From 5ea287ca84c2a85fd599dc29869dfeb1548cd455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20R=C3=BCsch?= <78490564+maximilianruesch@users.noreply.github.com> Date: Fri, 13 Jan 2023 19:25:22 +0100 Subject: [PATCH] Rebuild web client using npm, ts and vuejs (#1) --- .github/workflows/format.yml | 20 +- .github/workflows/linux.yml | 4 + CMakeLists.txt | 3 +- web/CMakeLists.txt | 6 + web/client/.eslintrc.cjs | 74 + web/client/.gitignore | 2 + web/client/.stylelintrc.json | 10 + web/client/CMakeLists.txt | 20 +- web/client/README.md | 32 + .../components/disruption/disruption.css | 21 - .../components/disruption/disruption.html | 9 - .../components/disruption/disruption.js | 59 - .../infrastructure/InfrastructureComponent.js | 53 - .../infrastructure/deps/maplibre-gl.css | 1 - .../infrastructure/deps/maplibre-gl.js | 42 - .../infrastructure/deps/maplibre-gl.js.map | 1 - .../infrastructure/infrastructure.css | 49 - .../infrastructure_component.html | 26 - .../components/infrastructure/map/addIcons.js | 18 - .../infrastructure/map/elementTypes.js | 26 - .../infrastructure/map/infrastructureMap.js | 239 - .../components/infrastructure/map/mapStyle.js | 161 - .../station_detail/stationDetail.js | 80 - .../station_detail/station_detail.html | 21 - .../ordering_graph/OrderingGraphComponent.js | 13 - .../ordering_graph_component.html | 18 - .../simulation/SimulationComponent.js | 421 - web/client/components/simulation/Tooltip.js | 87 - .../components/simulation/simulation.css | 17 - .../simulation/simulation_component.html | 26 - .../timetable/TimetableComponent.js | 13 - .../timetable/timetable_component.html | 18 - web/client/deps/GoldenLayout/GoldenLayout.js | 6353 ------------- web/client/deps/d3/d3-array.js | 1026 --- web/client/deps/d3/d3-axis.js | 101 - web/client/deps/d3/d3-brush.js | 552 -- web/client/deps/d3/d3-chord.js | 205 - web/client/deps/d3/d3-color.js | 448 - web/client/deps/d3/d3-contour.js | 325 - web/client/deps/d3/d3-delaunay.js | 641 -- web/client/deps/d3/d3-dispatch.js | 86 - web/client/deps/d3/d3-drag.js | 210 - web/client/deps/d3/d3-dsv.js | 172 - web/client/deps/d3/d3-ease.js | 152 - web/client/deps/d3/d3-fetch.js | 74 - web/client/deps/d3/d3-force.js | 524 -- web/client/deps/d3/d3-format.js | 229 - web/client/deps/d3/d3-geo.js | 2374 ----- web/client/deps/d3/d3-hierarchy.js | 1025 --- web/client/deps/d3/d3-interpolate.js | 426 - web/client/deps/d3/d3-path.js | 76 - web/client/deps/d3/d3-polygon.js | 79 - web/client/deps/d3/d3-quadtree.js | 322 - web/client/deps/d3/d3-random.js | 272 - web/client/deps/d3/d3-scale-chromatic.js | 115 - web/client/deps/d3/d3-scale.js | 863 -- web/client/deps/d3/d3-selection.js | 809 -- web/client/deps/d3/d3-shape.js | 1742 ---- web/client/deps/d3/d3-time-format.js | 587 -- web/client/deps/d3/d3-time.js | 312 - web/client/deps/d3/d3-timer.js | 128 - web/client/deps/d3/d3-transition.js | 697 -- web/client/deps/d3/d3-zoom.js | 405 - web/client/deps/d3/d3.js | 31 - web/client/deps/d3/delaunator.js | 375 - web/client/deps/d3/internmap.js | 63 - web/client/deps/d3/robust-predicates.js | 2071 ----- web/client/index.html | 341 +- web/client/model/InfrastructureManager.js | 65 - web/client/model/TimetableManager.js | 101 - web/client/package-lock.json | 8068 +++++++++++++++++ web/client/package.json | 38 + web/client/src/App.vue | 95 + .../src/components/disruption-detail.vue | 86 + .../InfrastructureComponent.vue | 40 + .../OrderingGraphComponent.vue | 17 + .../SimulationComponent.vue | 119 + .../TimetableComponent.vue | 11 + .../src/components/infrastructure/addIcons.ts | 27 + .../components/infrastructure/elementTypes.ts | 23 + .../infrastructure/infrastructure-map.vue | 287 + .../infrastructure/infrastructureMap.ts | 60 + .../src/components/infrastructure/mapStyle.ts | 162 + .../src/components/simulation/Tooltip.js | 88 + .../src/components/simulation/d3Graph.js | 363 + web/client/src/components/soro-button.vue | 32 + .../src/components/soro-collapsible.vue | 108 + web/client/src/components/soro-overlay.vue | 315 + web/client/src/components/soro-select.vue | 68 + web/client/src/components/station-detail.vue | 187 + .../golden-layout/golden-layout-adapter.vue | 255 + .../golden-layout/golden-layout-component.vue | 57 + .../golden-layout/golden-layout-constants.ts | 20 + web/client/src/main.ts | 16 + web/client/src/stores/infrastructure-store.ts | 62 + web/client/src/stores/timetable-store.ts | 103 + web/client/src/style.ts | 6 + web/client/{ => src}/style/material-icons.css | 2 + .../{ => src}/style/material-select.css | 1 + web/client/{ => src}/style/matter.css | 1 + web/client/src/style/style.css | 36 + web/client/{utl => src/util}/IDBFSHelper.js | 1 - web/client/src/util/Tooltip.js | 115 + web/client/src/util/iterate.js | 33 + web/client/src/vite-env.d.ts | 6 + web/client/style/collapsible.css | 83 - web/client/style/style.css | 251 - web/client/tsconfig.json | 30 + web/client/tsconfig.node.json | 9 + web/client/utl/Tooltip.js | 115 - web/client/utl/getFileContents.js | 18 - web/client/utl/goldenLayoutHelper.js | 46 - web/client/utl/iterate.js | 33 - web/client/vite.config.ts | 23 + 114 files changed, 11131 insertions(+), 26352 deletions(-) create mode 100644 web/client/.eslintrc.cjs create mode 100644 web/client/.gitignore create mode 100644 web/client/.stylelintrc.json create mode 100644 web/client/README.md delete mode 100644 web/client/components/disruption/disruption.css delete mode 100644 web/client/components/disruption/disruption.html delete mode 100644 web/client/components/disruption/disruption.js delete mode 100644 web/client/components/infrastructure/InfrastructureComponent.js delete mode 100644 web/client/components/infrastructure/deps/maplibre-gl.css delete mode 100644 web/client/components/infrastructure/deps/maplibre-gl.js delete mode 100644 web/client/components/infrastructure/deps/maplibre-gl.js.map delete mode 100644 web/client/components/infrastructure/infrastructure.css delete mode 100644 web/client/components/infrastructure/infrastructure_component.html delete mode 100644 web/client/components/infrastructure/map/addIcons.js delete mode 100644 web/client/components/infrastructure/map/elementTypes.js delete mode 100644 web/client/components/infrastructure/map/infrastructureMap.js delete mode 100644 web/client/components/infrastructure/map/mapStyle.js delete mode 100644 web/client/components/infrastructure/station_detail/stationDetail.js delete mode 100644 web/client/components/infrastructure/station_detail/station_detail.html delete mode 100644 web/client/components/ordering_graph/OrderingGraphComponent.js delete mode 100644 web/client/components/ordering_graph/ordering_graph_component.html delete mode 100644 web/client/components/simulation/SimulationComponent.js delete mode 100644 web/client/components/simulation/Tooltip.js delete mode 100644 web/client/components/simulation/simulation.css delete mode 100644 web/client/components/simulation/simulation_component.html delete mode 100644 web/client/components/timetable/TimetableComponent.js delete mode 100644 web/client/components/timetable/timetable_component.html delete mode 100644 web/client/deps/GoldenLayout/GoldenLayout.js delete mode 100644 web/client/deps/d3/d3-array.js delete mode 100644 web/client/deps/d3/d3-axis.js delete mode 100644 web/client/deps/d3/d3-brush.js delete mode 100644 web/client/deps/d3/d3-chord.js delete mode 100644 web/client/deps/d3/d3-color.js delete mode 100644 web/client/deps/d3/d3-contour.js delete mode 100644 web/client/deps/d3/d3-delaunay.js delete mode 100644 web/client/deps/d3/d3-dispatch.js delete mode 100644 web/client/deps/d3/d3-drag.js delete mode 100644 web/client/deps/d3/d3-dsv.js delete mode 100644 web/client/deps/d3/d3-ease.js delete mode 100644 web/client/deps/d3/d3-fetch.js delete mode 100644 web/client/deps/d3/d3-force.js delete mode 100644 web/client/deps/d3/d3-format.js delete mode 100644 web/client/deps/d3/d3-geo.js delete mode 100644 web/client/deps/d3/d3-hierarchy.js delete mode 100644 web/client/deps/d3/d3-interpolate.js delete mode 100644 web/client/deps/d3/d3-path.js delete mode 100644 web/client/deps/d3/d3-polygon.js delete mode 100644 web/client/deps/d3/d3-quadtree.js delete mode 100644 web/client/deps/d3/d3-random.js delete mode 100644 web/client/deps/d3/d3-scale-chromatic.js delete mode 100644 web/client/deps/d3/d3-scale.js delete mode 100644 web/client/deps/d3/d3-selection.js delete mode 100644 web/client/deps/d3/d3-shape.js delete mode 100644 web/client/deps/d3/d3-time-format.js delete mode 100644 web/client/deps/d3/d3-time.js delete mode 100644 web/client/deps/d3/d3-timer.js delete mode 100644 web/client/deps/d3/d3-transition.js delete mode 100644 web/client/deps/d3/d3-zoom.js delete mode 100644 web/client/deps/d3/d3.js delete mode 100644 web/client/deps/d3/delaunator.js delete mode 100644 web/client/deps/d3/internmap.js delete mode 100644 web/client/deps/d3/robust-predicates.js delete mode 100644 web/client/model/InfrastructureManager.js delete mode 100644 web/client/model/TimetableManager.js create mode 100644 web/client/package-lock.json create mode 100644 web/client/package.json create mode 100644 web/client/src/App.vue create mode 100644 web/client/src/components/disruption-detail.vue create mode 100644 web/client/src/components/golden-layout-components/InfrastructureComponent.vue create mode 100644 web/client/src/components/golden-layout-components/OrderingGraphComponent.vue create mode 100644 web/client/src/components/golden-layout-components/SimulationComponent.vue create mode 100644 web/client/src/components/golden-layout-components/TimetableComponent.vue create mode 100644 web/client/src/components/infrastructure/addIcons.ts create mode 100644 web/client/src/components/infrastructure/elementTypes.ts create mode 100644 web/client/src/components/infrastructure/infrastructure-map.vue create mode 100644 web/client/src/components/infrastructure/infrastructureMap.ts create mode 100644 web/client/src/components/infrastructure/mapStyle.ts create mode 100644 web/client/src/components/simulation/Tooltip.js create mode 100644 web/client/src/components/simulation/d3Graph.js create mode 100644 web/client/src/components/soro-button.vue create mode 100644 web/client/src/components/soro-collapsible.vue create mode 100644 web/client/src/components/soro-overlay.vue create mode 100644 web/client/src/components/soro-select.vue create mode 100644 web/client/src/components/station-detail.vue create mode 100644 web/client/src/golden-layout/golden-layout-adapter.vue create mode 100644 web/client/src/golden-layout/golden-layout-component.vue create mode 100644 web/client/src/golden-layout/golden-layout-constants.ts create mode 100644 web/client/src/main.ts create mode 100644 web/client/src/stores/infrastructure-store.ts create mode 100644 web/client/src/stores/timetable-store.ts create mode 100644 web/client/src/style.ts rename web/client/{ => src}/style/material-icons.css (97%) rename web/client/{ => src}/style/material-select.css (99%) rename web/client/{ => src}/style/matter.css (99%) create mode 100644 web/client/src/style/style.css rename web/client/{utl => src/util}/IDBFSHelper.js (99%) create mode 100644 web/client/src/util/Tooltip.js create mode 100644 web/client/src/util/iterate.js create mode 100644 web/client/src/vite-env.d.ts delete mode 100644 web/client/style/collapsible.css delete mode 100644 web/client/style/style.css create mode 100644 web/client/tsconfig.json create mode 100644 web/client/tsconfig.node.json delete mode 100644 web/client/utl/Tooltip.js delete mode 100644 web/client/utl/getFileContents.js delete mode 100644 web/client/utl/goldenLayoutHelper.js delete mode 100644 web/client/utl/iterate.js create mode 100644 web/client/vite.config.ts diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 9a6975e7..e3a4f86d 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -27,4 +27,22 @@ jobs: run: | git status --porcelain git diff - git status --porcelain | xargs -I {} -0 test -z \"{}\" \ No newline at end of file + git status --porcelain | xargs -I {} -0 test -z \"{}\" + + linting: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v3 + with: + node-version: 19.1 + + # ==== WEB LINT ==== + - name: Install deps + run: npm clean-install --prefix web/client + + - name: Run ESLint + run: npm run lint:eslint --prefix web/client + + - name: Run Stylelint + run: npm run lint:stylelint --prefix web/client \ No newline at end of file diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 2efccab3..74b207fd 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -37,6 +37,9 @@ jobs: steps: - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 19.1 - name: Get deps run: ln -s /deps deps @@ -59,6 +62,7 @@ jobs: - name: Build run: | buildcache -z + npm clean-install --prefix web/client cmake --build build/${{ matrix.config.preset }} --target soro-server buildcache -s diff --git a/CMakeLists.txt b/CMakeLists.txt index e1bd0193..90b1a781 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -150,8 +150,7 @@ endif () # Gets us the soro-server-client target set(SORO_SERVER_DIR ${CMAKE_CURRENT_BINARY_DIR}) -add_subdirectory(web/server) -add_subdirectory(web/client) +add_subdirectory(web) # Generate file_paths.h for locating the test resources configure_file(test/include/test/file_paths.h.in diff --git a/web/CMakeLists.txt b/web/CMakeLists.txt index e69de29b..60329938 100644 --- a/web/CMakeLists.txt +++ b/web/CMakeLists.txt @@ -0,0 +1,6 @@ +add_subdirectory(server) +add_subdirectory(client) + +add_custom_target(soro-server-client) +add_dependencies(soro-server-client soro-server) +add_dependencies(soro-server-client soro-client-production) \ No newline at end of file diff --git a/web/client/.eslintrc.cjs b/web/client/.eslintrc.cjs new file mode 100644 index 00000000..d214ea93 --- /dev/null +++ b/web/client/.eslintrc.cjs @@ -0,0 +1,74 @@ +module.exports = { + root: true, + env: { + browser: true, + es2021: true + }, + extends: [ + 'eslint:recommended', + 'plugin:vue/vue3-essential', + 'plugin:vue/vue3-recommended', + '@vue/eslint-config-typescript', + '@vue/eslint-config-typescript/recommended', + ], + overrides: [], + parser: 'vue-eslint-parser', + parserOptions: { + parser: '@typescript-eslint/parser', + ecmaVersion: 'latest', + sourceType: 'module' + }, + plugins: [ + 'vue', + '@typescript-eslint' + ], + rules: { + 'indent': [ + 'error', + 4 + ], + 'curly': [ + 'error', + 'all' + ], + 'brace-style': [ + 'error', + '1tbs' + ], + 'function-paren-newline': [ + 'error', + 'multiline' + ], + 'linebreak-style': [ + 'error', + 'unix' + ], + 'quotes': [ + 'error', + 'single' + ], + 'semi': [ + 'error', + 'always' + ], + 'comma-dangle': [ + 'error', + 'only-multiline', + ], + 'object-curly-spacing': [ + 'error', + 'always', + ], + 'object-shorthand': [ + 'error', + 'properties', + { avoidQuotes: true } + ], + 'vue/html-indent': [ + 'error', + 4, + ], + '@typescript-eslint/no-explicit-any': 0, + '@typescript-eslint/ban-ts-comment': 0, + } +}; diff --git a/web/client/.gitignore b/web/client/.gitignore new file mode 100644 index 00000000..76add878 --- /dev/null +++ b/web/client/.gitignore @@ -0,0 +1,2 @@ +node_modules +dist \ No newline at end of file diff --git a/web/client/.stylelintrc.json b/web/client/.stylelintrc.json new file mode 100644 index 00000000..c6b88662 --- /dev/null +++ b/web/client/.stylelintrc.json @@ -0,0 +1,10 @@ +{ + "extends": [ + "stylelint-config-standard-scss", + "stylelint-config-recommended-vue" + ], + "ignoreFiles": ["**/*.js", "**/*.ts"], + "rules": { + "indentation": 4 + } +} \ No newline at end of file diff --git a/web/client/CMakeLists.txt b/web/client/CMakeLists.txt index 8a4d5354..2a47d3e1 100644 --- a/web/client/CMakeLists.txt +++ b/web/client/CMakeLists.txt @@ -1,19 +1,7 @@ cmake_minimum_required(VERSION 3.18) project(soro) -file(GLOB_RECURSE soro-client-files - *.html - *.css - *.js - *.ico - *.png - *.svg - *.map) - -foreach (file ${soro-client-files}) - set(path ${file}) - cmake_path(RELATIVE_PATH path BASE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_VARIABLE relative-path) - configure_file(${file} ${SORO_SERVER_DIR}/server_resources/${relative-path} COPYONLY) -endforeach () - - +add_custom_target(soro-client-production COMMAND npm run build WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) +add_custom_command(TARGET soro-client-production POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory + ${CMAKE_CURRENT_SOURCE_DIR}/dist + ${SORO_SERVER_DIR}/server_resources) diff --git a/web/client/README.md b/web/client/README.md new file mode 100644 index 00000000..71ab0a8c --- /dev/null +++ b/web/client/README.md @@ -0,0 +1,32 @@ +## SORO-S Webclient + +### Tools: +- Node.js (preferably install via [nvm](https://github.com/nvm-sh/nvm)) + +### Setup: + +Have nodejs installed with npm available globally (enabled by default). Execute the following in this directory: + +```shell +npm install +``` + +### Development + +```shell +npm run dev +``` +You can access the client with hmr now on the port shown in the console (usually [5173](http://localhost:5173)). + +### Building the web interface for production + +If you never ran ninja before, run it now in your `build/{clang,gcc}-release` directory. +```shell +ninja +``` + +Then simply execute +```shell +ninja soro-client-production +``` +This target has also been added to the `soro-server-client` target for convenience. diff --git a/web/client/components/disruption/disruption.css b/web/client/components/disruption/disruption.css deleted file mode 100644 index efad8a6b..00000000 --- a/web/client/components/disruption/disruption.css +++ /dev/null @@ -1,21 +0,0 @@ -.disruption-detail { - margin-top: 10px; - - background: transparent; - color: #777; - width: 100%; - height: 100%; - box-shadow: 3px 3px 2px rgba(0, 0, 0, 0.2); - cursor: pointer; - display: flex; - align-items: center; - justify-content: center; - opacity: 1; - transition: all 0.2s ease; - flex-direction: column; - visibility: visible; -} - -.disruption-detail.hidden { - left: calc(0px - calc(var(--overlay-width) + var(--overlay-padding-left))); -} diff --git a/web/client/components/disruption/disruption.html b/web/client/components/disruption/disruption.html deleted file mode 100644 index 1be10f63..00000000 --- a/web/client/components/disruption/disruption.html +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/web/client/components/disruption/disruption.js b/web/client/components/disruption/disruption.js deleted file mode 100644 index 5fb1ddc6..00000000 --- a/web/client/components/disruption/disruption.js +++ /dev/null @@ -1,59 +0,0 @@ -import { getFileContents } from "../../utl/getFileContents.js"; -import { iterate } from "../../utl/iterate.js"; - -function createInputField(name, maxSpeedsDiv) { - let input = document.createElement('input'); - input.type = 'text'; - input.id = name + 'Input'; - input.name = name; - input.value = disruptionMap.get(name); - - input.addEventListener('input', - e => disruptionMap.set(e.target.name, e.target.value)); - - let label = document.createElement('label'); - label.htmlFor = input.id; - label.innerText = name + ' '; - - let br = document.createElement('br'); - - maxSpeedsDiv.appendChild(label); - maxSpeedsDiv.appendChild(input); - maxSpeedsDiv.appendChild(br); - maxSpeedsDiv.appendChild(br); - -} - -function fillDisruptionDetail(currentTimetable, maxSpeedsDiv) { - for (const train_run of iterate(currentTimetable.trainRuns)) { - createInputField(train_run.name, maxSpeedsDiv); - } - - let br = document.createElement('br'); - - let distsLabel = document.createElement('label'); - distsLabel.classList.add('matter-switch'); - - let distsInput = document.createElement('input'); - distsInput.type = 'checkbox'; - distsInput.value = 'UseDists'; - distsInput.checked = disruptionDists; - distsInput.addEventListener('input', e => disruptionDists = e.target.checked); - - let span = document.createElement('span'); - span.innerHTML = 'Use Distributions'; - - distsLabel.append(distsInput); - distsLabel.append(span); - maxSpeedsDiv.appendChild(distsLabel); -} - -export function showDisruptionDetail(currentTimetable) { - getFileContents("./components/disruption/disruption.html") - .then(html => { - document.getElementById('subOverlayContent').innerHTML = html; - - let maxSpeeds = document.getElementById('trainMaxSpeeds'); - fillDisruptionDetail(currentTimetable, maxSpeeds); - }); -} \ No newline at end of file diff --git a/web/client/components/infrastructure/InfrastructureComponent.js b/web/client/components/infrastructure/InfrastructureComponent.js deleted file mode 100644 index 332e4fe0..00000000 --- a/web/client/components/infrastructure/InfrastructureComponent.js +++ /dev/null @@ -1,53 +0,0 @@ -import { getFileContents } from "../../utl/getFileContents.js"; -import { ClickTooltip } from "../../utl/Tooltip.js"; -import { - createMap, - deHighlightSignalStationRoute, - deHighlightStationRoute, - highlightSignalStationRoute, - highlightStationRoute -} from "./map/infrastructureMap.js"; - -export class InfrastructureComponent { - _libreGLMap = undefined; - _tooltip = undefined; - - constructor(container, componentState) { - this.container = container; - this.rootElement = container.element; - - getFileContents("./components/infrastructure/infrastructure_component.html") - .then((html) => { - this.rootElement.innerHTML = html; - }).then(() => { - - this._tooltip = new ClickTooltip(this.rootElement, 'infrastructureTooltip'); - - container.on('resize', () => this._libreGLMap?.resize()); - }).then(() => { - this.changeInfrastructure(componentState.getCurrentInfrastructure()); - }); - } - - changeInfrastructure(newInfrastructureName) { - this._libreGLMap = newInfrastructureName - ? createMap(this.rootElement, newInfrastructureName, this._tooltip) - : undefined; - } - - highlightSignalStationRoute(signalStationRouteID) { - highlightSignalStationRoute(this._libreGLMap, window.infrastructureManager.get(), signalStationRouteID); - } - - deHighlightSignalStationRoute(signalStationRouteID) { - deHighlightSignalStationRoute(this._libreGLMap, window.infrastructureManager.get(), signalStationRouteID); - } - - highlightStationRoute(stationRouteID) { - highlightStationRoute(this._libreGLMap, window.infrastructureManager.get(), stationRouteID); - } - - deHighlightStationRoute(stationRouteID) { - deHighlightStationRoute(this._libreGLMap, stationRouteID); - } -} diff --git a/web/client/components/infrastructure/deps/maplibre-gl.css b/web/client/components/infrastructure/deps/maplibre-gl.css deleted file mode 100644 index 9fa34d5b..00000000 --- a/web/client/components/infrastructure/deps/maplibre-gl.css +++ /dev/null @@ -1 +0,0 @@ -.mapboxgl-map,.maplibregl-map{font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative;-webkit-tap-highlight-color:rgba(0,0,0,0)}.mapboxgl-canvas,.maplibregl-canvas{position:absolute;left:0;top:0}.mapboxgl-map:-webkit-full-screen,.maplibregl-map:-webkit-full-screen{width:100%;height:100%}.mapboxgl-canvas-container.mapboxgl-interactive,.mapboxgl-ctrl-group button.mapboxgl-ctrl-compass,.maplibregl-canvas-container.maplibregl-interactive,.maplibregl-ctrl-group button.maplibregl-ctrl-compass{cursor:-webkit-grab;cursor:-moz-grab;cursor:grab;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.mapboxgl-canvas-container.mapboxgl-interactive.mapboxgl-track-pointer,.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.mapboxgl-canvas-container.mapboxgl-interactive:active,.mapboxgl-ctrl-group button.mapboxgl-ctrl-compass:active,.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate,.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate .mapboxgl-canvas,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.mapboxgl-canvas-container.mapboxgl-touch-drag-pan,.mapboxgl-canvas-container.mapboxgl-touch-drag-pan .mapboxgl-canvas,.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate.mapboxgl-touch-drag-pan,.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate.mapboxgl-touch-drag-pan .mapboxgl-canvas,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.mapboxgl-ctrl-bottom-left,.mapboxgl-ctrl-bottom-right,.mapboxgl-ctrl-top-left,.mapboxgl-ctrl-top-right,.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{position:absolute;pointer-events:none;z-index:2}.mapboxgl-ctrl-top-left,.maplibregl-ctrl-top-left{top:0;left:0}.mapboxgl-ctrl-top-right,.maplibregl-ctrl-top-right{top:0;right:0}.mapboxgl-ctrl-bottom-left,.maplibregl-ctrl-bottom-left{bottom:0;left:0}.mapboxgl-ctrl-bottom-right,.maplibregl-ctrl-bottom-right{right:0;bottom:0}.mapboxgl-ctrl,.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.mapboxgl-ctrl-top-left .mapboxgl-ctrl,.maplibregl-ctrl-top-left .maplibregl-ctrl{margin:10px 0 0 10px;float:left}.mapboxgl-ctrl-top-right .mapboxgl-ctrl,.maplibregl-ctrl-top-right .maplibregl-ctrl{margin:10px 10px 0 0;float:right}.mapboxgl-ctrl-bottom-left .mapboxgl-ctrl,.maplibregl-ctrl-bottom-left .maplibregl-ctrl{margin:0 0 10px 10px;float:left}.mapboxgl-ctrl-bottom-right .mapboxgl-ctrl,.maplibregl-ctrl-bottom-right .maplibregl-ctrl{margin:0 10px 10px 0;float:right}.mapboxgl-ctrl-group,.maplibregl-ctrl-group{border-radius:4px;background:#fff}.mapboxgl-ctrl-group:not(:empty),.maplibregl-ctrl-group:not(:empty){-moz-box-shadow:0 0 2px rgba(0,0,0,.1);-webkit-box-shadow:0 0 2px rgba(0,0,0,.1);box-shadow:0 0 0 2px rgba(0,0,0,.1)}@media (-ms-high-contrast:active){.mapboxgl-ctrl-group:not(:empty),.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.mapboxgl-ctrl-group button,.maplibregl-ctrl-group button{width:29px;height:29px;display:block;padding:0;outline:none;border:0;box-sizing:border-box;background-color:transparent;cursor:pointer}.mapboxgl-ctrl-group button+button,.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.mapboxgl-ctrl button .mapboxgl-ctrl-icon,.maplibregl-ctrl button .maplibregl-ctrl-icon{display:block;width:100%;height:100%;background-repeat:no-repeat;background-position:50%}@media (-ms-high-contrast:active){.mapboxgl-ctrl-icon,.maplibregl-ctrl-icon{background-color:transparent}.mapboxgl-ctrl-group button+button,.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.mapboxgl-ctrl button::-moz-focus-inner,.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.mapboxgl-ctrl-attrib-button:focus,.mapboxgl-ctrl-group button:focus,.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.mapboxgl-ctrl button:disabled,.maplibregl-ctrl button:disabled{cursor:not-allowed}.mapboxgl-ctrl button:disabled .mapboxgl-ctrl-icon,.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}.mapboxgl-ctrl button:not(:disabled):hover,.maplibregl-ctrl button:not(:disabled):hover{background-color:rgba(0,0,0,.05)}.mapboxgl-ctrl-group button:focus:focus-visible,.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.mapboxgl-ctrl-group button:focus:not(:focus-visible),.maplibregl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.mapboxgl-ctrl-group button:focus:first-child,.maplibregl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.mapboxgl-ctrl-group button:focus:last-child,.maplibregl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.mapboxgl-ctrl-group button:focus:only-child,.maplibregl-ctrl-group button:focus:only-child{border-radius:inherit}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E")}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23fff'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23fff'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E")}}.mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E")}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23fff'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23fff'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E")}}.mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E%3Cpath d='M10.5 14l4-8 4 8h-8z'/%3E%3Cpath d='M10.5 16l4 8 4-8h-8z' fill='%23ccc'/%3E%3C/svg%3E")}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23fff'%3E%3Cpath d='M10.5 14l4-8 4 8h-8z'/%3E%3Cpath d='M10.5 16l4 8 4-8h-8z' fill='%23999'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10.5 14l4-8 4 8h-8z'/%3E%3Cpath d='M10.5 16l4 8 4-8h-8z' fill='%23ccc'/%3E%3C/svg%3E")}}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate:disabled .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23aaa'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath d='M14 5l1 1-9 9-1-1 9-9z' fill='red'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active-error .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e58978'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background-error .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e54e33'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-waiting .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{-webkit-animation:maplibregl-spin 2s linear infinite;-moz-animation:maplibregl-spin 2s infinite linear;-o-animation:maplibregl-spin 2s infinite linear;-ms-animation:maplibregl-spin 2s infinite linear;animation:maplibregl-spin 2s linear infinite}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23fff'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate:disabled .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23999'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath d='M14 5l1 1-9 9-1-1 9-9z' fill='red'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active-error .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e58978'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background-error .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e54e33'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate:disabled .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23666'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath d='M14 5l1 1-9 9-1-1 9-9z' fill='red'/%3E%3C/svg%3E")}}@-webkit-keyframes maplibregl-spin{0%{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(1turn)}}@-moz-keyframes maplibregl-spin{0%{-moz-transform:rotate(0deg)}to{-moz-transform:rotate(1turn)}}@-o-keyframes maplibregl-spin{0%{-o-transform:rotate(0deg)}to{-o-transform:rotate(1turn)}}@-ms-keyframes maplibregl-spin{0%{-ms-transform:rotate(0deg)}to{-ms-transform:rotate(1turn)}}@keyframes maplibregl-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}a.mapboxgl-ctrl-logo,a.maplibregl-ctrl-logo{width:88px;height:23px;margin:0 0 -4px -4px;display:block;background-repeat:no-repeat;cursor:pointer;overflow:hidden;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42l-.726 3.663a1.255 1.255 0 01-1.232 1.011h-1.827a1.255 1.255 0 01-1.229-1.509l2.501-12.095a1.255 1.255 0 011.23-1.001h.197a1.255 1.255 0 011.12.685l3.19 6.273 3.125-6.263a1.255 1.255 0 011.123-.695h.181a1.255 1.255 0 011.227.991l1.443 6.71a5.11 5.11 0 01.314-.787l.009-.016a4.623 4.623 0 011.777-1.887c.782-.46 1.668-.667 2.611-.667a4.548 4.548 0 011.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 011.212.925 1.255 1.255 0 011.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4.314.319.566.676.763 1.064V4.701a1.255 1.255 0 011.255-1.255h1.86A1.255 1.255 0 0154.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.416 2.416 0 01-.682-1.71c0-.665.267-1.253.735-1.7a2.448 2.448 0 011.722-.674 2.43 2.43 0 011.705.675c.211.2.381.43.504.683V4.7a1.255 1.255 0 011.255-1.255h1.744A1.255 1.255 0 0165.812 4.7v3.335a4.76 4.76 0 011.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 011.67 1.743v-.98a1.255 1.255 0 011.256-1.256h1.777c.233 0 .451.064.639.174a3.407 3.407 0 011.567-.372c.346 0 .861.02 1.285.232a1.255 1.255 0 01.689 1.004 4.73 4.73 0 01.853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528 0 .343-.02.694-.056 1.051a1.255 1.255 0 01-.947 1.09l.408.952a1.255 1.255 0 01-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.815 5.815 0 01-.548-2.512c0-.286.017-.567.053-.843a1.255 1.255 0 01-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 01-1.256 1.256h-1.777a1.255 1.255 0 01-1.256-1.256V15.69l-.032.057a4.778 4.778 0 01-1.86 1.833 5.04 5.04 0 01-2.484.634 4.47 4.47 0 01-1.935-.424 1.252 1.252 0 01-.764.258h-1.71a1.255 1.255 0 01-1.256-1.255V7.687a2.402 2.402 0 01-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 01-1.256 1.255h-1.843a1.25 1.25 0 01-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 01-1.256-1.255v-1.251l-.061.117a4.703 4.703 0 01-1.782 1.884 4.767 4.767 0 01-2.485.67 5.6 5.6 0 01-1.485-.188l.009 2.764a1.255 1.255 0 01-1.255 1.259h-1.729a1.255 1.255 0 01-1.255-1.255v-3.537a1.255 1.255 0 01-1.167.793h-1.679a1.25 1.25 0 01-.77-.263 4.47 4.47 0 01-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a4.983 4.983 0 01-1.081-.836 1.255 1.255 0 01-1.254 1.312h-1.81a1.255 1.255 0 01-1.228-.99l-.782-3.625-2.044 3.939a1.255 1.255 0 01-1.115.676h-.098a1.255 1.255 0 01-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15c.329-.237.574-.499.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267c-.088-.22-.264-.438-.526-.658l-.032-.028a3.16 3.16 0 00-.668-.428l-.27-.12a3.293 3.293 0 00-1.235-.23c-.757 0-1.415.163-1.974.493a3.36 3.36 0 00-1.3 1.382c-.297.593-.444 1.284-.444 2.074 0 .8.17 1.503.51 2.107a3.795 3.795 0 001.382 1.381 3.883 3.883 0 001.893.477c.53 0 1.015-.11 1.455-.33zm-2.789-5.38c-.384.45-.575 1.038-.575 1.762 0 .735.186 1.332.559 1.794.384.45.933.675 1.645.675a2.25 2.25 0 00.934-.19 2.17 2.17 0 00.468-.29l.178-.161a2.163 2.163 0 00.397-.561c.163-.333.244-.717.244-1.15v-.115c0-.472-.098-.894-.296-1.267l-.043-.077a2.211 2.211 0 00-.633-.709l-.13-.086-.047-.028a2.099 2.099 0 00-1.073-.285c-.702 0-1.244.231-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.958.958 0 00-.353-.389.851.851 0 00-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.626 2.626 0 00.331.423c.213.22.464.402.755.548l.173.074c.433.17.93.255 1.49.255.68 0 1.295-.165 1.844-.493a3.447 3.447 0 001.316-1.4c.329-.603.493-1.299.493-2.089 0-1.273-.33-2.243-.988-2.913-.658-.68-1.52-1.02-2.584-1.02-.598 0-1.124.115-1.575.347a2.807 2.807 0 00-.415.262l-.199.166a3.35 3.35 0 00-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138c.137.193.297.36.48.5l.155.11.053.034c.34.197.713.297 1.119.297.714 0 1.262-.225 1.645-.675.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.29 0-.569.053-.835.16a2.366 2.366 0 00-.284.136 1.99 1.99 0 00-.363.254 2.237 2.237 0 00-.46.569l-.082.162a2.56 2.56 0 00-.213 1.072v.115c0 .471.098.894.296 1.267l.135.211zm.964-.818a1.11 1.11 0 00.367.385.937.937 0 00.476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a.995.995 0 00-.503.135l-.012.007a.859.859 0 00-.335.343c-.073.133-.132.324-.132.614v.115a1.43 1.43 0 00.14.66zm15.7-6.222c.232-.23.346-.516.346-.856a1.053 1.053 0 00-.345-.79 1.175 1.175 0 00-.84-.329c-.34 0-.625.11-.855.33a1.053 1.053 0 00-.346.79c0 .34.115.625.346.855.23.23.516.346.856.346.34 0 .62-.115.839-.346zm4.337 9.314l.033-1.332c.128.269.324.518.59.747l.098.081a3.727 3.727 0 00.316.224l.223.122a3.21 3.21 0 001.44.322 3.785 3.785 0 001.875-.477 3.52 3.52 0 001.382-1.366c.352-.593.526-1.29.526-2.09 0-.79-.147-1.48-.444-2.073a3.235 3.235 0 00-1.283-1.399c-.549-.34-1.195-.51-1.942-.51a3.476 3.476 0 00-1.527.344l-.086.043-.165.09a3.412 3.412 0 00-.33.214c-.288.21-.507.446-.656.707a1.893 1.893 0 00-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.482 2.482 0 00.566.7c.078.065.159.125.245.18l.144.08a2.105 2.105 0 00.975.232c.713 0 1.262-.225 1.645-.675.384-.46.576-1.053.576-1.778 0-.734-.192-1.327-.576-1.777-.373-.46-.921-.692-1.645-.692a2.18 2.18 0 00-1.015.235c-.147.075-.285.17-.415.282l-.15.142a2.086 2.086 0 00-.42.594c-.149.32-.223.685-.223 1.1v.115c0 .47.097.89.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.868.868 0 00-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.13 1.13 0 00.367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013c.23-.087.472-.134.724-.14l.069-.002c.329 0 .542.033.642.099l.247-1.794c-.13-.066-.37-.099-.717-.099a2.3 2.3 0 00-.545.063 2.086 2.086 0 00-.411.148 2.18 2.18 0 00-.4.249 2.482 2.482 0 00-.485.499 2.659 2.659 0 00-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884c0-.364.053-.678.159-.943a1.49 1.49 0 01.466-.636 2.52 2.52 0 01.399-.253 2.19 2.19 0 01.224-.099zm9.784 2.656l.05-.922c0-1.162-.285-2.062-.856-2.698-.559-.647-1.42-.97-2.584-.97-.746 0-1.415.163-2.007.493a3.462 3.462 0 00-1.4 1.382c-.329.604-.493 1.306-.493 2.106 0 .714.143 1.371.428 1.975.285.593.73 1.07 1.332 1.432.604.351 1.355.526 2.255.526.649 0 1.204-.062 1.668-.185l.044-.012.135-.04c.409-.122.736-.263.984-.421l-.542-1.267c-.2.108-.415.199-.642.274l-.297.087c-.34.088-.773.131-1.3.131-.636 0-1.135-.147-1.497-.444a1.573 1.573 0 01-.192-.193c-.244-.294-.415-.705-.512-1.234l-.004-.021h5.43zm-5.427-1.256l-.003.022h3.752v-.138c-.007-.485-.104-.857-.288-1.118a1.056 1.056 0 00-.156-.176c-.307-.285-.746-.428-1.316-.428-.657 0-1.155.202-1.494.604-.253.3-.417.712-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z' fill='%23000' fill-opacity='.4' fill-rule='evenodd'/%3E%3Cpath d='M19.63 11.151l-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81c-.68 0-1.311-.16-1.893-.478a3.795 3.795 0 01-1.381-1.382c-.34-.604-.51-1.306-.51-2.106 0-.79.147-1.482.444-2.074a3.364 3.364 0 011.3-1.382c.559-.33 1.217-.494 1.974-.494a3.293 3.293 0 011.234.231 3.341 3.341 0 01.97.575c.264.22.44.439.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332c-.186.395-.526.746-1.02 1.053a3.167 3.167 0 01-1.662.444zm.296-1.482c.626 0 1.152-.214 1.58-.642.428-.44.642-1.01.642-1.711v-.115c0-.472-.098-.894-.296-1.267a2.211 2.211 0 00-.807-.872 2.098 2.098 0 00-1.119-.313c-.702 0-1.245.231-1.629.692-.384.45-.575 1.037-.575 1.76 0 .736.186 1.333.559 1.795.384.45.933.675 1.645.675zm6.521-6.237h1.711v1.4c.604-1.065 1.547-1.597 2.83-1.597 1.064 0 1.926.34 2.584 1.02.659.67.988 1.641.988 2.914 0 .79-.164 1.487-.493 2.09a3.456 3.456 0 01-1.316 1.399 3.51 3.51 0 01-1.844.493c-.636 0-1.19-.11-1.662-.329a2.665 2.665 0 01-1.086-.97l.017 5.134h-1.728V9.242zm4.048 6.22c.714 0 1.262-.224 1.645-.674.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.395 0-.768.098-1.12.296-.34.187-.613.46-.822.823-.197.351-.296.763-.296 1.234v.115c0 .472.098.894.296 1.267.209.362.483.647.823.855.34.197.713.297 1.119.297z' fill='%23fff'/%3E%3Cpath d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.159 1.159 0 01-.856-.346 1.165 1.165 0 01-.346-.856 1.053 1.053 0 01.346-.79c.23-.219.516-.329.856-.329.329 0 .609.11.839.33a1.053 1.053 0 01.345.79 1.159 1.159 0 01-.345.855c-.22.23-.5.346-.84.346zm7.875 9.133a3.167 3.167 0 01-1.662-.444c-.482-.307-.817-.658-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283c.186-.438.548-.812 1.086-1.119a3.486 3.486 0 011.778-.477c.746 0 1.393.17 1.942.51a3.235 3.235 0 011.283 1.4c.297.592.444 1.282.444 2.072 0 .8-.175 1.498-.526 2.09a3.52 3.52 0 01-1.382 1.366 3.785 3.785 0 01-1.876.477zm-.296-1.481c.713 0 1.26-.225 1.645-.675.384-.46.577-1.053.577-1.778 0-.734-.193-1.327-.577-1.776-.373-.46-.921-.692-1.645-.692a2.115 2.115 0 00-1.58.659c-.428.428-.642.992-.642 1.694v.115c0 .473.098.895.296 1.267a2.385 2.385 0 00.807.872 2.1 2.1 0 001.119.313zm5.927-6.237h1.777v1.481c.176-.505.46-.91.856-1.217a2.14 2.14 0 011.349-.46c.351 0 .593.032.724.098l-.247 1.794c-.099-.066-.313-.099-.642-.099-.516 0-.988.164-1.416.494-.417.329-.626.855-.626 1.58v3.883h-1.777V9.242zm9.534 7.718c-.9 0-1.651-.175-2.255-.526-.603-.362-1.047-.84-1.332-1.432a4.567 4.567 0 01-.428-1.975c0-.8.164-1.502.493-2.106a3.462 3.462 0 011.4-1.382c.592-.33 1.262-.494 2.007-.494 1.163 0 2.024.324 2.584.97.57.637.856 1.537.856 2.7 0 .296-.017.603-.05.92h-5.43c.12.67.356 1.153.708 1.45.362.296.86.443 1.497.443.526 0 .96-.044 1.3-.131a4.123 4.123 0 00.938-.362l.542 1.267c-.274.175-.647.329-1.119.46-.472.132-1.042.197-1.711.197zm1.596-4.558c.01-.68-.137-1.158-.444-1.432-.307-.285-.746-.428-1.316-.428-1.152 0-1.815.62-1.991 1.86h3.752z' fill='%23e1e3e9'/%3E%3Cg fill-rule='evenodd' stroke-width='1.036'%3E%3Cpath d='M8.166 16.146l-.002.002a1.54 1.54 0 01-2.009 0l-.002-.002-.043-.034-.002-.002-.199-.162H4.377a.657.657 0 00-.659.659v1.84a.657.657 0 00.659.659h5.565a.657.657 0 00.659-.659v-1.84a.657.657 0 00-.659-.659H8.411l-.202.164zm-1.121-.905a.29.29 0 00.113.023.286.286 0 00.189-.07l.077-.063c.634-.508 4.672-3.743 4.672-7.575 0-2.55-2.215-4.625-4.938-4.625S2.221 5.006 2.221 7.556c0 3.225 2.86 6.027 4.144 7.137h.004l.04.038.484.4.077.063a.628.628 0 00.074.047zm-2.52-.548a16.898 16.898 0 01-1.183-1.315C2.187 11.942.967 9.897.967 7.555c0-3.319 2.855-5.88 6.192-5.88 3.338 0 6.193 2.561 6.193 5.881 0 2.34-1.22 4.387-2.376 5.822a16.898 16.898 0 01-1.182 1.315h.15a1.912 1.912 0 011.914 1.914v1.84a1.912 1.912 0 01-1.914 1.914H4.377a1.912 1.912 0 01-1.914-1.914v-1.84a1.912 1.912 0 011.914-1.914zm3.82-6.935c0 .692-.55 1.222-1.187 1.222s-1.185-.529-1.185-1.222.548-1.222 1.185-1.222c.638 0 1.186.529 1.186 1.222zm-1.186 2.477c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477zm2.048 7.71H5.114v-.838h4.093z' fill='%23000' fill-opacity='.4'/%3E%3Cpath d='M2.222 7.555c0-2.55 2.214-4.625 4.937-4.625 2.723 0 4.938 2.075 4.938 4.625 0 3.832-4.038 7.068-4.672 7.575l-.077.063a.286.286 0 01-.189.07.286.286 0 01-.188-.07l-.077-.063c-.634-.507-4.672-3.743-4.672-7.575zm4.937 2.68c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477z' fill='%23e1e3e9'/%3E%3Cpath d='M4.377 15.948a.657.657 0 00-.659.659v1.84a.657.657 0 00.659.659h5.565a.657.657 0 00.659-.659v-1.84a.657.657 0 00-.659-.659zm4.83 1.16H5.114v.838h4.093z' fill='%23fff'/%3E%3C/g%3E%3C/svg%3E")}a.mapboxgl-ctrl-logo.mapboxgl-compact,a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (-ms-high-contrast:active){a.mapboxgl-ctrl-logo,a.maplibregl-ctrl-logo{background-color:transparent;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42l-.726 3.663a1.255 1.255 0 01-1.232 1.011h-1.827a1.255 1.255 0 01-1.229-1.509l2.501-12.095a1.255 1.255 0 011.23-1.001h.197a1.255 1.255 0 011.12.685l3.19 6.273 3.125-6.263a1.255 1.255 0 011.123-.695h.181a1.255 1.255 0 011.227.991l1.443 6.71a5.11 5.11 0 01.314-.787l.009-.016a4.623 4.623 0 011.777-1.887c.782-.46 1.668-.667 2.611-.667a4.548 4.548 0 011.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 011.212.925 1.255 1.255 0 011.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4.314.319.566.676.763 1.064V4.701a1.255 1.255 0 011.255-1.255h1.86A1.255 1.255 0 0154.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.416 2.416 0 01-.682-1.71c0-.665.267-1.253.735-1.7a2.448 2.448 0 011.722-.674 2.43 2.43 0 011.705.675c.211.2.381.43.504.683V4.7a1.255 1.255 0 011.255-1.255h1.744A1.255 1.255 0 0165.812 4.7v3.335a4.76 4.76 0 011.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 011.67 1.743v-.98a1.255 1.255 0 011.256-1.256h1.777c.233 0 .451.064.639.174a3.407 3.407 0 011.567-.372c.346 0 .861.02 1.285.232a1.255 1.255 0 01.689 1.004 4.73 4.73 0 01.853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528 0 .343-.02.694-.056 1.051a1.255 1.255 0 01-.947 1.09l.408.952a1.255 1.255 0 01-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.815 5.815 0 01-.548-2.512c0-.286.017-.567.053-.843a1.255 1.255 0 01-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 01-1.256 1.256h-1.777a1.255 1.255 0 01-1.256-1.256V15.69l-.032.057a4.778 4.778 0 01-1.86 1.833 5.04 5.04 0 01-2.484.634 4.47 4.47 0 01-1.935-.424 1.252 1.252 0 01-.764.258h-1.71a1.255 1.255 0 01-1.256-1.255V7.687a2.402 2.402 0 01-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 01-1.256 1.255h-1.843a1.25 1.25 0 01-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 01-1.256-1.255v-1.251l-.061.117a4.703 4.703 0 01-1.782 1.884 4.767 4.767 0 01-2.485.67 5.6 5.6 0 01-1.485-.188l.009 2.764a1.255 1.255 0 01-1.255 1.259h-1.729a1.255 1.255 0 01-1.255-1.255v-3.537a1.255 1.255 0 01-1.167.793h-1.679a1.25 1.25 0 01-.77-.263 4.47 4.47 0 01-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a4.983 4.983 0 01-1.081-.836 1.255 1.255 0 01-1.254 1.312h-1.81a1.255 1.255 0 01-1.228-.99l-.782-3.625-2.044 3.939a1.255 1.255 0 01-1.115.676h-.098a1.255 1.255 0 01-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15c.329-.237.574-.499.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267c-.088-.22-.264-.438-.526-.658l-.032-.028a3.16 3.16 0 00-.668-.428l-.27-.12a3.293 3.293 0 00-1.235-.23c-.757 0-1.415.163-1.974.493a3.36 3.36 0 00-1.3 1.382c-.297.593-.444 1.284-.444 2.074 0 .8.17 1.503.51 2.107a3.795 3.795 0 001.382 1.381 3.883 3.883 0 001.893.477c.53 0 1.015-.11 1.455-.33zm-2.789-5.38c-.384.45-.575 1.038-.575 1.762 0 .735.186 1.332.559 1.794.384.45.933.675 1.645.675a2.25 2.25 0 00.934-.19 2.17 2.17 0 00.468-.29l.178-.161a2.163 2.163 0 00.397-.561c.163-.333.244-.717.244-1.15v-.115c0-.472-.098-.894-.296-1.267l-.043-.077a2.211 2.211 0 00-.633-.709l-.13-.086-.047-.028a2.099 2.099 0 00-1.073-.285c-.702 0-1.244.231-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.958.958 0 00-.353-.389.851.851 0 00-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.626 2.626 0 00.331.423c.213.22.464.402.755.548l.173.074c.433.17.93.255 1.49.255.68 0 1.295-.165 1.844-.493a3.447 3.447 0 001.316-1.4c.329-.603.493-1.299.493-2.089 0-1.273-.33-2.243-.988-2.913-.658-.68-1.52-1.02-2.584-1.02-.598 0-1.124.115-1.575.347a2.807 2.807 0 00-.415.262l-.199.166a3.35 3.35 0 00-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138c.137.193.297.36.48.5l.155.11.053.034c.34.197.713.297 1.119.297.714 0 1.262-.225 1.645-.675.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.29 0-.569.053-.835.16a2.366 2.366 0 00-.284.136 1.99 1.99 0 00-.363.254 2.237 2.237 0 00-.46.569l-.082.162a2.56 2.56 0 00-.213 1.072v.115c0 .471.098.894.296 1.267l.135.211zm.964-.818a1.11 1.11 0 00.367.385.937.937 0 00.476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a.995.995 0 00-.503.135l-.012.007a.859.859 0 00-.335.343c-.073.133-.132.324-.132.614v.115a1.43 1.43 0 00.14.66zm15.7-6.222c.232-.23.346-.516.346-.856a1.053 1.053 0 00-.345-.79 1.175 1.175 0 00-.84-.329c-.34 0-.625.11-.855.33a1.053 1.053 0 00-.346.79c0 .34.115.625.346.855.23.23.516.346.856.346.34 0 .62-.115.839-.346zm4.337 9.314l.033-1.332c.128.269.324.518.59.747l.098.081a3.727 3.727 0 00.316.224l.223.122a3.21 3.21 0 001.44.322 3.785 3.785 0 001.875-.477 3.52 3.52 0 001.382-1.366c.352-.593.526-1.29.526-2.09 0-.79-.147-1.48-.444-2.073a3.235 3.235 0 00-1.283-1.399c-.549-.34-1.195-.51-1.942-.51a3.476 3.476 0 00-1.527.344l-.086.043-.165.09a3.412 3.412 0 00-.33.214c-.288.21-.507.446-.656.707a1.893 1.893 0 00-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.482 2.482 0 00.566.7c.078.065.159.125.245.18l.144.08a2.105 2.105 0 00.975.232c.713 0 1.262-.225 1.645-.675.384-.46.576-1.053.576-1.778 0-.734-.192-1.327-.576-1.777-.373-.46-.921-.692-1.645-.692a2.18 2.18 0 00-1.015.235c-.147.075-.285.17-.415.282l-.15.142a2.086 2.086 0 00-.42.594c-.149.32-.223.685-.223 1.1v.115c0 .47.097.89.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.868.868 0 00-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.13 1.13 0 00.367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013c.23-.087.472-.134.724-.14l.069-.002c.329 0 .542.033.642.099l.247-1.794c-.13-.066-.37-.099-.717-.099a2.3 2.3 0 00-.545.063 2.086 2.086 0 00-.411.148 2.18 2.18 0 00-.4.249 2.482 2.482 0 00-.485.499 2.659 2.659 0 00-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884c0-.364.053-.678.159-.943a1.49 1.49 0 01.466-.636 2.52 2.52 0 01.399-.253 2.19 2.19 0 01.224-.099zm9.784 2.656l.05-.922c0-1.162-.285-2.062-.856-2.698-.559-.647-1.42-.97-2.584-.97-.746 0-1.415.163-2.007.493a3.462 3.462 0 00-1.4 1.382c-.329.604-.493 1.306-.493 2.106 0 .714.143 1.371.428 1.975.285.593.73 1.07 1.332 1.432.604.351 1.355.526 2.255.526.649 0 1.204-.062 1.668-.185l.044-.012.135-.04c.409-.122.736-.263.984-.421l-.542-1.267c-.2.108-.415.199-.642.274l-.297.087c-.34.088-.773.131-1.3.131-.636 0-1.135-.147-1.497-.444a1.573 1.573 0 01-.192-.193c-.244-.294-.415-.705-.512-1.234l-.004-.021h5.43zm-5.427-1.256l-.003.022h3.752v-.138c-.007-.485-.104-.857-.288-1.118a1.056 1.056 0 00-.156-.176c-.307-.285-.746-.428-1.316-.428-.657 0-1.155.202-1.494.604-.253.3-.417.712-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z' fill='%23000' fill-opacity='.4' fill-rule='evenodd'/%3E%3Cpath d='M19.63 11.151l-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81c-.68 0-1.311-.16-1.893-.478a3.795 3.795 0 01-1.381-1.382c-.34-.604-.51-1.306-.51-2.106 0-.79.147-1.482.444-2.074a3.364 3.364 0 011.3-1.382c.559-.33 1.217-.494 1.974-.494a3.293 3.293 0 011.234.231 3.341 3.341 0 01.97.575c.264.22.44.439.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332c-.186.395-.526.746-1.02 1.053a3.167 3.167 0 01-1.662.444zm.296-1.482c.626 0 1.152-.214 1.58-.642.428-.44.642-1.01.642-1.711v-.115c0-.472-.098-.894-.296-1.267a2.211 2.211 0 00-.807-.872 2.098 2.098 0 00-1.119-.313c-.702 0-1.245.231-1.629.692-.384.45-.575 1.037-.575 1.76 0 .736.186 1.333.559 1.795.384.45.933.675 1.645.675zm6.521-6.237h1.711v1.4c.604-1.065 1.547-1.597 2.83-1.597 1.064 0 1.926.34 2.584 1.02.659.67.988 1.641.988 2.914 0 .79-.164 1.487-.493 2.09a3.456 3.456 0 01-1.316 1.399 3.51 3.51 0 01-1.844.493c-.636 0-1.19-.11-1.662-.329a2.665 2.665 0 01-1.086-.97l.017 5.134h-1.728V9.242zm4.048 6.22c.714 0 1.262-.224 1.645-.674.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.395 0-.768.098-1.12.296-.34.187-.613.46-.822.823-.197.351-.296.763-.296 1.234v.115c0 .472.098.894.296 1.267.209.362.483.647.823.855.34.197.713.297 1.119.297z' fill='%23fff'/%3E%3Cpath d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.159 1.159 0 01-.856-.346 1.165 1.165 0 01-.346-.856 1.053 1.053 0 01.346-.79c.23-.219.516-.329.856-.329.329 0 .609.11.839.33a1.053 1.053 0 01.345.79 1.159 1.159 0 01-.345.855c-.22.23-.5.346-.84.346zm7.875 9.133a3.167 3.167 0 01-1.662-.444c-.482-.307-.817-.658-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283c.186-.438.548-.812 1.086-1.119a3.486 3.486 0 011.778-.477c.746 0 1.393.17 1.942.51a3.235 3.235 0 011.283 1.4c.297.592.444 1.282.444 2.072 0 .8-.175 1.498-.526 2.09a3.52 3.52 0 01-1.382 1.366 3.785 3.785 0 01-1.876.477zm-.296-1.481c.713 0 1.26-.225 1.645-.675.384-.46.577-1.053.577-1.778 0-.734-.193-1.327-.577-1.776-.373-.46-.921-.692-1.645-.692a2.115 2.115 0 00-1.58.659c-.428.428-.642.992-.642 1.694v.115c0 .473.098.895.296 1.267a2.385 2.385 0 00.807.872 2.1 2.1 0 001.119.313zm5.927-6.237h1.777v1.481c.176-.505.46-.91.856-1.217a2.14 2.14 0 011.349-.46c.351 0 .593.032.724.098l-.247 1.794c-.099-.066-.313-.099-.642-.099-.516 0-.988.164-1.416.494-.417.329-.626.855-.626 1.58v3.883h-1.777V9.242zm9.534 7.718c-.9 0-1.651-.175-2.255-.526-.603-.362-1.047-.84-1.332-1.432a4.567 4.567 0 01-.428-1.975c0-.8.164-1.502.493-2.106a3.462 3.462 0 011.4-1.382c.592-.33 1.262-.494 2.007-.494 1.163 0 2.024.324 2.584.97.57.637.856 1.537.856 2.7 0 .296-.017.603-.05.92h-5.43c.12.67.356 1.153.708 1.45.362.296.86.443 1.497.443.526 0 .96-.044 1.3-.131a4.123 4.123 0 00.938-.362l.542 1.267c-.274.175-.647.329-1.119.46-.472.132-1.042.197-1.711.197zm1.596-4.558c.01-.68-.137-1.158-.444-1.432-.307-.285-.746-.428-1.316-.428-1.152 0-1.815.62-1.991 1.86h3.752z' fill='%23e1e3e9'/%3E%3Cg fill-rule='evenodd' stroke-width='1.036'%3E%3Cpath d='M8.166 16.146l-.002.002a1.54 1.54 0 01-2.009 0l-.002-.002-.043-.034-.002-.002-.199-.162H4.377a.657.657 0 00-.659.659v1.84a.657.657 0 00.659.659h5.565a.657.657 0 00.659-.659v-1.84a.657.657 0 00-.659-.659H8.411l-.202.164zm-1.121-.905a.29.29 0 00.113.023.286.286 0 00.189-.07l.077-.063c.634-.508 4.672-3.743 4.672-7.575 0-2.55-2.215-4.625-4.938-4.625S2.221 5.006 2.221 7.556c0 3.225 2.86 6.027 4.144 7.137h.004l.04.038.484.4.077.063a.628.628 0 00.074.047zm-2.52-.548a16.898 16.898 0 01-1.183-1.315C2.187 11.942.967 9.897.967 7.555c0-3.319 2.855-5.88 6.192-5.88 3.338 0 6.193 2.561 6.193 5.881 0 2.34-1.22 4.387-2.376 5.822a16.898 16.898 0 01-1.182 1.315h.15a1.912 1.912 0 011.914 1.914v1.84a1.912 1.912 0 01-1.914 1.914H4.377a1.912 1.912 0 01-1.914-1.914v-1.84a1.912 1.912 0 011.914-1.914zm3.82-6.935c0 .692-.55 1.222-1.187 1.222s-1.185-.529-1.185-1.222.548-1.222 1.185-1.222c.638 0 1.186.529 1.186 1.222zm-1.186 2.477c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477zm2.048 7.71H5.114v-.838h4.093z' fill='%23000' fill-opacity='.4'/%3E%3Cpath d='M2.222 7.555c0-2.55 2.214-4.625 4.937-4.625 2.723 0 4.938 2.075 4.938 4.625 0 3.832-4.038 7.068-4.672 7.575l-.077.063a.286.286 0 01-.189.07.286.286 0 01-.188-.07l-.077-.063c-.634-.507-4.672-3.743-4.672-7.575zm4.937 2.68c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477z' fill='%23e1e3e9'/%3E%3Cpath d='M4.377 15.948a.657.657 0 00-.659.659v1.84a.657.657 0 00.659.659h5.565a.657.657 0 00.659-.659v-1.84a.657.657 0 00-.659-.659zm4.83 1.16H5.114v.838h4.093z' fill='%23fff'/%3E%3C/g%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){a.mapboxgl-ctrl-logo,a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42l-.726 3.663a1.255 1.255 0 01-1.232 1.011h-1.827a1.255 1.255 0 01-1.229-1.509l2.501-12.095a1.255 1.255 0 011.23-1.001h.197a1.255 1.255 0 011.12.685l3.19 6.273 3.125-6.263a1.255 1.255 0 011.123-.695h.181a1.255 1.255 0 011.227.991l1.443 6.71a5.11 5.11 0 01.314-.787l.009-.016a4.623 4.623 0 011.777-1.887c.782-.46 1.668-.667 2.611-.667a4.548 4.548 0 011.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 011.212.925 1.255 1.255 0 011.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4.314.319.566.676.763 1.064V4.701a1.255 1.255 0 011.255-1.255h1.86A1.255 1.255 0 0154.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.416 2.416 0 01-.682-1.71c0-.665.267-1.253.735-1.7a2.448 2.448 0 011.722-.674 2.43 2.43 0 011.705.675c.211.2.381.43.504.683V4.7a1.255 1.255 0 011.255-1.255h1.744A1.255 1.255 0 0165.812 4.7v3.335a4.76 4.76 0 011.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 011.67 1.743v-.98a1.255 1.255 0 011.256-1.256h1.777c.233 0 .451.064.639.174a3.407 3.407 0 011.567-.372c.346 0 .861.02 1.285.232a1.255 1.255 0 01.689 1.004 4.73 4.73 0 01.853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528 0 .343-.02.694-.056 1.051a1.255 1.255 0 01-.947 1.09l.408.952a1.255 1.255 0 01-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.815 5.815 0 01-.548-2.512c0-.286.017-.567.053-.843a1.255 1.255 0 01-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 01-1.256 1.256h-1.777a1.255 1.255 0 01-1.256-1.256V15.69l-.032.057a4.778 4.778 0 01-1.86 1.833 5.04 5.04 0 01-2.484.634 4.47 4.47 0 01-1.935-.424 1.252 1.252 0 01-.764.258h-1.71a1.255 1.255 0 01-1.256-1.255V7.687a2.402 2.402 0 01-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 01-1.256 1.255h-1.843a1.25 1.25 0 01-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 01-1.256-1.255v-1.251l-.061.117a4.703 4.703 0 01-1.782 1.884 4.767 4.767 0 01-2.485.67 5.6 5.6 0 01-1.485-.188l.009 2.764a1.255 1.255 0 01-1.255 1.259h-1.729a1.255 1.255 0 01-1.255-1.255v-3.537a1.255 1.255 0 01-1.167.793h-1.679a1.25 1.25 0 01-.77-.263 4.47 4.47 0 01-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a4.983 4.983 0 01-1.081-.836 1.255 1.255 0 01-1.254 1.312h-1.81a1.255 1.255 0 01-1.228-.99l-.782-3.625-2.044 3.939a1.255 1.255 0 01-1.115.676h-.098a1.255 1.255 0 01-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15c.329-.237.574-.499.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267c-.088-.22-.264-.438-.526-.658l-.032-.028a3.16 3.16 0 00-.668-.428l-.27-.12a3.293 3.293 0 00-1.235-.23c-.757 0-1.415.163-1.974.493a3.36 3.36 0 00-1.3 1.382c-.297.593-.444 1.284-.444 2.074 0 .8.17 1.503.51 2.107a3.795 3.795 0 001.382 1.381 3.883 3.883 0 001.893.477c.53 0 1.015-.11 1.455-.33zm-2.789-5.38c-.384.45-.575 1.038-.575 1.762 0 .735.186 1.332.559 1.794.384.45.933.675 1.645.675a2.25 2.25 0 00.934-.19 2.17 2.17 0 00.468-.29l.178-.161a2.163 2.163 0 00.397-.561c.163-.333.244-.717.244-1.15v-.115c0-.472-.098-.894-.296-1.267l-.043-.077a2.211 2.211 0 00-.633-.709l-.13-.086-.047-.028a2.099 2.099 0 00-1.073-.285c-.702 0-1.244.231-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.958.958 0 00-.353-.389.851.851 0 00-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.626 2.626 0 00.331.423c.213.22.464.402.755.548l.173.074c.433.17.93.255 1.49.255.68 0 1.295-.165 1.844-.493a3.447 3.447 0 001.316-1.4c.329-.603.493-1.299.493-2.089 0-1.273-.33-2.243-.988-2.913-.658-.68-1.52-1.02-2.584-1.02-.598 0-1.124.115-1.575.347a2.807 2.807 0 00-.415.262l-.199.166a3.35 3.35 0 00-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138c.137.193.297.36.48.5l.155.11.053.034c.34.197.713.297 1.119.297.714 0 1.262-.225 1.645-.675.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.29 0-.569.053-.835.16a2.366 2.366 0 00-.284.136 1.99 1.99 0 00-.363.254 2.237 2.237 0 00-.46.569l-.082.162a2.56 2.56 0 00-.213 1.072v.115c0 .471.098.894.296 1.267l.135.211zm.964-.818a1.11 1.11 0 00.367.385.937.937 0 00.476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a.995.995 0 00-.503.135l-.012.007a.859.859 0 00-.335.343c-.073.133-.132.324-.132.614v.115a1.43 1.43 0 00.14.66zm15.7-6.222c.232-.23.346-.516.346-.856a1.053 1.053 0 00-.345-.79 1.175 1.175 0 00-.84-.329c-.34 0-.625.11-.855.33a1.053 1.053 0 00-.346.79c0 .34.115.625.346.855.23.23.516.346.856.346.34 0 .62-.115.839-.346zm4.337 9.314l.033-1.332c.128.269.324.518.59.747l.098.081a3.727 3.727 0 00.316.224l.223.122a3.21 3.21 0 001.44.322 3.785 3.785 0 001.875-.477 3.52 3.52 0 001.382-1.366c.352-.593.526-1.29.526-2.09 0-.79-.147-1.48-.444-2.073a3.235 3.235 0 00-1.283-1.399c-.549-.34-1.195-.51-1.942-.51a3.476 3.476 0 00-1.527.344l-.086.043-.165.09a3.412 3.412 0 00-.33.214c-.288.21-.507.446-.656.707a1.893 1.893 0 00-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.482 2.482 0 00.566.7c.078.065.159.125.245.18l.144.08a2.105 2.105 0 00.975.232c.713 0 1.262-.225 1.645-.675.384-.46.576-1.053.576-1.778 0-.734-.192-1.327-.576-1.777-.373-.46-.921-.692-1.645-.692a2.18 2.18 0 00-1.015.235c-.147.075-.285.17-.415.282l-.15.142a2.086 2.086 0 00-.42.594c-.149.32-.223.685-.223 1.1v.115c0 .47.097.89.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.868.868 0 00-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.13 1.13 0 00.367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013c.23-.087.472-.134.724-.14l.069-.002c.329 0 .542.033.642.099l.247-1.794c-.13-.066-.37-.099-.717-.099a2.3 2.3 0 00-.545.063 2.086 2.086 0 00-.411.148 2.18 2.18 0 00-.4.249 2.482 2.482 0 00-.485.499 2.659 2.659 0 00-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884c0-.364.053-.678.159-.943a1.49 1.49 0 01.466-.636 2.52 2.52 0 01.399-.253 2.19 2.19 0 01.224-.099zm9.784 2.656l.05-.922c0-1.162-.285-2.062-.856-2.698-.559-.647-1.42-.97-2.584-.97-.746 0-1.415.163-2.007.493a3.462 3.462 0 00-1.4 1.382c-.329.604-.493 1.306-.493 2.106 0 .714.143 1.371.428 1.975.285.593.73 1.07 1.332 1.432.604.351 1.355.526 2.255.526.649 0 1.204-.062 1.668-.185l.044-.012.135-.04c.409-.122.736-.263.984-.421l-.542-1.267c-.2.108-.415.199-.642.274l-.297.087c-.34.088-.773.131-1.3.131-.636 0-1.135-.147-1.497-.444a1.573 1.573 0 01-.192-.193c-.244-.294-.415-.705-.512-1.234l-.004-.021h5.43zm-5.427-1.256l-.003.022h3.752v-.138c-.007-.485-.104-.857-.288-1.118a1.056 1.056 0 00-.156-.176c-.307-.285-.746-.428-1.316-.428-.657 0-1.155.202-1.494.604-.253.3-.417.712-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z' fill='%23000' fill-opacity='.4' fill-rule='evenodd'/%3E%3Cpath d='M19.63 11.151l-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81c-.68 0-1.311-.16-1.893-.478a3.795 3.795 0 01-1.381-1.382c-.34-.604-.51-1.306-.51-2.106 0-.79.147-1.482.444-2.074a3.364 3.364 0 011.3-1.382c.559-.33 1.217-.494 1.974-.494a3.293 3.293 0 011.234.231 3.341 3.341 0 01.97.575c.264.22.44.439.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332c-.186.395-.526.746-1.02 1.053a3.167 3.167 0 01-1.662.444zm.296-1.482c.626 0 1.152-.214 1.58-.642.428-.44.642-1.01.642-1.711v-.115c0-.472-.098-.894-.296-1.267a2.211 2.211 0 00-.807-.872 2.098 2.098 0 00-1.119-.313c-.702 0-1.245.231-1.629.692-.384.45-.575 1.037-.575 1.76 0 .736.186 1.333.559 1.795.384.45.933.675 1.645.675zm6.521-6.237h1.711v1.4c.604-1.065 1.547-1.597 2.83-1.597 1.064 0 1.926.34 2.584 1.02.659.67.988 1.641.988 2.914 0 .79-.164 1.487-.493 2.09a3.456 3.456 0 01-1.316 1.399 3.51 3.51 0 01-1.844.493c-.636 0-1.19-.11-1.662-.329a2.665 2.665 0 01-1.086-.97l.017 5.134h-1.728V9.242zm4.048 6.22c.714 0 1.262-.224 1.645-.674.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.395 0-.768.098-1.12.296-.34.187-.613.46-.822.823-.197.351-.296.763-.296 1.234v.115c0 .472.098.894.296 1.267.209.362.483.647.823.855.34.197.713.297 1.119.297z' fill='%23fff'/%3E%3Cpath d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.159 1.159 0 01-.856-.346 1.165 1.165 0 01-.346-.856 1.053 1.053 0 01.346-.79c.23-.219.516-.329.856-.329.329 0 .609.11.839.33a1.053 1.053 0 01.345.79 1.159 1.159 0 01-.345.855c-.22.23-.5.346-.84.346zm7.875 9.133a3.167 3.167 0 01-1.662-.444c-.482-.307-.817-.658-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283c.186-.438.548-.812 1.086-1.119a3.486 3.486 0 011.778-.477c.746 0 1.393.17 1.942.51a3.235 3.235 0 011.283 1.4c.297.592.444 1.282.444 2.072 0 .8-.175 1.498-.526 2.09a3.52 3.52 0 01-1.382 1.366 3.785 3.785 0 01-1.876.477zm-.296-1.481c.713 0 1.26-.225 1.645-.675.384-.46.577-1.053.577-1.778 0-.734-.193-1.327-.577-1.776-.373-.46-.921-.692-1.645-.692a2.115 2.115 0 00-1.58.659c-.428.428-.642.992-.642 1.694v.115c0 .473.098.895.296 1.267a2.385 2.385 0 00.807.872 2.1 2.1 0 001.119.313zm5.927-6.237h1.777v1.481c.176-.505.46-.91.856-1.217a2.14 2.14 0 011.349-.46c.351 0 .593.032.724.098l-.247 1.794c-.099-.066-.313-.099-.642-.099-.516 0-.988.164-1.416.494-.417.329-.626.855-.626 1.58v3.883h-1.777V9.242zm9.534 7.718c-.9 0-1.651-.175-2.255-.526-.603-.362-1.047-.84-1.332-1.432a4.567 4.567 0 01-.428-1.975c0-.8.164-1.502.493-2.106a3.462 3.462 0 011.4-1.382c.592-.33 1.262-.494 2.007-.494 1.163 0 2.024.324 2.584.97.57.637.856 1.537.856 2.7 0 .296-.017.603-.05.92h-5.43c.12.67.356 1.153.708 1.45.362.296.86.443 1.497.443.526 0 .96-.044 1.3-.131a4.123 4.123 0 00.938-.362l.542 1.267c-.274.175-.647.329-1.119.46-.472.132-1.042.197-1.711.197zm1.596-4.558c.01-.68-.137-1.158-.444-1.432-.307-.285-.746-.428-1.316-.428-1.152 0-1.815.62-1.991 1.86h3.752z' fill='%23e1e3e9'/%3E%3Cg fill-rule='evenodd' stroke-width='1.036'%3E%3Cpath d='M8.166 16.146l-.002.002a1.54 1.54 0 01-2.009 0l-.002-.002-.043-.034-.002-.002-.199-.162H4.377a.657.657 0 00-.659.659v1.84a.657.657 0 00.659.659h5.565a.657.657 0 00.659-.659v-1.84a.657.657 0 00-.659-.659H8.411l-.202.164zm-1.121-.905a.29.29 0 00.113.023.286.286 0 00.189-.07l.077-.063c.634-.508 4.672-3.743 4.672-7.575 0-2.55-2.215-4.625-4.938-4.625S2.221 5.006 2.221 7.556c0 3.225 2.86 6.027 4.144 7.137h.004l.04.038.484.4.077.063a.628.628 0 00.074.047zm-2.52-.548a16.898 16.898 0 01-1.183-1.315C2.187 11.942.967 9.897.967 7.555c0-3.319 2.855-5.88 6.192-5.88 3.338 0 6.193 2.561 6.193 5.881 0 2.34-1.22 4.387-2.376 5.822a16.898 16.898 0 01-1.182 1.315h.15a1.912 1.912 0 011.914 1.914v1.84a1.912 1.912 0 01-1.914 1.914H4.377a1.912 1.912 0 01-1.914-1.914v-1.84a1.912 1.912 0 011.914-1.914zm3.82-6.935c0 .692-.55 1.222-1.187 1.222s-1.185-.529-1.185-1.222.548-1.222 1.185-1.222c.638 0 1.186.529 1.186 1.222zm-1.186 2.477c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477zm2.048 7.71H5.114v-.838h4.093z' fill='%23000' fill-opacity='.4'/%3E%3Cpath d='M2.222 7.555c0-2.55 2.214-4.625 4.937-4.625 2.723 0 4.938 2.075 4.938 4.625 0 3.832-4.038 7.068-4.672 7.575l-.077.063a.286.286 0 01-.189.07.286.286 0 01-.188-.07l-.077-.063c-.634-.507-4.672-3.743-4.672-7.575zm4.937 2.68c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477z' fill='%23e1e3e9'/%3E%3Cpath d='M4.377 15.948a.657.657 0 00-.659.659v1.84a.657.657 0 00.659.659h5.565a.657.657 0 00.659-.659v-1.84a.657.657 0 00-.659-.659zm4.83 1.16H5.114v.838h4.093z' fill='%23fff'/%3E%3C/g%3E%3C/svg%3E")}}.mapboxgl-ctrl.mapboxgl-ctrl-attrib,.maplibregl-ctrl.maplibregl-ctrl-attrib{padding:0 5px;background-color:hsla(0,0%,100%,.5);margin:0}@media screen{.mapboxgl-ctrl-attrib.mapboxgl-compact,.maplibregl-ctrl-attrib.maplibregl-compact{min-height:20px;padding:2px 24px 2px 0;margin:10px;position:relative;background-color:#fff;border-radius:12px}.mapboxgl-ctrl-attrib.mapboxgl-compact-show,.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.mapboxgl-ctrl-bottom-left>.mapboxgl-ctrl-attrib.mapboxgl-compact-show,.mapboxgl-ctrl-top-left>.mapboxgl-ctrl-attrib.mapboxgl-compact-show,.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 8px 2px 28px;border-radius:12px}.mapboxgl-ctrl-attrib.mapboxgl-compact .mapboxgl-ctrl-attrib-inner,.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.mapboxgl-ctrl-attrib-button,.maplibregl-ctrl-attrib-button{display:none;cursor:pointer;position:absolute;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='24' height='24' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd'%3E%3Cpath d='M4 10a6 6 0 1012 0 6 6 0 10-12 0m5-3a1 1 0 102 0 1 1 0 10-2 0m0 3a1 1 0 112 0v3a1 1 0 11-2 0'/%3E%3C/svg%3E");background-color:hsla(0,0%,100%,.5);width:24px;height:24px;box-sizing:border-box;border-radius:12px;outline:none;top:0;right:0;border:0}.mapboxgl-ctrl-bottom-left .mapboxgl-ctrl-attrib-button,.mapboxgl-ctrl-top-left .mapboxgl-ctrl-attrib-button,.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button{left:0}.mapboxgl-ctrl-attrib.mapboxgl-compact-show .mapboxgl-ctrl-attrib-inner,.mapboxgl-ctrl-attrib.mapboxgl-compact .mapboxgl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner,.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button{display:block}.mapboxgl-ctrl-attrib.mapboxgl-compact-show .mapboxgl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button{background-color:rgba(0,0,0,.05)}.mapboxgl-ctrl-bottom-right>.mapboxgl-ctrl-attrib.mapboxgl-compact:after,.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.mapboxgl-ctrl-top-right>.mapboxgl-ctrl-attrib.mapboxgl-compact:after,.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{top:0;right:0}.mapboxgl-ctrl-top-left>.mapboxgl-ctrl-attrib.mapboxgl-compact:after,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{top:0;left:0}.mapboxgl-ctrl-bottom-left>.mapboxgl-ctrl-attrib.mapboxgl-compact:after,.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (-ms-high-contrast:active){.mapboxgl-ctrl-attrib.mapboxgl-compact:after,.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='24' height='24' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd' fill='%23fff'%3E%3Cpath d='M4 10a6 6 0 1012 0 6 6 0 10-12 0m5-3a1 1 0 102 0 1 1 0 10-2 0m0 3a1 1 0 112 0v3a1 1 0 11-2 0'/%3E%3C/svg%3E")}}@media screen and (-ms-high-contrast:black-on-white){.mapboxgl-ctrl-attrib.mapboxgl-compact:after,.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='24' height='24' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd'%3E%3Cpath d='M4 10a6 6 0 1012 0 6 6 0 10-12 0m5-3a1 1 0 102 0 1 1 0 10-2 0m0 3a1 1 0 112 0v3a1 1 0 11-2 0'/%3E%3C/svg%3E")}}.mapboxgl-ctrl-attrib a,.maplibregl-ctrl-attrib a{color:rgba(0,0,0,.75);text-decoration:none}.mapboxgl-ctrl-attrib a:hover,.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.mapboxgl-ctrl-attrib .mapbox-improve-map,.maplibregl-ctrl-attrib .mapbox-improve-map{font-weight:700;margin-left:2px}.mapboxgl-attrib-empty,.maplibregl-attrib-empty{display:none}.mapboxgl-ctrl-scale,.maplibregl-ctrl-scale{background-color:hsla(0,0%,100%,.75);font-size:10px;border:2px solid #333;border-top:#333;padding:0 5px;color:#333;box-sizing:border-box}.mapboxgl-popup,.maplibregl-popup{position:absolute;top:0;left:0;display:-webkit-flex;display:flex;will-change:transform;pointer-events:none}.mapboxgl-popup-anchor-top,.mapboxgl-popup-anchor-top-left,.mapboxgl-popup-anchor-top-right,.maplibregl-popup-anchor-top,.maplibregl-popup-anchor-top-left,.maplibregl-popup-anchor-top-right{-webkit-flex-direction:column;flex-direction:column}.mapboxgl-popup-anchor-bottom,.mapboxgl-popup-anchor-bottom-left,.mapboxgl-popup-anchor-bottom-right,.maplibregl-popup-anchor-bottom,.maplibregl-popup-anchor-bottom-left,.maplibregl-popup-anchor-bottom-right{-webkit-flex-direction:column-reverse;flex-direction:column-reverse}.mapboxgl-popup-anchor-left,.maplibregl-popup-anchor-left{-webkit-flex-direction:row;flex-direction:row}.mapboxgl-popup-anchor-right,.maplibregl-popup-anchor-right{-webkit-flex-direction:row-reverse;flex-direction:row-reverse}.mapboxgl-popup-tip,.maplibregl-popup-tip{width:0;height:0;border:10px solid transparent;z-index:1}.mapboxgl-popup-anchor-top .mapboxgl-popup-tip,.maplibregl-popup-anchor-top .maplibregl-popup-tip{-webkit-align-self:center;align-self:center;border-top:none;border-bottom-color:#fff}.mapboxgl-popup-anchor-top-left .mapboxgl-popup-tip,.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{-webkit-align-self:flex-start;align-self:flex-start;border-top:none;border-left:none;border-bottom-color:#fff}.mapboxgl-popup-anchor-top-right .mapboxgl-popup-tip,.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{-webkit-align-self:flex-end;align-self:flex-end;border-top:none;border-right:none;border-bottom-color:#fff}.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip,.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{-webkit-align-self:center;align-self:center;border-bottom:none;border-top-color:#fff}.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-tip,.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{-webkit-align-self:flex-start;align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-tip,.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{-webkit-align-self:flex-end;align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.mapboxgl-popup-anchor-left .mapboxgl-popup-tip,.maplibregl-popup-anchor-left .maplibregl-popup-tip{-webkit-align-self:center;align-self:center;border-left:none;border-right-color:#fff}.mapboxgl-popup-anchor-right .mapboxgl-popup-tip,.maplibregl-popup-anchor-right .maplibregl-popup-tip{-webkit-align-self:center;align-self:center;border-right:none;border-left-color:#fff}.mapboxgl-popup-close-button,.maplibregl-popup-close-button{position:absolute;right:0;top:0;border:0;border-radius:0 3px 0 0;cursor:pointer;background-color:transparent}.mapboxgl-popup-close-button:hover,.maplibregl-popup-close-button:hover{background-color:rgba(0,0,0,.05)}.mapboxgl-popup-content,.maplibregl-popup-content{position:relative;background:#fff;border-radius:3px;box-shadow:0 1px 2px rgba(0,0,0,.1);padding:10px 10px 15px;pointer-events:auto}.mapboxgl-popup-anchor-top-left .mapboxgl-popup-content,.maplibregl-popup-anchor-top-left .maplibregl-popup-content{border-top-left-radius:0}.mapboxgl-popup-anchor-top-right .mapboxgl-popup-content,.maplibregl-popup-anchor-top-right .maplibregl-popup-content{border-top-right-radius:0}.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-content,.maplibregl-popup-anchor-bottom-left .maplibregl-popup-content{border-bottom-left-radius:0}.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-content,.maplibregl-popup-anchor-bottom-right .maplibregl-popup-content{border-bottom-right-radius:0}.mapboxgl-popup-track-pointer,.maplibregl-popup-track-pointer{display:none}.mapboxgl-popup-track-pointer *,.maplibregl-popup-track-pointer *{pointer-events:none;user-select:none}.mapboxgl-map:hover .mapboxgl-popup-track-pointer,.maplibregl-map:hover .maplibregl-popup-track-pointer{display:flex}.mapboxgl-map:active .mapboxgl-popup-track-pointer,.maplibregl-map:active .maplibregl-popup-track-pointer{display:none}.mapboxgl-marker,.maplibregl-marker{position:absolute;top:0;left:0;will-change:transform}.mapboxgl-user-location-dot,.maplibregl-user-location-dot{background-color:#1da1f2;width:15px;height:15px;border-radius:50%}.mapboxgl-user-location-dot:before,.maplibregl-user-location-dot:before{background-color:#1da1f2;content:"";width:15px;height:15px;border-radius:50%;position:absolute;-webkit-animation:maplibregl-user-location-dot-pulse 2s infinite;-moz-animation:maplibregl-user-location-dot-pulse 2s infinite;-ms-animation:maplibregl-user-location-dot-pulse 2s infinite;animation:maplibregl-user-location-dot-pulse 2s infinite}.mapboxgl-user-location-dot:after,.maplibregl-user-location-dot:after{border-radius:50%;border:2px solid #fff;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px;box-sizing:border-box;box-shadow:0 0 3px rgba(0,0,0,.35)}@-webkit-keyframes maplibregl-user-location-dot-pulse{0%{-webkit-transform:scale(1);opacity:1}70%{-webkit-transform:scale(3);opacity:0}to{-webkit-transform:scale(1);opacity:0}}@-ms-keyframes maplibregl-user-location-dot-pulse{0%{-ms-transform:scale(1);opacity:1}70%{-ms-transform:scale(3);opacity:0}to{-ms-transform:scale(1);opacity:0}}@keyframes maplibregl-user-location-dot-pulse{0%{transform:scale(1);opacity:1}70%{transform:scale(3);opacity:0}to{transform:scale(1);opacity:0}}.mapboxgl-user-location-dot-stale,.maplibregl-user-location-dot-stale{background-color:#aaa}.mapboxgl-user-location-dot-stale:after,.maplibregl-user-location-dot-stale:after{display:none}.mapboxgl-user-location-accuracy-circle,.maplibregl-user-location-accuracy-circle{background-color:rgba(29,161,242,.2);width:1px;height:1px;border-radius:100%}.mapboxgl-crosshair,.mapboxgl-crosshair .mapboxgl-interactive,.mapboxgl-crosshair .mapboxgl-interactive:active,.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.mapboxgl-boxzoom,.maplibregl-boxzoom{position:absolute;top:0;left:0;width:0;height:0;background:#fff;border:2px dotted #202020;opacity:.5}@media print{.mapbox-improve-map{display:none}} \ No newline at end of file diff --git a/web/client/components/infrastructure/deps/maplibre-gl.js b/web/client/components/infrastructure/deps/maplibre-gl.js deleted file mode 100644 index 7d8077be..00000000 --- a/web/client/components/infrastructure/deps/maplibre-gl.js +++ /dev/null @@ -1,42 +0,0 @@ -/* MapLibre GL JS is licensed under the 3-Clause BSD License. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v1.15.3/LICENSE.txt */ -(function (global, factory) { -typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : -typeof define === 'function' && define.amd ? define(factory) : -(global = global || self, global.maplibregl = factory()); -}(this, (function () { 'use strict'; - -/* eslint-disable */ - -var shared, worker, maplibregl; -// define gets called three times: one for each chunk. we rely on the order -// they're imported to know which is which -function define(_, chunk) { -if (!shared) { - shared = chunk; -} else if (!worker) { - worker = chunk; -} else { - var workerBundleString = 'var sharedChunk = {}; (' + shared + ')(sharedChunk); (' + worker + ')(sharedChunk);' - - var sharedChunk = {}; - shared(sharedChunk); - maplibregl = chunk(sharedChunk); - if (typeof window !== 'undefined') { - maplibregl.workerUrl = window.URL.createObjectURL(new Blob([workerBundleString], { type: 'text/javascript' })); - } -} -} - - -define(["exports"],(function(t){"use strict";function e(t,e){return t(e={exports:{}},e.exports),e.exports}var r=n;function n(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=r,this.p2y=n;}n.prototype.sampleCurveX=function(t){return ((this.ax*t+this.bx)*t+this.cx)*t},n.prototype.sampleCurveY=function(t){return ((this.ay*t+this.by)*t+this.cy)*t},n.prototype.sampleCurveDerivativeX=function(t){return (3*this.ax*t+2*this.bx)*t+this.cx},n.prototype.solveCurveX=function(t,e){var r,n,i,a,o;for(void 0===e&&(e=1e-6),i=t,o=0;o<8;o++){if(a=this.sampleCurveX(i)-t,Math.abs(a)(n=1))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))};var i=a;function a(t,e){this.x=t,this.y=e;}a.prototype={clone:function(){return new a(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=n,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-n*(this.y-e.y),this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},a.convert=function(t){return t instanceof a?t:Array.isArray(t)?new a(t[0],t[1]):t};var o="undefined"!=typeof self?self:{},s=Math.pow(2,53)-1;function u(t,e,n,i){var a=new r(t,e,n,i);return function(t){return a.solve(t)}}var l=u(.25,.1,.25,1);function p(t,e,r){return Math.min(r,Math.max(e,t))}function c(t,e,r){var n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i}function h(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];for(var n=0,i=e;n>e/4).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function m(t){return !!t&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)}function v(t,e){t.forEach((function(t){e[t]&&(e[t]=e[t].bind(e));}));}function g(t,e){return -1!==t.indexOf(e,t.length-e.length)}function x(t,e,r){var n={};for(var i in t)n[i]=e.call(r||this,t[i],i,t);return n}function b(t,e,r){var n={};for(var i in t)e.call(r||this,t[i],i,t)&&(n[i]=t[i]);return n}function w(t){return Array.isArray(t)?t.map(w):"object"==typeof t&&t?x(t,w):t}var _={};function A(t){_[t]||("undefined"!=typeof console&&console.warn(t),_[t]=!0);}function S(t,e,r){return (r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function k(t){for(var e=0,r=0,n=t.length,i=n-1,a=void 0,o=void 0;r@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(function(t,r,n,i){var a=n||i;return e[r]=!a||a.toLowerCase(),""})),e["max-age"]){var r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r;}return e}var C=null;function E(t){if(null==C){var e=t.navigator?t.navigator.userAgent:null;C=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")));}return C}function P(t){try{var e=o[t];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch(t){return !1}}var M,B,T,V,F=o.performance&&o.performance.now?o.performance.now.bind(o.performance):Date.now.bind(Date),D=o.requestAnimationFrame||o.mozRequestAnimationFrame||o.webkitRequestAnimationFrame||o.msRequestAnimationFrame,L=o.cancelAnimationFrame||o.mozCancelAnimationFrame||o.webkitCancelAnimationFrame||o.msCancelAnimationFrame,R={now:F,frame:function(t){var e=D(t);return {cancel:function(){return L(e)}}},getImageData:function(t,e){void 0===e&&(e=0);var r=o.document.createElement("canvas"),n=r.getContext("2d");if(!n)throw new Error("failed to create canvas 2d context");return r.width=t.width,r.height=t.height,n.drawImage(t,0,0,t.width,t.height),n.getImageData(-e,-e,t.width+2*e,t.height+2*e)},resolveURL:function(t){return M||(M=o.document.createElement("a")),M.href=t,M.href},hardwareConcurrency:o.navigator&&o.navigator.hardwareConcurrency||4,get devicePixelRatio(){return o.devicePixelRatio},get prefersReducedMotion(){return !!o.matchMedia&&(null==B&&(B=o.matchMedia("(prefers-reduced-motion: reduce)")),B.matches)}},O={API_URL:"https://api.mapbox.com",get EVENTS_URL(){return this.API_URL?0===this.API_URL.indexOf("https://api.mapbox.cn")?"https://events.mapbox.cn/events/v2":0===this.API_URL.indexOf("https://api.mapbox.com")?"https://events.mapbox.com/events/v2":null:null},FEEDBACK_URL:"https://apps.mapbox.com/feedback",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},U={supported:!1,testSupport:function(t){!j&&V&&(q?N(t):T=t);}},j=!1,q=!1;function N(t){var e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,V),t.isContextLost())return;U.supported=!0;}catch(t){}t.deleteTexture(e),j=!0;}o.document&&((V=o.document.createElement("img")).onload=function(){T&&N(T),T=null,q=!0;},V.onerror=function(){j=!0,T=null;},V.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");var K="01",G=function(t,e){this._transformRequestFn=t,this._customAccessToken=e,this._createSkuToken();};function Z(t){return 0===t.indexOf("mapbox:")}G.prototype._createSkuToken=function(){var t=function(){for(var t="",e=0;e<10;e++)t+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return {token:["1",K,t].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt;},G.prototype._isSkuTokenExpired=function(){return Date.now()>this._skuTokenExpiresAt},G.prototype.transformRequest=function(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}},G.prototype.normalizeStyleURL=function(t,e){if(!Z(t))return t;var r=Y(t);return r.path="/styles/v1"+r.path,this._makeAPIURL(r,this._customAccessToken||e)},G.prototype.normalizeGlyphsURL=function(t,e){if(!Z(t))return t;var r=Y(t);return r.path="/fonts/v1"+r.path,this._makeAPIURL(r,this._customAccessToken||e)},G.prototype.normalizeSourceURL=function(t,e){if(!Z(t))return t;var r=Y(t);return r.path="/v4/"+r.authority+".json",r.params.push("secure"),this._makeAPIURL(r,this._customAccessToken||e)},G.prototype.normalizeSpriteURL=function(t,e,r,n){var i=Y(t);return Z(t)?(i.path="/styles/v1"+i.path+"/sprite"+e+r,this._makeAPIURL(i,this._customAccessToken||n)):(i.path+=""+e+r,$(i))},G.prototype.normalizeTileURL=function(t,e){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!Z(t))return t;var r=Y(t);r.path=r.path.replace(/(\.(png|jpg)\d*)(?=$)/,(R.devicePixelRatio>=2||512===e?"@2x":"")+(U.supported?".webp":"$1")),r.path=r.path.replace(/^.+\/v4\//,"/"),r.path="/v4"+r.path;var n=this._customAccessToken||function(t){for(var e=0,r=t;e=0&&t.params.splice(i,1);}if("/"!==n.path&&(t.path=""+n.path+t.path),!O.REQUIRE_ACCESS_TOKEN)return $(t);if(!(e=e||O.ACCESS_TOKEN))throw new Error("An API access token is required to use Mapbox GL. "+r);if("s"===e[0])throw new Error("Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). "+r);return t.params=t.params.filter((function(t){return -1===t.indexOf("access_token")})),t.params.push("access_token="+e),$(t)},G.prototype.setTransformRequest=function(t){this._transformRequestFn=t;};var X=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;function J(t){return X.test(t)}var H=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Y(t){var e=t.match(H);if(!e)throw new Error("Unable to parse URL object");return {protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}function $(t){var e=t.params.length?"?"+t.params.join("&"):"";return t.protocol+"://"+t.authority+t.path+e}function W(t){if(!t)return null;var e=t.split(".");if(!e||3!==e.length)return null;try{return JSON.parse(decodeURIComponent(o.atob(e[1]).split("").map((function(t){return "%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)})).join("")))}catch(t){return null}}var Q=function(t){this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null;};Q.prototype.getStorageKey=function(t){var e,r=W(O.ACCESS_TOKEN);return e=r&&r.u?o.btoa(encodeURIComponent(r.u).replace(/%([0-9A-F]{2})/g,(function(t,e){return String.fromCharCode(Number("0x"+e))}))):O.ACCESS_TOKEN||"",t?"mapbox.eventData."+t+":"+e:"mapbox.eventData:"+e},Q.prototype.fetchEventData=function(){var t=P("localStorage"),e=this.getStorageKey(),r=this.getStorageKey("uuid");if(t)try{var n=o.localStorage.getItem(e);n&&(this.eventData=JSON.parse(n));var i=o.localStorage.getItem(r);i&&(this.anonId=i);}catch(t){A("Unable to read from LocalStorage");}},Q.prototype.saveEventData=function(){var t=P("localStorage"),e=this.getStorageKey(),r=this.getStorageKey("uuid");if(t)try{o.localStorage.setItem(r,this.anonId),Object.keys(this.eventData).length>=1&&o.localStorage.setItem(e,JSON.stringify(this.eventData));}catch(t){A("Unable to write to LocalStorage");}},Q.prototype.processRequests=function(t){},Q.prototype.postEvent=function(t,e,r,n){var i=this;if(O.EVENTS_URL){var a=Y(O.EVENTS_URL);a.params.push("access_token="+(n||O.ACCESS_TOKEN||""));var o={event:this.type,created:new Date(t).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:"1.15.3",skuId:K,userId:this.anonId},s=e?h(o,e):o,u={url:$(a),headers:{"Content-Type":"text/plain"},body:JSON.stringify([s])};this.pendingRequest=_t(u,(function(t){i.pendingRequest=null,r(t),i.saveEventData(),i.processRequests(n);}));}},Q.prototype.queueRequest=function(t,e){this.queue.push(t),this.processRequests(e);};var tt,et,rt=function(t){function e(){t.call(this,"map.load"),this.success={},this.skuToken="";}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.postMapLoadEvent=function(t,e,r,n){this.skuToken=r,(O.EVENTS_URL&&n||O.ACCESS_TOKEN&&Array.isArray(t)&&t.some((function(t){return Z(t)||J(t)})))&&this.queueRequest({id:e,timestamp:Date.now()},n);},e.prototype.processRequests=function(t){var e=this;if(!this.pendingRequest&&0!==this.queue.length){var r=this.queue.shift(),n=r.id,i=r.timestamp;n&&this.success[n]||(this.anonId||this.fetchEventData(),m(this.anonId)||(this.anonId=d()),this.postEvent(i,{skuToken:this.skuToken},(function(t){t||n&&(e.success[n]=!0);}),t));}},e}(Q),nt=new(function(t){function e(e){t.call(this,"appUserTurnstile"),this._customAccessToken=e;}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.postTurnstileEvent=function(t,e){O.EVENTS_URL&&O.ACCESS_TOKEN&&Array.isArray(t)&&t.some((function(t){return Z(t)||J(t)}))&&this.queueRequest(Date.now(),e);},e.prototype.processRequests=function(t){var e=this;if(!this.pendingRequest&&0!==this.queue.length){this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();var r=W(O.ACCESS_TOKEN),n=r?r.u:O.ACCESS_TOKEN,i=n!==this.eventData.tokenU;m(this.anonId)||(this.anonId=d(),i=!0);var a=this.queue.shift();if(this.eventData.lastSuccess){var o=new Date(this.eventData.lastSuccess),s=new Date(a),u=(a-this.eventData.lastSuccess)/864e5;i=i||u>=1||u<-1||o.getDate()!==s.getDate();}else i=!0;if(!i)return this.processRequests();this.postEvent(a,{"enabled.telemetry":!1},(function(t){t||(e.eventData.lastSuccess=a,e.eventData.tokenU=n);}),t);}},e}(Q)),it=nt.postTurnstileEvent.bind(nt),at=new rt,ot=at.postMapLoadEvent.bind(at),st=500,ut=50;function lt(){o.caches&&!tt&&(tt=o.caches.open("mapbox-tiles"));}function pt(t){var e=t.indexOf("?");return e<0?t:t.slice(0,e)}var ct,ht=1/0;function ft(){return null==ct&&(ct=o.OffscreenCanvas&&new o.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof o.createImageBitmap),ct}var yt={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(yt);var dt=function(t){function e(e,r,n){401===r&&J(n)&&(e+=": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"),t.call(this,e),this.status=r,this.url=n,this.name=this.constructor.name,this.message=e;}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.toString=function(){return this.name+": "+this.message+" ("+this.status+"): "+this.url},e}(Error),mt=I()?function(){return self.worker&&self.worker.referrer}:function(){return ("blob:"===o.location.protocol?o.parent:o).location.href};function vt(t,e){var r,n=new o.AbortController,i=new o.Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:mt(),signal:n.signal}),a=!1,s=!1,u=(r=i.url).indexOf("sku=")>0&&J(r);"json"===t.type&&i.headers.set("Accept","application/json");var l=function(r,n,a){if(!s){if(r&&"SecurityError"!==r.message&&A(r),n&&a)return p(n);var l=Date.now();o.fetch(i).then((function(r){if(r.ok){var n=u?r.clone():null;return p(r,n,l)}return e(new dt(r.statusText,r.status,t.url))})).catch((function(t){20!==t.code&&e(new Error(t.message));}));}},p=function(r,n,u){("arrayBuffer"===t.type?r.arrayBuffer():"json"===t.type?r.json():r.text()).then((function(t){s||(n&&u&&function(t,e,r){if(lt(),tt){var n={status:e.status,statusText:e.statusText,headers:new o.Headers};e.headers.forEach((function(t,e){return n.headers.set(e,t)}));var i=z(e.headers.get("Cache-Control")||"");i["no-store"]||(i["max-age"]&&n.headers.set("Expires",new Date(r+1e3*i["max-age"]).toUTCString()),new Date(n.headers.get("Expires")).getTime()-r<42e4||function(t,e){if(void 0===et)try{new Response(new ReadableStream),et=!0;}catch(t){et=!1;}et?e(t.body):t.blob().then(e);}(e,(function(e){var r=new o.Response(e,n);lt(),tt&&tt.then((function(e){return e.put(pt(t.url),r)})).catch((function(t){return A(t.message)}));})));}}(i,n,u),a=!0,e(null,t,r.headers.get("Cache-Control"),r.headers.get("Expires")));})).catch((function(t){s||e(new Error(t.message));}));};return u?function(t,e){if(lt(),!tt)return e(null);var r=pt(t.url);tt.then((function(t){t.match(r).then((function(n){var i=function(t){if(!t)return !1;var e=new Date(t.headers.get("Expires")||0),r=z(t.headers.get("Cache-Control")||"");return e>Date.now()&&!r["no-cache"]}(n);t.delete(r),i&&t.put(r,n.clone()),e(null,n,i);})).catch(e);})).catch(e);}(i,l):l(null,null),{cancel:function(){s=!0,a||n.abort();}}}var gt,xt,bt=function(t,e){if(/:\/\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){if(I()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e);if(!I()){var r=t.url.substring(0,t.url.indexOf("://"));return (O.REGISTERED_PROTOCOLS[r]||vt)(t,e)}}if(!(/^file:/.test(n=t.url)||/^file:/.test(mt())&&!/^\w+:/.test(n))){if(o.fetch&&o.Request&&o.AbortController&&o.Request.prototype.hasOwnProperty("signal"))return vt(t,e);if(I()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var n;return function(t,e){var r=new o.XMLHttpRequest;for(var n in r.open(t.method||"GET",t.url,!0),"arrayBuffer"===t.type&&(r.responseType="arraybuffer"),t.headers)r.setRequestHeader(n,t.headers[n]);return "json"===t.type&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===t.credentials,r.onerror=function(){e(new Error(r.statusText));},r.onload=function(){if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){var n=r.response;if("json"===t.type)try{n=JSON.parse(r.response);}catch(t){return e(t)}e(null,n,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"));}else e(new dt(r.statusText,r.status,t.url));},r.send(t.body),{cancel:function(){return r.abort()}}}(t,e)},wt=function(t,e){return bt(h(t,{type:"arrayBuffer"}),e)},_t=function(t,e){return bt(h(t,{method:"POST"}),e)},At="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";gt=[],xt=0;var St=function(t,e){if(U.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),xt>=O.MAX_PARALLEL_IMAGE_REQUESTS){var r={requestParameters:t,callback:e,cancelled:!1,cancel:function(){this.cancelled=!0;}};return gt.push(r),r}xt++;var n=!1,i=function(){if(!n)for(n=!0,xt--;gt.length&&xt0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)},Et.prototype.setEventedParent=function(t,e){return this._eventedParent=t,this._eventedParentData=e,this};var Pt={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}},Mt=function(t,e,r,n){this.message=(t?t+": ":"")+r,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__);};function Bt(t){var e=t.value;return e?[new Mt(t.key,e,"constants have been deprecated as of v8")]:[]}function Tt(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];for(var n=0,i=e;n":"value"===t.itemType.kind?"array":"array<"+e+">"}return t.kind}var Yt=[Rt,Ot,Ut,jt,qt,Zt,Nt,Jt(Kt),Xt];function $t(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!$t(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else {if(t.kind===e.kind)return null;if("value"===t.kind)for(var r=0,n=Yt;r255?255:t}function i(t){return n("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function a(t){return (e="%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))<0?0:e>1?1:e;var e;}function o(t,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}try{e.parseCSSColor=function(t){var e,s=t.replace(/ /g,"").toLowerCase();if(s in r)return r[s].slice();if("#"===s[0])return 4===s.length?(e=parseInt(s.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===s.length&&(e=parseInt(s.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var u=s.indexOf("("),l=s.indexOf(")");if(-1!==u&&l+1===s.length){var p=s.substr(0,u),c=s.substr(u+1,l-(u+1)).split(","),h=1;switch(p){case"rgba":if(4!==c.length)return null;h=a(c.pop());case"rgb":return 3!==c.length?null:[i(c[0]),i(c[1]),i(c[2]),h];case"hsla":if(4!==c.length)return null;h=a(c.pop());case"hsl":if(3!==c.length)return null;var f=(parseFloat(c[0])%360+360)%360/360,y=a(c[1]),d=a(c[2]),m=d<=.5?d*(y+1):d+y-d*y,v=2*d-m;return [n(255*o(v,m,f+1/3)),n(255*o(v,m,f)),n(255*o(v,m,f-1/3)),h];default:return null}}return null};}catch(t){}})).parseCSSColor,ee=function(t,e,r,n){void 0===n&&(n=1),this.r=t,this.g=e,this.b=r,this.a=n;};ee.parse=function(t){if(t){if(t instanceof ee)return t;if("string"==typeof t){var e=te(t);if(e)return new ee(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3])}}},ee.prototype.toString=function(){var t=this.toArray(),e=t[1],r=t[2],n=t[3];return "rgba("+Math.round(t[0])+","+Math.round(e)+","+Math.round(r)+","+n+")"},ee.prototype.toArray=function(){var t=this.a;return 0===t?[0,0,0,0]:[255*this.r/t,255*this.g/t,255*this.b/t,t]},ee.black=new ee(0,0,0,1),ee.white=new ee(1,1,1,1),ee.transparent=new ee(0,0,0,0),ee.red=new ee(1,0,0,1);var re=function(t,e,r){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"});};re.prototype.compare=function(t,e){return this.collator.compare(t,e)},re.prototype.resolvedLocale=function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale};var ne=function(t,e,r,n,i){this.text=t,this.image=e,this.scale=r,this.fontStack=n,this.textColor=i;},ie=function(t){this.sections=t;};ie.fromString=function(t){return new ie([new ne(t,null,null,null,null)])},ie.prototype.isEmpty=function(){return 0===this.sections.length||!this.sections.some((function(t){return 0!==t.text.length||t.image&&0!==t.image.name.length}))},ie.factory=function(t){return t instanceof ie?t:ie.fromString(t)},ie.prototype.toString=function(){return 0===this.sections.length?"":this.sections.map((function(t){return t.text})).join("")},ie.prototype.serialize=function(){for(var t=["format"],e=0,r=this.sections;e=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:"Invalid rgba value ["+[t,e,r,n].join(", ")+"]: 'a' must be between 0 and 1.":"Invalid rgba value ["+("number"==typeof n?[t,e,r,n]:[t,e,r]).join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."}function se(t){if(null===t)return !0;if("string"==typeof t)return !0;if("boolean"==typeof t)return !0;if("number"==typeof t)return !0;if(t instanceof ee)return !0;if(t instanceof re)return !0;if(t instanceof ie)return !0;if(t instanceof ae)return !0;if(Array.isArray(t)){for(var e=0,r=t;e2){var s=t[1];if("string"!=typeof s||!(s in he)||"object"===s)return e.error('The item type argument of "array" must be one of string, number, boolean',1);a=he[s],n++;}else a=Kt;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);o=t[2],n++;}r=Jt(a,o);}else r=he[i];for(var u=[];n1)&&e.push(n);}}return e.concat(this.args.map((function(t){return t.serialize()})))};var ye=function(t){this.type=Zt,this.sections=t;};ye.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var r=t[1];if(!Array.isArray(r)&&"object"==typeof r)return e.error("First argument must be an image or text section.");for(var n=[],i=!1,a=1;a<=t.length-1;++a){var o=t[a];if(i&&"object"==typeof o&&!Array.isArray(o)){i=!1;var s=null;if(o["font-scale"]&&!(s=e.parse(o["font-scale"],1,Ot)))return null;var u=null;if(o["text-font"]&&!(u=e.parse(o["text-font"],1,Jt(Ut))))return null;var l=null;if(o["text-color"]&&!(l=e.parse(o["text-color"],1,qt)))return null;var p=n[n.length-1];p.scale=s,p.font=u,p.textColor=l;}else {var c=e.parse(t[a],1,Kt);if(!c)return null;var h=c.type.kind;if("string"!==h&&"value"!==h&&"null"!==h&&"resolvedImage"!==h)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,n.push({content:c,scale:null,font:null,textColor:null});}}return new ye(n)},ye.prototype.evaluate=function(t){return new ie(this.sections.map((function(e){var r=e.content.evaluate(t);return ue(r)===Xt?new ne("",r,null,null,null):new ne(le(r),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))},ye.prototype.eachChild=function(t){for(var e=0,r=this.sections;e-1),r},de.prototype.eachChild=function(t){t(this.input);},de.prototype.outputDefined=function(){return !1},de.prototype.serialize=function(){return ["image",this.input.serialize()]};var me={"to-boolean":jt,"to-color":qt,"to-number":Ot,"to-string":Ut},ve=function(t,e){this.type=t,this.args=e;};ve.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var r=t[0];if(("to-boolean"===r||"to-string"===r)&&2!==t.length)return e.error("Expected one argument.");for(var n=me[r],i=[],a=1;a4?"Invalid rbga value "+JSON.stringify(e)+": expected an array containing either three or four numeric values.":oe(e[0],e[1],e[2],e[3])))return new ee(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new ce(r||"Could not parse color from value '"+("string"==typeof e?e:String(JSON.stringify(e)))+"'")}if("number"===this.type.kind){for(var o=null,s=0,u=this.args;s=e[2]||t[1]<=e[1]||t[3]>=e[3])}function Se(t,e){var r=(180+t[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,i=Math.pow(2,e.z);return [Math.round(r*i*8192),Math.round(n*i*8192)]}function ke(t,e,r){return e[1]>t[1]!=r[1]>t[1]&&t[0]<(r[0]-e[0])*(t[1]-e[1])/(r[1]-e[1])+e[0]}function Ie(t,e){for(var r,n,i,a,o,s,u,l=!1,p=0,c=e.length;p0&&s<0||o<0&&s>0}function Ee(t,e,r){for(var n=0,i=r;nr[2]){var i=.5*n,a=t[0]-r[0]>i?-n:r[0]-t[0]>i?n:0;0===a&&(a=t[0]-r[2]>i?-n:r[2]-t[0]>i?n:0),t[0]+=a;}_e(e,t);}function Fe(t,e,r,n){for(var i=8192*Math.pow(2,n.z),a=[8192*n.x,8192*n.y],o=[],s=0,u=t;s=0)return !1;var r=!0;return t.eachChild((function(t){r&&!Ue(t,e)&&(r=!1);})),r}Le.parse=function(t,e){if(2!==t.length)return e.error("'within' expression requires exactly one argument, but found "+(t.length-1)+" instead.");if(se(t[1])){var r=t[1];if("FeatureCollection"===r.type)for(var n=0;ne))throw new ce("Input is not a number.");a=o-1;}return 0}qe.prototype.parse=function(t,e,r,n,i){return void 0===i&&(i={}),e?this.concat(e,r,n)._parse(t,i):this._parse(t,i)},qe.prototype._parse=function(t,e){function r(t,e,r){return "assert"===r?new fe(e,[t]):"coerce"===r?new ve(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var n=t[0];if("string"!=typeof n)return this.error("Expression name must be a string, but found "+typeof n+' instead. If you wanted a literal array, use ["literal", [...]].',0),null;var i=this.registry[n];if(i){var a=i.parse(t,this);if(!a)return null;if(this.expectedType){var o=this.expectedType,s=a.type;if("string"!==o.kind&&"number"!==o.kind&&"boolean"!==o.kind&&"object"!==o.kind&&"array"!==o.kind||"value"!==s.kind)if("color"!==o.kind&&"formatted"!==o.kind&&"resolvedImage"!==o.kind||"value"!==s.kind&&"string"!==s.kind){if(this.checkSubtype(o,s))return null}else a=r(a,o,e.typeAnnotation||"coerce");else a=r(a,o,e.typeAnnotation||"assert");}if(!(a instanceof pe)&&"resolvedImage"!==a.type.kind&&function t(e){if(e instanceof je)return t(e.boundExpression);if(e instanceof be&&"error"===e.name)return !1;if(e instanceof we)return !1;if(e instanceof Le)return !1;var r=e instanceof ve||e instanceof fe,n=!0;return e.eachChild((function(e){n=r?n&&t(e):n&&e instanceof pe;})),!!n&&Re(e)&&Ue(e,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}(a)){var u=new xe;try{a=new pe(a.type,a.evaluate(u));}catch(t){return this.error(t.message),null}}return a}return this.error('Unknown expression "'+n+'". If you wanted a literal array, use ["literal", [...]].',0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':"Expected an array, but found "+typeof t+" instead.")},qe.prototype.concat=function(t,e,r){var n="number"==typeof t?this.path.concat(t):this.path,i=r?this.scope.concat(r):this.scope;return new qe(this.registry,n,e||null,i,this.errors)},qe.prototype.error=function(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];var n=""+this.key+e.map((function(t){return "["+t+"]"})).join("");this.errors.push(new Dt(n,t));},qe.prototype.checkSubtype=function(t,e){var r=$t(t,e);return r&&this.error(r),r};var Ke=function(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(var n=0,i=r;n=o)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',u);var p=e.parse(s,l,i);if(!p)return null;i=i||p.type,n.push([o,p]);}return new Ke(i,r,n)},Ke.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);var i=e.length;return n>=e[i-1]?r[i-1].evaluate(t):r[Ne(e,n)].evaluate(t)},Ke.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t};var Ze=Object.freeze({__proto__:null,number:Ge,color:function(t,e,r){return new ee(Ge(t.r,e.r,r),Ge(t.g,e.g,r),Ge(t.b,e.b,r),Ge(t.a,e.a,r))},array:function(t,e,r){return t.map((function(t,n){return Ge(t,e[n],r)}))}}),Xe=6/29*3*(6/29),Je=Math.PI/180,He=180/Math.PI;function Ye(t){return t>.008856451679035631?Math.pow(t,1/3):t/Xe+4/29}function $e(t){return t>6/29?t*t*t:Xe*(t-4/29)}function We(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Qe(t){return (t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function tr(t){var e=Qe(t.r),r=Qe(t.g),n=Qe(t.b),i=Ye((.4124564*e+.3575761*r+.1804375*n)/.95047),a=Ye((.2126729*e+.7151522*r+.072175*n)/1);return {l:116*a-16,a:500*(i-a),b:200*(a-Ye((.0193339*e+.119192*r+.9503041*n)/1.08883)),alpha:t.a}}function er(t){var e=(t.l+16)/116,r=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=1*$e(e),r=.95047*$e(r),n=1.08883*$e(n),new ee(We(3.2404542*r-1.5371385*e-.4985314*n),We(-.969266*r+1.8760108*e+.041556*n),We(.0556434*r-.2040259*e+1.0572252*n),t.alpha)}function rr(t,e,r){var n=e-t;return t+r*(n>180||n<-180?n-360*Math.round(n/360):n)}var nr={forward:tr,reverse:er,interpolate:function(t,e,r){return {l:Ge(t.l,e.l,r),a:Ge(t.a,e.a,r),b:Ge(t.b,e.b,r),alpha:Ge(t.alpha,e.alpha,r)}}},ir={forward:function(t){var e=tr(t),r=e.l,n=e.a,i=e.b,a=Math.atan2(i,n)*He;return {h:a<0?a+360:a,c:Math.sqrt(n*n+i*i),l:r,alpha:t.a}},reverse:function(t){var e=t.h*Je,r=t.c;return er({l:t.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:t.alpha})},interpolate:function(t,e,r){return {h:rr(t.h,e.h,r),c:Ge(t.c,e.c,r),l:Ge(t.l,e.l,r),alpha:Ge(t.alpha,e.alpha,r)}}},ar=Object.freeze({__proto__:null,lab:nr,hcl:ir}),or=function(t,e,r,n,i){this.type=t,this.operator=e,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(var a=0,o=i;a1})))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:s};}if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(!(i=e.parse(i,2,Ot)))return null;var u=[],l=null;"interpolate-hcl"===r||"interpolate-lab"===r?l=qt:e.expectedType&&"value"!==e.expectedType.kind&&(l=e.expectedType);for(var p=0;p=c)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',f);var d=e.parse(h,y,l);if(!d)return null;l=l||d.type,u.push([c,d]);}return "number"===l.kind||"color"===l.kind||"array"===l.kind&&"number"===l.itemType.kind&&"number"==typeof l.N?new or(l,r,n,i,u):e.error("Type "+Ht(l)+" is not interpolatable.")},or.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);var i=e.length;if(n>=e[i-1])return r[i-1].evaluate(t);var a=Ne(e,n),o=or.interpolationFactor(this.interpolation,n,e[a],e[a+1]),s=r[a].evaluate(t),u=r[a+1].evaluate(t);return "interpolate"===this.operator?Ze[this.type.kind.toLowerCase()](s,u,o):"interpolate-hcl"===this.operator?ir.reverse(ir.interpolate(ir.forward(s),ir.forward(u),o)):nr.reverse(nr.interpolate(nr.forward(s),nr.forward(u),o))},or.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e=r.length)throw new ce("Array index out of bounds: "+e+" > "+(r.length-1)+".");if(e!==Math.floor(e))throw new ce("Array index must be an integer, but found "+e+" instead.");return r[e]},pr.prototype.eachChild=function(t){t(this.index),t(this.input);},pr.prototype.outputDefined=function(){return !1},pr.prototype.serialize=function(){return ["at",this.index.serialize(),this.input.serialize()]};var cr=function(t,e){this.type=jt,this.needle=t,this.haystack=e;};cr.parse=function(t,e){if(3!==t.length)return e.error("Expected 2 arguments, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1,Kt),n=e.parse(t[2],2,Kt);return r&&n?Wt(r.type,[jt,Ut,Ot,Rt,Kt])?new cr(r,n):e.error("Expected first argument to be of type boolean, string, number or null, but found "+Ht(r.type)+" instead"):null},cr.prototype.evaluate=function(t){var e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!r)return !1;if(!Qt(e,["boolean","string","number","null"]))throw new ce("Expected first argument to be of type boolean, string, number or null, but found "+Ht(ue(e))+" instead.");if(!Qt(r,["string","array"]))throw new ce("Expected second argument to be of type array or string, but found "+Ht(ue(r))+" instead.");return r.indexOf(e)>=0},cr.prototype.eachChild=function(t){t(this.needle),t(this.haystack);},cr.prototype.outputDefined=function(){return !0},cr.prototype.serialize=function(){return ["in",this.needle.serialize(),this.haystack.serialize()]};var hr=function(t,e,r){this.type=Ot,this.needle=t,this.haystack=e,this.fromIndex=r;};hr.parse=function(t,e){if(t.length<=2||t.length>=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1,Kt),n=e.parse(t[2],2,Kt);if(!r||!n)return null;if(!Wt(r.type,[jt,Ut,Ot,Rt,Kt]))return e.error("Expected first argument to be of type boolean, string, number or null, but found "+Ht(r.type)+" instead");if(4===t.length){var i=e.parse(t[3],3,Ot);return i?new hr(r,n,i):null}return new hr(r,n)},hr.prototype.evaluate=function(t){var e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!Qt(e,["boolean","string","number","null"]))throw new ce("Expected first argument to be of type boolean, string, number or null, but found "+Ht(ue(e))+" instead.");if(!Qt(r,["string","array"]))throw new ce("Expected second argument to be of type array or string, but found "+Ht(ue(r))+" instead.");if(this.fromIndex){var n=this.fromIndex.evaluate(t);return r.indexOf(e,n)}return r.indexOf(e)},hr.prototype.eachChild=function(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex);},hr.prototype.outputDefined=function(){return !1},hr.prototype.serialize=function(){if(null!=this.fromIndex&&void 0!==this.fromIndex){var t=this.fromIndex.serialize();return ["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return ["index-of",this.needle.serialize(),this.haystack.serialize()]};var fr=function(t,e,r,n,i,a){this.inputType=t,this.type=e,this.input=r,this.cases=n,this.outputs=i,this.otherwise=a;};fr.parse=function(t,e){if(t.length<5)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if(t.length%2!=1)return e.error("Expected an even number of arguments.");var r,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);for(var i={},a=[],o=2;oNumber.MAX_SAFE_INTEGER)return l.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if("number"==typeof h&&Math.floor(h)!==h)return l.error("Numeric branch labels must be integer values.");if(r){if(l.checkSubtype(r,ue(h)))return null}else r=ue(h);if(void 0!==i[String(h)])return l.error("Branch labels must be unique.");i[String(h)]=a.length;}var f=e.parse(u,o,n);if(!f)return null;n=n||f.type,a.push(f);}var y=e.parse(t[1],1,Kt);if(!y)return null;var d=e.parse(t[t.length-1],t.length-1,n);return d?"value"!==y.type.kind&&e.concat(1).checkSubtype(r,y.type)?null:new fr(r,n,y,i,a,d):null},fr.prototype.evaluate=function(t){var e=this.input.evaluate(t);return (ue(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)},fr.prototype.eachChild=function(t){t(this.input),this.outputs.forEach(t),t(this.otherwise);},fr.prototype.outputDefined=function(){return this.outputs.every((function(t){return t.outputDefined()}))&&this.otherwise.outputDefined()},fr.prototype.serialize=function(){for(var t=this,e=["match",this.input.serialize()],r=[],n={},i=0,a=Object.keys(this.cases).sort();i=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1,Kt),n=e.parse(t[2],2,Ot);if(!r||!n)return null;if(!Wt(r.type,[Jt(Kt),Ut,Kt]))return e.error("Expected first argument to be of type array or string, but found "+Ht(r.type)+" instead");if(4===t.length){var i=e.parse(t[3],3,Ot);return i?new dr(r.type,r,n,i):null}return new dr(r.type,r,n)},dr.prototype.evaluate=function(t){var e=this.input.evaluate(t),r=this.beginIndex.evaluate(t);if(!Qt(e,["string","array"]))throw new ce("Expected first argument to be of type array or string, but found "+Ht(ue(e))+" instead.");if(this.endIndex){var n=this.endIndex.evaluate(t);return e.slice(r,n)}return e.slice(r)},dr.prototype.eachChild=function(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex);},dr.prototype.outputDefined=function(){return !1},dr.prototype.serialize=function(){if(null!=this.endIndex&&void 0!==this.endIndex){var t=this.endIndex.serialize();return ["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return ["slice",this.input.serialize(),this.beginIndex.serialize()]};var xr=gr("==",(function(t,e,r){return e===r}),vr),br=gr("!=",(function(t,e,r){return e!==r}),(function(t,e,r,n){return !vr(0,e,r,n)})),wr=gr("<",(function(t,e,r){return e",(function(t,e,r){return e>r}),(function(t,e,r,n){return n.compare(e,r)>0})),Ar=gr("<=",(function(t,e,r){return e<=r}),(function(t,e,r,n){return n.compare(e,r)<=0})),Sr=gr(">=",(function(t,e,r){return e>=r}),(function(t,e,r,n){return n.compare(e,r)>=0})),kr=function(t,e,r,n,i){this.type=Ut,this.number=t,this.locale=e,this.currency=r,this.minFractionDigits=n,this.maxFractionDigits=i;};kr.parse=function(t,e){if(3!==t.length)return e.error("Expected two arguments.");var r=e.parse(t[1],1,Ot);if(!r)return null;var n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");var i=null;if(n.locale&&!(i=e.parse(n.locale,1,Ut)))return null;var a=null;if(n.currency&&!(a=e.parse(n.currency,1,Ut)))return null;var o=null;if(n["min-fraction-digits"]&&!(o=e.parse(n["min-fraction-digits"],1,Ot)))return null;var s=null;return n["max-fraction-digits"]&&!(s=e.parse(n["max-fraction-digits"],1,Ot))?null:new kr(r,i,a,o,s)},kr.prototype.evaluate=function(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))},kr.prototype.eachChild=function(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits);},kr.prototype.outputDefined=function(){return !1},kr.prototype.serialize=function(){var t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]};var Ir=function(t){this.type=Ot,this.input=t;};Ir.parse=function(t,e){if(2!==t.length)return e.error("Expected 1 argument, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?e.error("Expected argument of type string or array, but found "+Ht(r.type)+" instead."):new Ir(r):null},Ir.prototype.evaluate=function(t){var e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new ce("Expected value to be of type string or array, but found "+Ht(ue(e))+" instead.")},Ir.prototype.eachChild=function(t){t(this.input);},Ir.prototype.outputDefined=function(){return !1},Ir.prototype.serialize=function(){var t=["length"];return this.eachChild((function(e){t.push(e.serialize());})),t};var zr={"==":xr,"!=":br,">":_r,"<":wr,">=":Sr,"<=":Ar,array:fe,at:pr,boolean:fe,case:yr,coalesce:ur,collator:we,format:ye,image:de,in:cr,"index-of":hr,interpolate:or,"interpolate-hcl":or,"interpolate-lab":or,length:Ir,let:lr,literal:pe,match:fr,number:fe,"number-format":kr,object:fe,slice:dr,step:Ke,string:fe,"to-boolean":ve,"to-color":ve,"to-number":ve,"to-string":ve,var:je,within:Le};function Cr(t,e){var r=e[0],n=e[1],i=e[2],a=e[3];r=r.evaluate(t),n=n.evaluate(t),i=i.evaluate(t);var o=a?a.evaluate(t):1,s=oe(r,n,i,o);if(s)throw new ce(s);return new ee(r/255*o,n/255*o,i/255*o,o)}function Er(t,e){return t in e}function Pr(t,e){var r=e[t];return void 0===r?null:r}function Mr(t){return {type:t}}function Br(t){return {result:"success",value:t}}function Tr(t){return {result:"error",value:t}}function Vr(t){return "data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function Fr(t){return !!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Dr(t){return !!t.expression&&t.expression.interpolated}function Lr(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Rr(t){return "object"==typeof t&&null!==t&&!Array.isArray(t)}function Or(t){return t}function Ur(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function jr(t,e,r,n,i){return Ur(typeof r===i?n[r]:void 0,t.default,e.default)}function qr(t,e,r){if("number"!==Lr(r))return Ur(t.default,e.default);var n=t.stops.length;if(1===n)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];var i=Ne(t.stops.map((function(t){return t[0]})),r);return t.stops[i][1]}function Nr(t,e,r){var n=void 0!==t.base?t.base:1;if("number"!==Lr(r))return Ur(t.default,e.default);var i=t.stops.length;if(1===i)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];var a=Ne(t.stops.map((function(t){return t[0]})),r),o=function(t,e,r,n){var i=n-r,a=t-r;return 0===i?0:1===e?a/i:(Math.pow(e,a)-1)/(Math.pow(e,i)-1)}(r,n,t.stops[a][0],t.stops[a+1][0]),s=t.stops[a][1],u=t.stops[a+1][1],l=Ze[e.type]||Or;if(t.colorSpace&&"rgb"!==t.colorSpace){var p=ar[t.colorSpace];l=function(t,e){return p.reverse(p.interpolate(p.forward(t),p.forward(e),o))};}return "function"==typeof s.evaluate?{evaluate:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=s.evaluate.apply(void 0,t),n=u.evaluate.apply(void 0,t);if(void 0!==r&&void 0!==n)return l(r,n,o)}}:l(s,u,o)}function Kr(t,e,r){return "color"===e.type?r=ee.parse(r):"formatted"===e.type?r=ie.fromString(r.toString()):"resolvedImage"===e.type?r=ae.fromString(r.toString()):Lr(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0),Ur(r,t.default,e.default)}be.register(zr,{error:[{kind:"error"},[Ut],function(t,e){throw new ce(e[0].evaluate(t))}],typeof:[Ut,[Kt],function(t,e){return Ht(ue(e[0].evaluate(t)))}],"to-rgba":[Jt(Ot,4),[qt],function(t,e){return e[0].evaluate(t).toArray()}],rgb:[qt,[Ot,Ot,Ot],Cr],rgba:[qt,[Ot,Ot,Ot,Ot],Cr],has:{type:jt,overloads:[[[Ut],function(t,e){return Er(e[0].evaluate(t),t.properties())}],[[Ut,Nt],function(t,e){var r=e[1];return Er(e[0].evaluate(t),r.evaluate(t))}]]},get:{type:Kt,overloads:[[[Ut],function(t,e){return Pr(e[0].evaluate(t),t.properties())}],[[Ut,Nt],function(t,e){var r=e[1];return Pr(e[0].evaluate(t),r.evaluate(t))}]]},"feature-state":[Kt,[Ut],function(t,e){return Pr(e[0].evaluate(t),t.featureState||{})}],properties:[Nt,[],function(t){return t.properties()}],"geometry-type":[Ut,[],function(t){return t.geometryType()}],id:[Kt,[],function(t){return t.id()}],zoom:[Ot,[],function(t){return t.globals.zoom}],"heatmap-density":[Ot,[],function(t){return t.globals.heatmapDensity||0}],"line-progress":[Ot,[],function(t){return t.globals.lineProgress||0}],accumulated:[Kt,[],function(t){return void 0===t.globals.accumulated?null:t.globals.accumulated}],"+":[Ot,Mr(Ot),function(t,e){for(var r=0,n=0,i=e;n":[jt,[Ut,Kt],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],a=n.value;return typeof i==typeof a&&i>a}],"filter-id->":[jt,[Kt],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n>i}],"filter-<=":[jt,[Ut,Kt],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],a=n.value;return typeof i==typeof a&&i<=a}],"filter-id-<=":[jt,[Kt],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n<=i}],"filter->=":[jt,[Ut,Kt],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],a=n.value;return typeof i==typeof a&&i>=a}],"filter-id->=":[jt,[Kt],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n>=i}],"filter-has":[jt,[Kt],function(t,e){return e[0].value in t.properties()}],"filter-has-id":[jt,[],function(t){return null!==t.id()&&void 0!==t.id()}],"filter-type-in":[jt,[Jt(Ut)],function(t,e){return e[0].value.indexOf(t.geometryType())>=0}],"filter-id-in":[jt,[Jt(Kt)],function(t,e){return e[0].value.indexOf(t.id())>=0}],"filter-in-small":[jt,[Ut,Jt(Kt)],function(t,e){var r=e[0];return e[1].value.indexOf(t.properties()[r.value])>=0}],"filter-in-large":[jt,[Ut,Jt(Kt)],function(t,e){var r=e[0],n=e[1];return function(t,e,r,n){for(;r<=n;){var i=r+n>>1;if(e[i]===t)return !0;e[i]>t?n=i-1:r=i+1;}return !1}(t.properties()[r.value],n.value,0,n.value.length-1)}],all:{type:jt,overloads:[[[jt,jt],function(t,e){var r=e[1];return e[0].evaluate(t)&&r.evaluate(t)}],[Mr(jt),function(t,e){for(var r=0,n=e;r0&&"string"==typeof t[0]&&t[0]in zr}function Xr(t,e){var r=new qe(zr,[],e?function(t){var e={color:qt,string:Ut,number:Ot,enum:Ut,boolean:jt,formatted:Zt,resolvedImage:Xt};return "array"===t.type?Jt(e[t.value]||Kt,t.length):e[t.type]}(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return n?Br(new Gr(n,e)):Tr(r.errors)}Gr.prototype.evaluateWithoutErrorHandling=function(t,e,r,n,i,a){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)},Gr.prototype.evaluate=function(t,e,r,n,i,a){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=a||null;try{var o=this.expression.evaluate(this._evaluator);if(null==o||"number"==typeof o&&o!=o)return this._defaultValue;if(this._enumValues&&!(o in this._enumValues))throw new ce("Expected value to be one of "+Object.keys(this._enumValues).map((function(t){return JSON.stringify(t)})).join(", ")+", but found "+JSON.stringify(o)+" instead.");return o}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}};var Jr=function(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Oe(e.expression);};Jr.prototype.evaluateWithoutErrorHandling=function(t,e,r,n,i,a){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,a)},Jr.prototype.evaluate=function(t,e,r,n,i,a){return this._styleExpression.evaluate(t,e,r,n,i,a)};var Hr=function(t,e,r,n){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Oe(e.expression),this.interpolationType=n;};function Yr(t,e){if("error"===(t=Xr(t,e)).result)return t;var r=t.value.expression,n=Re(r);if(!n&&!Vr(e))return Tr([new Dt("","data expressions not supported")]);var i=Ue(r,["zoom"]);if(!i&&!Fr(e))return Tr([new Dt("","zoom expressions not supported")]);var a=function t(e){var r=null;if(e instanceof lr)r=t(e.result);else if(e instanceof ur)for(var n=0,i=e.args;nn.maximum?[new Mt(e,r,r+" is greater than the maximum value "+n.maximum)]:[]}function en(t){var e,r,n,i=t.valueSpec,a=Vt(t.value.type),o={},s="categorical"!==a&&void 0===t.value.property,u=!s,l="array"===Lr(t.value.stops)&&"array"===Lr(t.value.stops[0])&&"object"===Lr(t.value.stops[0][0]),p=Wr({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===a)return [new Mt(t.key,t.value,'identity function may not have a "stops" property')];var e=[],r=t.value;return e=e.concat(Qr({key:t.key,value:r,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:c})),"array"===Lr(r)&&0===r.length&&e.push(new Mt(t.key,r,"array must have at least one stop")),e},default:function(t){return Sn({key:t.key,value:t.value,valueSpec:i,style:t.style,styleSpec:t.styleSpec})}}});return "identity"===a&&s&&p.push(new Mt(t.key,t.value,'missing required property "property"')),"identity"===a||t.value.stops||p.push(new Mt(t.key,t.value,'missing required property "stops"')),"exponential"===a&&t.valueSpec.expression&&!Dr(t.valueSpec)&&p.push(new Mt(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(u&&!Vr(t.valueSpec)?p.push(new Mt(t.key,t.value,"property functions not supported")):s&&!Fr(t.valueSpec)&&p.push(new Mt(t.key,t.value,"zoom functions not supported"))),"categorical"!==a&&!l||void 0!==t.value.property||p.push(new Mt(t.key,t.value,'"property" property is required')),p;function c(t){var e=[],a=t.value,s=t.key;if("array"!==Lr(a))return [new Mt(s,a,"array expected, "+Lr(a)+" found")];if(2!==a.length)return [new Mt(s,a,"array length 2 expected, length "+a.length+" found")];if(l){if("object"!==Lr(a[0]))return [new Mt(s,a,"object expected, "+Lr(a[0])+" found")];if(void 0===a[0].zoom)return [new Mt(s,a,"object stop key must have zoom")];if(void 0===a[0].value)return [new Mt(s,a,"object stop key must have value")];if(n&&n>Vt(a[0].zoom))return [new Mt(s,a[0].zoom,"stop zoom values must appear in ascending order")];Vt(a[0].zoom)!==n&&(n=Vt(a[0].zoom),r=void 0,o={}),e=e.concat(Wr({key:s+"[0]",value:a[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:tn,value:h}}));}else e=e.concat(h({key:s+"[0]",value:a[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},a));return Zr(Ft(a[1]))?e.concat([new Mt(s+"[1]",a[1],"expressions are not allowed in function stops.")]):e.concat(Sn({key:s+"[1]",value:a[1],valueSpec:i,style:t.style,styleSpec:t.styleSpec}))}function h(t,n){var s=Lr(t.value),u=Vt(t.value),l=null!==t.value?t.value:n;if(e){if(s!==e)return [new Mt(t.key,l,s+" stop domain type must match previous stop domain type "+e)]}else e=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return [new Mt(t.key,l,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==a){var p="number expected, "+s+" found";return Vr(i)&&void 0===a&&(p+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Mt(t.key,l,p)]}return "categorical"!==a||"number"!==s||isFinite(u)&&Math.floor(u)===u?"categorical"!==a&&"number"===s&&void 0!==r&&u=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return !1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(var e=0,r=t.slice(1);ee?1:0}function ln(t){if(!t)return !0;var e,r=t[0];return t.length<=1?"any"!==r:"=="===r?pn(t[1],t[2],"=="):"!="===r?fn(pn(t[1],t[2],"==")):"<"===r||">"===r||"<="===r||">="===r?pn(t[1],t[2],r):"any"===r?(e=t.slice(1),["any"].concat(e.map(ln))):"all"===r?["all"].concat(t.slice(1).map(ln)):"none"===r?["all"].concat(t.slice(1).map(ln).map(fn)):"in"===r?cn(t[1],t.slice(2)):"!in"===r?fn(cn(t[1],t.slice(2))):"has"===r?hn(t[1]):"!has"===r?fn(hn(t[1])):"within"!==r||t}function pn(t,e,r){switch(t){case"$type":return ["filter-type-"+r,e];case"$id":return ["filter-id-"+r,e];default:return ["filter-"+r,t,e]}}function cn(t,e){if(0===e.length)return !1;switch(t){case"$type":return ["filter-type-in",["literal",e]];case"$id":return ["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((function(t){return typeof t!=typeof e[0]}))?["filter-in-large",t,["literal",e.sort(un)]]:["filter-in-small",t,["literal",e]]}}function hn(t){switch(t){case"$type":return !0;case"$id":return ["filter-has-id"];default:return ["filter-has",t]}}function fn(t){return ["!",t]}function yn(t){return an(Ft(t.value))?rn(Tt({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):function t(e){var r=e.value,n=e.key;if("array"!==Lr(r))return [new Mt(n,r,"array expected, "+Lr(r)+" found")];var i,a=e.styleSpec,o=[];if(r.length<1)return [new Mt(n,r,"filter array must have at least 1 element")];switch(o=o.concat(nn({key:n+"[0]",value:r[0],valueSpec:a.filter_operator,style:e.style,styleSpec:e.styleSpec})),Vt(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&"$type"===Vt(r[1])&&o.push(new Mt(n,r,'"$type" cannot be use with operator "'+r[0]+'"'));case"==":case"!=":3!==r.length&&o.push(new Mt(n,r,'filter array for operator "'+r[0]+'" must have 3 elements'));case"in":case"!in":r.length>=2&&"string"!==(i=Lr(r[1]))&&o.push(new Mt(n+"[1]",r[1],"string expected, "+i+" found"));for(var s=2;s=p[f+0]&&n>=p[f+1])?(o[h]=!0,a.push(l[h])):o[h]=!1;}}},Fn.prototype._forEachCell=function(t,e,r,n,i,a,o,s){for(var u=this._convertToCellCoord(t),l=this._convertToCellCoord(e),p=this._convertToCellCoord(r),c=this._convertToCellCoord(n),h=u;h<=p;h++)for(var f=l;f<=c;f++){var y=this.d*f+h;if((!s||s(this._convertFromCellCoord(h),this._convertFromCellCoord(f),this._convertFromCellCoord(h+1),this._convertFromCellCoord(f+1)))&&i.call(this,t,e,r,n,y,a,o,s))return}},Fn.prototype._convertFromCellCoord=function(t){return (t-this.padding)/this.scale},Fn.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},Fn.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=3+this.cells.length+1+1,r=0,n=0;n=0)){var p=t[l];u[l]=Rn[s].shallow.indexOf(l)>=0?p:Nn(p,e);}t instanceof Error&&(u.message=t.message);}if(u.$name)throw new Error("$name property is reserved for worker serialization logic.");return "Object"!==s&&(u.$name=s),u}throw new Error("can't serialize object of type "+typeof t)}function Kn(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||jn(t)||qn(t)||ArrayBuffer.isView(t)||t instanceof Dn)return t;if(Array.isArray(t))return t.map(Kn);if("object"==typeof t){var e=t.$name||"Object",r=Rn[e].klass;if(!r)throw new Error("can't deserialize unregistered class "+e);if(r.deserialize)return r.deserialize(t);for(var n=Object.create(r.prototype),i=0,a=Object.keys(t);i=0?s:Kn(s);}}return n}throw new Error("can't deserialize object of type "+typeof t)}var Gn=function(){this.first=!0;};Gn.prototype.update=function(t,e){var r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoom=128&&t<=255},Arabic:function(t){return t>=1536&&t<=1791},"Arabic Supplement":function(t){return t>=1872&&t<=1919},"Arabic Extended-A":function(t){return t>=2208&&t<=2303},"Hangul Jamo":function(t){return t>=4352&&t<=4607},"Unified Canadian Aboriginal Syllabics":function(t){return t>=5120&&t<=5759},Khmer:function(t){return t>=6016&&t<=6143},"Unified Canadian Aboriginal Syllabics Extended":function(t){return t>=6320&&t<=6399},"General Punctuation":function(t){return t>=8192&&t<=8303},"Letterlike Symbols":function(t){return t>=8448&&t<=8527},"Number Forms":function(t){return t>=8528&&t<=8591},"Miscellaneous Technical":function(t){return t>=8960&&t<=9215},"Control Pictures":function(t){return t>=9216&&t<=9279},"Optical Character Recognition":function(t){return t>=9280&&t<=9311},"Enclosed Alphanumerics":function(t){return t>=9312&&t<=9471},"Geometric Shapes":function(t){return t>=9632&&t<=9727},"Miscellaneous Symbols":function(t){return t>=9728&&t<=9983},"Miscellaneous Symbols and Arrows":function(t){return t>=11008&&t<=11263},"CJK Radicals Supplement":function(t){return t>=11904&&t<=12031},"Kangxi Radicals":function(t){return t>=12032&&t<=12255},"Ideographic Description Characters":function(t){return t>=12272&&t<=12287},"CJK Symbols and Punctuation":function(t){return t>=12288&&t<=12351},Hiragana:function(t){return t>=12352&&t<=12447},Katakana:function(t){return t>=12448&&t<=12543},Bopomofo:function(t){return t>=12544&&t<=12591},"Hangul Compatibility Jamo":function(t){return t>=12592&&t<=12687},Kanbun:function(t){return t>=12688&&t<=12703},"Bopomofo Extended":function(t){return t>=12704&&t<=12735},"CJK Strokes":function(t){return t>=12736&&t<=12783},"Katakana Phonetic Extensions":function(t){return t>=12784&&t<=12799},"Enclosed CJK Letters and Months":function(t){return t>=12800&&t<=13055},"CJK Compatibility":function(t){return t>=13056&&t<=13311},"CJK Unified Ideographs Extension A":function(t){return t>=13312&&t<=19903},"Yijing Hexagram Symbols":function(t){return t>=19904&&t<=19967},"CJK Unified Ideographs":function(t){return t>=19968&&t<=40959},"Yi Syllables":function(t){return t>=40960&&t<=42127},"Yi Radicals":function(t){return t>=42128&&t<=42191},"Hangul Jamo Extended-A":function(t){return t>=43360&&t<=43391},"Hangul Syllables":function(t){return t>=44032&&t<=55215},"Hangul Jamo Extended-B":function(t){return t>=55216&&t<=55295},"Private Use Area":function(t){return t>=57344&&t<=63743},"CJK Compatibility Ideographs":function(t){return t>=63744&&t<=64255},"Arabic Presentation Forms-A":function(t){return t>=64336&&t<=65023},"Vertical Forms":function(t){return t>=65040&&t<=65055},"CJK Compatibility Forms":function(t){return t>=65072&&t<=65103},"Small Form Variants":function(t){return t>=65104&&t<=65135},"Arabic Presentation Forms-B":function(t){return t>=65136&&t<=65279},"Halfwidth and Fullwidth Forms":function(t){return t>=65280&&t<=65519}};function Xn(t){for(var e=0,r=t;e=65097&&t<=65103)||Zn["CJK Compatibility Ideographs"](t)||Zn["CJK Compatibility"](t)||Zn["CJK Radicals Supplement"](t)||Zn["CJK Strokes"](t)||!(!Zn["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||Zn["CJK Unified Ideographs Extension A"](t)||Zn["CJK Unified Ideographs"](t)||Zn["Enclosed CJK Letters and Months"](t)||Zn["Hangul Compatibility Jamo"](t)||Zn["Hangul Jamo Extended-A"](t)||Zn["Hangul Jamo Extended-B"](t)||Zn["Hangul Jamo"](t)||Zn["Hangul Syllables"](t)||Zn.Hiragana(t)||Zn["Ideographic Description Characters"](t)||Zn.Kanbun(t)||Zn["Kangxi Radicals"](t)||Zn["Katakana Phonetic Extensions"](t)||Zn.Katakana(t)&&12540!==t||!(!Zn["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!Zn["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||Zn["Unified Canadian Aboriginal Syllabics"](t)||Zn["Unified Canadian Aboriginal Syllabics Extended"](t)||Zn["Vertical Forms"](t)||Zn["Yijing Hexagram Symbols"](t)||Zn["Yi Syllables"](t)||Zn["Yi Radicals"](t))))}function Hn(t){return !(Jn(t)||function(t){return !!(Zn["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||Zn["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||Zn["Letterlike Symbols"](t)||Zn["Number Forms"](t)||Zn["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||Zn["Control Pictures"](t)&&9251!==t||Zn["Optical Character Recognition"](t)||Zn["Enclosed Alphanumerics"](t)||Zn["Geometric Shapes"](t)||Zn["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Zn["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Zn["CJK Symbols and Punctuation"](t)||Zn.Katakana(t)||Zn["Private Use Area"](t)||Zn["CJK Compatibility Forms"](t)||Zn["Small Form Variants"](t)||Zn["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Yn(t){return t>=1424&&t<=2303||Zn["Arabic Presentation Forms-A"](t)||Zn["Arabic Presentation Forms-B"](t)}function $n(t,e){return !(!e&&Yn(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||Zn.Khmer(t))}function Wn(t){for(var e=0,r=t;e-1&&(ti="error"),Qn&&Qn(t);};function ni(){ii.fire(new zt("pluginStateChange",{pluginStatus:ti,pluginURL:ei}));}var ii=new Et,ai=function(){return ti},oi=function(){if("deferred"!==ti||!ei)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");ti="loading",ni(),ei&&wt({url:ei},(function(t){t?ri(t):(ti="loaded",ni());}));},si={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:function(){return "loaded"===ti||null!=si.applyArabicShaping},isLoading:function(){return "loading"===ti},setState:function(t){ti=t.pluginStatus,ei=t.pluginURL;},isParsed:function(){return null!=si.applyArabicShaping&&null!=si.processBidirectionalText&&null!=si.processStyledBidirectionalText},getPluginURL:function(){return ei}},ui=function(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Gn,this.transition={});};ui.prototype.isSupportedScript=function(t){return function(t,e){for(var r=0,n=t;rthis.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*e}};var li=function(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(Rr(t))return new $r(t,e);if(Zr(t)){var r=Yr(t,e);if("error"===r.result)throw new Error(r.value.map((function(t){return t.key+": "+t.message})).join(", "));return r.value}var n=t;return "string"==typeof t&&"color"===e.type&&(n=ee.parse(t)),{kind:"constant",evaluate:function(){return n}}}(void 0===e?t.specification.default:e,t.specification);};li.prototype.isDataDriven=function(){return "source"===this.expression.kind||"composite"===this.expression.kind},li.prototype.possiblyEvaluate=function(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)};var pi=function(t){this.property=t,this.value=new li(t,void 0);};pi.prototype.transitioned=function(t,e){return new hi(this.property,this.value,e,h({},t.transition,this.transition),t.now)},pi.prototype.untransitioned=function(){return new hi(this.property,this.value,null,{},0)};var ci=function(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues);};ci.prototype.getValue=function(t){return w(this._values[t].value.value)},ci.prototype.setValue=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new pi(this._values[t].property)),this._values[t].value=new li(this._values[t].property,null===e?void 0:w(e));},ci.prototype.getTransition=function(t){return w(this._values[t].transition)},ci.prototype.setTransition=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new pi(this._values[t].property)),this._values[t].transition=w(e)||void 0;},ci.prototype.serialize=function(){for(var t={},e=0,r=Object.keys(this._values);ethis.end)return this.prior=null,i;if(this.value.isDataDriven())return this.prior=null,i;if(n=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}(o))}return i};var fi=function(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues);};fi.prototype.possiblyEvaluate=function(t,e,r){for(var n=new mi(this._properties),i=0,a=Object.keys(this._values);in.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}},e.prototype.interpolate=function(t){return t},e}(gi),bi=function(t){this.specification=t;};bi.prototype.possiblyEvaluate=function(t,e,r,n){if(void 0!==t.value){if("constant"===t.expression.kind){var i=t.expression.evaluate(e,null,{},r,n);return this._calculate(i,i,i,e)}return this._calculate(t.expression.evaluate(new ui(Math.floor(e.zoom-1),e)),t.expression.evaluate(new ui(Math.floor(e.zoom),e)),t.expression.evaluate(new ui(Math.floor(e.zoom+1),e)),e)}},bi.prototype._calculate=function(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}},bi.prototype.interpolate=function(t){return t};var wi=function(t){this.specification=t;};wi.prototype.possiblyEvaluate=function(t,e,r,n){return !!t.expression.evaluate(e,null,{},r,n)},wi.prototype.interpolate=function(){return !1};var _i=function(t){for(var e in this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[],t){var r=t[e];r.specification.overridable&&this.overridableProperties.push(e);var n=this.defaultPropertyValues[e]=new li(r,void 0),i=this.defaultTransitionablePropertyValues[e]=new pi(r);this.defaultTransitioningPropertyValues[e]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=n.possiblyEvaluate({});}};On("DataDrivenProperty",gi),On("DataConstantProperty",vi),On("CrossFadedDataDrivenProperty",xi),On("CrossFadedProperty",bi),On("ColorRampProperty",wi);var Ai=function(t){function e(e,r){if(t.call(this),this.id=e.id,this.type=e.type,this._featureFilter={filter:function(){return !0},needGeometry:!1},"custom"!==e.type&&(this.metadata=(e=e).metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new yi(r.layout)),r.paint)){for(var n in this._transitionablePaint=new ci(r.paint),e.paint)this.setPaintProperty(n,e.paint[n],{validate:!1});for(var i in e.layout)this.setLayoutProperty(i,e.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new mi(r.paint);}}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getCrossfadeParameters=function(){return this._crossfadeParameters},e.prototype.getLayoutProperty=function(t){return "visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)},e.prototype.setLayoutProperty=function(t,e,r){void 0===r&&(r={}),null!=e&&this._validate(Bn,"layers."+this.id+".layout."+t,t,e,r)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e);},e.prototype.getPaintProperty=function(t){return g(t,"-transition")?this._transitionablePaint.getTransition(t.slice(0,-"-transition".length)):this._transitionablePaint.getValue(t)},e.prototype.setPaintProperty=function(t,e,r){if(void 0===r&&(r={}),null!=e&&this._validate(Mn,"layers."+this.id+".paint."+t,t,e,r))return !1;if(g(t,"-transition"))return this._transitionablePaint.setTransition(t.slice(0,-"-transition".length),e||void 0),!1;var n=this._transitionablePaint._values[t],i="cross-faded-data-driven"===n.property.specification["property-type"],a=n.value.isDataDriven(),o=n.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);var s=this._transitionablePaint._values[t].value;return s.isDataDriven()||a||i||this._handleOverridablePaintPropertyUpdate(t,o,s)},e.prototype._handleSpecialPaintPropertyUpdate=function(t){},e.prototype._handleOverridablePaintPropertyUpdate=function(t,e,r){return !1},e.prototype.isHidden=function(t){return !!(this.minzoom&&t=this.maxzoom)||"none"===this.visibility},e.prototype.updateTransitions=function(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint);},e.prototype.hasTransition=function(){return this._transitioningPaint.hasTransition()},e.prototype.recalculate=function(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e);},e.prototype.serialize=function(){var t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),b(t,(function(t,e){return !(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)}))},e.prototype._validate=function(t,e,r,n,i){return void 0===i&&(i={}),(!i||!1!==i.validate)&&Tn(this,t.call(En,{key:e,layerType:this.type,objectKey:r,value:n,styleSpec:Pt,style:{glyphs:!0,sprite:!0}}))},e.prototype.is3D=function(){return !1},e.prototype.isTileClipped=function(){return !1},e.prototype.hasOffscreenPass=function(){return !1},e.prototype.resize=function(){},e.prototype.isStateDependent=function(){for(var t in this.paint._values){var e=this.paint.get(t);if(e instanceof di&&Vr(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return !0}return !1},e}(Et),Si={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},ki=function(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8;},Ii=function(){this.isTransferred=!1,this.capacity=-1,this.resize(0);};function zi(t,e){void 0===e&&(e=1);var r=0,n=0;return {members:t.map((function(t){var i=Si[t.type].BYTES_PER_ELEMENT,a=r=Ci(r,Math.max(e,i)),o=t.components||1;return n=Math.max(n,i),r+=i*o,{name:t.name,type:t.type,components:o,offset:a}})),size:Ci(r,Math.max(n,e)),alignment:e}}function Ci(t,e){return Math.ceil(t/e)*e}Ii.serialize=function(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}},Ii.deserialize=function(t){var e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e},Ii.prototype._trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews());},Ii.prototype.clear=function(){this.length=0;},Ii.prototype.resize=function(t){this.reserve(t),this.length=t;},Ii.prototype.reserve=function(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e);}},Ii.prototype._refreshViews=function(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")};var Ei=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e){var r=this.length;return this.resize(r+1),this.emplace(r,t,e)},e.prototype.emplace=function(t,e,r){var n=2*t;return this.int16[n+0]=e,this.int16[n+1]=r,t},e}(Ii);Ei.prototype.bytesPerElement=4,On("StructArrayLayout2i4",Ei);var Pi=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r,n){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)},e.prototype.emplace=function(t,e,r,n,i){var a=4*t;return this.int16[a+0]=e,this.int16[a+1]=r,this.int16[a+2]=n,this.int16[a+3]=i,t},e}(Ii);Pi.prototype.bytesPerElement=8,On("StructArrayLayout4i8",Pi);var Mi=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r,n,i,a){var o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,a)},e.prototype.emplace=function(t,e,r,n,i,a,o){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,this.int16[s+4]=a,this.int16[s+5]=o,t},e}(Ii);Mi.prototype.bytesPerElement=12,On("StructArrayLayout2i4i12",Mi);var Bi=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r,n,i,a){var o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,a)},e.prototype.emplace=function(t,e,r,n,i,a,o){var s=4*t,u=8*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.uint8[u+4]=n,this.uint8[u+5]=i,this.uint8[u+6]=a,this.uint8[u+7]=o,t},e}(Ii);Bi.prototype.bytesPerElement=8,On("StructArrayLayout2i4ub8",Bi);var Ti=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e){var r=this.length;return this.resize(r+1),this.emplace(r,t,e)},e.prototype.emplace=function(t,e,r){var n=2*t;return this.float32[n+0]=e,this.float32[n+1]=r,t},e}(Ii);Ti.prototype.bytesPerElement=8,On("StructArrayLayout2f8",Ti);var Vi=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r,n,i,a,o,s,u,l){var p=this.length;return this.resize(p+1),this.emplace(p,t,e,r,n,i,a,o,s,u,l)},e.prototype.emplace=function(t,e,r,n,i,a,o,s,u,l,p){var c=10*t;return this.uint16[c+0]=e,this.uint16[c+1]=r,this.uint16[c+2]=n,this.uint16[c+3]=i,this.uint16[c+4]=a,this.uint16[c+5]=o,this.uint16[c+6]=s,this.uint16[c+7]=u,this.uint16[c+8]=l,this.uint16[c+9]=p,t},e}(Ii);Vi.prototype.bytesPerElement=20,On("StructArrayLayout10ui20",Vi);var Fi=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r,n,i,a,o,s,u,l,p,c){var h=this.length;return this.resize(h+1),this.emplace(h,t,e,r,n,i,a,o,s,u,l,p,c)},e.prototype.emplace=function(t,e,r,n,i,a,o,s,u,l,p,c,h){var f=12*t;return this.int16[f+0]=e,this.int16[f+1]=r,this.int16[f+2]=n,this.int16[f+3]=i,this.uint16[f+4]=a,this.uint16[f+5]=o,this.uint16[f+6]=s,this.uint16[f+7]=u,this.int16[f+8]=l,this.int16[f+9]=p,this.int16[f+10]=c,this.int16[f+11]=h,t},e}(Ii);Fi.prototype.bytesPerElement=24,On("StructArrayLayout4i4ui4i24",Fi);var Di=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var i=3*t;return this.float32[i+0]=e,this.float32[i+1]=r,this.float32[i+2]=n,t},e}(Ii);Di.prototype.bytesPerElement=12,On("StructArrayLayout3f12",Di);var Li=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.uint32[1*t+0]=e,t},e}(Ii);Li.prototype.bytesPerElement=4,On("StructArrayLayout1ul4",Li);var Ri=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r,n,i,a,o,s,u){var l=this.length;return this.resize(l+1),this.emplace(l,t,e,r,n,i,a,o,s,u)},e.prototype.emplace=function(t,e,r,n,i,a,o,s,u,l){var p=10*t,c=5*t;return this.int16[p+0]=e,this.int16[p+1]=r,this.int16[p+2]=n,this.int16[p+3]=i,this.int16[p+4]=a,this.int16[p+5]=o,this.uint32[c+3]=s,this.uint16[p+8]=u,this.uint16[p+9]=l,t},e}(Ii);Ri.prototype.bytesPerElement=20,On("StructArrayLayout6i1ul2ui20",Ri);var Oi=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r,n,i,a){var o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,a)},e.prototype.emplace=function(t,e,r,n,i,a,o){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,this.int16[s+4]=a,this.int16[s+5]=o,t},e}(Ii);Oi.prototype.bytesPerElement=12,On("StructArrayLayout2i2i2i12",Oi);var Ui=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r,n,i){var a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i)},e.prototype.emplace=function(t,e,r,n,i,a){var o=4*t,s=8*t;return this.float32[o+0]=e,this.float32[o+1]=r,this.float32[o+2]=n,this.int16[s+6]=i,this.int16[s+7]=a,t},e}(Ii);Ui.prototype.bytesPerElement=16,On("StructArrayLayout2f1f2i16",Ui);var ji=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r,n){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)},e.prototype.emplace=function(t,e,r,n,i){var a=12*t,o=3*t;return this.uint8[a+0]=e,this.uint8[a+1]=r,this.float32[o+1]=n,this.float32[o+2]=i,t},e}(Ii);ji.prototype.bytesPerElement=12,On("StructArrayLayout2ub2f12",ji);var qi=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var i=3*t;return this.uint16[i+0]=e,this.uint16[i+1]=r,this.uint16[i+2]=n,t},e}(Ii);qi.prototype.bytesPerElement=6,On("StructArrayLayout3ui6",qi);var Ni=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r,n,i,a,o,s,u,l,p,c,h,f,y,d,m){var v=this.length;return this.resize(v+1),this.emplace(v,t,e,r,n,i,a,o,s,u,l,p,c,h,f,y,d,m)},e.prototype.emplace=function(t,e,r,n,i,a,o,s,u,l,p,c,h,f,y,d,m,v){var g=24*t,x=12*t,b=48*t;return this.int16[g+0]=e,this.int16[g+1]=r,this.uint16[g+2]=n,this.uint16[g+3]=i,this.uint32[x+2]=a,this.uint32[x+3]=o,this.uint32[x+4]=s,this.uint16[g+10]=u,this.uint16[g+11]=l,this.uint16[g+12]=p,this.float32[x+7]=c,this.float32[x+8]=h,this.uint8[b+36]=f,this.uint8[b+37]=y,this.uint8[b+38]=d,this.uint32[x+10]=m,this.int16[g+22]=v,t},e}(Ii);Ni.prototype.bytesPerElement=48,On("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Ni);var Ki=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r,n,i,a,o,s,u,l,p,c,h,f,y,d,m,v,g,x,b,w,_,A,S,k,I,z){var C=this.length;return this.resize(C+1),this.emplace(C,t,e,r,n,i,a,o,s,u,l,p,c,h,f,y,d,m,v,g,x,b,w,_,A,S,k,I,z)},e.prototype.emplace=function(t,e,r,n,i,a,o,s,u,l,p,c,h,f,y,d,m,v,g,x,b,w,_,A,S,k,I,z,C){var E=34*t,P=17*t;return this.int16[E+0]=e,this.int16[E+1]=r,this.int16[E+2]=n,this.int16[E+3]=i,this.int16[E+4]=a,this.int16[E+5]=o,this.int16[E+6]=s,this.int16[E+7]=u,this.uint16[E+8]=l,this.uint16[E+9]=p,this.uint16[E+10]=c,this.uint16[E+11]=h,this.uint16[E+12]=f,this.uint16[E+13]=y,this.uint16[E+14]=d,this.uint16[E+15]=m,this.uint16[E+16]=v,this.uint16[E+17]=g,this.uint16[E+18]=x,this.uint16[E+19]=b,this.uint16[E+20]=w,this.uint16[E+21]=_,this.uint16[E+22]=A,this.uint32[P+12]=S,this.float32[P+13]=k,this.float32[P+14]=I,this.float32[P+15]=z,this.float32[P+16]=C,t},e}(Ii);Ki.prototype.bytesPerElement=68,On("StructArrayLayout8i15ui1ul4f68",Ki);var Gi=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.float32[1*t+0]=e,t},e}(Ii);Gi.prototype.bytesPerElement=4,On("StructArrayLayout1f4",Gi);var Zi=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var i=3*t;return this.int16[i+0]=e,this.int16[i+1]=r,this.int16[i+2]=n,t},e}(Ii);Zi.prototype.bytesPerElement=6,On("StructArrayLayout3i6",Zi);var Xi=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var i=4*t;return this.uint32[2*t+0]=e,this.uint16[i+2]=r,this.uint16[i+3]=n,t},e}(Ii);Xi.prototype.bytesPerElement=8,On("StructArrayLayout1ul2ui8",Xi);var Ji=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e){var r=this.length;return this.resize(r+1),this.emplace(r,t,e)},e.prototype.emplace=function(t,e,r){var n=2*t;return this.uint16[n+0]=e,this.uint16[n+1]=r,t},e}(Ii);Ji.prototype.bytesPerElement=4,On("StructArrayLayout2ui4",Ji);var Hi=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.uint16[1*t+0]=e,t},e}(Ii);Hi.prototype.bytesPerElement=2,On("StructArrayLayout1ui2",Hi);var Yi=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r,n){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)},e.prototype.emplace=function(t,e,r,n,i){var a=4*t;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=n,this.float32[a+3]=i,t},e}(Ii);Yi.prototype.bytesPerElement=16,On("StructArrayLayout4f16",Yi);var $i=function(t){function e(){t.apply(this,arguments);}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={anchorPointX:{configurable:!0},anchorPointY:{configurable:!0},x1:{configurable:!0},y1:{configurable:!0},x2:{configurable:!0},y2:{configurable:!0},featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0},anchorPoint:{configurable:!0}};return r.anchorPointX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorPointY.get=function(){return this._structArray.int16[this._pos2+1]},r.x1.get=function(){return this._structArray.int16[this._pos2+2]},r.y1.get=function(){return this._structArray.int16[this._pos2+3]},r.x2.get=function(){return this._structArray.int16[this._pos2+4]},r.y2.get=function(){return this._structArray.int16[this._pos2+5]},r.featureIndex.get=function(){return this._structArray.uint32[this._pos4+3]},r.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+8]},r.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+9]},r.anchorPoint.get=function(){return new i(this.anchorPointX,this.anchorPointY)},Object.defineProperties(e.prototype,r),e}(ki);$i.prototype.size=20;var Wi=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new $i(this,t)},e}(Ri);On("CollisionBoxArray",Wi);var Qi=function(t){function e(){t.apply(this,arguments);}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={anchorX:{configurable:!0},anchorY:{configurable:!0},glyphStartIndex:{configurable:!0},numGlyphs:{configurable:!0},vertexStartIndex:{configurable:!0},lineStartIndex:{configurable:!0},lineLength:{configurable:!0},segment:{configurable:!0},lowerSize:{configurable:!0},upperSize:{configurable:!0},lineOffsetX:{configurable:!0},lineOffsetY:{configurable:!0},writingMode:{configurable:!0},placedOrientation:{configurable:!0},hidden:{configurable:!0},crossTileID:{configurable:!0},associatedIconIndex:{configurable:!0}};return r.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},r.glyphStartIndex.get=function(){return this._structArray.uint16[this._pos2+2]},r.numGlyphs.get=function(){return this._structArray.uint16[this._pos2+3]},r.vertexStartIndex.get=function(){return this._structArray.uint32[this._pos4+2]},r.lineStartIndex.get=function(){return this._structArray.uint32[this._pos4+3]},r.lineLength.get=function(){return this._structArray.uint32[this._pos4+4]},r.segment.get=function(){return this._structArray.uint16[this._pos2+10]},r.lowerSize.get=function(){return this._structArray.uint16[this._pos2+11]},r.upperSize.get=function(){return this._structArray.uint16[this._pos2+12]},r.lineOffsetX.get=function(){return this._structArray.float32[this._pos4+7]},r.lineOffsetY.get=function(){return this._structArray.float32[this._pos4+8]},r.writingMode.get=function(){return this._structArray.uint8[this._pos1+36]},r.placedOrientation.get=function(){return this._structArray.uint8[this._pos1+37]},r.placedOrientation.set=function(t){this._structArray.uint8[this._pos1+37]=t;},r.hidden.get=function(){return this._structArray.uint8[this._pos1+38]},r.hidden.set=function(t){this._structArray.uint8[this._pos1+38]=t;},r.crossTileID.get=function(){return this._structArray.uint32[this._pos4+10]},r.crossTileID.set=function(t){this._structArray.uint32[this._pos4+10]=t;},r.associatedIconIndex.get=function(){return this._structArray.int16[this._pos2+22]},Object.defineProperties(e.prototype,r),e}(ki);Qi.prototype.size=48;var ta=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new Qi(this,t)},e}(Ni);On("PlacedSymbolArray",ta);var ea=function(t){function e(){t.apply(this,arguments);}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={anchorX:{configurable:!0},anchorY:{configurable:!0},rightJustifiedTextSymbolIndex:{configurable:!0},centerJustifiedTextSymbolIndex:{configurable:!0},leftJustifiedTextSymbolIndex:{configurable:!0},verticalPlacedTextSymbolIndex:{configurable:!0},placedIconSymbolIndex:{configurable:!0},verticalPlacedIconSymbolIndex:{configurable:!0},key:{configurable:!0},textBoxStartIndex:{configurable:!0},textBoxEndIndex:{configurable:!0},verticalTextBoxStartIndex:{configurable:!0},verticalTextBoxEndIndex:{configurable:!0},iconBoxStartIndex:{configurable:!0},iconBoxEndIndex:{configurable:!0},verticalIconBoxStartIndex:{configurable:!0},verticalIconBoxEndIndex:{configurable:!0},featureIndex:{configurable:!0},numHorizontalGlyphVertices:{configurable:!0},numVerticalGlyphVertices:{configurable:!0},numIconVertices:{configurable:!0},numVerticalIconVertices:{configurable:!0},useRuntimeCollisionCircles:{configurable:!0},crossTileID:{configurable:!0},textBoxScale:{configurable:!0},textOffset0:{configurable:!0},textOffset1:{configurable:!0},collisionCircleDiameter:{configurable:!0}};return r.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},r.rightJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+2]},r.centerJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+3]},r.leftJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+4]},r.verticalPlacedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+5]},r.placedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+6]},r.verticalPlacedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+7]},r.key.get=function(){return this._structArray.uint16[this._pos2+8]},r.textBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+9]},r.textBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+10]},r.verticalTextBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+11]},r.verticalTextBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+12]},r.iconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+13]},r.iconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+14]},r.verticalIconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+15]},r.verticalIconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+16]},r.featureIndex.get=function(){return this._structArray.uint16[this._pos2+17]},r.numHorizontalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+18]},r.numVerticalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+19]},r.numIconVertices.get=function(){return this._structArray.uint16[this._pos2+20]},r.numVerticalIconVertices.get=function(){return this._structArray.uint16[this._pos2+21]},r.useRuntimeCollisionCircles.get=function(){return this._structArray.uint16[this._pos2+22]},r.crossTileID.get=function(){return this._structArray.uint32[this._pos4+12]},r.crossTileID.set=function(t){this._structArray.uint32[this._pos4+12]=t;},r.textBoxScale.get=function(){return this._structArray.float32[this._pos4+13]},r.textOffset0.get=function(){return this._structArray.float32[this._pos4+14]},r.textOffset1.get=function(){return this._structArray.float32[this._pos4+15]},r.collisionCircleDiameter.get=function(){return this._structArray.float32[this._pos4+16]},Object.defineProperties(e.prototype,r),e}(ki);ea.prototype.size=68;var ra=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new ea(this,t)},e}(Ki);On("SymbolInstanceArray",ra);var na=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getoffsetX=function(t){return this.float32[1*t+0]},e}(Gi);On("GlyphOffsetArray",na);var ia=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getx=function(t){return this.int16[3*t+0]},e.prototype.gety=function(t){return this.int16[3*t+1]},e.prototype.gettileUnitDistanceFromAnchor=function(t){return this.int16[3*t+2]},e}(Zi);On("SymbolLineVertexArray",ia);var aa=function(t){function e(){t.apply(this,arguments);}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0}};return r.featureIndex.get=function(){return this._structArray.uint32[this._pos4+0]},r.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+2]},r.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+3]},Object.defineProperties(e.prototype,r),e}(ki);aa.prototype.size=8;var oa=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new aa(this,t)},e}(Xi);On("FeatureIndexArray",oa);var sa=zi([{name:"a_pos",components:2,type:"Int16"}],4).members,ua=function(t){void 0===t&&(t=[]),this.segments=t;};function la(t,e){return 256*(t=p(Math.floor(t),0,255))+p(Math.floor(e),0,255)}ua.prototype.prepareSegment=function(t,e,r,n){var i=this.segments[this.segments.length-1];return t>ua.MAX_VERTEX_ARRAY_LENGTH&&A("Max vertices per segment is "+ua.MAX_VERTEX_ARRAY_LENGTH+": bucket requested "+t),(!i||i.vertexLength+t>ua.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==n)&&(i={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},void 0!==n&&(i.sortKey=n),this.segments.push(i)),i},ua.prototype.get=function(){return this.segments},ua.prototype.destroy=function(){for(var t=0,e=this.segments;t>>16)*o&65535)<<16)&4294967295)<<15|u>>>17))*s+(((u>>>16)*s&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(a>>>16)&65535)<<16);switch(u=0,r){case 3:u^=(255&t.charCodeAt(l+2))<<16;case 2:u^=(255&t.charCodeAt(l+1))<<8;case 1:i^=u=(65535&(u=(u=(65535&(u^=255&t.charCodeAt(l)))*o+(((u>>>16)*o&65535)<<16)&4294967295)<<15|u>>>17))*s+(((u>>>16)*s&65535)<<16)&4294967295;}return i^=t.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0};})),ha=e((function(t){t.exports=function(t,e){for(var r,n=t.length,i=e^n,a=0;n>=4;)r=1540483477*(65535&(r=255&t.charCodeAt(a)|(255&t.charCodeAt(++a))<<8|(255&t.charCodeAt(++a))<<16|(255&t.charCodeAt(++a))<<24))+((1540483477*(r>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),n-=4,++a;switch(n){case 3:i^=(255&t.charCodeAt(a+2))<<16;case 2:i^=(255&t.charCodeAt(a+1))<<8;case 1:i=1540483477*(65535&(i^=255&t.charCodeAt(a)))+((1540483477*(i>>>16)&65535)<<16);}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0};})),fa=ca,ya=ha;fa.murmur3=ca,fa.murmur2=ya;var da=function(){this.ids=[],this.positions=[],this.indexed=!1;};da.prototype.add=function(t,e,r,n){this.ids.push(va(t)),this.positions.push(e,r,n);},da.prototype.getPositions=function(t){for(var e=va(t),r=0,n=this.ids.length-1;r>1;this.ids[i]>=e?n=i:r=i+1;}for(var a=[];this.ids[r]===e;)a.push({index:this.positions[3*r],start:this.positions[3*r+1],end:this.positions[3*r+2]}),r++;return a},da.serialize=function(t,e){var r=new Float64Array(t.ids),n=new Uint32Array(t.positions);return function t(e,r,n,i){for(;n>1],o=n-1,s=i+1;;){do{o++;}while(e[o]a);if(o>=s)break;ga(e,o,s),ga(r,3*o,3*s),ga(r,3*o+1,3*s+1),ga(r,3*o+2,3*s+2);}s-no.x+1||uo.y+1)&&A("Geometry exceeds allowed extent, reduce your vector tile buffer size");}return r}function ja(t,e){return {type:t.type,id:t.id,properties:t.properties,geometry:e?Ua(t):[]}}function qa(t,e,r,n,i){t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2);}var Na=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Ei,this.indexArray=new qi,this.segments=new ua,this.programConfigurations=new Fa(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}));};function Ka(t,e){for(var r=0;r1){if(Ja(t,e))return !0;for(var n=0;n1?r:r.sub(e)._mult(i)._add(e))}function Wa(t,e){for(var r,n,i,a=!1,o=0;oe.y!=(i=r[u]).y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(a=!a);return a}function Qa(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}function to(t,e,r){var n=r[0],i=r[2];if(t.xi.x&&e.x>i.x||t.yi.y&&e.y>i.y)return !1;var a=S(t,e,r[0]);return a!==S(t,e,r[1])||a!==S(t,e,r[2])||a!==S(t,e,r[3])}function eo(t,e,r){var n=e.paint.get(t).value;return "constant"===n.kind?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function ro(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function no(t,e,r,n,a){if(!e[0]&&!e[1])return t;var o=i.convert(e)._mult(a);"viewport"===r&&o._rotate(-n);for(var s=[],u=0;u=8192||p<0||p>=8192)){var c=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),h=c.vertexLength;qa(this.layoutVertexArray,l,p,-1,-1),qa(this.layoutVertexArray,l,p,1,-1),qa(this.layoutVertexArray,l,p,1,1),qa(this.layoutVertexArray,l,p,-1,1),this.indexArray.emplaceBack(h,h+1,h+2),this.indexArray.emplaceBack(h,h+3,h+2),c.vertexLength+=4,c.primitiveLength+=2;}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{},n);},On("CircleBucket",Na,{omit:["layers"]});var io=new _i({"circle-sort-key":new gi(Pt.layout_circle["circle-sort-key"])}),ao={paint:new _i({"circle-radius":new gi(Pt.paint_circle["circle-radius"]),"circle-color":new gi(Pt.paint_circle["circle-color"]),"circle-blur":new gi(Pt.paint_circle["circle-blur"]),"circle-opacity":new gi(Pt.paint_circle["circle-opacity"]),"circle-translate":new vi(Pt.paint_circle["circle-translate"]),"circle-translate-anchor":new vi(Pt.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new vi(Pt.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new vi(Pt.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new gi(Pt.paint_circle["circle-stroke-width"]),"circle-stroke-color":new gi(Pt.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new gi(Pt.paint_circle["circle-stroke-opacity"])}),layout:io},oo="undefined"!=typeof Float32Array?Float32Array:Array;function so(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function uo(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],u=e[5],l=e[6],p=e[7],c=e[8],h=e[9],f=e[10],y=e[11],d=e[12],m=e[13],v=e[14],g=e[15],x=r[0],b=r[1],w=r[2],_=r[3];return t[0]=x*n+b*s+w*c+_*d,t[1]=x*i+b*u+w*h+_*m,t[2]=x*a+b*l+w*f+_*v,t[3]=x*o+b*p+w*y+_*g,t[4]=(x=r[4])*n+(b=r[5])*s+(w=r[6])*c+(_=r[7])*d,t[5]=x*i+b*u+w*h+_*m,t[6]=x*a+b*l+w*f+_*v,t[7]=x*o+b*p+w*y+_*g,t[8]=(x=r[8])*n+(b=r[9])*s+(w=r[10])*c+(_=r[11])*d,t[9]=x*i+b*u+w*h+_*m,t[10]=x*a+b*l+w*f+_*v,t[11]=x*o+b*p+w*y+_*g,t[12]=(x=r[12])*n+(b=r[13])*s+(w=r[14])*c+(_=r[15])*d,t[13]=x*i+b*u+w*h+_*m,t[14]=x*a+b*l+w*f+_*v,t[15]=x*o+b*p+w*y+_*g,t}Math.hypot||(Math.hypot=function(){for(var t=arguments,e=0,r=arguments.length;r--;)e+=t[r]*t[r];return Math.sqrt(e)});var lo,po=uo;function co(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}lo=new oo(3),oo!=Float32Array&&(lo[0]=0,lo[1]=0,lo[2]=0),function(){var t=new oo(4);oo!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0);}();var ho=(function(){var t=new oo(2);oo!=Float32Array&&(t[0]=0,t[1]=0);}(),function(t){function e(e){t.call(this,e,ao);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.createBucket=function(t){return new Na(t)},e.prototype.queryRadius=function(t){var e=t;return eo("circle-radius",this,e)+eo("circle-stroke-width",this,e)+ro(this.paint.get("circle-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,i,a,o,s){for(var u=no(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),a.angle,o),l=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),p="map"===this.paint.get("circle-pitch-alignment"),c=p?u:function(t,e){return t.map((function(t){return fo(t,e)}))}(u,s),h=p?l*o:l,f=0,y=n;ft.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");for(var o=t.data,s=e.data,u=0;u80*r){n=a=t[0],i=o=t[1];for(var y=r;ya&&(a=s),u>o&&(o=u);l=0!==(l=Math.max(a-n,o-i))?1/l:0;}return Bo(h,f,r,n,i,l),f}function Po(t,e,r,n,i){var a,o;if(i===ts(t,e,r,n)>0)for(a=e;a=e;a-=n)o=$o(a,t[a],t[a+1],o);return o&&Go(o,o.next)&&(Wo(o),o=o.next),o}function Mo(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!Go(n,n.next)&&0!==Ko(n.prev,n,n.next))n=n.next;else {if(Wo(n),(n=e=n.prev)===n.next)break;r=!0;}}while(r||n!==e);return e}function Bo(t,e,r,n,i,a,o){if(t){!o&&a&&function(t,e,r,n){var i=t;do{null===i.z&&(i.z=Uo(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,a,o,s,u,l=1;do{for(r=t,t=null,a=null,o=0;r;){for(o++,n=r,s=0,e=0;e0||u>0&&n;)0!==s&&(0===u||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,u--),a?a.nextZ=i:t=i,i.prevZ=a,a=i;r=n;}a.nextZ=null,l*=2;}while(o>1)}(i);}(t,n,i,a);for(var s,u,l=t;t.prev!==t.next;)if(s=t.prev,u=t.next,a?Vo(t,n,i,a):To(t))e.push(s.i/r),e.push(t.i/r),e.push(u.i/r),Wo(t),t=u.next,l=u.next;else if((t=u)===l){o?1===o?Bo(t=Fo(Mo(t),e,r),e,r,n,i,a,2):2===o&&Do(t,e,r,n,i,a):Bo(Mo(t),e,r,n,i,a,1);break}}}function To(t){var e=t.prev,r=t,n=t.next;if(Ko(e,r,n)>=0)return !1;for(var i=t.next.next;i!==t.prev;){if(qo(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&Ko(i.prev,i,i.next)>=0)return !1;i=i.next;}return !0}function Vo(t,e,r,n){var i=t.prev,a=t,o=t.next;if(Ko(i,a,o)>=0)return !1;for(var s=i.x>a.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,u=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,l=Uo(i.x=l&&h&&h.z<=p;){if(c!==t.prev&&c!==t.next&&qo(i.x,i.y,a.x,a.y,o.x,o.y,c.x,c.y)&&Ko(c.prev,c,c.next)>=0)return !1;if(c=c.prevZ,h!==t.prev&&h!==t.next&&qo(i.x,i.y,a.x,a.y,o.x,o.y,h.x,h.y)&&Ko(h.prev,h,h.next)>=0)return !1;h=h.nextZ;}for(;c&&c.z>=l;){if(c!==t.prev&&c!==t.next&&qo(i.x,i.y,a.x,a.y,o.x,o.y,c.x,c.y)&&Ko(c.prev,c,c.next)>=0)return !1;c=c.prevZ;}for(;h&&h.z<=p;){if(h!==t.prev&&h!==t.next&&qo(i.x,i.y,a.x,a.y,o.x,o.y,h.x,h.y)&&Ko(h.prev,h,h.next)>=0)return !1;h=h.nextZ;}return !0}function Fo(t,e,r){var n=t;do{var i=n.prev,a=n.next.next;!Go(i,a)&&Zo(i,n,n.next,a)&&Ho(i,a)&&Ho(a,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(a.i/r),Wo(n),Wo(n.next),n=t=a),n=n.next;}while(n!==t);return Mo(n)}function Do(t,e,r,n,i,a){var o=t;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&No(o,s)){var u=Yo(o,s);return o=Mo(o,o.next),u=Mo(u,u.next),Bo(o,e,r,n,i,a),void Bo(u,e,r,n,i,a)}s=s.next;}o=o.next;}while(o!==t)}function Lo(t,e){return t.x-e.x}function Ro(t,e){if(e=function(t,e){var r,n=e,i=t.x,a=t.y,o=-1/0;do{if(a<=n.y&&a>=n.next.y&&n.next.y!==n.y){var s=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&s>o){if(o=s,s===i){if(a===n.y)return n;if(a===n.next.y)return n.next}r=n.x=n.x&&n.x>=p&&i!==n.x&&qo(ar.x||n.x===r.x&&Oo(r,n)))&&(r=n,h=u)),n=n.next;}while(n!==l);return r}(t,e)){var r=Yo(e,t);Mo(e,e.next),Mo(r,r.next);}}function Oo(t,e){return Ko(t.prev,t,e.prev)<0&&Ko(e.next,t,t.next)<0}function Uo(t,e,r,n,i){return (t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function jo(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 No(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Zo(r,r.next,t,e))return !0;r=r.next;}while(r!==t);return !1}(t,e)&&(Ho(t,e)&&Ho(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,a=(t.y+e.y)/2;do{r.y>a!=r.next.y>a&&r.next.y!==r.y&&i<(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;}while(r!==t);return n}(t,e)&&(Ko(t.prev,t,e.prev)||Ko(t,e.prev,e))||Go(t,e)&&Ko(t.prev,t,t.next)>0&&Ko(e.prev,e,e.next)>0)}function Ko(t,e,r){return (e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Go(t,e){return t.x===e.x&&t.y===e.y}function Zo(t,e,r,n){var i=Jo(Ko(t,e,r)),a=Jo(Ko(t,e,n)),o=Jo(Ko(r,n,t)),s=Jo(Ko(r,n,e));return i!==a&&o!==s||!(0!==i||!Xo(t,r,e))||!(0!==a||!Xo(t,n,e))||!(0!==o||!Xo(r,t,n))||!(0!==s||!Xo(r,e,n))}function Xo(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function Jo(t){return t>0?1:t<0?-1:0}function Ho(t,e){return Ko(t.prev,t,t.next)<0?Ko(t,e,t.next)>=0&&Ko(t,t.prev,e)>=0:Ko(t,e,t.prev)<0||Ko(t,t.next,e)<0}function Yo(t,e){var r=new Qo(t.i,t.x,t.y),n=new Qo(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 $o(t,e,r,n){var i=new Qo(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 Wo(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 Qo(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 ts(t,e,r,n){for(var i=0,a=e,o=r-n;an;){if(i-n>600){var o=i-n+1,s=r-n+1,u=Math.log(o),l=.5*Math.exp(2*u/3),p=.5*Math.sqrt(u*l*(o-l)/o)*(s-o/2<0?-1:1);t(e,r,Math.max(n,Math.floor(r-s*l/o+p)),Math.min(i,Math.floor(r+(o-s)*l/o+p)),a);}var c=e[r],h=n,f=i;for(rs(e,n,r),a(e[i],c)>0&&rs(e,n,i);h0;)f--;}0===a(e[n],c)?rs(e,n,f):rs(e,++f,i),f<=r&&(n=f+1),r<=f&&(i=f-1);}}(t,e,r||0,n||t.length-1,i||ns);}function rs(t,e,r){var n=t[e];t[e]=t[r],t[r]=n;}function ns(t,e){return te?1:0}function is(t,e){var r=t.length;if(r<=1)return [t];for(var n,i,a=[],o=0;o1)for(var u=0;u0&&r.holes.push(n+=t[i-1].length);}return r},zo.default=Co;var us=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Ei,this.indexArray=new qi,this.indexArray2=new Ji,this.programConfigurations=new Fa(t.layers,t.zoom),this.segments=new ua,this.segments2=new ua,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}));};us.prototype.populate=function(t,e,r){this.hasPattern=os("fill",this.layers,e);for(var n=this.layers[0].layout.get("fill-sort-key"),i=!n.isConstant(),a=[],o=0,s=t;o>3;}if(a--,1===n||2===n)o+=t.readSVarint(),s+=t.readSVarint(),1===n&&(e&&u.push(e),e=[]),e.push(new i(o,s));else {if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone());}}return e&&u.push(e),u},ys.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,u=1/0,l=-1/0;t.pos>3;}if(n--,1===r||2===r)(i+=t.readSVarint())s&&(s=i),(a+=t.readSVarint())l&&(l=a);else if(7!==r)throw new Error("unknown command "+r)}return [o,u,s,l]},ys.prototype.toGeoJSON=function(t,e,r){var n,i,a=this.extent*Math.pow(2,r),o=this.extent*t,s=this.extent*e,u=this.loadGeometry(),l=ys.types[this.type];function p(t){for(var e=0;e>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null;}return e}(r));}function bs(t,e,r){if(3===t){var n=new vs(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n);}}gs.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 fs(this._pbf,e,this.extent,this._keys,this._values)};var ws={VectorTile:function(t,e){this.layers=t.readFields(bs,{},e);},VectorTileFeature:fs,VectorTileLayer:vs},_s=ws.VectorTileFeature.types,As=Math.pow(2,13);function Ss(t,e,r,n,i,a,o,s){t.emplaceBack(e,r,2*Math.floor(n*As)+o,i*As*2,a*As*2,Math.round(s));}var ks=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Mi,this.indexArray=new qi,this.programConfigurations=new Fa(t.layers,t.zoom),this.segments=new ua,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}));};function Is(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}ks.prototype.populate=function(t,e,r){this.features=[],this.hasPattern=os("fill-extrusion",this.layers,e);for(var n=0,i=t;n8192}))||B.every((function(t){return t.y<0}))||B.every((function(t){return t.y>8192}))))for(var d=0,m=0;m=1){var g=y[m-1];if(!Is(v,g)){c.vertexLength+4>ua.MAX_VERTEX_ARRAY_LENGTH&&(c=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));var x=v.sub(g)._perp()._unit(),b=g.dist(v);d+b>32768&&(d=0),Ss(this.layoutVertexArray,v.x,v.y,x.x,x.y,0,0,d),Ss(this.layoutVertexArray,v.x,v.y,x.x,x.y,0,1,d),Ss(this.layoutVertexArray,g.x,g.y,x.x,x.y,0,0,d+=b),Ss(this.layoutVertexArray,g.x,g.y,x.x,x.y,0,1,d);var w=c.vertexLength;this.indexArray.emplaceBack(w,w+2,w+1),this.indexArray.emplaceBack(w+1,w+2,w+3),c.vertexLength+=4,c.primitiveLength+=2;}}}}if(c.vertexLength+u>ua.MAX_VERTEX_ARRAY_LENGTH&&(c=this.segments.prepareSegment(u,this.layoutVertexArray,this.indexArray)),"Polygon"===_s[t.type]){for(var _=[],A=[],S=c.vertexLength,k=0,I=s;k=2&&t[u-1].equals(t[u-2]);)u--;for(var l=0;l0;if(A&&v>l){var k=p.dist(f);if(k>2*c){var I=p.sub(p.sub(f)._mult(c/k)._round());this.updateDistance(f,I),this.addCurrentVertex(I,d,0,0,h),f=I;}}var z=f&&y,C=z?r:s?"butt":n;if(z&&"round"===C&&(wi&&(C="bevel"),"bevel"===C&&(w>2&&(C="flipbevel"),w100)g=m.mult(-1);else {var E=w*d.add(m).mag()/d.sub(m).mag();g._perp()._mult(E*(S?-1:1));}this.addCurrentVertex(p,g,0,0,h),this.addCurrentVertex(p,g.mult(-1),0,0,h);}else if("bevel"===C||"fakeround"===C){var P=-Math.sqrt(w*w-1),M=S?P:0,B=S?0:P;if(f&&this.addCurrentVertex(p,d,M,B,h),"fakeround"===C)for(var T=Math.round(180*_/Math.PI/20),V=1;V2*c){var U=p.add(y.sub(p)._mult(c/O)._round());this.updateDistance(p,U),this.addCurrentVertex(U,m,0,0,h),p=U;}}}}},Ds.prototype.addCurrentVertex=function(t,e,r,n,i,a){void 0===a&&(a=!1);var o=e.y*n-e.x,s=-e.y-e.x*n;this.addHalfVertex(t,e.x+e.y*r,e.y-e.x*r,a,!1,r,i),this.addHalfVertex(t,o,s,a,!0,-n,i),this.distance>Fs/2&&0===this.totalDistance&&(this.distance=0,this.addCurrentVertex(t,e,r,n,i,a));},Ds.prototype.addHalfVertex=function(t,e,r,n,i,a,o){var s=.5*(this.lineClips?this.scaledDistance*(Fs-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t.x<<1)+(n?1:0),(t.y<<1)+(i?1:0),Math.round(63*e)+128,Math.round(63*r)+128,1+(0===a?0:a<0?-1:1)|(63&s)<<2,s>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);var u=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),o.primitiveLength++),i?this.e2=u:this.e1=u;},Ds.prototype.updateScaledDistance=function(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance;},Ds.prototype.updateDistance=function(t,e){this.distance+=t.dist(e),this.updateScaledDistance();},On("LineBucket",Ds,{omit:["layers","patternFeatures"]});var Ls=new _i({"line-cap":new vi(Pt.layout_line["line-cap"]),"line-join":new gi(Pt.layout_line["line-join"]),"line-miter-limit":new vi(Pt.layout_line["line-miter-limit"]),"line-round-limit":new vi(Pt.layout_line["line-round-limit"]),"line-sort-key":new gi(Pt.layout_line["line-sort-key"])}),Rs={paint:new _i({"line-opacity":new gi(Pt.paint_line["line-opacity"]),"line-color":new gi(Pt.paint_line["line-color"]),"line-translate":new vi(Pt.paint_line["line-translate"]),"line-translate-anchor":new vi(Pt.paint_line["line-translate-anchor"]),"line-width":new gi(Pt.paint_line["line-width"]),"line-gap-width":new gi(Pt.paint_line["line-gap-width"]),"line-offset":new gi(Pt.paint_line["line-offset"]),"line-blur":new gi(Pt.paint_line["line-blur"]),"line-dasharray":new bi(Pt.paint_line["line-dasharray"]),"line-pattern":new xi(Pt.paint_line["line-pattern"]),"line-gradient":new wi(Pt.paint_line["line-gradient"])}),layout:Ls},Os=new(function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.possiblyEvaluate=function(e,r){return r=new ui(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),t.prototype.possiblyEvaluate.call(this,e,r)},e.prototype.evaluate=function(e,r,n,i){return r=h({},r,{zoom:Math.floor(r.zoom)}),t.prototype.evaluate.call(this,e,r,n,i)},e}(gi))(Rs.paint.properties["line-width"].specification);Os.useIntegerZoom=!0;var Us=function(t){function e(e){t.call(this,e,Rs),this.gradientVersion=0;}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._handleSpecialPaintPropertyUpdate=function(t){"line-gradient"===t&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof Ke,this.gradientVersion=(this.gradientVersion+1)%s);},e.prototype.gradientExpression=function(){return this._transitionablePaint._values["line-gradient"].value.expression},e.prototype.recalculate=function(e,r){t.prototype.recalculate.call(this,e,r),this.paint._values["line-floorwidth"]=Os.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e);},e.prototype.createBucket=function(t){return new Ds(t)},e.prototype.queryRadius=function(t){var e=t,r=js(eo("line-width",this,e),eo("line-gap-width",this,e)),n=eo("line-offset",this,e);return r/2+Math.abs(n)+ro(this.paint.get("line-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,a,o,s){var u=no(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),o.angle,s),l=s/2*js(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),p=this.paint.get("line-offset").evaluate(e,r);return p&&(n=function(t,e){for(var r=[],n=new i(0,0),a=0;a=3)for(var a=0;a0?e+2*t:t}var qs=zi([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Ns=zi([{name:"a_projected_pos",components:3,type:"Float32"}],4),Ks=(zi([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),zi([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}])),Gs=(zi([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]),zi([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4)),Zs=zi([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Xs(t,e,r){return t.sections.forEach((function(t){t.text=function(t,e,r){var n=e.layout.get("text-transform").evaluate(r,{});return "uppercase"===n?t=t.toLocaleUpperCase():"lowercase"===n&&(t=t.toLocaleLowerCase()),si.applyArabicShaping&&(t=si.applyArabicShaping(t)),t}(t.text,e,r);})),t}zi([{name:"triangle",components:3,type:"Uint16"}]),zi([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),zi([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),zi([{type:"Float32",name:"offsetX"}]),zi([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var Js={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},Hs=function(t,e,r,n,i){var a,o,s=8*i-n-1,u=(1<>1,p=-7,c=r?i-1:0,h=r?-1:1,f=t[e+c];for(c+=h,a=f&(1<<-p)-1,f>>=-p,p+=s;p>0;a=256*a+t[e+c],c+=h,p-=8);for(o=a&(1<<-p)-1,a>>=-p,p+=n;p>0;o=256*o+t[e+c],c+=h,p-=8);if(0===a)a=1-l;else {if(a===u)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,n),a-=l;}return (f?-1:1)*o*Math.pow(2,a-n)},Ys=function(t,e,r,n,i,a){var o,s,u,l=8*a-i-1,p=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:a-1,y=n?1:-1,d=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=p):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),(e+=o+c>=1?h/u:h*Math.pow(2,1-c))*u>=2&&(o++,u/=2),o+c>=p?(s=0,o=p):o+c>=1?(s=(e*u-1)*Math.pow(2,i),o+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,i),o=0));i>=8;t[r+f]=255&s,f+=y,s/=256,i-=8);for(o=o<0;t[r+f]=255&o,f+=y,o/=256,l-=8);t[r+f-y]|=128*d;},$s=Ws;function Ws(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length;}Ws.Varint=0,Ws.Fixed64=1,Ws.Bytes=2,Ws.Fixed32=5;var Qs="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function tu(t){return t.type===Ws.Bytes?t.readVarint()+t.pos:t.pos+1}function eu(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function ru(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(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 nu(t,e){for(var r=0;r>>8,t[r+2]=e>>>16,t[r+3]=e>>>24;}function yu(t,e){return (t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function du(t,e,r){1===t&&r.readMessage(mu,e);}function mu(t,e,r){if(3===t){var n=r.readMessage(vu,{}),i=n.width,a=n.height,o=n.left,s=n.top,u=n.advance;e.push({id:n.id,bitmap:new xo({width:i+6,height:a+6},n.bitmap),metrics:{width:i,height:a,left:o,top:s,advance:u}});}}function vu(t,e,r){1===t?e.id=r.readVarint():2===t?e.bitmap=r.readBytes():3===t?e.width=r.readVarint():4===t?e.height=r.readVarint():5===t?e.left=r.readSVarint():6===t?e.top=r.readSVarint():7===t&&(e.advance=r.readVarint());}function gu(t){for(var e=0,r=0,n=0,i=t;n=0;h--){var f=o[h];if(!(c.w>f.w||c.h>f.h)){if(c.x=f.x,c.y=f.y,u=Math.max(u,c.y+c.h),s=Math.max(s,c.x+c.w),c.w===f.w&&c.h===f.h){var y=o.pop();h>3,a=this.pos;this.type=7&n,t(i,e,this),this.pos===a&&this.skip(n);}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=hu(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=yu(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=hu(this.buf,this.pos)+4294967296*hu(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=hu(this.buf,this.pos)+4294967296*yu(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=Hs(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Hs(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,i,a=r.buf;if(n=(112&(i=a[r.pos++]))>>4,i<128)return eu(t,n,e);if(n|=(127&(i=a[r.pos++]))<<3,i<128)return eu(t,n,e);if(n|=(127&(i=a[r.pos++]))<<10,i<128)return eu(t,n,e);if(n|=(127&(i=a[r.pos++]))<<17,i<128)return eu(t,n,e);if(n|=(127&(i=a[r.pos++]))<<24,i<128)return eu(t,n,e);if(n|=(1&(i=a[r.pos++]))<<31,i<128)return eu(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Qs?function(t,e,r){return Qs.decode(t.subarray(e,r))}(this.buf,e,t):function(t,e,r){for(var n="",i=e;i239?4:u>223?3:u>191?2:1;if(i+p>r)break;1===p?u<128&&(l=u):2===p?128==(192&(a=t[i+1]))&&(l=(31&u)<<6|63&a)<=127&&(l=null):3===p?(o=t[i+2],128==(192&(a=t[i+1]))&&128==(192&o)&&((l=(15&u)<<12|(63&a)<<6|63&o)<=2047||l>=55296&&l<=57343)&&(l=null)):4===p&&(o=t[i+2],s=t[i+3],128==(192&(a=t[i+1]))&&128==(192&o)&&128==(192&s)&&((l=(15&u)<<18|(63&a)<<12|(63&o)<<6|63&s)<=65535||l>=1114112)&&(l=null)),null===l?(l=65533,p=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),i+=p;}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==Ws.Bytes)return t.push(this.readVarint(e));var r=tu(this);for(t=t||[];this.pos127;);else if(e===Ws.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Ws.Fixed32)this.pos+=4;else {if(e!==Ws.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8;}},writeTag:function(t,e){this.writeVarint(t<<3|e);},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,r.buf[r.pos]=127&(t>>>=7);}(r,0,e),function(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))));}(n,e);}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))));},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t);},writeBoolean:function(t){this.writeVarint(Boolean(t));},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var n,i,a=0;a55295&&n<57344){if(!i){n>56319||a+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null;}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128);}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&ru(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r;},writeFloat:function(t){this.realloc(4),Ys(this.buf,t,this.pos,!0,23,4),this.pos+=4;},writeDouble:function(t){this.realloc(8),Ys(this.buf,t,this.pos,!0,52,8),this.pos+=8;},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&ru(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n;},writeMessage:function(t,e,r){this.writeTag(t,Ws.Bytes),this.writeRawMessage(e,r);},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,nu,e);},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,iu,e);},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,su,e);},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,au,e);},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,ou,e);},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,uu,e);},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,lu,e);},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,pu,e);},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,cu,e);},writeBytesField:function(t,e){this.writeTag(t,Ws.Bytes),this.writeBytes(e);},writeFixed32Field:function(t,e){this.writeTag(t,Ws.Fixed32),this.writeFixed32(e);},writeSFixed32Field:function(t,e){this.writeTag(t,Ws.Fixed32),this.writeSFixed32(e);},writeFixed64Field:function(t,e){this.writeTag(t,Ws.Fixed64),this.writeFixed64(e);},writeSFixed64Field:function(t,e){this.writeTag(t,Ws.Fixed64),this.writeSFixed64(e);},writeVarintField:function(t,e){this.writeTag(t,Ws.Varint),this.writeVarint(e);},writeSVarintField:function(t,e){this.writeTag(t,Ws.Varint),this.writeSVarint(e);},writeStringField:function(t,e){this.writeTag(t,Ws.Bytes),this.writeString(e);},writeFloatField:function(t,e){this.writeTag(t,Ws.Fixed32),this.writeFloat(e);},writeDoubleField:function(t,e){this.writeTag(t,Ws.Fixed64),this.writeDouble(e);},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e));}};var xu=function(t,e){var r=e.pixelRatio,n=e.version,i=e.stretchX,a=e.stretchY,o=e.content;this.paddedRect=t,this.pixelRatio=r,this.stretchX=i,this.stretchY=a,this.content=o,this.version=n;},bu={tl:{configurable:!0},br:{configurable:!0},tlbr:{configurable:!0},displaySize:{configurable:!0}};bu.tl.get=function(){return [this.paddedRect.x+1,this.paddedRect.y+1]},bu.br.get=function(){return [this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]},bu.tlbr.get=function(){return this.tl.concat(this.br)},bu.displaySize.get=function(){return [(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]},Object.defineProperties(xu.prototype,bu);var wu=function(t,e){var r={},n={};this.haveRenderCallbacks=[];var i=[];this.addImages(t,r,i),this.addImages(e,n,i);var a=gu(i),o=new bo({width:a.w||1,height:a.h||1});for(var s in t){var u=t[s],l=r[s].paddedRect;bo.copy(u.data,o,{x:0,y:0},{x:l.x+1,y:l.y+1},u.data);}for(var p in e){var c=e[p],h=n[p].paddedRect,f=h.x+1,y=h.y+1,d=c.data.width,m=c.data.height;bo.copy(c.data,o,{x:0,y:0},{x:f,y:y},c.data),bo.copy(c.data,o,{x:0,y:m-1},{x:f,y:y-1},{width:d,height:1}),bo.copy(c.data,o,{x:0,y:0},{x:f,y:y+m},{width:d,height:1}),bo.copy(c.data,o,{x:d-1,y:0},{x:f-1,y:y},{width:1,height:m}),bo.copy(c.data,o,{x:0,y:0},{x:f+d,y:y},{width:1,height:m});}this.image=o,this.iconPositions=r,this.patternPositions=n;};wu.prototype.addImages=function(t,e,r){for(var n in t){var i=t[n],a={x:0,y:0,w:i.data.width+2,h:i.data.height+2};r.push(a),e[n]=new xu(a,i),i.hasRenderCallback&&this.haveRenderCallbacks.push(n);}},wu.prototype.patchUpdatedImages=function(t,e){for(var r in t.dispatchRenderCallbacks(this.haveRenderCallbacks),t.updatedImages)this.patchUpdatedImage(this.iconPositions[r],t.getImage(r),e),this.patchUpdatedImage(this.patternPositions[r],t.getImage(r),e);},wu.prototype.patchUpdatedImage=function(t,e,r){if(t&&e&&t.version!==e.version){t.version=e.version;var n=t.tl;r.update(e.data,void 0,{x:n[0],y:n[1]});}},On("ImagePosition",xu),On("ImageAtlas",wu);var _u={horizontal:1,vertical:2,horizontalOnly:3},Au=function(){this.scale=1,this.fontStack="",this.imageName=null;};Au.forText=function(t,e){var r=new Au;return r.scale=t||1,r.fontStack=e,r},Au.forImage=function(t){var e=new Au;return e.imageName=t,e};var Su=function(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null;};function ku(t,e,r,n,i,a,o,s,u,l,p,c,h,f,y,d){var m,v=Su.fromFeature(t,i);c===_u.vertical&&v.verticalizePunctuation();var g=si.processBidirectionalText,x=si.processStyledBidirectionalText;if(g&&1===v.sections.length){m=[];for(var b=0,w=g(v.toString(),Bu(v,l,a,e,n,f,y));b0&&R>k&&(k=R);}else {var O=r[z.fontStack],U=O&&O[E];if(U&&U.rect)B=U.rect,M=U.metrics;else {var j=e[z.fontStack],q=j&&j[E];if(!q)continue;M=q.metrics;}P=24*(w-z.scale);}F?(t.verticalizable=!0,S.push({glyph:E,imageName:T,x:h,y:f+P,vertical:F,scale:z.scale,fontStack:z.fontStack,sectionIndex:C,metrics:M,rect:B}),h+=V*z.scale+l):(S.push({glyph:E,imageName:T,x:h,y:f+P,vertical:F,scale:z.scale,fontStack:z.fontStack,sectionIndex:C,metrics:M,rect:B}),h+=M.advance*z.scale+l);}0!==S.length&&(y=Math.max(h-l,y),Vu(S,0,S.length-1,m,k)),h=0;var N=a*w+k;A.lineOffset=Math.max(k,_),f+=N,d=Math.max(N,d),++v;}else f+=a,++v;}var K,G=f- -17,Z=Tu(o),X=Z.horizontalAlign,J=Z.verticalAlign;(function(t,e,r,n,i,a,o,s,u){var l,p=(e-r)*i;l=a!==o?-s*n- -17:(-n*u+.5)*o;for(var c=0,h=t;c=0&&n>=t&&Iu[this.text.charCodeAt(n)];n--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r);},Su.prototype.substring=function(t,e){var r=new Su;return r.text=this.text.substring(t,e),r.sectionIndex=this.sectionIndex.slice(t,e),r.sections=this.sections,r},Su.prototype.toString=function(){return this.text},Su.prototype.getMaxScale=function(){var t=this;return this.sectionIndex.reduce((function(e,r){return Math.max(e,t.sections[r].scale)}),0)},Su.prototype.addTextSection=function(t,e){this.text+=t.text,this.sections.push(Au.forText(t.scale,t.fontStack||e));for(var r=this.sections.length-1,n=0;n=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)};var Iu={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},zu={};function Cu(t,e,r,n,i,a){if(e.imageName){var o=n[e.imageName];return o?o.displaySize[0]*e.scale*24/a+i:0}var s=r[e.fontStack],u=s&&s[t];return u?u.metrics.advance*e.scale+i:0}function Eu(t,e,r,n){var i=Math.pow(t-e,2);return n?t=0,c=0,h=0;h-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 u=[],l=0;sn;)l-=u.shift().angleDelta;if(l>i)return !1;o++,s+=p.dist(c);}return !0}function qu(t){for(var e=0,r=0;rl){var y=(l-u)/f,d=Ge(c.x,h.x,y),m=Ge(c.y,h.y,y),v=new Du(d,m,h.angleTo(c),p);return v._round(),!o||ju(t,v,s,o,e)?v:void 0}u+=f;}}function Zu(t,e,r,n,i,a,o,s,u){var l=Nu(n,a,o),p=Ku(n,i),c=p*o,h=0===t[0].x||t[0].x===u||0===t[0].y||t[0].y===u;return e-c=0&&w=0&&_=0&&f+p<=c){var A=new Du(w,_,x,d);A._round(),i&&!ju(e,A,o,i,a)||y.push(A);}}h+=g;}return u||y.length||s||(y=t(e,h/2,n,i,a,o,s,!0,l)),y}(t,h?e/2*s%e:(p/2+2*a)*o*s%e,e,l,r,c,h,!1,u)}function Xu(t,e,r,n,a){for(var o=[],s=0;s=n&&h.x>=n||(c.x>=n?c=new i(n,c.y+(n-c.x)/(h.x-c.x)*(h.y-c.y))._round():h.x>=n&&(h=new i(n,c.y+(n-c.x)/(h.x-c.x)*(h.y-c.y))._round()),c.y>=a&&h.y>=a||(c.y>=a?c=new i(c.x+(a-c.y)/(h.y-c.y)*(h.x-c.x),a)._round():h.y>=a&&(h=new i(c.x+(a-c.y)/(h.y-c.y)*(h.x-c.x),a)._round()),l&&c.equals(l[l.length-1])||o.push(l=[c]),l.push(h)))));}return o}function Ju(t,e,r,n){var a=[],o=t.image,s=o.pixelRatio,u=o.paddedRect.w-2,l=o.paddedRect.h-2,p=t.right-t.left,c=t.bottom-t.top,h=o.stretchX||[[0,u]],f=o.stretchY||[[0,l]],y=function(t,e){return t+e[1]-e[0]},d=h.reduce(y,0),m=f.reduce(y,0),v=u-d,g=l-m,x=0,b=d,w=0,_=m,A=0,S=v,k=0,I=g;if(o.content&&n){var z=o.content;x=Hu(h,0,z[0]),w=Hu(f,0,z[1]),b=Hu(h,z[0],z[2]),_=Hu(f,z[1],z[3]),A=z[0]-x,k=z[1]-w,S=z[2]-z[0]-b,I=z[3]-z[1]-_;}var C=function(n,a,u,l){var h=$u(n.stretch-x,b,p,t.left),f=Wu(n.fixed-A,S,n.stretch,d),y=$u(a.stretch-w,_,c,t.top),v=Wu(a.fixed-k,I,a.stretch,m),g=$u(u.stretch-x,b,p,t.left),z=Wu(u.fixed-A,S,u.stretch,d),C=$u(l.stretch-w,_,c,t.top),E=Wu(l.fixed-k,I,l.stretch,m),P=new i(h,y),M=new i(g,y),B=new i(g,C),T=new i(h,C),V=new i(f/s,v/s),F=new i(z/s,E/s),D=e*Math.PI/180;if(D){var L=Math.sin(D),R=Math.cos(D),O=[R,-L,L,R];P._matMult(O),M._matMult(O),T._matMult(O),B._matMult(O);}var U=n.stretch+n.fixed,j=a.stretch+a.fixed;return {tl:P,tr:M,bl:T,br:B,tex:{x:o.paddedRect.x+1+U,y:o.paddedRect.y+1+j,w:u.stretch+u.fixed-U,h:l.stretch+l.fixed-j},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:V,pixelOffsetBR:F,minFontScaleX:S/s/p,minFontScaleY:I/s/c,isSDF:r}};if(n&&(o.stretchX||o.stretchY))for(var E=Yu(h,v,d),P=Yu(f,g,m),M=0;M0&&(y=Math.max(10,y),this.circleDiameter=y);}else {var d=o.top*s-u,m=o.bottom*s+u,v=o.left*s-u,g=o.right*s+u,x=o.collisionPadding;if(x&&(v-=x[0]*s,d-=x[1]*s,g+=x[2]*s,m+=x[3]*s),p){var b=new i(v,d),w=new i(g,d),_=new i(v,m),A=new i(g,m),S=p*Math.PI/180;b._rotate(S),w._rotate(S),_._rotate(S),A._rotate(S),v=Math.min(b.x,w.x,_.x,A.x),g=Math.max(b.x,w.x,_.x,A.x),d=Math.min(b.y,w.y,_.y,A.y),m=Math.max(b.y,w.y,_.y,A.y);}t.emplaceBack(e.x,e.y,v,d,g,m,r,n,a);}this.boxEndIndex=t.length;},tl=function(t,e){if(void 0===t&&(t=[]),void 0===e&&(e=el),this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(var r=(this.length>>1)-1;r>=0;r--)this._down(r);};function el(t,e){return te?1:0}function rl(t,e,r){void 0===e&&(e=1),void 0===r&&(r=!1);for(var n=1/0,a=1/0,o=-1/0,s=-1/0,u=t[0],l=0;lo)&&(o=p.x),(!l||p.y>s)&&(s=p.y);}var c=Math.min(o-n,s-a),h=c/2,f=new tl([],nl);if(0===c)return new i(n,a);for(var y=n;ym.d||!m.d)&&(m=g,r&&console.log("found best %d after %d probes",Math.round(1e4*g.d)/1e4,v)),g.max-m.d<=e||(f.push(new il(g.p.x-(h=g.h/2),g.p.y-h,h,t)),f.push(new il(g.p.x+h,g.p.y-h,h,t)),f.push(new il(g.p.x-h,g.p.y+h,h,t)),f.push(new il(g.p.x+h,g.p.y+h,h,t)),v+=4);}return r&&(console.log("num probes: "+v),console.log("best distance: "+m.d)),m.p}function nl(t,e){return e.max-t.max}function il(t,e,r,n){this.p=new i(t,e),this.h=r,this.d=function(t,e){for(var r=!1,n=1/0,i=0;it.y!=p.y>t.y&&t.x<(p.x-l.x)*(t.y-l.y)/(p.y-l.y)+l.x&&(r=!r),n=Math.min(n,$a(t,l,p));}return (r?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2;}tl.prototype.push=function(t){this.data.push(t),this.length++,this._up(this.length-1);},tl.prototype.pop=function(){if(0!==this.length){var t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}},tl.prototype.peek=function(){return this.data[0]},tl.prototype._up=function(t){for(var e=this.data,r=this.compare,n=e[t];t>0;){var i=t-1>>1,a=e[i];if(r(n,a)>=0)break;e[t]=a,t=i;}e[t]=n;},tl.prototype._down=function(t){for(var e=this.data,r=this.compare,n=this.length>>1,i=e[t];t=0)break;e[t]=o,t=a;}e[t]=i;};var al=Number.POSITIVE_INFINITY;function ol(t,e){return e[1]!==al?function(t,e,r){var n=0,i=0;switch(e=Math.abs(e),r=Math.abs(r),t){case"top-right":case"top-left":case"top":i=r-7;break;case"bottom-right":case"bottom-left":case"bottom":i=7-r;}switch(t){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e;}return [n,i]}(t,e[0],e[1]):function(t,e){var r=0,n=0;e<0&&(e=0);var i=e/Math.sqrt(2);switch(t){case"top-right":case"top-left":n=i-7;break;case"bottom-right":case"bottom-left":n=7-i;break;case"bottom":n=7-e;break;case"top":n=e-7;}switch(t){case"top-right":case"bottom-right":r=-i;break;case"top-left":case"bottom-left":r=i;break;case"left":r=e;break;case"right":r=-e;}return [r,n]}(t,e[0])}function sl(t){switch(t){case"right":case"top-right":case"bottom-right":return "right";case"left":case"top-left":case"bottom-left":return "left"}return "center"}function ul(t,e,r,n,a,o,s,u,l,p,c,h,f,y,d){var m=function(t,e,r,n,a,o,s,u){for(var l=n.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,p=[],c=0,h=e.positionedLines;c32640&&A(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'):"composite"===v.kind&&((g=[128*y.compositeTextSizes[0].evaluate(s,{},d),128*y.compositeTextSizes[1].evaluate(s,{},d)])[0]>32640||g[1]>32640)&&A(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'),t.addSymbols(t.text,m,g,u,o,s,p,e,l.lineStartIndex,l.lineLength,f,d);for(var x=0,b=c;x=0;o--)if(n.dist(a[o])0)&&("constant"!==a.value.kind||a.value.value.length>0),l="constant"!==s.value.kind||!!s.value.value||Object.keys(s.parameters).length>0,p=i.get("symbol-sort-key");if(this.features=[],u||l){for(var c=e.iconDependencies,h=e.glyphDependencies,f=e.availableImages,y=new ui(this.zoom),d=0,m=t;d=0;for(var B=0,T=S.sections;B=0;s--)a[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:i},s>0&&(i+=e[s-1].dist(e[s]));for(var u=0;u0},gl.prototype.hasIconData=function(){return this.icon.segments.get().length>0},gl.prototype.hasDebugData=function(){return this.textCollisionBox&&this.iconCollisionBox},gl.prototype.hasTextCollisionBoxData=function(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0},gl.prototype.hasIconCollisionBoxData=function(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0},gl.prototype.addIndicesForPlacedSymbol=function(t,e){for(var r=t.placedSymbolArray.get(e),n=r.vertexStartIndex+4*r.numGlyphs,i=r.vertexStartIndex;i1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(var r=0,n=this.symbolInstanceIndexes;r=0&&n.indexOf(t)===r&&e.addIndicesForPlacedSymbol(e.text,t);})),i.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,i.verticalPlacedTextSymbolIndex),i.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.placedIconSymbolIndex),i.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.verticalPlacedIconSymbolIndex);}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray);}},On("SymbolBucket",gl,{omit:["layers","collisionBoxArray","features","compareText"]}),gl.MAX_GLYPHS=65535,gl.addDynamicAttributes=yl;var xl=new _i({"symbol-placement":new vi(Pt.layout_symbol["symbol-placement"]),"symbol-spacing":new vi(Pt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new vi(Pt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new gi(Pt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new vi(Pt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new vi(Pt.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new vi(Pt.layout_symbol["icon-ignore-placement"]),"icon-optional":new vi(Pt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new vi(Pt.layout_symbol["icon-rotation-alignment"]),"icon-size":new gi(Pt.layout_symbol["icon-size"]),"icon-text-fit":new vi(Pt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new vi(Pt.layout_symbol["icon-text-fit-padding"]),"icon-image":new gi(Pt.layout_symbol["icon-image"]),"icon-rotate":new gi(Pt.layout_symbol["icon-rotate"]),"icon-padding":new vi(Pt.layout_symbol["icon-padding"]),"icon-keep-upright":new vi(Pt.layout_symbol["icon-keep-upright"]),"icon-offset":new gi(Pt.layout_symbol["icon-offset"]),"icon-anchor":new gi(Pt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new vi(Pt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new vi(Pt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new vi(Pt.layout_symbol["text-rotation-alignment"]),"text-field":new gi(Pt.layout_symbol["text-field"]),"text-font":new gi(Pt.layout_symbol["text-font"]),"text-size":new gi(Pt.layout_symbol["text-size"]),"text-max-width":new gi(Pt.layout_symbol["text-max-width"]),"text-line-height":new vi(Pt.layout_symbol["text-line-height"]),"text-letter-spacing":new gi(Pt.layout_symbol["text-letter-spacing"]),"text-justify":new gi(Pt.layout_symbol["text-justify"]),"text-radial-offset":new gi(Pt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new vi(Pt.layout_symbol["text-variable-anchor"]),"text-anchor":new gi(Pt.layout_symbol["text-anchor"]),"text-max-angle":new vi(Pt.layout_symbol["text-max-angle"]),"text-writing-mode":new vi(Pt.layout_symbol["text-writing-mode"]),"text-rotate":new gi(Pt.layout_symbol["text-rotate"]),"text-padding":new vi(Pt.layout_symbol["text-padding"]),"text-keep-upright":new vi(Pt.layout_symbol["text-keep-upright"]),"text-transform":new gi(Pt.layout_symbol["text-transform"]),"text-offset":new gi(Pt.layout_symbol["text-offset"]),"text-allow-overlap":new vi(Pt.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new vi(Pt.layout_symbol["text-ignore-placement"]),"text-optional":new vi(Pt.layout_symbol["text-optional"])}),bl={paint:new _i({"icon-opacity":new gi(Pt.paint_symbol["icon-opacity"]),"icon-color":new gi(Pt.paint_symbol["icon-color"]),"icon-halo-color":new gi(Pt.paint_symbol["icon-halo-color"]),"icon-halo-width":new gi(Pt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new gi(Pt.paint_symbol["icon-halo-blur"]),"icon-translate":new vi(Pt.paint_symbol["icon-translate"]),"icon-translate-anchor":new vi(Pt.paint_symbol["icon-translate-anchor"]),"text-opacity":new gi(Pt.paint_symbol["text-opacity"]),"text-color":new gi(Pt.paint_symbol["text-color"],{runtimeType:qt,getOverride:function(t){return t.textColor},hasOverride:function(t){return !!t.textColor}}),"text-halo-color":new gi(Pt.paint_symbol["text-halo-color"]),"text-halo-width":new gi(Pt.paint_symbol["text-halo-width"]),"text-halo-blur":new gi(Pt.paint_symbol["text-halo-blur"]),"text-translate":new vi(Pt.paint_symbol["text-translate"]),"text-translate-anchor":new vi(Pt.paint_symbol["text-translate-anchor"])}),layout:xl},wl=function(t){this.type=t.property.overrides?t.property.overrides.runtimeType:Rt,this.defaultValue=t;};wl.prototype.evaluate=function(t){if(t.formattedSection){var e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default},wl.prototype.eachChild=function(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression);},wl.prototype.outputDefined=function(){return !1},wl.prototype.serialize=function(){return null},On("FormatSectionOverride",wl,{omit:["defaultValue"]});var _l=function(t){function e(e){t.call(this,e,bl);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.recalculate=function(e,r){if(t.prototype.recalculate.call(this,e,r),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){var n=this.layout.get("text-writing-mode");if(n){for(var i=[],a=0,o=n;a",targetMapId:n,sourceMapId:a.mapId});}}},Dl.prototype.receive=function(t){var e=t.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if(""===e.type){delete this.tasks[r];var n=this.cancelCallbacks[r];delete this.cancelCallbacks[r],n&&n();}else I()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e);},Dl.prototype.process=function(){if(this.taskQueue.length){var t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(t,e);}},Dl.prototype.processTask=function(t,e){var r=this;if(""===e.type){var n=this.callbacks[t];delete this.callbacks[t],n&&(e.error?n(Kn(e.error)):n(null,Kn(e.data)));}else {var i=!1,a=E(this.globalScope)?void 0:[],o=e.hasCallback?function(e,n){i=!0,delete r.cancelCallbacks[t],r.target.postMessage({id:t,type:"",sourceMapId:r.mapId,error:e?Nn(e):null,data:Nn(n,a)},a);}:function(t){i=!0;},s=null,u=Kn(e.data);if(this.parent[e.type])s=this.parent[e.type](e.sourceMapId,u,o);else if(this.parent.getWorkerSource){var l=e.type.split(".");s=this.parent.getWorkerSource(e.sourceMapId,l[0],u.source)[l[1]](u,o);}else o(new Error("Could not find function "+e.type));!i&&s&&s.cancel&&(this.cancelCallbacks[t]=s.cancel);}},Dl.prototype.remove=function(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1);};var Rl=function(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]));};Rl.prototype.setNorthEast=function(t){return this._ne=t instanceof Ol?new Ol(t.lng,t.lat):Ol.convert(t),this},Rl.prototype.setSouthWest=function(t){return this._sw=t instanceof Ol?new Ol(t.lng,t.lat):Ol.convert(t),this},Rl.prototype.extend=function(t){var e,r,n=this._sw,i=this._ne;if(t instanceof Ol)e=t,r=t;else {if(!(t instanceof Rl))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(Rl.convert(t)):this.extend(Ol.convert(t)):this;if(r=t._ne,!(e=t._sw)||!r)return this}return n||i?(n.lng=Math.min(e.lng,n.lng),n.lat=Math.min(e.lat,n.lat),i.lng=Math.max(r.lng,i.lng),i.lat=Math.max(r.lat,i.lat)):(this._sw=new Ol(e.lng,e.lat),this._ne=new Ol(r.lng,r.lat)),this},Rl.prototype.getCenter=function(){return new Ol((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},Rl.prototype.getSouthWest=function(){return this._sw},Rl.prototype.getNorthEast=function(){return this._ne},Rl.prototype.getNorthWest=function(){return new Ol(this.getWest(),this.getNorth())},Rl.prototype.getSouthEast=function(){return new Ol(this.getEast(),this.getSouth())},Rl.prototype.getWest=function(){return this._sw.lng},Rl.prototype.getSouth=function(){return this._sw.lat},Rl.prototype.getEast=function(){return this._ne.lng},Rl.prototype.getNorth=function(){return this._ne.lat},Rl.prototype.toArray=function(){return [this._sw.toArray(),this._ne.toArray()]},Rl.prototype.toString=function(){return "LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},Rl.prototype.isEmpty=function(){return !(this._sw&&this._ne)},Rl.prototype.contains=function(t){var e=Ol.convert(t),r=e.lng,n=e.lat,i=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(i=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&i},Rl.convert=function(t){return !t||t instanceof Rl?t:new Rl(t)};var Ol=function(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")};Ol.prototype.wrap=function(){return new Ol(c(this.lng,-180,180),this.lat)},Ol.prototype.toArray=function(){return [this.lng,this.lat]},Ol.prototype.toString=function(){return "LngLat("+this.lng+", "+this.lat+")"},Ol.prototype.distanceTo=function(t){var e=Math.PI/180,r=this.lat*e,n=t.lat*e,i=Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos((t.lng-this.lng)*e);return 6371008.8*Math.acos(Math.min(i,1))},Ol.prototype.toBounds=function(t){void 0===t&&(t=0);var e=360*t/40075017,r=e/Math.cos(Math.PI/180*this.lat);return new Rl(new Ol(this.lng-r,this.lat-e),new Ol(this.lng+r,this.lat+e))},Ol.convert=function(t){if(t instanceof Ol)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new Ol(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new Ol(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")};var Ul=2*Math.PI*6371008.8;function jl(t){return Ul*Math.cos(t*Math.PI/180)}function ql(t){return (180+t)/360}function Nl(t){return (180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Kl(t,e){return t/jl(e)}function Gl(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}var Zl=function(t,e,r){void 0===r&&(r=0),this.x=+t,this.y=+e,this.z=+r;};Zl.fromLngLat=function(t,e){void 0===e&&(e=0);var r=Ol.convert(t);return new Zl(ql(r.lng),Nl(r.lat),Kl(e,r.lat))},Zl.prototype.toLngLat=function(){return new Ol(360*this.x-180,Gl(this.y))},Zl.prototype.toAltitude=function(){return this.z*jl(Gl(this.y))},Zl.prototype.meterInMercatorCoordinateUnits=function(){return 1/Ul*(t=Gl(this.y),1/Math.cos(t*Math.PI/180));var t;};var Xl=function(t,e,r){this.z=t,this.x=e,this.y=r,this.key=Yl(0,t,t,e,r);};Xl.prototype.equals=function(t){return this.z===t.z&&this.x===t.x&&this.y===t.y},Xl.prototype.url=function(t,e){var r,n,i,a,o,s=(n=this.y,i=this.z,a=Ll(256*(r=this.x),256*(n=Math.pow(2,i)-n-1),i),o=Ll(256*(r+1),256*(n+1),i),a[0]+","+a[1]+","+o[0]+","+o[1]),u=function(t,e,r){for(var n,i="",a=t;a>0;a--)i+=(e&(n=1<this.canonical.z?new Hl(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Hl(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)},Hl.prototype.calculateScaledKey=function(t,e){var r=this.canonical.z-t;return t>this.canonical.z?Yl(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):Yl(this.wrap*+e,t,t,this.canonical.x>>r,this.canonical.y>>r)},Hl.prototype.isChildOf=function(t){if(t.wrap!==this.wrap)return !1;var e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ>e&&t.canonical.y===this.canonical.y>>e},Hl.prototype.children=function(t){if(this.overscaledZ>=t)return [new Hl(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];var e=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return [new Hl(e,this.wrap,e,r,n),new Hl(e,this.wrap,e,r+1,n),new Hl(e,this.wrap,e,r,n+1),new Hl(e,this.wrap,e,r+1,n+1)]},Hl.prototype.isLessThan=function(t){return this.wrapt.wrap)&&(this.overscaledZt.overscaledZ)&&(this.canonical.xt.canonical.x)&&this.canonical.y=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return (e+1)*this.stride+(t+1)},$l.prototype._unpackMapbox=function(t,e,r){return (256*t*256+256*e+r)/10-1e4},$l.prototype._unpackTerrarium=function(t,e,r){return 256*t+e+r/256-32768},$l.prototype.getPixels=function(){return new bo({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))},$l.prototype.backfillBorder=function(t,e,r){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");var n=e*this.dim,i=e*this.dim+this.dim,a=r*this.dim,o=r*this.dim+this.dim;switch(e){case-1:n=i-1;break;case 1:i=n+1;}switch(r){case-1:a=o-1;break;case 1:o=a+1;}for(var s=-e*this.dim,u=-r*this.dim,l=a;l=0&&p[3]>=0&&s.insert(o,p[0],p[1],p[2],p[3]);}},rp.prototype.loadVTLayers=function(){return this.vtLayers||(this.vtLayers=new ws.VectorTile(new $s(this.rawTileData)).layers,this.sourceLayerCoder=new Wl(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers},rp.prototype.query=function(t,e,r,n){var a=this;this.loadVTLayers();for(var o=t.params||{},s=8192/t.tileSize/t.scale,u=sn(o.filter),l=t.queryGeometry,p=t.queryPadding*s,c=ip(l),h=this.grid.query(c.minX-p,c.minY-p,c.maxX+p,c.maxY+p),f=ip(t.cameraQueryGeometry),y=this.grid3D.query(f.minX-p,f.minY-p,f.maxX+p,f.maxY+p,(function(e,r,n,a){return function(t,e,r,n,a){for(var o=0,s=t;o=u.x&&a>=u.y)return !0}var l=[new i(e,r),new i(e,a),new i(n,a),new i(n,r)];if(t.length>2)for(var p=0,c=l;p=0)return !0;return !1}(a,c)){var f=this.sourceLayerCoder.decode(r),y=this.vtLayers[f].feature(n);if(i.needGeometry){var d=ja(y,!0);if(!i.filter(new ui(this.tileID.overscaledZ),d,this.tileID.canonical))return}else if(!i.filter(new ui(this.tileID.overscaledZ),y))return;for(var m=this.getId(y,f),v=0;vn)i=!1;else if(e)if(this.expirationTimeut&&(t.getActor().send("enforceCacheSizeLimit",st),ht=0);},t.clamp=p,t.clearTileCache=function(t){var e=o.caches.delete("mapbox-tiles");t&&e.catch(t).then((function(){return t()}));},t.clipLine=Xu,t.clone=function(t){var e=new oo(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.clone$1=w,t.clone$2=function(t){var e=new oo(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},t.collisionCircleLayout=Zs,t.config=O,t.create=function(){var t=new oo(16);return oo!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.create$1=function(){var t=new oo(9);return oo!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t},t.create$2=function(){var t=new oo(4);return oo!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t},t.createCommonjsModule=e,t.createExpression=Xr,t.createLayout=zi,t.createStyleLayer=function(t){return "custom"===t.type?new zl(t):new Cl[t.type](t)},t.cross=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[0],s=r[1],u=r[2];return t[0]=i*u-a*s,t[1]=a*o-n*u,t[2]=n*s-i*o,t},t.deepEqual=function t(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return !1;for(var n=0;n0&&(a=1/Math.sqrt(a)),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a,t},t.number=Ge,t.offscreenCanvasSupported=ft,t.ortho=function(t,e,r,n,i,a,o){var s=1/(e-r),u=1/(n-i),l=1/(a-o);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*l,t[11]=0,t[12]=(e+r)*s,t[13]=(i+n)*u,t[14]=(o+a)*l,t[15]=1,t},t.parseGlyphPBF=function(t){return new $s(t).readFields(du,[])},t.pbf=$s,t.performSymbolLayout=function(t,e,r,n,i,a,o){t.createArrays(),t.tilePixelRatio=8192/(512*t.overscaling),t.compareText={},t.iconsNeedLinear=!1;var s=t.layers[0].layout,u=t.layers[0]._unevaluatedLayout._values,l={};if("composite"===t.textSizeData.kind){var p=t.textSizeData,c=p.maxZoom;l.compositeTextSizes=[u["text-size"].possiblyEvaluate(new ui(p.minZoom),o),u["text-size"].possiblyEvaluate(new ui(c),o)];}if("composite"===t.iconSizeData.kind){var h=t.iconSizeData,f=h.maxZoom;l.compositeIconSizes=[u["icon-size"].possiblyEvaluate(new ui(h.minZoom),o),u["icon-size"].possiblyEvaluate(new ui(f),o)];}l.layoutTextSize=u["text-size"].possiblyEvaluate(new ui(t.zoom+1),o),l.layoutIconSize=u["icon-size"].possiblyEvaluate(new ui(t.zoom+1),o),l.textMaxSize=u["text-size"].possiblyEvaluate(new ui(18));for(var y=24*s.get("text-line-height"),d="map"===s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement"),m=s.get("text-keep-upright"),v=s.get("text-size"),g=function(){var a=b[x],u=s.get("text-font").evaluate(a,{},o).join(","),p=v.evaluate(a,{},o),c=l.layoutTextSize.evaluate(a,{},o),h=l.layoutIconSize.evaluate(a,{},o),f={horizontal:{},vertical:void 0},g=a.text,w=[0,0];if(g){var _=g.toString(),S=24*s.get("text-letter-spacing").evaluate(a,{},o),k=function(t){for(var e=0,r=t;e=8192||c.y<0||c.y>=8192||function(t,e,r,n,i,a,o,s,u,l,p,c,h,f,y,d,m,v,g,x,b,w,_,S,k){var I,z,C,E,P,M=t.addToLineVertexArray(e,r),B=0,T=0,V=0,F=0,D=-1,L=-1,R={},O=fa(""),U=0,j=0;if(void 0===s._unevaluatedLayout.getValue("text-radial-offset")?(U=(I=s.layout.get("text-offset").evaluate(b,{},S).map((function(t){return 24*t})))[0],j=I[1]):(U=24*s.layout.get("text-radial-offset").evaluate(b,{},S),j=al),t.allowVerticalPlacement&&n.vertical){var q=s.layout.get("text-rotate").evaluate(b,{},S)+90;E=new Qu(u,e,l,p,c,n.vertical,h,f,y,q),o&&(P=new Qu(u,e,l,p,c,o,m,v,y,q));}if(i){var N=s.layout.get("icon-rotate").evaluate(b,{}),K="none"!==s.layout.get("icon-text-fit"),G=Ju(i,N,_,K),Z=o?Ju(o,N,_,K):void 0;C=new Qu(u,e,l,p,c,i,m,v,!1,N),B=4*G.length;var X=t.iconSizeData,J=null;"source"===X.kind?(J=[128*s.layout.get("icon-size").evaluate(b,{})])[0]>32640&&A(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'):"composite"===X.kind&&((J=[128*w.compositeIconSizes[0].evaluate(b,{},S),128*w.compositeIconSizes[1].evaluate(b,{},S)])[0]>32640||J[1]>32640)&&A(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'),t.addSymbols(t.icon,G,J,x,g,b,!1,e,M.lineStartIndex,M.lineLength,-1,S),D=t.icon.placedSymbolArray.length-1,Z&&(T=4*Z.length,t.addSymbols(t.icon,Z,J,x,g,b,_u.vertical,e,M.lineStartIndex,M.lineLength,-1,S),L=t.icon.placedSymbolArray.length-1);}for(var H in n.horizontal){var Y=n.horizontal[H];if(!z){O=fa(Y.text);var $=s.layout.get("text-rotate").evaluate(b,{},S);z=new Qu(u,e,l,p,c,Y,h,f,y,$);}var W=1===Y.positionedLines.length;if(V+=ul(t,e,Y,a,s,y,b,d,M,n.vertical?_u.horizontal:_u.horizontalOnly,W?Object.keys(n.horizontal):[H],R,D,w,S),W)break}n.vertical&&(F+=ul(t,e,n.vertical,a,s,y,b,d,M,_u.vertical,["vertical"],R,L,w,S));var Q=z?z.boxStartIndex:t.collisionBoxArray.length,tt=z?z.boxEndIndex:t.collisionBoxArray.length,et=E?E.boxStartIndex:t.collisionBoxArray.length,rt=E?E.boxEndIndex:t.collisionBoxArray.length,nt=C?C.boxStartIndex:t.collisionBoxArray.length,it=C?C.boxEndIndex:t.collisionBoxArray.length,at=P?P.boxStartIndex:t.collisionBoxArray.length,ot=P?P.boxEndIndex:t.collisionBoxArray.length,st=-1,ut=function(t,e){return t&&t.circleDiameter?Math.max(t.circleDiameter,e):e};st=ut(z,st),st=ut(E,st),st=ut(C,st);var lt=(st=ut(P,st))>-1?1:0;lt&&(st*=k/24),t.glyphOffsetArray.length>=gl.MAX_GLYPHS&&A("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==b.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,b.sortKey),t.symbolInstances.emplaceBack(e.x,e.y,R.right>=0?R.right:-1,R.center>=0?R.center:-1,R.left>=0?R.left:-1,R.vertical||-1,D,L,O,Q,tt,et,rt,nt,it,at,ot,l,V,F,B,T,lt,0,h,U,j,st);}(t,c,s,r,n,i,h,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,v,w,k,u,x,_,I,y,e,a,l,p,o);};if("line"===z)for(var M=0,B=Xu(e.geometry,0,0,8192,8192);M1){var U=Gu(O,S,r.vertical||d,n,24,g);U&&P(O,U);}}else if("Polygon"===e.type)for(var j=0,q=is(e.geometry,0);j=T.maxzoom||"none"!==T.visibility&&(s(P,this.zoom,i),(g[T.id]=T.createBucket({index:h.bucketLayerIDs.length,layers:P,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:w,sourceID:this.source})).populate(S,v,this.tileID.canonical),h.bucketLayerIDs.push(P.map((function(e){return e.id}))));}}}var C=e.mapObject(v.glyphDependencies,(function(e){return Object.keys(e).map(Number)}));Object.keys(C).length?n.send("getGlyphs",{uid:this.uid,stacks:C},(function(e,t){c||(c=e,p=t,z.call(l));})):p={};var D=Object.keys(v.iconDependencies);D.length?n.send("getImages",{icons:D,source:this.source,tileID:this.tileID,type:"icons"},(function(e,t){c||(c=e,f=t,z.call(l));})):f={};var L=Object.keys(v.patternDependencies);function z(){if(c)return a(c);if(p&&f&&d){var t=new o(p),r=new e.ImageAtlas(f,d);for(var n in g){var l=g[n];l instanceof e.SymbolBucket?(s(l.layers,this.zoom,i),e.performSymbolLayout(l,p,t.positions,f,r.iconPositions,this.showCollisionBoxes,this.tileID.canonical)):l.hasPattern&&(l instanceof e.LineBucket||l instanceof e.FillBucket||l instanceof e.FillExtrusionBucket)&&(s(l.layers,this.zoom,i),l.addFeatures(v,this.tileID.canonical,r.patternPositions));}this.status="done",a(null,{buckets:e.values(g).filter((function(e){return !e.isEmpty()})),featureIndex:h,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:t.image,imageAtlas:r,glyphMap:this.returnDependencies?p:null,iconMap:this.returnDependencies?f:null,glyphPositions:this.returnDependencies?t.positions:null});}}L.length?n.send("getImages",{icons:L,source:this.source,tileID:this.tileID,type:"patterns"},(function(e,t){c||(c=e,d=t,z.call(l));})):d={},z.call(this);};var l=function(e,t,r,i){this.actor=e,this.layerIndex=t,this.availableImages=r,this.loadVectorData=i||a,this.loading={},this.loaded={};};l.prototype.loadTile=function(t,r){var i=this,o=t.uid;this.loading||(this.loading={});var s=!!(t&&t.request&&t.request.collectResourceTiming)&&new e.RequestPerformance(t.request),a=this.loading[o]=new n(t);a.abort=this.loadVectorData(t,(function(t,n){if(delete i.loading[o],t||!n)return a.status="done",i.loaded[o]=a,r(t);var l=n.rawData,u={};n.expires&&(u.expires=n.expires),n.cacheControl&&(u.cacheControl=n.cacheControl);var h={};if(s){var c=s.finish();c&&(h.resourceTiming=JSON.parse(JSON.stringify(c)));}a.vectorTile=n.vectorTile,a.parse(n.vectorTile,i.layerIndex,i.availableImages,i.actor,(function(t,i){if(t||!i)return r(t);r(null,e.extend({rawTileData:l.slice(0)},i,u,h));})),i.loaded=i.loaded||{},i.loaded[o]=a;}));},l.prototype.reloadTile=function(e,t){var r=this,i=this.loaded,o=e.uid,n=this;if(i&&i[o]){var s=i[o];s.showCollisionBoxes=e.showCollisionBoxes;var a=function(e,i){var o=s.reloadCallback;o&&(delete s.reloadCallback,s.parse(s.vectorTile,n.layerIndex,r.availableImages,n.actor,o)),t(e,i);};"parsing"===s.status?s.reloadCallback=a:"done"===s.status&&(s.vectorTile?s.parse(s.vectorTile,this.layerIndex,this.availableImages,this.actor,a):a());}},l.prototype.abortTile=function(e,t){var r=this.loading,i=e.uid;r&&r[i]&&r[i].abort&&(r[i].abort(),delete r[i]),t();},l.prototype.removeTile=function(e,t){var r=this.loaded,i=e.uid;r&&r[i]&&delete r[i],t();};var u=e.window.ImageBitmap,h=function(){this.loaded={};};function c(e,t){if(0!==e.length){p(e[0],t);for(var r=1;r=0!=!!t&&e.reverse();}h.prototype.loadTile=function(t,r){var i=t.uid,o=t.encoding,n=t.rawImageData,s=u&&n instanceof u?this.getImageData(n):n,a=new e.DEMData(i,s,o);this.loaded=this.loaded||{},this.loaded[i]=a,r(null,a);},h.prototype.getImageData=function(t){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(t.width,t.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=t.width,this.offscreenCanvas.height=t.height,this.offscreenCanvasContext.drawImage(t,0,0,t.width,t.height);var r=this.offscreenCanvasContext.getImageData(-1,-1,t.width+2,t.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new e.RGBAImage({width:r.width,height:r.height},r.data)},h.prototype.removeTile=function(e){var t=this.loaded,r=e.uid;t&&t[r]&&delete t[r];};var f=e.vectorTile.VectorTileFeature.prototype.toGeoJSON,d=function(t){this._feature=t,this.extent=e.EXTENT,this.type=t.type,this.properties=t.tags,"id"in t&&!isNaN(t.id)&&(this.id=parseInt(t.id,10));};d.prototype.loadGeometry=function(){if(1===this._feature.type){for(var t=[],r=0,i=this._feature.geometry;r>31}function T(e,t){for(var r=e.loadGeometry(),i=e.type,o=0,n=0,s=r.length,a=0;a>1;!function e(t,r,i,o,n,s){for(;n>o;){if(n-o>600){var a=n-o+1,l=i-o+1,u=Math.log(a),h=.5*Math.exp(2*u/3),c=.5*Math.sqrt(u*h*(a-h)/a)*(l-a/2<0?-1:1);e(t,r,i,Math.max(o,Math.floor(i-l*h/a+c)),Math.min(n,Math.floor(i+(a-l)*h/a+c)),s);}var p=r[2*i+s],f=o,d=n;for(D(t,r,o,i),r[2*n+s]>p&&D(t,r,o,n);fp;)d--;}r[2*o+s]===p?D(t,r,o,d):D(t,r,++d,n),d<=i&&(o=d+1),i<=d&&(n=d-1);}}(t,r,a,o,n,s%2),e(t,r,i,o,a-1,s+1),e(t,r,i,a+1,n,s+1);}}(s,a,i,0,s.length-1,0);};F.prototype.range=function(e,t,r,i){return function(e,t,r,i,o,n,s){for(var a,l,u=[0,e.length-1,0],h=[];u.length;){var c=u.pop(),p=u.pop(),f=u.pop();if(p-f<=s)for(var d=f;d<=p;d++)l=t[2*d+1],(a=t[2*d])>=r&&a<=o&&l>=i&&l<=n&&h.push(e[d]);else {var g=Math.floor((f+p)/2);l=t[2*g+1],(a=t[2*g])>=r&&a<=o&&l>=i&&l<=n&&h.push(e[g]);var v=(c+1)%2;(0===c?r<=a:i<=l)&&(u.push(f),u.push(g-1),u.push(v)),(0===c?o>=a:n>=l)&&(u.push(g+1),u.push(p),u.push(v));}}return h}(this.ids,this.coords,e,t,r,i,this.nodeSize)},F.prototype.within=function(e,t,r){return function(e,t,r,i,o,n){for(var s=[0,e.length-1,0],a=[],l=o*o;s.length;){var u=s.pop(),h=s.pop(),c=s.pop();if(h-c<=n)for(var p=c;p<=h;p++)z(t[2*p],t[2*p+1],r,i)<=l&&a.push(e[p]);else {var f=Math.floor((c+h)/2),d=t[2*f],g=t[2*f+1];z(d,g,r,i)<=l&&a.push(e[f]);var v=(u+1)%2;(0===u?r-o<=d:i-o<=g)&&(s.push(c),s.push(f-1),s.push(v)),(0===u?r+o>=d:i+o>=g)&&(s.push(f+1),s.push(h),s.push(v));}}return a}(this.ids,this.coords,e,t,r,this.nodeSize)};var N={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:function(e){return e}},J=function(e){this.options=V(Object.create(N),e),this.trees=new Array(this.options.maxZoom+1);};function Z(e,t,r,i,o){return {x:e,y:t,zoom:1/0,id:r,parentId:-1,numPoints:i,properties:o}}function A(e,t){var r=e.geometry.coordinates,i=r[1];return {x:Y(r[0]),y:j(i),zoom:1/0,index:t,parentId:-1}}function B(e){return {type:"Feature",id:e.id,properties:G(e),geometry:{type:"Point",coordinates:[(i=e.x,360*(i-.5)),(t=e.y,r=(180-360*t)*Math.PI/180,360*Math.atan(Math.exp(r))/Math.PI-90)]}};var t,r,i;}function G(e){var t=e.numPoints,r=t>=1e4?Math.round(t/1e3)+"k":t>=1e3?Math.round(t/100)/10+"k":t;return V(V({},e.properties),{cluster:!0,cluster_id:e.id,point_count:t,point_count_abbreviated:r})}function Y(e){return e/360+.5}function j(e){var t=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return r<0?0:r>1?1:r}function V(e,t){for(var r in t)e[r]=t[r];return e}function X(e){return e.x}function W(e){return e.y}function R(e,t,r,i,o,n){var s=o-r,a=n-i;if(0!==s||0!==a){var l=((e-r)*s+(t-i)*a)/(s*s+a*a);l>1?(r=o,i=n):l>0&&(r+=s*l,i+=a*l);}return (s=e-r)*s+(a=t-i)*a}function q(e,t,r,i){var o={id:void 0===e?null:e,type:t,geometry:r,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(e){var t=e.geometry,r=e.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)U(e,t);else if("Polygon"===r||"MultiLineString"===r)for(var i=0;i0&&(s+=i?(o*u-l*n)/2:Math.sqrt(Math.pow(l-o,2)+Math.pow(u-n,2))),o=l,n=u;}var h=t.length-3;t[2]=1,function e(t,r,i,o){for(var n,s=o,a=i-r>>1,l=i-r,u=t[r],h=t[r+1],c=t[i],p=t[i+1],f=r+3;fs)n=f,s=d;else if(d===s){var g=Math.abs(f-a);go&&(n-r>3&&e(t,r,n,o),t[n+2]=s,i-n>3&&e(t,n,i,o));}(t,0,h,r),t[h+2]=1,t.size=Math.abs(s),t.start=0,t.end=t.size;}function Q(e,t,r,i){for(var o=0;o1?1:r}function re(e,t,r,i,o,n,s,a){if(i/=t,n>=(r/=t)&&s=i)return null;for(var l=[],u=0;u=r&&d=i)){var g=[];if("Point"===p||"MultiPoint"===p)ie(c,g,r,i,o);else if("LineString"===p)oe(c,g,r,i,o,!1,a.lineMetrics);else if("MultiLineString"===p)se(c,g,r,i,o,!1);else if("Polygon"===p)se(c,g,r,i,o,!0);else if("MultiPolygon"===p)for(var v=0;v=r&&s<=i&&(t.push(e[n]),t.push(e[n+1]),t.push(e[n+2]));}}function oe(e,t,r,i,o,n,s){for(var a,l,u=ne(e),h=0===o?le:ue,c=e.start,p=0;pr&&(l=h(u,f,d,v,m,r),s&&(u.start=c+a*l)):y>i?x=r&&(l=h(u,f,d,v,m,r),w=!0),x>i&&y<=i&&(l=h(u,f,d,v,m,i),w=!0),!n&&w&&(s&&(u.end=c+a*l),t.push(u),u=ne(e)),s&&(c+=a);}var S=e.length-3;f=e[S],d=e[S+1],g=e[S+2],(y=0===o?f:d)>=r&&y<=i&&ae(u,f,d,g),S=u.length-3,n&&S>=3&&(u[S]!==u[0]||u[S+1]!==u[1])&&ae(u,u[0],u[1],u[2]),u.length&&t.push(u);}function ne(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function se(e,t,r,i,o,n){for(var s=0;ss.maxX&&(s.maxX=h),c>s.maxY&&(s.maxY=c);}return s}function ge(e,t,r,i){var o=t.geometry,n=t.type,s=[];if("Point"===n||"MultiPoint"===n)for(var a=0;a0&&t.size<(o?s:i))r.numPoints+=t.length/3;else {for(var a=[],l=0;ls)&&(r.numSimplified++,a.push(t[l]),a.push(t[l+1])),r.numPoints++;o&&function(e,t){for(var r=0,i=0,o=e.length,n=o-2;i0===t)for(i=0,o=e.length;i24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");var i=function(e,t){var r=[];if("FeatureCollection"===e.type)for(var i=0;i=i;u--){var h=+Date.now();a=this._cluster(a,u),this.trees[u]=new F(a,X,W,n,Float32Array),r&&console.log("z%d: %d clusters in %dms",u,a.length,+Date.now()-h);}return r&&console.timeEnd("total time"),this},J.prototype.getClusters=function(e,t){var r=((e[0]+180)%360+360)%360-180,i=Math.max(-90,Math.min(90,e[1])),o=180===e[2]?180:((e[2]+180)%360+360)%360-180,n=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)r=-180,o=180;else if(r>o){var s=this.getClusters([r,i,180,n],t),a=this.getClusters([-180,i,o,n],t);return s.concat(a)}for(var l=this.trees[this._limitZoom(t)],u=[],h=0,c=l.range(Y(r),j(n),Y(o),j(i));ht&&(p+=g.numPoints||1);}if(p>=n){for(var v=l.x*c,m=l.y*c,y=o&&c>1?this._map(l,!0):null,x=(a<<5)+(t+1)+this.points.length,w=0,S=h;w1)for(var b=0,_=h;b<_.length;b+=1){var k=u.points[_[b]];k.zoom<=t||(k.zoom=t,r.push(k));}}}return r},J.prototype._getOriginId=function(e){return e-this.points.length>>5},J.prototype._getOriginZoom=function(e){return (e-this.points.length)%32},J.prototype._map=function(e,t){if(e.numPoints)return t?V({},e.properties):e.properties;var r=this.points[e.index].properties,i=this.options.map(r);return t&&i===r?V({},i):i},me.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},me.prototype.splitTile=function(e,t,r,i,o,n,s){for(var a=[e,t,r,i],l=this.options,u=l.debug;a.length;){i=a.pop(),r=a.pop(),t=a.pop(),e=a.pop();var h=1<1&&console.time("creation"),p=this.tiles[c]=de(e,t,r,i,l),this.tileCoords.push({z:t,x:r,y:i}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,r,i,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));var f="z"+t;this.stats[f]=(this.stats[f]||0)+1,this.total++;}if(p.source=e,o){if(t===l.maxZoom||t===o)continue;var d=1<1&&console.time("clipping");var g,v,m,y,x,w,S=.5*l.buffer/l.extent,I=.5-S,M=.5+S,b=1+S;g=v=m=y=null,x=re(e,h,r-S,r+M,0,p.minX,p.maxX,l),w=re(e,h,r+I,r+b,0,p.minX,p.maxX,l),e=null,x&&(g=re(x,h,i-S,i+M,1,p.minY,p.maxY,l),v=re(x,h,i+I,i+b,1,p.minY,p.maxY,l),x=null),w&&(m=re(w,h,i-S,i+M,1,p.minY,p.maxY,l),y=re(w,h,i+I,i+b,1,p.minY,p.maxY,l),w=null),u>1&&console.timeEnd("clipping"),a.push(g||[],t+1,2*r,2*i),a.push(v||[],t+1,2*r,2*i+1),a.push(m||[],t+1,2*r+1,2*i),a.push(y||[],t+1,2*r+1,2*i+1);}}},me.prototype.getTile=function(e,t,r){var i=this.options,o=i.extent,n=i.debug;if(e<0||e>24)return null;var s=1<1&&console.log("drilling down to z%d-%d-%d",e,t,r);for(var l,u=e,h=t,c=r;!l&&u>0;)u--,h=Math.floor(h/2),c=Math.floor(c/2),l=this.tiles[ye(u,h,c)];return l&&l.source?(n>1&&console.log("found parent tile z%d-%d-%d",u,h,c),n>1&&console.time("drilling down"),this.splitTile(l.source,u,h,c,e,t,r),n>1&&console.timeEnd("drilling down"),this.tiles[a]?pe(this.tiles[a],o):null):null};var we=function(t){function r(e,r,i,o){t.call(this,e,r,i,xe),o&&(this.loadGeoJSON=o);}return t&&(r.__proto__=t),(r.prototype=Object.create(t&&t.prototype)).constructor=r,r.prototype.loadData=function(e,t){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=t,this._pendingLoadDataParams=e,this._state&&"Idle"!==this._state?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData());},r.prototype._loadData=function(){var t=this;if(this._pendingCallback&&this._pendingLoadDataParams){var r=this._pendingCallback,i=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;var o=!!(i&&i.request&&i.request.collectResourceTiming)&&new e.RequestPerformance(i.request);this.loadGeoJSON(i,(function(n,s){if(n||!s)return r(n);if("object"!=typeof s)return r(new Error("Input data given to '"+i.source+"' is not a valid GeoJSON object."));!function e(t,r){var i,o=t&&t.type;if("FeatureCollection"===o)for(i=0;i=0?0:e.button},i.remove=function(t){t.parentNode&&t.parentNode.removeChild(t);};var p=function(e){function i(){e.call(this),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.RGBAImage({width:1,height:1}),this.dirty=!0;}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.isLoaded=function(){return this.loaded},i.prototype.setLoaded=function(t){if(this.loaded!==t&&(this.loaded=t,t)){for(var e=0,i=this.requestors;e=0?1.2:1));}function g(t,e,i,o,r,a,n){for(var s=0;s65535)e(new Error("glyphs > 65535 not supported"));else if(a.ranges[s])e(null,{stack:i,id:r,glyph:n});else {var l=a.requests[s];l||(l=a.requests[s]=[],y.loadGlyphRange(i,s,o.url,o.requestManager,(function(t,e){if(e){for(var i in e)o._doesCharSupportLocalGlyph(+i)||(a.glyphs[+i]=e[+i]);a.ranges[s]=!0;}for(var r=0,n=l;r1&&(s=t[++n]);var c=Math.abs(l-s.left),u=Math.abs(l-s.right),h=Math.min(c,u),p=void 0,d=r/i*(o+1);if(s.isDash){var _=o-Math.abs(d);p=Math.sqrt(h*h+_*_);}else p=o-Math.sqrt(h*h+d*d);this.data[a+l]=Math.max(0,Math.min(255,p+128));}},T.prototype.addRegularDash=function(t){for(var e=t.length-1;e>=0;--e){var i=t[e],o=t[e+1];i.zeroLength?t.splice(e,1):o&&o.isDash===i.isDash&&(o.left=i.left,t.splice(e,1));}var r=t[0],a=t[t.length-1];r.isDash===a.isDash&&(r.left=a.left-this.width,a.right=r.right+this.width);for(var n=this.width*this.nextRow,s=0,l=t[s],c=0;c1&&(l=t[++s]);var u=Math.abs(c-l.left),h=Math.abs(c-l.right),p=Math.min(u,h);this.data[n+c]=Math.max(0,Math.min(255,(l.isDash?p:-p)+128));}},T.prototype.addDash=function(e,i){var o=i?7:0,r=2*o+1;if(this.nextRow+r>this.height)return t.warnOnce("LineAtlas out of space"),null;for(var a=0,n=0;n=o&&e.x=r&&e.y0&&(l[new t.OverscaledTileID(e.overscaledZ,a,i.z,r,i.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,i.z,n,i.y-1).key]={backfilled:!1}),i.y+10&&(o.resourceTiming=e._resourceTiming,e._resourceTiming=[]),e.fire(new t.Event("data",o));}}));},i.prototype.onAdd=function(t){this.map=t,this.load();},i.prototype.setData=function(e){var i=this;return this._data=e,this.fire(new t.Event("dataloading",{dataType:"source"})),this._updateWorkerData((function(e){if(e)i.fire(new t.ErrorEvent(e));else {var o={dataType:"source",sourceDataType:"content"};i._collectResourceTiming&&i._resourceTiming&&i._resourceTiming.length>0&&(o.resourceTiming=i._resourceTiming,i._resourceTiming=[]),i.fire(new t.Event("data",o));}})),this},i.prototype.getClusterExpansionZoom=function(t,e){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},e),this},i.prototype.getClusterChildren=function(t,e){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},e),this},i.prototype.getClusterLeaves=function(t,e,i,o){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:e,offset:i},o),this},i.prototype._updateWorkerData=function(e){var i=this;this._loaded=!1;var o=t.extend({},this.workerOptions),r=this._data;"string"==typeof r?(o.request=this.map._requestManager.transformRequest(t.browser.resolveURL(r),t.ResourceType.Source),o.request.collectResourceTiming=this._collectResourceTiming):o.data=JSON.stringify(r),this.actor.send(this.type+".loadData",o,(function(t,r){i._removed||r&&r.abandoned||(i._loaded=!0,r&&r.resourceTiming&&r.resourceTiming[i.id]&&(i._resourceTiming=r.resourceTiming[i.id].slice(0)),i.actor.send(i.type+".coalesce",{source:o.source},null),e(t));}));},i.prototype.loaded=function(){return this._loaded},i.prototype.loadTile=function(e,i){var o=this,r=e.actor?"reloadTile":"loadTile";e.actor=this.actor,e.request=this.actor.send(r,{type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:t.browser.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},(function(t,a){return delete e.request,e.unloadVectorData(),e.aborted?i(null):t?i(t):(e.loadVectorData(a,o.map.painter,"reloadTile"===r),i(null))}));},i.prototype.abortTile=function(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0;},i.prototype.unloadTile=function(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id});},i.prototype.onRemove=function(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id});},i.prototype.serialize=function(){return t.extend({},this._options,{type:this.type,data:this._data})},i.prototype.hasTransition=function(){return !1},i}(t.Evented),A=t.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),M=function(e){function i(t,i,o,r){e.call(this),this.id=t,this.dispatcher=o,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(r),this.options=i;}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.load=function(e,i){var o=this;this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this.url=this.options.url,t.getImage(this.map._requestManager.transformRequest(this.url,t.ResourceType.Image),(function(r,a){o._loaded=!0,r?o.fire(new t.ErrorEvent(r)):a&&(o.image=a,e&&(o.coordinates=e),i&&i(),o._finishLoading());}));},i.prototype.loaded=function(){return this._loaded},i.prototype.updateImage=function(t){var e=this;return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,(function(){e.texture=null;})),this):this},i.prototype._finishLoading=function(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})));},i.prototype.onAdd=function(t){this.map=t,this.load();},i.prototype.setCoordinates=function(e){var i=this;this.coordinates=e;var o=e.map(t.MercatorCoordinate.fromLngLat);this.tileID=function(e){for(var i=1/0,o=1/0,r=-1/0,a=-1/0,n=0,s=e;ni.end(0)?this.fire(new t.ErrorEvent(new t.ValidationError("sources."+this.id,null,"Playback for this video can be set only between the "+i.start(0)+" and "+i.end(0)+"-second mark."))):this.video.currentTime=e;}},i.prototype.getVideo=function(){return this.video},i.prototype.onAdd=function(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)));},i.prototype.prepare=function(){if(!(0===Object.keys(this.tiles).length||this.video.readyState<2)){var e=this.map.painter.context,i=e.gl;for(var o in this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,A.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new t.Texture(e,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE)),this.tiles){var r=this.tiles[o];"loaded"!==r.state&&(r.state="loaded",r.texture=this.texture);}}},i.prototype.serialize=function(){return {type:"video",urls:this.urls,coordinates:this.coordinates}},i.prototype.hasTransition=function(){return this.video&&!this.video.paused},i}(M),R=function(e){function i(i,o,r,a){e.call(this,i,o,r,a),o.coordinates?Array.isArray(o.coordinates)&&4===o.coordinates.length&&!o.coordinates.some((function(t){return !Array.isArray(t)||2!==t.length||t.some((function(t){return "number"!=typeof t}))}))||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+i,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+i,null,'missing required property "coordinates"'))),o.animate&&"boolean"!=typeof o.animate&&this.fire(new t.ErrorEvent(new t.ValidationError("sources."+i,null,'optional "animate" property must be a boolean value'))),o.canvas?"string"==typeof o.canvas||o.canvas instanceof t.window.HTMLCanvasElement||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+i,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+i,null,'missing required property "canvas"'))),this.options=o,this.animate=void 0===o.animate||o.animate;}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.load=function(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof t.window.HTMLCanvasElement?this.options.canvas:t.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new t.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint();},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1);},this._finishLoading());},i.prototype.getCanvas=function(){return this.canvas},i.prototype.onAdd=function(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play();},i.prototype.onRemove=function(){this.pause();},i.prototype.prepare=function(){var e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),!this._hasInvalidDimensions()&&0!==Object.keys(this.tiles).length){var i=this.map.painter.context,o=i.gl;for(var r in this.boundsBuffer||(this.boundsBuffer=i.createVertexBuffer(this._boundsArray,A.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new t.Texture(i,this.canvas,o.RGBA,{premultiply:!0}),this.tiles){var a=this.tiles[r];"loaded"!==a.state&&(a.state="loaded",a.texture=this.texture);}}},i.prototype.serialize=function(){return {type:"canvas",coordinates:this.coordinates}},i.prototype.hasTransition=function(){return this._playing},i.prototype._hasInvalidDimensions=function(){for(var t=0,e=[this.canvas.width,this.canvas.height];tthis.max){var n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n);}return this},U.prototype.has=function(t){return t.wrapped().key in this.data},U.prototype.getAndRemove=function(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null},U.prototype._getAndRemoveByKey=function(t){var e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value},U.prototype.getByKey=function(t){var e=this.data[t];return e?e[0].value:null},U.prototype.get=function(t){return this.has(t)?this.data[t.wrapped().key][0].value:null},U.prototype.remove=function(t,e){if(!this.has(t))return this;var i=t.wrapped().key,o=void 0===e?0:this.data[i].indexOf(e),r=this.data[i][o];return this.data[i].splice(o,1),r.timeout&&clearTimeout(r.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(r.value),this.order.splice(this.order.indexOf(i),1),this},U.prototype.setMaxSize=function(t){for(this.max=t;this.order.length>this.max;){var e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e);}return this},U.prototype.filter=function(t){var e=[];for(var i in this.data)for(var o=0,r=this.data[i];o1||(Math.abs(i)>1&&(1===Math.abs(i+r)?i+=r:1===Math.abs(i-r)&&(i-=r)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,i,o),t.neighboringTiles&&t.neighboringTiles[a]&&(t.neighboringTiles[a].backfilled=!0)));}},i.prototype.getTile=function(t){return this.getTileByID(t.key)},i.prototype.getTileByID=function(t){return this._tiles[t]},i.prototype._retainLoadedChildren=function(t,e,i,o){for(var r in this._tiles){var a=this._tiles[r];if(!(o[r]||!a.hasData()||a.tileID.overscaledZ<=e||a.tileID.overscaledZ>i)){for(var n=a.tileID;a&&a.tileID.overscaledZ>e+1;){var s=a.tileID.scaledTo(a.tileID.overscaledZ-1);(a=this._tiles[s.key])&&a.hasData()&&(n=s);}for(var l=n;l.overscaledZ>e;)if(t[(l=l.scaledTo(l.overscaledZ-1)).key]){o[n.key]=n;break}}}},i.prototype.findLoadedParent=function(t,e){if(t.key in this._loadedParentTiles){var i=this._loadedParentTiles[t.key];return i&&i.tileID.overscaledZ>=e?i:null}for(var o=t.overscaledZ-1;o>=e;o--){var r=t.scaledTo(o),a=this._getLoadedTile(r);if(a)return a}},i.prototype._getLoadedTile=function(t){var e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(t.wrapped().key)},i.prototype.updateCacheSize=function(t){var e=Math.ceil(t.width/this._source.tileSize)+1,i=Math.ceil(t.height/this._source.tileSize)+1,o=Math.floor(e*i*5),r="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,o):o;this._cache.setMaxSize(r);},i.prototype.handleWrapJump=function(t){var e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){var i={};for(var o in this._tiles){var r=this._tiles[o];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+e),i[r.tileID.key]=r;}for(var a in this._tiles=i,this._timers)clearTimeout(this._timers[a]),delete this._timers[a];for(var n in this._tiles)this._setTileReloadTimer(n,this._tiles[n]);}},i.prototype.update=function(e){var o=this;if(this.transform=e,this._sourceLoaded&&!this._paused){var r;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used?this._source.tileID?r=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((function(e){return new t.OverscaledTileID(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)})):(r=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}),this._source.hasTile&&(r=r.filter((function(t){return o._source.hasTile(t)})))):r=[];var a=e.coveringZoomLevel(this._source),n=Math.max(a-i.maxOverzooming,this._source.minzoom),s=Math.max(a+i.maxUnderzooming,this._source.minzoom),l=this._updateRetainedTiles(r,a);if(Mt(this._source.type)){for(var c={},u={},h=0,p=Object.keys(l);hthis._source.maxzoom){var m=_.children(this._source.maxzoom)[0],g=this.getTile(m);if(g&&g.hasData()){o[m.key]=m;continue}}else {var v=_.children(this._source.maxzoom);if(o[v[0].key]&&o[v[1].key]&&o[v[2].key]&&o[v[3].key])continue}for(var y=f.wasRequested(),x=_.overscaledZ-1;x>=a;--x){var b=_.scaledTo(x);if(r[b.key])break;if(r[b.key]=!0,!(f=this.getTile(b))&&y&&(f=this._addTile(b)),f&&(o[b.key]=b,y=f.wasRequested(),f.hasData()))break}}}return o},i.prototype._updateLoadedParentTileCache=function(){for(var t in this._loadedParentTiles={},this._tiles){for(var e=[],i=void 0,o=this._tiles[t].tileID;o.overscaledZ>0;){if(o.key in this._loadedParentTiles){i=this._loadedParentTiles[o.key];break}e.push(o.key);var r=o.scaledTo(o.overscaledZ-1);if(i=this._getLoadedTile(r))break;o=r;}for(var a=0,n=e;a0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))));},i.prototype.clearTiles=function(){for(var t in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(t);this._cache.reset();},i.prototype.tilesIn=function(e,i,o){var r=this,a=[],n=this.transform;if(!n)return a;for(var s=o?n.getCameraQueryGeometry(e):e,l=e.map((function(t){return n.pointCoordinate(t)})),c=s.map((function(t){return n.pointCoordinate(t)})),u=this.getIds(),h=1/0,p=1/0,d=-1/0,_=-1/0,f=0,m=c;f=0&&g[1].y+m>=0){var v=l.map((function(t){return s.getTilePoint(t)})),y=c.map((function(t){return s.getTilePoint(t)}));a.push({tile:o,tileID:s,queryGeometry:v,cameraQueryGeometry:y,scale:f});}}},y=0;y=t.browser.now())return !0}return !1},i.prototype.setFeatureState=function(t,e,i){this._state.updateState(t=t||"_geojsonTileLayer",e,i);},i.prototype.removeFeatureState=function(t,e,i){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,i);},i.prototype.getFeatureState=function(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)},i.prototype.setDependencies=function(t,e,i){var o=this._tiles[t];o&&o.setDependencies(e,i);},i.prototype.reloadTilesForDependencies=function(t,e){for(var i in this._tiles)this._tiles[i].hasDependency(t,e)&&this._reloadTile(i,"reloading");this._cache.filter((function(i){return !i.hasDependency(t,e)}));},i}(t.Evented);function At(t,e){var i=Math.abs(2*t.wrap)-+(t.wrap<0),o=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||o-i||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function Mt(t){return "raster"===t||"image"===t||"video"===t}function Lt(){return new t.window.Worker(Kr.workerUrl)}Dt.maxOverzooming=10,Dt.maxUnderzooming=3;var Rt="mapboxgl_preloaded_worker_pool",kt=function(){this.active={};};kt.prototype.acquire=function(t){if(!this.workers)for(this.workers=[];this.workers.length0?(r-n)/s:0;return this.points[a].mult(1-l).add(this.points[i].mult(l))};var Yt=function(t,e,i){var o=this.boxCells=[],r=this.circleCells=[];this.xCellCount=Math.ceil(t/i),this.yCellCount=Math.ceil(e/i);for(var a=0;a=-e[0]&&i<=e[0]&&o>=-e[1]&&o<=e[1]}function ie(e,i,o,r,a,n,s,l){var c=r?e.textSizeData:e.iconSizeData,u=t.evaluateSizeForZoom(c,o.transform.zoom),h=[256/o.width*2+1,256/o.height*2+1],p=r?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;p.clear();for(var d=e.lineVertexArray,_=r?e.text.placedSymbolArray:e.icon.placedSymbolArray,f=o.transform.width/o.transform.height,m=!1,g=0;g<_.length;g++){var v=_.get(g);if(v.hidden||v.writingMode===t.WritingMode.vertical&&!m)ce(v.numGlyphs,p);else {m=!1;var y=[v.anchorX,v.anchorY,0,1];if(t.transformMat4(y,y,i),ee(y,h)){var x=te(o.transform.cameraToCenterDistance,y[3]),b=t.evaluateSizeForFeature(c,u,v),w=s?b/x:b*x,T=new t.Point(v.anchorX,v.anchorY),E=$t(T,a).point,I={},P=ae(v,w,!1,l,i,a,n,e.glyphOffsetArray,d,p,E,T,I,f);m=P.useVertical,(P.notEnoughRoom||m||P.needsFlipping&&ae(v,w,!0,l,i,a,n,e.glyphOffsetArray,d,p,E,T,I,f).notEnoughRoom)&&ce(v.numGlyphs,p);}else ce(v.numGlyphs,p);}}r?e.text.dynamicLayoutVertexBuffer.updateData(p):e.icon.dynamicLayoutVertexBuffer.updateData(p);}function oe(t,e,i,o,r,a,n,s,l,c,u){var h=s.glyphStartIndex+s.numGlyphs,p=s.lineStartIndex,d=s.lineStartIndex+s.lineLength,_=e.getoffsetX(s.glyphStartIndex),f=e.getoffsetX(h-1),m=se(t*_,i,o,r,a,n,s.segment,p,d,l,c,u);if(!m)return null;var g=se(t*f,i,o,r,a,n,s.segment,p,d,l,c,u);return g?{first:m,last:g}:null}function re(e,i,o,r){return e===t.WritingMode.horizontal&&Math.abs(o.y-i.y)>Math.abs(o.x-i.x)*r?{useVertical:!0}:(e===t.WritingMode.vertical?i.yo.x)?{needsFlipping:!0}:null}function ae(e,i,o,r,a,n,s,l,c,u,h,p,d,_){var f,m=i/24,g=e.lineOffsetX*m,v=e.lineOffsetY*m;if(e.numGlyphs>1){var y=e.glyphStartIndex+e.numGlyphs,x=e.lineStartIndex,b=e.lineStartIndex+e.lineLength,w=oe(m,l,g,v,o,h,p,e,c,n,d);if(!w)return {notEnoughRoom:!0};var T=$t(w.first.point,s).point,E=$t(w.last.point,s).point;if(r&&!o){var I=re(e.writingMode,T,E,_);if(I)return I}f=[w.first];for(var P=e.glyphStartIndex+1;P0?D.point:ne(p,z,S,1,a),M=re(e.writingMode,S,A,_);if(M)return M}var L=se(m*l.getoffsetX(e.glyphStartIndex),g,v,o,h,p,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,c,n,d);if(!L)return {notEnoughRoom:!0};f=[L];}for(var R=0,k=f;R0?1:-1,f=0;r&&(_*=-1,f=Math.PI),_<0&&(f+=Math.PI);for(var m=_>0?l+s:l+s+1,g=a,v=a,y=0,x=0,b=Math.abs(d),w=[];y+x<=b;){if((m+=_)=c)return null;if(v=g,w.push(g),void 0===(g=p[m])){var T=new t.Point(u.getx(m),u.gety(m)),E=$t(T,h);if(E.signedDistanceFromCamera>0)g=p[m]=E.point;else {var I=m-_;g=ne(0===y?n:new t.Point(u.getx(I),u.gety(I)),T,v,b-y+1,h);}}y+=x,x=v.dist(g);}var P=(b-y)/x,S=g.sub(v),C=S.mult(P)._add(v);C._add(S._unit()._perp()._mult(o*_));var z=f+Math.atan2(g.y-v.y,g.x-v.x);return w.push(C),{point:C,angle:z,path:w}}Yt.prototype.keysLength=function(){return this.boxKeys.length+this.circleKeys.length},Yt.prototype.insert=function(t,e,i,o,r){this._forEachCell(e,i,o,r,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(o),this.bboxes.push(r);},Yt.prototype.insertCircle=function(t,e,i,o){this._forEachCell(e-o,i-o,e+o,i+o,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(i),this.circles.push(o);},Yt.prototype._insertBoxCell=function(t,e,i,o,r,a){this.boxCells[r].push(a);},Yt.prototype._insertCircleCell=function(t,e,i,o,r,a){this.circleCells[r].push(a);},Yt.prototype._query=function(t,e,i,o,r,a){if(i<0||t>this.width||o<0||e>this.height)return !r&&[];var n=[];if(t<=0&&e<=0&&this.width<=i&&this.height<=o){if(r)return !0;for(var s=0;s0:n},Yt.prototype._queryCircle=function(t,e,i,o,r){var a=t-i,n=t+i,s=e-i,l=e+i;if(n<0||a>this.width||l<0||s>this.height)return !o&&[];var c=[];return this._forEachCell(a,s,n,l,this._queryCellCircle,c,{hitTest:o,circle:{x:t,y:e,radius:i},seenUids:{box:{},circle:{}}},r),o?c.length>0:c},Yt.prototype.query=function(t,e,i,o,r){return this._query(t,e,i,o,!1,r)},Yt.prototype.hitTest=function(t,e,i,o,r){return this._query(t,e,i,o,!0,r)},Yt.prototype.hitTestCircle=function(t,e,i,o){return this._queryCircle(t,e,i,!0,o)},Yt.prototype._queryCell=function(t,e,i,o,r,a,n,s){var l=n.seenUids,c=this.boxCells[r];if(null!==c)for(var u=this.bboxes,h=0,p=c;h=u[_+0]&&o>=u[_+1]&&(!s||s(this.boxKeys[d]))){if(n.hitTest)return a.push(!0),!0;a.push({key:this.boxKeys[d],x1:u[_],y1:u[_+1],x2:u[_+2],y2:u[_+3]});}}}var f=this.circleCells[r];if(null!==f)for(var m=this.circles,g=0,v=f;gn*n+s*s},Yt.prototype._circleAndRectCollide=function(t,e,i,o,r,a,n){var s=(a-o)/2,l=Math.abs(t-(o+s));if(l>s+i)return !1;var c=(n-r)/2,u=Math.abs(e-(r+c));if(u>c+i)return !1;if(l<=s||u<=c)return !0;var h=l-s,p=u-c;return h*h+p*p<=i*i};var le=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ce(t,e){for(var i=0;i=1;A--)D.push(C.path[A]);for(var M=1;M0){for(var B=D[0].clone(),O=D[0].clone(),F=1;F=I.x&&O.x<=P.x&&B.y>=I.y&&O.y<=P.y?[D]:O.xP.x||O.yP.y?[]:t.clipLine([D],I.x,I.y,P.x,P.y);}for(var U=0,N=k;U=this.screenRightBoundary||o<100||e>this.screenBottomBoundary},he.prototype.isInsideGrid=function(t,e,i,o){return i>=0&&t=0&&e0?(this.prevPlacement&&this.prevPlacement.variableOffsets[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID].text&&(f=this.prevPlacement.variableOffsets[h.crossTileID].anchor),this.variableOffsets[h.crossTileID]={textOffset:m,width:i,height:o,anchor:t,textBoxScale:r,prevAnchor:f},this.markUsedJustification(p,t,h,d),p.allowVerticalPlacement&&(this.markUsedOrientation(p,d,h),this.placedOrientations[h.crossTileID]=d),{shift:g,placedGlyphBoxes:v}):void 0},be.prototype.placeLayerBucketPart=function(e,i,o){var r=this,a=e.parameters,n=a.bucket,s=a.layout,l=a.posMatrix,c=a.textLabelPlaneMatrix,u=a.labelToScreenMatrix,h=a.textPixelRatio,p=a.holdingForFade,d=a.collisionBoxArray,_=a.partiallyEvaluatedTextSize,f=a.collisionGroup,m=s.get("text-optional"),g=s.get("icon-optional"),v=s.get("text-allow-overlap"),y=s.get("icon-allow-overlap"),x="map"===s.get("text-rotation-alignment"),b="map"===s.get("text-pitch-alignment"),w="none"!==s.get("icon-text-fit"),T="viewport-y"===s.get("symbol-z-order"),E=v&&(y||!n.hasIconData()||g),I=y&&(v||!n.hasTextData()||m);!n.collisionArrays&&d&&n.deserializeCollisionBoxes(d);var P=function(e,a){if(!i[e.crossTileID])if(p)r.placements[e.crossTileID]=new fe(!1,!1,!1);else {var d,T=!1,P=!1,S=!0,C=null,z={box:null,offscreen:null},D={box:null,offscreen:null},A=null,M=null,L=0,R=0,k=0;a.textFeatureIndex?L=a.textFeatureIndex:e.useRuntimeCollisionCircles&&(L=e.featureIndex),a.verticalTextFeatureIndex&&(R=a.verticalTextFeatureIndex);var B=a.textBox;if(B){var O=function(i){var o=t.WritingMode.horizontal;if(n.allowVerticalPlacement&&!i&&r.prevPlacement){var a=r.prevPlacement.placedOrientations[e.crossTileID];a&&(r.placedOrientations[e.crossTileID]=a,r.markUsedOrientation(n,o=a,e));}return o},F=function(i,o){if(n.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&a.verticalTextBox)for(var r=0,s=n.writingModes;r0&&(U=U.filter((function(t){return t!==N.anchor}))).unshift(N.anchor);}var Z=function(t,i,o){for(var a=t.x2-t.x1,s=t.y2-t.y1,c=e.textBoxScale,u=w&&!y?i:null,p={box:[],offscreen:!1},d=v?2*U.length:U.length,_=0;_=U.length,e,n,o,u);if(m&&(p=m.placedGlyphBoxes)&&p.box&&p.box.length){T=!0,C=m.shift;break}}return p};F((function(){return Z(B,a.iconBox,t.WritingMode.horizontal)}),(function(){var i=a.verticalTextBox;return n.allowVerticalPlacement&&!(z&&z.box&&z.box.length)&&e.numVerticalGlyphVertices>0&&i?Z(i,a.verticalIconBox,t.WritingMode.vertical):{box:null,offscreen:null}})),z&&(T=z.box,S=z.offscreen);var q=O(z&&z.box);if(!T&&r.prevPlacement){var j=r.prevPlacement.variableOffsets[e.crossTileID];j&&(r.variableOffsets[e.crossTileID]=j,r.markUsedJustification(n,j.anchor,e,q));}}else {var V=function(t,i){var o=r.collisionIndex.placeCollisionBox(t,v,h,l,f.predicate);return o&&o.box&&o.box.length&&(r.markUsedOrientation(n,i,e),r.placedOrientations[e.crossTileID]=i),o};F((function(){return V(B,t.WritingMode.horizontal)}),(function(){var i=a.verticalTextBox;return n.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&i?V(i,t.WritingMode.vertical):{box:null,offscreen:null}})),O(z&&z.box&&z.box.length);}}if(T=(d=z)&&d.box&&d.box.length>0,S=d&&d.offscreen,e.useRuntimeCollisionCircles){var G=n.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),W=t.evaluateSizeForFeature(n.textSizeData,_,G),X=s.get("text-padding");A=r.collisionIndex.placeCollisionCircles(v,G,n.lineVertexArray,n.glyphOffsetArray,W,l,c,u,o,b,f.predicate,e.collisionCircleDiameter,X),T=v||A.circles.length>0&&!A.collisionDetected,S=S&&A.offscreen;}if(a.iconFeatureIndex&&(k=a.iconFeatureIndex),a.iconBox){var H=function(t){var e=w&&C?xe(t,C.x,C.y,x,b,r.transform.angle):t;return r.collisionIndex.placeCollisionBox(e,y,h,l,f.predicate)};P=D&&D.box&&D.box.length&&a.verticalIconBox?(M=H(a.verticalIconBox)).box.length>0:(M=H(a.iconBox)).box.length>0,S=S&&M.offscreen;}var K=m||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,Y=g||0===e.numIconVertices;if(K||Y?Y?K||(P=P&&T):T=P&&T:P=T=P&&T,T&&d&&d.box&&r.collisionIndex.insertCollisionBox(d.box,s.get("text-ignore-placement"),n.bucketInstanceId,D&&D.box&&R?R:L,f.ID),P&&M&&r.collisionIndex.insertCollisionBox(M.box,s.get("icon-ignore-placement"),n.bucketInstanceId,k,f.ID),A&&(T&&r.collisionIndex.insertCollisionCircles(A.circles,s.get("text-ignore-placement"),n.bucketInstanceId,L,f.ID),o)){var J=n.bucketInstanceId,Q=r.collisionCircleArrays[J];void 0===Q&&(Q=r.collisionCircleArrays[J]=new me);for(var $=0;$=0;--C){var z=S[C];P(n.symbolInstances.get(z),n.collisionArrays[z]);}else for(var D=e.symbolInstanceStart;D=0&&(e.text.placedSymbolArray.get(l).crossTileID=a>=0&&l!==a?0:o.crossTileID);}},be.prototype.markUsedOrientation=function(e,i,o){for(var r=i===t.WritingMode.horizontal||i===t.WritingMode.horizontalOnly?i:0,a=i===t.WritingMode.vertical?i:0,n=0,s=[o.leftJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.rightJustifiedTextSymbolIndex];n0,v=r.placedOrientations[a.crossTileID],y=v===t.WritingMode.vertical,x=v===t.WritingMode.horizontal||v===t.WritingMode.horizontalOnly;if(s>0||l>0){var b=De(m.text);_(e.text,s,y?Ae:b),_(e.text,l,x?Ae:b);var w=m.text.isHidden();[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex].forEach((function(t){t>=0&&(e.text.placedSymbolArray.get(t).hidden=w||y?1:0);})),a.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).hidden=w||x?1:0);var T=r.variableOffsets[a.crossTileID];T&&r.markUsedJustification(e,T.anchor,a,v);var E=r.placedOrientations[a.crossTileID];E&&(r.markUsedJustification(e,"left",a,E),r.markUsedOrientation(e,E,a));}if(g){var I=De(m.icon),P=!(p&&a.verticalPlacedIconSymbolIndex&&y);a.placedIconSymbolIndex>=0&&(_(e.icon,a.numIconVertices,P?I:Ae),e.icon.placedSymbolArray.get(a.placedIconSymbolIndex).hidden=m.icon.isHidden()),a.verticalPlacedIconSymbolIndex>=0&&(_(e.icon,a.numVerticalIconVertices,P?Ae:I),e.icon.placedSymbolArray.get(a.verticalPlacedIconSymbolIndex).hidden=m.icon.isHidden());}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){var S=e.collisionArrays[o];if(S){var C=new t.Point(0,0);if(S.textBox||S.verticalTextBox){var z=!0;if(c){var D=r.variableOffsets[f];D?(C=ye(D.anchor,D.width,D.height,D.textOffset,D.textBoxScale),u&&C._rotate(h?r.transform.angle:-r.transform.angle)):z=!1;}S.textBox&&we(e.textCollisionBox.collisionVertexArray,m.text.placed,!z||y,C.x,C.y),S.verticalTextBox&&we(e.textCollisionBox.collisionVertexArray,m.text.placed,!z||x,C.x,C.y);}var A=Boolean(!x&&S.verticalIconBox);S.iconBox&&we(e.iconCollisionBox.collisionVertexArray,m.icon.placed,A,p?C.x:0,p?C.y:0),S.verticalIconBox&&we(e.iconCollisionBox.collisionVertexArray,m.icon.placed,!A,p?C.x:0,p?C.y:0);}}},m=0;mt},be.prototype.setStale=function(){this.stale=!0;};var Te=Math.pow(2,25),Ee=Math.pow(2,24),Ie=Math.pow(2,17),Pe=Math.pow(2,16),Se=Math.pow(2,9),Ce=Math.pow(2,8),ze=Math.pow(2,1);function De(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;var e=t.placed?1:0,i=Math.floor(127*t.opacity);return i*Te+e*Ee+i*Ie+e*Pe+i*Se+e*Ce+i*ze+e}var Ae=0,Me=function(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[];};Me.prototype.continuePlacement=function(t,e,i,o,r){for(var a=this._bucketParts;this._currentTileIndex2};this._currentPlacementIndex>=0;){var s=i[e[this._currentPlacementIndex]],l=this.placement.collisionIndex.transform.zoom;if("symbol"===s.type&&(!s.minzoom||s.minzoom<=l)&&(!s.maxzoom||s.maxzoom>l)){if(this._inProgressLayer||(this._inProgressLayer=new Me(s)),this._inProgressLayer.continuePlacement(o[s.source],this.placement,this._showCollisionBoxes,s,n))return;delete this._inProgressLayer;}this._currentPlacementIndex--;}this._done=!0;},Le.prototype.commit=function(t){return this.placement.commit(t),this.placement};var Re=512/t.EXTENT/2,ke=function(t,e,i){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=i;for(var o=0;ot.overscaledZ)for(var s in n){var l=n[s];l.tileID.isChildOf(t)&&l.findMatches(e.symbolInstances,t,r);}else {var c=n[t.scaledTo(Number(a)).key];c&&c.findMatches(e.symbolInstances,t,r);}}for(var u=0;u1?"@2x":"",l=t.getJSON(i.transformRequest(i.normalizeSpriteURL(e,s,".json"),t.ResourceType.SpriteJSON),(function(t,e){l=null,n||(n=t,r=e,u());})),c=t.getImage(i.transformRequest(i.normalizeSpriteURL(e,s,".png"),t.ResourceType.SpriteImage),(function(t,e){c=null,n||(n=t,a=e,u());}));function u(){if(n)o(n);else if(r&&a){var e=t.browser.getImageData(a),i={};for(var s in r){var l=r[s],c=l.width,u=l.height,h=l.x,p=l.y,d=l.sdf,_=l.pixelRatio,f=l.stretchX,m=l.stretchY,g=l.content,v=new t.RGBAImage({width:c,height:u});t.RGBAImage.copy(e,v,{x:h,y:p},{x:0,y:0},{width:c,height:u}),i[s]={data:v,pixelRatio:_,sdf:d,stretchX:f,stretchY:m,content:g};}o(null,i);}}return {cancel:function(){l&&(l.cancel(),l=null),c&&(c.cancel(),c=null);}}}(e,this.map._requestManager,(function(e,o){if(i._spriteRequest=null,e)i.fire(new t.ErrorEvent(e));else if(o)for(var r in o)i.imageManager.addImage(r,o[r]);i.imageManager.setLoaded(!0),i._availableImages=i.imageManager.listImages(),i.dispatcher.broadcast("setImages",i._availableImages),i.fire(new t.Event("data",{dataType:"style"}));}));},i.prototype._validateLayer=function(e){var i=this.sourceCaches[e.source];if(i){var o=e.sourceLayer;if(o){var r=i.getSource();("geojson"===r.type||r.vectorLayerIds&&-1===r.vectorLayerIds.indexOf(o))&&this.fire(new t.ErrorEvent(new Error('Source layer "'+o+'" does not exist on source "'+r.id+'" as specified by style layer "'+e.id+'"')));}}},i.prototype.loaded=function(){if(!this._loaded)return !1;if(Object.keys(this._updatedSources).length)return !1;for(var t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return !1;return !!this.imageManager.isLoaded()},i.prototype._serializeLayers=function(t){for(var e=[],i=0,o=t;i0)throw new Error("Unimplemented: "+r.map((function(t){return t.command})).join(", ")+".");return o.forEach((function(t){"setTransition"!==t.command&&i[t.command].apply(i,t.args);})),this.stylesheet=e,!0},i.prototype.addImage=function(e,i){if(this.getImage(e))return this.fire(new t.ErrorEvent(new Error("An image with this name already exists.")));this.imageManager.addImage(e,i),this._afterImageUpdated(e);},i.prototype.updateImage=function(t,e){this.imageManager.updateImage(t,e);},i.prototype.getImage=function(t){return this.imageManager.getImage(t)},i.prototype.removeImage=function(e){if(!this.getImage(e))return this.fire(new t.ErrorEvent(new Error("No image with this name exists.")));this.imageManager.removeImage(e),this._afterImageUpdated(e);},i.prototype._afterImageUpdated=function(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"}));},i.prototype.listImages=function(){return this._checkLoaded(),this.imageManager.listImages()},i.prototype.addSource=function(e,i,o){var r=this;if(void 0===o&&(o={}),this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error("There is already a source with this ID");if(!i.type)throw new Error("The type property must be defined, but only the following properties were given: "+Object.keys(i).join(", ")+".");if(!(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(t.validateStyle.source,"sources."+e,i,null,o))){this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);var a=this.sourceCaches[e]=new Dt(e,i,this.dispatcher);a.style=this,a.setEventedParent(this,(function(){return {isSourceLoaded:r.loaded(),source:a.serialize(),sourceId:e}})),a.onAdd(this.map),this._changed=!0;}},i.prototype.removeSource=function(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(var i in this._layers)if(this._layers[i].source===e)return this.fire(new t.ErrorEvent(new Error('Source "'+e+'" cannot be removed while layer "'+i+'" is using it.')));var o=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],o.fire(new t.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),o.setEventedParent(null),o.clearTiles(),o.onRemove&&o.onRemove(this.map),this._changed=!0;},i.prototype.setGeoJSONSourceData=function(t,e){this._checkLoaded(),this.sourceCaches[t].getSource().setData(e),this._changed=!0;},i.prototype.getSource=function(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()},i.prototype.addLayer=function(e,i,o){void 0===o&&(o={}),this._checkLoaded();var r=e.id;if(this.getLayer(r))this.fire(new t.ErrorEvent(new Error('Layer with id "'+r+'" already exists on this map')));else {var a;if("custom"===e.type){if(Ue(this,t.validateCustomStyleLayer(e)))return;a=t.createStyleLayer(e);}else {if("object"==typeof e.source&&(this.addSource(r,e.source),e=t.clone$1(e),e=t.extend(e,{source:r})),this._validate(t.validateStyle.layer,"layers."+r,e,{arrayIndex:-1},o))return;a=t.createStyleLayer(e),this._validateLayer(a),a.setEventedParent(this,{layer:{id:r}}),this._serializedLayers[a.id]=a.serialize();}var n=i?this._order.indexOf(i):this._order.length;if(i&&-1===n)this.fire(new t.ErrorEvent(new Error('Layer with id "'+i+'" does not exist on this map.')));else {if(this._order.splice(n,0,r),this._layerOrderChanged=!0,this._layers[r]=a,this._removedLayers[r]&&a.source&&"custom"!==a.type){var s=this._removedLayers[r];delete this._removedLayers[r],s.type!==a.type?this._updatedSources[a.source]="clear":(this._updatedSources[a.source]="reload",this.sourceCaches[a.source].pause());}this._updateLayer(a),a.onAdd&&a.onAdd(this.map);}}},i.prototype.moveLayer=function(e,i){if(this._checkLoaded(),this._changed=!0,this._layers[e]){if(e!==i){var o=this._order.indexOf(e);this._order.splice(o,1);var r=i?this._order.indexOf(i):this._order.length;i&&-1===r?this.fire(new t.ErrorEvent(new Error('Layer with id "'+i+'" does not exist on this map.'))):(this._order.splice(r,0,e),this._layerOrderChanged=!0);}}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be moved.")));},i.prototype.removeLayer=function(e){this._checkLoaded();var i=this._layers[e];if(i){i.setEventedParent(null);var o=this._order.indexOf(e);this._order.splice(o,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=i,delete this._layers[e],delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],i.onRemove&&i.onRemove(this.map);}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be removed.")));},i.prototype.getLayer=function(t){return this._layers[t]},i.prototype.hasLayer=function(t){return t in this._layers},i.prototype.setLayerZoomRange=function(e,i,o){this._checkLoaded();var r=this.getLayer(e);r?r.minzoom===i&&r.maxzoom===o||(null!=i&&(r.minzoom=i),null!=o&&(r.maxzoom=o),this._updateLayer(r)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot have zoom extent.")));},i.prototype.setFilter=function(e,i,o){void 0===o&&(o={}),this._checkLoaded();var r=this.getLayer(e);if(r){if(!t.deepEqual(r.filter,i))return null==i?(r.filter=void 0,void this._updateLayer(r)):void(this._validate(t.validateStyle.filter,"layers."+r.id+".filter",i,null,o)||(r.filter=t.clone$1(i),this._updateLayer(r)))}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be filtered.")));},i.prototype.getFilter=function(e){return t.clone$1(this.getLayer(e).filter)},i.prototype.setLayoutProperty=function(e,i,o,r){void 0===r&&(r={}),this._checkLoaded();var a=this.getLayer(e);a?t.deepEqual(a.getLayoutProperty(i),o)||(a.setLayoutProperty(i,o,r),this._updateLayer(a)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")));},i.prototype.getLayoutProperty=function(e,i){var o=this.getLayer(e);if(o)return o.getLayoutProperty(i);this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style.")));},i.prototype.setPaintProperty=function(e,i,o,r){void 0===r&&(r={}),this._checkLoaded();var a=this.getLayer(e);a?t.deepEqual(a.getPaintProperty(i),o)||(a.setPaintProperty(i,o,r)&&this._updateLayer(a),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")));},i.prototype.getPaintProperty=function(t,e){return this.getLayer(t).getPaintProperty(e)},i.prototype.setFeatureState=function(e,i){this._checkLoaded();var o=e.source,r=e.sourceLayer,a=this.sourceCaches[o];if(void 0!==a){var n=a.getSource().type;"geojson"===n&&r?this.fire(new t.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==n||r?(void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),a.setFeatureState(r,e.id,i)):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));}else this.fire(new t.ErrorEvent(new Error("The source '"+o+"' does not exist in the map's style.")));},i.prototype.removeFeatureState=function(e,i){this._checkLoaded();var o=e.source,r=this.sourceCaches[o];if(void 0!==r){var a=r.getSource().type,n="vector"===a?e.sourceLayer:void 0;"vector"!==a||n?i&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new t.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):r.removeFeatureState(n,e.id,i):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));}else this.fire(new t.ErrorEvent(new Error("The source '"+o+"' does not exist in the map's style.")));},i.prototype.getFeatureState=function(e){this._checkLoaded();var i=e.source,o=e.sourceLayer,r=this.sourceCaches[i];if(void 0!==r){if("vector"!==r.getSource().type||o)return void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),r.getFeatureState(o,e.id);this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));}else this.fire(new t.ErrorEvent(new Error("The source '"+i+"' does not exist in the map's style.")));},i.prototype.getTransition=function(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)},i.prototype.serialize=function(){return t.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:t.mapObject(this.sourceCaches,(function(t){return t.serialize()})),layers:this._serializeLayers(this._order)},(function(t){return void 0!==t}))},i.prototype._updateLayer=function(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.sourceCaches[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0;},i.prototype._flattenAndSortRenderedFeatures=function(t){for(var e=this,i=function(t){return "fill-extrusion"===e._layers[t].type},o={},r=[],a=this._order.length-1;a>=0;a--){var n=this._order[a];if(i(n)){o[n]=a;for(var s=0,l=t;s=0;d--){var _=this._order[d];if(i(_))for(var f=r.length-1;f>=0;f--){var m=r[f].feature;if(o[m.layer.id] 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,0.0,1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),$e=gi("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),ti=gi("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,0,1);}"),ei=gi("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}"),ii=gi("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),oi=gi("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),ri=gi("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),ai=gi("varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),ni=gi("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),si=gi("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),li=gi("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),ci=gi("uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}"),ui=gi("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}"),hi=gi("uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),pi=gi("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}"),di=gi("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),_i=gi("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),0.0,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));}"),fi=gi("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),mi=gi("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}");function gi(t,e){var i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,o=e.match(/attribute ([\w]+) ([\w]+)/g),r=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),n=a?a.concat(r):r,s={};return {fragmentSource:t=t.replace(i,(function(t,e,i,o,r){return s[r]=!0,"define"===e?"\n#ifndef HAS_UNIFORM_u_"+r+"\nvarying "+i+" "+o+" "+r+";\n#else\nuniform "+i+" "+o+" u_"+r+";\n#endif\n":"\n#ifdef HAS_UNIFORM_u_"+r+"\n "+i+" "+o+" "+r+" = u_"+r+";\n#endif\n"})),vertexSource:e=e.replace(i,(function(t,e,i,o,r){var a="float"===o?"vec2":"vec4",n=r.match(/color/)?"color":a;return s[r]?"define"===e?"\n#ifndef HAS_UNIFORM_u_"+r+"\nuniform lowp float u_"+r+"_t;\nattribute "+i+" "+a+" a_"+r+";\nvarying "+i+" "+o+" "+r+";\n#else\nuniform "+i+" "+o+" u_"+r+";\n#endif\n":"vec4"===n?"\n#ifndef HAS_UNIFORM_u_"+r+"\n "+r+" = a_"+r+";\n#else\n "+i+" "+o+" "+r+" = u_"+r+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+r+"\n "+r+" = unpack_mix_"+n+"(a_"+r+", u_"+r+"_t);\n#else\n "+i+" "+o+" "+r+" = u_"+r+";\n#endif\n":"define"===e?"\n#ifndef HAS_UNIFORM_u_"+r+"\nuniform lowp float u_"+r+"_t;\nattribute "+i+" "+a+" a_"+r+";\n#else\nuniform "+i+" "+o+" u_"+r+";\n#endif\n":"vec4"===n?"\n#ifndef HAS_UNIFORM_u_"+r+"\n "+i+" "+o+" "+r+" = a_"+r+";\n#else\n "+i+" "+o+" "+r+" = u_"+r+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+r+"\n "+i+" "+o+" "+r+" = unpack_mix_"+n+"(a_"+r+", u_"+r+"_t);\n#else\n "+i+" "+o+" "+r+" = u_"+r+";\n#endif\n"})),staticAttributes:o,staticUniforms:n}}var vi=Object.freeze({__proto__:null,prelude:Ge,background:We,backgroundPattern:Xe,circle:He,clippingMask:Ke,heatmap:Ye,heatmapTexture:Je,collisionBox:Qe,collisionCircle:$e,debug:ti,fill:ei,fillOutline:ii,fillOutlinePattern:oi,fillPattern:ri,fillExtrusion:ai,fillExtrusionPattern:ni,hillshadePrepare:si,hillshade:li,line:ci,lineGradient:ui,linePattern:hi,lineSDF:pi,raster:di,symbolIcon:_i,symbolSDF:fi,symbolTextAndIcon:mi}),yi=function(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null;};function xi(t){for(var e=[],i=0;i>16,s>>16],u_pixel_coord_lower:[65535&n,65535&s]}}bi.prototype.draw=function(t,e,i,o,r,a,n,s,l,c,u,h,p,d,_,f){var m,g=t.gl;if(!this.failedToCreate){for(var v in t.program.set(this.program),t.setDepthMode(i),t.setStencilMode(o),t.setColorMode(r),t.setCullFace(a),this.fixedUniforms)this.fixedUniforms[v].set(n[v]);d&&d.setUniforms(t,this.binderUniforms,h,{zoom:p});for(var y=(m={},m[g.LINES]=2,m[g.TRIANGLES]=3,m[g.LINE_STRIP]=1,m)[e],x=0,b=u.get();x0?1-1/(1.001-n):-n),u_contrast_factor:(a=r.paint.get("raster-contrast"),a>0?1/(1-a):1+a),u_spin_weights:qi(r.paint.get("raster-hue-rotate"))};var a,n;};function qi(t){t*=Math.PI/180;var e=Math.sin(t),i=Math.cos(t);return [(2*i+1)/3,(-Math.sqrt(3)*e-i+1)/3,(Math.sqrt(3)*e-i+1)/3]}var ji,Vi=function(t,e,i,o,r,a,n,s,l,c){var u=r.transform;return {u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:u.cameraToCenterDistance,u_pitch:u.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:u.width/u.height,u_fade_change:r.options.fadeDuration?r.symbolFadeChange:1,u_matrix:a,u_label_plane_matrix:n,u_coord_matrix:s,u_is_text:+l,u_pitch_with_map:+o,u_texsize:c,u_texture:0}},Gi=function(e,i,o,r,a,n,s,l,c,u,h){var p=a.transform;return t.extend(Vi(e,i,o,r,a,n,s,l,c,u),{u_gamma_scale:r?Math.cos(p._pitch)*p.cameraToCenterDistance:1,u_device_pixel_ratio:t.browser.devicePixelRatio,u_is_halo:+h})},Wi=function(e,i,o,r,a,n,s,l,c,u){return t.extend(Gi(e,i,o,r,a,n,s,l,!0,c,!0),{u_texsize_icon:u,u_texture_icon:1})},Xi=function(t,e,i){return {u_matrix:t,u_opacity:e,u_color:i}},Hi=function(e,i,o,r,a,n){return t.extend(function(t,e,i,o){var r=i.imageManager.getPattern(t.from.toString()),a=i.imageManager.getPattern(t.to.toString()),n=i.imageManager.getPixelSize(),s=n.width,l=n.height,c=Math.pow(2,o.tileID.overscaledZ),u=o.tileSize*Math.pow(2,i.transform.tileZoom)/c,h=u*(o.tileID.canonical.x+o.tileID.wrap*c),p=u*o.tileID.canonical.y;return {u_image:0,u_pattern_tl_a:r.tl,u_pattern_br_a:r.br,u_pattern_tl_b:a.tl,u_pattern_br_b:a.br,u_texsize:[s,l],u_mix:e.t,u_pattern_size_a:r.displaySize,u_pattern_size_b:a.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/pe(o,1,i.transform.tileZoom),u_pixel_coord_upper:[h>>16,p>>16],u_pixel_coord_lower:[65535&h,65535&p]}}(r,n,o,a),{u_matrix:e,u_opacity:i})},Ki={fillExtrusion:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_lightpos:new t.Uniform3f(e,i.u_lightpos),u_lightintensity:new t.Uniform1f(e,i.u_lightintensity),u_lightcolor:new t.Uniform3f(e,i.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,i.u_vertical_gradient),u_opacity:new t.Uniform1f(e,i.u_opacity)}},fillExtrusionPattern:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_lightpos:new t.Uniform3f(e,i.u_lightpos),u_lightintensity:new t.Uniform1f(e,i.u_lightintensity),u_lightcolor:new t.Uniform3f(e,i.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,i.u_vertical_gradient),u_height_factor:new t.Uniform1f(e,i.u_height_factor),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade),u_opacity:new t.Uniform1f(e,i.u_opacity)}},fill:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}},fillPattern:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}},fillOutline:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world)}},fillOutlinePattern:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}},circle:function(e,i){return {u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_scale_with_map:new t.Uniform1i(e,i.u_scale_with_map),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_extrude_scale:new t.Uniform2f(e,i.u_extrude_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}},collisionBox:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pixels_to_tile_units:new t.Uniform1f(e,i.u_pixels_to_tile_units),u_extrude_scale:new t.Uniform2f(e,i.u_extrude_scale),u_overscale_factor:new t.Uniform1f(e,i.u_overscale_factor)}},collisionCircle:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_inv_matrix:new t.UniformMatrix4f(e,i.u_inv_matrix),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_viewport_size:new t.Uniform2f(e,i.u_viewport_size)}},debug:function(e,i){return {u_color:new t.UniformColor(e,i.u_color),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_overlay:new t.Uniform1i(e,i.u_overlay),u_overlay_scale:new t.Uniform1f(e,i.u_overlay_scale)}},clippingMask:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}},heatmap:function(e,i){return {u_extrude_scale:new t.Uniform1f(e,i.u_extrude_scale),u_intensity:new t.Uniform1f(e,i.u_intensity),u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}},heatmapTexture:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world),u_image:new t.Uniform1i(e,i.u_image),u_color_ramp:new t.Uniform1i(e,i.u_color_ramp),u_opacity:new t.Uniform1f(e,i.u_opacity)}},hillshade:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_latrange:new t.Uniform2f(e,i.u_latrange),u_light:new t.Uniform2f(e,i.u_light),u_shadow:new t.UniformColor(e,i.u_shadow),u_highlight:new t.UniformColor(e,i.u_highlight),u_accent:new t.UniformColor(e,i.u_accent)}},hillshadePrepare:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_dimension:new t.Uniform2f(e,i.u_dimension),u_zoom:new t.Uniform1f(e,i.u_zoom),u_unpack:new t.Uniform4f(e,i.u_unpack)}},line:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels)}},lineGradient:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_image:new t.Uniform1i(e,i.u_image),u_image_height:new t.Uniform1f(e,i.u_image_height)}},linePattern:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_texsize:new t.Uniform2f(e,i.u_texsize),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_image:new t.Uniform1i(e,i.u_image),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}},lineSDF:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_patternscale_a:new t.Uniform2f(e,i.u_patternscale_a),u_patternscale_b:new t.Uniform2f(e,i.u_patternscale_b),u_sdfgamma:new t.Uniform1f(e,i.u_sdfgamma),u_image:new t.Uniform1i(e,i.u_image),u_tex_y_a:new t.Uniform1f(e,i.u_tex_y_a),u_tex_y_b:new t.Uniform1f(e,i.u_tex_y_b),u_mix:new t.Uniform1f(e,i.u_mix)}},raster:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_tl_parent:new t.Uniform2f(e,i.u_tl_parent),u_scale_parent:new t.Uniform1f(e,i.u_scale_parent),u_buffer_scale:new t.Uniform1f(e,i.u_buffer_scale),u_fade_t:new t.Uniform1f(e,i.u_fade_t),u_opacity:new t.Uniform1f(e,i.u_opacity),u_image0:new t.Uniform1i(e,i.u_image0),u_image1:new t.Uniform1i(e,i.u_image1),u_brightness_low:new t.Uniform1f(e,i.u_brightness_low),u_brightness_high:new t.Uniform1f(e,i.u_brightness_high),u_saturation_factor:new t.Uniform1f(e,i.u_saturation_factor),u_contrast_factor:new t.Uniform1f(e,i.u_contrast_factor),u_spin_weights:new t.Uniform3f(e,i.u_spin_weights)}},symbolIcon:function(e,i){return {u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texture:new t.Uniform1i(e,i.u_texture)}},symbolSDF:function(e,i){return {u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texture:new t.Uniform1i(e,i.u_texture),u_gamma_scale:new t.Uniform1f(e,i.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,i.u_is_halo)}},symbolTextAndIcon:function(e,i){return {u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texsize_icon:new t.Uniform2f(e,i.u_texsize_icon),u_texture:new t.Uniform1i(e,i.u_texture),u_texture_icon:new t.Uniform1i(e,i.u_texture_icon),u_gamma_scale:new t.Uniform1f(e,i.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,i.u_is_halo)}},background:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_opacity:new t.Uniform1f(e,i.u_opacity),u_color:new t.UniformColor(e,i.u_color)}},backgroundPattern:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_opacity:new t.Uniform1f(e,i.u_opacity),u_image:new t.Uniform1i(e,i.u_image),u_pattern_tl_a:new t.Uniform2f(e,i.u_pattern_tl_a),u_pattern_br_a:new t.Uniform2f(e,i.u_pattern_br_a),u_pattern_tl_b:new t.Uniform2f(e,i.u_pattern_tl_b),u_pattern_br_b:new t.Uniform2f(e,i.u_pattern_br_b),u_texsize:new t.Uniform2f(e,i.u_texsize),u_mix:new t.Uniform1f(e,i.u_mix),u_pattern_size_a:new t.Uniform2f(e,i.u_pattern_size_a),u_pattern_size_b:new t.Uniform2f(e,i.u_pattern_size_b),u_scale_a:new t.Uniform1f(e,i.u_scale_a),u_scale_b:new t.Uniform1f(e,i.u_scale_b),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_tile_units_to_pixels:new t.Uniform1f(e,i.u_tile_units_to_pixels)}}};function Yi(e,i,o,r,a,n,s){for(var l=e.context,c=l.gl,u=e.useProgram("collisionBox"),h=[],p=0,d=0,_=0;_0){var b=t.create(),w=v;t.mul(b,g.placementInvProjMatrix,e.transform.glCoordMatrix),t.mul(b,b,g.placementViewportMatrix),h.push({circleArray:x,circleOffset:d,transform:w,invTransform:b}),d=p+=x.length/4;}y&&u.draw(l,c.LINES,It.disabled,Pt.disabled,e.colorModeForRenderPass(),Ct.disabled,Di(v,e.transform,m),o.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,null,e.transform.zoom,null,null,y.collisionVertexBuffer);}}if(s&&h.length){var T=e.useProgram("collisionCircle"),E=new t.StructArrayLayout2f1f2i16;E.resize(4*p),E._trim();for(var I=0,P=0,S=h;P=0&&(f[g.associatedIconIndex]={shiftedAnchor:E,angle:I});}else ce(g.numGlyphs,d);}if(h){_.clear();for(var S=e.icon.placedSymbolArray,C=0;C0){var s=t.browser.now(),l=(s-e.timeAdded)/n,c=i?(s-i.timeAdded)/n:-1,u=o.getSource(),h=a.coveringZoomLevel({tileSize:u.tileSize,roundZoom:u.roundZoom}),p=!i||Math.abs(i.tileID.overscaledZ-h)>Math.abs(e.tileID.overscaledZ-h),d=p&&e.refreshedUponExpiration?1:t.clamp(p?l:1-c,0,1);return e.refreshedUponExpiration&&l>=1&&(e.refreshedUponExpiration=!1),i?{opacity:1,mix:1-d}:{opacity:d,mix:0}}return {opacity:1,mix:0}}var lo=new t.Color(1,0,0,1),co=new t.Color(0,1,0,1),uo=new t.Color(0,0,1,1),ho=new t.Color(1,0,1,1),po=new t.Color(0,1,1,1);function _o(t,e,i,o){mo(t,0,e+i/2,t.transform.width,i,o);}function fo(t,e,i,o){mo(t,e-i/2,0,i,t.transform.height,o);}function mo(e,i,o,r,a,n){var s=e.context,l=s.gl;l.enable(l.SCISSOR_TEST),l.scissor(i*t.browser.devicePixelRatio,o*t.browser.devicePixelRatio,r*t.browser.devicePixelRatio,a*t.browser.devicePixelRatio),s.clear({color:n}),l.disable(l.SCISSOR_TEST);}function go(e,i,o){var r=e.context,a=r.gl,n=o.posMatrix,s=e.useProgram("debug"),l=It.disabled,c=Pt.disabled,u=e.colorModeForRenderPass();r.activeTexture.set(a.TEXTURE0),e.emptyTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE),s.draw(r,a.LINE_STRIP,l,c,u,Ct.disabled,Mi(n,t.Color.red),"$debug",e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments);var h=i.getTileByID(o.key).latestRawTileData,p=Math.floor((h&&h.byteLength||0)/1024),d=i.getTile(o).tileSize,_=512/Math.min(d,512)*(o.overscaledZ/e.transform.zoom)*.5,f=o.canonical.toString();o.overscaledZ!==o.canonical.z&&(f+=" => "+o.overscaledZ),function(t,e){t.initDebugOverlayCanvas();var i=t.debugOverlayCanvas,o=t.context.gl,r=t.debugOverlayCanvas.getContext("2d");r.clearRect(0,0,i.width,i.height),r.shadowColor="white",r.shadowBlur=2,r.lineWidth=1.5,r.strokeStyle="white",r.textBaseline="top",r.font="bold 36px Open Sans, sans-serif",r.fillText(e,5,5),r.strokeText(e,5,5),t.debugOverlayTexture.update(i),t.debugOverlayTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE);}(e,f+" "+p+"kb"),s.draw(r,a.TRIANGLES,l,c,St.alphaBlended,Ct.disabled,Mi(n,t.Color.transparent,_),"$debug",e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments);}var vo={symbol:function(e,i,o,r,a){if("translucent"===e.renderPass){var n=Pt.disabled,s=e.colorModeForRenderPass();o.layout.get("text-variable-anchor")&&function(e,i,o,r,a,n,s){for(var l=i.transform,c="map"===a,u="map"===n,h=0,p=e;h256&&this.clearStencil(),i.setColorMode(St.disabled),i.setDepthMode(It.disabled);var r=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(var a=0,n=e;a256&&this.clearStencil();var t=this.nextStencilID++,e=this.context.gl;return new Pt({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)},yo.prototype.stencilModeForClipping=function(t){var e=this.context.gl;return new Pt({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)},yo.prototype.stencilConfigForOverlap=function(t){var e,i=this.context.gl,o=t.sort((function(t,e){return e.overscaledZ-t.overscaledZ})),r=o[o.length-1].overscaledZ,a=o[0].overscaledZ-r+1;if(a>1){this.currentStencilSource=void 0,this.nextStencilID+a>256&&this.clearStencil();for(var n={},s=0;s=0;this.currentLayer--){var x=this.style._layers[r[this.currentLayer]],b=a[x.source],w=u[x.source];this._renderTileClippingMasks(x,w),this.renderLayer(this,b,x,w);}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer0?e.pop():null},yo.prototype.isPatternMissing=function(t){if(!t)return !1;if(!t.from||!t.to)return !0;var e=this.imageManager.getPattern(t.from.toString()),i=this.imageManager.getPattern(t.to.toString());return !e||!i},yo.prototype.useProgram=function(t,e){this.cache=this.cache||{};var i=""+t+(e?e.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"");return this.cache[i]||(this.cache[i]=new bi(this.context,t,vi[t],e,Ki[t],this._showOverdrawInspector)),this.cache[i]},yo.prototype.setCustomLayerDefaults=function(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault();},yo.prototype.setBaseState=function(){var t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD);},yo.prototype.initDebugOverlayCanvas=function(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=t.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new t.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA));},yo.prototype.destroy=function(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy();};var xo=function(t,e){this.points=t,this.planes=e;};xo.fromInvProjectionMatrix=function(e,i,o){var r=Math.pow(2,o),a=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((function(i){return t.transformMat4([],i,e)})).map((function(e){return t.scale$1([],e,1/e[3]/i*r)})),n=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((function(e){var i=t.sub([],a[e[0]],a[e[1]]),o=t.sub([],a[e[2]],a[e[1]]),r=t.normalize([],t.cross([],i,o)),n=-t.dot(r,a[e[1]]);return r.concat(n)}));return new xo(a,n)};var bo=function(e,i){this.min=e,this.max=i,this.center=t.scale$2([],t.add([],this.min,this.max),.5);};bo.prototype.quadrant=function(e){for(var i=[e%2==0,e<2],o=t.clone$2(this.min),r=t.clone$2(this.max),a=0;a=0;if(0===n)return 0;n!==i.length&&(o=!1);}if(o)return 2;for(var l=0;l<3;l++){for(var c=Number.MAX_VALUE,u=-Number.MAX_VALUE,h=0;hthis.max[l]-this.min[l])return 0}return 1};var wo=function(t,e,i,o){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===o&&(o=0),isNaN(t)||t<0||isNaN(e)||e<0||isNaN(i)||i<0||isNaN(o)||o<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=i,this.right=o;};wo.prototype.interpolate=function(e,i,o){return null!=i.top&&null!=e.top&&(this.top=t.number(e.top,i.top,o)),null!=i.bottom&&null!=e.bottom&&(this.bottom=t.number(e.bottom,i.bottom,o)),null!=i.left&&null!=e.left&&(this.left=t.number(e.left,i.left,o)),null!=i.right&&null!=e.right&&(this.right=t.number(e.right,i.right,o)),this},wo.prototype.getCenter=function(e,i){var o=t.clamp((this.left+e-this.right)/2,0,e),r=t.clamp((this.top+i-this.bottom)/2,0,i);return new t.Point(o,r)},wo.prototype.equals=function(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right},wo.prototype.clone=function(){return new wo(this.top,this.bottom,this.left,this.right)},wo.prototype.toJSON=function(){return {top:this.top,bottom:this.bottom,left:this.left,right:this.right}};var To=function(e,i,o,r,a){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=void 0===a||a,this._minZoom=e||0,this._maxZoom=i||22,this._minPitch=null==o?0:o,this._maxPitch=null==r?60:r,this.setMaxBounds(),this.width=0,this.height=0,this._center=new t.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new wo,this._posMatrixCache={},this._alignedPosMatrixCache={};},Eo={minZoom:{configurable:!0},maxZoom:{configurable:!0},minPitch:{configurable:!0},maxPitch:{configurable:!0},renderWorldCopies:{configurable:!0},worldSize:{configurable:!0},centerOffset:{configurable:!0},size:{configurable:!0},bearing:{configurable:!0},pitch:{configurable:!0},fov:{configurable:!0},zoom:{configurable:!0},center:{configurable:!0},padding:{configurable:!0},centerPoint:{configurable:!0},unmodified:{configurable:!0},point:{configurable:!0}};To.prototype.clone=function(){var t=new To(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._calcMatrices(),t},Eo.minZoom.get=function(){return this._minZoom},Eo.minZoom.set=function(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t));},Eo.maxZoom.get=function(){return this._maxZoom},Eo.maxZoom.set=function(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t));},Eo.minPitch.get=function(){return this._minPitch},Eo.minPitch.set=function(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t));},Eo.maxPitch.get=function(){return this._maxPitch},Eo.maxPitch.set=function(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t));},Eo.renderWorldCopies.get=function(){return this._renderWorldCopies},Eo.renderWorldCopies.set=function(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t;},Eo.worldSize.get=function(){return this.tileSize*this.scale},Eo.centerOffset.get=function(){return this.centerPoint._sub(this.size._div(2))},Eo.size.get=function(){return new t.Point(this.width,this.height)},Eo.bearing.get=function(){return -this.angle/Math.PI*180},Eo.bearing.set=function(e){var i=-t.wrap(e,-180,180)*Math.PI/180;this.angle!==i&&(this._unmodified=!1,this.angle=i,this._calcMatrices(),this.rotationMatrix=t.create$2(),t.rotate(this.rotationMatrix,this.rotationMatrix,this.angle));},Eo.pitch.get=function(){return this._pitch/Math.PI*180},Eo.pitch.set=function(e){var i=t.clamp(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==i&&(this._unmodified=!1,this._pitch=i,this._calcMatrices());},Eo.fov.get=function(){return this._fov/Math.PI*180},Eo.fov.set=function(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices());},Eo.zoom.get=function(){return this._zoom},Eo.zoom.set=function(t){var e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom,this._constrain(),this._calcMatrices());},Eo.center.get=function(){return this._center},Eo.center.set=function(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices());},Eo.padding.get=function(){return this._edgeInsets.toJSON()},Eo.padding.set=function(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices());},Eo.centerPoint.get=function(){return this._edgeInsets.getCenter(this.width,this.height)},To.prototype.isPaddingEqual=function(t){return this._edgeInsets.equals(t)},To.prototype.interpolatePadding=function(t,e,i){this._unmodified=!1,this._edgeInsets.interpolate(t,e,i),this._constrain(),this._calcMatrices();},To.prototype.coveringZoomLevel=function(t){var e=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,e)},To.prototype.getVisibleUnwrappedCoordinates=function(e){var i=[new t.UnwrappedTileID(0,e)];if(this._renderWorldCopies)for(var o=this.pointCoordinate(new t.Point(0,0)),r=this.pointCoordinate(new t.Point(this.width,0)),a=this.pointCoordinate(new t.Point(this.width,this.height)),n=this.pointCoordinate(new t.Point(0,this.height)),s=Math.floor(Math.min(o.x,r.x,a.x,n.x)),l=Math.floor(Math.max(o.x,r.x,a.x,n.x)),c=s-1;c<=l+1;c++)0!==c&&i.push(new t.UnwrappedTileID(c,e));return i},To.prototype.coveringTiles=function(e){var i=this.coveringZoomLevel(e),o=i;if(void 0!==e.minzoom&&ie.maxzoom&&(i=e.maxzoom);var r=t.MercatorCoordinate.fromLngLat(this.center),a=Math.pow(2,i),n=[a*r.x,a*r.y,0],s=xo.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,i),l=e.minzoom||0;this.pitch<=60&&this._edgeInsets.top<.1&&(l=i);var c=function(t){return {aabb:new bo([t*a,0,0],[(t+1)*a,a,0]),zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}},u=[],h=[],p=i,d=e.reparseOverscaled?o:i;if(this._renderWorldCopies)for(var _=1;_<=3;_++)u.push(c(-_)),u.push(c(_));for(u.push(c(0));u.length>0;){var f=u.pop(),m=f.x,g=f.y,v=f.fullyVisible;if(!v){var y=f.aabb.intersects(s);if(0===y)continue;v=2===y;}var x=f.aabb.distanceX(n),b=f.aabb.distanceY(n),w=Math.max(Math.abs(x),Math.abs(b));if(f.zoom===p||w>3+(1<=l)h.push({tileID:new t.OverscaledTileID(f.zoom===p?d:f.zoom,f.wrap,f.zoom,m,g),distanceSq:t.sqrLen([n[0]-.5-m,n[1]-.5-g])});else for(var T=0;T<4;T++){var E=(m<<1)+T%2,I=(g<<1)+(T>>1);u.push({aabb:f.aabb.quadrant(T),zoom:f.zoom+1,x:E,y:I,wrap:f.wrap,fullyVisible:v});}}return h.sort((function(t,e){return t.distanceSq-e.distanceSq})).map((function(t){return t.tileID}))},To.prototype.resize=function(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices();},Eo.unmodified.get=function(){return this._unmodified},To.prototype.zoomScale=function(t){return Math.pow(2,t)},To.prototype.scaleZoom=function(t){return Math.log(t)/Math.LN2},To.prototype.project=function(e){var i=t.clamp(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new t.Point(t.mercatorXfromLng(e.lng)*this.worldSize,t.mercatorYfromLat(i)*this.worldSize)},To.prototype.unproject=function(e){return new t.MercatorCoordinate(e.x/this.worldSize,e.y/this.worldSize).toLngLat()},Eo.point.get=function(){return this.project(this.center)},To.prototype.setLocationAtPoint=function(e,i){var o=this.pointCoordinate(i),r=this.pointCoordinate(this.centerPoint),a=this.locationCoordinate(e),n=new t.MercatorCoordinate(a.x-(o.x-r.x),a.y-(o.y-r.y));this.center=this.coordinateLocation(n),this._renderWorldCopies&&(this.center=this.center.wrap());},To.prototype.locationPoint=function(t){return this.coordinatePoint(this.locationCoordinate(t))},To.prototype.pointLocation=function(t){return this.coordinateLocation(this.pointCoordinate(t))},To.prototype.locationCoordinate=function(e){return t.MercatorCoordinate.fromLngLat(e)},To.prototype.coordinateLocation=function(t){return t.toLngLat()},To.prototype.pointCoordinate=function(e){var i=[e.x,e.y,0,1],o=[e.x,e.y,1,1];t.transformMat4(i,i,this.pixelMatrixInverse),t.transformMat4(o,o,this.pixelMatrixInverse);var r=i[3],a=o[3],n=i[1]/r,s=o[1]/a,l=i[2]/r,c=o[2]/a,u=l===c?0:(0-l)/(c-l);return new t.MercatorCoordinate(t.number(i[0]/r,o[0]/a,u)/this.worldSize,t.number(n,s,u)/this.worldSize)},To.prototype.coordinatePoint=function(e){var i=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(i,i,this.pixelMatrix),new t.Point(i[0]/i[3],i[1]/i[3])},To.prototype.getBounds=function(){return (new t.LngLatBounds).extend(this.pointLocation(new t.Point(0,0))).extend(this.pointLocation(new t.Point(this.width,0))).extend(this.pointLocation(new t.Point(this.width,this.height))).extend(this.pointLocation(new t.Point(0,this.height)))},To.prototype.getMaxBounds=function(){return this.latRange&&2===this.latRange.length&&this.lngRange&&2===this.lngRange.length?new t.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null},To.prototype.setMaxBounds=function(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude]);},To.prototype.calculatePosMatrix=function(e,i){void 0===i&&(i=!1);var o=e.key,r=i?this._alignedPosMatrixCache:this._posMatrixCache;if(r[o])return r[o];var a=e.canonical,n=this.worldSize/this.zoomScale(a.z),s=a.x+Math.pow(2,a.z)*e.wrap,l=t.identity(new Float64Array(16));return t.translate(l,l,[s*n,a.y*n,0]),t.scale(l,l,[n/t.EXTENT,n/t.EXTENT,1]),t.multiply(l,i?this.alignedProjMatrix:this.projMatrix,l),r[o]=new Float32Array(l),r[o]},To.prototype.customLayerMatrix=function(){return this.mercatorMatrix.slice()},To.prototype._constrain=function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var e,i,o,r,a=-90,n=90,s=-180,l=180,c=this.size,u=this._unmodified;if(this.latRange){var h=this.latRange;a=t.mercatorYfromLat(h[1])*this.worldSize,e=(n=t.mercatorYfromLat(h[0])*this.worldSize)-an&&(r=n-m);}if(this.lngRange){var g=d.x,v=c.x/2;g-vl&&(o=l-v);}void 0===o&&void 0===r||(this.center=this.unproject(new t.Point(void 0!==o?o:d.x,void 0!==r?r:d.y))),this._unmodified=u,this._constraining=!1;}},To.prototype._calcMatrices=function(){if(this.height){var e=this.centerOffset;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;var i=Math.PI/2+this._pitch,o=this._fov*(.5+e.y/this.height),r=Math.sin(o)*this.cameraToCenterDistance/Math.sin(t.clamp(Math.PI-i-o,.01,Math.PI-.01)),a=this.point,n=a.x,s=a.y,l=1.01*(Math.cos(Math.PI/2-this._pitch)*r+this.cameraToCenterDistance),c=this.height/50,u=new Float64Array(16);t.perspective(u,this._fov,this.width/this.height,c,l),u[8]=2*-e.x/this.width,u[9]=2*e.y/this.height,t.scale(u,u,[1,-1,1]),t.translate(u,u,[0,0,-this.cameraToCenterDistance]),t.rotateX(u,u,this._pitch),t.rotateZ(u,u,this.angle),t.translate(u,u,[-n,-s,0]),this.mercatorMatrix=t.scale([],u,[this.worldSize,this.worldSize,this.worldSize]),t.scale(u,u,[1,1,t.mercatorZfromAltitude(1,this.center.lat)*this.worldSize,1]),this.projMatrix=u,this.invProjMatrix=t.invert([],this.projMatrix);var h=this.width%2/2,p=this.height%2/2,d=Math.cos(this.angle),_=Math.sin(this.angle),f=n-Math.round(n)+d*h+_*p,m=s-Math.round(s)+d*p+_*h,g=new Float64Array(u);if(t.translate(g,g,[f>.5?f-1:f,m>.5?m-1:m,0]),this.alignedProjMatrix=g,u=t.create(),t.scale(u,u,[this.width/2,-this.height/2,1]),t.translate(u,u,[1,-1,0]),this.labelPlaneMatrix=u,u=t.create(),t.scale(u,u,[1,-1,1]),t.translate(u,u,[-1,-1,0]),t.scale(u,u,[2/this.width,2/this.height,1]),this.glCoordMatrix=u,this.pixelMatrix=t.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),!(u=t.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");this.pixelMatrixInverse=u,this._posMatrixCache={},this._alignedPosMatrixCache={};}},To.prototype.maxPitchScaleFactor=function(){if(!this.pixelMatrixInverse)return 1;var e=this.pointCoordinate(new t.Point(0,0)),i=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(i,i,this.pixelMatrix)[3]/this.cameraToCenterDistance},To.prototype.getCameraPoint=function(){var e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.Point(0,e))},To.prototype.getCameraQueryGeometry=function(e){var i=this.getCameraPoint();if(1===e.length)return [e[0],i];for(var o=i.x,r=i.y,a=i.x,n=i.y,s=0,l=e;s=3&&!t.some((function(t){return isNaN(t)}))){var e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0}return !1},Io.prototype._updateHashUnthrottled=function(){var e=t.window.location.href.replace(/(#.+)?$/,this.getHashString());try{t.window.history.replaceState(t.window.history.state,null,e);}catch(t){}};var Po={linearity:.3,easing:t.bezier(0,0,.3,1)},So=t.extend({deceleration:2500,maxSpeed:1400},Po),Co=t.extend({deceleration:20,maxSpeed:1400},Po),zo=t.extend({deceleration:1e3,maxSpeed:360},Po),Do=t.extend({deceleration:1e3,maxSpeed:90},Po),Ao=function(t){this._map=t,this.clear();};function Mo(t,e){(!t.duration||t.duration0&&i-e[0].time>160;)e.shift();},Ao.prototype._onMoveEnd=function(e){if(this._drainInertiaBuffer(),!(this._inertiaBuffer.length<2)){for(var i={zoom:0,bearing:0,pitch:0,pan:new t.Point(0,0),pinchAround:void 0,around:void 0},o=0,r=this._inertiaBuffer;o=this._clickTolerance||this._map.fire(new Ro(t.type,this._map,t));},Oo.prototype.dblclick=function(t){return this._firePreventable(new Ro(t.type,this._map,t))},Oo.prototype.mouseover=function(t){this._map.fire(new Ro(t.type,this._map,t));},Oo.prototype.mouseout=function(t){this._map.fire(new Ro(t.type,this._map,t));},Oo.prototype.touchstart=function(t){return this._firePreventable(new ko(t.type,this._map,t))},Oo.prototype.touchmove=function(t){this._map.fire(new ko(t.type,this._map,t));},Oo.prototype.touchend=function(t){this._map.fire(new ko(t.type,this._map,t));},Oo.prototype.touchcancel=function(t){this._map.fire(new ko(t.type,this._map,t));},Oo.prototype._firePreventable=function(t){if(this._map.fire(t),t.defaultPrevented)return {}},Oo.prototype.isEnabled=function(){return !0},Oo.prototype.isActive=function(){return !1},Oo.prototype.enable=function(){},Oo.prototype.disable=function(){};var Fo=function(t){this._map=t;};Fo.prototype.reset=function(){this._delayContextMenu=!1,delete this._contextMenuEvent;},Fo.prototype.mousemove=function(t){this._map.fire(new Ro(t.type,this._map,t));},Fo.prototype.mousedown=function(){this._delayContextMenu=!0;},Fo.prototype.mouseup=function(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ro("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent);},Fo.prototype.contextmenu=function(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new Ro(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault();},Fo.prototype.isEnabled=function(){return !0},Fo.prototype.isActive=function(){return !1},Fo.prototype.enable=function(){},Fo.prototype.disable=function(){};var Uo=function(t,e){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1;};function No(t,e){for(var i={},o=0;othis.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),o.length===this.numTouches&&(this.centroid=function(e){for(var i=new t.Point(0,0),o=0,r=e;o30)&&(this.aborted=!0);}}},Zo.prototype.touchend=function(t,e,i){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){var o=!this.aborted&&this.centroid;if(this.reset(),o)return o}};var qo=function(t){this.singleTap=new Zo(t),this.numTaps=t.numTaps,this.reset();};qo.prototype.reset=function(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset();},qo.prototype.touchstart=function(t,e,i){this.singleTap.touchstart(t,e,i);},qo.prototype.touchmove=function(t,e,i){this.singleTap.touchmove(t,e,i);},qo.prototype.touchend=function(t,e,i){var o=this.singleTap.touchend(t,e,i);if(o){var r=t.timeStamp-this.lastTime<500,a=!this.lastTap||this.lastTap.dist(o)<30;if(r&&a||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=o,this.count===this.numTaps)return this.reset(),o}};var jo=function(){this._zoomIn=new qo({numTouches:1,numTaps:2}),this._zoomOut=new qo({numTouches:2,numTaps:1}),this.reset();};jo.prototype.reset=function(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset();},jo.prototype.touchstart=function(t,e,i){this._zoomIn.touchstart(t,e,i),this._zoomOut.touchstart(t,e,i);},jo.prototype.touchmove=function(t,e,i){this._zoomIn.touchmove(t,e,i),this._zoomOut.touchmove(t,e,i);},jo.prototype.touchend=function(t,e,i){var o=this,r=this._zoomIn.touchend(t,e,i),a=this._zoomOut.touchend(t,e,i);return r?(this._active=!0,t.preventDefault(),setTimeout((function(){return o.reset()}),0),{cameraAnimation:function(e){return e.easeTo({duration:300,zoom:e.getZoom()+1,around:e.unproject(r)},{originalEvent:t})}}):a?(this._active=!0,t.preventDefault(),setTimeout((function(){return o.reset()}),0),{cameraAnimation:function(e){return e.easeTo({duration:300,zoom:e.getZoom()-1,around:e.unproject(a)},{originalEvent:t})}}):void 0},jo.prototype.touchcancel=function(){this.reset();},jo.prototype.enable=function(){this._enabled=!0;},jo.prototype.disable=function(){this._enabled=!1,this.reset();},jo.prototype.isEnabled=function(){return this._enabled},jo.prototype.isActive=function(){return this._active};var Vo={0:1,2:2},Go=function(t){this.reset(),this._clickTolerance=t.clickTolerance||1;};Go.prototype.reset=function(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton;},Go.prototype._correctButton=function(t,e){return !1},Go.prototype._move=function(t,e){return {}},Go.prototype.mousedown=function(t,e){if(!this._lastPoint){var o=i.mouseButton(t);this._correctButton(t,o)&&(this._lastPoint=e,this._eventButton=o);}},Go.prototype.mousemoveWindow=function(t,e){var i=this._lastPoint;if(i)if(t.preventDefault(),function(t,e){var i=Vo[e];return void 0===t.buttons||(t.buttons&i)!==i}(t,this._eventButton))this.reset();else if(this._moved||!(e.dist(i)0&&(this._active=!0);var r=No(o,i),a=new t.Point(0,0),n=new t.Point(0,0),s=0;for(var l in r){var c=r[l],u=this._touches[l];u&&(a._add(c),n._add(c.sub(u)),s++,r[l]=c);}if(this._touches=r,!(sMath.abs(t.x)}var or=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.reset=function(){t.prototype.reset.call(this),this._valid=void 0,delete this._firstMove,delete this._lastPoints;},e.prototype._start=function(t){this._lastPoints=t,ir(t[0].sub(t[1]))&&(this._valid=!1);},e.prototype._move=function(t,e,i){var o=t[0].sub(this._lastPoints[0]),r=t[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(o,r,i.timeStamp),this._valid)return this._lastPoints=t,this._active=!0,{pitchDelta:(o.y+r.y)/2*-.5}},e.prototype.gestureBeginsVertically=function(t,e,i){if(void 0!==this._valid)return this._valid;var o=t.mag()>=2,r=e.mag()>=2;if(o||r){if(!o||!r)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;var a=t.y>0==e.y>0;return ir(t)&&ir(e)&&a}},e}(Yo),rr={panStep:100,bearingStep:15,pitchStep:10},ar=function(){var t=rr;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1;};function nr(t){return t*(2-t)}ar.prototype.reset=function(){this._active=!1;},ar.prototype.keydown=function(t){var e=this;if(!(t.altKey||t.ctrlKey||t.metaKey)){var i=0,o=0,r=0,a=0,n=0;switch(t.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:t.shiftKey?o=-1:(t.preventDefault(),a=-1);break;case 39:t.shiftKey?o=1:(t.preventDefault(),a=1);break;case 38:t.shiftKey?r=1:(t.preventDefault(),n=-1);break;case 40:t.shiftKey?r=-1:(t.preventDefault(),n=1);break;default:return}return this._rotationDisabled&&(o=0,r=0),{cameraAnimation:function(s){var l=s.getZoom();s.easeTo({duration:300,easeId:"keyboardHandler",easing:nr,zoom:i?Math.round(l)+i*(t.shiftKey?2:1):l,bearing:s.getBearing()+o*e._bearingStep,pitch:s.getPitch()+r*e._pitchStep,offset:[-a*e._panStep,-n*e._panStep],center:s.getCenter()},{originalEvent:t});}}}},ar.prototype.enable=function(){this._enabled=!0;},ar.prototype.disable=function(){this._enabled=!1,this.reset();},ar.prototype.isEnabled=function(){return this._enabled},ar.prototype.isActive=function(){return this._active},ar.prototype.disableRotation=function(){this._rotationDisabled=!0;},ar.prototype.enableRotation=function(){this._rotationDisabled=!1;};var sr=function(e,i){this._map=e,this._el=e.getCanvasContainer(),this._handler=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=1/450,t.bindAll(["_onTimeout"],this);};sr.prototype.setZoomRate=function(t){this._defaultZoomRate=t;},sr.prototype.setWheelZoomRate=function(t){this._wheelZoomRate=t;},sr.prototype.isEnabled=function(){return !!this._enabled},sr.prototype.isActive=function(){return !!this._active||void 0!==this._finishTimeout},sr.prototype.isZooming=function(){return !!this._zooming},sr.prototype.enable=function(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&"center"===t.around);},sr.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1);},sr.prototype.wheel=function(e){if(this.isEnabled()){var i=e.deltaMode===t.window.WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,o=t.browser.now(),r=o-(this._lastWheelEventTime||0);this._lastWheelEventTime=o,0!==i&&i%4.000244140625==0?this._type="wheel":0!==i&&Math.abs(i)<4?this._type="trackpad":r>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(r*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),e.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=e,this._delta-=i,this._active||this._start(e)),e.preventDefault();}},sr.prototype._onTimeout=function(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t);},sr.prototype._start=function(e){if(this._delta){this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);var o=i.mousePos(this._el,e);this._around=t.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(o)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame());}},sr.prototype.renderFrame=function(){var e=this;if(this._frameId&&(this._frameId=null,this.isActive())){var i=this._map.transform;if(0!==this._delta){var o="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,r=2/(1+Math.exp(-Math.abs(this._delta*o)));this._delta<0&&0!==r&&(r=1/r);var a="number"==typeof this._targetZoom?i.zoomScale(this._targetZoom):i.scale;this._targetZoom=Math.min(i.maxZoom,Math.max(i.minZoom,i.scaleZoom(a*r))),"wheel"===this._type&&(this._startZoom=i.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0;}var n,s="number"==typeof this._targetZoom?this._targetZoom:i.zoom,l=this._startZoom,c=this._easing,u=!1;if("wheel"===this._type&&l&&c){var h=Math.min((t.browser.now()-this._lastWheelEventTime)/200,1),p=c(h);n=t.number(l,s,p),h<1?this._frameId||(this._frameId=!0):u=!0;}else n=s,u=!0;return this._active=!0,u&&(this._active=!1,this._finishTimeout=setTimeout((function(){e._zooming=!1,e._handler._triggerRenderFrame(),delete e._targetZoom,delete e._finishTimeout;}),200)),{noInertia:!0,needsRenderFrame:!u,zoomDelta:n-i.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}},sr.prototype._smoothOutEasing=function(e){var i=t.ease;if(this._prevEase){var o=this._prevEase,r=(t.browser.now()-o.start)/o.duration,a=o.easing(r+.01)-o.easing(r),n=.27/Math.sqrt(a*a+1e-4)*.01,s=Math.sqrt(.0729-n*n);i=t.bezier(n,s,.25,1);}return this._prevEase={start:t.browser.now(),duration:e,easing:i},i},sr.prototype.reset=function(){this._active=!1;};var lr=function(t,e){this._clickZoom=t,this._tapZoom=e;};lr.prototype.enable=function(){this._clickZoom.enable(),this._tapZoom.enable();},lr.prototype.disable=function(){this._clickZoom.disable(),this._tapZoom.disable();},lr.prototype.isEnabled=function(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()},lr.prototype.isActive=function(){return this._clickZoom.isActive()||this._tapZoom.isActive()};var cr=function(){this.reset();};cr.prototype.reset=function(){this._active=!1;},cr.prototype.dblclick=function(t,e){return t.preventDefault(),{cameraAnimation:function(i){i.easeTo({duration:300,zoom:i.getZoom()+(t.shiftKey?-1:1),around:i.unproject(e)},{originalEvent:t});}}},cr.prototype.enable=function(){this._enabled=!0;},cr.prototype.disable=function(){this._enabled=!1,this.reset();},cr.prototype.isEnabled=function(){return this._enabled},cr.prototype.isActive=function(){return this._active};var ur=function(){this._tap=new qo({numTouches:1,numTaps:1}),this.reset();};ur.prototype.reset=function(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset();},ur.prototype.touchstart=function(t,e,i){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?i.length>0&&(this._swipePoint=e[0],this._swipeTouch=i[0].identifier):this._tap.touchstart(t,e,i));},ur.prototype.touchmove=function(t,e,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;var o=e[0],r=o.y-this._swipePoint.y;return this._swipePoint=o,t.preventDefault(),this._active=!0,{zoomDelta:r/128}}}else this._tap.touchmove(t,e,i);},ur.prototype.touchend=function(t,e,i){this._tapTime?this._swipePoint&&0===i.length&&this.reset():this._tap.touchend(t,e,i)&&(this._tapTime=t.timeStamp);},ur.prototype.touchcancel=function(){this.reset();},ur.prototype.enable=function(){this._enabled=!0;},ur.prototype.disable=function(){this._enabled=!1,this.reset();},ur.prototype.isEnabled=function(){return this._enabled},ur.prototype.isActive=function(){return this._active};var hr=function(t,e,i){this._el=t,this._mousePan=e,this._touchPan=i;};hr.prototype.enable=function(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan");},hr.prototype.disable=function(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan");},hr.prototype.isEnabled=function(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()},hr.prototype.isActive=function(){return this._mousePan.isActive()||this._touchPan.isActive()};var pr=function(t,e,i){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=e,this._mousePitch=i;};pr.prototype.enable=function(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable();},pr.prototype.disable=function(){this._mouseRotate.disable(),this._mousePitch.disable();},pr.prototype.isEnabled=function(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())},pr.prototype.isActive=function(){return this._mouseRotate.isActive()||this._mousePitch.isActive()};var dr=function(t,e,i,o){this._el=t,this._touchZoom=e,this._touchRotate=i,this._tapDragZoom=o,this._rotationDisabled=!1,this._enabled=!0;};dr.prototype.enable=function(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate");},dr.prototype.disable=function(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate");},dr.prototype.isEnabled=function(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()},dr.prototype.isActive=function(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()},dr.prototype.disableRotation=function(){this._rotationDisabled=!0,this._touchRotate.disable();},dr.prototype.enableRotation=function(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable();};var _r=function(t){return t.zoom||t.drag||t.pitch||t.rotate},fr=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(t.Event);function mr(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta}var gr=function(e,o){this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Ao(e),this._bearingSnap=o.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(o),t.bindAll(["handleEvent","handleWindowEvent"],this);var r=this._el;this._listeners=[[r,"touchstart",{passive:!0}],[r,"touchmove",{passive:!1}],[r,"touchend",void 0],[r,"touchcancel",void 0],[r,"mousedown",void 0],[r,"mousemove",void 0],[r,"mouseup",void 0],[t.window.document,"mousemove",{capture:!0}],[t.window.document,"mouseup",void 0],[r,"mouseover",void 0],[r,"mouseout",void 0],[r,"dblclick",void 0],[r,"click",void 0],[r,"keydown",{capture:!1}],[r,"keyup",void 0],[r,"wheel",{passive:!1}],[r,"contextmenu",void 0],[t.window,"blur",void 0]];for(var a=0,n=this._listeners;aa?Math.min(2,b):Math.max(.5,b),w=Math.pow(m,1-e),T=r.unproject(y.add(x.mult(e*w)).mult(f));r.setLocationAtPoint(r.renderWorldCopies?T.wrap():T,_);}o._fireMoveEvents(i);}),(function(t){o._afterEase(i,t);}),e),this},i.prototype._prepareEase=function(e,i,o){void 0===o&&(o={}),this._moving=!0,i||o.moving||this.fire(new t.Event("movestart",e)),this._zooming&&!o.zooming&&this.fire(new t.Event("zoomstart",e)),this._rotating&&!o.rotating&&this.fire(new t.Event("rotatestart",e)),this._pitching&&!o.pitching&&this.fire(new t.Event("pitchstart",e));},i.prototype._fireMoveEvents=function(e){this.fire(new t.Event("move",e)),this._zooming&&this.fire(new t.Event("zoom",e)),this._rotating&&this.fire(new t.Event("rotate",e)),this._pitching&&this.fire(new t.Event("pitch",e));},i.prototype._afterEase=function(e,i){if(!this._easeId||!i||this._easeId!==i){delete this._easeId;var o=this._zooming,r=this._rotating,a=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,o&&this.fire(new t.Event("zoomend",e)),r&&this.fire(new t.Event("rotateend",e)),a&&this.fire(new t.Event("pitchend",e)),this.fire(new t.Event("moveend",e));}},i.prototype.flyTo=function(e,i){var o=this;if(!e.essential&&t.browser.prefersReducedMotion){var r=t.pick(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(r,i)}this.stop(),e=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.ease},e);var a=this.transform,n=this.getZoom(),s=this.getBearing(),l=this.getPitch(),c=this.getPadding(),u="zoom"in e?t.clamp(+e.zoom,a.minZoom,a.maxZoom):n,h="bearing"in e?this._normalizeBearing(e.bearing,s):s,p="pitch"in e?+e.pitch:l,d="padding"in e?e.padding:a.padding,_=a.zoomScale(u-n),f=t.Point.convert(e.offset),m=a.centerPoint.add(f),g=a.pointLocation(m),v=t.LngLat.convert(e.center||g);this._normalizeCenter(v);var y=a.project(g),x=a.project(v).sub(y),b=e.curve,w=Math.max(a.width,a.height),T=w/_,E=x.mag();if("minZoom"in e){var I=t.clamp(Math.min(e.minZoom,n,u),a.minZoom,a.maxZoom),P=w/a.zoomScale(I-n);b=Math.sqrt(P/E*2);}var S=b*b;function C(t){var e=(T*T-w*w+(t?-1:1)*S*S*E*E)/(2*(t?T:w)*S*E);return Math.log(Math.sqrt(e*e+1)-e)}function z(t){return (Math.exp(t)-Math.exp(-t))/2}function D(t){return (Math.exp(t)+Math.exp(-t))/2}var A=C(0),M=function(t){return D(A)/D(A+b*t)},L=function(t){return w*((D(A)*(z(e=A+b*t)/D(e))-z(A))/S)/E;var e;},R=(C(1)-A)/b;if(Math.abs(E)<1e-6||!isFinite(R)){if(Math.abs(w-T)<1e-6)return this.easeTo(e,i);var k=Te.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=s!==h,this._pitching=p!==l,this._padding=!a.isPaddingEqual(d),this._prepareEase(i,!1),this._ease((function(e){var r=e*R,_=1/M(r);a.zoom=1===e?u:n+a.scaleZoom(_),o._rotating&&(a.bearing=t.number(s,h,e)),o._pitching&&(a.pitch=t.number(l,p,e)),o._padding&&(a.interpolatePadding(c,d,e),m=a.centerPoint.add(f));var g=1===e?v:a.unproject(y.add(x.mult(L(r))).mult(_));a.setLocationAtPoint(a.renderWorldCopies?g.wrap():g,m),o._fireMoveEvents(i);}),(function(){return o._afterEase(i)}),e),this},i.prototype.isEasing=function(){return !!this._easeFrameId},i.prototype.stop=function(){return this._stop()},i.prototype._stop=function(t,e){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){var i=this._onEaseEnd;delete this._onEaseEnd,i.call(this,e);}if(!t){var o=this.handlers;o&&o.stop(!1);}return this},i.prototype._ease=function(e,i,o){!1===o.animate||0===o.duration?(e(1),i()):(this._easeStart=t.browser.now(),this._easeOptions=o,this._onEaseFrame=e,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback));},i.prototype._renderFrameCallback=function(){var e=Math.min((t.browser.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop();},i.prototype._normalizeBearing=function(e,i){e=t.wrap(e,-180,180);var o=Math.abs(e-i);return Math.abs(e-360-i)180?-360:i<-180?360:0;}},i}(t.Evented),yr=function(e){void 0===e&&(e={}),this.options=e,t.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this);};yr.prototype.getDefaultPosition=function(){return "bottom-right"},yr.prototype.onAdd=function(t){var e=this.options&&this.options.compact;return this._map=t,this._container=i.create("div","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=i.create("button","maplibregl-ctrl-attrib-button mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.type="button",this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=i.create("div","maplibregl-ctrl-attrib-inner mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),e&&this._container.classList.add("maplibregl-compact","mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===e&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container},yr.prototype.onRemove=function(){i.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0;},yr.prototype._setElementTitle=function(t,e){var i=this._map._getUIString("AttributionControl."+e);t.title=i,t.setAttribute("aria-label",i);},yr.prototype._toggleAttribution=function(){this._container.classList.contains("maplibregl-compact-show")||this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show"),this._compactButton.setAttribute("aria-pressed","false")):(this._container.classList.add("maplibregl-compact-show","mapboxgl-compact-show"),this._compactButton.setAttribute("aria-pressed","true"));},yr.prototype._updateEditLink=function(){var e=this._editLink;e||(e=this._editLink=this._container.querySelector(".mapbox-improve-map"));var i=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||t.config.ACCESS_TOKEN}];if(e){var o=i.reduce((function(t,e,o){return e.value&&(t+=e.key+"="+e.value+(o=0)return !1;return !0}))).join(" | ");n!==this._attribHTML&&(this._attribHTML=n,t.length?(this._innerContainer.innerHTML=n,this._container.classList.remove("maplibregl-attrib-empty","mapboxgl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty","mapboxgl-attrib-empty"),this._editLink=null);}},yr.prototype._updateCompact=function(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("maplibregl-compact","mapboxgl-compact"):this._container.classList.remove("maplibregl-compact","maplibregl-compact-show","mapboxgl-compact","mapboxgl-compact-show");};var xr=function(){t.bindAll(["_updateLogo"],this),t.bindAll(["_updateCompact"],this);};xr.prototype.onAdd=function(t){this._map=t,this._container=i.create("div","maplibregl-ctrl mapboxgl-ctrl");var e=i.create("a","maplibregl-ctrl-logo mapboxgl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://maplibre.org/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container},xr.prototype.onRemove=function(){i.remove(this._container),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact);},xr.prototype.getDefaultPosition=function(){return "bottom-left"},xr.prototype._updateLogo=function(t){t&&"metadata"!==t.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none");},xr.prototype._logoRequired=function(){if(this._map.style){var t=this._map.style.sourceCaches;for(var e in t)if(t[e].getSource().mapbox_logo)return !0;return !1}},xr.prototype._updateCompact=function(){var t=this._container.children;if(t.length){var e=t[0];this._map.getCanvasContainer().offsetWidth<250?e.classList.add("maplibregl-compact","mapboxgl-compact"):e.classList.remove("maplibregl-compact","mapboxgl-compact");}};var br=function(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1;};br.prototype.add=function(t){var e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e},br.prototype.remove=function(t){for(var e=this._currentlyRunning,i=0,o=e?this._queue.concat(e):this._queue;ie.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=e.minPitch&&null!=e.maxPitch&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=e.minPitch&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=e.maxPitch&&e.maxPitch>60)throw new Error("maxPitch must be less than or equal to 60");var r=new To(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies);if(o.call(this,r,e),this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._antialias=e.antialias,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._renderTaskQueue=new br,this._controls=[],this._mapId=t.uniqueId(),this._locale=t.extend({},wr,e.locale),this._clickTolerance=e.clickTolerance,this._requestManager=new t.RequestManager(e.transformRequest,e.accessToken),"string"==typeof e.container){if(this._container=t.window.document.getElementById(e.container),!this._container)throw new Error("Container '"+e.container+"' not found.")}else {if(!(e.container instanceof Er))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container;}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),t.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");this.on("move",(function(){return i._update(!1)})),this.on("moveend",(function(){return i._update(!1)})),this.on("zoom",(function(){return i._update(!0)})),void 0!==t.window&&(t.window.addEventListener("online",this._onWindowOnline,!1),t.window.addEventListener("resize",this._onWindowResize,!1),t.window.addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new gr(this,e),this._hash=e.hash&&new Io("string"==typeof e.hash&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,t.extend({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new yr({customAttribution:e.customAttribution})),this.addControl(new xr,e.logoPosition),this.on("style.load",(function(){i.transform.unmodified&&i.jumpTo(i.style.stylesheet);})),this.on("data",(function(e){i._update("style"===e.dataType),i.fire(new t.Event(e.dataType+"data",e));})),this.on("dataloading",(function(e){i.fire(new t.Event(e.dataType+"dataloading",e));}));}o&&(r.__proto__=o),(r.prototype=Object.create(o&&o.prototype)).constructor=r;var a={showTileBoundaries:{configurable:!0},showPadding:{configurable:!0},showCollisionBoxes:{configurable:!0},showOverdrawInspector:{configurable:!0},repaint:{configurable:!0},vertices:{configurable:!0},version:{configurable:!0}};return r.prototype._getMapId=function(){return this._mapId},r.prototype.addControl=function(e,i){if(void 0===i&&(i=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e||!e.onAdd)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));var o=e.onAdd(this);this._controls.push(e);var r=this._controlPositions[i];return -1!==i.indexOf("bottom")?r.insertBefore(o,r.firstChild):r.appendChild(o),this},r.prototype.removeControl=function(e){if(!e||!e.onRemove)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));var i=this._controls.indexOf(e);return i>-1&&this._controls.splice(i,1),e.onRemove(this),this},r.prototype.hasControl=function(t){return this._controls.indexOf(t)>-1},r.prototype.resize=function(e){var i=this._containerDimensions(),o=i[0],r=i[1];this._resizeCanvas(o,r),this.transform.resize(o,r),this.painter.resize(o,r);var a=!this._moving;return a&&(this.stop(),this.fire(new t.Event("movestart",e)).fire(new t.Event("move",e))),this.fire(new t.Event("resize",e)),a&&this.fire(new t.Event("moveend",e)),this},r.prototype.getBounds=function(){return this.transform.getBounds()},r.prototype.getMaxBounds=function(){return this.transform.getMaxBounds()},r.prototype.setMaxBounds=function(e){return this.transform.setMaxBounds(t.LngLatBounds.convert(e)),this._update()},r.prototype.setMinZoom=function(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")},r.prototype.getMaxZoom=function(){return this.transform.maxZoom},r.prototype.setMinPitch=function(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()60)throw new Error("maxPitch must be less than or equal to 60");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error("maxPitch must be greater than the current minPitch")},r.prototype.getMaxPitch=function(){return this.transform.maxPitch},r.prototype.getRenderWorldCopies=function(){return this.transform.renderWorldCopies},r.prototype.setRenderWorldCopies=function(t){return this.transform.renderWorldCopies=t,this._update()},r.prototype.project=function(e){return this.transform.locationPoint(t.LngLat.convert(e))},r.prototype.unproject=function(e){return this.transform.pointLocation(t.Point.convert(e))},r.prototype.isMoving=function(){return this._moving||this.handlers.isMoving()},r.prototype.isZooming=function(){return this._zooming||this.handlers.isZooming()},r.prototype.isRotating=function(){return this._rotating||this.handlers.isRotating()},r.prototype._createDelegatedListener=function(t,e,i){var o,r=this;if("mouseenter"===t||"mouseover"===t){var a=!1;return {layer:e,listener:i,delegates:{mousemove:function(o){var n=r.getLayer(e)?r.queryRenderedFeatures(o.point,{layers:[e]}):[];n.length?a||(a=!0,i.call(r,new Ro(t,r,o.originalEvent,{features:n}))):a=!1;},mouseout:function(){a=!1;}}}}if("mouseleave"===t||"mouseout"===t){var n=!1;return {layer:e,listener:i,delegates:{mousemove:function(o){(r.getLayer(e)?r.queryRenderedFeatures(o.point,{layers:[e]}):[]).length?n=!0:n&&(n=!1,i.call(r,new Ro(t,r,o.originalEvent)));},mouseout:function(e){n&&(n=!1,i.call(r,new Ro(t,r,e.originalEvent)));}}}}return {layer:e,listener:i,delegates:(o={},o[t]=function(t){var o=r.getLayer(e)?r.queryRenderedFeatures(t.point,{layers:[e]}):[];o.length&&(t.features=o,i.call(r,t),delete t.features);},o)}},r.prototype.on=function(t,e,i){if(void 0===i)return o.prototype.on.call(this,t,e);var r=this._createDelegatedListener(t,e,i);for(var a in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(r),r.delegates)this.on(a,r.delegates[a]);return this},r.prototype.once=function(t,e,i){if(void 0===i)return o.prototype.once.call(this,t,e);var r=this._createDelegatedListener(t,e,i);for(var a in r.delegates)this.once(a,r.delegates[a]);return this},r.prototype.off=function(t,e,i){var r=this;return void 0===i?o.prototype.off.call(this,t,e):(this._delegatedListeners&&this._delegatedListeners[t]&&function(o){for(var a=o[t],n=0;n180;){var s=o.locationPoint(e);if(s.x>=0&&s.y>=0&&s.x<=o.width&&s.y<=o.height)break;e.lng>o.center.lng?e.lng-=360:e.lng+=360;}return e}Ar.prototype.down=function(t,e){this.mouseRotate.mousedown(t,e),this.mousePitch&&this.mousePitch.mousedown(t,e),i.disableDrag();},Ar.prototype.move=function(t,e){var i=this.map,o=this.mouseRotate.mousemoveWindow(t,e);if(o&&o.bearingDelta&&i.setBearing(i.getBearing()+o.bearingDelta),this.mousePitch){var r=this.mousePitch.mousemoveWindow(t,e);r&&r.pitchDelta&&i.setPitch(i.getPitch()+r.pitchDelta);}},Ar.prototype.off=function(){var t=this.element;i.removeEventListener(t,"mousedown",this.mousedown),i.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),i.removeEventListener(t,"touchmove",this.touchmove),i.removeEventListener(t,"touchend",this.touchend),i.removeEventListener(t,"touchcancel",this.reset),this.offTemp();},Ar.prototype.offTemp=function(){i.enableDrag(),i.removeEventListener(t.window,"mousemove",this.mousemove),i.removeEventListener(t.window,"mouseup",this.mouseup);},Ar.prototype.mousedown=function(e){this.down(t.extend({},e,{ctrlKey:!0,preventDefault:function(){return e.preventDefault()}}),i.mousePos(this.element,e)),i.addEventListener(t.window,"mousemove",this.mousemove),i.addEventListener(t.window,"mouseup",this.mouseup);},Ar.prototype.mousemove=function(t){this.move(t,i.mousePos(this.element,t));},Ar.prototype.mouseup=function(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp();},Ar.prototype.touchstart=function(t){1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=i.touchPos(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:function(){return t.preventDefault()}},this._startPos));},Ar.prototype.touchmove=function(t){1!==t.targetTouches.length?this.reset():(this._lastPos=i.touchPos(this.element,t.targetTouches)[0],this.move({preventDefault:function(){return t.preventDefault()}},this._lastPos));},Ar.prototype.touchend=function(t){0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)=i;}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new t.Event("dragstart"))),this.fire(new t.Event("drag")));},o.prototype._onUp=function(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new t.Event("dragend")),this._state="inactive";},o.prototype._addDragHandler=function(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp));},o.prototype.setDraggable=function(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this},o.prototype.isDraggable=function(){return this._draggable},o.prototype.setRotation=function(t){return this._rotation=t||0,this._update(),this},o.prototype.getRotation=function(){return this._rotation},o.prototype.setRotationAlignment=function(t){return this._rotationAlignment=t||"auto",this._update(),this},o.prototype.getRotationAlignment=function(){return this._rotationAlignment},o.prototype.setPitchAlignment=function(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this},o.prototype.getPitchAlignment=function(){return this._pitchAlignment},o}(t.Evented),Or={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},Fr=0,Ur=!1,Nr=function(e){function o(i){e.call(this),this.options=t.extend({},Or,i),t.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this);}return e&&(o.__proto__=e),(o.prototype=Object.create(e&&e.prototype)).constructor=o,o.prototype.onAdd=function(e){var o;return this._map=e,this._container=i.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),o=this._setupUI,void 0!==kr?o(kr):void 0!==t.window.navigator.permissions?t.window.navigator.permissions.query({name:"geolocation"}).then((function(t){o(kr="denied"!==t.state);})):o(kr=!!t.window.navigator.geolocation),this._container},o.prototype.onRemove=function(){void 0!==this._geolocationWatchID&&(t.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),i.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Fr=0,Ur=!1;},o.prototype._isOutOfMapMaxBounds=function(t){var e=this._map.getMaxBounds(),i=t.coords;return e&&(i.longitudee.getEast()||i.latitudee.getNorth())},o.prototype._setErrorState=function(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");}},o.prototype._onSuccess=function(e){if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.Event("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background");}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new t.Event("geolocate",e)),this._finish();}},o.prototype._updateCamera=function(e){var i=new t.LngLat(e.coords.longitude,e.coords.latitude),o=e.coords.accuracy,r=this._map.getBearing(),a=t.extend({bearing:r},this.options.fitBoundsOptions);this._map.fitBounds(i.toBounds(o),a,{geolocateSource:!0});},o.prototype._updateMarker=function(e){if(e){var i=new t.LngLat(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius();}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove();},o.prototype._updateCircleRadius=function(){var t=this._map._container.clientHeight/2,e=this._map.unproject([0,t]),i=this._map.unproject([1,t]),o=e.distanceTo(i),r=Math.ceil(2*this._accuracy/o);this._circleElement.style.width=r+"px",this._circleElement.style.height=r+"px";},o.prototype._onZoom=function(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius();},o.prototype._onError=function(e){if(this._map){if(this.options.trackUserLocation)if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;var i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i),void 0!==this._geolocationWatchID&&this._clearWatch();}else {if(3===e.code&&Ur)return;this._setErrorState();}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new t.Event("error",e)),this._finish();}},o.prototype._finish=function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0;},o.prototype._setupUI=function(e){var o=this;if(this._container.addEventListener("contextmenu",(function(t){return t.preventDefault()})),this._geolocateButton=i.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),i.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden",!0),this._geolocateButton.type="button",!1===e){t.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");var r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=r,this._geolocateButton.setAttribute("aria-label",r);}else {var a=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=a,this._geolocateButton.setAttribute("aria-label",a);}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=i.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new Br(this._dotElement),this._circleElement=i.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Br({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(function(e){e.geolocateSource||"ACTIVE_LOCK"!==o._watchState||e.originalEvent&&"resize"===e.originalEvent.type||(o._watchState="BACKGROUND",o._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),o._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),o.fire(new t.Event("trackuserlocationend")));}));},o.prototype.trigger=function(){if(!this._setup)return t.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new t.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Fr--,Ur=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this.fire(new t.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new t.Event("trackuserlocationstart"));}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error");}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){var e;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++Fr>1?(e={maximumAge:6e5,timeout:0},Ur=!0):(e=this.options.positionOptions,Ur=!1),this._geolocationWatchID=t.window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e);}}else t.window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return !0},o.prototype._clearWatch=function(){t.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null);},o}(t.Evented),Zr={maxWidth:100,unit:"metric"},qr=function(e){this.options=t.extend({},Zr,e),t.bindAll(["_onMove","setUnit"],this);};function jr(t,e,i){var o=i&&i.maxWidth||100,r=t._container.clientHeight/2,a=t.unproject([0,r]),n=t.unproject([o,r]),s=a.distanceTo(n);if(i&&"imperial"===i.unit){var l=3.2808*s;l>5280?Vr(e,o,l/5280,t._getUIString("ScaleControl.Miles")):Vr(e,o,l,t._getUIString("ScaleControl.Feet"));}else i&&"nautical"===i.unit?Vr(e,o,s/1852,t._getUIString("ScaleControl.NauticalMiles")):s>=1e3?Vr(e,o,s/1e3,t._getUIString("ScaleControl.Kilometers")):Vr(e,o,s,t._getUIString("ScaleControl.Meters"));}function Vr(t,e,i,o){var r,a,n,s=(r=i,(a=Math.pow(10,(""+Math.floor(r)).length-1))*(n=(n=r/a)>=10?10:n>=5?5:n>=3?3:n>=2?2:n>=1?1:function(t){var e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(n)));t.style.width=e*(s/i)+"px",t.innerHTML=s+" "+o;}qr.prototype.getDefaultPosition=function(){return "bottom-left"},qr.prototype._onMove=function(){jr(this._map,this._container,this.options);},qr.prototype.onAdd=function(t){return this._map=t,this._container=i.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container},qr.prototype.onRemove=function(){i.remove(this._container),this._map.off("move",this._onMove),this._map=void 0;},qr.prototype.setUnit=function(t){this.options.unit=t,jr(this._map,this._container,this.options);};var Gr=function(e){this._fullscreen=!1,e&&e.container&&(e.container instanceof t.window.HTMLElement?this._container=e.container:t.warnOnce("Full screen control 'container' must be a DOM element.")),t.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in t.window.document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in t.window.document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in t.window.document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in t.window.document&&(this._fullscreenchange="MSFullscreenChange");};Gr.prototype.onAdd=function(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=i.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",t.warnOnce("This device does not support fullscreen mode.")),this._controlContainer},Gr.prototype.onRemove=function(){i.remove(this._controlContainer),this._map=null,t.window.document.removeEventListener(this._fullscreenchange,this._changeIcon);},Gr.prototype._checkFullscreenSupport=function(){return !!(t.window.document.fullscreenEnabled||t.window.document.mozFullScreenEnabled||t.window.document.msFullscreenEnabled||t.window.document.webkitFullscreenEnabled)},Gr.prototype._setupUI=function(){var e=this._fullscreenButton=i.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);i.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",e).setAttribute("aria-hidden",!0),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),t.window.document.addEventListener(this._fullscreenchange,this._changeIcon);},Gr.prototype._updateTitle=function(){var t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t;},Gr.prototype._getTitle=function(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")},Gr.prototype._isFullscreen=function(){return this._fullscreen},Gr.prototype._changeIcon=function(){(t.window.document.fullscreenElement||t.window.document.mozFullScreenElement||t.window.document.webkitFullscreenElement||t.window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle());},Gr.prototype._onClickFullscreen=function(){this._isFullscreen()?t.window.document.exitFullscreen?t.window.document.exitFullscreen():t.window.document.mozCancelFullScreen?t.window.document.mozCancelFullScreen():t.window.document.msExitFullscreen?t.window.document.msExitFullscreen():t.window.document.webkitCancelFullScreen&&t.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen();};var Wr={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Xr=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", "),Hr=function(e){function o(i){e.call(this),this.options=t.extend(Object.create(Wr),i),t.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this);}return e&&(o.__proto__=e),(o.prototype=Object.create(e&&e.prototype)).constructor=o,o.prototype.addTo=function(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new t.Event("open")),this},o.prototype.isOpen=function(){return !!this._map},o.prototype.remove=function(){return this._content&&i.remove(this._content),this._container&&(i.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new t.Event("close")),this},o.prototype.getLngLat=function(){return this._lngLat},o.prototype.setLngLat=function(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer","mapboxgl-track-pointer")),this},o.prototype.trackPointer=function(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")),this},o.prototype.getElement=function(){return this._container},o.prototype.setText=function(e){return this.setDOMContent(t.window.document.createTextNode(e))},o.prototype.setHTML=function(e){var i,o=t.window.document.createDocumentFragment(),r=t.window.document.createElement("body");for(r.innerHTML=e;i=r.firstChild;)o.appendChild(i);return this.setDOMContent(o)},o.prototype.getMaxWidth=function(){return this._container&&this._container.style.maxWidth},o.prototype.setMaxWidth=function(t){return this.options.maxWidth=t,this._update(),this},o.prototype.setDOMContent=function(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=i.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this},o.prototype.addClassName=function(t){this._container&&this._container.classList.add(t);},o.prototype.removeClassName=function(t){this._container&&this._container.classList.remove(t);},o.prototype.setOffset=function(t){return this.options.offset=t,this._update(),this},o.prototype.toggleClassName=function(t){if(this._container)return this._container.classList.toggle(t)},o.prototype._createCloseButton=function(){this.options.closeButton&&(this._closeButton=i.create("button","maplibregl-popup-close-button mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose));},o.prototype._onMouseUp=function(t){this._update(t.point);},o.prototype._onMouseMove=function(t){this._update(t.point);},o.prototype._onDrag=function(t){this._update(t.point);},o.prototype._update=function(e){var o=this;if(this._map&&(this._lngLat||this._trackPointer)&&this._content&&(this._container||(this._container=i.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=i.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach((function(t){return o._container.classList.add(t)})),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Mr(this._lngLat,this._pos,this._map.transform)),!this._trackPointer||e)){var r=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat),a=this.options.anchor,n=function e(i){if(i){if("number"==typeof i){var o=Math.round(Math.sqrt(.5*Math.pow(i,2)));return {center:new t.Point(0,0),top:new t.Point(0,i),"top-left":new t.Point(o,o),"top-right":new t.Point(-o,o),bottom:new t.Point(0,-i),"bottom-left":new t.Point(o,-o),"bottom-right":new t.Point(-o,-o),left:new t.Point(i,0),right:new t.Point(-i,0)}}if(i instanceof t.Point||Array.isArray(i)){var r=t.Point.convert(i);return {center:r,top:r,"top-left":r,"top-right":r,bottom:r,"bottom-left":r,"bottom-right":r,left:r,right:r}}return {center:t.Point.convert(i.center||[0,0]),top:t.Point.convert(i.top||[0,0]),"top-left":t.Point.convert(i["top-left"]||[0,0]),"top-right":t.Point.convert(i["top-right"]||[0,0]),bottom:t.Point.convert(i.bottom||[0,0]),"bottom-left":t.Point.convert(i["bottom-left"]||[0,0]),"bottom-right":t.Point.convert(i["bottom-right"]||[0,0]),left:t.Point.convert(i.left||[0,0]),right:t.Point.convert(i.right||[0,0])}}return e(new t.Point(0,0))}(this.options.offset);if(!a){var s,l=this._container.offsetWidth,c=this._container.offsetHeight;s=r.y+n.bottom.ythis._map.transform.height-c?["bottom"]:[],r.xthis._map.transform.width-l/2&&s.push("right"),a=0===s.length?"bottom":s.join("-");}var u=r.add(n[a]).round();i.setTransform(this._container,Lr[a]+" translate("+u.x+"px,"+u.y+"px)"),Rr(this._container,a,"popup");}},o.prototype._focusFirstElement=function(){if(this.options.focusAfterOpen&&this._container){var t=this._container.querySelector(Xr);t&&t.focus();}},o.prototype._onClose=function(){this.remove();},o}(t.Evented),Kr={version:t.version,supported:e,setRTLTextPlugin:t.setRTLTextPlugin,getRTLTextPluginStatus:t.getRTLTextPluginStatus,Map:Sr,NavigationControl:Dr,GeolocateControl:Nr,AttributionControl:yr,ScaleControl:qr,FullscreenControl:Gr,Popup:Hr,Marker:Br,Style:je,LngLat:t.LngLat,LngLatBounds:t.LngLatBounds,Point:t.Point,MercatorCoordinate:t.MercatorCoordinate,Evented:t.Evented,config:t.config,prewarm:function(){Ft().acquire(Rt);},clearPrewarmedResources:function(){var t=Bt;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(Rt),Bt=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"));},get accessToken(){return t.config.ACCESS_TOKEN},set accessToken(e){t.config.ACCESS_TOKEN=e;},get baseApiUrl(){return t.config.API_URL},set baseApiUrl(e){t.config.API_URL=e;},get workerCount(){return kt.workerCount},set workerCount(t){kt.workerCount=t;},get maxParallelImageRequests(){return t.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(e){t.config.MAX_PARALLEL_IMAGE_REQUESTS=e;},clearStorage:function(e){t.clearTileCache(e);},workerUrl:"",addProtocol:function(e,i){t.config.REGISTERED_PROTOCOLS[e]=i;},removeProtocol:function(e){delete t.config.REGISTERED_PROTOCOLS[e];}};return Kr})); - -// - -return maplibregl; - -}))); -//# sourceMappingURL=maplibre-gl.js.map diff --git a/web/client/components/infrastructure/deps/maplibre-gl.js.map b/web/client/components/infrastructure/deps/maplibre-gl.js.map deleted file mode 100644 index 7e1fb494..00000000 --- a/web/client/components/infrastructure/deps/maplibre-gl.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"maplibre-gl.js","sources":["../node_modules/@mapbox/unitbezier/index.js","../node_modules/@mapbox/point-geometry/index.js","../src/util/browser/window.js","../src/util/util.js","../src/util/browser.js","../src/util/webp_supported.js","../src/util/config.js","../src/util/sku_token.js","../src/util/mapbox.js","../src/util/tile_request_cache.js","../src/util/offscreen_canvas_supported.js","../src/util/ajax.js","../src/util/evented.js","../src/style-spec/error/validation_error.js","../src/style-spec/validate/validate_constants.js","../src/style-spec/util/extend.js","../src/style-spec/util/unbundle_jsonlint.js","../src/style-spec/expression/parsing_error.js","../src/style-spec/expression/scope.js","../src/style-spec/expression/types.js","../node_modules/csscolorparser/csscolorparser.js","../src/style-spec/util/color.js","../src/style-spec/expression/types/collator.js","../src/style-spec/expression/types/formatted.js","../src/style-spec/expression/types/resolved_image.js","../src/style-spec/expression/values.js","../src/style-spec/expression/definitions/literal.js","../src/style-spec/expression/runtime_error.js","../src/style-spec/expression/definitions/assertion.js","../src/style-spec/expression/definitions/format.js","../src/style-spec/expression/definitions/image.js","../src/style-spec/expression/definitions/coercion.js","../src/style-spec/expression/evaluation_context.js","../src/style-spec/expression/compound_expression.js","../src/style-spec/expression/definitions/collator.js","../src/style-spec/expression/definitions/within.js","../src/style-spec/expression/is_constant.js","../src/style-spec/expression/definitions/var.js","../src/style-spec/expression/parsing_context.js","../src/style-spec/expression/stops.js","../src/style-spec/expression/definitions/step.js","../src/style-spec/util/interpolate.js","../src/style-spec/util/color_spaces.js","../src/style-spec/expression/definitions/interpolate.js","../src/style-spec/expression/definitions/coalesce.js","../src/style-spec/expression/definitions/let.js","../src/style-spec/expression/definitions/at.js","../src/style-spec/expression/definitions/in.js","../src/style-spec/expression/definitions/index_of.js","../src/style-spec/expression/definitions/match.js","../src/style-spec/expression/definitions/case.js","../src/style-spec/expression/definitions/slice.js","../src/style-spec/expression/definitions/comparison.js","../src/style-spec/expression/definitions/number_format.js","../src/style-spec/expression/definitions/length.js","../src/style-spec/expression/definitions/index.js","../src/style-spec/util/result.js","../src/style-spec/util/properties.js","../src/style-spec/util/get_type.js","../src/style-spec/function/index.js","../src/style-spec/expression/index.js","../src/style-spec/validate/validate_object.js","../src/style-spec/validate/validate_array.js","../src/style-spec/validate/validate_number.js","../src/style-spec/validate/validate_function.js","../src/style-spec/validate/validate_expression.js","../src/style-spec/validate/validate_enum.js","../src/style-spec/feature_filter/index.js","../src/style-spec/validate/validate_filter.js","../src/style-spec/validate/validate_property.js","../src/style-spec/validate/validate_paint_property.js","../src/style-spec/validate/validate_layout_property.js","../src/style-spec/validate/validate_layer.js","../src/style-spec/validate/validate_string.js","../src/style-spec/validate/validate_source.js","../src/style-spec/validate/validate_light.js","../src/style-spec/validate/validate.js","../src/style-spec/validate/validate_boolean.js","../src/style-spec/validate/validate_color.js","../src/style-spec/validate/validate_formatted.js","../src/style-spec/validate/validate_image.js","../src/style-spec/validate/validate_glyphs_url.js","../src/style-spec/validate_style.min.js","../src/style/validate_style.js","../node_modules/grid-index/grid-index.js","../src/util/web_worker_transfer.js","../src/style/zoom_history.js","../src/util/is_char_in_unicode_block.js","../src/util/script_detection.js","../src/source/rtl_text_plugin.js","../src/style/evaluation_parameters.js","../src/style/properties.js","../src/style/style_layer.js","../src/util/struct_array.js","../src/data/array_types.js","../src/data/bucket/circle_attributes.js","../src/data/segment.js","../src/shaders/encode_attribute.js","../src/data/bucket/pattern_attributes.js","../node_modules/murmurhash-js/murmurhash3_gc.js","../node_modules/murmurhash-js/murmurhash2_gc.js","../node_modules/murmurhash-js/index.js","../src/data/feature_position_map.js","../src/render/uniform_binding.js","../src/data/program_configuration.js","../src/data/extent.js","../src/data/load_geometry.js","../src/data/evaluation_feature.js","../src/data/bucket/circle_bucket.js","../src/util/intersection_tests.js","../src/style/query_utils.js","../src/style/style_layer/circle_style_layer_properties.js","../node_modules/gl-matrix/esm/common.js","../node_modules/gl-matrix/esm/mat4.js","../node_modules/gl-matrix/esm/vec3.js","../node_modules/gl-matrix/esm/vec4.js","../src/style/style_layer/circle_style_layer.js","../node_modules/gl-matrix/esm/vec2.js","../src/data/bucket/heatmap_bucket.js","../src/util/image.js","../src/style/style_layer/heatmap_style_layer_properties.js","../src/util/color_ramp.js","../src/style/style_layer/heatmap_style_layer.js","../src/style/style_layer/hillshade_style_layer_properties.js","../src/style/style_layer/hillshade_style_layer.js","../src/data/bucket/fill_attributes.js","../node_modules/earcut/src/earcut.js","../node_modules/quickselect/index.js","../src/util/classify_rings.js","../src/data/bucket/pattern_bucket_features.js","../src/data/bucket/fill_bucket.js","../src/style/style_layer/fill_style_layer_properties.js","../src/style/style_layer/fill_style_layer.js","../src/data/bucket/fill_extrusion_attributes.js","../node_modules/@mapbox/vector-tile/lib/vectortilefeature.js","../node_modules/@mapbox/vector-tile/lib/vectortilelayer.js","../node_modules/@mapbox/vector-tile/lib/vectortile.js","../node_modules/@mapbox/vector-tile/index.js","../src/data/bucket/fill_extrusion_bucket.js","../src/style/style_layer/fill_extrusion_style_layer_properties.js","../src/style/style_layer/fill_extrusion_style_layer.js","../src/data/bucket/line_attributes.js","../src/data/bucket/line_attributes_ext.js","../src/data/bucket/line_bucket.js","../src/style/style_layer/line_style_layer_properties.js","../src/style/style_layer/line_style_layer.js","../src/data/bucket/symbol_attributes.js","../src/symbol/transform_text.js","../src/util/verticalize_punctuation.js","../node_modules/ieee754/index.js","../node_modules/pbf/index.js","../src/style/parse_glyph_pbf.js","../node_modules/potpack/index.mjs","../src/render/image_atlas.js","../src/symbol/shaping.js","../src/symbol/anchor.js","../src/symbol/symbol_size.js","../src/symbol/check_max_angle.js","../src/symbol/get_anchors.js","../src/symbol/clip_line.js","../src/symbol/quads.js","../src/symbol/collision_feature.js","../node_modules/tinyqueue/index.js","../src/util/find_pole_of_inaccessibility.js","../src/symbol/symbol_layout.js","../src/data/bucket/symbol_bucket.js","../src/symbol/mergelines.js","../src/style/style_layer/symbol_style_layer_properties.js","../src/style/format_section_override.js","../src/style/style_layer/symbol_style_layer.js","../src/util/resolve_tokens.js","../src/style/style_layer/background_style_layer_properties.js","../src/style/style_layer/background_style_layer.js","../src/style/style_layer/raster_style_layer_properties.js","../src/style/style_layer/raster_style_layer.js","../src/style/style_layer/custom_style_layer.js","../src/style/create_style_layer.js","../src/render/texture.js","../src/util/throttled_invoker.js","../src/util/actor.js","../node_modules/@mapbox/whoots-js/index.mjs","../src/geo/lng_lat_bounds.js","../src/geo/lng_lat.js","../src/geo/mercator_coordinate.js","../src/source/tile_id.js","../src/data/dem_data.js","../src/util/dictionary_coder.js","../src/util/vectortile_to_geojson.js","../src/source/source_state.js","../src/data/feature_index.js","../src/source/tile.js","../src/data/bucket.js","../src/style-spec/util/ref_properties.js","../src/util/performance.js","../node_modules/gl-matrix/esm/mat3.js","../node_modules/gl-matrix/esm/mat2.js","../src/style-spec/util/deep_equal.js","../src/style-spec/group_by_layout.js","../src/style/style_layer_index.js","../src/render/glyph_atlas.js","../src/source/worker_tile.js","../src/source/vector_tile_worker_source.js","../src/source/raster_dem_tile_worker_source.js","../node_modules/@mapbox/geojson-rewind/index.js","../src/source/geojson_wrapper.js","../node_modules/vt-pbf/lib/geojson_wrapper.js","../node_modules/vt-pbf/index.js","../node_modules/kdbush/src/sort.js","../node_modules/kdbush/src/within.js","../node_modules/kdbush/src/index.js","../node_modules/kdbush/src/range.js","../node_modules/supercluster/index.js","../node_modules/geojson-vt/src/simplify.js","../node_modules/geojson-vt/src/feature.js","../node_modules/geojson-vt/src/convert.js","../node_modules/geojson-vt/src/clip.js","../node_modules/geojson-vt/src/wrap.js","../node_modules/geojson-vt/src/transform.js","../node_modules/geojson-vt/src/tile.js","../node_modules/geojson-vt/src/index.js","../src/source/geojson_worker_source.js","../src/source/worker.js","../node_modules/@mapbox/mapbox-gl-supported/index.js","../src/util/dom.js","../src/style/style_image.js","../src/render/image_manager.js","../node_modules/@mapbox/tiny-sdf/index.js","../src/render/glyph_manager.js","../src/style/load_glyph_range.js","../src/style/light.js","../src/render/line_atlas.js","../src/util/dispatcher.js","../src/source/load_tilejson.js","../src/source/tile_bounds.js","../src/source/vector_tile_source.js","../src/source/raster_tile_source.js","../src/source/raster_dem_tile_source.js","../src/source/geojson_source.js","../src/source/image_source.js","../src/source/video_source.js","../src/source/canvas_source.js","../src/source/source.js","../src/source/query_features.js","../src/source/tile_cache.js","../src/gl/index_buffer.js","../src/gl/vertex_buffer.js","../src/gl/value.js","../src/gl/framebuffer.js","../src/gl/depth_mode.js","../src/gl/stencil_mode.js","../src/gl/color_mode.js","../src/gl/cull_face_mode.js","../src/gl/context.js","../src/source/source_cache.js","../src/util/browser/web_worker.js","../src/util/worker_pool.js","../src/util/global_worker_pool.js","../src/style-spec/deref.js","../src/style-spec/diff.js","../src/symbol/path_interpolator.js","../src/symbol/grid_index.js","../src/symbol/projection.js","../src/symbol/collision_index.js","../src/source/pixels_to_tile_units.js","../src/symbol/placement.js","../src/style/pauseable_placement.js","../src/symbol/cross_tile_symbol_index.js","../src/style/style.js","../src/style-spec/empty.js","../src/style/load_sprite.js","../src/data/pos_attributes.js","../src/shaders/shaders.js","../src/render/vertex_array_object.js","../src/render/program.js","../src/render/program/pattern.js","../src/render/program/fill_extrusion_program.js","../src/render/program/fill_program.js","../src/render/program/circle_program.js","../src/render/program/collision_program.js","../src/render/program/debug_program.js","../src/render/program/clipping_mask_program.js","../src/render/program/heatmap_program.js","../src/render/program/line_program.js","../src/render/program/raster_program.js","../src/render/program/symbol_program.js","../src/render/draw_collision_debug.js","../src/render/program/background_program.js","../src/render/program/program_uniforms.js","../src/render/program/hillshade_program.js","../src/render/draw_symbol.js","../src/render/draw_fill.js","../src/render/draw_fill_extrusion.js","../src/render/draw_hillshade.js","../src/render/draw_raster.js","../src/render/draw_debug.js","../src/render/painter.js","../src/render/draw_circle.js","../src/render/draw_heatmap.js","../src/render/draw_line.js","../src/render/draw_background.js","../src/render/draw_custom.js","../src/util/primitives.js","../src/geo/edge_insets.js","../src/geo/transform.js","../src/ui/hash.js","../src/util/throttle.js","../src/ui/handler_inertia.js","../src/ui/events.js","../src/ui/handler/map_event.js","../src/ui/handler/box_zoom.js","../src/ui/handler/handler_util.js","../src/ui/handler/tap_recognizer.js","../src/ui/handler/tap_zoom.js","../src/ui/handler/mouse.js","../src/ui/handler/touch_pan.js","../src/ui/handler/touch_zoom_rotate.js","../src/ui/handler/keyboard.js","../src/ui/handler/scroll_zoom.js","../src/ui/handler/shim/dblclick_zoom.js","../src/ui/handler/click_zoom.js","../src/ui/handler/tap_drag_zoom.js","../src/ui/handler/shim/drag_pan.js","../src/ui/handler/shim/drag_rotate.js","../src/ui/handler/shim/touch_zoom_rotate.js","../src/ui/handler_manager.js","../src/ui/camera.js","../src/ui/control/attribution_control.js","../src/ui/control/logo_control.js","../src/util/task_queue.js","../src/ui/default_locale.js","../src/ui/map.js","../src/ui/control/navigation_control.js","../src/util/smart_wrap.js","../src/ui/anchor.js","../src/ui/marker.js","../src/ui/control/geolocate_control.js","../src/ui/control/scale_control.js","../src/ui/control/fullscreen_control.js","../src/ui/popup.js","../src/index.js","../rollup/maplibregl.js"],"sourcesContent":["/*\n * Copyright (C) 2008 Apple Inc. All Rights Reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR\n * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\n * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * Ported from Webkit\n * http://svn.webkit.org/repository/webkit/trunk/Source/WebCore/platform/graphics/UnitBezier.h\n */\n\nmodule.exports = UnitBezier;\n\nfunction UnitBezier(p1x, p1y, p2x, p2y) {\n // Calculate the polynomial coefficients, implicit first and last control points are (0,0) and (1,1).\n this.cx = 3.0 * p1x;\n this.bx = 3.0 * (p2x - p1x) - this.cx;\n this.ax = 1.0 - this.cx - this.bx;\n\n this.cy = 3.0 * p1y;\n this.by = 3.0 * (p2y - p1y) - this.cy;\n this.ay = 1.0 - this.cy - this.by;\n\n this.p1x = p1x;\n this.p1y = p2y;\n this.p2x = p2x;\n this.p2y = p2y;\n}\n\nUnitBezier.prototype.sampleCurveX = function(t) {\n // `ax t^3 + bx t^2 + cx t' expanded using Horner's rule.\n return ((this.ax * t + this.bx) * t + this.cx) * t;\n};\n\nUnitBezier.prototype.sampleCurveY = function(t) {\n return ((this.ay * t + this.by) * t + this.cy) * t;\n};\n\nUnitBezier.prototype.sampleCurveDerivativeX = function(t) {\n return (3.0 * this.ax * t + 2.0 * this.bx) * t + this.cx;\n};\n\nUnitBezier.prototype.solveCurveX = function(x, epsilon) {\n if (typeof epsilon === 'undefined') epsilon = 1e-6;\n\n var t0, t1, t2, x2, i;\n\n // First try a few iterations of Newton's method -- normally very fast.\n for (t2 = x, i = 0; i < 8; i++) {\n\n x2 = this.sampleCurveX(t2) - x;\n if (Math.abs(x2) < epsilon) return t2;\n\n var d2 = this.sampleCurveDerivativeX(t2);\n if (Math.abs(d2) < 1e-6) break;\n\n t2 = t2 - x2 / d2;\n }\n\n // Fall back to the bisection method for reliability.\n t0 = 0.0;\n t1 = 1.0;\n t2 = x;\n\n if (t2 < t0) return t0;\n if (t2 > t1) return t1;\n\n while (t0 < t1) {\n\n x2 = this.sampleCurveX(t2);\n if (Math.abs(x2 - x) < epsilon) return t2;\n\n if (x > x2) {\n t0 = t2;\n } else {\n t1 = t2;\n }\n\n t2 = (t1 - t0) * 0.5 + t0;\n }\n\n // Failure.\n return t2;\n};\n\nUnitBezier.prototype.solve = function(x, epsilon) {\n return this.sampleCurveY(this.solveCurveX(x, epsilon));\n};\n","'use strict';\n\nmodule.exports = Point;\n\n/**\n * A standalone point geometry with useful accessor, comparison, and\n * modification methods.\n *\n * @class Point\n * @param {Number} x the x-coordinate. this could be longitude or screen\n * pixels, or any other sort of unit.\n * @param {Number} y the y-coordinate. this could be latitude or screen\n * pixels, or any other sort of unit.\n * @example\n * var point = new Point(-77, 38);\n */\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n}\n\nPoint.prototype = {\n\n /**\n * Clone this point, returning a new point that can be modified\n * without affecting the old one.\n * @return {Point} the clone\n */\n clone: function() { return new Point(this.x, this.y); },\n\n /**\n * Add this point's x & y coordinates to another point,\n * yielding a new point.\n * @param {Point} p the other point\n * @return {Point} output point\n */\n add: function(p) { return this.clone()._add(p); },\n\n /**\n * Subtract this point's x & y coordinates to from point,\n * yielding a new point.\n * @param {Point} p the other point\n * @return {Point} output point\n */\n sub: function(p) { return this.clone()._sub(p); },\n\n /**\n * Multiply this point's x & y coordinates by point,\n * yielding a new point.\n * @param {Point} p the other point\n * @return {Point} output point\n */\n multByPoint: function(p) { return this.clone()._multByPoint(p); },\n\n /**\n * Divide this point's x & y coordinates by point,\n * yielding a new point.\n * @param {Point} p the other point\n * @return {Point} output point\n */\n divByPoint: function(p) { return this.clone()._divByPoint(p); },\n\n /**\n * Multiply this point's x & y coordinates by a factor,\n * yielding a new point.\n * @param {Point} k factor\n * @return {Point} output point\n */\n mult: function(k) { return this.clone()._mult(k); },\n\n /**\n * Divide this point's x & y coordinates by a factor,\n * yielding a new point.\n * @param {Point} k factor\n * @return {Point} output point\n */\n div: function(k) { return this.clone()._div(k); },\n\n /**\n * Rotate this point around the 0, 0 origin by an angle a,\n * given in radians\n * @param {Number} a angle to rotate around, in radians\n * @return {Point} output point\n */\n rotate: function(a) { return this.clone()._rotate(a); },\n\n /**\n * Rotate this point around p point by an angle a,\n * given in radians\n * @param {Number} a angle to rotate around, in radians\n * @param {Point} p Point to rotate around\n * @return {Point} output point\n */\n rotateAround: function(a,p) { return this.clone()._rotateAround(a,p); },\n\n /**\n * Multiply this point by a 4x1 transformation matrix\n * @param {Array} m transformation matrix\n * @return {Point} output point\n */\n matMult: function(m) { return this.clone()._matMult(m); },\n\n /**\n * Calculate this point but as a unit vector from 0, 0, meaning\n * that the distance from the resulting point to the 0, 0\n * coordinate will be equal to 1 and the angle from the resulting\n * point to the 0, 0 coordinate will be the same as before.\n * @return {Point} unit vector point\n */\n unit: function() { return this.clone()._unit(); },\n\n /**\n * Compute a perpendicular point, where the new y coordinate\n * is the old x coordinate and the new x coordinate is the old y\n * coordinate multiplied by -1\n * @return {Point} perpendicular point\n */\n perp: function() { return this.clone()._perp(); },\n\n /**\n * Return a version of this point with the x & y coordinates\n * rounded to integers.\n * @return {Point} rounded point\n */\n round: function() { return this.clone()._round(); },\n\n /**\n * Return the magitude of this point: this is the Euclidean\n * distance from the 0, 0 coordinate to this point's x and y\n * coordinates.\n * @return {Number} magnitude\n */\n mag: function() {\n return Math.sqrt(this.x * this.x + this.y * this.y);\n },\n\n /**\n * Judge whether this point is equal to another point, returning\n * true or false.\n * @param {Point} other the other point\n * @return {boolean} whether the points are equal\n */\n equals: function(other) {\n return this.x === other.x &&\n this.y === other.y;\n },\n\n /**\n * Calculate the distance from this point to another point\n * @param {Point} p the other point\n * @return {Number} distance\n */\n dist: function(p) {\n return Math.sqrt(this.distSqr(p));\n },\n\n /**\n * Calculate the distance from this point to another point,\n * without the square root step. Useful if you're comparing\n * relative distances.\n * @param {Point} p the other point\n * @return {Number} distance\n */\n distSqr: function(p) {\n var dx = p.x - this.x,\n dy = p.y - this.y;\n return dx * dx + dy * dy;\n },\n\n /**\n * Get the angle from the 0, 0 coordinate to this point, in radians\n * coordinates.\n * @return {Number} angle\n */\n angle: function() {\n return Math.atan2(this.y, this.x);\n },\n\n /**\n * Get the angle from this point to another point, in radians\n * @param {Point} b the other point\n * @return {Number} angle\n */\n angleTo: function(b) {\n return Math.atan2(this.y - b.y, this.x - b.x);\n },\n\n /**\n * Get the angle between this point and another point, in radians\n * @param {Point} b the other point\n * @return {Number} angle\n */\n angleWith: function(b) {\n return this.angleWithSep(b.x, b.y);\n },\n\n /*\n * Find the angle of the two vectors, solving the formula for\n * the cross product a x b = |a||b|sin(θ) for θ.\n * @param {Number} x the x-coordinate\n * @param {Number} y the y-coordinate\n * @return {Number} the angle in radians\n */\n angleWithSep: function(x, y) {\n return Math.atan2(\n this.x * y - this.y * x,\n this.x * x + this.y * y);\n },\n\n _matMult: function(m) {\n var x = m[0] * this.x + m[1] * this.y,\n y = m[2] * this.x + m[3] * this.y;\n this.x = x;\n this.y = y;\n return this;\n },\n\n _add: function(p) {\n this.x += p.x;\n this.y += p.y;\n return this;\n },\n\n _sub: function(p) {\n this.x -= p.x;\n this.y -= p.y;\n return this;\n },\n\n _mult: function(k) {\n this.x *= k;\n this.y *= k;\n return this;\n },\n\n _div: function(k) {\n this.x /= k;\n this.y /= k;\n return this;\n },\n\n _multByPoint: function(p) {\n this.x *= p.x;\n this.y *= p.y;\n return this;\n },\n\n _divByPoint: function(p) {\n this.x /= p.x;\n this.y /= p.y;\n return this;\n },\n\n _unit: function() {\n this._div(this.mag());\n return this;\n },\n\n _perp: function() {\n var y = this.y;\n this.y = this.x;\n this.x = -y;\n return this;\n },\n\n _rotate: function(angle) {\n var cos = Math.cos(angle),\n sin = Math.sin(angle),\n x = cos * this.x - sin * this.y,\n y = sin * this.x + cos * this.y;\n this.x = x;\n this.y = y;\n return this;\n },\n\n _rotateAround: function(angle, p) {\n var cos = Math.cos(angle),\n sin = Math.sin(angle),\n x = p.x + cos * (this.x - p.x) - sin * (this.y - p.y),\n y = p.y + sin * (this.x - p.x) + cos * (this.y - p.y);\n this.x = x;\n this.y = y;\n return this;\n },\n\n _round: function() {\n this.x = Math.round(this.x);\n this.y = Math.round(this.y);\n return this;\n }\n};\n\n/**\n * Construct a point from an array if necessary, otherwise if the input\n * is already a Point, or an unknown type, return it unchanged\n * @param {Array|Point|*} a any kind of input value\n * @return {Point} constructed point, or passed-through value.\n * @example\n * // this\n * var point = Point.convert([0, 1]);\n * // is equivalent to\n * var point = new Point(0, 1);\n */\nPoint.convert = function (a) {\n if (a instanceof Point) {\n return a;\n }\n if (Array.isArray(a)) {\n return new Point(a[0], a[1]);\n }\n return a;\n};\n","// @flow\n/* eslint-env browser */\nimport type {Window} from '../../types/window';\n\n// shim window for the case of requiring the browser bundle in Node\nexport default typeof self !== 'undefined' ? (self: Window) : (({}: any): Window);\n","// @flow\n\nimport UnitBezier from '@mapbox/unitbezier';\n\nimport Point from '@mapbox/point-geometry';\nimport window from './window';\n\nimport type {Callback} from '../types/callback';\n\n// Number.MAX_SAFE_INTEGER not available in IE\nexport const MAX_SAFE_INTEGER = Math.pow(2, 53) - 1;\n\n/**\n * @module util\n * @private\n */\n\n/**\n * Given a value `t` that varies between 0 and 1, return\n * an interpolation function that eases between 0 and 1 in a pleasing\n * cubic in-out fashion.\n *\n * @private\n */\nexport function easeCubicInOut(t: number): number {\n if (t <= 0) return 0;\n if (t >= 1) return 1;\n const t2 = t * t,\n t3 = t2 * t;\n return 4 * (t < 0.5 ? t3 : 3 * (t - t2) + t3 - 0.75);\n}\n\n/**\n * Given given (x, y), (x1, y1) control points for a bezier curve,\n * return a function that interpolates along that curve.\n *\n * @param p1x control point 1 x coordinate\n * @param p1y control point 1 y coordinate\n * @param p2x control point 2 x coordinate\n * @param p2y control point 2 y coordinate\n * @private\n */\nexport function bezier(p1x: number, p1y: number, p2x: number, p2y: number): (t: number) => number {\n const bezier = new UnitBezier(p1x, p1y, p2x, p2y);\n return function(t: number) {\n return bezier.solve(t);\n };\n}\n\n/**\n * A default bezier-curve powered easing function with\n * control points (0.25, 0.1) and (0.25, 1)\n *\n * @private\n */\nexport const ease = bezier(0.25, 0.1, 0.25, 1);\n\n/**\n * constrain n to the given range via min + max\n *\n * @param n value\n * @param min the minimum value to be returned\n * @param max the maximum value to be returned\n * @returns the clamped value\n * @private\n */\nexport function clamp(n: number, min: number, max: number): number {\n return Math.min(max, Math.max(min, n));\n}\n\n/**\n * constrain n to the given range, excluding the minimum, via modular arithmetic\n *\n * @param n value\n * @param min the minimum value to be returned, exclusive\n * @param max the maximum value to be returned, inclusive\n * @returns constrained number\n * @private\n */\nexport function wrap(n: number, min: number, max: number): number {\n const d = max - min;\n const w = ((n - min) % d + d) % d + min;\n return (w === min) ? max : w;\n}\n\n/*\n * Call an asynchronous function on an array of arguments,\n * calling `callback` with the completed results of all calls.\n *\n * @param array input to each call of the async function.\n * @param fn an async function with signature (data, callback)\n * @param callback a callback run after all async work is done.\n * called with an array, containing the results of each async call.\n * @private\n */\nexport function asyncAll(\n array: Array,\n fn: (item: Item, fnCallback: Callback) => void,\n callback: Callback>\n) {\n if (!array.length) { return callback(null, []); }\n let remaining = array.length;\n const results = new Array(array.length);\n let error = null;\n array.forEach((item, i) => {\n fn(item, (err, result) => {\n if (err) error = err;\n results[i] = ((result: any): Result); // https://github.com/facebook/flow/issues/2123\n if (--remaining === 0) callback(error, results);\n });\n });\n}\n\n/*\n * Polyfill for Object.values. Not fully spec compliant, but we don't\n * need it to be.\n *\n * @private\n */\nexport function values(obj: {[key: string]: T}): Array {\n const result = [];\n for (const k in obj) {\n result.push(obj[k]);\n }\n return result;\n}\n\n/*\n * Compute the difference between the keys in one object and the keys\n * in another object.\n *\n * @returns keys difference\n * @private\n */\nexport function keysDifference(obj: {[key: string]: S}, other: {[key: string]: T}): Array {\n const difference = [];\n for (const i in obj) {\n if (!(i in other)) {\n difference.push(i);\n }\n }\n return difference;\n}\n\n/**\n * Given a destination object and optionally many source objects,\n * copy all properties from the source objects into the destination.\n * The last source object given overrides properties from previous\n * source objects.\n *\n * @param dest destination object\n * @param sources sources from which properties are pulled\n * @private\n */\nexport function extend(dest: Object, ...sources: Array): Object {\n for (const src of sources) {\n for (const k in src) {\n dest[k] = src[k];\n }\n }\n return dest;\n}\n\n/**\n * Given an object and a number of properties as strings, return version\n * of that object with only those properties.\n *\n * @param src the object\n * @param properties an array of property names chosen\n * to appear on the resulting object.\n * @returns object with limited properties.\n * @example\n * var foo = { name: 'Charlie', age: 10 };\n * var justName = pick(foo, ['name']);\n * // justName = { name: 'Charlie' }\n * @private\n */\nexport function pick(src: Object, properties: Array): Object {\n const result = {};\n for (let i = 0; i < properties.length; i++) {\n const k = properties[i];\n if (k in src) {\n result[k] = src[k];\n }\n }\n return result;\n}\n\nlet id = 1;\n\n/**\n * Return a unique numeric id, starting at 1 and incrementing with\n * each call.\n *\n * @returns unique numeric id.\n * @private\n */\nexport function uniqueId(): number {\n return id++;\n}\n\n/**\n * Return a random UUID (v4). Taken from: https://gist.github.com/jed/982883\n * @private\n */\nexport function uuid(): string {\n function b(a) {\n return a ? (a ^ Math.random() * 16 >> a / 4).toString(16) :\n //$FlowFixMe: Flow doesn't like the implied array literal conversion here\n ([1e7] + -[1e3] + -4e3 + -8e3 + -1e11).replace(/[018]/g, b);\n }\n return b();\n}\n\n/**\n * Return whether a given value is a power of two\n * @private\n */\nexport function isPowerOfTwo(value: number): boolean {\n return (Math.log(value) / Math.LN2) % 1 === 0;\n}\n\n/**\n * Return the next power of two, or the input value if already a power of two\n * @private\n */\nexport function nextPowerOfTwo(value: number): number {\n if (value <= 1) return 1;\n return Math.pow(2, Math.ceil(Math.log(value) / Math.LN2));\n}\n\n/**\n * Validate a string to match UUID(v4) of the\n * form: xxxxxxxx-xxxx-4xxx-[89ab]xxx-xxxxxxxxxxxx\n * @param str string to validate.\n * @private\n */\nexport function validateUuid(str: ?string): boolean {\n return str ? /^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(str) : false;\n}\n\n/**\n * Given an array of member function names as strings, replace all of them\n * with bound versions that will always refer to `context` as `this`. This\n * is useful for classes where otherwise event bindings would reassign\n * `this` to the evented object or some other value: this lets you ensure\n * the `this` value always.\n *\n * @param fns list of member function names\n * @param context the context value\n * @example\n * function MyClass() {\n * bindAll(['ontimer'], this);\n * this.name = 'Tom';\n * }\n * MyClass.prototype.ontimer = function() {\n * alert(this.name);\n * };\n * var myClass = new MyClass();\n * setTimeout(myClass.ontimer, 100);\n * @private\n */\nexport function bindAll(fns: Array, context: Object): void {\n fns.forEach((fn) => {\n if (!context[fn]) { return; }\n context[fn] = context[fn].bind(context);\n });\n}\n\n/**\n * Determine if a string ends with a particular substring\n *\n * @private\n */\nexport function endsWith(string: string, suffix: string): boolean {\n return string.indexOf(suffix, string.length - suffix.length) !== -1;\n}\n\n/**\n * Create an object by mapping all the values of an existing object while\n * preserving their keys.\n *\n * @private\n */\nexport function mapObject(input: Object, iterator: Function, context?: Object): Object {\n const output = {};\n for (const key in input) {\n output[key] = iterator.call(context || this, input[key], key, input);\n }\n return output;\n}\n\n/**\n * Create an object by filtering out values of an existing object.\n *\n * @private\n */\nexport function filterObject(input: Object, iterator: Function, context?: Object): Object {\n const output = {};\n for (const key in input) {\n if (iterator.call(context || this, input[key], key, input)) {\n output[key] = input[key];\n }\n }\n return output;\n}\n\nimport deepEqual from '../style-spec/util/deep_equal';\nexport {deepEqual};\n\n/**\n * Deeply clones two objects.\n *\n * @private\n */\nexport function clone(input: T): T {\n if (Array.isArray(input)) {\n return input.map(clone);\n } else if (typeof input === 'object' && input) {\n return ((mapObject(input, clone): any): T);\n } else {\n return input;\n }\n}\n\n/**\n * Check if two arrays have at least one common element.\n *\n * @private\n */\nexport function arraysIntersect(a: Array, b: Array): boolean {\n for (let l = 0; l < a.length; l++) {\n if (b.indexOf(a[l]) >= 0) return true;\n }\n return false;\n}\n\n/**\n * Print a warning message to the console and ensure duplicate warning messages\n * are not printed.\n *\n * @private\n */\nconst warnOnceHistory: {[key: string]: boolean} = {};\n\nexport function warnOnce(message: string): void {\n if (!warnOnceHistory[message]) {\n // console isn't defined in some WebWorkers, see #2558\n if (typeof console !== \"undefined\") console.warn(message);\n warnOnceHistory[message] = true;\n }\n}\n\n/**\n * Indicates if the provided Points are in a counter clockwise (true) or clockwise (false) order\n *\n * @private\n * @returns true for a counter clockwise set of points\n */\n// http://bryceboe.com/2006/10/23/line-segment-intersection-algorithm/\nexport function isCounterClockwise(a: Point, b: Point, c: Point): boolean {\n return (c.y - a.y) * (b.x - a.x) > (b.y - a.y) * (c.x - a.x);\n}\n\n/**\n * Returns the signed area for the polygon ring. Postive areas are exterior rings and\n * have a clockwise winding. Negative areas are interior rings and have a counter clockwise\n * ordering.\n *\n * @private\n * @param ring Exterior or interior ring\n */\nexport function calculateSignedArea(ring: Array): number {\n let sum = 0;\n for (let i = 0, len = ring.length, j = len - 1, p1, p2; i < len; j = i++) {\n p1 = ring[i];\n p2 = ring[j];\n sum += (p2.x - p1.x) * (p1.y + p2.y);\n }\n return sum;\n}\n\n/**\n * Detects closed polygons, first + last point are equal\n *\n * @private\n * @param points array of points\n * @return true if the points are a closed polygon\n */\nexport function isClosedPolygon(points: Array): boolean {\n // If it is 2 points that are the same then it is a point\n // If it is 3 points with start and end the same then it is a line\n if (points.length < 4)\n return false;\n\n const p1 = points[0];\n const p2 = points[points.length - 1];\n\n if (Math.abs(p1.x - p2.x) > 0 ||\n Math.abs(p1.y - p2.y) > 0) {\n return false;\n }\n\n // polygon simplification can produce polygons with zero area and more than 3 points\n return Math.abs(calculateSignedArea(points)) > 0.01;\n}\n\n/**\n * Converts spherical coordinates to cartesian coordinates.\n *\n * @private\n * @param spherical Spherical coordinates, in [radial, azimuthal, polar]\n * @return cartesian coordinates in [x, y, z]\n */\n\nexport function sphericalToCartesian([r, azimuthal, polar]: [number, number, number]): {x: number, y: number, z: number} {\n // We abstract \"north\"/\"up\" (compass-wise) to be 0° when really this is 90° (π/2):\n // correct for that here\n azimuthal += 90;\n\n // Convert azimuthal and polar angles to radians\n azimuthal *= Math.PI / 180;\n polar *= Math.PI / 180;\n\n return {\n x: r * Math.cos(azimuthal) * Math.sin(polar),\n y: r * Math.sin(azimuthal) * Math.sin(polar),\n z: r * Math.cos(polar)\n };\n}\n\n/* global self, WorkerGlobalScope */\n/**\n * Retuns true if the when run in the web-worker context.\n *\n * @private\n * @returns {boolean}\n */\nexport function isWorker(): boolean {\n return typeof WorkerGlobalScope !== 'undefined' && typeof self !== 'undefined' &&\n self instanceof WorkerGlobalScope;\n}\n\n/**\n * Parses data from 'Cache-Control' headers.\n *\n * @private\n * @param cacheControl Value of 'Cache-Control' header\n * @return object containing parsed header info.\n */\n\nexport function parseCacheControl(cacheControl: string): Object {\n // Taken from [Wreck](https://github.com/hapijs/wreck)\n const re = /(?:^|(?:\\s*\\,\\s*))([^\\x00-\\x20\\(\\)<>@\\,;\\:\\\\\"\\/\\[\\]\\?\\=\\{\\}\\x7F]+)(?:\\=(?:([^\\x00-\\x20\\(\\)<>@\\,;\\:\\\\\"\\/\\[\\]\\?\\=\\{\\}\\x7F]+)|(?:\\\"((?:[^\"\\\\]|\\\\.)*)\\\")))?/g;\n\n const header = {};\n cacheControl.replace(re, ($0, $1, $2, $3) => {\n const value = $2 || $3;\n header[$1] = value ? value.toLowerCase() : true;\n return '';\n });\n\n if (header['max-age']) {\n const maxAge = parseInt(header['max-age'], 10);\n if (isNaN(maxAge)) delete header['max-age'];\n else header['max-age'] = maxAge;\n }\n\n return header;\n}\n\nlet _isSafari = null;\n\n/**\n * Returns true when run in WebKit derived browsers.\n * This is used as a workaround for a memory leak in Safari caused by using Transferable objects to\n * transfer data between WebWorkers and the main thread.\n * https://github.com/mapbox/mapbox-gl-js/issues/8771\n *\n * This should be removed once the underlying Safari issue is fixed.\n *\n * @private\n * @param scope {WindowOrWorkerGlobalScope} Since this function is used both on the main thread and WebWorker context,\n * let the calling scope pass in the global scope object.\n * @returns {boolean}\n */\nexport function isSafari(scope: any): boolean {\n if (_isSafari == null) {\n const userAgent = scope.navigator ? scope.navigator.userAgent : null;\n _isSafari = !!scope.safari ||\n !!(userAgent && (/\\b(iPad|iPhone|iPod)\\b/.test(userAgent) || (!!userAgent.match('Safari') && !userAgent.match('Chrome'))));\n }\n return _isSafari;\n}\n\nexport function storageAvailable(type: string): boolean {\n try {\n const storage = window[type];\n storage.setItem('_mapbox_test_', 1);\n storage.removeItem('_mapbox_test_');\n return true;\n } catch (e) {\n return false;\n }\n}\n\n// The following methods are from https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#The_Unicode_Problem\n//Unicode compliant base64 encoder for strings\nexport function b64EncodeUnicode(str: string) {\n return window.btoa(\n encodeURIComponent(str).replace(/%([0-9A-F]{2})/g,\n (match, p1) => {\n return String.fromCharCode(Number('0x' + p1)); //eslint-disable-line\n }\n )\n );\n}\n\n// Unicode compliant decoder for base64-encoded strings\nexport function b64DecodeUnicode(str: string) {\n return decodeURIComponent(window.atob(str).split('').map((c) => {\n return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); //eslint-disable-line\n }).join(''));\n}\n","// @flow strict\n\nimport window from './window';\nimport type {Cancelable} from '../types/cancelable';\n\nconst now = window.performance && window.performance.now ?\n window.performance.now.bind(window.performance) :\n Date.now.bind(Date);\n\nconst raf = window.requestAnimationFrame ||\n window.mozRequestAnimationFrame ||\n window.webkitRequestAnimationFrame ||\n window.msRequestAnimationFrame;\n\nconst cancel = window.cancelAnimationFrame ||\n window.mozCancelAnimationFrame ||\n window.webkitCancelAnimationFrame ||\n window.msCancelAnimationFrame;\n\nlet linkEl;\n\nlet reducedMotionQuery: MediaQueryList;\n\n/**\n * @private\n */\nconst exported = {\n /**\n * Provides a function that outputs milliseconds: either performance.now()\n * or a fallback to Date.now()\n */\n now,\n\n frame(fn: (paintStartTimestamp: number) => void): Cancelable {\n const frame = raf(fn);\n return {cancel: () => cancel(frame)};\n },\n\n getImageData(img: CanvasImageSource, padding?: number = 0): ImageData {\n const canvas = window.document.createElement('canvas');\n const context = canvas.getContext('2d');\n if (!context) {\n throw new Error('failed to create canvas 2d context');\n }\n canvas.width = img.width;\n canvas.height = img.height;\n context.drawImage(img, 0, 0, img.width, img.height);\n return context.getImageData(-padding, -padding, img.width + 2 * padding, img.height + 2 * padding);\n },\n\n resolveURL(path: string) {\n if (!linkEl) linkEl = window.document.createElement('a');\n linkEl.href = path;\n return linkEl.href;\n },\n\n hardwareConcurrency: window.navigator && window.navigator.hardwareConcurrency || 4,\n\n get devicePixelRatio() { return window.devicePixelRatio; },\n get prefersReducedMotion(): boolean {\n if (!window.matchMedia) return false;\n //Lazily initialize media query\n if (reducedMotionQuery == null) {\n reducedMotionQuery = window.matchMedia('(prefers-reduced-motion: reduce)');\n }\n return reducedMotionQuery.matches;\n },\n};\n\nexport default exported;\n","// @flow strict\n\nimport window from './window';\n\nconst exported = {\n supported: false,\n testSupport\n};\n\nexport default exported;\n\nlet glForTesting;\nlet webpCheckComplete = false;\nlet webpImgTest;\nlet webpImgTestOnloadComplete = false;\n\nif (window.document) {\n webpImgTest = window.document.createElement('img');\n webpImgTest.onload = function() {\n if (glForTesting) testWebpTextureUpload(glForTesting);\n glForTesting = null;\n webpImgTestOnloadComplete = true;\n };\n webpImgTest.onerror = function() {\n webpCheckComplete = true;\n glForTesting = null;\n };\n webpImgTest.src = 'data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=';\n}\n\nfunction testSupport(gl: WebGLRenderingContext) {\n if (webpCheckComplete || !webpImgTest) return;\n\n // HTMLImageElement.complete is set when an image is done loading it's source\n // regardless of whether the load was successful or not.\n // It's possible for an error to set HTMLImageElement.complete to true which would trigger\n // testWebpTextureUpload and mistakenly set exported.supported to true in browsers which don't support webp\n // To avoid this, we set a flag in the image's onload handler and only call testWebpTextureUpload\n // after a successful image load event.\n if (webpImgTestOnloadComplete) {\n testWebpTextureUpload(gl);\n } else {\n glForTesting = gl;\n\n }\n}\n\nfunction testWebpTextureUpload(gl: WebGLRenderingContext) {\n // Edge 18 supports WebP but not uploading a WebP image to a gl texture\n // Test support for this before allowing WebP images.\n // https://github.com/mapbox/mapbox-gl-js/issues/7671\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n\n try {\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, webpImgTest);\n\n // The error does not get triggered in Edge if the context is lost\n if (gl.isContextLost()) return;\n\n exported.supported = true;\n } catch (e) {\n // Catch \"Unspecified Error.\" in Edge 18.\n }\n\n gl.deleteTexture(texture);\n\n webpCheckComplete = true;\n}\n","// @flow\n\ntype Config = {|\n API_URL: string,\n EVENTS_URL: ?string,\n FEEDBACK_URL: string,\n REQUIRE_ACCESS_TOKEN: boolean,\n ACCESS_TOKEN: ?string,\n MAX_PARALLEL_IMAGE_REQUESTS: number,\n REGISTERED_PROTOCOLS: { [string]: any },\n|};\n\nconst config: Config = {\n API_URL: 'https://api.mapbox.com',\n get EVENTS_URL() {\n if (!this.API_URL) { return null; }\n if (this.API_URL.indexOf('https://api.mapbox.cn') === 0) {\n return 'https://events.mapbox.cn/events/v2';\n } else if (this.API_URL.indexOf('https://api.mapbox.com') === 0) {\n return 'https://events.mapbox.com/events/v2';\n } else {\n return null;\n }\n },\n FEEDBACK_URL: 'https://apps.mapbox.com/feedback',\n REQUIRE_ACCESS_TOKEN: true,\n ACCESS_TOKEN: null,\n MAX_PARALLEL_IMAGE_REQUESTS: 16,\n REGISTERED_PROTOCOLS: {},\n};\n\nexport default config;\n","// @flow\n\n/***** START WARNING - IF YOU USE THIS CODE WITH MAPBOX MAPPING APIS, REMOVAL OR\n* MODIFICATION OF THE FOLLOWING CODE VIOLATES THE MAPBOX TERMS OF SERVICE ******\n* The following code is used to access Mapbox's Mapping APIs. Removal or modification\n* of this code when used with Mapbox's Mapping APIs can result in higher fees and/or\n* termination of your account with Mapbox.\n*\n* Under the Mapbox Terms of Service, you may not use this code to access Mapbox\n* Mapping APIs other than through Mapbox SDKs.\n*\n* The Mapping APIs documentation is available at https://docs.mapbox.com/api/maps/#maps\n* and the Mapbox Terms of Service are available at https://www.mapbox.com/tos/\n******************************************************************************/\n\ntype SkuTokenObject = {|\n token: string,\n tokenExpiresAt: number\n|};\n\nconst SKU_ID = '01';\n\nfunction createSkuToken(): SkuTokenObject {\n // SKU_ID and TOKEN_VERSION are specified by an internal schema and should not change\n const TOKEN_VERSION = '1';\n const base62chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\n // sessionRandomizer is a randomized 10-digit base-62 number\n let sessionRandomizer = '';\n for (let i = 0; i < 10; i++) {\n sessionRandomizer += base62chars[Math.floor(Math.random() * 62)];\n }\n const expiration = 12 * 60 * 60 * 1000; // 12 hours\n const token = [TOKEN_VERSION, SKU_ID, sessionRandomizer].join('');\n const tokenExpiresAt = Date.now() + expiration;\n\n return {token, tokenExpiresAt};\n}\n\nexport {createSkuToken, SKU_ID};\n\n/***** END WARNING - REMOVAL OR MODIFICATION OF THE\nPRECEDING CODE VIOLATES THE MAPBOX TERMS OF SERVICE ******/\n","// @flow\n\n/***** START WARNING - IF YOU USE THIS CODE WITH MAPBOX MAPPING APIS, REMOVAL OR\n* MODIFICATION OF THE FOLLOWING CODE VIOLATES THE MAPBOX TERMS OF SERVICE ******\n* The following code is used to access Mapbox's Mapping APIs. Removal or modification\n* of this code when used with Mapbox's Mapping APIs can result in higher fees and/or\n* termination of your account with Mapbox.\n*\n* Under the Mapbox Terms of Service, you may not use this code to access Mapbox\n* Mapping APIs other than through Mapbox SDKs.\n*\n* The Mapping APIs documentation is available at https://docs.mapbox.com/api/maps/#maps\n* and the Mapbox Terms of Service are available at https://www.mapbox.com/tos/\n******************************************************************************/\n\nimport config from './config';\n\nimport browser from './browser';\nimport window from './window';\nimport webpSupported from './webp_supported';\nimport {createSkuToken, SKU_ID} from './sku_token';\nimport {version as sdkVersion} from '../../package.json';\nimport {uuid, validateUuid, storageAvailable, b64DecodeUnicode, b64EncodeUnicode, warnOnce, extend} from './util';\nimport {postData, ResourceType} from './ajax';\n\nimport type {RequestParameters} from './ajax';\nimport type {Cancelable} from '../types/cancelable';\nimport type {TileJSON} from '../types/tilejson';\n\ntype ResourceTypeEnum = $Keys;\nexport type RequestTransformFunction = (url: string, resourceType?: ResourceTypeEnum) => RequestParameters;\n\ntype UrlObject = {|\n protocol: string,\n authority: string,\n path: string,\n params: Array\n|};\n\nexport class RequestManager {\n _skuToken: string;\n _skuTokenExpiresAt: number;\n _transformRequestFn: ?RequestTransformFunction;\n _customAccessToken: ?string;\n\n constructor(transformRequestFn?: RequestTransformFunction, customAccessToken?: string) {\n this._transformRequestFn = transformRequestFn;\n this._customAccessToken = customAccessToken;\n this._createSkuToken();\n }\n\n _createSkuToken() {\n const skuToken = createSkuToken();\n this._skuToken = skuToken.token;\n this._skuTokenExpiresAt = skuToken.tokenExpiresAt;\n }\n\n _isSkuTokenExpired(): boolean {\n return Date.now() > this._skuTokenExpiresAt;\n }\n\n transformRequest(url: string, type: ResourceTypeEnum) {\n if (this._transformRequestFn) {\n return this._transformRequestFn(url, type) || {url};\n }\n\n return {url};\n }\n\n normalizeStyleURL(url: string, accessToken?: string): string {\n if (!isMapboxURL(url)) return url;\n const urlObject = parseUrl(url);\n urlObject.path = `/styles/v1${urlObject.path}`;\n return this._makeAPIURL(urlObject, this._customAccessToken || accessToken);\n }\n\n normalizeGlyphsURL(url: string, accessToken?: string): string {\n if (!isMapboxURL(url)) return url;\n const urlObject = parseUrl(url);\n urlObject.path = `/fonts/v1${urlObject.path}`;\n return this._makeAPIURL(urlObject, this._customAccessToken || accessToken);\n }\n\n normalizeSourceURL(url: string, accessToken?: string): string {\n if (!isMapboxURL(url)) return url;\n const urlObject = parseUrl(url);\n urlObject.path = `/v4/${urlObject.authority}.json`;\n // TileJSON requests need a secure flag appended to their URLs so\n // that the server knows to send SSL-ified resource references.\n urlObject.params.push('secure');\n return this._makeAPIURL(urlObject, this._customAccessToken || accessToken);\n }\n\n normalizeSpriteURL(url: string, format: string, extension: string, accessToken?: string): string {\n const urlObject = parseUrl(url);\n if (!isMapboxURL(url)) {\n urlObject.path += `${format}${extension}`;\n return formatUrl(urlObject);\n }\n urlObject.path = `/styles/v1${urlObject.path}/sprite${format}${extension}`;\n return this._makeAPIURL(urlObject, this._customAccessToken || accessToken);\n }\n\n normalizeTileURL(tileURL: string, tileSize?: ?number): string {\n if (this._isSkuTokenExpired()) {\n this._createSkuToken();\n }\n\n if (tileURL && !isMapboxURL(tileURL)) return tileURL;\n\n const urlObject = parseUrl(tileURL);\n const imageExtensionRe = /(\\.(png|jpg)\\d*)(?=$)/;\n const tileURLAPIPrefixRe = /^.+\\/v4\\//;\n\n // The v4 mapbox tile API supports 512x512 image tiles only when @2x\n // is appended to the tile URL. If `tileSize: 512` is specified for\n // a Mapbox raster source force the @2x suffix even if a non hidpi device.\n const suffix = browser.devicePixelRatio >= 2 || tileSize === 512 ? '@2x' : '';\n const extension = webpSupported.supported ? '.webp' : '$1';\n urlObject.path = urlObject.path.replace(imageExtensionRe, `${suffix}${extension}`);\n urlObject.path = urlObject.path.replace(tileURLAPIPrefixRe, '/');\n urlObject.path = `/v4${urlObject.path}`;\n\n const accessToken = this._customAccessToken || getAccessToken(urlObject.params) || config.ACCESS_TOKEN;\n if (config.REQUIRE_ACCESS_TOKEN && accessToken && this._skuToken) {\n urlObject.params.push(`sku=${this._skuToken}`);\n }\n\n return this._makeAPIURL(urlObject, accessToken);\n }\n\n canonicalizeTileURL(url: string, removeAccessToken: boolean) {\n const version = \"/v4/\";\n // matches any file extension specified by a dot and one or more alphanumeric characters\n const extensionRe = /\\.[\\w]+$/;\n\n const urlObject = parseUrl(url);\n // Make sure that we are dealing with a valid Mapbox tile URL.\n // Has to begin with /v4/, with a valid filename + extension\n if (!urlObject.path.match(/(^\\/v4\\/)/) || !urlObject.path.match(extensionRe)) {\n // Not a proper Mapbox tile URL.\n return url;\n }\n // Reassemble the canonical URL from the parts we've parsed before.\n let result = \"mapbox://tiles/\";\n result += urlObject.path.replace(version, '');\n\n // Append the query string, minus the access token parameter.\n let params = urlObject.params;\n if (removeAccessToken) {\n params = params.filter(p => !p.match(/^access_token=/));\n }\n if (params.length) result += `?${params.join('&')}`;\n return result;\n }\n\n canonicalizeTileset(tileJSON: TileJSON, sourceURL?: string) {\n const removeAccessToken = sourceURL ? isMapboxURL(sourceURL) : false;\n const canonical = [];\n for (const url of tileJSON.tiles || []) {\n if (isMapboxHTTPURL(url)) {\n canonical.push(this.canonicalizeTileURL(url, removeAccessToken));\n } else {\n canonical.push(url);\n }\n }\n return canonical;\n }\n\n _makeAPIURL(urlObject: UrlObject, accessToken: string | null | void): string {\n const help = 'See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes';\n const apiUrlObject = parseUrl(config.API_URL);\n urlObject.protocol = apiUrlObject.protocol;\n urlObject.authority = apiUrlObject.authority;\n\n if (urlObject.protocol === 'http') {\n const i = urlObject.params.indexOf('secure');\n if (i >= 0) urlObject.params.splice(i, 1);\n }\n\n if (apiUrlObject.path !== '/') {\n urlObject.path = `${apiUrlObject.path}${urlObject.path}`;\n }\n\n if (!config.REQUIRE_ACCESS_TOKEN) return formatUrl(urlObject);\n\n accessToken = accessToken || config.ACCESS_TOKEN;\n if (!accessToken)\n throw new Error(`An API access token is required to use Mapbox GL. ${help}`);\n if (accessToken[0] === 's')\n throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${help}`);\n\n urlObject.params = urlObject.params.filter((d) => d.indexOf('access_token') === -1);\n urlObject.params.push(`access_token=${accessToken}`);\n return formatUrl(urlObject);\n }\n\n setTransformRequest(transformRequest: RequestTransformFunction) {\n this._transformRequestFn = transformRequest;\n }\n}\n\nfunction isMapboxURL(url: string) {\n return url.indexOf('mapbox:') === 0;\n}\n\nconst mapboxHTTPURLRe = /^((https?:)?\\/\\/)?([^\\/]+\\.)?mapbox\\.c(n|om)(\\/|\\?|$)/i;\nfunction isMapboxHTTPURL(url: string): boolean {\n return mapboxHTTPURLRe.test(url);\n}\n\nfunction hasCacheDefeatingSku(url: string) {\n return url.indexOf('sku=') > 0 && isMapboxHTTPURL(url);\n}\n\nfunction getAccessToken(params: Array): string | null {\n for (const param of params) {\n const match = param.match(/^access_token=(.*)$/);\n if (match) {\n return match[1];\n }\n }\n return null;\n}\n\nconst urlRe = /^(\\w+):\\/\\/([^/?]*)(\\/[^?]+)?\\??(.+)?/;\n\nfunction parseUrl(url: string): UrlObject {\n const parts = url.match(urlRe);\n if (!parts) {\n throw new Error('Unable to parse URL object');\n }\n return {\n protocol: parts[1],\n authority: parts[2],\n path: parts[3] || '/',\n params: parts[4] ? parts[4].split('&') : []\n };\n}\n\nfunction formatUrl(obj: UrlObject): string {\n const params = obj.params.length ? `?${obj.params.join('&')}` : '';\n return `${obj.protocol}://${obj.authority}${obj.path}${params}`;\n}\n\nexport {isMapboxURL, isMapboxHTTPURL, hasCacheDefeatingSku};\n\nconst telemEventKey = 'mapbox.eventData';\n\nfunction parseAccessToken(accessToken: ?string) {\n if (!accessToken) {\n return null;\n }\n\n const parts = accessToken.split('.');\n if (!parts || parts.length !== 3) {\n return null;\n }\n\n try {\n const jsonData = JSON.parse(b64DecodeUnicode(parts[1]));\n return jsonData;\n } catch (e) {\n return null;\n }\n}\n\ntype TelemetryEventType = 'appUserTurnstile' | 'map.load';\n\nclass TelemetryEvent {\n eventData: any;\n anonId: ?string;\n queue: Array;\n type: TelemetryEventType;\n pendingRequest: ?Cancelable;\n _customAccessToken: ?string;\n\n constructor(type: TelemetryEventType) {\n this.type = type;\n this.anonId = null;\n this.eventData = {};\n this.queue = [];\n this.pendingRequest = null;\n }\n\n getStorageKey(domain: ?string) {\n const tokenData = parseAccessToken(config.ACCESS_TOKEN);\n let u = '';\n if (tokenData && tokenData['u']) {\n u = b64EncodeUnicode(tokenData['u']);\n } else {\n u = config.ACCESS_TOKEN || '';\n }\n return domain ?\n `${telemEventKey}.${domain}:${u}` :\n `${telemEventKey}:${u}`;\n }\n\n fetchEventData() {\n const isLocalStorageAvailable = storageAvailable('localStorage');\n const storageKey = this.getStorageKey();\n const uuidKey = this.getStorageKey('uuid');\n\n if (isLocalStorageAvailable) {\n //Retrieve cached data\n try {\n const data = window.localStorage.getItem(storageKey);\n if (data) {\n this.eventData = JSON.parse(data);\n }\n\n const uuid = window.localStorage.getItem(uuidKey);\n if (uuid) this.anonId = uuid;\n } catch (e) {\n warnOnce('Unable to read from LocalStorage');\n }\n }\n }\n\n saveEventData() {\n const isLocalStorageAvailable = storageAvailable('localStorage');\n const storageKey = this.getStorageKey();\n const uuidKey = this.getStorageKey('uuid');\n if (isLocalStorageAvailable) {\n try {\n window.localStorage.setItem(uuidKey, this.anonId);\n if (Object.keys(this.eventData).length >= 1) {\n window.localStorage.setItem(storageKey, JSON.stringify(this.eventData));\n }\n } catch (e) {\n warnOnce('Unable to write to LocalStorage');\n }\n }\n\n }\n\n processRequests(_: ?string) {}\n\n /*\n * If any event data should be persisted after the POST request, the callback should modify eventData`\n * to the values that should be saved. For this reason, the callback should be invoked prior to the call\n * to TelemetryEvent#saveData\n */\n postEvent(timestamp: number, additionalPayload: {[_: string]: any}, callback: (err: ?Error) => void, customAccessToken?: ?string) {\n if (!config.EVENTS_URL) return;\n const eventsUrlObject: UrlObject = parseUrl(config.EVENTS_URL);\n eventsUrlObject.params.push(`access_token=${customAccessToken || config.ACCESS_TOKEN || ''}`);\n\n const payload: Object = {\n event: this.type,\n created: new Date(timestamp).toISOString(),\n sdkIdentifier: 'mapbox-gl-js',\n sdkVersion,\n skuId: SKU_ID,\n userId: this.anonId\n };\n\n const finalPayload = additionalPayload ? extend(payload, additionalPayload) : payload;\n const request: RequestParameters = {\n url: formatUrl(eventsUrlObject),\n headers: {\n 'Content-Type': 'text/plain' //Skip the pre-flight OPTIONS request\n },\n body: JSON.stringify([finalPayload])\n };\n\n this.pendingRequest = postData(request, (error) => {\n this.pendingRequest = null;\n callback(error);\n this.saveEventData();\n this.processRequests(customAccessToken);\n });\n }\n\n queueRequest(event: number | {id: number, timestamp: number}, customAccessToken?: ?string) {\n this.queue.push(event);\n this.processRequests(customAccessToken);\n }\n}\n\nexport class MapLoadEvent extends TelemetryEvent {\n +success: {[_: number]: boolean};\n skuToken: string;\n\n constructor() {\n super('map.load');\n this.success = {};\n this.skuToken = '';\n }\n\n postMapLoadEvent(tileUrls: Array, mapId: number, skuToken: string, customAccessToken: string) {\n //Enabled only when Mapbox Access Token is set and a source uses\n // mapbox tiles.\n this.skuToken = skuToken;\n\n if (config.EVENTS_URL &&\n customAccessToken || config.ACCESS_TOKEN &&\n Array.isArray(tileUrls) &&\n tileUrls.some(url => isMapboxURL(url) || isMapboxHTTPURL(url))) {\n this.queueRequest({id: mapId, timestamp: Date.now()}, customAccessToken);\n }\n }\n\n processRequests(customAccessToken?: ?string) {\n if (this.pendingRequest || this.queue.length === 0) return;\n const {id, timestamp} = this.queue.shift();\n\n // Only one load event should fire per map\n if (id && this.success[id]) return;\n\n if (!this.anonId) {\n this.fetchEventData();\n }\n\n if (!validateUuid(this.anonId)) {\n this.anonId = uuid();\n }\n\n this.postEvent(timestamp, {skuToken: this.skuToken}, (err) => {\n if (!err) {\n if (id) this.success[id] = true;\n }\n }, customAccessToken);\n }\n}\n\nexport class TurnstileEvent extends TelemetryEvent {\n constructor(customAccessToken?: ?string) {\n super('appUserTurnstile');\n this._customAccessToken = customAccessToken;\n }\n\n postTurnstileEvent(tileUrls: Array, customAccessToken?: ?string) {\n //Enabled only when Mapbox Access Token is set and a source uses\n // mapbox tiles.\n if (config.EVENTS_URL &&\n config.ACCESS_TOKEN &&\n Array.isArray(tileUrls) &&\n tileUrls.some(url => isMapboxURL(url) || isMapboxHTTPURL(url))) {\n this.queueRequest(Date.now(), customAccessToken);\n }\n }\n\n processRequests(customAccessToken?: ?string) {\n if (this.pendingRequest || this.queue.length === 0) {\n return;\n }\n\n if (!this.anonId || !this.eventData.lastSuccess || !this.eventData.tokenU) {\n //Retrieve cached data\n this.fetchEventData();\n }\n\n const tokenData = parseAccessToken(config.ACCESS_TOKEN);\n const tokenU = tokenData ? tokenData['u'] : config.ACCESS_TOKEN;\n //Reset event data cache if the access token owner changed.\n let dueForEvent = tokenU !== this.eventData.tokenU;\n\n if (!validateUuid(this.anonId)) {\n this.anonId = uuid();\n dueForEvent = true;\n }\n\n const nextUpdate = this.queue.shift();\n // Record turnstile event once per calendar day.\n if (this.eventData.lastSuccess) {\n const lastUpdate = new Date(this.eventData.lastSuccess);\n const nextDate = new Date(nextUpdate);\n const daysElapsed = (nextUpdate - this.eventData.lastSuccess) / (24 * 60 * 60 * 1000);\n dueForEvent = dueForEvent || daysElapsed >= 1 || daysElapsed < -1 || lastUpdate.getDate() !== nextDate.getDate();\n } else {\n dueForEvent = true;\n }\n\n if (!dueForEvent) {\n return this.processRequests();\n }\n\n this.postEvent(nextUpdate, {\"enabled.telemetry\": false}, (err) => {\n if (!err) {\n this.eventData.lastSuccess = nextUpdate;\n this.eventData.tokenU = tokenU;\n }\n }, customAccessToken);\n }\n}\n\nconst turnstileEvent_ = new TurnstileEvent();\nexport const postTurnstileEvent = turnstileEvent_.postTurnstileEvent.bind(turnstileEvent_);\n\nconst mapLoadEvent_ = new MapLoadEvent();\nexport const postMapLoadEvent = mapLoadEvent_.postMapLoadEvent.bind(mapLoadEvent_);\n\n/***** END WARNING - REMOVAL OR MODIFICATION OF THE\nPRECEDING CODE VIOLATES THE MAPBOX TERMS OF SERVICE ******/\n","// @flow\n\nimport {warnOnce, parseCacheControl} from './util';\nimport window from './window';\n\nimport type Dispatcher from './dispatcher';\n\nconst CACHE_NAME = 'mapbox-tiles';\nlet cacheLimit = 500; // 50MB / (100KB/tile) ~= 500 tiles\nlet cacheCheckThreshold = 50;\n\nconst MIN_TIME_UNTIL_EXPIRY = 1000 * 60 * 7; // 7 minutes. Skip caching tiles with a short enough max age.\n\nexport type ResponseOptions = {\n status: number,\n statusText: string,\n headers: window.Headers\n};\n\n// We're using a global shared cache object. Normally, requesting ad-hoc Cache objects is fine, but\n// Safari has a memory leak in which it fails to release memory when requesting keys() from a Cache\n// object. See https://bugs.webkit.org/show_bug.cgi?id=203991 for more information.\nlet sharedCache: ?Promise;\n\nfunction cacheOpen() {\n if (window.caches && !sharedCache) {\n sharedCache = window.caches.open(CACHE_NAME);\n }\n}\n\n// We're never closing the cache, but our unit tests rely on changing out the global window.caches\n// object, so we have a function specifically for unit tests that allows resetting the shared cache.\nexport function cacheClose() {\n sharedCache = undefined;\n}\n\nlet responseConstructorSupportsReadableStream;\nfunction prepareBody(response: Response, callback) {\n if (responseConstructorSupportsReadableStream === undefined) {\n try {\n new Response(new ReadableStream()); // eslint-disable-line no-undef\n responseConstructorSupportsReadableStream = true;\n } catch (e) {\n // Edge\n responseConstructorSupportsReadableStream = false;\n }\n }\n\n if (responseConstructorSupportsReadableStream) {\n callback(response.body);\n } else {\n response.blob().then(callback);\n }\n}\n\nexport function cachePut(request: Request, response: Response, requestTime: number) {\n cacheOpen();\n if (!sharedCache) return;\n\n const options: ResponseOptions = {\n status: response.status,\n statusText: response.statusText,\n headers: new window.Headers()\n };\n response.headers.forEach((v, k) => options.headers.set(k, v));\n\n const cacheControl = parseCacheControl(response.headers.get('Cache-Control') || '');\n if (cacheControl['no-store']) {\n return;\n }\n if (cacheControl['max-age']) {\n options.headers.set('Expires', new Date(requestTime + cacheControl['max-age'] * 1000).toUTCString());\n }\n\n const timeUntilExpiry = new Date(options.headers.get('Expires')).getTime() - requestTime;\n if (timeUntilExpiry < MIN_TIME_UNTIL_EXPIRY) return;\n\n prepareBody(response, body => {\n const clonedResponse = new window.Response(body, options);\n\n cacheOpen();\n if (!sharedCache) return;\n sharedCache\n .then(cache => cache.put(stripQueryParameters(request.url), clonedResponse))\n .catch(e => warnOnce(e.message));\n });\n}\n\nfunction stripQueryParameters(url: string) {\n const start = url.indexOf('?');\n return start < 0 ? url : url.slice(0, start);\n}\n\nexport function cacheGet(request: Request, callback: (error: ?any, response: ?Response, fresh: ?boolean) => void) {\n cacheOpen();\n if (!sharedCache) return callback(null);\n\n const strippedURL = stripQueryParameters(request.url);\n\n sharedCache\n .then(cache => {\n // manually strip URL instead of `ignoreSearch: true` because of a known\n // performance issue in Chrome https://github.com/mapbox/mapbox-gl-js/issues/8431\n cache.match(strippedURL)\n .then(response => {\n const fresh = isFresh(response);\n\n // Reinsert into cache so that order of keys in the cache is the order of access.\n // This line makes the cache a LRU instead of a FIFO cache.\n cache.delete(strippedURL);\n if (fresh) {\n cache.put(strippedURL, response.clone());\n }\n\n callback(null, response, fresh);\n })\n .catch(callback);\n })\n .catch(callback);\n\n}\n\nfunction isFresh(response) {\n if (!response) return false;\n const expires = new Date(response.headers.get('Expires') || 0);\n const cacheControl = parseCacheControl(response.headers.get('Cache-Control') || '');\n return expires > Date.now() && !cacheControl['no-cache'];\n}\n\n// `Infinity` triggers a cache check after the first tile is loaded\n// so that a check is run at least once on each page load.\nlet globalEntryCounter = Infinity;\n\n// The cache check gets run on a worker. The reason for this is that\n// profiling sometimes shows this as taking up significant time on the\n// thread it gets called from. And sometimes it doesn't. It *may* be\n// fine to run this on the main thread but out of caution this is being\n// dispatched on a worker. This can be investigated further in the future.\nexport function cacheEntryPossiblyAdded(dispatcher: Dispatcher) {\n globalEntryCounter++;\n if (globalEntryCounter > cacheCheckThreshold) {\n dispatcher.getActor().send('enforceCacheSizeLimit', cacheLimit);\n globalEntryCounter = 0;\n }\n}\n\n// runs on worker, see above comment\nexport function enforceCacheSizeLimit(limit: number) {\n cacheOpen();\n if (!sharedCache) return;\n\n sharedCache\n .then(cache => {\n cache.keys().then(keys => {\n for (let i = 0; i < keys.length - limit; i++) {\n cache.delete(keys[i]);\n }\n });\n });\n}\n\nexport function clearTileCache(callback?: (err: ?Error) => void) {\n const promise = window.caches.delete(CACHE_NAME);\n if (callback) {\n promise.catch(callback).then(() => callback());\n }\n}\n\nexport function setCacheLimits(limit: number, checkThreshold: number) {\n cacheLimit = limit;\n cacheCheckThreshold = checkThreshold;\n}\n","// @flow\nimport window from './window';\n\nlet supportsOffscreenCanvas: ?boolean;\n\nexport default function offscreenCanvasSupported(): boolean {\n if (supportsOffscreenCanvas == null) {\n supportsOffscreenCanvas = window.OffscreenCanvas &&\n new window.OffscreenCanvas(1, 1).getContext('2d') &&\n typeof window.createImageBitmap === 'function';\n }\n\n return supportsOffscreenCanvas;\n}\n","// @flow\n\nimport window from './window';\nimport {extend, warnOnce, isWorker} from './util';\nimport {isMapboxHTTPURL, hasCacheDefeatingSku} from './mapbox';\nimport config from './config';\nimport assert from 'assert';\nimport {cacheGet, cachePut} from './tile_request_cache';\nimport webpSupported from './webp_supported';\nimport offscreenCanvasSupported from './offscreen_canvas_supported';\n\nimport type {Callback} from '../types/callback';\nimport type {Cancelable} from '../types/cancelable';\n\n/**\n * The type of a resource.\n * @private\n * @readonly\n * @enum {string}\n */\nconst ResourceType = {\n Unknown: 'Unknown',\n Style: 'Style',\n Source: 'Source',\n Tile: 'Tile',\n Glyphs: 'Glyphs',\n SpriteImage: 'SpriteImage',\n SpriteJSON: 'SpriteJSON',\n Image: 'Image'\n};\nexport {ResourceType};\n\nif (typeof Object.freeze == 'function') {\n Object.freeze(ResourceType);\n}\n\n/**\n * A `RequestParameters` object to be returned from Map.options.transformRequest callbacks.\n * @typedef {Object} RequestParameters\n * @property {string} url The URL to be requested.\n * @property {Object} headers The headers to be sent with the request.\n * @property {string} method Request method `'GET' | 'POST' | 'PUT'`.\n * @property {string} body Request body.\n * @property {string} type Response body type to be returned `'string' | 'json' | 'arrayBuffer'`.\n * @property {string} credentials `'same-origin'|'include'` Use 'include' to send cookies with cross-origin requests.\n * @property {boolean} collectResourceTiming If true, Resource Timing API information will be collected for these transformed requests and returned in a resourceTiming property of relevant data events.\n * @example\n * // use transformRequest to modify requests that begin with `http://myHost`\n * transformRequest: function(url, resourceType) {\n * if (resourceType === 'Source' && url.indexOf('http://myHost') > -1) {\n * return {\n * url: url.replace('http', 'https'),\n * headers: { 'my-custom-header': true },\n * credentials: 'include' // Include cookies for cross-origin requests\n * }\n * }\n * }\n *\n */\nexport type RequestParameters = {\n url: string,\n headers?: Object,\n method?: 'GET' | 'POST' | 'PUT',\n body?: string,\n type?: 'string' | 'json' | 'arrayBuffer',\n credentials?: 'same-origin' | 'include',\n collectResourceTiming?: boolean\n};\n\nexport type ResponseCallback = (error: ?Error, data: ?T, cacheControl: ?string, expires: ?string) => void;\n\nclass AJAXError extends Error {\n status: number;\n url: string;\n constructor(message: string, status: number, url: string) {\n if (status === 401 && isMapboxHTTPURL(url)) {\n message += ': you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes';\n }\n super(message);\n this.status = status;\n this.url = url;\n\n // work around for https://github.com/Rich-Harris/buble/issues/40\n this.name = this.constructor.name;\n this.message = message;\n }\n\n toString() {\n return `${this.name}: ${this.message} (${this.status}): ${this.url}`;\n }\n}\n\n// Ensure that we're sending the correct referrer from blob URL worker bundles.\n// For files loaded from the local file system, `location.origin` will be set\n// to the string(!) \"null\" (Firefox), or \"file://\" (Chrome, Safari, Edge, IE),\n// and we will set an empty referrer. Otherwise, we're using the document's URL.\n/* global self */\nexport const getReferrer = isWorker() ?\n () => self.worker && self.worker.referrer :\n () => (window.location.protocol === 'blob:' ? window.parent : window).location.href;\n\n// Determines whether a URL is a file:// URL. This is obviously the case if it begins\n// with file://. Relative URLs are also file:// URLs iff the original document was loaded\n// via a file:// URL.\nconst isFileURL = url => /^file:/.test(url) || (/^file:/.test(getReferrer()) && !/^\\w+:/.test(url));\n\nfunction makeFetchRequest(requestParameters: RequestParameters, callback: ResponseCallback): Cancelable {\n const controller = new window.AbortController();\n const request = new window.Request(requestParameters.url, {\n method: requestParameters.method || 'GET',\n body: requestParameters.body,\n credentials: requestParameters.credentials,\n headers: requestParameters.headers,\n referrer: getReferrer(),\n signal: controller.signal\n });\n let complete = false;\n let aborted = false;\n\n const cacheIgnoringSearch = hasCacheDefeatingSku(request.url);\n\n if (requestParameters.type === 'json') {\n request.headers.set('Accept', 'application/json');\n }\n\n const validateOrFetch = (err, cachedResponse, responseIsFresh) => {\n if (aborted) return;\n\n if (err) {\n // Do fetch in case of cache error.\n // HTTP pages in Edge trigger a security error that can be ignored.\n if (err.message !== 'SecurityError') {\n warnOnce(err);\n }\n }\n\n if (cachedResponse && responseIsFresh) {\n return finishRequest(cachedResponse);\n }\n\n if (cachedResponse) {\n // We can't do revalidation with 'If-None-Match' because then the\n // request doesn't have simple cors headers.\n }\n\n const requestTime = Date.now();\n\n window.fetch(request).then(response => {\n if (response.ok) {\n const cacheableResponse = cacheIgnoringSearch ? response.clone() : null;\n return finishRequest(response, cacheableResponse, requestTime);\n\n } else {\n return callback(new AJAXError(response.statusText, response.status, requestParameters.url));\n }\n }).catch(error => {\n if (error.code === 20) {\n // silence expected AbortError\n return;\n }\n callback(new Error(error.message));\n });\n };\n\n const finishRequest = (response, cacheableResponse, requestTime) => {\n (\n requestParameters.type === 'arrayBuffer' ? response.arrayBuffer() :\n requestParameters.type === 'json' ? response.json() :\n response.text()\n ).then(result => {\n if (aborted) return;\n if (cacheableResponse && requestTime) {\n // The response needs to be inserted into the cache after it has completely loaded.\n // Until it is fully loaded there is a chance it will be aborted. Aborting while\n // reading the body can cause the cache insertion to error. We could catch this error\n // in most browsers but in Firefox it seems to sometimes crash the tab. Adding\n // it to the cache here avoids that error.\n cachePut(request, cacheableResponse, requestTime);\n }\n complete = true;\n callback(null, result, response.headers.get('Cache-Control'), response.headers.get('Expires'));\n }).catch(err => {\n if (!aborted) callback(new Error(err.message));\n });\n };\n\n if (cacheIgnoringSearch) {\n cacheGet(request, validateOrFetch);\n } else {\n validateOrFetch(null, null);\n }\n\n return {cancel: () => {\n aborted = true;\n if (!complete) controller.abort();\n }};\n}\n\nfunction makeXMLHttpRequest(requestParameters: RequestParameters, callback: ResponseCallback): Cancelable {\n const xhr: XMLHttpRequest = new window.XMLHttpRequest();\n\n xhr.open(requestParameters.method || 'GET', requestParameters.url, true);\n if (requestParameters.type === 'arrayBuffer') {\n xhr.responseType = 'arraybuffer';\n }\n for (const k in requestParameters.headers) {\n xhr.setRequestHeader(k, requestParameters.headers[k]);\n }\n if (requestParameters.type === 'json') {\n xhr.responseType = 'text';\n xhr.setRequestHeader('Accept', 'application/json');\n }\n xhr.withCredentials = requestParameters.credentials === 'include';\n xhr.onerror = () => {\n callback(new Error(xhr.statusText));\n };\n xhr.onload = () => {\n if (((xhr.status >= 200 && xhr.status < 300) || xhr.status === 0) && xhr.response !== null) {\n let data: mixed = xhr.response;\n if (requestParameters.type === 'json') {\n // We're manually parsing JSON here to get better error messages.\n try {\n data = JSON.parse(xhr.response);\n } catch (err) {\n return callback(err);\n }\n }\n callback(null, data, xhr.getResponseHeader('Cache-Control'), xhr.getResponseHeader('Expires'));\n } else {\n callback(new AJAXError(xhr.statusText, xhr.status, requestParameters.url));\n }\n };\n xhr.send(requestParameters.body);\n return {cancel: () => xhr.abort()};\n}\n\nexport const makeRequest = function(requestParameters: RequestParameters, callback: ResponseCallback): Cancelable {\n // We're trying to use the Fetch API if possible. However, in some situations we can't use it:\n // - IE11 doesn't support it at all. In this case, we dispatch the request to the main thread so\n // that we can get an accruate referrer header.\n // - Safari exposes window.AbortController, but it doesn't work actually abort any requests in\n // some versions (see https://bugs.webkit.org/show_bug.cgi?id=174980#c2)\n // - Requests for resources with the file:// URI scheme don't work with the Fetch API either. In\n // this case we unconditionally use XHR on the current thread since referrers don't matter.\n if (/:\\/\\//.test(requestParameters.url) && !(/^https?:|^file:/.test(requestParameters.url))) {\n if (isWorker() && self.worker && self.worker.actor) {\n return self.worker.actor.send('getResource', requestParameters, callback);\n }\n if (!isWorker()) {\n const protocol = requestParameters.url.substring(0, requestParameters.url.indexOf('://'));\n const action = config.REGISTERED_PROTOCOLS[protocol] || makeFetchRequest;\n return action(requestParameters, callback);\n }\n }\n if (!isFileURL(requestParameters.url)) {\n if (window.fetch && window.Request && window.AbortController && window.Request.prototype.hasOwnProperty('signal')) {\n return makeFetchRequest(requestParameters, callback);\n }\n if (isWorker() && self.worker && self.worker.actor) {\n const queueOnMainThread = true;\n return self.worker.actor.send('getResource', requestParameters, callback, undefined, queueOnMainThread);\n }\n }\n return makeXMLHttpRequest(requestParameters, callback);\n};\n\nexport const getJSON = function(requestParameters: RequestParameters, callback: ResponseCallback): Cancelable {\n return makeRequest(extend(requestParameters, {type: 'json'}), callback);\n};\n\nexport const getArrayBuffer = function(requestParameters: RequestParameters, callback: ResponseCallback): Cancelable {\n return makeRequest(extend(requestParameters, {type: 'arrayBuffer'}), callback);\n};\n\nexport const postData = function(requestParameters: RequestParameters, callback: ResponseCallback): Cancelable {\n return makeRequest(extend(requestParameters, {method: 'POST'}), callback);\n};\n\nfunction sameOrigin(url) {\n const a: HTMLAnchorElement = window.document.createElement('a');\n a.href = url;\n return a.protocol === window.document.location.protocol && a.host === window.document.location.host;\n}\n\nconst transparentPngUrl = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=';\n\nfunction arrayBufferToImage(data: ArrayBuffer, callback: (err: ?Error, image: ?HTMLImageElement) => void, cacheControl: ?string, expires: ?string) {\n const img: HTMLImageElement = new window.Image();\n const URL = window.URL;\n img.onload = () => {\n callback(null, img);\n URL.revokeObjectURL(img.src);\n // prevent image dataURI memory leak in Safari;\n // but don't free the image immediately because it might be uploaded in the next frame\n // https://github.com/mapbox/mapbox-gl-js/issues/10226\n img.onload = null;\n window.requestAnimationFrame(() => { img.src = transparentPngUrl; });\n };\n img.onerror = () => callback(new Error('Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.'));\n const blob: Blob = new window.Blob([new Uint8Array(data)], {type: 'image/png'});\n (img: any).cacheControl = cacheControl;\n (img: any).expires = expires;\n img.src = data.byteLength ? URL.createObjectURL(blob) : transparentPngUrl;\n}\n\nfunction arrayBufferToImageBitmap(data: ArrayBuffer, callback: (err: ?Error, image: ?ImageBitmap) => void) {\n const blob: Blob = new window.Blob([new Uint8Array(data)], {type: 'image/png'});\n window.createImageBitmap(blob).then((imgBitmap) => {\n callback(null, imgBitmap);\n }).catch((e) => {\n callback(new Error(`Could not load image because of ${e.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`));\n });\n}\n\nlet imageQueue, numImageRequests;\nexport const resetImageRequestQueue = () => {\n imageQueue = [];\n numImageRequests = 0;\n};\nresetImageRequestQueue();\n\nexport const getImage = function(requestParameters: RequestParameters, callback: Callback): Cancelable {\n if (webpSupported.supported) {\n if (!requestParameters.headers) {\n requestParameters.headers = {};\n }\n requestParameters.headers.accept = 'image/webp,*/*';\n }\n\n // limit concurrent image loads to help with raster sources performance on big screens\n if (numImageRequests >= config.MAX_PARALLEL_IMAGE_REQUESTS) {\n const queued = {\n requestParameters,\n callback,\n cancelled: false,\n cancel() { this.cancelled = true; }\n };\n imageQueue.push(queued);\n return queued;\n }\n numImageRequests++;\n\n let advanced = false;\n const advanceImageRequestQueue = () => {\n if (advanced) return;\n advanced = true;\n numImageRequests--;\n assert(numImageRequests >= 0);\n while (imageQueue.length && numImageRequests < config.MAX_PARALLEL_IMAGE_REQUESTS) { // eslint-disable-line\n const request = imageQueue.shift();\n const {requestParameters, callback, cancelled} = request;\n if (!cancelled) {\n request.cancel = getImage(requestParameters, callback).cancel;\n }\n }\n };\n\n // request the image with XHR to work around caching issues\n // see https://github.com/mapbox/mapbox-gl-js/issues/1470\n const request = getArrayBuffer(requestParameters, (err: ?Error, data: ?ArrayBuffer, cacheControl: ?string, expires: ?string) => {\n\n advanceImageRequestQueue();\n\n if (err) {\n callback(err);\n } else if (data) {\n if (offscreenCanvasSupported()) {\n arrayBufferToImageBitmap(data, callback);\n } else {\n arrayBufferToImage(data, callback, cacheControl, expires);\n }\n }\n });\n\n return {\n cancel: () => {\n request.cancel();\n advanceImageRequestQueue();\n }\n };\n};\n\nexport const getVideo = function(urls: Array, callback: Callback): Cancelable {\n const video: HTMLVideoElement = window.document.createElement('video');\n video.muted = true;\n video.onloadstart = function() {\n callback(null, video);\n };\n for (let i = 0; i < urls.length; i++) {\n const s: HTMLSourceElement = window.document.createElement('source');\n if (!sameOrigin(urls[i])) {\n video.crossOrigin = 'Anonymous';\n }\n s.src = urls[i];\n video.appendChild(s);\n }\n return {cancel: () => {}};\n};\n","// @flow\n\nimport {extend} from './util';\n\ntype Listener = (Object) => any;\ntype Listeners = {[_: string]: Array };\n\nfunction _addEventListener(type: string, listener: Listener, listenerList: Listeners) {\n const listenerExists = listenerList[type] && listenerList[type].indexOf(listener) !== -1;\n if (!listenerExists) {\n listenerList[type] = listenerList[type] || [];\n listenerList[type].push(listener);\n }\n}\n\nfunction _removeEventListener(type: string, listener: Listener, listenerList: Listeners) {\n if (listenerList && listenerList[type]) {\n const index = listenerList[type].indexOf(listener);\n if (index !== -1) {\n listenerList[type].splice(index, 1);\n }\n }\n}\n\nexport class Event {\n +type: string;\n\n constructor(type: string, data: Object = {}) {\n extend(this, data);\n this.type = type;\n }\n}\n\ninterface ErrorLike {\n message: string;\n}\n\nexport class ErrorEvent extends Event {\n error: ErrorLike;\n\n constructor(error: ErrorLike, data: Object = {}) {\n super('error', extend({error}, data));\n }\n}\n\n/**\n * Methods mixed in to other classes for event capabilities.\n *\n * @mixin Evented\n */\nexport class Evented {\n _listeners: Listeners;\n _oneTimeListeners: Listeners;\n _eventedParent: ?Evented;\n _eventedParentData: ?(Object | () => Object);\n\n /**\n * Adds a listener to a specified event type.\n *\n * @param {string} type The event type to add a listen for.\n * @param {Function} listener The function to be called when the event is fired.\n * The listener function is called with the data object passed to `fire`,\n * extended with `target` and `type` properties.\n * @returns {Object} `this`\n */\n on(type: *, listener: Listener): this {\n this._listeners = this._listeners || {};\n _addEventListener(type, listener, this._listeners);\n\n return this;\n }\n\n /**\n * Removes a previously registered event listener.\n *\n * @param {string} type The event type to remove listeners for.\n * @param {Function} listener The listener function to remove.\n * @returns {Object} `this`\n */\n off(type: *, listener: Listener) {\n _removeEventListener(type, listener, this._listeners);\n _removeEventListener(type, listener, this._oneTimeListeners);\n\n return this;\n }\n\n /**\n * Adds a listener that will be called only once to a specified event type.\n *\n * The listener will be called first time the event fires after the listener is registered.\n *\n * @param {string} type The event type to listen for.\n * @param {Function} listener The function to be called when the event is fired the first time.\n * @returns {Object} `this`\n */\n once(type: *, listener: Listener) {\n this._oneTimeListeners = this._oneTimeListeners || {};\n _addEventListener(type, listener, this._oneTimeListeners);\n\n return this;\n }\n\n fire(event: Event, properties?: Object) {\n // Compatibility with (type: string, properties: Object) signature from previous versions.\n // See https://github.com/mapbox/mapbox-gl-js/issues/6522,\n // https://github.com/mapbox/mapbox-gl-draw/issues/766\n if (typeof event === 'string') {\n event = new Event(event, properties || {});\n }\n\n const type = event.type;\n\n if (this.listens(type)) {\n (event: any).target = this;\n\n // make sure adding or removing listeners inside other listeners won't cause an infinite loop\n const listeners = this._listeners && this._listeners[type] ? this._listeners[type].slice() : [];\n for (const listener of listeners) {\n listener.call(this, event);\n }\n\n const oneTimeListeners = this._oneTimeListeners && this._oneTimeListeners[type] ? this._oneTimeListeners[type].slice() : [];\n for (const listener of oneTimeListeners) {\n _removeEventListener(type, listener, this._oneTimeListeners);\n listener.call(this, event);\n }\n\n const parent = this._eventedParent;\n if (parent) {\n extend(\n event,\n typeof this._eventedParentData === 'function' ? this._eventedParentData() : this._eventedParentData\n );\n parent.fire(event);\n }\n\n // To ensure that no error events are dropped, print them to the\n // console if they have no listeners.\n } else if (event instanceof ErrorEvent) {\n console.error(event.error);\n }\n\n return this;\n }\n\n /**\n * Returns a true if this instance of Evented or any forwardeed instances of Evented have a listener for the specified type.\n *\n * @param {string} type The event type\n * @returns {boolean} `true` if there is at least one registered listener for specified event type, `false` otherwise\n * @private\n */\n listens(type: string) {\n return (\n (this._listeners && this._listeners[type] && this._listeners[type].length > 0) ||\n (this._oneTimeListeners && this._oneTimeListeners[type] && this._oneTimeListeners[type].length > 0) ||\n (this._eventedParent && this._eventedParent.listens(type))\n );\n }\n\n /**\n * Bubble all events fired by this instance of Evented to this parent instance of Evented.\n *\n * @private\n * @returns {Object} `this`\n * @private\n */\n setEventedParent(parent: ?Evented, data?: Object | () => Object) {\n this._eventedParent = parent;\n this._eventedParentData = data;\n\n return this;\n }\n}\n","// @flow\n\n// Note: Do not inherit from Error. It breaks when transpiling to ES5.\n\nexport default class ValidationError {\n message: string;\n identifier: ?string;\n line: ?number;\n\n constructor(key: ?string, value: ?{ __line__: number }, message: string, identifier: ?string) {\n this.message = (key ? `${key}: ` : '') + message;\n if (identifier) this.identifier = identifier;\n\n if (value !== null && value !== undefined && value.__line__) {\n this.line = value.__line__;\n }\n }\n}\n","\nimport ValidationError from '../error/validation_error';\n\nexport default function validateConstants(options) {\n const key = options.key;\n const constants = options.value;\n\n if (constants) {\n return [new ValidationError(key, constants, 'constants have been deprecated as of v8')];\n } else {\n return [];\n }\n}\n","// @flow\n\nexport default function (output: any, ...inputs: Array) {\n for (const input of inputs) {\n for (const k in input) {\n output[k] = input[k];\n }\n }\n return output;\n}\n","// @flow\n\n// Turn jsonlint-lines-primitives objects into primitive objects\nexport function unbundle(value: mixed) {\n if (value instanceof Number || value instanceof String || value instanceof Boolean) {\n return value.valueOf();\n } else {\n return value;\n }\n}\n\nexport function deepUnbundle(value: mixed): mixed {\n if (Array.isArray(value)) {\n return value.map(deepUnbundle);\n } else if (value instanceof Object && !(value instanceof Number || value instanceof String || value instanceof Boolean)) {\n const unbundledValue: { [key: string]: mixed } = {};\n for (const key in value) {\n unbundledValue[key] = deepUnbundle(value[key]);\n }\n return unbundledValue;\n }\n\n return unbundle(value);\n}\n","// @flow\n\nclass ParsingError extends Error {\n key: string;\n message: string;\n constructor(key: string, message: string) {\n super(message);\n this.message = message;\n this.key = key;\n }\n}\n\nexport default ParsingError;\n","// @flow\n\nimport type {Expression} from './expression';\n\n/**\n * Tracks `let` bindings during expression parsing.\n * @private\n */\nclass Scope {\n parent: ?Scope;\n bindings: {[_: string]: Expression};\n constructor(parent?: Scope, bindings: Array<[string, Expression]> = []) {\n this.parent = parent;\n this.bindings = {};\n for (const [name, expression] of bindings) {\n this.bindings[name] = expression;\n }\n }\n\n concat(bindings: Array<[string, Expression]>) {\n return new Scope(this, bindings);\n }\n\n get(name: string): Expression {\n if (this.bindings[name]) { return this.bindings[name]; }\n if (this.parent) { return this.parent.get(name); }\n throw new Error(`${name} not found in scope.`);\n }\n\n has(name: string): boolean {\n if (this.bindings[name]) return true;\n return this.parent ? this.parent.has(name) : false;\n }\n}\n\nexport default Scope;\n","// @flow\n\nexport type NullTypeT = { kind: 'null' };\nexport type NumberTypeT = { kind: 'number' };\nexport type StringTypeT = { kind: 'string' };\nexport type BooleanTypeT = { kind: 'boolean' };\nexport type ColorTypeT = { kind: 'color' };\nexport type ObjectTypeT = { kind: 'object' };\nexport type ValueTypeT = { kind: 'value' };\nexport type ErrorTypeT = { kind: 'error' };\nexport type CollatorTypeT = { kind: 'collator' };\nexport type FormattedTypeT = { kind: 'formatted' };\nexport type ResolvedImageTypeT = { kind: 'resolvedImage' };\n\nexport type EvaluationKind = 'constant' | 'source' | 'camera' | 'composite';\n\nexport type Type =\n NullTypeT |\n NumberTypeT |\n StringTypeT |\n BooleanTypeT |\n ColorTypeT |\n ObjectTypeT |\n ValueTypeT |\n ArrayType | // eslint-disable-line no-use-before-define\n ErrorTypeT |\n CollatorTypeT |\n FormattedTypeT |\n ResolvedImageTypeT\n\nexport type ArrayType = {\n kind: 'array',\n itemType: Type,\n N: ?number\n}\n\nexport type NativeType = 'number' | 'string' | 'boolean' | 'null' | 'array' | 'object'\n\nexport const NullType = {kind: 'null'};\nexport const NumberType = {kind: 'number'};\nexport const StringType = {kind: 'string'};\nexport const BooleanType = {kind: 'boolean'};\nexport const ColorType = {kind: 'color'};\nexport const ObjectType = {kind: 'object'};\nexport const ValueType = {kind: 'value'};\nexport const ErrorType = {kind: 'error'};\nexport const CollatorType = {kind: 'collator'};\nexport const FormattedType = {kind: 'formatted'};\nexport const ResolvedImageType = {kind: 'resolvedImage'};\n\nexport function array(itemType: Type, N: ?number): ArrayType {\n return {\n kind: 'array',\n itemType,\n N\n };\n}\n\nexport function toString(type: Type): string {\n if (type.kind === 'array') {\n const itemType = toString(type.itemType);\n return typeof type.N === 'number' ?\n `array<${itemType}, ${type.N}>` :\n type.itemType.kind === 'value' ? 'array' : `array<${itemType}>`;\n } else {\n return type.kind;\n }\n}\n\nconst valueMemberTypes = [\n NullType,\n NumberType,\n StringType,\n BooleanType,\n ColorType,\n FormattedType,\n ObjectType,\n array(ValueType),\n ResolvedImageType\n];\n\n/**\n * Returns null if `t` is a subtype of `expected`; otherwise returns an\n * error message.\n * @private\n */\nexport function checkSubtype(expected: Type, t: Type): ?string {\n if (t.kind === 'error') {\n // Error is a subtype of every type\n return null;\n } else if (expected.kind === 'array') {\n if (t.kind === 'array' &&\n ((t.N === 0 && t.itemType.kind === 'value') || !checkSubtype(expected.itemType, t.itemType)) &&\n (typeof expected.N !== 'number' || expected.N === t.N)) {\n return null;\n }\n } else if (expected.kind === t.kind) {\n return null;\n } else if (expected.kind === 'value') {\n for (const memberType of valueMemberTypes) {\n if (!checkSubtype(memberType, t)) {\n return null;\n }\n }\n }\n\n return `Expected ${toString(expected)} but found ${toString(t)} instead.`;\n}\n\nexport function isValidType(provided: Type, allowedTypes: Array): boolean {\n return allowedTypes.some(t => t.kind === provided.kind);\n}\n\nexport function isValidNativeType(provided: any, allowedTypes: Array): boolean {\n return allowedTypes.some(t => {\n if (t === 'null') {\n return provided === null;\n } else if (t === 'array') {\n return Array.isArray(provided);\n } else if (t === 'object') {\n return provided && !Array.isArray(provided) && typeof provided === 'object';\n } else {\n return t === typeof provided;\n }\n });\n}\n","// (c) Dean McNamee , 2012.\n//\n// https://github.com/deanm/css-color-parser-js\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to\n// deal in the Software without restriction, including without limitation the\n// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n// sell copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n// IN THE SOFTWARE.\n\n// http://www.w3.org/TR/css3-color/\nvar kCSSColorTable = {\n \"transparent\": [0,0,0,0], \"aliceblue\": [240,248,255,1],\n \"antiquewhite\": [250,235,215,1], \"aqua\": [0,255,255,1],\n \"aquamarine\": [127,255,212,1], \"azure\": [240,255,255,1],\n \"beige\": [245,245,220,1], \"bisque\": [255,228,196,1],\n \"black\": [0,0,0,1], \"blanchedalmond\": [255,235,205,1],\n \"blue\": [0,0,255,1], \"blueviolet\": [138,43,226,1],\n \"brown\": [165,42,42,1], \"burlywood\": [222,184,135,1],\n \"cadetblue\": [95,158,160,1], \"chartreuse\": [127,255,0,1],\n \"chocolate\": [210,105,30,1], \"coral\": [255,127,80,1],\n \"cornflowerblue\": [100,149,237,1], \"cornsilk\": [255,248,220,1],\n \"crimson\": [220,20,60,1], \"cyan\": [0,255,255,1],\n \"darkblue\": [0,0,139,1], \"darkcyan\": [0,139,139,1],\n \"darkgoldenrod\": [184,134,11,1], \"darkgray\": [169,169,169,1],\n \"darkgreen\": [0,100,0,1], \"darkgrey\": [169,169,169,1],\n \"darkkhaki\": [189,183,107,1], \"darkmagenta\": [139,0,139,1],\n \"darkolivegreen\": [85,107,47,1], \"darkorange\": [255,140,0,1],\n \"darkorchid\": [153,50,204,1], \"darkred\": [139,0,0,1],\n \"darksalmon\": [233,150,122,1], \"darkseagreen\": [143,188,143,1],\n \"darkslateblue\": [72,61,139,1], \"darkslategray\": [47,79,79,1],\n \"darkslategrey\": [47,79,79,1], \"darkturquoise\": [0,206,209,1],\n \"darkviolet\": [148,0,211,1], \"deeppink\": [255,20,147,1],\n \"deepskyblue\": [0,191,255,1], \"dimgray\": [105,105,105,1],\n \"dimgrey\": [105,105,105,1], \"dodgerblue\": [30,144,255,1],\n \"firebrick\": [178,34,34,1], \"floralwhite\": [255,250,240,1],\n \"forestgreen\": [34,139,34,1], \"fuchsia\": [255,0,255,1],\n \"gainsboro\": [220,220,220,1], \"ghostwhite\": [248,248,255,1],\n \"gold\": [255,215,0,1], \"goldenrod\": [218,165,32,1],\n \"gray\": [128,128,128,1], \"green\": [0,128,0,1],\n \"greenyellow\": [173,255,47,1], \"grey\": [128,128,128,1],\n \"honeydew\": [240,255,240,1], \"hotpink\": [255,105,180,1],\n \"indianred\": [205,92,92,1], \"indigo\": [75,0,130,1],\n \"ivory\": [255,255,240,1], \"khaki\": [240,230,140,1],\n \"lavender\": [230,230,250,1], \"lavenderblush\": [255,240,245,1],\n \"lawngreen\": [124,252,0,1], \"lemonchiffon\": [255,250,205,1],\n \"lightblue\": [173,216,230,1], \"lightcoral\": [240,128,128,1],\n \"lightcyan\": [224,255,255,1], \"lightgoldenrodyellow\": [250,250,210,1],\n \"lightgray\": [211,211,211,1], \"lightgreen\": [144,238,144,1],\n \"lightgrey\": [211,211,211,1], \"lightpink\": [255,182,193,1],\n \"lightsalmon\": [255,160,122,1], \"lightseagreen\": [32,178,170,1],\n \"lightskyblue\": [135,206,250,1], \"lightslategray\": [119,136,153,1],\n \"lightslategrey\": [119,136,153,1], \"lightsteelblue\": [176,196,222,1],\n \"lightyellow\": [255,255,224,1], \"lime\": [0,255,0,1],\n \"limegreen\": [50,205,50,1], \"linen\": [250,240,230,1],\n \"magenta\": [255,0,255,1], \"maroon\": [128,0,0,1],\n \"mediumaquamarine\": [102,205,170,1], \"mediumblue\": [0,0,205,1],\n \"mediumorchid\": [186,85,211,1], \"mediumpurple\": [147,112,219,1],\n \"mediumseagreen\": [60,179,113,1], \"mediumslateblue\": [123,104,238,1],\n \"mediumspringgreen\": [0,250,154,1], \"mediumturquoise\": [72,209,204,1],\n \"mediumvioletred\": [199,21,133,1], \"midnightblue\": [25,25,112,1],\n \"mintcream\": [245,255,250,1], \"mistyrose\": [255,228,225,1],\n \"moccasin\": [255,228,181,1], \"navajowhite\": [255,222,173,1],\n \"navy\": [0,0,128,1], \"oldlace\": [253,245,230,1],\n \"olive\": [128,128,0,1], \"olivedrab\": [107,142,35,1],\n \"orange\": [255,165,0,1], \"orangered\": [255,69,0,1],\n \"orchid\": [218,112,214,1], \"palegoldenrod\": [238,232,170,1],\n \"palegreen\": [152,251,152,1], \"paleturquoise\": [175,238,238,1],\n \"palevioletred\": [219,112,147,1], \"papayawhip\": [255,239,213,1],\n \"peachpuff\": [255,218,185,1], \"peru\": [205,133,63,1],\n \"pink\": [255,192,203,1], \"plum\": [221,160,221,1],\n \"powderblue\": [176,224,230,1], \"purple\": [128,0,128,1],\n \"rebeccapurple\": [102,51,153,1],\n \"red\": [255,0,0,1], \"rosybrown\": [188,143,143,1],\n \"royalblue\": [65,105,225,1], \"saddlebrown\": [139,69,19,1],\n \"salmon\": [250,128,114,1], \"sandybrown\": [244,164,96,1],\n \"seagreen\": [46,139,87,1], \"seashell\": [255,245,238,1],\n \"sienna\": [160,82,45,1], \"silver\": [192,192,192,1],\n \"skyblue\": [135,206,235,1], \"slateblue\": [106,90,205,1],\n \"slategray\": [112,128,144,1], \"slategrey\": [112,128,144,1],\n \"snow\": [255,250,250,1], \"springgreen\": [0,255,127,1],\n \"steelblue\": [70,130,180,1], \"tan\": [210,180,140,1],\n \"teal\": [0,128,128,1], \"thistle\": [216,191,216,1],\n \"tomato\": [255,99,71,1], \"turquoise\": [64,224,208,1],\n \"violet\": [238,130,238,1], \"wheat\": [245,222,179,1],\n \"white\": [255,255,255,1], \"whitesmoke\": [245,245,245,1],\n \"yellow\": [255,255,0,1], \"yellowgreen\": [154,205,50,1]}\n\nfunction clamp_css_byte(i) { // Clamp to integer 0 .. 255.\n i = Math.round(i); // Seems to be what Chrome does (vs truncation).\n return i < 0 ? 0 : i > 255 ? 255 : i;\n}\n\nfunction clamp_css_float(f) { // Clamp to float 0.0 .. 1.0.\n return f < 0 ? 0 : f > 1 ? 1 : f;\n}\n\nfunction parse_css_int(str) { // int or percentage.\n if (str[str.length - 1] === '%')\n return clamp_css_byte(parseFloat(str) / 100 * 255);\n return clamp_css_byte(parseInt(str));\n}\n\nfunction parse_css_float(str) { // float or percentage.\n if (str[str.length - 1] === '%')\n return clamp_css_float(parseFloat(str) / 100);\n return clamp_css_float(parseFloat(str));\n}\n\nfunction css_hue_to_rgb(m1, m2, h) {\n if (h < 0) h += 1;\n else if (h > 1) h -= 1;\n\n if (h * 6 < 1) return m1 + (m2 - m1) * h * 6;\n if (h * 2 < 1) return m2;\n if (h * 3 < 2) return m1 + (m2 - m1) * (2/3 - h) * 6;\n return m1;\n}\n\nfunction parseCSSColor(css_str) {\n // Remove all whitespace, not compliant, but should just be more accepting.\n var str = css_str.replace(/ /g, '').toLowerCase();\n\n // Color keywords (and transparent) lookup.\n if (str in kCSSColorTable) return kCSSColorTable[str].slice(); // dup.\n\n // #abc and #abc123 syntax.\n if (str[0] === '#') {\n if (str.length === 4) {\n var iv = parseInt(str.substr(1), 16); // TODO(deanm): Stricter parsing.\n if (!(iv >= 0 && iv <= 0xfff)) return null; // Covers NaN.\n return [((iv & 0xf00) >> 4) | ((iv & 0xf00) >> 8),\n (iv & 0xf0) | ((iv & 0xf0) >> 4),\n (iv & 0xf) | ((iv & 0xf) << 4),\n 1];\n } else if (str.length === 7) {\n var iv = parseInt(str.substr(1), 16); // TODO(deanm): Stricter parsing.\n if (!(iv >= 0 && iv <= 0xffffff)) return null; // Covers NaN.\n return [(iv & 0xff0000) >> 16,\n (iv & 0xff00) >> 8,\n iv & 0xff,\n 1];\n }\n\n return null;\n }\n\n var op = str.indexOf('('), ep = str.indexOf(')');\n if (op !== -1 && ep + 1 === str.length) {\n var fname = str.substr(0, op);\n var params = str.substr(op+1, ep-(op+1)).split(',');\n var alpha = 1; // To allow case fallthrough.\n switch (fname) {\n case 'rgba':\n if (params.length !== 4) return null;\n alpha = parse_css_float(params.pop());\n // Fall through.\n case 'rgb':\n if (params.length !== 3) return null;\n return [parse_css_int(params[0]),\n parse_css_int(params[1]),\n parse_css_int(params[2]),\n alpha];\n case 'hsla':\n if (params.length !== 4) return null;\n alpha = parse_css_float(params.pop());\n // Fall through.\n case 'hsl':\n if (params.length !== 3) return null;\n var h = (((parseFloat(params[0]) % 360) + 360) % 360) / 360; // 0 .. 1\n // NOTE(deanm): According to the CSS spec s/l should only be\n // percentages, but we don't bother and let float or percentage.\n var s = parse_css_float(params[1]);\n var l = parse_css_float(params[2]);\n var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;\n var m1 = l * 2 - m2;\n return [clamp_css_byte(css_hue_to_rgb(m1, m2, h+1/3) * 255),\n clamp_css_byte(css_hue_to_rgb(m1, m2, h) * 255),\n clamp_css_byte(css_hue_to_rgb(m1, m2, h-1/3) * 255),\n alpha];\n default:\n return null;\n }\n }\n\n return null;\n}\n\ntry { exports.parseCSSColor = parseCSSColor } catch(e) { }\n","// @flow\n\nimport {parseCSSColor} from 'csscolorparser';\n\n/**\n * An RGBA color value. Create instances from color strings using the static\n * method `Color.parse`. The constructor accepts RGB channel values in the range\n * `[0, 1]`, premultiplied by A.\n *\n * @param {number} r The red channel.\n * @param {number} g The green channel.\n * @param {number} b The blue channel.\n * @param {number} a The alpha channel.\n * @private\n */\nclass Color {\n r: number;\n g: number;\n b: number;\n a: number;\n\n constructor(r: number, g: number, b: number, a: number = 1) {\n this.r = r;\n this.g = g;\n this.b = b;\n this.a = a;\n }\n\n static black: Color;\n static white: Color;\n static transparent: Color;\n static red: Color;\n\n /**\n * Parses valid CSS color strings and returns a `Color` instance.\n * @returns A `Color` instance, or `undefined` if the input is not a valid color string.\n */\n static parse(input?: string | Color | null): Color | void {\n if (!input) {\n return undefined;\n }\n\n if (input instanceof Color) {\n return input;\n }\n\n if (typeof input !== 'string') {\n return undefined;\n }\n\n const rgba = parseCSSColor(input);\n if (!rgba) {\n return undefined;\n }\n\n return new Color(\n rgba[0] / 255 * rgba[3],\n rgba[1] / 255 * rgba[3],\n rgba[2] / 255 * rgba[3],\n rgba[3]\n );\n }\n\n /**\n * Returns an RGBA string representing the color value.\n *\n * @returns An RGBA string.\n * @example\n * var purple = new Color.parse('purple');\n * purple.toString; // = \"rgba(128,0,128,1)\"\n * var translucentGreen = new Color.parse('rgba(26, 207, 26, .73)');\n * translucentGreen.toString(); // = \"rgba(26,207,26,0.73)\"\n */\n toString(): string {\n const [r, g, b, a] = this.toArray();\n return `rgba(${Math.round(r)},${Math.round(g)},${Math.round(b)},${a})`;\n }\n\n toArray(): [number, number, number, number] {\n const {r, g, b, a} = this;\n return a === 0 ? [0, 0, 0, 0] : [\n r * 255 / a,\n g * 255 / a,\n b * 255 / a,\n a\n ];\n }\n}\n\nColor.black = new Color(0, 0, 0, 1);\nColor.white = new Color(1, 1, 1, 1);\nColor.transparent = new Color(0, 0, 0, 0);\nColor.red = new Color(1, 0, 0, 1);\n\nexport default Color;\n","// @flow\n\n// Flow type declarations for Intl cribbed from\n// https://github.com/facebook/flow/issues/1270\n\ndeclare var Intl: {\n Collator: Class\n};\n\ndeclare class Intl$Collator {\n constructor (\n locales?: string | string[],\n options?: CollatorOptions\n ): Intl$Collator;\n\n static (\n locales?: string | string[],\n options?: CollatorOptions\n ): Intl$Collator;\n\n compare (a: string, b: string): number;\n\n resolvedOptions(): any;\n}\n\ntype CollatorOptions = {\n localeMatcher?: 'lookup' | 'best fit',\n usage?: 'sort' | 'search',\n sensitivity?: 'base' | 'accent' | 'case' | 'variant',\n ignorePunctuation?: boolean,\n numeric?: boolean,\n caseFirst?: 'upper' | 'lower' | 'false'\n}\n\nexport default class Collator {\n locale: string | null;\n sensitivity: 'base' | 'accent' | 'case' | 'variant';\n collator: Intl$Collator;\n\n constructor(caseSensitive: boolean, diacriticSensitive: boolean, locale: string | null) {\n if (caseSensitive)\n this.sensitivity = diacriticSensitive ? 'variant' : 'case';\n else\n this.sensitivity = diacriticSensitive ? 'accent' : 'base';\n\n this.locale = locale;\n this.collator = new Intl.Collator(this.locale ? this.locale : [],\n {sensitivity: this.sensitivity, usage: 'search'});\n }\n\n compare(lhs: string, rhs: string): number {\n return this.collator.compare(lhs, rhs);\n }\n\n resolvedLocale(): string {\n // We create a Collator without \"usage: search\" because we don't want\n // the search options encoded in our result (e.g. \"en-u-co-search\")\n return new Intl.Collator(this.locale ? this.locale : [])\n .resolvedOptions().locale;\n }\n}\n","// @flow\nimport type Color from '../../util/color';\nimport type ResolvedImage from '../types/resolved_image';\n\nexport class FormattedSection {\n text: string;\n image: ResolvedImage | null;\n scale: number | null;\n fontStack: string | null;\n textColor: Color | null;\n\n constructor(text: string, image: ResolvedImage | null, scale: number | null, fontStack: string | null, textColor: Color | null) {\n this.text = text;\n this.image = image;\n this.scale = scale;\n this.fontStack = fontStack;\n this.textColor = textColor;\n }\n}\n\nexport default class Formatted {\n sections: Array;\n\n constructor(sections: Array) {\n this.sections = sections;\n }\n\n static fromString(unformatted: string): Formatted {\n return new Formatted([new FormattedSection(unformatted, null, null, null, null)]);\n }\n\n isEmpty(): boolean {\n if (this.sections.length === 0) return true;\n return !this.sections.some(section => section.text.length !== 0 ||\n (section.image && section.image.name.length !== 0));\n }\n\n static factory(text: Formatted | string): Formatted {\n if (text instanceof Formatted) {\n return text;\n } else {\n return Formatted.fromString(text);\n }\n }\n\n toString(): string {\n if (this.sections.length === 0) return '';\n return this.sections.map(section => section.text).join('');\n }\n\n serialize(): Array {\n const serialized: Array = [\"format\"];\n for (const section of this.sections) {\n if (section.image) {\n serialized.push([\"image\", section.image.name]);\n continue;\n }\n serialized.push(section.text);\n const options: { [key: string]: mixed } = {};\n if (section.fontStack) {\n options[\"text-font\"] = [\"literal\", section.fontStack.split(',')];\n }\n if (section.scale) {\n options[\"font-scale\"] = section.scale;\n }\n if (section.textColor) {\n options[\"text-color\"] = ([\"rgba\"]: Array).concat(section.textColor.toArray());\n }\n serialized.push(options);\n }\n return serialized;\n }\n}\n","// @flow\n\nexport type ResolvedImageOptions = {\n name: string,\n available: boolean\n};\n\nexport default class ResolvedImage {\n name: string;\n available: boolean;\n\n constructor(options: ResolvedImageOptions) {\n this.name = options.name;\n this.available = options.available;\n }\n\n toString(): string {\n return this.name;\n }\n\n static fromString(name: string): ResolvedImage | null {\n if (!name) return null; // treat empty values as no image\n return new ResolvedImage({name, available: false});\n }\n\n serialize(): Array {\n return [\"image\", this.name];\n }\n}\n","// @flow\n\nimport assert from 'assert';\n\nimport Color from '../util/color';\nimport Collator from './types/collator';\nimport Formatted from './types/formatted';\nimport ResolvedImage from './types/resolved_image';\nimport {NullType, NumberType, StringType, BooleanType, ColorType, ObjectType, ValueType, CollatorType, FormattedType, ResolvedImageType, array} from './types';\n\nimport type {Type} from './types';\n\nexport function validateRGBA(r: mixed, g: mixed, b: mixed, a?: mixed): string | null {\n if (!(\n typeof r === 'number' && r >= 0 && r <= 255 &&\n typeof g === 'number' && g >= 0 && g <= 255 &&\n typeof b === 'number' && b >= 0 && b <= 255\n )) {\n const value = typeof a === 'number' ? [r, g, b, a] : [r, g, b];\n return `Invalid rgba value [${value.join(', ')}]: 'r', 'g', and 'b' must be between 0 and 255.`;\n }\n\n if (!(\n typeof a === 'undefined' || (typeof a === 'number' && a >= 0 && a <= 1)\n )) {\n return `Invalid rgba value [${[r, g, b, a].join(', ')}]: 'a' must be between 0 and 1.`;\n }\n\n return null;\n}\n\nexport type Value = null | string | boolean | number | Color | Collator | Formatted | ResolvedImage | $ReadOnlyArray | { +[string]: Value }\n\nexport function isValue(mixed: mixed): boolean {\n if (mixed === null) {\n return true;\n } else if (typeof mixed === 'string') {\n return true;\n } else if (typeof mixed === 'boolean') {\n return true;\n } else if (typeof mixed === 'number') {\n return true;\n } else if (mixed instanceof Color) {\n return true;\n } else if (mixed instanceof Collator) {\n return true;\n } else if (mixed instanceof Formatted) {\n return true;\n } else if (mixed instanceof ResolvedImage) {\n return true;\n } else if (Array.isArray(mixed)) {\n for (const item of mixed) {\n if (!isValue(item)) {\n return false;\n }\n }\n return true;\n } else if (typeof mixed === 'object') {\n for (const key in mixed) {\n if (!isValue(mixed[key])) {\n return false;\n }\n }\n return true;\n } else {\n return false;\n }\n}\n\nexport function typeOf(value: Value): Type {\n if (value === null) {\n return NullType;\n } else if (typeof value === 'string') {\n return StringType;\n } else if (typeof value === 'boolean') {\n return BooleanType;\n } else if (typeof value === 'number') {\n return NumberType;\n } else if (value instanceof Color) {\n return ColorType;\n } else if (value instanceof Collator) {\n return CollatorType;\n } else if (value instanceof Formatted) {\n return FormattedType;\n } else if (value instanceof ResolvedImage) {\n return ResolvedImageType;\n } else if (Array.isArray(value)) {\n const length = value.length;\n let itemType: Type | typeof undefined;\n\n for (const item of value) {\n const t = typeOf(item);\n if (!itemType) {\n itemType = t;\n } else if (itemType === t) {\n continue;\n } else {\n itemType = ValueType;\n break;\n }\n }\n\n return array(itemType || ValueType, length);\n } else {\n assert(typeof value === 'object');\n return ObjectType;\n }\n}\n\nexport function toString(value: Value) {\n const type = typeof value;\n if (value === null) {\n return '';\n } else if (type === 'string' || type === 'number' || type === 'boolean') {\n return String(value);\n } else if (value instanceof Color || value instanceof Formatted || value instanceof ResolvedImage) {\n return value.toString();\n } else {\n return JSON.stringify(value);\n }\n}\n\nexport {Color, Collator};\n","// @flow\n\nimport assert from 'assert';\nimport {isValue, typeOf, Color} from '../values';\nimport Formatted from '../types/formatted';\n\nimport type {Type} from '../types';\nimport type {Value} from '../values';\nimport type {Expression} from '../expression';\nimport type ParsingContext from '../parsing_context';\n\nclass Literal implements Expression {\n type: Type;\n value: Value;\n\n constructor(type: Type, value: Value) {\n this.type = type;\n this.value = value;\n }\n\n static parse(args: $ReadOnlyArray, context: ParsingContext) {\n if (args.length !== 2)\n return context.error(`'literal' expression requires exactly one argument, but found ${args.length - 1} instead.`);\n\n if (!isValue(args[1]))\n return context.error(`invalid value`);\n\n const value = (args[1]: any);\n let type = typeOf(value);\n\n // special case: infer the item type if possible for zero-length arrays\n const expected = context.expectedType;\n if (\n type.kind === 'array' &&\n type.N === 0 &&\n expected &&\n expected.kind === 'array' &&\n (typeof expected.N !== 'number' || expected.N === 0)\n ) {\n type = expected;\n }\n\n return new Literal(type, value);\n }\n\n evaluate() {\n return this.value;\n }\n\n eachChild() {}\n\n outputDefined() {\n return true;\n }\n\n serialize(): Array {\n if (this.type.kind === 'array' || this.type.kind === 'object') {\n return [\"literal\", this.value];\n } else if (this.value instanceof Color) {\n // Constant-folding can generate Literal expressions that you\n // couldn't actually generate with a \"literal\" expression,\n // so we have to implement an equivalent serialization here\n return [\"rgba\"].concat(this.value.toArray());\n } else if (this.value instanceof Formatted) {\n // Same as Color\n return this.value.serialize();\n } else {\n assert(this.value === null ||\n typeof this.value === 'string' ||\n typeof this.value === 'number' ||\n typeof this.value === 'boolean');\n return (this.value: any);\n }\n }\n}\n\nexport default Literal;\n","// @flow\n\nclass RuntimeError {\n name: string;\n message: string;\n\n constructor(message: string) {\n this.name = 'ExpressionEvaluationError';\n this.message = message;\n }\n\n toJSON() {\n return this.message;\n }\n}\n\nexport default RuntimeError;\n","// @flow\n\nimport assert from 'assert';\n\nimport {\n ObjectType,\n ValueType,\n StringType,\n NumberType,\n BooleanType,\n checkSubtype,\n toString,\n array\n} from '../types';\nimport RuntimeError from '../runtime_error';\nimport {typeOf} from '../values';\n\nimport type {Expression} from '../expression';\nimport type ParsingContext from '../parsing_context';\nimport type EvaluationContext from '../evaluation_context';\nimport type {Type} from '../types';\n\nconst types = {\n string: StringType,\n number: NumberType,\n boolean: BooleanType,\n object: ObjectType\n};\n\nclass Assertion implements Expression {\n type: Type;\n args: Array;\n\n constructor(type: Type, args: Array) {\n this.type = type;\n this.args = args;\n }\n\n static parse(args: $ReadOnlyArray, context: ParsingContext): ?Expression {\n if (args.length < 2)\n return context.error(`Expected at least one argument.`);\n\n let i = 1;\n let type;\n\n const name: string = (args[0]: any);\n if (name === 'array') {\n let itemType;\n if (args.length > 2) {\n const type = args[1];\n if (typeof type !== 'string' || !(type in types) || type === 'object')\n return context.error('The item type argument of \"array\" must be one of string, number, boolean', 1);\n itemType = types[type];\n i++;\n } else {\n itemType = ValueType;\n }\n\n let N;\n if (args.length > 3) {\n if (args[2] !== null &&\n (typeof args[2] !== 'number' ||\n args[2] < 0 ||\n args[2] !== Math.floor(args[2]))\n ) {\n return context.error('The length argument to \"array\" must be a positive integer literal', 2);\n }\n N = args[2];\n i++;\n }\n\n type = array(itemType, N);\n } else {\n assert(types[name], name);\n type = types[name];\n }\n\n const parsed = [];\n for (; i < args.length; i++) {\n const input = context.parse(args[i], i, ValueType);\n if (!input) return null;\n parsed.push(input);\n }\n\n return new Assertion(type, parsed);\n }\n\n evaluate(ctx: EvaluationContext) {\n for (let i = 0; i < this.args.length; i++) {\n const value = this.args[i].evaluate(ctx);\n const error = checkSubtype(this.type, typeOf(value));\n if (!error) {\n return value;\n } else if (i === this.args.length - 1) {\n throw new RuntimeError(`Expected value to be of type ${toString(this.type)}, but found ${toString(typeOf(value))} instead.`);\n }\n }\n\n assert(false);\n return null;\n }\n\n eachChild(fn: (_: Expression) => void) {\n this.args.forEach(fn);\n }\n\n outputDefined(): boolean {\n return this.args.every(arg => arg.outputDefined());\n }\n\n serialize(): Array {\n const type = this.type;\n const serialized = [type.kind];\n if (type.kind === 'array') {\n const itemType = type.itemType;\n if (itemType.kind === 'string' ||\n itemType.kind === 'number' ||\n itemType.kind === 'boolean') {\n serialized.push(itemType.kind);\n const N = type.N;\n if (typeof N === 'number' || this.args.length > 1) {\n serialized.push(N);\n }\n }\n }\n return serialized.concat(this.args.map(arg => arg.serialize()));\n }\n}\n\nexport default Assertion;\n","// @flow\n\nimport {NumberType, ValueType, FormattedType, array, StringType, ColorType, ResolvedImageType} from '../types';\nimport Formatted, {FormattedSection} from '../types/formatted';\nimport {toString, typeOf} from '../values';\n\nimport type {Expression} from '../expression';\nimport type EvaluationContext from '../evaluation_context';\nimport type ParsingContext from '../parsing_context';\nimport type {Type} from '../types';\n\ntype FormattedSectionExpression = {\n // Content of a section may be Image expression or other\n // type of expression that is coercable to 'string'.\n content: Expression,\n scale: Expression | null;\n font: Expression | null;\n textColor: Expression | null;\n}\n\nexport default class FormatExpression implements Expression {\n type: Type;\n sections: Array;\n\n constructor(sections: Array) {\n this.type = FormattedType;\n this.sections = sections;\n }\n\n static parse(args: $ReadOnlyArray, context: ParsingContext): ?Expression {\n if (args.length < 2) {\n return context.error(`Expected at least one argument.`);\n }\n\n const firstArg = args[1];\n if (!Array.isArray(firstArg) && typeof firstArg === 'object') {\n return context.error(`First argument must be an image or text section.`);\n }\n\n const sections: Array = [];\n let nextTokenMayBeObject = false;\n for (let i = 1; i <= args.length - 1; ++i) {\n const arg = (args[i]: any);\n\n if (nextTokenMayBeObject && typeof arg === \"object\" && !Array.isArray(arg)) {\n nextTokenMayBeObject = false;\n\n let scale = null;\n if (arg['font-scale']) {\n scale = context.parse(arg['font-scale'], 1, NumberType);\n if (!scale) return null;\n }\n\n let font = null;\n if (arg['text-font']) {\n font = context.parse(arg['text-font'], 1, array(StringType));\n if (!font) return null;\n }\n\n let textColor = null;\n if (arg['text-color']) {\n textColor = context.parse(arg['text-color'], 1, ColorType);\n if (!textColor) return null;\n }\n\n const lastExpression = sections[sections.length - 1];\n lastExpression.scale = scale;\n lastExpression.font = font;\n lastExpression.textColor = textColor;\n } else {\n const content = context.parse(args[i], 1, ValueType);\n if (!content) return null;\n\n const kind = content.type.kind;\n if (kind !== 'string' && kind !== 'value' && kind !== 'null' && kind !== 'resolvedImage')\n return context.error(`Formatted text type must be 'string', 'value', 'image' or 'null'.`);\n\n nextTokenMayBeObject = true;\n sections.push({content, scale: null, font: null, textColor: null});\n }\n }\n\n return new FormatExpression(sections);\n }\n\n evaluate(ctx: EvaluationContext) {\n const evaluateSection = section => {\n const evaluatedContent = section.content.evaluate(ctx);\n if (typeOf(evaluatedContent) === ResolvedImageType) {\n return new FormattedSection('', evaluatedContent, null, null, null);\n }\n\n return new FormattedSection(\n toString(evaluatedContent),\n null,\n section.scale ? section.scale.evaluate(ctx) : null,\n section.font ? section.font.evaluate(ctx).join(',') : null,\n section.textColor ? section.textColor.evaluate(ctx) : null\n );\n };\n\n return new Formatted(this.sections.map(evaluateSection));\n }\n\n eachChild(fn: (_: Expression) => void) {\n for (const section of this.sections) {\n fn(section.content);\n if (section.scale) {\n fn(section.scale);\n }\n if (section.font) {\n fn(section.font);\n }\n if (section.textColor) {\n fn(section.textColor);\n }\n }\n }\n\n outputDefined() {\n // Technically the combinatoric set of all children\n // Usually, this.text will be undefined anyway\n return false;\n }\n\n serialize() {\n const serialized = [\"format\"];\n for (const section of this.sections) {\n serialized.push(section.content.serialize());\n const options = {};\n if (section.scale) {\n options['font-scale'] = section.scale.serialize();\n }\n if (section.font) {\n options['text-font'] = section.font.serialize();\n }\n if (section.textColor) {\n options['text-color'] = section.textColor.serialize();\n }\n serialized.push(options);\n }\n return serialized;\n }\n}\n","// @flow\n\nimport {ResolvedImageType, StringType} from '../types';\nimport ResolvedImage from '../types/resolved_image';\n\nimport type {Expression} from '../expression';\nimport type EvaluationContext from '../evaluation_context';\nimport type ParsingContext from '../parsing_context';\nimport type {Type} from '../types';\n\nexport default class ImageExpression implements Expression {\n type: Type;\n input: Expression;\n\n constructor(input: Expression) {\n this.type = ResolvedImageType;\n this.input = input;\n }\n\n static parse(args: $ReadOnlyArray, context: ParsingContext): ?Expression {\n if (args.length !== 2) {\n return context.error(`Expected two arguments.`);\n }\n\n const name = context.parse(args[1], 1, StringType);\n if (!name) return context.error(`No image name provided.`);\n\n return new ImageExpression(name);\n }\n\n evaluate(ctx: EvaluationContext) {\n const evaluatedImageName = this.input.evaluate(ctx);\n\n const value = ResolvedImage.fromString(evaluatedImageName);\n if (value && ctx.availableImages) value.available = ctx.availableImages.indexOf(evaluatedImageName) > -1;\n\n return value;\n }\n\n eachChild(fn: (_: Expression) => void) {\n fn(this.input);\n }\n\n outputDefined() {\n // The output of image is determined by the list of available images in the evaluation context\n return false;\n }\n\n serialize() {\n return [\"image\", this.input.serialize()];\n }\n}\n","// @flow\n\nimport assert from 'assert';\n\nimport {BooleanType, ColorType, NumberType, StringType, ValueType} from '../types';\nimport {Color, toString as valueToString, validateRGBA} from '../values';\nimport RuntimeError from '../runtime_error';\nimport Formatted from '../types/formatted';\nimport FormatExpression from '../definitions/format';\nimport ImageExpression from '../definitions/image';\nimport ResolvedImage from '../types/resolved_image';\n\nimport type {Expression} from '../expression';\nimport type ParsingContext from '../parsing_context';\nimport type EvaluationContext from '../evaluation_context';\nimport type {Type} from '../types';\n\nconst types = {\n 'to-boolean': BooleanType,\n 'to-color': ColorType,\n 'to-number': NumberType,\n 'to-string': StringType\n};\n\n/**\n * Special form for error-coalescing coercion expressions \"to-number\",\n * \"to-color\". Since these coercions can fail at runtime, they accept multiple\n * arguments, only evaluating one at a time until one succeeds.\n *\n * @private\n */\nclass Coercion implements Expression {\n type: Type;\n args: Array;\n\n constructor(type: Type, args: Array) {\n this.type = type;\n this.args = args;\n }\n\n static parse(args: $ReadOnlyArray, context: ParsingContext): ?Expression {\n if (args.length < 2)\n return context.error(`Expected at least one argument.`);\n\n const name: string = (args[0]: any);\n assert(types[name], name);\n\n if ((name === 'to-boolean' || name === 'to-string') && args.length !== 2)\n return context.error(`Expected one argument.`);\n\n const type = types[name];\n\n const parsed = [];\n for (let i = 1; i < args.length; i++) {\n const input = context.parse(args[i], i, ValueType);\n if (!input) return null;\n parsed.push(input);\n }\n\n return new Coercion(type, parsed);\n }\n\n evaluate(ctx: EvaluationContext) {\n if (this.type.kind === 'boolean') {\n return Boolean(this.args[0].evaluate(ctx));\n } else if (this.type.kind === 'color') {\n let input;\n let error;\n for (const arg of this.args) {\n input = arg.evaluate(ctx);\n error = null;\n if (input instanceof Color) {\n return input;\n } else if (typeof input === 'string') {\n const c = ctx.parseColor(input);\n if (c) return c;\n } else if (Array.isArray(input)) {\n if (input.length < 3 || input.length > 4) {\n error = `Invalid rbga value ${JSON.stringify(input)}: expected an array containing either three or four numeric values.`;\n } else {\n error = validateRGBA(input[0], input[1], input[2], input[3]);\n }\n if (!error) {\n return new Color((input[0]: any) / 255, (input[1]: any) / 255, (input[2]: any) / 255, (input[3]: any));\n }\n }\n }\n throw new RuntimeError(error || `Could not parse color from value '${typeof input === 'string' ? input : String(JSON.stringify(input))}'`);\n } else if (this.type.kind === 'number') {\n let value = null;\n for (const arg of this.args) {\n value = arg.evaluate(ctx);\n if (value === null) return 0;\n const num = Number(value);\n if (isNaN(num)) continue;\n return num;\n }\n throw new RuntimeError(`Could not convert ${JSON.stringify(value)} to number.`);\n } else if (this.type.kind === 'formatted') {\n // There is no explicit 'to-formatted' but this coercion can be implicitly\n // created by properties that expect the 'formatted' type.\n return Formatted.fromString(valueToString(this.args[0].evaluate(ctx)));\n } else if (this.type.kind === 'resolvedImage') {\n return ResolvedImage.fromString(valueToString(this.args[0].evaluate(ctx)));\n } else {\n return valueToString(this.args[0].evaluate(ctx));\n }\n }\n\n eachChild(fn: (_: Expression) => void) {\n this.args.forEach(fn);\n }\n\n outputDefined(): boolean {\n return this.args.every(arg => arg.outputDefined());\n }\n\n serialize() {\n if (this.type.kind === 'formatted') {\n return new FormatExpression([{content: this.args[0], scale: null, font: null, textColor: null}]).serialize();\n }\n\n if (this.type.kind === 'resolvedImage') {\n return new ImageExpression(this.args[0]).serialize();\n }\n\n const serialized = [`to-${this.type.kind}`];\n this.eachChild(child => { serialized.push(child.serialize()); });\n return serialized;\n }\n}\n\nexport default Coercion;\n","// @flow\n\nimport {Color} from './values';\nimport type {FormattedSection} from './types/formatted';\nimport type {GlobalProperties, Feature, FeatureState} from './index';\nimport type {CanonicalTileID} from '../../source/tile_id';\n\nconst geometryTypes = ['Unknown', 'Point', 'LineString', 'Polygon'];\n\nclass EvaluationContext {\n globals: GlobalProperties;\n feature: ?Feature;\n featureState: ?FeatureState;\n formattedSection: ?FormattedSection;\n availableImages: ?Array;\n canonical: ?CanonicalTileID;\n\n _parseColorCache: {[_: string]: ?Color};\n\n constructor() {\n this.globals = (null: any);\n this.feature = null;\n this.featureState = null;\n this.formattedSection = null;\n this._parseColorCache = {};\n this.availableImages = null;\n this.canonical = null;\n }\n\n id() {\n return this.feature && 'id' in this.feature ? this.feature.id : null;\n }\n\n geometryType() {\n return this.feature ? typeof this.feature.type === 'number' ? geometryTypes[this.feature.type] : this.feature.type : null;\n }\n\n geometry() {\n return this.feature && 'geometry' in this.feature ? this.feature.geometry : null;\n }\n\n canonicalID() {\n return this.canonical;\n }\n\n properties() {\n return this.feature && this.feature.properties || {};\n }\n\n parseColor(input: string): ?Color {\n let cached = this._parseColorCache[input];\n if (!cached) {\n cached = this._parseColorCache[input] = Color.parse(input);\n }\n return cached;\n }\n}\n\nexport default EvaluationContext;\n","// @flow\n\nimport {toString} from './types';\n\nimport ParsingContext from './parsing_context';\nimport EvaluationContext from './evaluation_context';\nimport assert from 'assert';\n\nimport type {Expression, ExpressionRegistry} from './expression';\nimport type {Type} from './types';\nimport type {Value} from './values';\n\nexport type Varargs = {| type: Type |};\ntype Signature = Array | Varargs;\ntype Evaluate = (EvaluationContext, Array) => Value;\ntype Definition = [Type, Signature, Evaluate] |\n {|type: Type, overloads: Array<[Signature, Evaluate]>|};\n\nclass CompoundExpression implements Expression {\n name: string;\n type: Type;\n _evaluate: Evaluate;\n args: Array;\n\n static definitions: {[_: string]: Definition };\n\n constructor(name: string, type: Type, evaluate: Evaluate, args: Array) {\n this.name = name;\n this.type = type;\n this._evaluate = evaluate;\n this.args = args;\n }\n\n evaluate(ctx: EvaluationContext) {\n return this._evaluate(ctx, this.args);\n }\n\n eachChild(fn: (_: Expression) => void) {\n this.args.forEach(fn);\n }\n\n outputDefined() {\n return false;\n }\n\n serialize(): Array {\n return [this.name].concat(this.args.map(arg => arg.serialize()));\n }\n\n static parse(args: $ReadOnlyArray, context: ParsingContext): ?Expression {\n const op: string = (args[0]: any);\n const definition = CompoundExpression.definitions[op];\n if (!definition) {\n return context.error(`Unknown expression \"${op}\". If you wanted a literal array, use [\"literal\", [...]].`, 0);\n }\n\n // Now check argument types against each signature\n const type = Array.isArray(definition) ?\n definition[0] : definition.type;\n\n const availableOverloads = Array.isArray(definition) ?\n [[definition[1], definition[2]]] :\n definition.overloads;\n\n const overloads = availableOverloads.filter(([signature]) => (\n !Array.isArray(signature) || // varags\n signature.length === args.length - 1 // correct param count\n ));\n\n let signatureContext: ParsingContext = (null: any);\n\n for (const [params, evaluate] of overloads) {\n // Use a fresh context for each attempted signature so that, if\n // we eventually succeed, we haven't polluted `context.errors`.\n signatureContext = new ParsingContext(context.registry, context.path, null, context.scope);\n\n // First parse all the args, potentially coercing to the\n // types expected by this overload.\n const parsedArgs: Array = [];\n let argParseFailed = false;\n for (let i = 1; i < args.length; i++) {\n const arg = args[i];\n const expectedType = Array.isArray(params) ?\n params[i - 1] :\n params.type;\n\n const parsed = signatureContext.parse(arg, 1 + parsedArgs.length, expectedType);\n if (!parsed) {\n argParseFailed = true;\n break;\n }\n parsedArgs.push(parsed);\n }\n if (argParseFailed) {\n // Couldn't coerce args of this overload to expected type, move\n // on to next one.\n continue;\n }\n\n if (Array.isArray(params)) {\n if (params.length !== parsedArgs.length) {\n signatureContext.error(`Expected ${params.length} arguments, but found ${parsedArgs.length} instead.`);\n continue;\n }\n }\n\n for (let i = 0; i < parsedArgs.length; i++) {\n const expected = Array.isArray(params) ? params[i] : params.type;\n const arg = parsedArgs[i];\n signatureContext.concat(i + 1).checkSubtype(expected, arg.type);\n }\n\n if (signatureContext.errors.length === 0) {\n return new CompoundExpression(op, type, evaluate, parsedArgs);\n }\n }\n\n assert(!signatureContext || signatureContext.errors.length > 0);\n\n if (overloads.length === 1) {\n context.errors.push(...signatureContext.errors);\n } else {\n const expected = overloads.length ? overloads : availableOverloads;\n const signatures = expected\n .map(([params]) => stringifySignature(params))\n .join(' | ');\n\n const actualTypes = [];\n // For error message, re-parse arguments without trying to\n // apply any coercions\n for (let i = 1; i < args.length; i++) {\n const parsed = context.parse(args[i], 1 + actualTypes.length);\n if (!parsed) return null;\n actualTypes.push(toString(parsed.type));\n }\n context.error(`Expected arguments of type ${signatures}, but found (${actualTypes.join(', ')}) instead.`);\n }\n\n return null;\n }\n\n static register(\n registry: ExpressionRegistry,\n definitions: {[_: string]: Definition }\n ) {\n assert(!CompoundExpression.definitions);\n CompoundExpression.definitions = definitions;\n for (const name in definitions) {\n registry[name] = CompoundExpression;\n }\n }\n}\n\nfunction stringifySignature(signature: Signature): string {\n if (Array.isArray(signature)) {\n return `(${signature.map(toString).join(', ')})`;\n } else {\n return `(${toString(signature.type)}...)`;\n }\n}\n\nexport default CompoundExpression;\n","// @flow\n\nimport {StringType, BooleanType, CollatorType} from '../types';\nimport Collator from '../types/collator';\n\nimport type {Expression} from '../expression';\nimport type EvaluationContext from '../evaluation_context';\nimport type ParsingContext from '../parsing_context';\nimport type {Type} from '../types';\n\nexport default class CollatorExpression implements Expression {\n type: Type;\n caseSensitive: Expression;\n diacriticSensitive: Expression;\n locale: Expression | null;\n\n constructor(caseSensitive: Expression, diacriticSensitive: Expression, locale: Expression | null) {\n this.type = CollatorType;\n this.locale = locale;\n this.caseSensitive = caseSensitive;\n this.diacriticSensitive = diacriticSensitive;\n }\n\n static parse(args: $ReadOnlyArray, context: ParsingContext): ?Expression {\n if (args.length !== 2)\n return context.error(`Expected one argument.`);\n\n const options = (args[1]: any);\n if (typeof options !== \"object\" || Array.isArray(options))\n return context.error(`Collator options argument must be an object.`);\n\n const caseSensitive = context.parse(\n options['case-sensitive'] === undefined ? false : options['case-sensitive'], 1, BooleanType);\n if (!caseSensitive) return null;\n\n const diacriticSensitive = context.parse(\n options['diacritic-sensitive'] === undefined ? false : options['diacritic-sensitive'], 1, BooleanType);\n if (!diacriticSensitive) return null;\n\n let locale = null;\n if (options['locale']) {\n locale = context.parse(options['locale'], 1, StringType);\n if (!locale) return null;\n }\n\n return new CollatorExpression(caseSensitive, diacriticSensitive, locale);\n }\n\n evaluate(ctx: EvaluationContext) {\n return new Collator(this.caseSensitive.evaluate(ctx), this.diacriticSensitive.evaluate(ctx), this.locale ? this.locale.evaluate(ctx) : null);\n }\n\n eachChild(fn: (_: Expression) => void) {\n fn(this.caseSensitive);\n fn(this.diacriticSensitive);\n if (this.locale) {\n fn(this.locale);\n }\n }\n\n outputDefined() {\n // Technically the set of possible outputs is the combinatoric set of Collators produced\n // by all possible outputs of locale/caseSensitive/diacriticSensitive\n // But for the primary use of Collators in comparison operators, we ignore the Collator's\n // possible outputs anyway, so we can get away with leaving this false for now.\n return false;\n }\n\n serialize() {\n const options = {};\n options['case-sensitive'] = this.caseSensitive.serialize();\n options['diacritic-sensitive'] = this.diacriticSensitive.serialize();\n if (this.locale) {\n options['locale'] = this.locale.serialize();\n }\n return [\"collator\", options];\n }\n}\n","// @flow\n\nimport {isValue} from '../values';\nimport type {Type} from '../types';\nimport {BooleanType} from '../types';\nimport type {Expression} from '../expression';\nimport type ParsingContext from '../parsing_context';\nimport type EvaluationContext from '../evaluation_context';\nimport type {GeoJSON, GeoJSONPolygon, GeoJSONMultiPolygon} from '@mapbox/geojson-types';\nimport Point from '@mapbox/point-geometry';\nimport type {CanonicalTileID} from '../../../source/tile_id';\n\ntype GeoJSONPolygons =| GeoJSONPolygon | GeoJSONMultiPolygon;\n\n// minX, minY, maxX, maxY\ntype BBox = [number, number, number, number];\nconst EXTENT = 8192;\n\nfunction updateBBox(bbox: BBox, coord: Point) {\n bbox[0] = Math.min(bbox[0], coord[0]);\n bbox[1] = Math.min(bbox[1], coord[1]);\n bbox[2] = Math.max(bbox[2], coord[0]);\n bbox[3] = Math.max(bbox[3], coord[1]);\n}\n\nfunction mercatorXfromLng(lng: number) {\n return (180 + lng) / 360;\n}\n\nfunction mercatorYfromLat(lat: number) {\n return (180 - (180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + lat * Math.PI / 360)))) / 360;\n}\n\nfunction boxWithinBox(bbox1: BBox, bbox2: BBox) {\n if (bbox1[0] <= bbox2[0]) return false;\n if (bbox1[2] >= bbox2[2]) return false;\n if (bbox1[1] <= bbox2[1]) return false;\n if (bbox1[3] >= bbox2[3]) return false;\n return true;\n}\n\nfunction getTileCoordinates(p, canonical: CanonicalTileID) {\n const x = mercatorXfromLng(p[0]);\n const y = mercatorYfromLat(p[1]);\n const tilesAtZoom = Math.pow(2, canonical.z);\n return [Math.round(x * tilesAtZoom * EXTENT), Math.round(y * tilesAtZoom * EXTENT)];\n}\n\nfunction onBoundary(p, p1, p2) {\n const x1 = p[0] - p1[0];\n const y1 = p[1] - p1[1];\n const x2 = p[0] - p2[0];\n const y2 = p[1] - p2[1];\n return (x1 * y2 - x2 * y1 === 0) && (x1 * x2 <= 0) && (y1 * y2 <= 0);\n}\n\nfunction rayIntersect(p, p1, p2) {\n return ((p1[1] > p[1]) !== (p2[1] > p[1])) && (p[0] < (p2[0] - p1[0]) * (p[1] - p1[1]) / (p2[1] - p1[1]) + p1[0]);\n}\n\n// ray casting algorithm for detecting if point is in polygon\nfunction pointWithinPolygon(point, rings) {\n let inside = false;\n for (let i = 0, len = rings.length; i < len; i++) {\n const ring = rings[i];\n for (let j = 0, len2 = ring.length; j < len2 - 1; j++) {\n if (onBoundary(point, ring[j], ring[j + 1])) return false;\n if (rayIntersect(point, ring[j], ring[j + 1])) inside = !inside;\n }\n }\n return inside;\n}\n\nfunction pointWithinPolygons(point, polygons) {\n for (let i = 0; i < polygons.length; i++) {\n if (pointWithinPolygon(point, polygons[i])) return true;\n }\n return false;\n}\n\nfunction perp(v1, v2) {\n return (v1[0] * v2[1] - v1[1] * v2[0]);\n}\n\n// check if p1 and p2 are in different sides of line segment q1->q2\nfunction twoSided(p1, p2, q1, q2) {\n // q1->p1 (x1, y1), q1->p2 (x2, y2), q1->q2 (x3, y3)\n const x1 = p1[0] - q1[0];\n const y1 = p1[1] - q1[1];\n const x2 = p2[0] - q1[0];\n const y2 = p2[1] - q1[1];\n const x3 = q2[0] - q1[0];\n const y3 = q2[1] - q1[1];\n const det1 = (x1 * y3 - x3 * y1);\n const det2 = (x2 * y3 - x3 * y2);\n if ((det1 > 0 && det2 < 0) || (det1 < 0 && det2 > 0)) return true;\n return false;\n}\n// a, b are end points for line segment1, c and d are end points for line segment2\nfunction lineIntersectLine(a, b, c, d) {\n // check if two segments are parallel or not\n // precondition is end point a, b is inside polygon, if line a->b is\n // parallel to polygon edge c->d, then a->b won't intersect with c->d\n const vectorP = [b[0] - a[0], b[1] - a[1]];\n const vectorQ = [d[0] - c[0], d[1] - c[1]];\n if (perp(vectorQ, vectorP) === 0) return false;\n\n // If lines are intersecting with each other, the relative location should be:\n // a and b lie in different sides of segment c->d\n // c and d lie in different sides of segment a->b\n if (twoSided(a, b, c, d) && twoSided(c, d, a, b)) return true;\n return false;\n}\n\nfunction lineIntersectPolygon(p1, p2, polygon) {\n for (const ring of polygon) {\n // loop through every edge of the ring\n for (let j = 0; j < ring.length - 1; ++j) {\n if (lineIntersectLine(p1, p2, ring[j], ring[j + 1])) {\n return true;\n }\n }\n }\n return false;\n}\n\nfunction lineStringWithinPolygon(line, polygon) {\n // First, check if geometry points of line segments are all inside polygon\n for (let i = 0; i < line.length; ++i) {\n if (!pointWithinPolygon(line[i], polygon)) {\n return false;\n }\n }\n\n // Second, check if there is line segment intersecting polygon edge\n for (let i = 0; i < line.length - 1; ++i) {\n if (lineIntersectPolygon(line[i], line[i + 1], polygon)) {\n return false;\n }\n }\n return true;\n}\n\nfunction lineStringWithinPolygons(line, polygons) {\n for (let i = 0; i < polygons.length; i++) {\n if (lineStringWithinPolygon(line, polygons[i])) return true;\n }\n return false;\n}\n\nfunction getTilePolygon(coordinates, bbox, canonical) {\n const polygon = [];\n for (let i = 0; i < coordinates.length; i++) {\n const ring = [];\n for (let j = 0; j < coordinates[i].length; j++) {\n const coord = getTileCoordinates(coordinates[i][j], canonical);\n updateBBox(bbox, coord);\n ring.push(coord);\n }\n polygon.push(ring);\n }\n return polygon;\n}\n\nfunction getTilePolygons(coordinates, bbox, canonical) {\n const polygons = [];\n for (let i = 0; i < coordinates.length; i++) {\n const polygon = getTilePolygon(coordinates[i], bbox, canonical);\n polygons.push(polygon);\n }\n return polygons;\n}\n\nfunction updatePoint(p, bbox, polyBBox, worldSize) {\n if (p[0] < polyBBox[0] || p[0] > polyBBox[2]) {\n const halfWorldSize = worldSize * 0.5;\n let shift = (p[0] - polyBBox[0] > halfWorldSize) ? -worldSize : (polyBBox[0] - p[0] > halfWorldSize) ? worldSize : 0;\n if (shift === 0) {\n shift = (p[0] - polyBBox[2] > halfWorldSize) ? -worldSize : (polyBBox[2] - p[0] > halfWorldSize) ? worldSize : 0;\n }\n p[0] += shift;\n }\n updateBBox(bbox, p);\n}\n\nfunction resetBBox(bbox) {\n bbox[0] = bbox[1] = Infinity;\n bbox[2] = bbox[3] = -Infinity;\n}\n\nfunction getTilePoints(geometry, pointBBox, polyBBox, canonical) {\n const worldSize = Math.pow(2, canonical.z) * EXTENT;\n const shifts = [canonical.x * EXTENT, canonical.y * EXTENT];\n const tilePoints = [];\n for (const points of geometry) {\n for (const point of points) {\n const p = [point.x + shifts[0], point.y + shifts[1]];\n updatePoint(p, pointBBox, polyBBox, worldSize);\n tilePoints.push(p);\n }\n }\n return tilePoints;\n}\n\nfunction getTileLines(geometry, lineBBox, polyBBox, canonical) {\n const worldSize = Math.pow(2, canonical.z) * EXTENT;\n const shifts = [canonical.x * EXTENT, canonical.y * EXTENT];\n const tileLines = [];\n for (const line of geometry) {\n const tileLine = [];\n for (const point of line) {\n const p = [point.x + shifts[0], point.y + shifts[1]];\n updateBBox(lineBBox, p);\n tileLine.push(p);\n }\n tileLines.push(tileLine);\n }\n if (lineBBox[2] - lineBBox[0] <= worldSize / 2) {\n resetBBox(lineBBox);\n for (const line of tileLines) {\n for (const p of line) {\n updatePoint(p, lineBBox, polyBBox, worldSize);\n }\n }\n }\n return tileLines;\n}\n\nfunction pointsWithinPolygons(ctx: EvaluationContext, polygonGeometry: GeoJSONPolygons) {\n const pointBBox = [Infinity, Infinity, -Infinity, -Infinity];\n const polyBBox = [Infinity, Infinity, -Infinity, -Infinity];\n\n const canonical = ctx.canonicalID();\n\n if (polygonGeometry.type === 'Polygon') {\n const tilePolygon = getTilePolygon(polygonGeometry.coordinates, polyBBox, canonical);\n const tilePoints = getTilePoints(ctx.geometry(), pointBBox, polyBBox, canonical);\n if (!boxWithinBox(pointBBox, polyBBox)) return false;\n\n for (const point of tilePoints) {\n if (!pointWithinPolygon(point, tilePolygon)) return false;\n }\n }\n if (polygonGeometry.type === 'MultiPolygon') {\n const tilePolygons = getTilePolygons(polygonGeometry.coordinates, polyBBox, canonical);\n const tilePoints = getTilePoints(ctx.geometry(), pointBBox, polyBBox, canonical);\n if (!boxWithinBox(pointBBox, polyBBox)) return false;\n\n for (const point of tilePoints) {\n if (!pointWithinPolygons(point, tilePolygons)) return false;\n }\n }\n\n return true;\n}\n\nfunction linesWithinPolygons(ctx: EvaluationContext, polygonGeometry: GeoJSONPolygons) {\n const lineBBox = [Infinity, Infinity, -Infinity, -Infinity];\n const polyBBox = [Infinity, Infinity, -Infinity, -Infinity];\n\n const canonical = ctx.canonicalID();\n\n if (polygonGeometry.type === 'Polygon') {\n const tilePolygon = getTilePolygon(polygonGeometry.coordinates, polyBBox, canonical);\n const tileLines = getTileLines(ctx.geometry(), lineBBox, polyBBox, canonical);\n if (!boxWithinBox(lineBBox, polyBBox)) return false;\n\n for (const line of tileLines) {\n if (!lineStringWithinPolygon(line, tilePolygon)) return false;\n }\n }\n if (polygonGeometry.type === 'MultiPolygon') {\n const tilePolygons = getTilePolygons(polygonGeometry.coordinates, polyBBox, canonical);\n const tileLines = getTileLines(ctx.geometry(), lineBBox, polyBBox, canonical);\n if (!boxWithinBox(lineBBox, polyBBox)) return false;\n\n for (const line of tileLines) {\n if (!lineStringWithinPolygons(line, tilePolygons)) return false;\n }\n }\n return true;\n}\n\nclass Within implements Expression {\n type: Type;\n geojson: GeoJSON\n geometries: GeoJSONPolygons;\n\n constructor(geojson: GeoJSON, geometries: GeoJSONPolygons) {\n this.type = BooleanType;\n this.geojson = geojson;\n this.geometries = geometries;\n }\n\n static parse(args: $ReadOnlyArray, context: ParsingContext) {\n if (args.length !== 2)\n return context.error(`'within' expression requires exactly one argument, but found ${args.length - 1} instead.`);\n if (isValue(args[1])) {\n const geojson = (args[1]: Object);\n if (geojson.type === 'FeatureCollection') {\n for (let i = 0; i < geojson.features.length; ++i) {\n const type = geojson.features[i].geometry.type;\n if (type === 'Polygon' || type === 'MultiPolygon') {\n return new Within(geojson, geojson.features[i].geometry);\n }\n }\n } else if (geojson.type === 'Feature') {\n const type = geojson.geometry.type;\n if (type === 'Polygon' || type === 'MultiPolygon') {\n return new Within(geojson, geojson.geometry);\n }\n } else if (geojson.type === 'Polygon' || geojson.type === 'MultiPolygon') {\n return new Within(geojson, geojson);\n }\n }\n return context.error(`'within' expression requires valid geojson object that contains polygon geometry type.`);\n }\n\n evaluate(ctx: EvaluationContext) {\n if (ctx.geometry() != null && ctx.canonicalID() != null) {\n if (ctx.geometryType() === 'Point') {\n return pointsWithinPolygons(ctx, this.geometries);\n } else if (ctx.geometryType() === 'LineString') {\n return linesWithinPolygons(ctx, this.geometries);\n }\n }\n return false;\n }\n\n eachChild() {}\n\n outputDefined(): boolean {\n return true;\n }\n\n serialize(): Array {\n return [\"within\", this.geojson];\n }\n\n}\n\nexport default Within;\n","// @flow\n\nimport CompoundExpression from './compound_expression';\nimport Within from './definitions/within';\nimport type {Expression} from './expression.js';\n\nfunction isFeatureConstant(e: Expression) {\n if (e instanceof CompoundExpression) {\n if (e.name === 'get' && e.args.length === 1) {\n return false;\n } else if (e.name === 'feature-state') {\n return false;\n } else if (e.name === 'has' && e.args.length === 1) {\n return false;\n } else if (\n e.name === 'properties' ||\n e.name === 'geometry-type' ||\n e.name === 'id'\n ) {\n return false;\n } else if (/^filter-/.test(e.name)) {\n return false;\n }\n }\n\n if (e instanceof Within) {\n return false;\n }\n\n let result = true;\n e.eachChild(arg => {\n if (result && !isFeatureConstant(arg)) { result = false; }\n });\n return result;\n}\n\nfunction isStateConstant(e: Expression) {\n if (e instanceof CompoundExpression) {\n if (e.name === 'feature-state') {\n return false;\n }\n }\n let result = true;\n e.eachChild(arg => {\n if (result && !isStateConstant(arg)) { result = false; }\n });\n return result;\n}\n\nfunction isGlobalPropertyConstant(e: Expression, properties: Array) {\n if (e instanceof CompoundExpression && properties.indexOf(e.name) >= 0) { return false; }\n let result = true;\n e.eachChild((arg) => {\n if (result && !isGlobalPropertyConstant(arg, properties)) { result = false; }\n });\n return result;\n}\n\nexport {isFeatureConstant, isGlobalPropertyConstant, isStateConstant};\n","// @flow\n\nimport type {Type} from '../types';\nimport type {Expression} from '../expression';\nimport type ParsingContext from '../parsing_context';\nimport type EvaluationContext from '../evaluation_context';\n\nclass Var implements Expression {\n type: Type;\n name: string;\n boundExpression: Expression;\n\n constructor(name: string, boundExpression: Expression) {\n this.type = boundExpression.type;\n this.name = name;\n this.boundExpression = boundExpression;\n }\n\n static parse(args: $ReadOnlyArray, context: ParsingContext) {\n if (args.length !== 2 || typeof args[1] !== 'string')\n return context.error(`'var' expression requires exactly one string literal argument.`);\n\n const name = args[1];\n if (!context.scope.has(name)) {\n return context.error(`Unknown variable \"${name}\". Make sure \"${name}\" has been bound in an enclosing \"let\" expression before using it.`, 1);\n }\n\n return new Var(name, context.scope.get(name));\n }\n\n evaluate(ctx: EvaluationContext) {\n return this.boundExpression.evaluate(ctx);\n }\n\n eachChild() {}\n\n outputDefined() {\n return false;\n }\n\n serialize() {\n return [\"var\", this.name];\n }\n}\n\nexport default Var;\n","// @flow\n\nimport Scope from './scope';\nimport {checkSubtype} from './types';\nimport ParsingError from './parsing_error';\nimport Literal from './definitions/literal';\nimport Assertion from './definitions/assertion';\nimport Coercion from './definitions/coercion';\nimport EvaluationContext from './evaluation_context';\nimport CompoundExpression from './compound_expression';\nimport CollatorExpression from './definitions/collator';\nimport Within from './definitions/within';\nimport {isGlobalPropertyConstant, isFeatureConstant} from './is_constant';\nimport Var from './definitions/var';\n\nimport type {Expression, ExpressionRegistry} from './expression';\nimport type {Type} from './types';\n\n/**\n * State associated parsing at a given point in an expression tree.\n * @private\n */\nclass ParsingContext {\n registry: ExpressionRegistry;\n path: Array;\n key: string;\n scope: Scope;\n errors: Array;\n\n // The expected type of this expression. Provided only to allow Expression\n // implementations to infer argument types: Expression#parse() need not\n // check that the output type of the parsed expression matches\n // `expectedType`.\n expectedType: ?Type;\n\n constructor(\n registry: ExpressionRegistry,\n path: Array = [],\n expectedType: ?Type,\n scope: Scope = new Scope(),\n errors: Array = []\n ) {\n this.registry = registry;\n this.path = path;\n this.key = path.map(part => `[${part}]`).join('');\n this.scope = scope;\n this.errors = errors;\n this.expectedType = expectedType;\n }\n\n /**\n * @param expr the JSON expression to parse\n * @param index the optional argument index if this expression is an argument of a parent expression that's being parsed\n * @param options\n * @param options.omitTypeAnnotations set true to omit inferred type annotations. Caller beware: with this option set, the parsed expression's type will NOT satisfy `expectedType` if it would normally be wrapped in an inferred annotation.\n * @private\n */\n parse(\n expr: mixed,\n index?: number,\n expectedType?: ?Type,\n bindings?: Array<[string, Expression]>,\n options: {typeAnnotation?: 'assert' | 'coerce' | 'omit'} = {}\n ): ?Expression {\n if (index) {\n return this.concat(index, expectedType, bindings)._parse(expr, options);\n }\n return this._parse(expr, options);\n }\n\n _parse(expr: mixed, options: {typeAnnotation?: 'assert' | 'coerce' | 'omit'}): ?Expression {\n if (expr === null || typeof expr === 'string' || typeof expr === 'boolean' || typeof expr === 'number') {\n expr = ['literal', expr];\n }\n\n function annotate(parsed, type, typeAnnotation: 'assert' | 'coerce' | 'omit') {\n if (typeAnnotation === 'assert') {\n return new Assertion(type, [parsed]);\n } else if (typeAnnotation === 'coerce') {\n return new Coercion(type, [parsed]);\n } else {\n return parsed;\n }\n }\n\n if (Array.isArray(expr)) {\n if (expr.length === 0) {\n return this.error(`Expected an array with at least one element. If you wanted a literal array, use [\"literal\", []].`);\n }\n\n const op = expr[0];\n if (typeof op !== 'string') {\n this.error(`Expression name must be a string, but found ${typeof op} instead. If you wanted a literal array, use [\"literal\", [...]].`, 0);\n return null;\n }\n\n const Expr = this.registry[op];\n if (Expr) {\n let parsed = Expr.parse(expr, this);\n if (!parsed) return null;\n\n if (this.expectedType) {\n const expected = this.expectedType;\n const actual = parsed.type;\n\n // When we expect a number, string, boolean, or array but have a value, wrap it in an assertion.\n // When we expect a color or formatted string, but have a string or value, wrap it in a coercion.\n // Otherwise, we do static type-checking.\n //\n // These behaviors are overridable for:\n // * The \"coalesce\" operator, which needs to omit type annotations.\n // * String-valued properties (e.g. `text-field`), where coercion is more convenient than assertion.\n //\n if ((expected.kind === 'string' || expected.kind === 'number' || expected.kind === 'boolean' || expected.kind === 'object' || expected.kind === 'array') && actual.kind === 'value') {\n parsed = annotate(parsed, expected, options.typeAnnotation || 'assert');\n } else if ((expected.kind === 'color' || expected.kind === 'formatted' || expected.kind === 'resolvedImage') && (actual.kind === 'value' || actual.kind === 'string')) {\n parsed = annotate(parsed, expected, options.typeAnnotation || 'coerce');\n } else if (this.checkSubtype(expected, actual)) {\n return null;\n }\n }\n\n // If an expression's arguments are all literals, we can evaluate\n // it immediately and replace it with a literal value in the\n // parsed/compiled result. Expressions that expect an image should\n // not be resolved here so we can later get the available images.\n if (!(parsed instanceof Literal) && (parsed.type.kind !== 'resolvedImage') && isConstant(parsed)) {\n const ec = new EvaluationContext();\n try {\n parsed = new Literal(parsed.type, parsed.evaluate(ec));\n } catch (e) {\n this.error(e.message);\n return null;\n }\n }\n\n return parsed;\n }\n\n return this.error(`Unknown expression \"${op}\". If you wanted a literal array, use [\"literal\", [...]].`, 0);\n } else if (typeof expr === 'undefined') {\n return this.error(`'undefined' value invalid. Use null instead.`);\n } else if (typeof expr === 'object') {\n return this.error(`Bare objects invalid. Use [\"literal\", {...}] instead.`);\n } else {\n return this.error(`Expected an array, but found ${typeof expr} instead.`);\n }\n }\n\n /**\n * Returns a copy of this context suitable for parsing the subexpression at\n * index `index`, optionally appending to 'let' binding map.\n *\n * Note that `errors` property, intended for collecting errors while\n * parsing, is copied by reference rather than cloned.\n * @private\n */\n concat(index: number, expectedType?: ?Type, bindings?: Array<[string, Expression]>) {\n const path = typeof index === 'number' ? this.path.concat(index) : this.path;\n const scope = bindings ? this.scope.concat(bindings) : this.scope;\n return new ParsingContext(\n this.registry,\n path,\n expectedType || null,\n scope,\n this.errors\n );\n }\n\n /**\n * Push a parsing (or type checking) error into the `this.errors`\n * @param error The message\n * @param keys Optionally specify the source of the error at a child\n * of the current expression at `this.key`.\n * @private\n */\n error(error: string, ...keys: Array) {\n const key = `${this.key}${keys.map(k => `[${k}]`).join('')}`;\n this.errors.push(new ParsingError(key, error));\n }\n\n /**\n * Returns null if `t` is a subtype of `expected`; otherwise returns an\n * error message and also pushes it to `this.errors`.\n */\n checkSubtype(expected: Type, t: Type): ?string {\n const error = checkSubtype(expected, t);\n if (error) this.error(error);\n return error;\n }\n}\n\nexport default ParsingContext;\n\nfunction isConstant(expression: Expression) {\n if (expression instanceof Var) {\n return isConstant(expression.boundExpression);\n } else if (expression instanceof CompoundExpression && expression.name === 'error') {\n return false;\n } else if (expression instanceof CollatorExpression) {\n // Although the results of a Collator expression with fixed arguments\n // generally shouldn't change between executions, we can't serialize them\n // as constant expressions because results change based on environment.\n return false;\n } else if (expression instanceof Within) {\n return false;\n }\n\n const isTypeAnnotation = expression instanceof Coercion ||\n expression instanceof Assertion;\n\n let childrenConstant = true;\n expression.eachChild(child => {\n // We can _almost_ assume that if `expressions` children are constant,\n // they would already have been evaluated to Literal values when they\n // were parsed. Type annotations are the exception, because they might\n // have been inferred and added after a child was parsed.\n\n // So we recurse into isConstant() for the children of type annotations,\n // but otherwise simply check whether they are Literals.\n if (isTypeAnnotation) {\n childrenConstant = childrenConstant && isConstant(child);\n } else {\n childrenConstant = childrenConstant && child instanceof Literal;\n }\n });\n if (!childrenConstant) {\n return false;\n }\n\n return isFeatureConstant(expression) &&\n isGlobalPropertyConstant(expression, ['zoom', 'heatmap-density', 'line-progress', 'accumulated', 'is-supported-script']);\n}\n","// @flow\n\nimport RuntimeError from './runtime_error';\n\nimport type {Expression} from './expression';\n\nexport type Stops = Array<[number, Expression]>;\n\n/**\n * Returns the index of the last stop <= input, or 0 if it doesn't exist.\n * @private\n */\nexport function findStopLessThanOrEqualTo(stops: Array, input: number) {\n const lastIndex = stops.length - 1;\n let lowerIndex = 0;\n let upperIndex = lastIndex;\n let currentIndex = 0;\n let currentValue, nextValue;\n\n while (lowerIndex <= upperIndex) {\n currentIndex = Math.floor((lowerIndex + upperIndex) / 2);\n currentValue = stops[currentIndex];\n nextValue = stops[currentIndex + 1];\n\n if (currentValue <= input) {\n if (currentIndex === lastIndex || input < nextValue) { // Search complete\n return currentIndex;\n }\n\n lowerIndex = currentIndex + 1;\n } else if (currentValue > input) {\n upperIndex = currentIndex - 1;\n } else {\n throw new RuntimeError('Input is not a number.');\n }\n }\n\n return 0;\n}\n","// @flow\n\nimport {NumberType} from '../types';\n\nimport {findStopLessThanOrEqualTo} from '../stops';\n\nimport type {Stops} from '../stops';\nimport type {Expression} from '../expression';\nimport type ParsingContext from '../parsing_context';\nimport type EvaluationContext from '../evaluation_context';\nimport type {Type} from '../types';\n\nclass Step implements Expression {\n type: Type;\n\n input: Expression;\n labels: Array;\n outputs: Array;\n\n constructor(type: Type, input: Expression, stops: Stops) {\n this.type = type;\n this.input = input;\n\n this.labels = [];\n this.outputs = [];\n for (const [label, expression] of stops) {\n this.labels.push(label);\n this.outputs.push(expression);\n }\n }\n\n static parse(args: $ReadOnlyArray, context: ParsingContext) {\n if (args.length - 1 < 4) {\n return context.error(`Expected at least 4 arguments, but found only ${args.length - 1}.`);\n }\n\n if ((args.length - 1) % 2 !== 0) {\n return context.error(`Expected an even number of arguments.`);\n }\n\n const input = context.parse(args[1], 1, NumberType);\n if (!input) return null;\n\n const stops: Stops = [];\n\n let outputType: Type = (null: any);\n if (context.expectedType && context.expectedType.kind !== 'value') {\n outputType = context.expectedType;\n }\n\n for (let i = 1; i < args.length; i += 2) {\n const label = i === 1 ? -Infinity : args[i];\n const value = args[i + 1];\n\n const labelKey = i;\n const valueKey = i + 1;\n\n if (typeof label !== 'number') {\n return context.error('Input/output pairs for \"step\" expressions must be defined using literal numeric values (not computed expressions) for the input values.', labelKey);\n }\n\n if (stops.length && stops[stops.length - 1][0] >= label) {\n return context.error('Input/output pairs for \"step\" expressions must be arranged with input values in strictly ascending order.', labelKey);\n }\n\n const parsed = context.parse(value, valueKey, outputType);\n if (!parsed) return null;\n outputType = outputType || parsed.type;\n stops.push([label, parsed]);\n }\n\n return new Step(outputType, input, stops);\n }\n\n evaluate(ctx: EvaluationContext) {\n const labels = this.labels;\n const outputs = this.outputs;\n\n if (labels.length === 1) {\n return outputs[0].evaluate(ctx);\n }\n\n const value = ((this.input.evaluate(ctx): any): number);\n if (value <= labels[0]) {\n return outputs[0].evaluate(ctx);\n }\n\n const stopCount = labels.length;\n if (value >= labels[stopCount - 1]) {\n return outputs[stopCount - 1].evaluate(ctx);\n }\n\n const index = findStopLessThanOrEqualTo(labels, value);\n return outputs[index].evaluate(ctx);\n }\n\n eachChild(fn: (_: Expression) => void) {\n fn(this.input);\n for (const expression of this.outputs) {\n fn(expression);\n }\n }\n\n outputDefined(): boolean {\n return this.outputs.every(out => out.outputDefined());\n }\n\n serialize() {\n const serialized = [\"step\", this.input.serialize()];\n for (let i = 0; i < this.labels.length; i++) {\n if (i > 0) {\n serialized.push(this.labels[i]);\n }\n serialized.push(this.outputs[i].serialize());\n }\n return serialized;\n }\n}\n\nexport default Step;\n","// @flow\n\nimport Color from './color';\n\nexport function number(a: number, b: number, t: number) {\n return (a * (1 - t)) + (b * t);\n}\n\nexport function color(from: Color, to: Color, t: number) {\n return new Color(\n number(from.r, to.r, t),\n number(from.g, to.g, t),\n number(from.b, to.b, t),\n number(from.a, to.a, t)\n );\n}\n\nexport function array(from: Array, to: Array, t: number): Array {\n return from.map((d, i) => {\n return number(d, to[i], t);\n });\n}\n","// @flow\n\nimport Color from './color';\n\nimport {number as interpolateNumber} from './interpolate';\n\ntype LABColor = {\n l: number,\n a: number,\n b: number,\n alpha: number\n};\n\ntype HCLColor = {\n h: number,\n c: number,\n l: number,\n alpha: number\n};\n\n// Constants\nconst Xn = 0.950470, // D65 standard referent\n Yn = 1,\n Zn = 1.088830,\n t0 = 4 / 29,\n t1 = 6 / 29,\n t2 = 3 * t1 * t1,\n t3 = t1 * t1 * t1,\n deg2rad = Math.PI / 180,\n rad2deg = 180 / Math.PI;\n\n// Utilities\nfunction xyz2lab(t: number) {\n return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;\n}\n\nfunction lab2xyz(t: number) {\n return t > t1 ? t * t * t : t2 * (t - t0);\n}\n\nfunction xyz2rgb(x: number) {\n return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);\n}\n\nfunction rgb2xyz(x: number) {\n x /= 255;\n return x <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);\n}\n\n// LAB\nfunction rgbToLab(rgbColor: Color): LABColor {\n const b = rgb2xyz(rgbColor.r),\n a = rgb2xyz(rgbColor.g),\n l = rgb2xyz(rgbColor.b),\n x = xyz2lab((0.4124564 * b + 0.3575761 * a + 0.1804375 * l) / Xn),\n y = xyz2lab((0.2126729 * b + 0.7151522 * a + 0.0721750 * l) / Yn),\n z = xyz2lab((0.0193339 * b + 0.1191920 * a + 0.9503041 * l) / Zn);\n\n return {\n l: 116 * y - 16,\n a: 500 * (x - y),\n b: 200 * (y - z),\n alpha: rgbColor.a\n };\n}\n\nfunction labToRgb(labColor: LABColor): Color {\n let y = (labColor.l + 16) / 116,\n x = isNaN(labColor.a) ? y : y + labColor.a / 500,\n z = isNaN(labColor.b) ? y : y - labColor.b / 200;\n y = Yn * lab2xyz(y);\n x = Xn * lab2xyz(x);\n z = Zn * lab2xyz(z);\n return new Color(\n xyz2rgb(3.2404542 * x - 1.5371385 * y - 0.4985314 * z), // D65 -> sRGB\n xyz2rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z),\n xyz2rgb(0.0556434 * x - 0.2040259 * y + 1.0572252 * z),\n labColor.alpha\n );\n}\n\nfunction interpolateLab(from: LABColor, to: LABColor, t: number) {\n return {\n l: interpolateNumber(from.l, to.l, t),\n a: interpolateNumber(from.a, to.a, t),\n b: interpolateNumber(from.b, to.b, t),\n alpha: interpolateNumber(from.alpha, to.alpha, t)\n };\n}\n\n// HCL\nfunction rgbToHcl(rgbColor: Color): HCLColor {\n const {l, a, b} = rgbToLab(rgbColor);\n const h = Math.atan2(b, a) * rad2deg;\n return {\n h: h < 0 ? h + 360 : h,\n c: Math.sqrt(a * a + b * b),\n l,\n alpha: rgbColor.a\n };\n}\n\nfunction hclToRgb(hclColor: HCLColor): Color {\n const h = hclColor.h * deg2rad,\n c = hclColor.c,\n l = hclColor.l;\n return labToRgb({\n l,\n a: Math.cos(h) * c,\n b: Math.sin(h) * c,\n alpha: hclColor.alpha\n });\n}\n\nfunction interpolateHue(a: number, b: number, t: number) {\n const d = b - a;\n return a + t * (d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d);\n}\n\nfunction interpolateHcl(from: HCLColor, to: HCLColor, t: number) {\n return {\n h: interpolateHue(from.h, to.h, t),\n c: interpolateNumber(from.c, to.c, t),\n l: interpolateNumber(from.l, to.l, t),\n alpha: interpolateNumber(from.alpha, to.alpha, t)\n };\n}\n\nexport const lab = {\n forward: rgbToLab,\n reverse: labToRgb,\n interpolate: interpolateLab\n};\n\nexport const hcl = {\n forward: rgbToHcl,\n reverse: hclToRgb,\n interpolate: interpolateHcl\n};\n","// @flow\n\nimport UnitBezier from '@mapbox/unitbezier';\n\nimport * as interpolate from '../../util/interpolate';\nimport {toString, NumberType, ColorType} from '../types';\nimport {findStopLessThanOrEqualTo} from '../stops';\nimport {hcl, lab} from '../../util/color_spaces';\n\nimport type {Stops} from '../stops';\nimport type {Expression} from '../expression';\nimport type ParsingContext from '../parsing_context';\nimport type EvaluationContext from '../evaluation_context';\nimport type {Type} from '../types';\n\nexport type InterpolationType =\n { name: 'linear' } |\n { name: 'exponential', base: number } |\n { name: 'cubic-bezier', controlPoints: [number, number, number, number] };\n\nclass Interpolate implements Expression {\n type: Type;\n\n operator: 'interpolate' | 'interpolate-hcl' | 'interpolate-lab';\n interpolation: InterpolationType;\n input: Expression;\n labels: Array;\n outputs: Array;\n\n constructor(type: Type, operator: 'interpolate' | 'interpolate-hcl' | 'interpolate-lab', interpolation: InterpolationType, input: Expression, stops: Stops) {\n this.type = type;\n this.operator = operator;\n this.interpolation = interpolation;\n this.input = input;\n\n this.labels = [];\n this.outputs = [];\n for (const [label, expression] of stops) {\n this.labels.push(label);\n this.outputs.push(expression);\n }\n }\n\n static interpolationFactor(interpolation: InterpolationType, input: number, lower: number, upper: number) {\n let t = 0;\n if (interpolation.name === 'exponential') {\n t = exponentialInterpolation(input, interpolation.base, lower, upper);\n } else if (interpolation.name === 'linear') {\n t = exponentialInterpolation(input, 1, lower, upper);\n } else if (interpolation.name === 'cubic-bezier') {\n const c = interpolation.controlPoints;\n const ub = new UnitBezier(c[0], c[1], c[2], c[3]);\n t = ub.solve(exponentialInterpolation(input, 1, lower, upper));\n }\n return t;\n }\n\n static parse(args: $ReadOnlyArray, context: ParsingContext) {\n let [operator, interpolation, input, ...rest] = args;\n\n if (!Array.isArray(interpolation) || interpolation.length === 0) {\n return context.error(`Expected an interpolation type expression.`, 1);\n }\n\n if (interpolation[0] === 'linear') {\n interpolation = {name: 'linear'};\n } else if (interpolation[0] === 'exponential') {\n const base = interpolation[1];\n if (typeof base !== 'number')\n return context.error(`Exponential interpolation requires a numeric base.`, 1, 1);\n interpolation = {\n name: 'exponential',\n base\n };\n } else if (interpolation[0] === 'cubic-bezier') {\n const controlPoints = interpolation.slice(1);\n if (\n controlPoints.length !== 4 ||\n controlPoints.some(t => typeof t !== 'number' || t < 0 || t > 1)\n ) {\n return context.error('Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.', 1);\n }\n\n interpolation = {\n name: 'cubic-bezier',\n controlPoints: (controlPoints: any)\n };\n } else {\n return context.error(`Unknown interpolation type ${String(interpolation[0])}`, 1, 0);\n }\n\n if (args.length - 1 < 4) {\n return context.error(`Expected at least 4 arguments, but found only ${args.length - 1}.`);\n }\n\n if ((args.length - 1) % 2 !== 0) {\n return context.error(`Expected an even number of arguments.`);\n }\n\n input = context.parse(input, 2, NumberType);\n if (!input) return null;\n\n const stops: Stops = [];\n\n let outputType: Type = (null: any);\n if (operator === 'interpolate-hcl' || operator === 'interpolate-lab') {\n outputType = ColorType;\n } else if (context.expectedType && context.expectedType.kind !== 'value') {\n outputType = context.expectedType;\n }\n\n for (let i = 0; i < rest.length; i += 2) {\n const label = rest[i];\n const value = rest[i + 1];\n\n const labelKey = i + 3;\n const valueKey = i + 4;\n\n if (typeof label !== 'number') {\n return context.error('Input/output pairs for \"interpolate\" expressions must be defined using literal numeric values (not computed expressions) for the input values.', labelKey);\n }\n\n if (stops.length && stops[stops.length - 1][0] >= label) {\n return context.error('Input/output pairs for \"interpolate\" expressions must be arranged with input values in strictly ascending order.', labelKey);\n }\n\n const parsed = context.parse(value, valueKey, outputType);\n if (!parsed) return null;\n outputType = outputType || parsed.type;\n stops.push([label, parsed]);\n }\n\n if (outputType.kind !== 'number' &&\n outputType.kind !== 'color' &&\n !(\n outputType.kind === 'array' &&\n outputType.itemType.kind === 'number' &&\n typeof outputType.N === 'number'\n )\n ) {\n return context.error(`Type ${toString(outputType)} is not interpolatable.`);\n }\n\n return new Interpolate(outputType, (operator: any), interpolation, input, stops);\n }\n\n evaluate(ctx: EvaluationContext) {\n const labels = this.labels;\n const outputs = this.outputs;\n\n if (labels.length === 1) {\n return outputs[0].evaluate(ctx);\n }\n\n const value = ((this.input.evaluate(ctx): any): number);\n if (value <= labels[0]) {\n return outputs[0].evaluate(ctx);\n }\n\n const stopCount = labels.length;\n if (value >= labels[stopCount - 1]) {\n return outputs[stopCount - 1].evaluate(ctx);\n }\n\n const index = findStopLessThanOrEqualTo(labels, value);\n const lower = labels[index];\n const upper = labels[index + 1];\n const t = Interpolate.interpolationFactor(this.interpolation, value, lower, upper);\n\n const outputLower = outputs[index].evaluate(ctx);\n const outputUpper = outputs[index + 1].evaluate(ctx);\n\n if (this.operator === 'interpolate') {\n return (interpolate[this.type.kind.toLowerCase()]: any)(outputLower, outputUpper, t); // eslint-disable-line import/namespace\n } else if (this.operator === 'interpolate-hcl') {\n return hcl.reverse(hcl.interpolate(hcl.forward(outputLower), hcl.forward(outputUpper), t));\n } else {\n return lab.reverse(lab.interpolate(lab.forward(outputLower), lab.forward(outputUpper), t));\n }\n }\n\n eachChild(fn: (_: Expression) => void) {\n fn(this.input);\n for (const expression of this.outputs) {\n fn(expression);\n }\n }\n\n outputDefined(): boolean {\n return this.outputs.every(out => out.outputDefined());\n }\n\n serialize(): Array {\n let interpolation;\n if (this.interpolation.name === 'linear') {\n interpolation = [\"linear\"];\n } else if (this.interpolation.name === 'exponential') {\n if (this.interpolation.base === 1) {\n interpolation = [\"linear\"];\n } else {\n interpolation = [\"exponential\", this.interpolation.base];\n }\n } else {\n interpolation = [\"cubic-bezier\" ].concat(this.interpolation.controlPoints);\n }\n\n const serialized = [this.operator, interpolation, this.input.serialize()];\n\n for (let i = 0; i < this.labels.length; i++) {\n serialized.push(\n this.labels[i],\n this.outputs[i].serialize()\n );\n }\n return serialized;\n }\n}\n\n/**\n * Returns a ratio that can be used to interpolate between exponential function\n * stops.\n * How it works: Two consecutive stop values define a (scaled and shifted) exponential function `f(x) = a * base^x + b`, where `base` is the user-specified base,\n * and `a` and `b` are constants affording sufficient degrees of freedom to fit\n * the function to the given stops.\n *\n * Here's a bit of algebra that lets us compute `f(x)` directly from the stop\n * values without explicitly solving for `a` and `b`:\n *\n * First stop value: `f(x0) = y0 = a * base^x0 + b`\n * Second stop value: `f(x1) = y1 = a * base^x1 + b`\n * => `y1 - y0 = a(base^x1 - base^x0)`\n * => `a = (y1 - y0)/(base^x1 - base^x0)`\n *\n * Desired value: `f(x) = y = a * base^x + b`\n * => `f(x) = y0 + a * (base^x - base^x0)`\n *\n * From the above, we can replace the `a` in `a * (base^x - base^x0)` and do a\n * little algebra:\n * ```\n * a * (base^x - base^x0) = (y1 - y0)/(base^x1 - base^x0) * (base^x - base^x0)\n * = (y1 - y0) * (base^x - base^x0) / (base^x1 - base^x0)\n * ```\n *\n * If we let `(base^x - base^x0) / (base^x1 base^x0)`, then we have\n * `f(x) = y0 + (y1 - y0) * ratio`. In other words, `ratio` may be treated as\n * an interpolation factor between the two stops' output values.\n *\n * (Note: a slightly different form for `ratio`,\n * `(base^(x-x0) - 1) / (base^(x1-x0) - 1) `, is equivalent, but requires fewer\n * expensive `Math.pow()` operations.)\n *\n * @private\n*/\nfunction exponentialInterpolation(input, base, lowerValue, upperValue) {\n const difference = upperValue - lowerValue;\n const progress = input - lowerValue;\n\n if (difference === 0) {\n return 0;\n } else if (base === 1) {\n return progress / difference;\n } else {\n return (Math.pow(base, progress) - 1) / (Math.pow(base, difference) - 1);\n }\n}\n\nexport default Interpolate;\n","// @flow\n\nimport assert from 'assert';\n\nimport {checkSubtype, ValueType} from '../types';\nimport ResolvedImage from '../types/resolved_image';\n\nimport type {Expression} from '../expression';\nimport type ParsingContext from '../parsing_context';\nimport type EvaluationContext from '../evaluation_context';\nimport type {Type} from '../types';\n\nclass Coalesce implements Expression {\n type: Type;\n args: Array;\n\n constructor(type: Type, args: Array) {\n this.type = type;\n this.args = args;\n }\n\n static parse(args: $ReadOnlyArray, context: ParsingContext) {\n if (args.length < 2) {\n return context.error(\"Expectected at least one argument.\");\n }\n let outputType: Type = (null: any);\n const expectedType = context.expectedType;\n if (expectedType && expectedType.kind !== 'value') {\n outputType = expectedType;\n }\n const parsedArgs = [];\n\n for (const arg of args.slice(1)) {\n const parsed = context.parse(arg, 1 + parsedArgs.length, outputType, undefined, {typeAnnotation: 'omit'});\n if (!parsed) return null;\n outputType = outputType || parsed.type;\n parsedArgs.push(parsed);\n }\n assert(outputType);\n\n // Above, we parse arguments without inferred type annotation so that\n // they don't produce a runtime error for `null` input, which would\n // preempt the desired null-coalescing behavior.\n // Thus, if any of our arguments would have needed an annotation, we\n // need to wrap the enclosing coalesce expression with it instead.\n const needsAnnotation = expectedType &&\n parsedArgs.some(arg => checkSubtype(expectedType, arg.type));\n\n return needsAnnotation ?\n new Coalesce(ValueType, parsedArgs) :\n new Coalesce((outputType: any), parsedArgs);\n }\n\n evaluate(ctx: EvaluationContext) {\n let result = null;\n let argCount = 0;\n let requestedImageName;\n for (const arg of this.args) {\n argCount++;\n result = arg.evaluate(ctx);\n // we need to keep track of the first requested image in a coalesce statement\n // if coalesce can't find a valid image, we return the first image name so styleimagemissing can fire\n if (result && result instanceof ResolvedImage && !result.available) {\n if (!requestedImageName) {\n requestedImageName = result.name;\n }\n result = null;\n if (argCount === this.args.length) {\n result = requestedImageName;\n }\n }\n\n if (result !== null) break;\n }\n return result;\n }\n\n eachChild(fn: (_: Expression) => void) {\n this.args.forEach(fn);\n }\n\n outputDefined(): boolean {\n return this.args.every(arg => arg.outputDefined());\n }\n\n serialize() {\n const serialized = [\"coalesce\"];\n this.eachChild(child => { serialized.push(child.serialize()); });\n return serialized;\n }\n}\n\nexport default Coalesce;\n","// @flow\n\nimport type {Type} from '../types';\nimport type {Expression} from '../expression';\nimport type ParsingContext from '../parsing_context';\nimport type EvaluationContext from '../evaluation_context';\n\nclass Let implements Expression {\n type: Type;\n bindings: Array<[string, Expression]>;\n result: Expression;\n\n constructor(bindings: Array<[string, Expression]>, result: Expression) {\n this.type = result.type;\n this.bindings = [].concat(bindings);\n this.result = result;\n }\n\n evaluate(ctx: EvaluationContext) {\n return this.result.evaluate(ctx);\n }\n\n eachChild(fn: (_: Expression) => void) {\n for (const binding of this.bindings) {\n fn(binding[1]);\n }\n fn(this.result);\n }\n\n static parse(args: $ReadOnlyArray, context: ParsingContext) {\n if (args.length < 4)\n return context.error(`Expected at least 3 arguments, but found ${args.length - 1} instead.`);\n\n const bindings: Array<[string, Expression]> = [];\n for (let i = 1; i < args.length - 1; i += 2) {\n const name = args[i];\n\n if (typeof name !== 'string') {\n return context.error(`Expected string, but found ${typeof name} instead.`, i);\n }\n\n if (/[^a-zA-Z0-9_]/.test(name)) {\n return context.error(`Variable names must contain only alphanumeric characters or '_'.`, i);\n }\n\n const value = context.parse(args[i + 1], i + 1);\n if (!value) return null;\n\n bindings.push([name, value]);\n }\n\n const result = context.parse(args[args.length - 1], args.length - 1, context.expectedType, bindings);\n if (!result) return null;\n\n return new Let(bindings, result);\n }\n\n outputDefined() {\n return this.result.outputDefined();\n }\n\n serialize() {\n const serialized = [\"let\"];\n for (const [name, expr] of this.bindings) {\n serialized.push(name, expr.serialize());\n }\n serialized.push(this.result.serialize());\n return serialized;\n }\n}\n\nexport default Let;\n","// @flow\n\nimport {array, ValueType, NumberType} from '../types';\n\nimport RuntimeError from '../runtime_error';\n\nimport type {Expression} from '../expression';\nimport type ParsingContext from '../parsing_context';\nimport type EvaluationContext from '../evaluation_context';\nimport type {Type, ArrayType} from '../types';\nimport type {Value} from '../values';\n\nclass At implements Expression {\n type: Type;\n index: Expression;\n input: Expression;\n\n constructor(type: Type, index: Expression, input: Expression) {\n this.type = type;\n this.index = index;\n this.input = input;\n }\n\n static parse(args: $ReadOnlyArray, context: ParsingContext) {\n if (args.length !== 3)\n return context.error(`Expected 2 arguments, but found ${args.length - 1} instead.`);\n\n const index = context.parse(args[1], 1, NumberType);\n const input = context.parse(args[2], 2, array(context.expectedType || ValueType));\n\n if (!index || !input) return null;\n\n const t: ArrayType = (input.type: any);\n return new At(t.itemType, index, input);\n }\n\n evaluate(ctx: EvaluationContext) {\n const index = ((this.index.evaluate(ctx): any): number);\n const array = ((this.input.evaluate(ctx): any): Array);\n\n if (index < 0) {\n throw new RuntimeError(`Array index out of bounds: ${index} < 0.`);\n }\n\n if (index >= array.length) {\n throw new RuntimeError(`Array index out of bounds: ${index} > ${array.length - 1}.`);\n }\n\n if (index !== Math.floor(index)) {\n throw new RuntimeError(`Array index must be an integer, but found ${index} instead.`);\n }\n\n return array[index];\n }\n\n eachChild(fn: (_: Expression) => void) {\n fn(this.index);\n fn(this.input);\n }\n\n outputDefined() {\n return false;\n }\n\n serialize() {\n return [\"at\", this.index.serialize(), this.input.serialize()];\n }\n}\n\nexport default At;\n","// @flow\n\nimport {BooleanType, StringType, ValueType, NullType, toString, NumberType, isValidType, isValidNativeType} from '../types';\nimport RuntimeError from '../runtime_error';\nimport {typeOf} from '../values';\n\nimport type {Expression} from '../expression';\nimport type ParsingContext from '../parsing_context';\nimport type EvaluationContext from '../evaluation_context';\nimport type {Type} from '../types';\n\nclass In implements Expression {\n type: Type;\n needle: Expression;\n haystack: Expression;\n\n constructor(needle: Expression, haystack: Expression) {\n this.type = BooleanType;\n this.needle = needle;\n this.haystack = haystack;\n }\n\n static parse(args: $ReadOnlyArray, context: ParsingContext) {\n if (args.length !== 3) {\n return context.error(`Expected 2 arguments, but found ${args.length - 1} instead.`);\n }\n\n const needle = context.parse(args[1], 1, ValueType);\n\n const haystack = context.parse(args[2], 2, ValueType);\n\n if (!needle || !haystack) return null;\n\n if (!isValidType(needle.type, [BooleanType, StringType, NumberType, NullType, ValueType])) {\n return context.error(`Expected first argument to be of type boolean, string, number or null, but found ${toString(needle.type)} instead`);\n }\n\n return new In(needle, haystack);\n }\n\n evaluate(ctx: EvaluationContext) {\n const needle = (this.needle.evaluate(ctx): any);\n const haystack = (this.haystack.evaluate(ctx): any);\n\n if (!haystack) return false;\n\n if (!isValidNativeType(needle, ['boolean', 'string', 'number', 'null'])) {\n throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${toString(typeOf(needle))} instead.`);\n }\n\n if (!isValidNativeType(haystack, ['string', 'array'])) {\n throw new RuntimeError(`Expected second argument to be of type array or string, but found ${toString(typeOf(haystack))} instead.`);\n }\n\n return haystack.indexOf(needle) >= 0;\n }\n\n eachChild(fn: (_: Expression) => void) {\n fn(this.needle);\n fn(this.haystack);\n }\n\n outputDefined() {\n return true;\n }\n\n serialize() {\n return [\"in\", this.needle.serialize(), this.haystack.serialize()];\n }\n}\n\nexport default In;\n","// @flow\n\nimport {BooleanType, StringType, ValueType, NullType, toString, NumberType, isValidType, isValidNativeType} from '../types';\nimport RuntimeError from '../runtime_error';\nimport {typeOf} from '../values';\n\nimport type {Expression} from '../expression';\nimport type ParsingContext from '../parsing_context';\nimport type EvaluationContext from '../evaluation_context';\nimport type {Type} from '../types';\n\nclass IndexOf implements Expression {\n type: Type;\n needle: Expression;\n haystack: Expression;\n fromIndex: ?Expression;\n\n constructor(needle: Expression, haystack: Expression, fromIndex?: Expression) {\n this.type = NumberType;\n this.needle = needle;\n this.haystack = haystack;\n this.fromIndex = fromIndex;\n }\n\n static parse(args: $ReadOnlyArray, context: ParsingContext) {\n if (args.length <= 2 || args.length >= 5) {\n return context.error(`Expected 3 or 4 arguments, but found ${args.length - 1} instead.`);\n }\n\n const needle = context.parse(args[1], 1, ValueType);\n\n const haystack = context.parse(args[2], 2, ValueType);\n\n if (!needle || !haystack) return null;\n if (!isValidType(needle.type, [BooleanType, StringType, NumberType, NullType, ValueType])) {\n return context.error(`Expected first argument to be of type boolean, string, number or null, but found ${toString(needle.type)} instead`);\n }\n\n if (args.length === 4) {\n const fromIndex = context.parse(args[3], 3, NumberType);\n if (!fromIndex) return null;\n return new IndexOf(needle, haystack, fromIndex);\n } else {\n return new IndexOf(needle, haystack);\n }\n }\n\n evaluate(ctx: EvaluationContext) {\n const needle = (this.needle.evaluate(ctx): any);\n const haystack = (this.haystack.evaluate(ctx): any);\n\n if (!isValidNativeType(needle, ['boolean', 'string', 'number', 'null'])) {\n throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${toString(typeOf(needle))} instead.`);\n }\n\n if (!isValidNativeType(haystack, ['string', 'array'])) {\n throw new RuntimeError(`Expected second argument to be of type array or string, but found ${toString(typeOf(haystack))} instead.`);\n }\n\n if (this.fromIndex) {\n const fromIndex = (this.fromIndex.evaluate(ctx): number);\n return haystack.indexOf(needle, fromIndex);\n }\n\n return haystack.indexOf(needle);\n }\n\n eachChild(fn: (_: Expression) => void) {\n fn(this.needle);\n fn(this.haystack);\n if (this.fromIndex) {\n fn(this.fromIndex);\n }\n }\n\n outputDefined() {\n return false;\n }\n\n serialize() {\n if (this.fromIndex != null && this.fromIndex !== undefined) {\n const fromIndex = this.fromIndex.serialize();\n return [\"index-of\", this.needle.serialize(), this.haystack.serialize(), fromIndex];\n }\n return [\"index-of\", this.needle.serialize(), this.haystack.serialize()];\n }\n}\n\nexport default IndexOf;\n","// @flow\n\nimport assert from 'assert';\n\nimport {typeOf} from '../values';\nimport {ValueType, type Type} from '../types';\n\nimport type {Expression} from '../expression';\nimport type ParsingContext from '../parsing_context';\nimport type EvaluationContext from '../evaluation_context';\n\n// Map input label values to output expression index\ntype Cases = {[number | string]: number};\n\nclass Match implements Expression {\n type: Type;\n inputType: Type;\n\n input: Expression;\n cases: Cases;\n outputs: Array;\n otherwise: Expression;\n\n constructor(inputType: Type, outputType: Type, input: Expression, cases: Cases, outputs: Array, otherwise: Expression) {\n this.inputType = inputType;\n this.type = outputType;\n this.input = input;\n this.cases = cases;\n this.outputs = outputs;\n this.otherwise = otherwise;\n }\n\n static parse(args: $ReadOnlyArray, context: ParsingContext) {\n if (args.length < 5)\n return context.error(`Expected at least 4 arguments, but found only ${args.length - 1}.`);\n if (args.length % 2 !== 1)\n return context.error(`Expected an even number of arguments.`);\n\n let inputType;\n let outputType;\n if (context.expectedType && context.expectedType.kind !== 'value') {\n outputType = context.expectedType;\n }\n const cases = {};\n const outputs = [];\n for (let i = 2; i < args.length - 1; i += 2) {\n let labels = args[i];\n const value = args[i + 1];\n\n if (!Array.isArray(labels)) {\n labels = [labels];\n }\n\n const labelContext = context.concat(i);\n if (labels.length === 0) {\n return labelContext.error('Expected at least one branch label.');\n }\n\n for (const label of labels) {\n if (typeof label !== 'number' && typeof label !== 'string') {\n return labelContext.error(`Branch labels must be numbers or strings.`);\n } else if (typeof label === 'number' && Math.abs(label) > Number.MAX_SAFE_INTEGER) {\n return labelContext.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);\n\n } else if (typeof label === 'number' && Math.floor(label) !== label) {\n return labelContext.error(`Numeric branch labels must be integer values.`);\n\n } else if (!inputType) {\n inputType = typeOf(label);\n } else if (labelContext.checkSubtype(inputType, typeOf(label))) {\n return null;\n }\n\n if (typeof cases[String(label)] !== 'undefined') {\n return labelContext.error('Branch labels must be unique.');\n }\n\n cases[String(label)] = outputs.length;\n }\n\n const result = context.parse(value, i, outputType);\n if (!result) return null;\n outputType = outputType || result.type;\n outputs.push(result);\n }\n\n const input = context.parse(args[1], 1, ValueType);\n if (!input) return null;\n\n const otherwise = context.parse(args[args.length - 1], args.length - 1, outputType);\n if (!otherwise) return null;\n\n assert(inputType && outputType);\n\n if (input.type.kind !== 'value' && context.concat(1).checkSubtype((inputType: any), input.type)) {\n return null;\n }\n\n return new Match((inputType: any), (outputType: any), input, cases, outputs, otherwise);\n }\n\n evaluate(ctx: EvaluationContext) {\n const input = (this.input.evaluate(ctx): any);\n const output = (typeOf(input) === this.inputType && this.outputs[this.cases[input]]) || this.otherwise;\n return output.evaluate(ctx);\n }\n\n eachChild(fn: (_: Expression) => void) {\n fn(this.input);\n this.outputs.forEach(fn);\n fn(this.otherwise);\n }\n\n outputDefined(): boolean {\n return this.outputs.every(out => out.outputDefined()) && this.otherwise.outputDefined();\n }\n\n serialize(): Array {\n const serialized = [\"match\", this.input.serialize()];\n\n // Sort so serialization has an arbitrary defined order, even though\n // branch order doesn't affect evaluation\n const sortedLabels = Object.keys(this.cases).sort();\n\n // Group branches by unique match expression to support condensed\n // serializations of the form [case1, case2, ...] -> matchExpression\n const groupedByOutput: Array<[number, Array]> = [];\n const outputLookup: {[index: number]: number} = {}; // lookup index into groupedByOutput for a given output expression\n for (const label of sortedLabels) {\n const outputIndex = outputLookup[this.cases[label]];\n if (outputIndex === undefined) {\n // First time seeing this output, add it to the end of the grouped list\n outputLookup[this.cases[label]] = groupedByOutput.length;\n groupedByOutput.push([this.cases[label], [label]]);\n } else {\n // We've seen this expression before, add the label to that output's group\n groupedByOutput[outputIndex][1].push(label);\n }\n }\n\n const coerceLabel = (label) => this.inputType.kind === 'number' ? Number(label) : label;\n\n for (const [outputIndex, labels] of groupedByOutput) {\n if (labels.length === 1) {\n // Only a single label matches this output expression\n serialized.push(coerceLabel(labels[0]));\n } else {\n // Array of literal labels pointing to this output expression\n serialized.push(labels.map(coerceLabel));\n }\n serialized.push(this.outputs[outputIndex].serialize());\n }\n serialized.push(this.otherwise.serialize());\n return serialized;\n }\n}\n\nexport default Match;\n","// @flow\n\nimport assert from 'assert';\n\nimport {BooleanType} from '../types';\n\nimport type {Expression} from '../expression';\nimport type ParsingContext from '../parsing_context';\nimport type EvaluationContext from '../evaluation_context';\nimport type {Type} from '../types';\n\ntype Branches = Array<[Expression, Expression]>;\n\nclass Case implements Expression {\n type: Type;\n\n branches: Branches;\n otherwise: Expression;\n\n constructor(type: Type, branches: Branches, otherwise: Expression) {\n this.type = type;\n this.branches = branches;\n this.otherwise = otherwise;\n }\n\n static parse(args: $ReadOnlyArray, context: ParsingContext) {\n if (args.length < 4)\n return context.error(`Expected at least 3 arguments, but found only ${args.length - 1}.`);\n if (args.length % 2 !== 0)\n return context.error(`Expected an odd number of arguments.`);\n\n let outputType: ?Type;\n if (context.expectedType && context.expectedType.kind !== 'value') {\n outputType = context.expectedType;\n }\n\n const branches = [];\n for (let i = 1; i < args.length - 1; i += 2) {\n const test = context.parse(args[i], i, BooleanType);\n if (!test) return null;\n\n const result = context.parse(args[i + 1], i + 1, outputType);\n if (!result) return null;\n\n branches.push([test, result]);\n\n outputType = outputType || result.type;\n }\n\n const otherwise = context.parse(args[args.length - 1], args.length - 1, outputType);\n if (!otherwise) return null;\n\n assert(outputType);\n return new Case((outputType: any), branches, otherwise);\n }\n\n evaluate(ctx: EvaluationContext) {\n for (const [test, expression] of this.branches) {\n if (test.evaluate(ctx)) {\n return expression.evaluate(ctx);\n }\n }\n return this.otherwise.evaluate(ctx);\n }\n\n eachChild(fn: (_: Expression) => void) {\n for (const [test, expression] of this.branches) {\n fn(test);\n fn(expression);\n }\n fn(this.otherwise);\n }\n\n outputDefined(): boolean {\n return this.branches.every(([_, out]) => out.outputDefined()) && this.otherwise.outputDefined();\n }\n\n serialize() {\n const serialized = [\"case\"];\n this.eachChild(child => { serialized.push(child.serialize()); });\n return serialized;\n }\n}\n\nexport default Case;\n","// @flow\n\nimport {ValueType, NumberType, StringType, array, toString, isValidType, isValidNativeType} from '../types';\nimport RuntimeError from '../runtime_error';\nimport {typeOf} from '../values';\n\nimport type {Expression} from '../expression';\nimport type ParsingContext from '../parsing_context';\nimport type EvaluationContext from '../evaluation_context';\nimport type {Type} from '../types';\n\nclass Slice implements Expression {\n type: Type;\n input: Expression;\n beginIndex: Expression;\n endIndex: ?Expression;\n\n constructor(type: Type, input: Expression, beginIndex: Expression, endIndex?: Expression) {\n this.type = type;\n this.input = input;\n this.beginIndex = beginIndex;\n this.endIndex = endIndex;\n\n }\n\n static parse(args: $ReadOnlyArray, context: ParsingContext) {\n if (args.length <= 2 || args.length >= 5) {\n return context.error(`Expected 3 or 4 arguments, but found ${args.length - 1} instead.`);\n }\n\n const input = context.parse(args[1], 1, ValueType);\n const beginIndex = context.parse(args[2], 2, NumberType);\n\n if (!input || !beginIndex) return null;\n\n if (!isValidType(input.type, [array(ValueType), StringType, ValueType])) {\n return context.error(`Expected first argument to be of type array or string, but found ${toString(input.type)} instead`);\n }\n\n if (args.length === 4) {\n const endIndex = context.parse(args[3], 3, NumberType);\n if (!endIndex) return null;\n return new Slice(input.type, input, beginIndex, endIndex);\n } else {\n return new Slice(input.type, input, beginIndex);\n }\n }\n\n evaluate(ctx: EvaluationContext) {\n const input = (this.input.evaluate(ctx): any);\n const beginIndex = (this.beginIndex.evaluate(ctx): number);\n\n if (!isValidNativeType(input, ['string', 'array'])) {\n throw new RuntimeError(`Expected first argument to be of type array or string, but found ${toString(typeOf(input))} instead.`);\n }\n\n if (this.endIndex) {\n const endIndex = (this.endIndex.evaluate(ctx): number);\n return input.slice(beginIndex, endIndex);\n }\n\n return input.slice(beginIndex);\n }\n\n eachChild(fn: (_: Expression) => void) {\n fn(this.input);\n fn(this.beginIndex);\n if (this.endIndex) {\n fn(this.endIndex);\n }\n }\n\n outputDefined() {\n return false;\n }\n\n serialize() {\n if (this.endIndex != null && this.endIndex !== undefined) {\n const endIndex = this.endIndex.serialize();\n return [\"slice\", this.input.serialize(), this.beginIndex.serialize(), endIndex];\n }\n return [\"slice\", this.input.serialize(), this.beginIndex.serialize()];\n }\n}\n\nexport default Slice;\n","// @flow\n\nimport {toString, ValueType, BooleanType, CollatorType} from '../types';\nimport Assertion from './assertion';\nimport {typeOf} from '../values';\nimport RuntimeError from '../runtime_error';\n\nimport type {Expression} from '../expression';\nimport type EvaluationContext from '../evaluation_context';\nimport type ParsingContext from '../parsing_context';\nimport type {Type} from '../types';\n\ntype ComparisonOperator = '==' | '!=' | '<' | '>' | '<=' | '>=' ;\n\nfunction isComparableType(op: ComparisonOperator, type: Type) {\n if (op === '==' || op === '!=') {\n // equality operator\n return type.kind === 'boolean' ||\n type.kind === 'string' ||\n type.kind === 'number' ||\n type.kind === 'null' ||\n type.kind === 'value';\n } else {\n // ordering operator\n return type.kind === 'string' ||\n type.kind === 'number' ||\n type.kind === 'value';\n }\n}\n\nfunction eq(ctx, a, b) { return a === b; }\nfunction neq(ctx, a, b) { return a !== b; }\nfunction lt(ctx, a, b) { return a < b; }\nfunction gt(ctx, a, b) { return a > b; }\nfunction lteq(ctx, a, b) { return a <= b; }\nfunction gteq(ctx, a, b) { return a >= b; }\n\nfunction eqCollate(ctx, a, b, c) { return c.compare(a, b) === 0; }\nfunction neqCollate(ctx, a, b, c) { return !eqCollate(ctx, a, b, c); }\nfunction ltCollate(ctx, a, b, c) { return c.compare(a, b) < 0; }\nfunction gtCollate(ctx, a, b, c) { return c.compare(a, b) > 0; }\nfunction lteqCollate(ctx, a, b, c) { return c.compare(a, b) <= 0; }\nfunction gteqCollate(ctx, a, b, c) { return c.compare(a, b) >= 0; }\n\n/**\n * Special form for comparison operators, implementing the signatures:\n * - (T, T, ?Collator) => boolean\n * - (T, value, ?Collator) => boolean\n * - (value, T, ?Collator) => boolean\n *\n * For inequalities, T must be either value, string, or number. For ==/!=, it\n * can also be boolean or null.\n *\n * Equality semantics are equivalent to Javascript's strict equality (===/!==)\n * -- i.e., when the arguments' types don't match, == evaluates to false, != to\n * true.\n *\n * When types don't match in an ordering comparison, a runtime error is thrown.\n *\n * @private\n */\nfunction makeComparison(op: ComparisonOperator, compareBasic, compareWithCollator) {\n const isOrderComparison = op !== '==' && op !== '!=';\n\n return class Comparison implements Expression {\n type: Type;\n lhs: Expression;\n rhs: Expression;\n collator: ?Expression;\n hasUntypedArgument: boolean;\n\n constructor(lhs: Expression, rhs: Expression, collator: ?Expression) {\n this.type = BooleanType;\n this.lhs = lhs;\n this.rhs = rhs;\n this.collator = collator;\n this.hasUntypedArgument = lhs.type.kind === 'value' || rhs.type.kind === 'value';\n }\n\n static parse(args: $ReadOnlyArray, context: ParsingContext): ?Expression {\n if (args.length !== 3 && args.length !== 4)\n return context.error(`Expected two or three arguments.`);\n\n const op: ComparisonOperator = (args[0]: any);\n\n let lhs = context.parse(args[1], 1, ValueType);\n if (!lhs) return null;\n if (!isComparableType(op, lhs.type)) {\n return context.concat(1).error(`\"${op}\" comparisons are not supported for type '${toString(lhs.type)}'.`);\n }\n let rhs = context.parse(args[2], 2, ValueType);\n if (!rhs) return null;\n if (!isComparableType(op, rhs.type)) {\n return context.concat(2).error(`\"${op}\" comparisons are not supported for type '${toString(rhs.type)}'.`);\n }\n\n if (\n lhs.type.kind !== rhs.type.kind &&\n lhs.type.kind !== 'value' &&\n rhs.type.kind !== 'value'\n ) {\n return context.error(`Cannot compare types '${toString(lhs.type)}' and '${toString(rhs.type)}'.`);\n }\n\n if (isOrderComparison) {\n // typing rules specific to less/greater than operators\n if (lhs.type.kind === 'value' && rhs.type.kind !== 'value') {\n // (value, T)\n lhs = new Assertion(rhs.type, [lhs]);\n } else if (lhs.type.kind !== 'value' && rhs.type.kind === 'value') {\n // (T, value)\n rhs = new Assertion(lhs.type, [rhs]);\n }\n }\n\n let collator = null;\n if (args.length === 4) {\n if (\n lhs.type.kind !== 'string' &&\n rhs.type.kind !== 'string' &&\n lhs.type.kind !== 'value' &&\n rhs.type.kind !== 'value'\n ) {\n return context.error(`Cannot use collator to compare non-string types.`);\n }\n collator = context.parse(args[3], 3, CollatorType);\n if (!collator) return null;\n }\n\n return new Comparison(lhs, rhs, collator);\n }\n\n evaluate(ctx: EvaluationContext) {\n const lhs = this.lhs.evaluate(ctx);\n const rhs = this.rhs.evaluate(ctx);\n\n if (isOrderComparison && this.hasUntypedArgument) {\n const lt = typeOf(lhs);\n const rt = typeOf(rhs);\n // check that type is string or number, and equal\n if (lt.kind !== rt.kind || !(lt.kind === 'string' || lt.kind === 'number')) {\n throw new RuntimeError(`Expected arguments for \"${op}\" to be (string, string) or (number, number), but found (${lt.kind}, ${rt.kind}) instead.`);\n }\n }\n\n if (this.collator && !isOrderComparison && this.hasUntypedArgument) {\n const lt = typeOf(lhs);\n const rt = typeOf(rhs);\n if (lt.kind !== 'string' || rt.kind !== 'string') {\n return compareBasic(ctx, lhs, rhs);\n }\n }\n\n return this.collator ?\n compareWithCollator(ctx, lhs, rhs, this.collator.evaluate(ctx)) :\n compareBasic(ctx, lhs, rhs);\n }\n\n eachChild(fn: (_: Expression) => void) {\n fn(this.lhs);\n fn(this.rhs);\n if (this.collator) {\n fn(this.collator);\n }\n }\n\n outputDefined(): boolean {\n return true;\n }\n\n serialize() {\n const serialized = [op];\n this.eachChild(child => { serialized.push(child.serialize()); });\n return serialized;\n }\n };\n}\n\nexport const Equals = makeComparison('==', eq, eqCollate);\nexport const NotEquals = makeComparison('!=', neq, neqCollate);\nexport const LessThan = makeComparison('<', lt, ltCollate);\nexport const GreaterThan = makeComparison('>', gt, gtCollate);\nexport const LessThanOrEqual = makeComparison('<=', lteq, lteqCollate);\nexport const GreaterThanOrEqual = makeComparison('>=', gteq, gteqCollate);\n","// @flow\n\nimport {StringType, NumberType} from '../types';\n\nimport type {Expression} from '../expression';\nimport type EvaluationContext from '../evaluation_context';\nimport type ParsingContext from '../parsing_context';\nimport type {Type} from '../types';\n\ndeclare var Intl: {\n NumberFormat: Class\n};\n\ndeclare class Intl$NumberFormat {\n constructor (\n locales?: string | string[],\n options?: NumberFormatOptions\n ): Intl$NumberFormat;\n\n static (\n locales?: string | string[],\n options?: NumberFormatOptions\n ): Intl$NumberFormat;\n\n format(a: number): string;\n\n resolvedOptions(): any;\n}\n\ntype NumberFormatOptions = {\n style?: 'decimal' | 'currency' | 'percent';\n currency?: null | string;\n minimumFractionDigits?: null | string;\n maximumFractionDigits?: null | string;\n};\n\nexport default class NumberFormat implements Expression {\n type: Type;\n number: Expression;\n locale: Expression | null; // BCP 47 language tag\n currency: Expression | null; // ISO 4217 currency code, required if style=currency\n minFractionDigits: Expression | null; // Default 0\n maxFractionDigits: Expression | null; // Default 3\n\n constructor(number: Expression,\n locale: Expression | null,\n currency: Expression | null,\n minFractionDigits: Expression | null,\n maxFractionDigits: Expression | null) {\n this.type = StringType;\n this.number = number;\n this.locale = locale;\n this.currency = currency;\n this.minFractionDigits = minFractionDigits;\n this.maxFractionDigits = maxFractionDigits;\n }\n\n static parse(args: $ReadOnlyArray, context: ParsingContext): ?Expression {\n if (args.length !== 3)\n return context.error(`Expected two arguments.`);\n\n const number = context.parse(args[1], 1, NumberType);\n if (!number) return null;\n\n const options = (args[2]: any);\n if (typeof options !== \"object\" || Array.isArray(options))\n return context.error(`NumberFormat options argument must be an object.`);\n\n let locale = null;\n if (options['locale']) {\n locale = context.parse(options['locale'], 1, StringType);\n if (!locale) return null;\n }\n\n let currency = null;\n if (options['currency']) {\n currency = context.parse(options['currency'], 1, StringType);\n if (!currency) return null;\n }\n\n let minFractionDigits = null;\n if (options['min-fraction-digits']) {\n minFractionDigits = context.parse(options['min-fraction-digits'], 1, NumberType);\n if (!minFractionDigits) return null;\n }\n\n let maxFractionDigits = null;\n if (options['max-fraction-digits']) {\n maxFractionDigits = context.parse(options['max-fraction-digits'], 1, NumberType);\n if (!maxFractionDigits) return null;\n }\n\n return new NumberFormat(number, locale, currency, minFractionDigits, maxFractionDigits);\n }\n\n evaluate(ctx: EvaluationContext) {\n return new Intl.NumberFormat(this.locale ? this.locale.evaluate(ctx) : [],\n {\n style: this.currency ? \"currency\" : \"decimal\",\n currency: this.currency ? this.currency.evaluate(ctx) : undefined,\n minimumFractionDigits: this.minFractionDigits ? this.minFractionDigits.evaluate(ctx) : undefined,\n maximumFractionDigits: this.maxFractionDigits ? this.maxFractionDigits.evaluate(ctx) : undefined,\n }).format(this.number.evaluate(ctx));\n }\n\n eachChild(fn: (_: Expression) => void) {\n fn(this.number);\n if (this.locale) {\n fn(this.locale);\n }\n if (this.currency) {\n fn(this.currency);\n }\n if (this.minFractionDigits) {\n fn(this.minFractionDigits);\n }\n if (this.maxFractionDigits) {\n fn(this.maxFractionDigits);\n }\n }\n\n outputDefined() {\n return false;\n }\n\n serialize() {\n const options = {};\n if (this.locale) {\n options['locale'] = this.locale.serialize();\n }\n if (this.currency) {\n options['currency'] = this.currency.serialize();\n }\n if (this.minFractionDigits) {\n options['min-fraction-digits'] = this.minFractionDigits.serialize();\n }\n if (this.maxFractionDigits) {\n options['max-fraction-digits'] = this.maxFractionDigits.serialize();\n }\n return [\"number-format\", this.number.serialize(), options];\n }\n}\n","// @flow\n\nimport {NumberType, toString} from '../types';\n\nimport {typeOf} from '../values';\nimport RuntimeError from '../runtime_error';\n\nimport type {Expression} from '../expression';\nimport type ParsingContext from '../parsing_context';\nimport type EvaluationContext from '../evaluation_context';\nimport type {Type} from '../types';\n\nclass Length implements Expression {\n type: Type;\n input: Expression;\n\n constructor(input: Expression) {\n this.type = NumberType;\n this.input = input;\n }\n\n static parse(args: $ReadOnlyArray, context: ParsingContext) {\n if (args.length !== 2)\n return context.error(`Expected 1 argument, but found ${args.length - 1} instead.`);\n\n const input = context.parse(args[1], 1);\n if (!input) return null;\n\n if (input.type.kind !== 'array' && input.type.kind !== 'string' && input.type.kind !== 'value')\n return context.error(`Expected argument of type string or array, but found ${toString(input.type)} instead.`);\n\n return new Length(input);\n }\n\n evaluate(ctx: EvaluationContext) {\n const input = this.input.evaluate(ctx);\n if (typeof input === 'string') {\n return input.length;\n } else if (Array.isArray(input)) {\n return input.length;\n } else {\n throw new RuntimeError(`Expected value to be of type string or array, but found ${toString(typeOf(input))} instead.`);\n }\n }\n\n eachChild(fn: (_: Expression) => void) {\n fn(this.input);\n }\n\n outputDefined() {\n return false;\n }\n\n serialize() {\n const serialized = [\"length\"];\n this.eachChild(child => { serialized.push(child.serialize()); });\n return serialized;\n }\n}\n\nexport default Length;\n","// @flow\n\nimport {\n type Type,\n NumberType,\n StringType,\n BooleanType,\n ColorType,\n ObjectType,\n ValueType,\n ErrorType,\n CollatorType,\n array,\n toString as typeToString\n} from '../types';\n\nimport {typeOf, Color, validateRGBA, toString as valueToString} from '../values';\nimport CompoundExpression from '../compound_expression';\nimport RuntimeError from '../runtime_error';\nimport Let from './let';\nimport Var from './var';\nimport Literal from './literal';\nimport Assertion from './assertion';\nimport Coercion from './coercion';\nimport At from './at';\nimport In from './in';\nimport IndexOf from './index_of';\nimport Match from './match';\nimport Case from './case';\nimport Slice from './slice';\nimport Step from './step';\nimport Interpolate from './interpolate';\nimport Coalesce from './coalesce';\nimport {\n Equals,\n NotEquals,\n LessThan,\n GreaterThan,\n LessThanOrEqual,\n GreaterThanOrEqual\n} from './comparison';\nimport CollatorExpression from './collator';\nimport NumberFormat from './number_format';\nimport FormatExpression from './format';\nimport ImageExpression from './image';\nimport Length from './length';\nimport Within from './within';\n\nimport type {Varargs} from '../compound_expression';\nimport type {ExpressionRegistry} from '../expression';\n\nconst expressions: ExpressionRegistry = {\n // special forms\n '==': Equals,\n '!=': NotEquals,\n '>': GreaterThan,\n '<': LessThan,\n '>=': GreaterThanOrEqual,\n '<=': LessThanOrEqual,\n 'array': Assertion,\n 'at': At,\n 'boolean': Assertion,\n 'case': Case,\n 'coalesce': Coalesce,\n 'collator': CollatorExpression,\n 'format': FormatExpression,\n 'image': ImageExpression,\n 'in': In,\n 'index-of': IndexOf,\n 'interpolate': Interpolate,\n 'interpolate-hcl': Interpolate,\n 'interpolate-lab': Interpolate,\n 'length': Length,\n 'let': Let,\n 'literal': Literal,\n 'match': Match,\n 'number': Assertion,\n 'number-format': NumberFormat,\n 'object': Assertion,\n 'slice': Slice,\n 'step': Step,\n 'string': Assertion,\n 'to-boolean': Coercion,\n 'to-color': Coercion,\n 'to-number': Coercion,\n 'to-string': Coercion,\n 'var': Var,\n 'within': Within\n};\n\nfunction rgba(ctx, [r, g, b, a]) {\n r = r.evaluate(ctx);\n g = g.evaluate(ctx);\n b = b.evaluate(ctx);\n const alpha = a ? a.evaluate(ctx) : 1;\n const error = validateRGBA(r, g, b, alpha);\n if (error) throw new RuntimeError(error);\n return new Color(r / 255 * alpha, g / 255 * alpha, b / 255 * alpha, alpha);\n}\n\nfunction has(key, obj) {\n return key in obj;\n}\n\nfunction get(key, obj) {\n const v = obj[key];\n return typeof v === 'undefined' ? null : v;\n}\n\nfunction binarySearch(v, a, i, j) {\n while (i <= j) {\n const m = (i + j) >> 1;\n if (a[m] === v)\n return true;\n if (a[m] > v)\n j = m - 1;\n else\n i = m + 1;\n }\n return false;\n}\n\nfunction varargs(type: Type): Varargs {\n return {type};\n}\n\nCompoundExpression.register(expressions, {\n 'error': [\n ErrorType,\n [StringType],\n (ctx, [v]) => { throw new RuntimeError(v.evaluate(ctx)); }\n ],\n 'typeof': [\n StringType,\n [ValueType],\n (ctx, [v]) => typeToString(typeOf(v.evaluate(ctx)))\n ],\n 'to-rgba': [\n array(NumberType, 4),\n [ColorType],\n (ctx, [v]) => {\n return v.evaluate(ctx).toArray();\n }\n ],\n 'rgb': [\n ColorType,\n [NumberType, NumberType, NumberType],\n rgba\n ],\n 'rgba': [\n ColorType,\n [NumberType, NumberType, NumberType, NumberType],\n rgba\n ],\n 'has': {\n type: BooleanType,\n overloads: [\n [\n [StringType],\n (ctx, [key]) => has(key.evaluate(ctx), ctx.properties())\n ], [\n [StringType, ObjectType],\n (ctx, [key, obj]) => has(key.evaluate(ctx), obj.evaluate(ctx))\n ]\n ]\n },\n 'get': {\n type: ValueType,\n overloads: [\n [\n [StringType],\n (ctx, [key]) => get(key.evaluate(ctx), ctx.properties())\n ], [\n [StringType, ObjectType],\n (ctx, [key, obj]) => get(key.evaluate(ctx), obj.evaluate(ctx))\n ]\n ]\n },\n 'feature-state': [\n ValueType,\n [StringType],\n (ctx, [key]) => get(key.evaluate(ctx), ctx.featureState || {})\n ],\n 'properties': [\n ObjectType,\n [],\n (ctx) => ctx.properties()\n ],\n 'geometry-type': [\n StringType,\n [],\n (ctx) => ctx.geometryType()\n ],\n 'id': [\n ValueType,\n [],\n (ctx) => ctx.id()\n ],\n 'zoom': [\n NumberType,\n [],\n (ctx) => ctx.globals.zoom\n ],\n 'heatmap-density': [\n NumberType,\n [],\n (ctx) => ctx.globals.heatmapDensity || 0\n ],\n 'line-progress': [\n NumberType,\n [],\n (ctx) => ctx.globals.lineProgress || 0\n ],\n 'accumulated': [\n ValueType,\n [],\n (ctx) => ctx.globals.accumulated === undefined ? null : ctx.globals.accumulated\n ],\n '+': [\n NumberType,\n varargs(NumberType),\n (ctx, args) => {\n let result = 0;\n for (const arg of args) {\n result += arg.evaluate(ctx);\n }\n return result;\n }\n ],\n '*': [\n NumberType,\n varargs(NumberType),\n (ctx, args) => {\n let result = 1;\n for (const arg of args) {\n result *= arg.evaluate(ctx);\n }\n return result;\n }\n ],\n '-': {\n type: NumberType,\n overloads: [\n [\n [NumberType, NumberType],\n (ctx, [a, b]) => a.evaluate(ctx) - b.evaluate(ctx)\n ], [\n [NumberType],\n (ctx, [a]) => -a.evaluate(ctx)\n ]\n ]\n },\n '/': [\n NumberType,\n [NumberType, NumberType],\n (ctx, [a, b]) => a.evaluate(ctx) / b.evaluate(ctx)\n ],\n '%': [\n NumberType,\n [NumberType, NumberType],\n (ctx, [a, b]) => a.evaluate(ctx) % b.evaluate(ctx)\n ],\n 'ln2': [\n NumberType,\n [],\n () => Math.LN2\n ],\n 'pi': [\n NumberType,\n [],\n () => Math.PI\n ],\n 'e': [\n NumberType,\n [],\n () => Math.E\n ],\n '^': [\n NumberType,\n [NumberType, NumberType],\n (ctx, [b, e]) => Math.pow(b.evaluate(ctx), e.evaluate(ctx))\n ],\n 'sqrt': [\n NumberType,\n [NumberType],\n (ctx, [x]) => Math.sqrt(x.evaluate(ctx))\n ],\n 'log10': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.log(n.evaluate(ctx)) / Math.LN10\n ],\n 'ln': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.log(n.evaluate(ctx))\n ],\n 'log2': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.log(n.evaluate(ctx)) / Math.LN2\n ],\n 'sin': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.sin(n.evaluate(ctx))\n ],\n 'cos': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.cos(n.evaluate(ctx))\n ],\n 'tan': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.tan(n.evaluate(ctx))\n ],\n 'asin': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.asin(n.evaluate(ctx))\n ],\n 'acos': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.acos(n.evaluate(ctx))\n ],\n 'atan': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.atan(n.evaluate(ctx))\n ],\n 'min': [\n NumberType,\n varargs(NumberType),\n (ctx, args) => Math.min(...args.map(arg => arg.evaluate(ctx)))\n ],\n 'max': [\n NumberType,\n varargs(NumberType),\n (ctx, args) => Math.max(...args.map(arg => arg.evaluate(ctx)))\n ],\n 'abs': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.abs(n.evaluate(ctx))\n ],\n 'round': [\n NumberType,\n [NumberType],\n (ctx, [n]) => {\n const v = n.evaluate(ctx);\n // Javascript's Math.round() rounds towards +Infinity for halfway\n // values, even when they're negative. It's more common to round\n // away from 0 (e.g., this is what python and C++ do)\n return v < 0 ? -Math.round(-v) : Math.round(v);\n }\n ],\n 'floor': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.floor(n.evaluate(ctx))\n ],\n 'ceil': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.ceil(n.evaluate(ctx))\n ],\n 'filter-==': [\n BooleanType,\n [StringType, ValueType],\n (ctx, [k, v]) => ctx.properties()[(k: any).value] === (v: any).value\n ],\n 'filter-id-==': [\n BooleanType,\n [ValueType],\n (ctx, [v]) => ctx.id() === (v: any).value\n ],\n 'filter-type-==': [\n BooleanType,\n [StringType],\n (ctx, [v]) => ctx.geometryType() === (v: any).value\n ],\n 'filter-<': [\n BooleanType,\n [StringType, ValueType],\n (ctx, [k, v]) => {\n const a = ctx.properties()[(k: any).value];\n const b = (v: any).value;\n return typeof a === typeof b && a < b;\n }\n ],\n 'filter-id-<': [\n BooleanType,\n [ValueType],\n (ctx, [v]) => {\n const a = ctx.id();\n const b = (v: any).value;\n return typeof a === typeof b && a < b;\n }\n ],\n 'filter->': [\n BooleanType,\n [StringType, ValueType],\n (ctx, [k, v]) => {\n const a = ctx.properties()[(k: any).value];\n const b = (v: any).value;\n return typeof a === typeof b && a > b;\n }\n ],\n 'filter-id->': [\n BooleanType,\n [ValueType],\n (ctx, [v]) => {\n const a = ctx.id();\n const b = (v: any).value;\n return typeof a === typeof b && a > b;\n }\n ],\n 'filter-<=': [\n BooleanType,\n [StringType, ValueType],\n (ctx, [k, v]) => {\n const a = ctx.properties()[(k: any).value];\n const b = (v: any).value;\n return typeof a === typeof b && a <= b;\n }\n ],\n 'filter-id-<=': [\n BooleanType,\n [ValueType],\n (ctx, [v]) => {\n const a = ctx.id();\n const b = (v: any).value;\n return typeof a === typeof b && a <= b;\n }\n ],\n 'filter->=': [\n BooleanType,\n [StringType, ValueType],\n (ctx, [k, v]) => {\n const a = ctx.properties()[(k: any).value];\n const b = (v: any).value;\n return typeof a === typeof b && a >= b;\n }\n ],\n 'filter-id->=': [\n BooleanType,\n [ValueType],\n (ctx, [v]) => {\n const a = ctx.id();\n const b = (v: any).value;\n return typeof a === typeof b && a >= b;\n }\n ],\n 'filter-has': [\n BooleanType,\n [ValueType],\n (ctx, [k]) => (k: any).value in ctx.properties()\n ],\n 'filter-has-id': [\n BooleanType,\n [],\n (ctx) => (ctx.id() !== null && ctx.id() !== undefined)\n ],\n 'filter-type-in': [\n BooleanType,\n [array(StringType)],\n (ctx, [v]) => (v: any).value.indexOf(ctx.geometryType()) >= 0\n ],\n 'filter-id-in': [\n BooleanType,\n [array(ValueType)],\n (ctx, [v]) => (v: any).value.indexOf(ctx.id()) >= 0\n ],\n 'filter-in-small': [\n BooleanType,\n [StringType, array(ValueType)],\n // assumes v is an array literal\n (ctx, [k, v]) => (v: any).value.indexOf(ctx.properties()[(k: any).value]) >= 0\n ],\n 'filter-in-large': [\n BooleanType,\n [StringType, array(ValueType)],\n // assumes v is a array literal with values sorted in ascending order and of a single type\n (ctx, [k, v]) => binarySearch(ctx.properties()[(k: any).value], (v: any).value, 0, (v: any).value.length - 1)\n ],\n 'all': {\n type: BooleanType,\n overloads: [\n [\n [BooleanType, BooleanType],\n (ctx, [a, b]) => a.evaluate(ctx) && b.evaluate(ctx)\n ],\n [\n varargs(BooleanType),\n (ctx, args) => {\n for (const arg of args) {\n if (!arg.evaluate(ctx))\n return false;\n }\n return true;\n }\n ]\n ]\n },\n 'any': {\n type: BooleanType,\n overloads: [\n [\n [BooleanType, BooleanType],\n (ctx, [a, b]) => a.evaluate(ctx) || b.evaluate(ctx)\n ],\n [\n varargs(BooleanType),\n (ctx, args) => {\n for (const arg of args) {\n if (arg.evaluate(ctx))\n return true;\n }\n return false;\n }\n ]\n ]\n },\n '!': [\n BooleanType,\n [BooleanType],\n (ctx, [b]) => !b.evaluate(ctx)\n ],\n 'is-supported-script': [\n BooleanType,\n [StringType],\n // At parse time this will always return true, so we need to exclude this expression with isGlobalPropertyConstant\n (ctx, [s]) => {\n const isSupportedScript = ctx.globals && ctx.globals.isSupportedScript;\n if (isSupportedScript) {\n return isSupportedScript(s.evaluate(ctx));\n }\n return true;\n }\n ],\n 'upcase': [\n StringType,\n [StringType],\n (ctx, [s]) => s.evaluate(ctx).toUpperCase()\n ],\n 'downcase': [\n StringType,\n [StringType],\n (ctx, [s]) => s.evaluate(ctx).toLowerCase()\n ],\n 'concat': [\n StringType,\n varargs(ValueType),\n (ctx, args) => args.map(arg => valueToString(arg.evaluate(ctx))).join('')\n ],\n 'resolved-locale': [\n StringType,\n [CollatorType],\n (ctx, [collator]) => collator.evaluate(ctx).resolvedLocale()\n ]\n});\n\nexport default expressions;\n","// @flow\n\n/**\n * A type used for returning and propagating errors. The first element of the union\n * represents success and contains a value, and the second represents an error and\n * contains an error value.\n * @private\n */\nexport type Result =\n | {| result: 'success', value: T |}\n | {| result: 'error', value: E |};\n\nexport function success(value: T): Result {\n return {result: 'success', value};\n}\n\nexport function error(value: E): Result {\n return {result: 'error', value};\n}\n","// @flow\n\nimport type {StylePropertySpecification} from '../style-spec';\n\nexport function supportsPropertyExpression(spec: StylePropertySpecification): boolean {\n return spec['property-type'] === 'data-driven' || spec['property-type'] === 'cross-faded-data-driven';\n}\n\nexport function supportsZoomExpression(spec: StylePropertySpecification): boolean {\n return !!spec.expression && spec.expression.parameters.indexOf('zoom') > -1;\n}\n\nexport function supportsInterpolation(spec: StylePropertySpecification): boolean {\n return !!spec.expression && spec.expression.interpolated;\n}\n","// @flow\n\nexport default function getType(val: mixed): string {\n if (val instanceof Number) {\n return 'number';\n } else if (val instanceof String) {\n return 'string';\n } else if (val instanceof Boolean) {\n return 'boolean';\n } else if (Array.isArray(val)) {\n return 'array';\n } else if (val === null) {\n return 'null';\n } else {\n return typeof val;\n }\n}\n","\nimport * as colorSpaces from '../util/color_spaces';\nimport Color from '../util/color';\nimport extend from '../util/extend';\nimport getType from '../util/get_type';\nimport * as interpolate from '../util/interpolate';\nimport Interpolate from '../expression/definitions/interpolate';\nimport Formatted from '../expression/types/formatted';\nimport ResolvedImage from '../expression/types/resolved_image';\nimport {supportsInterpolation} from '../util/properties';\nimport {findStopLessThanOrEqualTo} from '../expression/stops';\n\nexport function isFunction(value) {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction identityFunction(x) {\n return x;\n}\n\nexport function createFunction(parameters, propertySpec) {\n const isColor = propertySpec.type === 'color';\n const zoomAndFeatureDependent = parameters.stops && typeof parameters.stops[0][0] === 'object';\n const featureDependent = zoomAndFeatureDependent || parameters.property !== undefined;\n const zoomDependent = zoomAndFeatureDependent || !featureDependent;\n const type = parameters.type || (supportsInterpolation(propertySpec) ? 'exponential' : 'interval');\n\n if (isColor) {\n parameters = extend({}, parameters);\n\n if (parameters.stops) {\n parameters.stops = parameters.stops.map((stop) => {\n return [stop[0], Color.parse(stop[1])];\n });\n }\n\n if (parameters.default) {\n parameters.default = Color.parse(parameters.default);\n } else {\n parameters.default = Color.parse(propertySpec.default);\n }\n }\n\n if (parameters.colorSpace && parameters.colorSpace !== 'rgb' && !colorSpaces[parameters.colorSpace]) { // eslint-disable-line import/namespace\n throw new Error(`Unknown color space: ${parameters.colorSpace}`);\n }\n\n let innerFun;\n let hashedStops;\n let categoricalKeyType;\n if (type === 'exponential') {\n innerFun = evaluateExponentialFunction;\n } else if (type === 'interval') {\n innerFun = evaluateIntervalFunction;\n } else if (type === 'categorical') {\n innerFun = evaluateCategoricalFunction;\n\n // For categorical functions, generate an Object as a hashmap of the stops for fast searching\n hashedStops = Object.create(null);\n for (const stop of parameters.stops) {\n hashedStops[stop[0]] = stop[1];\n }\n\n // Infer key type based on first stop key-- used to encforce strict type checking later\n categoricalKeyType = typeof parameters.stops[0][0];\n\n } else if (type === 'identity') {\n innerFun = evaluateIdentityFunction;\n } else {\n throw new Error(`Unknown function type \"${type}\"`);\n }\n\n if (zoomAndFeatureDependent) {\n const featureFunctions = {};\n const zoomStops = [];\n for (let s = 0; s < parameters.stops.length; s++) {\n const stop = parameters.stops[s];\n const zoom = stop[0].zoom;\n if (featureFunctions[zoom] === undefined) {\n featureFunctions[zoom] = {\n zoom,\n type: parameters.type,\n property: parameters.property,\n default: parameters.default,\n stops: []\n };\n zoomStops.push(zoom);\n }\n featureFunctions[zoom].stops.push([stop[0].value, stop[1]]);\n }\n\n const featureFunctionStops = [];\n for (const z of zoomStops) {\n featureFunctionStops.push([featureFunctions[z].zoom, createFunction(featureFunctions[z], propertySpec)]);\n }\n\n const interpolationType = {name: 'linear'};\n return {\n kind: 'composite',\n interpolationType,\n interpolationFactor: Interpolate.interpolationFactor.bind(undefined, interpolationType),\n zoomStops: featureFunctionStops.map(s => s[0]),\n evaluate({zoom}, properties) {\n return evaluateExponentialFunction({\n stops: featureFunctionStops,\n base: parameters.base\n }, propertySpec, zoom).evaluate(zoom, properties);\n }\n };\n } else if (zoomDependent) {\n const interpolationType = type === 'exponential' ?\n {name: 'exponential', base: parameters.base !== undefined ? parameters.base : 1} : null;\n return {\n kind: 'camera',\n interpolationType,\n interpolationFactor: Interpolate.interpolationFactor.bind(undefined, interpolationType),\n zoomStops: parameters.stops.map(s => s[0]),\n evaluate: ({zoom}) => innerFun(parameters, propertySpec, zoom, hashedStops, categoricalKeyType)\n };\n } else {\n return {\n kind: 'source',\n evaluate(_, feature) {\n const value = feature && feature.properties ? feature.properties[parameters.property] : undefined;\n if (value === undefined) {\n return coalesce(parameters.default, propertySpec.default);\n }\n return innerFun(parameters, propertySpec, value, hashedStops, categoricalKeyType);\n }\n };\n }\n}\n\nfunction coalesce(a, b, c) {\n if (a !== undefined) return a;\n if (b !== undefined) return b;\n if (c !== undefined) return c;\n}\n\nfunction evaluateCategoricalFunction(parameters, propertySpec, input, hashedStops, keyType) {\n const evaluated = typeof input === keyType ? hashedStops[input] : undefined; // Enforce strict typing on input\n return coalesce(evaluated, parameters.default, propertySpec.default);\n}\n\nfunction evaluateIntervalFunction(parameters, propertySpec, input) {\n // Edge cases\n if (getType(input) !== 'number') return coalesce(parameters.default, propertySpec.default);\n const n = parameters.stops.length;\n if (n === 1) return parameters.stops[0][1];\n if (input <= parameters.stops[0][0]) return parameters.stops[0][1];\n if (input >= parameters.stops[n - 1][0]) return parameters.stops[n - 1][1];\n\n const index = findStopLessThanOrEqualTo(parameters.stops.map((stop) => stop[0]), input);\n\n return parameters.stops[index][1];\n}\n\nfunction evaluateExponentialFunction(parameters, propertySpec, input) {\n const base = parameters.base !== undefined ? parameters.base : 1;\n\n // Edge cases\n if (getType(input) !== 'number') return coalesce(parameters.default, propertySpec.default);\n const n = parameters.stops.length;\n if (n === 1) return parameters.stops[0][1];\n if (input <= parameters.stops[0][0]) return parameters.stops[0][1];\n if (input >= parameters.stops[n - 1][0]) return parameters.stops[n - 1][1];\n\n const index = findStopLessThanOrEqualTo(parameters.stops.map((stop) => stop[0]), input);\n const t = interpolationFactor(\n input, base,\n parameters.stops[index][0],\n parameters.stops[index + 1][0]);\n\n const outputLower = parameters.stops[index][1];\n const outputUpper = parameters.stops[index + 1][1];\n let interp = interpolate[propertySpec.type] || identityFunction; // eslint-disable-line import/namespace\n\n if (parameters.colorSpace && parameters.colorSpace !== 'rgb') {\n const colorspace = colorSpaces[parameters.colorSpace]; // eslint-disable-line import/namespace\n interp = (a, b) => colorspace.reverse(colorspace.interpolate(colorspace.forward(a), colorspace.forward(b), t));\n }\n\n if (typeof outputLower.evaluate === 'function') {\n return {\n evaluate(...args) {\n const evaluatedLower = outputLower.evaluate.apply(undefined, args);\n const evaluatedUpper = outputUpper.evaluate.apply(undefined, args);\n // Special case for fill-outline-color, which has no spec default.\n if (evaluatedLower === undefined || evaluatedUpper === undefined) {\n return undefined;\n }\n return interp(evaluatedLower, evaluatedUpper, t);\n }\n };\n }\n\n return interp(outputLower, outputUpper, t);\n}\n\nfunction evaluateIdentityFunction(parameters, propertySpec, input) {\n if (propertySpec.type === 'color') {\n input = Color.parse(input);\n } else if (propertySpec.type === 'formatted') {\n input = Formatted.fromString(input.toString());\n } else if (propertySpec.type === 'resolvedImage') {\n input = ResolvedImage.fromString(input.toString());\n } else if (getType(input) !== propertySpec.type && (propertySpec.type !== 'enum' || !propertySpec.values[input])) {\n input = undefined;\n }\n return coalesce(input, parameters.default, propertySpec.default);\n}\n\n/**\n * Returns a ratio that can be used to interpolate between exponential function\n * stops.\n *\n * How it works:\n * Two consecutive stop values define a (scaled and shifted) exponential\n * function `f(x) = a * base^x + b`, where `base` is the user-specified base,\n * and `a` and `b` are constants affording sufficient degrees of freedom to fit\n * the function to the given stops.\n *\n * Here's a bit of algebra that lets us compute `f(x)` directly from the stop\n * values without explicitly solving for `a` and `b`:\n *\n * First stop value: `f(x0) = y0 = a * base^x0 + b`\n * Second stop value: `f(x1) = y1 = a * base^x1 + b`\n * => `y1 - y0 = a(base^x1 - base^x0)`\n * => `a = (y1 - y0)/(base^x1 - base^x0)`\n *\n * Desired value: `f(x) = y = a * base^x + b`\n * => `f(x) = y0 + a * (base^x - base^x0)`\n *\n * From the above, we can replace the `a` in `a * (base^x - base^x0)` and do a\n * little algebra:\n * ```\n * a * (base^x - base^x0) = (y1 - y0)/(base^x1 - base^x0) * (base^x - base^x0)\n * = (y1 - y0) * (base^x - base^x0) / (base^x1 - base^x0)\n * ```\n *\n * If we let `(base^x - base^x0) / (base^x1 base^x0)`, then we have\n * `f(x) = y0 + (y1 - y0) * ratio`. In other words, `ratio` may be treated as\n * an interpolation factor between the two stops' output values.\n *\n * (Note: a slightly different form for `ratio`,\n * `(base^(x-x0) - 1) / (base^(x1-x0) - 1) `, is equivalent, but requires fewer\n * expensive `Math.pow()` operations.)\n *\n * @private\n */\nfunction interpolationFactor(input, base, lowerValue, upperValue) {\n const difference = upperValue - lowerValue;\n const progress = input - lowerValue;\n\n if (difference === 0) {\n return 0;\n } else if (base === 1) {\n return progress / difference;\n } else {\n return (Math.pow(base, progress) - 1) / (Math.pow(base, difference) - 1);\n }\n}\n","// @flow\n\nimport assert from 'assert';\n\nimport extend from '../util/extend';\nimport ParsingError from './parsing_error';\nimport ParsingContext from './parsing_context';\nimport EvaluationContext from './evaluation_context';\nimport CompoundExpression from './compound_expression';\nimport Step from './definitions/step';\nimport Interpolate from './definitions/interpolate';\nimport Coalesce from './definitions/coalesce';\nimport Let from './definitions/let';\nimport definitions from './definitions';\nimport * as isConstant from './is_constant';\nimport RuntimeError from './runtime_error';\nimport {success, error} from '../util/result';\nimport {supportsPropertyExpression, supportsZoomExpression, supportsInterpolation} from '../util/properties';\n\nimport type {Type, EvaluationKind} from './types';\nimport type {Value} from './values';\nimport type {Expression} from './expression';\nimport type {StylePropertySpecification} from '../style-spec';\nimport type {Result} from '../util/result';\nimport type {InterpolationType} from './definitions/interpolate';\nimport type {PropertyValueSpecification} from '../types';\nimport type {FormattedSection} from './types/formatted';\nimport type Point from '@mapbox/point-geometry';\nimport type {CanonicalTileID} from '../../source/tile_id';\n\nexport type Feature = {\n +type: 1 | 2 | 3 | 'Unknown' | 'Point' | 'MultiPoint' | 'LineString' | 'MultiLineString' | 'Polygon' | 'MultiPolygon',\n +id?: any,\n +properties: {[_: string]: any},\n +patterns?: {[_: string]: {\"min\": string, \"mid\": string, \"max\": string}},\n +geometry?: Array>\n};\n\nexport type FeatureState = {[_: string]: any};\n\nexport type GlobalProperties = $ReadOnly<{\n zoom: number,\n heatmapDensity?: number,\n lineProgress?: number,\n isSupportedScript?: (_: string) => boolean,\n accumulated?: Value\n}>;\n\nexport class StyleExpression {\n expression: Expression;\n\n _evaluator: EvaluationContext;\n _defaultValue: Value;\n _warningHistory: {[key: string]: boolean};\n _enumValues: ?{[_: string]: any};\n\n constructor(expression: Expression, propertySpec: ?StylePropertySpecification) {\n this.expression = expression;\n this._warningHistory = {};\n this._evaluator = new EvaluationContext();\n this._defaultValue = propertySpec ? getDefaultValue(propertySpec) : null;\n this._enumValues = propertySpec && propertySpec.type === 'enum' ? propertySpec.values : null;\n }\n\n evaluateWithoutErrorHandling(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: Array, formattedSection?: FormattedSection): any {\n this._evaluator.globals = globals;\n this._evaluator.feature = feature;\n this._evaluator.featureState = featureState;\n this._evaluator.canonical = canonical;\n this._evaluator.availableImages = availableImages || null;\n this._evaluator.formattedSection = formattedSection;\n\n return this.expression.evaluate(this._evaluator);\n }\n\n evaluate(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: Array, formattedSection?: FormattedSection): any {\n this._evaluator.globals = globals;\n this._evaluator.feature = feature || null;\n this._evaluator.featureState = featureState || null;\n this._evaluator.canonical = canonical;\n this._evaluator.availableImages = availableImages || null;\n this._evaluator.formattedSection = formattedSection || null;\n\n try {\n const val = this.expression.evaluate(this._evaluator);\n // eslint-disable-next-line no-self-compare\n if (val === null || val === undefined || (typeof val === 'number' && val !== val)) {\n return this._defaultValue;\n }\n if (this._enumValues && !(val in this._enumValues)) {\n throw new RuntimeError(`Expected value to be one of ${Object.keys(this._enumValues).map(v => JSON.stringify(v)).join(', ')}, but found ${JSON.stringify(val)} instead.`);\n }\n return val;\n } catch (e) {\n if (!this._warningHistory[e.message]) {\n this._warningHistory[e.message] = true;\n if (typeof console !== 'undefined') {\n console.warn(e.message);\n }\n }\n return this._defaultValue;\n }\n }\n}\n\nexport function isExpression(expression: mixed) {\n return Array.isArray(expression) && expression.length > 0 &&\n typeof expression[0] === 'string' && expression[0] in definitions;\n}\n\n/**\n * Parse and typecheck the given style spec JSON expression. If\n * options.defaultValue is provided, then the resulting StyleExpression's\n * `evaluate()` method will handle errors by logging a warning (once per\n * message) and returning the default value. Otherwise, it will throw\n * evaluation errors.\n *\n * @private\n */\nexport function createExpression(expression: mixed, propertySpec: ?StylePropertySpecification): Result> {\n const parser = new ParsingContext(definitions, [], propertySpec ? getExpectedType(propertySpec) : undefined);\n\n // For string-valued properties, coerce to string at the top level rather than asserting.\n const parsed = parser.parse(expression, undefined, undefined, undefined,\n propertySpec && propertySpec.type === 'string' ? {typeAnnotation: 'coerce'} : undefined);\n\n if (!parsed) {\n assert(parser.errors.length > 0);\n return error(parser.errors);\n }\n\n return success(new StyleExpression(parsed, propertySpec));\n}\n\nexport class ZoomConstantExpression {\n kind: Kind;\n isStateDependent: boolean;\n _styleExpression: StyleExpression;\n\n constructor(kind: Kind, expression: StyleExpression) {\n this.kind = kind;\n this._styleExpression = expression;\n this.isStateDependent = kind !== ('constant': EvaluationKind) && !isConstant.isStateConstant(expression.expression);\n }\n\n evaluateWithoutErrorHandling(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: Array, formattedSection?: FormattedSection): any {\n return this._styleExpression.evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection);\n }\n\n evaluate(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: Array, formattedSection?: FormattedSection): any {\n return this._styleExpression.evaluate(globals, feature, featureState, canonical, availableImages, formattedSection);\n }\n}\n\nexport class ZoomDependentExpression {\n kind: Kind;\n zoomStops: Array;\n isStateDependent: boolean;\n\n _styleExpression: StyleExpression;\n interpolationType: ?InterpolationType;\n\n constructor(kind: Kind, expression: StyleExpression, zoomStops: Array, interpolationType?: InterpolationType) {\n this.kind = kind;\n this.zoomStops = zoomStops;\n this._styleExpression = expression;\n this.isStateDependent = kind !== ('camera': EvaluationKind) && !isConstant.isStateConstant(expression.expression);\n this.interpolationType = interpolationType;\n }\n\n evaluateWithoutErrorHandling(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: Array, formattedSection?: FormattedSection): any {\n return this._styleExpression.evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection);\n }\n\n evaluate(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: Array, formattedSection?: FormattedSection): any {\n return this._styleExpression.evaluate(globals, feature, featureState, canonical, availableImages, formattedSection);\n }\n\n interpolationFactor(input: number, lower: number, upper: number): number {\n if (this.interpolationType) {\n return Interpolate.interpolationFactor(this.interpolationType, input, lower, upper);\n } else {\n return 0;\n }\n }\n}\n\nexport type ConstantExpression = {\n kind: 'constant',\n +evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: Array) => any,\n}\n\nexport type SourceExpression = {\n kind: 'source',\n isStateDependent: boolean,\n +evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: Array, formattedSection?: FormattedSection) => any,\n};\n\nexport type CameraExpression = {\n kind: 'camera',\n +evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: Array) => any,\n +interpolationFactor: (input: number, lower: number, upper: number) => number,\n zoomStops: Array,\n interpolationType: ?InterpolationType\n};\n\nexport type CompositeExpression = {\n kind: 'composite',\n isStateDependent: boolean,\n +evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: Array, formattedSection?: FormattedSection) => any,\n +interpolationFactor: (input: number, lower: number, upper: number) => number,\n zoomStops: Array,\n interpolationType: ?InterpolationType\n};\n\nexport type StylePropertyExpression =\n | ConstantExpression\n | SourceExpression\n | CameraExpression\n | CompositeExpression;\n\nexport function createPropertyExpression(expression: mixed, propertySpec: StylePropertySpecification): Result> {\n expression = createExpression(expression, propertySpec);\n if (expression.result === 'error') {\n return expression;\n }\n\n const parsed = expression.value.expression;\n\n const isFeatureConstant = isConstant.isFeatureConstant(parsed);\n if (!isFeatureConstant && !supportsPropertyExpression(propertySpec)) {\n return error([new ParsingError('', 'data expressions not supported')]);\n }\n\n const isZoomConstant = isConstant.isGlobalPropertyConstant(parsed, ['zoom']);\n if (!isZoomConstant && !supportsZoomExpression(propertySpec)) {\n return error([new ParsingError('', 'zoom expressions not supported')]);\n }\n\n const zoomCurve = findZoomCurve(parsed);\n if (!zoomCurve && !isZoomConstant) {\n return error([new ParsingError('', '\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression.')]);\n } else if (zoomCurve instanceof ParsingError) {\n return error([zoomCurve]);\n } else if (zoomCurve instanceof Interpolate && !supportsInterpolation(propertySpec)) {\n return error([new ParsingError('', '\"interpolate\" expressions cannot be used with this property')]);\n }\n\n if (!zoomCurve) {\n return success(isFeatureConstant ?\n (new ZoomConstantExpression('constant', expression.value): ConstantExpression) :\n (new ZoomConstantExpression('source', expression.value): SourceExpression));\n }\n\n const interpolationType = zoomCurve instanceof Interpolate ? zoomCurve.interpolation : undefined;\n\n return success(isFeatureConstant ?\n (new ZoomDependentExpression('camera', expression.value, zoomCurve.labels, interpolationType): CameraExpression) :\n (new ZoomDependentExpression('composite', expression.value, zoomCurve.labels, interpolationType): CompositeExpression));\n}\n\nimport {isFunction, createFunction} from '../function';\nimport {Color} from './values';\n\n// serialization wrapper for old-style stop functions normalized to the\n// expression interface\nexport class StylePropertyFunction {\n _parameters: PropertyValueSpecification;\n _specification: StylePropertySpecification;\n\n kind: EvaluationKind;\n evaluate: (globals: GlobalProperties, feature?: Feature) => any;\n interpolationFactor: ?(input: number, lower: number, upper: number) => number;\n zoomStops: ?Array;\n\n constructor(parameters: PropertyValueSpecification, specification: StylePropertySpecification) {\n this._parameters = parameters;\n this._specification = specification;\n extend(this, createFunction(this._parameters, this._specification));\n }\n\n static deserialize(serialized: {_parameters: PropertyValueSpecification, _specification: StylePropertySpecification}) {\n return ((new StylePropertyFunction(serialized._parameters, serialized._specification)): StylePropertyFunction);\n }\n\n static serialize(input: StylePropertyFunction) {\n return {\n _parameters: input._parameters,\n _specification: input._specification\n };\n }\n}\n\nexport function normalizePropertyExpression(value: PropertyValueSpecification, specification: StylePropertySpecification): StylePropertyExpression {\n if (isFunction(value)) {\n return (new StylePropertyFunction(value, specification): any);\n\n } else if (isExpression(value)) {\n const expression = createPropertyExpression(value, specification);\n if (expression.result === 'error') {\n // this should have been caught in validation\n throw new Error(expression.value.map(err => `${err.key}: ${err.message}`).join(', '));\n }\n return expression.value;\n\n } else {\n let constant: any = value;\n if (typeof value === 'string' && specification.type === 'color') {\n constant = Color.parse(value);\n }\n return {\n kind: 'constant',\n evaluate: () => constant\n };\n }\n}\n\n// Zoom-dependent expressions may only use [\"zoom\"] as the input to a top-level \"step\" or \"interpolate\"\n// expression (collectively referred to as a \"curve\"). The curve may be wrapped in one or more \"let\" or\n// \"coalesce\" expressions.\nfunction findZoomCurve(expression: Expression): Step | Interpolate | ParsingError | null {\n let result = null;\n if (expression instanceof Let) {\n result = findZoomCurve(expression.result);\n\n } else if (expression instanceof Coalesce) {\n for (const arg of expression.args) {\n result = findZoomCurve(arg);\n if (result) {\n break;\n }\n }\n\n } else if ((expression instanceof Step || expression instanceof Interpolate) &&\n expression.input instanceof CompoundExpression &&\n expression.input.name === 'zoom') {\n\n result = expression;\n }\n\n if (result instanceof ParsingError) {\n return result;\n }\n\n expression.eachChild((child) => {\n const childResult = findZoomCurve(child);\n if (childResult instanceof ParsingError) {\n result = childResult;\n } else if (!result && childResult) {\n result = new ParsingError('', '\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression.');\n } else if (result && childResult && result !== childResult) {\n result = new ParsingError('', 'Only one zoom-based \"step\" or \"interpolate\" subexpression may be used in an expression.');\n }\n });\n\n return result;\n}\n\nimport {ColorType, StringType, NumberType, BooleanType, ValueType, FormattedType, ResolvedImageType, array} from './types';\n\nfunction getExpectedType(spec: StylePropertySpecification): Type {\n const types = {\n color: ColorType,\n string: StringType,\n number: NumberType,\n enum: StringType,\n boolean: BooleanType,\n formatted: FormattedType,\n resolvedImage: ResolvedImageType\n };\n\n if (spec.type === 'array') {\n return array(types[spec.value] || ValueType, spec.length);\n }\n\n return types[spec.type];\n}\n\nfunction getDefaultValue(spec: StylePropertySpecification): Value {\n if (spec.type === 'color' && isFunction(spec.default)) {\n // Special case for heatmap-color: it uses the 'default:' to define a\n // default color ramp, but createExpression expects a simple value to fall\n // back to in case of runtime errors\n return new Color(0, 0, 0, 0);\n } else if (spec.type === 'color') {\n return Color.parse(spec.default) || null;\n } else if (spec.default === undefined) {\n return null;\n } else {\n return spec.default;\n }\n}\n","\nimport ValidationError from '../error/validation_error';\nimport getType from '../util/get_type';\nimport validateSpec from './validate';\n\nexport default function validateObject(options) {\n const key = options.key;\n const object = options.value;\n const elementSpecs = options.valueSpec || {};\n const elementValidators = options.objectElementValidators || {};\n const style = options.style;\n const styleSpec = options.styleSpec;\n let errors = [];\n\n const type = getType(object);\n if (type !== 'object') {\n return [new ValidationError(key, object, `object expected, ${type} found`)];\n }\n\n for (const objectKey in object) {\n const elementSpecKey = objectKey.split('.')[0]; // treat 'paint.*' as 'paint'\n const elementSpec = elementSpecs[elementSpecKey] || elementSpecs['*'];\n\n let validateElement;\n if (elementValidators[elementSpecKey]) {\n validateElement = elementValidators[elementSpecKey];\n } else if (elementSpecs[elementSpecKey]) {\n validateElement = validateSpec;\n } else if (elementValidators['*']) {\n validateElement = elementValidators['*'];\n } else if (elementSpecs['*']) {\n validateElement = validateSpec;\n } else {\n errors.push(new ValidationError(key, object[objectKey], `unknown property \"${objectKey}\"`));\n continue;\n }\n\n errors = errors.concat(validateElement({\n key: (key ? `${key}.` : key) + objectKey,\n value: object[objectKey],\n valueSpec: elementSpec,\n style,\n styleSpec,\n object,\n objectKey\n }, object));\n }\n\n for (const elementSpecKey in elementSpecs) {\n // Don't check `required` when there's a custom validator for that property.\n if (elementValidators[elementSpecKey]) {\n continue;\n }\n\n if (elementSpecs[elementSpecKey].required && elementSpecs[elementSpecKey]['default'] === undefined && object[elementSpecKey] === undefined) {\n errors.push(new ValidationError(key, object, `missing required property \"${elementSpecKey}\"`));\n }\n }\n\n return errors;\n}\n","\nimport getType from '../util/get_type';\nimport validate from './validate';\nimport ValidationError from '../error/validation_error';\n\nexport default function validateArray(options) {\n const array = options.value;\n const arraySpec = options.valueSpec;\n const style = options.style;\n const styleSpec = options.styleSpec;\n const key = options.key;\n const validateArrayElement = options.arrayElementValidator || validate;\n\n if (getType(array) !== 'array') {\n return [new ValidationError(key, array, `array expected, ${getType(array)} found`)];\n }\n\n if (arraySpec.length && array.length !== arraySpec.length) {\n return [new ValidationError(key, array, `array length ${arraySpec.length} expected, length ${array.length} found`)];\n }\n\n if (arraySpec['min-length'] && array.length < arraySpec['min-length']) {\n return [new ValidationError(key, array, `array length at least ${arraySpec['min-length']} expected, length ${array.length} found`)];\n }\n\n let arrayElementSpec = {\n \"type\": arraySpec.value,\n \"values\": arraySpec.values\n };\n\n if (styleSpec.$version < 7) {\n arrayElementSpec.function = arraySpec.function;\n }\n\n if (getType(arraySpec.value) === 'object') {\n arrayElementSpec = arraySpec.value;\n }\n\n let errors = [];\n for (let i = 0; i < array.length; i++) {\n errors = errors.concat(validateArrayElement({\n array,\n arrayIndex: i,\n value: array[i],\n valueSpec: arrayElementSpec,\n style,\n styleSpec,\n key: `${key}[${i}]`\n }));\n }\n return errors;\n}\n","\nimport getType from '../util/get_type';\nimport ValidationError from '../error/validation_error';\n\nexport default function validateNumber(options) {\n const key = options.key;\n const value = options.value;\n const valueSpec = options.valueSpec;\n let type = getType(value);\n\n // eslint-disable-next-line no-self-compare\n if (type === 'number' && value !== value) {\n type = 'NaN';\n }\n\n if (type !== 'number') {\n return [new ValidationError(key, value, `number expected, ${type} found`)];\n }\n\n if ('minimum' in valueSpec && value < valueSpec.minimum) {\n return [new ValidationError(key, value, `${value} is less than the minimum value ${valueSpec.minimum}`)];\n }\n\n if ('maximum' in valueSpec && value > valueSpec.maximum) {\n return [new ValidationError(key, value, `${value} is greater than the maximum value ${valueSpec.maximum}`)];\n }\n\n return [];\n}\n","\nimport ValidationError from '../error/validation_error';\nimport getType from '../util/get_type';\nimport validate from './validate';\nimport validateObject from './validate_object';\nimport validateArray from './validate_array';\nimport validateNumber from './validate_number';\nimport {isExpression} from '../expression';\nimport {unbundle, deepUnbundle} from '../util/unbundle_jsonlint';\nimport {\n supportsPropertyExpression,\n supportsZoomExpression,\n supportsInterpolation\n} from '../util/properties';\n\nexport default function validateFunction(options) {\n const functionValueSpec = options.valueSpec;\n const functionType = unbundle(options.value.type);\n let stopKeyType;\n let stopDomainValues = {};\n let previousStopDomainValue;\n let previousStopDomainZoom;\n\n const isZoomFunction = functionType !== 'categorical' && options.value.property === undefined;\n const isPropertyFunction = !isZoomFunction;\n const isZoomAndPropertyFunction =\n getType(options.value.stops) === 'array' &&\n getType(options.value.stops[0]) === 'array' &&\n getType(options.value.stops[0][0]) === 'object';\n\n const errors = validateObject({\n key: options.key,\n value: options.value,\n valueSpec: options.styleSpec.function,\n style: options.style,\n styleSpec: options.styleSpec,\n objectElementValidators: {\n stops: validateFunctionStops,\n default: validateFunctionDefault\n }\n });\n\n if (functionType === 'identity' && isZoomFunction) {\n errors.push(new ValidationError(options.key, options.value, 'missing required property \"property\"'));\n }\n\n if (functionType !== 'identity' && !options.value.stops) {\n errors.push(new ValidationError(options.key, options.value, 'missing required property \"stops\"'));\n }\n\n if (functionType === 'exponential' && options.valueSpec.expression && !supportsInterpolation(options.valueSpec)) {\n errors.push(new ValidationError(options.key, options.value, 'exponential functions not supported'));\n }\n\n if (options.styleSpec.$version >= 8) {\n if (isPropertyFunction && !supportsPropertyExpression(options.valueSpec)) {\n errors.push(new ValidationError(options.key, options.value, 'property functions not supported'));\n } else if (isZoomFunction && !supportsZoomExpression(options.valueSpec)) {\n errors.push(new ValidationError(options.key, options.value, 'zoom functions not supported'));\n }\n }\n\n if ((functionType === 'categorical' || isZoomAndPropertyFunction) && options.value.property === undefined) {\n errors.push(new ValidationError(options.key, options.value, '\"property\" property is required'));\n }\n\n return errors;\n\n function validateFunctionStops(options) {\n if (functionType === 'identity') {\n return [new ValidationError(options.key, options.value, 'identity function may not have a \"stops\" property')];\n }\n\n let errors = [];\n const value = options.value;\n\n errors = errors.concat(validateArray({\n key: options.key,\n value,\n valueSpec: options.valueSpec,\n style: options.style,\n styleSpec: options.styleSpec,\n arrayElementValidator: validateFunctionStop\n }));\n\n if (getType(value) === 'array' && value.length === 0) {\n errors.push(new ValidationError(options.key, value, 'array must have at least one stop'));\n }\n\n return errors;\n }\n\n function validateFunctionStop(options) {\n let errors = [];\n const value = options.value;\n const key = options.key;\n\n if (getType(value) !== 'array') {\n return [new ValidationError(key, value, `array expected, ${getType(value)} found`)];\n }\n\n if (value.length !== 2) {\n return [new ValidationError(key, value, `array length 2 expected, length ${value.length} found`)];\n }\n\n if (isZoomAndPropertyFunction) {\n if (getType(value[0]) !== 'object') {\n return [new ValidationError(key, value, `object expected, ${getType(value[0])} found`)];\n }\n if (value[0].zoom === undefined) {\n return [new ValidationError(key, value, 'object stop key must have zoom')];\n }\n if (value[0].value === undefined) {\n return [new ValidationError(key, value, 'object stop key must have value')];\n }\n if (previousStopDomainZoom && previousStopDomainZoom > unbundle(value[0].zoom)) {\n return [new ValidationError(key, value[0].zoom, 'stop zoom values must appear in ascending order')];\n }\n if (unbundle(value[0].zoom) !== previousStopDomainZoom) {\n previousStopDomainZoom = unbundle(value[0].zoom);\n previousStopDomainValue = undefined;\n stopDomainValues = {};\n }\n errors = errors.concat(validateObject({\n key: `${key}[0]`,\n value: value[0],\n valueSpec: {zoom: {}},\n style: options.style,\n styleSpec: options.styleSpec,\n objectElementValidators: {zoom: validateNumber, value: validateStopDomainValue}\n }));\n } else {\n errors = errors.concat(validateStopDomainValue({\n key: `${key}[0]`,\n value: value[0],\n valueSpec: {},\n style: options.style,\n styleSpec: options.styleSpec\n }, value));\n }\n\n if (isExpression(deepUnbundle(value[1]))) {\n return errors.concat([new ValidationError(`${key}[1]`, value[1], 'expressions are not allowed in function stops.')]);\n }\n\n return errors.concat(validate({\n key: `${key}[1]`,\n value: value[1],\n valueSpec: functionValueSpec,\n style: options.style,\n styleSpec: options.styleSpec\n }));\n }\n\n function validateStopDomainValue(options, stop) {\n const type = getType(options.value);\n const value = unbundle(options.value);\n\n const reportValue = options.value !== null ? options.value : stop;\n\n if (!stopKeyType) {\n stopKeyType = type;\n } else if (type !== stopKeyType) {\n return [new ValidationError(options.key, reportValue, `${type} stop domain type must match previous stop domain type ${stopKeyType}`)];\n }\n\n if (type !== 'number' && type !== 'string' && type !== 'boolean') {\n return [new ValidationError(options.key, reportValue, 'stop domain value must be a number, string, or boolean')];\n }\n\n if (type !== 'number' && functionType !== 'categorical') {\n let message = `number expected, ${type} found`;\n if (supportsPropertyExpression(functionValueSpec) && functionType === undefined) {\n message += '\\nIf you intended to use a categorical function, specify `\"type\": \"categorical\"`.';\n }\n return [new ValidationError(options.key, reportValue, message)];\n }\n\n if (functionType === 'categorical' && type === 'number' && (!isFinite(value) || Math.floor(value) !== value)) {\n return [new ValidationError(options.key, reportValue, `integer expected, found ${value}`)];\n }\n\n if (functionType !== 'categorical' && type === 'number' && previousStopDomainValue !== undefined && value < previousStopDomainValue) {\n return [new ValidationError(options.key, reportValue, 'stop domain values must appear in ascending order')];\n } else {\n previousStopDomainValue = value;\n }\n\n if (functionType === 'categorical' && value in stopDomainValues) {\n return [new ValidationError(options.key, reportValue, 'stop domain values must be unique')];\n } else {\n stopDomainValues[value] = true;\n }\n\n return [];\n }\n\n function validateFunctionDefault(options) {\n return validate({\n key: options.key,\n value: options.value,\n valueSpec: functionValueSpec,\n style: options.style,\n styleSpec: options.styleSpec\n });\n }\n}\n","// @flow\n\nimport ValidationError from '../error/validation_error';\n\nimport {createExpression, createPropertyExpression} from '../expression';\nimport {deepUnbundle} from '../util/unbundle_jsonlint';\nimport {isStateConstant, isGlobalPropertyConstant, isFeatureConstant} from '../expression/is_constant';\n\nexport default function validateExpression(options: any): Array {\n const expression = (options.expressionContext === 'property' ? createPropertyExpression : createExpression)(deepUnbundle(options.value), options.valueSpec);\n if (expression.result === 'error') {\n return expression.value.map((error) => {\n return new ValidationError(`${options.key}${error.key}`, options.value, error.message);\n });\n }\n\n const expressionObj = (expression.value: any).expression || (expression.value: any)._styleExpression.expression;\n\n if (options.expressionContext === 'property' && (options.propertyKey === 'text-font') &&\n !expressionObj.outputDefined()) {\n return [new ValidationError(options.key, options.value, `Invalid data expression for \"${options.propertyKey}\". Output values must be contained as literals within the expression.`)];\n }\n\n if (options.expressionContext === 'property' && options.propertyType === 'layout' &&\n (!isStateConstant(expressionObj))) {\n return [new ValidationError(options.key, options.value, '\"feature-state\" data expressions are not supported with layout properties.')];\n }\n\n if (options.expressionContext === 'filter' && !isStateConstant(expressionObj)) {\n return [new ValidationError(options.key, options.value, '\"feature-state\" data expressions are not supported with filters.')];\n }\n\n if (options.expressionContext && options.expressionContext.indexOf('cluster') === 0) {\n if (!isGlobalPropertyConstant(expressionObj, ['zoom', 'feature-state'])) {\n return [new ValidationError(options.key, options.value, '\"zoom\" and \"feature-state\" expressions are not supported with cluster properties.')];\n }\n if (options.expressionContext === 'cluster-initial' && !isFeatureConstant(expressionObj)) {\n return [new ValidationError(options.key, options.value, 'Feature data expressions are not supported with initial expression part of cluster properties.')];\n }\n }\n\n return [];\n}\n","\nimport ValidationError from '../error/validation_error';\nimport {unbundle} from '../util/unbundle_jsonlint';\n\nexport default function validateEnum(options) {\n const key = options.key;\n const value = options.value;\n const valueSpec = options.valueSpec;\n const errors = [];\n\n if (Array.isArray(valueSpec.values)) { // <=v7\n if (valueSpec.values.indexOf(unbundle(value)) === -1) {\n errors.push(new ValidationError(key, value, `expected one of [${valueSpec.values.join(', ')}], ${JSON.stringify(value)} found`));\n }\n } else { // >=v8\n if (Object.keys(valueSpec.values).indexOf(unbundle(value)) === -1) {\n errors.push(new ValidationError(key, value, `expected one of [${Object.keys(valueSpec.values).join(', ')}], ${JSON.stringify(value)} found`));\n }\n }\n return errors;\n}\n","// @flow\n\nimport {createExpression} from '../expression';\nimport type {GlobalProperties, Feature} from '../expression';\nimport type {CanonicalTileID} from '../../source/tile_id';\n\ntype FilterExpression = (globalProperties: GlobalProperties, feature: Feature, canonical?: CanonicalTileID) => boolean;\nexport type FeatureFilter ={filter: FilterExpression, needGeometry: boolean};\n\nexport default createFilter;\nexport {isExpressionFilter};\n\nfunction isExpressionFilter(filter: any) {\n if (filter === true || filter === false) {\n return true;\n }\n\n if (!Array.isArray(filter) || filter.length === 0) {\n return false;\n }\n switch (filter[0]) {\n case 'has':\n return filter.length >= 2 && filter[1] !== '$id' && filter[1] !== '$type';\n\n case 'in':\n return filter.length >= 3 && (typeof filter[1] !== 'string' || Array.isArray(filter[2]));\n\n case '!in':\n case '!has':\n case 'none':\n return false;\n\n case '==':\n case '!=':\n case '>':\n case '>=':\n case '<':\n case '<=':\n return filter.length !== 3 || (Array.isArray(filter[1]) || Array.isArray(filter[2]));\n\n case 'any':\n case 'all':\n for (const f of filter.slice(1)) {\n if (!isExpressionFilter(f) && typeof f !== 'boolean') {\n return false;\n }\n }\n return true;\n\n default:\n return true;\n }\n}\n\nconst filterSpec = {\n 'type': 'boolean',\n 'default': false,\n 'transition': false,\n 'property-type': 'data-driven',\n 'expression': {\n 'interpolated': false,\n 'parameters': ['zoom', 'feature']\n }\n};\n\n/**\n * Given a filter expressed as nested arrays, return a new function\n * that evaluates whether a given feature (with a .properties or .tags property)\n * passes its test.\n *\n * @private\n * @param {Array} filter maplibre gl filter\n * @returns {Function} filter-evaluating function\n */\nfunction createFilter(filter: any): FeatureFilter {\n if (filter === null || filter === undefined) {\n return {filter: () => true, needGeometry: false};\n }\n\n if (!isExpressionFilter(filter)) {\n filter = convertFilter(filter);\n }\n\n const compiled = createExpression(filter, filterSpec);\n if (compiled.result === 'error') {\n throw new Error(compiled.value.map(err => `${err.key}: ${err.message}`).join(', '));\n } else {\n const needGeometry = geometryNeeded(filter);\n return {filter: (globalProperties: GlobalProperties, feature: Feature, canonical?: CanonicalTileID) => compiled.value.evaluate(globalProperties, feature, {}, canonical),\n needGeometry};\n }\n}\n\n// Comparison function to sort numbers and strings\nfunction compare(a, b) {\n return a < b ? -1 : a > b ? 1 : 0;\n}\n\nfunction geometryNeeded(filter) {\n if (!Array.isArray(filter)) return false;\n if (filter[0] === 'within') return true;\n for (let index = 1; index < filter.length; index++) {\n if (geometryNeeded(filter[index])) return true;\n }\n return false;\n}\n\nfunction convertFilter(filter: ?Array): mixed {\n if (!filter) return true;\n const op = filter[0];\n if (filter.length <= 1) return (op !== 'any');\n const converted =\n op === '==' ? convertComparisonOp(filter[1], filter[2], '==') :\n op === '!=' ? convertNegation(convertComparisonOp(filter[1], filter[2], '==')) :\n op === '<' ||\n op === '>' ||\n op === '<=' ||\n op === '>=' ? convertComparisonOp(filter[1], filter[2], op) :\n op === 'any' ? convertDisjunctionOp(filter.slice(1)) :\n op === 'all' ? ['all'].concat(filter.slice(1).map(convertFilter)) :\n op === 'none' ? ['all'].concat(filter.slice(1).map(convertFilter).map(convertNegation)) :\n op === 'in' ? convertInOp(filter[1], filter.slice(2)) :\n op === '!in' ? convertNegation(convertInOp(filter[1], filter.slice(2))) :\n op === 'has' ? convertHasOp(filter[1]) :\n op === '!has' ? convertNegation(convertHasOp(filter[1])) :\n op === 'within' ? filter :\n true;\n return converted;\n}\n\nfunction convertComparisonOp(property: string, value: any, op: string) {\n switch (property) {\n case '$type':\n return [`filter-type-${op}`, value];\n case '$id':\n return [`filter-id-${op}`, value];\n default:\n return [`filter-${op}`, property, value];\n }\n}\n\nfunction convertDisjunctionOp(filters: Array>) {\n return ['any'].concat(filters.map(convertFilter));\n}\n\nfunction convertInOp(property: string, values: Array) {\n if (values.length === 0) { return false; }\n switch (property) {\n case '$type':\n return [`filter-type-in`, ['literal', values]];\n case '$id':\n return [`filter-id-in`, ['literal', values]];\n default:\n if (values.length > 200 && !values.some(v => typeof v !== typeof values[0])) {\n return ['filter-in-large', property, ['literal', values.sort(compare)]];\n } else {\n return ['filter-in-small', property, ['literal', values]];\n }\n }\n}\n\nfunction convertHasOp(property: string) {\n switch (property) {\n case '$type':\n return true;\n case '$id':\n return [`filter-has-id`];\n default:\n return [`filter-has`, property];\n }\n}\n\nfunction convertNegation(filter: mixed) {\n return ['!', filter];\n}\n","\nimport ValidationError from '../error/validation_error';\nimport validateExpression from './validate_expression';\nimport validateEnum from './validate_enum';\nimport getType from '../util/get_type';\nimport {unbundle, deepUnbundle} from '../util/unbundle_jsonlint';\nimport extend from '../util/extend';\nimport {isExpressionFilter} from '../feature_filter';\n\nexport default function validateFilter(options) {\n if (isExpressionFilter(deepUnbundle(options.value))) {\n return validateExpression(extend({}, options, {\n expressionContext: 'filter',\n valueSpec: {value: 'boolean'}\n }));\n } else {\n return validateNonExpressionFilter(options);\n }\n}\n\nfunction validateNonExpressionFilter(options) {\n const value = options.value;\n const key = options.key;\n\n if (getType(value) !== 'array') {\n return [new ValidationError(key, value, `array expected, ${getType(value)} found`)];\n }\n\n const styleSpec = options.styleSpec;\n let type;\n\n let errors = [];\n\n if (value.length < 1) {\n return [new ValidationError(key, value, 'filter array must have at least 1 element')];\n }\n\n errors = errors.concat(validateEnum({\n key: `${key}[0]`,\n value: value[0],\n valueSpec: styleSpec.filter_operator,\n style: options.style,\n styleSpec: options.styleSpec\n }));\n\n switch (unbundle(value[0])) {\n case '<':\n case '<=':\n case '>':\n case '>=':\n if (value.length >= 2 && unbundle(value[1]) === '$type') {\n errors.push(new ValidationError(key, value, `\"$type\" cannot be use with operator \"${value[0]}\"`));\n }\n /* falls through */\n case '==':\n case '!=':\n if (value.length !== 3) {\n errors.push(new ValidationError(key, value, `filter array for operator \"${value[0]}\" must have 3 elements`));\n }\n /* falls through */\n case 'in':\n case '!in':\n if (value.length >= 2) {\n type = getType(value[1]);\n if (type !== 'string') {\n errors.push(new ValidationError(`${key}[1]`, value[1], `string expected, ${type} found`));\n }\n }\n for (let i = 2; i < value.length; i++) {\n type = getType(value[i]);\n if (unbundle(value[1]) === '$type') {\n errors = errors.concat(validateEnum({\n key: `${key}[${i}]`,\n value: value[i],\n valueSpec: styleSpec.geometry_type,\n style: options.style,\n styleSpec: options.styleSpec\n }));\n } else if (type !== 'string' && type !== 'number' && type !== 'boolean') {\n errors.push(new ValidationError(`${key}[${i}]`, value[i], `string, number, or boolean expected, ${type} found`));\n }\n }\n break;\n\n case 'any':\n case 'all':\n case 'none':\n for (let i = 1; i < value.length; i++) {\n errors = errors.concat(validateNonExpressionFilter({\n key: `${key}[${i}]`,\n value: value[i],\n style: options.style,\n styleSpec: options.styleSpec\n }));\n }\n break;\n\n case 'has':\n case '!has':\n type = getType(value[1]);\n if (value.length !== 2) {\n errors.push(new ValidationError(key, value, `filter array for \"${value[0]}\" operator must have 2 elements`));\n } else if (type !== 'string') {\n errors.push(new ValidationError(`${key}[1]`, value[1], `string expected, ${type} found`));\n }\n break;\n case 'within':\n type = getType(value[1]);\n if (value.length !== 2) {\n errors.push(new ValidationError(key, value, `filter array for \"${value[0]}\" operator must have 2 elements`));\n } else if (type !== 'object') {\n errors.push(new ValidationError(`${key}[1]`, value[1], `object expected, ${type} found`));\n }\n break;\n }\n return errors;\n}\n","\nimport validate from './validate';\nimport ValidationError from '../error/validation_error';\nimport getType from '../util/get_type';\nimport {isFunction} from '../function';\nimport {unbundle, deepUnbundle} from '../util/unbundle_jsonlint';\nimport {supportsPropertyExpression} from '../util/properties';\n\nexport default function validateProperty(options, propertyType) {\n const key = options.key;\n const style = options.style;\n const styleSpec = options.styleSpec;\n const value = options.value;\n const propertyKey = options.objectKey;\n const layerSpec = styleSpec[`${propertyType}_${options.layerType}`];\n\n if (!layerSpec) return [];\n\n const transitionMatch = propertyKey.match(/^(.*)-transition$/);\n if (propertyType === 'paint' && transitionMatch && layerSpec[transitionMatch[1]] && layerSpec[transitionMatch[1]].transition) {\n return validate({\n key,\n value,\n valueSpec: styleSpec.transition,\n style,\n styleSpec\n });\n }\n\n const valueSpec = options.valueSpec || layerSpec[propertyKey];\n if (!valueSpec) {\n return [new ValidationError(key, value, `unknown property \"${propertyKey}\"`)];\n }\n\n let tokenMatch;\n if (getType(value) === 'string' && supportsPropertyExpression(valueSpec) && !valueSpec.tokens && (tokenMatch = /^{([^}]+)}$/.exec(value))) {\n return [new ValidationError(\n key, value,\n `\"${propertyKey}\" does not support interpolation syntax\\n` +\n `Use an identity property function instead: \\`{ \"type\": \"identity\", \"property\": ${JSON.stringify(tokenMatch[1])} }\\`.`)];\n }\n\n const errors = [];\n\n if (options.layerType === 'symbol') {\n if (propertyKey === 'text-field' && style && !style.glyphs) {\n errors.push(new ValidationError(key, value, 'use of \"text-field\" requires a style \"glyphs\" property'));\n }\n if (propertyKey === 'text-font' && isFunction(deepUnbundle(value)) && unbundle(value.type) === 'identity') {\n errors.push(new ValidationError(key, value, '\"text-font\" does not support identity functions'));\n }\n }\n\n return errors.concat(validate({\n key: options.key,\n value,\n valueSpec,\n style,\n styleSpec,\n expressionContext: 'property',\n propertyType,\n propertyKey\n }));\n}\n","\nimport validateProperty from './validate_property';\n\nexport default function validatePaintProperty(options) {\n return validateProperty(options, 'paint');\n}\n","\nimport validateProperty from './validate_property';\n\nexport default function validateLayoutProperty(options) {\n return validateProperty(options, 'layout');\n}\n","\nimport ValidationError from '../error/validation_error';\nimport {unbundle} from '../util/unbundle_jsonlint';\nimport validateObject from './validate_object';\nimport validateFilter from './validate_filter';\nimport validatePaintProperty from './validate_paint_property';\nimport validateLayoutProperty from './validate_layout_property';\nimport validateSpec from './validate';\nimport extend from '../util/extend';\n\nexport default function validateLayer(options) {\n let errors = [];\n\n const layer = options.value;\n const key = options.key;\n const style = options.style;\n const styleSpec = options.styleSpec;\n\n if (!layer.type && !layer.ref) {\n errors.push(new ValidationError(key, layer, 'either \"type\" or \"ref\" is required'));\n }\n let type = unbundle(layer.type);\n const ref = unbundle(layer.ref);\n\n if (layer.id) {\n const layerId = unbundle(layer.id);\n for (let i = 0; i < options.arrayIndex; i++) {\n const otherLayer = style.layers[i];\n if (unbundle(otherLayer.id) === layerId) {\n errors.push(new ValidationError(key, layer.id, `duplicate layer id \"${layer.id}\", previously used at line ${otherLayer.id.__line__}`));\n }\n }\n }\n\n if ('ref' in layer) {\n ['type', 'source', 'source-layer', 'filter', 'layout'].forEach((p) => {\n if (p in layer) {\n errors.push(new ValidationError(key, layer[p], `\"${p}\" is prohibited for ref layers`));\n }\n });\n\n let parent;\n\n style.layers.forEach((layer) => {\n if (unbundle(layer.id) === ref) parent = layer;\n });\n\n if (!parent) {\n errors.push(new ValidationError(key, layer.ref, `ref layer \"${ref}\" not found`));\n } else if (parent.ref) {\n errors.push(new ValidationError(key, layer.ref, 'ref cannot reference another ref layer'));\n } else {\n type = unbundle(parent.type);\n }\n } else if (type !== 'background') {\n if (!layer.source) {\n errors.push(new ValidationError(key, layer, 'missing required property \"source\"'));\n } else {\n const source = style.sources && style.sources[layer.source];\n const sourceType = source && unbundle(source.type);\n if (!source) {\n errors.push(new ValidationError(key, layer.source, `source \"${layer.source}\" not found`));\n } else if (sourceType === 'vector' && type === 'raster') {\n errors.push(new ValidationError(key, layer.source, `layer \"${layer.id}\" requires a raster source`));\n } else if (sourceType === 'raster' && type !== 'raster') {\n errors.push(new ValidationError(key, layer.source, `layer \"${layer.id}\" requires a vector source`));\n } else if (sourceType === 'vector' && !layer['source-layer']) {\n errors.push(new ValidationError(key, layer, `layer \"${layer.id}\" must specify a \"source-layer\"`));\n } else if (sourceType === 'raster-dem' && type !== 'hillshade') {\n errors.push(new ValidationError(key, layer.source, 'raster-dem source can only be used with layer type \\'hillshade\\'.'));\n } else if (type === 'line' && layer.paint && layer.paint['line-gradient'] &&\n (sourceType !== 'geojson' || !source.lineMetrics)) {\n errors.push(new ValidationError(key, layer, `layer \"${layer.id}\" specifies a line-gradient, which requires a GeoJSON source with \\`lineMetrics\\` enabled.`));\n }\n }\n }\n\n errors = errors.concat(validateObject({\n key,\n value: layer,\n valueSpec: styleSpec.layer,\n style: options.style,\n styleSpec: options.styleSpec,\n objectElementValidators: {\n '*'() {\n return [];\n },\n // We don't want to enforce the spec's `\"requires\": true` for backward compatibility with refs;\n // the actual requirement is validated above. See https://github.com/mapbox/mapbox-gl-js/issues/5772.\n type() {\n return validateSpec({\n key: `${key}.type`,\n value: layer.type,\n valueSpec: styleSpec.layer.type,\n style: options.style,\n styleSpec: options.styleSpec,\n object: layer,\n objectKey: 'type'\n });\n },\n filter: validateFilter,\n layout(options) {\n return validateObject({\n layer,\n key: options.key,\n value: options.value,\n style: options.style,\n styleSpec: options.styleSpec,\n objectElementValidators: {\n '*'(options) {\n return validateLayoutProperty(extend({layerType: type}, options));\n }\n }\n });\n },\n paint(options) {\n return validateObject({\n layer,\n key: options.key,\n value: options.value,\n style: options.style,\n styleSpec: options.styleSpec,\n objectElementValidators: {\n '*'(options) {\n return validatePaintProperty(extend({layerType: type}, options));\n }\n }\n });\n }\n }\n }));\n\n return errors;\n}\n","\nimport getType from '../util/get_type';\nimport ValidationError from '../error/validation_error';\n\nexport default function validateString(options) {\n const value = options.value;\n const key = options.key;\n const type = getType(value);\n\n if (type !== 'string') {\n return [new ValidationError(key, value, `string expected, ${type} found`)];\n }\n\n return [];\n}\n","\nimport ValidationError from '../error/validation_error';\nimport {unbundle} from '../util/unbundle_jsonlint';\nimport validateObject from './validate_object';\nimport validateEnum from './validate_enum';\nimport validateExpression from './validate_expression';\nimport validateString from './validate_string';\nimport getType from '../util/get_type';\n\nconst objectElementValidators = {\n promoteId: validatePromoteId\n};\n\nexport default function validateSource(options) {\n const value = options.value;\n const key = options.key;\n const styleSpec = options.styleSpec;\n const style = options.style;\n\n if (!value.type) {\n return [new ValidationError(key, value, '\"type\" is required')];\n }\n\n const type = unbundle(value.type);\n let errors;\n\n switch (type) {\n case 'vector':\n case 'raster':\n case 'raster-dem':\n errors = validateObject({\n key,\n value,\n valueSpec: styleSpec[`source_${type.replace('-', '_')}`],\n style: options.style,\n styleSpec,\n objectElementValidators\n });\n return errors;\n\n case 'geojson':\n errors = validateObject({\n key,\n value,\n valueSpec: styleSpec.source_geojson,\n style,\n styleSpec,\n objectElementValidators\n });\n if (value.cluster) {\n for (const prop in value.clusterProperties) {\n const [operator, mapExpr] = value.clusterProperties[prop];\n const reduceExpr = typeof operator === 'string' ? [operator, ['accumulated'], ['get', prop]] : operator;\n\n errors.push(...validateExpression({\n key: `${key}.${prop}.map`,\n value: mapExpr,\n expressionContext: 'cluster-map'\n }));\n errors.push(...validateExpression({\n key: `${key}.${prop}.reduce`,\n value: reduceExpr,\n expressionContext: 'cluster-reduce'\n }));\n }\n }\n return errors;\n\n case 'video':\n return validateObject({\n key,\n value,\n valueSpec: styleSpec.source_video,\n style,\n styleSpec\n });\n\n case 'image':\n return validateObject({\n key,\n value,\n valueSpec: styleSpec.source_image,\n style,\n styleSpec\n });\n\n case 'canvas':\n return [new ValidationError(key, null, `Please use runtime APIs to add canvas sources, rather than including them in stylesheets.`, 'source.canvas')];\n\n default:\n return validateEnum({\n key: `${key}.type`,\n value: value.type,\n valueSpec: {values: ['vector', 'raster', 'raster-dem', 'geojson', 'video', 'image']},\n style,\n styleSpec\n });\n }\n}\n\nfunction validatePromoteId({key, value}) {\n if (getType(value) === 'string') {\n return validateString({key, value});\n } else {\n const errors = [];\n for (const prop in value) {\n errors.push(...validateString({key: `${key}.${prop}`, value: value[prop]}));\n }\n return errors;\n }\n}\n","\nimport ValidationError from '../error/validation_error';\nimport getType from '../util/get_type';\nimport validate from './validate';\n\nexport default function validateLight(options) {\n const light = options.value;\n const styleSpec = options.styleSpec;\n const lightSpec = styleSpec.light;\n const style = options.style;\n\n let errors = [];\n\n const rootType = getType(light);\n if (light === undefined) {\n return errors;\n } else if (rootType !== 'object') {\n errors = errors.concat([new ValidationError('light', light, `object expected, ${rootType} found`)]);\n return errors;\n }\n\n for (const key in light) {\n const transitionMatch = key.match(/^(.*)-transition$/);\n\n if (transitionMatch && lightSpec[transitionMatch[1]] && lightSpec[transitionMatch[1]].transition) {\n errors = errors.concat(validate({\n key,\n value: light[key],\n valueSpec: styleSpec.transition,\n style,\n styleSpec\n }));\n } else if (lightSpec[key]) {\n errors = errors.concat(validate({\n key,\n value: light[key],\n valueSpec: lightSpec[key],\n style,\n styleSpec\n }));\n } else {\n errors = errors.concat([new ValidationError(key, light[key], `unknown property \"${key}\"`)]);\n }\n }\n\n return errors;\n}\n","\nimport extend from '../util/extend';\nimport {unbundle, deepUnbundle} from '../util/unbundle_jsonlint';\nimport {isExpression} from '../expression';\nimport {isFunction} from '../function';\n\nimport validateFunction from './validate_function';\nimport validateExpression from './validate_expression';\nimport validateObject from './validate_object';\nimport validateArray from './validate_array';\nimport validateBoolean from './validate_boolean';\nimport validateNumber from './validate_number';\nimport validateColor from './validate_color';\nimport validateConstants from './validate_constants';\nimport validateEnum from './validate_enum';\nimport validateFilter from './validate_filter';\nimport validateLayer from './validate_layer';\nimport validateSource from './validate_source';\nimport validateLight from './validate_light';\nimport validateString from './validate_string';\nimport validateFormatted from './validate_formatted';\nimport validateImage from './validate_image';\n\nconst VALIDATORS = {\n '*'() {\n return [];\n },\n 'array': validateArray,\n 'boolean': validateBoolean,\n 'number': validateNumber,\n 'color': validateColor,\n 'constants': validateConstants,\n 'enum': validateEnum,\n 'filter': validateFilter,\n 'function': validateFunction,\n 'layer': validateLayer,\n 'object': validateObject,\n 'source': validateSource,\n 'light': validateLight,\n 'string': validateString,\n 'formatted': validateFormatted,\n 'resolvedImage': validateImage\n};\n\n// Main recursive validation function. Tracks:\n//\n// - key: string representing location of validation in style tree. Used only\n// for more informative error reporting.\n// - value: current value from style being evaluated. May be anything from a\n// high level object that needs to be descended into deeper or a simple\n// scalar value.\n// - valueSpec: current spec being evaluated. Tracks value.\n// - styleSpec: current full spec being evaluated.\n\nexport default function validate(options) {\n const value = options.value;\n const valueSpec = options.valueSpec;\n const styleSpec = options.styleSpec;\n\n if (valueSpec.expression && isFunction(unbundle(value))) {\n return validateFunction(options);\n\n } else if (valueSpec.expression && isExpression(deepUnbundle(value))) {\n return validateExpression(options);\n\n } else if (valueSpec.type && VALIDATORS[valueSpec.type]) {\n return VALIDATORS[valueSpec.type](options);\n\n } else {\n const valid = validateObject(extend({}, options, {\n valueSpec: valueSpec.type ? styleSpec[valueSpec.type] : valueSpec\n }));\n return valid;\n }\n}\n","\nimport getType from '../util/get_type';\nimport ValidationError from '../error/validation_error';\n\nexport default function validateBoolean(options) {\n const value = options.value;\n const key = options.key;\n const type = getType(value);\n\n if (type !== 'boolean') {\n return [new ValidationError(key, value, `boolean expected, ${type} found`)];\n }\n\n return [];\n}\n","\nimport ValidationError from '../error/validation_error';\nimport getType from '../util/get_type';\nimport {parseCSSColor} from 'csscolorparser';\n\nexport default function validateColor(options) {\n const key = options.key;\n const value = options.value;\n const type = getType(value);\n\n if (type !== 'string') {\n return [new ValidationError(key, value, `color expected, ${type} found`)];\n }\n\n if (parseCSSColor(value) === null) {\n return [new ValidationError(key, value, `color expected, \"${value}\" found`)];\n }\n\n return [];\n}\n","// @flow\nimport validateExpression from './validate_expression';\nimport validateString from './validate_string';\n\nexport default function validateFormatted(options: any) {\n if (validateString(options).length === 0) {\n return [];\n }\n\n return validateExpression(options);\n}\n","// @flow\nimport validateExpression from './validate_expression';\nimport validateString from './validate_string';\n\nexport default function validateImage(options: any) {\n if (validateString(options).length === 0) {\n return [];\n }\n\n return validateExpression(options);\n}\n","\nimport ValidationError from '../error/validation_error';\nimport validateString from './validate_string';\n\nexport default function(options) {\n const value = options.value;\n const key = options.key;\n\n const errors = validateString(options);\n if (errors.length) return errors;\n\n if (value.indexOf('{fontstack}') === -1) {\n errors.push(new ValidationError(key, value, '\"glyphs\" url must include a \"{fontstack}\" token'));\n }\n\n if (value.indexOf('{range}') === -1) {\n errors.push(new ValidationError(key, value, '\"glyphs\" url must include a \"{range}\" token'));\n }\n\n return errors;\n}\n","\nimport validateConstants from './validate/validate_constants';\nimport validate from './validate/validate';\nimport latestStyleSpec from './reference/latest';\nimport validateGlyphsURL from './validate/validate_glyphs_url';\n\nimport validateSource from './validate/validate_source';\nimport validateLight from './validate/validate_light';\nimport validateLayer from './validate/validate_layer';\nimport validateFilter from './validate/validate_filter';\nimport validatePaintProperty from './validate/validate_paint_property';\nimport validateLayoutProperty from './validate/validate_layout_property';\n\n/**\n * Validate a Mapbox GL style against the style specification. This entrypoint,\n * `maplibre-gl-style-spec/lib/validate_style.min`, is designed to produce as\n * small a browserify bundle as possible by omitting unnecessary functionality\n * and legacy style specifications.\n *\n * @private\n * @param {Object} style The style to be validated.\n * @param {Object} [styleSpec] The style specification to validate against.\n * If omitted, the latest style spec is used.\n * @returns {Array}\n * @example\n * var validate = require('maplibre-gl-style-spec/lib/validate_style.min');\n * var errors = validate(style);\n */\nfunction validateStyleMin(style, styleSpec = latestStyleSpec) {\n\n let errors = [];\n\n errors = errors.concat(validate({\n key: '',\n value: style,\n valueSpec: styleSpec.$root,\n styleSpec,\n style,\n objectElementValidators: {\n glyphs: validateGlyphsURL,\n '*'() {\n return [];\n }\n }\n }));\n\n if (style.constants) {\n errors = errors.concat(validateConstants({\n key: 'constants',\n value: style.constants,\n style,\n styleSpec\n }));\n }\n\n return sortErrors(errors);\n}\n\nvalidateStyleMin.source = wrapCleanErrors(validateSource);\nvalidateStyleMin.light = wrapCleanErrors(validateLight);\nvalidateStyleMin.layer = wrapCleanErrors(validateLayer);\nvalidateStyleMin.filter = wrapCleanErrors(validateFilter);\nvalidateStyleMin.paintProperty = wrapCleanErrors(validatePaintProperty);\nvalidateStyleMin.layoutProperty = wrapCleanErrors(validateLayoutProperty);\n\nfunction sortErrors(errors) {\n return [].concat(errors).sort((a, b) => {\n return a.line - b.line;\n });\n}\n\nfunction wrapCleanErrors(inner) {\n return function(...args) {\n return sortErrors(inner.apply(this, args));\n };\n}\n\nexport default validateStyleMin;\n","// @flow\nimport validateStyleMin from '../style-spec/validate_style.min';\nimport {ErrorEvent} from '../util/evented';\n\nimport type {Evented} from '../util/evented';\n\ntype ValidationError = {\n message: string,\n line: number,\n identifier?: string\n};\n\nexport type Validator = (Object) => $ReadOnlyArray;\n\ntype ValidateStyle = {\n (Object, ?Object): $ReadOnlyArray,\n source: Validator,\n layer: Validator,\n light: Validator,\n filter: Validator,\n paintProperty: Validator,\n layoutProperty: Validator\n};\n\nexport const validateStyle = (validateStyleMin: ValidateStyle);\n\nexport const validateSource = validateStyle.source;\nexport const validateLight = validateStyle.light;\nexport const validateFilter = validateStyle.filter;\nexport const validatePaintProperty = validateStyle.paintProperty;\nexport const validateLayoutProperty = validateStyle.layoutProperty;\n\nexport function emitValidationErrors(emitter: Evented, errors: ?$ReadOnlyArray<{message: string, identifier?: string}>): boolean {\n let hasErrors = false;\n if (errors && errors.length) {\n for (const error of errors) {\n emitter.fire(new ErrorEvent(new Error(error.message)));\n hasErrors = true;\n }\n }\n return hasErrors;\n}\n","'use strict';\n\nmodule.exports = GridIndex;\n\nvar NUM_PARAMS = 3;\n\nfunction GridIndex(extent, n, padding) {\n var cells = this.cells = [];\n\n if (extent instanceof ArrayBuffer) {\n this.arrayBuffer = extent;\n var array = new Int32Array(this.arrayBuffer);\n extent = array[0];\n n = array[1];\n padding = array[2];\n\n this.d = n + 2 * padding;\n for (var k = 0; k < this.d * this.d; k++) {\n var start = array[NUM_PARAMS + k];\n var end = array[NUM_PARAMS + k + 1];\n cells.push(start === end ?\n null :\n array.subarray(start, end));\n }\n var keysOffset = array[NUM_PARAMS + cells.length];\n var bboxesOffset = array[NUM_PARAMS + cells.length + 1];\n this.keys = array.subarray(keysOffset, bboxesOffset);\n this.bboxes = array.subarray(bboxesOffset);\n\n this.insert = this._insertReadonly;\n\n } else {\n this.d = n + 2 * padding;\n for (var i = 0; i < this.d * this.d; i++) {\n cells.push([]);\n }\n this.keys = [];\n this.bboxes = [];\n }\n\n this.n = n;\n this.extent = extent;\n this.padding = padding;\n this.scale = n / extent;\n this.uid = 0;\n\n var p = (padding / n) * extent;\n this.min = -p;\n this.max = extent + p;\n}\n\n\nGridIndex.prototype.insert = function(key, x1, y1, x2, y2) {\n this._forEachCell(x1, y1, x2, y2, this._insertCell, this.uid++);\n this.keys.push(key);\n this.bboxes.push(x1);\n this.bboxes.push(y1);\n this.bboxes.push(x2);\n this.bboxes.push(y2);\n};\n\nGridIndex.prototype._insertReadonly = function() {\n throw 'Cannot insert into a GridIndex created from an ArrayBuffer.';\n};\n\nGridIndex.prototype._insertCell = function(x1, y1, x2, y2, cellIndex, uid) {\n this.cells[cellIndex].push(uid);\n};\n\nGridIndex.prototype.query = function(x1, y1, x2, y2, intersectionTest) {\n var min = this.min;\n var max = this.max;\n if (x1 <= min && y1 <= min && max <= x2 && max <= y2 && !intersectionTest) {\n // We use `Array#slice` because `this.keys` may be a `Int32Array` and\n // some browsers (Safari and IE) do not support `TypedArray#slice`\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/slice#Browser_compatibility\n return Array.prototype.slice.call(this.keys);\n\n } else {\n var result = [];\n var seenUids = {};\n this._forEachCell(x1, y1, x2, y2, this._queryCell, result, seenUids, intersectionTest);\n return result;\n }\n};\n\nGridIndex.prototype._queryCell = function(x1, y1, x2, y2, cellIndex, result, seenUids, intersectionTest) {\n var cell = this.cells[cellIndex];\n if (cell !== null) {\n var keys = this.keys;\n var bboxes = this.bboxes;\n for (var u = 0; u < cell.length; u++) {\n var uid = cell[u];\n if (seenUids[uid] === undefined) {\n var offset = uid * 4;\n if (intersectionTest ?\n intersectionTest(bboxes[offset + 0], bboxes[offset + 1], bboxes[offset + 2], bboxes[offset + 3]) :\n ((x1 <= bboxes[offset + 2]) &&\n (y1 <= bboxes[offset + 3]) &&\n (x2 >= bboxes[offset + 0]) &&\n (y2 >= bboxes[offset + 1]))) {\n seenUids[uid] = true;\n result.push(keys[uid]);\n } else {\n seenUids[uid] = false;\n }\n }\n }\n }\n};\n\nGridIndex.prototype._forEachCell = function(x1, y1, x2, y2, fn, arg1, arg2, intersectionTest) {\n var cx1 = this._convertToCellCoord(x1);\n var cy1 = this._convertToCellCoord(y1);\n var cx2 = this._convertToCellCoord(x2);\n var cy2 = this._convertToCellCoord(y2);\n for (var x = cx1; x <= cx2; x++) {\n for (var y = cy1; y <= cy2; y++) {\n var cellIndex = this.d * y + x;\n if (intersectionTest && !intersectionTest(\n this._convertFromCellCoord(x),\n this._convertFromCellCoord(y),\n this._convertFromCellCoord(x + 1),\n this._convertFromCellCoord(y + 1))) continue;\n if (fn.call(this, x1, y1, x2, y2, cellIndex, arg1, arg2, intersectionTest)) return;\n }\n }\n};\n\nGridIndex.prototype._convertFromCellCoord = function(x) {\n return (x - this.padding) / this.scale;\n};\n\nGridIndex.prototype._convertToCellCoord = function(x) {\n return Math.max(0, Math.min(this.d - 1, Math.floor(x * this.scale) + this.padding));\n};\n\nGridIndex.prototype.toArrayBuffer = function() {\n if (this.arrayBuffer) return this.arrayBuffer;\n\n var cells = this.cells;\n\n var metadataLength = NUM_PARAMS + this.cells.length + 1 + 1;\n var totalCellLength = 0;\n for (var i = 0; i < this.cells.length; i++) {\n totalCellLength += this.cells[i].length;\n }\n\n var array = new Int32Array(metadataLength + totalCellLength + this.keys.length + this.bboxes.length);\n array[0] = this.extent;\n array[1] = this.n;\n array[2] = this.padding;\n\n var offset = metadataLength;\n for (var k = 0; k < cells.length; k++) {\n var cell = cells[k];\n array[NUM_PARAMS + k] = offset;\n array.set(cell, offset);\n offset += cell.length;\n }\n\n array[NUM_PARAMS + cells.length] = offset;\n array.set(this.keys, offset);\n offset += this.keys.length;\n\n array[NUM_PARAMS + cells.length + 1] = offset;\n array.set(this.bboxes, offset);\n offset += this.bboxes.length;\n\n return array.buffer;\n};\n","// @flow\n\nimport assert from 'assert';\n\nimport Grid from 'grid-index';\nimport Color from '../style-spec/util/color';\nimport {StylePropertyFunction, StyleExpression, ZoomDependentExpression, ZoomConstantExpression} from '../style-spec/expression';\nimport CompoundExpression from '../style-spec/expression/compound_expression';\nimport expressions from '../style-spec/expression/definitions';\nimport ResolvedImage from '../style-spec/expression/types/resolved_image';\nimport window from './window';\nconst {ImageData, ImageBitmap} = window;\n\nimport type {Transferable} from '../types/transferable';\n\ntype SerializedObject = {[_: string]: Serialized }; // eslint-disable-line\nexport type Serialized =\n | null\n | void\n | boolean\n | number\n | string\n | Boolean\n | Number\n | String\n | Date\n | RegExp\n | ArrayBuffer\n | $ArrayBufferView\n | ImageData\n | Array\n | SerializedObject;\n\ntype Registry = {\n [_: string]: {\n klass: Class,\n omit: $ReadOnlyArray,\n shallow: $ReadOnlyArray\n }\n};\n\ntype RegisterOptions = {\n omit?: $ReadOnlyArray<$Keys>,\n shallow?: $ReadOnlyArray<$Keys>\n}\n\nconst registry: Registry = {};\n\n/**\n * Register the given class as serializable.\n *\n * @param options\n * @param options.omit List of properties to omit from serialization (e.g., cached/computed properties)\n * @param options.shallow List of properties that should be serialized by a simple shallow copy, rather than by a recursive call to serialize().\n *\n * @private\n */\nexport function register(name: string, klass: Class, options: RegisterOptions = {}) {\n assert(!registry[name], `${name} is already registered.`);\n (Object.defineProperty: any)(klass, '_classRegistryKey', {\n value: name,\n writeable: false\n });\n registry[name] = {\n klass,\n omit: options.omit || [],\n shallow: options.shallow || []\n };\n}\n\nregister('Object', Object);\n\ntype SerializedGrid = { buffer: ArrayBuffer };\n\nGrid.serialize = function serialize(grid: Grid, transferables?: Array): SerializedGrid {\n const buffer = grid.toArrayBuffer();\n if (transferables) {\n transferables.push(buffer);\n }\n return {buffer};\n};\n\nGrid.deserialize = function deserialize(serialized: SerializedGrid): Grid {\n return new Grid(serialized.buffer);\n};\nregister('Grid', Grid);\n\nregister('Color', Color);\nregister('Error', Error);\nregister('ResolvedImage', ResolvedImage);\n\nregister('StylePropertyFunction', StylePropertyFunction);\nregister('StyleExpression', StyleExpression, {omit: ['_evaluator']});\n\nregister('ZoomDependentExpression', ZoomDependentExpression);\nregister('ZoomConstantExpression', ZoomConstantExpression);\nregister('CompoundExpression', CompoundExpression, {omit: ['_evaluate']});\nfor (const name in expressions) {\n if ((expressions[name]: any)._classRegistryKey) continue;\n register(`Expression_${name}`, expressions[name]);\n}\n\nfunction isArrayBuffer(val: any): boolean {\n return val && typeof ArrayBuffer !== 'undefined' &&\n (val instanceof ArrayBuffer || (val.constructor && val.constructor.name === 'ArrayBuffer'));\n}\n\nfunction isImageBitmap(val: any): boolean {\n return ImageBitmap &&\n val instanceof ImageBitmap;\n}\n\n/**\n * Serialize the given object for transfer to or from a web worker.\n *\n * For non-builtin types, recursively serialize each property (possibly\n * omitting certain properties - see register()), and package the result along\n * with the constructor's `name` so that the appropriate constructor can be\n * looked up in `deserialize()`.\n *\n * If a `transferables` array is provided, add any transferable objects (i.e.,\n * any ArrayBuffers or ArrayBuffer views) to the list. (If a copy is needed,\n * this should happen in the client code, before using serialize().)\n *\n * @private\n */\nexport function serialize(input: mixed, transferables: ?Array): Serialized {\n if (input === null ||\n input === undefined ||\n typeof input === 'boolean' ||\n typeof input === 'number' ||\n typeof input === 'string' ||\n input instanceof Boolean ||\n input instanceof Number ||\n input instanceof String ||\n input instanceof Date ||\n input instanceof RegExp) {\n return input;\n }\n\n if (isArrayBuffer(input) || isImageBitmap(input)) {\n if (transferables) {\n transferables.push(((input: any): ArrayBuffer));\n }\n return input;\n }\n\n if (ArrayBuffer.isView(input)) {\n const view: $ArrayBufferView = (input: any);\n if (transferables) {\n transferables.push(view.buffer);\n }\n return view;\n }\n\n if (input instanceof ImageData) {\n if (transferables) {\n transferables.push(input.data.buffer);\n }\n return input;\n }\n\n if (Array.isArray(input)) {\n const serialized: Array = [];\n for (const item of input) {\n serialized.push(serialize(item, transferables));\n }\n return serialized;\n }\n\n if (typeof input === 'object') {\n const klass = (input.constructor: any);\n const name = klass._classRegistryKey;\n if (!name) {\n throw new Error(`can't serialize object of unregistered class`);\n }\n assert(registry[name]);\n\n const properties: SerializedObject = klass.serialize ?\n // (Temporary workaround) allow a class to provide static\n // `serialize()` and `deserialize()` methods to bypass the generic\n // approach.\n // This temporary workaround lets us use the generic serialization\n // approach for objects whose members include instances of dynamic\n // StructArray types. Once we refactor StructArray to be static,\n // we can remove this complexity.\n (klass.serialize(input, transferables): SerializedObject) : {};\n\n if (!klass.serialize) {\n for (const key in input) {\n // any cast due to https://github.com/facebook/flow/issues/5393\n if (!(input: any).hasOwnProperty(key)) continue;\n if (registry[name].omit.indexOf(key) >= 0) continue;\n const property = (input: any)[key];\n properties[key] = registry[name].shallow.indexOf(key) >= 0 ?\n property :\n serialize(property, transferables);\n }\n if (input instanceof Error) {\n properties.message = input.message;\n }\n } else {\n // make sure statically serialized object survives transfer of $name property\n assert(!transferables || properties !== transferables[transferables.length - 1]);\n }\n\n if (properties.$name) {\n throw new Error('$name property is reserved for worker serialization logic.');\n }\n if (name !== 'Object') {\n properties.$name = name;\n }\n\n return properties;\n }\n\n throw new Error(`can't serialize object of type ${typeof input}`);\n}\n\nexport function deserialize(input: Serialized): mixed {\n if (input === null ||\n input === undefined ||\n typeof input === 'boolean' ||\n typeof input === 'number' ||\n typeof input === 'string' ||\n input instanceof Boolean ||\n input instanceof Number ||\n input instanceof String ||\n input instanceof Date ||\n input instanceof RegExp ||\n isArrayBuffer(input) ||\n isImageBitmap(input) ||\n ArrayBuffer.isView(input) ||\n input instanceof ImageData) {\n return input;\n }\n\n if (Array.isArray(input)) {\n return input.map(deserialize);\n }\n\n if (typeof input === 'object') {\n const name = (input: any).$name || 'Object';\n\n const {klass} = registry[name];\n if (!klass) {\n throw new Error(`can't deserialize unregistered class ${name}`);\n }\n\n if (klass.deserialize) {\n return (klass.deserialize: typeof deserialize)(input);\n }\n\n const result = Object.create(klass.prototype);\n\n for (const key of Object.keys(input)) {\n if (key === '$name') continue;\n const value = (input: SerializedObject)[key];\n result[key] = registry[name].shallow.indexOf(key) >= 0 ? value : deserialize(value);\n }\n\n return result;\n }\n\n throw new Error(`can't deserialize object of type ${typeof input}`);\n}\n","// @flow\n\nclass ZoomHistory {\n lastZoom: number;\n lastFloorZoom: number;\n lastIntegerZoom: number;\n lastIntegerZoomTime: number;\n first: boolean;\n\n constructor() {\n this.first = true;\n }\n\n update(z: number, now: number) {\n const floorZ = Math.floor(z);\n\n if (this.first) {\n this.first = false;\n this.lastIntegerZoom = floorZ;\n this.lastIntegerZoomTime = 0;\n this.lastZoom = z;\n this.lastFloorZoom = floorZ;\n return true;\n }\n\n if (this.lastFloorZoom > floorZ) {\n this.lastIntegerZoom = floorZ + 1;\n this.lastIntegerZoomTime = now;\n } else if (this.lastFloorZoom < floorZ) {\n this.lastIntegerZoom = floorZ;\n this.lastIntegerZoomTime = now;\n }\n\n if (z !== this.lastZoom) {\n this.lastZoom = z;\n this.lastFloorZoom = floorZ;\n return true;\n }\n\n return false;\n }\n}\n\nexport default ZoomHistory;\n","// @flow\n\n// The following table comes from .\n// Keep it synchronized with .\n\ntype UnicodeBlockLookup = {[key: string]: (char: number) => boolean};\n\nconst unicodeBlockLookup: UnicodeBlockLookup = {\n // 'Basic Latin': (char) => char >= 0x0000 && char <= 0x007F,\n 'Latin-1 Supplement': (char) => char >= 0x0080 && char <= 0x00FF,\n // 'Latin Extended-A': (char) => char >= 0x0100 && char <= 0x017F,\n // 'Latin Extended-B': (char) => char >= 0x0180 && char <= 0x024F,\n // 'IPA Extensions': (char) => char >= 0x0250 && char <= 0x02AF,\n // 'Spacing Modifier Letters': (char) => char >= 0x02B0 && char <= 0x02FF,\n // 'Combining Diacritical Marks': (char) => char >= 0x0300 && char <= 0x036F,\n // 'Greek and Coptic': (char) => char >= 0x0370 && char <= 0x03FF,\n // 'Cyrillic': (char) => char >= 0x0400 && char <= 0x04FF,\n // 'Cyrillic Supplement': (char) => char >= 0x0500 && char <= 0x052F,\n // 'Armenian': (char) => char >= 0x0530 && char <= 0x058F,\n //'Hebrew': (char) => char >= 0x0590 && char <= 0x05FF,\n 'Arabic': (char) => char >= 0x0600 && char <= 0x06FF,\n //'Syriac': (char) => char >= 0x0700 && char <= 0x074F,\n 'Arabic Supplement': (char) => char >= 0x0750 && char <= 0x077F,\n // 'Thaana': (char) => char >= 0x0780 && char <= 0x07BF,\n // 'NKo': (char) => char >= 0x07C0 && char <= 0x07FF,\n // 'Samaritan': (char) => char >= 0x0800 && char <= 0x083F,\n // 'Mandaic': (char) => char >= 0x0840 && char <= 0x085F,\n // 'Syriac Supplement': (char) => char >= 0x0860 && char <= 0x086F,\n 'Arabic Extended-A': (char) => char >= 0x08A0 && char <= 0x08FF,\n // 'Devanagari': (char) => char >= 0x0900 && char <= 0x097F,\n // 'Bengali': (char) => char >= 0x0980 && char <= 0x09FF,\n // 'Gurmukhi': (char) => char >= 0x0A00 && char <= 0x0A7F,\n // 'Gujarati': (char) => char >= 0x0A80 && char <= 0x0AFF,\n // 'Oriya': (char) => char >= 0x0B00 && char <= 0x0B7F,\n // 'Tamil': (char) => char >= 0x0B80 && char <= 0x0BFF,\n // 'Telugu': (char) => char >= 0x0C00 && char <= 0x0C7F,\n // 'Kannada': (char) => char >= 0x0C80 && char <= 0x0CFF,\n // 'Malayalam': (char) => char >= 0x0D00 && char <= 0x0D7F,\n // 'Sinhala': (char) => char >= 0x0D80 && char <= 0x0DFF,\n // 'Thai': (char) => char >= 0x0E00 && char <= 0x0E7F,\n // 'Lao': (char) => char >= 0x0E80 && char <= 0x0EFF,\n // 'Tibetan': (char) => char >= 0x0F00 && char <= 0x0FFF,\n // 'Myanmar': (char) => char >= 0x1000 && char <= 0x109F,\n // 'Georgian': (char) => char >= 0x10A0 && char <= 0x10FF,\n 'Hangul Jamo': (char) => char >= 0x1100 && char <= 0x11FF,\n // 'Ethiopic': (char) => char >= 0x1200 && char <= 0x137F,\n // 'Ethiopic Supplement': (char) => char >= 0x1380 && char <= 0x139F,\n // 'Cherokee': (char) => char >= 0x13A0 && char <= 0x13FF,\n 'Unified Canadian Aboriginal Syllabics': (char) => char >= 0x1400 && char <= 0x167F,\n // 'Ogham': (char) => char >= 0x1680 && char <= 0x169F,\n // 'Runic': (char) => char >= 0x16A0 && char <= 0x16FF,\n // 'Tagalog': (char) => char >= 0x1700 && char <= 0x171F,\n // 'Hanunoo': (char) => char >= 0x1720 && char <= 0x173F,\n // 'Buhid': (char) => char >= 0x1740 && char <= 0x175F,\n // 'Tagbanwa': (char) => char >= 0x1760 && char <= 0x177F,\n 'Khmer': (char) => char >= 0x1780 && char <= 0x17FF,\n // 'Mongolian': (char) => char >= 0x1800 && char <= 0x18AF,\n 'Unified Canadian Aboriginal Syllabics Extended': (char) => char >= 0x18B0 && char <= 0x18FF,\n // 'Limbu': (char) => char >= 0x1900 && char <= 0x194F,\n // 'Tai Le': (char) => char >= 0x1950 && char <= 0x197F,\n // 'New Tai Lue': (char) => char >= 0x1980 && char <= 0x19DF,\n // 'Khmer Symbols': (char) => char >= 0x19E0 && char <= 0x19FF,\n // 'Buginese': (char) => char >= 0x1A00 && char <= 0x1A1F,\n // 'Tai Tham': (char) => char >= 0x1A20 && char <= 0x1AAF,\n // 'Combining Diacritical Marks Extended': (char) => char >= 0x1AB0 && char <= 0x1AFF,\n // 'Balinese': (char) => char >= 0x1B00 && char <= 0x1B7F,\n // 'Sundanese': (char) => char >= 0x1B80 && char <= 0x1BBF,\n // 'Batak': (char) => char >= 0x1BC0 && char <= 0x1BFF,\n // 'Lepcha': (char) => char >= 0x1C00 && char <= 0x1C4F,\n // 'Ol Chiki': (char) => char >= 0x1C50 && char <= 0x1C7F,\n // 'Cyrillic Extended-C': (char) => char >= 0x1C80 && char <= 0x1C8F,\n // 'Georgian Extended': (char) => char >= 0x1C90 && char <= 0x1CBF,\n // 'Sundanese Supplement': (char) => char >= 0x1CC0 && char <= 0x1CCF,\n // 'Vedic Extensions': (char) => char >= 0x1CD0 && char <= 0x1CFF,\n // 'Phonetic Extensions': (char) => char >= 0x1D00 && char <= 0x1D7F,\n // 'Phonetic Extensions Supplement': (char) => char >= 0x1D80 && char <= 0x1DBF,\n // 'Combining Diacritical Marks Supplement': (char) => char >= 0x1DC0 && char <= 0x1DFF,\n // 'Latin Extended Additional': (char) => char >= 0x1E00 && char <= 0x1EFF,\n // 'Greek Extended': (char) => char >= 0x1F00 && char <= 0x1FFF,\n 'General Punctuation': (char) => char >= 0x2000 && char <= 0x206F,\n // 'Superscripts and Subscripts': (char) => char >= 0x2070 && char <= 0x209F,\n // 'Currency Symbols': (char) => char >= 0x20A0 && char <= 0x20CF,\n // 'Combining Diacritical Marks for Symbols': (char) => char >= 0x20D0 && char <= 0x20FF,\n 'Letterlike Symbols': (char) => char >= 0x2100 && char <= 0x214F,\n 'Number Forms': (char) => char >= 0x2150 && char <= 0x218F,\n // 'Arrows': (char) => char >= 0x2190 && char <= 0x21FF,\n // 'Mathematical Operators': (char) => char >= 0x2200 && char <= 0x22FF,\n 'Miscellaneous Technical': (char) => char >= 0x2300 && char <= 0x23FF,\n 'Control Pictures': (char) => char >= 0x2400 && char <= 0x243F,\n 'Optical Character Recognition': (char) => char >= 0x2440 && char <= 0x245F,\n 'Enclosed Alphanumerics': (char) => char >= 0x2460 && char <= 0x24FF,\n // 'Box Drawing': (char) => char >= 0x2500 && char <= 0x257F,\n // 'Block Elements': (char) => char >= 0x2580 && char <= 0x259F,\n 'Geometric Shapes': (char) => char >= 0x25A0 && char <= 0x25FF,\n 'Miscellaneous Symbols': (char) => char >= 0x2600 && char <= 0x26FF,\n // 'Dingbats': (char) => char >= 0x2700 && char <= 0x27BF,\n // 'Miscellaneous Mathematical Symbols-A': (char) => char >= 0x27C0 && char <= 0x27EF,\n // 'Supplemental Arrows-A': (char) => char >= 0x27F0 && char <= 0x27FF,\n // 'Braille Patterns': (char) => char >= 0x2800 && char <= 0x28FF,\n // 'Supplemental Arrows-B': (char) => char >= 0x2900 && char <= 0x297F,\n // 'Miscellaneous Mathematical Symbols-B': (char) => char >= 0x2980 && char <= 0x29FF,\n // 'Supplemental Mathematical Operators': (char) => char >= 0x2A00 && char <= 0x2AFF,\n 'Miscellaneous Symbols and Arrows': (char) => char >= 0x2B00 && char <= 0x2BFF,\n // 'Glagolitic': (char) => char >= 0x2C00 && char <= 0x2C5F,\n // 'Latin Extended-C': (char) => char >= 0x2C60 && char <= 0x2C7F,\n // 'Coptic': (char) => char >= 0x2C80 && char <= 0x2CFF,\n // 'Georgian Supplement': (char) => char >= 0x2D00 && char <= 0x2D2F,\n // 'Tifinagh': (char) => char >= 0x2D30 && char <= 0x2D7F,\n // 'Ethiopic Extended': (char) => char >= 0x2D80 && char <= 0x2DDF,\n // 'Cyrillic Extended-A': (char) => char >= 0x2DE0 && char <= 0x2DFF,\n // 'Supplemental Punctuation': (char) => char >= 0x2E00 && char <= 0x2E7F,\n 'CJK Radicals Supplement': (char) => char >= 0x2E80 && char <= 0x2EFF,\n 'Kangxi Radicals': (char) => char >= 0x2F00 && char <= 0x2FDF,\n 'Ideographic Description Characters': (char) => char >= 0x2FF0 && char <= 0x2FFF,\n 'CJK Symbols and Punctuation': (char) => char >= 0x3000 && char <= 0x303F,\n 'Hiragana': (char) => char >= 0x3040 && char <= 0x309F,\n 'Katakana': (char) => char >= 0x30A0 && char <= 0x30FF,\n 'Bopomofo': (char) => char >= 0x3100 && char <= 0x312F,\n 'Hangul Compatibility Jamo': (char) => char >= 0x3130 && char <= 0x318F,\n 'Kanbun': (char) => char >= 0x3190 && char <= 0x319F,\n 'Bopomofo Extended': (char) => char >= 0x31A0 && char <= 0x31BF,\n 'CJK Strokes': (char) => char >= 0x31C0 && char <= 0x31EF,\n 'Katakana Phonetic Extensions': (char) => char >= 0x31F0 && char <= 0x31FF,\n 'Enclosed CJK Letters and Months': (char) => char >= 0x3200 && char <= 0x32FF,\n 'CJK Compatibility': (char) => char >= 0x3300 && char <= 0x33FF,\n 'CJK Unified Ideographs Extension A': (char) => char >= 0x3400 && char <= 0x4DBF,\n 'Yijing Hexagram Symbols': (char) => char >= 0x4DC0 && char <= 0x4DFF,\n 'CJK Unified Ideographs': (char) => char >= 0x4E00 && char <= 0x9FFF,\n 'Yi Syllables': (char) => char >= 0xA000 && char <= 0xA48F,\n 'Yi Radicals': (char) => char >= 0xA490 && char <= 0xA4CF,\n // 'Lisu': (char) => char >= 0xA4D0 && char <= 0xA4FF,\n // 'Vai': (char) => char >= 0xA500 && char <= 0xA63F,\n // 'Cyrillic Extended-B': (char) => char >= 0xA640 && char <= 0xA69F,\n // 'Bamum': (char) => char >= 0xA6A0 && char <= 0xA6FF,\n // 'Modifier Tone Letters': (char) => char >= 0xA700 && char <= 0xA71F,\n // 'Latin Extended-D': (char) => char >= 0xA720 && char <= 0xA7FF,\n // 'Syloti Nagri': (char) => char >= 0xA800 && char <= 0xA82F,\n // 'Common Indic Number Forms': (char) => char >= 0xA830 && char <= 0xA83F,\n // 'Phags-pa': (char) => char >= 0xA840 && char <= 0xA87F,\n // 'Saurashtra': (char) => char >= 0xA880 && char <= 0xA8DF,\n // 'Devanagari Extended': (char) => char >= 0xA8E0 && char <= 0xA8FF,\n // 'Kayah Li': (char) => char >= 0xA900 && char <= 0xA92F,\n // 'Rejang': (char) => char >= 0xA930 && char <= 0xA95F,\n 'Hangul Jamo Extended-A': (char) => char >= 0xA960 && char <= 0xA97F,\n // 'Javanese': (char) => char >= 0xA980 && char <= 0xA9DF,\n // 'Myanmar Extended-B': (char) => char >= 0xA9E0 && char <= 0xA9FF,\n // 'Cham': (char) => char >= 0xAA00 && char <= 0xAA5F,\n // 'Myanmar Extended-A': (char) => char >= 0xAA60 && char <= 0xAA7F,\n // 'Tai Viet': (char) => char >= 0xAA80 && char <= 0xAADF,\n // 'Meetei Mayek Extensions': (char) => char >= 0xAAE0 && char <= 0xAAFF,\n // 'Ethiopic Extended-A': (char) => char >= 0xAB00 && char <= 0xAB2F,\n // 'Latin Extended-E': (char) => char >= 0xAB30 && char <= 0xAB6F,\n // 'Cherokee Supplement': (char) => char >= 0xAB70 && char <= 0xABBF,\n // 'Meetei Mayek': (char) => char >= 0xABC0 && char <= 0xABFF,\n 'Hangul Syllables': (char) => char >= 0xAC00 && char <= 0xD7AF,\n 'Hangul Jamo Extended-B': (char) => char >= 0xD7B0 && char <= 0xD7FF,\n // 'High Surrogates': (char) => char >= 0xD800 && char <= 0xDB7F,\n // 'High Private Use Surrogates': (char) => char >= 0xDB80 && char <= 0xDBFF,\n // 'Low Surrogates': (char) => char >= 0xDC00 && char <= 0xDFFF,\n 'Private Use Area': (char) => char >= 0xE000 && char <= 0xF8FF,\n 'CJK Compatibility Ideographs': (char) => char >= 0xF900 && char <= 0xFAFF,\n // 'Alphabetic Presentation Forms': (char) => char >= 0xFB00 && char <= 0xFB4F,\n 'Arabic Presentation Forms-A': (char) => char >= 0xFB50 && char <= 0xFDFF,\n // 'Variation Selectors': (char) => char >= 0xFE00 && char <= 0xFE0F,\n 'Vertical Forms': (char) => char >= 0xFE10 && char <= 0xFE1F,\n // 'Combining Half Marks': (char) => char >= 0xFE20 && char <= 0xFE2F,\n 'CJK Compatibility Forms': (char) => char >= 0xFE30 && char <= 0xFE4F,\n 'Small Form Variants': (char) => char >= 0xFE50 && char <= 0xFE6F,\n 'Arabic Presentation Forms-B': (char) => char >= 0xFE70 && char <= 0xFEFF,\n 'Halfwidth and Fullwidth Forms': (char) => char >= 0xFF00 && char <= 0xFFEF\n // 'Specials': (char) => char >= 0xFFF0 && char <= 0xFFFF,\n // 'Linear B Syllabary': (char) => char >= 0x10000 && char <= 0x1007F,\n // 'Linear B Ideograms': (char) => char >= 0x10080 && char <= 0x100FF,\n // 'Aegean Numbers': (char) => char >= 0x10100 && char <= 0x1013F,\n // 'Ancient Greek Numbers': (char) => char >= 0x10140 && char <= 0x1018F,\n // 'Ancient Symbols': (char) => char >= 0x10190 && char <= 0x101CF,\n // 'Phaistos Disc': (char) => char >= 0x101D0 && char <= 0x101FF,\n // 'Lycian': (char) => char >= 0x10280 && char <= 0x1029F,\n // 'Carian': (char) => char >= 0x102A0 && char <= 0x102DF,\n // 'Coptic Epact Numbers': (char) => char >= 0x102E0 && char <= 0x102FF,\n // 'Old Italic': (char) => char >= 0x10300 && char <= 0x1032F,\n // 'Gothic': (char) => char >= 0x10330 && char <= 0x1034F,\n // 'Old Permic': (char) => char >= 0x10350 && char <= 0x1037F,\n // 'Ugaritic': (char) => char >= 0x10380 && char <= 0x1039F,\n // 'Old Persian': (char) => char >= 0x103A0 && char <= 0x103DF,\n // 'Deseret': (char) => char >= 0x10400 && char <= 0x1044F,\n // 'Shavian': (char) => char >= 0x10450 && char <= 0x1047F,\n // 'Osmanya': (char) => char >= 0x10480 && char <= 0x104AF,\n // 'Osage': (char) => char >= 0x104B0 && char <= 0x104FF,\n // 'Elbasan': (char) => char >= 0x10500 && char <= 0x1052F,\n // 'Caucasian Albanian': (char) => char >= 0x10530 && char <= 0x1056F,\n // 'Linear A': (char) => char >= 0x10600 && char <= 0x1077F,\n // 'Cypriot Syllabary': (char) => char >= 0x10800 && char <= 0x1083F,\n // 'Imperial Aramaic': (char) => char >= 0x10840 && char <= 0x1085F,\n // 'Palmyrene': (char) => char >= 0x10860 && char <= 0x1087F,\n // 'Nabataean': (char) => char >= 0x10880 && char <= 0x108AF,\n // 'Hatran': (char) => char >= 0x108E0 && char <= 0x108FF,\n // 'Phoenician': (char) => char >= 0x10900 && char <= 0x1091F,\n // 'Lydian': (char) => char >= 0x10920 && char <= 0x1093F,\n // 'Meroitic Hieroglyphs': (char) => char >= 0x10980 && char <= 0x1099F,\n // 'Meroitic Cursive': (char) => char >= 0x109A0 && char <= 0x109FF,\n // 'Kharoshthi': (char) => char >= 0x10A00 && char <= 0x10A5F,\n // 'Old South Arabian': (char) => char >= 0x10A60 && char <= 0x10A7F,\n // 'Old North Arabian': (char) => char >= 0x10A80 && char <= 0x10A9F,\n // 'Manichaean': (char) => char >= 0x10AC0 && char <= 0x10AFF,\n // 'Avestan': (char) => char >= 0x10B00 && char <= 0x10B3F,\n // 'Inscriptional Parthian': (char) => char >= 0x10B40 && char <= 0x10B5F,\n // 'Inscriptional Pahlavi': (char) => char >= 0x10B60 && char <= 0x10B7F,\n // 'Psalter Pahlavi': (char) => char >= 0x10B80 && char <= 0x10BAF,\n // 'Old Turkic': (char) => char >= 0x10C00 && char <= 0x10C4F,\n // 'Old Hungarian': (char) => char >= 0x10C80 && char <= 0x10CFF,\n // 'Hanifi Rohingya': (char) => char >= 0x10D00 && char <= 0x10D3F,\n // 'Rumi Numeral Symbols': (char) => char >= 0x10E60 && char <= 0x10E7F,\n // 'Old Sogdian': (char) => char >= 0x10F00 && char <= 0x10F2F,\n // 'Sogdian': (char) => char >= 0x10F30 && char <= 0x10F6F,\n // 'Elymaic': (char) => char >= 0x10FE0 && char <= 0x10FFF,\n // 'Brahmi': (char) => char >= 0x11000 && char <= 0x1107F,\n // 'Kaithi': (char) => char >= 0x11080 && char <= 0x110CF,\n // 'Sora Sompeng': (char) => char >= 0x110D0 && char <= 0x110FF,\n // 'Chakma': (char) => char >= 0x11100 && char <= 0x1114F,\n // 'Mahajani': (char) => char >= 0x11150 && char <= 0x1117F,\n // 'Sharada': (char) => char >= 0x11180 && char <= 0x111DF,\n // 'Sinhala Archaic Numbers': (char) => char >= 0x111E0 && char <= 0x111FF,\n // 'Khojki': (char) => char >= 0x11200 && char <= 0x1124F,\n // 'Multani': (char) => char >= 0x11280 && char <= 0x112AF,\n // 'Khudawadi': (char) => char >= 0x112B0 && char <= 0x112FF,\n // 'Grantha': (char) => char >= 0x11300 && char <= 0x1137F,\n // 'Newa': (char) => char >= 0x11400 && char <= 0x1147F,\n // 'Tirhuta': (char) => char >= 0x11480 && char <= 0x114DF,\n // 'Siddham': (char) => char >= 0x11580 && char <= 0x115FF,\n // 'Modi': (char) => char >= 0x11600 && char <= 0x1165F,\n // 'Mongolian Supplement': (char) => char >= 0x11660 && char <= 0x1167F,\n // 'Takri': (char) => char >= 0x11680 && char <= 0x116CF,\n // 'Ahom': (char) => char >= 0x11700 && char <= 0x1173F,\n // 'Dogra': (char) => char >= 0x11800 && char <= 0x1184F,\n // 'Warang Citi': (char) => char >= 0x118A0 && char <= 0x118FF,\n // 'Nandinagari': (char) => char >= 0x119A0 && char <= 0x119FF,\n // 'Zanabazar Square': (char) => char >= 0x11A00 && char <= 0x11A4F,\n // 'Soyombo': (char) => char >= 0x11A50 && char <= 0x11AAF,\n // 'Pau Cin Hau': (char) => char >= 0x11AC0 && char <= 0x11AFF,\n // 'Bhaiksuki': (char) => char >= 0x11C00 && char <= 0x11C6F,\n // 'Marchen': (char) => char >= 0x11C70 && char <= 0x11CBF,\n // 'Masaram Gondi': (char) => char >= 0x11D00 && char <= 0x11D5F,\n // 'Gunjala Gondi': (char) => char >= 0x11D60 && char <= 0x11DAF,\n // 'Makasar': (char) => char >= 0x11EE0 && char <= 0x11EFF,\n // 'Tamil Supplement': (char) => char >= 0x11FC0 && char <= 0x11FFF,\n // 'Cuneiform': (char) => char >= 0x12000 && char <= 0x123FF,\n // 'Cuneiform Numbers and Punctuation': (char) => char >= 0x12400 && char <= 0x1247F,\n // 'Early Dynastic Cuneiform': (char) => char >= 0x12480 && char <= 0x1254F,\n // 'Egyptian Hieroglyphs': (char) => char >= 0x13000 && char <= 0x1342F,\n // 'Egyptian Hieroglyph Format Controls': (char) => char >= 0x13430 && char <= 0x1343F,\n // 'Anatolian Hieroglyphs': (char) => char >= 0x14400 && char <= 0x1467F,\n // 'Bamum Supplement': (char) => char >= 0x16800 && char <= 0x16A3F,\n // 'Mro': (char) => char >= 0x16A40 && char <= 0x16A6F,\n // 'Bassa Vah': (char) => char >= 0x16AD0 && char <= 0x16AFF,\n // 'Pahawh Hmong': (char) => char >= 0x16B00 && char <= 0x16B8F,\n // 'Medefaidrin': (char) => char >= 0x16E40 && char <= 0x16E9F,\n // 'Miao': (char) => char >= 0x16F00 && char <= 0x16F9F,\n // 'Ideographic Symbols and Punctuation': (char) => char >= 0x16FE0 && char <= 0x16FFF,\n // 'Tangut': (char) => char >= 0x17000 && char <= 0x187FF,\n // 'Tangut Components': (char) => char >= 0x18800 && char <= 0x18AFF,\n // 'Kana Supplement': (char) => char >= 0x1B000 && char <= 0x1B0FF,\n // 'Kana Extended-A': (char) => char >= 0x1B100 && char <= 0x1B12F,\n // 'Small Kana Extension': (char) => char >= 0x1B130 && char <= 0x1B16F,\n // 'Nushu': (char) => char >= 0x1B170 && char <= 0x1B2FF,\n // 'Duployan': (char) => char >= 0x1BC00 && char <= 0x1BC9F,\n // 'Shorthand Format Controls': (char) => char >= 0x1BCA0 && char <= 0x1BCAF,\n // 'Byzantine Musical Symbols': (char) => char >= 0x1D000 && char <= 0x1D0FF,\n // 'Musical Symbols': (char) => char >= 0x1D100 && char <= 0x1D1FF,\n // 'Ancient Greek Musical Notation': (char) => char >= 0x1D200 && char <= 0x1D24F,\n // 'Mayan Numerals': (char) => char >= 0x1D2E0 && char <= 0x1D2FF,\n // 'Tai Xuan Jing Symbols': (char) => char >= 0x1D300 && char <= 0x1D35F,\n // 'Counting Rod Numerals': (char) => char >= 0x1D360 && char <= 0x1D37F,\n // 'Mathematical Alphanumeric Symbols': (char) => char >= 0x1D400 && char <= 0x1D7FF,\n // 'Sutton SignWriting': (char) => char >= 0x1D800 && char <= 0x1DAAF,\n // 'Glagolitic Supplement': (char) => char >= 0x1E000 && char <= 0x1E02F,\n // 'Nyiakeng Puachue Hmong': (char) => char >= 0x1E100 && char <= 0x1E14F,\n // 'Wancho': (char) => char >= 0x1E2C0 && char <= 0x1E2FF,\n // 'Mende Kikakui': (char) => char >= 0x1E800 && char <= 0x1E8DF,\n // 'Adlam': (char) => char >= 0x1E900 && char <= 0x1E95F,\n // 'Indic Siyaq Numbers': (char) => char >= 0x1EC70 && char <= 0x1ECBF,\n // 'Ottoman Siyaq Numbers': (char) => char >= 0x1ED00 && char <= 0x1ED4F,\n // 'Arabic Mathematical Alphabetic Symbols': (char) => char >= 0x1EE00 && char <= 0x1EEFF,\n // 'Mahjong Tiles': (char) => char >= 0x1F000 && char <= 0x1F02F,\n // 'Domino Tiles': (char) => char >= 0x1F030 && char <= 0x1F09F,\n // 'Playing Cards': (char) => char >= 0x1F0A0 && char <= 0x1F0FF,\n // 'Enclosed Alphanumeric Supplement': (char) => char >= 0x1F100 && char <= 0x1F1FF,\n // 'Enclosed Ideographic Supplement': (char) => char >= 0x1F200 && char <= 0x1F2FF,\n // 'Miscellaneous Symbols and Pictographs': (char) => char >= 0x1F300 && char <= 0x1F5FF,\n // 'Emoticons': (char) => char >= 0x1F600 && char <= 0x1F64F,\n // 'Ornamental Dingbats': (char) => char >= 0x1F650 && char <= 0x1F67F,\n // 'Transport and Map Symbols': (char) => char >= 0x1F680 && char <= 0x1F6FF,\n // 'Alchemical Symbols': (char) => char >= 0x1F700 && char <= 0x1F77F,\n // 'Geometric Shapes Extended': (char) => char >= 0x1F780 && char <= 0x1F7FF,\n // 'Supplemental Arrows-C': (char) => char >= 0x1F800 && char <= 0x1F8FF,\n // 'Supplemental Symbols and Pictographs': (char) => char >= 0x1F900 && char <= 0x1F9FF,\n // 'Chess Symbols': (char) => char >= 0x1FA00 && char <= 0x1FA6F,\n // 'Symbols and Pictographs Extended-A': (char) => char >= 0x1FA70 && char <= 0x1FAFF,\n // 'CJK Unified Ideographs Extension B': (char) => char >= 0x20000 && char <= 0x2A6DF,\n // 'CJK Unified Ideographs Extension C': (char) => char >= 0x2A700 && char <= 0x2B73F,\n // 'CJK Unified Ideographs Extension D': (char) => char >= 0x2B740 && char <= 0x2B81F,\n // 'CJK Unified Ideographs Extension E': (char) => char >= 0x2B820 && char <= 0x2CEAF,\n // 'CJK Unified Ideographs Extension F': (char) => char >= 0x2CEB0 && char <= 0x2EBEF,\n // 'CJK Compatibility Ideographs Supplement': (char) => char >= 0x2F800 && char <= 0x2FA1F,\n // 'Tags': (char) => char >= 0xE0000 && char <= 0xE007F,\n // 'Variation Selectors Supplement': (char) => char >= 0xE0100 && char <= 0xE01EF,\n // 'Supplementary Private Use Area-A': (char) => char >= 0xF0000 && char <= 0xFFFFF,\n // 'Supplementary Private Use Area-B': (char) => char >= 0x100000 && char <= 0x10FFFF,\n};\n\nexport default unicodeBlockLookup;\n","// @flow\n\n/* eslint-disable new-cap */\n\nimport isChar from './is_char_in_unicode_block';\n\nexport function allowsIdeographicBreaking(chars: string) {\n for (const char of chars) {\n if (!charAllowsIdeographicBreaking(char.charCodeAt(0))) return false;\n }\n return true;\n}\n\nexport function allowsVerticalWritingMode(chars: string) {\n for (const char of chars) {\n if (charHasUprightVerticalOrientation(char.charCodeAt(0))) return true;\n }\n return false;\n}\n\nexport function allowsLetterSpacing(chars: string) {\n for (const char of chars) {\n if (!charAllowsLetterSpacing(char.charCodeAt(0))) return false;\n }\n return true;\n}\n\nexport function charAllowsLetterSpacing(char: number) {\n if (isChar['Arabic'](char)) return false;\n if (isChar['Arabic Supplement'](char)) return false;\n if (isChar['Arabic Extended-A'](char)) return false;\n if (isChar['Arabic Presentation Forms-A'](char)) return false;\n if (isChar['Arabic Presentation Forms-B'](char)) return false;\n\n return true;\n}\n\nexport function charAllowsIdeographicBreaking(char: number) {\n // Return early for characters outside all ideographic ranges.\n if (char < 0x2E80) return false;\n\n if (isChar['Bopomofo Extended'](char)) return true;\n if (isChar['Bopomofo'](char)) return true;\n if (isChar['CJK Compatibility Forms'](char)) return true;\n if (isChar['CJK Compatibility Ideographs'](char)) return true;\n if (isChar['CJK Compatibility'](char)) return true;\n if (isChar['CJK Radicals Supplement'](char)) return true;\n if (isChar['CJK Strokes'](char)) return true;\n if (isChar['CJK Symbols and Punctuation'](char)) return true;\n if (isChar['CJK Unified Ideographs Extension A'](char)) return true;\n if (isChar['CJK Unified Ideographs'](char)) return true;\n if (isChar['Enclosed CJK Letters and Months'](char)) return true;\n if (isChar['Halfwidth and Fullwidth Forms'](char)) return true;\n if (isChar['Hiragana'](char)) return true;\n if (isChar['Ideographic Description Characters'](char)) return true;\n if (isChar['Kangxi Radicals'](char)) return true;\n if (isChar['Katakana Phonetic Extensions'](char)) return true;\n if (isChar['Katakana'](char)) return true;\n if (isChar['Vertical Forms'](char)) return true;\n if (isChar['Yi Radicals'](char)) return true;\n if (isChar['Yi Syllables'](char)) return true;\n\n return false;\n}\n\n// The following logic comes from\n// .\n// Keep it synchronized with\n// .\n// The data file denotes with “U” or “Tu” any codepoint that may be drawn\n// upright in vertical text but does not distinguish between upright and\n// “neutral” characters.\n\n// Blocks in the Unicode supplementary planes are excluded from this module due\n// to .\n\n/**\n * Returns true if the given Unicode codepoint identifies a character with\n * upright orientation.\n *\n * A character has upright orientation if it is drawn upright (unrotated)\n * whether the line is oriented horizontally or vertically, even if both\n * adjacent characters can be rotated. For example, a Chinese character is\n * always drawn upright. An uprightly oriented character causes an adjacent\n * “neutral” character to be drawn upright as well.\n * @private\n */\nexport function charHasUprightVerticalOrientation(char: number) {\n if (char === 0x02EA /* modifier letter yin departing tone mark */ ||\n char === 0x02EB /* modifier letter yang departing tone mark */) {\n return true;\n }\n\n // Return early for characters outside all ranges whose characters remain\n // upright in vertical writing mode.\n if (char < 0x1100) return false;\n\n if (isChar['Bopomofo Extended'](char)) return true;\n if (isChar['Bopomofo'](char)) return true;\n if (isChar['CJK Compatibility Forms'](char)) {\n if (!((char >= 0xFE49 /* dashed overline */ && char <= 0xFE4F) /* wavy low line */)) {\n return true;\n }\n }\n if (isChar['CJK Compatibility Ideographs'](char)) return true;\n if (isChar['CJK Compatibility'](char)) return true;\n if (isChar['CJK Radicals Supplement'](char)) return true;\n if (isChar['CJK Strokes'](char)) return true;\n if (isChar['CJK Symbols and Punctuation'](char)) {\n if (!((char >= 0x3008 /* left angle bracket */ && char <= 0x3011) /* right black lenticular bracket */) &&\n !((char >= 0x3014 /* left tortoise shell bracket */ && char <= 0x301F) /* low double prime quotation mark */) &&\n char !== 0x3030 /* wavy dash */) {\n return true;\n }\n }\n if (isChar['CJK Unified Ideographs Extension A'](char)) return true;\n if (isChar['CJK Unified Ideographs'](char)) return true;\n if (isChar['Enclosed CJK Letters and Months'](char)) return true;\n if (isChar['Hangul Compatibility Jamo'](char)) return true;\n if (isChar['Hangul Jamo Extended-A'](char)) return true;\n if (isChar['Hangul Jamo Extended-B'](char)) return true;\n if (isChar['Hangul Jamo'](char)) return true;\n if (isChar['Hangul Syllables'](char)) return true;\n if (isChar['Hiragana'](char)) return true;\n if (isChar['Ideographic Description Characters'](char)) return true;\n if (isChar['Kanbun'](char)) return true;\n if (isChar['Kangxi Radicals'](char)) return true;\n if (isChar['Katakana Phonetic Extensions'](char)) return true;\n if (isChar['Katakana'](char)) {\n if (char !== 0x30FC /* katakana-hiragana prolonged sound mark */) {\n return true;\n }\n }\n if (isChar['Halfwidth and Fullwidth Forms'](char)) {\n if (char !== 0xFF08 /* fullwidth left parenthesis */ &&\n char !== 0xFF09 /* fullwidth right parenthesis */ &&\n char !== 0xFF0D /* fullwidth hyphen-minus */ &&\n !((char >= 0xFF1A /* fullwidth colon */ && char <= 0xFF1E) /* fullwidth greater-than sign */) &&\n char !== 0xFF3B /* fullwidth left square bracket */ &&\n char !== 0xFF3D /* fullwidth right square bracket */ &&\n char !== 0xFF3F /* fullwidth low line */ &&\n !(char >= 0xFF5B /* fullwidth left curly bracket */ && char <= 0xFFDF) &&\n char !== 0xFFE3 /* fullwidth macron */ &&\n !(char >= 0xFFE8 /* halfwidth forms light vertical */ && char <= 0xFFEF)) {\n return true;\n }\n }\n if (isChar['Small Form Variants'](char)) {\n if (!((char >= 0xFE58 /* small em dash */ && char <= 0xFE5E) /* small right tortoise shell bracket */) &&\n !((char >= 0xFE63 /* small hyphen-minus */ && char <= 0xFE66) /* small equals sign */)) {\n return true;\n }\n }\n if (isChar['Unified Canadian Aboriginal Syllabics'](char)) return true;\n if (isChar['Unified Canadian Aboriginal Syllabics Extended'](char)) return true;\n if (isChar['Vertical Forms'](char)) return true;\n if (isChar['Yijing Hexagram Symbols'](char)) return true;\n if (isChar['Yi Syllables'](char)) return true;\n if (isChar['Yi Radicals'](char)) return true;\n\n return false;\n}\n\n/**\n * Returns true if the given Unicode codepoint identifies a character with\n * neutral orientation.\n *\n * A character has neutral orientation if it may be drawn rotated or unrotated\n * when the line is oriented vertically, depending on the orientation of the\n * adjacent characters. For example, along a verticlly oriented line, the vulgar\n * fraction ½ is drawn upright among Chinese characters but rotated among Latin\n * letters. A neutrally oriented character does not influence whether an\n * adjacent character is drawn upright or rotated.\n * @private\n */\nexport function charHasNeutralVerticalOrientation(char: number) {\n if (isChar['Latin-1 Supplement'](char)) {\n if (char === 0x00A7 /* section sign */ ||\n char === 0x00A9 /* copyright sign */ ||\n char === 0x00AE /* registered sign */ ||\n char === 0x00B1 /* plus-minus sign */ ||\n char === 0x00BC /* vulgar fraction one quarter */ ||\n char === 0x00BD /* vulgar fraction one half */ ||\n char === 0x00BE /* vulgar fraction three quarters */ ||\n char === 0x00D7 /* multiplication sign */ ||\n char === 0x00F7 /* division sign */) {\n return true;\n }\n }\n if (isChar['General Punctuation'](char)) {\n if (char === 0x2016 /* double vertical line */ ||\n char === 0x2020 /* dagger */ ||\n char === 0x2021 /* double dagger */ ||\n char === 0x2030 /* per mille sign */ ||\n char === 0x2031 /* per ten thousand sign */ ||\n char === 0x203B /* reference mark */ ||\n char === 0x203C /* double exclamation mark */ ||\n char === 0x2042 /* asterism */ ||\n char === 0x2047 /* double question mark */ ||\n char === 0x2048 /* question exclamation mark */ ||\n char === 0x2049 /* exclamation question mark */ ||\n char === 0x2051 /* two asterisks aligned vertically */) {\n return true;\n }\n }\n if (isChar['Letterlike Symbols'](char)) return true;\n if (isChar['Number Forms'](char)) return true;\n if (isChar['Miscellaneous Technical'](char)) {\n if ((char >= 0x2300 /* diameter sign */ && char <= 0x2307 /* wavy line */) ||\n (char >= 0x230C /* bottom right crop */ && char <= 0x231F /* bottom right corner */) ||\n (char >= 0x2324 /* up arrowhead between two horizontal bars */ && char <= 0x2328 /* keyboard */) ||\n char === 0x232B /* erase to the left */ ||\n (char >= 0x237D /* shouldered open box */ && char <= 0x239A /* clear screen symbol */) ||\n (char >= 0x23BE /* dentistry symbol light vertical and top right */ && char <= 0x23CD /* square foot */) ||\n char === 0x23CF /* eject symbol */ ||\n (char >= 0x23D1 /* metrical breve */ && char <= 0x23DB /* fuse */) ||\n (char >= 0x23E2 /* white trapezium */ && char <= 0x23FF)) {\n return true;\n }\n }\n if (isChar['Control Pictures'](char) && char !== 0x2423 /* open box */) return true;\n if (isChar['Optical Character Recognition'](char)) return true;\n if (isChar['Enclosed Alphanumerics'](char)) return true;\n if (isChar['Geometric Shapes'](char)) return true;\n if (isChar['Miscellaneous Symbols'](char)) {\n if (!((char >= 0x261A /* black left pointing index */ && char <= 0x261F) /* white down pointing index */)) {\n return true;\n }\n }\n if (isChar['Miscellaneous Symbols and Arrows'](char)) {\n if ((char >= 0x2B12 /* square with top half black */ && char <= 0x2B2F /* white vertical ellipse */) ||\n (char >= 0x2B50 /* white medium star */ && char <= 0x2B59 /* heavy circled saltire */) ||\n (char >= 0x2BB8 /* upwards white arrow from bar with horizontal bar */ && char <= 0x2BEB)) {\n return true;\n }\n }\n if (isChar['CJK Symbols and Punctuation'](char)) return true;\n if (isChar['Katakana'](char)) return true;\n if (isChar['Private Use Area'](char)) return true;\n if (isChar['CJK Compatibility Forms'](char)) return true;\n if (isChar['Small Form Variants'](char)) return true;\n if (isChar['Halfwidth and Fullwidth Forms'](char)) return true;\n\n if (char === 0x221E /* infinity */ ||\n char === 0x2234 /* therefore */ ||\n char === 0x2235 /* because */ ||\n (char >= 0x2700 /* black safety scissors */ && char <= 0x2767 /* rotated floral heart bullet */) ||\n (char >= 0x2776 /* dingbat negative circled digit one */ && char <= 0x2793 /* dingbat negative circled sans-serif number ten */) ||\n char === 0xFFFC /* object replacement character */ ||\n char === 0xFFFD /* replacement character */) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Returns true if the given Unicode codepoint identifies a character with\n * rotated orientation.\n *\n * A character has rotated orientation if it is drawn rotated when the line is\n * oriented vertically, even if both adjacent characters are upright. For\n * example, a Latin letter is drawn rotated along a vertical line. A rotated\n * character causes an adjacent “neutral” character to be drawn rotated as well.\n * @private\n */\nexport function charHasRotatedVerticalOrientation(char: number) {\n return !(charHasUprightVerticalOrientation(char) ||\n charHasNeutralVerticalOrientation(char));\n}\n\nexport function charInComplexShapingScript(char: number) {\n return isChar['Arabic'](char) ||\n isChar['Arabic Supplement'](char) ||\n isChar['Arabic Extended-A'](char) ||\n isChar['Arabic Presentation Forms-A'](char) ||\n isChar['Arabic Presentation Forms-B'](char);\n}\n\nexport function charInRTLScript(char: number) {\n // Main blocks for Hebrew, Arabic, Thaana and other RTL scripts\n return (char >= 0x0590 && char <= 0x08FF) ||\n isChar['Arabic Presentation Forms-A'](char) ||\n isChar['Arabic Presentation Forms-B'](char);\n}\n\nexport function charInSupportedScript(char: number, canRenderRTL: boolean) {\n // This is a rough heuristic: whether we \"can render\" a script\n // actually depends on the properties of the font being used\n // and whether differences from the ideal rendering are considered\n // semantically significant.\n\n // Even in Latin script, we \"can't render\" combinations such as the fi\n // ligature, but we don't consider that semantically significant.\n if (!canRenderRTL && charInRTLScript(char)) {\n return false;\n }\n if ((char >= 0x0900 && char <= 0x0DFF) ||\n // Main blocks for Indic scripts and Sinhala\n (char >= 0x0F00 && char <= 0x109F) ||\n // Main blocks for Tibetan and Myanmar\n isChar['Khmer'](char)) {\n // These blocks cover common scripts that require\n // complex text shaping, based on unicode script metadata:\n // http://www.unicode.org/repos/cldr/trunk/common/properties/scriptMetadata.txt\n // where \"Web Rank <= 32\" \"Shaping Required = YES\"\n return false;\n }\n return true;\n}\n\nexport function stringContainsRTLText(chars: string): boolean {\n for (const char of chars) {\n if (charInRTLScript(char.charCodeAt(0))) {\n return true;\n }\n }\n return false;\n}\n\nexport function isStringInSupportedScript(chars: string, canRenderRTL: boolean) {\n for (const char of chars) {\n if (!charInSupportedScript(char.charCodeAt(0), canRenderRTL)) {\n return false;\n }\n }\n return true;\n}\n","// @flow\n\nimport {Event, Evented} from '../util/evented';\nimport {getArrayBuffer} from '../util/ajax';\nimport browser from '../util/browser';\nimport assert from 'assert';\nimport {isWorker} from '../util/util';\n\nconst status = {\n unavailable: 'unavailable', // Not loaded\n deferred: 'deferred', // The plugin URL has been specified, but loading has been deferred\n loading: 'loading', // request in-flight\n loaded: 'loaded',\n error: 'error'\n};\n\nexport type PluginState = {\n pluginStatus: $Values;\n pluginURL: ?string\n};\n\ntype ErrorCallback = (error: ?Error) => void;\ntype PluginStateSyncCallback = (state: PluginState) => void;\nlet _completionCallback = null;\n\n//Variables defining the current state of the plugin\nlet pluginStatus = status.unavailable;\nlet pluginURL = null;\n\nexport const triggerPluginCompletionEvent = function(error: ?Error) {\n // NetworkError's are not correctly reflected by the plugin status which prevents reloading plugin\n if (error && typeof error === 'string' && error.indexOf('NetworkError') > -1) {\n pluginStatus = status.error;\n }\n\n if (_completionCallback) {\n _completionCallback(error);\n }\n};\n\nfunction sendPluginStateToWorker() {\n evented.fire(new Event('pluginStateChange', {pluginStatus, pluginURL}));\n}\n\nexport const evented = new Evented();\n\nexport const getRTLTextPluginStatus = function () {\n return pluginStatus;\n};\n\nexport const registerForPluginStateChange = function(callback: PluginStateSyncCallback) {\n // Do an initial sync of the state\n callback({pluginStatus, pluginURL});\n // Listen for all future state changes\n evented.on('pluginStateChange', callback);\n return callback;\n};\n\nexport const clearRTLTextPlugin = function() {\n pluginStatus = status.unavailable;\n pluginURL = null;\n};\n\nexport const setRTLTextPlugin = function(url: string, callback: ?ErrorCallback, deferred: boolean = false) {\n if (pluginStatus === status.deferred || pluginStatus === status.loading || pluginStatus === status.loaded) {\n throw new Error('setRTLTextPlugin cannot be called multiple times.');\n }\n pluginURL = browser.resolveURL(url);\n pluginStatus = status.deferred;\n _completionCallback = callback;\n sendPluginStateToWorker();\n\n //Start downloading the plugin immediately if not intending to lazy-load\n if (!deferred) {\n downloadRTLTextPlugin();\n }\n};\n\nexport const downloadRTLTextPlugin = function() {\n if (pluginStatus !== status.deferred || !pluginURL) {\n throw new Error('rtl-text-plugin cannot be downloaded unless a pluginURL is specified');\n }\n pluginStatus = status.loading;\n sendPluginStateToWorker();\n if (pluginURL) {\n getArrayBuffer({url: pluginURL}, (error) => {\n if (error) {\n triggerPluginCompletionEvent(error);\n } else {\n pluginStatus = status.loaded;\n sendPluginStateToWorker();\n }\n });\n }\n};\n\nexport const plugin: {\n applyArabicShaping: ?Function,\n processBidirectionalText: ?(string, Array) => Array,\n processStyledBidirectionalText: ?(string, Array, Array) => Array<[string, Array]>,\n isLoaded: () => boolean,\n isLoading: () => boolean,\n setState: (state: PluginState) => void,\n isParsed: () => boolean,\n getPluginURL: () => ?string\n} = {\n applyArabicShaping: null,\n processBidirectionalText: null,\n processStyledBidirectionalText: null,\n isLoaded() {\n return pluginStatus === status.loaded || // Main Thread: loaded if the completion callback returned successfully\n plugin.applyArabicShaping != null; // Web-worker: loaded if the plugin functions have been compiled\n },\n isLoading() { // Main Thread Only: query the loading status, this function does not return the correct value in the worker context.\n return pluginStatus === status.loading;\n },\n setState(state: PluginState) { // Worker thread only: this tells the worker threads that the plugin is available on the Main thread\n assert(isWorker(), 'Cannot set the state of the rtl-text-plugin when not in the web-worker context');\n\n pluginStatus = state.pluginStatus;\n pluginURL = state.pluginURL;\n },\n isParsed(): boolean {\n assert(isWorker(), 'rtl-text-plugin is only parsed on the worker-threads');\n\n return plugin.applyArabicShaping != null &&\n plugin.processBidirectionalText != null &&\n plugin.processStyledBidirectionalText != null;\n },\n getPluginURL(): ?string {\n assert(isWorker(), 'rtl-text-plugin url can only be queried from the worker threads');\n return pluginURL;\n }\n};\n\nexport const lazyLoadRTLTextPlugin = function() {\n if (!plugin.isLoading() &&\n !plugin.isLoaded() &&\n getRTLTextPluginStatus() === 'deferred'\n ) {\n downloadRTLTextPlugin();\n }\n};\n","// @flow\n\nimport ZoomHistory from './zoom_history';\nimport {isStringInSupportedScript} from '../util/script_detection';\nimport {plugin as rtlTextPlugin} from '../source/rtl_text_plugin';\n\nimport type {TransitionSpecification} from '../style-spec/types';\n\nexport type CrossfadeParameters = {\n fromScale: number,\n toScale: number,\n t: number\n};\n\nclass EvaluationParameters {\n zoom: number;\n now: number;\n fadeDuration: number;\n zoomHistory: ZoomHistory;\n transition: TransitionSpecification;\n\n // \"options\" may also be another EvaluationParameters to copy, see CrossFadedProperty.possiblyEvaluate\n constructor(zoom: number, options?: *) {\n this.zoom = zoom;\n\n if (options) {\n this.now = options.now;\n this.fadeDuration = options.fadeDuration;\n this.zoomHistory = options.zoomHistory;\n this.transition = options.transition;\n } else {\n this.now = 0;\n this.fadeDuration = 0;\n this.zoomHistory = new ZoomHistory();\n this.transition = {};\n }\n }\n\n isSupportedScript(str: string): boolean {\n return isStringInSupportedScript(str, rtlTextPlugin.isLoaded());\n }\n\n crossFadingFactor() {\n if (this.fadeDuration === 0) {\n return 1;\n } else {\n return Math.min((this.now - this.zoomHistory.lastIntegerZoomTime) / this.fadeDuration, 1);\n }\n }\n\n getCrossfadeParameters(): CrossfadeParameters {\n const z = this.zoom;\n const fraction = z - Math.floor(z);\n const t = this.crossFadingFactor();\n\n return z > this.zoomHistory.lastIntegerZoom ?\n {fromScale: 2, toScale: 1, t: fraction + (1 - fraction) * t} :\n {fromScale: 0.5, toScale: 1, t: 1 - (1 - t) * fraction};\n }\n}\n\nexport default EvaluationParameters;\n","// @flow\n\nimport assert from 'assert';\nimport {clone, extend, easeCubicInOut} from '../util/util';\nimport * as interpolate from '../style-spec/util/interpolate';\nimport {normalizePropertyExpression} from '../style-spec/expression';\nimport Color from '../style-spec/util/color';\nimport {register} from '../util/web_worker_transfer';\nimport EvaluationParameters from './evaluation_parameters';\n\nimport type {CanonicalTileID} from '../source/tile_id';\nimport type {StylePropertySpecification} from '../style-spec/style-spec';\nimport type {\n TransitionSpecification,\n PropertyValueSpecification\n} from '../style-spec/types';\n\nimport type {\n Feature,\n FeatureState,\n StylePropertyExpression,\n SourceExpression,\n CompositeExpression\n} from '../style-spec/expression';\n\ntype TimePoint = number;\n\nexport type CrossFaded = {\n to: T,\n from: T\n};\n\n/**\n * Implements a number of classes that define state and behavior for paint and layout properties, most\n * importantly their respective evaluation chains:\n *\n * Transitionable paint property value\n * → Transitioning paint property value\n * → Possibly evaluated paint property value\n * → Fully evaluated paint property value\n *\n * Layout property value\n * → Possibly evaluated layout property value\n * → Fully evaluated layout property value\n *\n * @module\n * @private\n */\n\n/**\n * Implementations of the `Property` interface:\n *\n * * Hold metadata about a property that's independent of any specific value: stuff like the type of the value,\n * the default value, etc. This comes from the style specification JSON.\n * * Define behavior that needs to be polymorphic across different properties: \"possibly evaluating\"\n * an input value (see below), and interpolating between two possibly-evaluted values.\n *\n * The type `T` is the fully-evaluated value type (e.g. `number`, `string`, `Color`).\n * The type `R` is the intermediate \"possibly evaluated\" value type. See below.\n *\n * There are two main implementations of the interface -- one for properties that allow data-driven values,\n * and one for properties that don't. There are a few \"special case\" implementations as well: one for properties\n * which cross-fade between two values rather than interpolating, one for `heatmap-color` and `line-gradient`,\n * and one for `light-position`.\n *\n * @private\n */\nexport interface Property {\n specification: StylePropertySpecification;\n possiblyEvaluate(value: PropertyValue, parameters: EvaluationParameters, canonical?: CanonicalTileID, availableImages?: Array): R;\n interpolate(a: R, b: R, t: number): R;\n}\n\n/**\n * `PropertyValue` represents the value part of a property key-value unit. It's used to represent both\n * paint and layout property values, and regardless of whether or not their property supports data-driven\n * expressions.\n *\n * `PropertyValue` stores the raw input value as seen in a style or a runtime styling API call, i.e. one of the\n * following:\n *\n * * A constant value of the type appropriate for the property\n * * A function which produces a value of that type (but functions are quasi-deprecated in favor of expressions)\n * * An expression which produces a value of that type\n * * \"undefined\"/\"not present\", in which case the property is assumed to take on its default value.\n *\n * In addition to storing the original input value, `PropertyValue` also stores a normalized representation,\n * effectively treating functions as if they are expressions, and constant or default values as if they are\n * (constant) expressions.\n *\n * @private\n */\nexport class PropertyValue {\n property: Property;\n value: PropertyValueSpecification | void;\n expression: StylePropertyExpression;\n\n constructor(property: Property, value: PropertyValueSpecification | void) {\n this.property = property;\n this.value = value;\n this.expression = normalizePropertyExpression(value === undefined ? property.specification.default : value, property.specification);\n }\n\n isDataDriven(): boolean {\n return this.expression.kind === 'source' || this.expression.kind === 'composite';\n }\n\n possiblyEvaluate(parameters: EvaluationParameters, canonical?: CanonicalTileID, availableImages?: Array): R {\n return this.property.possiblyEvaluate(this, parameters, canonical, availableImages);\n }\n}\n\n// ------- Transitionable -------\n\nexport type TransitionParameters = {\n now: TimePoint,\n transition: TransitionSpecification\n};\n\n/**\n * Paint properties are _transitionable_: they can change in a fluid manner, interpolating or cross-fading between\n * old and new value. The duration of the transition, and the delay before it begins, is configurable.\n *\n * `TransitionablePropertyValue` is a compositional class that stores both the property value and that transition\n * configuration.\n *\n * A `TransitionablePropertyValue` can calculate the next step in the evaluation chain for paint property values:\n * `TransitioningPropertyValue`.\n *\n * @private\n */\nclass TransitionablePropertyValue {\n property: Property;\n value: PropertyValue;\n transition: TransitionSpecification | void;\n\n constructor(property: Property) {\n this.property = property;\n this.value = new PropertyValue(property, undefined);\n }\n\n transitioned(parameters: TransitionParameters,\n prior: TransitioningPropertyValue): TransitioningPropertyValue {\n return new TransitioningPropertyValue(this.property, this.value, prior, // eslint-disable-line no-use-before-define\n extend({}, parameters.transition, this.transition), parameters.now);\n }\n\n untransitioned(): TransitioningPropertyValue {\n return new TransitioningPropertyValue(this.property, this.value, null, {}, 0); // eslint-disable-line no-use-before-define\n }\n}\n\n/**\n * A helper type: given an object type `Properties` whose values are each of type `Property`, it calculates\n * an object type with the same keys and values of type `TransitionablePropertyValue`.\n *\n * @private\n */\ntype TransitionablePropertyValues\n = $Exact<$ObjMap(p: Property) => TransitionablePropertyValue>>\n\n/**\n * `Transitionable` stores a map of all (property name, `TransitionablePropertyValue`) pairs for paint properties of a\n * given layer type. It can calculate the `TransitioningPropertyValue`s for all of them at once, producing a\n * `Transitioning` instance for the same set of properties.\n *\n * @private\n */\nexport class Transitionable {\n _properties: Properties;\n _values: TransitionablePropertyValues;\n\n constructor(properties: Properties) {\n this._properties = properties;\n this._values = (Object.create(properties.defaultTransitionablePropertyValues): any);\n }\n\n getValue(name: S): PropertyValueSpecification | void {\n return clone(this._values[name].value.value);\n }\n\n setValue(name: S, value: PropertyValueSpecification | void) {\n if (!this._values.hasOwnProperty(name)) {\n this._values[name] = new TransitionablePropertyValue(this._values[name].property);\n }\n // Note that we do not _remove_ an own property in the case where a value is being reset\n // to the default: the transition might still be non-default.\n this._values[name].value = new PropertyValue(this._values[name].property, value === null ? undefined : clone(value));\n }\n\n getTransition(name: S): TransitionSpecification | void {\n return clone(this._values[name].transition);\n }\n\n setTransition(name: S, value: TransitionSpecification | void) {\n if (!this._values.hasOwnProperty(name)) {\n this._values[name] = new TransitionablePropertyValue(this._values[name].property);\n }\n this._values[name].transition = clone(value) || undefined;\n }\n\n serialize() {\n const result: any = {};\n for (const property of Object.keys(this._values)) {\n const value = this.getValue(property);\n if (value !== undefined) {\n result[property] = value;\n }\n\n const transition = this.getTransition(property);\n if (transition !== undefined) {\n result[`${property}-transition`] = transition;\n }\n }\n return result;\n }\n\n transitioned(parameters: TransitionParameters, prior: Transitioning): Transitioning {\n const result = new Transitioning(this._properties); // eslint-disable-line no-use-before-define\n for (const property of Object.keys(this._values)) {\n result._values[property] = this._values[property].transitioned(parameters, prior._values[property]);\n }\n return result;\n }\n\n untransitioned(): Transitioning {\n const result = new Transitioning(this._properties); // eslint-disable-line no-use-before-define\n for (const property of Object.keys(this._values)) {\n result._values[property] = this._values[property].untransitioned();\n }\n return result;\n }\n}\n\n// ------- Transitioning -------\n\n/**\n * `TransitioningPropertyValue` implements the first of two intermediate steps in the evaluation chain of a paint\n * property value. In this step, transitions between old and new values are handled: as long as the transition is in\n * progress, `TransitioningPropertyValue` maintains a reference to the prior value, and interpolates between it and\n * the new value based on the current time and the configured transition duration and delay. The product is the next\n * step in the evaluation chain: the \"possibly evaluated\" result type `R`. See below for more on this concept.\n *\n * @private\n */\nclass TransitioningPropertyValue {\n property: Property;\n value: PropertyValue;\n prior: ?TransitioningPropertyValue;\n begin: TimePoint;\n end: TimePoint;\n\n constructor(property: Property,\n value: PropertyValue,\n prior: ?TransitioningPropertyValue,\n transition: TransitionSpecification,\n now: TimePoint) {\n this.property = property;\n this.value = value;\n this.begin = now + transition.delay || 0;\n this.end = this.begin + transition.duration || 0;\n if (property.specification.transition && (transition.delay || transition.duration)) {\n this.prior = prior;\n }\n }\n\n possiblyEvaluate(parameters: EvaluationParameters, canonical: CanonicalTileID, availableImages: Array): R {\n const now = parameters.now || 0;\n const finalValue = this.value.possiblyEvaluate(parameters, canonical, availableImages);\n const prior = this.prior;\n if (!prior) {\n // No prior value.\n return finalValue;\n } else if (now > this.end) {\n // Transition from prior value is now complete.\n this.prior = null;\n return finalValue;\n } else if (this.value.isDataDriven()) {\n // Transitions to data-driven properties are not supported.\n // We snap immediately to the data-driven value so that, when we perform layout,\n // we see the data-driven function and can use it to populate vertex buffers.\n this.prior = null;\n return finalValue;\n } else if (now < this.begin) {\n // Transition hasn't started yet.\n return prior.possiblyEvaluate(parameters, canonical, availableImages);\n } else {\n // Interpolate between recursively-calculated prior value and final.\n const t = (now - this.begin) / (this.end - this.begin);\n return this.property.interpolate(prior.possiblyEvaluate(parameters, canonical, availableImages), finalValue, easeCubicInOut(t));\n }\n }\n}\n\n/**\n * A helper type: given an object type `Properties` whose values are each of type `Property`, it calculates\n * an object type with the same keys and values of type `TransitioningPropertyValue`.\n *\n * @private\n */\ntype TransitioningPropertyValues\n = $Exact<$ObjMap(p: Property) => TransitioningPropertyValue>>\n\n/**\n * `Transitioning` stores a map of all (property name, `TransitioningPropertyValue`) pairs for paint properties of a\n * given layer type. It can calculate the possibly-evaluated values for all of them at once, producing a\n * `PossiblyEvaluated` instance for the same set of properties.\n *\n * @private\n */\nexport class Transitioning {\n _properties: Properties;\n _values: TransitioningPropertyValues;\n\n constructor(properties: Properties) {\n this._properties = properties;\n this._values = (Object.create(properties.defaultTransitioningPropertyValues): any);\n }\n\n possiblyEvaluate(parameters: EvaluationParameters, canonical?: CanonicalTileID, availableImages?: Array): PossiblyEvaluated {\n const result = new PossiblyEvaluated(this._properties); // eslint-disable-line no-use-before-define\n for (const property of Object.keys(this._values)) {\n result._values[property] = this._values[property].possiblyEvaluate(parameters, canonical, availableImages);\n }\n return result;\n }\n\n hasTransition() {\n for (const property of Object.keys(this._values)) {\n if (this._values[property].prior) {\n return true;\n }\n }\n return false;\n }\n}\n\n// ------- Layout -------\n\n/**\n * A helper type: given an object type `Properties` whose values are each of type `Property`, it calculates\n * an object type with the same keys and values of type `PropertyValue`.\n *\n * @private\n */\ntype PropertyValues\n = $Exact<$ObjMap(p: Property) => PropertyValue>>\n\n/**\n * Because layout properties are not transitionable, they have a simpler representation and evaluation chain than\n * paint properties: `PropertyValue`s are possibly evaluated, producing possibly evaluated values, which are then\n * fully evaluated.\n *\n * `Layout` stores a map of all (property name, `PropertyValue`) pairs for layout properties of a\n * given layer type. It can calculate the possibly-evaluated values for all of them at once, producing a\n * `PossiblyEvaluated` instance for the same set of properties.\n *\n * @private\n */\nexport class Layout {\n _properties: Properties;\n _values: PropertyValues;\n\n constructor(properties: Properties) {\n this._properties = properties;\n this._values = (Object.create(properties.defaultPropertyValues): any);\n }\n\n getValue(name: S) {\n return clone(this._values[name].value);\n }\n\n setValue(name: S, value: *) {\n this._values[name] = new PropertyValue(this._values[name].property, value === null ? undefined : clone(value));\n }\n\n serialize() {\n const result: any = {};\n for (const property of Object.keys(this._values)) {\n const value = this.getValue(property);\n if (value !== undefined) {\n result[property] = value;\n }\n }\n return result;\n }\n\n possiblyEvaluate(parameters: EvaluationParameters, canonical?: CanonicalTileID, availableImages?: Array): PossiblyEvaluated {\n const result = new PossiblyEvaluated(this._properties); // eslint-disable-line no-use-before-define\n for (const property of Object.keys(this._values)) {\n result._values[property] = this._values[property].possiblyEvaluate(parameters, canonical, availableImages);\n }\n return result;\n }\n}\n\n// ------- PossiblyEvaluated -------\n\n/**\n * \"Possibly evaluated value\" is an intermediate stage in the evaluation chain for both paint and layout property\n * values. The purpose of this stage is to optimize away unnecessary recalculations for data-driven properties. Code\n * which uses data-driven property values must assume that the value is dependent on feature data, and request that it\n * be evaluated for each feature. But when that property value is in fact a constant or camera function, the calculation\n * will not actually depend on the feature, and we can benefit from returning the prior result of having done the\n * evaluation once, ahead of time, in an intermediate step whose inputs are just the value and \"global\" parameters\n * such as current zoom level.\n *\n * `PossiblyEvaluatedValue` represents the three possible outcomes of this step: if the input value was a constant or\n * camera expression, then the \"possibly evaluated\" result is a constant value. Otherwise, the input value was either\n * a source or composite expression, and we must defer final evaluation until supplied a feature. We separate\n * the source and composite cases because they are handled differently when generating GL attributes, buffers, and\n * uniforms.\n *\n * Note that `PossiblyEvaluatedValue` (and `PossiblyEvaluatedPropertyValue`, below) are _not_ used for properties that\n * do not allow data-driven values. For such properties, we know that the \"possibly evaluated\" result is always a constant\n * scalar value. See below.\n *\n * @private\n */\ntype PossiblyEvaluatedValue =\n | {kind: 'constant', value: T}\n | SourceExpression\n | CompositeExpression;\n\n/**\n * `PossiblyEvaluatedPropertyValue` is used for data-driven paint and layout property values. It holds a\n * `PossiblyEvaluatedValue` and the `GlobalProperties` that were used to generate it. You're not allowed to supply\n * a different set of `GlobalProperties` when performing the final evaluation because they would be ignored in the\n * case where the input value was a constant or camera function.\n *\n * @private\n */\nexport class PossiblyEvaluatedPropertyValue {\n property: DataDrivenProperty;\n value: PossiblyEvaluatedValue;\n parameters: EvaluationParameters;\n\n constructor(property: DataDrivenProperty, value: PossiblyEvaluatedValue, parameters: EvaluationParameters) {\n this.property = property;\n this.value = value;\n this.parameters = parameters;\n }\n\n isConstant(): boolean {\n return this.value.kind === 'constant';\n }\n\n constantOr(value: T): T {\n if (this.value.kind === 'constant') {\n return this.value.value;\n } else {\n return value;\n }\n }\n\n evaluate(feature: Feature, featureState: FeatureState, canonical?: CanonicalTileID, availableImages?: Array): T {\n return this.property.evaluate(this.value, this.parameters, feature, featureState, canonical, availableImages);\n }\n}\n\n/**\n * A helper type: given an object type `Properties` whose values are each of type `Property`, it calculates\n * an object type with the same keys, and values of type `R`.\n *\n * For properties that don't allow data-driven values, `R` is a scalar type such as `number`, `string`, or `Color`.\n * For data-driven properties, it is `PossiblyEvaluatedPropertyValue`. Critically, the type definitions are set up\n * in a way that allows flow to know which of these two cases applies for any given property name, and if you attempt\n * to use a `PossiblyEvaluatedPropertyValue` as if it was a scalar, or vice versa, you will get a type error. (However,\n * there's at least one case in which flow fails to produce a type error that you should be aware of: in a context such\n * as `layer.paint.get('foo-opacity') === 0`, if `foo-opacity` is data-driven, than the left-hand side is of type\n * `PossiblyEvaluatedPropertyValue`, but flow will not complain about comparing this to a number using `===`.\n * See https://github.com/facebook/flow/issues/2359.)\n *\n * There's also a third, special case possiblity for `R`: for cross-faded properties, it's `?CrossFaded`.\n *\n * @private\n */\ntype PossiblyEvaluatedPropertyValues\n = $Exact<$ObjMap(p: Property) => R>>\n\n/**\n * `PossiblyEvaluated` stores a map of all (property name, `R`) pairs for paint or layout properties of a\n * given layer type.\n * @private\n */\nexport class PossiblyEvaluated {\n _properties: Properties;\n _values: PossiblyEvaluatedPropertyValues;\n\n constructor(properties: Properties) {\n this._properties = properties;\n this._values = (Object.create(properties.defaultPossiblyEvaluatedValues): any);\n }\n\n get(name: S): $ElementType, S> {\n return this._values[name];\n }\n}\n\n/**\n * An implementation of `Property` for properties that do not permit data-driven (source or composite) expressions.\n * This restriction allows us to declare statically that the result of possibly evaluating this kind of property\n * is in fact always the scalar type `T`, and can be used without further evaluating the value on a per-feature basis.\n *\n * @private\n */\nexport class DataConstantProperty implements Property {\n specification: StylePropertySpecification;\n\n constructor(specification: StylePropertySpecification) {\n this.specification = specification;\n }\n\n possiblyEvaluate(value: PropertyValue, parameters: EvaluationParameters): T {\n assert(!value.isDataDriven());\n return value.expression.evaluate(parameters);\n }\n\n interpolate(a: T, b: T, t: number): T {\n const interp: ?(a: T, b: T, t: number) => T = (interpolate: any)[this.specification.type];\n if (interp) {\n return interp(a, b, t);\n } else {\n return a;\n }\n }\n}\n\n/**\n * An implementation of `Property` for properties that permit data-driven (source or composite) expressions.\n * The result of possibly evaluating this kind of property is `PossiblyEvaluatedPropertyValue`; obtaining\n * a scalar value `T` requires further evaluation on a per-feature basis.\n *\n * @private\n */\nexport class DataDrivenProperty implements Property> {\n specification: StylePropertySpecification;\n overrides: ?Object;\n\n constructor(specification: StylePropertySpecification, overrides?: Object) {\n this.specification = specification;\n this.overrides = overrides;\n }\n\n possiblyEvaluate(value: PropertyValue>, parameters: EvaluationParameters, canonical?: CanonicalTileID, availableImages?: Array): PossiblyEvaluatedPropertyValue {\n if (value.expression.kind === 'constant' || value.expression.kind === 'camera') {\n return new PossiblyEvaluatedPropertyValue(this, {kind: 'constant', value: value.expression.evaluate(parameters, (null: any), {}, canonical, availableImages)}, parameters);\n } else {\n return new PossiblyEvaluatedPropertyValue(this, value.expression, parameters);\n }\n }\n\n interpolate(a: PossiblyEvaluatedPropertyValue,\n b: PossiblyEvaluatedPropertyValue,\n t: number): PossiblyEvaluatedPropertyValue {\n // If either possibly-evaluated value is non-constant, give up: we aren't able to interpolate data-driven values.\n if (a.value.kind !== 'constant' || b.value.kind !== 'constant') {\n return a;\n }\n\n // Special case hack solely for fill-outline-color. The undefined value is subsequently handled in\n // FillStyleLayer#recalculate, which sets fill-outline-color to the fill-color value if the former\n // is a PossiblyEvaluatedPropertyValue containing a constant undefined value. In addition to the\n // return value here, the other source of a PossiblyEvaluatedPropertyValue containing a constant\n // undefined value is the \"default value\" for fill-outline-color held in\n // `Properties#defaultPossiblyEvaluatedValues`, which serves as the prototype of\n // `PossiblyEvaluated#_values`.\n if (a.value.value === undefined || b.value.value === undefined) {\n return new PossiblyEvaluatedPropertyValue(this, {kind: 'constant', value: (undefined: any)}, a.parameters);\n }\n\n const interp: ?(a: T, b: T, t: number) => T = (interpolate: any)[this.specification.type];\n if (interp) {\n return new PossiblyEvaluatedPropertyValue(this, {kind: 'constant', value: interp(a.value.value, b.value.value, t)}, a.parameters);\n } else {\n return a;\n }\n }\n\n evaluate(value: PossiblyEvaluatedValue, parameters: EvaluationParameters, feature: Feature, featureState: FeatureState, canonical?: CanonicalTileID, availableImages?: Array): T {\n if (value.kind === 'constant') {\n return value.value;\n } else {\n return value.evaluate(parameters, feature, featureState, canonical, availableImages);\n }\n }\n}\n\n/**\n * An implementation of `Property` for data driven `line-pattern` which are transitioned by cross-fading\n * rather than interpolation.\n *\n * @private\n */\n\nexport class CrossFadedDataDrivenProperty extends DataDrivenProperty> {\n\n possiblyEvaluate(value: PropertyValue, PossiblyEvaluatedPropertyValue>>, parameters: EvaluationParameters, canonical?: CanonicalTileID, availableImages?: Array): PossiblyEvaluatedPropertyValue> {\n if (value.value === undefined) {\n return new PossiblyEvaluatedPropertyValue(this, {kind: 'constant', value: undefined}, parameters);\n } else if (value.expression.kind === 'constant') {\n const evaluatedValue = value.expression.evaluate(parameters, (null: any), {}, canonical, availableImages);\n const isImageExpression = value.property.specification.type === 'resolvedImage';\n const constantValue = isImageExpression && typeof evaluatedValue !== 'string' ? evaluatedValue.name : evaluatedValue;\n const constant = this._calculate(constantValue, constantValue, constantValue, parameters);\n return new PossiblyEvaluatedPropertyValue(this, {kind: 'constant', value: constant}, parameters);\n } else if (value.expression.kind === 'camera') {\n const cameraVal = this._calculate(\n value.expression.evaluate({zoom: parameters.zoom - 1.0}),\n value.expression.evaluate({zoom: parameters.zoom}),\n value.expression.evaluate({zoom: parameters.zoom + 1.0}),\n parameters);\n return new PossiblyEvaluatedPropertyValue(this, {kind: 'constant', value: cameraVal}, parameters);\n } else {\n // source or composite expression\n return new PossiblyEvaluatedPropertyValue(this, value.expression, parameters);\n }\n }\n\n evaluate(value: PossiblyEvaluatedValue>, globals: EvaluationParameters, feature: Feature, featureState: FeatureState, canonical?: CanonicalTileID, availableImages?: Array): ?CrossFaded {\n if (value.kind === 'source') {\n const constant = value.evaluate(globals, feature, featureState, canonical, availableImages);\n return this._calculate(constant, constant, constant, globals);\n } else if (value.kind === 'composite') {\n return this._calculate(\n value.evaluate({zoom: Math.floor(globals.zoom) - 1.0}, feature, featureState),\n value.evaluate({zoom: Math.floor(globals.zoom)}, feature, featureState),\n value.evaluate({zoom: Math.floor(globals.zoom) + 1.0}, feature, featureState),\n globals);\n } else {\n return value.value;\n }\n }\n\n _calculate(min: T, mid: T, max: T, parameters: EvaluationParameters): CrossFaded {\n const z = parameters.zoom;\n return z > parameters.zoomHistory.lastIntegerZoom ? {from: min, to: mid} : {from: max, to: mid};\n }\n\n interpolate(a: PossiblyEvaluatedPropertyValue>): PossiblyEvaluatedPropertyValue> {\n return a;\n }\n}\n/**\n * An implementation of `Property` for `*-pattern` and `line-dasharray`, which are transitioned by cross-fading\n * rather than interpolation.\n *\n * @private\n */\nexport class CrossFadedProperty implements Property> {\n specification: StylePropertySpecification;\n\n constructor(specification: StylePropertySpecification) {\n this.specification = specification;\n }\n\n possiblyEvaluate(value: PropertyValue>, parameters: EvaluationParameters, canonical?: CanonicalTileID, availableImages?: Array): ?CrossFaded {\n if (value.value === undefined) {\n return undefined;\n } else if (value.expression.kind === 'constant') {\n const constant = value.expression.evaluate(parameters, (null: any), {}, canonical, availableImages);\n return this._calculate(constant, constant, constant, parameters);\n } else {\n assert(!value.isDataDriven());\n return this._calculate(\n value.expression.evaluate(new EvaluationParameters(Math.floor(parameters.zoom - 1.0), parameters)),\n value.expression.evaluate(new EvaluationParameters(Math.floor(parameters.zoom), parameters)),\n value.expression.evaluate(new EvaluationParameters(Math.floor(parameters.zoom + 1.0), parameters)),\n parameters);\n }\n }\n\n _calculate(min: T, mid: T, max: T, parameters: EvaluationParameters): ?CrossFaded {\n const z = parameters.zoom;\n return z > parameters.zoomHistory.lastIntegerZoom ? {from: min, to: mid} : {from: max, to: mid};\n }\n\n interpolate(a: ?CrossFaded): ?CrossFaded {\n return a;\n }\n}\n\n/**\n * An implementation of `Property` for `heatmap-color` and `line-gradient`. Interpolation is a no-op, and\n * evaluation returns a boolean value in order to indicate its presence, but the real\n * evaluation happens in StyleLayer classes.\n *\n * @private\n */\n\nexport class ColorRampProperty implements Property {\n specification: StylePropertySpecification;\n\n constructor(specification: StylePropertySpecification) {\n this.specification = specification;\n }\n\n possiblyEvaluate(value: PropertyValue, parameters: EvaluationParameters, canonical?: CanonicalTileID, availableImages?: Array): boolean {\n return !!value.expression.evaluate(parameters, (null: any), {}, canonical, availableImages);\n }\n\n interpolate(): boolean { return false; }\n}\n\n/**\n * `Properties` holds objects containing default values for the layout or paint property set of a given\n * layer type. These objects are immutable, and they are used as the prototypes for the `_values` members of\n * `Transitionable`, `Transitioning`, `Layout`, and `PossiblyEvaluated`. This allows these classes to avoid\n * doing work in the common case where a property has no explicit value set and should be considered to take\n * on the default value: using `for (const property of Object.keys(this._values))`, they can iterate over\n * only the _own_ properties of `_values`, skipping repeated calculation of transitions and possible/final\n * evaluations for defaults, the result of which will always be the same.\n *\n * @private\n */\nexport class Properties {\n properties: Props;\n defaultPropertyValues: PropertyValues;\n defaultTransitionablePropertyValues: TransitionablePropertyValues;\n defaultTransitioningPropertyValues: TransitioningPropertyValues;\n defaultPossiblyEvaluatedValues: PossiblyEvaluatedPropertyValues;\n overridableProperties: Array;\n\n constructor(properties: Props) {\n this.properties = properties;\n this.defaultPropertyValues = ({}: any);\n this.defaultTransitionablePropertyValues = ({}: any);\n this.defaultTransitioningPropertyValues = ({}: any);\n this.defaultPossiblyEvaluatedValues = ({}: any);\n this.overridableProperties = ([]: any);\n\n for (const property in properties) {\n const prop = properties[property];\n if (prop.specification.overridable) {\n this.overridableProperties.push(property);\n }\n const defaultPropertyValue = this.defaultPropertyValues[property] =\n new PropertyValue(prop, undefined);\n const defaultTransitionablePropertyValue = this.defaultTransitionablePropertyValues[property] =\n new TransitionablePropertyValue(prop);\n this.defaultTransitioningPropertyValues[property] =\n defaultTransitionablePropertyValue.untransitioned();\n this.defaultPossiblyEvaluatedValues[property] =\n defaultPropertyValue.possiblyEvaluate(({}: any));\n }\n }\n}\n\nregister('DataDrivenProperty', DataDrivenProperty);\nregister('DataConstantProperty', DataConstantProperty);\nregister('CrossFadedDataDrivenProperty', CrossFadedDataDrivenProperty);\nregister('CrossFadedProperty', CrossFadedProperty);\nregister('ColorRampProperty', ColorRampProperty);\n","// @flow\n\nimport {endsWith, filterObject} from '../util/util';\n\nimport styleSpec from '../style-spec/reference/latest';\nimport {\n validateStyle,\n validateLayoutProperty,\n validatePaintProperty,\n emitValidationErrors\n} from './validate_style';\nimport {Evented} from '../util/evented';\nimport {Layout, Transitionable, Transitioning, Properties, PossiblyEvaluated, PossiblyEvaluatedPropertyValue} from './properties';\nimport {supportsPropertyExpression} from '../style-spec/util/properties';\n\nimport type {FeatureState} from '../style-spec/expression';\nimport type {Bucket} from '../data/bucket';\nimport type Point from '@mapbox/point-geometry';\nimport type {FeatureFilter} from '../style-spec/feature_filter';\nimport type {TransitionParameters, PropertyValue} from './properties';\nimport type EvaluationParameters, {CrossfadeParameters} from './evaluation_parameters';\nimport type Transform from '../geo/transform';\nimport type {\n LayerSpecification,\n FilterSpecification\n} from '../style-spec/types';\nimport type {CustomLayerInterface} from './style_layer/custom_style_layer';\nimport type Map from '../ui/map';\nimport type {StyleSetterOptions} from './style';\n\nconst TRANSITION_SUFFIX = '-transition';\n\nclass StyleLayer extends Evented {\n id: string;\n metadata: mixed;\n type: string;\n source: string;\n sourceLayer: ?string;\n minzoom: ?number;\n maxzoom: ?number;\n filter: FilterSpecification | void;\n visibility: 'visible' | 'none' | void;\n _crossfadeParameters: CrossfadeParameters;\n\n _unevaluatedLayout: Layout;\n +layout: mixed;\n\n _transitionablePaint: Transitionable;\n _transitioningPaint: Transitioning;\n +paint: mixed;\n\n _featureFilter: FeatureFilter;\n\n +queryRadius: (bucket: Bucket) => number;\n +queryIntersectsFeature: (queryGeometry: Array,\n feature: VectorTileFeature,\n featureState: FeatureState,\n geometry: Array>,\n zoom: number,\n transform: Transform,\n pixelsToTileUnits: number,\n pixelPosMatrix: Float32Array) => boolean | number;\n\n +onAdd: ?(map: Map) => void;\n +onRemove: ?(map: Map) => void;\n\n constructor(layer: LayerSpecification | CustomLayerInterface, properties: $ReadOnly<{layout?: Properties<*>, paint?: Properties<*>}>) {\n super();\n\n this.id = layer.id;\n this.type = layer.type;\n this._featureFilter = {filter: () => true, needGeometry: false};\n\n if (layer.type === 'custom') return;\n\n layer = ((layer: any): LayerSpecification);\n\n this.metadata = layer.metadata;\n this.minzoom = layer.minzoom;\n this.maxzoom = layer.maxzoom;\n\n if (layer.type !== 'background') {\n this.source = layer.source;\n this.sourceLayer = layer['source-layer'];\n this.filter = layer.filter;\n }\n\n if (properties.layout) {\n this._unevaluatedLayout = new Layout(properties.layout);\n }\n\n if (properties.paint) {\n this._transitionablePaint = new Transitionable(properties.paint);\n\n for (const property in layer.paint) {\n this.setPaintProperty(property, layer.paint[property], {validate: false});\n }\n for (const property in layer.layout) {\n this.setLayoutProperty(property, layer.layout[property], {validate: false});\n }\n\n this._transitioningPaint = this._transitionablePaint.untransitioned();\n //$FlowFixMe\n this.paint = new PossiblyEvaluated(properties.paint);\n }\n }\n\n getCrossfadeParameters() {\n return this._crossfadeParameters;\n }\n\n getLayoutProperty(name: string) {\n if (name === 'visibility') {\n return this.visibility;\n }\n\n return this._unevaluatedLayout.getValue(name);\n }\n\n setLayoutProperty(name: string, value: any, options: StyleSetterOptions = {}) {\n if (value !== null && value !== undefined) {\n const key = `layers.${this.id}.layout.${name}`;\n if (this._validate(validateLayoutProperty, key, name, value, options)) {\n return;\n }\n }\n\n if (name === 'visibility') {\n this.visibility = value;\n return;\n }\n\n this._unevaluatedLayout.setValue(name, value);\n }\n\n getPaintProperty(name: string) {\n if (endsWith(name, TRANSITION_SUFFIX)) {\n return this._transitionablePaint.getTransition(name.slice(0, -TRANSITION_SUFFIX.length));\n } else {\n return this._transitionablePaint.getValue(name);\n }\n }\n\n setPaintProperty(name: string, value: mixed, options: StyleSetterOptions = {}) {\n if (value !== null && value !== undefined) {\n const key = `layers.${this.id}.paint.${name}`;\n if (this._validate(validatePaintProperty, key, name, value, options)) {\n return false;\n }\n }\n\n if (endsWith(name, TRANSITION_SUFFIX)) {\n this._transitionablePaint.setTransition(name.slice(0, -TRANSITION_SUFFIX.length), (value: any) || undefined);\n return false;\n } else {\n const transitionable = this._transitionablePaint._values[name];\n const isCrossFadedProperty = transitionable.property.specification[\"property-type\"] === 'cross-faded-data-driven';\n const wasDataDriven = transitionable.value.isDataDriven();\n const oldValue = transitionable.value;\n\n this._transitionablePaint.setValue(name, value);\n this._handleSpecialPaintPropertyUpdate(name);\n\n const newValue = this._transitionablePaint._values[name].value;\n const isDataDriven = newValue.isDataDriven();\n\n // if a cross-faded value is changed, we need to make sure the new icons get added to each tile's iconAtlas\n // so a call to _updateLayer is necessary, and we return true from this function so it gets called in\n // Style#setPaintProperty\n return isDataDriven || wasDataDriven || isCrossFadedProperty || this._handleOverridablePaintPropertyUpdate(name, oldValue, newValue);\n }\n }\n\n _handleSpecialPaintPropertyUpdate(_: string) {\n // No-op; can be overridden by derived classes.\n }\n\n // eslint-disable-next-line no-unused-vars\n _handleOverridablePaintPropertyUpdate(name: string, oldValue: PropertyValue, newValue: PropertyValue): boolean {\n // No-op; can be overridden by derived classes.\n return false;\n }\n\n isHidden(zoom: number) {\n if (this.minzoom && zoom < this.minzoom) return true;\n if (this.maxzoom && zoom >= this.maxzoom) return true;\n return this.visibility === 'none';\n }\n\n updateTransitions(parameters: TransitionParameters) {\n this._transitioningPaint = this._transitionablePaint.transitioned(parameters, this._transitioningPaint);\n }\n\n hasTransition() {\n return this._transitioningPaint.hasTransition();\n }\n\n recalculate(parameters: EvaluationParameters, availableImages: Array) {\n if (parameters.getCrossfadeParameters) {\n this._crossfadeParameters = parameters.getCrossfadeParameters();\n }\n\n if (this._unevaluatedLayout) {\n (this: any).layout = this._unevaluatedLayout.possiblyEvaluate(parameters, undefined, availableImages);\n }\n\n (this: any).paint = this._transitioningPaint.possiblyEvaluate(parameters, undefined, availableImages);\n }\n\n serialize() {\n const output: any = {\n 'id': this.id,\n 'type': this.type,\n 'source': this.source,\n 'source-layer': this.sourceLayer,\n 'metadata': this.metadata,\n 'minzoom': this.minzoom,\n 'maxzoom': this.maxzoom,\n 'filter': this.filter,\n 'layout': this._unevaluatedLayout && this._unevaluatedLayout.serialize(),\n 'paint': this._transitionablePaint && this._transitionablePaint.serialize()\n };\n\n if (this.visibility) {\n output.layout = output.layout || {};\n output.layout.visibility = this.visibility;\n }\n\n return filterObject(output, (value, key) => {\n return value !== undefined &&\n !(key === 'layout' && !Object.keys(value).length) &&\n !(key === 'paint' && !Object.keys(value).length);\n });\n }\n\n _validate(validate: Function, key: string, name: string, value: mixed, options: StyleSetterOptions = {}) {\n if (options && options.validate === false) {\n return false;\n }\n return emitValidationErrors(this, validate.call(validateStyle, {\n key,\n layerType: this.type,\n objectKey: name,\n value,\n styleSpec,\n // Workaround for https://github.com/mapbox/mapbox-gl-js/issues/2407\n style: {glyphs: true, sprite: true}\n }));\n }\n\n is3D() {\n return false;\n }\n\n isTileClipped() {\n return false;\n }\n\n hasOffscreenPass() {\n return false;\n }\n\n resize() {\n // noop\n }\n\n isStateDependent() {\n for (const property in (this: any).paint._values) {\n const value = (this: any).paint.get(property);\n if (!(value instanceof PossiblyEvaluatedPropertyValue) || !supportsPropertyExpression(value.property.specification)) {\n continue;\n }\n\n if ((value.value.kind === 'source' || value.value.kind === 'composite') &&\n value.value.isStateDependent) {\n return true;\n }\n }\n return false;\n }\n}\n\nexport default StyleLayer;\n","// @flow\n\n// Note: all \"sizes\" are measured in bytes\n\nimport assert from 'assert';\n\nimport type {Transferable} from '../types/transferable';\n\nconst viewTypes = {\n 'Int8': Int8Array,\n 'Uint8': Uint8Array,\n 'Int16': Int16Array,\n 'Uint16': Uint16Array,\n 'Int32': Int32Array,\n 'Uint32': Uint32Array,\n 'Float32': Float32Array\n};\n\nexport type ViewType = $Keys;\n\n/**\n * @private\n */\nclass Struct {\n _pos1: number;\n _pos2: number;\n _pos4: number;\n _pos8: number;\n +_structArray: StructArray;\n\n // The following properties are defined on the prototype of sub classes.\n size: number;\n\n /**\n * @param {StructArray} structArray The StructArray the struct is stored in\n * @param {number} index The index of the struct in the StructArray.\n * @private\n */\n constructor(structArray: StructArray, index: number) {\n (this: any)._structArray = structArray;\n this._pos1 = index * this.size;\n this._pos2 = this._pos1 / 2;\n this._pos4 = this._pos1 / 4;\n this._pos8 = this._pos1 / 8;\n }\n}\n\nconst DEFAULT_CAPACITY = 128;\nconst RESIZE_MULTIPLIER = 5;\n\nexport type StructArrayMember = {\n name: string,\n type: ViewType,\n components: number,\n offset: number\n};\n\nexport type StructArrayLayout = {\n members: Array,\n size: number,\n alignment: ?number\n}\n\nexport type SerializedStructArray = {\n length: number,\n arrayBuffer: ArrayBuffer\n};\n\n/**\n * `StructArray` provides an abstraction over `ArrayBuffer` and `TypedArray`\n * making it behave like an array of typed structs.\n *\n * Conceptually, a StructArray is comprised of elements, i.e., instances of its\n * associated struct type. Each particular struct type, together with an\n * alignment size, determines the memory layout of a StructArray whose elements\n * are of that type. Thus, for each such layout that we need, we have\n * a corrseponding StructArrayLayout class, inheriting from StructArray and\n * implementing `emplaceBack()` and `_refreshViews()`.\n *\n * In some cases, where we need to access particular elements of a StructArray,\n * we implement a more specific subclass that inherits from one of the\n * StructArrayLayouts and adds a `get(i): T` accessor that returns a structured\n * object whose properties are proxies into the underlying memory space for the\n * i-th element. This affords the convience of working with (seemingly) plain\n * Javascript objects without the overhead of serializing/deserializing them\n * into ArrayBuffers for efficient web worker transfer.\n *\n * @private\n */\nclass StructArray {\n capacity: number;\n length: number;\n isTransferred: boolean;\n arrayBuffer: ArrayBuffer;\n uint8: Uint8Array;\n\n // The following properties are defined on the prototype.\n members: Array;\n bytesPerElement: number;\n +emplaceBack: Function;\n +emplace: Function;\n\n constructor() {\n this.isTransferred = false;\n this.capacity = -1;\n this.resize(0);\n }\n\n /**\n * Serialize a StructArray instance. Serializes both the raw data and the\n * metadata needed to reconstruct the StructArray base class during\n * deserialization.\n * @private\n */\n static serialize(array: StructArray, transferables?: Array): SerializedStructArray {\n assert(!array.isTransferred);\n\n array._trim();\n\n if (transferables) {\n array.isTransferred = true;\n transferables.push(array.arrayBuffer);\n }\n\n return {\n length: array.length,\n arrayBuffer: array.arrayBuffer,\n };\n }\n\n static deserialize(input: SerializedStructArray) {\n const structArray = Object.create(this.prototype);\n structArray.arrayBuffer = input.arrayBuffer;\n structArray.length = input.length;\n structArray.capacity = input.arrayBuffer.byteLength / structArray.bytesPerElement;\n structArray._refreshViews();\n return structArray;\n }\n\n /**\n * Resize the array to discard unused capacity.\n */\n _trim() {\n if (this.length !== this.capacity) {\n this.capacity = this.length;\n this.arrayBuffer = this.arrayBuffer.slice(0, this.length * this.bytesPerElement);\n this._refreshViews();\n }\n }\n\n /**\n * Resets the the length of the array to 0 without de-allocating capcacity.\n */\n clear() {\n this.length = 0;\n }\n\n /**\n * Resize the array.\n * If `n` is greater than the current length then additional elements with undefined values are added.\n * If `n` is less than the current length then the array will be reduced to the first `n` elements.\n * @param {number} n The new size of the array.\n */\n resize(n: number) {\n assert(!this.isTransferred);\n this.reserve(n);\n this.length = n;\n }\n\n /**\n * Indicate a planned increase in size, so that any necessary allocation may\n * be done once, ahead of time.\n * @param {number} n The expected size of the array.\n */\n reserve(n: number) {\n if (n > this.capacity) {\n this.capacity = Math.max(n, Math.floor(this.capacity * RESIZE_MULTIPLIER), DEFAULT_CAPACITY);\n this.arrayBuffer = new ArrayBuffer(this.capacity * this.bytesPerElement);\n\n const oldUint8Array = this.uint8;\n this._refreshViews();\n if (oldUint8Array) this.uint8.set(oldUint8Array);\n }\n }\n\n /**\n * Create TypedArray views for the current ArrayBuffer.\n */\n _refreshViews() {\n throw new Error('_refreshViews() must be implemented by each concrete StructArray layout');\n }\n}\n\n/**\n * Given a list of member fields, create a full StructArrayLayout, in\n * particular calculating the correct byte offset for each field. This data\n * is used at build time to generate StructArrayLayout_*#emplaceBack() and\n * other accessors, and at runtime for binding vertex buffer attributes.\n *\n * @private\n */\nfunction createLayout(\n members: Array<{ name: string, type: ViewType, +components?: number, }>,\n alignment: number = 1\n): StructArrayLayout {\n\n let offset = 0;\n let maxSize = 0;\n const layoutMembers = members.map((member) => {\n assert(member.name.length);\n const typeSize = sizeOf(member.type);\n const memberOffset = offset = align(offset, Math.max(alignment, typeSize));\n const components = member.components || 1;\n\n maxSize = Math.max(maxSize, typeSize);\n offset += typeSize * components;\n\n return {\n name: member.name,\n type: member.type,\n components,\n offset: memberOffset,\n };\n });\n\n const size = align(offset, Math.max(maxSize, alignment));\n\n return {\n members: layoutMembers,\n size,\n alignment\n };\n}\n\nfunction sizeOf(type: ViewType): number {\n return viewTypes[type].BYTES_PER_ELEMENT;\n}\n\nfunction align(offset: number, size: number): number {\n return Math.ceil(offset / size) * size;\n}\n\nexport {StructArray, Struct, viewTypes, createLayout};\n","// This file is generated. Edit build/generate-struct-arrays.js, then run `yarn run codegen`.\n// @flow\n\nimport assert from 'assert';\nimport {Struct, StructArray} from '../util/struct_array';\nimport {register} from '../util/web_worker_transfer';\nimport Point from '@mapbox/point-geometry';\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Int16[2]\n *\n * @private\n */\nclass StructArrayLayout2i4 extends StructArray {\n uint8: Uint8Array;\n int16: Int16Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.int16 = new Int16Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number) {\n const i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1);\n }\n\n emplace(i: number, v0: number, v1: number) {\n const o2 = i * 2;\n this.int16[o2 + 0] = v0;\n this.int16[o2 + 1] = v1;\n return i;\n }\n}\n\nStructArrayLayout2i4.prototype.bytesPerElement = 4;\nregister('StructArrayLayout2i4', StructArrayLayout2i4);\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Int16[4]\n *\n * @private\n */\nclass StructArrayLayout4i8 extends StructArray {\n uint8: Uint8Array;\n int16: Int16Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.int16 = new Int16Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number, v2: number, v3: number) {\n const i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1, v2, v3);\n }\n\n emplace(i: number, v0: number, v1: number, v2: number, v3: number) {\n const o2 = i * 4;\n this.int16[o2 + 0] = v0;\n this.int16[o2 + 1] = v1;\n this.int16[o2 + 2] = v2;\n this.int16[o2 + 3] = v3;\n return i;\n }\n}\n\nStructArrayLayout4i8.prototype.bytesPerElement = 8;\nregister('StructArrayLayout4i8', StructArrayLayout4i8);\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Int16[2]\n * [4]: Int16[4]\n *\n * @private\n */\nclass StructArrayLayout2i4i12 extends StructArray {\n uint8: Uint8Array;\n int16: Int16Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.int16 = new Int16Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number, v2: number, v3: number, v4: number, v5: number) {\n const i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1, v2, v3, v4, v5);\n }\n\n emplace(i: number, v0: number, v1: number, v2: number, v3: number, v4: number, v5: number) {\n const o2 = i * 6;\n this.int16[o2 + 0] = v0;\n this.int16[o2 + 1] = v1;\n this.int16[o2 + 2] = v2;\n this.int16[o2 + 3] = v3;\n this.int16[o2 + 4] = v4;\n this.int16[o2 + 5] = v5;\n return i;\n }\n}\n\nStructArrayLayout2i4i12.prototype.bytesPerElement = 12;\nregister('StructArrayLayout2i4i12', StructArrayLayout2i4i12);\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Int16[2]\n * [4]: Uint8[4]\n *\n * @private\n */\nclass StructArrayLayout2i4ub8 extends StructArray {\n uint8: Uint8Array;\n int16: Int16Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.int16 = new Int16Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number, v2: number, v3: number, v4: number, v5: number) {\n const i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1, v2, v3, v4, v5);\n }\n\n emplace(i: number, v0: number, v1: number, v2: number, v3: number, v4: number, v5: number) {\n const o2 = i * 4;\n const o1 = i * 8;\n this.int16[o2 + 0] = v0;\n this.int16[o2 + 1] = v1;\n this.uint8[o1 + 4] = v2;\n this.uint8[o1 + 5] = v3;\n this.uint8[o1 + 6] = v4;\n this.uint8[o1 + 7] = v5;\n return i;\n }\n}\n\nStructArrayLayout2i4ub8.prototype.bytesPerElement = 8;\nregister('StructArrayLayout2i4ub8', StructArrayLayout2i4ub8);\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Float32[2]\n *\n * @private\n */\nclass StructArrayLayout2f8 extends StructArray {\n uint8: Uint8Array;\n float32: Float32Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.float32 = new Float32Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number) {\n const i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1);\n }\n\n emplace(i: number, v0: number, v1: number) {\n const o4 = i * 2;\n this.float32[o4 + 0] = v0;\n this.float32[o4 + 1] = v1;\n return i;\n }\n}\n\nStructArrayLayout2f8.prototype.bytesPerElement = 8;\nregister('StructArrayLayout2f8', StructArrayLayout2f8);\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Uint16[10]\n *\n * @private\n */\nclass StructArrayLayout10ui20 extends StructArray {\n uint8: Uint8Array;\n uint16: Uint16Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.uint16 = new Uint16Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, v9: number) {\n const i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);\n }\n\n emplace(i: number, v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, v9: number) {\n const o2 = i * 10;\n this.uint16[o2 + 0] = v0;\n this.uint16[o2 + 1] = v1;\n this.uint16[o2 + 2] = v2;\n this.uint16[o2 + 3] = v3;\n this.uint16[o2 + 4] = v4;\n this.uint16[o2 + 5] = v5;\n this.uint16[o2 + 6] = v6;\n this.uint16[o2 + 7] = v7;\n this.uint16[o2 + 8] = v8;\n this.uint16[o2 + 9] = v9;\n return i;\n }\n}\n\nStructArrayLayout10ui20.prototype.bytesPerElement = 20;\nregister('StructArrayLayout10ui20', StructArrayLayout10ui20);\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Int16[4]\n * [8]: Uint16[4]\n * [16]: Int16[4]\n *\n * @private\n */\nclass StructArrayLayout4i4ui4i24 extends StructArray {\n uint8: Uint8Array;\n int16: Int16Array;\n uint16: Uint16Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.int16 = new Int16Array(this.arrayBuffer);\n this.uint16 = new Uint16Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, v9: number, v10: number, v11: number) {\n const i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11);\n }\n\n emplace(i: number, v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, v9: number, v10: number, v11: number) {\n const o2 = i * 12;\n this.int16[o2 + 0] = v0;\n this.int16[o2 + 1] = v1;\n this.int16[o2 + 2] = v2;\n this.int16[o2 + 3] = v3;\n this.uint16[o2 + 4] = v4;\n this.uint16[o2 + 5] = v5;\n this.uint16[o2 + 6] = v6;\n this.uint16[o2 + 7] = v7;\n this.int16[o2 + 8] = v8;\n this.int16[o2 + 9] = v9;\n this.int16[o2 + 10] = v10;\n this.int16[o2 + 11] = v11;\n return i;\n }\n}\n\nStructArrayLayout4i4ui4i24.prototype.bytesPerElement = 24;\nregister('StructArrayLayout4i4ui4i24', StructArrayLayout4i4ui4i24);\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Float32[3]\n *\n * @private\n */\nclass StructArrayLayout3f12 extends StructArray {\n uint8: Uint8Array;\n float32: Float32Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.float32 = new Float32Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number, v2: number) {\n const i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1, v2);\n }\n\n emplace(i: number, v0: number, v1: number, v2: number) {\n const o4 = i * 3;\n this.float32[o4 + 0] = v0;\n this.float32[o4 + 1] = v1;\n this.float32[o4 + 2] = v2;\n return i;\n }\n}\n\nStructArrayLayout3f12.prototype.bytesPerElement = 12;\nregister('StructArrayLayout3f12', StructArrayLayout3f12);\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Uint32[1]\n *\n * @private\n */\nclass StructArrayLayout1ul4 extends StructArray {\n uint8: Uint8Array;\n uint32: Uint32Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.uint32 = new Uint32Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number) {\n const i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0);\n }\n\n emplace(i: number, v0: number) {\n const o4 = i * 1;\n this.uint32[o4 + 0] = v0;\n return i;\n }\n}\n\nStructArrayLayout1ul4.prototype.bytesPerElement = 4;\nregister('StructArrayLayout1ul4', StructArrayLayout1ul4);\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Int16[6]\n * [12]: Uint32[1]\n * [16]: Uint16[2]\n *\n * @private\n */\nclass StructArrayLayout6i1ul2ui20 extends StructArray {\n uint8: Uint8Array;\n int16: Int16Array;\n uint32: Uint32Array;\n uint16: Uint16Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.int16 = new Int16Array(this.arrayBuffer);\n this.uint32 = new Uint32Array(this.arrayBuffer);\n this.uint16 = new Uint16Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number) {\n const i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1, v2, v3, v4, v5, v6, v7, v8);\n }\n\n emplace(i: number, v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number) {\n const o2 = i * 10;\n const o4 = i * 5;\n this.int16[o2 + 0] = v0;\n this.int16[o2 + 1] = v1;\n this.int16[o2 + 2] = v2;\n this.int16[o2 + 3] = v3;\n this.int16[o2 + 4] = v4;\n this.int16[o2 + 5] = v5;\n this.uint32[o4 + 3] = v6;\n this.uint16[o2 + 8] = v7;\n this.uint16[o2 + 9] = v8;\n return i;\n }\n}\n\nStructArrayLayout6i1ul2ui20.prototype.bytesPerElement = 20;\nregister('StructArrayLayout6i1ul2ui20', StructArrayLayout6i1ul2ui20);\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Int16[2]\n * [4]: Int16[2]\n * [8]: Int16[2]\n *\n * @private\n */\nclass StructArrayLayout2i2i2i12 extends StructArray {\n uint8: Uint8Array;\n int16: Int16Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.int16 = new Int16Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number, v2: number, v3: number, v4: number, v5: number) {\n const i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1, v2, v3, v4, v5);\n }\n\n emplace(i: number, v0: number, v1: number, v2: number, v3: number, v4: number, v5: number) {\n const o2 = i * 6;\n this.int16[o2 + 0] = v0;\n this.int16[o2 + 1] = v1;\n this.int16[o2 + 2] = v2;\n this.int16[o2 + 3] = v3;\n this.int16[o2 + 4] = v4;\n this.int16[o2 + 5] = v5;\n return i;\n }\n}\n\nStructArrayLayout2i2i2i12.prototype.bytesPerElement = 12;\nregister('StructArrayLayout2i2i2i12', StructArrayLayout2i2i2i12);\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Float32[2]\n * [8]: Float32[1]\n * [12]: Int16[2]\n *\n * @private\n */\nclass StructArrayLayout2f1f2i16 extends StructArray {\n uint8: Uint8Array;\n float32: Float32Array;\n int16: Int16Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.float32 = new Float32Array(this.arrayBuffer);\n this.int16 = new Int16Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number, v2: number, v3: number, v4: number) {\n const i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1, v2, v3, v4);\n }\n\n emplace(i: number, v0: number, v1: number, v2: number, v3: number, v4: number) {\n const o4 = i * 4;\n const o2 = i * 8;\n this.float32[o4 + 0] = v0;\n this.float32[o4 + 1] = v1;\n this.float32[o4 + 2] = v2;\n this.int16[o2 + 6] = v3;\n this.int16[o2 + 7] = v4;\n return i;\n }\n}\n\nStructArrayLayout2f1f2i16.prototype.bytesPerElement = 16;\nregister('StructArrayLayout2f1f2i16', StructArrayLayout2f1f2i16);\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Uint8[2]\n * [4]: Float32[2]\n *\n * @private\n */\nclass StructArrayLayout2ub2f12 extends StructArray {\n uint8: Uint8Array;\n float32: Float32Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.float32 = new Float32Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number, v2: number, v3: number) {\n const i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1, v2, v3);\n }\n\n emplace(i: number, v0: number, v1: number, v2: number, v3: number) {\n const o1 = i * 12;\n const o4 = i * 3;\n this.uint8[o1 + 0] = v0;\n this.uint8[o1 + 1] = v1;\n this.float32[o4 + 1] = v2;\n this.float32[o4 + 2] = v3;\n return i;\n }\n}\n\nStructArrayLayout2ub2f12.prototype.bytesPerElement = 12;\nregister('StructArrayLayout2ub2f12', StructArrayLayout2ub2f12);\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Uint16[3]\n *\n * @private\n */\nclass StructArrayLayout3ui6 extends StructArray {\n uint8: Uint8Array;\n uint16: Uint16Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.uint16 = new Uint16Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number, v2: number) {\n const i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1, v2);\n }\n\n emplace(i: number, v0: number, v1: number, v2: number) {\n const o2 = i * 3;\n this.uint16[o2 + 0] = v0;\n this.uint16[o2 + 1] = v1;\n this.uint16[o2 + 2] = v2;\n return i;\n }\n}\n\nStructArrayLayout3ui6.prototype.bytesPerElement = 6;\nregister('StructArrayLayout3ui6', StructArrayLayout3ui6);\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Int16[2]\n * [4]: Uint16[2]\n * [8]: Uint32[3]\n * [20]: Uint16[3]\n * [28]: Float32[2]\n * [36]: Uint8[3]\n * [40]: Uint32[1]\n * [44]: Int16[1]\n *\n * @private\n */\nclass StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48 extends StructArray {\n uint8: Uint8Array;\n int16: Int16Array;\n uint16: Uint16Array;\n uint32: Uint32Array;\n float32: Float32Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.int16 = new Int16Array(this.arrayBuffer);\n this.uint16 = new Uint16Array(this.arrayBuffer);\n this.uint32 = new Uint32Array(this.arrayBuffer);\n this.float32 = new Float32Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, v9: number, v10: number, v11: number, v12: number, v13: number, v14: number, v15: number, v16: number) {\n const i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16);\n }\n\n emplace(i: number, v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, v9: number, v10: number, v11: number, v12: number, v13: number, v14: number, v15: number, v16: number) {\n const o2 = i * 24;\n const o4 = i * 12;\n const o1 = i * 48;\n this.int16[o2 + 0] = v0;\n this.int16[o2 + 1] = v1;\n this.uint16[o2 + 2] = v2;\n this.uint16[o2 + 3] = v3;\n this.uint32[o4 + 2] = v4;\n this.uint32[o4 + 3] = v5;\n this.uint32[o4 + 4] = v6;\n this.uint16[o2 + 10] = v7;\n this.uint16[o2 + 11] = v8;\n this.uint16[o2 + 12] = v9;\n this.float32[o4 + 7] = v10;\n this.float32[o4 + 8] = v11;\n this.uint8[o1 + 36] = v12;\n this.uint8[o1 + 37] = v13;\n this.uint8[o1 + 38] = v14;\n this.uint32[o4 + 10] = v15;\n this.int16[o2 + 22] = v16;\n return i;\n }\n}\n\nStructArrayLayout2i2ui3ul3ui2f3ub1ul1i48.prototype.bytesPerElement = 48;\nregister('StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48', StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48);\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Int16[8]\n * [16]: Uint16[15]\n * [48]: Uint32[1]\n * [52]: Float32[4]\n *\n * @private\n */\nclass StructArrayLayout8i15ui1ul4f68 extends StructArray {\n uint8: Uint8Array;\n int16: Int16Array;\n uint16: Uint16Array;\n uint32: Uint32Array;\n float32: Float32Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.int16 = new Int16Array(this.arrayBuffer);\n this.uint16 = new Uint16Array(this.arrayBuffer);\n this.uint32 = new Uint32Array(this.arrayBuffer);\n this.float32 = new Float32Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, v9: number, v10: number, v11: number, v12: number, v13: number, v14: number, v15: number, v16: number, v17: number, v18: number, v19: number, v20: number, v21: number, v22: number, v23: number, v24: number, v25: number, v26: number, v27: number) {\n const i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27);\n }\n\n emplace(i: number, v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, v9: number, v10: number, v11: number, v12: number, v13: number, v14: number, v15: number, v16: number, v17: number, v18: number, v19: number, v20: number, v21: number, v22: number, v23: number, v24: number, v25: number, v26: number, v27: number) {\n const o2 = i * 34;\n const o4 = i * 17;\n this.int16[o2 + 0] = v0;\n this.int16[o2 + 1] = v1;\n this.int16[o2 + 2] = v2;\n this.int16[o2 + 3] = v3;\n this.int16[o2 + 4] = v4;\n this.int16[o2 + 5] = v5;\n this.int16[o2 + 6] = v6;\n this.int16[o2 + 7] = v7;\n this.uint16[o2 + 8] = v8;\n this.uint16[o2 + 9] = v9;\n this.uint16[o2 + 10] = v10;\n this.uint16[o2 + 11] = v11;\n this.uint16[o2 + 12] = v12;\n this.uint16[o2 + 13] = v13;\n this.uint16[o2 + 14] = v14;\n this.uint16[o2 + 15] = v15;\n this.uint16[o2 + 16] = v16;\n this.uint16[o2 + 17] = v17;\n this.uint16[o2 + 18] = v18;\n this.uint16[o2 + 19] = v19;\n this.uint16[o2 + 20] = v20;\n this.uint16[o2 + 21] = v21;\n this.uint16[o2 + 22] = v22;\n this.uint32[o4 + 12] = v23;\n this.float32[o4 + 13] = v24;\n this.float32[o4 + 14] = v25;\n this.float32[o4 + 15] = v26;\n this.float32[o4 + 16] = v27;\n return i;\n }\n}\n\nStructArrayLayout8i15ui1ul4f68.prototype.bytesPerElement = 68;\nregister('StructArrayLayout8i15ui1ul4f68', StructArrayLayout8i15ui1ul4f68);\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Float32[1]\n *\n * @private\n */\nclass StructArrayLayout1f4 extends StructArray {\n uint8: Uint8Array;\n float32: Float32Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.float32 = new Float32Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number) {\n const i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0);\n }\n\n emplace(i: number, v0: number) {\n const o4 = i * 1;\n this.float32[o4 + 0] = v0;\n return i;\n }\n}\n\nStructArrayLayout1f4.prototype.bytesPerElement = 4;\nregister('StructArrayLayout1f4', StructArrayLayout1f4);\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Int16[3]\n *\n * @private\n */\nclass StructArrayLayout3i6 extends StructArray {\n uint8: Uint8Array;\n int16: Int16Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.int16 = new Int16Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number, v2: number) {\n const i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1, v2);\n }\n\n emplace(i: number, v0: number, v1: number, v2: number) {\n const o2 = i * 3;\n this.int16[o2 + 0] = v0;\n this.int16[o2 + 1] = v1;\n this.int16[o2 + 2] = v2;\n return i;\n }\n}\n\nStructArrayLayout3i6.prototype.bytesPerElement = 6;\nregister('StructArrayLayout3i6', StructArrayLayout3i6);\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Uint32[1]\n * [4]: Uint16[2]\n *\n * @private\n */\nclass StructArrayLayout1ul2ui8 extends StructArray {\n uint8: Uint8Array;\n uint32: Uint32Array;\n uint16: Uint16Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.uint32 = new Uint32Array(this.arrayBuffer);\n this.uint16 = new Uint16Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number, v2: number) {\n const i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1, v2);\n }\n\n emplace(i: number, v0: number, v1: number, v2: number) {\n const o4 = i * 2;\n const o2 = i * 4;\n this.uint32[o4 + 0] = v0;\n this.uint16[o2 + 2] = v1;\n this.uint16[o2 + 3] = v2;\n return i;\n }\n}\n\nStructArrayLayout1ul2ui8.prototype.bytesPerElement = 8;\nregister('StructArrayLayout1ul2ui8', StructArrayLayout1ul2ui8);\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Uint16[2]\n *\n * @private\n */\nclass StructArrayLayout2ui4 extends StructArray {\n uint8: Uint8Array;\n uint16: Uint16Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.uint16 = new Uint16Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number) {\n const i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1);\n }\n\n emplace(i: number, v0: number, v1: number) {\n const o2 = i * 2;\n this.uint16[o2 + 0] = v0;\n this.uint16[o2 + 1] = v1;\n return i;\n }\n}\n\nStructArrayLayout2ui4.prototype.bytesPerElement = 4;\nregister('StructArrayLayout2ui4', StructArrayLayout2ui4);\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Uint16[1]\n *\n * @private\n */\nclass StructArrayLayout1ui2 extends StructArray {\n uint8: Uint8Array;\n uint16: Uint16Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.uint16 = new Uint16Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number) {\n const i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0);\n }\n\n emplace(i: number, v0: number) {\n const o2 = i * 1;\n this.uint16[o2 + 0] = v0;\n return i;\n }\n}\n\nStructArrayLayout1ui2.prototype.bytesPerElement = 2;\nregister('StructArrayLayout1ui2', StructArrayLayout1ui2);\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Float32[4]\n *\n * @private\n */\nclass StructArrayLayout4f16 extends StructArray {\n uint8: Uint8Array;\n float32: Float32Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.float32 = new Float32Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number, v2: number, v3: number) {\n const i = this.length;\n this.resize(i + 1);\n return this.emplace(i, v0, v1, v2, v3);\n }\n\n emplace(i: number, v0: number, v1: number, v2: number, v3: number) {\n const o4 = i * 4;\n this.float32[o4 + 0] = v0;\n this.float32[o4 + 1] = v1;\n this.float32[o4 + 2] = v2;\n this.float32[o4 + 3] = v3;\n return i;\n }\n}\n\nStructArrayLayout4f16.prototype.bytesPerElement = 16;\nregister('StructArrayLayout4f16', StructArrayLayout4f16);\n\nclass CollisionBoxStruct extends Struct {\n _structArray: CollisionBoxArray;\n anchorPointX: number;\n anchorPointY: number;\n x1: number;\n y1: number;\n x2: number;\n y2: number;\n featureIndex: number;\n sourceLayerIndex: number;\n bucketIndex: number;\n anchorPoint: Point;\n get anchorPointX() { return this._structArray.int16[this._pos2 + 0]; }\n get anchorPointY() { return this._structArray.int16[this._pos2 + 1]; }\n get x1() { return this._structArray.int16[this._pos2 + 2]; }\n get y1() { return this._structArray.int16[this._pos2 + 3]; }\n get x2() { return this._structArray.int16[this._pos2 + 4]; }\n get y2() { return this._structArray.int16[this._pos2 + 5]; }\n get featureIndex() { return this._structArray.uint32[this._pos4 + 3]; }\n get sourceLayerIndex() { return this._structArray.uint16[this._pos2 + 8]; }\n get bucketIndex() { return this._structArray.uint16[this._pos2 + 9]; }\n get anchorPoint() { return new Point(this.anchorPointX, this.anchorPointY); }\n}\n\nCollisionBoxStruct.prototype.size = 20;\n\nexport type CollisionBox = CollisionBoxStruct;\n\n/**\n * @private\n */\nexport class CollisionBoxArray extends StructArrayLayout6i1ul2ui20 {\n /**\n * Return the CollisionBoxStruct at the given location in the array.\n * @param {number} index The index of the element.\n * @private\n */\n get(index: number): CollisionBoxStruct {\n assert(!this.isTransferred);\n return new CollisionBoxStruct(this, index);\n }\n}\n\nregister('CollisionBoxArray', CollisionBoxArray);\n\nclass PlacedSymbolStruct extends Struct {\n _structArray: PlacedSymbolArray;\n anchorX: number;\n anchorY: number;\n glyphStartIndex: number;\n numGlyphs: number;\n vertexStartIndex: number;\n lineStartIndex: number;\n lineLength: number;\n segment: number;\n lowerSize: number;\n upperSize: number;\n lineOffsetX: number;\n lineOffsetY: number;\n writingMode: number;\n placedOrientation: number;\n hidden: number;\n crossTileID: number;\n associatedIconIndex: number;\n get anchorX() { return this._structArray.int16[this._pos2 + 0]; }\n get anchorY() { return this._structArray.int16[this._pos2 + 1]; }\n get glyphStartIndex() { return this._structArray.uint16[this._pos2 + 2]; }\n get numGlyphs() { return this._structArray.uint16[this._pos2 + 3]; }\n get vertexStartIndex() { return this._structArray.uint32[this._pos4 + 2]; }\n get lineStartIndex() { return this._structArray.uint32[this._pos4 + 3]; }\n get lineLength() { return this._structArray.uint32[this._pos4 + 4]; }\n get segment() { return this._structArray.uint16[this._pos2 + 10]; }\n get lowerSize() { return this._structArray.uint16[this._pos2 + 11]; }\n get upperSize() { return this._structArray.uint16[this._pos2 + 12]; }\n get lineOffsetX() { return this._structArray.float32[this._pos4 + 7]; }\n get lineOffsetY() { return this._structArray.float32[this._pos4 + 8]; }\n get writingMode() { return this._structArray.uint8[this._pos1 + 36]; }\n get placedOrientation() { return this._structArray.uint8[this._pos1 + 37]; }\n set placedOrientation(x: number) { this._structArray.uint8[this._pos1 + 37] = x; }\n get hidden() { return this._structArray.uint8[this._pos1 + 38]; }\n set hidden(x: number) { this._structArray.uint8[this._pos1 + 38] = x; }\n get crossTileID() { return this._structArray.uint32[this._pos4 + 10]; }\n set crossTileID(x: number) { this._structArray.uint32[this._pos4 + 10] = x; }\n get associatedIconIndex() { return this._structArray.int16[this._pos2 + 22]; }\n}\n\nPlacedSymbolStruct.prototype.size = 48;\n\nexport type PlacedSymbol = PlacedSymbolStruct;\n\n/**\n * @private\n */\nexport class PlacedSymbolArray extends StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48 {\n /**\n * Return the PlacedSymbolStruct at the given location in the array.\n * @param {number} index The index of the element.\n * @private\n */\n get(index: number): PlacedSymbolStruct {\n assert(!this.isTransferred);\n return new PlacedSymbolStruct(this, index);\n }\n}\n\nregister('PlacedSymbolArray', PlacedSymbolArray);\n\nclass SymbolInstanceStruct extends Struct {\n _structArray: SymbolInstanceArray;\n anchorX: number;\n anchorY: number;\n rightJustifiedTextSymbolIndex: number;\n centerJustifiedTextSymbolIndex: number;\n leftJustifiedTextSymbolIndex: number;\n verticalPlacedTextSymbolIndex: number;\n placedIconSymbolIndex: number;\n verticalPlacedIconSymbolIndex: number;\n key: number;\n textBoxStartIndex: number;\n textBoxEndIndex: number;\n verticalTextBoxStartIndex: number;\n verticalTextBoxEndIndex: number;\n iconBoxStartIndex: number;\n iconBoxEndIndex: number;\n verticalIconBoxStartIndex: number;\n verticalIconBoxEndIndex: number;\n featureIndex: number;\n numHorizontalGlyphVertices: number;\n numVerticalGlyphVertices: number;\n numIconVertices: number;\n numVerticalIconVertices: number;\n useRuntimeCollisionCircles: number;\n crossTileID: number;\n textBoxScale: number;\n textOffset0: number;\n textOffset1: number;\n collisionCircleDiameter: number;\n get anchorX() { return this._structArray.int16[this._pos2 + 0]; }\n get anchorY() { return this._structArray.int16[this._pos2 + 1]; }\n get rightJustifiedTextSymbolIndex() { return this._structArray.int16[this._pos2 + 2]; }\n get centerJustifiedTextSymbolIndex() { return this._structArray.int16[this._pos2 + 3]; }\n get leftJustifiedTextSymbolIndex() { return this._structArray.int16[this._pos2 + 4]; }\n get verticalPlacedTextSymbolIndex() { return this._structArray.int16[this._pos2 + 5]; }\n get placedIconSymbolIndex() { return this._structArray.int16[this._pos2 + 6]; }\n get verticalPlacedIconSymbolIndex() { return this._structArray.int16[this._pos2 + 7]; }\n get key() { return this._structArray.uint16[this._pos2 + 8]; }\n get textBoxStartIndex() { return this._structArray.uint16[this._pos2 + 9]; }\n get textBoxEndIndex() { return this._structArray.uint16[this._pos2 + 10]; }\n get verticalTextBoxStartIndex() { return this._structArray.uint16[this._pos2 + 11]; }\n get verticalTextBoxEndIndex() { return this._structArray.uint16[this._pos2 + 12]; }\n get iconBoxStartIndex() { return this._structArray.uint16[this._pos2 + 13]; }\n get iconBoxEndIndex() { return this._structArray.uint16[this._pos2 + 14]; }\n get verticalIconBoxStartIndex() { return this._structArray.uint16[this._pos2 + 15]; }\n get verticalIconBoxEndIndex() { return this._structArray.uint16[this._pos2 + 16]; }\n get featureIndex() { return this._structArray.uint16[this._pos2 + 17]; }\n get numHorizontalGlyphVertices() { return this._structArray.uint16[this._pos2 + 18]; }\n get numVerticalGlyphVertices() { return this._structArray.uint16[this._pos2 + 19]; }\n get numIconVertices() { return this._structArray.uint16[this._pos2 + 20]; }\n get numVerticalIconVertices() { return this._structArray.uint16[this._pos2 + 21]; }\n get useRuntimeCollisionCircles() { return this._structArray.uint16[this._pos2 + 22]; }\n get crossTileID() { return this._structArray.uint32[this._pos4 + 12]; }\n set crossTileID(x: number) { this._structArray.uint32[this._pos4 + 12] = x; }\n get textBoxScale() { return this._structArray.float32[this._pos4 + 13]; }\n get textOffset0() { return this._structArray.float32[this._pos4 + 14]; }\n get textOffset1() { return this._structArray.float32[this._pos4 + 15]; }\n get collisionCircleDiameter() { return this._structArray.float32[this._pos4 + 16]; }\n}\n\nSymbolInstanceStruct.prototype.size = 68;\n\nexport type SymbolInstance = SymbolInstanceStruct;\n\n/**\n * @private\n */\nexport class SymbolInstanceArray extends StructArrayLayout8i15ui1ul4f68 {\n /**\n * Return the SymbolInstanceStruct at the given location in the array.\n * @param {number} index The index of the element.\n * @private\n */\n get(index: number): SymbolInstanceStruct {\n assert(!this.isTransferred);\n return new SymbolInstanceStruct(this, index);\n }\n}\n\nregister('SymbolInstanceArray', SymbolInstanceArray);\n\n/**\n * @private\n */\nexport class GlyphOffsetArray extends StructArrayLayout1f4 {\n getoffsetX(index: number) { return this.float32[index * 1 + 0]; }\n}\n\nregister('GlyphOffsetArray', GlyphOffsetArray);\n\n/**\n * @private\n */\nexport class SymbolLineVertexArray extends StructArrayLayout3i6 {\n getx(index: number) { return this.int16[index * 3 + 0]; }\n gety(index: number) { return this.int16[index * 3 + 1]; }\n gettileUnitDistanceFromAnchor(index: number) { return this.int16[index * 3 + 2]; }\n}\n\nregister('SymbolLineVertexArray', SymbolLineVertexArray);\n\nclass FeatureIndexStruct extends Struct {\n _structArray: FeatureIndexArray;\n featureIndex: number;\n sourceLayerIndex: number;\n bucketIndex: number;\n get featureIndex() { return this._structArray.uint32[this._pos4 + 0]; }\n get sourceLayerIndex() { return this._structArray.uint16[this._pos2 + 2]; }\n get bucketIndex() { return this._structArray.uint16[this._pos2 + 3]; }\n}\n\nFeatureIndexStruct.prototype.size = 8;\n\nexport type FeatureIndex = FeatureIndexStruct;\n\n/**\n * @private\n */\nexport class FeatureIndexArray extends StructArrayLayout1ul2ui8 {\n /**\n * Return the FeatureIndexStruct at the given location in the array.\n * @param {number} index The index of the element.\n * @private\n */\n get(index: number): FeatureIndexStruct {\n assert(!this.isTransferred);\n return new FeatureIndexStruct(this, index);\n }\n}\n\nregister('FeatureIndexArray', FeatureIndexArray);\n\nexport {\n StructArrayLayout2i4,\n StructArrayLayout4i8,\n StructArrayLayout2i4i12,\n StructArrayLayout2i4ub8,\n StructArrayLayout2f8,\n StructArrayLayout10ui20,\n StructArrayLayout4i4ui4i24,\n StructArrayLayout3f12,\n StructArrayLayout1ul4,\n StructArrayLayout6i1ul2ui20,\n StructArrayLayout2i2i2i12,\n StructArrayLayout2f1f2i16,\n StructArrayLayout2ub2f12,\n StructArrayLayout3ui6,\n StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48,\n StructArrayLayout8i15ui1ul4f68,\n StructArrayLayout1f4,\n StructArrayLayout3i6,\n StructArrayLayout1ul2ui8,\n StructArrayLayout2ui4,\n StructArrayLayout1ui2,\n StructArrayLayout4f16,\n StructArrayLayout2i4 as PosArray,\n StructArrayLayout4i8 as RasterBoundsArray,\n StructArrayLayout2i4 as CircleLayoutArray,\n StructArrayLayout2i4 as FillLayoutArray,\n StructArrayLayout2i4i12 as FillExtrusionLayoutArray,\n StructArrayLayout2i4 as HeatmapLayoutArray,\n StructArrayLayout2i4ub8 as LineLayoutArray,\n StructArrayLayout2f8 as LineExtLayoutArray,\n StructArrayLayout10ui20 as PatternLayoutArray,\n StructArrayLayout4i4ui4i24 as SymbolLayoutArray,\n StructArrayLayout3f12 as SymbolDynamicLayoutArray,\n StructArrayLayout1ul4 as SymbolOpacityArray,\n StructArrayLayout2i2i2i12 as CollisionBoxLayoutArray,\n StructArrayLayout2f1f2i16 as CollisionCircleLayoutArray,\n StructArrayLayout2ub2f12 as CollisionVertexArray,\n StructArrayLayout3ui6 as QuadTriangleArray,\n StructArrayLayout3ui6 as TriangleIndexArray,\n StructArrayLayout2ui4 as LineIndexArray,\n StructArrayLayout1ui2 as LineStripIndexArray\n};\n","// @flow\nimport {createLayout} from '../../util/struct_array';\n\nconst layout = createLayout([\n {name: 'a_pos', components: 2, type: 'Int16'}\n], 4);\n\nexport default layout;\nexport const {members, size, alignment} = layout;\n","// @flow\n\nimport {warnOnce} from '../util/util';\n\nimport {register} from '../util/web_worker_transfer';\n\nimport type VertexArrayObject from '../render/vertex_array_object';\nimport type {StructArray} from '../util/struct_array';\n\nexport type Segment = {\n sortKey: number | void,\n vertexOffset: number,\n primitiveOffset: number,\n vertexLength: number,\n primitiveLength: number,\n vaos: {[_: string]: VertexArrayObject}\n}\n\nclass SegmentVector {\n static MAX_VERTEX_ARRAY_LENGTH: number;\n segments: Array;\n\n constructor(segments?: Array = []) {\n this.segments = segments;\n }\n\n prepareSegment(numVertices: number, layoutVertexArray: StructArray, indexArray: StructArray, sortKey?: number): Segment {\n let segment: Segment = this.segments[this.segments.length - 1];\n if (numVertices > SegmentVector.MAX_VERTEX_ARRAY_LENGTH) warnOnce(`Max vertices per segment is ${SegmentVector.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${numVertices}`);\n if (!segment || segment.vertexLength + numVertices > SegmentVector.MAX_VERTEX_ARRAY_LENGTH || segment.sortKey !== sortKey) {\n segment = ({\n vertexOffset: layoutVertexArray.length,\n primitiveOffset: indexArray.length,\n vertexLength: 0,\n primitiveLength: 0\n }: any);\n if (sortKey !== undefined) segment.sortKey = sortKey;\n this.segments.push(segment);\n }\n return segment;\n }\n\n get() {\n return this.segments;\n }\n\n destroy() {\n for (const segment of this.segments) {\n for (const k in segment.vaos) {\n segment.vaos[k].destroy();\n }\n }\n }\n\n static simpleSegment(vertexOffset: number, primitiveOffset: number, vertexLength: number, primitiveLength: number): SegmentVector {\n return new SegmentVector([{\n vertexOffset,\n primitiveOffset,\n vertexLength,\n primitiveLength,\n vaos: {},\n sortKey: 0\n }]);\n }\n}\n\n/*\n * The maximum size of a vertex array. This limit is imposed by WebGL's 16 bit\n * addressing of vertex buffers.\n * @private\n * @readonly\n */\nSegmentVector.MAX_VERTEX_ARRAY_LENGTH = Math.pow(2, 16) - 1;\n\nregister('SegmentVector', SegmentVector);\nexport default SegmentVector;\n","// @flow\n\nimport {clamp} from '../util/util';\n\n/**\n * Packs two numbers, interpreted as 8-bit unsigned integers, into a single\n * float. Unpack them in the shader using the `unpack_float()` function,\n * defined in _prelude.vertex.glsl\n *\n * @private\n */\nexport function packUint8ToFloat(a: number, b: number) {\n // coerce a and b to 8-bit ints\n a = clamp(Math.floor(a), 0, 255);\n b = clamp(Math.floor(b), 0, 255);\n return 256 * a + b;\n}\n","// @flow\nimport {createLayout} from '../../util/struct_array';\n\nconst patternAttributes = createLayout([\n // [tl.x, tl.y, br.x, br.y]\n {name: 'a_pattern_from', components: 4, type: 'Uint16'},\n {name: 'a_pattern_to', components: 4, type: 'Uint16'},\n {name: 'a_pixel_ratio_from', components: 1, type: 'Uint16'},\n {name: 'a_pixel_ratio_to', components: 1, type: 'Uint16'},\n]);\n\nexport default patternAttributes;\n","/**\n * JS Implementation of MurmurHash3 (r136) (as of May 20, 2011)\n * \n * @author Gary Court\n * @see http://github.com/garycourt/murmurhash-js\n * @author Austin Appleby\n * @see http://sites.google.com/site/murmurhash/\n * \n * @param {string} key ASCII only\n * @param {number} seed Positive integer only\n * @return {number} 32-bit positive integer hash \n */\n\nfunction murmurhash3_32_gc(key, seed) {\n\tvar remainder, bytes, h1, h1b, c1, c1b, c2, c2b, k1, i;\n\t\n\tremainder = key.length & 3; // key.length % 4\n\tbytes = key.length - remainder;\n\th1 = seed;\n\tc1 = 0xcc9e2d51;\n\tc2 = 0x1b873593;\n\ti = 0;\n\t\n\twhile (i < bytes) {\n\t \tk1 = \n\t \t ((key.charCodeAt(i) & 0xff)) |\n\t \t ((key.charCodeAt(++i) & 0xff) << 8) |\n\t \t ((key.charCodeAt(++i) & 0xff) << 16) |\n\t \t ((key.charCodeAt(++i) & 0xff) << 24);\n\t\t++i;\n\t\t\n\t\tk1 = ((((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16))) & 0xffffffff;\n\t\tk1 = (k1 << 15) | (k1 >>> 17);\n\t\tk1 = ((((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16))) & 0xffffffff;\n\n\t\th1 ^= k1;\n h1 = (h1 << 13) | (h1 >>> 19);\n\t\th1b = ((((h1 & 0xffff) * 5) + ((((h1 >>> 16) * 5) & 0xffff) << 16))) & 0xffffffff;\n\t\th1 = (((h1b & 0xffff) + 0x6b64) + ((((h1b >>> 16) + 0xe654) & 0xffff) << 16));\n\t}\n\t\n\tk1 = 0;\n\t\n\tswitch (remainder) {\n\t\tcase 3: k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16;\n\t\tcase 2: k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;\n\t\tcase 1: k1 ^= (key.charCodeAt(i) & 0xff);\n\t\t\n\t\tk1 = (((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16)) & 0xffffffff;\n\t\tk1 = (k1 << 15) | (k1 >>> 17);\n\t\tk1 = (((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16)) & 0xffffffff;\n\t\th1 ^= k1;\n\t}\n\t\n\th1 ^= key.length;\n\n\th1 ^= h1 >>> 16;\n\th1 = (((h1 & 0xffff) * 0x85ebca6b) + ((((h1 >>> 16) * 0x85ebca6b) & 0xffff) << 16)) & 0xffffffff;\n\th1 ^= h1 >>> 13;\n\th1 = ((((h1 & 0xffff) * 0xc2b2ae35) + ((((h1 >>> 16) * 0xc2b2ae35) & 0xffff) << 16))) & 0xffffffff;\n\th1 ^= h1 >>> 16;\n\n\treturn h1 >>> 0;\n}\n\nif(typeof module !== \"undefined\") {\n module.exports = murmurhash3_32_gc\n}","/**\n * JS Implementation of MurmurHash2\n * \n * @author Gary Court\n * @see http://github.com/garycourt/murmurhash-js\n * @author Austin Appleby\n * @see http://sites.google.com/site/murmurhash/\n * \n * @param {string} str ASCII only\n * @param {number} seed Positive integer only\n * @return {number} 32-bit positive integer hash\n */\n\nfunction murmurhash2_32_gc(str, seed) {\n var\n l = str.length,\n h = seed ^ l,\n i = 0,\n k;\n \n while (l >= 4) {\n \tk = \n \t ((str.charCodeAt(i) & 0xff)) |\n \t ((str.charCodeAt(++i) & 0xff) << 8) |\n \t ((str.charCodeAt(++i) & 0xff) << 16) |\n \t ((str.charCodeAt(++i) & 0xff) << 24);\n \n k = (((k & 0xffff) * 0x5bd1e995) + ((((k >>> 16) * 0x5bd1e995) & 0xffff) << 16));\n k ^= k >>> 24;\n k = (((k & 0xffff) * 0x5bd1e995) + ((((k >>> 16) * 0x5bd1e995) & 0xffff) << 16));\n\n\th = (((h & 0xffff) * 0x5bd1e995) + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16)) ^ k;\n\n l -= 4;\n ++i;\n }\n \n switch (l) {\n case 3: h ^= (str.charCodeAt(i + 2) & 0xff) << 16;\n case 2: h ^= (str.charCodeAt(i + 1) & 0xff) << 8;\n case 1: h ^= (str.charCodeAt(i) & 0xff);\n h = (((h & 0xffff) * 0x5bd1e995) + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16));\n }\n\n h ^= h >>> 13;\n h = (((h & 0xffff) * 0x5bd1e995) + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16));\n h ^= h >>> 15;\n\n return h >>> 0;\n}\n\nif(typeof module !== undefined) {\n module.exports = murmurhash2_32_gc\n}\n","var murmur3 = require(\"./murmurhash3_gc.js\")\nvar murmur2 = require(\"./murmurhash2_gc.js\")\n\nmodule.exports = murmur3\nmodule.exports.murmur3 = murmur3\nmodule.exports.murmur2 = murmur2\n","// @flow\n\nimport murmur3 from 'murmurhash-js';\nimport {register} from '../util/web_worker_transfer';\nimport assert from 'assert';\n\ntype SerializedFeaturePositionMap = {\n ids: Float64Array;\n positions: Uint32Array;\n};\n\ntype FeaturePosition = {\n index: number;\n start: number;\n end: number;\n};\n\n// A transferable data structure that maps feature ids to their indices and buffer offsets\nexport default class FeaturePositionMap {\n ids: Array;\n positions: Array;\n indexed: boolean;\n\n constructor() {\n this.ids = [];\n this.positions = [];\n this.indexed = false;\n }\n\n add(id: mixed, index: number, start: number, end: number) {\n this.ids.push(getNumericId(id));\n this.positions.push(index, start, end);\n }\n\n getPositions(id: mixed): Array {\n assert(this.indexed);\n\n const intId = getNumericId(id);\n\n // binary search for the first occurrence of id in this.ids;\n // relies on ids/positions being sorted by id, which happens in serialization\n let i = 0;\n let j = this.ids.length - 1;\n while (i < j) {\n const m = (i + j) >> 1;\n if (this.ids[m] >= intId) {\n j = m;\n } else {\n i = m + 1;\n }\n }\n const positions = [];\n while (this.ids[i] === intId) {\n const index = this.positions[3 * i];\n const start = this.positions[3 * i + 1];\n const end = this.positions[3 * i + 2];\n positions.push({index, start, end});\n i++;\n }\n return positions;\n }\n\n static serialize(map: FeaturePositionMap, transferables: Array): SerializedFeaturePositionMap {\n const ids = new Float64Array(map.ids);\n const positions = new Uint32Array(map.positions);\n\n sort(ids, positions, 0, ids.length - 1);\n\n if (transferables) {\n transferables.push(ids.buffer, positions.buffer);\n }\n\n return {ids, positions};\n }\n\n static deserialize(obj: SerializedFeaturePositionMap): FeaturePositionMap {\n const map = new FeaturePositionMap();\n // after transferring, we only use these arrays statically (no pushes),\n // so TypedArray vs Array distinction that flow points out doesn't matter\n map.ids = (obj.ids: any);\n map.positions = (obj.positions: any);\n map.indexed = true;\n return map;\n }\n}\n\nconst MAX_SAFE_INTEGER = Math.pow(2, 53) - 1;\n\nfunction getNumericId(value: mixed) {\n const numValue = +value;\n if (!isNaN(numValue) && numValue <= MAX_SAFE_INTEGER) {\n return numValue;\n }\n return murmur3(String(value));\n}\n\n// custom quicksort that sorts ids, indices and offsets together (by ids)\n// uses Hoare partitioning & manual tail call optimization to avoid worst case scenarios\nfunction sort(ids, positions, left, right) {\n while (left < right) {\n const pivot = ids[(left + right) >> 1];\n let i = left - 1;\n let j = right + 1;\n\n while (true) {\n do i++; while (ids[i] < pivot);\n do j--; while (ids[j] > pivot);\n if (i >= j) break;\n swap(ids, i, j);\n swap(positions, 3 * i, 3 * j);\n swap(positions, 3 * i + 1, 3 * j + 1);\n swap(positions, 3 * i + 2, 3 * j + 2);\n }\n\n if (j - left < right - j) {\n sort(ids, positions, left, j);\n left = j + 1;\n } else {\n sort(ids, positions, j + 1, right);\n right = j;\n }\n }\n}\n\nfunction swap(arr, i, j) {\n const tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n}\n\nregister('FeaturePositionMap', FeaturePositionMap);\n","// @flow\n\nimport Color from '../style-spec/util/color';\n\nimport type Context from '../gl/context';\n\nexport type UniformValues\n = $Exact<$ObjMap(u: Uniform) => V>>;\nexport type UniformLocations = {[_: string]: WebGLUniformLocation};\n\nclass Uniform {\n gl: WebGLRenderingContext;\n location: ?WebGLUniformLocation;\n current: T;\n\n constructor(context: Context, location: WebGLUniformLocation) {\n this.gl = context.gl;\n this.location = location;\n }\n\n +set: (v: T) => void;\n}\n\nclass Uniform1i extends Uniform {\n constructor(context: Context, location: WebGLUniformLocation) {\n super(context, location);\n this.current = 0;\n }\n\n set(v: number): void {\n if (this.current !== v) {\n this.current = v;\n this.gl.uniform1i(this.location, v);\n }\n }\n}\n\nclass Uniform1f extends Uniform {\n constructor(context: Context, location: WebGLUniformLocation) {\n super(context, location);\n this.current = 0;\n }\n\n set(v: number): void {\n if (this.current !== v) {\n this.current = v;\n this.gl.uniform1f(this.location, v);\n }\n }\n}\n\nclass Uniform2f extends Uniform<[number, number]> {\n constructor(context: Context, location: WebGLUniformLocation) {\n super(context, location);\n this.current = [0, 0];\n }\n\n set(v: [number, number]): void {\n if (v[0] !== this.current[0] || v[1] !== this.current[1]) {\n this.current = v;\n this.gl.uniform2f(this.location, v[0], v[1]);\n }\n }\n}\n\nclass Uniform3f extends Uniform<[number, number, number]> {\n constructor(context: Context, location: WebGLUniformLocation) {\n super(context, location);\n this.current = [0, 0, 0];\n }\n\n set(v: [number, number, number]): void {\n if (v[0] !== this.current[0] || v[1] !== this.current[1] || v[2] !== this.current[2]) {\n this.current = v;\n this.gl.uniform3f(this.location, v[0], v[1], v[2]);\n }\n }\n}\n\nclass Uniform4f extends Uniform<[number, number, number, number]> {\n constructor(context: Context, location: WebGLUniformLocation) {\n super(context, location);\n this.current = [0, 0, 0, 0];\n }\n\n set(v: [number, number, number, number]): void {\n if (v[0] !== this.current[0] || v[1] !== this.current[1] ||\n v[2] !== this.current[2] || v[3] !== this.current[3]) {\n this.current = v;\n this.gl.uniform4f(this.location, v[0], v[1], v[2], v[3]);\n }\n }\n}\n\nclass UniformColor extends Uniform {\n constructor(context: Context, location: WebGLUniformLocation) {\n super(context, location);\n this.current = Color.transparent;\n }\n\n set(v: Color): void {\n if (v.r !== this.current.r || v.g !== this.current.g ||\n v.b !== this.current.b || v.a !== this.current.a) {\n this.current = v;\n this.gl.uniform4f(this.location, v.r, v.g, v.b, v.a);\n }\n }\n}\n\nconst emptyMat4 = new Float32Array(16);\nclass UniformMatrix4f extends Uniform {\n constructor(context: Context, location: WebGLUniformLocation) {\n super(context, location);\n this.current = emptyMat4;\n }\n\n set(v: Float32Array): void {\n // The vast majority of matrix comparisons that will trip this set\n // happen at i=12 or i=0, so we check those first to avoid lots of\n // unnecessary iteration:\n if (v[12] !== this.current[12] || v[0] !== this.current[0]) {\n this.current = v;\n this.gl.uniformMatrix4fv(this.location, false, v);\n return;\n }\n for (let i = 1; i < 16; i++) {\n if (v[i] !== this.current[i]) {\n this.current = v;\n this.gl.uniformMatrix4fv(this.location, false, v);\n break;\n }\n }\n }\n}\n\nexport {\n Uniform,\n Uniform1i,\n Uniform1f,\n Uniform2f,\n Uniform3f,\n Uniform4f,\n UniformColor,\n UniformMatrix4f\n};\n\nexport type UniformBindings = {[_: string]: Uniform};\n","// @flow\n\nimport {packUint8ToFloat} from '../shaders/encode_attribute';\nimport Color from '../style-spec/util/color';\nimport {supportsPropertyExpression} from '../style-spec/util/properties';\nimport {register} from '../util/web_worker_transfer';\nimport {PossiblyEvaluatedPropertyValue} from '../style/properties';\nimport {StructArrayLayout1f4, StructArrayLayout2f8, StructArrayLayout4f16, PatternLayoutArray} from './array_types';\nimport {clamp} from '../util/util';\nimport patternAttributes from './bucket/pattern_attributes';\nimport EvaluationParameters from '../style/evaluation_parameters';\nimport FeaturePositionMap from './feature_position_map';\nimport {\n Uniform,\n Uniform1f,\n UniformColor,\n Uniform4f,\n type UniformLocations\n} from '../render/uniform_binding';\n\nimport type {CanonicalTileID} from '../source/tile_id';\nimport type Context from '../gl/context';\nimport type {TypedStyleLayer} from '../style/style_layer/typed_style_layer';\nimport type {CrossfadeParameters} from '../style/evaluation_parameters';\nimport type {StructArray, StructArrayMember} from '../util/struct_array';\nimport type VertexBuffer from '../gl/vertex_buffer';\nimport type {ImagePosition} from '../render/image_atlas';\nimport type {\n Feature,\n FeatureState,\n GlobalProperties,\n SourceExpression,\n CompositeExpression\n} from '../style-spec/expression';\nimport type {PossiblyEvaluated} from '../style/properties';\nimport type {FeatureStates} from '../source/source_state';\nimport type {FormattedSection} from '../style-spec/expression/types/formatted';\n\nexport type BinderUniform = {\n name: string,\n property: string,\n binding: Uniform\n};\n\nfunction packColor(color: Color): [number, number] {\n return [\n packUint8ToFloat(255 * color.r, 255 * color.g),\n packUint8ToFloat(255 * color.b, 255 * color.a)\n ];\n}\n\n/**\n * `Binder` is the interface definition for the strategies for constructing,\n * uploading, and binding paint property data as GLSL attributes. Most style-\n * spec properties have a 1:1 relationship to shader attribute/uniforms, but\n * some require multliple values per feature to be passed to the GPU, and in\n * those cases we bind multiple attributes/uniforms.\n *\n * It has three implementations, one for each of the three strategies we use:\n *\n * * For _constant_ properties -- those whose value is a constant, or the constant\n * result of evaluating a camera expression at a particular camera position -- we\n * don't need a vertex attribute buffer, and instead use a uniform.\n * * For data expressions, we use a vertex buffer with a single attribute value,\n * the evaluated result of the source function for the given feature.\n * * For composite expressions, we use a vertex buffer with two attributes: min and\n * max values covering the range of zooms at which we expect the tile to be\n * displayed. These values are calculated by evaluating the composite expression for\n * the given feature at strategically chosen zoom levels. In addition to this\n * attribute data, we also use a uniform value which the shader uses to interpolate\n * between the min and max value at the final displayed zoom level. The use of a\n * uniform allows us to cheaply update the value on every frame.\n *\n * Note that the shader source varies depending on whether we're using a uniform or\n * attribute. We dynamically compile shaders at runtime to accomodate this.\n *\n * @private\n */\n\ninterface AttributeBinder {\n populatePaintArray(length: number, feature: Feature, imagePositions: {[_: string]: ImagePosition}, canonical?: CanonicalTileID, formattedSection?: FormattedSection): void;\n updatePaintArray(start: number, length: number, feature: Feature, featureState: FeatureState, imagePositions: {[_: string]: ImagePosition}): void;\n upload(Context): void;\n destroy(): void;\n}\n\ninterface UniformBinder {\n uniformNames: Array;\n setUniform(uniform: Uniform<*>, globals: GlobalProperties, currentValue: PossiblyEvaluatedPropertyValue<*>, uniformName: string): void;\n getBinding(context: Context, location: WebGLUniformLocation, name: string): $Shape>;\n}\n\nclass ConstantBinder implements UniformBinder {\n value: mixed;\n type: string;\n uniformNames: Array;\n\n constructor(value: mixed, names: Array, type: string) {\n this.value = value;\n this.uniformNames = names.map(name => `u_${name}`);\n this.type = type;\n }\n\n setUniform(uniform: Uniform<*>, globals: GlobalProperties, currentValue: PossiblyEvaluatedPropertyValue): void {\n uniform.set(currentValue.constantOr(this.value));\n }\n\n getBinding(context: Context, location: WebGLUniformLocation, _: string): $Shape> {\n return (this.type === 'color') ?\n new UniformColor(context, location) :\n new Uniform1f(context, location);\n }\n}\n\nclass CrossFadedConstantBinder implements UniformBinder {\n uniformNames: Array;\n patternFrom: ?Array;\n patternTo: ?Array;\n pixelRatioFrom: number;\n pixelRatioTo: number;\n\n constructor(value: mixed, names: Array) {\n this.uniformNames = names.map(name => `u_${name}`);\n this.patternFrom = null;\n this.patternTo = null;\n this.pixelRatioFrom = 1.0;\n this.pixelRatioTo = 1.0;\n }\n\n setConstantPatternPositions(posTo: ImagePosition, posFrom: ImagePosition) {\n this.pixelRatioFrom = posFrom.pixelRatio;\n this.pixelRatioTo = posTo.pixelRatio;\n this.patternFrom = posFrom.tlbr;\n this.patternTo = posTo.tlbr;\n }\n\n setUniform(uniform: Uniform<*>, globals: GlobalProperties, currentValue: PossiblyEvaluatedPropertyValue, uniformName: string) {\n const pos =\n uniformName === 'u_pattern_to' ? this.patternTo :\n uniformName === 'u_pattern_from' ? this.patternFrom :\n uniformName === 'u_pixel_ratio_to' ? this.pixelRatioTo :\n uniformName === 'u_pixel_ratio_from' ? this.pixelRatioFrom : null;\n if (pos) uniform.set(pos);\n }\n\n getBinding(context: Context, location: WebGLUniformLocation, name: string): $Shape> {\n return name.substr(0, 9) === 'u_pattern' ?\n new Uniform4f(context, location) :\n new Uniform1f(context, location);\n }\n}\n\nclass SourceExpressionBinder implements AttributeBinder {\n expression: SourceExpression;\n type: string;\n maxValue: number;\n\n paintVertexArray: StructArray;\n paintVertexAttributes: Array;\n paintVertexBuffer: ?VertexBuffer;\n\n constructor(expression: SourceExpression, names: Array, type: string, PaintVertexArray: Class) {\n this.expression = expression;\n this.type = type;\n this.maxValue = 0;\n this.paintVertexAttributes = names.map((name) => ({\n name: `a_${name}`,\n type: 'Float32',\n components: type === 'color' ? 2 : 1,\n offset: 0\n }));\n this.paintVertexArray = new PaintVertexArray();\n }\n\n populatePaintArray(newLength: number, feature: Feature, imagePositions: {[_: string]: ImagePosition}, canonical?: CanonicalTileID, formattedSection?: FormattedSection) {\n const start = this.paintVertexArray.length;\n const value = this.expression.evaluate(new EvaluationParameters(0), feature, {}, canonical, [], formattedSection);\n this.paintVertexArray.resize(newLength);\n this._setPaintValue(start, newLength, value);\n }\n\n updatePaintArray(start: number, end: number, feature: Feature, featureState: FeatureState) {\n const value = this.expression.evaluate({zoom: 0}, feature, featureState);\n this._setPaintValue(start, end, value);\n }\n\n _setPaintValue(start, end, value) {\n if (this.type === 'color') {\n const color = packColor(value);\n for (let i = start; i < end; i++) {\n this.paintVertexArray.emplace(i, color[0], color[1]);\n }\n } else {\n for (let i = start; i < end; i++) {\n this.paintVertexArray.emplace(i, value);\n }\n this.maxValue = Math.max(this.maxValue, Math.abs(value));\n }\n }\n\n upload(context: Context) {\n if (this.paintVertexArray && this.paintVertexArray.arrayBuffer) {\n if (this.paintVertexBuffer && this.paintVertexBuffer.buffer) {\n this.paintVertexBuffer.updateData(this.paintVertexArray);\n } else {\n this.paintVertexBuffer = context.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent);\n }\n }\n }\n\n destroy() {\n if (this.paintVertexBuffer) {\n this.paintVertexBuffer.destroy();\n }\n }\n}\n\nclass CompositeExpressionBinder implements AttributeBinder, UniformBinder {\n expression: CompositeExpression;\n uniformNames: Array;\n type: string;\n useIntegerZoom: boolean;\n zoom: number;\n maxValue: number;\n\n paintVertexArray: StructArray;\n paintVertexAttributes: Array;\n paintVertexBuffer: ?VertexBuffer;\n\n constructor(expression: CompositeExpression, names: Array, type: string, useIntegerZoom: boolean, zoom: number, PaintVertexArray: Class) {\n this.expression = expression;\n this.uniformNames = names.map(name => `u_${name}_t`);\n this.type = type;\n this.useIntegerZoom = useIntegerZoom;\n this.zoom = zoom;\n this.maxValue = 0;\n this.paintVertexAttributes = names.map((name) => ({\n name: `a_${name}`,\n type: 'Float32',\n components: type === 'color' ? 4 : 2,\n offset: 0\n }));\n this.paintVertexArray = new PaintVertexArray();\n }\n\n populatePaintArray(newLength: number, feature: Feature, imagePositions: {[_: string]: ImagePosition}, canonical?: CanonicalTileID, formattedSection?: FormattedSection) {\n const min = this.expression.evaluate(new EvaluationParameters(this.zoom), feature, {}, canonical, [], formattedSection);\n const max = this.expression.evaluate(new EvaluationParameters(this.zoom + 1), feature, {}, canonical, [], formattedSection);\n const start = this.paintVertexArray.length;\n this.paintVertexArray.resize(newLength);\n this._setPaintValue(start, newLength, min, max);\n }\n\n updatePaintArray(start: number, end: number, feature: Feature, featureState: FeatureState) {\n const min = this.expression.evaluate({zoom: this.zoom}, feature, featureState);\n const max = this.expression.evaluate({zoom: this.zoom + 1}, feature, featureState);\n this._setPaintValue(start, end, min, max);\n }\n\n _setPaintValue(start, end, min, max) {\n if (this.type === 'color') {\n const minColor = packColor(min);\n const maxColor = packColor(max);\n for (let i = start; i < end; i++) {\n this.paintVertexArray.emplace(i, minColor[0], minColor[1], maxColor[0], maxColor[1]);\n }\n } else {\n for (let i = start; i < end; i++) {\n this.paintVertexArray.emplace(i, min, max);\n }\n this.maxValue = Math.max(this.maxValue, Math.abs(min), Math.abs(max));\n }\n }\n\n upload(context: Context) {\n if (this.paintVertexArray && this.paintVertexArray.arrayBuffer) {\n if (this.paintVertexBuffer && this.paintVertexBuffer.buffer) {\n this.paintVertexBuffer.updateData(this.paintVertexArray);\n } else {\n this.paintVertexBuffer = context.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent);\n }\n }\n }\n\n destroy() {\n if (this.paintVertexBuffer) {\n this.paintVertexBuffer.destroy();\n }\n }\n\n setUniform(uniform: Uniform<*>, globals: GlobalProperties): void {\n const currentZoom = this.useIntegerZoom ? Math.floor(globals.zoom) : globals.zoom;\n const factor = clamp(this.expression.interpolationFactor(currentZoom, this.zoom, this.zoom + 1), 0, 1);\n uniform.set(factor);\n }\n\n getBinding(context: Context, location: WebGLUniformLocation, _: string): Uniform1f {\n return new Uniform1f(context, location);\n }\n}\n\nclass CrossFadedCompositeBinder implements AttributeBinder {\n expression: CompositeExpression;\n type: string;\n useIntegerZoom: boolean;\n zoom: number;\n layerId: string;\n\n zoomInPaintVertexArray: StructArray;\n zoomOutPaintVertexArray: StructArray;\n zoomInPaintVertexBuffer: ?VertexBuffer;\n zoomOutPaintVertexBuffer: ?VertexBuffer;\n paintVertexAttributes: Array;\n\n constructor(expression: CompositeExpression, type: string, useIntegerZoom: boolean, zoom: number, PaintVertexArray: Class, layerId: string) {\n this.expression = expression;\n this.type = type;\n this.useIntegerZoom = useIntegerZoom;\n this.zoom = zoom;\n this.layerId = layerId;\n\n this.zoomInPaintVertexArray = new PaintVertexArray();\n this.zoomOutPaintVertexArray = new PaintVertexArray();\n }\n\n populatePaintArray(length: number, feature: Feature, imagePositions: {[_: string]: ImagePosition}) {\n const start = this.zoomInPaintVertexArray.length;\n this.zoomInPaintVertexArray.resize(length);\n this.zoomOutPaintVertexArray.resize(length);\n this._setPaintValues(start, length, feature.patterns && feature.patterns[this.layerId], imagePositions);\n }\n\n updatePaintArray(start: number, end: number, feature: Feature, featureState: FeatureState, imagePositions: {[_: string]: ImagePosition}) {\n this._setPaintValues(start, end, feature.patterns && feature.patterns[this.layerId], imagePositions);\n }\n\n _setPaintValues(start, end, patterns, positions) {\n if (!positions || !patterns) return;\n\n const {min, mid, max} = patterns;\n const imageMin = positions[min];\n const imageMid = positions[mid];\n const imageMax = positions[max];\n if (!imageMin || !imageMid || !imageMax) return;\n\n // We populate two paint arrays because, for cross-faded properties, we don't know which direction\n // we're cross-fading to at layout time. In order to keep vertex attributes to a minimum and not pass\n // unnecessary vertex data to the shaders, we determine which to upload at draw time.\n for (let i = start; i < end; i++) {\n this.zoomInPaintVertexArray.emplace(i,\n imageMid.tl[0], imageMid.tl[1], imageMid.br[0], imageMid.br[1],\n imageMin.tl[0], imageMin.tl[1], imageMin.br[0], imageMin.br[1],\n imageMid.pixelRatio,\n imageMin.pixelRatio,\n );\n this.zoomOutPaintVertexArray.emplace(i,\n imageMid.tl[0], imageMid.tl[1], imageMid.br[0], imageMid.br[1],\n imageMax.tl[0], imageMax.tl[1], imageMax.br[0], imageMax.br[1],\n imageMid.pixelRatio,\n imageMax.pixelRatio,\n );\n }\n }\n\n upload(context: Context) {\n if (this.zoomInPaintVertexArray && this.zoomInPaintVertexArray.arrayBuffer && this.zoomOutPaintVertexArray && this.zoomOutPaintVertexArray.arrayBuffer) {\n this.zoomInPaintVertexBuffer = context.createVertexBuffer(this.zoomInPaintVertexArray, patternAttributes.members, this.expression.isStateDependent);\n this.zoomOutPaintVertexBuffer = context.createVertexBuffer(this.zoomOutPaintVertexArray, patternAttributes.members, this.expression.isStateDependent);\n }\n }\n\n destroy() {\n if (this.zoomOutPaintVertexBuffer) this.zoomOutPaintVertexBuffer.destroy();\n if (this.zoomInPaintVertexBuffer) this.zoomInPaintVertexBuffer.destroy();\n }\n}\n\n/**\n * ProgramConfiguration contains the logic for binding style layer properties and tile\n * layer feature data into GL program uniforms and vertex attributes.\n *\n * Non-data-driven property values are bound to shader uniforms. Data-driven property\n * values are bound to vertex attributes. In order to support a uniform GLSL syntax over\n * both, [Mapbox GL Shaders](https://github.com/mapbox/mapbox-gl-shaders) defines a `#pragma`\n * abstraction, which ProgramConfiguration is responsible for implementing. At runtime,\n * it examines the attributes of a particular layer, combines this with fixed knowledge\n * about how layers of the particular type are implemented, and determines which uniforms\n * and vertex attributes will be required. It can then substitute the appropriate text\n * into the shader source code, create and link a program, and bind the uniforms and\n * vertex attributes in preparation for drawing.\n *\n * When a vector tile is parsed, this same configuration information is used to\n * populate the attribute buffers needed for data-driven styling using the zoom\n * level and feature property data.\n *\n * @private\n */\nexport default class ProgramConfiguration {\n binders: {[_: string]: (AttributeBinder | UniformBinder) };\n cacheKey: string;\n\n _buffers: Array;\n\n constructor(layer: TypedStyleLayer, zoom: number, filterProperties: (_: string) => boolean) {\n this.binders = {};\n this._buffers = [];\n\n const keys = [];\n\n for (const property in layer.paint._values) {\n if (!filterProperties(property)) continue;\n const value = layer.paint.get(property);\n if (!(value instanceof PossiblyEvaluatedPropertyValue) || !supportsPropertyExpression(value.property.specification)) {\n continue;\n }\n const names = paintAttributeNames(property, layer.type);\n const expression = value.value;\n const type = value.property.specification.type;\n const useIntegerZoom = value.property.useIntegerZoom;\n const propType = value.property.specification['property-type'];\n const isCrossFaded = propType === 'cross-faded' || propType === 'cross-faded-data-driven';\n\n if (expression.kind === 'constant') {\n this.binders[property] = isCrossFaded ?\n new CrossFadedConstantBinder(expression.value, names) :\n new ConstantBinder(expression.value, names, type);\n keys.push(`/u_${property}`);\n\n } else if (expression.kind === 'source' || isCrossFaded) {\n const StructArrayLayout = layoutType(property, type, 'source');\n this.binders[property] = isCrossFaded ?\n new CrossFadedCompositeBinder(expression, type, useIntegerZoom, zoom, StructArrayLayout, layer.id) :\n new SourceExpressionBinder(expression, names, type, StructArrayLayout);\n keys.push(`/a_${property}`);\n\n } else {\n const StructArrayLayout = layoutType(property, type, 'composite');\n this.binders[property] = new CompositeExpressionBinder(expression, names, type, useIntegerZoom, zoom, StructArrayLayout);\n keys.push(`/z_${property}`);\n }\n }\n\n this.cacheKey = keys.sort().join('');\n }\n\n getMaxValue(property: string): number {\n const binder = this.binders[property];\n return binder instanceof SourceExpressionBinder || binder instanceof CompositeExpressionBinder ? binder.maxValue : 0;\n }\n\n populatePaintArrays(newLength: number, feature: Feature, imagePositions: {[_: string]: ImagePosition}, canonical?: CanonicalTileID, formattedSection?: FormattedSection) {\n for (const property in this.binders) {\n const binder = this.binders[property];\n if (binder instanceof SourceExpressionBinder || binder instanceof CompositeExpressionBinder || binder instanceof CrossFadedCompositeBinder)\n (binder: AttributeBinder).populatePaintArray(newLength, feature, imagePositions, canonical, formattedSection);\n }\n }\n setConstantPatternPositions(posTo: ImagePosition, posFrom: ImagePosition) {\n for (const property in this.binders) {\n const binder = this.binders[property];\n if (binder instanceof CrossFadedConstantBinder)\n binder.setConstantPatternPositions(posTo, posFrom);\n }\n }\n\n updatePaintArrays(featureStates: FeatureStates, featureMap: FeaturePositionMap, vtLayer: VectorTileLayer, layer: TypedStyleLayer, imagePositions: {[_: string]: ImagePosition}): boolean {\n let dirty: boolean = false;\n for (const id in featureStates) {\n const positions = featureMap.getPositions(id);\n\n for (const pos of positions) {\n const feature = vtLayer.feature(pos.index);\n\n for (const property in this.binders) {\n const binder = this.binders[property];\n if ((binder instanceof SourceExpressionBinder || binder instanceof CompositeExpressionBinder ||\n binder instanceof CrossFadedCompositeBinder) && (binder: any).expression.isStateDependent === true) {\n //AHM: Remove after https://github.com/mapbox/mapbox-gl-js/issues/6255\n const value = layer.paint.get(property);\n (binder: any).expression = value.value;\n (binder: AttributeBinder).updatePaintArray(pos.start, pos.end, feature, featureStates[id], imagePositions);\n dirty = true;\n }\n }\n }\n }\n return dirty;\n }\n\n defines(): Array {\n const result = [];\n for (const property in this.binders) {\n const binder = this.binders[property];\n if (binder instanceof ConstantBinder || binder instanceof CrossFadedConstantBinder) {\n result.push(...binder.uniformNames.map(name => `#define HAS_UNIFORM_${name}`));\n }\n }\n return result;\n }\n\n getBinderAttributes(): Array {\n const result = [];\n for (const property in this.binders) {\n const binder = this.binders[property];\n if (binder instanceof SourceExpressionBinder || binder instanceof CompositeExpressionBinder) {\n for (let i = 0; i < binder.paintVertexAttributes.length; i++) {\n result.push(binder.paintVertexAttributes[i].name);\n }\n } else if (binder instanceof CrossFadedCompositeBinder) {\n for (let i = 0; i < patternAttributes.members.length; i++) {\n result.push(patternAttributes.members[i].name);\n }\n }\n }\n return result;\n }\n\n getBinderUniforms(): Array {\n const uniforms = [];\n for (const property in this.binders) {\n const binder = this.binders[property];\n if (binder instanceof ConstantBinder || binder instanceof CrossFadedConstantBinder || binder instanceof CompositeExpressionBinder) {\n for (const uniformName of binder.uniformNames) {\n uniforms.push(uniformName);\n }\n }\n }\n return uniforms;\n }\n\n getPaintVertexBuffers(): Array {\n return this._buffers;\n }\n\n getUniforms(context: Context, locations: UniformLocations): Array {\n const uniforms = [];\n for (const property in this.binders) {\n const binder = this.binders[property];\n if (binder instanceof ConstantBinder || binder instanceof CrossFadedConstantBinder || binder instanceof CompositeExpressionBinder) {\n for (const name of binder.uniformNames) {\n if (locations[name]) {\n const binding = binder.getBinding(context, locations[name], name);\n uniforms.push({name, property, binding});\n }\n }\n }\n }\n return uniforms;\n }\n\n setUniforms(context: Context, binderUniforms: Array, properties: PossiblyEvaluated, globals: GlobalProperties) {\n // Uniform state bindings are owned by the Program, but we set them\n // from within the ProgramConfiguraton's binder members.\n for (const {name, property, binding} of binderUniforms) {\n (this.binders[property]: any).setUniform(binding, globals, properties.get(property), name);\n }\n }\n\n updatePaintBuffers(crossfade?: CrossfadeParameters) {\n this._buffers = [];\n\n for (const property in this.binders) {\n const binder = this.binders[property];\n if (crossfade && binder instanceof CrossFadedCompositeBinder) {\n const patternVertexBuffer = crossfade.fromScale === 2 ? binder.zoomInPaintVertexBuffer : binder.zoomOutPaintVertexBuffer;\n if (patternVertexBuffer) this._buffers.push(patternVertexBuffer);\n\n } else if ((binder instanceof SourceExpressionBinder || binder instanceof CompositeExpressionBinder) && binder.paintVertexBuffer) {\n this._buffers.push(binder.paintVertexBuffer);\n }\n }\n }\n\n upload(context: Context) {\n for (const property in this.binders) {\n const binder = this.binders[property];\n if (binder instanceof SourceExpressionBinder || binder instanceof CompositeExpressionBinder || binder instanceof CrossFadedCompositeBinder)\n binder.upload(context);\n }\n this.updatePaintBuffers();\n }\n\n destroy() {\n for (const property in this.binders) {\n const binder = this.binders[property];\n if (binder instanceof SourceExpressionBinder || binder instanceof CompositeExpressionBinder || binder instanceof CrossFadedCompositeBinder)\n binder.destroy();\n }\n }\n}\n\nexport class ProgramConfigurationSet {\n programConfigurations: {[_: string]: ProgramConfiguration};\n needsUpload: boolean;\n _featureMap: FeaturePositionMap;\n _bufferOffset: number;\n\n constructor(layers: $ReadOnlyArray, zoom: number, filterProperties: (_: string) => boolean = () => true) {\n this.programConfigurations = {};\n for (const layer of layers) {\n this.programConfigurations[layer.id] = new ProgramConfiguration(layer, zoom, filterProperties);\n }\n this.needsUpload = false;\n this._featureMap = new FeaturePositionMap();\n this._bufferOffset = 0;\n }\n\n populatePaintArrays(length: number, feature: Feature, index: number, imagePositions: {[_: string]: ImagePosition}, canonical: CanonicalTileID, formattedSection?: FormattedSection) {\n for (const key in this.programConfigurations) {\n this.programConfigurations[key].populatePaintArrays(length, feature, imagePositions, canonical, formattedSection);\n }\n\n if (feature.id !== undefined) {\n this._featureMap.add(feature.id, index, this._bufferOffset, length);\n }\n this._bufferOffset = length;\n\n this.needsUpload = true;\n }\n\n updatePaintArrays(featureStates: FeatureStates, vtLayer: VectorTileLayer, layers: $ReadOnlyArray, imagePositions: {[_: string]: ImagePosition}) {\n for (const layer of layers) {\n this.needsUpload = this.programConfigurations[layer.id].updatePaintArrays(featureStates, this._featureMap, vtLayer, layer, imagePositions) || this.needsUpload;\n }\n }\n\n get(layerId: string) {\n return this.programConfigurations[layerId];\n }\n\n upload(context: Context) {\n if (!this.needsUpload) return;\n for (const layerId in this.programConfigurations) {\n this.programConfigurations[layerId].upload(context);\n }\n this.needsUpload = false;\n }\n\n destroy() {\n for (const layerId in this.programConfigurations) {\n this.programConfigurations[layerId].destroy();\n }\n }\n}\n\nfunction paintAttributeNames(property, type) {\n const attributeNameExceptions = {\n 'text-opacity': ['opacity'],\n 'icon-opacity': ['opacity'],\n 'text-color': ['fill_color'],\n 'icon-color': ['fill_color'],\n 'text-halo-color': ['halo_color'],\n 'icon-halo-color': ['halo_color'],\n 'text-halo-blur': ['halo_blur'],\n 'icon-halo-blur': ['halo_blur'],\n 'text-halo-width': ['halo_width'],\n 'icon-halo-width': ['halo_width'],\n 'line-gap-width': ['gapwidth'],\n 'line-pattern': ['pattern_to', 'pattern_from', 'pixel_ratio_to', 'pixel_ratio_from'],\n 'fill-pattern': ['pattern_to', 'pattern_from', 'pixel_ratio_to', 'pixel_ratio_from'],\n 'fill-extrusion-pattern': ['pattern_to', 'pattern_from', 'pixel_ratio_to', 'pixel_ratio_from'],\n };\n\n return attributeNameExceptions[property] || [property.replace(`${type}-`, '').replace(/-/g, '_')];\n}\n\nfunction getLayoutException(property) {\n const propertyExceptions = {\n 'line-pattern':{\n 'source': PatternLayoutArray,\n 'composite': PatternLayoutArray\n },\n 'fill-pattern': {\n 'source': PatternLayoutArray,\n 'composite': PatternLayoutArray\n },\n 'fill-extrusion-pattern':{\n 'source': PatternLayoutArray,\n 'composite': PatternLayoutArray\n }\n };\n\n return propertyExceptions[property];\n}\n\nfunction layoutType(property, type, binderType) {\n const defaultLayouts = {\n 'color': {\n 'source': StructArrayLayout2f8,\n 'composite': StructArrayLayout4f16\n },\n 'number': {\n 'source': StructArrayLayout1f4,\n 'composite': StructArrayLayout2f8\n }\n };\n\n const layoutException = getLayoutException(property);\n return layoutException && layoutException[binderType] || defaultLayouts[type][binderType];\n}\n\nregister('ConstantBinder', ConstantBinder);\nregister('CrossFadedConstantBinder', CrossFadedConstantBinder);\nregister('SourceExpressionBinder', SourceExpressionBinder);\nregister('CrossFadedCompositeBinder', CrossFadedCompositeBinder);\nregister('CompositeExpressionBinder', CompositeExpressionBinder);\nregister('ProgramConfiguration', ProgramConfiguration, {omit: ['_buffers']});\nregister('ProgramConfigurationSet', ProgramConfigurationSet);\n","// @flow\n\n/**\n * The maximum value of a coordinate in the internal tile coordinate system. Coordinates of\n * all source features normalized to this extent upon load.\n *\n * The value is a consequence of the following:\n *\n * * Vertex buffer store positions as signed 16 bit integers.\n * * One bit is lost for signedness to support tile buffers.\n * * One bit is lost because the line vertex buffer used to pack 1 bit of other data into the int.\n * * One bit is lost to support features extending past the extent on the right edge of the tile.\n * * This leaves us with 2^13 = 8192\n *\n * @private\n * @readonly\n */\nexport default 8192;\n","// @flow\n\nimport {warnOnce, clamp} from '../util/util';\n\nimport EXTENT from './extent';\n\nimport type Point from '@mapbox/point-geometry';\n\n// These bounds define the minimum and maximum supported coordinate values.\n// While visible coordinates are within [0, EXTENT], tiles may theoretically\n// contain cordinates within [-Infinity, Infinity]. Our range is limited by the\n// number of bits used to represent the coordinate.\nconst BITS = 15;\nconst MAX = Math.pow(2, BITS - 1) - 1;\nconst MIN = -MAX - 1;\n\n/**\n * Loads a geometry from a VectorTileFeature and scales it to the common extent\n * used internally.\n * @param {VectorTileFeature} feature\n * @private\n */\nexport default function loadGeometry(feature: VectorTileFeature): Array> {\n const scale = EXTENT / feature.extent;\n const geometry = feature.loadGeometry();\n for (let r = 0; r < geometry.length; r++) {\n const ring = geometry[r];\n for (let p = 0; p < ring.length; p++) {\n const point = ring[p];\n // round here because mapbox-gl-native uses integers to represent\n // points and we need to do the same to avoid renering differences.\n const x = Math.round(point.x * scale);\n const y = Math.round(point.y * scale);\n\n point.x = clamp(x, MIN, MAX);\n point.y = clamp(y, MIN, MAX);\n\n if (x < point.x || x > point.x + 1 || y < point.y || y > point.y + 1) {\n // warn when exceeding allowed extent except for the 1-px-off case\n // https://github.com/mapbox/mapbox-gl-js/issues/8992\n warnOnce('Geometry exceeds allowed extent, reduce your vector tile buffer size');\n }\n }\n }\n return geometry;\n}\n","// @flow\n\nimport loadGeometry from './load_geometry';\n\ntype EvaluationFeature = {\n +type: 1 | 2 | 3 | 'Unknown' | 'Point' | 'MultiPoint' | 'LineString' | 'MultiLineString' | 'Polygon' | 'MultiPolygon',\n +id?: any,\n +properties: {[_: string]: any},\n +patterns?: {[_: string]: {\"min\": string, \"mid\": string, \"max\": string}},\n geometry: Array>\n};\n\n/**\n * Construct a new feature based on a VectorTileFeature for expression evaluation, the geometry of which\n * will be loaded based on necessity.\n * @param {VectorTileFeature} feature\n * @param {boolean} needGeometry\n * @private\n */\nexport default function toEvaluationFeature(feature: VectorTileFeature, needGeometry: boolean): EvaluationFeature {\n return {type: feature.type,\n id: feature.id,\n properties:feature.properties,\n geometry: needGeometry ? loadGeometry(feature) : []};\n}\n","// @flow\n\nimport {CircleLayoutArray} from '../array_types';\n\nimport {members as layoutAttributes} from './circle_attributes';\nimport SegmentVector from '../segment';\nimport {ProgramConfigurationSet} from '../program_configuration';\nimport {TriangleIndexArray} from '../index_array_type';\nimport loadGeometry from '../load_geometry';\nimport toEvaluationFeature from '../evaluation_feature';\nimport EXTENT from '../extent';\nimport {register} from '../../util/web_worker_transfer';\nimport EvaluationParameters from '../../style/evaluation_parameters';\n\nimport type {CanonicalTileID} from '../../source/tile_id';\nimport type {\n Bucket,\n BucketParameters,\n BucketFeature,\n IndexedFeature,\n PopulateParameters\n} from '../bucket';\nimport type CircleStyleLayer from '../../style/style_layer/circle_style_layer';\nimport type HeatmapStyleLayer from '../../style/style_layer/heatmap_style_layer';\nimport type Context from '../../gl/context';\nimport type IndexBuffer from '../../gl/index_buffer';\nimport type VertexBuffer from '../../gl/vertex_buffer';\nimport type Point from '@mapbox/point-geometry';\nimport type {FeatureStates} from '../../source/source_state';\nimport type {ImagePosition} from '../../render/image_atlas';\n\nfunction addCircleVertex(layoutVertexArray, x, y, extrudeX, extrudeY) {\n layoutVertexArray.emplaceBack(\n (x * 2) + ((extrudeX + 1) / 2),\n (y * 2) + ((extrudeY + 1) / 2));\n}\n\n/**\n * Circles are represented by two triangles.\n *\n * Each corner has a pos that is the center of the circle and an extrusion\n * vector that is where it points.\n * @private\n */\nclass CircleBucket implements Bucket {\n index: number;\n zoom: number;\n overscaling: number;\n layerIds: Array;\n layers: Array;\n stateDependentLayers: Array;\n stateDependentLayerIds: Array;\n\n layoutVertexArray: CircleLayoutArray;\n layoutVertexBuffer: VertexBuffer;\n\n indexArray: TriangleIndexArray;\n indexBuffer: IndexBuffer;\n\n hasPattern: boolean;\n programConfigurations: ProgramConfigurationSet;\n segments: SegmentVector;\n uploaded: boolean;\n\n constructor(options: BucketParameters) {\n this.zoom = options.zoom;\n this.overscaling = options.overscaling;\n this.layers = options.layers;\n this.layerIds = this.layers.map(layer => layer.id);\n this.index = options.index;\n this.hasPattern = false;\n\n this.layoutVertexArray = new CircleLayoutArray();\n this.indexArray = new TriangleIndexArray();\n this.segments = new SegmentVector();\n this.programConfigurations = new ProgramConfigurationSet(options.layers, options.zoom);\n this.stateDependentLayerIds = this.layers.filter((l) => l.isStateDependent()).map((l) => l.id);\n }\n\n populate(features: Array, options: PopulateParameters, canonical: CanonicalTileID) {\n const styleLayer = this.layers[0];\n const bucketFeatures = [];\n let circleSortKey = null;\n let sortFeaturesByKey = false;\n\n // Heatmap layers are handled in this bucket and have no evaluated properties, so we check our access\n if (styleLayer.type === 'circle') {\n circleSortKey = ((styleLayer: any): CircleStyleLayer).layout.get('circle-sort-key');\n sortFeaturesByKey = !circleSortKey.isConstant();\n }\n\n for (const {feature, id, index, sourceLayerIndex} of features) {\n const needGeometry = this.layers[0]._featureFilter.needGeometry;\n const evaluationFeature = toEvaluationFeature(feature, needGeometry);\n\n if (!this.layers[0]._featureFilter.filter(new EvaluationParameters(this.zoom), evaluationFeature, canonical)) continue;\n\n const sortKey = sortFeaturesByKey ?\n // $FlowFixMe\n circleSortKey.evaluate(evaluationFeature, {}, canonical) :\n undefined;\n\n const bucketFeature: BucketFeature = {\n id,\n properties: feature.properties,\n type: feature.type,\n sourceLayerIndex,\n index,\n geometry: needGeometry ? evaluationFeature.geometry : loadGeometry(feature),\n patterns: {},\n sortKey\n };\n\n bucketFeatures.push(bucketFeature);\n\n }\n\n if (sortFeaturesByKey) {\n bucketFeatures.sort((a, b) => {\n // a.sortKey is always a number when in use\n return ((a.sortKey: any): number) - ((b.sortKey: any): number);\n });\n }\n\n for (const bucketFeature of bucketFeatures) {\n const {geometry, index, sourceLayerIndex} = bucketFeature;\n const feature = features[index].feature;\n\n this.addFeature(bucketFeature, geometry, index, canonical);\n options.featureIndex.insert(feature, geometry, index, sourceLayerIndex, this.index);\n }\n }\n\n update(states: FeatureStates, vtLayer: VectorTileLayer, imagePositions: {[_: string]: ImagePosition}) {\n if (!this.stateDependentLayers.length) return;\n this.programConfigurations.updatePaintArrays(states, vtLayer, this.stateDependentLayers, imagePositions);\n }\n\n isEmpty() {\n return this.layoutVertexArray.length === 0;\n }\n\n uploadPending() {\n return !this.uploaded || this.programConfigurations.needsUpload;\n }\n\n upload(context: Context) {\n if (!this.uploaded) {\n this.layoutVertexBuffer = context.createVertexBuffer(this.layoutVertexArray, layoutAttributes);\n this.indexBuffer = context.createIndexBuffer(this.indexArray);\n }\n this.programConfigurations.upload(context);\n this.uploaded = true;\n }\n\n destroy() {\n if (!this.layoutVertexBuffer) return;\n this.layoutVertexBuffer.destroy();\n this.indexBuffer.destroy();\n this.programConfigurations.destroy();\n this.segments.destroy();\n }\n\n addFeature(feature: BucketFeature, geometry: Array>, index: number, canonical: CanonicalTileID) {\n for (const ring of geometry) {\n for (const point of ring) {\n const x = point.x;\n const y = point.y;\n\n // Do not include points that are outside the tile boundaries.\n if (x < 0 || x >= EXTENT || y < 0 || y >= EXTENT) continue;\n\n // this geometry will be of the Point type, and we'll derive\n // two triangles from it.\n //\n // ┌─────────┐\n // │ 3 2 │\n // │ │\n // │ 0 1 │\n // └─────────┘\n\n const segment = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray, feature.sortKey);\n const index = segment.vertexLength;\n\n addCircleVertex(this.layoutVertexArray, x, y, -1, -1);\n addCircleVertex(this.layoutVertexArray, x, y, 1, -1);\n addCircleVertex(this.layoutVertexArray, x, y, 1, 1);\n addCircleVertex(this.layoutVertexArray, x, y, -1, 1);\n\n this.indexArray.emplaceBack(index, index + 1, index + 2);\n this.indexArray.emplaceBack(index, index + 3, index + 2);\n\n segment.vertexLength += 4;\n segment.primitiveLength += 2;\n }\n }\n\n this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, feature, index, {}, canonical);\n }\n}\n\nregister('CircleBucket', CircleBucket, {omit: ['layers']});\n\nexport default CircleBucket;\n","// @flow\n\nimport {isCounterClockwise} from './util';\n\nimport Point from '@mapbox/point-geometry';\n\nexport {polygonIntersectsBufferedPoint, polygonIntersectsMultiPolygon, polygonIntersectsBufferedMultiLine, polygonIntersectsPolygon, distToSegmentSquared, polygonIntersectsBox};\n\ntype Line = Array;\ntype MultiLine = Array;\ntype Ring = Array;\ntype Polygon = Array;\ntype MultiPolygon = Array;\n\nfunction polygonIntersectsPolygon(polygonA: Polygon, polygonB: Polygon) {\n for (let i = 0; i < polygonA.length; i++) {\n if (polygonContainsPoint(polygonB, polygonA[i])) return true;\n }\n\n for (let i = 0; i < polygonB.length; i++) {\n if (polygonContainsPoint(polygonA, polygonB[i])) return true;\n }\n\n if (lineIntersectsLine(polygonA, polygonB)) return true;\n\n return false;\n}\n\nfunction polygonIntersectsBufferedPoint(polygon: Polygon, point: Point, radius: number) {\n if (polygonContainsPoint(polygon, point)) return true;\n if (pointIntersectsBufferedLine(point, polygon, radius)) return true;\n return false;\n}\n\nfunction polygonIntersectsMultiPolygon(polygon: Polygon, multiPolygon: MultiPolygon) {\n\n if (polygon.length === 1) {\n return multiPolygonContainsPoint(multiPolygon, polygon[0]);\n }\n\n for (let m = 0; m < multiPolygon.length; m++) {\n const ring = multiPolygon[m];\n for (let n = 0; n < ring.length; n++) {\n if (polygonContainsPoint(polygon, ring[n])) return true;\n }\n }\n\n for (let i = 0; i < polygon.length; i++) {\n if (multiPolygonContainsPoint(multiPolygon, polygon[i])) return true;\n }\n\n for (let k = 0; k < multiPolygon.length; k++) {\n if (lineIntersectsLine(polygon, multiPolygon[k])) return true;\n }\n\n return false;\n}\n\nfunction polygonIntersectsBufferedMultiLine(polygon: Polygon, multiLine: MultiLine, radius: number) {\n for (let i = 0; i < multiLine.length; i++) {\n const line = multiLine[i];\n\n if (polygon.length >= 3) {\n for (let k = 0; k < line.length; k++) {\n if (polygonContainsPoint(polygon, line[k])) return true;\n }\n }\n\n if (lineIntersectsBufferedLine(polygon, line, radius)) return true;\n }\n return false;\n}\n\nfunction lineIntersectsBufferedLine(lineA: Line, lineB: Line, radius: number) {\n\n if (lineA.length > 1) {\n if (lineIntersectsLine(lineA, lineB)) return true;\n\n // Check whether any point in either line is within radius of the other line\n for (let j = 0; j < lineB.length; j++) {\n if (pointIntersectsBufferedLine(lineB[j], lineA, radius)) return true;\n }\n }\n\n for (let k = 0; k < lineA.length; k++) {\n if (pointIntersectsBufferedLine(lineA[k], lineB, radius)) return true;\n }\n\n return false;\n}\n\nfunction lineIntersectsLine(lineA: Line, lineB: Line) {\n if (lineA.length === 0 || lineB.length === 0) return false;\n for (let i = 0; i < lineA.length - 1; i++) {\n const a0 = lineA[i];\n const a1 = lineA[i + 1];\n for (let j = 0; j < lineB.length - 1; j++) {\n const b0 = lineB[j];\n const b1 = lineB[j + 1];\n if (lineSegmentIntersectsLineSegment(a0, a1, b0, b1)) return true;\n }\n }\n return false;\n}\n\nfunction lineSegmentIntersectsLineSegment(a0: Point, a1: Point, b0: Point, b1: Point) {\n return isCounterClockwise(a0, b0, b1) !== isCounterClockwise(a1, b0, b1) &&\n isCounterClockwise(a0, a1, b0) !== isCounterClockwise(a0, a1, b1);\n}\n\nfunction pointIntersectsBufferedLine(p: Point, line: Line, radius: number) {\n const radiusSquared = radius * radius;\n\n if (line.length === 1) return p.distSqr(line[0]) < radiusSquared;\n\n for (let i = 1; i < line.length; i++) {\n // Find line segments that have a distance <= radius^2 to p\n // In that case, we treat the line as \"containing point p\".\n const v = line[i - 1], w = line[i];\n if (distToSegmentSquared(p, v, w) < radiusSquared) return true;\n }\n return false;\n}\n\n// Code from http://stackoverflow.com/a/1501725/331379.\nfunction distToSegmentSquared(p: Point, v: Point, w: Point) {\n const l2 = v.distSqr(w);\n if (l2 === 0) return p.distSqr(v);\n const t = ((p.x - v.x) * (w.x - v.x) + (p.y - v.y) * (w.y - v.y)) / l2;\n if (t < 0) return p.distSqr(v);\n if (t > 1) return p.distSqr(w);\n return p.distSqr(w.sub(v)._mult(t)._add(v));\n}\n\n// point in polygon ray casting algorithm\nfunction multiPolygonContainsPoint(rings: Array, p: Point) {\n let c = false,\n ring, p1, p2;\n\n for (let k = 0; k < rings.length; k++) {\n ring = rings[k];\n for (let i = 0, j = ring.length - 1; i < ring.length; j = i++) {\n p1 = ring[i];\n p2 = ring[j];\n if (((p1.y > p.y) !== (p2.y > p.y)) && (p.x < (p2.x - p1.x) * (p.y - p1.y) / (p2.y - p1.y) + p1.x)) {\n c = !c;\n }\n }\n }\n return c;\n}\n\nfunction polygonContainsPoint(ring: Ring, p: Point) {\n let c = false;\n for (let i = 0, j = ring.length - 1; i < ring.length; j = i++) {\n const p1 = ring[i];\n const p2 = ring[j];\n if (((p1.y > p.y) !== (p2.y > p.y)) && (p.x < (p2.x - p1.x) * (p.y - p1.y) / (p2.y - p1.y) + p1.x)) {\n c = !c;\n }\n }\n return c;\n}\n\nfunction polygonIntersectsBox(ring: Ring, boxX1: number, boxY1: number, boxX2: number, boxY2: number) {\n for (const p of ring) {\n if (boxX1 <= p.x &&\n boxY1 <= p.y &&\n boxX2 >= p.x &&\n boxY2 >= p.y) return true;\n }\n\n const corners = [\n new Point(boxX1, boxY1),\n new Point(boxX1, boxY2),\n new Point(boxX2, boxY2),\n new Point(boxX2, boxY1)];\n\n if (ring.length > 2) {\n for (const corner of corners) {\n if (polygonContainsPoint(ring, corner)) return true;\n }\n }\n\n for (let i = 0; i < ring.length - 1; i++) {\n const p1 = ring[i];\n const p2 = ring[i + 1];\n if (edgeIntersectsBox(p1, p2, corners)) return true;\n }\n\n return false;\n}\n\nfunction edgeIntersectsBox(e1: Point, e2: Point, corners: Array) {\n const tl = corners[0];\n const br = corners[2];\n // the edge and box do not intersect in either the x or y dimensions\n if (((e1.x < tl.x) && (e2.x < tl.x)) ||\n ((e1.x > br.x) && (e2.x > br.x)) ||\n ((e1.y < tl.y) && (e2.y < tl.y)) ||\n ((e1.y > br.y) && (e2.y > br.y))) return false;\n\n // check if all corners of the box are on the same side of the edge\n const dir = isCounterClockwise(e1, e2, corners[0]);\n return dir !== isCounterClockwise(e1, e2, corners[1]) ||\n dir !== isCounterClockwise(e1, e2, corners[2]) ||\n dir !== isCounterClockwise(e1, e2, corners[3]);\n}\n","// @flow\n\nimport Point from '@mapbox/point-geometry';\n\nimport type {PossiblyEvaluatedPropertyValue} from \"./properties\";\nimport type StyleLayer from '../style/style_layer';\nimport type CircleBucket from '../data/bucket/circle_bucket';\nimport type LineBucket from '../data/bucket/line_bucket';\n\nexport function getMaximumPaintValue(property: string, layer: StyleLayer, bucket: CircleBucket<*> | LineBucket): number {\n const value = ((layer.paint: any).get(property): PossiblyEvaluatedPropertyValue).value;\n if (value.kind === 'constant') {\n return value.value;\n } else {\n return bucket.programConfigurations.get(layer.id).getMaxValue(property);\n }\n}\n\nexport function translateDistance(translate: [number, number]) {\n return Math.sqrt(translate[0] * translate[0] + translate[1] * translate[1]);\n}\n\nexport function translate(queryGeometry: Array,\n translate: [number, number],\n translateAnchor: 'viewport' | 'map',\n bearing: number,\n pixelsToTileUnits: number) {\n if (!translate[0] && !translate[1]) {\n return queryGeometry;\n }\n const pt = Point.convert(translate)._mult(pixelsToTileUnits);\n\n if (translateAnchor === \"viewport\") {\n pt._rotate(-bearing);\n }\n\n const translated = [];\n for (let i = 0; i < queryGeometry.length; i++) {\n const point = queryGeometry[i];\n translated.push(point.sub(pt));\n }\n return translated;\n}\n","// This file is generated. Edit build/generate-style-code.js, then run `yarn run codegen`.\n// @flow\n/* eslint-disable */\n\nimport styleSpec from '../../style-spec/reference/latest';\n\nimport {\n Properties,\n DataConstantProperty,\n DataDrivenProperty,\n CrossFadedDataDrivenProperty,\n CrossFadedProperty,\n ColorRampProperty\n} from '../properties';\n\nimport type Color from '../../style-spec/util/color';\n\nimport type Formatted from '../../style-spec/expression/types/formatted';\n\nimport type ResolvedImage from '../../style-spec/expression/types/resolved_image';\n\nexport type LayoutProps = {|\n \"circle-sort-key\": DataDrivenProperty,\n|};\n\nconst layout: Properties = new Properties({\n \"circle-sort-key\": new DataDrivenProperty(styleSpec[\"layout_circle\"][\"circle-sort-key\"]),\n});\n\nexport type PaintProps = {|\n \"circle-radius\": DataDrivenProperty,\n \"circle-color\": DataDrivenProperty,\n \"circle-blur\": DataDrivenProperty,\n \"circle-opacity\": DataDrivenProperty,\n \"circle-translate\": DataConstantProperty<[number, number]>,\n \"circle-translate-anchor\": DataConstantProperty<\"map\" | \"viewport\">,\n \"circle-pitch-scale\": DataConstantProperty<\"map\" | \"viewport\">,\n \"circle-pitch-alignment\": DataConstantProperty<\"map\" | \"viewport\">,\n \"circle-stroke-width\": DataDrivenProperty,\n \"circle-stroke-color\": DataDrivenProperty,\n \"circle-stroke-opacity\": DataDrivenProperty,\n|};\n\nconst paint: Properties = new Properties({\n \"circle-radius\": new DataDrivenProperty(styleSpec[\"paint_circle\"][\"circle-radius\"]),\n \"circle-color\": new DataDrivenProperty(styleSpec[\"paint_circle\"][\"circle-color\"]),\n \"circle-blur\": new DataDrivenProperty(styleSpec[\"paint_circle\"][\"circle-blur\"]),\n \"circle-opacity\": new DataDrivenProperty(styleSpec[\"paint_circle\"][\"circle-opacity\"]),\n \"circle-translate\": new DataConstantProperty(styleSpec[\"paint_circle\"][\"circle-translate\"]),\n \"circle-translate-anchor\": new DataConstantProperty(styleSpec[\"paint_circle\"][\"circle-translate-anchor\"]),\n \"circle-pitch-scale\": new DataConstantProperty(styleSpec[\"paint_circle\"][\"circle-pitch-scale\"]),\n \"circle-pitch-alignment\": new DataConstantProperty(styleSpec[\"paint_circle\"][\"circle-pitch-alignment\"]),\n \"circle-stroke-width\": new DataDrivenProperty(styleSpec[\"paint_circle\"][\"circle-stroke-width\"]),\n \"circle-stroke-color\": new DataDrivenProperty(styleSpec[\"paint_circle\"][\"circle-stroke-color\"]),\n \"circle-stroke-opacity\": new DataDrivenProperty(styleSpec[\"paint_circle\"][\"circle-stroke-opacity\"]),\n});\n\n// Note: without adding the explicit type annotation, Flow infers weaker types\n// for these objects from their use in the constructor to StyleLayer, as\n// {layout?: Properties<...>, paint: Properties<...>}\nexport default ({ paint, layout }: $Exact<{\n paint: Properties, layout: Properties\n}>);\n","/**\r\n * Common utilities\r\n * @module glMatrix\r\n */\n// Configuration Constants\nexport var EPSILON = 0.000001;\nexport var ARRAY_TYPE = typeof Float32Array !== 'undefined' ? Float32Array : Array;\nexport var RANDOM = Math.random;\n/**\r\n * Sets the type of array used when creating new vectors and matrices\r\n *\r\n * @param {Type} type Array type, such as Float32Array or Array\r\n */\n\nexport function setMatrixArrayType(type) {\n ARRAY_TYPE = type;\n}\nvar degree = Math.PI / 180;\n/**\r\n * Convert Degree To Radian\r\n *\r\n * @param {Number} a Angle in Degrees\r\n */\n\nexport function toRadian(a) {\n return a * degree;\n}\n/**\r\n * Tests whether or not the arguments have approximately the same value, within an absolute\r\n * or relative tolerance of glMatrix.EPSILON (an absolute tolerance is used for values less\r\n * than or equal to 1.0, and a relative tolerance is used for larger values)\r\n *\r\n * @param {Number} a The first number to test.\r\n * @param {Number} b The second number to test.\r\n * @returns {Boolean} True if the numbers are approximately equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n return Math.abs(a - b) <= EPSILON * Math.max(1.0, Math.abs(a), Math.abs(b));\n}\nif (!Math.hypot) Math.hypot = function () {\n var y = 0,\n i = arguments.length;\n\n while (i--) {\n y += arguments[i] * arguments[i];\n }\n\n return Math.sqrt(y);\n};","import * as glMatrix from \"./common.js\";\n/**\r\n * 4x4 Matrix
Format: column-major, when typed out it looks like row-major
The matrices are being post multiplied.\r\n * @module mat4\r\n */\n\n/**\r\n * Creates a new identity mat4\r\n *\r\n * @returns {mat4} a new 4x4 matrix\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(16);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n }\n\n out[0] = 1;\n out[5] = 1;\n out[10] = 1;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a new mat4 initialized with values from an existing matrix\r\n *\r\n * @param {mat4} a matrix to clone\r\n * @returns {mat4} a new 4x4 matrix\r\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(16);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\r\n * Copy the values from one mat4 to another\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the source matrix\r\n * @returns {mat4} out\r\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\r\n * Create a new mat4 with the given values\r\n *\r\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\r\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\r\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\r\n * @param {Number} m03 Component in column 0, row 3 position (index 3)\r\n * @param {Number} m10 Component in column 1, row 0 position (index 4)\r\n * @param {Number} m11 Component in column 1, row 1 position (index 5)\r\n * @param {Number} m12 Component in column 1, row 2 position (index 6)\r\n * @param {Number} m13 Component in column 1, row 3 position (index 7)\r\n * @param {Number} m20 Component in column 2, row 0 position (index 8)\r\n * @param {Number} m21 Component in column 2, row 1 position (index 9)\r\n * @param {Number} m22 Component in column 2, row 2 position (index 10)\r\n * @param {Number} m23 Component in column 2, row 3 position (index 11)\r\n * @param {Number} m30 Component in column 3, row 0 position (index 12)\r\n * @param {Number} m31 Component in column 3, row 1 position (index 13)\r\n * @param {Number} m32 Component in column 3, row 2 position (index 14)\r\n * @param {Number} m33 Component in column 3, row 3 position (index 15)\r\n * @returns {mat4} A new mat4\r\n */\n\nexport function fromValues(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {\n var out = new glMatrix.ARRAY_TYPE(16);\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m03;\n out[4] = m10;\n out[5] = m11;\n out[6] = m12;\n out[7] = m13;\n out[8] = m20;\n out[9] = m21;\n out[10] = m22;\n out[11] = m23;\n out[12] = m30;\n out[13] = m31;\n out[14] = m32;\n out[15] = m33;\n return out;\n}\n/**\r\n * Set the components of a mat4 to the given values\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\r\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\r\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\r\n * @param {Number} m03 Component in column 0, row 3 position (index 3)\r\n * @param {Number} m10 Component in column 1, row 0 position (index 4)\r\n * @param {Number} m11 Component in column 1, row 1 position (index 5)\r\n * @param {Number} m12 Component in column 1, row 2 position (index 6)\r\n * @param {Number} m13 Component in column 1, row 3 position (index 7)\r\n * @param {Number} m20 Component in column 2, row 0 position (index 8)\r\n * @param {Number} m21 Component in column 2, row 1 position (index 9)\r\n * @param {Number} m22 Component in column 2, row 2 position (index 10)\r\n * @param {Number} m23 Component in column 2, row 3 position (index 11)\r\n * @param {Number} m30 Component in column 3, row 0 position (index 12)\r\n * @param {Number} m31 Component in column 3, row 1 position (index 13)\r\n * @param {Number} m32 Component in column 3, row 2 position (index 14)\r\n * @param {Number} m33 Component in column 3, row 3 position (index 15)\r\n * @returns {mat4} out\r\n */\n\nexport function set(out, m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m03;\n out[4] = m10;\n out[5] = m11;\n out[6] = m12;\n out[7] = m13;\n out[8] = m20;\n out[9] = m21;\n out[10] = m22;\n out[11] = m23;\n out[12] = m30;\n out[13] = m31;\n out[14] = m32;\n out[15] = m33;\n return out;\n}\n/**\r\n * Set a mat4 to the identity matrix\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @returns {mat4} out\r\n */\n\nexport function identity(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Transpose the values of a mat4\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the source matrix\r\n * @returns {mat4} out\r\n */\n\nexport function transpose(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a12 = a[6],\n a13 = a[7];\n var a23 = a[11];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a01;\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a02;\n out[9] = a12;\n out[11] = a[14];\n out[12] = a03;\n out[13] = a13;\n out[14] = a23;\n } else {\n out[0] = a[0];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a[1];\n out[5] = a[5];\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a[2];\n out[9] = a[6];\n out[10] = a[10];\n out[11] = a[14];\n out[12] = a[3];\n out[13] = a[7];\n out[14] = a[11];\n out[15] = a[15];\n }\n\n return out;\n}\n/**\r\n * Inverts a mat4\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the source matrix\r\n * @returns {mat4} out\r\n */\n\nexport function invert(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n var b00 = a00 * a11 - a01 * a10;\n var b01 = a00 * a12 - a02 * a10;\n var b02 = a00 * a13 - a03 * a10;\n var b03 = a01 * a12 - a02 * a11;\n var b04 = a01 * a13 - a03 * a11;\n var b05 = a02 * a13 - a03 * a12;\n var b06 = a20 * a31 - a21 * a30;\n var b07 = a20 * a32 - a22 * a30;\n var b08 = a20 * a33 - a23 * a30;\n var b09 = a21 * a32 - a22 * a31;\n var b10 = a21 * a33 - a23 * a31;\n var b11 = a22 * a33 - a23 * a32; // Calculate the determinant\n\n var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) {\n return null;\n }\n\n det = 1.0 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n return out;\n}\n/**\r\n * Calculates the adjugate of a mat4\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the source matrix\r\n * @returns {mat4} out\r\n */\n\nexport function adjoint(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n out[0] = a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22);\n out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22));\n out[2] = a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12);\n out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12));\n out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22));\n out[5] = a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22);\n out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12));\n out[7] = a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12);\n out[8] = a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21);\n out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21));\n out[10] = a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11);\n out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11));\n out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21));\n out[13] = a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21);\n out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11));\n out[15] = a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11);\n return out;\n}\n/**\r\n * Calculates the determinant of a mat4\r\n *\r\n * @param {mat4} a the source matrix\r\n * @returns {Number} determinant of a\r\n */\n\nexport function determinant(a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n var b00 = a00 * a11 - a01 * a10;\n var b01 = a00 * a12 - a02 * a10;\n var b02 = a00 * a13 - a03 * a10;\n var b03 = a01 * a12 - a02 * a11;\n var b04 = a01 * a13 - a03 * a11;\n var b05 = a02 * a13 - a03 * a12;\n var b06 = a20 * a31 - a21 * a30;\n var b07 = a20 * a32 - a22 * a30;\n var b08 = a20 * a33 - a23 * a30;\n var b09 = a21 * a32 - a22 * a31;\n var b10 = a21 * a33 - a23 * a31;\n var b11 = a22 * a33 - a23 * a32; // Calculate the determinant\n\n return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n}\n/**\r\n * Multiplies two mat4s\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the first operand\r\n * @param {mat4} b the second operand\r\n * @returns {mat4} out\r\n */\n\nexport function multiply(out, a, b) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15]; // Cache only the current line of the second matrix\n\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[4];\n b1 = b[5];\n b2 = b[6];\n b3 = b[7];\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[8];\n b1 = b[9];\n b2 = b[10];\n b3 = b[11];\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[12];\n b1 = b[13];\n b2 = b[14];\n b3 = b[15];\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n return out;\n}\n/**\r\n * Translate a mat4 by the given vector\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to translate\r\n * @param {vec3} v vector to translate by\r\n * @returns {mat4} out\r\n */\n\nexport function translate(out, a, v) {\n var x = v[0],\n y = v[1],\n z = v[2];\n var a00, a01, a02, a03;\n var a10, a11, a12, a13;\n var a20, a21, a22, a23;\n\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n } else {\n a00 = a[0];\n a01 = a[1];\n a02 = a[2];\n a03 = a[3];\n a10 = a[4];\n a11 = a[5];\n a12 = a[6];\n a13 = a[7];\n a20 = a[8];\n a21 = a[9];\n a22 = a[10];\n a23 = a[11];\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n out[3] = a03;\n out[4] = a10;\n out[5] = a11;\n out[6] = a12;\n out[7] = a13;\n out[8] = a20;\n out[9] = a21;\n out[10] = a22;\n out[11] = a23;\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n\n return out;\n}\n/**\r\n * Scales the mat4 by the dimensions in the given vec3 not using vectorization\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to scale\r\n * @param {vec3} v the vec3 to scale the matrix by\r\n * @returns {mat4} out\r\n **/\n\nexport function scale(out, a, v) {\n var x = v[0],\n y = v[1],\n z = v[2];\n out[0] = a[0] * x;\n out[1] = a[1] * x;\n out[2] = a[2] * x;\n out[3] = a[3] * x;\n out[4] = a[4] * y;\n out[5] = a[5] * y;\n out[6] = a[6] * y;\n out[7] = a[7] * y;\n out[8] = a[8] * z;\n out[9] = a[9] * z;\n out[10] = a[10] * z;\n out[11] = a[11] * z;\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\r\n * Rotates a mat4 by the given angle around the given axis\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to rotate\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @param {vec3} axis the axis to rotate around\r\n * @returns {mat4} out\r\n */\n\nexport function rotate(out, a, rad, axis) {\n var x = axis[0],\n y = axis[1],\n z = axis[2];\n var len = Math.hypot(x, y, z);\n var s, c, t;\n var a00, a01, a02, a03;\n var a10, a11, a12, a13;\n var a20, a21, a22, a23;\n var b00, b01, b02;\n var b10, b11, b12;\n var b20, b21, b22;\n\n if (len < glMatrix.EPSILON) {\n return null;\n }\n\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c;\n a00 = a[0];\n a01 = a[1];\n a02 = a[2];\n a03 = a[3];\n a10 = a[4];\n a11 = a[5];\n a12 = a[6];\n a13 = a[7];\n a20 = a[8];\n a21 = a[9];\n a22 = a[10];\n a23 = a[11]; // Construct the elements of the rotation matrix\n\n b00 = x * x * t + c;\n b01 = y * x * t + z * s;\n b02 = z * x * t - y * s;\n b10 = x * y * t - z * s;\n b11 = y * y * t + c;\n b12 = z * y * t + x * s;\n b20 = x * z * t + y * s;\n b21 = y * z * t - x * s;\n b22 = z * z * t + c; // Perform rotation-specific matrix multiplication\n\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged last row\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n\n return out;\n}\n/**\r\n * Rotates a matrix by the given angle around the X axis\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to rotate\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function rotateX(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a10 = a[4];\n var a11 = a[5];\n var a12 = a[6];\n var a13 = a[7];\n var a20 = a[8];\n var a21 = a[9];\n var a22 = a[10];\n var a23 = a[11];\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged rows\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n } // Perform axis-specific matrix multiplication\n\n\n out[4] = a10 * c + a20 * s;\n out[5] = a11 * c + a21 * s;\n out[6] = a12 * c + a22 * s;\n out[7] = a13 * c + a23 * s;\n out[8] = a20 * c - a10 * s;\n out[9] = a21 * c - a11 * s;\n out[10] = a22 * c - a12 * s;\n out[11] = a23 * c - a13 * s;\n return out;\n}\n/**\r\n * Rotates a matrix by the given angle around the Y axis\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to rotate\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function rotateY(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a00 = a[0];\n var a01 = a[1];\n var a02 = a[2];\n var a03 = a[3];\n var a20 = a[8];\n var a21 = a[9];\n var a22 = a[10];\n var a23 = a[11];\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged rows\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n } // Perform axis-specific matrix multiplication\n\n\n out[0] = a00 * c - a20 * s;\n out[1] = a01 * c - a21 * s;\n out[2] = a02 * c - a22 * s;\n out[3] = a03 * c - a23 * s;\n out[8] = a00 * s + a20 * c;\n out[9] = a01 * s + a21 * c;\n out[10] = a02 * s + a22 * c;\n out[11] = a03 * s + a23 * c;\n return out;\n}\n/**\r\n * Rotates a matrix by the given angle around the Z axis\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to rotate\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function rotateZ(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a00 = a[0];\n var a01 = a[1];\n var a02 = a[2];\n var a03 = a[3];\n var a10 = a[4];\n var a11 = a[5];\n var a12 = a[6];\n var a13 = a[7];\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged last row\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n } // Perform axis-specific matrix multiplication\n\n\n out[0] = a00 * c + a10 * s;\n out[1] = a01 * c + a11 * s;\n out[2] = a02 * c + a12 * s;\n out[3] = a03 * c + a13 * s;\n out[4] = a10 * c - a00 * s;\n out[5] = a11 * c - a01 * s;\n out[6] = a12 * c - a02 * s;\n out[7] = a13 * c - a03 * s;\n return out;\n}\n/**\r\n * Creates a matrix from a vector translation\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, dest, vec);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {vec3} v Translation vector\r\n * @returns {mat4} out\r\n */\n\nexport function fromTranslation(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.scale(dest, dest, vec);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {vec3} v Scaling vector\r\n * @returns {mat4} out\r\n */\n\nexport function fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = v[1];\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = v[2];\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.rotate(dest, dest, rad, axis);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @param {vec3} axis the axis to rotate around\r\n * @returns {mat4} out\r\n */\n\nexport function fromRotation(out, rad, axis) {\n var x = axis[0],\n y = axis[1],\n z = axis[2];\n var len = Math.hypot(x, y, z);\n var s, c, t;\n\n if (len < glMatrix.EPSILON) {\n return null;\n }\n\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c; // Perform rotation-specific matrix multiplication\n\n out[0] = x * x * t + c;\n out[1] = y * x * t + z * s;\n out[2] = z * x * t - y * s;\n out[3] = 0;\n out[4] = x * y * t - z * s;\n out[5] = y * y * t + c;\n out[6] = z * y * t + x * s;\n out[7] = 0;\n out[8] = x * z * t + y * s;\n out[9] = y * z * t - x * s;\n out[10] = z * z * t + c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from the given angle around the X axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.rotateX(dest, dest, rad);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function fromXRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad); // Perform axis-specific matrix multiplication\n\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = c;\n out[6] = s;\n out[7] = 0;\n out[8] = 0;\n out[9] = -s;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from the given angle around the Y axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.rotateY(dest, dest, rad);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function fromYRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad); // Perform axis-specific matrix multiplication\n\n out[0] = c;\n out[1] = 0;\n out[2] = -s;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = s;\n out[9] = 0;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from the given angle around the Z axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.rotateZ(dest, dest, rad);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function fromZRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad); // Perform axis-specific matrix multiplication\n\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = 0;\n out[4] = -s;\n out[5] = c;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a quaternion rotation and vector translation\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {quat4} q Rotation quaternion\r\n * @param {vec3} v Translation vector\r\n * @returns {mat4} out\r\n */\n\nexport function fromRotationTranslation(out, q, v) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n out[0] = 1 - (yy + zz);\n out[1] = xy + wz;\n out[2] = xz - wy;\n out[3] = 0;\n out[4] = xy - wz;\n out[5] = 1 - (xx + zz);\n out[6] = yz + wx;\n out[7] = 0;\n out[8] = xz + wy;\n out[9] = yz - wx;\n out[10] = 1 - (xx + yy);\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a new mat4 from a dual quat.\r\n *\r\n * @param {mat4} out Matrix\r\n * @param {quat2} a Dual Quaternion\r\n * @returns {mat4} mat4 receiving operation result\r\n */\n\nexport function fromQuat2(out, a) {\n var translation = new glMatrix.ARRAY_TYPE(3);\n var bx = -a[0],\n by = -a[1],\n bz = -a[2],\n bw = a[3],\n ax = a[4],\n ay = a[5],\n az = a[6],\n aw = a[7];\n var magnitude = bx * bx + by * by + bz * bz + bw * bw; //Only scale if it makes sense\n\n if (magnitude > 0) {\n translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude;\n translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude;\n translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2 / magnitude;\n } else {\n translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\n translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\n translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\n }\n\n fromRotationTranslation(out, a, translation);\n return out;\n}\n/**\r\n * Returns the translation vector component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslation,\r\n * the returned vector will be the same as the translation vector\r\n * originally supplied.\r\n * @param {vec3} out Vector to receive translation component\r\n * @param {mat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\n\nexport function getTranslation(out, mat) {\n out[0] = mat[12];\n out[1] = mat[13];\n out[2] = mat[14];\n return out;\n}\n/**\r\n * Returns the scaling factor component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslationScale\r\n * with a normalized Quaternion paramter, the returned vector will be\r\n * the same as the scaling vector\r\n * originally supplied.\r\n * @param {vec3} out Vector to receive scaling factor component\r\n * @param {mat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\n\nexport function getScaling(out, mat) {\n var m11 = mat[0];\n var m12 = mat[1];\n var m13 = mat[2];\n var m21 = mat[4];\n var m22 = mat[5];\n var m23 = mat[6];\n var m31 = mat[8];\n var m32 = mat[9];\n var m33 = mat[10];\n out[0] = Math.hypot(m11, m12, m13);\n out[1] = Math.hypot(m21, m22, m23);\n out[2] = Math.hypot(m31, m32, m33);\n return out;\n}\n/**\r\n * Returns a quaternion representing the rotational component\r\n * of a transformation matrix. If a matrix is built with\r\n * fromRotationTranslation, the returned quaternion will be the\r\n * same as the quaternion originally supplied.\r\n * @param {quat} out Quaternion to receive the rotation component\r\n * @param {mat4} mat Matrix to be decomposed (input)\r\n * @return {quat} out\r\n */\n\nexport function getRotation(out, mat) {\n var scaling = new glMatrix.ARRAY_TYPE(3);\n getScaling(scaling, mat);\n var is1 = 1 / scaling[0];\n var is2 = 1 / scaling[1];\n var is3 = 1 / scaling[2];\n var sm11 = mat[0] * is1;\n var sm12 = mat[1] * is2;\n var sm13 = mat[2] * is3;\n var sm21 = mat[4] * is1;\n var sm22 = mat[5] * is2;\n var sm23 = mat[6] * is3;\n var sm31 = mat[8] * is1;\n var sm32 = mat[9] * is2;\n var sm33 = mat[10] * is3;\n var trace = sm11 + sm22 + sm33;\n var S = 0;\n\n if (trace > 0) {\n S = Math.sqrt(trace + 1.0) * 2;\n out[3] = 0.25 * S;\n out[0] = (sm23 - sm32) / S;\n out[1] = (sm31 - sm13) / S;\n out[2] = (sm12 - sm21) / S;\n } else if (sm11 > sm22 && sm11 > sm33) {\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\n out[3] = (sm23 - sm32) / S;\n out[0] = 0.25 * S;\n out[1] = (sm12 + sm21) / S;\n out[2] = (sm31 + sm13) / S;\n } else if (sm22 > sm33) {\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\n out[3] = (sm31 - sm13) / S;\n out[0] = (sm12 + sm21) / S;\n out[1] = 0.25 * S;\n out[2] = (sm23 + sm32) / S;\n } else {\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\n out[3] = (sm12 - sm21) / S;\n out[0] = (sm31 + sm13) / S;\n out[1] = (sm23 + sm32) / S;\n out[2] = 0.25 * S;\n }\n\n return out;\n}\n/**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale)\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {quat4} q Rotation quaternion\r\n * @param {vec3} v Translation vector\r\n * @param {vec3} s Scaling vector\r\n * @returns {mat4} out\r\n */\n\nexport function fromRotationTranslationScale(out, q, v, s) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n var sx = s[0];\n var sy = s[1];\n var sz = s[2];\n out[0] = (1 - (yy + zz)) * sx;\n out[1] = (xy + wz) * sx;\n out[2] = (xz - wy) * sx;\n out[3] = 0;\n out[4] = (xy - wz) * sy;\n out[5] = (1 - (xx + zz)) * sy;\n out[6] = (yz + wx) * sy;\n out[7] = 0;\n out[8] = (xz + wy) * sz;\n out[9] = (yz - wx) * sz;\n out[10] = (1 - (xx + yy)) * sz;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * mat4.translate(dest, origin);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale)\r\n * mat4.translate(dest, negativeOrigin);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {quat4} q Rotation quaternion\r\n * @param {vec3} v Translation vector\r\n * @param {vec3} s Scaling vector\r\n * @param {vec3} o The origin vector around which to scale and rotate\r\n * @returns {mat4} out\r\n */\n\nexport function fromRotationTranslationScaleOrigin(out, q, v, s, o) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n var sx = s[0];\n var sy = s[1];\n var sz = s[2];\n var ox = o[0];\n var oy = o[1];\n var oz = o[2];\n var out0 = (1 - (yy + zz)) * sx;\n var out1 = (xy + wz) * sx;\n var out2 = (xz - wy) * sx;\n var out4 = (xy - wz) * sy;\n var out5 = (1 - (xx + zz)) * sy;\n var out6 = (yz + wx) * sy;\n var out8 = (xz + wy) * sz;\n var out9 = (yz - wx) * sz;\n var out10 = (1 - (xx + yy)) * sz;\n out[0] = out0;\n out[1] = out1;\n out[2] = out2;\n out[3] = 0;\n out[4] = out4;\n out[5] = out5;\n out[6] = out6;\n out[7] = 0;\n out[8] = out8;\n out[9] = out9;\n out[10] = out10;\n out[11] = 0;\n out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz);\n out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz);\n out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz);\n out[15] = 1;\n return out;\n}\n/**\r\n * Calculates a 4x4 matrix from the given quaternion\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {quat} q Quaternion to create matrix from\r\n *\r\n * @returns {mat4} out\r\n */\n\nexport function fromQuat(out, q) {\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var yx = y * x2;\n var yy = y * y2;\n var zx = z * x2;\n var zy = z * y2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n out[0] = 1 - yy - zz;\n out[1] = yx + wz;\n out[2] = zx - wy;\n out[3] = 0;\n out[4] = yx - wz;\n out[5] = 1 - xx - zz;\n out[6] = zy + wx;\n out[7] = 0;\n out[8] = zx + wy;\n out[9] = zy - wx;\n out[10] = 1 - xx - yy;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Generates a frustum matrix with the given bounds\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {Number} left Left bound of the frustum\r\n * @param {Number} right Right bound of the frustum\r\n * @param {Number} bottom Bottom bound of the frustum\r\n * @param {Number} top Top bound of the frustum\r\n * @param {Number} near Near bound of the frustum\r\n * @param {Number} far Far bound of the frustum\r\n * @returns {mat4} out\r\n */\n\nexport function frustum(out, left, right, bottom, top, near, far) {\n var rl = 1 / (right - left);\n var tb = 1 / (top - bottom);\n var nf = 1 / (near - far);\n out[0] = near * 2 * rl;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = near * 2 * tb;\n out[6] = 0;\n out[7] = 0;\n out[8] = (right + left) * rl;\n out[9] = (top + bottom) * tb;\n out[10] = (far + near) * nf;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[14] = far * near * 2 * nf;\n out[15] = 0;\n return out;\n}\n/**\r\n * Generates a perspective projection matrix with the given bounds.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {number} fovy Vertical field of view in radians\r\n * @param {number} aspect Aspect ratio. typically viewport width/height\r\n * @param {number} near Near bound of the frustum\r\n * @param {number} far Far bound of the frustum, can be null or Infinity\r\n * @returns {mat4} out\r\n */\n\nexport function perspective(out, fovy, aspect, near, far) {\n var f = 1.0 / Math.tan(fovy / 2),\n nf;\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[15] = 0;\n\n if (far != null && far !== Infinity) {\n nf = 1 / (near - far);\n out[10] = (far + near) * nf;\n out[14] = 2 * far * near * nf;\n } else {\n out[10] = -1;\n out[14] = -2 * near;\n }\n\n return out;\n}\n/**\r\n * Generates a perspective projection matrix with the given field of view.\r\n * This is primarily useful for generating projection matrices to be used\r\n * with the still experiemental WebVR API.\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {Object} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees\r\n * @param {number} near Near bound of the frustum\r\n * @param {number} far Far bound of the frustum\r\n * @returns {mat4} out\r\n */\n\nexport function perspectiveFromFieldOfView(out, fov, near, far) {\n var upTan = Math.tan(fov.upDegrees * Math.PI / 180.0);\n var downTan = Math.tan(fov.downDegrees * Math.PI / 180.0);\n var leftTan = Math.tan(fov.leftDegrees * Math.PI / 180.0);\n var rightTan = Math.tan(fov.rightDegrees * Math.PI / 180.0);\n var xScale = 2.0 / (leftTan + rightTan);\n var yScale = 2.0 / (upTan + downTan);\n out[0] = xScale;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n out[4] = 0.0;\n out[5] = yScale;\n out[6] = 0.0;\n out[7] = 0.0;\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\n out[9] = (upTan - downTan) * yScale * 0.5;\n out[10] = far / (near - far);\n out[11] = -1.0;\n out[12] = 0.0;\n out[13] = 0.0;\n out[14] = far * near / (near - far);\n out[15] = 0.0;\n return out;\n}\n/**\r\n * Generates a orthogonal projection matrix with the given bounds\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {number} left Left bound of the frustum\r\n * @param {number} right Right bound of the frustum\r\n * @param {number} bottom Bottom bound of the frustum\r\n * @param {number} top Top bound of the frustum\r\n * @param {number} near Near bound of the frustum\r\n * @param {number} far Far bound of the frustum\r\n * @returns {mat4} out\r\n */\n\nexport function ortho(out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right);\n var bt = 1 / (bottom - top);\n var nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n}\n/**\r\n * Generates a look-at matrix with the given eye position, focal point, and up axis.\r\n * If you want a matrix that actually makes an object look at another object, you should use targetTo instead.\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {vec3} eye Position of the viewer\r\n * @param {vec3} center Point the viewer is looking at\r\n * @param {vec3} up vec3 pointing up\r\n * @returns {mat4} out\r\n */\n\nexport function lookAt(out, eye, center, up) {\n var x0, x1, x2, y0, y1, y2, z0, z1, z2, len;\n var eyex = eye[0];\n var eyey = eye[1];\n var eyez = eye[2];\n var upx = up[0];\n var upy = up[1];\n var upz = up[2];\n var centerx = center[0];\n var centery = center[1];\n var centerz = center[2];\n\n if (Math.abs(eyex - centerx) < glMatrix.EPSILON && Math.abs(eyey - centery) < glMatrix.EPSILON && Math.abs(eyez - centerz) < glMatrix.EPSILON) {\n return identity(out);\n }\n\n z0 = eyex - centerx;\n z1 = eyey - centery;\n z2 = eyez - centerz;\n len = 1 / Math.hypot(z0, z1, z2);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n x0 = upy * z2 - upz * z1;\n x1 = upz * z0 - upx * z2;\n x2 = upx * z1 - upy * z0;\n len = Math.hypot(x0, x1, x2);\n\n if (!len) {\n x0 = 0;\n x1 = 0;\n x2 = 0;\n } else {\n len = 1 / len;\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n\n y0 = z1 * x2 - z2 * x1;\n y1 = z2 * x0 - z0 * x2;\n y2 = z0 * x1 - z1 * x0;\n len = Math.hypot(y0, y1, y2);\n\n if (!len) {\n y0 = 0;\n y1 = 0;\n y2 = 0;\n } else {\n len = 1 / len;\n y0 *= len;\n y1 *= len;\n y2 *= len;\n }\n\n out[0] = x0;\n out[1] = y0;\n out[2] = z0;\n out[3] = 0;\n out[4] = x1;\n out[5] = y1;\n out[6] = z1;\n out[7] = 0;\n out[8] = x2;\n out[9] = y2;\n out[10] = z2;\n out[11] = 0;\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\n out[15] = 1;\n return out;\n}\n/**\r\n * Generates a matrix that makes something look at something else.\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {vec3} eye Position of the viewer\r\n * @param {vec3} center Point the viewer is looking at\r\n * @param {vec3} up vec3 pointing up\r\n * @returns {mat4} out\r\n */\n\nexport function targetTo(out, eye, target, up) {\n var eyex = eye[0],\n eyey = eye[1],\n eyez = eye[2],\n upx = up[0],\n upy = up[1],\n upz = up[2];\n var z0 = eyex - target[0],\n z1 = eyey - target[1],\n z2 = eyez - target[2];\n var len = z0 * z0 + z1 * z1 + z2 * z2;\n\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n }\n\n var x0 = upy * z2 - upz * z1,\n x1 = upz * z0 - upx * z2,\n x2 = upx * z1 - upy * z0;\n len = x0 * x0 + x1 * x1 + x2 * x2;\n\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n\n out[0] = x0;\n out[1] = x1;\n out[2] = x2;\n out[3] = 0;\n out[4] = z1 * x2 - z2 * x1;\n out[5] = z2 * x0 - z0 * x2;\n out[6] = z0 * x1 - z1 * x0;\n out[7] = 0;\n out[8] = z0;\n out[9] = z1;\n out[10] = z2;\n out[11] = 0;\n out[12] = eyex;\n out[13] = eyey;\n out[14] = eyez;\n out[15] = 1;\n return out;\n}\n/**\r\n * Returns a string representation of a mat4\r\n *\r\n * @param {mat4} a matrix to represent as a string\r\n * @returns {String} string representation of the matrix\r\n */\n\nexport function str(a) {\n return \"mat4(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \", \" + a[3] + \", \" + a[4] + \", \" + a[5] + \", \" + a[6] + \", \" + a[7] + \", \" + a[8] + \", \" + a[9] + \", \" + a[10] + \", \" + a[11] + \", \" + a[12] + \", \" + a[13] + \", \" + a[14] + \", \" + a[15] + \")\";\n}\n/**\r\n * Returns Frobenius norm of a mat4\r\n *\r\n * @param {mat4} a the matrix to calculate Frobenius norm of\r\n * @returns {Number} Frobenius norm\r\n */\n\nexport function frob(a) {\n return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15]);\n}\n/**\r\n * Adds two mat4's\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the first operand\r\n * @param {mat4} b the second operand\r\n * @returns {mat4} out\r\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n out[8] = a[8] + b[8];\n out[9] = a[9] + b[9];\n out[10] = a[10] + b[10];\n out[11] = a[11] + b[11];\n out[12] = a[12] + b[12];\n out[13] = a[13] + b[13];\n out[14] = a[14] + b[14];\n out[15] = a[15] + b[15];\n return out;\n}\n/**\r\n * Subtracts matrix b from matrix a\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the first operand\r\n * @param {mat4} b the second operand\r\n * @returns {mat4} out\r\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n out[6] = a[6] - b[6];\n out[7] = a[7] - b[7];\n out[8] = a[8] - b[8];\n out[9] = a[9] - b[9];\n out[10] = a[10] - b[10];\n out[11] = a[11] - b[11];\n out[12] = a[12] - b[12];\n out[13] = a[13] - b[13];\n out[14] = a[14] - b[14];\n out[15] = a[15] - b[15];\n return out;\n}\n/**\r\n * Multiply each element of the matrix by a scalar.\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to scale\r\n * @param {Number} b amount to scale the matrix's elements by\r\n * @returns {mat4} out\r\n */\n\nexport function multiplyScalar(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n out[8] = a[8] * b;\n out[9] = a[9] * b;\n out[10] = a[10] * b;\n out[11] = a[11] * b;\n out[12] = a[12] * b;\n out[13] = a[13] * b;\n out[14] = a[14] * b;\n out[15] = a[15] * b;\n return out;\n}\n/**\r\n * Adds two mat4's after multiplying each element of the second operand by a scalar value.\r\n *\r\n * @param {mat4} out the receiving vector\r\n * @param {mat4} a the first operand\r\n * @param {mat4} b the second operand\r\n * @param {Number} scale the amount to scale b's elements by before adding\r\n * @returns {mat4} out\r\n */\n\nexport function multiplyScalarAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\n out[6] = a[6] + b[6] * scale;\n out[7] = a[7] + b[7] * scale;\n out[8] = a[8] + b[8] * scale;\n out[9] = a[9] + b[9] * scale;\n out[10] = a[10] + b[10] * scale;\n out[11] = a[11] + b[11] * scale;\n out[12] = a[12] + b[12] * scale;\n out[13] = a[13] + b[13] * scale;\n out[14] = a[14] + b[14] * scale;\n out[15] = a[15] + b[15] * scale;\n return out;\n}\n/**\r\n * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)\r\n *\r\n * @param {mat4} a The first matrix.\r\n * @param {mat4} b The second matrix.\r\n * @returns {Boolean} True if the matrices are equal, false otherwise.\r\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8] && a[9] === b[9] && a[10] === b[10] && a[11] === b[11] && a[12] === b[12] && a[13] === b[13] && a[14] === b[14] && a[15] === b[15];\n}\n/**\r\n * Returns whether or not the matrices have approximately the same elements in the same position.\r\n *\r\n * @param {mat4} a The first matrix.\r\n * @param {mat4} b The second matrix.\r\n * @returns {Boolean} True if the matrices are equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var a4 = a[4],\n a5 = a[5],\n a6 = a[6],\n a7 = a[7];\n var a8 = a[8],\n a9 = a[9],\n a10 = a[10],\n a11 = a[11];\n var a12 = a[12],\n a13 = a[13],\n a14 = a[14],\n a15 = a[15];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n var b4 = b[4],\n b5 = b[5],\n b6 = b[6],\n b7 = b[7];\n var b8 = b[8],\n b9 = b[9],\n b10 = b[10],\n b11 = b[11];\n var b12 = b[12],\n b13 = b[13],\n b14 = b[14],\n b15 = b[15];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a15), Math.abs(b15));\n}\n/**\r\n * Alias for {@link mat4.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Alias for {@link mat4.subtract}\r\n * @function\r\n */\n\nexport var sub = subtract;","import * as glMatrix from \"./common.js\";\n/**\r\n * 3 Dimensional Vector\r\n * @module vec3\r\n */\n\n/**\r\n * Creates a new, empty vec3\r\n *\r\n * @returns {vec3} a new 3D vector\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(3);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n }\n\n return out;\n}\n/**\r\n * Creates a new vec3 initialized with values from an existing vector\r\n *\r\n * @param {vec3} a vector to clone\r\n * @returns {vec3} a new 3D vector\r\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(3);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n}\n/**\r\n * Calculates the length of a vec3\r\n *\r\n * @param {vec3} a vector to calculate length of\r\n * @returns {Number} length of a\r\n */\n\nexport function length(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n return Math.hypot(x, y, z);\n}\n/**\r\n * Creates a new vec3 initialized with the given values\r\n *\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @param {Number} z Z component\r\n * @returns {vec3} a new 3D vector\r\n */\n\nexport function fromValues(x, y, z) {\n var out = new glMatrix.ARRAY_TYPE(3);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n}\n/**\r\n * Copy the values from one vec3 to another\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the source vector\r\n * @returns {vec3} out\r\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n}\n/**\r\n * Set the components of a vec3 to the given values\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @param {Number} z Z component\r\n * @returns {vec3} out\r\n */\n\nexport function set(out, x, y, z) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n}\n/**\r\n * Adds two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n return out;\n}\n/**\r\n * Subtracts vector b from vector a\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n return out;\n}\n/**\r\n * Multiplies two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n return out;\n}\n/**\r\n * Divides two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n return out;\n}\n/**\r\n * Math.ceil the components of a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a vector to ceil\r\n * @returns {vec3} out\r\n */\n\nexport function ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n out[2] = Math.ceil(a[2]);\n return out;\n}\n/**\r\n * Math.floor the components of a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a vector to floor\r\n * @returns {vec3} out\r\n */\n\nexport function floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n out[2] = Math.floor(a[2]);\n return out;\n}\n/**\r\n * Returns the minimum of two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n return out;\n}\n/**\r\n * Returns the maximum of two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n return out;\n}\n/**\r\n * Math.round the components of a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a vector to round\r\n * @returns {vec3} out\r\n */\n\nexport function round(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n out[2] = Math.round(a[2]);\n return out;\n}\n/**\r\n * Scales a vec3 by a scalar number\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the vector to scale\r\n * @param {Number} b amount to scale the vector by\r\n * @returns {vec3} out\r\n */\n\nexport function scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n return out;\n}\n/**\r\n * Adds two vec3's after scaling the second operand by a scalar value\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @param {Number} scale the amount to scale b by before adding\r\n * @returns {vec3} out\r\n */\n\nexport function scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n return out;\n}\n/**\r\n * Calculates the euclidian distance between two vec3's\r\n *\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {Number} distance between a and b\r\n */\n\nexport function distance(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n return Math.hypot(x, y, z);\n}\n/**\r\n * Calculates the squared euclidian distance between two vec3's\r\n *\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {Number} squared distance between a and b\r\n */\n\nexport function squaredDistance(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n return x * x + y * y + z * z;\n}\n/**\r\n * Calculates the squared length of a vec3\r\n *\r\n * @param {vec3} a vector to calculate squared length of\r\n * @returns {Number} squared length of a\r\n */\n\nexport function squaredLength(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n return x * x + y * y + z * z;\n}\n/**\r\n * Negates the components of a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a vector to negate\r\n * @returns {vec3} out\r\n */\n\nexport function negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n return out;\n}\n/**\r\n * Returns the inverse of the components of a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a vector to invert\r\n * @returns {vec3} out\r\n */\n\nexport function inverse(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n return out;\n}\n/**\r\n * Normalize a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a vector to normalize\r\n * @returns {vec3} out\r\n */\n\nexport function normalize(out, a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var len = x * x + y * y + z * z;\n\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n }\n\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n out[2] = a[2] * len;\n return out;\n}\n/**\r\n * Calculates the dot product of two vec3's\r\n *\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {Number} dot product of a and b\r\n */\n\nexport function dot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n}\n/**\r\n * Computes the cross product of two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function cross(out, a, b) {\n var ax = a[0],\n ay = a[1],\n az = a[2];\n var bx = b[0],\n by = b[1],\n bz = b[2];\n out[0] = ay * bz - az * by;\n out[1] = az * bx - ax * bz;\n out[2] = ax * by - ay * bx;\n return out;\n}\n/**\r\n * Performs a linear interpolation between two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {vec3} out\r\n */\n\nexport function lerp(out, a, b, t) {\n var ax = a[0];\n var ay = a[1];\n var az = a[2];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n return out;\n}\n/**\r\n * Performs a hermite interpolation with two control points\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @param {vec3} c the third operand\r\n * @param {vec3} d the fourth operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {vec3} out\r\n */\n\nexport function hermite(out, a, b, c, d, t) {\n var factorTimes2 = t * t;\n var factor1 = factorTimes2 * (2 * t - 3) + 1;\n var factor2 = factorTimes2 * (t - 2) + t;\n var factor3 = factorTimes2 * (t - 1);\n var factor4 = factorTimes2 * (3 - 2 * t);\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n return out;\n}\n/**\r\n * Performs a bezier interpolation with two control points\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @param {vec3} c the third operand\r\n * @param {vec3} d the fourth operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {vec3} out\r\n */\n\nexport function bezier(out, a, b, c, d, t) {\n var inverseFactor = 1 - t;\n var inverseFactorTimesTwo = inverseFactor * inverseFactor;\n var factorTimes2 = t * t;\n var factor1 = inverseFactorTimesTwo * inverseFactor;\n var factor2 = 3 * t * inverseFactorTimesTwo;\n var factor3 = 3 * factorTimes2 * inverseFactor;\n var factor4 = factorTimes2 * t;\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n return out;\n}\n/**\r\n * Generates a random vector with the given scale\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\r\n * @returns {vec3} out\r\n */\n\nexport function random(out, scale) {\n scale = scale || 1.0;\n var r = glMatrix.RANDOM() * 2.0 * Math.PI;\n var z = glMatrix.RANDOM() * 2.0 - 1.0;\n var zScale = Math.sqrt(1.0 - z * z) * scale;\n out[0] = Math.cos(r) * zScale;\n out[1] = Math.sin(r) * zScale;\n out[2] = z * scale;\n return out;\n}\n/**\r\n * Transforms the vec3 with a mat4.\r\n * 4th vector component is implicitly '1'\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the vector to transform\r\n * @param {mat4} m matrix to transform with\r\n * @returns {vec3} out\r\n */\n\nexport function transformMat4(out, a, m) {\n var x = a[0],\n y = a[1],\n z = a[2];\n var w = m[3] * x + m[7] * y + m[11] * z + m[15];\n w = w || 1.0;\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n return out;\n}\n/**\r\n * Transforms the vec3 with a mat3.\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the vector to transform\r\n * @param {mat3} m the 3x3 matrix to transform with\r\n * @returns {vec3} out\r\n */\n\nexport function transformMat3(out, a, m) {\n var x = a[0],\n y = a[1],\n z = a[2];\n out[0] = x * m[0] + y * m[3] + z * m[6];\n out[1] = x * m[1] + y * m[4] + z * m[7];\n out[2] = x * m[2] + y * m[5] + z * m[8];\n return out;\n}\n/**\r\n * Transforms the vec3 with a quat\r\n * Can also be used for dual quaternions. (Multiply it with the real part)\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the vector to transform\r\n * @param {quat} q quaternion to transform with\r\n * @returns {vec3} out\r\n */\n\nexport function transformQuat(out, a, q) {\n // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed\n var qx = q[0],\n qy = q[1],\n qz = q[2],\n qw = q[3];\n var x = a[0],\n y = a[1],\n z = a[2]; // var qvec = [qx, qy, qz];\n // var uv = vec3.cross([], qvec, a);\n\n var uvx = qy * z - qz * y,\n uvy = qz * x - qx * z,\n uvz = qx * y - qy * x; // var uuv = vec3.cross([], qvec, uv);\n\n var uuvx = qy * uvz - qz * uvy,\n uuvy = qz * uvx - qx * uvz,\n uuvz = qx * uvy - qy * uvx; // vec3.scale(uv, uv, 2 * w);\n\n var w2 = qw * 2;\n uvx *= w2;\n uvy *= w2;\n uvz *= w2; // vec3.scale(uuv, uuv, 2);\n\n uuvx *= 2;\n uuvy *= 2;\n uuvz *= 2; // return vec3.add(out, a, vec3.add(out, uv, uuv));\n\n out[0] = x + uvx + uuvx;\n out[1] = y + uvy + uuvy;\n out[2] = z + uvz + uuvz;\n return out;\n}\n/**\r\n * Rotate a 3D vector around the x-axis\r\n * @param {vec3} out The receiving vec3\r\n * @param {vec3} a The vec3 point to rotate\r\n * @param {vec3} b The origin of the rotation\r\n * @param {Number} rad The angle of rotation in radians\r\n * @returns {vec3} out\r\n */\n\nexport function rotateX(out, a, b, rad) {\n var p = [],\n r = []; //Translate point to the origin\n\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2]; //perform rotation\n\n r[0] = p[0];\n r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad);\n r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad); //translate to correct position\n\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\r\n * Rotate a 3D vector around the y-axis\r\n * @param {vec3} out The receiving vec3\r\n * @param {vec3} a The vec3 point to rotate\r\n * @param {vec3} b The origin of the rotation\r\n * @param {Number} rad The angle of rotation in radians\r\n * @returns {vec3} out\r\n */\n\nexport function rotateY(out, a, b, rad) {\n var p = [],\n r = []; //Translate point to the origin\n\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2]; //perform rotation\n\n r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad);\n r[1] = p[1];\n r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad); //translate to correct position\n\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\r\n * Rotate a 3D vector around the z-axis\r\n * @param {vec3} out The receiving vec3\r\n * @param {vec3} a The vec3 point to rotate\r\n * @param {vec3} b The origin of the rotation\r\n * @param {Number} rad The angle of rotation in radians\r\n * @returns {vec3} out\r\n */\n\nexport function rotateZ(out, a, b, rad) {\n var p = [],\n r = []; //Translate point to the origin\n\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2]; //perform rotation\n\n r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad);\n r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad);\n r[2] = p[2]; //translate to correct position\n\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\r\n * Get the angle between two 3D vectors\r\n * @param {vec3} a The first operand\r\n * @param {vec3} b The second operand\r\n * @returns {Number} The angle in radians\r\n */\n\nexport function angle(a, b) {\n var ax = a[0],\n ay = a[1],\n az = a[2],\n bx = b[0],\n by = b[1],\n bz = b[2],\n mag1 = Math.sqrt(ax * ax + ay * ay + az * az),\n mag2 = Math.sqrt(bx * bx + by * by + bz * bz),\n mag = mag1 * mag2,\n cosine = mag && dot(a, b) / mag;\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\n}\n/**\r\n * Set the components of a vec3 to zero\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @returns {vec3} out\r\n */\n\nexport function zero(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n out[2] = 0.0;\n return out;\n}\n/**\r\n * Returns a string representation of a vector\r\n *\r\n * @param {vec3} a vector to represent as a string\r\n * @returns {String} string representation of the vector\r\n */\n\nexport function str(a) {\n return \"vec3(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \")\";\n}\n/**\r\n * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)\r\n *\r\n * @param {vec3} a The first vector.\r\n * @param {vec3} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n}\n/**\r\n * Returns whether or not the vectors have approximately the same elements in the same position.\r\n *\r\n * @param {vec3} a The first vector.\r\n * @param {vec3} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2));\n}\n/**\r\n * Alias for {@link vec3.subtract}\r\n * @function\r\n */\n\nexport var sub = subtract;\n/**\r\n * Alias for {@link vec3.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Alias for {@link vec3.divide}\r\n * @function\r\n */\n\nexport var div = divide;\n/**\r\n * Alias for {@link vec3.distance}\r\n * @function\r\n */\n\nexport var dist = distance;\n/**\r\n * Alias for {@link vec3.squaredDistance}\r\n * @function\r\n */\n\nexport var sqrDist = squaredDistance;\n/**\r\n * Alias for {@link vec3.length}\r\n * @function\r\n */\n\nexport var len = length;\n/**\r\n * Alias for {@link vec3.squaredLength}\r\n * @function\r\n */\n\nexport var sqrLen = squaredLength;\n/**\r\n * Perform some operation over an array of vec3s.\r\n *\r\n * @param {Array} a the array of vectors to iterate over\r\n * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed\r\n * @param {Number} offset Number of elements to skip at the beginning of the array\r\n * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array\r\n * @param {Function} fn Function to call for each vector in the array\r\n * @param {Object} [arg] additional argument to pass to fn\r\n * @returns {Array} a\r\n * @function\r\n */\n\nexport var forEach = function () {\n var vec = create();\n return function (a, stride, offset, count, fn, arg) {\n var i, l;\n\n if (!stride) {\n stride = 3;\n }\n\n if (!offset) {\n offset = 0;\n }\n\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n } else {\n l = a.length;\n }\n\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n vec[2] = a[i + 2];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n a[i + 2] = vec[2];\n }\n\n return a;\n };\n}();","import * as glMatrix from \"./common.js\";\n/**\r\n * 4 Dimensional Vector\r\n * @module vec4\r\n */\n\n/**\r\n * Creates a new, empty vec4\r\n *\r\n * @returns {vec4} a new 4D vector\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(4);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n }\n\n return out;\n}\n/**\r\n * Creates a new vec4 initialized with values from an existing vector\r\n *\r\n * @param {vec4} a vector to clone\r\n * @returns {vec4} a new 4D vector\r\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\n/**\r\n * Creates a new vec4 initialized with the given values\r\n *\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @param {Number} z Z component\r\n * @param {Number} w W component\r\n * @returns {vec4} a new 4D vector\r\n */\n\nexport function fromValues(x, y, z, w) {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n}\n/**\r\n * Copy the values from one vec4 to another\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the source vector\r\n * @returns {vec4} out\r\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\n/**\r\n * Set the components of a vec4 to the given values\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @param {Number} z Z component\r\n * @param {Number} w W component\r\n * @returns {vec4} out\r\n */\n\nexport function set(out, x, y, z, w) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n}\n/**\r\n * Adds two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n return out;\n}\n/**\r\n * Subtracts vector b from vector a\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n return out;\n}\n/**\r\n * Multiplies two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n out[3] = a[3] * b[3];\n return out;\n}\n/**\r\n * Divides two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n out[3] = a[3] / b[3];\n return out;\n}\n/**\r\n * Math.ceil the components of a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a vector to ceil\r\n * @returns {vec4} out\r\n */\n\nexport function ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n out[2] = Math.ceil(a[2]);\n out[3] = Math.ceil(a[3]);\n return out;\n}\n/**\r\n * Math.floor the components of a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a vector to floor\r\n * @returns {vec4} out\r\n */\n\nexport function floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n out[2] = Math.floor(a[2]);\n out[3] = Math.floor(a[3]);\n return out;\n}\n/**\r\n * Returns the minimum of two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n out[3] = Math.min(a[3], b[3]);\n return out;\n}\n/**\r\n * Returns the maximum of two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n out[3] = Math.max(a[3], b[3]);\n return out;\n}\n/**\r\n * Math.round the components of a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a vector to round\r\n * @returns {vec4} out\r\n */\n\nexport function round(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n out[2] = Math.round(a[2]);\n out[3] = Math.round(a[3]);\n return out;\n}\n/**\r\n * Scales a vec4 by a scalar number\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the vector to scale\r\n * @param {Number} b amount to scale the vector by\r\n * @returns {vec4} out\r\n */\n\nexport function scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n return out;\n}\n/**\r\n * Adds two vec4's after scaling the second operand by a scalar value\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @param {Number} scale the amount to scale b by before adding\r\n * @returns {vec4} out\r\n */\n\nexport function scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n return out;\n}\n/**\r\n * Calculates the euclidian distance between two vec4's\r\n *\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {Number} distance between a and b\r\n */\n\nexport function distance(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n var w = b[3] - a[3];\n return Math.hypot(x, y, z, w);\n}\n/**\r\n * Calculates the squared euclidian distance between two vec4's\r\n *\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {Number} squared distance between a and b\r\n */\n\nexport function squaredDistance(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n var w = b[3] - a[3];\n return x * x + y * y + z * z + w * w;\n}\n/**\r\n * Calculates the length of a vec4\r\n *\r\n * @param {vec4} a vector to calculate length of\r\n * @returns {Number} length of a\r\n */\n\nexport function length(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var w = a[3];\n return Math.hypot(x, y, z, w);\n}\n/**\r\n * Calculates the squared length of a vec4\r\n *\r\n * @param {vec4} a vector to calculate squared length of\r\n * @returns {Number} squared length of a\r\n */\n\nexport function squaredLength(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var w = a[3];\n return x * x + y * y + z * z + w * w;\n}\n/**\r\n * Negates the components of a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a vector to negate\r\n * @returns {vec4} out\r\n */\n\nexport function negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = -a[3];\n return out;\n}\n/**\r\n * Returns the inverse of the components of a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a vector to invert\r\n * @returns {vec4} out\r\n */\n\nexport function inverse(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n out[3] = 1.0 / a[3];\n return out;\n}\n/**\r\n * Normalize a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a vector to normalize\r\n * @returns {vec4} out\r\n */\n\nexport function normalize(out, a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var w = a[3];\n var len = x * x + y * y + z * z + w * w;\n\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n }\n\n out[0] = x * len;\n out[1] = y * len;\n out[2] = z * len;\n out[3] = w * len;\n return out;\n}\n/**\r\n * Calculates the dot product of two vec4's\r\n *\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {Number} dot product of a and b\r\n */\n\nexport function dot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\n}\n/**\r\n * Returns the cross-product of three vectors in a 4-dimensional space\r\n *\r\n * @param {vec4} result the receiving vector\r\n * @param {vec4} U the first vector\r\n * @param {vec4} V the second vector\r\n * @param {vec4} W the third vector\r\n * @returns {vec4} result\r\n */\n\nexport function cross(out, u, v, w) {\n var A = v[0] * w[1] - v[1] * w[0],\n B = v[0] * w[2] - v[2] * w[0],\n C = v[0] * w[3] - v[3] * w[0],\n D = v[1] * w[2] - v[2] * w[1],\n E = v[1] * w[3] - v[3] * w[1],\n F = v[2] * w[3] - v[3] * w[2];\n var G = u[0];\n var H = u[1];\n var I = u[2];\n var J = u[3];\n out[0] = H * F - I * E + J * D;\n out[1] = -(G * F) + I * C - J * B;\n out[2] = G * E - H * C + J * A;\n out[3] = -(G * D) + H * B - I * A;\n return out;\n}\n/**\r\n * Performs a linear interpolation between two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {vec4} out\r\n */\n\nexport function lerp(out, a, b, t) {\n var ax = a[0];\n var ay = a[1];\n var az = a[2];\n var aw = a[3];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n out[3] = aw + t * (b[3] - aw);\n return out;\n}\n/**\r\n * Generates a random vector with the given scale\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\r\n * @returns {vec4} out\r\n */\n\nexport function random(out, scale) {\n scale = scale || 1.0; // Marsaglia, George. Choosing a Point from the Surface of a\n // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646.\n // http://projecteuclid.org/euclid.aoms/1177692644;\n\n var v1, v2, v3, v4;\n var s1, s2;\n\n do {\n v1 = glMatrix.RANDOM() * 2 - 1;\n v2 = glMatrix.RANDOM() * 2 - 1;\n s1 = v1 * v1 + v2 * v2;\n } while (s1 >= 1);\n\n do {\n v3 = glMatrix.RANDOM() * 2 - 1;\n v4 = glMatrix.RANDOM() * 2 - 1;\n s2 = v3 * v3 + v4 * v4;\n } while (s2 >= 1);\n\n var d = Math.sqrt((1 - s1) / s2);\n out[0] = scale * v1;\n out[1] = scale * v2;\n out[2] = scale * v3 * d;\n out[3] = scale * v4 * d;\n return out;\n}\n/**\r\n * Transforms the vec4 with a mat4.\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the vector to transform\r\n * @param {mat4} m matrix to transform with\r\n * @returns {vec4} out\r\n */\n\nexport function transformMat4(out, a, m) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n return out;\n}\n/**\r\n * Transforms the vec4 with a quat\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the vector to transform\r\n * @param {quat} q quaternion to transform with\r\n * @returns {vec4} out\r\n */\n\nexport function transformQuat(out, a, q) {\n var x = a[0],\n y = a[1],\n z = a[2];\n var qx = q[0],\n qy = q[1],\n qz = q[2],\n qw = q[3]; // calculate quat * vec\n\n var ix = qw * x + qy * z - qz * y;\n var iy = qw * y + qz * x - qx * z;\n var iz = qw * z + qx * y - qy * x;\n var iw = -qx * x - qy * y - qz * z; // calculate result * inverse quat\n\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n out[3] = a[3];\n return out;\n}\n/**\r\n * Set the components of a vec4 to zero\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @returns {vec4} out\r\n */\n\nexport function zero(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n return out;\n}\n/**\r\n * Returns a string representation of a vector\r\n *\r\n * @param {vec4} a vector to represent as a string\r\n * @returns {String} string representation of the vector\r\n */\n\nexport function str(a) {\n return \"vec4(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \", \" + a[3] + \")\";\n}\n/**\r\n * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)\r\n *\r\n * @param {vec4} a The first vector.\r\n * @param {vec4} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n/**\r\n * Returns whether or not the vectors have approximately the same elements in the same position.\r\n *\r\n * @param {vec4} a The first vector.\r\n * @param {vec4} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3));\n}\n/**\r\n * Alias for {@link vec4.subtract}\r\n * @function\r\n */\n\nexport var sub = subtract;\n/**\r\n * Alias for {@link vec4.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Alias for {@link vec4.divide}\r\n * @function\r\n */\n\nexport var div = divide;\n/**\r\n * Alias for {@link vec4.distance}\r\n * @function\r\n */\n\nexport var dist = distance;\n/**\r\n * Alias for {@link vec4.squaredDistance}\r\n * @function\r\n */\n\nexport var sqrDist = squaredDistance;\n/**\r\n * Alias for {@link vec4.length}\r\n * @function\r\n */\n\nexport var len = length;\n/**\r\n * Alias for {@link vec4.squaredLength}\r\n * @function\r\n */\n\nexport var sqrLen = squaredLength;\n/**\r\n * Perform some operation over an array of vec4s.\r\n *\r\n * @param {Array} a the array of vectors to iterate over\r\n * @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed\r\n * @param {Number} offset Number of elements to skip at the beginning of the array\r\n * @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array\r\n * @param {Function} fn Function to call for each vector in the array\r\n * @param {Object} [arg] additional argument to pass to fn\r\n * @returns {Array} a\r\n * @function\r\n */\n\nexport var forEach = function () {\n var vec = create();\n return function (a, stride, offset, count, fn, arg) {\n var i, l;\n\n if (!stride) {\n stride = 4;\n }\n\n if (!offset) {\n offset = 0;\n }\n\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n } else {\n l = a.length;\n }\n\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n vec[2] = a[i + 2];\n vec[3] = a[i + 3];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n a[i + 2] = vec[2];\n a[i + 3] = vec[3];\n }\n\n return a;\n };\n}();","// @flow\n\nimport StyleLayer from '../style_layer';\n\nimport CircleBucket from '../../data/bucket/circle_bucket';\nimport {polygonIntersectsBufferedPoint} from '../../util/intersection_tests';\nimport {getMaximumPaintValue, translateDistance, translate} from '../query_utils';\nimport properties from './circle_style_layer_properties';\nimport {Transitionable, Transitioning, Layout, PossiblyEvaluated} from '../properties';\nimport {vec4} from 'gl-matrix';\nimport Point from '@mapbox/point-geometry';\n\nimport type {FeatureState} from '../../style-spec/expression';\nimport type Transform from '../../geo/transform';\nimport type {Bucket, BucketParameters} from '../../data/bucket';\nimport type {LayoutProps, PaintProps} from './circle_style_layer_properties';\nimport type {LayerSpecification} from '../../style-spec/types';\n\nclass CircleStyleLayer extends StyleLayer {\n _unevaluatedLayout: Layout;\n layout: PossiblyEvaluated;\n\n _transitionablePaint: Transitionable;\n _transitioningPaint: Transitioning;\n paint: PossiblyEvaluated;\n\n constructor(layer: LayerSpecification) {\n super(layer, properties);\n }\n\n createBucket(parameters: BucketParameters<*>) {\n return new CircleBucket(parameters);\n }\n\n queryRadius(bucket: Bucket): number {\n const circleBucket: CircleBucket = (bucket: any);\n return getMaximumPaintValue('circle-radius', this, circleBucket) +\n getMaximumPaintValue('circle-stroke-width', this, circleBucket) +\n translateDistance(this.paint.get('circle-translate'));\n }\n\n queryIntersectsFeature(queryGeometry: Array,\n feature: VectorTileFeature,\n featureState: FeatureState,\n geometry: Array>,\n zoom: number,\n transform: Transform,\n pixelsToTileUnits: number,\n pixelPosMatrix: Float32Array): boolean {\n const translatedPolygon = translate(queryGeometry,\n this.paint.get('circle-translate'),\n this.paint.get('circle-translate-anchor'),\n transform.angle, pixelsToTileUnits);\n const radius = this.paint.get('circle-radius').evaluate(feature, featureState);\n const stroke = this.paint.get('circle-stroke-width').evaluate(feature, featureState);\n const size = radius + stroke;\n\n // For pitch-alignment: map, compare feature geometry to query geometry in the plane of the tile\n // // Otherwise, compare geometry in the plane of the viewport\n // // A circle with fixed scaling relative to the viewport gets larger in tile space as it moves into the distance\n // // A circle with fixed scaling relative to the map gets smaller in viewport space as it moves into the distance\n const alignWithMap = this.paint.get('circle-pitch-alignment') === 'map';\n const transformedPolygon = alignWithMap ? translatedPolygon : projectQueryGeometry(translatedPolygon, pixelPosMatrix);\n const transformedSize = alignWithMap ? size * pixelsToTileUnits : size;\n\n for (const ring of geometry) {\n for (const point of ring) {\n\n const transformedPoint = alignWithMap ? point : projectPoint(point, pixelPosMatrix);\n\n let adjustedSize = transformedSize;\n const projectedCenter = vec4.transformMat4([], [point.x, point.y, 0, 1], pixelPosMatrix);\n if (this.paint.get('circle-pitch-scale') === 'viewport' && this.paint.get('circle-pitch-alignment') === 'map') {\n adjustedSize *= projectedCenter[3] / transform.cameraToCenterDistance;\n } else if (this.paint.get('circle-pitch-scale') === 'map' && this.paint.get('circle-pitch-alignment') === 'viewport') {\n adjustedSize *= transform.cameraToCenterDistance / projectedCenter[3];\n }\n\n if (polygonIntersectsBufferedPoint(transformedPolygon, transformedPoint, adjustedSize)) return true;\n }\n }\n\n return false;\n }\n}\n\nfunction projectPoint(p: Point, pixelPosMatrix: Float32Array) {\n const point = vec4.transformMat4([], [p.x, p.y, 0, 1], pixelPosMatrix);\n return new Point(point[0] / point[3], point[1] / point[3]);\n}\n\nfunction projectQueryGeometry(queryGeometry: Array, pixelPosMatrix: Float32Array) {\n return queryGeometry.map((p) => {\n return projectPoint(p, pixelPosMatrix);\n });\n}\n\nexport default CircleStyleLayer;\n","import * as glMatrix from \"./common.js\";\n/**\r\n * 2 Dimensional Vector\r\n * @module vec2\r\n */\n\n/**\r\n * Creates a new, empty vec2\r\n *\r\n * @returns {vec2} a new 2D vector\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(2);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n }\n\n return out;\n}\n/**\r\n * Creates a new vec2 initialized with values from an existing vector\r\n *\r\n * @param {vec2} a vector to clone\r\n * @returns {vec2} a new 2D vector\r\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(2);\n out[0] = a[0];\n out[1] = a[1];\n return out;\n}\n/**\r\n * Creates a new vec2 initialized with the given values\r\n *\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @returns {vec2} a new 2D vector\r\n */\n\nexport function fromValues(x, y) {\n var out = new glMatrix.ARRAY_TYPE(2);\n out[0] = x;\n out[1] = y;\n return out;\n}\n/**\r\n * Copy the values from one vec2 to another\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the source vector\r\n * @returns {vec2} out\r\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n return out;\n}\n/**\r\n * Set the components of a vec2 to the given values\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @returns {vec2} out\r\n */\n\nexport function set(out, x, y) {\n out[0] = x;\n out[1] = y;\n return out;\n}\n/**\r\n * Adds two vec2's\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec2} out\r\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n return out;\n}\n/**\r\n * Subtracts vector b from vector a\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec2} out\r\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n return out;\n}\n/**\r\n * Multiplies two vec2's\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec2} out\r\n */\n\nexport function multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n return out;\n}\n/**\r\n * Divides two vec2's\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec2} out\r\n */\n\nexport function divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n return out;\n}\n/**\r\n * Math.ceil the components of a vec2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a vector to ceil\r\n * @returns {vec2} out\r\n */\n\nexport function ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n return out;\n}\n/**\r\n * Math.floor the components of a vec2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a vector to floor\r\n * @returns {vec2} out\r\n */\n\nexport function floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n return out;\n}\n/**\r\n * Returns the minimum of two vec2's\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec2} out\r\n */\n\nexport function min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n return out;\n}\n/**\r\n * Returns the maximum of two vec2's\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec2} out\r\n */\n\nexport function max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n return out;\n}\n/**\r\n * Math.round the components of a vec2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a vector to round\r\n * @returns {vec2} out\r\n */\n\nexport function round(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n return out;\n}\n/**\r\n * Scales a vec2 by a scalar number\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the vector to scale\r\n * @param {Number} b amount to scale the vector by\r\n * @returns {vec2} out\r\n */\n\nexport function scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n return out;\n}\n/**\r\n * Adds two vec2's after scaling the second operand by a scalar value\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @param {Number} scale the amount to scale b by before adding\r\n * @returns {vec2} out\r\n */\n\nexport function scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n return out;\n}\n/**\r\n * Calculates the euclidian distance between two vec2's\r\n *\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {Number} distance between a and b\r\n */\n\nexport function distance(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1];\n return Math.hypot(x, y);\n}\n/**\r\n * Calculates the squared euclidian distance between two vec2's\r\n *\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {Number} squared distance between a and b\r\n */\n\nexport function squaredDistance(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1];\n return x * x + y * y;\n}\n/**\r\n * Calculates the length of a vec2\r\n *\r\n * @param {vec2} a vector to calculate length of\r\n * @returns {Number} length of a\r\n */\n\nexport function length(a) {\n var x = a[0],\n y = a[1];\n return Math.hypot(x, y);\n}\n/**\r\n * Calculates the squared length of a vec2\r\n *\r\n * @param {vec2} a vector to calculate squared length of\r\n * @returns {Number} squared length of a\r\n */\n\nexport function squaredLength(a) {\n var x = a[0],\n y = a[1];\n return x * x + y * y;\n}\n/**\r\n * Negates the components of a vec2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a vector to negate\r\n * @returns {vec2} out\r\n */\n\nexport function negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n return out;\n}\n/**\r\n * Returns the inverse of the components of a vec2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a vector to invert\r\n * @returns {vec2} out\r\n */\n\nexport function inverse(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n return out;\n}\n/**\r\n * Normalize a vec2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a vector to normalize\r\n * @returns {vec2} out\r\n */\n\nexport function normalize(out, a) {\n var x = a[0],\n y = a[1];\n var len = x * x + y * y;\n\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n }\n\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n return out;\n}\n/**\r\n * Calculates the dot product of two vec2's\r\n *\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {Number} dot product of a and b\r\n */\n\nexport function dot(a, b) {\n return a[0] * b[0] + a[1] * b[1];\n}\n/**\r\n * Computes the cross product of two vec2's\r\n * Note that the cross product must by definition produce a 3D vector\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function cross(out, a, b) {\n var z = a[0] * b[1] - a[1] * b[0];\n out[0] = out[1] = 0;\n out[2] = z;\n return out;\n}\n/**\r\n * Performs a linear interpolation between two vec2's\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {vec2} out\r\n */\n\nexport function lerp(out, a, b, t) {\n var ax = a[0],\n ay = a[1];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n return out;\n}\n/**\r\n * Generates a random vector with the given scale\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\r\n * @returns {vec2} out\r\n */\n\nexport function random(out, scale) {\n scale = scale || 1.0;\n var r = glMatrix.RANDOM() * 2.0 * Math.PI;\n out[0] = Math.cos(r) * scale;\n out[1] = Math.sin(r) * scale;\n return out;\n}\n/**\r\n * Transforms the vec2 with a mat2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the vector to transform\r\n * @param {mat2} m matrix to transform with\r\n * @returns {vec2} out\r\n */\n\nexport function transformMat2(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[2] * y;\n out[1] = m[1] * x + m[3] * y;\n return out;\n}\n/**\r\n * Transforms the vec2 with a mat2d\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the vector to transform\r\n * @param {mat2d} m matrix to transform with\r\n * @returns {vec2} out\r\n */\n\nexport function transformMat2d(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[2] * y + m[4];\n out[1] = m[1] * x + m[3] * y + m[5];\n return out;\n}\n/**\r\n * Transforms the vec2 with a mat3\r\n * 3rd vector component is implicitly '1'\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the vector to transform\r\n * @param {mat3} m matrix to transform with\r\n * @returns {vec2} out\r\n */\n\nexport function transformMat3(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[3] * y + m[6];\n out[1] = m[1] * x + m[4] * y + m[7];\n return out;\n}\n/**\r\n * Transforms the vec2 with a mat4\r\n * 3rd vector component is implicitly '0'\r\n * 4th vector component is implicitly '1'\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the vector to transform\r\n * @param {mat4} m matrix to transform with\r\n * @returns {vec2} out\r\n */\n\nexport function transformMat4(out, a, m) {\n var x = a[0];\n var y = a[1];\n out[0] = m[0] * x + m[4] * y + m[12];\n out[1] = m[1] * x + m[5] * y + m[13];\n return out;\n}\n/**\r\n * Rotate a 2D vector\r\n * @param {vec2} out The receiving vec2\r\n * @param {vec2} a The vec2 point to rotate\r\n * @param {vec2} b The origin of the rotation\r\n * @param {Number} rad The angle of rotation in radians\r\n * @returns {vec2} out\r\n */\n\nexport function rotate(out, a, b, rad) {\n //Translate point to the origin\n var p0 = a[0] - b[0],\n p1 = a[1] - b[1],\n sinC = Math.sin(rad),\n cosC = Math.cos(rad); //perform rotation and translate to correct position\n\n out[0] = p0 * cosC - p1 * sinC + b[0];\n out[1] = p0 * sinC + p1 * cosC + b[1];\n return out;\n}\n/**\r\n * Get the angle between two 2D vectors\r\n * @param {vec2} a The first operand\r\n * @param {vec2} b The second operand\r\n * @returns {Number} The angle in radians\r\n */\n\nexport function angle(a, b) {\n var x1 = a[0],\n y1 = a[1],\n x2 = b[0],\n y2 = b[1],\n // mag is the product of the magnitudes of a and b\n mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2),\n // mag &&.. short circuits if mag == 0\n cosine = mag && (x1 * x2 + y1 * y2) / mag; // Math.min(Math.max(cosine, -1), 1) clamps the cosine between -1 and 1\n\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\n}\n/**\r\n * Set the components of a vec2 to zero\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @returns {vec2} out\r\n */\n\nexport function zero(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n return out;\n}\n/**\r\n * Returns a string representation of a vector\r\n *\r\n * @param {vec2} a vector to represent as a string\r\n * @returns {String} string representation of the vector\r\n */\n\nexport function str(a) {\n return \"vec2(\" + a[0] + \", \" + a[1] + \")\";\n}\n/**\r\n * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===)\r\n *\r\n * @param {vec2} a The first vector.\r\n * @param {vec2} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1];\n}\n/**\r\n * Returns whether or not the vectors have approximately the same elements in the same position.\r\n *\r\n * @param {vec2} a The first vector.\r\n * @param {vec2} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1];\n var b0 = b[0],\n b1 = b[1];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1));\n}\n/**\r\n * Alias for {@link vec2.length}\r\n * @function\r\n */\n\nexport var len = length;\n/**\r\n * Alias for {@link vec2.subtract}\r\n * @function\r\n */\n\nexport var sub = subtract;\n/**\r\n * Alias for {@link vec2.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Alias for {@link vec2.divide}\r\n * @function\r\n */\n\nexport var div = divide;\n/**\r\n * Alias for {@link vec2.distance}\r\n * @function\r\n */\n\nexport var dist = distance;\n/**\r\n * Alias for {@link vec2.squaredDistance}\r\n * @function\r\n */\n\nexport var sqrDist = squaredDistance;\n/**\r\n * Alias for {@link vec2.squaredLength}\r\n * @function\r\n */\n\nexport var sqrLen = squaredLength;\n/**\r\n * Perform some operation over an array of vec2s.\r\n *\r\n * @param {Array} a the array of vectors to iterate over\r\n * @param {Number} stride Number of elements between the start of each vec2. If 0 assumes tightly packed\r\n * @param {Number} offset Number of elements to skip at the beginning of the array\r\n * @param {Number} count Number of vec2s to iterate over. If 0 iterates over entire array\r\n * @param {Function} fn Function to call for each vector in the array\r\n * @param {Object} [arg] additional argument to pass to fn\r\n * @returns {Array} a\r\n * @function\r\n */\n\nexport var forEach = function () {\n var vec = create();\n return function (a, stride, offset, count, fn, arg) {\n var i, l;\n\n if (!stride) {\n stride = 2;\n }\n\n if (!offset) {\n offset = 0;\n }\n\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n } else {\n l = a.length;\n }\n\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n }\n\n return a;\n };\n}();","// @flow\n\nimport CircleBucket from './circle_bucket';\n\nimport {register} from '../../util/web_worker_transfer';\n\nimport type HeatmapStyleLayer from '../../style/style_layer/heatmap_style_layer';\n\nclass HeatmapBucket extends CircleBucket {\n // Needed for flow to accept omit: ['layers'] below, due to\n // https://github.com/facebook/flow/issues/4262\n layers: Array;\n}\n\nregister('HeatmapBucket', HeatmapBucket, {omit: ['layers']});\n\nexport default HeatmapBucket;\n","// @flow\n\nimport assert from 'assert';\n\nimport {register} from './web_worker_transfer';\n\nexport type Size = {\n width: number,\n height: number\n};\n\ntype Point = {\n x: number,\n y: number\n};\n\nfunction createImage(image: *, {width, height}: Size, channels: number, data?: Uint8Array | Uint8ClampedArray) {\n if (!data) {\n data = new Uint8Array(width * height * channels);\n } else if (data instanceof Uint8ClampedArray) {\n data = new Uint8Array(data.buffer);\n } else if (data.length !== width * height * channels) {\n throw new RangeError('mismatched image size');\n }\n image.width = width;\n image.height = height;\n image.data = data;\n return image;\n}\n\nfunction resizeImage(image: *, {width, height}: Size, channels: number) {\n if (width === image.width && height === image.height) {\n return;\n }\n\n const newImage = createImage({}, {width, height}, channels);\n\n copyImage(image, newImage, {x: 0, y: 0}, {x: 0, y: 0}, {\n width: Math.min(image.width, width),\n height: Math.min(image.height, height)\n }, channels);\n\n image.width = width;\n image.height = height;\n image.data = newImage.data;\n}\n\nfunction copyImage(srcImg: *, dstImg: *, srcPt: Point, dstPt: Point, size: Size, channels: number) {\n if (size.width === 0 || size.height === 0) {\n return dstImg;\n }\n\n if (size.width > srcImg.width ||\n size.height > srcImg.height ||\n srcPt.x > srcImg.width - size.width ||\n srcPt.y > srcImg.height - size.height) {\n throw new RangeError('out of range source coordinates for image copy');\n }\n\n if (size.width > dstImg.width ||\n size.height > dstImg.height ||\n dstPt.x > dstImg.width - size.width ||\n dstPt.y > dstImg.height - size.height) {\n throw new RangeError('out of range destination coordinates for image copy');\n }\n\n const srcData = srcImg.data;\n const dstData = dstImg.data;\n\n assert(srcData !== dstData);\n\n for (let y = 0; y < size.height; y++) {\n const srcOffset = ((srcPt.y + y) * srcImg.width + srcPt.x) * channels;\n const dstOffset = ((dstPt.y + y) * dstImg.width + dstPt.x) * channels;\n for (let i = 0; i < size.width * channels; i++) {\n dstData[dstOffset + i] = srcData[srcOffset + i];\n }\n }\n return dstImg;\n}\n\nexport class AlphaImage {\n width: number;\n height: number;\n data: Uint8Array;\n\n constructor(size: Size, data?: Uint8Array | Uint8ClampedArray) {\n createImage(this, size, 1, data);\n }\n\n resize(size: Size) {\n resizeImage(this, size, 1);\n }\n\n clone() {\n return new AlphaImage({width: this.width, height: this.height}, new Uint8Array(this.data));\n }\n\n static copy(srcImg: AlphaImage, dstImg: AlphaImage, srcPt: Point, dstPt: Point, size: Size) {\n copyImage(srcImg, dstImg, srcPt, dstPt, size, 1);\n }\n}\n\n// Not premultiplied, because ImageData is not premultiplied.\n// UNPACK_PREMULTIPLY_ALPHA_WEBGL must be used when uploading to a texture.\nexport class RGBAImage {\n width: number;\n height: number;\n\n // data must be a Uint8Array instead of Uint8ClampedArray because texImage2D does not\n // support Uint8ClampedArray in all browsers\n data: Uint8Array;\n\n constructor(size: Size, data?: Uint8Array | Uint8ClampedArray) {\n createImage(this, size, 4, data);\n }\n\n resize(size: Size) {\n resizeImage(this, size, 4);\n }\n\n replace(data: Uint8Array | Uint8ClampedArray, copy?: boolean) {\n if (copy) {\n this.data.set(data);\n } else if (data instanceof Uint8ClampedArray) {\n this.data = new Uint8Array(data.buffer);\n } else {\n this.data = data;\n }\n }\n\n clone() {\n return new RGBAImage({width: this.width, height: this.height}, new Uint8Array(this.data));\n }\n\n static copy(srcImg: RGBAImage | ImageData, dstImg: RGBAImage, srcPt: Point, dstPt: Point, size: Size) {\n copyImage(srcImg, dstImg, srcPt, dstPt, size, 4);\n }\n}\n\nregister('AlphaImage', AlphaImage);\nregister('RGBAImage', RGBAImage);\n","// This file is generated. Edit build/generate-style-code.js, then run `yarn run codegen`.\n// @flow\n/* eslint-disable */\n\nimport styleSpec from '../../style-spec/reference/latest';\n\nimport {\n Properties,\n DataConstantProperty,\n DataDrivenProperty,\n CrossFadedDataDrivenProperty,\n CrossFadedProperty,\n ColorRampProperty\n} from '../properties';\n\nimport type Color from '../../style-spec/util/color';\n\nimport type Formatted from '../../style-spec/expression/types/formatted';\n\nimport type ResolvedImage from '../../style-spec/expression/types/resolved_image';\n\n\nexport type PaintProps = {|\n \"heatmap-radius\": DataDrivenProperty,\n \"heatmap-weight\": DataDrivenProperty,\n \"heatmap-intensity\": DataConstantProperty,\n \"heatmap-color\": ColorRampProperty,\n \"heatmap-opacity\": DataConstantProperty,\n|};\n\nconst paint: Properties = new Properties({\n \"heatmap-radius\": new DataDrivenProperty(styleSpec[\"paint_heatmap\"][\"heatmap-radius\"]),\n \"heatmap-weight\": new DataDrivenProperty(styleSpec[\"paint_heatmap\"][\"heatmap-weight\"]),\n \"heatmap-intensity\": new DataConstantProperty(styleSpec[\"paint_heatmap\"][\"heatmap-intensity\"]),\n \"heatmap-color\": new ColorRampProperty(styleSpec[\"paint_heatmap\"][\"heatmap-color\"]),\n \"heatmap-opacity\": new DataConstantProperty(styleSpec[\"paint_heatmap\"][\"heatmap-opacity\"]),\n});\n\n// Note: without adding the explicit type annotation, Flow infers weaker types\n// for these objects from their use in the constructor to StyleLayer, as\n// {layout?: Properties<...>, paint: Properties<...>}\nexport default ({ paint }: $Exact<{\n paint: Properties\n}>);\n","// @flow\n\nimport {RGBAImage} from './image';\nimport {isPowerOfTwo} from './util';\nimport assert from 'assert';\n\nimport type {StylePropertyExpression} from '../style-spec/expression/index';\n\nexport type ColorRampParams = {\n expression: StylePropertyExpression;\n evaluationKey: string;\n resolution?: number;\n image?: RGBAImage;\n clips?: Array;\n}\n\n/**\n * Given an expression that should evaluate to a color ramp,\n * return a RGBA image representing that ramp expression.\n *\n * @private\n */\nexport function renderColorRamp(params: ColorRampParams): RGBAImage {\n const evaluationGlobals = {};\n const width = params.resolution || 256;\n const height = params.clips ? params.clips.length : 1;\n const image = params.image || new RGBAImage({width, height});\n\n assert(isPowerOfTwo(width));\n\n const renderPixel = (stride, index, progress) => {\n evaluationGlobals[params.evaluationKey] = progress;\n const pxColor = params.expression.evaluate((evaluationGlobals: any));\n // the colors are being unpremultiplied because Color uses\n // premultiplied values, and the Texture class expects unpremultiplied ones\n image.data[stride + index + 0] = Math.floor(pxColor.r * 255 / pxColor.a);\n image.data[stride + index + 1] = Math.floor(pxColor.g * 255 / pxColor.a);\n image.data[stride + index + 2] = Math.floor(pxColor.b * 255 / pxColor.a);\n image.data[stride + index + 3] = Math.floor(pxColor.a * 255);\n };\n\n if (!params.clips) {\n for (let i = 0, j = 0; i < width; i++, j += 4) {\n const progress = i / (width - 1);\n\n renderPixel(0, j, progress);\n }\n } else {\n for (let clip = 0, stride = 0; clip < height; ++clip, stride += width * 4) {\n for (let i = 0, j = 0; i < width; i++, j += 4) {\n // Remap progress between clips\n const progress = i / (width - 1);\n const {start, end} = params.clips[clip];\n const evaluationProgress = start * (1 - progress) + end * progress;\n renderPixel(stride, j, evaluationProgress);\n }\n }\n }\n\n return image;\n}\n","// @flow\n\nimport StyleLayer from '../style_layer';\n\nimport HeatmapBucket from '../../data/bucket/heatmap_bucket';\nimport {RGBAImage} from '../../util/image';\nimport properties from './heatmap_style_layer_properties';\nimport {renderColorRamp} from '../../util/color_ramp';\nimport {Transitionable, Transitioning, PossiblyEvaluated} from '../properties';\n\nimport type Texture from '../../render/texture';\nimport type Framebuffer from '../../gl/framebuffer';\nimport type {PaintProps} from './heatmap_style_layer_properties';\nimport type {LayerSpecification} from '../../style-spec/types';\n\nclass HeatmapStyleLayer extends StyleLayer {\n\n heatmapFbo: ?Framebuffer;\n colorRamp: RGBAImage;\n colorRampTexture: ?Texture;\n\n _transitionablePaint: Transitionable;\n _transitioningPaint: Transitioning;\n paint: PossiblyEvaluated;\n\n createBucket(options: any) {\n return new HeatmapBucket(options);\n }\n\n constructor(layer: LayerSpecification) {\n super(layer, properties);\n\n // make sure color ramp texture is generated for default heatmap color too\n this._updateColorRamp();\n }\n\n _handleSpecialPaintPropertyUpdate(name: string) {\n if (name === 'heatmap-color') {\n this._updateColorRamp();\n }\n }\n\n _updateColorRamp() {\n const expression = this._transitionablePaint._values['heatmap-color'].value.expression;\n this.colorRamp = renderColorRamp({\n expression,\n evaluationKey: 'heatmapDensity',\n image: this.colorRamp\n });\n this.colorRampTexture = null;\n }\n\n resize() {\n if (this.heatmapFbo) {\n this.heatmapFbo.destroy();\n this.heatmapFbo = null;\n }\n }\n\n queryRadius(): number {\n return 0;\n }\n\n queryIntersectsFeature(): boolean {\n return false;\n }\n\n hasOffscreenPass() {\n return this.paint.get('heatmap-opacity') !== 0 && this.visibility !== 'none';\n }\n}\n\nexport default HeatmapStyleLayer;\n","// This file is generated. Edit build/generate-style-code.js, then run `yarn run codegen`.\n// @flow\n/* eslint-disable */\n\nimport styleSpec from '../../style-spec/reference/latest';\n\nimport {\n Properties,\n DataConstantProperty,\n DataDrivenProperty,\n CrossFadedDataDrivenProperty,\n CrossFadedProperty,\n ColorRampProperty\n} from '../properties';\n\nimport type Color from '../../style-spec/util/color';\n\nimport type Formatted from '../../style-spec/expression/types/formatted';\n\nimport type ResolvedImage from '../../style-spec/expression/types/resolved_image';\n\n\nexport type PaintProps = {|\n \"hillshade-illumination-direction\": DataConstantProperty,\n \"hillshade-illumination-anchor\": DataConstantProperty<\"map\" | \"viewport\">,\n \"hillshade-exaggeration\": DataConstantProperty,\n \"hillshade-shadow-color\": DataConstantProperty,\n \"hillshade-highlight-color\": DataConstantProperty,\n \"hillshade-accent-color\": DataConstantProperty,\n|};\n\nconst paint: Properties = new Properties({\n \"hillshade-illumination-direction\": new DataConstantProperty(styleSpec[\"paint_hillshade\"][\"hillshade-illumination-direction\"]),\n \"hillshade-illumination-anchor\": new DataConstantProperty(styleSpec[\"paint_hillshade\"][\"hillshade-illumination-anchor\"]),\n \"hillshade-exaggeration\": new DataConstantProperty(styleSpec[\"paint_hillshade\"][\"hillshade-exaggeration\"]),\n \"hillshade-shadow-color\": new DataConstantProperty(styleSpec[\"paint_hillshade\"][\"hillshade-shadow-color\"]),\n \"hillshade-highlight-color\": new DataConstantProperty(styleSpec[\"paint_hillshade\"][\"hillshade-highlight-color\"]),\n \"hillshade-accent-color\": new DataConstantProperty(styleSpec[\"paint_hillshade\"][\"hillshade-accent-color\"]),\n});\n\n// Note: without adding the explicit type annotation, Flow infers weaker types\n// for these objects from their use in the constructor to StyleLayer, as\n// {layout?: Properties<...>, paint: Properties<...>}\nexport default ({ paint }: $Exact<{\n paint: Properties\n}>);\n","// @flow\n\nimport StyleLayer from '../style_layer';\n\nimport properties from './hillshade_style_layer_properties';\nimport {Transitionable, Transitioning, PossiblyEvaluated} from '../properties';\n\nimport type {PaintProps} from './hillshade_style_layer_properties';\nimport type {LayerSpecification} from '../../style-spec/types';\n\nclass HillshadeStyleLayer extends StyleLayer {\n _transitionablePaint: Transitionable;\n _transitioningPaint: Transitioning;\n paint: PossiblyEvaluated;\n\n constructor(layer: LayerSpecification) {\n super(layer, properties);\n }\n\n hasOffscreenPass() {\n return this.paint.get('hillshade-exaggeration') !== 0 && this.visibility !== 'none';\n }\n}\n\nexport default HillshadeStyleLayer;\n","// @flow\nimport {createLayout} from '../../util/struct_array';\n\nconst layout = createLayout([\n {name: 'a_pos', components: 2, type: 'Int16'}\n], 4);\n\nexport default layout;\nexport const {members, size, alignment} = layout;\n","'use strict';\n\nmodule.exports = earcut;\nmodule.exports.default = earcut;\n\nfunction earcut(data, holeIndices, dim) {\n\n dim = dim || 2;\n\n var hasHoles = holeIndices && holeIndices.length,\n outerLen = hasHoles ? holeIndices[0] * dim : data.length,\n outerNode = linkedList(data, 0, outerLen, dim, true),\n triangles = [];\n\n if (!outerNode || outerNode.next === outerNode.prev) return triangles;\n\n var minX, minY, maxX, maxY, x, y, invSize;\n\n if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);\n\n // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n if (data.length > 80 * dim) {\n minX = maxX = data[0];\n minY = maxY = data[1];\n\n for (var i = dim; i < outerLen; i += dim) {\n x = data[i];\n y = data[i + 1];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n }\n\n // minX, minY and invSize are later used to transform coords into integers for z-order calculation\n invSize = Math.max(maxX - minX, maxY - minY);\n invSize = invSize !== 0 ? 1 / invSize : 0;\n }\n\n earcutLinked(outerNode, triangles, dim, minX, minY, invSize);\n\n return triangles;\n}\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList(data, start, end, dim, clockwise) {\n var i, last;\n\n if (clockwise === (signedArea(data, start, end, dim) > 0)) {\n for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);\n } else {\n for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);\n }\n\n if (last && equals(last, last.next)) {\n removeNode(last);\n last = last.next;\n }\n\n return last;\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) break;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {\n if (!ear) return;\n\n // interlink polygon nodes in z-order\n if (!pass && invSize) indexCurve(ear, minX, minY, invSize);\n\n var stop = ear,\n prev, next;\n\n // iterate through ears, slicing them one by one\n while (ear.prev !== ear.next) {\n prev = ear.prev;\n next = ear.next;\n\n if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {\n // cut off the triangle\n triangles.push(prev.i / dim);\n triangles.push(ear.i / dim);\n triangles.push(next.i / dim);\n\n removeNode(ear);\n\n // skipping the next vertex leads to less sliver triangles\n ear = next.next;\n stop = next.next;\n\n continue;\n }\n\n ear = next;\n\n // if we looped through the whole remaining polygon and can't find any more ears\n if (ear === stop) {\n // try filtering points and slicing again\n if (!pass) {\n earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);\n\n // if this didn't work, try curing all small self-intersections locally\n } else if (pass === 1) {\n ear = cureLocalIntersections(filterPoints(ear), triangles, dim);\n earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);\n\n // as a last resort, try splitting the remaining polygon into two\n } else if (pass === 2) {\n splitEarcut(ear, triangles, dim, minX, minY, invSize);\n }\n\n break;\n }\n }\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar(ear) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // now make sure we don't have other points inside the potential ear\n var p = ear.next.next;\n\n while (p !== ear.prev) {\n if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.next;\n }\n\n return true;\n}\n\nfunction isEarHashed(ear, minX, minY, invSize) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // triangle bbox; min & max are calculated like this for speed\n var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x),\n minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y),\n maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x),\n maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y);\n\n // z-order range for the current triangle bbox;\n var minZ = zOrder(minTX, minTY, minX, minY, invSize),\n maxZ = zOrder(maxTX, maxTY, minX, minY, invSize);\n\n var p = ear.prevZ,\n n = ear.nextZ;\n\n // look for points inside the triangle in both directions\n while (p && p.z >= minZ && n && n.z <= maxZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n\n if (n !== ear.prev && n !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&\n area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n // look for remaining points in decreasing z-order\n while (p && p.z >= minZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n }\n\n // look for remaining points in increasing z-order\n while (n && n.z <= maxZ) {\n if (n !== ear.prev && n !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&\n area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n return true;\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return filterPoints(p);\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut(start, triangles, dim, minX, minY, invSize) {\n // look for a valid diagonal that divides the polygon into two\n var a = start;\n do {\n var b = a.next.next;\n while (b !== a.prev) {\n if (a.i !== b.i && isValidDiagonal(a, b)) {\n // split the polygon in two by the diagonal\n var c = splitPolygon(a, b);\n\n // filter colinear points around the cuts\n a = filterPoints(a, a.next);\n c = filterPoints(c, c.next);\n\n // run earcut on each half\n earcutLinked(a, triangles, dim, minX, minY, invSize);\n earcutLinked(c, triangles, dim, minX, minY, invSize);\n return;\n }\n b = b.next;\n }\n a = a.next;\n } while (a !== start);\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles(data, holeIndices, outerNode, dim) {\n var queue = [],\n i, len, start, end, list;\n\n for (i = 0, len = holeIndices.length; i < len; i++) {\n start = holeIndices[i] * dim;\n end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n list = linkedList(data, start, end, dim, false);\n if (list === list.next) list.steiner = true;\n queue.push(getLeftmost(list));\n }\n\n queue.sort(compareX);\n\n // process holes from left to right\n for (i = 0; i < queue.length; i++) {\n eliminateHole(queue[i], outerNode);\n outerNode = filterPoints(outerNode, outerNode.next);\n }\n\n return outerNode;\n}\n\nfunction compareX(a, b) {\n return a.x - b.x;\n}\n\n// find a bridge between vertices that connects hole with an outer ring and and link it\nfunction eliminateHole(hole, outerNode) {\n outerNode = findHoleBridge(hole, outerNode);\n if (outerNode) {\n var b = splitPolygon(outerNode, hole);\n\n // filter collinear points around the cuts\n filterPoints(outerNode, outerNode.next);\n filterPoints(b, b.next);\n }\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge(hole, outerNode) {\n var p = outerNode,\n hx = hole.x,\n hy = hole.y,\n qx = -Infinity,\n m;\n\n // find a segment intersected by a ray from the hole's leftmost point to the left;\n // segment's endpoint with lesser x will be potential connection point\n do {\n if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {\n var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n if (x <= hx && x > qx) {\n qx = x;\n if (x === hx) {\n if (hy === p.y) return p;\n if (hy === p.next.y) return p.next;\n }\n m = p.x < p.next.x ? p : p.next;\n }\n }\n p = p.next;\n } while (p !== outerNode);\n\n if (!m) return null;\n\n if (hx === qx) return m; // hole touches outer segment; pick leftmost endpoint\n\n // look for points inside the triangle of hole point, segment intersection and endpoint;\n // if there are no points found, we have a valid connection;\n // otherwise choose the point of the minimum angle with the ray as connection point\n\n var stop = m,\n mx = m.x,\n my = m.y,\n tanMin = Infinity,\n tan;\n\n p = m;\n\n do {\n if (hx >= p.x && p.x >= mx && hx !== p.x &&\n pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {\n\n tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n\n if (locallyInside(p, hole) &&\n (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) {\n m = p;\n tanMin = tan;\n }\n }\n\n p = p.next;\n } while (p !== stop);\n\n return m;\n}\n\n// whether sector in vertex m contains sector in vertex p in the same coordinates\nfunction sectorContainsSector(m, p) {\n return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve(start, minX, minY, invSize) {\n var p = start;\n do {\n if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, invSize);\n p.prevZ = p.prev;\n p.nextZ = p.next;\n p = p.next;\n } while (p !== start);\n\n p.prevZ.nextZ = null;\n p.prevZ = null;\n\n sortLinked(p);\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked(list) {\n var i, p, q, e, tail, numMerges, pSize, qSize,\n inSize = 1;\n\n do {\n p = list;\n list = null;\n tail = null;\n numMerges = 0;\n\n while (p) {\n numMerges++;\n q = p;\n pSize = 0;\n for (i = 0; i < inSize; i++) {\n pSize++;\n q = q.nextZ;\n if (!q) break;\n }\n qSize = inSize;\n\n while (pSize > 0 || (qSize > 0 && q)) {\n\n if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else {\n e = q;\n q = q.nextZ;\n qSize--;\n }\n\n if (tail) tail.nextZ = e;\n else list = e;\n\n e.prevZ = tail;\n tail = e;\n }\n\n p = q;\n }\n\n tail.nextZ = null;\n inSize *= 2;\n\n } while (numMerges > 1);\n\n return list;\n}\n\n// z-order of a point given coords and inverse of the longer side of data bbox\nfunction zOrder(x, y, minX, minY, invSize) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) * invSize;\n y = 32767 * (y - minY) * invSize;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost(start) {\n var p = start,\n leftmost = start;\n do {\n if (p.x < leftmost.x || (p.x === leftmost.x && p.y < leftmost.y)) leftmost = p;\n p = p.next;\n } while (p !== start);\n\n return leftmost;\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal(a, b) {\n return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges\n (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible\n (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors\n equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case\n}\n\n// signed area of a triangle\nfunction area(p, q, r) {\n return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n}\n\n// check if two points are equal\nfunction equals(p1, p2) {\n return p1.x === p2.x && p1.y === p2.y;\n}\n\n// check if two segments intersect\nfunction intersects(p1, q1, p2, q2) {\n var o1 = sign(area(p1, q1, p2));\n var o2 = sign(area(p1, q1, q2));\n var o3 = sign(area(p2, q2, p1));\n var o4 = sign(area(p2, q2, q1));\n\n if (o1 !== o2 && o3 !== o4) return true; // general case\n\n if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1\n if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1\n if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2\n if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2\n\n return false;\n}\n\n// for collinear points p, q, r, check if point q lies on segment pr\nfunction onSegment(p, q, r) {\n return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);\n}\n\nfunction sign(num) {\n return num > 0 ? 1 : num < 0 ? -1 : 0;\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon(a, b) {\n var p = a;\n do {\n if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n intersects(p, p.next, a, b)) return true;\n p = p.next;\n } while (p !== a);\n\n return false;\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside(a, b) {\n return area(a.prev, a, a.next) < 0 ?\n area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :\n area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon(a, b) {\n var a2 = new Node(a.i, a.x, a.y),\n b2 = new Node(b.i, b.x, b.y),\n an = a.next,\n bp = b.prev;\n\n a.next = b;\n b.prev = a;\n\n a2.next = an;\n an.prev = a2;\n\n b2.next = a2;\n a2.prev = b2;\n\n bp.next = b2;\n b2.prev = bp;\n\n return b2;\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode(i, x, y, last) {\n var p = new Node(i, x, y);\n\n if (!last) {\n p.prev = p;\n p.next = p;\n\n } else {\n p.next = last.next;\n p.prev = last;\n last.next.prev = p;\n last.next = p;\n }\n return p;\n}\n\nfunction removeNode(p) {\n p.next.prev = p.prev;\n p.prev.next = p.next;\n\n if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n}\n\nfunction Node(i, x, y) {\n // vertex index in coordinates array\n this.i = i;\n\n // vertex coordinates\n this.x = x;\n this.y = y;\n\n // previous and next vertex nodes in a polygon ring\n this.prev = null;\n this.next = null;\n\n // z-order curve value\n this.z = null;\n\n // previous and next nodes in z-order\n this.prevZ = null;\n this.nextZ = null;\n\n // indicates whether this is a steiner point\n this.steiner = false;\n}\n\n// return a percentage difference between the polygon area and its triangulation area;\n// used to verify correctness of triangulation\nearcut.deviation = function (data, holeIndices, dim, triangles) {\n var hasHoles = holeIndices && holeIndices.length;\n var outerLen = hasHoles ? holeIndices[0] * dim : data.length;\n\n var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim));\n if (hasHoles) {\n for (var i = 0, len = holeIndices.length; i < len; i++) {\n var start = holeIndices[i] * dim;\n var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n polygonArea -= Math.abs(signedArea(data, start, end, dim));\n }\n }\n\n var trianglesArea = 0;\n for (i = 0; i < triangles.length; i += 3) {\n var a = triangles[i] * dim;\n var b = triangles[i + 1] * dim;\n var c = triangles[i + 2] * dim;\n trianglesArea += Math.abs(\n (data[a] - data[c]) * (data[b + 1] - data[a + 1]) -\n (data[a] - data[b]) * (data[c + 1] - data[a + 1]));\n }\n\n return polygonArea === 0 && trianglesArea === 0 ? 0 :\n Math.abs((trianglesArea - polygonArea) / polygonArea);\n};\n\nfunction signedArea(data, start, end, dim) {\n var sum = 0;\n for (var i = start, j = end - dim; i < end; i += dim) {\n sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n j = i;\n }\n return sum;\n}\n\n// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts\nearcut.flatten = function (data) {\n var dim = data[0][0].length,\n result = {vertices: [], holes: [], dimensions: dim},\n holeIndex = 0;\n\n for (var i = 0; i < data.length; i++) {\n for (var j = 0; j < data[i].length; j++) {\n for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]);\n }\n if (i > 0) {\n holeIndex += data[i - 1].length;\n result.holes.push(holeIndex);\n }\n }\n return result;\n};\n","\nexport default function quickselect(arr, k, left, right, compare) {\n quickselectStep(arr, k, left || 0, right || (arr.length - 1), compare || defaultCompare);\n}\n\nfunction quickselectStep(arr, k, left, right, compare) {\n\n while (right > left) {\n if (right - left > 600) {\n var n = right - left + 1;\n var m = k - left + 1;\n var z = Math.log(n);\n var s = 0.5 * Math.exp(2 * z / 3);\n var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);\n var newLeft = Math.max(left, Math.floor(k - m * s / n + sd));\n var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));\n quickselectStep(arr, k, newLeft, newRight, compare);\n }\n\n var t = arr[k];\n var i = left;\n var j = right;\n\n swap(arr, left, k);\n if (compare(arr[right], t) > 0) swap(arr, left, right);\n\n while (i < j) {\n swap(arr, i, j);\n i++;\n j--;\n while (compare(arr[i], t) < 0) i++;\n while (compare(arr[j], t) > 0) j--;\n }\n\n if (compare(arr[left], t) === 0) swap(arr, left, j);\n else {\n j++;\n swap(arr, j, right);\n }\n\n if (j <= k) left = j + 1;\n if (k <= j) right = j - 1;\n }\n}\n\nfunction swap(arr, i, j) {\n var tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n}\n\nfunction defaultCompare(a, b) {\n return a < b ? -1 : a > b ? 1 : 0;\n}\n","// @flow\n\nimport quickselect from 'quickselect';\n\nimport {calculateSignedArea} from './util';\n\nimport type Point from '@mapbox/point-geometry';\n\n// classifies an array of rings into polygons with outer rings and holes\nexport default function classifyRings(rings: Array>, maxRings: number) {\n const len = rings.length;\n\n if (len <= 1) return [rings];\n\n const polygons = [];\n let polygon,\n ccw;\n\n for (let i = 0; i < len; i++) {\n const area = calculateSignedArea(rings[i]);\n if (area === 0) continue;\n\n (rings[i]: any).area = Math.abs(area);\n\n if (ccw === undefined) ccw = area < 0;\n\n if (ccw === area < 0) {\n if (polygon) polygons.push(polygon);\n polygon = [rings[i]];\n\n } else {\n (polygon: any).push(rings[i]);\n }\n }\n if (polygon) polygons.push(polygon);\n\n // Earcut performance degrades with the # of rings in a polygon. For this\n // reason, we limit strip out all but the `maxRings` largest rings.\n if (maxRings > 1) {\n for (let j = 0; j < polygons.length; j++) {\n if (polygons[j].length <= maxRings) continue;\n quickselect(polygons[j], maxRings, 1, polygons[j].length - 1, compareAreas);\n polygons[j] = polygons[j].slice(0, maxRings);\n }\n }\n\n return polygons;\n}\n\nfunction compareAreas(a, b) {\n return b.area - a.area;\n}\n","// @flow\nimport type FillStyleLayer from '../../style/style_layer/fill_style_layer';\nimport type FillExtrusionStyleLayer from '../../style/style_layer/fill_extrusion_style_layer';\nimport type LineStyleLayer from '../../style/style_layer/line_style_layer';\n\nimport type {\n BucketFeature,\n PopulateParameters\n} from '../bucket';\n\ntype PatternStyleLayers =\n Array |\n Array |\n Array;\n\nexport function hasPattern(type: string, layers: PatternStyleLayers, options: PopulateParameters) {\n const patterns = options.patternDependencies;\n let hasPattern = false;\n\n for (const layer of layers) {\n const patternProperty = layer.paint.get(`${type}-pattern`);\n if (!patternProperty.isConstant()) {\n hasPattern = true;\n }\n\n const constantPattern = patternProperty.constantOr(null);\n if (constantPattern) {\n hasPattern = true;\n patterns[constantPattern.to] = true;\n patterns[constantPattern.from] = true;\n }\n }\n\n return hasPattern;\n}\n\nexport function addPatternDependencies(type: string, layers: PatternStyleLayers, patternFeature: BucketFeature, zoom: number, options: PopulateParameters) {\n const patterns = options.patternDependencies;\n for (const layer of layers) {\n const patternProperty = layer.paint.get(`${type}-pattern`);\n\n const patternPropertyValue = patternProperty.value;\n if (patternPropertyValue.kind !== \"constant\") {\n let min = patternPropertyValue.evaluate({zoom: zoom - 1}, patternFeature, {}, options.availableImages);\n let mid = patternPropertyValue.evaluate({zoom}, patternFeature, {}, options.availableImages);\n let max = patternPropertyValue.evaluate({zoom: zoom + 1}, patternFeature, {}, options.availableImages);\n min = min && min.name ? min.name : min;\n mid = mid && mid.name ? mid.name : mid;\n max = max && max.name ? max.name : max;\n // add to patternDependencies\n patterns[min] = true;\n patterns[mid] = true;\n patterns[max] = true;\n\n // save for layout\n patternFeature.patterns[layer.id] = {min, mid, max};\n }\n }\n return patternFeature;\n}\n","// @flow\n\nimport {FillLayoutArray} from '../array_types';\n\nimport {members as layoutAttributes} from './fill_attributes';\nimport SegmentVector from '../segment';\nimport {ProgramConfigurationSet} from '../program_configuration';\nimport {LineIndexArray, TriangleIndexArray} from '../index_array_type';\nimport earcut from 'earcut';\nimport classifyRings from '../../util/classify_rings';\nimport assert from 'assert';\nconst EARCUT_MAX_RINGS = 500;\nimport {register} from '../../util/web_worker_transfer';\nimport {hasPattern, addPatternDependencies} from './pattern_bucket_features';\nimport loadGeometry from '../load_geometry';\nimport toEvaluationFeature from '../evaluation_feature';\nimport EvaluationParameters from '../../style/evaluation_parameters';\n\nimport type {CanonicalTileID} from '../../source/tile_id';\nimport type {\n Bucket,\n BucketParameters,\n BucketFeature,\n IndexedFeature,\n PopulateParameters\n} from '../bucket';\nimport type FillStyleLayer from '../../style/style_layer/fill_style_layer';\nimport type Context from '../../gl/context';\nimport type IndexBuffer from '../../gl/index_buffer';\nimport type VertexBuffer from '../../gl/vertex_buffer';\nimport type Point from '@mapbox/point-geometry';\nimport type {FeatureStates} from '../../source/source_state';\nimport type {ImagePosition} from '../../render/image_atlas';\n\nclass FillBucket implements Bucket {\n index: number;\n zoom: number;\n overscaling: number;\n layers: Array;\n layerIds: Array;\n stateDependentLayers: Array;\n stateDependentLayerIds: Array;\n patternFeatures: Array;\n\n layoutVertexArray: FillLayoutArray;\n layoutVertexBuffer: VertexBuffer;\n\n indexArray: TriangleIndexArray;\n indexBuffer: IndexBuffer;\n\n indexArray2: LineIndexArray;\n indexBuffer2: IndexBuffer;\n\n hasPattern: boolean;\n programConfigurations: ProgramConfigurationSet;\n segments: SegmentVector;\n segments2: SegmentVector;\n uploaded: boolean;\n\n constructor(options: BucketParameters) {\n this.zoom = options.zoom;\n this.overscaling = options.overscaling;\n this.layers = options.layers;\n this.layerIds = this.layers.map(layer => layer.id);\n this.index = options.index;\n this.hasPattern = false;\n this.patternFeatures = [];\n\n this.layoutVertexArray = new FillLayoutArray();\n this.indexArray = new TriangleIndexArray();\n this.indexArray2 = new LineIndexArray();\n this.programConfigurations = new ProgramConfigurationSet(options.layers, options.zoom);\n this.segments = new SegmentVector();\n this.segments2 = new SegmentVector();\n this.stateDependentLayerIds = this.layers.filter((l) => l.isStateDependent()).map((l) => l.id);\n }\n\n populate(features: Array, options: PopulateParameters, canonical: CanonicalTileID) {\n this.hasPattern = hasPattern('fill', this.layers, options);\n const fillSortKey = this.layers[0].layout.get('fill-sort-key');\n const sortFeaturesByKey = !fillSortKey.isConstant();\n const bucketFeatures = [];\n\n for (const {feature, id, index, sourceLayerIndex} of features) {\n const needGeometry = this.layers[0]._featureFilter.needGeometry;\n const evaluationFeature = toEvaluationFeature(feature, needGeometry);\n\n if (!this.layers[0]._featureFilter.filter(new EvaluationParameters(this.zoom), evaluationFeature, canonical)) continue;\n\n const sortKey = sortFeaturesByKey ?\n fillSortKey.evaluate(evaluationFeature, {}, canonical, options.availableImages) :\n undefined;\n\n const bucketFeature: BucketFeature = {\n id,\n properties: feature.properties,\n type: feature.type,\n sourceLayerIndex,\n index,\n geometry: needGeometry ? evaluationFeature.geometry : loadGeometry(feature),\n patterns: {},\n sortKey\n };\n\n bucketFeatures.push(bucketFeature);\n }\n\n if (sortFeaturesByKey) {\n bucketFeatures.sort((a, b) => {\n // a.sortKey is always a number when in use\n return ((a.sortKey: any): number) - ((b.sortKey: any): number);\n });\n }\n\n for (const bucketFeature of bucketFeatures) {\n const {geometry, index, sourceLayerIndex} = bucketFeature;\n\n if (this.hasPattern) {\n const patternFeature = addPatternDependencies('fill', this.layers, bucketFeature, this.zoom, options);\n // pattern features are added only once the pattern is loaded into the image atlas\n // so are stored during populate until later updated with positions by tile worker in addFeatures\n this.patternFeatures.push(patternFeature);\n } else {\n this.addFeature(bucketFeature, geometry, index, canonical, {});\n }\n\n const feature = features[index].feature;\n options.featureIndex.insert(feature, geometry, index, sourceLayerIndex, this.index);\n }\n }\n\n update(states: FeatureStates, vtLayer: VectorTileLayer, imagePositions: {[_: string]: ImagePosition}) {\n if (!this.stateDependentLayers.length) return;\n this.programConfigurations.updatePaintArrays(states, vtLayer, this.stateDependentLayers, imagePositions);\n }\n\n addFeatures(options: PopulateParameters, canonical: CanonicalTileID, imagePositions: {[_: string]: ImagePosition}) {\n for (const feature of this.patternFeatures) {\n this.addFeature(feature, feature.geometry, feature.index, canonical, imagePositions);\n }\n }\n\n isEmpty() {\n return this.layoutVertexArray.length === 0;\n }\n\n uploadPending(): boolean {\n return !this.uploaded || this.programConfigurations.needsUpload;\n }\n upload(context: Context) {\n if (!this.uploaded) {\n this.layoutVertexBuffer = context.createVertexBuffer(this.layoutVertexArray, layoutAttributes);\n this.indexBuffer = context.createIndexBuffer(this.indexArray);\n this.indexBuffer2 = context.createIndexBuffer(this.indexArray2);\n }\n this.programConfigurations.upload(context);\n this.uploaded = true;\n }\n\n destroy() {\n if (!this.layoutVertexBuffer) return;\n this.layoutVertexBuffer.destroy();\n this.indexBuffer.destroy();\n this.indexBuffer2.destroy();\n this.programConfigurations.destroy();\n this.segments.destroy();\n this.segments2.destroy();\n }\n\n addFeature(feature: BucketFeature, geometry: Array>, index: number, canonical: CanonicalTileID, imagePositions: {[_: string]: ImagePosition}) {\n for (const polygon of classifyRings(geometry, EARCUT_MAX_RINGS)) {\n let numVertices = 0;\n for (const ring of polygon) {\n numVertices += ring.length;\n }\n\n const triangleSegment = this.segments.prepareSegment(numVertices, this.layoutVertexArray, this.indexArray);\n const triangleIndex = triangleSegment.vertexLength;\n\n const flattened = [];\n const holeIndices = [];\n\n for (const ring of polygon) {\n if (ring.length === 0) {\n continue;\n }\n\n if (ring !== polygon[0]) {\n holeIndices.push(flattened.length / 2);\n }\n\n const lineSegment = this.segments2.prepareSegment(ring.length, this.layoutVertexArray, this.indexArray2);\n const lineIndex = lineSegment.vertexLength;\n\n this.layoutVertexArray.emplaceBack(ring[0].x, ring[0].y);\n this.indexArray2.emplaceBack(lineIndex + ring.length - 1, lineIndex);\n flattened.push(ring[0].x);\n flattened.push(ring[0].y);\n\n for (let i = 1; i < ring.length; i++) {\n this.layoutVertexArray.emplaceBack(ring[i].x, ring[i].y);\n this.indexArray2.emplaceBack(lineIndex + i - 1, lineIndex + i);\n flattened.push(ring[i].x);\n flattened.push(ring[i].y);\n }\n\n lineSegment.vertexLength += ring.length;\n lineSegment.primitiveLength += ring.length;\n }\n\n const indices = earcut(flattened, holeIndices);\n assert(indices.length % 3 === 0);\n\n for (let i = 0; i < indices.length; i += 3) {\n this.indexArray.emplaceBack(\n triangleIndex + indices[i],\n triangleIndex + indices[i + 1],\n triangleIndex + indices[i + 2]);\n }\n\n triangleSegment.vertexLength += numVertices;\n triangleSegment.primitiveLength += indices.length / 3;\n }\n this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, feature, index, imagePositions, canonical);\n }\n}\n\nregister('FillBucket', FillBucket, {omit: ['layers', 'patternFeatures']});\n\nexport default FillBucket;\n","// This file is generated. Edit build/generate-style-code.js, then run `yarn run codegen`.\n// @flow\n/* eslint-disable */\n\nimport styleSpec from '../../style-spec/reference/latest';\n\nimport {\n Properties,\n DataConstantProperty,\n DataDrivenProperty,\n CrossFadedDataDrivenProperty,\n CrossFadedProperty,\n ColorRampProperty\n} from '../properties';\n\nimport type Color from '../../style-spec/util/color';\n\nimport type Formatted from '../../style-spec/expression/types/formatted';\n\nimport type ResolvedImage from '../../style-spec/expression/types/resolved_image';\n\nexport type LayoutProps = {|\n \"fill-sort-key\": DataDrivenProperty,\n|};\n\nconst layout: Properties = new Properties({\n \"fill-sort-key\": new DataDrivenProperty(styleSpec[\"layout_fill\"][\"fill-sort-key\"]),\n});\n\nexport type PaintProps = {|\n \"fill-antialias\": DataConstantProperty,\n \"fill-opacity\": DataDrivenProperty,\n \"fill-color\": DataDrivenProperty,\n \"fill-outline-color\": DataDrivenProperty,\n \"fill-translate\": DataConstantProperty<[number, number]>,\n \"fill-translate-anchor\": DataConstantProperty<\"map\" | \"viewport\">,\n \"fill-pattern\": CrossFadedDataDrivenProperty,\n|};\n\nconst paint: Properties = new Properties({\n \"fill-antialias\": new DataConstantProperty(styleSpec[\"paint_fill\"][\"fill-antialias\"]),\n \"fill-opacity\": new DataDrivenProperty(styleSpec[\"paint_fill\"][\"fill-opacity\"]),\n \"fill-color\": new DataDrivenProperty(styleSpec[\"paint_fill\"][\"fill-color\"]),\n \"fill-outline-color\": new DataDrivenProperty(styleSpec[\"paint_fill\"][\"fill-outline-color\"]),\n \"fill-translate\": new DataConstantProperty(styleSpec[\"paint_fill\"][\"fill-translate\"]),\n \"fill-translate-anchor\": new DataConstantProperty(styleSpec[\"paint_fill\"][\"fill-translate-anchor\"]),\n \"fill-pattern\": new CrossFadedDataDrivenProperty(styleSpec[\"paint_fill\"][\"fill-pattern\"]),\n});\n\n// Note: without adding the explicit type annotation, Flow infers weaker types\n// for these objects from their use in the constructor to StyleLayer, as\n// {layout?: Properties<...>, paint: Properties<...>}\nexport default ({ paint, layout }: $Exact<{\n paint: Properties, layout: Properties\n}>);\n","// @flow\n\nimport StyleLayer from '../style_layer';\n\nimport FillBucket from '../../data/bucket/fill_bucket';\nimport {polygonIntersectsMultiPolygon} from '../../util/intersection_tests';\nimport {translateDistance, translate} from '../query_utils';\nimport properties from './fill_style_layer_properties';\nimport {Transitionable, Transitioning, Layout, PossiblyEvaluated} from '../properties';\n\nimport type {FeatureState} from '../../style-spec/expression';\nimport type {BucketParameters} from '../../data/bucket';\nimport type Point from '@mapbox/point-geometry';\nimport type {LayoutProps, PaintProps} from './fill_style_layer_properties';\nimport type EvaluationParameters from '../evaluation_parameters';\nimport type Transform from '../../geo/transform';\nimport type {LayerSpecification} from '../../style-spec/types';\n\nclass FillStyleLayer extends StyleLayer {\n _unevaluatedLayout: Layout;\n layout: PossiblyEvaluated;\n\n _transitionablePaint: Transitionable;\n _transitioningPaint: Transitioning;\n paint: PossiblyEvaluated;\n\n constructor(layer: LayerSpecification) {\n super(layer, properties);\n }\n\n recalculate(parameters: EvaluationParameters, availableImages: Array) {\n super.recalculate(parameters, availableImages);\n\n const outlineColor = this.paint._values['fill-outline-color'];\n if (outlineColor.value.kind === 'constant' && outlineColor.value.value === undefined) {\n this.paint._values['fill-outline-color'] = this.paint._values['fill-color'];\n }\n }\n\n createBucket(parameters: BucketParameters<*>) {\n return new FillBucket(parameters);\n }\n\n queryRadius(): number {\n return translateDistance(this.paint.get('fill-translate'));\n }\n\n queryIntersectsFeature(queryGeometry: Array,\n feature: VectorTileFeature,\n featureState: FeatureState,\n geometry: Array>,\n zoom: number,\n transform: Transform,\n pixelsToTileUnits: number): boolean {\n const translatedPolygon = translate(queryGeometry,\n this.paint.get('fill-translate'),\n this.paint.get('fill-translate-anchor'),\n transform.angle, pixelsToTileUnits);\n return polygonIntersectsMultiPolygon(translatedPolygon, geometry);\n }\n\n isTileClipped() {\n return true;\n }\n}\n\nexport default FillStyleLayer;\n","// @flow\nimport {createLayout} from '../../util/struct_array';\n\nconst layout = createLayout([\n {name: 'a_pos', components: 2, type: 'Int16'},\n {name: 'a_normal_ed', components: 4, type: 'Int16'},\n], 4);\n\nexport default layout;\nexport const {members, size, alignment} = layout;\n","'use strict';\n\nvar Point = require('@mapbox/point-geometry');\n\nmodule.exports = VectorTileFeature;\n\nfunction VectorTileFeature(pbf, end, extent, keys, values) {\n // Public\n this.properties = {};\n this.extent = extent;\n this.type = 0;\n\n // Private\n this._pbf = pbf;\n this._geometry = -1;\n this._keys = keys;\n this._values = values;\n\n pbf.readFields(readFeature, this, end);\n}\n\nfunction readFeature(tag, feature, pbf) {\n if (tag == 1) feature.id = pbf.readVarint();\n else if (tag == 2) readTag(pbf, feature);\n else if (tag == 3) feature.type = pbf.readVarint();\n else if (tag == 4) feature._geometry = pbf.pos;\n}\n\nfunction readTag(pbf, feature) {\n var end = pbf.readVarint() + pbf.pos;\n\n while (pbf.pos < end) {\n var key = feature._keys[pbf.readVarint()],\n value = feature._values[pbf.readVarint()];\n feature.properties[key] = value;\n }\n}\n\nVectorTileFeature.types = ['Unknown', 'Point', 'LineString', 'Polygon'];\n\nVectorTileFeature.prototype.loadGeometry = function() {\n var pbf = this._pbf;\n pbf.pos = this._geometry;\n\n var end = pbf.readVarint() + pbf.pos,\n cmd = 1,\n length = 0,\n x = 0,\n y = 0,\n lines = [],\n line;\n\n while (pbf.pos < end) {\n if (length <= 0) {\n var cmdLen = pbf.readVarint();\n cmd = cmdLen & 0x7;\n length = cmdLen >> 3;\n }\n\n length--;\n\n if (cmd === 1 || cmd === 2) {\n x += pbf.readSVarint();\n y += pbf.readSVarint();\n\n if (cmd === 1) { // moveTo\n if (line) lines.push(line);\n line = [];\n }\n\n line.push(new Point(x, y));\n\n } else if (cmd === 7) {\n\n // Workaround for https://github.com/mapbox/mapnik-vector-tile/issues/90\n if (line) {\n line.push(line[0].clone()); // closePolygon\n }\n\n } else {\n throw new Error('unknown command ' + cmd);\n }\n }\n\n if (line) lines.push(line);\n\n return lines;\n};\n\nVectorTileFeature.prototype.bbox = function() {\n var pbf = this._pbf;\n pbf.pos = this._geometry;\n\n var end = pbf.readVarint() + pbf.pos,\n cmd = 1,\n length = 0,\n x = 0,\n y = 0,\n x1 = Infinity,\n x2 = -Infinity,\n y1 = Infinity,\n y2 = -Infinity;\n\n while (pbf.pos < end) {\n if (length <= 0) {\n var cmdLen = pbf.readVarint();\n cmd = cmdLen & 0x7;\n length = cmdLen >> 3;\n }\n\n length--;\n\n if (cmd === 1 || cmd === 2) {\n x += pbf.readSVarint();\n y += pbf.readSVarint();\n if (x < x1) x1 = x;\n if (x > x2) x2 = x;\n if (y < y1) y1 = y;\n if (y > y2) y2 = y;\n\n } else if (cmd !== 7) {\n throw new Error('unknown command ' + cmd);\n }\n }\n\n return [x1, y1, x2, y2];\n};\n\nVectorTileFeature.prototype.toGeoJSON = function(x, y, z) {\n var size = this.extent * Math.pow(2, z),\n x0 = this.extent * x,\n y0 = this.extent * y,\n coords = this.loadGeometry(),\n type = VectorTileFeature.types[this.type],\n i, j;\n\n function project(line) {\n for (var j = 0; j < line.length; j++) {\n var p = line[j], y2 = 180 - (p.y + y0) * 360 / size;\n line[j] = [\n (p.x + x0) * 360 / size - 180,\n 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90\n ];\n }\n }\n\n switch (this.type) {\n case 1:\n var points = [];\n for (i = 0; i < coords.length; i++) {\n points[i] = coords[i][0];\n }\n coords = points;\n project(coords);\n break;\n\n case 2:\n for (i = 0; i < coords.length; i++) {\n project(coords[i]);\n }\n break;\n\n case 3:\n coords = classifyRings(coords);\n for (i = 0; i < coords.length; i++) {\n for (j = 0; j < coords[i].length; j++) {\n project(coords[i][j]);\n }\n }\n break;\n }\n\n if (coords.length === 1) {\n coords = coords[0];\n } else {\n type = 'Multi' + type;\n }\n\n var result = {\n type: \"Feature\",\n geometry: {\n type: type,\n coordinates: coords\n },\n properties: this.properties\n };\n\n if ('id' in this) {\n result.id = this.id;\n }\n\n return result;\n};\n\n// classifies an array of rings into polygons with outer rings and holes\n\nfunction classifyRings(rings) {\n var len = rings.length;\n\n if (len <= 1) return [rings];\n\n var polygons = [],\n polygon,\n ccw;\n\n for (var i = 0; i < len; i++) {\n var area = signedArea(rings[i]);\n if (area === 0) continue;\n\n if (ccw === undefined) ccw = area < 0;\n\n if (ccw === area < 0) {\n if (polygon) polygons.push(polygon);\n polygon = [rings[i]];\n\n } else {\n polygon.push(rings[i]);\n }\n }\n if (polygon) polygons.push(polygon);\n\n return polygons;\n}\n\nfunction signedArea(ring) {\n var sum = 0;\n for (var i = 0, len = ring.length, j = len - 1, p1, p2; i < len; j = i++) {\n p1 = ring[i];\n p2 = ring[j];\n sum += (p2.x - p1.x) * (p1.y + p2.y);\n }\n return sum;\n}\n","'use strict';\n\nvar VectorTileFeature = require('./vectortilefeature.js');\n\nmodule.exports = VectorTileLayer;\n\nfunction VectorTileLayer(pbf, end) {\n // Public\n this.version = 1;\n this.name = null;\n this.extent = 4096;\n this.length = 0;\n\n // Private\n this._pbf = pbf;\n this._keys = [];\n this._values = [];\n this._features = [];\n\n pbf.readFields(readLayer, this, end);\n\n this.length = this._features.length;\n}\n\nfunction readLayer(tag, layer, pbf) {\n if (tag === 15) layer.version = pbf.readVarint();\n else if (tag === 1) layer.name = pbf.readString();\n else if (tag === 5) layer.extent = pbf.readVarint();\n else if (tag === 2) layer._features.push(pbf.pos);\n else if (tag === 3) layer._keys.push(pbf.readString());\n else if (tag === 4) layer._values.push(readValueMessage(pbf));\n}\n\nfunction readValueMessage(pbf) {\n var value = null,\n end = pbf.readVarint() + pbf.pos;\n\n while (pbf.pos < end) {\n var tag = pbf.readVarint() >> 3;\n\n value = tag === 1 ? pbf.readString() :\n tag === 2 ? pbf.readFloat() :\n tag === 3 ? pbf.readDouble() :\n tag === 4 ? pbf.readVarint64() :\n tag === 5 ? pbf.readVarint() :\n tag === 6 ? pbf.readSVarint() :\n tag === 7 ? pbf.readBoolean() : null;\n }\n\n return value;\n}\n\n// return feature `i` from this layer as a `VectorTileFeature`\nVectorTileLayer.prototype.feature = function(i) {\n if (i < 0 || i >= this._features.length) throw new Error('feature index out of bounds');\n\n this._pbf.pos = this._features[i];\n\n var end = this._pbf.readVarint() + this._pbf.pos;\n return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values);\n};\n","'use strict';\n\nvar VectorTileLayer = require('./vectortilelayer');\n\nmodule.exports = VectorTile;\n\nfunction VectorTile(pbf, end) {\n this.layers = pbf.readFields(readTile, {}, end);\n}\n\nfunction readTile(tag, layers, pbf) {\n if (tag === 3) {\n var layer = new VectorTileLayer(pbf, pbf.readVarint() + pbf.pos);\n if (layer.length) layers[layer.name] = layer;\n }\n}\n\n","module.exports.VectorTile = require('./lib/vectortile.js');\nmodule.exports.VectorTileFeature = require('./lib/vectortilefeature.js');\nmodule.exports.VectorTileLayer = require('./lib/vectortilelayer.js');\n","// @flow\n\nimport {FillExtrusionLayoutArray} from '../array_types';\n\nimport {members as layoutAttributes} from './fill_extrusion_attributes';\nimport SegmentVector from '../segment';\nimport {ProgramConfigurationSet} from '../program_configuration';\nimport {TriangleIndexArray} from '../index_array_type';\nimport EXTENT from '../extent';\nimport earcut from 'earcut';\nimport mvt from '@mapbox/vector-tile';\nconst vectorTileFeatureTypes = mvt.VectorTileFeature.types;\nimport classifyRings from '../../util/classify_rings';\nimport assert from 'assert';\nconst EARCUT_MAX_RINGS = 500;\nimport {register} from '../../util/web_worker_transfer';\nimport {hasPattern, addPatternDependencies} from './pattern_bucket_features';\nimport loadGeometry from '../load_geometry';\nimport toEvaluationFeature from '../evaluation_feature';\nimport EvaluationParameters from '../../style/evaluation_parameters';\n\nimport type {CanonicalTileID} from '../../source/tile_id';\nimport type {\n Bucket,\n BucketParameters,\n BucketFeature,\n IndexedFeature,\n PopulateParameters\n} from '../bucket';\n\nimport type FillExtrusionStyleLayer from '../../style/style_layer/fill_extrusion_style_layer';\nimport type Context from '../../gl/context';\nimport type IndexBuffer from '../../gl/index_buffer';\nimport type VertexBuffer from '../../gl/vertex_buffer';\nimport type Point from '@mapbox/point-geometry';\nimport type {FeatureStates} from '../../source/source_state';\nimport type {ImagePosition} from '../../render/image_atlas';\n\nconst FACTOR = Math.pow(2, 13);\n\nfunction addVertex(vertexArray, x, y, nx, ny, nz, t, e) {\n vertexArray.emplaceBack(\n // a_pos\n x,\n y,\n // a_normal_ed: 3-component normal and 1-component edgedistance\n Math.floor(nx * FACTOR) * 2 + t,\n ny * FACTOR * 2,\n nz * FACTOR * 2,\n // edgedistance (used for wrapping patterns around extrusion sides)\n Math.round(e)\n );\n}\n\nclass FillExtrusionBucket implements Bucket {\n index: number;\n zoom: number;\n overscaling: number;\n layers: Array;\n layerIds: Array;\n stateDependentLayers: Array;\n stateDependentLayerIds: Array;\n\n layoutVertexArray: FillExtrusionLayoutArray;\n layoutVertexBuffer: VertexBuffer;\n\n indexArray: TriangleIndexArray;\n indexBuffer: IndexBuffer;\n\n hasPattern: boolean;\n programConfigurations: ProgramConfigurationSet;\n segments: SegmentVector;\n uploaded: boolean;\n features: Array;\n\n constructor(options: BucketParameters) {\n this.zoom = options.zoom;\n this.overscaling = options.overscaling;\n this.layers = options.layers;\n this.layerIds = this.layers.map(layer => layer.id);\n this.index = options.index;\n this.hasPattern = false;\n\n this.layoutVertexArray = new FillExtrusionLayoutArray();\n this.indexArray = new TriangleIndexArray();\n this.programConfigurations = new ProgramConfigurationSet(options.layers, options.zoom);\n this.segments = new SegmentVector();\n this.stateDependentLayerIds = this.layers.filter((l) => l.isStateDependent()).map((l) => l.id);\n\n }\n\n populate(features: Array, options: PopulateParameters, canonical: CanonicalTileID) {\n this.features = [];\n this.hasPattern = hasPattern('fill-extrusion', this.layers, options);\n\n for (const {feature, id, index, sourceLayerIndex} of features) {\n const needGeometry = this.layers[0]._featureFilter.needGeometry;\n const evaluationFeature = toEvaluationFeature(feature, needGeometry);\n\n if (!this.layers[0]._featureFilter.filter(new EvaluationParameters(this.zoom), evaluationFeature, canonical)) continue;\n\n const bucketFeature: BucketFeature = {\n id,\n sourceLayerIndex,\n index,\n geometry: needGeometry ? evaluationFeature.geometry : loadGeometry(feature),\n properties: feature.properties,\n type: feature.type,\n patterns: {}\n };\n\n if (this.hasPattern) {\n this.features.push(addPatternDependencies('fill-extrusion', this.layers, bucketFeature, this.zoom, options));\n } else {\n this.addFeature(bucketFeature, bucketFeature.geometry, index, canonical, {});\n }\n\n options.featureIndex.insert(feature, bucketFeature.geometry, index, sourceLayerIndex, this.index, true);\n }\n }\n\n addFeatures(options: PopulateParameters, canonical: CanonicalTileID, imagePositions: {[_: string]: ImagePosition}) {\n for (const feature of this.features) {\n const {geometry} = feature;\n this.addFeature(feature, geometry, feature.index, canonical, imagePositions);\n }\n }\n\n update(states: FeatureStates, vtLayer: VectorTileLayer, imagePositions: {[_: string]: ImagePosition}) {\n if (!this.stateDependentLayers.length) return;\n this.programConfigurations.updatePaintArrays(states, vtLayer, this.stateDependentLayers, imagePositions);\n }\n\n isEmpty() {\n return this.layoutVertexArray.length === 0;\n }\n\n uploadPending() {\n return !this.uploaded || this.programConfigurations.needsUpload;\n }\n\n upload(context: Context) {\n if (!this.uploaded) {\n this.layoutVertexBuffer = context.createVertexBuffer(this.layoutVertexArray, layoutAttributes);\n this.indexBuffer = context.createIndexBuffer(this.indexArray);\n }\n this.programConfigurations.upload(context);\n this.uploaded = true;\n }\n\n destroy() {\n if (!this.layoutVertexBuffer) return;\n this.layoutVertexBuffer.destroy();\n this.indexBuffer.destroy();\n this.programConfigurations.destroy();\n this.segments.destroy();\n }\n\n addFeature(feature: BucketFeature, geometry: Array>, index: number, canonical: CanonicalTileID, imagePositions: {[_: string]: ImagePosition}) {\n for (const polygon of classifyRings(geometry, EARCUT_MAX_RINGS)) {\n let numVertices = 0;\n for (const ring of polygon) {\n numVertices += ring.length;\n }\n let segment = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray);\n\n for (const ring of polygon) {\n if (ring.length === 0) {\n continue;\n }\n\n if (isEntirelyOutside(ring)) {\n continue;\n }\n\n let edgeDistance = 0;\n\n for (let p = 0; p < ring.length; p++) {\n const p1 = ring[p];\n\n if (p >= 1) {\n const p2 = ring[p - 1];\n\n if (!isBoundaryEdge(p1, p2)) {\n if (segment.vertexLength + 4 > SegmentVector.MAX_VERTEX_ARRAY_LENGTH) {\n segment = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray);\n }\n\n const perp = p1.sub(p2)._perp()._unit();\n const dist = p2.dist(p1);\n if (edgeDistance + dist > 32768) edgeDistance = 0;\n\n addVertex(this.layoutVertexArray, p1.x, p1.y, perp.x, perp.y, 0, 0, edgeDistance);\n addVertex(this.layoutVertexArray, p1.x, p1.y, perp.x, perp.y, 0, 1, edgeDistance);\n\n edgeDistance += dist;\n\n addVertex(this.layoutVertexArray, p2.x, p2.y, perp.x, perp.y, 0, 0, edgeDistance);\n addVertex(this.layoutVertexArray, p2.x, p2.y, perp.x, perp.y, 0, 1, edgeDistance);\n\n const bottomRight = segment.vertexLength;\n\n // ┌──────┐\n // │ 0 1 │ Counter-clockwise winding order.\n // │ │ Triangle 1: 0 => 2 => 1\n // │ 2 3 │ Triangle 2: 1 => 2 => 3\n // └──────┘\n this.indexArray.emplaceBack(bottomRight, bottomRight + 2, bottomRight + 1);\n this.indexArray.emplaceBack(bottomRight + 1, bottomRight + 2, bottomRight + 3);\n\n segment.vertexLength += 4;\n segment.primitiveLength += 2;\n }\n }\n }\n }\n\n if (segment.vertexLength + numVertices > SegmentVector.MAX_VERTEX_ARRAY_LENGTH) {\n segment = this.segments.prepareSegment(numVertices, this.layoutVertexArray, this.indexArray);\n }\n\n //Only triangulate and draw the area of the feature if it is a polygon\n //Other feature types (e.g. LineString) do not have area, so triangulation is pointless / undefined\n if (vectorTileFeatureTypes[feature.type] !== 'Polygon')\n continue;\n\n const flattened = [];\n const holeIndices = [];\n const triangleIndex = segment.vertexLength;\n\n for (const ring of polygon) {\n if (ring.length === 0) {\n continue;\n }\n\n if (ring !== polygon[0]) {\n holeIndices.push(flattened.length / 2);\n }\n\n for (let i = 0; i < ring.length; i++) {\n const p = ring[i];\n\n addVertex(this.layoutVertexArray, p.x, p.y, 0, 0, 1, 1, 0);\n\n flattened.push(p.x);\n flattened.push(p.y);\n }\n }\n\n const indices = earcut(flattened, holeIndices);\n assert(indices.length % 3 === 0);\n\n for (let j = 0; j < indices.length; j += 3) {\n // Counter-clockwise winding order.\n this.indexArray.emplaceBack(\n triangleIndex + indices[j],\n triangleIndex + indices[j + 2],\n triangleIndex + indices[j + 1]);\n }\n\n segment.primitiveLength += indices.length / 3;\n segment.vertexLength += numVertices;\n }\n\n this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, feature, index, imagePositions, canonical);\n }\n}\n\nregister('FillExtrusionBucket', FillExtrusionBucket, {omit: ['layers', 'features']});\n\nexport default FillExtrusionBucket;\n\nfunction isBoundaryEdge(p1, p2) {\n return (p1.x === p2.x && (p1.x < 0 || p1.x > EXTENT)) ||\n (p1.y === p2.y && (p1.y < 0 || p1.y > EXTENT));\n}\n\nfunction isEntirelyOutside(ring) {\n return ring.every(p => p.x < 0) ||\n ring.every(p => p.x > EXTENT) ||\n ring.every(p => p.y < 0) ||\n ring.every(p => p.y > EXTENT);\n}\n","// This file is generated. Edit build/generate-style-code.js, then run `yarn run codegen`.\n// @flow\n/* eslint-disable */\n\nimport styleSpec from '../../style-spec/reference/latest';\n\nimport {\n Properties,\n DataConstantProperty,\n DataDrivenProperty,\n CrossFadedDataDrivenProperty,\n CrossFadedProperty,\n ColorRampProperty\n} from '../properties';\n\nimport type Color from '../../style-spec/util/color';\n\nimport type Formatted from '../../style-spec/expression/types/formatted';\n\nimport type ResolvedImage from '../../style-spec/expression/types/resolved_image';\n\n\nexport type PaintProps = {|\n \"fill-extrusion-opacity\": DataConstantProperty,\n \"fill-extrusion-color\": DataDrivenProperty,\n \"fill-extrusion-translate\": DataConstantProperty<[number, number]>,\n \"fill-extrusion-translate-anchor\": DataConstantProperty<\"map\" | \"viewport\">,\n \"fill-extrusion-pattern\": CrossFadedDataDrivenProperty,\n \"fill-extrusion-height\": DataDrivenProperty,\n \"fill-extrusion-base\": DataDrivenProperty,\n \"fill-extrusion-vertical-gradient\": DataConstantProperty,\n|};\n\nconst paint: Properties = new Properties({\n \"fill-extrusion-opacity\": new DataConstantProperty(styleSpec[\"paint_fill-extrusion\"][\"fill-extrusion-opacity\"]),\n \"fill-extrusion-color\": new DataDrivenProperty(styleSpec[\"paint_fill-extrusion\"][\"fill-extrusion-color\"]),\n \"fill-extrusion-translate\": new DataConstantProperty(styleSpec[\"paint_fill-extrusion\"][\"fill-extrusion-translate\"]),\n \"fill-extrusion-translate-anchor\": new DataConstantProperty(styleSpec[\"paint_fill-extrusion\"][\"fill-extrusion-translate-anchor\"]),\n \"fill-extrusion-pattern\": new CrossFadedDataDrivenProperty(styleSpec[\"paint_fill-extrusion\"][\"fill-extrusion-pattern\"]),\n \"fill-extrusion-height\": new DataDrivenProperty(styleSpec[\"paint_fill-extrusion\"][\"fill-extrusion-height\"]),\n \"fill-extrusion-base\": new DataDrivenProperty(styleSpec[\"paint_fill-extrusion\"][\"fill-extrusion-base\"]),\n \"fill-extrusion-vertical-gradient\": new DataConstantProperty(styleSpec[\"paint_fill-extrusion\"][\"fill-extrusion-vertical-gradient\"]),\n});\n\n// Note: without adding the explicit type annotation, Flow infers weaker types\n// for these objects from their use in the constructor to StyleLayer, as\n// {layout?: Properties<...>, paint: Properties<...>}\nexport default ({ paint }: $Exact<{\n paint: Properties\n}>);\n","// @flow\n\nimport StyleLayer from '../style_layer';\n\nimport FillExtrusionBucket from '../../data/bucket/fill_extrusion_bucket';\nimport {polygonIntersectsPolygon, polygonIntersectsMultiPolygon} from '../../util/intersection_tests';\nimport {translateDistance, translate} from '../query_utils';\nimport properties from './fill_extrusion_style_layer_properties';\nimport {Transitionable, Transitioning, PossiblyEvaluated} from '../properties';\nimport {vec4} from 'gl-matrix';\nimport Point from '@mapbox/point-geometry';\n\nimport type {FeatureState} from '../../style-spec/expression';\nimport type {BucketParameters} from '../../data/bucket';\nimport type {PaintProps} from './fill_extrusion_style_layer_properties';\nimport type Transform from '../../geo/transform';\nimport type {LayerSpecification} from '../../style-spec/types';\n\nclass FillExtrusionStyleLayer extends StyleLayer {\n _transitionablePaint: Transitionable;\n _transitioningPaint: Transitioning;\n paint: PossiblyEvaluated;\n\n constructor(layer: LayerSpecification) {\n super(layer, properties);\n }\n\n createBucket(parameters: BucketParameters) {\n return new FillExtrusionBucket(parameters);\n }\n\n queryRadius(): number {\n return translateDistance(this.paint.get('fill-extrusion-translate'));\n }\n\n is3D(): boolean {\n return true;\n }\n\n queryIntersectsFeature(queryGeometry: Array,\n feature: VectorTileFeature,\n featureState: FeatureState,\n geometry: Array>,\n zoom: number,\n transform: Transform,\n pixelsToTileUnits: number,\n pixelPosMatrix: Float32Array): boolean | number {\n\n const translatedPolygon = translate(queryGeometry,\n this.paint.get('fill-extrusion-translate'),\n this.paint.get('fill-extrusion-translate-anchor'),\n transform.angle, pixelsToTileUnits);\n\n const height = this.paint.get('fill-extrusion-height').evaluate(feature, featureState);\n const base = this.paint.get('fill-extrusion-base').evaluate(feature, featureState);\n\n const projectedQueryGeometry = projectQueryGeometry(translatedPolygon, pixelPosMatrix, transform, 0);\n\n const projected = projectExtrusion(geometry, base, height, pixelPosMatrix);\n const projectedBase = projected[0];\n const projectedTop = projected[1];\n return checkIntersection(projectedBase, projectedTop, projectedQueryGeometry);\n }\n}\n\nfunction dot(a, b) {\n return a.x * b.x + a.y * b.y;\n}\n\nexport function getIntersectionDistance(projectedQueryGeometry: Array, projectedFace: Array) {\n\n if (projectedQueryGeometry.length === 1) {\n // For point queries calculate the z at which the point intersects the face\n // using barycentric coordinates.\n\n // Find the barycentric coordinates of the projected point within the first\n // triangle of the face, using only the xy plane. It doesn't matter if the\n // point is outside the first triangle because all the triangles in the face\n // are in the same plane.\n //\n // Check whether points are coincident and use other points if they are.\n let i = 0;\n const a = projectedFace[i++];\n let b;\n while (!b || a.equals(b)) {\n b = projectedFace[i++];\n if (!b) return Infinity;\n }\n\n // Loop until point `c` is not colinear with points `a` and `b`.\n for (; i < projectedFace.length; i++) {\n const c = projectedFace[i];\n\n const p = projectedQueryGeometry[0];\n\n const ab = b.sub(a);\n const ac = c.sub(a);\n const ap = p.sub(a);\n\n const dotABAB = dot(ab, ab);\n const dotABAC = dot(ab, ac);\n const dotACAC = dot(ac, ac);\n const dotAPAB = dot(ap, ab);\n const dotAPAC = dot(ap, ac);\n const denom = dotABAB * dotACAC - dotABAC * dotABAC;\n\n const v = (dotACAC * dotAPAB - dotABAC * dotAPAC) / denom;\n const w = (dotABAB * dotAPAC - dotABAC * dotAPAB) / denom;\n const u = 1 - v - w;\n\n // Use the barycentric weighting along with the original triangle z coordinates to get the point of intersection.\n const distance = a.z * u + b.z * v + c.z * w;\n\n if (isFinite(distance)) return distance;\n }\n\n return Infinity;\n\n } else {\n // The counts as closest is less clear when the query is a box. This\n // returns the distance to the nearest point on the face, whether it is\n // within the query or not. It could be more correct to return the\n // distance to the closest point within the query box but this would be\n // more complicated and expensive to calculate with little benefit.\n let closestDistance = Infinity;\n for (const p of projectedFace) {\n closestDistance = Math.min(closestDistance, p.z);\n }\n return closestDistance;\n }\n}\n\nfunction checkIntersection(projectedBase: Array, projectedTop: Array, projectedQueryGeometry: Array) {\n let closestDistance = Infinity;\n\n if (polygonIntersectsMultiPolygon(projectedQueryGeometry, projectedTop)) {\n closestDistance = getIntersectionDistance(projectedQueryGeometry, projectedTop[0]);\n }\n\n for (let r = 0; r < projectedTop.length; r++) {\n const ringTop = projectedTop[r];\n const ringBase = projectedBase[r];\n for (let p = 0; p < ringTop.length - 1; p++) {\n const topA = ringTop[p];\n const topB = ringTop[p + 1];\n const baseA = ringBase[p];\n const baseB = ringBase[p + 1];\n const face = [topA, topB, baseB, baseA, topA];\n if (polygonIntersectsPolygon(projectedQueryGeometry, face)) {\n closestDistance = Math.min(closestDistance, getIntersectionDistance(projectedQueryGeometry, face));\n }\n }\n }\n\n return closestDistance === Infinity ? false : closestDistance;\n}\n\n/*\n * Project the geometry using matrix `m`. This is essentially doing\n * `vec4.transformMat4([], [p.x, p.y, z, 1], m)` but the multiplication\n * is inlined so that parts of the projection that are the same across\n * different points can only be done once. This produced a measurable\n * performance improvement.\n */\nfunction projectExtrusion(geometry: Array>, zBase: number, zTop: number, m: Float32Array) {\n const projectedBase = [];\n const projectedTop = [];\n\n const baseXZ = m[8] * zBase;\n const baseYZ = m[9] * zBase;\n const baseZZ = m[10] * zBase;\n const baseWZ = m[11] * zBase;\n const topXZ = m[8] * zTop;\n const topYZ = m[9] * zTop;\n const topZZ = m[10] * zTop;\n const topWZ = m[11] * zTop;\n\n for (const r of geometry) {\n const ringBase = [];\n const ringTop = [];\n for (const p of r) {\n const x = p.x;\n const y = p.y;\n\n const sX = m[0] * x + m[4] * y + m[12];\n const sY = m[1] * x + m[5] * y + m[13];\n const sZ = m[2] * x + m[6] * y + m[14];\n const sW = m[3] * x + m[7] * y + m[15];\n\n const baseX = sX + baseXZ;\n const baseY = sY + baseYZ;\n const baseZ = sZ + baseZZ;\n const baseW = sW + baseWZ;\n\n const topX = sX + topXZ;\n const topY = sY + topYZ;\n const topZ = sZ + topZZ;\n const topW = sW + topWZ;\n\n const b = new Point(baseX / baseW, baseY / baseW);\n b.z = baseZ / baseW;\n ringBase.push(b);\n\n const t = new Point(topX / topW, topY / topW);\n t.z = topZ / topW;\n ringTop.push(t);\n }\n projectedBase.push(ringBase);\n projectedTop.push(ringTop);\n }\n return [projectedBase, projectedTop];\n}\n\nfunction projectQueryGeometry(queryGeometry: Array, pixelPosMatrix: Float32Array, transform: Transform, z: number) {\n const projectedQueryGeometry = [];\n for (const p of queryGeometry) {\n const v = [p.x, p.y, z, 1];\n vec4.transformMat4(v, v, pixelPosMatrix);\n projectedQueryGeometry.push(new Point(v[0] / v[3], v[1] / v[3]));\n }\n return projectedQueryGeometry;\n}\n\nexport default FillExtrusionStyleLayer;\n","// @flow\nimport {createLayout} from '../../util/struct_array';\n\nconst lineLayoutAttributes = createLayout([\n {name: 'a_pos_normal', components: 2, type: 'Int16'},\n {name: 'a_data', components: 4, type: 'Uint8'}\n], 4);\n\nexport default lineLayoutAttributes;\nexport const {members, size, alignment} = lineLayoutAttributes;\n","// @flow\nimport {createLayout} from '../../util/struct_array';\n\nconst lineLayoutAttributesExt = createLayout([\n {name: 'a_uv_x', components: 1, type: 'Float32'},\n {name: 'a_split_index', components: 1, type: 'Float32'},\n]);\n\nexport default lineLayoutAttributesExt;\nexport const {members, size, alignment} = lineLayoutAttributesExt;\n","// @flow\n\nimport {LineLayoutArray, LineExtLayoutArray} from '../array_types';\n\nimport {members as layoutAttributes} from './line_attributes';\nimport {members as layoutAttributesExt} from './line_attributes_ext';\nimport SegmentVector from '../segment';\nimport {ProgramConfigurationSet} from '../program_configuration';\nimport {TriangleIndexArray} from '../index_array_type';\nimport EXTENT from '../extent';\nimport mvt from '@mapbox/vector-tile';\nconst vectorTileFeatureTypes = mvt.VectorTileFeature.types;\nimport {register} from '../../util/web_worker_transfer';\nimport {hasPattern, addPatternDependencies} from './pattern_bucket_features';\nimport loadGeometry from '../load_geometry';\nimport toEvaluationFeature from '../evaluation_feature';\nimport EvaluationParameters from '../../style/evaluation_parameters';\n\nimport type {CanonicalTileID} from '../../source/tile_id';\nimport type {\n Bucket,\n BucketParameters,\n BucketFeature,\n IndexedFeature,\n PopulateParameters\n} from '../bucket';\nimport type LineStyleLayer from '../../style/style_layer/line_style_layer';\nimport type Point from '@mapbox/point-geometry';\nimport type {Segment} from '../segment';\nimport {RGBAImage} from '../../util/image';\nimport type Context from '../../gl/context';\nimport type Texture from '../../render/texture';\nimport type IndexBuffer from '../../gl/index_buffer';\nimport type VertexBuffer from '../../gl/vertex_buffer';\nimport type {FeatureStates} from '../../source/source_state';\nimport type {ImagePosition} from '../../render/image_atlas';\n\n// NOTE ON EXTRUDE SCALE:\n// scale the extrusion vector so that the normal length is this value.\n// contains the \"texture\" normals (-1..1). this is distinct from the extrude\n// normals for line joins, because the x-value remains 0 for the texture\n// normal array, while the extrude normal actually moves the vertex to create\n// the acute/bevelled line join.\nconst EXTRUDE_SCALE = 63;\n\n/*\n * Sharp corners cause dashed lines to tilt because the distance along the line\n * is the same at both the inner and outer corners. To improve the appearance of\n * dashed lines we add extra points near sharp corners so that a smaller part\n * of the line is tilted.\n *\n * COS_HALF_SHARP_CORNER controls how sharp a corner has to be for us to add an\n * extra vertex. The default is 75 degrees.\n *\n * The newly created vertices are placed SHARP_CORNER_OFFSET pixels from the corner.\n */\nconst COS_HALF_SHARP_CORNER = Math.cos(75 / 2 * (Math.PI / 180));\nconst SHARP_CORNER_OFFSET = 15;\n\n// Angle per triangle for approximating round line joins.\nconst DEG_PER_TRIANGLE = 20;\n\n// The number of bits that is used to store the line distance in the buffer.\nconst LINE_DISTANCE_BUFFER_BITS = 15;\n\n// We don't have enough bits for the line distance as we'd like to have, so\n// use this value to scale the line distance (in tile units) down to a smaller\n// value. This lets us store longer distances while sacrificing precision.\nconst LINE_DISTANCE_SCALE = 1 / 2;\n\n// The maximum line distance, in tile units, that fits in the buffer.\nconst MAX_LINE_DISTANCE = Math.pow(2, LINE_DISTANCE_BUFFER_BITS - 1) / LINE_DISTANCE_SCALE;\n\ntype LineClips = {\n start: number;\n end: number;\n}\n\ntype GradientTexture = {\n texture: Texture;\n gradient: ?RGBAImage;\n version: number;\n}\n\n/**\n * @private\n */\nclass LineBucket implements Bucket {\n distance: number;\n totalDistance: number;\n maxLineLength: number;\n scaledDistance: number;\n lineClips: ?LineClips;\n\n e1: number;\n e2: number;\n\n index: number;\n zoom: number;\n overscaling: number;\n layers: Array;\n layerIds: Array;\n gradients: {[string]: GradientTexture};\n stateDependentLayers: Array;\n stateDependentLayerIds: Array;\n patternFeatures: Array;\n lineClipsArray: Array;\n\n layoutVertexArray: LineLayoutArray;\n layoutVertexBuffer: VertexBuffer;\n layoutVertexArray2: LineExtLayoutArray;\n layoutVertexBuffer2: VertexBuffer;\n\n indexArray: TriangleIndexArray;\n indexBuffer: IndexBuffer;\n\n hasPattern: boolean;\n programConfigurations: ProgramConfigurationSet;\n segments: SegmentVector;\n uploaded: boolean;\n\n constructor(options: BucketParameters) {\n this.zoom = options.zoom;\n this.overscaling = options.overscaling;\n this.layers = options.layers;\n this.layerIds = this.layers.map(layer => layer.id);\n this.index = options.index;\n this.hasPattern = false;\n this.patternFeatures = [];\n this.lineClipsArray = [];\n this.gradients = {};\n this.layers.forEach(layer => {\n this.gradients[layer.id] = {};\n });\n\n this.layoutVertexArray = new LineLayoutArray();\n this.layoutVertexArray2 = new LineExtLayoutArray();\n this.indexArray = new TriangleIndexArray();\n this.programConfigurations = new ProgramConfigurationSet(options.layers, options.zoom);\n this.segments = new SegmentVector();\n this.maxLineLength = 0;\n\n this.stateDependentLayerIds = this.layers.filter((l) => l.isStateDependent()).map((l) => l.id);\n }\n\n populate(features: Array, options: PopulateParameters, canonical: CanonicalTileID) {\n this.hasPattern = hasPattern('line', this.layers, options);\n const lineSortKey = this.layers[0].layout.get('line-sort-key');\n const sortFeaturesByKey = !lineSortKey.isConstant();\n const bucketFeatures = [];\n\n for (const {feature, id, index, sourceLayerIndex} of features) {\n const needGeometry = this.layers[0]._featureFilter.needGeometry;\n const evaluationFeature = toEvaluationFeature(feature, needGeometry);\n\n if (!this.layers[0]._featureFilter.filter(new EvaluationParameters(this.zoom), evaluationFeature, canonical)) continue;\n\n const sortKey = sortFeaturesByKey ?\n lineSortKey.evaluate(evaluationFeature, {}, canonical) :\n undefined;\n\n const bucketFeature: BucketFeature = {\n id,\n properties: feature.properties,\n type: feature.type,\n sourceLayerIndex,\n index,\n geometry: needGeometry ? evaluationFeature.geometry : loadGeometry(feature),\n patterns: {},\n sortKey\n };\n\n bucketFeatures.push(bucketFeature);\n }\n\n if (sortFeaturesByKey) {\n bucketFeatures.sort((a, b) => {\n // a.sortKey is always a number when in use\n return ((a.sortKey: any): number) - ((b.sortKey: any): number);\n });\n }\n\n for (const bucketFeature of bucketFeatures) {\n const {geometry, index, sourceLayerIndex} = bucketFeature;\n\n if (this.hasPattern) {\n const patternBucketFeature = addPatternDependencies('line', this.layers, bucketFeature, this.zoom, options);\n // pattern features are added only once the pattern is loaded into the image atlas\n // so are stored during populate until later updated with positions by tile worker in addFeatures\n this.patternFeatures.push(patternBucketFeature);\n } else {\n this.addFeature(bucketFeature, geometry, index, canonical, {});\n }\n\n const feature = features[index].feature;\n options.featureIndex.insert(feature, geometry, index, sourceLayerIndex, this.index);\n }\n }\n\n update(states: FeatureStates, vtLayer: VectorTileLayer, imagePositions: {[_: string]: ImagePosition}) {\n if (!this.stateDependentLayers.length) return;\n this.programConfigurations.updatePaintArrays(states, vtLayer, this.stateDependentLayers, imagePositions);\n }\n\n addFeatures(options: PopulateParameters, canonical: CanonicalTileID, imagePositions: {[_: string]: ImagePosition}) {\n for (const feature of this.patternFeatures) {\n this.addFeature(feature, feature.geometry, feature.index, canonical, imagePositions);\n }\n }\n\n isEmpty() {\n return this.layoutVertexArray.length === 0;\n }\n\n uploadPending() {\n return !this.uploaded || this.programConfigurations.needsUpload;\n }\n\n upload(context: Context) {\n if (!this.uploaded) {\n if (this.layoutVertexArray2.length !== 0) {\n this.layoutVertexBuffer2 = context.createVertexBuffer(this.layoutVertexArray2, layoutAttributesExt);\n }\n this.layoutVertexBuffer = context.createVertexBuffer(this.layoutVertexArray, layoutAttributes);\n this.indexBuffer = context.createIndexBuffer(this.indexArray);\n }\n this.programConfigurations.upload(context);\n this.uploaded = true;\n }\n\n destroy() {\n if (!this.layoutVertexBuffer) return;\n this.layoutVertexBuffer.destroy();\n this.indexBuffer.destroy();\n this.programConfigurations.destroy();\n this.segments.destroy();\n }\n\n lineFeatureClips(feature: BucketFeature): ?LineClips {\n if (!!feature.properties && feature.properties.hasOwnProperty('mapbox_clip_start') && feature.properties.hasOwnProperty('mapbox_clip_end')) {\n const start = +feature.properties['mapbox_clip_start'];\n const end = +feature.properties['mapbox_clip_end'];\n return {start, end};\n }\n }\n\n addFeature(feature: BucketFeature, geometry: Array>, index: number, canonical: CanonicalTileID, imagePositions: {[_: string]: ImagePosition}) {\n const layout = this.layers[0].layout;\n const join = layout.get('line-join').evaluate(feature, {});\n const cap = layout.get('line-cap');\n const miterLimit = layout.get('line-miter-limit');\n const roundLimit = layout.get('line-round-limit');\n this.lineClips = this.lineFeatureClips(feature);\n\n for (const line of geometry) {\n this.addLine(line, feature, join, cap, miterLimit, roundLimit);\n }\n\n this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, feature, index, imagePositions, canonical);\n }\n\n addLine(vertices: Array, feature: BucketFeature, join: string, cap: string, miterLimit: number, roundLimit: number) {\n this.distance = 0;\n this.scaledDistance = 0;\n this.totalDistance = 0;\n\n if (this.lineClips) {\n this.lineClipsArray.push(this.lineClips);\n // Calculate the total distance, in tile units, of this tiled line feature\n for (let i = 0; i < vertices.length - 1; i++) {\n this.totalDistance += vertices[i].dist(vertices[i + 1]);\n }\n this.updateScaledDistance();\n this.maxLineLength = Math.max(this.maxLineLength, this.totalDistance);\n }\n\n const isPolygon = vectorTileFeatureTypes[feature.type] === 'Polygon';\n\n // If the line has duplicate vertices at the ends, adjust start/length to remove them.\n let len = vertices.length;\n while (len >= 2 && vertices[len - 1].equals(vertices[len - 2])) {\n len--;\n }\n let first = 0;\n while (first < len - 1 && vertices[first].equals(vertices[first + 1])) {\n first++;\n }\n\n // Ignore invalid geometry.\n if (len < (isPolygon ? 3 : 2)) return;\n\n if (join === 'bevel') miterLimit = 1.05;\n\n const sharpCornerOffset = this.overscaling <= 16 ?\n SHARP_CORNER_OFFSET * EXTENT / (512 * this.overscaling) :\n 0;\n\n // we could be more precise, but it would only save a negligible amount of space\n const segment = this.segments.prepareSegment(len * 10, this.layoutVertexArray, this.indexArray);\n\n let currentVertex;\n let prevVertex = ((undefined: any): Point);\n let nextVertex = ((undefined: any): Point);\n let prevNormal = ((undefined: any): Point);\n let nextNormal = ((undefined: any): Point);\n\n // the last two vertices added\n this.e1 = this.e2 = -1;\n\n if (isPolygon) {\n currentVertex = vertices[len - 2];\n nextNormal = vertices[first].sub(currentVertex)._unit()._perp();\n }\n\n for (let i = first; i < len; i++) {\n\n nextVertex = i === len - 1 ?\n (isPolygon ? vertices[first + 1] : (undefined: any)) : // if it's a polygon, treat the last vertex like the first\n vertices[i + 1]; // just the next vertex\n\n // if two consecutive vertices exist, skip the current one\n if (nextVertex && vertices[i].equals(nextVertex)) continue;\n\n if (nextNormal) prevNormal = nextNormal;\n if (currentVertex) prevVertex = currentVertex;\n\n currentVertex = vertices[i];\n\n // Calculate the normal towards the next vertex in this line. In case\n // there is no next vertex, pretend that the line is continuing straight,\n // meaning that we are just using the previous normal.\n nextNormal = nextVertex ? nextVertex.sub(currentVertex)._unit()._perp() : prevNormal;\n\n // If we still don't have a previous normal, this is the beginning of a\n // non-closed line, so we're doing a straight \"join\".\n prevNormal = prevNormal || nextNormal;\n\n // Determine the normal of the join extrusion. It is the angle bisector\n // of the segments between the previous line and the next line.\n // In the case of 180° angles, the prev and next normals cancel each other out:\n // prevNormal + nextNormal = (0, 0), its magnitude is 0, so the unit vector would be\n // undefined. In that case, we're keeping the joinNormal at (0, 0), so that the cosHalfAngle\n // below will also become 0 and miterLength will become Infinity.\n let joinNormal = prevNormal.add(nextNormal);\n if (joinNormal.x !== 0 || joinNormal.y !== 0) {\n joinNormal._unit();\n }\n /* joinNormal prevNormal\n * ↖ ↑\n * .________. prevVertex\n * |\n * nextNormal ← | currentVertex\n * |\n * nextVertex !\n *\n */\n\n // calculate cosines of the angle (and its half) using dot product\n const cosAngle = prevNormal.x * nextNormal.x + prevNormal.y * nextNormal.y;\n const cosHalfAngle = joinNormal.x * nextNormal.x + joinNormal.y * nextNormal.y;\n\n // Calculate the length of the miter (the ratio of the miter to the width)\n // as the inverse of cosine of the angle between next and join normals\n const miterLength = cosHalfAngle !== 0 ? 1 / cosHalfAngle : Infinity;\n\n // approximate angle from cosine\n const approxAngle = 2 * Math.sqrt(2 - 2 * cosHalfAngle);\n\n const isSharpCorner = cosHalfAngle < COS_HALF_SHARP_CORNER && prevVertex && nextVertex;\n const lineTurnsLeft = prevNormal.x * nextNormal.y - prevNormal.y * nextNormal.x > 0;\n\n if (isSharpCorner && i > first) {\n const prevSegmentLength = currentVertex.dist(prevVertex);\n if (prevSegmentLength > 2 * sharpCornerOffset) {\n const newPrevVertex = currentVertex.sub(currentVertex.sub(prevVertex)._mult(sharpCornerOffset / prevSegmentLength)._round());\n this.updateDistance(prevVertex, newPrevVertex);\n this.addCurrentVertex(newPrevVertex, prevNormal, 0, 0, segment);\n prevVertex = newPrevVertex;\n }\n }\n\n // The join if a middle vertex, otherwise the cap.\n const middleVertex = prevVertex && nextVertex;\n let currentJoin = middleVertex ? join : isPolygon ? 'butt' : cap;\n\n if (middleVertex && currentJoin === 'round') {\n if (miterLength < roundLimit) {\n currentJoin = 'miter';\n } else if (miterLength <= 2) {\n currentJoin = 'fakeround';\n }\n }\n\n if (currentJoin === 'miter' && miterLength > miterLimit) {\n currentJoin = 'bevel';\n }\n\n if (currentJoin === 'bevel') {\n // The maximum extrude length is 128 / 63 = 2 times the width of the line\n // so if miterLength >= 2 we need to draw a different type of bevel here.\n if (miterLength > 2) currentJoin = 'flipbevel';\n\n // If the miterLength is really small and the line bevel wouldn't be visible,\n // just draw a miter join to save a triangle.\n if (miterLength < miterLimit) currentJoin = 'miter';\n }\n\n // Calculate how far along the line the currentVertex is\n if (prevVertex) this.updateDistance(prevVertex, currentVertex);\n\n if (currentJoin === 'miter') {\n\n joinNormal._mult(miterLength);\n this.addCurrentVertex(currentVertex, joinNormal, 0, 0, segment);\n\n } else if (currentJoin === 'flipbevel') {\n // miter is too big, flip the direction to make a beveled join\n\n if (miterLength > 100) {\n // Almost parallel lines\n joinNormal = nextNormal.mult(-1);\n\n } else {\n const bevelLength = miterLength * prevNormal.add(nextNormal).mag() / prevNormal.sub(nextNormal).mag();\n joinNormal._perp()._mult(bevelLength * (lineTurnsLeft ? -1 : 1));\n }\n this.addCurrentVertex(currentVertex, joinNormal, 0, 0, segment);\n this.addCurrentVertex(currentVertex, joinNormal.mult(-1), 0, 0, segment);\n\n } else if (currentJoin === 'bevel' || currentJoin === 'fakeround') {\n const offset = -Math.sqrt(miterLength * miterLength - 1);\n const offsetA = lineTurnsLeft ? offset : 0;\n const offsetB = lineTurnsLeft ? 0 : offset;\n\n // Close previous segment with a bevel\n if (prevVertex) {\n this.addCurrentVertex(currentVertex, prevNormal, offsetA, offsetB, segment);\n }\n\n if (currentJoin === 'fakeround') {\n // The join angle is sharp enough that a round join would be visible.\n // Bevel joins fill the gap between segments with a single pie slice triangle.\n // Create a round join by adding multiple pie slices. The join isn't actually round, but\n // it looks like it is at the sizes we render lines at.\n\n // pick the number of triangles for approximating round join by based on the angle between normals\n const n = Math.round((approxAngle * 180 / Math.PI) / DEG_PER_TRIANGLE);\n\n for (let m = 1; m < n; m++) {\n let t = m / n;\n if (t !== 0.5) {\n // approximate spherical interpolation https://observablehq.com/@mourner/approximating-geometric-slerp\n const t2 = t - 0.5;\n const A = 1.0904 + cosAngle * (-3.2452 + cosAngle * (3.55645 - cosAngle * 1.43519));\n const B = 0.848013 + cosAngle * (-1.06021 + cosAngle * 0.215638);\n t = t + t * t2 * (t - 1) * (A * t2 * t2 + B);\n }\n const extrude = nextNormal.sub(prevNormal)._mult(t)._add(prevNormal)._unit()._mult(lineTurnsLeft ? -1 : 1);\n this.addHalfVertex(currentVertex, extrude.x, extrude.y, false, lineTurnsLeft, 0, segment);\n }\n }\n\n if (nextVertex) {\n // Start next segment\n this.addCurrentVertex(currentVertex, nextNormal, -offsetA, -offsetB, segment);\n }\n\n } else if (currentJoin === 'butt') {\n this.addCurrentVertex(currentVertex, joinNormal, 0, 0, segment); // butt cap\n\n } else if (currentJoin === 'square') {\n const offset = prevVertex ? 1 : -1; // closing or starting square cap\n this.addCurrentVertex(currentVertex, joinNormal, offset, offset, segment);\n\n } else if (currentJoin === 'round') {\n\n if (prevVertex) {\n // Close previous segment with butt\n this.addCurrentVertex(currentVertex, prevNormal, 0, 0, segment);\n\n // Add round cap or linejoin at end of segment\n this.addCurrentVertex(currentVertex, prevNormal, 1, 1, segment, true);\n }\n if (nextVertex) {\n // Add round cap before first segment\n this.addCurrentVertex(currentVertex, nextNormal, -1, -1, segment, true);\n\n // Start next segment with a butt\n this.addCurrentVertex(currentVertex, nextNormal, 0, 0, segment);\n }\n }\n\n if (isSharpCorner && i < len - 1) {\n const nextSegmentLength = currentVertex.dist(nextVertex);\n if (nextSegmentLength > 2 * sharpCornerOffset) {\n const newCurrentVertex = currentVertex.add(nextVertex.sub(currentVertex)._mult(sharpCornerOffset / nextSegmentLength)._round());\n this.updateDistance(currentVertex, newCurrentVertex);\n this.addCurrentVertex(newCurrentVertex, nextNormal, 0, 0, segment);\n currentVertex = newCurrentVertex;\n }\n }\n }\n }\n\n /**\n * Add two vertices to the buffers.\n *\n * @param p the line vertex to add buffer vertices for\n * @param normal vertex normal\n * @param endLeft extrude to shift the left vertex along the line\n * @param endRight extrude to shift the left vertex along the line\n * @param segment the segment object to add the vertex to\n * @param round whether this is a round cap\n * @private\n */\n addCurrentVertex(p: Point, normal: Point, endLeft: number, endRight: number, segment: Segment, round: boolean = false) {\n // left and right extrude vectors, perpendicularly shifted by endLeft/endRight\n const leftX = normal.x + normal.y * endLeft;\n const leftY = normal.y - normal.x * endLeft;\n const rightX = -normal.x + normal.y * endRight;\n const rightY = -normal.y - normal.x * endRight;\n\n this.addHalfVertex(p, leftX, leftY, round, false, endLeft, segment);\n this.addHalfVertex(p, rightX, rightY, round, true, -endRight, segment);\n\n // There is a maximum \"distance along the line\" that we can store in the buffers.\n // When we get close to the distance, reset it to zero and add the vertex again with\n // a distance of zero. The max distance is determined by the number of bits we allocate\n // to `linesofar`.\n if (this.distance > MAX_LINE_DISTANCE / 2 && this.totalDistance === 0) {\n this.distance = 0;\n this.addCurrentVertex(p, normal, endLeft, endRight, segment, round);\n }\n }\n\n addHalfVertex({x, y}: Point, extrudeX: number, extrudeY: number, round: boolean, up: boolean, dir: number, segment: Segment) {\n const totalDistance = this.lineClips ? this.scaledDistance * (MAX_LINE_DISTANCE - 1) : this.scaledDistance;\n // scale down so that we can store longer distances while sacrificing precision.\n const linesofarScaled = totalDistance * LINE_DISTANCE_SCALE;\n\n this.layoutVertexArray.emplaceBack(\n // a_pos_normal\n // Encode round/up the least significant bits\n (x << 1) + (round ? 1 : 0),\n (y << 1) + (up ? 1 : 0),\n // a_data\n // add 128 to store a byte in an unsigned byte\n Math.round(EXTRUDE_SCALE * extrudeX) + 128,\n Math.round(EXTRUDE_SCALE * extrudeY) + 128,\n // Encode the -1/0/1 direction value into the first two bits of .z of a_data.\n // Combine it with the lower 6 bits of `linesofarScaled` (shifted by 2 bits to make\n // room for the direction value). The upper 8 bits of `linesofarScaled` are placed in\n // the `w` component.\n ((dir === 0 ? 0 : (dir < 0 ? -1 : 1)) + 1) | ((linesofarScaled & 0x3F) << 2),\n linesofarScaled >> 6);\n\n // Constructs a second vertex buffer with higher precision line progress\n if (this.lineClips) {\n const progressRealigned = this.scaledDistance - this.lineClips.start;\n const endClipRealigned = this.lineClips.end - this.lineClips.start;\n const uvX = progressRealigned / endClipRealigned;\n this.layoutVertexArray2.emplaceBack(uvX, this.lineClipsArray.length);\n }\n\n const e = segment.vertexLength++;\n if (this.e1 >= 0 && this.e2 >= 0) {\n this.indexArray.emplaceBack(this.e1, this.e2, e);\n segment.primitiveLength++;\n }\n if (up) {\n this.e2 = e;\n } else {\n this.e1 = e;\n }\n }\n\n updateScaledDistance() {\n // Knowing the ratio of the full linestring covered by this tiled feature, as well\n // as the total distance (in tile units) of this tiled feature, and the distance\n // (in tile units) of the current vertex, we can determine the relative distance\n // of this vertex along the full linestring feature and scale it to [0, 2^15)\n this.scaledDistance = this.lineClips ?\n this.lineClips.start + (this.lineClips.end - this.lineClips.start) * this.distance / this.totalDistance :\n this.distance;\n }\n\n updateDistance(prev: Point, next: Point) {\n this.distance += prev.dist(next);\n this.updateScaledDistance();\n }\n}\n\nregister('LineBucket', LineBucket, {omit: ['layers', 'patternFeatures']});\n\nexport default LineBucket;\n","// This file is generated. Edit build/generate-style-code.js, then run `yarn run codegen`.\n// @flow\n/* eslint-disable */\n\nimport styleSpec from '../../style-spec/reference/latest';\n\nimport {\n Properties,\n DataConstantProperty,\n DataDrivenProperty,\n CrossFadedDataDrivenProperty,\n CrossFadedProperty,\n ColorRampProperty\n} from '../properties';\n\nimport type Color from '../../style-spec/util/color';\n\nimport type Formatted from '../../style-spec/expression/types/formatted';\n\nimport type ResolvedImage from '../../style-spec/expression/types/resolved_image';\n\nexport type LayoutProps = {|\n \"line-cap\": DataConstantProperty<\"butt\" | \"round\" | \"square\">,\n \"line-join\": DataDrivenProperty<\"bevel\" | \"round\" | \"miter\">,\n \"line-miter-limit\": DataConstantProperty,\n \"line-round-limit\": DataConstantProperty,\n \"line-sort-key\": DataDrivenProperty,\n|};\n\nconst layout: Properties = new Properties({\n \"line-cap\": new DataConstantProperty(styleSpec[\"layout_line\"][\"line-cap\"]),\n \"line-join\": new DataDrivenProperty(styleSpec[\"layout_line\"][\"line-join\"]),\n \"line-miter-limit\": new DataConstantProperty(styleSpec[\"layout_line\"][\"line-miter-limit\"]),\n \"line-round-limit\": new DataConstantProperty(styleSpec[\"layout_line\"][\"line-round-limit\"]),\n \"line-sort-key\": new DataDrivenProperty(styleSpec[\"layout_line\"][\"line-sort-key\"]),\n});\n\nexport type PaintProps = {|\n \"line-opacity\": DataDrivenProperty,\n \"line-color\": DataDrivenProperty,\n \"line-translate\": DataConstantProperty<[number, number]>,\n \"line-translate-anchor\": DataConstantProperty<\"map\" | \"viewport\">,\n \"line-width\": DataDrivenProperty,\n \"line-gap-width\": DataDrivenProperty,\n \"line-offset\": DataDrivenProperty,\n \"line-blur\": DataDrivenProperty,\n \"line-dasharray\": CrossFadedProperty>,\n \"line-pattern\": CrossFadedDataDrivenProperty,\n \"line-gradient\": ColorRampProperty,\n|};\n\nconst paint: Properties = new Properties({\n \"line-opacity\": new DataDrivenProperty(styleSpec[\"paint_line\"][\"line-opacity\"]),\n \"line-color\": new DataDrivenProperty(styleSpec[\"paint_line\"][\"line-color\"]),\n \"line-translate\": new DataConstantProperty(styleSpec[\"paint_line\"][\"line-translate\"]),\n \"line-translate-anchor\": new DataConstantProperty(styleSpec[\"paint_line\"][\"line-translate-anchor\"]),\n \"line-width\": new DataDrivenProperty(styleSpec[\"paint_line\"][\"line-width\"]),\n \"line-gap-width\": new DataDrivenProperty(styleSpec[\"paint_line\"][\"line-gap-width\"]),\n \"line-offset\": new DataDrivenProperty(styleSpec[\"paint_line\"][\"line-offset\"]),\n \"line-blur\": new DataDrivenProperty(styleSpec[\"paint_line\"][\"line-blur\"]),\n \"line-dasharray\": new CrossFadedProperty(styleSpec[\"paint_line\"][\"line-dasharray\"]),\n \"line-pattern\": new CrossFadedDataDrivenProperty(styleSpec[\"paint_line\"][\"line-pattern\"]),\n \"line-gradient\": new ColorRampProperty(styleSpec[\"paint_line\"][\"line-gradient\"]),\n});\n\n// Note: without adding the explicit type annotation, Flow infers weaker types\n// for these objects from their use in the constructor to StyleLayer, as\n// {layout?: Properties<...>, paint: Properties<...>}\nexport default ({ paint, layout }: $Exact<{\n paint: Properties, layout: Properties\n}>);\n","// @flow\n\nimport Point from '@mapbox/point-geometry';\n\nimport StyleLayer from '../style_layer';\nimport LineBucket from '../../data/bucket/line_bucket';\nimport {polygonIntersectsBufferedMultiLine} from '../../util/intersection_tests';\nimport {getMaximumPaintValue, translateDistance, translate} from '../query_utils';\nimport properties from './line_style_layer_properties';\nimport {extend, MAX_SAFE_INTEGER} from '../../util/util';\nimport EvaluationParameters from '../evaluation_parameters';\nimport {Transitionable, Transitioning, Layout, PossiblyEvaluated, DataDrivenProperty} from '../properties';\n\nimport Step from '../../style-spec/expression/definitions/step';\nimport type {FeatureState, ZoomConstantExpression} from '../../style-spec/expression';\nimport type {Bucket, BucketParameters} from '../../data/bucket';\nimport type {LayoutProps, PaintProps} from './line_style_layer_properties';\nimport type Transform from '../../geo/transform';\nimport type {LayerSpecification} from '../../style-spec/types';\n\nclass LineFloorwidthProperty extends DataDrivenProperty {\n useIntegerZoom: true;\n\n possiblyEvaluate(value, parameters) {\n parameters = new EvaluationParameters(Math.floor(parameters.zoom), {\n now: parameters.now,\n fadeDuration: parameters.fadeDuration,\n zoomHistory: parameters.zoomHistory,\n transition: parameters.transition\n });\n return super.possiblyEvaluate(value, parameters);\n }\n\n evaluate(value, globals, feature, featureState) {\n globals = extend({}, globals, {zoom: Math.floor(globals.zoom)});\n return super.evaluate(value, globals, feature, featureState);\n }\n}\n\nconst lineFloorwidthProperty = new LineFloorwidthProperty(properties.paint.properties['line-width'].specification);\nlineFloorwidthProperty.useIntegerZoom = true;\n\nclass LineStyleLayer extends StyleLayer {\n _unevaluatedLayout: Layout;\n layout: PossiblyEvaluated;\n\n gradientVersion: number;\n stepInterpolant: boolean;\n\n _transitionablePaint: Transitionable;\n _transitioningPaint: Transitioning;\n paint: PossiblyEvaluated;\n\n constructor(layer: LayerSpecification) {\n super(layer, properties);\n this.gradientVersion = 0;\n }\n\n _handleSpecialPaintPropertyUpdate(name: string) {\n if (name === 'line-gradient') {\n const expression: ZoomConstantExpression<'source'> = ((this._transitionablePaint._values['line-gradient'].value.expression): any);\n this.stepInterpolant = expression._styleExpression.expression instanceof Step;\n this.gradientVersion = (this.gradientVersion + 1) % MAX_SAFE_INTEGER;\n }\n }\n\n gradientExpression() {\n return this._transitionablePaint._values['line-gradient'].value.expression;\n }\n\n recalculate(parameters: EvaluationParameters, availableImages: Array) {\n super.recalculate(parameters, availableImages);\n\n (this.paint._values: any)['line-floorwidth'] =\n lineFloorwidthProperty.possiblyEvaluate(this._transitioningPaint._values['line-width'].value, parameters);\n }\n\n createBucket(parameters: BucketParameters<*>) {\n return new LineBucket(parameters);\n }\n\n queryRadius(bucket: Bucket): number {\n const lineBucket: LineBucket = (bucket: any);\n const width = getLineWidth(\n getMaximumPaintValue('line-width', this, lineBucket),\n getMaximumPaintValue('line-gap-width', this, lineBucket));\n const offset = getMaximumPaintValue('line-offset', this, lineBucket);\n return width / 2 + Math.abs(offset) + translateDistance(this.paint.get('line-translate'));\n }\n\n queryIntersectsFeature(queryGeometry: Array,\n feature: VectorTileFeature,\n featureState: FeatureState,\n geometry: Array>,\n zoom: number,\n transform: Transform,\n pixelsToTileUnits: number): boolean {\n const translatedPolygon = translate(queryGeometry,\n this.paint.get('line-translate'),\n this.paint.get('line-translate-anchor'),\n transform.angle, pixelsToTileUnits);\n const halfWidth = pixelsToTileUnits / 2 * getLineWidth(\n this.paint.get('line-width').evaluate(feature, featureState),\n this.paint.get('line-gap-width').evaluate(feature, featureState));\n const lineOffset = this.paint.get('line-offset').evaluate(feature, featureState);\n if (lineOffset) {\n geometry = offsetLine(geometry, lineOffset * pixelsToTileUnits);\n }\n\n return polygonIntersectsBufferedMultiLine(translatedPolygon, geometry, halfWidth);\n }\n\n isTileClipped() {\n return true;\n }\n}\n\nexport default LineStyleLayer;\n\nfunction getLineWidth(lineWidth, lineGapWidth) {\n if (lineGapWidth > 0) {\n return lineGapWidth + 2 * lineWidth;\n } else {\n return lineWidth;\n }\n}\n\nfunction offsetLine(rings, offset) {\n const newRings = [];\n const zero = new Point(0, 0);\n for (let k = 0; k < rings.length; k++) {\n const ring = rings[k];\n const newRing = [];\n for (let i = 0; i < ring.length; i++) {\n const a = ring[i - 1];\n const b = ring[i];\n const c = ring[i + 1];\n const aToB = i === 0 ? zero : b.sub(a)._unit()._perp();\n const bToC = i === ring.length - 1 ? zero : c.sub(b)._unit()._perp();\n const extrude = aToB._add(bToC)._unit();\n\n const cosHalfAngle = extrude.x * bToC.x + extrude.y * bToC.y;\n extrude._mult(1 / cosHalfAngle);\n\n newRing.push(extrude._mult(offset)._add(b));\n }\n newRings.push(newRing);\n }\n return newRings;\n}\n","// @flow\n\nimport {createLayout} from '../../util/struct_array';\n\nexport const symbolLayoutAttributes = createLayout([\n {name: 'a_pos_offset', components: 4, type: 'Int16'},\n {name: 'a_data', components: 4, type: 'Uint16'},\n {name: 'a_pixeloffset', components: 4, type: 'Int16'}\n], 4);\n\nexport const dynamicLayoutAttributes = createLayout([\n {name: 'a_projected_pos', components: 3, type: 'Float32'}\n], 4);\n\nexport const placementOpacityAttributes = createLayout([\n {name: 'a_fade_opacity', components: 1, type: 'Uint32'}\n], 4);\n\nexport const collisionVertexAttributes = createLayout([\n {name: 'a_placed', components: 2, type: 'Uint8'},\n {name: 'a_shift', components: 2, type: 'Float32'}\n]);\n\nexport const collisionBox = createLayout([\n // the box is centered around the anchor point\n {type: 'Int16', name: 'anchorPointX'},\n {type: 'Int16', name: 'anchorPointY'},\n\n // distances to the edges from the anchor\n {type: 'Int16', name: 'x1'},\n {type: 'Int16', name: 'y1'},\n {type: 'Int16', name: 'x2'},\n {type: 'Int16', name: 'y2'},\n\n // the index of the feature in the original vectortile\n {type: 'Uint32', name: 'featureIndex'},\n // the source layer the feature appears in\n {type: 'Uint16', name: 'sourceLayerIndex'},\n // the bucket the feature appears in\n {type: 'Uint16', name: 'bucketIndex'},\n]);\n\nexport const collisionBoxLayout = createLayout([ // used to render collision boxes for debugging purposes\n {name: 'a_pos', components: 2, type: 'Int16'},\n {name: 'a_anchor_pos', components: 2, type: 'Int16'},\n {name: 'a_extrude', components: 2, type: 'Int16'}\n], 4);\n\nexport const collisionCircleLayout = createLayout([ // used to render collision circles for debugging purposes\n {name: 'a_pos', components: 2, type: 'Float32'},\n {name: 'a_radius', components: 1, type: 'Float32'},\n {name: 'a_flags', components: 2, type: 'Int16'}\n], 4);\n\nexport const quadTriangle = createLayout([\n {name: 'triangle', components: 3, type: 'Uint16'},\n]);\n\nexport const placement = createLayout([\n {type: 'Int16', name: 'anchorX'},\n {type: 'Int16', name: 'anchorY'},\n {type: 'Uint16', name: 'glyphStartIndex'},\n {type: 'Uint16', name: 'numGlyphs'},\n {type: 'Uint32', name: 'vertexStartIndex'},\n {type: 'Uint32', name: 'lineStartIndex'},\n {type: 'Uint32', name: 'lineLength'},\n {type: 'Uint16', name: 'segment'},\n {type: 'Uint16', name: 'lowerSize'},\n {type: 'Uint16', name: 'upperSize'},\n {type: 'Float32', name: 'lineOffsetX'},\n {type: 'Float32', name: 'lineOffsetY'},\n {type: 'Uint8', name: 'writingMode'},\n {type: 'Uint8', name: 'placedOrientation'},\n {type: 'Uint8', name: 'hidden'},\n {type: 'Uint32', name: 'crossTileID'},\n {type: 'Int16', name: 'associatedIconIndex'}\n]);\n\nexport const symbolInstance = createLayout([\n {type: 'Int16', name: 'anchorX'},\n {type: 'Int16', name: 'anchorY'},\n {type: 'Int16', name: 'rightJustifiedTextSymbolIndex'},\n {type: 'Int16', name: 'centerJustifiedTextSymbolIndex'},\n {type: 'Int16', name: 'leftJustifiedTextSymbolIndex'},\n {type: 'Int16', name: 'verticalPlacedTextSymbolIndex'},\n {type: 'Int16', name: 'placedIconSymbolIndex'},\n {type: 'Int16', name: 'verticalPlacedIconSymbolIndex'},\n {type: 'Uint16', name: 'key'},\n {type: 'Uint16', name: 'textBoxStartIndex'},\n {type: 'Uint16', name: 'textBoxEndIndex'},\n {type: 'Uint16', name: 'verticalTextBoxStartIndex'},\n {type: 'Uint16', name: 'verticalTextBoxEndIndex'},\n {type: 'Uint16', name: 'iconBoxStartIndex'},\n {type: 'Uint16', name: 'iconBoxEndIndex'},\n {type: 'Uint16', name: 'verticalIconBoxStartIndex'},\n {type: 'Uint16', name: 'verticalIconBoxEndIndex'},\n {type: 'Uint16', name: 'featureIndex'},\n {type: 'Uint16', name: 'numHorizontalGlyphVertices'},\n {type: 'Uint16', name: 'numVerticalGlyphVertices'},\n {type: 'Uint16', name: 'numIconVertices'},\n {type: 'Uint16', name: 'numVerticalIconVertices'},\n {type: 'Uint16', name: 'useRuntimeCollisionCircles'},\n {type: 'Uint32', name: 'crossTileID'},\n {type: 'Float32', name: 'textBoxScale'},\n {type: 'Float32', components: 2, name: 'textOffset'},\n {type: 'Float32', name: 'collisionCircleDiameter'},\n]);\n\nexport const glyphOffset = createLayout([\n {type: 'Float32', name: 'offsetX'}\n]);\n\nexport const lineVertex = createLayout([\n {type: 'Int16', name: 'x'},\n {type: 'Int16', name: 'y'},\n {type: 'Int16', name: 'tileUnitDistanceFromAnchor'}\n]);\n","// @flow\n\nimport {plugin as rtlTextPlugin} from '../source/rtl_text_plugin';\n\nimport type SymbolStyleLayer from '../style/style_layer/symbol_style_layer';\nimport type {Feature} from '../style-spec/expression';\nimport Formatted from '../style-spec/expression/types/formatted';\n\nfunction transformText(text: string, layer: SymbolStyleLayer, feature: Feature) {\n const transform = layer.layout.get('text-transform').evaluate(feature, {});\n if (transform === 'uppercase') {\n text = text.toLocaleUpperCase();\n } else if (transform === 'lowercase') {\n text = text.toLocaleLowerCase();\n }\n\n if (rtlTextPlugin.applyArabicShaping) {\n text = rtlTextPlugin.applyArabicShaping(text);\n }\n\n return text;\n}\n\nexport default function(text: Formatted, layer: SymbolStyleLayer, feature: Feature): Formatted {\n text.sections.forEach(section => {\n section.text = transformText(section.text, layer, feature);\n });\n return text;\n}\n","// @flow\n\nimport {\n charHasRotatedVerticalOrientation,\n} from './script_detection';\n\nexport const verticalizedCharacterMap = {\n '!': '︕',\n '#': '#',\n '$': '$',\n '%': '%',\n '&': '&',\n '(': '︵',\n ')': '︶',\n '*': '*',\n '+': '+',\n ',': '︐',\n '-': '︲',\n '.': '・',\n '/': '/',\n ':': '︓',\n ';': '︔',\n '<': '︿',\n '=': '=',\n '>': '﹀',\n '?': '︖',\n '@': '@',\n '[': '﹇',\n '\\\\': '\',\n ']': '﹈',\n '^': '^',\n '_': '︳',\n '`': '`',\n '{': '︷',\n '|': '―',\n '}': '︸',\n '~': '~',\n '¢': '¢',\n '£': '£',\n '¥': '¥',\n '¦': '¦',\n '¬': '¬',\n '¯': ' ̄',\n '–': '︲',\n '—': '︱',\n '‘': '﹃',\n '’': '﹄',\n '“': '﹁',\n '”': '﹂',\n '…': '︙',\n '‧': '・',\n '₩': '₩',\n '、': '︑',\n '。': '︒',\n '〈': '︿',\n '〉': '﹀',\n '《': '︽',\n '》': '︾',\n '「': '﹁',\n '」': '﹂',\n '『': '﹃',\n '』': '﹄',\n '【': '︻',\n '】': '︼',\n '〔': '︹',\n '〕': '︺',\n '〖': '︗',\n '〗': '︘',\n '!': '︕',\n '(': '︵',\n ')': '︶',\n ',': '︐',\n '-': '︲',\n '.': '・',\n ':': '︓',\n ';': '︔',\n '<': '︿',\n '>': '﹀',\n '?': '︖',\n '[': '﹇',\n ']': '﹈',\n '_': '︳',\n '{': '︷',\n '|': '―',\n '}': '︸',\n '⦅': '︵',\n '⦆': '︶',\n '。': '︒',\n '「': '﹁',\n '」': '﹂'\n};\n\nexport default function verticalizePunctuation(input: string) {\n let output = '';\n\n for (let i = 0; i < input.length; i++) {\n const nextCharCode = input.charCodeAt(i + 1) || null;\n const prevCharCode = input.charCodeAt(i - 1) || null;\n\n const canReplacePunctuation = (\n (!nextCharCode || !charHasRotatedVerticalOrientation(nextCharCode) || verticalizedCharacterMap[input[i + 1]]) &&\n (!prevCharCode || !charHasRotatedVerticalOrientation(prevCharCode) || verticalizedCharacterMap[input[i - 1]])\n );\n\n if (canReplacePunctuation && verticalizedCharacterMap[input[i]]) {\n output += verticalizedCharacterMap[input[i]];\n } else {\n output += input[i];\n }\n }\n\n return output;\n}\n\n","exports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","'use strict';\n\nmodule.exports = Pbf;\n\nvar ieee754 = require('ieee754');\n\nfunction Pbf(buf) {\n this.buf = ArrayBuffer.isView && ArrayBuffer.isView(buf) ? buf : new Uint8Array(buf || 0);\n this.pos = 0;\n this.type = 0;\n this.length = this.buf.length;\n}\n\nPbf.Varint = 0; // varint: int32, int64, uint32, uint64, sint32, sint64, bool, enum\nPbf.Fixed64 = 1; // 64-bit: double, fixed64, sfixed64\nPbf.Bytes = 2; // length-delimited: string, bytes, embedded messages, packed repeated fields\nPbf.Fixed32 = 5; // 32-bit: float, fixed32, sfixed32\n\nvar SHIFT_LEFT_32 = (1 << 16) * (1 << 16),\n SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;\n\n// Threshold chosen based on both benchmarking and knowledge about browser string\n// data structures (which currently switch structure types at 12 bytes or more)\nvar TEXT_DECODER_MIN_LENGTH = 12;\nvar utf8TextDecoder = typeof TextDecoder === 'undefined' ? null : new TextDecoder('utf8');\n\nPbf.prototype = {\n\n destroy: function() {\n this.buf = null;\n },\n\n // === READING =================================================================\n\n readFields: function(readField, result, end) {\n end = end || this.length;\n\n while (this.pos < end) {\n var val = this.readVarint(),\n tag = val >> 3,\n startPos = this.pos;\n\n this.type = val & 0x7;\n readField(tag, result, this);\n\n if (this.pos === startPos) this.skip(val);\n }\n return result;\n },\n\n readMessage: function(readField, result) {\n return this.readFields(readField, result, this.readVarint() + this.pos);\n },\n\n readFixed32: function() {\n var val = readUInt32(this.buf, this.pos);\n this.pos += 4;\n return val;\n },\n\n readSFixed32: function() {\n var val = readInt32(this.buf, this.pos);\n this.pos += 4;\n return val;\n },\n\n // 64-bit int handling is based on github.com/dpw/node-buffer-more-ints (MIT-licensed)\n\n readFixed64: function() {\n var val = readUInt32(this.buf, this.pos) + readUInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;\n this.pos += 8;\n return val;\n },\n\n readSFixed64: function() {\n var val = readUInt32(this.buf, this.pos) + readInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;\n this.pos += 8;\n return val;\n },\n\n readFloat: function() {\n var val = ieee754.read(this.buf, this.pos, true, 23, 4);\n this.pos += 4;\n return val;\n },\n\n readDouble: function() {\n var val = ieee754.read(this.buf, this.pos, true, 52, 8);\n this.pos += 8;\n return val;\n },\n\n readVarint: function(isSigned) {\n var buf = this.buf,\n val, b;\n\n b = buf[this.pos++]; val = b & 0x7f; if (b < 0x80) return val;\n b = buf[this.pos++]; val |= (b & 0x7f) << 7; if (b < 0x80) return val;\n b = buf[this.pos++]; val |= (b & 0x7f) << 14; if (b < 0x80) return val;\n b = buf[this.pos++]; val |= (b & 0x7f) << 21; if (b < 0x80) return val;\n b = buf[this.pos]; val |= (b & 0x0f) << 28;\n\n return readVarintRemainder(val, isSigned, this);\n },\n\n readVarint64: function() { // for compatibility with v2.0.1\n return this.readVarint(true);\n },\n\n readSVarint: function() {\n var num = this.readVarint();\n return num % 2 === 1 ? (num + 1) / -2 : num / 2; // zigzag encoding\n },\n\n readBoolean: function() {\n return Boolean(this.readVarint());\n },\n\n readString: function() {\n var end = this.readVarint() + this.pos;\n var pos = this.pos;\n this.pos = end;\n\n if (end - pos >= TEXT_DECODER_MIN_LENGTH && utf8TextDecoder) {\n // longer strings are fast with the built-in browser TextDecoder API\n return readUtf8TextDecoder(this.buf, pos, end);\n }\n // short strings are fast with our custom implementation\n return readUtf8(this.buf, pos, end);\n },\n\n readBytes: function() {\n var end = this.readVarint() + this.pos,\n buffer = this.buf.subarray(this.pos, end);\n this.pos = end;\n return buffer;\n },\n\n // verbose for performance reasons; doesn't affect gzipped size\n\n readPackedVarint: function(arr, isSigned) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readVarint(isSigned));\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readVarint(isSigned));\n return arr;\n },\n readPackedSVarint: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readSVarint());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readSVarint());\n return arr;\n },\n readPackedBoolean: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readBoolean());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readBoolean());\n return arr;\n },\n readPackedFloat: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readFloat());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readFloat());\n return arr;\n },\n readPackedDouble: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readDouble());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readDouble());\n return arr;\n },\n readPackedFixed32: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readFixed32());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readFixed32());\n return arr;\n },\n readPackedSFixed32: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readSFixed32());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readSFixed32());\n return arr;\n },\n readPackedFixed64: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readFixed64());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readFixed64());\n return arr;\n },\n readPackedSFixed64: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readSFixed64());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readSFixed64());\n return arr;\n },\n\n skip: function(val) {\n var type = val & 0x7;\n if (type === Pbf.Varint) while (this.buf[this.pos++] > 0x7f) {}\n else if (type === Pbf.Bytes) this.pos = this.readVarint() + this.pos;\n else if (type === Pbf.Fixed32) this.pos += 4;\n else if (type === Pbf.Fixed64) this.pos += 8;\n else throw new Error('Unimplemented type: ' + type);\n },\n\n // === WRITING =================================================================\n\n writeTag: function(tag, type) {\n this.writeVarint((tag << 3) | type);\n },\n\n realloc: function(min) {\n var length = this.length || 16;\n\n while (length < this.pos + min) length *= 2;\n\n if (length !== this.length) {\n var buf = new Uint8Array(length);\n buf.set(this.buf);\n this.buf = buf;\n this.length = length;\n }\n },\n\n finish: function() {\n this.length = this.pos;\n this.pos = 0;\n return this.buf.subarray(0, this.length);\n },\n\n writeFixed32: function(val) {\n this.realloc(4);\n writeInt32(this.buf, val, this.pos);\n this.pos += 4;\n },\n\n writeSFixed32: function(val) {\n this.realloc(4);\n writeInt32(this.buf, val, this.pos);\n this.pos += 4;\n },\n\n writeFixed64: function(val) {\n this.realloc(8);\n writeInt32(this.buf, val & -1, this.pos);\n writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);\n this.pos += 8;\n },\n\n writeSFixed64: function(val) {\n this.realloc(8);\n writeInt32(this.buf, val & -1, this.pos);\n writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);\n this.pos += 8;\n },\n\n writeVarint: function(val) {\n val = +val || 0;\n\n if (val > 0xfffffff || val < 0) {\n writeBigVarint(val, this);\n return;\n }\n\n this.realloc(4);\n\n this.buf[this.pos++] = val & 0x7f | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;\n this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;\n this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;\n this.buf[this.pos++] = (val >>> 7) & 0x7f;\n },\n\n writeSVarint: function(val) {\n this.writeVarint(val < 0 ? -val * 2 - 1 : val * 2);\n },\n\n writeBoolean: function(val) {\n this.writeVarint(Boolean(val));\n },\n\n writeString: function(str) {\n str = String(str);\n this.realloc(str.length * 4);\n\n this.pos++; // reserve 1 byte for short string length\n\n var startPos = this.pos;\n // write the string directly to the buffer and see how much was written\n this.pos = writeUtf8(this.buf, str, this.pos);\n var len = this.pos - startPos;\n\n if (len >= 0x80) makeRoomForExtraLength(startPos, len, this);\n\n // finally, write the message length in the reserved place and restore the position\n this.pos = startPos - 1;\n this.writeVarint(len);\n this.pos += len;\n },\n\n writeFloat: function(val) {\n this.realloc(4);\n ieee754.write(this.buf, val, this.pos, true, 23, 4);\n this.pos += 4;\n },\n\n writeDouble: function(val) {\n this.realloc(8);\n ieee754.write(this.buf, val, this.pos, true, 52, 8);\n this.pos += 8;\n },\n\n writeBytes: function(buffer) {\n var len = buffer.length;\n this.writeVarint(len);\n this.realloc(len);\n for (var i = 0; i < len; i++) this.buf[this.pos++] = buffer[i];\n },\n\n writeRawMessage: function(fn, obj) {\n this.pos++; // reserve 1 byte for short message length\n\n // write the message directly to the buffer and see how much was written\n var startPos = this.pos;\n fn(obj, this);\n var len = this.pos - startPos;\n\n if (len >= 0x80) makeRoomForExtraLength(startPos, len, this);\n\n // finally, write the message length in the reserved place and restore the position\n this.pos = startPos - 1;\n this.writeVarint(len);\n this.pos += len;\n },\n\n writeMessage: function(tag, fn, obj) {\n this.writeTag(tag, Pbf.Bytes);\n this.writeRawMessage(fn, obj);\n },\n\n writePackedVarint: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedVarint, arr); },\n writePackedSVarint: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSVarint, arr); },\n writePackedBoolean: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedBoolean, arr); },\n writePackedFloat: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFloat, arr); },\n writePackedDouble: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedDouble, arr); },\n writePackedFixed32: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFixed32, arr); },\n writePackedSFixed32: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSFixed32, arr); },\n writePackedFixed64: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFixed64, arr); },\n writePackedSFixed64: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSFixed64, arr); },\n\n writeBytesField: function(tag, buffer) {\n this.writeTag(tag, Pbf.Bytes);\n this.writeBytes(buffer);\n },\n writeFixed32Field: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed32);\n this.writeFixed32(val);\n },\n writeSFixed32Field: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed32);\n this.writeSFixed32(val);\n },\n writeFixed64Field: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed64);\n this.writeFixed64(val);\n },\n writeSFixed64Field: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed64);\n this.writeSFixed64(val);\n },\n writeVarintField: function(tag, val) {\n this.writeTag(tag, Pbf.Varint);\n this.writeVarint(val);\n },\n writeSVarintField: function(tag, val) {\n this.writeTag(tag, Pbf.Varint);\n this.writeSVarint(val);\n },\n writeStringField: function(tag, str) {\n this.writeTag(tag, Pbf.Bytes);\n this.writeString(str);\n },\n writeFloatField: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed32);\n this.writeFloat(val);\n },\n writeDoubleField: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed64);\n this.writeDouble(val);\n },\n writeBooleanField: function(tag, val) {\n this.writeVarintField(tag, Boolean(val));\n }\n};\n\nfunction readVarintRemainder(l, s, p) {\n var buf = p.buf,\n h, b;\n\n b = buf[p.pos++]; h = (b & 0x70) >> 4; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x7f) << 3; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x7f) << 10; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x7f) << 17; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x7f) << 24; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x01) << 31; if (b < 0x80) return toNum(l, h, s);\n\n throw new Error('Expected varint not more than 10 bytes');\n}\n\nfunction readPackedEnd(pbf) {\n return pbf.type === Pbf.Bytes ?\n pbf.readVarint() + pbf.pos : pbf.pos + 1;\n}\n\nfunction toNum(low, high, isSigned) {\n if (isSigned) {\n return high * 0x100000000 + (low >>> 0);\n }\n\n return ((high >>> 0) * 0x100000000) + (low >>> 0);\n}\n\nfunction writeBigVarint(val, pbf) {\n var low, high;\n\n if (val >= 0) {\n low = (val % 0x100000000) | 0;\n high = (val / 0x100000000) | 0;\n } else {\n low = ~(-val % 0x100000000);\n high = ~(-val / 0x100000000);\n\n if (low ^ 0xffffffff) {\n low = (low + 1) | 0;\n } else {\n low = 0;\n high = (high + 1) | 0;\n }\n }\n\n if (val >= 0x10000000000000000 || val < -0x10000000000000000) {\n throw new Error('Given varint doesn\\'t fit into 10 bytes');\n }\n\n pbf.realloc(10);\n\n writeBigVarintLow(low, high, pbf);\n writeBigVarintHigh(high, pbf);\n}\n\nfunction writeBigVarintLow(low, high, pbf) {\n pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;\n pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;\n pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;\n pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;\n pbf.buf[pbf.pos] = low & 0x7f;\n}\n\nfunction writeBigVarintHigh(high, pbf) {\n var lsb = (high & 0x07) << 4;\n\n pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f;\n}\n\nfunction makeRoomForExtraLength(startPos, len, pbf) {\n var extraLen =\n len <= 0x3fff ? 1 :\n len <= 0x1fffff ? 2 :\n len <= 0xfffffff ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));\n\n // if 1 byte isn't enough for encoding message length, shift the data to the right\n pbf.realloc(extraLen);\n for (var i = pbf.pos - 1; i >= startPos; i--) pbf.buf[i + extraLen] = pbf.buf[i];\n}\n\nfunction writePackedVarint(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeVarint(arr[i]); }\nfunction writePackedSVarint(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSVarint(arr[i]); }\nfunction writePackedFloat(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFloat(arr[i]); }\nfunction writePackedDouble(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeDouble(arr[i]); }\nfunction writePackedBoolean(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeBoolean(arr[i]); }\nfunction writePackedFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFixed32(arr[i]); }\nfunction writePackedSFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed32(arr[i]); }\nfunction writePackedFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFixed64(arr[i]); }\nfunction writePackedSFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed64(arr[i]); }\n\n// Buffer code below from https://github.com/feross/buffer, MIT-licensed\n\nfunction readUInt32(buf, pos) {\n return ((buf[pos]) |\n (buf[pos + 1] << 8) |\n (buf[pos + 2] << 16)) +\n (buf[pos + 3] * 0x1000000);\n}\n\nfunction writeInt32(buf, val, pos) {\n buf[pos] = val;\n buf[pos + 1] = (val >>> 8);\n buf[pos + 2] = (val >>> 16);\n buf[pos + 3] = (val >>> 24);\n}\n\nfunction readInt32(buf, pos) {\n return ((buf[pos]) |\n (buf[pos + 1] << 8) |\n (buf[pos + 2] << 16)) +\n (buf[pos + 3] << 24);\n}\n\nfunction readUtf8(buf, pos, end) {\n var str = '';\n var i = pos;\n\n while (i < end) {\n var b0 = buf[i];\n var c = null; // codepoint\n var bytesPerSequence =\n b0 > 0xEF ? 4 :\n b0 > 0xDF ? 3 :\n b0 > 0xBF ? 2 : 1;\n\n if (i + bytesPerSequence > end) break;\n\n var b1, b2, b3;\n\n if (bytesPerSequence === 1) {\n if (b0 < 0x80) {\n c = b0;\n }\n } else if (bytesPerSequence === 2) {\n b1 = buf[i + 1];\n if ((b1 & 0xC0) === 0x80) {\n c = (b0 & 0x1F) << 0x6 | (b1 & 0x3F);\n if (c <= 0x7F) {\n c = null;\n }\n }\n } else if (bytesPerSequence === 3) {\n b1 = buf[i + 1];\n b2 = buf[i + 2];\n if ((b1 & 0xC0) === 0x80 && (b2 & 0xC0) === 0x80) {\n c = (b0 & 0xF) << 0xC | (b1 & 0x3F) << 0x6 | (b2 & 0x3F);\n if (c <= 0x7FF || (c >= 0xD800 && c <= 0xDFFF)) {\n c = null;\n }\n }\n } else if (bytesPerSequence === 4) {\n b1 = buf[i + 1];\n b2 = buf[i + 2];\n b3 = buf[i + 3];\n if ((b1 & 0xC0) === 0x80 && (b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80) {\n c = (b0 & 0xF) << 0x12 | (b1 & 0x3F) << 0xC | (b2 & 0x3F) << 0x6 | (b3 & 0x3F);\n if (c <= 0xFFFF || c >= 0x110000) {\n c = null;\n }\n }\n }\n\n if (c === null) {\n c = 0xFFFD;\n bytesPerSequence = 1;\n\n } else if (c > 0xFFFF) {\n c -= 0x10000;\n str += String.fromCharCode(c >>> 10 & 0x3FF | 0xD800);\n c = 0xDC00 | c & 0x3FF;\n }\n\n str += String.fromCharCode(c);\n i += bytesPerSequence;\n }\n\n return str;\n}\n\nfunction readUtf8TextDecoder(buf, pos, end) {\n return utf8TextDecoder.decode(buf.subarray(pos, end));\n}\n\nfunction writeUtf8(buf, str, pos) {\n for (var i = 0, c, lead; i < str.length; i++) {\n c = str.charCodeAt(i); // code point\n\n if (c > 0xD7FF && c < 0xE000) {\n if (lead) {\n if (c < 0xDC00) {\n buf[pos++] = 0xEF;\n buf[pos++] = 0xBF;\n buf[pos++] = 0xBD;\n lead = c;\n continue;\n } else {\n c = lead - 0xD800 << 10 | c - 0xDC00 | 0x10000;\n lead = null;\n }\n } else {\n if (c > 0xDBFF || (i + 1 === str.length)) {\n buf[pos++] = 0xEF;\n buf[pos++] = 0xBF;\n buf[pos++] = 0xBD;\n } else {\n lead = c;\n }\n continue;\n }\n } else if (lead) {\n buf[pos++] = 0xEF;\n buf[pos++] = 0xBF;\n buf[pos++] = 0xBD;\n lead = null;\n }\n\n if (c < 0x80) {\n buf[pos++] = c;\n } else {\n if (c < 0x800) {\n buf[pos++] = c >> 0x6 | 0xC0;\n } else {\n if (c < 0x10000) {\n buf[pos++] = c >> 0xC | 0xE0;\n } else {\n buf[pos++] = c >> 0x12 | 0xF0;\n buf[pos++] = c >> 0xC & 0x3F | 0x80;\n }\n buf[pos++] = c >> 0x6 & 0x3F | 0x80;\n }\n buf[pos++] = c & 0x3F | 0x80;\n }\n }\n return pos;\n}\n","// @flow\n\nimport {AlphaImage} from '../util/image';\n\nimport Protobuf from 'pbf';\nconst border = 3;\n\nimport type {StyleGlyph} from './style_glyph';\n\nfunction readFontstacks(tag: number, glyphs: Array, pbf: Protobuf) {\n if (tag === 1) {\n pbf.readMessage(readFontstack, glyphs);\n }\n}\n\nfunction readFontstack(tag: number, glyphs: Array, pbf: Protobuf) {\n if (tag === 3) {\n const {id, bitmap, width, height, left, top, advance} = pbf.readMessage(readGlyph, {});\n glyphs.push({\n id,\n bitmap: new AlphaImage({\n width: width + 2 * border,\n height: height + 2 * border\n }, bitmap),\n metrics: {width, height, left, top, advance}\n });\n }\n}\n\nfunction readGlyph(tag: number, glyph: Object, pbf: Protobuf) {\n if (tag === 1) glyph.id = pbf.readVarint();\n else if (tag === 2) glyph.bitmap = pbf.readBytes();\n else if (tag === 3) glyph.width = pbf.readVarint();\n else if (tag === 4) glyph.height = pbf.readVarint();\n else if (tag === 5) glyph.left = pbf.readSVarint();\n else if (tag === 6) glyph.top = pbf.readSVarint();\n else if (tag === 7) glyph.advance = pbf.readVarint();\n}\n\nexport default function (data: ArrayBuffer | Uint8Array): Array {\n return new Protobuf(data).readFields(readFontstacks, []);\n}\n\nexport const GLYPH_PBF_BORDER = border;\n","\nexport default function potpack(boxes) {\n\n // calculate total box area and maximum box width\n let area = 0;\n let maxWidth = 0;\n\n for (const box of boxes) {\n area += box.w * box.h;\n maxWidth = Math.max(maxWidth, box.w);\n }\n\n // sort the boxes for insertion by height, descending\n boxes.sort((a, b) => b.h - a.h);\n\n // aim for a squarish resulting container,\n // slightly adjusted for sub-100% space utilization\n const startWidth = Math.max(Math.ceil(Math.sqrt(area / 0.95)), maxWidth);\n\n // start with a single empty space, unbounded at the bottom\n const spaces = [{x: 0, y: 0, w: startWidth, h: Infinity}];\n\n let width = 0;\n let height = 0;\n\n for (const box of boxes) {\n // look through spaces backwards so that we check smaller spaces first\n for (let i = spaces.length - 1; i >= 0; i--) {\n const space = spaces[i];\n\n // look for empty spaces that can accommodate the current box\n if (box.w > space.w || box.h > space.h) continue;\n\n // found the space; add the box to its top-left corner\n // |-------|-------|\n // | box | |\n // |_______| |\n // | space |\n // |_______________|\n box.x = space.x;\n box.y = space.y;\n\n height = Math.max(height, box.y + box.h);\n width = Math.max(width, box.x + box.w);\n\n if (box.w === space.w && box.h === space.h) {\n // space matches the box exactly; remove it\n const last = spaces.pop();\n if (i < spaces.length) spaces[i] = last;\n\n } else if (box.h === space.h) {\n // space matches the box height; update it accordingly\n // |-------|---------------|\n // | box | updated space |\n // |_______|_______________|\n space.x += box.w;\n space.w -= box.w;\n\n } else if (box.w === space.w) {\n // space matches the box width; update it accordingly\n // |---------------|\n // | box |\n // |_______________|\n // | updated space |\n // |_______________|\n space.y += box.h;\n space.h -= box.h;\n\n } else {\n // otherwise the box splits the space into two spaces\n // |-------|-----------|\n // | box | new space |\n // |_______|___________|\n // | updated space |\n // |___________________|\n spaces.push({\n x: space.x + box.w,\n y: space.y,\n w: space.w - box.w,\n h: box.h\n });\n space.y += box.h;\n space.h -= box.h;\n }\n break;\n }\n }\n\n return {\n w: width, // container width\n h: height, // container height\n fill: (area / (width * height)) || 0 // space utilization\n };\n}\n","// @flow\n\nimport {RGBAImage} from '../util/image';\nimport {register} from '../util/web_worker_transfer';\nimport potpack from 'potpack';\n\nimport type {StyleImage} from '../style/style_image';\nimport type ImageManager from './image_manager';\nimport type Texture from './texture';\n\nconst IMAGE_PADDING: number = 1;\nexport {IMAGE_PADDING};\n\ntype Rect = {\n x: number,\n y: number,\n w: number,\n h: number\n};\n\nexport class ImagePosition {\n paddedRect: Rect;\n pixelRatio: number;\n version: number;\n stretchY: ?Array<[number, number]>;\n stretchX: ?Array<[number, number]>;\n content: ?[number, number, number, number];\n\n constructor(paddedRect: Rect, {pixelRatio, version, stretchX, stretchY, content}: StyleImage) {\n this.paddedRect = paddedRect;\n this.pixelRatio = pixelRatio;\n this.stretchX = stretchX;\n this.stretchY = stretchY;\n this.content = content;\n this.version = version;\n }\n\n get tl(): [number, number] {\n return [\n this.paddedRect.x + IMAGE_PADDING,\n this.paddedRect.y + IMAGE_PADDING\n ];\n }\n\n get br(): [number, number] {\n return [\n this.paddedRect.x + this.paddedRect.w - IMAGE_PADDING,\n this.paddedRect.y + this.paddedRect.h - IMAGE_PADDING\n ];\n }\n\n get tlbr(): Array {\n return this.tl.concat(this.br);\n }\n\n get displaySize(): [number, number] {\n return [\n (this.paddedRect.w - IMAGE_PADDING * 2) / this.pixelRatio,\n (this.paddedRect.h - IMAGE_PADDING * 2) / this.pixelRatio\n ];\n }\n}\n\nexport default class ImageAtlas {\n image: RGBAImage;\n iconPositions: {[_: string]: ImagePosition};\n patternPositions: {[_: string]: ImagePosition};\n haveRenderCallbacks: Array;\n uploaded: ?boolean;\n\n constructor(icons: {[_: string]: StyleImage}, patterns: {[_: string]: StyleImage}) {\n const iconPositions = {}, patternPositions = {};\n this.haveRenderCallbacks = [];\n\n const bins = [];\n\n this.addImages(icons, iconPositions, bins);\n this.addImages(patterns, patternPositions, bins);\n\n const {w, h} = potpack(bins);\n const image = new RGBAImage({width: w || 1, height: h || 1});\n\n for (const id in icons) {\n const src = icons[id];\n const bin = iconPositions[id].paddedRect;\n RGBAImage.copy(src.data, image, {x: 0, y: 0}, {x: bin.x + IMAGE_PADDING, y: bin.y + IMAGE_PADDING}, src.data);\n }\n\n for (const id in patterns) {\n const src = patterns[id];\n const bin = patternPositions[id].paddedRect;\n const x = bin.x + IMAGE_PADDING,\n y = bin.y + IMAGE_PADDING,\n w = src.data.width,\n h = src.data.height;\n\n RGBAImage.copy(src.data, image, {x: 0, y: 0}, {x, y}, src.data);\n // Add 1 pixel wrapped padding on each side of the image.\n RGBAImage.copy(src.data, image, {x: 0, y: h - 1}, {x, y: y - 1}, {width: w, height: 1}); // T\n RGBAImage.copy(src.data, image, {x: 0, y: 0}, {x, y: y + h}, {width: w, height: 1}); // B\n RGBAImage.copy(src.data, image, {x: w - 1, y: 0}, {x: x - 1, y}, {width: 1, height: h}); // L\n RGBAImage.copy(src.data, image, {x: 0, y: 0}, {x: x + w, y}, {width: 1, height: h}); // R\n }\n\n this.image = image;\n this.iconPositions = iconPositions;\n this.patternPositions = patternPositions;\n }\n\n addImages(images: {[_: string]: StyleImage}, positions: {[_: string]: ImagePosition}, bins: Array) {\n for (const id in images) {\n const src = images[id];\n const bin = {\n x: 0,\n y: 0,\n w: src.data.width + 2 * IMAGE_PADDING,\n h: src.data.height + 2 * IMAGE_PADDING,\n };\n bins.push(bin);\n positions[id] = new ImagePosition(bin, src);\n\n if (src.hasRenderCallback) {\n this.haveRenderCallbacks.push(id);\n }\n }\n }\n\n patchUpdatedImages(imageManager: ImageManager, texture: Texture) {\n imageManager.dispatchRenderCallbacks(this.haveRenderCallbacks);\n for (const name in imageManager.updatedImages) {\n this.patchUpdatedImage(this.iconPositions[name], imageManager.getImage(name), texture);\n this.patchUpdatedImage(this.patternPositions[name], imageManager.getImage(name), texture);\n }\n }\n\n patchUpdatedImage(position: ?ImagePosition, image: ?StyleImage, texture: Texture) {\n if (!position || !image) return;\n\n if (position.version === image.version) return;\n\n position.version = image.version;\n const [x, y] = position.tl;\n texture.update(image.data, undefined, {x, y});\n }\n\n}\n\nregister('ImagePosition', ImagePosition);\nregister('ImageAtlas', ImageAtlas);\n","// @flow\n\nimport assert from 'assert';\nimport {\n charHasUprightVerticalOrientation,\n charAllowsIdeographicBreaking,\n charInComplexShapingScript\n} from '../util/script_detection';\nimport verticalizePunctuation from '../util/verticalize_punctuation';\nimport {plugin as rtlTextPlugin} from '../source/rtl_text_plugin';\nimport ONE_EM from './one_em';\nimport {warnOnce} from '../util/util';\n\nimport type {StyleGlyph, GlyphMetrics} from '../style/style_glyph';\nimport {GLYPH_PBF_BORDER} from '../style/parse_glyph_pbf';\nimport type {ImagePosition} from '../render/image_atlas';\nimport {IMAGE_PADDING} from '../render/image_atlas';\nimport type {Rect, GlyphPosition} from '../render/glyph_atlas';\nimport Formatted, {FormattedSection} from '../style-spec/expression/types/formatted';\n\nconst WritingMode = {\n horizontal: 1,\n vertical: 2,\n horizontalOnly: 3\n};\n\nconst SHAPING_DEFAULT_OFFSET = -17;\nexport {shapeText, shapeIcon, fitIconToText, getAnchorAlignment, WritingMode, SHAPING_DEFAULT_OFFSET};\n\n// The position of a glyph relative to the text's anchor point.\nexport type PositionedGlyph = {\n glyph: number,\n imageName: string | null,\n x: number,\n y: number,\n vertical: boolean,\n scale: number,\n fontStack: string,\n sectionIndex: number,\n metrics: GlyphMetrics,\n rect: Rect | null\n};\n\nexport type PositionedLine = {\n positionedGlyphs: Array,\n lineOffset: number\n};\n\n// A collection of positioned glyphs and some metadata\nexport type Shaping = {\n positionedLines: Array,\n top: number,\n bottom: number,\n left: number,\n right: number,\n writingMode: 1 | 2,\n text: string,\n iconsInText: boolean,\n verticalizable: boolean\n};\n\nfunction isEmpty(positionedLines: Array) {\n for (const line of positionedLines) {\n if (line.positionedGlyphs.length !== 0) {\n return false;\n }\n }\n return true;\n}\n\nexport type SymbolAnchor = 'center' | 'left' | 'right' | 'top' | 'bottom' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';\nexport type TextJustify = 'left' | 'center' | 'right';\n\n// Max number of images in label is 6401 U+E000–U+F8FF that covers\n// Basic Multilingual Plane Unicode Private Use Area (PUA).\nconst PUAbegin = 0xE000;\nconst PUAend = 0xF8FF;\n\nclass SectionOptions {\n // Text options\n scale: number;\n fontStack: string;\n // Image options\n imageName: string | null;\n\n constructor() {\n this.scale = 1.0;\n this.fontStack = \"\";\n this.imageName = null;\n }\n\n static forText(scale: number | null, fontStack: string) {\n const textOptions = new SectionOptions();\n textOptions.scale = scale || 1;\n textOptions.fontStack = fontStack;\n return textOptions;\n }\n\n static forImage(imageName: string) {\n const imageOptions = new SectionOptions();\n imageOptions.imageName = imageName;\n return imageOptions;\n }\n\n}\n\nclass TaggedString {\n text: string;\n sectionIndex: Array // maps each character in 'text' to its corresponding entry in 'sections'\n sections: Array\n imageSectionID: number | null;\n\n constructor() {\n this.text = \"\";\n this.sectionIndex = [];\n this.sections = [];\n this.imageSectionID = null;\n }\n\n static fromFeature(text: Formatted, defaultFontStack: string) {\n const result = new TaggedString();\n for (let i = 0; i < text.sections.length; i++) {\n const section = text.sections[i];\n if (!section.image) {\n result.addTextSection(section, defaultFontStack);\n } else {\n result.addImageSection(section);\n }\n }\n return result;\n }\n\n length(): number {\n return this.text.length;\n }\n\n getSection(index: number): SectionOptions {\n return this.sections[this.sectionIndex[index]];\n }\n\n getSectionIndex(index: number): number {\n return this.sectionIndex[index];\n }\n\n getCharCode(index: number): number {\n return this.text.charCodeAt(index);\n }\n\n verticalizePunctuation() {\n this.text = verticalizePunctuation(this.text);\n }\n\n trim() {\n let beginningWhitespace = 0;\n for (let i = 0;\n i < this.text.length && whitespace[this.text.charCodeAt(i)];\n i++) {\n beginningWhitespace++;\n }\n let trailingWhitespace = this.text.length;\n for (let i = this.text.length - 1;\n i >= 0 && i >= beginningWhitespace && whitespace[this.text.charCodeAt(i)];\n i--) {\n trailingWhitespace--;\n }\n this.text = this.text.substring(beginningWhitespace, trailingWhitespace);\n this.sectionIndex = this.sectionIndex.slice(beginningWhitespace, trailingWhitespace);\n }\n\n substring(start: number, end: number): TaggedString {\n const substring = new TaggedString();\n substring.text = this.text.substring(start, end);\n substring.sectionIndex = this.sectionIndex.slice(start, end);\n substring.sections = this.sections;\n return substring;\n }\n\n toString(): string {\n return this.text;\n }\n\n getMaxScale() {\n return this.sectionIndex.reduce((max, index) => Math.max(max, this.sections[index].scale), 0);\n }\n\n addTextSection(section: FormattedSection, defaultFontStack: string) {\n this.text += section.text;\n this.sections.push(SectionOptions.forText(section.scale, section.fontStack || defaultFontStack));\n const index = this.sections.length - 1;\n for (let i = 0; i < section.text.length; ++i) {\n this.sectionIndex.push(index);\n }\n }\n\n addImageSection(section: FormattedSection) {\n const imageName = section.image ? section.image.name : '';\n if (imageName.length === 0) {\n warnOnce(`Can't add FormattedSection with an empty image.`);\n return;\n }\n\n const nextImageSectionCharCode = this.getNextImageSectionCharCode();\n if (!nextImageSectionCharCode) {\n warnOnce(`Reached maximum number of images ${PUAend - PUAbegin + 2}`);\n return;\n }\n\n this.text += String.fromCharCode(nextImageSectionCharCode);\n this.sections.push(SectionOptions.forImage(imageName));\n this.sectionIndex.push(this.sections.length - 1);\n }\n\n getNextImageSectionCharCode(): number | null {\n if (!this.imageSectionID) {\n this.imageSectionID = PUAbegin;\n return this.imageSectionID;\n }\n\n if (this.imageSectionID >= PUAend) return null;\n return ++this.imageSectionID;\n }\n}\n\nfunction breakLines(input: TaggedString, lineBreakPoints: Array): Array {\n const lines = [];\n const text = input.text;\n let start = 0;\n for (const lineBreak of lineBreakPoints) {\n lines.push(input.substring(start, lineBreak));\n start = lineBreak;\n }\n\n if (start < text.length) {\n lines.push(input.substring(start, text.length));\n }\n return lines;\n}\n\nfunction shapeText(text: Formatted,\n glyphMap: {[_: string]: {[_: number]: ?StyleGlyph}},\n glyphPositions: {[_: string]: {[_: number]: GlyphPosition}},\n imagePositions: {[_: string]: ImagePosition},\n defaultFontStack: string,\n maxWidth: number,\n lineHeight: number,\n textAnchor: SymbolAnchor,\n textJustify: TextJustify,\n spacing: number,\n translate: [number, number],\n writingMode: 1 | 2,\n allowVerticalPlacement: boolean,\n symbolPlacement: string,\n layoutTextSize: number,\n layoutTextSizeThisZoom: number): Shaping | false {\n const logicalInput = TaggedString.fromFeature(text, defaultFontStack);\n\n if (writingMode === WritingMode.vertical) {\n logicalInput.verticalizePunctuation();\n }\n\n let lines: Array;\n\n const {processBidirectionalText, processStyledBidirectionalText} = rtlTextPlugin;\n if (processBidirectionalText && logicalInput.sections.length === 1) {\n // Bidi doesn't have to be style-aware\n lines = [];\n const untaggedLines =\n processBidirectionalText(logicalInput.toString(),\n determineLineBreaks(logicalInput, spacing, maxWidth, glyphMap, imagePositions, symbolPlacement, layoutTextSize));\n for (const line of untaggedLines) {\n const taggedLine = new TaggedString();\n taggedLine.text = line;\n taggedLine.sections = logicalInput.sections;\n for (let i = 0; i < line.length; i++) {\n taggedLine.sectionIndex.push(0);\n }\n lines.push(taggedLine);\n }\n } else if (processStyledBidirectionalText) {\n // Need version of mapbox-gl-rtl-text with style support for combining RTL text\n // with formatting\n lines = [];\n const processedLines =\n processStyledBidirectionalText(logicalInput.text,\n logicalInput.sectionIndex,\n determineLineBreaks(logicalInput, spacing, maxWidth, glyphMap, imagePositions, symbolPlacement, layoutTextSize));\n for (const line of processedLines) {\n const taggedLine = new TaggedString();\n taggedLine.text = line[0];\n taggedLine.sectionIndex = line[1];\n taggedLine.sections = logicalInput.sections;\n lines.push(taggedLine);\n }\n } else {\n lines = breakLines(logicalInput, determineLineBreaks(logicalInput, spacing, maxWidth, glyphMap, imagePositions, symbolPlacement, layoutTextSize));\n }\n\n const positionedLines = [];\n const shaping = {\n positionedLines,\n text: logicalInput.toString(),\n top: translate[1],\n bottom: translate[1],\n left: translate[0],\n right: translate[0],\n writingMode,\n iconsInText: false,\n verticalizable: false\n };\n\n shapeLines(shaping, glyphMap, glyphPositions, imagePositions, lines, lineHeight, textAnchor, textJustify, writingMode, spacing, allowVerticalPlacement, layoutTextSizeThisZoom);\n if (isEmpty(positionedLines)) return false;\n\n return shaping;\n}\n\n// using computed properties due to https://github.com/facebook/flow/issues/380\n/* eslint no-useless-computed-key: 0 */\n\nconst whitespace: {[_: number]: boolean} = {\n [0x09]: true, // tab\n [0x0a]: true, // newline\n [0x0b]: true, // vertical tab\n [0x0c]: true, // form feed\n [0x0d]: true, // carriage return\n [0x20]: true, // space\n};\n\nconst breakable: {[_: number]: boolean} = {\n [0x0a]: true, // newline\n [0x20]: true, // space\n [0x26]: true, // ampersand\n [0x28]: true, // left parenthesis\n [0x29]: true, // right parenthesis\n [0x2b]: true, // plus sign\n [0x2d]: true, // hyphen-minus\n [0x2f]: true, // solidus\n [0xad]: true, // soft hyphen\n [0xb7]: true, // middle dot\n [0x200b]: true, // zero-width space\n [0x2010]: true, // hyphen\n [0x2013]: true, // en dash\n [0x2027]: true // interpunct\n // Many other characters may be reasonable breakpoints\n // Consider \"neutral orientation\" characters at scriptDetection.charHasNeutralVerticalOrientation\n // See https://github.com/mapbox/mapbox-gl-js/issues/3658\n};\n\nfunction getGlyphAdvance(codePoint: number,\n section: SectionOptions,\n glyphMap: {[_: string]: {[_: number]: ?StyleGlyph}},\n imagePositions: {[_: string]: ImagePosition},\n spacing: number,\n layoutTextSize: number): number {\n if (!section.imageName) {\n const positions = glyphMap[section.fontStack];\n const glyph = positions && positions[codePoint];\n if (!glyph) return 0;\n return glyph.metrics.advance * section.scale + spacing;\n } else {\n const imagePosition = imagePositions[section.imageName];\n if (!imagePosition) return 0;\n return imagePosition.displaySize[0] * section.scale * ONE_EM / layoutTextSize + spacing;\n }\n}\n\nfunction determineAverageLineWidth(logicalInput: TaggedString,\n spacing: number,\n maxWidth: number,\n glyphMap: {[_: string]: {[_: number]: ?StyleGlyph}},\n imagePositions: {[_: string]: ImagePosition},\n layoutTextSize: number) {\n let totalWidth = 0;\n\n for (let index = 0; index < logicalInput.length(); index++) {\n const section = logicalInput.getSection(index);\n totalWidth += getGlyphAdvance(logicalInput.getCharCode(index), section, glyphMap, imagePositions, spacing, layoutTextSize);\n }\n\n const lineCount = Math.max(1, Math.ceil(totalWidth / maxWidth));\n return totalWidth / lineCount;\n}\n\nfunction calculateBadness(lineWidth: number,\n targetWidth: number,\n penalty: number,\n isLastBreak: boolean) {\n const raggedness = Math.pow(lineWidth - targetWidth, 2);\n if (isLastBreak) {\n // Favor finals lines shorter than average over longer than average\n if (lineWidth < targetWidth) {\n return raggedness / 2;\n } else {\n return raggedness * 2;\n }\n }\n\n return raggedness + Math.abs(penalty) * penalty;\n}\n\nfunction calculatePenalty(codePoint: number, nextCodePoint: number, penalizableIdeographicBreak: boolean) {\n let penalty = 0;\n // Force break on newline\n if (codePoint === 0x0a) {\n penalty -= 10000;\n }\n // Penalize breaks between characters that allow ideographic breaking because\n // they are less preferable than breaks at spaces (or zero width spaces).\n if (penalizableIdeographicBreak) {\n penalty += 150;\n }\n\n // Penalize open parenthesis at end of line\n if (codePoint === 0x28 || codePoint === 0xff08) {\n penalty += 50;\n }\n\n // Penalize close parenthesis at beginning of line\n if (nextCodePoint === 0x29 || nextCodePoint === 0xff09) {\n penalty += 50;\n }\n return penalty;\n}\n\ntype Break = {\n index: number,\n x: number,\n priorBreak: ?Break,\n badness: number\n};\n\nfunction evaluateBreak(breakIndex: number,\n breakX: number,\n targetWidth: number,\n potentialBreaks: Array,\n penalty: number,\n isLastBreak: boolean): Break {\n // We could skip evaluating breaks where the line length (breakX - priorBreak.x) > maxWidth\n // ...but in fact we allow lines longer than maxWidth (if there's no break points)\n // ...and when targetWidth and maxWidth are close, strictly enforcing maxWidth can give\n // more lopsided results.\n\n let bestPriorBreak: ?Break = null;\n let bestBreakBadness = calculateBadness(breakX, targetWidth, penalty, isLastBreak);\n\n for (const potentialBreak of potentialBreaks) {\n const lineWidth = breakX - potentialBreak.x;\n const breakBadness =\n calculateBadness(lineWidth, targetWidth, penalty, isLastBreak) + potentialBreak.badness;\n if (breakBadness <= bestBreakBadness) {\n bestPriorBreak = potentialBreak;\n bestBreakBadness = breakBadness;\n }\n }\n\n return {\n index: breakIndex,\n x: breakX,\n priorBreak: bestPriorBreak,\n badness: bestBreakBadness\n };\n}\n\nfunction leastBadBreaks(lastLineBreak: ?Break): Array {\n if (!lastLineBreak) {\n return [];\n }\n return leastBadBreaks(lastLineBreak.priorBreak).concat(lastLineBreak.index);\n}\n\nfunction determineLineBreaks(logicalInput: TaggedString,\n spacing: number,\n maxWidth: number,\n glyphMap: {[_: string]: {[_: number]: ?StyleGlyph}},\n imagePositions: {[_: string]: ImagePosition},\n symbolPlacement: string,\n layoutTextSize: number): Array {\n if (symbolPlacement !== 'point')\n return [];\n\n if (!logicalInput)\n return [];\n\n const potentialLineBreaks = [];\n const targetWidth = determineAverageLineWidth(logicalInput, spacing, maxWidth, glyphMap, imagePositions, layoutTextSize);\n\n const hasServerSuggestedBreakpoints = logicalInput.text.indexOf(\"\\u200b\") >= 0;\n\n let currentX = 0;\n\n for (let i = 0; i < logicalInput.length(); i++) {\n const section = logicalInput.getSection(i);\n const codePoint = logicalInput.getCharCode(i);\n if (!whitespace[codePoint]) currentX += getGlyphAdvance(codePoint, section, glyphMap, imagePositions, spacing, layoutTextSize);\n\n // Ideographic characters, spaces, and word-breaking punctuation that often appear without\n // surrounding spaces.\n if ((i < logicalInput.length() - 1)) {\n const ideographicBreak = charAllowsIdeographicBreaking(codePoint);\n if (breakable[codePoint] || ideographicBreak || section.imageName) {\n\n potentialLineBreaks.push(\n evaluateBreak(\n i + 1,\n currentX,\n targetWidth,\n potentialLineBreaks,\n calculatePenalty(codePoint, logicalInput.getCharCode(i + 1), ideographicBreak && hasServerSuggestedBreakpoints),\n false));\n }\n }\n }\n\n return leastBadBreaks(\n evaluateBreak(\n logicalInput.length(),\n currentX,\n targetWidth,\n potentialLineBreaks,\n 0,\n true));\n}\n\nfunction getAnchorAlignment(anchor: SymbolAnchor) {\n let horizontalAlign = 0.5, verticalAlign = 0.5;\n\n switch (anchor) {\n case 'right':\n case 'top-right':\n case 'bottom-right':\n horizontalAlign = 1;\n break;\n case 'left':\n case 'top-left':\n case 'bottom-left':\n horizontalAlign = 0;\n break;\n }\n\n switch (anchor) {\n case 'bottom':\n case 'bottom-right':\n case 'bottom-left':\n verticalAlign = 1;\n break;\n case 'top':\n case 'top-right':\n case 'top-left':\n verticalAlign = 0;\n break;\n }\n\n return {horizontalAlign, verticalAlign};\n}\n\nfunction shapeLines(shaping: Shaping,\n glyphMap: {[_: string]: {[_: number]: ?StyleGlyph}},\n glyphPositions: {[_: string]: {[_: number]: GlyphPosition}},\n imagePositions: {[_: string]: ImagePosition},\n lines: Array,\n lineHeight: number,\n textAnchor: SymbolAnchor,\n textJustify: TextJustify,\n writingMode: 1 | 2,\n spacing: number,\n allowVerticalPlacement: boolean,\n layoutTextSizeThisZoom: number) {\n\n let x = 0;\n let y = SHAPING_DEFAULT_OFFSET;\n\n let maxLineLength = 0;\n let maxLineHeight = 0;\n\n const justify =\n textJustify === 'right' ? 1 :\n textJustify === 'left' ? 0 : 0.5;\n\n let lineIndex = 0;\n for (const line of lines) {\n line.trim();\n\n const lineMaxScale = line.getMaxScale();\n const maxLineOffset = (lineMaxScale - 1) * ONE_EM;\n const positionedLine = {positionedGlyphs: [], lineOffset: 0};\n shaping.positionedLines[lineIndex] = positionedLine;\n const positionedGlyphs = positionedLine.positionedGlyphs;\n let lineOffset = 0.0;\n\n if (!line.length()) {\n y += lineHeight; // Still need a line feed after empty line\n ++lineIndex;\n continue;\n }\n\n for (let i = 0; i < line.length(); i++) {\n const section = line.getSection(i);\n const sectionIndex = line.getSectionIndex(i);\n const codePoint = line.getCharCode(i);\n let baselineOffset = 0.0;\n let metrics = null;\n let rect = null;\n let imageName = null;\n let verticalAdvance = ONE_EM;\n const vertical = !(writingMode === WritingMode.horizontal ||\n // Don't verticalize glyphs that have no upright orientation if vertical placement is disabled.\n (!allowVerticalPlacement && !charHasUprightVerticalOrientation(codePoint)) ||\n // If vertical placement is enabled, don't verticalize glyphs that\n // are from complex text layout script, or whitespaces.\n (allowVerticalPlacement && (whitespace[codePoint] || charInComplexShapingScript(codePoint))));\n\n if (!section.imageName) {\n const positions = glyphPositions[section.fontStack];\n const glyphPosition = positions && positions[codePoint];\n if (glyphPosition && glyphPosition.rect) {\n rect = glyphPosition.rect;\n metrics = glyphPosition.metrics;\n } else {\n const glyphs = glyphMap[section.fontStack];\n const glyph = glyphs && glyphs[codePoint];\n if (!glyph) continue;\n metrics = glyph.metrics;\n }\n\n // We don't know the baseline, but since we're laying out\n // at 24 points, we can calculate how much it will move when\n // we scale up or down.\n baselineOffset = (lineMaxScale - section.scale) * ONE_EM;\n } else {\n const imagePosition = imagePositions[section.imageName];\n if (!imagePosition) continue;\n imageName = section.imageName;\n shaping.iconsInText = shaping.iconsInText || true;\n rect = imagePosition.paddedRect;\n const size = imagePosition.displaySize;\n // If needed, allow to set scale factor for an image using\n // alias \"image-scale\" that could be alias for \"font-scale\"\n // when FormattedSection is an image section.\n section.scale = section.scale * ONE_EM / layoutTextSizeThisZoom;\n\n metrics = {width: size[0],\n height: size[1],\n left: IMAGE_PADDING,\n top: -GLYPH_PBF_BORDER,\n advance: vertical ? size[1] : size[0]};\n\n // Difference between one EM and an image size.\n // Aligns bottom of an image to a baseline level.\n const imageOffset = ONE_EM - size[1] * section.scale;\n baselineOffset = maxLineOffset + imageOffset;\n verticalAdvance = metrics.advance;\n\n // Difference between height of an image and one EM at max line scale.\n // Pushes current line down if an image size is over 1 EM at max line scale.\n const offset = vertical ? size[0] * section.scale - ONE_EM * lineMaxScale :\n size[1] * section.scale - ONE_EM * lineMaxScale;\n if (offset > 0 && offset > lineOffset) {\n lineOffset = offset;\n }\n }\n\n if (!vertical) {\n positionedGlyphs.push({glyph: codePoint, imageName, x, y: y + baselineOffset, vertical, scale: section.scale, fontStack: section.fontStack, sectionIndex, metrics, rect});\n x += metrics.advance * section.scale + spacing;\n } else {\n shaping.verticalizable = true;\n positionedGlyphs.push({glyph: codePoint, imageName, x, y: y + baselineOffset, vertical, scale: section.scale, fontStack: section.fontStack, sectionIndex, metrics, rect});\n x += verticalAdvance * section.scale + spacing;\n }\n }\n\n // Only justify if we placed at least one glyph\n if (positionedGlyphs.length !== 0) {\n const lineLength = x - spacing;\n maxLineLength = Math.max(lineLength, maxLineLength);\n justifyLine(positionedGlyphs, 0, positionedGlyphs.length - 1, justify, lineOffset);\n }\n\n x = 0;\n const currentLineHeight = lineHeight * lineMaxScale + lineOffset;\n positionedLine.lineOffset = Math.max(lineOffset, maxLineOffset);\n y += currentLineHeight;\n maxLineHeight = Math.max(currentLineHeight, maxLineHeight);\n ++lineIndex;\n }\n\n // Calculate the bounding box and justify / align text block.\n const height = y - SHAPING_DEFAULT_OFFSET;\n const {horizontalAlign, verticalAlign} = getAnchorAlignment(textAnchor);\n align(shaping.positionedLines, justify, horizontalAlign, verticalAlign, maxLineLength, maxLineHeight, lineHeight, height, lines.length);\n\n shaping.top += -verticalAlign * height;\n shaping.bottom = shaping.top + height;\n shaping.left += -horizontalAlign * maxLineLength;\n shaping.right = shaping.left + maxLineLength;\n}\n\n// justify right = 1, left = 0, center = 0.5\nfunction justifyLine(positionedGlyphs: Array,\n start: number,\n end: number,\n justify: 1 | 0 | 0.5,\n lineOffset: number) {\n if (!justify && !lineOffset)\n return;\n\n const lastPositionedGlyph = positionedGlyphs[end];\n const lastAdvance = lastPositionedGlyph.metrics.advance * lastPositionedGlyph.scale;\n const lineIndent = (positionedGlyphs[end].x + lastAdvance) * justify;\n\n for (let j = start; j <= end; j++) {\n positionedGlyphs[j].x -= lineIndent;\n positionedGlyphs[j].y += lineOffset;\n }\n}\n\nfunction align(positionedLines: Array,\n justify: number,\n horizontalAlign: number,\n verticalAlign: number,\n maxLineLength: number,\n maxLineHeight: number,\n lineHeight: number,\n blockHeight: number,\n lineCount: number) {\n const shiftX = (justify - horizontalAlign) * maxLineLength;\n let shiftY = 0;\n\n if (maxLineHeight !== lineHeight) {\n shiftY = -blockHeight * verticalAlign - SHAPING_DEFAULT_OFFSET;\n } else {\n shiftY = (-verticalAlign * lineCount + 0.5) * lineHeight;\n }\n\n for (const line of positionedLines) {\n for (const positionedGlyph of line.positionedGlyphs) {\n positionedGlyph.x += shiftX;\n positionedGlyph.y += shiftY;\n }\n }\n}\n\nexport type PositionedIcon = {\n image: ImagePosition,\n top: number,\n bottom: number,\n left: number,\n right: number,\n collisionPadding?: [number, number, number, number]\n};\n\nfunction shapeIcon(image: ImagePosition, iconOffset: [number, number], iconAnchor: SymbolAnchor): PositionedIcon {\n const {horizontalAlign, verticalAlign} = getAnchorAlignment(iconAnchor);\n const dx = iconOffset[0];\n const dy = iconOffset[1];\n const x1 = dx - image.displaySize[0] * horizontalAlign;\n const x2 = x1 + image.displaySize[0];\n const y1 = dy - image.displaySize[1] * verticalAlign;\n const y2 = y1 + image.displaySize[1];\n return {image, top: y1, bottom: y2, left: x1, right: x2};\n}\n\nfunction fitIconToText(shapedIcon: PositionedIcon, shapedText: Shaping,\n textFit: string,\n padding: [ number, number, number, number ],\n iconOffset: [ number, number ], fontScale: number): PositionedIcon {\n assert(textFit !== 'none');\n assert(Array.isArray(padding) && padding.length === 4);\n assert(Array.isArray(iconOffset) && iconOffset.length === 2);\n\n const image = shapedIcon.image;\n\n let collisionPadding;\n if (image.content) {\n const content = image.content;\n const pixelRatio = image.pixelRatio || 1;\n collisionPadding = [\n content[0] / pixelRatio,\n content[1] / pixelRatio,\n image.displaySize[0] - content[2] / pixelRatio,\n image.displaySize[1] - content[3] / pixelRatio\n ];\n }\n\n // We don't respect the icon-anchor, because icon-text-fit is set. Instead,\n // the icon will be centered on the text, then stretched in the given\n // dimensions.\n\n const textLeft = shapedText.left * fontScale;\n const textRight = shapedText.right * fontScale;\n\n let top, right, bottom, left;\n if (textFit === 'width' || textFit === 'both') {\n // Stretched horizontally to the text width\n left = iconOffset[0] + textLeft - padding[3];\n right = iconOffset[0] + textRight + padding[1];\n } else {\n // Centered on the text\n left = iconOffset[0] + (textLeft + textRight - image.displaySize[0]) / 2;\n right = left + image.displaySize[0];\n }\n\n const textTop = shapedText.top * fontScale;\n const textBottom = shapedText.bottom * fontScale;\n if (textFit === 'height' || textFit === 'both') {\n // Stretched vertically to the text height\n top = iconOffset[1] + textTop - padding[0];\n bottom = iconOffset[1] + textBottom + padding[2];\n } else {\n // Centered on the text\n top = iconOffset[1] + (textTop + textBottom - image.displaySize[1]) / 2;\n bottom = top + image.displaySize[1];\n }\n\n return {image, top, right, bottom, left, collisionPadding};\n}\n","// @flow\n\nimport Point from '@mapbox/point-geometry';\n\nimport {register} from '../util/web_worker_transfer';\n\nclass Anchor extends Point {\n angle: any;\n segment: number | void;\n\n constructor(x: number, y: number, angle: number, segment?: number) {\n super(x, y);\n this.angle = angle;\n if (segment !== undefined) {\n this.segment = segment;\n }\n }\n\n clone() {\n return new Anchor(this.x, this.y, this.angle, this.segment);\n }\n}\n\nregister('Anchor', Anchor);\n\nexport default Anchor;\n","// @flow\n\nimport {number as interpolate} from '../style-spec/util/interpolate';\nimport Interpolate from '../style-spec/expression/definitions/interpolate';\nimport {clamp} from '../util/util';\nimport EvaluationParameters from '../style/evaluation_parameters';\n\nimport type {PropertyValue, PossiblyEvaluatedPropertyValue} from '../style/properties';\nimport type {InterpolationType} from '../style-spec/expression/definitions/interpolate';\n\nconst SIZE_PACK_FACTOR = 128;\n\nexport {getSizeData, evaluateSizeForFeature, evaluateSizeForZoom, SIZE_PACK_FACTOR};\n\nexport type SizeData = {\n kind: 'constant',\n layoutSize: number\n} | {\n kind: 'source'\n} | {\n kind: 'camera',\n minZoom: number,\n maxZoom: number,\n minSize: number,\n maxSize: number,\n interpolationType: ?InterpolationType\n} | {\n kind: 'composite',\n minZoom: number,\n maxZoom: number,\n interpolationType: ?InterpolationType\n};\n\n// For {text,icon}-size, get the bucket-level data that will be needed by\n// the painter to set symbol-size-related uniforms\nfunction getSizeData(tileZoom: number, value: PropertyValue>): SizeData {\n const {expression} = value;\n\n if (expression.kind === 'constant') {\n const layoutSize = expression.evaluate(new EvaluationParameters(tileZoom + 1));\n return {kind: 'constant', layoutSize};\n\n } else if (expression.kind === 'source') {\n return {kind: 'source'};\n\n } else {\n const {zoomStops, interpolationType} = expression;\n\n // calculate covering zoom stops for zoom-dependent values\n let lower = 0;\n while (lower < zoomStops.length && zoomStops[lower] <= tileZoom) lower++;\n lower = Math.max(0, lower - 1);\n let upper = lower;\n while (upper < zoomStops.length && zoomStops[upper] < tileZoom + 1) upper++;\n upper = Math.min(zoomStops.length - 1, upper);\n\n const minZoom = zoomStops[lower];\n const maxZoom = zoomStops[upper];\n\n // We'd like to be able to use CameraExpression or CompositeExpression in these\n // return types rather than ExpressionSpecification, but the former are not\n // transferrable across Web Worker boundaries.\n if (expression.kind === 'composite') {\n return {kind: 'composite', minZoom, maxZoom, interpolationType};\n }\n\n // for camera functions, also save off the function values\n // evaluated at the covering zoom levels\n const minSize = expression.evaluate(new EvaluationParameters(minZoom));\n const maxSize = expression.evaluate(new EvaluationParameters(maxZoom));\n\n return {kind: 'camera', minZoom, maxZoom, minSize, maxSize, interpolationType};\n }\n}\n\nfunction evaluateSizeForFeature(sizeData: SizeData,\n {uSize, uSizeT}: { uSize: number, uSizeT: number },\n {lowerSize, upperSize}: { lowerSize: number, upperSize: number}) {\n if (sizeData.kind === 'source') {\n return lowerSize / SIZE_PACK_FACTOR;\n } else if (sizeData.kind === 'composite') {\n return interpolate(lowerSize / SIZE_PACK_FACTOR, upperSize / SIZE_PACK_FACTOR, uSizeT);\n }\n return uSize;\n}\n\nfunction evaluateSizeForZoom(sizeData: SizeData, zoom: number) {\n let uSizeT = 0;\n let uSize = 0;\n\n if (sizeData.kind === 'constant') {\n uSize = sizeData.layoutSize;\n\n } else if (sizeData.kind !== 'source') {\n const {interpolationType, minZoom, maxZoom} = sizeData;\n\n // Even though we could get the exact value of the camera function\n // at z = tr.zoom, we intentionally do not: instead, we interpolate\n // between the camera function values at a pair of zoom stops covering\n // [tileZoom, tileZoom + 1] in order to be consistent with this\n // restriction on composite functions\n const t = !interpolationType ? 0 : clamp(\n Interpolate.interpolationFactor(interpolationType, zoom, minZoom, maxZoom), 0, 1);\n\n if (sizeData.kind === 'camera') {\n uSize = interpolate(sizeData.minSize, sizeData.maxSize, t);\n } else {\n uSizeT = t;\n }\n }\n\n return {uSizeT, uSize};\n}\n","// @flow\n\nexport default checkMaxAngle;\n\nimport type Point from '@mapbox/point-geometry';\nimport type Anchor from './anchor';\n\n/**\n * Labels placed around really sharp angles aren't readable. Check if any\n * part of the potential label has a combined angle that is too big.\n *\n * @param line\n * @param anchor The point on the line around which the label is anchored.\n * @param labelLength The length of the label in geometry units.\n * @param windowSize The check fails if the combined angles within a part of the line that is `windowSize` long is too big.\n * @param maxAngle The maximum combined angle that any window along the label is allowed to have.\n *\n * @returns {boolean} whether the label should be placed\n * @private\n */\nfunction checkMaxAngle(line: Array, anchor: Anchor, labelLength: number, windowSize: number, maxAngle: number) {\n\n // horizontal labels always pass\n if (anchor.segment === undefined) return true;\n\n let p = anchor;\n let index = anchor.segment + 1;\n let anchorDistance = 0;\n\n // move backwards along the line to the first segment the label appears on\n while (anchorDistance > -labelLength / 2) {\n index--;\n\n // there isn't enough room for the label after the beginning of the line\n if (index < 0) return false;\n\n anchorDistance -= line[index].dist(p);\n p = line[index];\n }\n\n anchorDistance += line[index].dist(line[index + 1]);\n index++;\n\n // store recent corners and their total angle difference\n const recentCorners = [];\n let recentAngleDelta = 0;\n\n // move forwards by the length of the label and check angles along the way\n while (anchorDistance < labelLength / 2) {\n const prev = line[index - 1];\n const current = line[index];\n const next = line[index + 1];\n\n // there isn't enough room for the label before the end of the line\n if (!next) return false;\n\n let angleDelta = prev.angleTo(current) - current.angleTo(next);\n // restrict angle to -pi..pi range\n angleDelta = Math.abs(((angleDelta + 3 * Math.PI) % (Math.PI * 2)) - Math.PI);\n\n recentCorners.push({\n distance: anchorDistance,\n angleDelta\n });\n recentAngleDelta += angleDelta;\n\n // remove corners that are far enough away from the list of recent anchors\n while (anchorDistance - recentCorners[0].distance > windowSize) {\n recentAngleDelta -= recentCorners.shift().angleDelta;\n }\n\n // the sum of angles within the window area exceeds the maximum allowed value. check fails.\n if (recentAngleDelta > maxAngle) return false;\n\n index++;\n anchorDistance += current.dist(next);\n }\n\n // no part of the line had an angle greater than the maximum allowed. check passes.\n return true;\n}\n","// @flow\n\nimport {number as interpolate} from '../style-spec/util/interpolate';\n\nimport Anchor from '../symbol/anchor';\nimport checkMaxAngle from './check_max_angle';\n\nimport type Point from '@mapbox/point-geometry';\nimport type {Shaping, PositionedIcon} from './shaping';\n\nexport {getAnchors, getCenterAnchor};\n\nfunction getLineLength(line: Array): number {\n let lineLength = 0;\n for (let k = 0; k < line.length - 1; k++) {\n lineLength += line[k].dist(line[k + 1]);\n }\n return lineLength;\n}\n\nfunction getAngleWindowSize(shapedText: ?Shaping,\n glyphSize: number,\n boxScale: number): number {\n return shapedText ?\n 3 / 5 * glyphSize * boxScale :\n 0;\n}\n\nfunction getShapedLabelLength(shapedText: ?Shaping, shapedIcon: ?PositionedIcon): number {\n return Math.max(\n shapedText ? shapedText.right - shapedText.left : 0,\n shapedIcon ? shapedIcon.right - shapedIcon.left : 0);\n}\n\nfunction getCenterAnchor(line: Array,\n maxAngle: number,\n shapedText: ?Shaping,\n shapedIcon: ?PositionedIcon,\n glyphSize: number,\n boxScale: number) {\n const angleWindowSize = getAngleWindowSize(shapedText, glyphSize, boxScale);\n const labelLength = getShapedLabelLength(shapedText, shapedIcon) * boxScale;\n\n let prevDistance = 0;\n const centerDistance = getLineLength(line) / 2;\n\n for (let i = 0; i < line.length - 1; i++) {\n\n const a = line[i],\n b = line[i + 1];\n\n const segmentDistance = a.dist(b);\n\n if (prevDistance + segmentDistance > centerDistance) {\n // The center is on this segment\n const t = (centerDistance - prevDistance) / segmentDistance,\n x = interpolate(a.x, b.x, t),\n y = interpolate(a.y, b.y, t);\n\n const anchor = new Anchor(x, y, b.angleTo(a), i);\n anchor._round();\n if (!angleWindowSize || checkMaxAngle(line, anchor, labelLength, angleWindowSize, maxAngle)) {\n return anchor;\n } else {\n return;\n }\n }\n\n prevDistance += segmentDistance;\n }\n}\n\nfunction getAnchors(line: Array,\n spacing: number,\n maxAngle: number,\n shapedText: ?Shaping,\n shapedIcon: ?PositionedIcon,\n glyphSize: number,\n boxScale: number,\n overscaling: number,\n tileExtent: number) {\n\n // Resample a line to get anchor points for labels and check that each\n // potential label passes text-max-angle check and has enough froom to fit\n // on the line.\n\n const angleWindowSize = getAngleWindowSize(shapedText, glyphSize, boxScale);\n const shapedLabelLength = getShapedLabelLength(shapedText, shapedIcon);\n const labelLength = shapedLabelLength * boxScale;\n\n // Is the line continued from outside the tile boundary?\n const isLineContinued = line[0].x === 0 || line[0].x === tileExtent || line[0].y === 0 || line[0].y === tileExtent;\n\n // Is the label long, relative to the spacing?\n // If so, adjust the spacing so there is always a minimum space of `spacing / 4` between label edges.\n if (spacing - labelLength < spacing / 4) {\n spacing = labelLength + spacing / 4;\n }\n\n // Offset the first anchor by:\n // Either half the label length plus a fixed extra offset if the line is not continued\n // Or half the spacing if the line is continued.\n\n // For non-continued lines, add a bit of fixed extra offset to avoid collisions at T intersections.\n const fixedExtraOffset = glyphSize * 2;\n\n const offset = !isLineContinued ?\n ((shapedLabelLength / 2 + fixedExtraOffset) * boxScale * overscaling) % spacing :\n (spacing / 2 * overscaling) % spacing;\n\n return resample(line, offset, spacing, angleWindowSize, maxAngle, labelLength, isLineContinued, false, tileExtent);\n}\n\nfunction resample(line, offset, spacing, angleWindowSize, maxAngle, labelLength, isLineContinued, placeAtMiddle, tileExtent) {\n\n const halfLabelLength = labelLength / 2;\n const lineLength = getLineLength(line);\n\n let distance = 0,\n markedDistance = offset - spacing;\n\n let anchors = [];\n\n for (let i = 0; i < line.length - 1; i++) {\n\n const a = line[i],\n b = line[i + 1];\n\n const segmentDist = a.dist(b),\n angle = b.angleTo(a);\n\n while (markedDistance + spacing < distance + segmentDist) {\n markedDistance += spacing;\n\n const t = (markedDistance - distance) / segmentDist,\n x = interpolate(a.x, b.x, t),\n y = interpolate(a.y, b.y, t);\n\n // Check that the point is within the tile boundaries and that\n // the label would fit before the beginning and end of the line\n // if placed at this point.\n if (x >= 0 && x < tileExtent && y >= 0 && y < tileExtent &&\n markedDistance - halfLabelLength >= 0 &&\n markedDistance + halfLabelLength <= lineLength) {\n const anchor = new Anchor(x, y, angle, i);\n anchor._round();\n\n if (!angleWindowSize || checkMaxAngle(line, anchor, labelLength, angleWindowSize, maxAngle)) {\n anchors.push(anchor);\n }\n }\n }\n\n distance += segmentDist;\n }\n\n if (!placeAtMiddle && !anchors.length && !isLineContinued) {\n // The first attempt at finding anchors at which labels can be placed failed.\n // Try again, but this time just try placing one anchor at the middle of the line.\n // This has the most effect for short lines in overscaled tiles, since the\n // initial offset used in overscaled tiles is calculated to align labels with positions in\n // parent tiles instead of placing the label as close to the beginning as possible.\n anchors = resample(line, distance / 2, spacing, angleWindowSize, maxAngle, labelLength, isLineContinued, true, tileExtent);\n }\n\n return anchors;\n}\n","// @flow\n\nimport Point from '@mapbox/point-geometry';\n\nexport default clipLine;\n\n/**\n * Returns the part of a multiline that intersects with the provided rectangular box.\n *\n * @param lines\n * @param x1 the left edge of the box\n * @param y1 the top edge of the box\n * @param x2 the right edge of the box\n * @param y2 the bottom edge of the box\n * @returns lines\n * @private\n */\nfunction clipLine(lines: Array>, x1: number, y1: number, x2: number, y2: number): Array> {\n const clippedLines = [];\n\n for (let l = 0; l < lines.length; l++) {\n const line = lines[l];\n let clippedLine;\n\n for (let i = 0; i < line.length - 1; i++) {\n let p0 = line[i];\n let p1 = line[i + 1];\n\n if (p0.x < x1 && p1.x < x1) {\n continue;\n } else if (p0.x < x1) {\n p0 = new Point(x1, p0.y + (p1.y - p0.y) * ((x1 - p0.x) / (p1.x - p0.x)))._round();\n } else if (p1.x < x1) {\n p1 = new Point(x1, p0.y + (p1.y - p0.y) * ((x1 - p0.x) / (p1.x - p0.x)))._round();\n }\n\n if (p0.y < y1 && p1.y < y1) {\n continue;\n } else if (p0.y < y1) {\n p0 = new Point(p0.x + (p1.x - p0.x) * ((y1 - p0.y) / (p1.y - p0.y)), y1)._round();\n } else if (p1.y < y1) {\n p1 = new Point(p0.x + (p1.x - p0.x) * ((y1 - p0.y) / (p1.y - p0.y)), y1)._round();\n }\n\n if (p0.x >= x2 && p1.x >= x2) {\n continue;\n } else if (p0.x >= x2) {\n p0 = new Point(x2, p0.y + (p1.y - p0.y) * ((x2 - p0.x) / (p1.x - p0.x)))._round();\n } else if (p1.x >= x2) {\n p1 = new Point(x2, p0.y + (p1.y - p0.y) * ((x2 - p0.x) / (p1.x - p0.x)))._round();\n }\n\n if (p0.y >= y2 && p1.y >= y2) {\n continue;\n } else if (p0.y >= y2) {\n p0 = new Point(p0.x + (p1.x - p0.x) * ((y2 - p0.y) / (p1.y - p0.y)), y2)._round();\n } else if (p1.y >= y2) {\n p1 = new Point(p0.x + (p1.x - p0.x) * ((y2 - p0.y) / (p1.y - p0.y)), y2)._round();\n }\n\n if (!clippedLine || !p0.equals(clippedLine[clippedLine.length - 1])) {\n clippedLine = [p0];\n clippedLines.push(clippedLine);\n }\n\n clippedLine.push(p1);\n }\n }\n\n return clippedLines;\n}\n","// @flow\n\nimport Point from '@mapbox/point-geometry';\n\nimport {GLYPH_PBF_BORDER} from '../style/parse_glyph_pbf';\n\nimport type Anchor from './anchor';\nimport type {PositionedIcon, Shaping} from './shaping';\nimport {SHAPING_DEFAULT_OFFSET} from './shaping';\nimport {IMAGE_PADDING} from '../render/image_atlas';\nimport type SymbolStyleLayer from '../style/style_layer/symbol_style_layer';\nimport type {Feature} from '../style-spec/expression';\nimport type {StyleImage} from '../style/style_image';\nimport ONE_EM from './one_em';\n\n/**\n * A textured quad for rendering a single icon or glyph.\n *\n * The zoom range the glyph can be shown is defined by minScale and maxScale.\n *\n * @param tl The offset of the top left corner from the anchor.\n * @param tr The offset of the top right corner from the anchor.\n * @param bl The offset of the bottom left corner from the anchor.\n * @param br The offset of the bottom right corner from the anchor.\n * @param tex The texture coordinates.\n *\n * @private\n */\nexport type SymbolQuad = {\n tl: Point,\n tr: Point,\n bl: Point,\n br: Point,\n tex: {\n x: number,\n y: number,\n w: number,\n h: number\n },\n pixelOffsetTL: Point,\n pixelOffsetBR: Point,\n writingMode: any | void,\n glyphOffset: [number, number],\n sectionIndex: number,\n isSDF: boolean,\n minFontScaleX: number,\n minFontScaleY: number\n};\n\n// If you have a 10px icon that isn't perfectly aligned to the pixel grid it will cover 11 actual\n// pixels. The quad needs to be padded to account for this, otherwise they'll look slightly clipped\n// on one edge in some cases.\nconst border = IMAGE_PADDING;\n\n/**\n * Create the quads used for rendering an icon.\n * @private\n */\nexport function getIconQuads(\n shapedIcon: PositionedIcon,\n iconRotate: number,\n isSDFIcon: boolean,\n hasIconTextFit: boolean): Array {\n const quads = [];\n\n const image = shapedIcon.image;\n const pixelRatio = image.pixelRatio;\n const imageWidth = image.paddedRect.w - 2 * border;\n const imageHeight = image.paddedRect.h - 2 * border;\n\n const iconWidth = shapedIcon.right - shapedIcon.left;\n const iconHeight = shapedIcon.bottom - shapedIcon.top;\n\n const stretchX = image.stretchX || [[0, imageWidth]];\n const stretchY = image.stretchY || [[0, imageHeight]];\n\n const reduceRanges = (sum, range) => sum + range[1] - range[0];\n const stretchWidth = stretchX.reduce(reduceRanges, 0);\n const stretchHeight = stretchY.reduce(reduceRanges, 0);\n const fixedWidth = imageWidth - stretchWidth;\n const fixedHeight = imageHeight - stretchHeight;\n\n let stretchOffsetX = 0;\n let stretchContentWidth = stretchWidth;\n let stretchOffsetY = 0;\n let stretchContentHeight = stretchHeight;\n let fixedOffsetX = 0;\n let fixedContentWidth = fixedWidth;\n let fixedOffsetY = 0;\n let fixedContentHeight = fixedHeight;\n\n if (image.content && hasIconTextFit) {\n const content = image.content;\n stretchOffsetX = sumWithinRange(stretchX, 0, content[0]);\n stretchOffsetY = sumWithinRange(stretchY, 0, content[1]);\n stretchContentWidth = sumWithinRange(stretchX, content[0], content[2]);\n stretchContentHeight = sumWithinRange(stretchY, content[1], content[3]);\n fixedOffsetX = content[0] - stretchOffsetX;\n fixedOffsetY = content[1] - stretchOffsetY;\n fixedContentWidth = content[2] - content[0] - stretchContentWidth;\n fixedContentHeight = content[3] - content[1] - stretchContentHeight;\n }\n\n const makeBox = (left, top, right, bottom) => {\n\n const leftEm = getEmOffset(left.stretch - stretchOffsetX, stretchContentWidth, iconWidth, shapedIcon.left);\n const leftPx = getPxOffset(left.fixed - fixedOffsetX, fixedContentWidth, left.stretch, stretchWidth);\n\n const topEm = getEmOffset(top.stretch - stretchOffsetY, stretchContentHeight, iconHeight, shapedIcon.top);\n const topPx = getPxOffset(top.fixed - fixedOffsetY, fixedContentHeight, top.stretch, stretchHeight);\n\n const rightEm = getEmOffset(right.stretch - stretchOffsetX, stretchContentWidth, iconWidth, shapedIcon.left);\n const rightPx = getPxOffset(right.fixed - fixedOffsetX, fixedContentWidth, right.stretch, stretchWidth);\n\n const bottomEm = getEmOffset(bottom.stretch - stretchOffsetY, stretchContentHeight, iconHeight, shapedIcon.top);\n const bottomPx = getPxOffset(bottom.fixed - fixedOffsetY, fixedContentHeight, bottom.stretch, stretchHeight);\n\n const tl = new Point(leftEm, topEm);\n const tr = new Point(rightEm, topEm);\n const br = new Point(rightEm, bottomEm);\n const bl = new Point(leftEm, bottomEm);\n const pixelOffsetTL = new Point(leftPx / pixelRatio, topPx / pixelRatio);\n const pixelOffsetBR = new Point(rightPx / pixelRatio, bottomPx / pixelRatio);\n\n const angle = iconRotate * Math.PI / 180;\n\n if (angle) {\n const sin = Math.sin(angle),\n cos = Math.cos(angle),\n matrix = [cos, -sin, sin, cos];\n\n tl._matMult(matrix);\n tr._matMult(matrix);\n bl._matMult(matrix);\n br._matMult(matrix);\n }\n\n const x1 = left.stretch + left.fixed;\n const x2 = right.stretch + right.fixed;\n const y1 = top.stretch + top.fixed;\n const y2 = bottom.stretch + bottom.fixed;\n\n const subRect = {\n x: image.paddedRect.x + border + x1,\n y: image.paddedRect.y + border + y1,\n w: x2 - x1,\n h: y2 - y1\n };\n\n const minFontScaleX = fixedContentWidth / pixelRatio / iconWidth;\n const minFontScaleY = fixedContentHeight / pixelRatio / iconHeight;\n\n // Icon quad is padded, so texture coordinates also need to be padded.\n return {tl, tr, bl, br, tex: subRect, writingMode: undefined, glyphOffset: [0, 0], sectionIndex: 0, pixelOffsetTL, pixelOffsetBR, minFontScaleX, minFontScaleY, isSDF: isSDFIcon};\n };\n\n if (!hasIconTextFit || (!image.stretchX && !image.stretchY)) {\n quads.push(makeBox(\n {fixed: 0, stretch: -1},\n {fixed: 0, stretch: -1},\n {fixed: 0, stretch: imageWidth + 1},\n {fixed: 0, stretch: imageHeight + 1}));\n } else {\n const xCuts = stretchZonesToCuts(stretchX, fixedWidth, stretchWidth);\n const yCuts = stretchZonesToCuts(stretchY, fixedHeight, stretchHeight);\n\n for (let xi = 0; xi < xCuts.length - 1; xi++) {\n const x1 = xCuts[xi];\n const x2 = xCuts[xi + 1];\n for (let yi = 0; yi < yCuts.length - 1; yi++) {\n const y1 = yCuts[yi];\n const y2 = yCuts[yi + 1];\n quads.push(makeBox(x1, y1, x2, y2));\n }\n }\n }\n\n return quads;\n}\n\nfunction sumWithinRange(ranges, min, max) {\n let sum = 0;\n for (const range of ranges) {\n sum += Math.max(min, Math.min(max, range[1])) - Math.max(min, Math.min(max, range[0]));\n }\n return sum;\n}\n\nfunction stretchZonesToCuts(stretchZones, fixedSize, stretchSize) {\n const cuts = [{fixed: -border, stretch: 0}];\n\n for (const [c1, c2] of stretchZones) {\n const last = cuts[cuts.length - 1];\n cuts.push({\n fixed: c1 - last.stretch,\n stretch: last.stretch\n });\n cuts.push({\n fixed: c1 - last.stretch,\n stretch: last.stretch + (c2 - c1)\n });\n }\n cuts.push({\n fixed: fixedSize + border,\n stretch: stretchSize\n });\n return cuts;\n}\n\nfunction getEmOffset(stretchOffset, stretchSize, iconSize, iconOffset) {\n return stretchOffset / stretchSize * iconSize + iconOffset;\n}\n\nfunction getPxOffset(fixedOffset, fixedSize, stretchOffset, stretchSize) {\n return fixedOffset - fixedSize * stretchOffset / stretchSize;\n}\n\n/**\n * Create the quads used for rendering a text label.\n * @private\n */\nexport function getGlyphQuads(anchor: Anchor,\n shaping: Shaping,\n textOffset: [number, number],\n layer: SymbolStyleLayer,\n alongLine: boolean,\n feature: Feature,\n imageMap: {[_: string]: StyleImage},\n allowVerticalPlacement: boolean): Array {\n\n const textRotate = layer.layout.get('text-rotate').evaluate(feature, {}) * Math.PI / 180;\n const quads = [];\n\n for (const line of shaping.positionedLines) {\n for (const positionedGlyph of line.positionedGlyphs) {\n if (!positionedGlyph.rect) continue;\n const textureRect = positionedGlyph.rect || {};\n\n // The rects have an additional buffer that is not included in their size.\n const glyphPadding = 1.0;\n let rectBuffer = GLYPH_PBF_BORDER + glyphPadding;\n let isSDF = true;\n let pixelRatio = 1.0;\n let lineOffset = 0.0;\n\n const rotateVerticalGlyph = (alongLine || allowVerticalPlacement) && positionedGlyph.vertical;\n const halfAdvance = positionedGlyph.metrics.advance * positionedGlyph.scale / 2;\n\n // Align images and scaled glyphs in the middle of a vertical line.\n if (allowVerticalPlacement && shaping.verticalizable) {\n const scaledGlyphOffset = (positionedGlyph.scale - 1) * ONE_EM;\n const imageOffset = (ONE_EM - positionedGlyph.metrics.width * positionedGlyph.scale) / 2;\n lineOffset = line.lineOffset / 2 - (positionedGlyph.imageName ? -imageOffset : scaledGlyphOffset);\n }\n\n if (positionedGlyph.imageName) {\n const image = imageMap[positionedGlyph.imageName];\n isSDF = image.sdf;\n pixelRatio = image.pixelRatio;\n rectBuffer = IMAGE_PADDING / pixelRatio;\n }\n\n const glyphOffset = alongLine ?\n [positionedGlyph.x + halfAdvance, positionedGlyph.y] :\n [0, 0];\n\n let builtInOffset = alongLine ?\n [0, 0] :\n [positionedGlyph.x + halfAdvance + textOffset[0], positionedGlyph.y + textOffset[1] - lineOffset];\n\n let verticalizedLabelOffset = [0, 0];\n if (rotateVerticalGlyph) {\n // Vertical POI labels that are rotated 90deg CW and whose glyphs must preserve upright orientation\n // need to be rotated 90deg CCW. After a quad is rotated, it is translated to the original built-in offset.\n verticalizedLabelOffset = builtInOffset;\n builtInOffset = [0, 0];\n }\n\n const x1 = (positionedGlyph.metrics.left - rectBuffer) * positionedGlyph.scale - halfAdvance + builtInOffset[0];\n const y1 = (-positionedGlyph.metrics.top - rectBuffer) * positionedGlyph.scale + builtInOffset[1];\n const x2 = x1 + textureRect.w * positionedGlyph.scale / pixelRatio;\n const y2 = y1 + textureRect.h * positionedGlyph.scale / pixelRatio;\n\n const tl = new Point(x1, y1);\n const tr = new Point(x2, y1);\n const bl = new Point(x1, y2);\n const br = new Point(x2, y2);\n\n if (rotateVerticalGlyph) {\n // Vertical-supporting glyphs are laid out in 24x24 point boxes (1 square em)\n // In horizontal orientation, the y values for glyphs are below the midline\n // and we use a \"yOffset\" of -17 to pull them up to the middle.\n // By rotating counter-clockwise around the point at the center of the left\n // edge of a 24x24 layout box centered below the midline, we align the center\n // of the glyphs with the horizontal midline, so the yOffset is no longer\n // necessary, but we also pull the glyph to the left along the x axis.\n // The y coordinate includes baseline yOffset, thus needs to be accounted\n // for when glyph is rotated and translated.\n const center = new Point(-halfAdvance, halfAdvance - SHAPING_DEFAULT_OFFSET);\n const verticalRotation = -Math.PI / 2;\n\n // xHalfWidthOffsetCorrection is a difference between full-width and half-width\n // advance, should be 0 for full-width glyphs and will pull up half-width glyphs.\n const xHalfWidthOffsetCorrection = ONE_EM / 2 - halfAdvance;\n const yImageOffsetCorrection = positionedGlyph.imageName ? xHalfWidthOffsetCorrection : 0.0;\n const halfWidthOffsetCorrection = new Point(5 - SHAPING_DEFAULT_OFFSET - xHalfWidthOffsetCorrection, -yImageOffsetCorrection);\n const verticalOffsetCorrection = new Point(...verticalizedLabelOffset);\n tl._rotateAround(verticalRotation, center)._add(halfWidthOffsetCorrection)._add(verticalOffsetCorrection);\n tr._rotateAround(verticalRotation, center)._add(halfWidthOffsetCorrection)._add(verticalOffsetCorrection);\n bl._rotateAround(verticalRotation, center)._add(halfWidthOffsetCorrection)._add(verticalOffsetCorrection);\n br._rotateAround(verticalRotation, center)._add(halfWidthOffsetCorrection)._add(verticalOffsetCorrection);\n }\n\n if (textRotate) {\n const sin = Math.sin(textRotate),\n cos = Math.cos(textRotate),\n matrix = [cos, -sin, sin, cos];\n\n tl._matMult(matrix);\n tr._matMult(matrix);\n bl._matMult(matrix);\n br._matMult(matrix);\n }\n\n const pixelOffsetTL = new Point(0, 0);\n const pixelOffsetBR = new Point(0, 0);\n const minFontScaleX = 0;\n const minFontScaleY = 0;\n quads.push({tl, tr, bl, br, tex: textureRect, writingMode: shaping.writingMode, glyphOffset, sectionIndex: positionedGlyph.sectionIndex, isSDF, pixelOffsetTL, pixelOffsetBR, minFontScaleX, minFontScaleY});\n }\n }\n\n return quads;\n}\n","// @flow\n\nimport type {CollisionBoxArray} from '../data/array_types';\nimport Point from '@mapbox/point-geometry';\nimport type Anchor from './anchor';\n\n/**\n * A CollisionFeature represents the area of the tile covered by a single label.\n * It is used with CollisionIndex to check if the label overlaps with any\n * previous labels. A CollisionFeature is mostly just a set of CollisionBox\n * objects.\n *\n * @private\n */\nclass CollisionFeature {\n boxStartIndex: number;\n boxEndIndex: number;\n circleDiameter: ?number;\n\n /**\n * Create a CollisionFeature, adding its collision box data to the given collisionBoxArray in the process.\n * For line aligned labels a collision circle diameter is computed instead.\n *\n * @param anchor The point along the line around which the label is anchored.\n * @param shaped The text or icon shaping results.\n * @param boxScale A magic number used to convert from glyph metrics units to geometry units.\n * @param padding The amount of padding to add around the label edges.\n * @param alignLine Whether the label is aligned with the line or the viewport.\n * @private\n */\n constructor(collisionBoxArray: CollisionBoxArray,\n anchor: Anchor,\n featureIndex: number,\n sourceLayerIndex: number,\n bucketIndex: number,\n shaped: Object,\n boxScale: number,\n padding: number,\n alignLine: boolean,\n rotate: number) {\n\n this.boxStartIndex = collisionBoxArray.length;\n\n if (alignLine) {\n // Compute height of the shape in glyph metrics and apply collision padding.\n // Note that the pixel based 'text-padding' is applied at runtime\n let top = shaped.top;\n let bottom = shaped.bottom;\n const collisionPadding = shaped.collisionPadding;\n\n if (collisionPadding) {\n top -= collisionPadding[1];\n bottom += collisionPadding[3];\n }\n\n let height = bottom - top;\n\n if (height > 0) {\n // set minimum box height to avoid very many small labels\n height = Math.max(10, height);\n this.circleDiameter = height;\n }\n } else {\n let y1 = shaped.top * boxScale - padding;\n let y2 = shaped.bottom * boxScale + padding;\n let x1 = shaped.left * boxScale - padding;\n let x2 = shaped.right * boxScale + padding;\n\n const collisionPadding = shaped.collisionPadding;\n if (collisionPadding) {\n x1 -= collisionPadding[0] * boxScale;\n y1 -= collisionPadding[1] * boxScale;\n x2 += collisionPadding[2] * boxScale;\n y2 += collisionPadding[3] * boxScale;\n }\n\n if (rotate) {\n // Account for *-rotate in point collision boxes\n // See https://github.com/mapbox/mapbox-gl-js/issues/6075\n // Doesn't account for icon-text-fit\n\n const tl = new Point(x1, y1);\n const tr = new Point(x2, y1);\n const bl = new Point(x1, y2);\n const br = new Point(x2, y2);\n\n const rotateRadians = rotate * Math.PI / 180;\n\n tl._rotate(rotateRadians);\n tr._rotate(rotateRadians);\n bl._rotate(rotateRadians);\n br._rotate(rotateRadians);\n\n // Collision features require an \"on-axis\" geometry,\n // so take the envelope of the rotated geometry\n // (may be quite large for wide labels rotated 45 degrees)\n x1 = Math.min(tl.x, tr.x, bl.x, br.x);\n x2 = Math.max(tl.x, tr.x, bl.x, br.x);\n y1 = Math.min(tl.y, tr.y, bl.y, br.y);\n y2 = Math.max(tl.y, tr.y, bl.y, br.y);\n }\n collisionBoxArray.emplaceBack(anchor.x, anchor.y, x1, y1, x2, y2, featureIndex, sourceLayerIndex, bucketIndex);\n }\n\n this.boxEndIndex = collisionBoxArray.length;\n }\n}\n\nexport default CollisionFeature;\n","\nexport default class TinyQueue {\n constructor(data = [], compare = defaultCompare) {\n this.data = data;\n this.length = this.data.length;\n this.compare = compare;\n\n if (this.length > 0) {\n for (let i = (this.length >> 1) - 1; i >= 0; i--) this._down(i);\n }\n }\n\n push(item) {\n this.data.push(item);\n this.length++;\n this._up(this.length - 1);\n }\n\n pop() {\n if (this.length === 0) return undefined;\n\n const top = this.data[0];\n const bottom = this.data.pop();\n this.length--;\n\n if (this.length > 0) {\n this.data[0] = bottom;\n this._down(0);\n }\n\n return top;\n }\n\n peek() {\n return this.data[0];\n }\n\n _up(pos) {\n const {data, compare} = this;\n const item = data[pos];\n\n while (pos > 0) {\n const parent = (pos - 1) >> 1;\n const current = data[parent];\n if (compare(item, current) >= 0) break;\n data[pos] = current;\n pos = parent;\n }\n\n data[pos] = item;\n }\n\n _down(pos) {\n const {data, compare} = this;\n const halfLength = this.length >> 1;\n const item = data[pos];\n\n while (pos < halfLength) {\n let left = (pos << 1) + 1;\n let best = data[left];\n const right = left + 1;\n\n if (right < this.length && compare(data[right], best) < 0) {\n left = right;\n best = data[right];\n }\n if (compare(best, item) >= 0) break;\n\n data[pos] = best;\n pos = left;\n }\n\n data[pos] = item;\n }\n}\n\nfunction defaultCompare(a, b) {\n return a < b ? -1 : a > b ? 1 : 0;\n}\n","// @flow\n\nimport Queue from 'tinyqueue';\n\nimport Point from '@mapbox/point-geometry';\nimport {distToSegmentSquared} from './intersection_tests';\n\n/**\n * Finds an approximation of a polygon's Pole Of Inaccessibiliy https://en.wikipedia.org/wiki/Pole_of_inaccessibility\n * This is a copy of http://github.com/mapbox/polylabel adapted to use Points\n *\n * @param polygonRings first item in array is the outer ring followed optionally by the list of holes, should be an element of the result of util/classify_rings\n * @param precision Specified in input coordinate units. If 0 returns after first run, if > 0 repeatedly narrows the search space until the radius of the area searched for the best pole is less than precision\n * @param debug Print some statistics to the console during execution\n * @returns Pole of Inaccessibiliy.\n * @private\n */\nexport default function (polygonRings: Array>, precision?: number = 1, debug?: boolean = false): Point {\n // find the bounding box of the outer ring\n let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\n const outerRing = polygonRings[0];\n for (let i = 0; i < outerRing.length; i++) {\n const p = outerRing[i];\n if (!i || p.x < minX) minX = p.x;\n if (!i || p.y < minY) minY = p.y;\n if (!i || p.x > maxX) maxX = p.x;\n if (!i || p.y > maxY) maxY = p.y;\n }\n\n const width = maxX - minX;\n const height = maxY - minY;\n const cellSize = Math.min(width, height);\n let h = cellSize / 2;\n\n // a priority queue of cells in order of their \"potential\" (max distance to polygon)\n const cellQueue = new Queue([], compareMax);\n\n if (cellSize === 0) return new Point(minX, minY);\n\n // cover polygon with initial cells\n for (let x = minX; x < maxX; x += cellSize) {\n for (let y = minY; y < maxY; y += cellSize) {\n cellQueue.push(new Cell(x + h, y + h, h, polygonRings));\n }\n }\n\n // take centroid as the first best guess\n let bestCell = getCentroidCell(polygonRings);\n let numProbes = cellQueue.length;\n\n while (cellQueue.length) {\n // pick the most promising cell from the queue\n const cell = cellQueue.pop();\n\n // update the best cell if we found a better one\n if (cell.d > bestCell.d || !bestCell.d) {\n bestCell = cell;\n if (debug) console.log('found best %d after %d probes', Math.round(1e4 * cell.d) / 1e4, numProbes);\n }\n\n // do not drill down further if there's no chance of a better solution\n if (cell.max - bestCell.d <= precision) continue;\n\n // split the cell into four cells\n h = cell.h / 2;\n cellQueue.push(new Cell(cell.p.x - h, cell.p.y - h, h, polygonRings));\n cellQueue.push(new Cell(cell.p.x + h, cell.p.y - h, h, polygonRings));\n cellQueue.push(new Cell(cell.p.x - h, cell.p.y + h, h, polygonRings));\n cellQueue.push(new Cell(cell.p.x + h, cell.p.y + h, h, polygonRings));\n numProbes += 4;\n }\n\n if (debug) {\n console.log(`num probes: ${numProbes}`);\n console.log(`best distance: ${bestCell.d}`);\n }\n\n return bestCell.p;\n}\n\nfunction compareMax(a, b) {\n return b.max - a.max;\n}\n\nfunction Cell(x, y, h, polygon) {\n this.p = new Point(x, y);\n this.h = h; // half the cell size\n this.d = pointToPolygonDist(this.p, polygon); // distance from cell center to polygon\n this.max = this.d + this.h * Math.SQRT2; // max distance to polygon within a cell\n}\n\n// signed distance from point to polygon outline (negative if point is outside)\nfunction pointToPolygonDist(p, polygon) {\n let inside = false;\n let minDistSq = Infinity;\n\n for (let k = 0; k < polygon.length; k++) {\n const ring = polygon[k];\n\n for (let i = 0, len = ring.length, j = len - 1; i < len; j = i++) {\n const a = ring[i];\n const b = ring[j];\n\n if ((a.y > p.y !== b.y > p.y) &&\n (p.x < (b.x - a.x) * (p.y - a.y) / (b.y - a.y) + a.x)) inside = !inside;\n\n minDistSq = Math.min(minDistSq, distToSegmentSquared(p, a, b));\n }\n }\n\n return (inside ? 1 : -1) * Math.sqrt(minDistSq);\n}\n\n// get polygon centroid\nfunction getCentroidCell(polygon) {\n let area = 0;\n let x = 0;\n let y = 0;\n const points = polygon[0];\n for (let i = 0, len = points.length, j = len - 1; i < len; j = i++) {\n const a = points[i];\n const b = points[j];\n const f = a.x * b.y - b.x * a.y;\n x += (a.x + b.x) * f;\n y += (a.y + b.y) * f;\n area += f * 3;\n }\n return new Cell(x / area, y / area, 0, polygon);\n}\n","// @flow\n\nimport Anchor from './anchor';\n\nimport {getAnchors, getCenterAnchor} from './get_anchors';\nimport clipLine from './clip_line';\nimport {shapeText, shapeIcon, WritingMode, fitIconToText} from './shaping';\nimport {getGlyphQuads, getIconQuads} from './quads';\nimport CollisionFeature from './collision_feature';\nimport {warnOnce} from '../util/util';\nimport {\n allowsVerticalWritingMode,\n allowsLetterSpacing\n} from '../util/script_detection';\nimport findPoleOfInaccessibility from '../util/find_pole_of_inaccessibility';\nimport classifyRings from '../util/classify_rings';\nimport EXTENT from '../data/extent';\nimport SymbolBucket from '../data/bucket/symbol_bucket';\nimport EvaluationParameters from '../style/evaluation_parameters';\nimport {SIZE_PACK_FACTOR} from './symbol_size';\nimport ONE_EM from './one_em';\nimport type {CanonicalTileID} from '../source/tile_id';\nimport type {Shaping, PositionedIcon, TextJustify} from './shaping';\nimport type {CollisionBoxArray} from '../data/array_types';\nimport type {SymbolFeature} from '../data/bucket/symbol_bucket';\nimport type {StyleImage} from '../style/style_image';\nimport type {StyleGlyph} from '../style/style_glyph';\nimport type SymbolStyleLayer from '../style/style_layer/symbol_style_layer';\nimport type {ImagePosition} from '../render/image_atlas';\nimport type {GlyphPosition} from '../render/glyph_atlas';\nimport type {PossiblyEvaluatedPropertyValue} from '../style/properties';\n\nimport Point from '@mapbox/point-geometry';\nimport murmur3 from 'murmurhash-js';\n\n// The symbol layout process needs `text-size` evaluated at up to five different zoom levels, and\n// `icon-size` at up to three:\n//\n// 1. `text-size` at the zoom level of the bucket. Used to calculate a per-feature size for source `text-size`\n// expressions, and to calculate the box dimensions for icon-text-fit.\n// 2. `icon-size` at the zoom level of the bucket. Used to calculate a per-feature size for source `icon-size`\n// expressions.\n// 3. `text-size` and `icon-size` at the zoom level of the bucket, plus one. Used to calculate collision boxes.\n// 4. `text-size` at zoom level 18. Used for something line-symbol-placement-related.\n// 5. For composite `*-size` expressions: two zoom levels of curve stops that \"cover\" the zoom level of the\n// bucket. These go into a vertex buffer and are used by the shader to interpolate the size at render time.\n//\n// (1) and (2) are stored in `bucket.layers[0].layout`. The remainder are below.\n//\ntype Sizes = {\n layoutTextSize: PossiblyEvaluatedPropertyValue, // (3)\n layoutIconSize: PossiblyEvaluatedPropertyValue, // (3)\n textMaxSize: PossiblyEvaluatedPropertyValue, // (4)\n compositeTextSizes: [PossiblyEvaluatedPropertyValue, PossiblyEvaluatedPropertyValue], // (5)\n compositeIconSizes: [PossiblyEvaluatedPropertyValue, PossiblyEvaluatedPropertyValue], // (5)\n};\n\nexport type TextAnchor = 'center' | 'left' | 'right' | 'top' | 'bottom' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';\n\n// The radial offset is to the edge of the text box\n// In the horizontal direction, the edge of the text box is where glyphs start\n// But in the vertical direction, the glyphs appear to \"start\" at the baseline\n// We don't actually load baseline data, but we assume an offset of ONE_EM - 17\n// (see \"yOffset\" in shaping.js)\nconst baselineOffset = 7;\nconst INVALID_TEXT_OFFSET = Number.POSITIVE_INFINITY;\n\nexport function evaluateVariableOffset(anchor: TextAnchor, offset: [number, number]) {\n\n function fromRadialOffset(anchor: TextAnchor, radialOffset: number) {\n let x = 0, y = 0;\n if (radialOffset < 0) radialOffset = 0; // Ignore negative offset.\n // solve for r where r^2 + r^2 = radialOffset^2\n const hypotenuse = radialOffset / Math.sqrt(2);\n switch (anchor) {\n case 'top-right':\n case 'top-left':\n y = hypotenuse - baselineOffset;\n break;\n case 'bottom-right':\n case 'bottom-left':\n y = -hypotenuse + baselineOffset;\n break;\n case 'bottom':\n y = -radialOffset + baselineOffset;\n break;\n case 'top':\n y = radialOffset - baselineOffset;\n break;\n }\n\n switch (anchor) {\n case 'top-right':\n case 'bottom-right':\n x = -hypotenuse;\n break;\n case 'top-left':\n case 'bottom-left':\n x = hypotenuse;\n break;\n case 'left':\n x = radialOffset;\n break;\n case 'right':\n x = -radialOffset;\n break;\n }\n\n return [x, y];\n }\n\n function fromTextOffset(anchor: TextAnchor, offsetX: number, offsetY: number) {\n let x = 0, y = 0;\n // Use absolute offset values.\n offsetX = Math.abs(offsetX);\n offsetY = Math.abs(offsetY);\n\n switch (anchor) {\n case 'top-right':\n case 'top-left':\n case 'top':\n y = offsetY - baselineOffset;\n break;\n case 'bottom-right':\n case 'bottom-left':\n case 'bottom':\n y = -offsetY + baselineOffset;\n break;\n }\n\n switch (anchor) {\n case 'top-right':\n case 'bottom-right':\n case 'right':\n x = -offsetX;\n break;\n case 'top-left':\n case 'bottom-left':\n case 'left':\n x = offsetX;\n break;\n }\n\n return [x, y];\n }\n\n return (offset[1] !== INVALID_TEXT_OFFSET) ? fromTextOffset(anchor, offset[0], offset[1]) : fromRadialOffset(anchor, offset[0]);\n}\n\nexport function performSymbolLayout(bucket: SymbolBucket,\n glyphMap: {[_: string]: {[number]: ?StyleGlyph}},\n glyphPositions: {[_: string]: {[number]: GlyphPosition}},\n imageMap: {[_: string]: StyleImage},\n imagePositions: {[_: string]: ImagePosition},\n showCollisionBoxes: boolean,\n canonical: CanonicalTileID) {\n bucket.createArrays();\n\n const tileSize = 512 * bucket.overscaling;\n bucket.tilePixelRatio = EXTENT / tileSize;\n bucket.compareText = {};\n bucket.iconsNeedLinear = false;\n\n const layout = bucket.layers[0].layout;\n const unevaluatedLayoutValues = bucket.layers[0]._unevaluatedLayout._values;\n\n const sizes = {};\n\n if (bucket.textSizeData.kind === 'composite') {\n const {minZoom, maxZoom} = bucket.textSizeData;\n sizes.compositeTextSizes = [\n unevaluatedLayoutValues['text-size'].possiblyEvaluate(new EvaluationParameters(minZoom), canonical),\n unevaluatedLayoutValues['text-size'].possiblyEvaluate(new EvaluationParameters(maxZoom), canonical)\n ];\n }\n\n if (bucket.iconSizeData.kind === 'composite') {\n const {minZoom, maxZoom} = bucket.iconSizeData;\n sizes.compositeIconSizes = [\n unevaluatedLayoutValues['icon-size'].possiblyEvaluate(new EvaluationParameters(minZoom), canonical),\n unevaluatedLayoutValues['icon-size'].possiblyEvaluate(new EvaluationParameters(maxZoom), canonical)\n ];\n }\n\n sizes.layoutTextSize = unevaluatedLayoutValues['text-size'].possiblyEvaluate(new EvaluationParameters(bucket.zoom + 1), canonical);\n sizes.layoutIconSize = unevaluatedLayoutValues['icon-size'].possiblyEvaluate(new EvaluationParameters(bucket.zoom + 1), canonical);\n sizes.textMaxSize = unevaluatedLayoutValues['text-size'].possiblyEvaluate(new EvaluationParameters(18));\n\n const lineHeight = layout.get('text-line-height') * ONE_EM;\n const textAlongLine = layout.get('text-rotation-alignment') === 'map' && layout.get('symbol-placement') !== 'point';\n const keepUpright = layout.get('text-keep-upright');\n const textSize = layout.get('text-size');\n\n for (const feature of bucket.features) {\n const fontstack = layout.get('text-font').evaluate(feature, {}, canonical).join(',');\n const layoutTextSizeThisZoom = textSize.evaluate(feature, {}, canonical);\n const layoutTextSize = sizes.layoutTextSize.evaluate(feature, {}, canonical);\n const layoutIconSize = sizes.layoutIconSize.evaluate(feature, {}, canonical);\n\n const shapedTextOrientations = {\n horizontal: {},\n vertical: undefined\n };\n const text = feature.text;\n let textOffset: [number, number] = [0, 0];\n if (text) {\n const unformattedText = text.toString();\n const spacing = layout.get('text-letter-spacing').evaluate(feature, {}, canonical) * ONE_EM;\n const spacingIfAllowed = allowsLetterSpacing(unformattedText) ? spacing : 0;\n\n const textAnchor = layout.get('text-anchor').evaluate(feature, {}, canonical);\n const variableTextAnchor = layout.get('text-variable-anchor');\n\n if (!variableTextAnchor) {\n const radialOffset = layout.get('text-radial-offset').evaluate(feature, {}, canonical);\n // Layers with variable anchors use the `text-radial-offset` property and the [x, y] offset vector\n // is calculated at placement time instead of layout time\n if (radialOffset) {\n // The style spec says don't use `text-offset` and `text-radial-offset` together\n // but doesn't actually specify what happens if you use both. We go with the radial offset.\n textOffset = evaluateVariableOffset(textAnchor, [radialOffset * ONE_EM, INVALID_TEXT_OFFSET]);\n } else {\n textOffset = (layout.get('text-offset').evaluate(feature, {}, canonical).map(t => t * ONE_EM): any);\n }\n }\n\n let textJustify = textAlongLine ?\n \"center\" :\n layout.get('text-justify').evaluate(feature, {}, canonical);\n\n const symbolPlacement = layout.get('symbol-placement');\n const maxWidth = symbolPlacement === 'point' ?\n layout.get('text-max-width').evaluate(feature, {}, canonical) * ONE_EM :\n 0;\n\n const addVerticalShapingForPointLabelIfNeeded = () => {\n if (bucket.allowVerticalPlacement && allowsVerticalWritingMode(unformattedText)) {\n // Vertical POI label placement is meant to be used for scripts that support vertical\n // writing mode, thus, default left justification is used. If Latin\n // scripts would need to be supported, this should take into account other justifications.\n shapedTextOrientations.vertical = shapeText(text, glyphMap, glyphPositions, imagePositions, fontstack, maxWidth, lineHeight, textAnchor,\n 'left', spacingIfAllowed, textOffset, WritingMode.vertical, true, symbolPlacement, layoutTextSize, layoutTextSizeThisZoom);\n }\n };\n\n // If this layer uses text-variable-anchor, generate shapings for all justification possibilities.\n if (!textAlongLine && variableTextAnchor) {\n const justifications = textJustify === \"auto\" ?\n variableTextAnchor.map(a => getAnchorJustification(a)) :\n [textJustify];\n\n let singleLine = false;\n for (let i = 0; i < justifications.length; i++) {\n const justification: TextJustify = justifications[i];\n if (shapedTextOrientations.horizontal[justification]) continue;\n if (singleLine) {\n // If the shaping for the first justification was only a single line, we\n // can re-use it for the other justifications\n shapedTextOrientations.horizontal[justification] = shapedTextOrientations.horizontal[0];\n } else {\n // If using text-variable-anchor for the layer, we use a center anchor for all shapings and apply\n // the offsets for the anchor in the placement step.\n const shaping = shapeText(text, glyphMap, glyphPositions, imagePositions, fontstack, maxWidth, lineHeight, 'center',\n justification, spacingIfAllowed, textOffset, WritingMode.horizontal, false, symbolPlacement, layoutTextSize, layoutTextSizeThisZoom);\n if (shaping) {\n shapedTextOrientations.horizontal[justification] = shaping;\n singleLine = shaping.positionedLines.length === 1;\n }\n }\n }\n\n addVerticalShapingForPointLabelIfNeeded();\n } else {\n if (textJustify === \"auto\") {\n textJustify = getAnchorJustification(textAnchor);\n }\n\n // Horizontal point or line label.\n const shaping = shapeText(text, glyphMap, glyphPositions, imagePositions, fontstack, maxWidth, lineHeight, textAnchor, textJustify, spacingIfAllowed,\n textOffset, WritingMode.horizontal, false, symbolPlacement, layoutTextSize, layoutTextSizeThisZoom);\n if (shaping) shapedTextOrientations.horizontal[textJustify] = shaping;\n\n // Vertical point label (if allowVerticalPlacement is enabled).\n addVerticalShapingForPointLabelIfNeeded();\n\n // Verticalized line label.\n if (allowsVerticalWritingMode(unformattedText) && textAlongLine && keepUpright) {\n shapedTextOrientations.vertical = shapeText(text, glyphMap, glyphPositions, imagePositions, fontstack, maxWidth, lineHeight, textAnchor, textJustify,\n spacingIfAllowed, textOffset, WritingMode.vertical, false, symbolPlacement, layoutTextSize, layoutTextSizeThisZoom);\n }\n }\n }\n\n let shapedIcon;\n let isSDFIcon = false;\n if (feature.icon && feature.icon.name) {\n const image = imageMap[feature.icon.name];\n if (image) {\n shapedIcon = shapeIcon(\n imagePositions[feature.icon.name],\n layout.get('icon-offset').evaluate(feature, {}, canonical),\n layout.get('icon-anchor').evaluate(feature, {}, canonical));\n isSDFIcon = image.sdf;\n if (bucket.sdfIcons === undefined) {\n bucket.sdfIcons = image.sdf;\n } else if (bucket.sdfIcons !== image.sdf) {\n warnOnce('Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer');\n }\n if (image.pixelRatio !== bucket.pixelRatio) {\n bucket.iconsNeedLinear = true;\n } else if (layout.get('icon-rotate').constantOr(1) !== 0) {\n bucket.iconsNeedLinear = true;\n }\n }\n }\n\n const shapedText = getDefaultHorizontalShaping(shapedTextOrientations.horizontal) || shapedTextOrientations.vertical;\n bucket.iconsInText = shapedText ? shapedText.iconsInText : false;\n if (shapedText || shapedIcon) {\n addFeature(bucket, feature, shapedTextOrientations, shapedIcon, imageMap, sizes, layoutTextSize, layoutIconSize, textOffset, isSDFIcon, canonical);\n }\n }\n\n if (showCollisionBoxes) {\n bucket.generateCollisionDebugBuffers();\n }\n}\n\n// Choose the justification that matches the direction of the TextAnchor\nexport function getAnchorJustification(anchor: TextAnchor): TextJustify {\n switch (anchor) {\n case 'right':\n case 'top-right':\n case 'bottom-right':\n return 'right';\n case 'left':\n case 'top-left':\n case 'bottom-left':\n return 'left';\n }\n return 'center';\n}\n\n/**\n * Given a feature and its shaped text and icon data, add a 'symbol\n * instance' for each _possible_ placement of the symbol feature.\n * (At render timePlaceSymbols#place() selects which of these instances to\n * show or hide based on collisions with symbols in other layers.)\n * @private\n */\nfunction addFeature(bucket: SymbolBucket,\n feature: SymbolFeature,\n shapedTextOrientations: any,\n shapedIcon: PositionedIcon | void,\n imageMap: {[_: string]: StyleImage},\n sizes: Sizes,\n layoutTextSize: number,\n layoutIconSize: number,\n textOffset: [number, number],\n isSDFIcon: boolean, canonical: CanonicalTileID) {\n // To reduce the number of labels that jump around when zooming we need\n // to use a text-size value that is the same for all zoom levels.\n // bucket calculates text-size at a high zoom level so that all tiles can\n // use the same value when calculating anchor positions.\n let textMaxSize = sizes.textMaxSize.evaluate(feature, {});\n if (textMaxSize === undefined) {\n textMaxSize = layoutTextSize;\n }\n const layout = bucket.layers[0].layout;\n const iconOffset = layout.get('icon-offset').evaluate(feature, {}, canonical);\n const defaultHorizontalShaping = getDefaultHorizontalShaping(shapedTextOrientations.horizontal);\n const glyphSize = 24,\n fontScale = layoutTextSize / glyphSize,\n textBoxScale = bucket.tilePixelRatio * fontScale,\n textMaxBoxScale = bucket.tilePixelRatio * textMaxSize / glyphSize,\n iconBoxScale = bucket.tilePixelRatio * layoutIconSize,\n symbolMinDistance = bucket.tilePixelRatio * layout.get('symbol-spacing'),\n textPadding = layout.get('text-padding') * bucket.tilePixelRatio,\n iconPadding = layout.get('icon-padding') * bucket.tilePixelRatio,\n textMaxAngle = layout.get('text-max-angle') / 180 * Math.PI,\n textAlongLine = layout.get('text-rotation-alignment') === 'map' && layout.get('symbol-placement') !== 'point',\n iconAlongLine = layout.get('icon-rotation-alignment') === 'map' && layout.get('symbol-placement') !== 'point',\n symbolPlacement = layout.get('symbol-placement'),\n textRepeatDistance = symbolMinDistance / 2;\n\n const iconTextFit = layout.get('icon-text-fit');\n let verticallyShapedIcon;\n // Adjust shaped icon size when icon-text-fit is used.\n if (shapedIcon && iconTextFit !== 'none') {\n if (bucket.allowVerticalPlacement && shapedTextOrientations.vertical) {\n verticallyShapedIcon = fitIconToText(shapedIcon, shapedTextOrientations.vertical, iconTextFit,\n layout.get('icon-text-fit-padding'), iconOffset, fontScale);\n }\n if (defaultHorizontalShaping) {\n shapedIcon = fitIconToText(shapedIcon, defaultHorizontalShaping, iconTextFit,\n layout.get('icon-text-fit-padding'), iconOffset, fontScale);\n }\n }\n\n const addSymbolAtAnchor = (line, anchor) => {\n if (anchor.x < 0 || anchor.x >= EXTENT || anchor.y < 0 || anchor.y >= EXTENT) {\n // Symbol layers are drawn across tile boundaries, We filter out symbols\n // outside our tile boundaries (which may be included in vector tile buffers)\n // to prevent double-drawing symbols.\n return;\n }\n\n addSymbol(bucket, anchor, line, shapedTextOrientations, shapedIcon, imageMap, verticallyShapedIcon, bucket.layers[0],\n bucket.collisionBoxArray, feature.index, feature.sourceLayerIndex, bucket.index,\n textBoxScale, textPadding, textAlongLine, textOffset,\n iconBoxScale, iconPadding, iconAlongLine, iconOffset,\n feature, sizes, isSDFIcon, canonical, layoutTextSize);\n };\n\n if (symbolPlacement === 'line') {\n for (const line of clipLine(feature.geometry, 0, 0, EXTENT, EXTENT)) {\n const anchors = getAnchors(\n line,\n symbolMinDistance,\n textMaxAngle,\n shapedTextOrientations.vertical || defaultHorizontalShaping,\n shapedIcon,\n glyphSize,\n textMaxBoxScale,\n bucket.overscaling,\n EXTENT\n );\n for (const anchor of anchors) {\n const shapedText = defaultHorizontalShaping;\n if (!shapedText || !anchorIsTooClose(bucket, shapedText.text, textRepeatDistance, anchor)) {\n addSymbolAtAnchor(line, anchor);\n }\n }\n }\n } else if (symbolPlacement === 'line-center') {\n // No clipping, multiple lines per feature are allowed\n // \"lines\" with only one point are ignored as in clipLines\n for (const line of feature.geometry) {\n if (line.length > 1) {\n const anchor = getCenterAnchor(\n line,\n textMaxAngle,\n shapedTextOrientations.vertical || defaultHorizontalShaping,\n shapedIcon,\n glyphSize,\n textMaxBoxScale);\n if (anchor) {\n addSymbolAtAnchor(line, anchor);\n }\n }\n }\n } else if (feature.type === 'Polygon') {\n for (const polygon of classifyRings(feature.geometry, 0)) {\n // 16 here represents 2 pixels\n const poi = findPoleOfInaccessibility(polygon, 16);\n addSymbolAtAnchor(polygon[0], new Anchor(poi.x, poi.y, 0));\n }\n } else if (feature.type === 'LineString') {\n // https://github.com/mapbox/mapbox-gl-js/issues/3808\n for (const line of feature.geometry) {\n addSymbolAtAnchor(line, new Anchor(line[0].x, line[0].y, 0));\n }\n } else if (feature.type === 'Point') {\n for (const points of feature.geometry) {\n for (const point of points) {\n addSymbolAtAnchor([point], new Anchor(point.x, point.y, 0));\n }\n }\n }\n}\n\nconst MAX_GLYPH_ICON_SIZE = 255;\nconst MAX_PACKED_SIZE = MAX_GLYPH_ICON_SIZE * SIZE_PACK_FACTOR;\nexport {MAX_PACKED_SIZE};\n\nfunction addTextVertices(bucket: SymbolBucket,\n anchor: Point,\n shapedText: Shaping,\n imageMap: {[_: string]: StyleImage},\n layer: SymbolStyleLayer,\n textAlongLine: boolean,\n feature: SymbolFeature,\n textOffset: [number, number],\n lineArray: {lineStartIndex: number, lineLength: number},\n writingMode: number,\n placementTypes: Array<'vertical' | 'center' | 'left' | 'right'>,\n placedTextSymbolIndices: {[_: string]: number},\n placedIconIndex: number,\n sizes: Sizes,\n canonical: CanonicalTileID) {\n const glyphQuads = getGlyphQuads(anchor, shapedText, textOffset,\n layer, textAlongLine, feature, imageMap, bucket.allowVerticalPlacement);\n\n const sizeData = bucket.textSizeData;\n let textSizeData = null;\n\n if (sizeData.kind === 'source') {\n textSizeData = [\n SIZE_PACK_FACTOR * layer.layout.get('text-size').evaluate(feature, {})\n ];\n if (textSizeData[0] > MAX_PACKED_SIZE) {\n warnOnce(`${bucket.layerIds[0]}: Value for \"text-size\" is >= ${MAX_GLYPH_ICON_SIZE}. Reduce your \"text-size\".`);\n }\n } else if (sizeData.kind === 'composite') {\n textSizeData = [\n SIZE_PACK_FACTOR * sizes.compositeTextSizes[0].evaluate(feature, {}, canonical),\n SIZE_PACK_FACTOR * sizes.compositeTextSizes[1].evaluate(feature, {}, canonical)\n ];\n if (textSizeData[0] > MAX_PACKED_SIZE || textSizeData[1] > MAX_PACKED_SIZE) {\n warnOnce(`${bucket.layerIds[0]}: Value for \"text-size\" is >= ${MAX_GLYPH_ICON_SIZE}. Reduce your \"text-size\".`);\n }\n }\n\n bucket.addSymbols(\n bucket.text,\n glyphQuads,\n textSizeData,\n textOffset,\n textAlongLine,\n feature,\n writingMode,\n anchor,\n lineArray.lineStartIndex,\n lineArray.lineLength,\n placedIconIndex,\n canonical);\n\n // The placedSymbolArray is used at render time in drawTileSymbols\n // These indices allow access to the array at collision detection time\n for (const placementType of placementTypes) {\n placedTextSymbolIndices[placementType] = bucket.text.placedSymbolArray.length - 1;\n }\n\n return glyphQuads.length * 4;\n}\n\nfunction getDefaultHorizontalShaping(horizontalShaping: {[_: TextJustify]: Shaping}): Shaping | null {\n // We don't care which shaping we get because this is used for collision purposes\n // and all the justifications have the same collision box\n for (const justification: any in horizontalShaping) {\n return horizontalShaping[justification];\n }\n return null;\n}\n\n/**\n * Add a single label & icon placement.\n *\n * @private\n */\nfunction addSymbol(bucket: SymbolBucket,\n anchor: Anchor,\n line: Array,\n shapedTextOrientations: any,\n shapedIcon: PositionedIcon | void,\n imageMap: {[_: string]: StyleImage},\n verticallyShapedIcon: PositionedIcon | void,\n layer: SymbolStyleLayer,\n collisionBoxArray: CollisionBoxArray,\n featureIndex: number,\n sourceLayerIndex: number,\n bucketIndex: number,\n textBoxScale: number,\n textPadding: number,\n textAlongLine: boolean,\n textOffset: [number, number],\n iconBoxScale: number,\n iconPadding: number,\n iconAlongLine: boolean,\n iconOffset: [number, number],\n feature: SymbolFeature,\n sizes: Sizes,\n isSDFIcon: boolean,\n canonical: CanonicalTileID,\n layoutTextSize: number) {\n const lineArray = bucket.addToLineVertexArray(anchor, line);\n\n let textCollisionFeature, iconCollisionFeature, verticalTextCollisionFeature, verticalIconCollisionFeature;\n\n let numIconVertices = 0;\n let numVerticalIconVertices = 0;\n let numHorizontalGlyphVertices = 0;\n let numVerticalGlyphVertices = 0;\n let placedIconSymbolIndex = -1;\n let verticalPlacedIconSymbolIndex = -1;\n const placedTextSymbolIndices = {};\n let key = murmur3('');\n\n let textOffset0 = 0;\n let textOffset1 = 0;\n if (layer._unevaluatedLayout.getValue('text-radial-offset') === undefined) {\n [textOffset0, textOffset1] = (layer.layout.get('text-offset').evaluate(feature, {}, canonical).map(t => t * ONE_EM): any);\n } else {\n textOffset0 = layer.layout.get('text-radial-offset').evaluate(feature, {}, canonical) * ONE_EM;\n textOffset1 = INVALID_TEXT_OFFSET;\n }\n\n if (bucket.allowVerticalPlacement && shapedTextOrientations.vertical) {\n const textRotation = layer.layout.get('text-rotate').evaluate(feature, {}, canonical);\n const verticalTextRotation = textRotation + 90.0;\n const verticalShaping = shapedTextOrientations.vertical;\n verticalTextCollisionFeature = new CollisionFeature(collisionBoxArray, anchor, featureIndex, sourceLayerIndex, bucketIndex, verticalShaping, textBoxScale, textPadding, textAlongLine, verticalTextRotation);\n\n if (verticallyShapedIcon) {\n verticalIconCollisionFeature = new CollisionFeature(collisionBoxArray, anchor, featureIndex, sourceLayerIndex, bucketIndex, verticallyShapedIcon, iconBoxScale, iconPadding, textAlongLine, verticalTextRotation);\n }\n }\n\n //Place icon first, so text can have a reference to its index in the placed symbol array.\n //Text symbols can lazily shift at render-time because of variable anchor placement.\n //If the style specifies an `icon-text-fit` then the icon would have to shift along with it.\n // For more info check `updateVariableAnchors` in `draw_symbol.js` .\n if (shapedIcon) {\n const iconRotate = layer.layout.get('icon-rotate').evaluate(feature, {});\n const hasIconTextFit = layer.layout.get('icon-text-fit') !== 'none';\n const iconQuads = getIconQuads(shapedIcon, iconRotate, isSDFIcon, hasIconTextFit);\n const verticalIconQuads = verticallyShapedIcon ? getIconQuads(verticallyShapedIcon, iconRotate, isSDFIcon, hasIconTextFit) : undefined;\n iconCollisionFeature = new CollisionFeature(collisionBoxArray, anchor, featureIndex, sourceLayerIndex, bucketIndex, shapedIcon, iconBoxScale, iconPadding, /*align boxes to line*/false, iconRotate);\n\n numIconVertices = iconQuads.length * 4;\n\n const sizeData = bucket.iconSizeData;\n let iconSizeData = null;\n\n if (sizeData.kind === 'source') {\n iconSizeData = [\n SIZE_PACK_FACTOR * layer.layout.get('icon-size').evaluate(feature, {})\n ];\n if (iconSizeData[0] > MAX_PACKED_SIZE) {\n warnOnce(`${bucket.layerIds[0]}: Value for \"icon-size\" is >= ${MAX_GLYPH_ICON_SIZE}. Reduce your \"icon-size\".`);\n }\n } else if (sizeData.kind === 'composite') {\n iconSizeData = [\n SIZE_PACK_FACTOR * sizes.compositeIconSizes[0].evaluate(feature, {}, canonical),\n SIZE_PACK_FACTOR * sizes.compositeIconSizes[1].evaluate(feature, {}, canonical)\n ];\n if (iconSizeData[0] > MAX_PACKED_SIZE || iconSizeData[1] > MAX_PACKED_SIZE) {\n warnOnce(`${bucket.layerIds[0]}: Value for \"icon-size\" is >= ${MAX_GLYPH_ICON_SIZE}. Reduce your \"icon-size\".`);\n }\n }\n\n bucket.addSymbols(\n bucket.icon,\n iconQuads,\n iconSizeData,\n iconOffset,\n iconAlongLine,\n feature,\n false,\n anchor,\n lineArray.lineStartIndex,\n lineArray.lineLength,\n // The icon itself does not have an associated symbol since the text isnt placed yet\n -1, canonical);\n\n placedIconSymbolIndex = bucket.icon.placedSymbolArray.length - 1;\n\n if (verticalIconQuads) {\n numVerticalIconVertices = verticalIconQuads.length * 4;\n\n bucket.addSymbols(\n bucket.icon,\n verticalIconQuads,\n iconSizeData,\n iconOffset,\n iconAlongLine,\n feature,\n WritingMode.vertical,\n anchor,\n lineArray.lineStartIndex,\n lineArray.lineLength,\n // The icon itself does not have an associated symbol since the text isnt placed yet\n -1, canonical);\n\n verticalPlacedIconSymbolIndex = bucket.icon.placedSymbolArray.length - 1;\n }\n }\n\n for (const justification: any in shapedTextOrientations.horizontal) {\n const shaping = shapedTextOrientations.horizontal[justification];\n\n if (!textCollisionFeature) {\n key = murmur3(shaping.text);\n const textRotate = layer.layout.get('text-rotate').evaluate(feature, {}, canonical);\n // As a collision approximation, we can use either the vertical or any of the horizontal versions of the feature\n // We're counting on all versions having similar dimensions\n textCollisionFeature = new CollisionFeature(collisionBoxArray, anchor, featureIndex, sourceLayerIndex, bucketIndex, shaping, textBoxScale, textPadding, textAlongLine, textRotate);\n }\n\n const singleLine = shaping.positionedLines.length === 1;\n numHorizontalGlyphVertices += addTextVertices(\n bucket, anchor, shaping, imageMap, layer, textAlongLine, feature, textOffset, lineArray,\n shapedTextOrientations.vertical ? WritingMode.horizontal : WritingMode.horizontalOnly,\n singleLine ? (Object.keys(shapedTextOrientations.horizontal): any) : [justification],\n placedTextSymbolIndices, placedIconSymbolIndex, sizes, canonical);\n\n if (singleLine) {\n break;\n }\n }\n\n if (shapedTextOrientations.vertical) {\n numVerticalGlyphVertices += addTextVertices(\n bucket, anchor, shapedTextOrientations.vertical, imageMap, layer, textAlongLine, feature,\n textOffset, lineArray, WritingMode.vertical, ['vertical'], placedTextSymbolIndices, verticalPlacedIconSymbolIndex, sizes, canonical);\n }\n\n const textBoxStartIndex = textCollisionFeature ? textCollisionFeature.boxStartIndex : bucket.collisionBoxArray.length;\n const textBoxEndIndex = textCollisionFeature ? textCollisionFeature.boxEndIndex : bucket.collisionBoxArray.length;\n\n const verticalTextBoxStartIndex = verticalTextCollisionFeature ? verticalTextCollisionFeature.boxStartIndex : bucket.collisionBoxArray.length;\n const verticalTextBoxEndIndex = verticalTextCollisionFeature ? verticalTextCollisionFeature.boxEndIndex : bucket.collisionBoxArray.length;\n\n const iconBoxStartIndex = iconCollisionFeature ? iconCollisionFeature.boxStartIndex : bucket.collisionBoxArray.length;\n const iconBoxEndIndex = iconCollisionFeature ? iconCollisionFeature.boxEndIndex : bucket.collisionBoxArray.length;\n\n const verticalIconBoxStartIndex = verticalIconCollisionFeature ? verticalIconCollisionFeature.boxStartIndex : bucket.collisionBoxArray.length;\n const verticalIconBoxEndIndex = verticalIconCollisionFeature ? verticalIconCollisionFeature.boxEndIndex : bucket.collisionBoxArray.length;\n\n // Check if runtime collision circles should be used for any of the collision features.\n // It is enough to choose the tallest feature shape as circles are always placed on a line.\n // All measurements are in glyph metrics and later converted into pixels using proper font size \"layoutTextSize\"\n let collisionCircleDiameter = -1;\n\n const getCollisionCircleHeight = (feature: ?CollisionFeature, prevHeight: number): number => {\n if (feature && feature.circleDiameter)\n return Math.max(feature.circleDiameter, prevHeight);\n return prevHeight;\n };\n\n collisionCircleDiameter = getCollisionCircleHeight(textCollisionFeature, collisionCircleDiameter);\n collisionCircleDiameter = getCollisionCircleHeight(verticalTextCollisionFeature, collisionCircleDiameter);\n collisionCircleDiameter = getCollisionCircleHeight(iconCollisionFeature, collisionCircleDiameter);\n collisionCircleDiameter = getCollisionCircleHeight(verticalIconCollisionFeature, collisionCircleDiameter);\n const useRuntimeCollisionCircles = (collisionCircleDiameter > -1) ? 1 : 0;\n\n // Convert circle collision height into pixels\n if (useRuntimeCollisionCircles)\n collisionCircleDiameter *= layoutTextSize / ONE_EM;\n\n if (bucket.glyphOffsetArray.length >= SymbolBucket.MAX_GLYPHS) warnOnce(\n \"Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907\"\n );\n\n if (feature.sortKey !== undefined) {\n bucket.addToSortKeyRanges(bucket.symbolInstances.length, feature.sortKey);\n }\n\n bucket.symbolInstances.emplaceBack(\n anchor.x,\n anchor.y,\n placedTextSymbolIndices.right >= 0 ? placedTextSymbolIndices.right : -1,\n placedTextSymbolIndices.center >= 0 ? placedTextSymbolIndices.center : -1,\n placedTextSymbolIndices.left >= 0 ? placedTextSymbolIndices.left : -1,\n placedTextSymbolIndices.vertical || -1,\n placedIconSymbolIndex,\n verticalPlacedIconSymbolIndex,\n key,\n textBoxStartIndex,\n textBoxEndIndex,\n verticalTextBoxStartIndex,\n verticalTextBoxEndIndex,\n iconBoxStartIndex,\n iconBoxEndIndex,\n verticalIconBoxStartIndex,\n verticalIconBoxEndIndex,\n featureIndex,\n numHorizontalGlyphVertices,\n numVerticalGlyphVertices,\n numIconVertices,\n numVerticalIconVertices,\n useRuntimeCollisionCircles,\n 0,\n textBoxScale,\n textOffset0,\n textOffset1,\n collisionCircleDiameter);\n}\n\nfunction anchorIsTooClose(bucket: any, text: string, repeatDistance: number, anchor: Point) {\n const compareText = bucket.compareText;\n if (!(text in compareText)) {\n compareText[text] = [];\n } else {\n const otherAnchors = compareText[text];\n for (let k = otherAnchors.length - 1; k >= 0; k--) {\n if (anchor.dist(otherAnchors[k]) < repeatDistance) {\n // If it's within repeatDistance of one anchor, stop looking\n return true;\n }\n }\n }\n // If anchor is not within repeatDistance of any other anchor, add to array\n compareText[text].push(anchor);\n return false;\n}\n","// @flow\n\nimport {symbolLayoutAttributes,\n collisionVertexAttributes,\n collisionBoxLayout,\n dynamicLayoutAttributes\n} from './symbol_attributes';\n\nimport {SymbolLayoutArray,\n SymbolDynamicLayoutArray,\n SymbolOpacityArray,\n CollisionBoxLayoutArray,\n CollisionVertexArray,\n PlacedSymbolArray,\n SymbolInstanceArray,\n GlyphOffsetArray,\n SymbolLineVertexArray\n} from '../array_types';\n\nimport Point from '@mapbox/point-geometry';\nimport SegmentVector from '../segment';\nimport {ProgramConfigurationSet} from '../program_configuration';\nimport {TriangleIndexArray, LineIndexArray} from '../index_array_type';\nimport transformText from '../../symbol/transform_text';\nimport mergeLines from '../../symbol/mergelines';\nimport {allowsVerticalWritingMode, stringContainsRTLText} from '../../util/script_detection';\nimport {WritingMode} from '../../symbol/shaping';\nimport loadGeometry from '../load_geometry';\nimport toEvaluationFeature from '../evaluation_feature';\nimport mvt from '@mapbox/vector-tile';\nconst vectorTileFeatureTypes = mvt.VectorTileFeature.types;\nimport {verticalizedCharacterMap} from '../../util/verticalize_punctuation';\nimport Anchor from '../../symbol/anchor';\nimport {getSizeData} from '../../symbol/symbol_size';\nimport {MAX_PACKED_SIZE} from '../../symbol/symbol_layout';\nimport {register} from '../../util/web_worker_transfer';\nimport EvaluationParameters from '../../style/evaluation_parameters';\nimport Formatted from '../../style-spec/expression/types/formatted';\nimport ResolvedImage from '../../style-spec/expression/types/resolved_image';\nimport {plugin as globalRTLTextPlugin, getRTLTextPluginStatus} from '../../source/rtl_text_plugin';\nimport {mat4} from 'gl-matrix';\n\nimport type {CanonicalTileID} from '../../source/tile_id';\nimport type {\n Bucket,\n BucketParameters,\n IndexedFeature,\n PopulateParameters\n} from '../bucket';\nimport type {CollisionBoxArray, CollisionBox, SymbolInstance} from '../array_types';\nimport type {StructArray, StructArrayMember} from '../../util/struct_array';\nimport SymbolStyleLayer from '../../style/style_layer/symbol_style_layer';\nimport type Context from '../../gl/context';\nimport type IndexBuffer from '../../gl/index_buffer';\nimport type VertexBuffer from '../../gl/vertex_buffer';\nimport type {SymbolQuad} from '../../symbol/quads';\nimport type {SizeData} from '../../symbol/symbol_size';\nimport type {FeatureStates} from '../../source/source_state';\nimport type {ImagePosition} from '../../render/image_atlas';\n\nexport type SingleCollisionBox = {\n x1: number;\n y1: number;\n x2: number;\n y2: number;\n anchorPointX: number;\n anchorPointY: number;\n};\n\nexport type CollisionArrays = {\n textBox?: SingleCollisionBox;\n verticalTextBox?: SingleCollisionBox;\n iconBox?: SingleCollisionBox;\n verticalIconBox?: SingleCollisionBox;\n textFeatureIndex?: number;\n verticalTextFeatureIndex?: number;\n iconFeatureIndex?: number;\n verticalIconFeatureIndex?: number;\n};\n\nexport type SymbolFeature = {|\n sortKey: number | void,\n text: Formatted | void,\n icon: ?ResolvedImage,\n index: number,\n sourceLayerIndex: number,\n geometry: Array>,\n properties: Object,\n type: 'Point' | 'LineString' | 'Polygon',\n id?: any\n|};\n\nexport type SortKeyRange = {\n sortKey: number,\n symbolInstanceStart: number,\n symbolInstanceEnd: number\n};\n\n// Opacity arrays are frequently updated but don't contain a lot of information, so we pack them\n// tight. Each Uint32 is actually four duplicate Uint8s for the four corners of a glyph\n// 7 bits are for the current opacity, and the lowest bit is the target opacity\n\n// actually defined in symbol_attributes.js\n// const placementOpacityAttributes = [\n// { name: 'a_fade_opacity', components: 1, type: 'Uint32' }\n// ];\nconst shaderOpacityAttributes = [\n {name: 'a_fade_opacity', components: 1, type: 'Uint8', offset: 0}\n];\n\nfunction addVertex(array, anchorX, anchorY, ox, oy, tx, ty, sizeVertex, isSDF: boolean, pixelOffsetX, pixelOffsetY, minFontScaleX, minFontScaleY) {\n const aSizeX = sizeVertex ? Math.min(MAX_PACKED_SIZE, Math.round(sizeVertex[0])) : 0;\n const aSizeY = sizeVertex ? Math.min(MAX_PACKED_SIZE, Math.round(sizeVertex[1])) : 0;\n array.emplaceBack(\n // a_pos_offset\n anchorX,\n anchorY,\n Math.round(ox * 32),\n Math.round(oy * 32),\n\n // a_data\n tx, // x coordinate of symbol on glyph atlas texture\n ty, // y coordinate of symbol on glyph atlas texture\n (aSizeX << 1) + (isSDF ? 1 : 0),\n aSizeY,\n pixelOffsetX * 16,\n pixelOffsetY * 16,\n minFontScaleX * 256,\n minFontScaleY * 256\n );\n}\n\nfunction addDynamicAttributes(dynamicLayoutVertexArray: StructArray, p: Point, angle: number) {\n dynamicLayoutVertexArray.emplaceBack(p.x, p.y, angle);\n dynamicLayoutVertexArray.emplaceBack(p.x, p.y, angle);\n dynamicLayoutVertexArray.emplaceBack(p.x, p.y, angle);\n dynamicLayoutVertexArray.emplaceBack(p.x, p.y, angle);\n}\n\nfunction containsRTLText(formattedText: Formatted): boolean {\n for (const section of formattedText.sections) {\n if (stringContainsRTLText(section.text)) {\n return true;\n }\n }\n return false;\n}\n\nexport class SymbolBuffers {\n layoutVertexArray: SymbolLayoutArray;\n layoutVertexBuffer: VertexBuffer;\n\n indexArray: TriangleIndexArray;\n indexBuffer: IndexBuffer;\n\n programConfigurations: ProgramConfigurationSet;\n segments: SegmentVector;\n\n dynamicLayoutVertexArray: SymbolDynamicLayoutArray;\n dynamicLayoutVertexBuffer: VertexBuffer;\n\n opacityVertexArray: SymbolOpacityArray;\n opacityVertexBuffer: VertexBuffer;\n\n collisionVertexArray: CollisionVertexArray;\n collisionVertexBuffer: VertexBuffer;\n\n placedSymbolArray: PlacedSymbolArray;\n\n constructor(programConfigurations: ProgramConfigurationSet) {\n this.layoutVertexArray = new SymbolLayoutArray();\n this.indexArray = new TriangleIndexArray();\n this.programConfigurations = programConfigurations;\n this.segments = new SegmentVector();\n this.dynamicLayoutVertexArray = new SymbolDynamicLayoutArray();\n this.opacityVertexArray = new SymbolOpacityArray();\n this.placedSymbolArray = new PlacedSymbolArray();\n }\n\n isEmpty() {\n return this.layoutVertexArray.length === 0 &&\n this.indexArray.length === 0 &&\n this.dynamicLayoutVertexArray.length === 0 &&\n this.opacityVertexArray.length === 0;\n }\n\n upload(context: Context, dynamicIndexBuffer: boolean, upload?: boolean, update?: boolean) {\n if (this.isEmpty()) {\n return;\n }\n\n if (upload) {\n this.layoutVertexBuffer = context.createVertexBuffer(this.layoutVertexArray, symbolLayoutAttributes.members);\n this.indexBuffer = context.createIndexBuffer(this.indexArray, dynamicIndexBuffer);\n this.dynamicLayoutVertexBuffer = context.createVertexBuffer(this.dynamicLayoutVertexArray, dynamicLayoutAttributes.members, true);\n this.opacityVertexBuffer = context.createVertexBuffer(this.opacityVertexArray, shaderOpacityAttributes, true);\n // This is a performance hack so that we can write to opacityVertexArray with uint32s\n // even though the shaders read uint8s\n this.opacityVertexBuffer.itemSize = 1;\n }\n if (upload || update) {\n this.programConfigurations.upload(context);\n }\n }\n\n destroy() {\n if (!this.layoutVertexBuffer) return;\n this.layoutVertexBuffer.destroy();\n this.indexBuffer.destroy();\n this.programConfigurations.destroy();\n this.segments.destroy();\n this.dynamicLayoutVertexBuffer.destroy();\n this.opacityVertexBuffer.destroy();\n }\n}\n\nregister('SymbolBuffers', SymbolBuffers);\n\nclass CollisionBuffers {\n layoutVertexArray: StructArray;\n layoutAttributes: Array;\n layoutVertexBuffer: VertexBuffer;\n\n indexArray: TriangleIndexArray | LineIndexArray;\n indexBuffer: IndexBuffer;\n\n segments: SegmentVector;\n\n collisionVertexArray: CollisionVertexArray;\n collisionVertexBuffer: VertexBuffer;\n\n constructor(LayoutArray: Class,\n layoutAttributes: Array,\n IndexArray: Class) {\n this.layoutVertexArray = new LayoutArray();\n this.layoutAttributes = layoutAttributes;\n this.indexArray = new IndexArray();\n this.segments = new SegmentVector();\n this.collisionVertexArray = new CollisionVertexArray();\n }\n\n upload(context: Context) {\n this.layoutVertexBuffer = context.createVertexBuffer(this.layoutVertexArray, this.layoutAttributes);\n this.indexBuffer = context.createIndexBuffer(this.indexArray);\n this.collisionVertexBuffer = context.createVertexBuffer(this.collisionVertexArray, collisionVertexAttributes.members, true);\n }\n\n destroy() {\n if (!this.layoutVertexBuffer) return;\n this.layoutVertexBuffer.destroy();\n this.indexBuffer.destroy();\n this.segments.destroy();\n this.collisionVertexBuffer.destroy();\n }\n}\n\nregister('CollisionBuffers', CollisionBuffers);\n\n/**\n * Unlike other buckets, which simply implement #addFeature with type-specific\n * logic for (essentially) triangulating feature geometries, SymbolBucket\n * requires specialized behavior:\n *\n * 1. WorkerTile#parse(), the logical owner of the bucket creation process,\n * calls SymbolBucket#populate(), which resolves text and icon tokens on\n * each feature, adds each glyphs and symbols needed to the passed-in\n * collections options.glyphDependencies and options.iconDependencies, and\n * stores the feature data for use in subsequent step (this.features).\n *\n * 2. WorkerTile asynchronously requests from the main thread all of the glyphs\n * and icons needed (by this bucket and any others). When glyphs and icons\n * have been received, the WorkerTile creates a CollisionIndex and invokes:\n *\n * 3. performSymbolLayout(bucket, stacks, icons) perform texts shaping and\n * layout on a Symbol Bucket. This step populates:\n * `this.symbolInstances`: metadata on generated symbols\n * `this.collisionBoxArray`: collision data for use by foreground\n * `this.text`: SymbolBuffers for text symbols\n * `this.icons`: SymbolBuffers for icons\n * `this.iconCollisionBox`: Debug SymbolBuffers for icon collision boxes\n * `this.textCollisionBox`: Debug SymbolBuffers for text collision boxes\n * The results are sent to the foreground for rendering\n *\n * 4. performSymbolPlacement(bucket, collisionIndex) is run on the foreground,\n * and uses the CollisionIndex along with current camera settings to determine\n * which symbols can actually show on the map. Collided symbols are hidden\n * using a dynamic \"OpacityVertexArray\".\n *\n * @private\n */\nclass SymbolBucket implements Bucket {\n static MAX_GLYPHS: number;\n static addDynamicAttributes: typeof addDynamicAttributes;\n\n collisionBoxArray: CollisionBoxArray;\n zoom: number;\n overscaling: number;\n layers: Array;\n layerIds: Array;\n stateDependentLayers: Array;\n stateDependentLayerIds: Array;\n\n index: number;\n sdfIcons: boolean;\n iconsInText: boolean;\n iconsNeedLinear: boolean;\n bucketInstanceId: number;\n justReloaded: boolean;\n hasPattern: boolean;\n\n textSizeData: SizeData;\n iconSizeData: SizeData;\n\n glyphOffsetArray: GlyphOffsetArray;\n lineVertexArray: SymbolLineVertexArray;\n features: Array;\n symbolInstances: SymbolInstanceArray;\n collisionArrays: Array;\n sortKeyRanges: Array;\n pixelRatio: number;\n tilePixelRatio: number;\n compareText: {[_: string]: Array};\n fadeStartTime: number;\n sortFeaturesByKey: boolean;\n sortFeaturesByY: boolean;\n canOverlap: boolean;\n sortedAngle: number;\n featureSortOrder: Array;\n\n collisionCircleArray: Array;\n placementInvProjMatrix: mat4;\n placementViewportMatrix: mat4;\n\n text: SymbolBuffers;\n icon: SymbolBuffers;\n textCollisionBox: CollisionBuffers;\n iconCollisionBox: CollisionBuffers;\n uploaded: boolean;\n sourceLayerIndex: number;\n sourceID: string;\n symbolInstanceIndexes: Array;\n writingModes: Array;\n allowVerticalPlacement: boolean;\n hasRTLText: boolean;\n\n constructor(options: BucketParameters) {\n this.collisionBoxArray = options.collisionBoxArray;\n this.zoom = options.zoom;\n this.overscaling = options.overscaling;\n this.layers = options.layers;\n this.layerIds = this.layers.map(layer => layer.id);\n this.index = options.index;\n this.pixelRatio = options.pixelRatio;\n this.sourceLayerIndex = options.sourceLayerIndex;\n this.hasPattern = false;\n this.hasRTLText = false;\n this.sortKeyRanges = [];\n\n this.collisionCircleArray = [];\n this.placementInvProjMatrix = mat4.identity([]);\n this.placementViewportMatrix = mat4.identity([]);\n\n const layer = this.layers[0];\n const unevaluatedLayoutValues = layer._unevaluatedLayout._values;\n\n this.textSizeData = getSizeData(this.zoom, unevaluatedLayoutValues['text-size']);\n this.iconSizeData = getSizeData(this.zoom, unevaluatedLayoutValues['icon-size']);\n\n const layout = this.layers[0].layout;\n const sortKey = layout.get('symbol-sort-key');\n const zOrder = layout.get('symbol-z-order');\n this.canOverlap =\n layout.get('text-allow-overlap') ||\n layout.get('icon-allow-overlap') ||\n layout.get('text-ignore-placement') ||\n layout.get('icon-ignore-placement');\n this.sortFeaturesByKey = zOrder !== 'viewport-y' && !sortKey.isConstant();\n const zOrderByViewportY = zOrder === 'viewport-y' || (zOrder === 'auto' && !this.sortFeaturesByKey);\n this.sortFeaturesByY = zOrderByViewportY && this.canOverlap;\n\n if (layout.get('symbol-placement') === 'point') {\n this.writingModes = layout.get('text-writing-mode').map(wm => WritingMode[wm]);\n }\n\n this.stateDependentLayerIds = this.layers.filter((l) => l.isStateDependent()).map((l) => l.id);\n\n this.sourceID = options.sourceID;\n }\n\n createArrays() {\n this.text = new SymbolBuffers(new ProgramConfigurationSet(this.layers, this.zoom, property => /^text/.test(property)));\n this.icon = new SymbolBuffers(new ProgramConfigurationSet(this.layers, this.zoom, property => /^icon/.test(property)));\n\n this.glyphOffsetArray = new GlyphOffsetArray();\n this.lineVertexArray = new SymbolLineVertexArray();\n this.symbolInstances = new SymbolInstanceArray();\n }\n\n calculateGlyphDependencies(text: string, stack: {[_: number]: boolean}, textAlongLine: boolean, allowVerticalPlacement: boolean, doesAllowVerticalWritingMode: boolean) {\n for (let i = 0; i < text.length; i++) {\n stack[text.charCodeAt(i)] = true;\n if ((textAlongLine || allowVerticalPlacement) && doesAllowVerticalWritingMode) {\n const verticalChar = verticalizedCharacterMap[text.charAt(i)];\n if (verticalChar) {\n stack[verticalChar.charCodeAt(0)] = true;\n }\n }\n }\n }\n\n populate(features: Array, options: PopulateParameters, canonical: CanonicalTileID) {\n const layer = this.layers[0];\n const layout = layer.layout;\n\n const textFont = layout.get('text-font');\n const textField = layout.get('text-field');\n const iconImage = layout.get('icon-image');\n const hasText =\n (textField.value.kind !== 'constant' ||\n (textField.value.value instanceof Formatted && !textField.value.value.isEmpty()) ||\n textField.value.value.toString().length > 0) &&\n (textFont.value.kind !== 'constant' || textFont.value.value.length > 0);\n // we should always resolve the icon-image value if the property was defined in the style\n // this allows us to fire the styleimagemissing event if image evaluation returns null\n // the only way to distinguish between null returned from a coalesce statement with no valid images\n // and null returned because icon-image wasn't defined is to check whether or not iconImage.parameters is an empty object\n const hasIcon = iconImage.value.kind !== 'constant' || !!iconImage.value.value || Object.keys(iconImage.parameters).length > 0;\n const symbolSortKey = layout.get('symbol-sort-key');\n\n this.features = [];\n\n if (!hasText && !hasIcon) {\n return;\n }\n\n const icons = options.iconDependencies;\n const stacks = options.glyphDependencies;\n const availableImages = options.availableImages;\n const globalProperties = new EvaluationParameters(this.zoom);\n\n for (const {feature, id, index, sourceLayerIndex} of features) {\n\n const needGeometry = layer._featureFilter.needGeometry;\n const evaluationFeature = toEvaluationFeature(feature, needGeometry);\n if (!layer._featureFilter.filter(globalProperties, evaluationFeature, canonical)) {\n continue;\n }\n\n if (!needGeometry) evaluationFeature.geometry = loadGeometry(feature);\n\n let text: Formatted | void;\n if (hasText) {\n // Expression evaluation will automatically coerce to Formatted\n // but plain string token evaluation skips that pathway so do the\n // conversion here.\n const resolvedTokens = layer.getValueAndResolveTokens('text-field', evaluationFeature, canonical, availableImages);\n const formattedText = Formatted.factory(resolvedTokens);\n if (containsRTLText(formattedText)) {\n this.hasRTLText = true;\n }\n if (\n !this.hasRTLText || // non-rtl text so can proceed safely\n getRTLTextPluginStatus() === 'unavailable' || // We don't intend to lazy-load the rtl text plugin, so proceed with incorrect shaping\n this.hasRTLText && globalRTLTextPlugin.isParsed() // Use the rtlText plugin to shape text\n ) {\n text = transformText(formattedText, layer, evaluationFeature);\n }\n }\n\n let icon: ?ResolvedImage;\n if (hasIcon) {\n // Expression evaluation will automatically coerce to Image\n // but plain string token evaluation skips that pathway so do the\n // conversion here.\n const resolvedTokens = layer.getValueAndResolveTokens('icon-image', evaluationFeature, canonical, availableImages);\n if (resolvedTokens instanceof ResolvedImage) {\n icon = resolvedTokens;\n } else {\n icon = ResolvedImage.fromString(resolvedTokens);\n }\n }\n\n if (!text && !icon) {\n continue;\n }\n const sortKey = this.sortFeaturesByKey ?\n symbolSortKey.evaluate(evaluationFeature, {}, canonical) :\n undefined;\n\n const symbolFeature: SymbolFeature = {\n id,\n text,\n icon,\n index,\n sourceLayerIndex,\n geometry: evaluationFeature.geometry,\n properties: feature.properties,\n type: vectorTileFeatureTypes[feature.type],\n sortKey\n };\n this.features.push(symbolFeature);\n\n if (icon) {\n icons[icon.name] = true;\n }\n\n if (text) {\n const fontStack = textFont.evaluate(evaluationFeature, {}, canonical).join(',');\n const textAlongLine = layout.get('text-rotation-alignment') === 'map' && layout.get('symbol-placement') !== 'point';\n this.allowVerticalPlacement = this.writingModes && this.writingModes.indexOf(WritingMode.vertical) >= 0;\n for (const section of text.sections) {\n if (!section.image) {\n const doesAllowVerticalWritingMode = allowsVerticalWritingMode(text.toString());\n const sectionFont = section.fontStack || fontStack;\n const sectionStack = stacks[sectionFont] = stacks[sectionFont] || {};\n this.calculateGlyphDependencies(section.text, sectionStack, textAlongLine, this.allowVerticalPlacement, doesAllowVerticalWritingMode);\n } else {\n // Add section image to the list of dependencies.\n icons[section.image.name] = true;\n }\n }\n }\n }\n\n if (layout.get('symbol-placement') === 'line') {\n // Merge adjacent lines with the same text to improve labelling.\n // It's better to place labels on one long line than on many short segments.\n this.features = mergeLines(this.features);\n }\n\n if (this.sortFeaturesByKey) {\n this.features.sort((a, b) => {\n // a.sortKey is always a number when sortFeaturesByKey is true\n return ((a.sortKey: any): number) - ((b.sortKey: any): number);\n });\n }\n }\n\n update(states: FeatureStates, vtLayer: VectorTileLayer, imagePositions: {[_: string]: ImagePosition}) {\n if (!this.stateDependentLayers.length) return;\n this.text.programConfigurations.updatePaintArrays(states, vtLayer, this.layers, imagePositions);\n this.icon.programConfigurations.updatePaintArrays(states, vtLayer, this.layers, imagePositions);\n }\n\n isEmpty() {\n // When the bucket encounters only rtl-text but the plugin isnt loaded, no symbol instances will be created.\n // In order for the bucket to be serialized, and not discarded as an empty bucket both checks are necessary.\n return this.symbolInstances.length === 0 && !this.hasRTLText;\n }\n\n uploadPending() {\n return !this.uploaded || this.text.programConfigurations.needsUpload || this.icon.programConfigurations.needsUpload;\n }\n\n upload(context: Context) {\n if (!this.uploaded && this.hasDebugData()) {\n this.textCollisionBox.upload(context);\n this.iconCollisionBox.upload(context);\n }\n this.text.upload(context, this.sortFeaturesByY, !this.uploaded, this.text.programConfigurations.needsUpload);\n this.icon.upload(context, this.sortFeaturesByY, !this.uploaded, this.icon.programConfigurations.needsUpload);\n this.uploaded = true;\n }\n\n destroyDebugData() {\n this.textCollisionBox.destroy();\n this.iconCollisionBox.destroy();\n }\n\n destroy() {\n this.text.destroy();\n this.icon.destroy();\n\n if (this.hasDebugData()) {\n this.destroyDebugData();\n }\n }\n\n addToLineVertexArray(anchor: Anchor, line: any) {\n const lineStartIndex = this.lineVertexArray.length;\n if (anchor.segment !== undefined) {\n let sumForwardLength = anchor.dist(line[anchor.segment + 1]);\n let sumBackwardLength = anchor.dist(line[anchor.segment]);\n const vertices = {};\n for (let i = anchor.segment + 1; i < line.length; i++) {\n vertices[i] = {x: line[i].x, y: line[i].y, tileUnitDistanceFromAnchor: sumForwardLength};\n if (i < line.length - 1) {\n sumForwardLength += line[i + 1].dist(line[i]);\n }\n }\n for (let i = anchor.segment || 0; i >= 0; i--) {\n vertices[i] = {x: line[i].x, y: line[i].y, tileUnitDistanceFromAnchor: sumBackwardLength};\n if (i > 0) {\n sumBackwardLength += line[i - 1].dist(line[i]);\n }\n }\n for (let i = 0; i < line.length; i++) {\n const vertex = vertices[i];\n this.lineVertexArray.emplaceBack(vertex.x, vertex.y, vertex.tileUnitDistanceFromAnchor);\n }\n }\n return {\n lineStartIndex,\n lineLength: this.lineVertexArray.length - lineStartIndex\n };\n }\n\n addSymbols(arrays: SymbolBuffers,\n quads: Array,\n sizeVertex: any,\n lineOffset: [number, number],\n alongLine: boolean,\n feature: SymbolFeature,\n writingMode: any,\n labelAnchor: Anchor,\n lineStartIndex: number,\n lineLength: number,\n associatedIconIndex: number,\n canonical: CanonicalTileID) {\n const indexArray = arrays.indexArray;\n const layoutVertexArray = arrays.layoutVertexArray;\n\n const segment = arrays.segments.prepareSegment(4 * quads.length, layoutVertexArray, indexArray, this.canOverlap ? feature.sortKey : undefined);\n const glyphOffsetArrayStart = this.glyphOffsetArray.length;\n const vertexStartIndex = segment.vertexLength;\n\n const angle = (this.allowVerticalPlacement && writingMode === WritingMode.vertical) ? Math.PI / 2 : 0;\n\n const sections = feature.text && feature.text.sections;\n\n for (let i = 0; i < quads.length; i++) {\n const {tl, tr, bl, br, tex, pixelOffsetTL, pixelOffsetBR, minFontScaleX, minFontScaleY, glyphOffset, isSDF, sectionIndex} = quads[i];\n const index = segment.vertexLength;\n\n const y = glyphOffset[1];\n addVertex(layoutVertexArray, labelAnchor.x, labelAnchor.y, tl.x, y + tl.y, tex.x, tex.y, sizeVertex, isSDF, pixelOffsetTL.x, pixelOffsetTL.y, minFontScaleX, minFontScaleY);\n addVertex(layoutVertexArray, labelAnchor.x, labelAnchor.y, tr.x, y + tr.y, tex.x + tex.w, tex.y, sizeVertex, isSDF, pixelOffsetBR.x, pixelOffsetTL.y, minFontScaleX, minFontScaleY);\n addVertex(layoutVertexArray, labelAnchor.x, labelAnchor.y, bl.x, y + bl.y, tex.x, tex.y + tex.h, sizeVertex, isSDF, pixelOffsetTL.x, pixelOffsetBR.y, minFontScaleX, minFontScaleY);\n addVertex(layoutVertexArray, labelAnchor.x, labelAnchor.y, br.x, y + br.y, tex.x + tex.w, tex.y + tex.h, sizeVertex, isSDF, pixelOffsetBR.x, pixelOffsetBR.y, minFontScaleX, minFontScaleY);\n\n addDynamicAttributes(arrays.dynamicLayoutVertexArray, labelAnchor, angle);\n\n indexArray.emplaceBack(index, index + 1, index + 2);\n indexArray.emplaceBack(index + 1, index + 2, index + 3);\n\n segment.vertexLength += 4;\n segment.primitiveLength += 2;\n\n this.glyphOffsetArray.emplaceBack(glyphOffset[0]);\n\n if (i === quads.length - 1 || sectionIndex !== quads[i + 1].sectionIndex) {\n arrays.programConfigurations.populatePaintArrays(layoutVertexArray.length, feature, feature.index, {}, canonical, sections && sections[sectionIndex]);\n }\n }\n\n arrays.placedSymbolArray.emplaceBack(labelAnchor.x, labelAnchor.y,\n glyphOffsetArrayStart, this.glyphOffsetArray.length - glyphOffsetArrayStart, vertexStartIndex,\n lineStartIndex, lineLength, (labelAnchor.segment: any),\n sizeVertex ? sizeVertex[0] : 0, sizeVertex ? sizeVertex[1] : 0,\n lineOffset[0], lineOffset[1],\n writingMode,\n // placedOrientation is null initially; will be updated to horizontal(1)/vertical(2) if placed\n 0,\n (false: any),\n // The crossTileID is only filled/used on the foreground for dynamic text anchors\n 0,\n associatedIconIndex\n );\n }\n\n _addCollisionDebugVertex(layoutVertexArray: StructArray, collisionVertexArray: StructArray, point: Point, anchorX: number, anchorY: number, extrude: Point) {\n collisionVertexArray.emplaceBack(0, 0);\n return layoutVertexArray.emplaceBack(\n // pos\n point.x,\n point.y,\n // a_anchor_pos\n anchorX,\n anchorY,\n // extrude\n Math.round(extrude.x),\n Math.round(extrude.y));\n }\n\n addCollisionDebugVertices(x1: number, y1: number, x2: number, y2: number, arrays: CollisionBuffers, boxAnchorPoint: Point, symbolInstance: SymbolInstance) {\n const segment = arrays.segments.prepareSegment(4, arrays.layoutVertexArray, arrays.indexArray);\n const index = segment.vertexLength;\n\n const layoutVertexArray = arrays.layoutVertexArray;\n const collisionVertexArray = arrays.collisionVertexArray;\n\n const anchorX = symbolInstance.anchorX;\n const anchorY = symbolInstance.anchorY;\n\n this._addCollisionDebugVertex(layoutVertexArray, collisionVertexArray, boxAnchorPoint, anchorX, anchorY, new Point(x1, y1));\n this._addCollisionDebugVertex(layoutVertexArray, collisionVertexArray, boxAnchorPoint, anchorX, anchorY, new Point(x2, y1));\n this._addCollisionDebugVertex(layoutVertexArray, collisionVertexArray, boxAnchorPoint, anchorX, anchorY, new Point(x2, y2));\n this._addCollisionDebugVertex(layoutVertexArray, collisionVertexArray, boxAnchorPoint, anchorX, anchorY, new Point(x1, y2));\n\n segment.vertexLength += 4;\n\n const indexArray: LineIndexArray = (arrays.indexArray: any);\n indexArray.emplaceBack(index, index + 1);\n indexArray.emplaceBack(index + 1, index + 2);\n indexArray.emplaceBack(index + 2, index + 3);\n indexArray.emplaceBack(index + 3, index);\n\n segment.primitiveLength += 4;\n }\n\n addDebugCollisionBoxes(startIndex: number, endIndex: number, symbolInstance: SymbolInstance, isText: boolean) {\n for (let b = startIndex; b < endIndex; b++) {\n const box: CollisionBox = (this.collisionBoxArray.get(b): any);\n const x1 = box.x1;\n const y1 = box.y1;\n const x2 = box.x2;\n const y2 = box.y2;\n\n this.addCollisionDebugVertices(x1, y1, x2, y2,\n isText ? this.textCollisionBox : this.iconCollisionBox,\n box.anchorPoint, symbolInstance);\n }\n }\n\n generateCollisionDebugBuffers() {\n if (this.hasDebugData()) {\n this.destroyDebugData();\n }\n\n this.textCollisionBox = new CollisionBuffers(CollisionBoxLayoutArray, collisionBoxLayout.members, LineIndexArray);\n this.iconCollisionBox = new CollisionBuffers(CollisionBoxLayoutArray, collisionBoxLayout.members, LineIndexArray);\n\n for (let i = 0; i < this.symbolInstances.length; i++) {\n const symbolInstance = this.symbolInstances.get(i);\n this.addDebugCollisionBoxes(symbolInstance.textBoxStartIndex, symbolInstance.textBoxEndIndex, symbolInstance, true);\n this.addDebugCollisionBoxes(symbolInstance.verticalTextBoxStartIndex, symbolInstance.verticalTextBoxEndIndex, symbolInstance, true);\n this.addDebugCollisionBoxes(symbolInstance.iconBoxStartIndex, symbolInstance.iconBoxEndIndex, symbolInstance, false);\n this.addDebugCollisionBoxes(symbolInstance.verticalIconBoxStartIndex, symbolInstance.verticalIconBoxEndIndex, symbolInstance, false);\n }\n }\n\n // These flat arrays are meant to be quicker to iterate over than the source\n // CollisionBoxArray\n _deserializeCollisionBoxesForSymbol(collisionBoxArray: CollisionBoxArray,\n textStartIndex: number, textEndIndex: number,\n verticalTextStartIndex: number, verticalTextEndIndex: number,\n iconStartIndex: number, iconEndIndex: number,\n verticalIconStartIndex: number, verticalIconEndIndex: number): CollisionArrays {\n\n const collisionArrays = {};\n for (let k = textStartIndex; k < textEndIndex; k++) {\n const box: CollisionBox = (collisionBoxArray.get(k): any);\n collisionArrays.textBox = {x1: box.x1, y1: box.y1, x2: box.x2, y2: box.y2, anchorPointX: box.anchorPointX, anchorPointY: box.anchorPointY};\n collisionArrays.textFeatureIndex = box.featureIndex;\n break; // Only one box allowed per instance\n }\n for (let k = verticalTextStartIndex; k < verticalTextEndIndex; k++) {\n const box: CollisionBox = (collisionBoxArray.get(k): any);\n collisionArrays.verticalTextBox = {x1: box.x1, y1: box.y1, x2: box.x2, y2: box.y2, anchorPointX: box.anchorPointX, anchorPointY: box.anchorPointY};\n collisionArrays.verticalTextFeatureIndex = box.featureIndex;\n break; // Only one box allowed per instance\n }\n for (let k = iconStartIndex; k < iconEndIndex; k++) {\n // An icon can only have one box now, so this indexing is a bit vestigial...\n const box: CollisionBox = (collisionBoxArray.get(k): any);\n collisionArrays.iconBox = {x1: box.x1, y1: box.y1, x2: box.x2, y2: box.y2, anchorPointX: box.anchorPointX, anchorPointY: box.anchorPointY};\n collisionArrays.iconFeatureIndex = box.featureIndex;\n break; // Only one box allowed per instance\n }\n for (let k = verticalIconStartIndex; k < verticalIconEndIndex; k++) {\n // An icon can only have one box now, so this indexing is a bit vestigial...\n const box: CollisionBox = (collisionBoxArray.get(k): any);\n collisionArrays.verticalIconBox = {x1: box.x1, y1: box.y1, x2: box.x2, y2: box.y2, anchorPointX: box.anchorPointX, anchorPointY: box.anchorPointY};\n collisionArrays.verticalIconFeatureIndex = box.featureIndex;\n break; // Only one box allowed per instance\n }\n return collisionArrays;\n }\n\n deserializeCollisionBoxes(collisionBoxArray: CollisionBoxArray) {\n this.collisionArrays = [];\n for (let i = 0; i < this.symbolInstances.length; i++) {\n const symbolInstance = this.symbolInstances.get(i);\n this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(\n collisionBoxArray,\n symbolInstance.textBoxStartIndex,\n symbolInstance.textBoxEndIndex,\n symbolInstance.verticalTextBoxStartIndex,\n symbolInstance.verticalTextBoxEndIndex,\n symbolInstance.iconBoxStartIndex,\n symbolInstance.iconBoxEndIndex,\n symbolInstance.verticalIconBoxStartIndex,\n symbolInstance.verticalIconBoxEndIndex\n ));\n }\n }\n\n hasTextData() {\n return this.text.segments.get().length > 0;\n }\n\n hasIconData() {\n return this.icon.segments.get().length > 0;\n }\n\n hasDebugData() {\n return this.textCollisionBox && this.iconCollisionBox;\n }\n\n hasTextCollisionBoxData() {\n return this.hasDebugData() && this.textCollisionBox.segments.get().length > 0;\n }\n\n hasIconCollisionBoxData() {\n return this.hasDebugData() && this.iconCollisionBox.segments.get().length > 0;\n }\n\n addIndicesForPlacedSymbol(iconOrText: SymbolBuffers, placedSymbolIndex: number) {\n const placedSymbol = iconOrText.placedSymbolArray.get(placedSymbolIndex);\n\n const endIndex = placedSymbol.vertexStartIndex + placedSymbol.numGlyphs * 4;\n for (let vertexIndex = placedSymbol.vertexStartIndex; vertexIndex < endIndex; vertexIndex += 4) {\n iconOrText.indexArray.emplaceBack(vertexIndex, vertexIndex + 1, vertexIndex + 2);\n iconOrText.indexArray.emplaceBack(vertexIndex + 1, vertexIndex + 2, vertexIndex + 3);\n }\n }\n\n getSortedSymbolIndexes(angle: number) {\n if (this.sortedAngle === angle && this.symbolInstanceIndexes !== undefined) {\n return this.symbolInstanceIndexes;\n }\n const sin = Math.sin(angle);\n const cos = Math.cos(angle);\n const rotatedYs = [];\n const featureIndexes = [];\n const result = [];\n\n for (let i = 0; i < this.symbolInstances.length; ++i) {\n result.push(i);\n const symbolInstance = this.symbolInstances.get(i);\n rotatedYs.push(Math.round(sin * symbolInstance.anchorX + cos * symbolInstance.anchorY) | 0);\n featureIndexes.push(symbolInstance.featureIndex);\n }\n\n result.sort((aIndex, bIndex) => {\n return (rotatedYs[aIndex] - rotatedYs[bIndex]) ||\n (featureIndexes[bIndex] - featureIndexes[aIndex]);\n });\n\n return result;\n }\n\n addToSortKeyRanges(symbolInstanceIndex: number, sortKey: number) {\n const last = this.sortKeyRanges[this.sortKeyRanges.length - 1];\n if (last && last.sortKey === sortKey) {\n last.symbolInstanceEnd = symbolInstanceIndex + 1;\n } else {\n this.sortKeyRanges.push({\n sortKey,\n symbolInstanceStart: symbolInstanceIndex,\n symbolInstanceEnd: symbolInstanceIndex + 1\n });\n }\n }\n\n sortFeatures(angle: number) {\n if (!this.sortFeaturesByY) return;\n if (this.sortedAngle === angle) return;\n\n // The current approach to sorting doesn't sort across segments so don't try.\n // Sorting within segments separately seemed not to be worth the complexity.\n if (this.text.segments.get().length > 1 || this.icon.segments.get().length > 1) return;\n\n // If the symbols are allowed to overlap sort them by their vertical screen position.\n // The index array buffer is rewritten to reference the (unchanged) vertices in the\n // sorted order.\n\n // To avoid sorting the actual symbolInstance array we sort an array of indexes.\n this.symbolInstanceIndexes = this.getSortedSymbolIndexes(angle);\n this.sortedAngle = angle;\n\n this.text.indexArray.clear();\n this.icon.indexArray.clear();\n\n this.featureSortOrder = [];\n\n for (const i of this.symbolInstanceIndexes) {\n const symbolInstance = this.symbolInstances.get(i);\n this.featureSortOrder.push(symbolInstance.featureIndex);\n\n [\n symbolInstance.rightJustifiedTextSymbolIndex,\n symbolInstance.centerJustifiedTextSymbolIndex,\n symbolInstance.leftJustifiedTextSymbolIndex\n ].forEach((index, i, array) => {\n // Only add a given index the first time it shows up,\n // to avoid duplicate opacity entries when multiple justifications\n // share the same glyphs.\n if (index >= 0 && array.indexOf(index) === i) {\n this.addIndicesForPlacedSymbol(this.text, index);\n }\n });\n\n if (symbolInstance.verticalPlacedTextSymbolIndex >= 0) {\n this.addIndicesForPlacedSymbol(this.text, symbolInstance.verticalPlacedTextSymbolIndex);\n }\n\n if (symbolInstance.placedIconSymbolIndex >= 0) {\n this.addIndicesForPlacedSymbol(this.icon, symbolInstance.placedIconSymbolIndex);\n }\n\n if (symbolInstance.verticalPlacedIconSymbolIndex >= 0) {\n this.addIndicesForPlacedSymbol(this.icon, symbolInstance.verticalPlacedIconSymbolIndex);\n }\n }\n\n if (this.text.indexBuffer) this.text.indexBuffer.updateData(this.text.indexArray);\n if (this.icon.indexBuffer) this.icon.indexBuffer.updateData(this.icon.indexArray);\n }\n}\n\nregister('SymbolBucket', SymbolBucket, {\n omit: ['layers', 'collisionBoxArray', 'features', 'compareText']\n});\n\n// this constant is based on the size of StructArray indexes used in a symbol\n// bucket--namely, glyphOffsetArrayStart\n// eg the max valid UInt16 is 65,535\n// See https://github.com/mapbox/mapbox-gl-js/issues/2907 for motivation\n// lineStartIndex and textBoxStartIndex could potentially be concerns\n// but we expect there to be many fewer boxes/lines than glyphs\nSymbolBucket.MAX_GLYPHS = 65535;\n\nSymbolBucket.addDynamicAttributes = addDynamicAttributes;\n\nexport default SymbolBucket;\nexport {addDynamicAttributes};\n","// @flow\n\nimport type {SymbolFeature} from '../data/bucket/symbol_bucket';\n\nexport default function (features: Array): Array {\n const leftIndex: {[_: string]: number} = {};\n const rightIndex: {[_: string]: number} = {};\n const mergedFeatures = [];\n let mergedIndex = 0;\n\n function add(k) {\n mergedFeatures.push(features[k]);\n mergedIndex++;\n }\n\n function mergeFromRight(leftKey: string, rightKey: string, geom) {\n const i = rightIndex[leftKey];\n delete rightIndex[leftKey];\n rightIndex[rightKey] = i;\n\n mergedFeatures[i].geometry[0].pop();\n mergedFeatures[i].geometry[0] = mergedFeatures[i].geometry[0].concat(geom[0]);\n return i;\n }\n\n function mergeFromLeft(leftKey: string, rightKey: string, geom) {\n const i = leftIndex[rightKey];\n delete leftIndex[rightKey];\n leftIndex[leftKey] = i;\n\n mergedFeatures[i].geometry[0].shift();\n mergedFeatures[i].geometry[0] = geom[0].concat(mergedFeatures[i].geometry[0]);\n return i;\n }\n\n function getKey(text, geom, onRight) {\n const point = onRight ? geom[0][geom[0].length - 1] : geom[0][0];\n return `${text}:${point.x}:${point.y}`;\n }\n\n for (let k = 0; k < features.length; k++) {\n const feature = features[k];\n const geom = feature.geometry;\n const text = feature.text ? feature.text.toString() : null;\n\n if (!text) {\n add(k);\n continue;\n }\n\n const leftKey = getKey(text, geom),\n rightKey = getKey(text, geom, true);\n\n if ((leftKey in rightIndex) && (rightKey in leftIndex) && (rightIndex[leftKey] !== leftIndex[rightKey])) {\n // found lines with the same text adjacent to both ends of the current line, merge all three\n const j = mergeFromLeft(leftKey, rightKey, geom);\n const i = mergeFromRight(leftKey, rightKey, mergedFeatures[j].geometry);\n\n delete leftIndex[leftKey];\n delete rightIndex[rightKey];\n\n rightIndex[getKey(text, mergedFeatures[i].geometry, true)] = i;\n mergedFeatures[j].geometry = (null: any);\n\n } else if (leftKey in rightIndex) {\n // found mergeable line adjacent to the start of the current line, merge\n mergeFromRight(leftKey, rightKey, geom);\n\n } else if (rightKey in leftIndex) {\n // found mergeable line adjacent to the end of the current line, merge\n mergeFromLeft(leftKey, rightKey, geom);\n\n } else {\n // no adjacent lines, add as a new item\n add(k);\n leftIndex[leftKey] = mergedIndex - 1;\n rightIndex[rightKey] = mergedIndex - 1;\n }\n }\n\n return mergedFeatures.filter((f) => f.geometry);\n}\n","// This file is generated. Edit build/generate-style-code.js, then run `yarn run codegen`.\n// @flow\n/* eslint-disable */\n\nimport styleSpec from '../../style-spec/reference/latest';\n\nimport {\n Properties,\n DataConstantProperty,\n DataDrivenProperty,\n CrossFadedDataDrivenProperty,\n CrossFadedProperty,\n ColorRampProperty\n} from '../properties';\n\nimport type Color from '../../style-spec/util/color';\n\nimport type Formatted from '../../style-spec/expression/types/formatted';\n\nimport type ResolvedImage from '../../style-spec/expression/types/resolved_image';\n\nimport {\n ColorType\n} from '../../style-spec/expression/types';\n\nexport type LayoutProps = {|\n \"symbol-placement\": DataConstantProperty<\"point\" | \"line\" | \"line-center\">,\n \"symbol-spacing\": DataConstantProperty,\n \"symbol-avoid-edges\": DataConstantProperty,\n \"symbol-sort-key\": DataDrivenProperty,\n \"symbol-z-order\": DataConstantProperty<\"auto\" | \"viewport-y\" | \"source\">,\n \"icon-allow-overlap\": DataConstantProperty,\n \"icon-ignore-placement\": DataConstantProperty,\n \"icon-optional\": DataConstantProperty,\n \"icon-rotation-alignment\": DataConstantProperty<\"map\" | \"viewport\" | \"auto\">,\n \"icon-size\": DataDrivenProperty,\n \"icon-text-fit\": DataConstantProperty<\"none\" | \"width\" | \"height\" | \"both\">,\n \"icon-text-fit-padding\": DataConstantProperty<[number, number, number, number]>,\n \"icon-image\": DataDrivenProperty,\n \"icon-rotate\": DataDrivenProperty,\n \"icon-padding\": DataConstantProperty,\n \"icon-keep-upright\": DataConstantProperty,\n \"icon-offset\": DataDrivenProperty<[number, number]>,\n \"icon-anchor\": DataDrivenProperty<\"center\" | \"left\" | \"right\" | \"top\" | \"bottom\" | \"top-left\" | \"top-right\" | \"bottom-left\" | \"bottom-right\">,\n \"icon-pitch-alignment\": DataConstantProperty<\"map\" | \"viewport\" | \"auto\">,\n \"text-pitch-alignment\": DataConstantProperty<\"map\" | \"viewport\" | \"auto\">,\n \"text-rotation-alignment\": DataConstantProperty<\"map\" | \"viewport\" | \"auto\">,\n \"text-field\": DataDrivenProperty,\n \"text-font\": DataDrivenProperty>,\n \"text-size\": DataDrivenProperty,\n \"text-max-width\": DataDrivenProperty,\n \"text-line-height\": DataConstantProperty,\n \"text-letter-spacing\": DataDrivenProperty,\n \"text-justify\": DataDrivenProperty<\"auto\" | \"left\" | \"center\" | \"right\">,\n \"text-radial-offset\": DataDrivenProperty,\n \"text-variable-anchor\": DataConstantProperty>,\n \"text-anchor\": DataDrivenProperty<\"center\" | \"left\" | \"right\" | \"top\" | \"bottom\" | \"top-left\" | \"top-right\" | \"bottom-left\" | \"bottom-right\">,\n \"text-max-angle\": DataConstantProperty,\n \"text-writing-mode\": DataConstantProperty>,\n \"text-rotate\": DataDrivenProperty,\n \"text-padding\": DataConstantProperty,\n \"text-keep-upright\": DataConstantProperty,\n \"text-transform\": DataDrivenProperty<\"none\" | \"uppercase\" | \"lowercase\">,\n \"text-offset\": DataDrivenProperty<[number, number]>,\n \"text-allow-overlap\": DataConstantProperty,\n \"text-ignore-placement\": DataConstantProperty,\n \"text-optional\": DataConstantProperty,\n|};\n\nconst layout: Properties = new Properties({\n \"symbol-placement\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"symbol-placement\"]),\n \"symbol-spacing\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"symbol-spacing\"]),\n \"symbol-avoid-edges\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"symbol-avoid-edges\"]),\n \"symbol-sort-key\": new DataDrivenProperty(styleSpec[\"layout_symbol\"][\"symbol-sort-key\"]),\n \"symbol-z-order\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"symbol-z-order\"]),\n \"icon-allow-overlap\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"icon-allow-overlap\"]),\n \"icon-ignore-placement\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"icon-ignore-placement\"]),\n \"icon-optional\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"icon-optional\"]),\n \"icon-rotation-alignment\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"icon-rotation-alignment\"]),\n \"icon-size\": new DataDrivenProperty(styleSpec[\"layout_symbol\"][\"icon-size\"]),\n \"icon-text-fit\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"icon-text-fit\"]),\n \"icon-text-fit-padding\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"icon-text-fit-padding\"]),\n \"icon-image\": new DataDrivenProperty(styleSpec[\"layout_symbol\"][\"icon-image\"]),\n \"icon-rotate\": new DataDrivenProperty(styleSpec[\"layout_symbol\"][\"icon-rotate\"]),\n \"icon-padding\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"icon-padding\"]),\n \"icon-keep-upright\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"icon-keep-upright\"]),\n \"icon-offset\": new DataDrivenProperty(styleSpec[\"layout_symbol\"][\"icon-offset\"]),\n \"icon-anchor\": new DataDrivenProperty(styleSpec[\"layout_symbol\"][\"icon-anchor\"]),\n \"icon-pitch-alignment\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"icon-pitch-alignment\"]),\n \"text-pitch-alignment\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"text-pitch-alignment\"]),\n \"text-rotation-alignment\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"text-rotation-alignment\"]),\n \"text-field\": new DataDrivenProperty(styleSpec[\"layout_symbol\"][\"text-field\"]),\n \"text-font\": new DataDrivenProperty(styleSpec[\"layout_symbol\"][\"text-font\"]),\n \"text-size\": new DataDrivenProperty(styleSpec[\"layout_symbol\"][\"text-size\"]),\n \"text-max-width\": new DataDrivenProperty(styleSpec[\"layout_symbol\"][\"text-max-width\"]),\n \"text-line-height\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"text-line-height\"]),\n \"text-letter-spacing\": new DataDrivenProperty(styleSpec[\"layout_symbol\"][\"text-letter-spacing\"]),\n \"text-justify\": new DataDrivenProperty(styleSpec[\"layout_symbol\"][\"text-justify\"]),\n \"text-radial-offset\": new DataDrivenProperty(styleSpec[\"layout_symbol\"][\"text-radial-offset\"]),\n \"text-variable-anchor\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"text-variable-anchor\"]),\n \"text-anchor\": new DataDrivenProperty(styleSpec[\"layout_symbol\"][\"text-anchor\"]),\n \"text-max-angle\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"text-max-angle\"]),\n \"text-writing-mode\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"text-writing-mode\"]),\n \"text-rotate\": new DataDrivenProperty(styleSpec[\"layout_symbol\"][\"text-rotate\"]),\n \"text-padding\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"text-padding\"]),\n \"text-keep-upright\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"text-keep-upright\"]),\n \"text-transform\": new DataDrivenProperty(styleSpec[\"layout_symbol\"][\"text-transform\"]),\n \"text-offset\": new DataDrivenProperty(styleSpec[\"layout_symbol\"][\"text-offset\"]),\n \"text-allow-overlap\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"text-allow-overlap\"]),\n \"text-ignore-placement\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"text-ignore-placement\"]),\n \"text-optional\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"text-optional\"]),\n});\n\nexport type PaintProps = {|\n \"icon-opacity\": DataDrivenProperty,\n \"icon-color\": DataDrivenProperty,\n \"icon-halo-color\": DataDrivenProperty,\n \"icon-halo-width\": DataDrivenProperty,\n \"icon-halo-blur\": DataDrivenProperty,\n \"icon-translate\": DataConstantProperty<[number, number]>,\n \"icon-translate-anchor\": DataConstantProperty<\"map\" | \"viewport\">,\n \"text-opacity\": DataDrivenProperty,\n \"text-color\": DataDrivenProperty,\n \"text-halo-color\": DataDrivenProperty,\n \"text-halo-width\": DataDrivenProperty,\n \"text-halo-blur\": DataDrivenProperty,\n \"text-translate\": DataConstantProperty<[number, number]>,\n \"text-translate-anchor\": DataConstantProperty<\"map\" | \"viewport\">,\n|};\n\nconst paint: Properties = new Properties({\n \"icon-opacity\": new DataDrivenProperty(styleSpec[\"paint_symbol\"][\"icon-opacity\"]),\n \"icon-color\": new DataDrivenProperty(styleSpec[\"paint_symbol\"][\"icon-color\"]),\n \"icon-halo-color\": new DataDrivenProperty(styleSpec[\"paint_symbol\"][\"icon-halo-color\"]),\n \"icon-halo-width\": new DataDrivenProperty(styleSpec[\"paint_symbol\"][\"icon-halo-width\"]),\n \"icon-halo-blur\": new DataDrivenProperty(styleSpec[\"paint_symbol\"][\"icon-halo-blur\"]),\n \"icon-translate\": new DataConstantProperty(styleSpec[\"paint_symbol\"][\"icon-translate\"]),\n \"icon-translate-anchor\": new DataConstantProperty(styleSpec[\"paint_symbol\"][\"icon-translate-anchor\"]),\n \"text-opacity\": new DataDrivenProperty(styleSpec[\"paint_symbol\"][\"text-opacity\"]),\n \"text-color\": new DataDrivenProperty(styleSpec[\"paint_symbol\"][\"text-color\"], { runtimeType: ColorType, getOverride: (o) => o.textColor, hasOverride: (o) => !!o.textColor }),\n \"text-halo-color\": new DataDrivenProperty(styleSpec[\"paint_symbol\"][\"text-halo-color\"]),\n \"text-halo-width\": new DataDrivenProperty(styleSpec[\"paint_symbol\"][\"text-halo-width\"]),\n \"text-halo-blur\": new DataDrivenProperty(styleSpec[\"paint_symbol\"][\"text-halo-blur\"]),\n \"text-translate\": new DataConstantProperty(styleSpec[\"paint_symbol\"][\"text-translate\"]),\n \"text-translate-anchor\": new DataConstantProperty(styleSpec[\"paint_symbol\"][\"text-translate-anchor\"]),\n});\n\n// Note: without adding the explicit type annotation, Flow infers weaker types\n// for these objects from their use in the constructor to StyleLayer, as\n// {layout?: Properties<...>, paint: Properties<...>}\nexport default ({ paint, layout }: $Exact<{\n paint: Properties, layout: Properties\n}>);\n","// @flow\n\nimport assert from 'assert';\nimport type {Expression} from '../style-spec/expression/expression';\nimport type EvaluationContext from '../style-spec/expression/evaluation_context';\nimport type {Type} from '../style-spec/expression/types';\nimport type {ZoomConstantExpression} from '../style-spec/expression';\nimport {NullType} from '../style-spec/expression/types';\nimport {PossiblyEvaluatedPropertyValue} from './properties';\nimport {register} from '../util/web_worker_transfer';\n\n// This is an internal expression class. It is only used in GL JS and\n// has GL JS dependencies which can break the standalone style-spec module\nexport default class FormatSectionOverride implements Expression {\n type: Type;\n defaultValue: PossiblyEvaluatedPropertyValue;\n\n constructor(defaultValue: PossiblyEvaluatedPropertyValue) {\n assert(defaultValue.property.overrides !== undefined);\n this.type = defaultValue.property.overrides ? defaultValue.property.overrides.runtimeType : NullType;\n this.defaultValue = defaultValue;\n }\n\n evaluate(ctx: EvaluationContext) {\n if (ctx.formattedSection) {\n const overrides = this.defaultValue.property.overrides;\n if (overrides && overrides.hasOverride(ctx.formattedSection)) {\n return overrides.getOverride(ctx.formattedSection);\n }\n }\n\n if (ctx.feature && ctx.featureState) {\n return this.defaultValue.evaluate(ctx.feature, ctx.featureState);\n }\n\n return this.defaultValue.property.specification.default;\n }\n\n eachChild(fn: (_: Expression) => void) {\n if (!this.defaultValue.isConstant()) {\n const expr: ZoomConstantExpression<'source'> = ((this.defaultValue.value): any);\n fn(expr._styleExpression.expression);\n }\n }\n\n // Cannot be statically evaluated, as the output depends on the evaluation context.\n outputDefined() {\n return false;\n }\n\n serialize() {\n return null;\n }\n}\n\nregister('FormatSectionOverride', FormatSectionOverride, {omit: ['defaultValue']});\n","// @flow\n\nimport StyleLayer from '../style_layer';\n\nimport assert from 'assert';\nimport SymbolBucket from '../../data/bucket/symbol_bucket';\nimport resolveTokens from '../../util/resolve_tokens';\nimport properties from './symbol_style_layer_properties';\n\nimport {\n Transitionable,\n Transitioning,\n Layout,\n PossiblyEvaluated,\n PossiblyEvaluatedPropertyValue,\n PropertyValue\n} from '../properties';\n\nimport {\n isExpression,\n StyleExpression,\n ZoomConstantExpression,\n ZoomDependentExpression\n} from '../../style-spec/expression';\n\nimport type {BucketParameters} from '../../data/bucket';\nimport type {LayoutProps, PaintProps} from './symbol_style_layer_properties';\nimport type EvaluationParameters from '../evaluation_parameters';\nimport type {LayerSpecification} from '../../style-spec/types';\nimport type {Feature, SourceExpression, CompositeExpression} from '../../style-spec/expression';\nimport type {Expression} from '../../style-spec/expression/expression';\nimport type {CanonicalTileID} from '../../source/tile_id';\nimport {FormattedType} from '../../style-spec/expression/types';\nimport {typeOf} from '../../style-spec/expression/values';\nimport Formatted from '../../style-spec/expression/types/formatted';\nimport FormatSectionOverride from '../format_section_override';\nimport FormatExpression from '../../style-spec/expression/definitions/format';\nimport Literal from '../../style-spec/expression/definitions/literal';\n\nclass SymbolStyleLayer extends StyleLayer {\n _unevaluatedLayout: Layout;\n layout: PossiblyEvaluated;\n\n _transitionablePaint: Transitionable;\n _transitioningPaint: Transitioning;\n paint: PossiblyEvaluated;\n\n constructor(layer: LayerSpecification) {\n super(layer, properties);\n }\n\n recalculate(parameters: EvaluationParameters, availableImages: Array) {\n super.recalculate(parameters, availableImages);\n\n if (this.layout.get('icon-rotation-alignment') === 'auto') {\n if (this.layout.get('symbol-placement') !== 'point') {\n this.layout._values['icon-rotation-alignment'] = 'map';\n } else {\n this.layout._values['icon-rotation-alignment'] = 'viewport';\n }\n }\n\n if (this.layout.get('text-rotation-alignment') === 'auto') {\n if (this.layout.get('symbol-placement') !== 'point') {\n this.layout._values['text-rotation-alignment'] = 'map';\n } else {\n this.layout._values['text-rotation-alignment'] = 'viewport';\n }\n }\n\n // If unspecified, `*-pitch-alignment` inherits `*-rotation-alignment`\n if (this.layout.get('text-pitch-alignment') === 'auto') {\n this.layout._values['text-pitch-alignment'] = this.layout.get('text-rotation-alignment');\n }\n if (this.layout.get('icon-pitch-alignment') === 'auto') {\n this.layout._values['icon-pitch-alignment'] = this.layout.get('icon-rotation-alignment');\n }\n\n if (this.layout.get('symbol-placement') === 'point') {\n const writingModes = this.layout.get('text-writing-mode');\n if (writingModes) {\n // remove duplicates, preserving order\n const deduped = [];\n for (const m of writingModes) {\n if (deduped.indexOf(m) < 0) deduped.push(m);\n }\n this.layout._values['text-writing-mode'] = deduped;\n } else {\n this.layout._values['text-writing-mode'] = ['horizontal'];\n }\n }\n\n this._setPaintOverrides();\n }\n\n getValueAndResolveTokens(name: *, feature: Feature, canonical: CanonicalTileID, availableImages: Array) {\n const value = this.layout.get(name).evaluate(feature, {}, canonical, availableImages);\n const unevaluated = this._unevaluatedLayout._values[name];\n if (!unevaluated.isDataDriven() && !isExpression(unevaluated.value) && value) {\n return resolveTokens(feature.properties, value);\n }\n\n return value;\n }\n\n createBucket(parameters: BucketParameters<*>) {\n return new SymbolBucket(parameters);\n }\n\n queryRadius(): number {\n return 0;\n }\n\n queryIntersectsFeature(): boolean {\n assert(false); // Should take a different path in FeatureIndex\n return false;\n }\n\n _setPaintOverrides() {\n for (const overridable of properties.paint.overridableProperties) {\n if (!SymbolStyleLayer.hasPaintOverride(this.layout, overridable)) {\n continue;\n }\n const overriden = this.paint.get(overridable);\n const override = new FormatSectionOverride(overriden);\n const styleExpression = new StyleExpression(override, overriden.property.specification);\n let expression = null;\n if (overriden.value.kind === 'constant' || overriden.value.kind === 'source') {\n expression = (new ZoomConstantExpression('source', styleExpression): SourceExpression);\n } else {\n expression = (new ZoomDependentExpression('composite',\n styleExpression,\n overriden.value.zoomStops,\n overriden.value._interpolationType): CompositeExpression);\n }\n this.paint._values[overridable] = new PossiblyEvaluatedPropertyValue(overriden.property,\n expression,\n overriden.parameters);\n }\n }\n\n _handleOverridablePaintPropertyUpdate(name: string, oldValue: PropertyValue, newValue: PropertyValue): boolean {\n if (!this.layout || oldValue.isDataDriven() || newValue.isDataDriven()) {\n return false;\n }\n return SymbolStyleLayer.hasPaintOverride(this.layout, name);\n }\n\n static hasPaintOverride(layout: PossiblyEvaluated, propertyName: string): boolean {\n const textField = layout.get('text-field');\n const property = properties.paint.properties[propertyName];\n let hasOverrides = false;\n\n const checkSections = (sections) => {\n for (const section of sections) {\n if (property.overrides && property.overrides.hasOverride(section)) {\n hasOverrides = true;\n return;\n }\n }\n };\n\n if (textField.value.kind === 'constant' && textField.value.value instanceof Formatted) {\n checkSections(textField.value.value.sections);\n } else if (textField.value.kind === 'source') {\n\n const checkExpression = (expression: Expression) => {\n if (hasOverrides) return;\n\n if (expression instanceof Literal && typeOf(expression.value) === FormattedType) {\n const formatted: Formatted = ((expression.value): any);\n checkSections(formatted.sections);\n } else if (expression instanceof FormatExpression) {\n checkSections(expression.sections);\n } else {\n expression.eachChild(checkExpression);\n }\n };\n\n const expr: ZoomConstantExpression<'source'> = ((textField.value): any);\n if (expr._styleExpression) {\n checkExpression(expr._styleExpression.expression);\n }\n }\n\n return hasOverrides;\n }\n}\n\nexport default SymbolStyleLayer;\n","// @flow\nexport default resolveTokens;\n\n/**\n * Replace tokens in a string template with values in an object\n *\n * @param properties a key/value relationship between tokens and replacements\n * @param text the template string\n * @returns the template with tokens replaced\n * @private\n */\nfunction resolveTokens(properties: {+[string]: mixed}, text: string): string {\n return text.replace(/{([^{}]+)}/g, (match, key: string) => {\n return key in properties ? String(properties[key]) : '';\n });\n}\n","// This file is generated. Edit build/generate-style-code.js, then run `yarn run codegen`.\n// @flow\n/* eslint-disable */\n\nimport styleSpec from '../../style-spec/reference/latest';\n\nimport {\n Properties,\n DataConstantProperty,\n DataDrivenProperty,\n CrossFadedDataDrivenProperty,\n CrossFadedProperty,\n ColorRampProperty\n} from '../properties';\n\nimport type Color from '../../style-spec/util/color';\n\nimport type Formatted from '../../style-spec/expression/types/formatted';\n\nimport type ResolvedImage from '../../style-spec/expression/types/resolved_image';\n\n\nexport type PaintProps = {|\n \"background-color\": DataConstantProperty,\n \"background-pattern\": CrossFadedProperty,\n \"background-opacity\": DataConstantProperty,\n|};\n\nconst paint: Properties = new Properties({\n \"background-color\": new DataConstantProperty(styleSpec[\"paint_background\"][\"background-color\"]),\n \"background-pattern\": new CrossFadedProperty(styleSpec[\"paint_background\"][\"background-pattern\"]),\n \"background-opacity\": new DataConstantProperty(styleSpec[\"paint_background\"][\"background-opacity\"]),\n});\n\n// Note: without adding the explicit type annotation, Flow infers weaker types\n// for these objects from their use in the constructor to StyleLayer, as\n// {layout?: Properties<...>, paint: Properties<...>}\nexport default ({ paint }: $Exact<{\n paint: Properties\n}>);\n","// @flow\n\nimport StyleLayer from '../style_layer';\n\nimport properties from './background_style_layer_properties';\nimport {Transitionable, Transitioning, PossiblyEvaluated} from '../properties';\n\nimport type {PaintProps} from './background_style_layer_properties';\nimport type {LayerSpecification} from '../../style-spec/types';\n\nclass BackgroundStyleLayer extends StyleLayer {\n _transitionablePaint: Transitionable;\n _transitioningPaint: Transitioning;\n paint: PossiblyEvaluated;\n\n constructor(layer: LayerSpecification) {\n super(layer, properties);\n }\n}\n\nexport default BackgroundStyleLayer;\n","// This file is generated. Edit build/generate-style-code.js, then run `yarn run codegen`.\n// @flow\n/* eslint-disable */\n\nimport styleSpec from '../../style-spec/reference/latest';\n\nimport {\n Properties,\n DataConstantProperty,\n DataDrivenProperty,\n CrossFadedDataDrivenProperty,\n CrossFadedProperty,\n ColorRampProperty\n} from '../properties';\n\nimport type Color from '../../style-spec/util/color';\n\nimport type Formatted from '../../style-spec/expression/types/formatted';\n\nimport type ResolvedImage from '../../style-spec/expression/types/resolved_image';\n\n\nexport type PaintProps = {|\n \"raster-opacity\": DataConstantProperty,\n \"raster-hue-rotate\": DataConstantProperty,\n \"raster-brightness-min\": DataConstantProperty,\n \"raster-brightness-max\": DataConstantProperty,\n \"raster-saturation\": DataConstantProperty,\n \"raster-contrast\": DataConstantProperty,\n \"raster-resampling\": DataConstantProperty<\"linear\" | \"nearest\">,\n \"raster-fade-duration\": DataConstantProperty,\n|};\n\nconst paint: Properties = new Properties({\n \"raster-opacity\": new DataConstantProperty(styleSpec[\"paint_raster\"][\"raster-opacity\"]),\n \"raster-hue-rotate\": new DataConstantProperty(styleSpec[\"paint_raster\"][\"raster-hue-rotate\"]),\n \"raster-brightness-min\": new DataConstantProperty(styleSpec[\"paint_raster\"][\"raster-brightness-min\"]),\n \"raster-brightness-max\": new DataConstantProperty(styleSpec[\"paint_raster\"][\"raster-brightness-max\"]),\n \"raster-saturation\": new DataConstantProperty(styleSpec[\"paint_raster\"][\"raster-saturation\"]),\n \"raster-contrast\": new DataConstantProperty(styleSpec[\"paint_raster\"][\"raster-contrast\"]),\n \"raster-resampling\": new DataConstantProperty(styleSpec[\"paint_raster\"][\"raster-resampling\"]),\n \"raster-fade-duration\": new DataConstantProperty(styleSpec[\"paint_raster\"][\"raster-fade-duration\"]),\n});\n\n// Note: without adding the explicit type annotation, Flow infers weaker types\n// for these objects from their use in the constructor to StyleLayer, as\n// {layout?: Properties<...>, paint: Properties<...>}\nexport default ({ paint }: $Exact<{\n paint: Properties\n}>);\n","// @flow\n\nimport StyleLayer from '../style_layer';\n\nimport properties from './raster_style_layer_properties';\nimport {Transitionable, Transitioning, PossiblyEvaluated} from '../properties';\n\nimport type {PaintProps} from './raster_style_layer_properties';\nimport type {LayerSpecification} from '../../style-spec/types';\n\nclass RasterStyleLayer extends StyleLayer {\n _transitionablePaint: Transitionable;\n _transitioningPaint: Transitioning;\n paint: PossiblyEvaluated;\n\n constructor(layer: LayerSpecification) {\n super(layer, properties);\n }\n}\n\nexport default RasterStyleLayer;\n","// @flow\n\nimport StyleLayer from '../style_layer';\nimport type Map from '../../ui/map';\nimport assert from 'assert';\n\ntype CustomRenderMethod = (gl: WebGLRenderingContext, matrix: Array) => void;\n\n/**\n * Interface for custom style layers. This is a specification for\n * implementers to model: it is not an exported method or class.\n *\n * Custom layers allow a user to render directly into the map's GL context using the map's camera.\n * These layers can be added between any regular layers using {@link Map#addLayer}.\n *\n * Custom layers must have a unique `id` and must have the `type` of `\"custom\"`.\n * They must implement `render` and may implement `prerender`, `onAdd` and `onRemove`.\n * They can trigger rendering using {@link Map#triggerRepaint}\n * and they should appropriately handle {@link Map.event:webglcontextlost} and\n * {@link Map.event:webglcontextrestored}.\n *\n * The `renderingMode` property controls whether the layer is treated as a `\"2d\"` or `\"3d\"` map layer. Use:\n * - `\"renderingMode\": \"3d\"` to use the depth buffer and share it with other layers\n * - `\"renderingMode\": \"2d\"` to add a layer with no depth. If you need to use the depth buffer for a `\"2d\"` layer you must use an offscreen\n * framebuffer and {@link CustomLayerInterface#prerender}\n *\n * @interface CustomLayerInterface\n * @property {string} id A unique layer id.\n * @property {string} type The layer's type. Must be `\"custom\"`.\n * @property {string} renderingMode Either `\"2d\"` or `\"3d\"`. Defaults to `\"2d\"`.\n * @example\n * // Custom layer implemented as ES6 class\n * class NullIslandLayer {\n * constructor() {\n * this.id = 'null-island';\n * this.type = 'custom';\n * this.renderingMode = '2d';\n * }\n *\n * onAdd(map, gl) {\n * const vertexSource = `\n * uniform mat4 u_matrix;\n * void main() {\n * gl_Position = u_matrix * vec4(0.5, 0.5, 0.0, 1.0);\n * gl_PointSize = 20.0;\n * }`;\n *\n * const fragmentSource = `\n * void main() {\n * gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n * }`;\n *\n * const vertexShader = gl.createShader(gl.VERTEX_SHADER);\n * gl.shaderSource(vertexShader, vertexSource);\n * gl.compileShader(vertexShader);\n * const fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);\n * gl.shaderSource(fragmentShader, fragmentSource);\n * gl.compileShader(fragmentShader);\n *\n * this.program = gl.createProgram();\n * gl.attachShader(this.program, vertexShader);\n * gl.attachShader(this.program, fragmentShader);\n * gl.linkProgram(this.program);\n * }\n *\n * render(gl, matrix) {\n * gl.useProgram(this.program);\n * gl.uniformMatrix4fv(gl.getUniformLocation(this.program, \"u_matrix\"), false, matrix);\n * gl.drawArrays(gl.POINTS, 0, 1);\n * }\n * }\n *\n * map.on('load', function() {\n * map.addLayer(new NullIslandLayer());\n * });\n */\n\n/**\n * Optional method called when the layer has been added to the Map with {@link Map#addLayer}. This\n * gives the layer a chance to initialize gl resources and register event listeners.\n *\n * @function\n * @memberof CustomLayerInterface\n * @instance\n * @name onAdd\n * @param {Map} map The Map this custom layer was just added to.\n * @param {WebGLRenderingContext} gl The gl context for the map.\n */\n\n/**\n * Optional method called when the layer has been removed from the Map with {@link Map#removeLayer}. This\n * gives the layer a chance to clean up gl resources and event listeners.\n *\n * @function\n * @memberof CustomLayerInterface\n * @instance\n * @name onRemove\n * @param {Map} map The Map this custom layer was just added to.\n * @param {WebGLRenderingContext} gl The gl context for the map.\n */\n\n/**\n * Optional method called during a render frame to allow a layer to prepare resources or render into a texture.\n *\n * The layer cannot make any assumptions about the current GL state and must bind a framebuffer before rendering.\n *\n * @function\n * @memberof CustomLayerInterface\n * @instance\n * @name prerender\n * @param {WebGLRenderingContext} gl The map's gl context.\n * @param {Array} matrix The map's camera matrix. It projects spherical mercator\n * coordinates to gl coordinates. The mercator coordinate `[0, 0]` represents the\n * top left corner of the mercator world and `[1, 1]` represents the bottom right corner. When\n * the `renderingMode` is `\"3d\"`, the z coordinate is conformal. A box with identical x, y, and z\n * lengths in mercator units would be rendered as a cube. {@link MercatorCoordinate}.fromLngLat\n * can be used to project a `LngLat` to a mercator coordinate.\n */\n\n/**\n * Called during a render frame allowing the layer to draw into the GL context.\n *\n * The layer can assume blending and depth state is set to allow the layer to properly\n * blend and clip other layers. The layer cannot make any other assumptions about the\n * current GL state.\n *\n * If the layer needs to render to a texture, it should implement the `prerender` method\n * to do this and only use the `render` method for drawing directly into the main framebuffer.\n *\n * The blend function is set to `gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA)`. This expects\n * colors to be provided in premultiplied alpha form where the `r`, `g` and `b` values are already\n * multiplied by the `a` value. If you are unable to provide colors in premultiplied form you\n * may want to change the blend function to\n * `gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA)`.\n *\n * @function\n * @memberof CustomLayerInterface\n * @instance\n * @name render\n * @param {WebGLRenderingContext} gl The map's gl context.\n * @param {Array} matrix The map's camera matrix. It projects spherical mercator\n * coordinates to gl coordinates. The spherical mercator coordinate `[0, 0]` represents the\n * top left corner of the mercator world and `[1, 1]` represents the bottom right corner. When\n * the `renderingMode` is `\"3d\"`, the z coordinate is conformal. A box with identical x, y, and z\n * lengths in mercator units would be rendered as a cube. {@link MercatorCoordinate}.fromLngLat\n * can be used to project a `LngLat` to a mercator coordinate.\n */\nexport type CustomLayerInterface = {\n id: string,\n type: \"custom\",\n renderingMode: \"2d\" | \"3d\",\n render: CustomRenderMethod,\n prerender: ?CustomRenderMethod,\n onAdd: ?(map: Map, gl: WebGLRenderingContext) => void,\n onRemove: ?(map: Map, gl: WebGLRenderingContext) => void\n}\n\nexport function validateCustomStyleLayer(layerObject: CustomLayerInterface) {\n const errors = [];\n const id = layerObject.id;\n\n if (id === undefined) {\n errors.push({\n message: `layers.${id}: missing required property \"id\"`\n });\n }\n\n if (layerObject.render === undefined) {\n errors.push({\n message: `layers.${id}: missing required method \"render\"`\n });\n }\n\n if (layerObject.renderingMode &&\n layerObject.renderingMode !== '2d' &&\n layerObject.renderingMode !== '3d') {\n errors.push({\n message: `layers.${id}: property \"renderingMode\" must be either \"2d\" or \"3d\"`\n });\n }\n\n return errors;\n}\n\nclass CustomStyleLayer extends StyleLayer {\n\n implementation: CustomLayerInterface;\n\n constructor(implementation: CustomLayerInterface) {\n super(implementation, {});\n this.implementation = implementation;\n }\n\n is3D() {\n return this.implementation.renderingMode === '3d';\n }\n\n hasOffscreenPass() {\n return this.implementation.prerender !== undefined;\n }\n\n recalculate() {}\n updateTransitions() {}\n hasTransition() {}\n\n serialize() {\n assert(false, \"Custom layers cannot be serialized\");\n }\n\n onAdd(map: Map) {\n if (this.implementation.onAdd) {\n this.implementation.onAdd(map, map.painter.context.gl);\n }\n }\n\n onRemove(map: Map) {\n if (this.implementation.onRemove) {\n this.implementation.onRemove(map, map.painter.context.gl);\n }\n }\n}\n\nexport default CustomStyleLayer;\n","// @flow\n\nimport circle from './style_layer/circle_style_layer';\nimport heatmap from './style_layer/heatmap_style_layer';\nimport hillshade from './style_layer/hillshade_style_layer';\nimport fill from './style_layer/fill_style_layer';\nimport fillExtrusion from './style_layer/fill_extrusion_style_layer';\nimport line from './style_layer/line_style_layer';\nimport symbol from './style_layer/symbol_style_layer';\nimport background from './style_layer/background_style_layer';\nimport raster from './style_layer/raster_style_layer';\nimport CustomStyleLayer from './style_layer/custom_style_layer';\nimport type {CustomLayerInterface} from './style_layer/custom_style_layer';\n\nimport type {LayerSpecification} from '../style-spec/types';\n\nconst subclasses = {\n circle,\n heatmap,\n hillshade,\n fill,\n 'fill-extrusion': fillExtrusion,\n line,\n symbol,\n background,\n raster\n};\n\nexport default function createStyleLayer(layer: LayerSpecification | CustomLayerInterface) {\n if (layer.type === 'custom') {\n return new CustomStyleLayer(layer);\n } else {\n return new subclasses[layer.type](layer);\n }\n}\n\n","// @flow\n\nimport window from '../util/window';\nconst {HTMLImageElement, HTMLCanvasElement, HTMLVideoElement, ImageData, ImageBitmap} = window;\n\nimport type Context from '../gl/context';\nimport type {RGBAImage, AlphaImage} from '../util/image';\n\nexport type TextureFormat =\n | $PropertyType\n | $PropertyType;\nexport type TextureFilter =\n | $PropertyType\n | $PropertyType\n | $PropertyType;\nexport type TextureWrap =\n | $PropertyType\n | $PropertyType\n | $PropertyType;\n\ntype EmptyImage = {\n width: number,\n height: number,\n data: null\n}\n\nexport type TextureImage =\n | RGBAImage\n | AlphaImage\n | HTMLImageElement\n | HTMLCanvasElement\n | HTMLVideoElement\n | ImageData\n | EmptyImage\n | ImageBitmap;\n\nclass Texture {\n context: Context;\n size: [number, number];\n texture: WebGLTexture;\n format: TextureFormat;\n filter: ?TextureFilter;\n wrap: ?TextureWrap;\n useMipmap: boolean;\n\n constructor(context: Context, image: TextureImage, format: TextureFormat, options: ?{ premultiply?: boolean, useMipmap?: boolean }) {\n this.context = context;\n this.format = format;\n this.texture = context.gl.createTexture();\n this.update(image, options);\n }\n\n update(image: TextureImage, options: ?{premultiply?: boolean, useMipmap?: boolean}, position?: { x: number, y: number }) {\n const {width, height} = image;\n const resize = (!this.size || this.size[0] !== width || this.size[1] !== height) && !position;\n const {context} = this;\n const {gl} = context;\n\n this.useMipmap = Boolean(options && options.useMipmap);\n gl.bindTexture(gl.TEXTURE_2D, this.texture);\n\n context.pixelStoreUnpackFlipY.set(false);\n context.pixelStoreUnpack.set(1);\n context.pixelStoreUnpackPremultiplyAlpha.set(this.format === gl.RGBA && (!options || options.premultiply !== false));\n\n if (resize) {\n this.size = [width, height];\n\n if (image instanceof HTMLImageElement || image instanceof HTMLCanvasElement || image instanceof HTMLVideoElement || image instanceof ImageData || (ImageBitmap && image instanceof ImageBitmap)) {\n gl.texImage2D(gl.TEXTURE_2D, 0, this.format, this.format, gl.UNSIGNED_BYTE, image);\n } else {\n gl.texImage2D(gl.TEXTURE_2D, 0, this.format, width, height, 0, this.format, gl.UNSIGNED_BYTE, image.data);\n }\n\n } else {\n const {x, y} = position || {x: 0, y: 0};\n if (image instanceof HTMLImageElement || image instanceof HTMLCanvasElement || image instanceof HTMLVideoElement || image instanceof ImageData || (ImageBitmap && image instanceof ImageBitmap)) {\n gl.texSubImage2D(gl.TEXTURE_2D, 0, x, y, gl.RGBA, gl.UNSIGNED_BYTE, image);\n } else {\n gl.texSubImage2D(gl.TEXTURE_2D, 0, x, y, width, height, gl.RGBA, gl.UNSIGNED_BYTE, image.data);\n }\n }\n\n if (this.useMipmap && this.isSizePowerOfTwo()) {\n gl.generateMipmap(gl.TEXTURE_2D);\n }\n }\n\n bind(filter: TextureFilter, wrap: TextureWrap, minFilter: ?TextureFilter) {\n const {context} = this;\n const {gl} = context;\n gl.bindTexture(gl.TEXTURE_2D, this.texture);\n\n if (minFilter === gl.LINEAR_MIPMAP_NEAREST && !this.isSizePowerOfTwo()) {\n minFilter = gl.LINEAR;\n }\n\n if (filter !== this.filter) {\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, minFilter || filter);\n this.filter = filter;\n }\n\n if (wrap !== this.wrap) {\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, wrap);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, wrap);\n this.wrap = wrap;\n }\n }\n\n isSizePowerOfTwo() {\n return this.size[0] === this.size[1] && (Math.log(this.size[0]) / Math.LN2) % 1 === 0;\n }\n\n destroy() {\n const {gl} = this.context;\n gl.deleteTexture(this.texture);\n this.texture = (null: any);\n }\n}\n\nexport default Texture;\n","// @flow\n\n/**\n * Invokes the wrapped function in a non-blocking way when trigger() is called. Invocation requests\n * are ignored until the function was actually invoked.\n *\n * @private\n */\nclass ThrottledInvoker {\n _channel: MessageChannel;\n _triggered: boolean;\n _callback: Function\n\n constructor(callback: Function) {\n this._callback = callback;\n this._triggered = false;\n if (typeof MessageChannel !== 'undefined') {\n this._channel = new MessageChannel();\n this._channel.port2.onmessage = () => {\n this._triggered = false;\n this._callback();\n };\n }\n }\n\n trigger() {\n if (!this._triggered) {\n this._triggered = true;\n if (this._channel) {\n this._channel.port1.postMessage(true);\n } else {\n setTimeout(() => {\n this._triggered = false;\n this._callback();\n }, 0);\n }\n }\n }\n\n remove() {\n delete this._channel;\n this._callback = () => {};\n }\n}\n\nexport default ThrottledInvoker;\n","// @flow\n\nimport {bindAll, isWorker, isSafari} from './util';\nimport window from './window';\nimport {serialize, deserialize} from './web_worker_transfer';\nimport ThrottledInvoker from './throttled_invoker';\n\nimport type {Transferable} from '../types/transferable';\nimport type {Cancelable} from '../types/cancelable';\n\n/**\n * An implementation of the [Actor design pattern](http://en.wikipedia.org/wiki/Actor_model)\n * that maintains the relationship between asynchronous tasks and the objects\n * that spin them off - in this case, tasks like parsing parts of styles,\n * owned by the styles\n *\n * @param {WebWorker} target\n * @param {WebWorker} parent\n * @param {string|number} mapId A unique identifier for the Map instance using this Actor.\n * @private\n */\nclass Actor {\n target: any;\n parent: any;\n mapId: ?number;\n callbacks: { number: any };\n name: string;\n tasks: { number: any };\n taskQueue: Array;\n cancelCallbacks: { number: Cancelable };\n invoker: ThrottledInvoker;\n globalScope: any;\n\n constructor(target: any, parent: any, mapId: ?number) {\n this.target = target;\n this.parent = parent;\n this.mapId = mapId;\n this.callbacks = {};\n this.tasks = {};\n this.taskQueue = [];\n this.cancelCallbacks = {};\n bindAll(['receive', 'process'], this);\n this.invoker = new ThrottledInvoker(this.process);\n this.target.addEventListener('message', this.receive, false);\n this.globalScope = isWorker() ? target : window;\n }\n\n /**\n * Sends a message from a main-thread map to a Worker or from a Worker back to\n * a main-thread map instance.\n *\n * @param type The name of the target method to invoke or '[source-type].[source-name].name' for a method on a WorkerSource.\n * @param targetMapId A particular mapId to which to send this message.\n * @private\n */\n send(type: string, data: mixed, callback: ?Function, targetMapId: ?string, mustQueue: boolean = false): ?Cancelable {\n // We're using a string ID instead of numbers because they are being used as object keys\n // anyway, and thus stringified implicitly. We use random IDs because an actor may receive\n // message from multiple other actors which could run in different execution context. A\n // linearly increasing ID could produce collisions.\n const id = Math.round((Math.random() * 1e18)).toString(36).substring(0, 10);\n if (callback) {\n this.callbacks[id] = callback;\n }\n const buffers: ?Array = isSafari(this.globalScope) ? undefined : [];\n this.target.postMessage({\n id,\n type,\n hasCallback: !!callback,\n targetMapId,\n mustQueue,\n sourceMapId: this.mapId,\n data: serialize(data, buffers)\n }, buffers);\n return {\n cancel: () => {\n if (callback) {\n // Set the callback to null so that it never fires after the request is aborted.\n delete this.callbacks[id];\n }\n this.target.postMessage({\n id,\n type: '',\n targetMapId,\n sourceMapId: this.mapId\n });\n }\n };\n }\n\n receive(message: Object) {\n const data = message.data,\n id = data.id;\n\n if (!id) {\n return;\n }\n\n if (data.targetMapId && this.mapId !== data.targetMapId) {\n return;\n }\n\n if (data.type === '') {\n // Remove the original request from the queue. This is only possible if it\n // hasn't been kicked off yet. The id will remain in the queue, but because\n // there is no associated task, it will be dropped once it's time to execute it.\n delete this.tasks[id];\n const cancel = this.cancelCallbacks[id];\n delete this.cancelCallbacks[id];\n if (cancel) {\n cancel();\n }\n } else {\n if (isWorker() || data.mustQueue) {\n // In workers, store the tasks that we need to process before actually processing them. This\n // is necessary because we want to keep receiving messages, and in particular,\n // messages. Some tasks may take a while in the worker thread, so before\n // executing the next task in our queue, postMessage preempts this and \n // messages can be processed. We're using a MessageChannel object to get throttle the\n // process() flow to one at a time.\n this.tasks[id] = data;\n this.taskQueue.push(id);\n this.invoker.trigger();\n } else {\n // In the main thread, process messages immediately so that other work does not slip in\n // between getting partial data back from workers.\n this.processTask(id, data);\n }\n }\n }\n\n process() {\n if (!this.taskQueue.length) {\n return;\n }\n const id = this.taskQueue.shift();\n const task = this.tasks[id];\n delete this.tasks[id];\n // Schedule another process call if we know there's more to process _before_ invoking the\n // current task. This is necessary so that processing continues even if the current task\n // doesn't execute successfully.\n if (this.taskQueue.length) {\n this.invoker.trigger();\n }\n if (!task) {\n // If the task ID doesn't have associated task data anymore, it was canceled.\n return;\n }\n\n this.processTask(id, task);\n }\n\n processTask(id: number, task: any) {\n if (task.type === '') {\n // The done() function in the counterpart has been called, and we are now\n // firing the callback in the originating actor, if there is one.\n const callback = this.callbacks[id];\n delete this.callbacks[id];\n if (callback) {\n // If we get a response, but don't have a callback, the request was canceled.\n if (task.error) {\n callback(deserialize(task.error));\n } else {\n callback(null, deserialize(task.data));\n }\n }\n } else {\n let completed = false;\n const buffers: ?Array = isSafari(this.globalScope) ? undefined : [];\n const done = task.hasCallback ? (err, data) => {\n completed = true;\n delete this.cancelCallbacks[id];\n this.target.postMessage({\n id,\n type: '',\n sourceMapId: this.mapId,\n error: err ? serialize(err) : null,\n data: serialize(data, buffers)\n }, buffers);\n } : (_) => {\n completed = true;\n };\n\n let callback = null;\n const params = (deserialize(task.data): any);\n if (this.parent[task.type]) {\n // task.type == 'loadTile', 'removeTile', etc.\n callback = this.parent[task.type](task.sourceMapId, params, done);\n } else if (this.parent.getWorkerSource) {\n // task.type == sourcetype.method\n const keys = task.type.split('.');\n const scope = (this.parent: any).getWorkerSource(task.sourceMapId, keys[0], params.source);\n callback = scope[keys[1]](params, done);\n } else {\n // No function was found.\n done(new Error(`Could not find function ${task.type}`));\n }\n\n if (!completed && callback && callback.cancel) {\n // Allows canceling the task as long as it hasn't been completed yet.\n this.cancelCallbacks[id] = callback.cancel;\n }\n }\n }\n\n remove() {\n this.invoker.remove();\n this.target.removeEventListener('message', this.receive, false);\n }\n}\n\nexport default Actor;\n","export { getURL, getTileBBox, getMercCoords };\n\n\n/**\n * getURL\n *\n * @param {String} baseUrl Base url of the WMS server\n * @param {String} layer Layer name\n * @param {Number} x Tile coordinate x\n * @param {Number} y Tile coordinate y\n * @param {Number} z Tile zoom\n * @param {Object} [options]\n * @param {String} [options.format='image/png']\n * @param {String} [options.service='WMS']\n * @param {String} [options.version='1.1.1']\n * @param {String} [options.request='GetMap']\n * @param {String} [options.srs='EPSG:3857']\n * @param {Number} [options.width='256']\n * @param {Number} [options.height='256']\n * @returns {String} url\n * @example\n * var baseUrl = 'http://geodata.state.nj.us/imagerywms/Natural2015';\n * var layer = 'Natural2015';\n * var url = whoots.getURL(baseUrl, layer, 154308, 197167, 19);\n */\nfunction getURL(baseUrl, layer, x, y, z, options) {\n options = options || {};\n\n var url = baseUrl + '?' + [\n 'bbox=' + getTileBBox(x, y, z),\n 'format=' + (options.format || 'image/png'),\n 'service=' + (options.service || 'WMS'),\n 'version=' + (options.version || '1.1.1'),\n 'request=' + (options.request || 'GetMap'),\n 'srs=' + (options.srs || 'EPSG:3857'),\n 'width=' + (options.width || 256),\n 'height=' + (options.height || 256),\n 'layers=' + layer\n ].join('&');\n\n return url;\n}\n\n\n/**\n * getTileBBox\n *\n * @param {Number} x Tile coordinate x\n * @param {Number} y Tile coordinate y\n * @param {Number} z Tile zoom\n * @returns {String} String of the bounding box\n */\nfunction getTileBBox(x, y, z) {\n // for Google/OSM tile scheme we need to alter the y\n y = (Math.pow(2, z) - y - 1);\n\n var min = getMercCoords(x * 256, y * 256, z),\n max = getMercCoords((x + 1) * 256, (y + 1) * 256, z);\n\n return min[0] + ',' + min[1] + ',' + max[0] + ',' + max[1];\n}\n\n\n/**\n * getMercCoords\n *\n * @param {Number} x Pixel coordinate x\n * @param {Number} y Pixel coordinate y\n * @param {Number} z Tile zoom\n * @returns {Array} [x, y]\n */\nfunction getMercCoords(x, y, z) {\n var resolution = (2 * Math.PI * 6378137 / 256) / Math.pow(2, z),\n merc_x = (x * resolution - 2 * Math.PI * 6378137 / 2.0),\n merc_y = (y * resolution - 2 * Math.PI * 6378137 / 2.0);\n\n return [merc_x, merc_y];\n}\n","// @flow\n\nimport LngLat from './lng_lat';\n\nimport type {LngLatLike} from './lng_lat';\n\n/**\n * A `LngLatBounds` object represents a geographical bounding box,\n * defined by its southwest and northeast points in longitude and latitude.\n *\n * If no arguments are provided to the constructor, a `null` bounding box is created.\n *\n * Note that any Mapbox GL method that accepts a `LngLatBounds` object as an argument or option\n * can also accept an `Array` of two {@link LngLatLike} constructs and will perform an implicit conversion.\n * This flexible type is documented as {@link LngLatBoundsLike}.\n *\n * @param {LngLatLike} [sw] The southwest corner of the bounding box.\n * @param {LngLatLike} [ne] The northeast corner of the bounding box.\n * @example\n * var sw = new maplibregl.LngLat(-73.9876, 40.7661);\n * var ne = new maplibregl.LngLat(-73.9397, 40.8002);\n * var llb = new maplibregl.LngLatBounds(sw, ne);\n */\nclass LngLatBounds {\n _ne: LngLat;\n _sw: LngLat;\n\n // This constructor is too flexible to type. It should not be so flexible.\n constructor(sw: any, ne: any) {\n if (!sw) {\n // noop\n } else if (ne) {\n this.setSouthWest(sw).setNorthEast(ne);\n } else if (sw.length === 4) {\n this.setSouthWest([sw[0], sw[1]]).setNorthEast([sw[2], sw[3]]);\n } else {\n this.setSouthWest(sw[0]).setNorthEast(sw[1]);\n }\n }\n\n /**\n * Set the northeast corner of the bounding box\n *\n * @param {LngLatLike} ne a {@link LngLatLike} object describing the northeast corner of the bounding box.\n * @returns {LngLatBounds} `this`\n */\n setNorthEast(ne: LngLatLike) {\n this._ne = ne instanceof LngLat ? new LngLat(ne.lng, ne.lat) : LngLat.convert(ne);\n return this;\n }\n\n /**\n * Set the southwest corner of the bounding box\n *\n * @param {LngLatLike} sw a {@link LngLatLike} object describing the southwest corner of the bounding box.\n * @returns {LngLatBounds} `this`\n */\n setSouthWest(sw: LngLatLike) {\n this._sw = sw instanceof LngLat ? new LngLat(sw.lng, sw.lat) : LngLat.convert(sw);\n return this;\n }\n\n /**\n * Extend the bounds to include a given LngLatLike or LngLatBoundsLike.\n *\n * @param {LngLatLike|LngLatBoundsLike} obj object to extend to\n * @returns {LngLatBounds} `this`\n */\n extend(obj: LngLatLike | LngLatBoundsLike) {\n const sw = this._sw,\n ne = this._ne;\n let sw2, ne2;\n\n if (obj instanceof LngLat) {\n sw2 = obj;\n ne2 = obj;\n\n } else if (obj instanceof LngLatBounds) {\n sw2 = obj._sw;\n ne2 = obj._ne;\n\n if (!sw2 || !ne2) return this;\n\n } else {\n if (Array.isArray(obj)) {\n if (obj.length === 4 || obj.every(Array.isArray)) {\n const lngLatBoundsObj = ((obj: any): LngLatBoundsLike);\n return this.extend(LngLatBounds.convert(lngLatBoundsObj));\n } else {\n const lngLatObj = ((obj: any): LngLatLike);\n return this.extend(LngLat.convert(lngLatObj));\n }\n }\n return this;\n }\n\n if (!sw && !ne) {\n this._sw = new LngLat(sw2.lng, sw2.lat);\n this._ne = new LngLat(ne2.lng, ne2.lat);\n\n } else {\n sw.lng = Math.min(sw2.lng, sw.lng);\n sw.lat = Math.min(sw2.lat, sw.lat);\n ne.lng = Math.max(ne2.lng, ne.lng);\n ne.lat = Math.max(ne2.lat, ne.lat);\n }\n\n return this;\n }\n\n /**\n * Returns the geographical coordinate equidistant from the bounding box's corners.\n *\n * @returns {LngLat} The bounding box's center.\n * @example\n * var llb = new maplibregl.LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]);\n * llb.getCenter(); // = LngLat {lng: -73.96365, lat: 40.78315}\n */\n getCenter(): LngLat {\n return new LngLat((this._sw.lng + this._ne.lng) / 2, (this._sw.lat + this._ne.lat) / 2);\n }\n\n /**\n * Returns the southwest corner of the bounding box.\n *\n * @returns {LngLat} The southwest corner of the bounding box.\n */\n getSouthWest(): LngLat { return this._sw; }\n\n /**\n * Returns the northeast corner of the bounding box.\n *\n * @returns {LngLat} The northeast corner of the bounding box.\n */\n getNorthEast(): LngLat { return this._ne; }\n\n /**\n * Returns the northwest corner of the bounding box.\n *\n * @returns {LngLat} The northwest corner of the bounding box.\n */\n getNorthWest(): LngLat { return new LngLat(this.getWest(), this.getNorth()); }\n\n /**\n * Returns the southeast corner of the bounding box.\n *\n * @returns {LngLat} The southeast corner of the bounding box.\n */\n getSouthEast(): LngLat { return new LngLat(this.getEast(), this.getSouth()); }\n\n /**\n * Returns the west edge of the bounding box.\n *\n * @returns {number} The west edge of the bounding box.\n */\n getWest(): number { return this._sw.lng; }\n\n /**\n * Returns the south edge of the bounding box.\n *\n * @returns {number} The south edge of the bounding box.\n */\n getSouth(): number { return this._sw.lat; }\n\n /**\n * Returns the east edge of the bounding box.\n *\n * @returns {number} The east edge of the bounding box.\n */\n getEast(): number { return this._ne.lng; }\n\n /**\n * Returns the north edge of the bounding box.\n *\n * @returns {number} The north edge of the bounding box.\n */\n getNorth(): number { return this._ne.lat; }\n\n /**\n * Returns the bounding box represented as an array.\n *\n * @returns {Array>} The bounding box represented as an array, consisting of the\n * southwest and northeast coordinates of the bounding represented as arrays of numbers.\n * @example\n * var llb = new maplibregl.LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]);\n * llb.toArray(); // = [[-73.9876, 40.7661], [-73.9397, 40.8002]]\n */\n toArray() {\n return [this._sw.toArray(), this._ne.toArray()];\n }\n\n /**\n * Return the bounding box represented as a string.\n *\n * @returns {string} The bounding box represents as a string of the format\n * `'LngLatBounds(LngLat(lng, lat), LngLat(lng, lat))'`.\n * @example\n * var llb = new maplibregl.LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]);\n * llb.toString(); // = \"LngLatBounds(LngLat(-73.9876, 40.7661), LngLat(-73.9397, 40.8002))\"\n */\n toString() {\n return `LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`;\n }\n\n /**\n * Check if the bounding box is an empty/`null`-type box.\n *\n * @returns {boolean} True if bounds have been defined, otherwise false.\n */\n isEmpty() {\n return !(this._sw && this._ne);\n }\n\n /**\n * Check if the point is within the bounding box.\n *\n * @param {LngLatLike} lnglat geographic point to check against.\n * @returns {boolean} True if the point is within the bounding box.\n * @example\n * var llb = new maplibregl.LngLatBounds(\n * new maplibregl.LngLat(-73.9876, 40.7661),\n * new maplibregl.LngLat(-73.9397, 40.8002)\n * );\n *\n * var ll = new maplibregl.LngLat(-73.9567, 40.7789);\n *\n * console.log(llb.contains(ll)); // = true\n */\n contains(lnglat: LngLatLike) {\n const {lng, lat} = LngLat.convert(lnglat);\n\n const containsLatitude = this._sw.lat <= lat && lat <= this._ne.lat;\n let containsLongitude = this._sw.lng <= lng && lng <= this._ne.lng;\n if (this._sw.lng > this._ne.lng) { // wrapped coordinates\n containsLongitude = this._sw.lng >= lng && lng >= this._ne.lng;\n }\n\n return containsLatitude && containsLongitude;\n }\n\n /**\n * Converts an array to a `LngLatBounds` object.\n *\n * If a `LngLatBounds` object is passed in, the function returns it unchanged.\n *\n * Internally, the function calls `LngLat#convert` to convert arrays to `LngLat` values.\n *\n * @param {LngLatBoundsLike} input An array of two coordinates to convert, or a `LngLatBounds` object to return.\n * @returns {LngLatBounds} A new `LngLatBounds` object, if a conversion occurred, or the original `LngLatBounds` object.\n * @example\n * var arr = [[-73.9876, 40.7661], [-73.9397, 40.8002]];\n * var llb = maplibregl.LngLatBounds.convert(arr);\n * llb; // = LngLatBounds {_sw: LngLat {lng: -73.9876, lat: 40.7661}, _ne: LngLat {lng: -73.9397, lat: 40.8002}}\n */\n static convert(input: LngLatBoundsLike): LngLatBounds {\n if (!input || input instanceof LngLatBounds) return input;\n return new LngLatBounds(input);\n }\n}\n\n/**\n * A {@link LngLatBounds} object, an array of {@link LngLatLike} objects in [sw, ne] order,\n * or an array of numbers in [west, south, east, north] order.\n *\n * @typedef {LngLatBounds | [LngLatLike, LngLatLike] | [number, number, number, number]} LngLatBoundsLike\n * @example\n * var v1 = new maplibregl.LngLatBounds(\n * new maplibregl.LngLat(-73.9876, 40.7661),\n * new maplibregl.LngLat(-73.9397, 40.8002)\n * );\n * var v2 = new maplibregl.LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002])\n * var v3 = [[-73.9876, 40.7661], [-73.9397, 40.8002]];\n */\nexport type LngLatBoundsLike = LngLatBounds | [LngLatLike, LngLatLike] | [number, number, number, number];\n\nexport default LngLatBounds;\n","// @flow\n\nimport {wrap} from '../util/util';\nimport LngLatBounds from './lng_lat_bounds';\n\n/*\n* Approximate radius of the earth in meters.\n* Uses the WGS-84 approximation. The radius at the equator is ~6378137 and at the poles is ~6356752. https://en.wikipedia.org/wiki/World_Geodetic_System#WGS84\n* 6371008.8 is one published \"average radius\" see https://en.wikipedia.org/wiki/Earth_radius#Mean_radius, or ftp://athena.fsv.cvut.cz/ZFG/grs80-Moritz.pdf p.4\n*/\nexport const earthRadius = 6371008.8;\n\n/**\n * A `LngLat` object represents a given longitude and latitude coordinate, measured in degrees.\n * These coordinates are based on the [WGS84 (EPSG:4326) standard](https://en.wikipedia.org/wiki/World_Geodetic_System#WGS84).\n *\n * Mapbox GL uses longitude, latitude coordinate order (as opposed to latitude, longitude) to match the\n * [GeoJSON specification](https://tools.ietf.org/html/rfc7946).\n *\n * Note that any Mapbox GL method that accepts a `LngLat` object as an argument or option\n * can also accept an `Array` of two numbers and will perform an implicit conversion.\n * This flexible type is documented as {@link LngLatLike}.\n *\n * @param {number} lng Longitude, measured in degrees.\n * @param {number} lat Latitude, measured in degrees.\n * @example\n * var ll = new maplibregl.LngLat(-123.9749, 40.7736);\n * ll.lng; // = -123.9749\n * @see [Get coordinates of the mouse pointer](https://maplibre.org/maplibre-gl-js-docs/example/mouse-position/)\n * @see [Display a popup](https://maplibre.org/maplibre-gl-js-docs/example/popup/)\n * @see [Create a timeline animation](https://maplibre.org/maplibre-gl-js-docs/example/timeline-animation/)\n */\nclass LngLat {\n lng: number;\n lat: number;\n\n constructor(lng: number, lat: number) {\n if (isNaN(lng) || isNaN(lat)) {\n throw new Error(`Invalid LngLat object: (${lng}, ${lat})`);\n }\n this.lng = +lng;\n this.lat = +lat;\n if (this.lat > 90 || this.lat < -90) {\n throw new Error('Invalid LngLat latitude value: must be between -90 and 90');\n }\n }\n\n /**\n * Returns a new `LngLat` object whose longitude is wrapped to the range (-180, 180).\n *\n * @returns {LngLat} The wrapped `LngLat` object.\n * @example\n * var ll = new maplibregl.LngLat(286.0251, 40.7736);\n * var wrapped = ll.wrap();\n * wrapped.lng; // = -73.9749\n */\n wrap() {\n return new LngLat(wrap(this.lng, -180, 180), this.lat);\n }\n\n /**\n * Returns the coordinates represented as an array of two numbers.\n *\n * @returns {Array} The coordinates represeted as an array of longitude and latitude.\n * @example\n * var ll = new maplibregl.LngLat(-73.9749, 40.7736);\n * ll.toArray(); // = [-73.9749, 40.7736]\n */\n toArray() {\n return [this.lng, this.lat];\n }\n\n /**\n * Returns the coordinates represent as a string.\n *\n * @returns {string} The coordinates represented as a string of the format `'LngLat(lng, lat)'`.\n * @example\n * var ll = new maplibregl.LngLat(-73.9749, 40.7736);\n * ll.toString(); // = \"LngLat(-73.9749, 40.7736)\"\n */\n toString() {\n return `LngLat(${this.lng}, ${this.lat})`;\n }\n\n /**\n * Returns the approximate distance between a pair of coordinates in meters\n * Uses the Haversine Formula (from R.W. Sinnott, \"Virtues of the Haversine\", Sky and Telescope, vol. 68, no. 2, 1984, p. 159)\n *\n * @param {LngLat} lngLat coordinates to compute the distance to\n * @returns {number} Distance in meters between the two coordinates.\n * @example\n * var new_york = new maplibregl.LngLat(-74.0060, 40.7128);\n * var los_angeles = new maplibregl.LngLat(-118.2437, 34.0522);\n * new_york.distanceTo(los_angeles); // = 3935751.690893987, \"true distance\" using a non-spherical approximation is ~3966km\n */\n distanceTo(lngLat: LngLat) {\n const rad = Math.PI / 180;\n const lat1 = this.lat * rad;\n const lat2 = lngLat.lat * rad;\n const a = Math.sin(lat1) * Math.sin(lat2) + Math.cos(lat1) * Math.cos(lat2) * Math.cos((lngLat.lng - this.lng) * rad);\n\n const maxMeters = earthRadius * Math.acos(Math.min(a, 1));\n return maxMeters;\n }\n\n /**\n * Returns a `LngLatBounds` from the coordinates extended by a given `radius`. The returned `LngLatBounds` completely contains the `radius`.\n *\n * @param {number} [radius=0] Distance in meters from the coordinates to extend the bounds.\n * @returns {LngLatBounds} A new `LngLatBounds` object representing the coordinates extended by the `radius`.\n * @example\n * var ll = new maplibregl.LngLat(-73.9749, 40.7736);\n * ll.toBounds(100).toArray(); // = [[-73.97501862141328, 40.77351016847229], [-73.97478137858673, 40.77368983152771]]\n */\n toBounds(radius?: number = 0) {\n const earthCircumferenceInMetersAtEquator = 40075017;\n const latAccuracy = 360 * radius / earthCircumferenceInMetersAtEquator,\n lngAccuracy = latAccuracy / Math.cos((Math.PI / 180) * this.lat);\n\n return new LngLatBounds(new LngLat(this.lng - lngAccuracy, this.lat - latAccuracy),\n new LngLat(this.lng + lngAccuracy, this.lat + latAccuracy));\n }\n\n /**\n * Converts an array of two numbers or an object with `lng` and `lat` or `lon` and `lat` properties\n * to a `LngLat` object.\n *\n * If a `LngLat` object is passed in, the function returns it unchanged.\n *\n * @param {LngLatLike} input An array of two numbers or object to convert, or a `LngLat` object to return.\n * @returns {LngLat} A new `LngLat` object, if a conversion occurred, or the original `LngLat` object.\n * @example\n * var arr = [-73.9749, 40.7736];\n * var ll = maplibregl.LngLat.convert(arr);\n * ll; // = LngLat {lng: -73.9749, lat: 40.7736}\n */\n static convert(input: LngLatLike): LngLat {\n if (input instanceof LngLat) {\n return input;\n }\n if (Array.isArray(input) && (input.length === 2 || input.length === 3)) {\n return new LngLat(Number(input[0]), Number(input[1]));\n }\n if (!Array.isArray(input) && typeof input === 'object' && input !== null) {\n return new LngLat(\n // flow can't refine this to have one of lng or lat, so we have to cast to any\n Number('lng' in input ? (input: any).lng : (input: any).lon),\n Number(input.lat)\n );\n }\n throw new Error(\"`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]\");\n }\n}\n\n/**\n * A {@link LngLat} object, an array of two numbers representing longitude and latitude,\n * or an object with `lng` and `lat` or `lon` and `lat` properties.\n *\n * @typedef {LngLat | {lng: number, lat: number} | {lon: number, lat: number} | [number, number]} LngLatLike\n * @example\n * var v1 = new maplibregl.LngLat(-122.420679, 37.772537);\n * var v2 = [-122.420679, 37.772537];\n * var v3 = {lon: -122.420679, lat: 37.772537};\n */\nexport type LngLatLike = LngLat | {lng: number, lat: number} | {lon: number, lat: number} | [number, number];\n\nexport default LngLat;\n","// @flow\n\nimport LngLat, {earthRadius} from '../geo/lng_lat';\nimport type {LngLatLike} from '../geo/lng_lat';\n\n/*\n * The average circumference of the world in meters.\n */\nconst earthCircumfrence = 2 * Math.PI * earthRadius; // meters\n\n/*\n * The circumference at a line of latitude in meters.\n */\nfunction circumferenceAtLatitude(latitude: number) {\n return earthCircumfrence * Math.cos(latitude * Math.PI / 180);\n}\n\nexport function mercatorXfromLng(lng: number) {\n return (180 + lng) / 360;\n}\n\nexport function mercatorYfromLat(lat: number) {\n return (180 - (180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + lat * Math.PI / 360)))) / 360;\n}\n\nexport function mercatorZfromAltitude(altitude: number, lat: number) {\n return altitude / circumferenceAtLatitude(lat);\n}\n\nexport function lngFromMercatorX(x: number) {\n return x * 360 - 180;\n}\n\nexport function latFromMercatorY(y: number) {\n const y2 = 180 - y * 360;\n return 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90;\n}\n\nexport function altitudeFromMercatorZ(z: number, y: number) {\n return z * circumferenceAtLatitude(latFromMercatorY(y));\n}\n\n/**\n * Determine the Mercator scale factor for a given latitude, see\n * https://en.wikipedia.org/wiki/Mercator_projection#Scale_factor\n *\n * At the equator the scale factor will be 1, which increases at higher latitudes.\n *\n * @param {number} lat Latitude\n * @returns {number} scale factor\n * @private\n */\nexport function mercatorScale(lat: number) {\n return 1 / Math.cos(lat * Math.PI / 180);\n}\n\n/**\n * A `MercatorCoordinate` object represents a projected three dimensional position.\n *\n * `MercatorCoordinate` uses the web mercator projection ([EPSG:3857](https://epsg.io/3857)) with slightly different units:\n * - the size of 1 unit is the width of the projected world instead of the \"mercator meter\"\n * - the origin of the coordinate space is at the north-west corner instead of the middle\n *\n * For example, `MercatorCoordinate(0, 0, 0)` is the north-west corner of the mercator world and\n * `MercatorCoordinate(1, 1, 0)` is the south-east corner. If you are familiar with\n * [vector tiles](https://github.com/mapbox/vector-tile-spec) it may be helpful to think\n * of the coordinate space as the `0/0/0` tile with an extent of `1`.\n *\n * The `z` dimension of `MercatorCoordinate` is conformal. A cube in the mercator coordinate space would be rendered as a cube.\n *\n * @param {number} x The x component of the position.\n * @param {number} y The y component of the position.\n * @param {number} z The z component of the position.\n * @example\n * var nullIsland = new maplibregl.MercatorCoordinate(0.5, 0.5, 0);\n *\n * @see [Add a custom style layer](https://maplibre.org/maplibre-gl-js-docs/example/custom-style-layer/)\n */\nclass MercatorCoordinate {\n x: number;\n y: number;\n z: number;\n\n constructor(x: number, y: number, z: number = 0) {\n this.x = +x;\n this.y = +y;\n this.z = +z;\n }\n\n /**\n * Project a `LngLat` to a `MercatorCoordinate`.\n *\n * @param {LngLatLike} lngLatLike The location to project.\n * @param {number} altitude The altitude in meters of the position.\n * @returns {MercatorCoordinate} The projected mercator coordinate.\n * @example\n * var coord = maplibregl.MercatorCoordinate.fromLngLat({ lng: 0, lat: 0}, 0);\n * coord; // MercatorCoordinate(0.5, 0.5, 0)\n */\n static fromLngLat(lngLatLike: LngLatLike, altitude: number = 0) {\n const lngLat = LngLat.convert(lngLatLike);\n\n return new MercatorCoordinate(\n mercatorXfromLng(lngLat.lng),\n mercatorYfromLat(lngLat.lat),\n mercatorZfromAltitude(altitude, lngLat.lat));\n }\n\n /**\n * Returns the `LngLat` for the coordinate.\n *\n * @returns {LngLat} The `LngLat` object.\n * @example\n * var coord = new maplibregl.MercatorCoordinate(0.5, 0.5, 0);\n * var lngLat = coord.toLngLat(); // LngLat(0, 0)\n */\n toLngLat() {\n return new LngLat(\n lngFromMercatorX(this.x),\n latFromMercatorY(this.y));\n }\n\n /**\n * Returns the altitude in meters of the coordinate.\n *\n * @returns {number} The altitude in meters.\n * @example\n * var coord = new maplibregl.MercatorCoordinate(0, 0, 0.02);\n * coord.toAltitude(); // 6914.281956295339\n */\n toAltitude() {\n return altitudeFromMercatorZ(this.z, this.y);\n }\n\n /**\n * Returns the distance of 1 meter in `MercatorCoordinate` units at this latitude.\n *\n * For coordinates in real world units using meters, this naturally provides the scale\n * to transform into `MercatorCoordinate`s.\n *\n * @returns {number} Distance of 1 meter in `MercatorCoordinate` units.\n */\n meterInMercatorCoordinateUnits() {\n // 1 meter / circumference at equator in meters * Mercator projection scale factor at this latitude\n return 1 / earthCircumfrence * mercatorScale(latFromMercatorY(this.y));\n }\n\n}\n\nexport default MercatorCoordinate;\n","// @flow\n\nimport {getTileBBox} from '@mapbox/whoots-js';\nimport EXTENT from '../data/extent';\nimport Point from '@mapbox/point-geometry';\nimport MercatorCoordinate from '../geo/mercator_coordinate';\n\nimport assert from 'assert';\nimport {register} from '../util/web_worker_transfer';\n\nexport class CanonicalTileID {\n z: number;\n x: number;\n y: number;\n key: string;\n\n constructor(z: number, x: number, y: number) {\n assert(z >= 0 && z <= 25);\n assert(x >= 0 && x < Math.pow(2, z));\n assert(y >= 0 && y < Math.pow(2, z));\n this.z = z;\n this.x = x;\n this.y = y;\n this.key = calculateKey(0, z, z, x, y);\n }\n\n equals(id: CanonicalTileID) {\n return this.z === id.z && this.x === id.x && this.y === id.y;\n }\n\n // given a list of urls, choose a url template and return a tile URL\n url(urls: Array, scheme: ?string) {\n const bbox = getTileBBox(this.x, this.y, this.z);\n const quadkey = getQuadkey(this.z, this.x, this.y);\n\n return urls[(this.x + this.y) % urls.length]\n .replace('{prefix}', (this.x % 16).toString(16) + (this.y % 16).toString(16))\n .replace('{z}', String(this.z))\n .replace('{x}', String(this.x))\n .replace('{y}', String(scheme === 'tms' ? (Math.pow(2, this.z) - this.y - 1) : this.y))\n .replace('{quadkey}', quadkey)\n .replace('{bbox-epsg-3857}', bbox);\n }\n\n getTilePoint(coord: MercatorCoordinate) {\n const tilesAtZoom = Math.pow(2, this.z);\n return new Point(\n (coord.x * tilesAtZoom - this.x) * EXTENT,\n (coord.y * tilesAtZoom - this.y) * EXTENT);\n }\n\n toString() {\n return `${this.z}/${this.x}/${this.y}`;\n }\n}\n\nexport class UnwrappedTileID {\n wrap: number;\n canonical: CanonicalTileID;\n key: string;\n\n constructor(wrap: number, canonical: CanonicalTileID) {\n this.wrap = wrap;\n this.canonical = canonical;\n this.key = calculateKey(wrap, canonical.z, canonical.z, canonical.x, canonical.y);\n }\n}\n\nexport class OverscaledTileID {\n overscaledZ: number;\n wrap: number;\n canonical: CanonicalTileID;\n key: string;\n posMatrix: Float32Array;\n\n constructor(overscaledZ: number, wrap: number, z: number, x: number, y: number) {\n assert(overscaledZ >= z);\n this.overscaledZ = overscaledZ;\n this.wrap = wrap;\n this.canonical = new CanonicalTileID(z, +x, +y);\n this.key = calculateKey(wrap, overscaledZ, z, x, y);\n }\n\n equals(id: OverscaledTileID) {\n return this.overscaledZ === id.overscaledZ && this.wrap === id.wrap && this.canonical.equals(id.canonical);\n }\n\n scaledTo(targetZ: number) {\n assert(targetZ <= this.overscaledZ);\n const zDifference = this.canonical.z - targetZ;\n if (targetZ > this.canonical.z) {\n return new OverscaledTileID(targetZ, this.wrap, this.canonical.z, this.canonical.x, this.canonical.y);\n } else {\n return new OverscaledTileID(targetZ, this.wrap, targetZ, this.canonical.x >> zDifference, this.canonical.y >> zDifference);\n }\n }\n\n /*\n * calculateScaledKey is an optimization:\n * when withWrap == true, implements the same as this.scaledTo(z).key,\n * when withWrap == false, implements the same as this.scaledTo(z).wrapped().key.\n */\n calculateScaledKey(targetZ: number, withWrap: boolean): string {\n assert(targetZ <= this.overscaledZ);\n const zDifference = this.canonical.z - targetZ;\n if (targetZ > this.canonical.z) {\n return calculateKey(this.wrap * +withWrap, targetZ, this.canonical.z, this.canonical.x, this.canonical.y);\n } else {\n return calculateKey(this.wrap * +withWrap, targetZ, targetZ, this.canonical.x >> zDifference, this.canonical.y >> zDifference);\n }\n }\n\n isChildOf(parent: OverscaledTileID) {\n if (parent.wrap !== this.wrap) {\n // We can't be a child if we're in a different world copy\n return false;\n }\n const zDifference = this.canonical.z - parent.canonical.z;\n // We're first testing for z == 0, to avoid a 32 bit shift, which is undefined.\n return parent.overscaledZ === 0 || (\n parent.overscaledZ < this.overscaledZ &&\n parent.canonical.x === (this.canonical.x >> zDifference) &&\n parent.canonical.y === (this.canonical.y >> zDifference));\n }\n\n children(sourceMaxZoom: number) {\n if (this.overscaledZ >= sourceMaxZoom) {\n // return a single tile coord representing a an overscaled tile\n return [new OverscaledTileID(this.overscaledZ + 1, this.wrap, this.canonical.z, this.canonical.x, this.canonical.y)];\n }\n\n const z = this.canonical.z + 1;\n const x = this.canonical.x * 2;\n const y = this.canonical.y * 2;\n return [\n new OverscaledTileID(z, this.wrap, z, x, y),\n new OverscaledTileID(z, this.wrap, z, x + 1, y),\n new OverscaledTileID(z, this.wrap, z, x, y + 1),\n new OverscaledTileID(z, this.wrap, z, x + 1, y + 1)\n ];\n }\n\n isLessThan(rhs: OverscaledTileID) {\n if (this.wrap < rhs.wrap) return true;\n if (this.wrap > rhs.wrap) return false;\n\n if (this.overscaledZ < rhs.overscaledZ) return true;\n if (this.overscaledZ > rhs.overscaledZ) return false;\n\n if (this.canonical.x < rhs.canonical.x) return true;\n if (this.canonical.x > rhs.canonical.x) return false;\n\n if (this.canonical.y < rhs.canonical.y) return true;\n return false;\n }\n\n wrapped() {\n return new OverscaledTileID(this.overscaledZ, 0, this.canonical.z, this.canonical.x, this.canonical.y);\n }\n\n unwrapTo(wrap: number) {\n return new OverscaledTileID(this.overscaledZ, wrap, this.canonical.z, this.canonical.x, this.canonical.y);\n }\n\n overscaleFactor() {\n return Math.pow(2, this.overscaledZ - this.canonical.z);\n }\n\n toUnwrapped() {\n return new UnwrappedTileID(this.wrap, this.canonical);\n }\n\n toString() {\n return `${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`;\n }\n\n getTilePoint(coord: MercatorCoordinate) {\n return this.canonical.getTilePoint(new MercatorCoordinate(coord.x - this.wrap, coord.y));\n }\n}\n\nfunction calculateKey(wrap: number, overscaledZ: number, z: number, x: number, y: number): string {\n wrap *= 2;\n if (wrap < 0) wrap = wrap * -1 - 1;\n const dim = 1 << z;\n return (dim * dim * wrap + dim * y + x).toString(36) + z.toString(36) + overscaledZ.toString(36);\n}\n\nfunction getQuadkey(z, x, y) {\n let quadkey = '', mask;\n for (let i = z; i > 0; i--) {\n mask = 1 << (i - 1);\n quadkey += ((x & mask ? 1 : 0) + (y & mask ? 2 : 0));\n }\n return quadkey;\n}\n\nregister('CanonicalTileID', CanonicalTileID);\nregister('OverscaledTileID', OverscaledTileID, {omit: ['posMatrix']});\n","// @flow\nimport {RGBAImage} from '../util/image';\n\nimport {warnOnce} from '../util/util';\nimport {register} from '../util/web_worker_transfer';\n\n// DEMData is a data structure for decoding, backfilling, and storing elevation data for processing in the hillshade shaders\n// data can be populated either from a pngraw image tile or from serliazed data sent back from a worker. When data is initially\n// loaded from a image tile, we decode the pixel values using the appropriate decoding formula, but we store the\n// elevation data as an Int32 value. we add 65536 (2^16) to eliminate negative values and enable the use of\n// integer overflow when creating the texture used in the hillshadePrepare step.\n\n// DEMData also handles the backfilling of data from a tile's neighboring tiles. This is necessary because we use a pixel's 8\n// surrounding pixel values to compute the slope at that pixel, and we cannot accurately calculate the slope at pixels on a\n// tile's edge without backfilling from neighboring tiles.\n\nexport default class DEMData {\n uid: string;\n data: Uint32Array;\n stride: number;\n dim: number;\n encoding: \"mapbox\" | \"terrarium\";\n\n // RGBAImage data has uniform 1px padding on all sides: square tile edge size defines stride\n // and dim is calculated as stride - 2.\n constructor(uid: string, data: RGBAImage, encoding: \"mapbox\" | \"terrarium\") {\n this.uid = uid;\n if (data.height !== data.width) throw new RangeError('DEM tiles must be square');\n if (encoding && encoding !== \"mapbox\" && encoding !== \"terrarium\") return warnOnce(\n `\"${encoding}\" is not a valid encoding type. Valid types include \"mapbox\" and \"terrarium\".`\n );\n this.stride = data.height;\n const dim = this.dim = data.height - 2;\n this.data = new Uint32Array(data.data.buffer);\n this.encoding = encoding || 'mapbox';\n\n // in order to avoid flashing seams between tiles, here we are initially populating a 1px border of pixels around the image\n // with the data of the nearest pixel from the image. this data is eventually replaced when the tile's neighboring\n // tiles are loaded and the accurate data can be backfilled using DEMData#backfillBorder\n for (let x = 0; x < dim; x++) {\n // left vertical border\n this.data[this._idx(-1, x)] = this.data[this._idx(0, x)];\n // right vertical border\n this.data[this._idx(dim, x)] = this.data[this._idx(dim - 1, x)];\n // left horizontal border\n this.data[this._idx(x, -1)] = this.data[this._idx(x, 0)];\n // right horizontal border\n this.data[this._idx(x, dim)] = this.data[this._idx(x, dim - 1)];\n }\n // corners\n this.data[this._idx(-1, -1)] = this.data[this._idx(0, 0)];\n this.data[this._idx(dim, -1)] = this.data[this._idx(dim - 1, 0)];\n this.data[this._idx(-1, dim)] = this.data[this._idx(0, dim - 1)];\n this.data[this._idx(dim, dim)] = this.data[this._idx(dim - 1, dim - 1)];\n }\n\n get(x: number, y: number) {\n const pixels = new Uint8Array(this.data.buffer);\n const index = this._idx(x, y) * 4;\n const unpack = this.encoding === \"terrarium\" ? this._unpackTerrarium : this._unpackMapbox;\n return unpack(pixels[index], pixels[index + 1], pixels[index + 2]);\n }\n\n getUnpackVector() {\n return this.encoding === \"terrarium\" ? [256.0, 1.0, 1.0 / 256.0, 32768.0] : [6553.6, 25.6, 0.1, 10000.0];\n }\n\n _idx(x: number, y: number) {\n if (x < -1 || x >= this.dim + 1 || y < -1 || y >= this.dim + 1) throw new RangeError('out of range source coordinates for DEM data');\n return (y + 1) * this.stride + (x + 1);\n }\n\n _unpackMapbox(r: number, g: number, b: number) {\n // unpacking formula for mapbox.terrain-rgb:\n // https://www.mapbox.com/help/access-elevation-data/#mapbox-terrain-rgb\n return ((r * 256 * 256 + g * 256.0 + b) / 10.0 - 10000.0);\n }\n\n _unpackTerrarium(r: number, g: number, b: number) {\n // unpacking formula for mapzen terrarium:\n // https://aws.amazon.com/public-datasets/terrain/\n return ((r * 256 + g + b / 256) - 32768.0);\n }\n\n getPixels() {\n return new RGBAImage({width: this.stride, height: this.stride}, new Uint8Array(this.data.buffer));\n }\n\n backfillBorder(borderTile: DEMData, dx: number, dy: number) {\n if (this.dim !== borderTile.dim) throw new Error('dem dimension mismatch');\n\n let xMin = dx * this.dim,\n xMax = dx * this.dim + this.dim,\n yMin = dy * this.dim,\n yMax = dy * this.dim + this.dim;\n\n switch (dx) {\n case -1:\n xMin = xMax - 1;\n break;\n case 1:\n xMax = xMin + 1;\n break;\n }\n\n switch (dy) {\n case -1:\n yMin = yMax - 1;\n break;\n case 1:\n yMax = yMin + 1;\n break;\n }\n\n const ox = -dx * this.dim;\n const oy = -dy * this.dim;\n for (let y = yMin; y < yMax; y++) {\n for (let x = xMin; x < xMax; x++) {\n this.data[this._idx(x, y)] = borderTile.data[this._idx(x + ox, y + oy)];\n }\n }\n }\n}\n\nregister('DEMData', DEMData);\n","// @flow strict\n\nimport assert from 'assert';\n\nclass DictionaryCoder {\n _stringToNumber: {[_: string]: number };\n _numberToString: Array;\n\n constructor(strings: Array) {\n this._stringToNumber = {};\n this._numberToString = [];\n for (let i = 0; i < strings.length; i++) {\n const string = strings[i];\n this._stringToNumber[string] = i;\n this._numberToString[i] = string;\n }\n }\n\n encode(string: string) {\n assert(string in this._stringToNumber);\n return this._stringToNumber[string];\n }\n\n decode(n: number) {\n assert(n < this._numberToString.length);\n return this._numberToString[n];\n }\n}\n\nexport default DictionaryCoder;\n","// @flow\nimport type {GeoJSONGeometry} from '@mapbox/geojson-types';\n\nclass Feature {\n type: 'Feature';\n _geometry: ?GeoJSONGeometry;\n properties: {};\n id: number | string | void;\n\n _vectorTileFeature: VectorTileFeature;\n\n constructor(vectorTileFeature: VectorTileFeature, z: number, x: number, y: number, id: string | number | void) {\n this.type = 'Feature';\n\n this._vectorTileFeature = vectorTileFeature;\n (vectorTileFeature: any)._z = z;\n (vectorTileFeature: any)._x = x;\n (vectorTileFeature: any)._y = y;\n\n this.properties = vectorTileFeature.properties;\n this.id = id;\n }\n\n get geometry(): ?GeoJSONGeometry {\n if (this._geometry === undefined) {\n this._geometry = this._vectorTileFeature.toGeoJSON(\n (this._vectorTileFeature: any)._x,\n (this._vectorTileFeature: any)._y,\n (this._vectorTileFeature: any)._z).geometry;\n }\n return this._geometry;\n }\n\n set geometry(g: ?GeoJSONGeometry) {\n this._geometry = g;\n }\n\n toJSON() {\n const json = {\n geometry: this.geometry\n };\n for (const i in this) {\n if (i === '_geometry' || i === '_vectorTileFeature') continue;\n json[i] = (this: any)[i];\n }\n return json;\n }\n}\n\nexport default Feature;\n","// @flow\n\nimport {extend} from '../util/util';\nimport Tile from './tile';\nimport type {FeatureState} from '../style-spec/expression';\n\nexport type FeatureStates = {[feature_id: string]: FeatureState};\nexport type LayerFeatureStates = {[layer: string]: FeatureStates};\n\n/**\n * SourceFeatureState manages the state and pending changes\n * to features in a source, separated by source layer.\n * stateChanges and deletedStates batch all changes to the tile (updates and removes, respectively)\n * between coalesce() events. addFeatureState() and removeFeatureState() also update their counterpart's\n * list of changes, such that coalesce() can apply the proper state changes while agnostic to the order of operations.\n * In deletedStates, all null's denote complete removal of state at that scope\n * @private\n*/\nclass SourceFeatureState {\n state: LayerFeatureStates;\n stateChanges: LayerFeatureStates;\n deletedStates: {};\n\n constructor() {\n this.state = {};\n this.stateChanges = {};\n this.deletedStates = {};\n }\n\n updateState(sourceLayer: string, featureId: number | string, newState: Object) {\n const feature = String(featureId);\n this.stateChanges[sourceLayer] = this.stateChanges[sourceLayer] || {};\n this.stateChanges[sourceLayer][feature] = this.stateChanges[sourceLayer][feature] || {};\n extend(this.stateChanges[sourceLayer][feature], newState);\n\n if (this.deletedStates[sourceLayer] === null) {\n this.deletedStates[sourceLayer] = {};\n for (const ft in this.state[sourceLayer]) {\n if (ft !== feature) this.deletedStates[sourceLayer][ft] = null;\n }\n } else {\n const featureDeletionQueued = this.deletedStates[sourceLayer] && this.deletedStates[sourceLayer][feature] === null;\n if (featureDeletionQueued) {\n this.deletedStates[sourceLayer][feature] = {};\n for (const prop in this.state[sourceLayer][feature]) {\n if (!newState[prop]) this.deletedStates[sourceLayer][feature][prop] = null;\n }\n } else {\n for (const key in newState) {\n const deletionInQueue = this.deletedStates[sourceLayer] && this.deletedStates[sourceLayer][feature] && this.deletedStates[sourceLayer][feature][key] === null;\n if (deletionInQueue) delete this.deletedStates[sourceLayer][feature][key];\n }\n }\n }\n }\n\n removeFeatureState(sourceLayer: string, featureId?: number | string, key?: string) {\n const sourceLayerDeleted = this.deletedStates[sourceLayer] === null;\n if (sourceLayerDeleted) return;\n\n const feature = String(featureId);\n\n this.deletedStates[sourceLayer] = this.deletedStates[sourceLayer] || {};\n\n if (key && featureId !== undefined) {\n if (this.deletedStates[sourceLayer][feature] !== null) {\n this.deletedStates[sourceLayer][feature] = this.deletedStates[sourceLayer][feature] || {};\n this.deletedStates[sourceLayer][feature][key] = null;\n }\n } else if (featureId !== undefined) {\n const updateInQueue = this.stateChanges[sourceLayer] && this.stateChanges[sourceLayer][feature];\n if (updateInQueue) {\n this.deletedStates[sourceLayer][feature] = {};\n for (key in this.stateChanges[sourceLayer][feature]) this.deletedStates[sourceLayer][feature][key] = null;\n\n } else {\n this.deletedStates[sourceLayer][feature] = null;\n }\n } else {\n this.deletedStates[sourceLayer] = null;\n }\n\n }\n\n getState(sourceLayer: string, featureId: number | string) {\n const feature = String(featureId);\n const base = this.state[sourceLayer] || {};\n const changes = this.stateChanges[sourceLayer] || {};\n\n const reconciledState = extend({}, base[feature], changes[feature]);\n\n //return empty object if the whole source layer is awaiting deletion\n if (this.deletedStates[sourceLayer] === null) return {};\n else if (this.deletedStates[sourceLayer]) {\n const featureDeletions = this.deletedStates[sourceLayer][featureId];\n if (featureDeletions === null) return {};\n for (const prop in featureDeletions) delete reconciledState[prop];\n }\n return reconciledState;\n }\n\n initializeTileState(tile: Tile, painter: any) {\n tile.setFeatureState(this.state, painter);\n }\n\n coalesceChanges(tiles: {[_: any]: Tile}, painter: any) {\n //track changes with full state objects, but only for features that got modified\n const featuresChanged: LayerFeatureStates = {};\n\n for (const sourceLayer in this.stateChanges) {\n this.state[sourceLayer] = this.state[sourceLayer] || {};\n const layerStates = {};\n for (const feature in this.stateChanges[sourceLayer]) {\n if (!this.state[sourceLayer][feature]) this.state[sourceLayer][feature] = {};\n extend(this.state[sourceLayer][feature], this.stateChanges[sourceLayer][feature]);\n layerStates[feature] = this.state[sourceLayer][feature];\n }\n featuresChanged[sourceLayer] = layerStates;\n }\n\n for (const sourceLayer in this.deletedStates) {\n this.state[sourceLayer] = this.state[sourceLayer] || {};\n const layerStates = {};\n\n if (this.deletedStates[sourceLayer] === null) {\n for (const ft in this.state[sourceLayer]) {\n layerStates[ft] = {};\n this.state[sourceLayer][ft] = {};\n }\n } else {\n for (const feature in this.deletedStates[sourceLayer]) {\n const deleteWholeFeatureState = this.deletedStates[sourceLayer][feature] === null;\n if (deleteWholeFeatureState) this.state[sourceLayer][feature] = {};\n else {\n for (const key of Object.keys(this.deletedStates[sourceLayer][feature])) {\n delete this.state[sourceLayer][feature][key];\n }\n }\n layerStates[feature] = this.state[sourceLayer][feature];\n }\n }\n\n featuresChanged[sourceLayer] = featuresChanged[sourceLayer] || {};\n extend(featuresChanged[sourceLayer], layerStates);\n }\n\n this.stateChanges = {};\n this.deletedStates = {};\n\n if (Object.keys(featuresChanged).length === 0) return;\n\n for (const id in tiles) {\n const tile = tiles[id];\n tile.setFeatureState(featuresChanged, painter);\n }\n }\n}\n\nexport default SourceFeatureState;\n","// @flow\n\nimport Point from '@mapbox/point-geometry';\n\nimport loadGeometry from './load_geometry';\nimport toEvaluationFeature from './evaluation_feature';\nimport EXTENT from './extent';\nimport featureFilter from '../style-spec/feature_filter';\nimport Grid from 'grid-index';\nimport DictionaryCoder from '../util/dictionary_coder';\nimport vt from '@mapbox/vector-tile';\nimport Protobuf from 'pbf';\nimport GeoJSONFeature from '../util/vectortile_to_geojson';\nimport {arraysIntersect, mapObject, extend} from '../util/util';\nimport {OverscaledTileID} from '../source/tile_id';\nimport {register} from '../util/web_worker_transfer';\nimport EvaluationParameters from '../style/evaluation_parameters';\nimport SourceFeatureState from '../source/source_state';\nimport {polygonIntersectsBox} from '../util/intersection_tests';\nimport {PossiblyEvaluated} from '../style/properties';\n\nimport type StyleLayer from '../style/style_layer';\nimport type {FeatureFilter} from '../style-spec/feature_filter';\nimport type Transform from '../geo/transform';\nimport type {FilterSpecification, PromoteIdSpecification} from '../style-spec/types';\n\nimport {FeatureIndexArray} from './array_types';\n\ntype QueryParameters = {\n scale: number,\n pixelPosMatrix: Float32Array,\n transform: Transform,\n tileSize: number,\n queryGeometry: Array,\n cameraQueryGeometry: Array,\n queryPadding: number,\n params: {\n filter: FilterSpecification,\n layers: Array,\n availableImages: Array\n }\n}\n\nclass FeatureIndex {\n tileID: OverscaledTileID;\n x: number;\n y: number;\n z: number;\n grid: Grid;\n grid3D: Grid;\n featureIndexArray: FeatureIndexArray;\n promoteId: ?PromoteIdSpecification;\n\n rawTileData: ArrayBuffer;\n bucketLayerIDs: Array>;\n\n vtLayers: {[_: string]: VectorTileLayer};\n sourceLayerCoder: DictionaryCoder;\n\n constructor(tileID: OverscaledTileID, promoteId?: ?PromoteIdSpecification) {\n this.tileID = tileID;\n this.x = tileID.canonical.x;\n this.y = tileID.canonical.y;\n this.z = tileID.canonical.z;\n this.grid = new Grid(EXTENT, 16, 0);\n this.grid3D = new Grid(EXTENT, 16, 0);\n this.featureIndexArray = new FeatureIndexArray();\n this.promoteId = promoteId;\n }\n\n insert(feature: VectorTileFeature, geometry: Array>, featureIndex: number, sourceLayerIndex: number, bucketIndex: number, is3D?: boolean) {\n const key = this.featureIndexArray.length;\n this.featureIndexArray.emplaceBack(featureIndex, sourceLayerIndex, bucketIndex);\n\n const grid = is3D ? this.grid3D : this.grid;\n\n for (let r = 0; r < geometry.length; r++) {\n const ring = geometry[r];\n\n const bbox = [Infinity, Infinity, -Infinity, -Infinity];\n for (let i = 0; i < ring.length; i++) {\n const p = ring[i];\n bbox[0] = Math.min(bbox[0], p.x);\n bbox[1] = Math.min(bbox[1], p.y);\n bbox[2] = Math.max(bbox[2], p.x);\n bbox[3] = Math.max(bbox[3], p.y);\n }\n\n if (bbox[0] < EXTENT &&\n bbox[1] < EXTENT &&\n bbox[2] >= 0 &&\n bbox[3] >= 0) {\n grid.insert(key, bbox[0], bbox[1], bbox[2], bbox[3]);\n }\n }\n }\n\n loadVTLayers(): {[_: string]: VectorTileLayer} {\n if (!this.vtLayers) {\n this.vtLayers = new vt.VectorTile(new Protobuf(this.rawTileData)).layers;\n this.sourceLayerCoder = new DictionaryCoder(this.vtLayers ? Object.keys(this.vtLayers).sort() : ['_geojsonTileLayer']);\n }\n return this.vtLayers;\n }\n\n // Finds non-symbol features in this tile at a particular position.\n query(args: QueryParameters, styleLayers: {[_: string]: StyleLayer}, serializedLayers: {[_: string]: Object}, sourceFeatureState: SourceFeatureState): {[_: string]: Array<{ featureIndex: number, feature: GeoJSONFeature }>} {\n this.loadVTLayers();\n\n const params = args.params || {},\n pixelsToTileUnits = EXTENT / args.tileSize / args.scale,\n filter = featureFilter(params.filter);\n\n const queryGeometry = args.queryGeometry;\n const queryPadding = args.queryPadding * pixelsToTileUnits;\n\n const bounds = getBounds(queryGeometry);\n const matching = this.grid.query(bounds.minX - queryPadding, bounds.minY - queryPadding, bounds.maxX + queryPadding, bounds.maxY + queryPadding);\n\n const cameraBounds = getBounds(args.cameraQueryGeometry);\n const matching3D = this.grid3D.query(\n cameraBounds.minX - queryPadding, cameraBounds.minY - queryPadding, cameraBounds.maxX + queryPadding, cameraBounds.maxY + queryPadding,\n (bx1, by1, bx2, by2) => {\n return polygonIntersectsBox(args.cameraQueryGeometry, bx1 - queryPadding, by1 - queryPadding, bx2 + queryPadding, by2 + queryPadding);\n });\n\n for (const key of matching3D) {\n matching.push(key);\n }\n\n matching.sort(topDownFeatureComparator);\n\n const result = {};\n let previousIndex;\n for (let k = 0; k < matching.length; k++) {\n const index = matching[k];\n\n // don't check the same feature more than once\n if (index === previousIndex) continue;\n previousIndex = index;\n\n const match = this.featureIndexArray.get(index);\n let featureGeometry = null;\n this.loadMatchingFeature(\n result,\n match.bucketIndex,\n match.sourceLayerIndex,\n match.featureIndex,\n filter,\n params.layers,\n params.availableImages,\n styleLayers,\n serializedLayers,\n sourceFeatureState,\n (feature: VectorTileFeature, styleLayer: StyleLayer, featureState: Object) => {\n if (!featureGeometry) {\n featureGeometry = loadGeometry(feature);\n }\n\n return styleLayer.queryIntersectsFeature(queryGeometry, feature, featureState, featureGeometry, this.z, args.transform, pixelsToTileUnits, args.pixelPosMatrix);\n }\n );\n }\n\n return result;\n }\n\n loadMatchingFeature(\n result: {[_: string]: Array<{ featureIndex: number, feature: GeoJSONFeature }>},\n bucketIndex: number,\n sourceLayerIndex: number,\n featureIndex: number,\n filter: FeatureFilter,\n filterLayerIDs: Array,\n availableImages: Array,\n styleLayers: {[_: string]: StyleLayer},\n serializedLayers: {[_: string]: Object},\n sourceFeatureState?: SourceFeatureState,\n intersectionTest?: (feature: VectorTileFeature, styleLayer: StyleLayer, featureState: Object, id: string | number | void) => boolean | number) {\n\n const layerIDs = this.bucketLayerIDs[bucketIndex];\n if (filterLayerIDs && !arraysIntersect(filterLayerIDs, layerIDs))\n return;\n\n const sourceLayerName = this.sourceLayerCoder.decode(sourceLayerIndex);\n const sourceLayer = this.vtLayers[sourceLayerName];\n const feature = sourceLayer.feature(featureIndex);\n\n if (filter.needGeometry) {\n const evaluationFeature = toEvaluationFeature(feature, true);\n if (!filter.filter(new EvaluationParameters(this.tileID.overscaledZ), evaluationFeature, this.tileID.canonical)) {\n return;\n }\n } else if (!filter.filter(new EvaluationParameters(this.tileID.overscaledZ), feature)) {\n return;\n }\n\n const id = this.getId(feature, sourceLayerName);\n\n for (let l = 0; l < layerIDs.length; l++) {\n const layerID = layerIDs[l];\n\n if (filterLayerIDs && filterLayerIDs.indexOf(layerID) < 0) {\n continue;\n }\n\n const styleLayer = styleLayers[layerID];\n\n if (!styleLayer) continue;\n\n let featureState = {};\n if (id !== undefined && sourceFeatureState) {\n // `feature-state` expression evaluation requires feature state to be available\n featureState = sourceFeatureState.getState(styleLayer.sourceLayer || '_geojsonTileLayer', id);\n }\n\n const serializedLayer = extend({}, serializedLayers[layerID]);\n\n serializedLayer.paint = evaluateProperties(serializedLayer.paint, styleLayer.paint, feature, featureState, availableImages);\n serializedLayer.layout = evaluateProperties(serializedLayer.layout, styleLayer.layout, feature, featureState, availableImages);\n\n const intersectionZ = !intersectionTest || intersectionTest(feature, styleLayer, featureState);\n if (!intersectionZ) {\n // Only applied for non-symbol features\n continue;\n }\n\n const geojsonFeature = new GeoJSONFeature(feature, this.z, this.x, this.y, id);\n (geojsonFeature: any).layer = serializedLayer;\n let layerResult = result[layerID];\n if (layerResult === undefined) {\n layerResult = result[layerID] = [];\n }\n layerResult.push({featureIndex, feature: geojsonFeature, intersectionZ});\n }\n }\n\n // Given a set of symbol indexes that have already been looked up,\n // return a matching set of GeoJSONFeatures\n lookupSymbolFeatures(symbolFeatureIndexes: Array,\n serializedLayers: {[string]: StyleLayer},\n bucketIndex: number,\n sourceLayerIndex: number,\n filterSpec: FilterSpecification,\n filterLayerIDs: Array,\n availableImages: Array,\n styleLayers: {[_: string]: StyleLayer}) {\n const result = {};\n this.loadVTLayers();\n\n const filter = featureFilter(filterSpec);\n\n for (const symbolFeatureIndex of symbolFeatureIndexes) {\n this.loadMatchingFeature(\n result,\n bucketIndex,\n sourceLayerIndex,\n symbolFeatureIndex,\n filter,\n filterLayerIDs,\n availableImages,\n styleLayers,\n serializedLayers\n );\n\n }\n return result;\n }\n\n hasLayer(id: string) {\n for (const layerIDs of this.bucketLayerIDs) {\n for (const layerID of layerIDs) {\n if (id === layerID) return true;\n }\n }\n\n return false;\n }\n\n getId(feature: VectorTileFeature, sourceLayerId: string): string | number | void {\n let id = feature.id;\n if (this.promoteId) {\n const propName = typeof this.promoteId === 'string' ? this.promoteId : this.promoteId[sourceLayerId];\n id = feature.properties[propName];\n if (typeof id === 'boolean') id = Number(id);\n }\n return id;\n }\n}\n\nregister(\n 'FeatureIndex',\n FeatureIndex,\n {omit: ['rawTileData', 'sourceLayerCoder']}\n);\n\nexport default FeatureIndex;\n\nfunction evaluateProperties(serializedProperties, styleLayerProperties, feature, featureState, availableImages) {\n return mapObject(serializedProperties, (property, key) => {\n const prop = styleLayerProperties instanceof PossiblyEvaluated ? styleLayerProperties.get(key) : null;\n return prop && prop.evaluate ? prop.evaluate(feature, featureState, availableImages) : prop;\n });\n}\n\nfunction getBounds(geometry: Array) {\n let minX = Infinity;\n let minY = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n for (const p of geometry) {\n minX = Math.min(minX, p.x);\n minY = Math.min(minY, p.y);\n maxX = Math.max(maxX, p.x);\n maxY = Math.max(maxY, p.y);\n }\n return {minX, minY, maxX, maxY};\n}\n\nfunction topDownFeatureComparator(a, b) {\n return b - a;\n}\n","// @flow\n\nimport {uniqueId, parseCacheControl} from '../util/util';\nimport {deserialize as deserializeBucket} from '../data/bucket';\nimport FeatureIndex from '../data/feature_index';\nimport GeoJSONFeature from '../util/vectortile_to_geojson';\nimport featureFilter from '../style-spec/feature_filter';\nimport SymbolBucket from '../data/bucket/symbol_bucket';\nimport {CollisionBoxArray} from '../data/array_types';\nimport Texture from '../render/texture';\nimport browser from '../util/browser';\nimport toEvaluationFeature from '../data/evaluation_feature';\nimport EvaluationParameters from '../style/evaluation_parameters';\nimport SourceFeatureState from '../source/source_state';\nimport {lazyLoadRTLTextPlugin} from './rtl_text_plugin';\n\nconst CLOCK_SKEW_RETRY_TIMEOUT = 30000;\n\nimport type {Bucket} from '../data/bucket';\nimport type StyleLayer from '../style/style_layer';\nimport type {WorkerTileResult} from './worker_source';\nimport type Actor from '../util/actor';\nimport type DEMData from '../data/dem_data';\nimport type {AlphaImage} from '../util/image';\nimport type ImageAtlas from '../render/image_atlas';\nimport type ImageManager from '../render/image_manager';\nimport type Context from '../gl/context';\nimport type {OverscaledTileID} from './tile_id';\nimport type Framebuffer from '../gl/framebuffer';\nimport type Transform from '../geo/transform';\nimport type {LayerFeatureStates} from './source_state';\nimport type {Cancelable} from '../types/cancelable';\nimport type {FilterSpecification} from '../style-spec/types';\n\nexport type TileState =\n | 'loading' // Tile data is in the process of loading.\n | 'loaded' // Tile data has been loaded. Tile can be rendered.\n | 'reloading' // Tile data has been loaded and is being updated. Tile can be rendered.\n | 'unloaded' // Tile data has been deleted.\n | 'errored' // Tile data was not loaded because of an error.\n | 'expired'; /* Tile data was previously loaded, but has expired per its\n * HTTP headers and is in the process of refreshing. */\n\n/**\n * A tile object is the combination of a Coordinate, which defines\n * its place, as well as a unique ID and data tracking for its content\n *\n * @private\n */\nclass Tile {\n tileID: OverscaledTileID;\n uid: number;\n uses: number;\n tileSize: number;\n buckets: {[_: string]: Bucket};\n latestFeatureIndex: ?FeatureIndex;\n latestRawTileData: ?ArrayBuffer;\n imageAtlas: ?ImageAtlas;\n imageAtlasTexture: Texture;\n glyphAtlasImage: ?AlphaImage;\n glyphAtlasTexture: Texture;\n expirationTime: any;\n expiredRequestCount: number;\n state: TileState;\n timeAdded: any;\n fadeEndTime: any;\n collisionBoxArray: ?CollisionBoxArray;\n redoWhenDone: boolean;\n showCollisionBoxes: boolean;\n placementSource: any;\n actor: ?Actor;\n vtLayers: {[_: string]: VectorTileLayer};\n\n neighboringTiles: ?Object;\n dem: ?DEMData;\n aborted: ?boolean;\n needsHillshadePrepare: ?boolean;\n request: ?Cancelable;\n texture: any;\n fbo: ?Framebuffer;\n demTexture: ?Texture;\n refreshedUponExpiration: boolean;\n reloadCallback: any;\n resourceTiming: ?Array;\n queryPadding: number;\n\n symbolFadeHoldUntil: ?number;\n hasSymbolBuckets: boolean;\n hasRTLText: boolean;\n dependencies: Object;\n\n /**\n * @param {OverscaledTileID} tileID\n * @param size\n * @private\n */\n constructor(tileID: OverscaledTileID, size: number) {\n this.tileID = tileID;\n this.uid = uniqueId();\n this.uses = 0;\n this.tileSize = size;\n this.buckets = {};\n this.expirationTime = null;\n this.queryPadding = 0;\n this.hasSymbolBuckets = false;\n this.hasRTLText = false;\n this.dependencies = {};\n\n // Counts the number of times a response was already expired when\n // received. We're using this to add a delay when making a new request\n // so we don't have to keep retrying immediately in case of a server\n // serving expired tiles.\n this.expiredRequestCount = 0;\n\n this.state = 'loading';\n }\n\n registerFadeDuration(duration: number) {\n const fadeEndTime = duration + this.timeAdded;\n if (fadeEndTime < browser.now()) return;\n if (this.fadeEndTime && fadeEndTime < this.fadeEndTime) return;\n\n this.fadeEndTime = fadeEndTime;\n }\n\n wasRequested() {\n return this.state === 'errored' || this.state === 'loaded' || this.state === 'reloading';\n }\n\n /**\n * Given a data object with a 'buffers' property, load it into\n * this tile's elementGroups and buffers properties and set loaded\n * to true. If the data is null, like in the case of an empty\n * GeoJSON tile, no-op but still set loaded to true.\n * @param {Object} data\n * @param painter\n * @returns {undefined}\n * @private\n */\n loadVectorData(data: WorkerTileResult, painter: any, justReloaded: ?boolean) {\n if (this.hasData()) {\n this.unloadVectorData();\n }\n\n this.state = 'loaded';\n\n // empty GeoJSON tile\n if (!data) {\n this.collisionBoxArray = new CollisionBoxArray();\n return;\n }\n\n if (data.featureIndex) {\n this.latestFeatureIndex = data.featureIndex;\n if (data.rawTileData) {\n // Only vector tiles have rawTileData, and they won't update it for\n // 'reloadTile'\n this.latestRawTileData = data.rawTileData;\n this.latestFeatureIndex.rawTileData = data.rawTileData;\n } else if (this.latestRawTileData) {\n // If rawTileData hasn't updated, hold onto a pointer to the last\n // one we received\n this.latestFeatureIndex.rawTileData = this.latestRawTileData;\n }\n }\n this.collisionBoxArray = data.collisionBoxArray;\n this.buckets = deserializeBucket(data.buckets, painter.style);\n\n this.hasSymbolBuckets = false;\n for (const id in this.buckets) {\n const bucket = this.buckets[id];\n if (bucket instanceof SymbolBucket) {\n this.hasSymbolBuckets = true;\n if (justReloaded) {\n bucket.justReloaded = true;\n } else {\n break;\n }\n }\n }\n\n this.hasRTLText = false;\n if (this.hasSymbolBuckets) {\n for (const id in this.buckets) {\n const bucket = this.buckets[id];\n if (bucket instanceof SymbolBucket) {\n if (bucket.hasRTLText) {\n this.hasRTLText = true;\n lazyLoadRTLTextPlugin();\n break;\n }\n }\n }\n }\n\n this.queryPadding = 0;\n for (const id in this.buckets) {\n const bucket = this.buckets[id];\n this.queryPadding = Math.max(this.queryPadding, painter.style.getLayer(id).queryRadius(bucket));\n }\n\n if (data.imageAtlas) {\n this.imageAtlas = data.imageAtlas;\n }\n if (data.glyphAtlasImage) {\n this.glyphAtlasImage = data.glyphAtlasImage;\n }\n }\n\n /**\n * Release any data or WebGL resources referenced by this tile.\n * @returns {undefined}\n * @private\n */\n unloadVectorData() {\n for (const id in this.buckets) {\n this.buckets[id].destroy();\n }\n this.buckets = {};\n\n if (this.imageAtlasTexture) {\n this.imageAtlasTexture.destroy();\n }\n\n if (this.imageAtlas) {\n this.imageAtlas = null;\n }\n\n if (this.glyphAtlasTexture) {\n this.glyphAtlasTexture.destroy();\n }\n\n this.latestFeatureIndex = null;\n this.state = 'unloaded';\n }\n\n getBucket(layer: StyleLayer) {\n return this.buckets[layer.id];\n }\n\n upload(context: Context) {\n for (const id in this.buckets) {\n const bucket = this.buckets[id];\n if (bucket.uploadPending()) {\n bucket.upload(context);\n }\n }\n\n const gl = context.gl;\n if (this.imageAtlas && !this.imageAtlas.uploaded) {\n this.imageAtlasTexture = new Texture(context, this.imageAtlas.image, gl.RGBA);\n this.imageAtlas.uploaded = true;\n }\n\n if (this.glyphAtlasImage) {\n this.glyphAtlasTexture = new Texture(context, this.glyphAtlasImage, gl.ALPHA);\n this.glyphAtlasImage = null;\n }\n }\n\n prepare(imageManager: ImageManager) {\n if (this.imageAtlas) {\n this.imageAtlas.patchUpdatedImages(imageManager, this.imageAtlasTexture);\n }\n }\n\n // Queries non-symbol features rendered for this tile.\n // Symbol features are queried globally\n queryRenderedFeatures(layers: {[_: string]: StyleLayer},\n serializedLayers: {[string]: Object},\n sourceFeatureState: SourceFeatureState,\n queryGeometry: Array,\n cameraQueryGeometry: Array,\n scale: number,\n params: { filter: FilterSpecification, layers: Array, availableImages: Array },\n transform: Transform,\n maxPitchScaleFactor: number,\n pixelPosMatrix: Float32Array): {[_: string]: Array<{ featureIndex: number, feature: GeoJSONFeature }>} {\n if (!this.latestFeatureIndex || !this.latestFeatureIndex.rawTileData)\n return {};\n\n return this.latestFeatureIndex.query({\n queryGeometry,\n cameraQueryGeometry,\n scale,\n tileSize: this.tileSize,\n pixelPosMatrix,\n transform,\n params,\n queryPadding: this.queryPadding * maxPitchScaleFactor\n }, layers, serializedLayers, sourceFeatureState);\n }\n\n querySourceFeatures(result: Array, params: any) {\n const featureIndex = this.latestFeatureIndex;\n if (!featureIndex || !featureIndex.rawTileData) return;\n\n const vtLayers = featureIndex.loadVTLayers();\n\n const sourceLayer = params ? params.sourceLayer : '';\n const layer = vtLayers._geojsonTileLayer || vtLayers[sourceLayer];\n\n if (!layer) return;\n\n const filter = featureFilter(params && params.filter);\n const {z, x, y} = this.tileID.canonical;\n const coord = {z, x, y};\n\n for (let i = 0; i < layer.length; i++) {\n const feature = layer.feature(i);\n if (filter.needGeometry) {\n const evaluationFeature = toEvaluationFeature(feature, true);\n if (!filter.filter(new EvaluationParameters(this.tileID.overscaledZ), evaluationFeature, this.tileID.canonical)) continue;\n } else if (!filter.filter(new EvaluationParameters(this.tileID.overscaledZ), feature)) {\n continue;\n }\n const id = featureIndex.getId(feature, sourceLayer);\n const geojsonFeature = new GeoJSONFeature(feature, z, x, y, id);\n (geojsonFeature: any).tile = coord;\n result.push(geojsonFeature);\n }\n }\n\n hasData() {\n return this.state === 'loaded' || this.state === 'reloading' || this.state === 'expired';\n }\n\n patternsLoaded() {\n return this.imageAtlas && !!Object.keys(this.imageAtlas.patternPositions).length;\n }\n\n setExpiryData(data: any) {\n const prior = this.expirationTime;\n\n if (data.cacheControl) {\n const parsedCC = parseCacheControl(data.cacheControl);\n if (parsedCC['max-age']) this.expirationTime = Date.now() + parsedCC['max-age'] * 1000;\n } else if (data.expires) {\n this.expirationTime = new Date(data.expires).getTime();\n }\n\n if (this.expirationTime) {\n const now = Date.now();\n let isExpired = false;\n\n if (this.expirationTime > now) {\n isExpired = false;\n } else if (!prior) {\n isExpired = true;\n } else if (this.expirationTime < prior) {\n // Expiring date is going backwards:\n // fall back to exponential backoff\n isExpired = true;\n\n } else {\n const delta = this.expirationTime - prior;\n\n if (!delta) {\n // Server is serving the same expired resource over and over: fall\n // back to exponential backoff.\n isExpired = true;\n\n } else {\n // Assume that either the client or the server clock is wrong and\n // try to interpolate a valid expiration date (from the client POV)\n // observing a minimum timeout.\n this.expirationTime = now + Math.max(delta, CLOCK_SKEW_RETRY_TIMEOUT);\n\n }\n }\n\n if (isExpired) {\n this.expiredRequestCount++;\n this.state = 'expired';\n } else {\n this.expiredRequestCount = 0;\n }\n }\n }\n\n getExpiryTimeout() {\n if (this.expirationTime) {\n if (this.expiredRequestCount) {\n return 1000 * (1 << Math.min(this.expiredRequestCount - 1, 31));\n } else {\n // Max value for `setTimeout` implementations is a 32 bit integer; cap this accordingly\n return Math.min(this.expirationTime - new Date().getTime(), Math.pow(2, 31) - 1);\n }\n }\n }\n\n setFeatureState(states: LayerFeatureStates, painter: any) {\n if (!this.latestFeatureIndex ||\n !this.latestFeatureIndex.rawTileData ||\n Object.keys(states).length === 0) {\n return;\n }\n\n const vtLayers = this.latestFeatureIndex.loadVTLayers();\n\n for (const id in this.buckets) {\n if (!painter.style.hasLayer(id)) continue;\n\n const bucket = this.buckets[id];\n // Buckets are grouped by common source-layer\n const sourceLayerId = bucket.layers[0]['sourceLayer'] || '_geojsonTileLayer';\n const sourceLayer = vtLayers[sourceLayerId];\n const sourceLayerStates = states[sourceLayerId];\n if (!sourceLayer || !sourceLayerStates || Object.keys(sourceLayerStates).length === 0) continue;\n\n bucket.update(sourceLayerStates, sourceLayer, this.imageAtlas && this.imageAtlas.patternPositions || {});\n const layer = painter && painter.style && painter.style.getLayer(id);\n if (layer) {\n this.queryPadding = Math.max(this.queryPadding, layer.queryRadius(bucket));\n }\n }\n }\n\n holdingForFade(): boolean {\n return this.symbolFadeHoldUntil !== undefined;\n }\n\n symbolFadeFinished(): boolean {\n return !this.symbolFadeHoldUntil || this.symbolFadeHoldUntil < browser.now();\n }\n\n clearFadeHold() {\n this.symbolFadeHoldUntil = undefined;\n }\n\n setHoldDuration(duration: number) {\n this.symbolFadeHoldUntil = browser.now() + duration;\n }\n\n setDependencies(namespace: string, dependencies: Array) {\n const index = {};\n for (const dep of dependencies) {\n index[dep] = true;\n }\n this.dependencies[namespace] = index;\n }\n\n hasDependency(namespaces: Array, keys: Array) {\n for (const namespace of namespaces) {\n const dependencies = this.dependencies[namespace];\n if (dependencies) {\n for (const key of keys) {\n if (dependencies[key]) {\n return true;\n }\n }\n }\n }\n return false;\n }\n}\n\nexport default Tile;\n","// @flow\n\nimport type {CollisionBoxArray} from './array_types';\nimport type Style from '../style/style';\nimport type {TypedStyleLayer} from '../style/style_layer/typed_style_layer';\nimport type FeatureIndex from './feature_index';\nimport type Context from '../gl/context';\nimport type {FeatureStates} from '../source/source_state';\nimport type {ImagePosition} from '../render/image_atlas';\nimport type {CanonicalTileID} from '../source/tile_id';\n\nexport type BucketParameters = {\n index: number,\n layers: Array,\n zoom: number,\n pixelRatio: number,\n overscaling: number,\n collisionBoxArray: CollisionBoxArray,\n sourceLayerIndex: number,\n sourceID: string\n}\n\nexport type PopulateParameters = {\n featureIndex: FeatureIndex,\n iconDependencies: {},\n patternDependencies: {},\n glyphDependencies: {},\n availableImages: Array\n}\n\nexport type IndexedFeature = {\n feature: VectorTileFeature,\n id: number | string,\n index: number,\n sourceLayerIndex: number,\n}\n\nexport type BucketFeature = {|\n index: number,\n sourceLayerIndex: number,\n geometry: Array>,\n properties: Object,\n type: 1 | 2 | 3,\n id?: any,\n +patterns: {[_: string]: {\"min\": string, \"mid\": string, \"max\": string}},\n sortKey?: number\n|};\n\n/**\n * The `Bucket` interface is the single point of knowledge about turning vector\n * tiles into WebGL buffers.\n *\n * `Bucket` is an abstract interface. An implementation exists for each style layer type.\n * Create a bucket via the `StyleLayer#createBucket` method.\n *\n * The concrete bucket types, using layout options from the style layer,\n * transform feature geometries into vertex and index data for use by the\n * vertex shader. They also (via `ProgramConfiguration`) use feature\n * properties and the zoom level to populate the attributes needed for\n * data-driven styling.\n *\n * Buckets are designed to be built on a worker thread and then serialized and\n * transferred back to the main thread for rendering. On the worker side, a\n * bucket's vertex, index, and attribute data is stored in `bucket.arrays:\n * ArrayGroup`. When a bucket's data is serialized and sent back to the main\n * thread, is gets deserialized (using `new Bucket(serializedBucketData)`, with\n * the array data now stored in `bucket.buffers: BufferGroup`. BufferGroups\n * hold the same data as ArrayGroups, but are tuned for consumption by WebGL.\n *\n * @private\n */\nexport interface Bucket {\n layerIds: Array;\n hasPattern: boolean;\n +layers: Array;\n +stateDependentLayers: Array;\n +stateDependentLayerIds: Array;\n populate(features: Array, options: PopulateParameters, canonical: CanonicalTileID): void;\n update(states: FeatureStates, vtLayer: VectorTileLayer, imagePositions: {[_: string]: ImagePosition}): void;\n isEmpty(): boolean;\n\n upload(context: Context): void;\n uploadPending(): boolean;\n\n /**\n * Release the WebGL resources associated with the buffers. Note that because\n * buckets are shared between layers having the same layout properties, they\n * must be destroyed in groups (all buckets for a tile, or all symbol buckets).\n *\n * @private\n */\n destroy(): void;\n}\n\nexport function deserialize(input: Array, style: Style): {[_: string]: Bucket} {\n const output = {};\n\n // Guard against the case where the map's style has been set to null while\n // this bucket has been parsing.\n if (!style) return output;\n\n for (const bucket of input) {\n const layers = bucket.layerIds\n .map((id) => style.getLayer(id))\n .filter(Boolean);\n\n if (layers.length === 0) {\n continue;\n }\n\n // look up StyleLayer objects from layer ids (since we don't\n // want to waste time serializing/copying them from the worker)\n (bucket: any).layers = layers;\n if ((bucket: any).stateDependentLayerIds) {\n (bucket: any).stateDependentLayers = (bucket: any).stateDependentLayerIds.map((lId) => layers.filter((l) => l.id === lId)[0]);\n }\n for (const layer of layers) {\n output[layer.id] = bucket;\n }\n }\n\n return output;\n}\n","\nexport default ['type', 'source', 'source-layer', 'minzoom', 'maxzoom', 'filter', 'layout'];\n","// @flow\n\nimport window from '../util/window';\nimport type {RequestParameters} from '../util/ajax';\n\nconst performance = window.performance;\n\nexport type PerformanceMetrics = {\n loadTime: number,\n fullLoadTime: number,\n fps: number,\n percentDroppedFrames: number\n}\n\nexport const PerformanceMarkers = {\n create: 'create',\n load: 'load',\n fullLoad: 'fullLoad'\n};\n\nlet lastFrameTime = null;\nlet frameTimes = [];\n\nconst minFramerateTarget = 30;\nconst frameTimeTarget = 1000 / minFramerateTarget;\n\nexport const PerformanceUtils = {\n mark(marker: $Keys) {\n performance.mark(marker);\n },\n frame(timestamp: number) {\n const currTimestamp = timestamp;\n if (lastFrameTime != null) {\n const frameTime = currTimestamp - lastFrameTime;\n frameTimes.push(frameTime);\n }\n lastFrameTime = currTimestamp;\n },\n clearMetrics() {\n lastFrameTime = null;\n frameTimes = [];\n performance.clearMeasures('loadTime');\n performance.clearMeasures('fullLoadTime');\n\n for (const marker in PerformanceMarkers) {\n performance.clearMarks(PerformanceMarkers[marker]);\n }\n },\n getPerformanceMetrics(): PerformanceMetrics {\n const loadTime = performance.measure('loadTime', PerformanceMarkers.create, PerformanceMarkers.load).duration;\n const fullLoadTime = performance.measure('fullLoadTime', PerformanceMarkers.create, PerformanceMarkers.fullLoad).duration;\n const totalFrames = frameTimes.length;\n\n const avgFrameTime = frameTimes.reduce((prev, curr) => prev + curr, 0) / totalFrames / 1000;\n const fps = 1 / avgFrameTime;\n\n // count frames that missed our framerate target\n const droppedFrames = frameTimes\n .filter((frameTime) => frameTime > frameTimeTarget)\n .reduce((acc, curr) => {\n return acc + (curr - frameTimeTarget) / frameTimeTarget;\n }, 0);\n const percentDroppedFrames = (droppedFrames / (totalFrames + droppedFrames)) * 100;\n\n return {\n loadTime,\n fullLoadTime,\n fps,\n percentDroppedFrames\n };\n }\n};\n\n/**\n * Safe wrapper for the performance resource timing API in web workers with graceful degradation\n *\n * @param {RequestParameters} request\n * @private\n */\nexport class RequestPerformance {\n _marks: {start: string, end: string, measure: string};\n\n constructor (request: RequestParameters) {\n this._marks = {\n start: [request.url, 'start'].join('#'),\n end: [request.url, 'end'].join('#'),\n measure: request.url.toString()\n };\n\n performance.mark(this._marks.start);\n }\n\n finish() {\n performance.mark(this._marks.end);\n let resourceTimingData = performance.getEntriesByName(this._marks.measure);\n\n // fallback if web worker implementation of perf.getEntriesByName returns empty\n if (resourceTimingData.length === 0) {\n performance.measure(this._marks.measure, this._marks.start, this._marks.end);\n resourceTimingData = performance.getEntriesByName(this._marks.measure);\n\n // cleanup\n performance.clearMarks(this._marks.start);\n performance.clearMarks(this._marks.end);\n performance.clearMeasures(this._marks.measure);\n }\n\n return resourceTimingData;\n }\n}\n\nexport default performance;\n","import * as glMatrix from \"./common.js\";\n/**\r\n * 3x3 Matrix\r\n * @module mat3\r\n */\n\n/**\r\n * Creates a new identity mat3\r\n *\r\n * @returns {mat3} a new 3x3 matrix\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(9);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n }\n\n out[0] = 1;\n out[4] = 1;\n out[8] = 1;\n return out;\n}\n/**\r\n * Copies the upper-left 3x3 values into the given mat3.\r\n *\r\n * @param {mat3} out the receiving 3x3 matrix\r\n * @param {mat4} a the source 4x4 matrix\r\n * @returns {mat3} out\r\n */\n\nexport function fromMat4(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[4];\n out[4] = a[5];\n out[5] = a[6];\n out[6] = a[8];\n out[7] = a[9];\n out[8] = a[10];\n return out;\n}\n/**\r\n * Creates a new mat3 initialized with values from an existing matrix\r\n *\r\n * @param {mat3} a matrix to clone\r\n * @returns {mat3} a new 3x3 matrix\r\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(9);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n}\n/**\r\n * Copy the values from one mat3 to another\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the source matrix\r\n * @returns {mat3} out\r\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n}\n/**\r\n * Create a new mat3 with the given values\r\n *\r\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\r\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\r\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\r\n * @param {Number} m10 Component in column 1, row 0 position (index 3)\r\n * @param {Number} m11 Component in column 1, row 1 position (index 4)\r\n * @param {Number} m12 Component in column 1, row 2 position (index 5)\r\n * @param {Number} m20 Component in column 2, row 0 position (index 6)\r\n * @param {Number} m21 Component in column 2, row 1 position (index 7)\r\n * @param {Number} m22 Component in column 2, row 2 position (index 8)\r\n * @returns {mat3} A new mat3\r\n */\n\nexport function fromValues(m00, m01, m02, m10, m11, m12, m20, m21, m22) {\n var out = new glMatrix.ARRAY_TYPE(9);\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m10;\n out[4] = m11;\n out[5] = m12;\n out[6] = m20;\n out[7] = m21;\n out[8] = m22;\n return out;\n}\n/**\r\n * Set the components of a mat3 to the given values\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\r\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\r\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\r\n * @param {Number} m10 Component in column 1, row 0 position (index 3)\r\n * @param {Number} m11 Component in column 1, row 1 position (index 4)\r\n * @param {Number} m12 Component in column 1, row 2 position (index 5)\r\n * @param {Number} m20 Component in column 2, row 0 position (index 6)\r\n * @param {Number} m21 Component in column 2, row 1 position (index 7)\r\n * @param {Number} m22 Component in column 2, row 2 position (index 8)\r\n * @returns {mat3} out\r\n */\n\nexport function set(out, m00, m01, m02, m10, m11, m12, m20, m21, m22) {\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m10;\n out[4] = m11;\n out[5] = m12;\n out[6] = m20;\n out[7] = m21;\n out[8] = m22;\n return out;\n}\n/**\r\n * Set a mat3 to the identity matrix\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @returns {mat3} out\r\n */\n\nexport function identity(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n/**\r\n * Transpose the values of a mat3\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the source matrix\r\n * @returns {mat3} out\r\n */\n\nexport function transpose(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a01 = a[1],\n a02 = a[2],\n a12 = a[5];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a01;\n out[5] = a[7];\n out[6] = a02;\n out[7] = a12;\n } else {\n out[0] = a[0];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a[1];\n out[4] = a[4];\n out[5] = a[7];\n out[6] = a[2];\n out[7] = a[5];\n out[8] = a[8];\n }\n\n return out;\n}\n/**\r\n * Inverts a mat3\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the source matrix\r\n * @returns {mat3} out\r\n */\n\nexport function invert(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2];\n var a10 = a[3],\n a11 = a[4],\n a12 = a[5];\n var a20 = a[6],\n a21 = a[7],\n a22 = a[8];\n var b01 = a22 * a11 - a12 * a21;\n var b11 = -a22 * a10 + a12 * a20;\n var b21 = a21 * a10 - a11 * a20; // Calculate the determinant\n\n var det = a00 * b01 + a01 * b11 + a02 * b21;\n\n if (!det) {\n return null;\n }\n\n det = 1.0 / det;\n out[0] = b01 * det;\n out[1] = (-a22 * a01 + a02 * a21) * det;\n out[2] = (a12 * a01 - a02 * a11) * det;\n out[3] = b11 * det;\n out[4] = (a22 * a00 - a02 * a20) * det;\n out[5] = (-a12 * a00 + a02 * a10) * det;\n out[6] = b21 * det;\n out[7] = (-a21 * a00 + a01 * a20) * det;\n out[8] = (a11 * a00 - a01 * a10) * det;\n return out;\n}\n/**\r\n * Calculates the adjugate of a mat3\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the source matrix\r\n * @returns {mat3} out\r\n */\n\nexport function adjoint(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2];\n var a10 = a[3],\n a11 = a[4],\n a12 = a[5];\n var a20 = a[6],\n a21 = a[7],\n a22 = a[8];\n out[0] = a11 * a22 - a12 * a21;\n out[1] = a02 * a21 - a01 * a22;\n out[2] = a01 * a12 - a02 * a11;\n out[3] = a12 * a20 - a10 * a22;\n out[4] = a00 * a22 - a02 * a20;\n out[5] = a02 * a10 - a00 * a12;\n out[6] = a10 * a21 - a11 * a20;\n out[7] = a01 * a20 - a00 * a21;\n out[8] = a00 * a11 - a01 * a10;\n return out;\n}\n/**\r\n * Calculates the determinant of a mat3\r\n *\r\n * @param {mat3} a the source matrix\r\n * @returns {Number} determinant of a\r\n */\n\nexport function determinant(a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2];\n var a10 = a[3],\n a11 = a[4],\n a12 = a[5];\n var a20 = a[6],\n a21 = a[7],\n a22 = a[8];\n return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20);\n}\n/**\r\n * Multiplies two mat3's\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the first operand\r\n * @param {mat3} b the second operand\r\n * @returns {mat3} out\r\n */\n\nexport function multiply(out, a, b) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2];\n var a10 = a[3],\n a11 = a[4],\n a12 = a[5];\n var a20 = a[6],\n a21 = a[7],\n a22 = a[8];\n var b00 = b[0],\n b01 = b[1],\n b02 = b[2];\n var b10 = b[3],\n b11 = b[4],\n b12 = b[5];\n var b20 = b[6],\n b21 = b[7],\n b22 = b[8];\n out[0] = b00 * a00 + b01 * a10 + b02 * a20;\n out[1] = b00 * a01 + b01 * a11 + b02 * a21;\n out[2] = b00 * a02 + b01 * a12 + b02 * a22;\n out[3] = b10 * a00 + b11 * a10 + b12 * a20;\n out[4] = b10 * a01 + b11 * a11 + b12 * a21;\n out[5] = b10 * a02 + b11 * a12 + b12 * a22;\n out[6] = b20 * a00 + b21 * a10 + b22 * a20;\n out[7] = b20 * a01 + b21 * a11 + b22 * a21;\n out[8] = b20 * a02 + b21 * a12 + b22 * a22;\n return out;\n}\n/**\r\n * Translate a mat3 by the given vector\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the matrix to translate\r\n * @param {vec2} v vector to translate by\r\n * @returns {mat3} out\r\n */\n\nexport function translate(out, a, v) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a10 = a[3],\n a11 = a[4],\n a12 = a[5],\n a20 = a[6],\n a21 = a[7],\n a22 = a[8],\n x = v[0],\n y = v[1];\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n out[3] = a10;\n out[4] = a11;\n out[5] = a12;\n out[6] = x * a00 + y * a10 + a20;\n out[7] = x * a01 + y * a11 + a21;\n out[8] = x * a02 + y * a12 + a22;\n return out;\n}\n/**\r\n * Rotates a mat3 by the given angle\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the matrix to rotate\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat3} out\r\n */\n\nexport function rotate(out, a, rad) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a10 = a[3],\n a11 = a[4],\n a12 = a[5],\n a20 = a[6],\n a21 = a[7],\n a22 = a[8],\n s = Math.sin(rad),\n c = Math.cos(rad);\n out[0] = c * a00 + s * a10;\n out[1] = c * a01 + s * a11;\n out[2] = c * a02 + s * a12;\n out[3] = c * a10 - s * a00;\n out[4] = c * a11 - s * a01;\n out[5] = c * a12 - s * a02;\n out[6] = a20;\n out[7] = a21;\n out[8] = a22;\n return out;\n}\n/**\r\n * Scales the mat3 by the dimensions in the given vec2\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the matrix to rotate\r\n * @param {vec2} v the vec2 to scale the matrix by\r\n * @returns {mat3} out\r\n **/\n\nexport function scale(out, a, v) {\n var x = v[0],\n y = v[1];\n out[0] = x * a[0];\n out[1] = x * a[1];\n out[2] = x * a[2];\n out[3] = y * a[3];\n out[4] = y * a[4];\n out[5] = y * a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n}\n/**\r\n * Creates a matrix from a vector translation\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat3.identity(dest);\r\n * mat3.translate(dest, dest, vec);\r\n *\r\n * @param {mat3} out mat3 receiving operation result\r\n * @param {vec2} v Translation vector\r\n * @returns {mat3} out\r\n */\n\nexport function fromTranslation(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = v[0];\n out[7] = v[1];\n out[8] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a given angle\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat3.identity(dest);\r\n * mat3.rotate(dest, dest, rad);\r\n *\r\n * @param {mat3} out mat3 receiving operation result\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat3} out\r\n */\n\nexport function fromRotation(out, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = -s;\n out[4] = c;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat3.identity(dest);\r\n * mat3.scale(dest, dest, vec);\r\n *\r\n * @param {mat3} out mat3 receiving operation result\r\n * @param {vec2} v Scaling vector\r\n * @returns {mat3} out\r\n */\n\nexport function fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = v[1];\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n/**\r\n * Copies the values from a mat2d into a mat3\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat2d} a the matrix to copy\r\n * @returns {mat3} out\r\n **/\n\nexport function fromMat2d(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = 0;\n out[3] = a[2];\n out[4] = a[3];\n out[5] = 0;\n out[6] = a[4];\n out[7] = a[5];\n out[8] = 1;\n return out;\n}\n/**\r\n * Calculates a 3x3 matrix from the given quaternion\r\n *\r\n * @param {mat3} out mat3 receiving operation result\r\n * @param {quat} q Quaternion to create matrix from\r\n *\r\n * @returns {mat3} out\r\n */\n\nexport function fromQuat(out, q) {\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var yx = y * x2;\n var yy = y * y2;\n var zx = z * x2;\n var zy = z * y2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n out[0] = 1 - yy - zz;\n out[3] = yx - wz;\n out[6] = zx + wy;\n out[1] = yx + wz;\n out[4] = 1 - xx - zz;\n out[7] = zy - wx;\n out[2] = zx - wy;\n out[5] = zy + wx;\n out[8] = 1 - xx - yy;\n return out;\n}\n/**\r\n * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\r\n *\r\n * @param {mat3} out mat3 receiving operation result\r\n * @param {mat4} a Mat4 to derive the normal matrix from\r\n *\r\n * @returns {mat3} out\r\n */\n\nexport function normalFromMat4(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n var b00 = a00 * a11 - a01 * a10;\n var b01 = a00 * a12 - a02 * a10;\n var b02 = a00 * a13 - a03 * a10;\n var b03 = a01 * a12 - a02 * a11;\n var b04 = a01 * a13 - a03 * a11;\n var b05 = a02 * a13 - a03 * a12;\n var b06 = a20 * a31 - a21 * a30;\n var b07 = a20 * a32 - a22 * a30;\n var b08 = a20 * a33 - a23 * a30;\n var b09 = a21 * a32 - a22 * a31;\n var b10 = a21 * a33 - a23 * a31;\n var b11 = a22 * a33 - a23 * a32; // Calculate the determinant\n\n var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) {\n return null;\n }\n\n det = 1.0 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n return out;\n}\n/**\r\n * Generates a 2D projection matrix with the given bounds\r\n *\r\n * @param {mat3} out mat3 frustum matrix will be written into\r\n * @param {number} width Width of your gl context\r\n * @param {number} height Height of gl context\r\n * @returns {mat3} out\r\n */\n\nexport function projection(out, width, height) {\n out[0] = 2 / width;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = -2 / height;\n out[5] = 0;\n out[6] = -1;\n out[7] = 1;\n out[8] = 1;\n return out;\n}\n/**\r\n * Returns a string representation of a mat3\r\n *\r\n * @param {mat3} a matrix to represent as a string\r\n * @returns {String} string representation of the matrix\r\n */\n\nexport function str(a) {\n return \"mat3(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \", \" + a[3] + \", \" + a[4] + \", \" + a[5] + \", \" + a[6] + \", \" + a[7] + \", \" + a[8] + \")\";\n}\n/**\r\n * Returns Frobenius norm of a mat3\r\n *\r\n * @param {mat3} a the matrix to calculate Frobenius norm of\r\n * @returns {Number} Frobenius norm\r\n */\n\nexport function frob(a) {\n return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]);\n}\n/**\r\n * Adds two mat3's\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the first operand\r\n * @param {mat3} b the second operand\r\n * @returns {mat3} out\r\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n out[8] = a[8] + b[8];\n return out;\n}\n/**\r\n * Subtracts matrix b from matrix a\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the first operand\r\n * @param {mat3} b the second operand\r\n * @returns {mat3} out\r\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n out[6] = a[6] - b[6];\n out[7] = a[7] - b[7];\n out[8] = a[8] - b[8];\n return out;\n}\n/**\r\n * Multiply each element of the matrix by a scalar.\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the matrix to scale\r\n * @param {Number} b amount to scale the matrix's elements by\r\n * @returns {mat3} out\r\n */\n\nexport function multiplyScalar(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n out[8] = a[8] * b;\n return out;\n}\n/**\r\n * Adds two mat3's after multiplying each element of the second operand by a scalar value.\r\n *\r\n * @param {mat3} out the receiving vector\r\n * @param {mat3} a the first operand\r\n * @param {mat3} b the second operand\r\n * @param {Number} scale the amount to scale b's elements by before adding\r\n * @returns {mat3} out\r\n */\n\nexport function multiplyScalarAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\n out[6] = a[6] + b[6] * scale;\n out[7] = a[7] + b[7] * scale;\n out[8] = a[8] + b[8] * scale;\n return out;\n}\n/**\r\n * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)\r\n *\r\n * @param {mat3} a The first matrix.\r\n * @param {mat3} b The second matrix.\r\n * @returns {Boolean} True if the matrices are equal, false otherwise.\r\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8];\n}\n/**\r\n * Returns whether or not the matrices have approximately the same elements in the same position.\r\n *\r\n * @param {mat3} a The first matrix.\r\n * @param {mat3} b The second matrix.\r\n * @returns {Boolean} True if the matrices are equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3],\n a4 = a[4],\n a5 = a[5],\n a6 = a[6],\n a7 = a[7],\n a8 = a[8];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3],\n b4 = b[4],\n b5 = b[5],\n b6 = b[6],\n b7 = b[7],\n b8 = b[8];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8));\n}\n/**\r\n * Alias for {@link mat3.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Alias for {@link mat3.subtract}\r\n * @function\r\n */\n\nexport var sub = subtract;","import * as glMatrix from \"./common.js\";\n/**\r\n * 2x2 Matrix\r\n * @module mat2\r\n */\n\n/**\r\n * Creates a new identity mat2\r\n *\r\n * @returns {mat2} a new 2x2 matrix\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(4);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[1] = 0;\n out[2] = 0;\n }\n\n out[0] = 1;\n out[3] = 1;\n return out;\n}\n/**\r\n * Creates a new mat2 initialized with values from an existing matrix\r\n *\r\n * @param {mat2} a matrix to clone\r\n * @returns {mat2} a new 2x2 matrix\r\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\n/**\r\n * Copy the values from one mat2 to another\r\n *\r\n * @param {mat2} out the receiving matrix\r\n * @param {mat2} a the source matrix\r\n * @returns {mat2} out\r\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\n/**\r\n * Set a mat2 to the identity matrix\r\n *\r\n * @param {mat2} out the receiving matrix\r\n * @returns {mat2} out\r\n */\n\nexport function identity(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n}\n/**\r\n * Create a new mat2 with the given values\r\n *\r\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\r\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\r\n * @param {Number} m10 Component in column 1, row 0 position (index 2)\r\n * @param {Number} m11 Component in column 1, row 1 position (index 3)\r\n * @returns {mat2} out A new 2x2 matrix\r\n */\n\nexport function fromValues(m00, m01, m10, m11) {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = m00;\n out[1] = m01;\n out[2] = m10;\n out[3] = m11;\n return out;\n}\n/**\r\n * Set the components of a mat2 to the given values\r\n *\r\n * @param {mat2} out the receiving matrix\r\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\r\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\r\n * @param {Number} m10 Component in column 1, row 0 position (index 2)\r\n * @param {Number} m11 Component in column 1, row 1 position (index 3)\r\n * @returns {mat2} out\r\n */\n\nexport function set(out, m00, m01, m10, m11) {\n out[0] = m00;\n out[1] = m01;\n out[2] = m10;\n out[3] = m11;\n return out;\n}\n/**\r\n * Transpose the values of a mat2\r\n *\r\n * @param {mat2} out the receiving matrix\r\n * @param {mat2} a the source matrix\r\n * @returns {mat2} out\r\n */\n\nexport function transpose(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache\n // some values\n if (out === a) {\n var a1 = a[1];\n out[1] = a[2];\n out[2] = a1;\n } else {\n out[0] = a[0];\n out[1] = a[2];\n out[2] = a[1];\n out[3] = a[3];\n }\n\n return out;\n}\n/**\r\n * Inverts a mat2\r\n *\r\n * @param {mat2} out the receiving matrix\r\n * @param {mat2} a the source matrix\r\n * @returns {mat2} out\r\n */\n\nexport function invert(out, a) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3]; // Calculate the determinant\n\n var det = a0 * a3 - a2 * a1;\n\n if (!det) {\n return null;\n }\n\n det = 1.0 / det;\n out[0] = a3 * det;\n out[1] = -a1 * det;\n out[2] = -a2 * det;\n out[3] = a0 * det;\n return out;\n}\n/**\r\n * Calculates the adjugate of a mat2\r\n *\r\n * @param {mat2} out the receiving matrix\r\n * @param {mat2} a the source matrix\r\n * @returns {mat2} out\r\n */\n\nexport function adjoint(out, a) {\n // Caching this value is nessecary if out == a\n var a0 = a[0];\n out[0] = a[3];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a0;\n return out;\n}\n/**\r\n * Calculates the determinant of a mat2\r\n *\r\n * @param {mat2} a the source matrix\r\n * @returns {Number} determinant of a\r\n */\n\nexport function determinant(a) {\n return a[0] * a[3] - a[2] * a[1];\n}\n/**\r\n * Multiplies two mat2's\r\n *\r\n * @param {mat2} out the receiving matrix\r\n * @param {mat2} a the first operand\r\n * @param {mat2} b the second operand\r\n * @returns {mat2} out\r\n */\n\nexport function multiply(out, a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n out[0] = a0 * b0 + a2 * b1;\n out[1] = a1 * b0 + a3 * b1;\n out[2] = a0 * b2 + a2 * b3;\n out[3] = a1 * b2 + a3 * b3;\n return out;\n}\n/**\r\n * Rotates a mat2 by the given angle\r\n *\r\n * @param {mat2} out the receiving matrix\r\n * @param {mat2} a the matrix to rotate\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat2} out\r\n */\n\nexport function rotate(out, a, rad) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n out[0] = a0 * c + a2 * s;\n out[1] = a1 * c + a3 * s;\n out[2] = a0 * -s + a2 * c;\n out[3] = a1 * -s + a3 * c;\n return out;\n}\n/**\r\n * Scales the mat2 by the dimensions in the given vec2\r\n *\r\n * @param {mat2} out the receiving matrix\r\n * @param {mat2} a the matrix to rotate\r\n * @param {vec2} v the vec2 to scale the matrix by\r\n * @returns {mat2} out\r\n **/\n\nexport function scale(out, a, v) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var v0 = v[0],\n v1 = v[1];\n out[0] = a0 * v0;\n out[1] = a1 * v0;\n out[2] = a2 * v1;\n out[3] = a3 * v1;\n return out;\n}\n/**\r\n * Creates a matrix from a given angle\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat2.identity(dest);\r\n * mat2.rotate(dest, dest, rad);\r\n *\r\n * @param {mat2} out mat2 receiving operation result\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat2} out\r\n */\n\nexport function fromRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = -s;\n out[3] = c;\n return out;\n}\n/**\r\n * Creates a matrix from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat2.identity(dest);\r\n * mat2.scale(dest, dest, vec);\r\n *\r\n * @param {mat2} out mat2 receiving operation result\r\n * @param {vec2} v Scaling vector\r\n * @returns {mat2} out\r\n */\n\nexport function fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = v[1];\n return out;\n}\n/**\r\n * Returns a string representation of a mat2\r\n *\r\n * @param {mat2} a matrix to represent as a string\r\n * @returns {String} string representation of the matrix\r\n */\n\nexport function str(a) {\n return \"mat2(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \", \" + a[3] + \")\";\n}\n/**\r\n * Returns Frobenius norm of a mat2\r\n *\r\n * @param {mat2} a the matrix to calculate Frobenius norm of\r\n * @returns {Number} Frobenius norm\r\n */\n\nexport function frob(a) {\n return Math.hypot(a[0], a[1], a[2], a[3]);\n}\n/**\r\n * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix\r\n * @param {mat2} L the lower triangular matrix\r\n * @param {mat2} D the diagonal matrix\r\n * @param {mat2} U the upper triangular matrix\r\n * @param {mat2} a the input matrix to factorize\r\n */\n\nexport function LDU(L, D, U, a) {\n L[2] = a[2] / a[0];\n U[0] = a[0];\n U[1] = a[1];\n U[3] = a[3] - L[2] * U[1];\n return [L, D, U];\n}\n/**\r\n * Adds two mat2's\r\n *\r\n * @param {mat2} out the receiving matrix\r\n * @param {mat2} a the first operand\r\n * @param {mat2} b the second operand\r\n * @returns {mat2} out\r\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n return out;\n}\n/**\r\n * Subtracts matrix b from matrix a\r\n *\r\n * @param {mat2} out the receiving matrix\r\n * @param {mat2} a the first operand\r\n * @param {mat2} b the second operand\r\n * @returns {mat2} out\r\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n return out;\n}\n/**\r\n * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)\r\n *\r\n * @param {mat2} a The first matrix.\r\n * @param {mat2} b The second matrix.\r\n * @returns {Boolean} True if the matrices are equal, false otherwise.\r\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n/**\r\n * Returns whether or not the matrices have approximately the same elements in the same position.\r\n *\r\n * @param {mat2} a The first matrix.\r\n * @param {mat2} b The second matrix.\r\n * @returns {Boolean} True if the matrices are equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3));\n}\n/**\r\n * Multiply each element of the matrix by a scalar.\r\n *\r\n * @param {mat2} out the receiving matrix\r\n * @param {mat2} a the matrix to scale\r\n * @param {Number} b amount to scale the matrix's elements by\r\n * @returns {mat2} out\r\n */\n\nexport function multiplyScalar(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n return out;\n}\n/**\r\n * Adds two mat2's after multiplying each element of the second operand by a scalar value.\r\n *\r\n * @param {mat2} out the receiving vector\r\n * @param {mat2} a the first operand\r\n * @param {mat2} b the second operand\r\n * @param {Number} scale the amount to scale b's elements by before adding\r\n * @returns {mat2} out\r\n */\n\nexport function multiplyScalarAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n return out;\n}\n/**\r\n * Alias for {@link mat2.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Alias for {@link mat2.subtract}\r\n * @function\r\n */\n\nexport var sub = subtract;","// @flow\n\n/**\n * Deeply compares two object literals.\n *\n * @private\n */\nfunction deepEqual(a: ?mixed, b: ?mixed): boolean {\n if (Array.isArray(a)) {\n if (!Array.isArray(b) || a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (!deepEqual(a[i], b[i])) return false;\n }\n return true;\n }\n if (typeof a === 'object' && a !== null && b !== null) {\n if (!(typeof b === 'object')) return false;\n const keys = Object.keys(a);\n if (keys.length !== Object.keys(b).length) return false;\n for (const key in a) {\n if (!deepEqual(a[key], b[key])) return false;\n }\n return true;\n }\n return a === b;\n}\n\nexport default deepEqual;\n","\nimport refProperties from './util/ref_properties';\n\nfunction stringify(obj) {\n const type = typeof obj;\n if (type === 'number' || type === 'boolean' || type === 'string' || obj === undefined || obj === null)\n return JSON.stringify(obj);\n\n if (Array.isArray(obj)) {\n let str = '[';\n for (const val of obj) {\n str += `${stringify(val)},`;\n }\n return `${str}]`;\n }\n\n const keys = Object.keys(obj).sort();\n\n let str = '{';\n for (let i = 0; i < keys.length; i++) {\n str += `${JSON.stringify(keys[i])}:${stringify(obj[keys[i]])},`;\n }\n return `${str}}`;\n}\n\nfunction getKey(layer) {\n let key = '';\n for (const k of refProperties) {\n key += `/${stringify(layer[k])}`;\n }\n return key;\n}\n\nexport default groupByLayout;\n\n/**\n * Given an array of layers, return an array of arrays of layers where all\n * layers in each group have identical layout-affecting properties. These\n * are the properties that were formerly used by explicit `ref` mechanism\n * for layers: 'type', 'source', 'source-layer', 'minzoom', 'maxzoom',\n * 'filter', and 'layout'.\n *\n * The input is not modified. The output layers are references to the\n * input layers.\n *\n * @private\n * @param {Array} layers\n * @param {Object} [cachedKeys] - an object to keep already calculated keys.\n * @returns {Array>}\n */\nfunction groupByLayout(layers, cachedKeys) {\n const groups = {};\n\n for (let i = 0; i < layers.length; i++) {\n\n const k = (cachedKeys && cachedKeys[layers[i].id]) || getKey(layers[i]);\n // update the cache if there is one\n if (cachedKeys)\n cachedKeys[layers[i].id] = k;\n\n let group = groups[k];\n if (!group) {\n group = groups[k] = [];\n }\n group.push(layers[i]);\n }\n\n const result = [];\n\n for (const k in groups) {\n result.push(groups[k]);\n }\n\n return result;\n}\n","// @flow\n\nimport StyleLayer from './style_layer';\nimport createStyleLayer from './create_style_layer';\n\nimport {values} from '../util/util';\nimport featureFilter from '../style-spec/feature_filter';\nimport groupByLayout from '../style-spec/group_by_layout';\n\nimport type {TypedStyleLayer} from './style_layer/typed_style_layer';\nimport type {LayerSpecification} from '../style-spec/types';\n\nexport type LayerConfigs = {[_: string]: LayerSpecification };\nexport type Family = Array;\n\nclass StyleLayerIndex {\n familiesBySource: { [source: string]: { [sourceLayer: string]: Array> } };\n keyCache: { [source: string]: string };\n\n _layerConfigs: LayerConfigs;\n _layers: {[_: string]: StyleLayer };\n\n constructor(layerConfigs: ?Array) {\n this.keyCache = {};\n if (layerConfigs) {\n this.replace(layerConfigs);\n }\n }\n\n replace(layerConfigs: Array) {\n this._layerConfigs = {};\n this._layers = {};\n this.update(layerConfigs, []);\n }\n\n update(layerConfigs: Array, removedIds: Array) {\n for (const layerConfig of layerConfigs) {\n this._layerConfigs[layerConfig.id] = layerConfig;\n\n const layer = this._layers[layerConfig.id] = createStyleLayer(layerConfig);\n layer._featureFilter = featureFilter(layer.filter);\n if (this.keyCache[layerConfig.id])\n delete this.keyCache[layerConfig.id];\n }\n for (const id of removedIds) {\n delete this.keyCache[id];\n delete this._layerConfigs[id];\n delete this._layers[id];\n }\n\n this.familiesBySource = {};\n\n const groups = groupByLayout(values(this._layerConfigs), this.keyCache);\n\n for (const layerConfigs of groups) {\n const layers = layerConfigs.map((layerConfig) => this._layers[layerConfig.id]);\n\n const layer = layers[0];\n if (layer.visibility === 'none') {\n continue;\n }\n\n const sourceId = layer.source || '';\n let sourceGroup = this.familiesBySource[sourceId];\n if (!sourceGroup) {\n sourceGroup = this.familiesBySource[sourceId] = {};\n }\n\n const sourceLayerId = layer.sourceLayer || '_geojsonTileLayer';\n let sourceLayerFamilies = sourceGroup[sourceLayerId];\n if (!sourceLayerFamilies) {\n sourceLayerFamilies = sourceGroup[sourceLayerId] = [];\n }\n\n sourceLayerFamilies.push(layers);\n }\n }\n}\n\nexport default StyleLayerIndex;\n","// @flow\n\nimport {AlphaImage} from '../util/image';\nimport {register} from '../util/web_worker_transfer';\nimport potpack from 'potpack';\n\nimport type {GlyphMetrics, StyleGlyph} from '../style/style_glyph';\n\nconst padding = 1;\n\nexport type Rect = {\n x: number,\n y: number,\n w: number,\n h: number\n};\n\nexport type GlyphPosition = {\n rect: Rect,\n metrics: GlyphMetrics\n};\n\nexport type GlyphPositions = {[_: string]: {[_: number]: GlyphPosition } }\n\nexport default class GlyphAtlas {\n image: AlphaImage;\n positions: GlyphPositions;\n\n constructor(stacks: {[_: string]: {[_: number]: ?StyleGlyph } }) {\n const positions = {};\n const bins = [];\n\n for (const stack in stacks) {\n const glyphs = stacks[stack];\n const stackPositions = positions[stack] = {};\n\n for (const id in glyphs) {\n const src = glyphs[+id];\n if (!src || src.bitmap.width === 0 || src.bitmap.height === 0) continue;\n\n const bin = {\n x: 0,\n y: 0,\n w: src.bitmap.width + 2 * padding,\n h: src.bitmap.height + 2 * padding\n };\n bins.push(bin);\n stackPositions[id] = {rect: bin, metrics: src.metrics};\n }\n }\n\n const {w, h} = potpack(bins);\n const image = new AlphaImage({width: w || 1, height: h || 1});\n\n for (const stack in stacks) {\n const glyphs = stacks[stack];\n\n for (const id in glyphs) {\n const src = glyphs[+id];\n if (!src || src.bitmap.width === 0 || src.bitmap.height === 0) continue;\n const bin = positions[stack][id].rect;\n AlphaImage.copy(src.bitmap, image, {x: 0, y: 0}, {x: bin.x + padding, y: bin.y + padding}, src.bitmap);\n }\n }\n\n this.image = image;\n this.positions = positions;\n }\n}\n\nregister('GlyphAtlas', GlyphAtlas);\n","// @flow\n\nimport FeatureIndex from '../data/feature_index';\n\nimport {performSymbolLayout} from '../symbol/symbol_layout';\nimport {CollisionBoxArray} from '../data/array_types';\nimport DictionaryCoder from '../util/dictionary_coder';\nimport SymbolBucket from '../data/bucket/symbol_bucket';\nimport LineBucket from '../data/bucket/line_bucket';\nimport FillBucket from '../data/bucket/fill_bucket';\nimport FillExtrusionBucket from '../data/bucket/fill_extrusion_bucket';\nimport {warnOnce, mapObject, values} from '../util/util';\nimport assert from 'assert';\nimport ImageAtlas from '../render/image_atlas';\nimport GlyphAtlas from '../render/glyph_atlas';\nimport EvaluationParameters from '../style/evaluation_parameters';\nimport {OverscaledTileID} from './tile_id';\n\nimport type {Bucket} from '../data/bucket';\nimport type Actor from '../util/actor';\nimport type StyleLayer from '../style/style_layer';\nimport type StyleLayerIndex from '../style/style_layer_index';\nimport type {StyleImage} from '../style/style_image';\nimport type {StyleGlyph} from '../style/style_glyph';\nimport type {\n WorkerTileParameters,\n WorkerTileCallback,\n} from '../source/worker_source';\nimport type {PromoteIdSpecification} from '../style-spec/types';\n\nclass WorkerTile {\n tileID: OverscaledTileID;\n uid: string;\n zoom: number;\n pixelRatio: number;\n tileSize: number;\n source: string;\n promoteId: ?PromoteIdSpecification;\n overscaling: number;\n showCollisionBoxes: boolean;\n collectResourceTiming: boolean;\n returnDependencies: boolean;\n\n status: 'parsing' | 'done';\n data: VectorTile;\n collisionBoxArray: CollisionBoxArray;\n\n abort: ?() => void;\n reloadCallback: WorkerTileCallback;\n vectorTile: VectorTile;\n\n constructor(params: WorkerTileParameters) {\n this.tileID = new OverscaledTileID(params.tileID.overscaledZ, params.tileID.wrap, params.tileID.canonical.z, params.tileID.canonical.x, params.tileID.canonical.y);\n this.uid = params.uid;\n this.zoom = params.zoom;\n this.pixelRatio = params.pixelRatio;\n this.tileSize = params.tileSize;\n this.source = params.source;\n this.overscaling = this.tileID.overscaleFactor();\n this.showCollisionBoxes = params.showCollisionBoxes;\n this.collectResourceTiming = !!params.collectResourceTiming;\n this.returnDependencies = !!params.returnDependencies;\n this.promoteId = params.promoteId;\n }\n\n parse(data: VectorTile, layerIndex: StyleLayerIndex, availableImages: Array, actor: Actor, callback: WorkerTileCallback) {\n this.status = 'parsing';\n this.data = data;\n\n this.collisionBoxArray = new CollisionBoxArray();\n const sourceLayerCoder = new DictionaryCoder(Object.keys(data.layers).sort());\n\n const featureIndex = new FeatureIndex(this.tileID, this.promoteId);\n featureIndex.bucketLayerIDs = [];\n\n const buckets: {[_: string]: Bucket} = {};\n\n const options = {\n featureIndex,\n iconDependencies: {},\n patternDependencies: {},\n glyphDependencies: {},\n availableImages\n };\n\n const layerFamilies = layerIndex.familiesBySource[this.source];\n for (const sourceLayerId in layerFamilies) {\n const sourceLayer = data.layers[sourceLayerId];\n if (!sourceLayer) {\n continue;\n }\n\n if (sourceLayer.version === 1) {\n warnOnce(`Vector tile source \"${this.source}\" layer \"${sourceLayerId}\" ` +\n `does not use vector tile spec v2 and therefore may have some rendering errors.`);\n }\n\n const sourceLayerIndex = sourceLayerCoder.encode(sourceLayerId);\n const features = [];\n for (let index = 0; index < sourceLayer.length; index++) {\n const feature = sourceLayer.feature(index);\n const id = featureIndex.getId(feature, sourceLayerId);\n features.push({feature, id, index, sourceLayerIndex});\n }\n\n for (const family of layerFamilies[sourceLayerId]) {\n const layer = family[0];\n\n assert(layer.source === this.source);\n if (layer.minzoom && this.zoom < Math.floor(layer.minzoom)) continue;\n if (layer.maxzoom && this.zoom >= layer.maxzoom) continue;\n if (layer.visibility === 'none') continue;\n\n recalculateLayers(family, this.zoom, availableImages);\n\n const bucket = buckets[layer.id] = layer.createBucket({\n index: featureIndex.bucketLayerIDs.length,\n layers: family,\n zoom: this.zoom,\n pixelRatio: this.pixelRatio,\n overscaling: this.overscaling,\n collisionBoxArray: this.collisionBoxArray,\n sourceLayerIndex,\n sourceID: this.source\n });\n\n bucket.populate(features, options, this.tileID.canonical);\n featureIndex.bucketLayerIDs.push(family.map((l) => l.id));\n }\n }\n\n let error: ?Error;\n let glyphMap: ?{[_: string]: {[_: number]: ?StyleGlyph}};\n let iconMap: ?{[_: string]: StyleImage};\n let patternMap: ?{[_: string]: StyleImage};\n\n const stacks = mapObject(options.glyphDependencies, (glyphs) => Object.keys(glyphs).map(Number));\n if (Object.keys(stacks).length) {\n actor.send('getGlyphs', {uid: this.uid, stacks}, (err, result) => {\n if (!error) {\n error = err;\n glyphMap = result;\n maybePrepare.call(this);\n }\n });\n } else {\n glyphMap = {};\n }\n\n const icons = Object.keys(options.iconDependencies);\n if (icons.length) {\n actor.send('getImages', {icons, source: this.source, tileID: this.tileID, type: 'icons'}, (err, result) => {\n if (!error) {\n error = err;\n iconMap = result;\n maybePrepare.call(this);\n }\n });\n } else {\n iconMap = {};\n }\n\n const patterns = Object.keys(options.patternDependencies);\n if (patterns.length) {\n actor.send('getImages', {icons: patterns, source: this.source, tileID: this.tileID, type: 'patterns'}, (err, result) => {\n if (!error) {\n error = err;\n patternMap = result;\n maybePrepare.call(this);\n }\n });\n } else {\n patternMap = {};\n }\n\n maybePrepare.call(this);\n\n function maybePrepare() {\n if (error) {\n return callback(error);\n } else if (glyphMap && iconMap && patternMap) {\n const glyphAtlas = new GlyphAtlas(glyphMap);\n const imageAtlas = new ImageAtlas(iconMap, patternMap);\n\n for (const key in buckets) {\n const bucket = buckets[key];\n if (bucket instanceof SymbolBucket) {\n recalculateLayers(bucket.layers, this.zoom, availableImages);\n performSymbolLayout(bucket, glyphMap, glyphAtlas.positions, iconMap, imageAtlas.iconPositions, this.showCollisionBoxes, this.tileID.canonical);\n } else if (bucket.hasPattern &&\n (bucket instanceof LineBucket ||\n bucket instanceof FillBucket ||\n bucket instanceof FillExtrusionBucket)) {\n recalculateLayers(bucket.layers, this.zoom, availableImages);\n bucket.addFeatures(options, this.tileID.canonical, imageAtlas.patternPositions);\n }\n }\n\n this.status = 'done';\n callback(null, {\n buckets: values(buckets).filter(b => !b.isEmpty()),\n featureIndex,\n collisionBoxArray: this.collisionBoxArray,\n glyphAtlasImage: glyphAtlas.image,\n imageAtlas,\n // Only used for benchmarking:\n glyphMap: this.returnDependencies ? glyphMap : null,\n iconMap: this.returnDependencies ? iconMap : null,\n glyphPositions: this.returnDependencies ? glyphAtlas.positions : null\n });\n }\n }\n }\n}\n\nfunction recalculateLayers(layers: $ReadOnlyArray, zoom: number, availableImages: Array) {\n // Layers are shared and may have been used by a WorkerTile with a different zoom.\n const parameters = new EvaluationParameters(zoom);\n for (const layer of layers) {\n layer.recalculate(parameters, availableImages);\n }\n}\n\nexport default WorkerTile;\n","// @flow\n\nimport {getArrayBuffer} from '../util/ajax';\n\nimport vt from '@mapbox/vector-tile';\nimport Protobuf from 'pbf';\nimport WorkerTile from './worker_tile';\nimport {extend} from '../util/util';\nimport {RequestPerformance} from '../util/performance';\n\nimport type {\n WorkerSource,\n WorkerTileParameters,\n WorkerTileCallback,\n TileParameters\n} from '../source/worker_source';\n\nimport type Actor from '../util/actor';\nimport type StyleLayerIndex from '../style/style_layer_index';\nimport type {Callback} from '../types/callback';\n\nexport type LoadVectorTileResult = {\n vectorTile: VectorTile;\n rawData: ArrayBuffer;\n expires?: any;\n cacheControl?: any;\n resourceTiming?: Array;\n};\n\n/**\n * @callback LoadVectorDataCallback\n * @param error\n * @param vectorTile\n * @private\n */\nexport type LoadVectorDataCallback = Callback;\n\nexport type AbortVectorData = () => void;\nexport type LoadVectorData = (params: WorkerTileParameters, callback: LoadVectorDataCallback) => ?AbortVectorData;\n\n/**\n * @private\n */\nfunction loadVectorTile(params: WorkerTileParameters, callback: LoadVectorDataCallback) {\n const request = getArrayBuffer(params.request, (err: ?Error, data: ?ArrayBuffer, cacheControl: ?string, expires: ?string) => {\n if (err) {\n callback(err);\n } else if (data) {\n callback(null, {\n vectorTile: new vt.VectorTile(new Protobuf(data)),\n rawData: data,\n cacheControl,\n expires\n });\n }\n });\n return () => {\n request.cancel();\n callback();\n };\n}\n\n/**\n * The {@link WorkerSource} implementation that supports {@link VectorTileSource}.\n * This class is designed to be easily reused to support custom source types\n * for data formats that can be parsed/converted into an in-memory VectorTile\n * representation. To do so, create it with\n * `new VectorTileWorkerSource(actor, styleLayers, customLoadVectorDataFunction)`.\n *\n * @private\n */\nclass VectorTileWorkerSource implements WorkerSource {\n actor: Actor;\n layerIndex: StyleLayerIndex;\n availableImages: Array;\n loadVectorData: LoadVectorData;\n loading: {[_: string]: WorkerTile };\n loaded: {[_: string]: WorkerTile };\n\n /**\n * @param [loadVectorData] Optional method for custom loading of a VectorTile\n * object based on parameters passed from the main-thread Source. See\n * {@link VectorTileWorkerSource#loadTile}. The default implementation simply\n * loads the pbf at `params.url`.\n * @private\n */\n constructor(actor: Actor, layerIndex: StyleLayerIndex, availableImages: Array, loadVectorData: ?LoadVectorData) {\n this.actor = actor;\n this.layerIndex = layerIndex;\n this.availableImages = availableImages;\n this.loadVectorData = loadVectorData || loadVectorTile;\n this.loading = {};\n this.loaded = {};\n }\n\n /**\n * Implements {@link WorkerSource#loadTile}. Delegates to\n * {@link VectorTileWorkerSource#loadVectorData} (which by default expects\n * a `params.url` property) for fetching and producing a VectorTile object.\n * @private\n */\n loadTile(params: WorkerTileParameters, callback: WorkerTileCallback) {\n const uid = params.uid;\n\n if (!this.loading)\n this.loading = {};\n\n const perf = (params && params.request && params.request.collectResourceTiming) ?\n new RequestPerformance(params.request) : false;\n\n const workerTile = this.loading[uid] = new WorkerTile(params);\n workerTile.abort = this.loadVectorData(params, (err, response) => {\n delete this.loading[uid];\n\n if (err || !response) {\n workerTile.status = 'done';\n this.loaded[uid] = workerTile;\n return callback(err);\n }\n\n const rawTileData = response.rawData;\n const cacheControl = {};\n if (response.expires) cacheControl.expires = response.expires;\n if (response.cacheControl) cacheControl.cacheControl = response.cacheControl;\n\n const resourceTiming = {};\n if (perf) {\n const resourceTimingData = perf.finish();\n // it's necessary to eval the result of getEntriesByName() here via parse/stringify\n // late evaluation in the main thread causes TypeError: illegal invocation\n if (resourceTimingData)\n resourceTiming.resourceTiming = JSON.parse(JSON.stringify(resourceTimingData));\n }\n\n workerTile.vectorTile = response.vectorTile;\n workerTile.parse(response.vectorTile, this.layerIndex, this.availableImages, this.actor, (err, result) => {\n if (err || !result) return callback(err);\n\n // Transferring a copy of rawTileData because the worker needs to retain its copy.\n callback(null, extend({rawTileData: rawTileData.slice(0)}, result, cacheControl, resourceTiming));\n });\n\n this.loaded = this.loaded || {};\n this.loaded[uid] = workerTile;\n });\n }\n\n /**\n * Implements {@link WorkerSource#reloadTile}.\n * @private\n */\n reloadTile(params: WorkerTileParameters, callback: WorkerTileCallback) {\n const loaded = this.loaded,\n uid = params.uid,\n vtSource = this;\n if (loaded && loaded[uid]) {\n const workerTile = loaded[uid];\n workerTile.showCollisionBoxes = params.showCollisionBoxes;\n\n const done = (err, data) => {\n const reloadCallback = workerTile.reloadCallback;\n if (reloadCallback) {\n delete workerTile.reloadCallback;\n workerTile.parse(workerTile.vectorTile, vtSource.layerIndex, this.availableImages, vtSource.actor, reloadCallback);\n }\n callback(err, data);\n };\n\n if (workerTile.status === 'parsing') {\n workerTile.reloadCallback = done;\n } else if (workerTile.status === 'done') {\n // if there was no vector tile data on the initial load, don't try and re-parse tile\n if (workerTile.vectorTile) {\n workerTile.parse(workerTile.vectorTile, this.layerIndex, this.availableImages, this.actor, done);\n } else {\n done();\n }\n }\n }\n }\n\n /**\n * Implements {@link WorkerSource#abortTile}.\n *\n * @param params\n * @param params.uid The UID for this tile.\n * @private\n */\n abortTile(params: TileParameters, callback: WorkerTileCallback) {\n const loading = this.loading,\n uid = params.uid;\n if (loading && loading[uid] && loading[uid].abort) {\n loading[uid].abort();\n delete loading[uid];\n }\n callback();\n }\n\n /**\n * Implements {@link WorkerSource#removeTile}.\n *\n * @param params\n * @param params.uid The UID for this tile.\n * @private\n */\n removeTile(params: TileParameters, callback: WorkerTileCallback) {\n const loaded = this.loaded,\n uid = params.uid;\n if (loaded && loaded[uid]) {\n delete loaded[uid];\n }\n callback();\n }\n}\n\nexport default VectorTileWorkerSource;\n","// @flow\n\nimport DEMData from '../data/dem_data';\nimport {RGBAImage} from '../util/image';\nimport window from '../util/window';\n\nimport type Actor from '../util/actor';\nimport type {\n WorkerDEMTileParameters,\n WorkerDEMTileCallback,\n TileParameters\n} from './worker_source';\nconst {ImageBitmap} = window;\n\nclass RasterDEMTileWorkerSource {\n actor: Actor;\n loaded: {[_: string]: DEMData};\n offscreenCanvas: OffscreenCanvas;\n offscreenCanvasContext: CanvasRenderingContext2D;\n\n constructor() {\n this.loaded = {};\n }\n\n loadTile(params: WorkerDEMTileParameters, callback: WorkerDEMTileCallback) {\n const {uid, encoding, rawImageData} = params;\n // Main thread will transfer ImageBitmap if offscreen decode with OffscreenCanvas is supported, else it will transfer an already decoded image.\n const imagePixels = (ImageBitmap && rawImageData instanceof ImageBitmap) ? this.getImageData(rawImageData) : rawImageData;\n const dem = new DEMData(uid, imagePixels, encoding);\n this.loaded = this.loaded || {};\n this.loaded[uid] = dem;\n callback(null, dem);\n }\n\n getImageData(imgBitmap: ImageBitmap): RGBAImage {\n // Lazily initialize OffscreenCanvas\n if (!this.offscreenCanvas || !this.offscreenCanvasContext) {\n // Dem tiles are typically 256x256\n this.offscreenCanvas = new OffscreenCanvas(imgBitmap.width, imgBitmap.height);\n this.offscreenCanvasContext = this.offscreenCanvas.getContext('2d');\n }\n\n this.offscreenCanvas.width = imgBitmap.width;\n this.offscreenCanvas.height = imgBitmap.height;\n\n this.offscreenCanvasContext.drawImage(imgBitmap, 0, 0, imgBitmap.width, imgBitmap.height);\n // Insert an additional 1px padding around the image to allow backfilling for neighboring data.\n const imgData = this.offscreenCanvasContext.getImageData(-1, -1, imgBitmap.width + 2, imgBitmap.height + 2);\n this.offscreenCanvasContext.clearRect(0, 0, this.offscreenCanvas.width, this.offscreenCanvas.height);\n return new RGBAImage({width: imgData.width, height: imgData.height}, imgData.data);\n }\n\n removeTile(params: TileParameters) {\n const loaded = this.loaded,\n uid = params.uid;\n if (loaded && loaded[uid]) {\n delete loaded[uid];\n }\n }\n}\n\nexport default RasterDEMTileWorkerSource;\n","\nmodule.exports = rewind;\n\nfunction rewind(gj, outer) {\n var type = gj && gj.type, i;\n\n if (type === 'FeatureCollection') {\n for (i = 0; i < gj.features.length; i++) rewind(gj.features[i], outer);\n\n } else if (type === 'GeometryCollection') {\n for (i = 0; i < gj.geometries.length; i++) rewind(gj.geometries[i], outer);\n\n } else if (type === 'Feature') {\n rewind(gj.geometry, outer);\n\n } else if (type === 'Polygon') {\n rewindRings(gj.coordinates, outer);\n\n } else if (type === 'MultiPolygon') {\n for (i = 0; i < gj.coordinates.length; i++) rewindRings(gj.coordinates[i], outer);\n }\n\n return gj;\n}\n\nfunction rewindRings(rings, outer) {\n if (rings.length === 0) return;\n\n rewindRing(rings[0], outer);\n for (var i = 1; i < rings.length; i++) {\n rewindRing(rings[i], !outer);\n }\n}\n\nfunction rewindRing(ring, dir) {\n var area = 0;\n for (var i = 0, len = ring.length, j = len - 1; i < len; j = i++) {\n area += (ring[i][0] - ring[j][0]) * (ring[j][1] + ring[i][1]);\n }\n if (area >= 0 !== !!dir) ring.reverse();\n}\n","// @flow\n\nimport Point from '@mapbox/point-geometry';\n\nimport mvt from '@mapbox/vector-tile';\nconst toGeoJSON = mvt.VectorTileFeature.prototype.toGeoJSON;\nimport EXTENT from '../data/extent';\n\n// The feature type used by geojson-vt and supercluster. Should be extracted to\n// global type and used in module definitions for those two modules.\ntype Feature = {\n type: 1,\n id: mixed,\n tags: {[_: string]: string | number | boolean},\n geometry: Array<[number, number]>,\n} | {\n type: 2 | 3,\n id: mixed,\n tags: {[_: string]: string | number | boolean},\n geometry: Array>,\n}\n\nclass FeatureWrapper implements VectorTileFeature {\n _feature: Feature;\n\n extent: number;\n type: 1 | 2 | 3;\n id: number;\n properties: {[_: string]: string | number | boolean};\n\n constructor(feature: Feature) {\n this._feature = feature;\n\n this.extent = EXTENT;\n this.type = feature.type;\n this.properties = feature.tags;\n\n // If the feature has a top-level `id` property, copy it over, but only\n // if it can be coerced to an integer, because this wrapper is used for\n // serializing geojson feature data into vector tile PBF data, and the\n // vector tile spec only supports integer values for feature ids --\n // allowing non-integer values here results in a non-compliant PBF\n // that causes an exception when it is parsed with vector-tile-js\n if ('id' in feature && !isNaN(feature.id)) {\n this.id = parseInt(feature.id, 10);\n }\n }\n\n loadGeometry() {\n if (this._feature.type === 1) {\n const geometry = [];\n for (const point of this._feature.geometry) {\n geometry.push([new Point(point[0], point[1])]);\n }\n return geometry;\n } else {\n const geometry = [];\n for (const ring of this._feature.geometry) {\n const newRing = [];\n for (const point of ring) {\n newRing.push(new Point(point[0], point[1]));\n }\n geometry.push(newRing);\n }\n return geometry;\n }\n }\n\n toGeoJSON(x: number, y: number, z: number) {\n return toGeoJSON.call(this, x, y, z);\n }\n}\n\nclass GeoJSONWrapper implements VectorTile, VectorTileLayer {\n layers: {[_: string]: VectorTileLayer};\n name: string;\n extent: number;\n length: number;\n _features: Array;\n\n constructor(features: Array) {\n this.layers = {'_geojsonTileLayer': this};\n this.name = '_geojsonTileLayer';\n this.extent = EXTENT;\n this.length = features.length;\n this._features = features;\n }\n\n feature(i: number): VectorTileFeature {\n return new FeatureWrapper(this._features[i]);\n }\n}\n\nexport default GeoJSONWrapper;\n","'use strict'\n\nvar Point = require('@mapbox/point-geometry')\nvar VectorTileFeature = require('@mapbox/vector-tile').VectorTileFeature\n\nmodule.exports = GeoJSONWrapper\n\n// conform to vectortile api\nfunction GeoJSONWrapper (features, options) {\n this.options = options || {}\n this.features = features\n this.length = features.length\n}\n\nGeoJSONWrapper.prototype.feature = function (i) {\n return new FeatureWrapper(this.features[i], this.options.extent)\n}\n\nfunction FeatureWrapper (feature, extent) {\n this.id = typeof feature.id === 'number' ? feature.id : undefined\n this.type = feature.type\n this.rawGeometry = feature.type === 1 ? [feature.geometry] : feature.geometry\n this.properties = feature.tags\n this.extent = extent || 4096\n}\n\nFeatureWrapper.prototype.loadGeometry = function () {\n var rings = this.rawGeometry\n this.geometry = []\n\n for (var i = 0; i < rings.length; i++) {\n var ring = rings[i]\n var newRing = []\n for (var j = 0; j < ring.length; j++) {\n newRing.push(new Point(ring[j][0], ring[j][1]))\n }\n this.geometry.push(newRing)\n }\n return this.geometry\n}\n\nFeatureWrapper.prototype.bbox = function () {\n if (!this.geometry) this.loadGeometry()\n\n var rings = this.geometry\n var x1 = Infinity\n var x2 = -Infinity\n var y1 = Infinity\n var y2 = -Infinity\n\n for (var i = 0; i < rings.length; i++) {\n var ring = rings[i]\n\n for (var j = 0; j < ring.length; j++) {\n var coord = ring[j]\n\n x1 = Math.min(x1, coord.x)\n x2 = Math.max(x2, coord.x)\n y1 = Math.min(y1, coord.y)\n y2 = Math.max(y2, coord.y)\n }\n }\n\n return [x1, y1, x2, y2]\n}\n\nFeatureWrapper.prototype.toGeoJSON = VectorTileFeature.prototype.toGeoJSON\n","var Pbf = require('pbf')\nvar GeoJSONWrapper = require('./lib/geojson_wrapper')\n\nmodule.exports = fromVectorTileJs\nmodule.exports.fromVectorTileJs = fromVectorTileJs\nmodule.exports.fromGeojsonVt = fromGeojsonVt\nmodule.exports.GeoJSONWrapper = GeoJSONWrapper\n\n/**\n * Serialize a vector-tile-js-created tile to pbf\n *\n * @param {Object} tile\n * @return {Buffer} uncompressed, pbf-serialized tile data\n */\nfunction fromVectorTileJs (tile) {\n var out = new Pbf()\n writeTile(tile, out)\n return out.finish()\n}\n\n/**\n * Serialized a geojson-vt-created tile to pbf.\n *\n * @param {Object} layers - An object mapping layer names to geojson-vt-created vector tile objects\n * @param {Object} [options] - An object specifying the vector-tile specification version and extent that were used to create `layers`.\n * @param {Number} [options.version=1] - Version of vector-tile spec used\n * @param {Number} [options.extent=4096] - Extent of the vector tile\n * @return {Buffer} uncompressed, pbf-serialized tile data\n */\nfunction fromGeojsonVt (layers, options) {\n options = options || {}\n var l = {}\n for (var k in layers) {\n l[k] = new GeoJSONWrapper(layers[k].features, options)\n l[k].name = k\n l[k].version = options.version\n l[k].extent = options.extent\n }\n return fromVectorTileJs({layers: l})\n}\n\nfunction writeTile (tile, pbf) {\n for (var key in tile.layers) {\n pbf.writeMessage(3, writeLayer, tile.layers[key])\n }\n}\n\nfunction writeLayer (layer, pbf) {\n pbf.writeVarintField(15, layer.version || 1)\n pbf.writeStringField(1, layer.name || '')\n pbf.writeVarintField(5, layer.extent || 4096)\n\n var i\n var context = {\n keys: [],\n values: [],\n keycache: {},\n valuecache: {}\n }\n\n for (i = 0; i < layer.length; i++) {\n context.feature = layer.feature(i)\n pbf.writeMessage(2, writeFeature, context)\n }\n\n var keys = context.keys\n for (i = 0; i < keys.length; i++) {\n pbf.writeStringField(3, keys[i])\n }\n\n var values = context.values\n for (i = 0; i < values.length; i++) {\n pbf.writeMessage(4, writeValue, values[i])\n }\n}\n\nfunction writeFeature (context, pbf) {\n var feature = context.feature\n\n if (feature.id !== undefined) {\n pbf.writeVarintField(1, feature.id)\n }\n\n pbf.writeMessage(2, writeProperties, context)\n pbf.writeVarintField(3, feature.type)\n pbf.writeMessage(4, writeGeometry, feature)\n}\n\nfunction writeProperties (context, pbf) {\n var feature = context.feature\n var keys = context.keys\n var values = context.values\n var keycache = context.keycache\n var valuecache = context.valuecache\n\n for (var key in feature.properties) {\n var keyIndex = keycache[key]\n if (typeof keyIndex === 'undefined') {\n keys.push(key)\n keyIndex = keys.length - 1\n keycache[key] = keyIndex\n }\n pbf.writeVarint(keyIndex)\n\n var value = feature.properties[key]\n var type = typeof value\n if (type !== 'string' && type !== 'boolean' && type !== 'number') {\n value = JSON.stringify(value)\n }\n var valueKey = type + ':' + value\n var valueIndex = valuecache[valueKey]\n if (typeof valueIndex === 'undefined') {\n values.push(value)\n valueIndex = values.length - 1\n valuecache[valueKey] = valueIndex\n }\n pbf.writeVarint(valueIndex)\n }\n}\n\nfunction command (cmd, length) {\n return (length << 3) + (cmd & 0x7)\n}\n\nfunction zigzag (num) {\n return (num << 1) ^ (num >> 31)\n}\n\nfunction writeGeometry (feature, pbf) {\n var geometry = feature.loadGeometry()\n var type = feature.type\n var x = 0\n var y = 0\n var rings = geometry.length\n for (var r = 0; r < rings; r++) {\n var ring = geometry[r]\n var count = 1\n if (type === 1) {\n count = ring.length\n }\n pbf.writeVarint(command(1, count)) // moveto\n // do not write polygon closing path as lineto\n var lineCount = type === 3 ? ring.length - 1 : ring.length\n for (var i = 0; i < lineCount; i++) {\n if (i === 1 && type !== 1) {\n pbf.writeVarint(command(2, lineCount - 1)) // lineto\n }\n var dx = ring[i].x - x\n var dy = ring[i].y - y\n pbf.writeVarint(zigzag(dx))\n pbf.writeVarint(zigzag(dy))\n x += dx\n y += dy\n }\n if (type === 3) {\n pbf.writeVarint(command(7, 1)) // closepath\n }\n }\n}\n\nfunction writeValue (value, pbf) {\n var type = typeof value\n if (type === 'string') {\n pbf.writeStringField(1, value)\n } else if (type === 'boolean') {\n pbf.writeBooleanField(7, value)\n } else if (type === 'number') {\n if (value % 1 !== 0) {\n pbf.writeDoubleField(3, value)\n } else if (value < 0) {\n pbf.writeSVarintField(6, value)\n } else {\n pbf.writeVarintField(5, value)\n }\n }\n}\n","\nexport default function sortKD(ids, coords, nodeSize, left, right, depth) {\n if (right - left <= nodeSize) return;\n\n const m = (left + right) >> 1;\n\n select(ids, coords, m, left, right, depth % 2);\n\n sortKD(ids, coords, nodeSize, left, m - 1, depth + 1);\n sortKD(ids, coords, nodeSize, m + 1, right, depth + 1);\n}\n\nfunction select(ids, coords, k, left, right, inc) {\n\n while (right > left) {\n if (right - left > 600) {\n const n = right - left + 1;\n const m = k - left + 1;\n const z = Math.log(n);\n const s = 0.5 * Math.exp(2 * z / 3);\n const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);\n const newLeft = Math.max(left, Math.floor(k - m * s / n + sd));\n const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));\n select(ids, coords, k, newLeft, newRight, inc);\n }\n\n const t = coords[2 * k + inc];\n let i = left;\n let j = right;\n\n swapItem(ids, coords, left, k);\n if (coords[2 * right + inc] > t) swapItem(ids, coords, left, right);\n\n while (i < j) {\n swapItem(ids, coords, i, j);\n i++;\n j--;\n while (coords[2 * i + inc] < t) i++;\n while (coords[2 * j + inc] > t) j--;\n }\n\n if (coords[2 * left + inc] === t) swapItem(ids, coords, left, j);\n else {\n j++;\n swapItem(ids, coords, j, right);\n }\n\n if (j <= k) left = j + 1;\n if (k <= j) right = j - 1;\n }\n}\n\nfunction swapItem(ids, coords, i, j) {\n swap(ids, i, j);\n swap(coords, 2 * i, 2 * j);\n swap(coords, 2 * i + 1, 2 * j + 1);\n}\n\nfunction swap(arr, i, j) {\n const tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n}\n","\nexport default function within(ids, coords, qx, qy, r, nodeSize) {\n const stack = [0, ids.length - 1, 0];\n const result = [];\n const r2 = r * r;\n\n while (stack.length) {\n const axis = stack.pop();\n const right = stack.pop();\n const left = stack.pop();\n\n if (right - left <= nodeSize) {\n for (let i = left; i <= right; i++) {\n if (sqDist(coords[2 * i], coords[2 * i + 1], qx, qy) <= r2) result.push(ids[i]);\n }\n continue;\n }\n\n const m = Math.floor((left + right) / 2);\n\n const x = coords[2 * m];\n const y = coords[2 * m + 1];\n\n if (sqDist(x, y, qx, qy) <= r2) result.push(ids[m]);\n\n const nextAxis = (axis + 1) % 2;\n\n if (axis === 0 ? qx - r <= x : qy - r <= y) {\n stack.push(left);\n stack.push(m - 1);\n stack.push(nextAxis);\n }\n if (axis === 0 ? qx + r >= x : qy + r >= y) {\n stack.push(m + 1);\n stack.push(right);\n stack.push(nextAxis);\n }\n }\n\n return result;\n}\n\nfunction sqDist(ax, ay, bx, by) {\n const dx = ax - bx;\n const dy = ay - by;\n return dx * dx + dy * dy;\n}\n","\nimport sort from './sort';\nimport range from './range';\nimport within from './within';\n\nconst defaultGetX = p => p[0];\nconst defaultGetY = p => p[1];\n\nexport default class KDBush {\n constructor(points, getX = defaultGetX, getY = defaultGetY, nodeSize = 64, ArrayType = Float64Array) {\n this.nodeSize = nodeSize;\n this.points = points;\n\n const IndexArrayType = points.length < 65536 ? Uint16Array : Uint32Array;\n\n const ids = this.ids = new IndexArrayType(points.length);\n const coords = this.coords = new ArrayType(points.length * 2);\n\n for (let i = 0; i < points.length; i++) {\n ids[i] = i;\n coords[2 * i] = getX(points[i]);\n coords[2 * i + 1] = getY(points[i]);\n }\n\n sort(ids, coords, nodeSize, 0, ids.length - 1, 0);\n }\n\n range(minX, minY, maxX, maxY) {\n return range(this.ids, this.coords, minX, minY, maxX, maxY, this.nodeSize);\n }\n\n within(x, y, r) {\n return within(this.ids, this.coords, x, y, r, this.nodeSize);\n }\n}\n","\nexport default function range(ids, coords, minX, minY, maxX, maxY, nodeSize) {\n const stack = [0, ids.length - 1, 0];\n const result = [];\n let x, y;\n\n while (stack.length) {\n const axis = stack.pop();\n const right = stack.pop();\n const left = stack.pop();\n\n if (right - left <= nodeSize) {\n for (let i = left; i <= right; i++) {\n x = coords[2 * i];\n y = coords[2 * i + 1];\n if (x >= minX && x <= maxX && y >= minY && y <= maxY) result.push(ids[i]);\n }\n continue;\n }\n\n const m = Math.floor((left + right) / 2);\n\n x = coords[2 * m];\n y = coords[2 * m + 1];\n\n if (x >= minX && x <= maxX && y >= minY && y <= maxY) result.push(ids[m]);\n\n const nextAxis = (axis + 1) % 2;\n\n if (axis === 0 ? minX <= x : minY <= y) {\n stack.push(left);\n stack.push(m - 1);\n stack.push(nextAxis);\n }\n if (axis === 0 ? maxX >= x : maxY >= y) {\n stack.push(m + 1);\n stack.push(right);\n stack.push(nextAxis);\n }\n }\n\n return result;\n}\n","\nimport KDBush from 'kdbush';\n\nconst defaultOptions = {\n minZoom: 0, // min zoom to generate clusters on\n maxZoom: 16, // max zoom level to cluster the points on\n minPoints: 2, // minimum points to form a cluster\n radius: 40, // cluster radius in pixels\n extent: 512, // tile extent (radius is calculated relative to it)\n nodeSize: 64, // size of the KD-tree leaf node, affects performance\n log: false, // whether to log timing info\n\n // whether to generate numeric ids for input features (in vector tiles)\n generateId: false,\n\n // a reduce function for calculating custom cluster properties\n reduce: null, // (accumulated, props) => { accumulated.sum += props.sum; }\n\n // properties to use for individual points when running the reducer\n map: props => props // props => ({sum: props.my_value})\n};\n\nexport default class Supercluster {\n constructor(options) {\n this.options = extend(Object.create(defaultOptions), options);\n this.trees = new Array(this.options.maxZoom + 1);\n }\n\n load(points) {\n const {log, minZoom, maxZoom, nodeSize} = this.options;\n\n if (log) console.time('total time');\n\n const timerId = `prepare ${ points.length } points`;\n if (log) console.time(timerId);\n\n this.points = points;\n\n // generate a cluster object for each point and index input points into a KD-tree\n let clusters = [];\n for (let i = 0; i < points.length; i++) {\n if (!points[i].geometry) continue;\n clusters.push(createPointCluster(points[i], i));\n }\n this.trees[maxZoom + 1] = new KDBush(clusters, getX, getY, nodeSize, Float32Array);\n\n if (log) console.timeEnd(timerId);\n\n // cluster points on max zoom, then cluster the results on previous zoom, etc.;\n // results in a cluster hierarchy across zoom levels\n for (let z = maxZoom; z >= minZoom; z--) {\n const now = +Date.now();\n\n // create a new set of clusters for the zoom and index them with a KD-tree\n clusters = this._cluster(clusters, z);\n this.trees[z] = new KDBush(clusters, getX, getY, nodeSize, Float32Array);\n\n if (log) console.log('z%d: %d clusters in %dms', z, clusters.length, +Date.now() - now);\n }\n\n if (log) console.timeEnd('total time');\n\n return this;\n }\n\n getClusters(bbox, zoom) {\n let minLng = ((bbox[0] + 180) % 360 + 360) % 360 - 180;\n const minLat = Math.max(-90, Math.min(90, bbox[1]));\n let maxLng = bbox[2] === 180 ? 180 : ((bbox[2] + 180) % 360 + 360) % 360 - 180;\n const maxLat = Math.max(-90, Math.min(90, bbox[3]));\n\n if (bbox[2] - bbox[0] >= 360) {\n minLng = -180;\n maxLng = 180;\n } else if (minLng > maxLng) {\n const easternHem = this.getClusters([minLng, minLat, 180, maxLat], zoom);\n const westernHem = this.getClusters([-180, minLat, maxLng, maxLat], zoom);\n return easternHem.concat(westernHem);\n }\n\n const tree = this.trees[this._limitZoom(zoom)];\n const ids = tree.range(lngX(minLng), latY(maxLat), lngX(maxLng), latY(minLat));\n const clusters = [];\n for (const id of ids) {\n const c = tree.points[id];\n clusters.push(c.numPoints ? getClusterJSON(c) : this.points[c.index]);\n }\n return clusters;\n }\n\n getChildren(clusterId) {\n const originId = this._getOriginId(clusterId);\n const originZoom = this._getOriginZoom(clusterId);\n const errorMsg = 'No cluster with the specified id.';\n\n const index = this.trees[originZoom];\n if (!index) throw new Error(errorMsg);\n\n const origin = index.points[originId];\n if (!origin) throw new Error(errorMsg);\n\n const r = this.options.radius / (this.options.extent * Math.pow(2, originZoom - 1));\n const ids = index.within(origin.x, origin.y, r);\n const children = [];\n for (const id of ids) {\n const c = index.points[id];\n if (c.parentId === clusterId) {\n children.push(c.numPoints ? getClusterJSON(c) : this.points[c.index]);\n }\n }\n\n if (children.length === 0) throw new Error(errorMsg);\n\n return children;\n }\n\n getLeaves(clusterId, limit, offset) {\n limit = limit || 10;\n offset = offset || 0;\n\n const leaves = [];\n this._appendLeaves(leaves, clusterId, limit, offset, 0);\n\n return leaves;\n }\n\n getTile(z, x, y) {\n const tree = this.trees[this._limitZoom(z)];\n const z2 = Math.pow(2, z);\n const {extent, radius} = this.options;\n const p = radius / extent;\n const top = (y - p) / z2;\n const bottom = (y + 1 + p) / z2;\n\n const tile = {\n features: []\n };\n\n this._addTileFeatures(\n tree.range((x - p) / z2, top, (x + 1 + p) / z2, bottom),\n tree.points, x, y, z2, tile);\n\n if (x === 0) {\n this._addTileFeatures(\n tree.range(1 - p / z2, top, 1, bottom),\n tree.points, z2, y, z2, tile);\n }\n if (x === z2 - 1) {\n this._addTileFeatures(\n tree.range(0, top, p / z2, bottom),\n tree.points, -1, y, z2, tile);\n }\n\n return tile.features.length ? tile : null;\n }\n\n getClusterExpansionZoom(clusterId) {\n let expansionZoom = this._getOriginZoom(clusterId) - 1;\n while (expansionZoom <= this.options.maxZoom) {\n const children = this.getChildren(clusterId);\n expansionZoom++;\n if (children.length !== 1) break;\n clusterId = children[0].properties.cluster_id;\n }\n return expansionZoom;\n }\n\n _appendLeaves(result, clusterId, limit, offset, skipped) {\n const children = this.getChildren(clusterId);\n\n for (const child of children) {\n const props = child.properties;\n\n if (props && props.cluster) {\n if (skipped + props.point_count <= offset) {\n // skip the whole cluster\n skipped += props.point_count;\n } else {\n // enter the cluster\n skipped = this._appendLeaves(result, props.cluster_id, limit, offset, skipped);\n // exit the cluster\n }\n } else if (skipped < offset) {\n // skip a single point\n skipped++;\n } else {\n // add a single point\n result.push(child);\n }\n if (result.length === limit) break;\n }\n\n return skipped;\n }\n\n _addTileFeatures(ids, points, x, y, z2, tile) {\n for (const i of ids) {\n const c = points[i];\n const isCluster = c.numPoints;\n const f = {\n type: 1,\n geometry: [[\n Math.round(this.options.extent * (c.x * z2 - x)),\n Math.round(this.options.extent * (c.y * z2 - y))\n ]],\n tags: isCluster ? getClusterProperties(c) : this.points[c.index].properties\n };\n\n // assign id\n let id;\n if (isCluster) {\n id = c.id;\n } else if (this.options.generateId) {\n // optionally generate id\n id = c.index;\n } else if (this.points[c.index].id) {\n // keep id if already assigned\n id = this.points[c.index].id;\n }\n\n if (id !== undefined) f.id = id;\n\n tile.features.push(f);\n }\n }\n\n _limitZoom(z) {\n return Math.max(this.options.minZoom, Math.min(+z, this.options.maxZoom + 1));\n }\n\n _cluster(points, zoom) {\n const clusters = [];\n const {radius, extent, reduce, minPoints} = this.options;\n const r = radius / (extent * Math.pow(2, zoom));\n\n // loop through each point\n for (let i = 0; i < points.length; i++) {\n const p = points[i];\n // if we've already visited the point at this zoom level, skip it\n if (p.zoom <= zoom) continue;\n p.zoom = zoom;\n\n // find all nearby points\n const tree = this.trees[zoom + 1];\n const neighborIds = tree.within(p.x, p.y, r);\n\n const numPointsOrigin = p.numPoints || 1;\n let numPoints = numPointsOrigin;\n\n // count the number of points in a potential cluster\n for (const neighborId of neighborIds) {\n const b = tree.points[neighborId];\n // filter out neighbors that are already processed\n if (b.zoom > zoom) numPoints += b.numPoints || 1;\n }\n\n if (numPoints >= minPoints) { // enough points to form a cluster\n let wx = p.x * numPointsOrigin;\n let wy = p.y * numPointsOrigin;\n\n let clusterProperties = reduce && numPointsOrigin > 1 ? this._map(p, true) : null;\n\n // encode both zoom and point index on which the cluster originated -- offset by total length of features\n const id = (i << 5) + (zoom + 1) + this.points.length;\n\n for (const neighborId of neighborIds) {\n const b = tree.points[neighborId];\n\n if (b.zoom <= zoom) continue;\n b.zoom = zoom; // save the zoom (so it doesn't get processed twice)\n\n const numPoints2 = b.numPoints || 1;\n wx += b.x * numPoints2; // accumulate coordinates for calculating weighted center\n wy += b.y * numPoints2;\n\n b.parentId = id;\n\n if (reduce) {\n if (!clusterProperties) clusterProperties = this._map(p, true);\n reduce(clusterProperties, this._map(b));\n }\n }\n\n p.parentId = id;\n clusters.push(createCluster(wx / numPoints, wy / numPoints, id, numPoints, clusterProperties));\n\n } else { // left points as unclustered\n clusters.push(p);\n\n if (numPoints > 1) {\n for (const neighborId of neighborIds) {\n const b = tree.points[neighborId];\n if (b.zoom <= zoom) continue;\n b.zoom = zoom;\n clusters.push(b);\n }\n }\n }\n }\n\n return clusters;\n }\n\n // get index of the point from which the cluster originated\n _getOriginId(clusterId) {\n return (clusterId - this.points.length) >> 5;\n }\n\n // get zoom of the point from which the cluster originated\n _getOriginZoom(clusterId) {\n return (clusterId - this.points.length) % 32;\n }\n\n _map(point, clone) {\n if (point.numPoints) {\n return clone ? extend({}, point.properties) : point.properties;\n }\n const original = this.points[point.index].properties;\n const result = this.options.map(original);\n return clone && result === original ? extend({}, result) : result;\n }\n}\n\nfunction createCluster(x, y, id, numPoints, properties) {\n return {\n x, // weighted cluster center\n y,\n zoom: Infinity, // the last zoom the cluster was processed at\n id, // encodes index of the first child of the cluster and its zoom level\n parentId: -1, // parent cluster id\n numPoints,\n properties\n };\n}\n\nfunction createPointCluster(p, id) {\n const [x, y] = p.geometry.coordinates;\n return {\n x: lngX(x), // projected point coordinates\n y: latY(y),\n zoom: Infinity, // the last zoom the point was processed at\n index: id, // index of the source feature in the original input array,\n parentId: -1 // parent cluster id\n };\n}\n\nfunction getClusterJSON(cluster) {\n return {\n type: 'Feature',\n id: cluster.id,\n properties: getClusterProperties(cluster),\n geometry: {\n type: 'Point',\n coordinates: [xLng(cluster.x), yLat(cluster.y)]\n }\n };\n}\n\nfunction getClusterProperties(cluster) {\n const count = cluster.numPoints;\n const abbrev =\n count >= 10000 ? `${Math.round(count / 1000) }k` :\n count >= 1000 ? `${Math.round(count / 100) / 10 }k` : count;\n return extend(extend({}, cluster.properties), {\n cluster: true,\n cluster_id: cluster.id,\n point_count: count,\n point_count_abbreviated: abbrev\n });\n}\n\n// longitude/latitude to spherical mercator in [0..1] range\nfunction lngX(lng) {\n return lng / 360 + 0.5;\n}\nfunction latY(lat) {\n const sin = Math.sin(lat * Math.PI / 180);\n const y = (0.5 - 0.25 * Math.log((1 + sin) / (1 - sin)) / Math.PI);\n return y < 0 ? 0 : y > 1 ? 1 : y;\n}\n\n// spherical mercator to longitude/latitude\nfunction xLng(x) {\n return (x - 0.5) * 360;\n}\nfunction yLat(y) {\n const y2 = (180 - y * 360) * Math.PI / 180;\n return 360 * Math.atan(Math.exp(y2)) / Math.PI - 90;\n}\n\nfunction extend(dest, src) {\n for (const id in src) dest[id] = src[id];\n return dest;\n}\n\nfunction getX(p) {\n return p.x;\n}\nfunction getY(p) {\n return p.y;\n}\n","\n// calculate simplification data using optimized Douglas-Peucker algorithm\n\nexport default function simplify(coords, first, last, sqTolerance) {\n var maxSqDist = sqTolerance;\n var mid = (last - first) >> 1;\n var minPosToMid = last - first;\n var index;\n\n var ax = coords[first];\n var ay = coords[first + 1];\n var bx = coords[last];\n var by = coords[last + 1];\n\n for (var i = first + 3; i < last; i += 3) {\n var d = getSqSegDist(coords[i], coords[i + 1], ax, ay, bx, by);\n\n if (d > maxSqDist) {\n index = i;\n maxSqDist = d;\n\n } else if (d === maxSqDist) {\n // a workaround to ensure we choose a pivot close to the middle of the list,\n // reducing recursion depth, for certain degenerate inputs\n // https://github.com/mapbox/geojson-vt/issues/104\n var posToMid = Math.abs(i - mid);\n if (posToMid < minPosToMid) {\n index = i;\n minPosToMid = posToMid;\n }\n }\n }\n\n if (maxSqDist > sqTolerance) {\n if (index - first > 3) simplify(coords, first, index, sqTolerance);\n coords[index + 2] = maxSqDist;\n if (last - index > 3) simplify(coords, index, last, sqTolerance);\n }\n}\n\n// square distance from a point to a segment\nfunction getSqSegDist(px, py, x, y, bx, by) {\n\n var dx = bx - x;\n var dy = by - y;\n\n if (dx !== 0 || dy !== 0) {\n\n var t = ((px - x) * dx + (py - y) * dy) / (dx * dx + dy * dy);\n\n if (t > 1) {\n x = bx;\n y = by;\n\n } else if (t > 0) {\n x += dx * t;\n y += dy * t;\n }\n }\n\n dx = px - x;\n dy = py - y;\n\n return dx * dx + dy * dy;\n}\n","\nexport default function createFeature(id, type, geom, tags) {\n var feature = {\n id: typeof id === 'undefined' ? null : id,\n type: type,\n geometry: geom,\n tags: tags,\n minX: Infinity,\n minY: Infinity,\n maxX: -Infinity,\n maxY: -Infinity\n };\n calcBBox(feature);\n return feature;\n}\n\nfunction calcBBox(feature) {\n var geom = feature.geometry;\n var type = feature.type;\n\n if (type === 'Point' || type === 'MultiPoint' || type === 'LineString') {\n calcLineBBox(feature, geom);\n\n } else if (type === 'Polygon' || type === 'MultiLineString') {\n for (var i = 0; i < geom.length; i++) {\n calcLineBBox(feature, geom[i]);\n }\n\n } else if (type === 'MultiPolygon') {\n for (i = 0; i < geom.length; i++) {\n for (var j = 0; j < geom[i].length; j++) {\n calcLineBBox(feature, geom[i][j]);\n }\n }\n }\n}\n\nfunction calcLineBBox(feature, geom) {\n for (var i = 0; i < geom.length; i += 3) {\n feature.minX = Math.min(feature.minX, geom[i]);\n feature.minY = Math.min(feature.minY, geom[i + 1]);\n feature.maxX = Math.max(feature.maxX, geom[i]);\n feature.maxY = Math.max(feature.maxY, geom[i + 1]);\n }\n}\n","\nimport simplify from './simplify';\nimport createFeature from './feature';\n\n// converts GeoJSON feature into an intermediate projected JSON vector format with simplification data\n\nexport default function convert(data, options) {\n var features = [];\n if (data.type === 'FeatureCollection') {\n for (var i = 0; i < data.features.length; i++) {\n convertFeature(features, data.features[i], options, i);\n }\n\n } else if (data.type === 'Feature') {\n convertFeature(features, data, options);\n\n } else {\n // single geometry or a geometry collection\n convertFeature(features, {geometry: data}, options);\n }\n\n return features;\n}\n\nfunction convertFeature(features, geojson, options, index) {\n if (!geojson.geometry) return;\n\n var coords = geojson.geometry.coordinates;\n var type = geojson.geometry.type;\n var tolerance = Math.pow(options.tolerance / ((1 << options.maxZoom) * options.extent), 2);\n var geometry = [];\n var id = geojson.id;\n if (options.promoteId) {\n id = geojson.properties[options.promoteId];\n } else if (options.generateId) {\n id = index || 0;\n }\n if (type === 'Point') {\n convertPoint(coords, geometry);\n\n } else if (type === 'MultiPoint') {\n for (var i = 0; i < coords.length; i++) {\n convertPoint(coords[i], geometry);\n }\n\n } else if (type === 'LineString') {\n convertLine(coords, geometry, tolerance, false);\n\n } else if (type === 'MultiLineString') {\n if (options.lineMetrics) {\n // explode into linestrings to be able to track metrics\n for (i = 0; i < coords.length; i++) {\n geometry = [];\n convertLine(coords[i], geometry, tolerance, false);\n features.push(createFeature(id, 'LineString', geometry, geojson.properties));\n }\n return;\n } else {\n convertLines(coords, geometry, tolerance, false);\n }\n\n } else if (type === 'Polygon') {\n convertLines(coords, geometry, tolerance, true);\n\n } else if (type === 'MultiPolygon') {\n for (i = 0; i < coords.length; i++) {\n var polygon = [];\n convertLines(coords[i], polygon, tolerance, true);\n geometry.push(polygon);\n }\n } else if (type === 'GeometryCollection') {\n for (i = 0; i < geojson.geometry.geometries.length; i++) {\n convertFeature(features, {\n id: id,\n geometry: geojson.geometry.geometries[i],\n properties: geojson.properties\n }, options, index);\n }\n return;\n } else {\n throw new Error('Input data is not a valid GeoJSON object.');\n }\n\n features.push(createFeature(id, type, geometry, geojson.properties));\n}\n\nfunction convertPoint(coords, out) {\n out.push(projectX(coords[0]));\n out.push(projectY(coords[1]));\n out.push(0);\n}\n\nfunction convertLine(ring, out, tolerance, isPolygon) {\n var x0, y0;\n var size = 0;\n\n for (var j = 0; j < ring.length; j++) {\n var x = projectX(ring[j][0]);\n var y = projectY(ring[j][1]);\n\n out.push(x);\n out.push(y);\n out.push(0);\n\n if (j > 0) {\n if (isPolygon) {\n size += (x0 * y - x * y0) / 2; // area\n } else {\n size += Math.sqrt(Math.pow(x - x0, 2) + Math.pow(y - y0, 2)); // length\n }\n }\n x0 = x;\n y0 = y;\n }\n\n var last = out.length - 3;\n out[2] = 1;\n simplify(out, 0, last, tolerance);\n out[last + 2] = 1;\n\n out.size = Math.abs(size);\n out.start = 0;\n out.end = out.size;\n}\n\nfunction convertLines(rings, out, tolerance, isPolygon) {\n for (var i = 0; i < rings.length; i++) {\n var geom = [];\n convertLine(rings[i], geom, tolerance, isPolygon);\n out.push(geom);\n }\n}\n\nfunction projectX(x) {\n return x / 360 + 0.5;\n}\n\nfunction projectY(y) {\n var sin = Math.sin(y * Math.PI / 180);\n var y2 = 0.5 - 0.25 * Math.log((1 + sin) / (1 - sin)) / Math.PI;\n return y2 < 0 ? 0 : y2 > 1 ? 1 : y2;\n}\n","\nimport createFeature from './feature';\n\n/* clip features between two axis-parallel lines:\n * | |\n * ___|___ | /\n * / | \\____|____/\n * | |\n */\n\nexport default function clip(features, scale, k1, k2, axis, minAll, maxAll, options) {\n\n k1 /= scale;\n k2 /= scale;\n\n if (minAll >= k1 && maxAll < k2) return features; // trivial accept\n else if (maxAll < k1 || minAll >= k2) return null; // trivial reject\n\n var clipped = [];\n\n for (var i = 0; i < features.length; i++) {\n\n var feature = features[i];\n var geometry = feature.geometry;\n var type = feature.type;\n\n var min = axis === 0 ? feature.minX : feature.minY;\n var max = axis === 0 ? feature.maxX : feature.maxY;\n\n if (min >= k1 && max < k2) { // trivial accept\n clipped.push(feature);\n continue;\n } else if (max < k1 || min >= k2) { // trivial reject\n continue;\n }\n\n var newGeometry = [];\n\n if (type === 'Point' || type === 'MultiPoint') {\n clipPoints(geometry, newGeometry, k1, k2, axis);\n\n } else if (type === 'LineString') {\n clipLine(geometry, newGeometry, k1, k2, axis, false, options.lineMetrics);\n\n } else if (type === 'MultiLineString') {\n clipLines(geometry, newGeometry, k1, k2, axis, false);\n\n } else if (type === 'Polygon') {\n clipLines(geometry, newGeometry, k1, k2, axis, true);\n\n } else if (type === 'MultiPolygon') {\n for (var j = 0; j < geometry.length; j++) {\n var polygon = [];\n clipLines(geometry[j], polygon, k1, k2, axis, true);\n if (polygon.length) {\n newGeometry.push(polygon);\n }\n }\n }\n\n if (newGeometry.length) {\n if (options.lineMetrics && type === 'LineString') {\n for (j = 0; j < newGeometry.length; j++) {\n clipped.push(createFeature(feature.id, type, newGeometry[j], feature.tags));\n }\n continue;\n }\n\n if (type === 'LineString' || type === 'MultiLineString') {\n if (newGeometry.length === 1) {\n type = 'LineString';\n newGeometry = newGeometry[0];\n } else {\n type = 'MultiLineString';\n }\n }\n if (type === 'Point' || type === 'MultiPoint') {\n type = newGeometry.length === 3 ? 'Point' : 'MultiPoint';\n }\n\n clipped.push(createFeature(feature.id, type, newGeometry, feature.tags));\n }\n }\n\n return clipped.length ? clipped : null;\n}\n\nfunction clipPoints(geom, newGeom, k1, k2, axis) {\n for (var i = 0; i < geom.length; i += 3) {\n var a = geom[i + axis];\n\n if (a >= k1 && a <= k2) {\n newGeom.push(geom[i]);\n newGeom.push(geom[i + 1]);\n newGeom.push(geom[i + 2]);\n }\n }\n}\n\nfunction clipLine(geom, newGeom, k1, k2, axis, isPolygon, trackMetrics) {\n\n var slice = newSlice(geom);\n var intersect = axis === 0 ? intersectX : intersectY;\n var len = geom.start;\n var segLen, t;\n\n for (var i = 0; i < geom.length - 3; i += 3) {\n var ax = geom[i];\n var ay = geom[i + 1];\n var az = geom[i + 2];\n var bx = geom[i + 3];\n var by = geom[i + 4];\n var a = axis === 0 ? ax : ay;\n var b = axis === 0 ? bx : by;\n var exited = false;\n\n if (trackMetrics) segLen = Math.sqrt(Math.pow(ax - bx, 2) + Math.pow(ay - by, 2));\n\n if (a < k1) {\n // ---|--> | (line enters the clip region from the left)\n if (b > k1) {\n t = intersect(slice, ax, ay, bx, by, k1);\n if (trackMetrics) slice.start = len + segLen * t;\n }\n } else if (a > k2) {\n // | <--|--- (line enters the clip region from the right)\n if (b < k2) {\n t = intersect(slice, ax, ay, bx, by, k2);\n if (trackMetrics) slice.start = len + segLen * t;\n }\n } else {\n addPoint(slice, ax, ay, az);\n }\n if (b < k1 && a >= k1) {\n // <--|--- | or <--|-----|--- (line exits the clip region on the left)\n t = intersect(slice, ax, ay, bx, by, k1);\n exited = true;\n }\n if (b > k2 && a <= k2) {\n // | ---|--> or ---|-----|--> (line exits the clip region on the right)\n t = intersect(slice, ax, ay, bx, by, k2);\n exited = true;\n }\n\n if (!isPolygon && exited) {\n if (trackMetrics) slice.end = len + segLen * t;\n newGeom.push(slice);\n slice = newSlice(geom);\n }\n\n if (trackMetrics) len += segLen;\n }\n\n // add the last point\n var last = geom.length - 3;\n ax = geom[last];\n ay = geom[last + 1];\n az = geom[last + 2];\n a = axis === 0 ? ax : ay;\n if (a >= k1 && a <= k2) addPoint(slice, ax, ay, az);\n\n // close the polygon if its endpoints are not the same after clipping\n last = slice.length - 3;\n if (isPolygon && last >= 3 && (slice[last] !== slice[0] || slice[last + 1] !== slice[1])) {\n addPoint(slice, slice[0], slice[1], slice[2]);\n }\n\n // add the final slice\n if (slice.length) {\n newGeom.push(slice);\n }\n}\n\nfunction newSlice(line) {\n var slice = [];\n slice.size = line.size;\n slice.start = line.start;\n slice.end = line.end;\n return slice;\n}\n\nfunction clipLines(geom, newGeom, k1, k2, axis, isPolygon) {\n for (var i = 0; i < geom.length; i++) {\n clipLine(geom[i], newGeom, k1, k2, axis, isPolygon, false);\n }\n}\n\nfunction addPoint(out, x, y, z) {\n out.push(x);\n out.push(y);\n out.push(z);\n}\n\nfunction intersectX(out, ax, ay, bx, by, x) {\n var t = (x - ax) / (bx - ax);\n out.push(x);\n out.push(ay + (by - ay) * t);\n out.push(1);\n return t;\n}\n\nfunction intersectY(out, ax, ay, bx, by, y) {\n var t = (y - ay) / (by - ay);\n out.push(ax + (bx - ax) * t);\n out.push(y);\n out.push(1);\n return t;\n}\n","\nimport clip from './clip';\nimport createFeature from './feature';\n\nexport default function wrap(features, options) {\n var buffer = options.buffer / options.extent;\n var merged = features;\n var left = clip(features, 1, -1 - buffer, buffer, 0, -1, 2, options); // left world copy\n var right = clip(features, 1, 1 - buffer, 2 + buffer, 0, -1, 2, options); // right world copy\n\n if (left || right) {\n merged = clip(features, 1, -buffer, 1 + buffer, 0, -1, 2, options) || []; // center world copy\n\n if (left) merged = shiftFeatureCoords(left, 1).concat(merged); // merge left into center\n if (right) merged = merged.concat(shiftFeatureCoords(right, -1)); // merge right into center\n }\n\n return merged;\n}\n\nfunction shiftFeatureCoords(features, offset) {\n var newFeatures = [];\n\n for (var i = 0; i < features.length; i++) {\n var feature = features[i],\n type = feature.type;\n\n var newGeometry;\n\n if (type === 'Point' || type === 'MultiPoint' || type === 'LineString') {\n newGeometry = shiftCoords(feature.geometry, offset);\n\n } else if (type === 'MultiLineString' || type === 'Polygon') {\n newGeometry = [];\n for (var j = 0; j < feature.geometry.length; j++) {\n newGeometry.push(shiftCoords(feature.geometry[j], offset));\n }\n } else if (type === 'MultiPolygon') {\n newGeometry = [];\n for (j = 0; j < feature.geometry.length; j++) {\n var newPolygon = [];\n for (var k = 0; k < feature.geometry[j].length; k++) {\n newPolygon.push(shiftCoords(feature.geometry[j][k], offset));\n }\n newGeometry.push(newPolygon);\n }\n }\n\n newFeatures.push(createFeature(feature.id, type, newGeometry, feature.tags));\n }\n\n return newFeatures;\n}\n\nfunction shiftCoords(points, offset) {\n var newPoints = [];\n newPoints.size = points.size;\n\n if (points.start !== undefined) {\n newPoints.start = points.start;\n newPoints.end = points.end;\n }\n\n for (var i = 0; i < points.length; i += 3) {\n newPoints.push(points[i] + offset, points[i + 1], points[i + 2]);\n }\n return newPoints;\n}\n","\n// Transforms the coordinates of each feature in the given tile from\n// mercator-projected space into (extent x extent) tile space.\nexport default function transformTile(tile, extent) {\n if (tile.transformed) return tile;\n\n var z2 = 1 << tile.z,\n tx = tile.x,\n ty = tile.y,\n i, j, k;\n\n for (i = 0; i < tile.features.length; i++) {\n var feature = tile.features[i],\n geom = feature.geometry,\n type = feature.type;\n\n feature.geometry = [];\n\n if (type === 1) {\n for (j = 0; j < geom.length; j += 2) {\n feature.geometry.push(transformPoint(geom[j], geom[j + 1], extent, z2, tx, ty));\n }\n } else {\n for (j = 0; j < geom.length; j++) {\n var ring = [];\n for (k = 0; k < geom[j].length; k += 2) {\n ring.push(transformPoint(geom[j][k], geom[j][k + 1], extent, z2, tx, ty));\n }\n feature.geometry.push(ring);\n }\n }\n }\n\n tile.transformed = true;\n\n return tile;\n}\n\nfunction transformPoint(x, y, extent, z2, tx, ty) {\n return [\n Math.round(extent * (x * z2 - tx)),\n Math.round(extent * (y * z2 - ty))];\n}\n","\nexport default function createTile(features, z, tx, ty, options) {\n var tolerance = z === options.maxZoom ? 0 : options.tolerance / ((1 << z) * options.extent);\n var tile = {\n features: [],\n numPoints: 0,\n numSimplified: 0,\n numFeatures: 0,\n source: null,\n x: tx,\n y: ty,\n z: z,\n transformed: false,\n minX: 2,\n minY: 1,\n maxX: -1,\n maxY: 0\n };\n for (var i = 0; i < features.length; i++) {\n tile.numFeatures++;\n addFeature(tile, features[i], tolerance, options);\n\n var minX = features[i].minX;\n var minY = features[i].minY;\n var maxX = features[i].maxX;\n var maxY = features[i].maxY;\n\n if (minX < tile.minX) tile.minX = minX;\n if (minY < tile.minY) tile.minY = minY;\n if (maxX > tile.maxX) tile.maxX = maxX;\n if (maxY > tile.maxY) tile.maxY = maxY;\n }\n return tile;\n}\n\nfunction addFeature(tile, feature, tolerance, options) {\n\n var geom = feature.geometry,\n type = feature.type,\n simplified = [];\n\n if (type === 'Point' || type === 'MultiPoint') {\n for (var i = 0; i < geom.length; i += 3) {\n simplified.push(geom[i]);\n simplified.push(geom[i + 1]);\n tile.numPoints++;\n tile.numSimplified++;\n }\n\n } else if (type === 'LineString') {\n addLine(simplified, geom, tile, tolerance, false, false);\n\n } else if (type === 'MultiLineString' || type === 'Polygon') {\n for (i = 0; i < geom.length; i++) {\n addLine(simplified, geom[i], tile, tolerance, type === 'Polygon', i === 0);\n }\n\n } else if (type === 'MultiPolygon') {\n\n for (var k = 0; k < geom.length; k++) {\n var polygon = geom[k];\n for (i = 0; i < polygon.length; i++) {\n addLine(simplified, polygon[i], tile, tolerance, true, i === 0);\n }\n }\n }\n\n if (simplified.length) {\n var tags = feature.tags || null;\n if (type === 'LineString' && options.lineMetrics) {\n tags = {};\n for (var key in feature.tags) tags[key] = feature.tags[key];\n tags['mapbox_clip_start'] = geom.start / geom.size;\n tags['mapbox_clip_end'] = geom.end / geom.size;\n }\n var tileFeature = {\n geometry: simplified,\n type: type === 'Polygon' || type === 'MultiPolygon' ? 3 :\n type === 'LineString' || type === 'MultiLineString' ? 2 : 1,\n tags: tags\n };\n if (feature.id !== null) {\n tileFeature.id = feature.id;\n }\n tile.features.push(tileFeature);\n }\n}\n\nfunction addLine(result, geom, tile, tolerance, isPolygon, isOuter) {\n var sqTolerance = tolerance * tolerance;\n\n if (tolerance > 0 && (geom.size < (isPolygon ? sqTolerance : tolerance))) {\n tile.numPoints += geom.length / 3;\n return;\n }\n\n var ring = [];\n\n for (var i = 0; i < geom.length; i += 3) {\n if (tolerance === 0 || geom[i + 2] > sqTolerance) {\n tile.numSimplified++;\n ring.push(geom[i]);\n ring.push(geom[i + 1]);\n }\n tile.numPoints++;\n }\n\n if (isPolygon) rewind(ring, isOuter);\n\n result.push(ring);\n}\n\nfunction rewind(ring, clockwise) {\n var area = 0;\n for (var i = 0, len = ring.length, j = len - 2; i < len; j = i, i += 2) {\n area += (ring[i] - ring[j]) * (ring[i + 1] + ring[j + 1]);\n }\n if (area > 0 === clockwise) {\n for (i = 0, len = ring.length; i < len / 2; i += 2) {\n var x = ring[i];\n var y = ring[i + 1];\n ring[i] = ring[len - 2 - i];\n ring[i + 1] = ring[len - 1 - i];\n ring[len - 2 - i] = x;\n ring[len - 1 - i] = y;\n }\n }\n}\n","\nimport convert from './convert'; // GeoJSON conversion and preprocessing\nimport clip from './clip'; // stripe clipping algorithm\nimport wrap from './wrap'; // date line processing\nimport transform from './transform'; // coordinate transformation\nimport createTile from './tile'; // final simplified tile generation\n\nexport default function geojsonvt(data, options) {\n return new GeoJSONVT(data, options);\n}\n\nfunction GeoJSONVT(data, options) {\n options = this.options = extend(Object.create(this.options), options);\n\n var debug = options.debug;\n\n if (debug) console.time('preprocess data');\n\n if (options.maxZoom < 0 || options.maxZoom > 24) throw new Error('maxZoom should be in the 0-24 range');\n if (options.promoteId && options.generateId) throw new Error('promoteId and generateId cannot be used together.');\n\n var features = convert(data, options);\n\n this.tiles = {};\n this.tileCoords = [];\n\n if (debug) {\n console.timeEnd('preprocess data');\n console.log('index: maxZoom: %d, maxPoints: %d', options.indexMaxZoom, options.indexMaxPoints);\n console.time('generate tiles');\n this.stats = {};\n this.total = 0;\n }\n\n features = wrap(features, options);\n\n // start slicing from the top tile down\n if (features.length) this.splitTile(features, 0, 0, 0);\n\n if (debug) {\n if (features.length) console.log('features: %d, points: %d', this.tiles[0].numFeatures, this.tiles[0].numPoints);\n console.timeEnd('generate tiles');\n console.log('tiles generated:', this.total, JSON.stringify(this.stats));\n }\n}\n\nGeoJSONVT.prototype.options = {\n maxZoom: 14, // max zoom to preserve detail on\n indexMaxZoom: 5, // max zoom in the tile index\n indexMaxPoints: 100000, // max number of points per tile in the tile index\n tolerance: 3, // simplification tolerance (higher means simpler)\n extent: 4096, // tile extent\n buffer: 64, // tile buffer on each side\n lineMetrics: false, // whether to calculate line metrics\n promoteId: null, // name of a feature property to be promoted to feature.id\n generateId: false, // whether to generate feature ids. Cannot be used with promoteId\n debug: 0 // logging level (0, 1 or 2)\n};\n\nGeoJSONVT.prototype.splitTile = function (features, z, x, y, cz, cx, cy) {\n\n var stack = [features, z, x, y],\n options = this.options,\n debug = options.debug;\n\n // avoid recursion by using a processing queue\n while (stack.length) {\n y = stack.pop();\n x = stack.pop();\n z = stack.pop();\n features = stack.pop();\n\n var z2 = 1 << z,\n id = toID(z, x, y),\n tile = this.tiles[id];\n\n if (!tile) {\n if (debug > 1) console.time('creation');\n\n tile = this.tiles[id] = createTile(features, z, x, y, options);\n this.tileCoords.push({z: z, x: x, y: y});\n\n if (debug) {\n if (debug > 1) {\n console.log('tile z%d-%d-%d (features: %d, points: %d, simplified: %d)',\n z, x, y, tile.numFeatures, tile.numPoints, tile.numSimplified);\n console.timeEnd('creation');\n }\n var key = 'z' + z;\n this.stats[key] = (this.stats[key] || 0) + 1;\n this.total++;\n }\n }\n\n // save reference to original geometry in tile so that we can drill down later if we stop now\n tile.source = features;\n\n // if it's the first-pass tiling\n if (!cz) {\n // stop tiling if we reached max zoom, or if the tile is too simple\n if (z === options.indexMaxZoom || tile.numPoints <= options.indexMaxPoints) continue;\n\n // if a drilldown to a specific tile\n } else {\n // stop tiling if we reached base zoom or our target tile zoom\n if (z === options.maxZoom || z === cz) continue;\n\n // stop tiling if it's not an ancestor of the target tile\n var m = 1 << (cz - z);\n if (x !== Math.floor(cx / m) || y !== Math.floor(cy / m)) continue;\n }\n\n // if we slice further down, no need to keep source geometry\n tile.source = null;\n\n if (features.length === 0) continue;\n\n if (debug > 1) console.time('clipping');\n\n // values we'll use for clipping\n var k1 = 0.5 * options.buffer / options.extent,\n k2 = 0.5 - k1,\n k3 = 0.5 + k1,\n k4 = 1 + k1,\n tl, bl, tr, br, left, right;\n\n tl = bl = tr = br = null;\n\n left = clip(features, z2, x - k1, x + k3, 0, tile.minX, tile.maxX, options);\n right = clip(features, z2, x + k2, x + k4, 0, tile.minX, tile.maxX, options);\n features = null;\n\n if (left) {\n tl = clip(left, z2, y - k1, y + k3, 1, tile.minY, tile.maxY, options);\n bl = clip(left, z2, y + k2, y + k4, 1, tile.minY, tile.maxY, options);\n left = null;\n }\n\n if (right) {\n tr = clip(right, z2, y - k1, y + k3, 1, tile.minY, tile.maxY, options);\n br = clip(right, z2, y + k2, y + k4, 1, tile.minY, tile.maxY, options);\n right = null;\n }\n\n if (debug > 1) console.timeEnd('clipping');\n\n stack.push(tl || [], z + 1, x * 2, y * 2);\n stack.push(bl || [], z + 1, x * 2, y * 2 + 1);\n stack.push(tr || [], z + 1, x * 2 + 1, y * 2);\n stack.push(br || [], z + 1, x * 2 + 1, y * 2 + 1);\n }\n};\n\nGeoJSONVT.prototype.getTile = function (z, x, y) {\n var options = this.options,\n extent = options.extent,\n debug = options.debug;\n\n if (z < 0 || z > 24) return null;\n\n var z2 = 1 << z;\n x = ((x % z2) + z2) % z2; // wrap tile x coordinate\n\n var id = toID(z, x, y);\n if (this.tiles[id]) return transform(this.tiles[id], extent);\n\n if (debug > 1) console.log('drilling down to z%d-%d-%d', z, x, y);\n\n var z0 = z,\n x0 = x,\n y0 = y,\n parent;\n\n while (!parent && z0 > 0) {\n z0--;\n x0 = Math.floor(x0 / 2);\n y0 = Math.floor(y0 / 2);\n parent = this.tiles[toID(z0, x0, y0)];\n }\n\n if (!parent || !parent.source) return null;\n\n // if we found a parent tile containing the original geometry, we can drill down from it\n if (debug > 1) console.log('found parent tile z%d-%d-%d', z0, x0, y0);\n\n if (debug > 1) console.time('drilling down');\n this.splitTile(parent.source, z0, x0, y0, z, x, y);\n if (debug > 1) console.timeEnd('drilling down');\n\n return this.tiles[id] ? transform(this.tiles[id], extent) : null;\n};\n\nfunction toID(z, x, y) {\n return (((1 << z) * y + x) * 32) + z;\n}\n\nfunction extend(dest, src) {\n for (var i in src) dest[i] = src[i];\n return dest;\n}\n","// @flow\n\nimport {getJSON} from '../util/ajax';\n\nimport {RequestPerformance} from '../util/performance';\nimport rewind from '@mapbox/geojson-rewind';\nimport GeoJSONWrapper from './geojson_wrapper';\nimport vtpbf from 'vt-pbf';\nimport Supercluster from 'supercluster';\nimport geojsonvt from 'geojson-vt';\nimport assert from 'assert';\nimport VectorTileWorkerSource from './vector_tile_worker_source';\nimport {createExpression} from '../style-spec/expression';\n\nimport type {\n WorkerTileParameters,\n WorkerTileCallback,\n} from '../source/worker_source';\n\nimport type Actor from '../util/actor';\nimport type StyleLayerIndex from '../style/style_layer_index';\n\nimport type {LoadVectorDataCallback} from './vector_tile_worker_source';\nimport type {RequestParameters, ResponseCallback} from '../util/ajax';\nimport type {Callback} from '../types/callback';\nimport type {GeoJSONFeature} from '@mapbox/geojson-types';\n\nexport type LoadGeoJSONParameters = {\n request?: RequestParameters,\n data?: string,\n source: string,\n cluster: boolean,\n superclusterOptions?: Object,\n geojsonVtOptions?: Object,\n clusterProperties?: Object,\n filter?: Array\n};\n\nexport type LoadGeoJSON = (params: LoadGeoJSONParameters, callback: ResponseCallback) => void;\n\nexport interface GeoJSONIndex {\n getTile(z: number, x: number, y: number): Object;\n\n // supercluster methods\n getClusterExpansionZoom(clusterId: number): number;\n getChildren(clusterId: number): Array;\n getLeaves(clusterId: number, limit: number, offset: number): Array;\n}\n\nfunction loadGeoJSONTile(params: WorkerTileParameters, callback: LoadVectorDataCallback) {\n const canonical = params.tileID.canonical;\n\n if (!this._geoJSONIndex) {\n return callback(null, null); // we couldn't load the file\n }\n\n const geoJSONTile = this._geoJSONIndex.getTile(canonical.z, canonical.x, canonical.y);\n if (!geoJSONTile) {\n return callback(null, null); // nothing in the given tile\n }\n\n const geojsonWrapper = new GeoJSONWrapper(geoJSONTile.features);\n\n // Encode the geojson-vt tile into binary vector tile form. This\n // is a convenience that allows `FeatureIndex` to operate the same way\n // across `VectorTileSource` and `GeoJSONSource` data.\n let pbf = vtpbf(geojsonWrapper);\n if (pbf.byteOffset !== 0 || pbf.byteLength !== pbf.buffer.byteLength) {\n // Compatibility with node Buffer (https://github.com/mapbox/pbf/issues/35)\n pbf = new Uint8Array(pbf);\n }\n\n callback(null, {\n vectorTile: geojsonWrapper,\n rawData: pbf.buffer\n });\n}\n\nexport type SourceState =\n | 'Idle' // Source empty or data loaded\n | 'Coalescing' // Data finished loading, but discard 'loadData' messages until receiving 'coalesced'\n | 'NeedsLoadData'; // 'loadData' received while coalescing, trigger one more 'loadData' on receiving 'coalesced'\n\n/**\n * The {@link WorkerSource} implementation that supports {@link GeoJSONSource}.\n * This class is designed to be easily reused to support custom source types\n * for data formats that can be parsed/converted into an in-memory GeoJSON\n * representation. To do so, create it with\n * `new GeoJSONWorkerSource(actor, layerIndex, customLoadGeoJSONFunction)`.\n * For a full example, see [mapbox-gl-topojson](https://github.com/developmentseed/mapbox-gl-topojson).\n *\n * @private\n */\nclass GeoJSONWorkerSource extends VectorTileWorkerSource {\n loadGeoJSON: LoadGeoJSON;\n _state: SourceState;\n _pendingCallback: Callback<{\n resourceTiming?: {[_: string]: Array},\n abandoned?: boolean }>;\n _pendingLoadDataParams: LoadGeoJSONParameters;\n _geoJSONIndex: GeoJSONIndex\n\n /**\n * @param [loadGeoJSON] Optional method for custom loading/parsing of\n * GeoJSON based on parameters passed from the main-thread Source.\n * See {@link GeoJSONWorkerSource#loadGeoJSON}.\n * @private\n */\n constructor(actor: Actor, layerIndex: StyleLayerIndex, availableImages: Array, loadGeoJSON: ?LoadGeoJSON) {\n super(actor, layerIndex, availableImages, loadGeoJSONTile);\n if (loadGeoJSON) {\n this.loadGeoJSON = loadGeoJSON;\n }\n }\n\n /**\n * Fetches (if appropriate), parses, and index geojson data into tiles. This\n * preparatory method must be called before {@link GeoJSONWorkerSource#loadTile}\n * can correctly serve up tiles.\n *\n * Defers to {@link GeoJSONWorkerSource#loadGeoJSON} for the fetching/parsing,\n * expecting `callback(error, data)` to be called with either an error or a\n * parsed GeoJSON object.\n *\n * When `loadData` requests come in faster than they can be processed,\n * they are coalesced into a single request using the latest data.\n * See {@link GeoJSONWorkerSource#coalesce}\n *\n * @param params\n * @param callback\n * @private\n */\n loadData(params: LoadGeoJSONParameters, callback: Callback<{\n resourceTiming?: {[_: string]: Array},\n abandoned?: boolean }>) {\n if (this._pendingCallback) {\n // Tell the foreground the previous call has been abandoned\n this._pendingCallback(null, {abandoned: true});\n }\n this._pendingCallback = callback;\n this._pendingLoadDataParams = params;\n\n if (this._state &&\n this._state !== 'Idle') {\n this._state = 'NeedsLoadData';\n } else {\n this._state = 'Coalescing';\n this._loadData();\n }\n }\n\n /**\n * Internal implementation: called directly by `loadData`\n * or by `coalesce` using stored parameters.\n */\n _loadData() {\n if (!this._pendingCallback || !this._pendingLoadDataParams) {\n assert(false);\n return;\n }\n const callback = this._pendingCallback;\n const params = this._pendingLoadDataParams;\n delete this._pendingCallback;\n delete this._pendingLoadDataParams;\n\n const perf = (params && params.request && params.request.collectResourceTiming) ?\n new RequestPerformance(params.request) : false;\n\n this.loadGeoJSON(params, (err: ?Error, data: ?Object) => {\n if (err || !data) {\n return callback(err);\n } else if (typeof data !== 'object') {\n return callback(new Error(`Input data given to '${params.source}' is not a valid GeoJSON object.`));\n } else {\n rewind(data, true);\n\n try {\n if (params.filter) {\n const compiled = createExpression(params.filter, {type: 'boolean', 'property-type': 'data-driven', overridable: false, transition: false});\n if (compiled.result === 'error')\n throw new Error(compiled.value.map(err => `${err.key}: ${err.message}`).join(', '));\n\n const features = data.features.filter(feature => compiled.value.evaluate({zoom: 0}, feature));\n data = {type: 'FeatureCollection', features};\n }\n\n this._geoJSONIndex = params.cluster ?\n new Supercluster(getSuperclusterOptions(params)).load(data.features) :\n geojsonvt(data, params.geojsonVtOptions);\n } catch (err) {\n return callback(err);\n }\n\n this.loaded = {};\n\n const result = {};\n if (perf) {\n const resourceTimingData = perf.finish();\n // it's necessary to eval the result of getEntriesByName() here via parse/stringify\n // late evaluation in the main thread causes TypeError: illegal invocation\n if (resourceTimingData) {\n result.resourceTiming = {};\n result.resourceTiming[params.source] = JSON.parse(JSON.stringify(resourceTimingData));\n }\n }\n callback(null, result);\n }\n });\n }\n\n /**\n * While processing `loadData`, we coalesce all further\n * `loadData` messages into a single call to _loadData\n * that will happen once we've finished processing the\n * first message. {@link GeoJSONSource#_updateWorkerData}\n * is responsible for sending us the `coalesce` message\n * at the time it receives a response from `loadData`\n *\n * State: Idle\n * ↑ |\n * 'coalesce' 'loadData'\n * | (triggers load)\n * | ↓\n * State: Coalescing\n * ↑ |\n * (triggers load) |\n * 'coalesce' 'loadData'\n * | ↓\n * State: NeedsLoadData\n */\n coalesce() {\n if (this._state === 'Coalescing') {\n this._state = 'Idle';\n } else if (this._state === 'NeedsLoadData') {\n this._state = 'Coalescing';\n this._loadData();\n }\n }\n\n /**\n * Implements {@link WorkerSource#reloadTile}.\n *\n * If the tile is loaded, uses the implementation in VectorTileWorkerSource.\n * Otherwise, such as after a setData() call, we load the tile fresh.\n *\n * @param params\n * @param params.uid The UID for this tile.\n * @private\n */\n reloadTile(params: WorkerTileParameters, callback: WorkerTileCallback) {\n const loaded = this.loaded,\n uid = params.uid;\n\n if (loaded && loaded[uid]) {\n return super.reloadTile(params, callback);\n } else {\n return this.loadTile(params, callback);\n }\n }\n\n /**\n * Fetch and parse GeoJSON according to the given params. Calls `callback`\n * with `(err, data)`, where `data` is a parsed GeoJSON object.\n *\n * GeoJSON is loaded and parsed from `params.url` if it exists, or else\n * expected as a literal (string or object) `params.data`.\n *\n * @param params\n * @param [params.url] A URL to the remote GeoJSON data.\n * @param [params.data] Literal GeoJSON data. Must be provided if `params.url` is not.\n * @private\n */\n loadGeoJSON(params: LoadGeoJSONParameters, callback: ResponseCallback) {\n // Because of same origin issues, urls must either include an explicit\n // origin or absolute path.\n // ie: /foo/bar.json or http://example.com/bar.json\n // but not ../foo/bar.json\n if (params.request) {\n getJSON(params.request, callback);\n } else if (typeof params.data === 'string') {\n try {\n return callback(null, JSON.parse(params.data));\n } catch (e) {\n return callback(new Error(`Input data given to '${params.source}' is not a valid GeoJSON object.`));\n }\n } else {\n return callback(new Error(`Input data given to '${params.source}' is not a valid GeoJSON object.`));\n }\n }\n\n removeSource(params: {source: string}, callback: Callback) {\n if (this._pendingCallback) {\n // Don't leak callbacks\n this._pendingCallback(null, {abandoned: true});\n }\n callback();\n }\n\n getClusterExpansionZoom(params: {clusterId: number}, callback: Callback) {\n try {\n callback(null, this._geoJSONIndex.getClusterExpansionZoom(params.clusterId));\n } catch (e) {\n callback(e);\n }\n }\n\n getClusterChildren(params: {clusterId: number}, callback: Callback>) {\n try {\n callback(null, this._geoJSONIndex.getChildren(params.clusterId));\n } catch (e) {\n callback(e);\n }\n }\n\n getClusterLeaves(params: {clusterId: number, limit: number, offset: number}, callback: Callback>) {\n try {\n callback(null, this._geoJSONIndex.getLeaves(params.clusterId, params.limit, params.offset));\n } catch (e) {\n callback(e);\n }\n }\n}\n\nfunction getSuperclusterOptions({superclusterOptions, clusterProperties}) {\n if (!clusterProperties || !superclusterOptions) return superclusterOptions;\n\n const mapExpressions = {};\n const reduceExpressions = {};\n const globals = {accumulated: null, zoom: 0};\n const feature = {properties: null};\n const propertyNames = Object.keys(clusterProperties);\n\n for (const key of propertyNames) {\n const [operator, mapExpression] = clusterProperties[key];\n\n const mapExpressionParsed = createExpression(mapExpression);\n const reduceExpressionParsed = createExpression(\n typeof operator === 'string' ? [operator, ['accumulated'], ['get', key]] : operator);\n\n assert(mapExpressionParsed.result === 'success');\n assert(reduceExpressionParsed.result === 'success');\n\n mapExpressions[key] = mapExpressionParsed.value;\n reduceExpressions[key] = reduceExpressionParsed.value;\n }\n\n superclusterOptions.map = (pointProperties) => {\n feature.properties = pointProperties;\n const properties = {};\n for (const key of propertyNames) {\n properties[key] = mapExpressions[key].evaluate(globals, feature);\n }\n return properties;\n };\n superclusterOptions.reduce = (accumulated, clusterProperties) => {\n feature.properties = clusterProperties;\n for (const key of propertyNames) {\n globals.accumulated = accumulated[key];\n accumulated[key] = reduceExpressions[key].evaluate(globals, feature);\n }\n };\n\n return superclusterOptions;\n}\n\nexport default GeoJSONWorkerSource;\n","// @flow\n\nimport Actor from '../util/actor';\n\nimport StyleLayerIndex from '../style/style_layer_index';\nimport VectorTileWorkerSource from './vector_tile_worker_source';\nimport RasterDEMTileWorkerSource from './raster_dem_tile_worker_source';\nimport GeoJSONWorkerSource from './geojson_worker_source';\nimport assert from 'assert';\nimport {plugin as globalRTLTextPlugin} from './rtl_text_plugin';\nimport {enforceCacheSizeLimit} from '../util/tile_request_cache';\n\nimport type {\n WorkerSource,\n WorkerTileParameters,\n WorkerDEMTileParameters,\n WorkerTileCallback,\n WorkerDEMTileCallback,\n TileParameters\n} from '../source/worker_source';\n\nimport type {WorkerGlobalScopeInterface} from '../util/web_worker';\nimport type {Callback} from '../types/callback';\nimport type {LayerSpecification} from '../style-spec/types';\nimport type {PluginState} from './rtl_text_plugin';\n\n/**\n * @private\n */\nexport default class Worker {\n self: WorkerGlobalScopeInterface;\n actor: Actor;\n layerIndexes: {[_: string]: StyleLayerIndex };\n availableImages: {[_: string]: Array };\n workerSourceTypes: {[_: string]: Class };\n workerSources: {[_: string]: {[_: string]: {[_: string]: WorkerSource } } };\n demWorkerSources: {[_: string]: {[_: string]: RasterDEMTileWorkerSource } };\n referrer: ?string;\n\n constructor(self: WorkerGlobalScopeInterface) {\n this.self = self;\n this.actor = new Actor(self, this);\n\n this.layerIndexes = {};\n this.availableImages = {};\n\n this.workerSourceTypes = {\n vector: VectorTileWorkerSource,\n geojson: GeoJSONWorkerSource\n };\n\n // [mapId][sourceType][sourceName] => worker source instance\n this.workerSources = {};\n this.demWorkerSources = {};\n\n this.self.registerWorkerSource = (name: string, WorkerSource: Class) => {\n if (this.workerSourceTypes[name]) {\n throw new Error(`Worker source with name \"${name}\" already registered.`);\n }\n this.workerSourceTypes[name] = WorkerSource;\n };\n\n // This is invoked by the RTL text plugin when the download via the `importScripts` call has finished, and the code has been parsed.\n this.self.registerRTLTextPlugin = (rtlTextPlugin: {applyArabicShaping: Function, processBidirectionalText: Function, processStyledBidirectionalText?: Function}) => {\n if (globalRTLTextPlugin.isParsed()) {\n throw new Error('RTL text plugin already registered.');\n }\n globalRTLTextPlugin['applyArabicShaping'] = rtlTextPlugin.applyArabicShaping;\n globalRTLTextPlugin['processBidirectionalText'] = rtlTextPlugin.processBidirectionalText;\n globalRTLTextPlugin['processStyledBidirectionalText'] = rtlTextPlugin.processStyledBidirectionalText;\n };\n }\n\n setReferrer(mapID: string, referrer: string) {\n this.referrer = referrer;\n }\n\n setImages(mapId: string, images: Array, callback: WorkerTileCallback) {\n this.availableImages[mapId] = images;\n for (const workerSource in this.workerSources[mapId]) {\n const ws = this.workerSources[mapId][workerSource];\n for (const source in ws) {\n ws[source].availableImages = images;\n }\n }\n callback();\n }\n\n setLayers(mapId: string, layers: Array, callback: WorkerTileCallback) {\n this.getLayerIndex(mapId).replace(layers);\n callback();\n }\n\n updateLayers(mapId: string, params: {layers: Array, removedIds: Array}, callback: WorkerTileCallback) {\n this.getLayerIndex(mapId).update(params.layers, params.removedIds);\n callback();\n }\n\n loadTile(mapId: string, params: WorkerTileParameters & {type: string}, callback: WorkerTileCallback) {\n assert(params.type);\n this.getWorkerSource(mapId, params.type, params.source).loadTile(params, callback);\n }\n\n loadDEMTile(mapId: string, params: WorkerDEMTileParameters, callback: WorkerDEMTileCallback) {\n this.getDEMWorkerSource(mapId, params.source).loadTile(params, callback);\n }\n\n reloadTile(mapId: string, params: WorkerTileParameters & {type: string}, callback: WorkerTileCallback) {\n assert(params.type);\n this.getWorkerSource(mapId, params.type, params.source).reloadTile(params, callback);\n }\n\n abortTile(mapId: string, params: TileParameters & {type: string}, callback: WorkerTileCallback) {\n assert(params.type);\n this.getWorkerSource(mapId, params.type, params.source).abortTile(params, callback);\n }\n\n removeTile(mapId: string, params: TileParameters & {type: string}, callback: WorkerTileCallback) {\n assert(params.type);\n this.getWorkerSource(mapId, params.type, params.source).removeTile(params, callback);\n }\n\n removeDEMTile(mapId: string, params: TileParameters) {\n this.getDEMWorkerSource(mapId, params.source).removeTile(params);\n }\n\n removeSource(mapId: string, params: {source: string} & {type: string}, callback: WorkerTileCallback) {\n assert(params.type);\n assert(params.source);\n\n if (!this.workerSources[mapId] ||\n !this.workerSources[mapId][params.type] ||\n !this.workerSources[mapId][params.type][params.source]) {\n return;\n }\n\n const worker = this.workerSources[mapId][params.type][params.source];\n delete this.workerSources[mapId][params.type][params.source];\n\n if (worker.removeSource !== undefined) {\n worker.removeSource(params, callback);\n } else {\n callback();\n }\n }\n\n /**\n * Load a {@link WorkerSource} script at params.url. The script is run\n * (using importScripts) with `registerWorkerSource` in scope, which is a\n * function taking `(name, workerSourceObject)`.\n * @private\n */\n loadWorkerSource(map: string, params: { url: string }, callback: Callback) {\n try {\n this.self.importScripts(params.url);\n callback();\n } catch (e) {\n callback(e.toString());\n }\n }\n\n syncRTLPluginState(map: string, state: PluginState, callback: Callback) {\n try {\n globalRTLTextPlugin.setState(state);\n const pluginURL = globalRTLTextPlugin.getPluginURL();\n if (\n globalRTLTextPlugin.isLoaded() &&\n !globalRTLTextPlugin.isParsed() &&\n pluginURL != null // Not possible when `isLoaded` is true, but keeps flow happy\n ) {\n this.self.importScripts(pluginURL);\n const complete = globalRTLTextPlugin.isParsed();\n const error = complete ? undefined : new Error(`RTL Text Plugin failed to import scripts from ${pluginURL}`);\n callback(error, complete);\n }\n } catch (e) {\n callback(e.toString());\n }\n }\n\n getAvailableImages(mapId: string) {\n let availableImages = this.availableImages[mapId];\n\n if (!availableImages) {\n availableImages = [];\n }\n\n return availableImages;\n }\n\n getLayerIndex(mapId: string) {\n let layerIndexes = this.layerIndexes[mapId];\n if (!layerIndexes) {\n layerIndexes = this.layerIndexes[mapId] = new StyleLayerIndex();\n }\n return layerIndexes;\n }\n\n getWorkerSource(mapId: string, type: string, source: string) {\n if (!this.workerSources[mapId])\n this.workerSources[mapId] = {};\n if (!this.workerSources[mapId][type])\n this.workerSources[mapId][type] = {};\n\n if (!this.workerSources[mapId][type][source]) {\n // use a wrapped actor so that we can attach a target mapId param\n // to any messages invoked by the WorkerSource\n const actor = {\n send: (type, data, callback) => {\n this.actor.send(type, data, callback, mapId);\n }\n };\n this.workerSources[mapId][type][source] = new (this.workerSourceTypes[type]: any)((actor: any), this.getLayerIndex(mapId), this.getAvailableImages(mapId));\n }\n\n return this.workerSources[mapId][type][source];\n }\n\n getDEMWorkerSource(mapId: string, source: string) {\n if (!this.demWorkerSources[mapId])\n this.demWorkerSources[mapId] = {};\n\n if (!this.demWorkerSources[mapId][source]) {\n this.demWorkerSources[mapId][source] = new RasterDEMTileWorkerSource();\n }\n\n return this.demWorkerSources[mapId][source];\n }\n\n enforceCacheSizeLimit(mapId: string, limit: number) {\n enforceCacheSizeLimit(limit);\n }\n}\n\n/* global self, WorkerGlobalScope */\nif (typeof WorkerGlobalScope !== 'undefined' &&\n typeof self !== 'undefined' &&\n self instanceof WorkerGlobalScope) {\n self.worker = new Worker(self);\n}\n","'use strict';\n\nif (typeof module !== 'undefined' && module.exports) {\n module.exports = isSupported;\n} else if (window) {\n window.mapboxgl = window.mapboxgl || {};\n window.mapboxgl.supported = isSupported;\n window.mapboxgl.notSupportedReason = notSupportedReason;\n}\n\n/**\n * Test whether the current browser supports Mapbox GL JS\n * @param {Object} options\n * @param {boolean} [options.failIfMajorPerformanceCaveat=false] Return `false`\n * if the performance of Mapbox GL JS would be dramatically worse than\n * expected (i.e. a software renderer is would be used)\n * @return {boolean}\n */\nfunction isSupported(options) {\n return !notSupportedReason(options);\n}\n\nfunction notSupportedReason(options) {\n if (!isBrowser()) return 'not a browser';\n if (!isArraySupported()) return 'insufficent Array support';\n if (!isFunctionSupported()) return 'insufficient Function support';\n if (!isObjectSupported()) return 'insufficient Object support';\n if (!isJSONSupported()) return 'insufficient JSON support';\n if (!isWorkerSupported()) return 'insufficient worker support';\n if (!isUint8ClampedArraySupported()) return 'insufficient Uint8ClampedArray support';\n if (!isArrayBufferSupported()) return 'insufficient ArrayBuffer support';\n if (!isCanvasGetImageDataSupported()) return 'insufficient Canvas/getImageData support';\n if (!isWebGLSupportedCached(options && options.failIfMajorPerformanceCaveat)) return 'insufficient WebGL support';\n}\n\nfunction isBrowser() {\n return typeof window !== 'undefined' && typeof document !== 'undefined';\n}\n\nfunction isArraySupported() {\n return (\n Array.prototype &&\n Array.prototype.every &&\n Array.prototype.filter &&\n Array.prototype.forEach &&\n Array.prototype.indexOf &&\n Array.prototype.lastIndexOf &&\n Array.prototype.map &&\n Array.prototype.some &&\n Array.prototype.reduce &&\n Array.prototype.reduceRight &&\n Array.isArray\n );\n}\n\nfunction isFunctionSupported() {\n return Function.prototype && Function.prototype.bind;\n}\n\nfunction isObjectSupported() {\n return (\n Object.keys &&\n Object.create &&\n Object.getPrototypeOf &&\n Object.getOwnPropertyNames &&\n Object.isSealed &&\n Object.isFrozen &&\n Object.isExtensible &&\n Object.getOwnPropertyDescriptor &&\n Object.defineProperty &&\n Object.defineProperties &&\n Object.seal &&\n Object.freeze &&\n Object.preventExtensions\n );\n}\n\nfunction isJSONSupported() {\n return 'JSON' in window && 'parse' in JSON && 'stringify' in JSON;\n}\n\nfunction isWorkerSupported() {\n if (!('Worker' in window && 'Blob' in window && 'URL' in window)) {\n return false;\n }\n\n var blob = new Blob([''], { type: 'text/javascript' });\n var workerURL = URL.createObjectURL(blob);\n var supported;\n var worker;\n\n try {\n worker = new Worker(workerURL);\n supported = true;\n } catch (e) {\n supported = false;\n }\n\n if (worker) {\n worker.terminate();\n }\n URL.revokeObjectURL(workerURL);\n\n return supported;\n}\n\n// IE11 only supports `Uint8ClampedArray` as of version\n// [KB2929437](https://support.microsoft.com/en-us/kb/2929437)\nfunction isUint8ClampedArraySupported() {\n return 'Uint8ClampedArray' in window;\n}\n\n// https://github.com/mapbox/mapbox-gl-supported/issues/19\nfunction isArrayBufferSupported() {\n return ArrayBuffer.isView;\n}\n\n// Some browsers or browser extensions block access to canvas data to prevent fingerprinting.\n// Mapbox GL uses this API to load sprites and images in general.\nfunction isCanvasGetImageDataSupported() {\n const canvas = document.createElement('canvas');\n canvas.width = canvas.height = 1;\n const context = canvas.getContext('2d');\n if (!context) {\n return false;\n }\n const imageData = context.getImageData(0, 0, 1, 1);\n return imageData && imageData.width === canvas.width;\n}\n\nvar isWebGLSupportedCache = {};\nfunction isWebGLSupportedCached(failIfMajorPerformanceCaveat) {\n\n if (isWebGLSupportedCache[failIfMajorPerformanceCaveat] === undefined) {\n isWebGLSupportedCache[failIfMajorPerformanceCaveat] = isWebGLSupported(failIfMajorPerformanceCaveat);\n }\n\n return isWebGLSupportedCache[failIfMajorPerformanceCaveat];\n}\n\nisSupported.webGLContextAttributes = {\n antialias: false,\n alpha: true,\n stencil: true,\n depth: true\n};\n\nfunction getWebGLContext(failIfMajorPerformanceCaveat) {\n var canvas = document.createElement('canvas');\n\n var attributes = Object.create(isSupported.webGLContextAttributes);\n attributes.failIfMajorPerformanceCaveat = failIfMajorPerformanceCaveat;\n\n if (canvas.probablySupportsContext) {\n return (\n canvas.probablySupportsContext('webgl', attributes) ||\n canvas.probablySupportsContext('experimental-webgl', attributes)\n );\n\n } else if (canvas.supportsContext) {\n return (\n canvas.supportsContext('webgl', attributes) ||\n canvas.supportsContext('experimental-webgl', attributes)\n );\n\n } else {\n return (\n canvas.getContext('webgl', attributes) ||\n canvas.getContext('experimental-webgl', attributes)\n );\n }\n}\n\nfunction isWebGLSupported(failIfMajorPerformanceCaveat) {\n const gl = getWebGLContext(failIfMajorPerformanceCaveat);\n if (!gl) {\n return false;\n }\n\n // Try compiling a shader and get its compile status. Some browsers like Brave block this API\n // to prevent fingerprinting. Unfortunately, this also means that Mapbox GL won't work.\n const shader = gl.createShader(gl.VERTEX_SHADER);\n if (!shader || gl.isContextLost()) {\n return false;\n }\n gl.shaderSource(shader, 'void main() {}');\n gl.compileShader(shader);\n return gl.getShaderParameter(shader, gl.COMPILE_STATUS) === true;\n}\n","// @flow strict\n\nimport Point from '@mapbox/point-geometry';\n\nimport window from './window';\nimport assert from 'assert';\n\nconst DOM = {};\nexport default DOM;\n\nDOM.create = function (tagName: string, className: ?string, container?: HTMLElement) {\n const el = window.document.createElement(tagName);\n if (className !== undefined) el.className = className;\n if (container) container.appendChild(el);\n return el;\n};\n\nDOM.createNS = function (namespaceURI: string, tagName: string) {\n const el = window.document.createElementNS(namespaceURI, tagName);\n return el;\n};\n\nconst docStyle = window.document && window.document.documentElement.style;\n\nfunction testProp(props) {\n if (!docStyle) return props[0];\n for (let i = 0; i < props.length; i++) {\n if (props[i] in docStyle) {\n return props[i];\n }\n }\n return props[0];\n}\n\nconst selectProp = testProp(['userSelect', 'MozUserSelect', 'WebkitUserSelect', 'msUserSelect']);\nlet userSelect;\n\nDOM.disableDrag = function () {\n if (docStyle && selectProp) {\n userSelect = docStyle[selectProp];\n docStyle[selectProp] = 'none';\n }\n};\n\nDOM.enableDrag = function () {\n if (docStyle && selectProp) {\n docStyle[selectProp] = userSelect;\n }\n};\n\nconst transformProp = testProp(['transform', 'WebkitTransform']);\n\nDOM.setTransform = function(el: HTMLElement, value: string) {\n // https://github.com/facebook/flow/issues/7754\n // $FlowFixMe\n el.style[transformProp] = value;\n};\n\n// Feature detection for {passive: false} support in add/removeEventListener.\nlet passiveSupported = false;\n\ntry {\n // https://github.com/facebook/flow/issues/285\n // $FlowFixMe\n const options = Object.defineProperty({}, \"passive\", {\n get() { // eslint-disable-line\n passiveSupported = true;\n }\n });\n window.addEventListener(\"test\", options, options);\n window.removeEventListener(\"test\", options, options);\n} catch (err) {\n passiveSupported = false;\n}\n\nDOM.addEventListener = function(target: *, type: *, callback: *, options: {passive?: boolean, capture?: boolean} = {}) {\n if ('passive' in options && passiveSupported) {\n target.addEventListener(type, callback, options);\n } else {\n target.addEventListener(type, callback, options.capture);\n }\n};\n\nDOM.removeEventListener = function(target: *, type: *, callback: *, options: {passive?: boolean, capture?: boolean} = {}) {\n if ('passive' in options && passiveSupported) {\n target.removeEventListener(type, callback, options);\n } else {\n target.removeEventListener(type, callback, options.capture);\n }\n};\n\n// Suppress the next click, but only if it's immediate.\nconst suppressClick: MouseEventListener = function (e) {\n e.preventDefault();\n e.stopPropagation();\n window.removeEventListener('click', suppressClick, true);\n};\n\nDOM.suppressClick = function() {\n window.addEventListener('click', suppressClick, true);\n window.setTimeout(() => {\n window.removeEventListener('click', suppressClick, true);\n }, 0);\n};\n\nDOM.mousePos = function (el: HTMLElement, e: MouseEvent | window.TouchEvent | Touch) {\n const rect = el.getBoundingClientRect();\n return new Point(\n e.clientX - rect.left - el.clientLeft,\n e.clientY - rect.top - el.clientTop\n );\n};\n\nDOM.touchPos = function (el: HTMLElement, touches: TouchList) {\n const rect = el.getBoundingClientRect(),\n points = [];\n for (let i = 0; i < touches.length; i++) {\n points.push(new Point(\n touches[i].clientX - rect.left - el.clientLeft,\n touches[i].clientY - rect.top - el.clientTop\n ));\n }\n return points;\n};\n\nDOM.mouseButton = function (e: MouseEvent) {\n assert(e.type === 'mousedown' || e.type === 'mouseup');\n if (typeof window.InstallTrigger !== 'undefined' && e.button === 2 && e.ctrlKey &&\n window.navigator.platform.toUpperCase().indexOf('MAC') >= 0) {\n // Fix for https://github.com/mapbox/mapbox-gl-js/issues/3131:\n // Firefox (detected by InstallTrigger) on Mac determines e.button = 2 when\n // using Control + left click\n return 0;\n }\n return e.button;\n};\n\nDOM.remove = function(node: HTMLElement) {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n};\n","// @flow\n\nimport {RGBAImage} from '../util/image';\n\nimport type Map from '../ui/map';\n\nexport type StyleImageData = {\n data: RGBAImage,\n version: number,\n hasRenderCallback?: boolean,\n userImage?: StyleImageInterface\n};\n\nexport type StyleImageMetadata = {\n pixelRatio: number,\n sdf: boolean,\n stretchX?: Array<[number, number]>,\n stretchY?: Array<[number, number]>,\n content?: [number, number, number, number]\n};\n\nexport type StyleImage = StyleImageData & StyleImageMetadata;\n\nexport type StyleImageInterface = {\n width: number,\n height: number,\n data: Uint8Array | Uint8ClampedArray,\n render?: () => boolean,\n onAdd?: (map: Map, id: string) => void,\n onRemove?: () => void\n};\n\nexport function renderStyleImage(image: StyleImage) {\n const {userImage} = image;\n if (userImage && userImage.render) {\n const updated = userImage.render();\n if (updated) {\n image.data.replace(new Uint8Array(userImage.data.buffer));\n return true;\n }\n }\n return false;\n}\n\n/**\n * Interface for dynamically generated style images. This is a specification for\n * implementers to model: it is not an exported method or class.\n *\n * Images implementing this interface can be redrawn for every frame. They can be used to animate\n * icons and patterns or make them respond to user input. Style images can implement a\n * {@link StyleImageInterface#render} method. The method is called every frame and\n * can be used to update the image.\n *\n * @interface StyleImageInterface\n * @property {number} width\n * @property {number} height\n * @property {Uint8Array | Uint8ClampedArray} data\n *\n * @see [Add an animated icon to the map.](https://maplibre.org/maplibre-gl-js-docs/example/add-image-animated/)\n *\n * @example\n * var flashingSquare = {\n * width: 64,\n * height: 64,\n * data: new Uint8Array(64 * 64 * 4),\n *\n * onAdd: function(map) {\n * this.map = map;\n * },\n *\n * render: function() {\n * // keep repainting while the icon is on the map\n * this.map.triggerRepaint();\n *\n * // alternate between black and white based on the time\n * var value = Math.round(Date.now() / 1000) % 2 === 0 ? 255 : 0;\n *\n * // check if image needs to be changed\n * if (value !== this.previousValue) {\n * this.previousValue = value;\n *\n * var bytesPerPixel = 4;\n * for (var x = 0; x < this.width; x++) {\n * for (var y = 0; y < this.height; y++) {\n * var offset = (y * this.width + x) * bytesPerPixel;\n * this.data[offset + 0] = value;\n * this.data[offset + 1] = value;\n * this.data[offset + 2] = value;\n * this.data[offset + 3] = 255;\n * }\n * }\n *\n * // return true to indicate that the image changed\n * return true;\n * }\n * }\n * }\n *\n * map.addImage('flashing_square', flashingSquare);\n */\n\n/**\n * This method is called once before every frame where the icon will be used.\n * The method can optionally update the image's `data` member with a new image.\n *\n * If the method updates the image it must return `true` to commit the change.\n * If the method returns `false` or nothing the image is assumed to not have changed.\n *\n * If updates are infrequent it maybe easier to use {@link Map#updateImage} to update\n * the image instead of implementing this method.\n *\n * @function\n * @memberof StyleImageInterface\n * @instance\n * @name render\n * @return {boolean} `true` if this method updated the image. `false` if the image was not changed.\n */\n\n/**\n * Optional method called when the layer has been added to the Map with {@link Map#addImage}.\n *\n * @function\n * @memberof StyleImageInterface\n * @instance\n * @name onAdd\n * @param {Map} map The Map this custom layer was just added to.\n */\n\n/**\n * Optional method called when the icon is removed from the map with {@link Map#removeImage}.\n * This gives the image a chance to clean up resources and event listeners.\n *\n * @function\n * @memberof StyleImageInterface\n * @instance\n * @name onRemove\n */\n","// @flow\n\nimport potpack from 'potpack';\n\nimport {Event, ErrorEvent, Evented} from '../util/evented';\nimport {RGBAImage} from '../util/image';\nimport {ImagePosition} from './image_atlas';\nimport Texture from './texture';\nimport assert from 'assert';\nimport {renderStyleImage} from '../style/style_image';\nimport {warnOnce} from '../util/util';\n\nimport type {StyleImage} from '../style/style_image';\nimport type Context from '../gl/context';\nimport type {Bin} from 'potpack';\nimport type {Callback} from '../types/callback';\n\ntype Pattern = {\n bin: Bin,\n position: ImagePosition\n};\n\n// When copied into the atlas texture, image data is padded by one pixel on each side. Icon\n// images are padded with fully transparent pixels, while pattern images are padded with a\n// copy of the image data wrapped from the opposite side. In both cases, this ensures the\n// correct behavior of GL_LINEAR texture sampling mode.\nconst padding = 1;\n\n/*\n ImageManager does three things:\n\n 1. Tracks requests for icon images from tile workers and sends responses when the requests are fulfilled.\n 2. Builds a texture atlas for pattern images.\n 3. Rerenders renderable images once per frame\n\n These are disparate responsibilities and should eventually be handled by different classes. When we implement\n data-driven support for `*-pattern`, we'll likely use per-bucket pattern atlases, and that would be a good time\n to refactor this.\n*/\nclass ImageManager extends Evented {\n images: {[_: string]: StyleImage};\n updatedImages: {[_: string]: boolean};\n callbackDispatchedThisFrame: {[_: string]: boolean};\n loaded: boolean;\n requestors: Array<{ids: Array, callback: Callback<{[_: string]: StyleImage}>}>;\n\n patterns: {[_: string]: Pattern};\n atlasImage: RGBAImage;\n atlasTexture: ?Texture;\n dirty: boolean;\n\n constructor() {\n super();\n this.images = {};\n this.updatedImages = {};\n this.callbackDispatchedThisFrame = {};\n this.loaded = false;\n this.requestors = [];\n\n this.patterns = {};\n this.atlasImage = new RGBAImage({width: 1, height: 1});\n this.dirty = true;\n }\n\n isLoaded() {\n return this.loaded;\n }\n\n setLoaded(loaded: boolean) {\n if (this.loaded === loaded) {\n return;\n }\n\n this.loaded = loaded;\n\n if (loaded) {\n for (const {ids, callback} of this.requestors) {\n this._notify(ids, callback);\n }\n this.requestors = [];\n }\n }\n\n getImage(id: string): ?StyleImage {\n return this.images[id];\n }\n\n addImage(id: string, image: StyleImage) {\n assert(!this.images[id]);\n if (this._validate(id, image)) {\n this.images[id] = image;\n }\n }\n\n _validate(id: string, image: StyleImage) {\n let valid = true;\n if (!this._validateStretch(image.stretchX, image.data && image.data.width)) {\n this.fire(new ErrorEvent(new Error(`Image \"${id}\" has invalid \"stretchX\" value`)));\n valid = false;\n }\n if (!this._validateStretch(image.stretchY, image.data && image.data.height)) {\n this.fire(new ErrorEvent(new Error(`Image \"${id}\" has invalid \"stretchY\" value`)));\n valid = false;\n }\n if (!this._validateContent(image.content, image)) {\n this.fire(new ErrorEvent(new Error(`Image \"${id}\" has invalid \"content\" value`)));\n valid = false;\n }\n return valid;\n }\n\n _validateStretch(stretch: ?Array<[number, number]> | void, size: number) {\n if (!stretch) return true;\n let last = 0;\n for (const part of stretch) {\n if (part[0] < last || part[1] < part[0] || size < part[1]) return false;\n last = part[1];\n }\n return true;\n }\n\n _validateContent(content: ?[number, number, number, number] | void, image: StyleImage) {\n if (!content) return true;\n if (content.length !== 4) return false;\n if (content[0] < 0 || image.data.width < content[0]) return false;\n if (content[1] < 0 || image.data.height < content[1]) return false;\n if (content[2] < 0 || image.data.width < content[2]) return false;\n if (content[3] < 0 || image.data.height < content[3]) return false;\n if (content[2] < content[0]) return false;\n if (content[3] < content[1]) return false;\n return true;\n }\n\n updateImage(id: string, image: StyleImage) {\n const oldImage = this.images[id];\n assert(oldImage);\n assert(oldImage.data.width === image.data.width);\n assert(oldImage.data.height === image.data.height);\n image.version = oldImage.version + 1;\n this.images[id] = image;\n this.updatedImages[id] = true;\n }\n\n removeImage(id: string) {\n assert(this.images[id]);\n const image = this.images[id];\n delete this.images[id];\n delete this.patterns[id];\n\n if (image.userImage && image.userImage.onRemove) {\n image.userImage.onRemove();\n }\n }\n\n listImages(): Array {\n return Object.keys(this.images);\n }\n\n getImages(ids: Array, callback: Callback<{[_: string]: StyleImage}>) {\n // If the sprite has been loaded, or if all the icon dependencies are already present\n // (i.e. if they've been added via runtime styling), then notify the requestor immediately.\n // Otherwise, delay notification until the sprite is loaded. At that point, if any of the\n // dependencies are still unavailable, we'll just assume they are permanently missing.\n let hasAllDependencies = true;\n if (!this.isLoaded()) {\n for (const id of ids) {\n if (!this.images[id]) {\n hasAllDependencies = false;\n }\n }\n }\n if (this.isLoaded() || hasAllDependencies) {\n this._notify(ids, callback);\n } else {\n this.requestors.push({ids, callback});\n }\n }\n\n _notify(ids: Array, callback: Callback<{[_: string]: StyleImage}>) {\n const response = {};\n\n for (const id of ids) {\n if (!this.images[id]) {\n this.fire(new Event('styleimagemissing', {id}));\n }\n const image = this.images[id];\n if (image) {\n // Clone the image so that our own copy of its ArrayBuffer doesn't get transferred.\n response[id] = {\n data: image.data.clone(),\n pixelRatio: image.pixelRatio,\n sdf: image.sdf,\n version: image.version,\n stretchX: image.stretchX,\n stretchY: image.stretchY,\n content: image.content,\n hasRenderCallback: Boolean(image.userImage && image.userImage.render)\n };\n } else {\n warnOnce(`Image \"${id}\" could not be loaded. Please make sure you have added the image with map.addImage() or a \"sprite\" property in your style. You can provide missing images by listening for the \"styleimagemissing\" map event.`);\n }\n }\n\n callback(null, response);\n }\n\n // Pattern stuff\n\n getPixelSize() {\n const {width, height} = this.atlasImage;\n return {width, height};\n }\n\n getPattern(id: string): ?ImagePosition {\n const pattern = this.patterns[id];\n\n const image = this.getImage(id);\n if (!image) {\n return null;\n }\n\n if (pattern && pattern.position.version === image.version) {\n return pattern.position;\n }\n\n if (!pattern) {\n const w = image.data.width + padding * 2;\n const h = image.data.height + padding * 2;\n const bin = {w, h, x: 0, y: 0};\n const position = new ImagePosition(bin, image);\n this.patterns[id] = {bin, position};\n } else {\n pattern.position.version = image.version;\n }\n\n this._updatePatternAtlas();\n\n return this.patterns[id].position;\n }\n\n bind(context: Context) {\n const gl = context.gl;\n if (!this.atlasTexture) {\n this.atlasTexture = new Texture(context, this.atlasImage, gl.RGBA);\n } else if (this.dirty) {\n this.atlasTexture.update(this.atlasImage);\n this.dirty = false;\n }\n\n this.atlasTexture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n }\n\n _updatePatternAtlas() {\n const bins = [];\n for (const id in this.patterns) {\n bins.push(this.patterns[id].bin);\n }\n\n const {w, h} = potpack(bins);\n\n const dst = this.atlasImage;\n dst.resize({width: w || 1, height: h || 1});\n\n for (const id in this.patterns) {\n const {bin} = this.patterns[id];\n const x = bin.x + padding;\n const y = bin.y + padding;\n const src = this.images[id].data;\n const w = src.width;\n const h = src.height;\n\n RGBAImage.copy(src, dst, {x: 0, y: 0}, {x, y}, {width: w, height: h});\n\n // Add 1 pixel wrapped padding on each side of the image.\n RGBAImage.copy(src, dst, {x: 0, y: h - 1}, {x, y: y - 1}, {width: w, height: 1}); // T\n RGBAImage.copy(src, dst, {x: 0, y: 0}, {x, y: y + h}, {width: w, height: 1}); // B\n RGBAImage.copy(src, dst, {x: w - 1, y: 0}, {x: x - 1, y}, {width: 1, height: h}); // L\n RGBAImage.copy(src, dst, {x: 0, y: 0}, {x: x + w, y}, {width: 1, height: h}); // R\n }\n\n this.dirty = true;\n }\n\n beginFrame() {\n this.callbackDispatchedThisFrame = {};\n }\n\n dispatchRenderCallbacks(ids: Array) {\n for (const id of ids) {\n\n // the callback for the image was already dispatched for a different frame\n if (this.callbackDispatchedThisFrame[id]) continue;\n this.callbackDispatchedThisFrame[id] = true;\n\n const image = this.images[id];\n assert(image);\n\n const updated = renderStyleImage(image);\n if (updated) {\n this.updateImage(id, image);\n }\n }\n }\n}\n\nexport default ImageManager;\n","'use strict';\n\nmodule.exports = TinySDF;\nmodule.exports.default = TinySDF;\n\nvar INF = 1e20;\n\nfunction TinySDF(fontSize, buffer, radius, cutoff, fontFamily, fontWeight) {\n this.fontSize = fontSize || 24;\n this.buffer = buffer === undefined ? 3 : buffer;\n this.cutoff = cutoff || 0.25;\n this.fontFamily = fontFamily || 'sans-serif';\n this.fontWeight = fontWeight || 'normal';\n this.radius = radius || 8;\n var size = this.size = this.fontSize + this.buffer * 2;\n\n this.canvas = document.createElement('canvas');\n this.canvas.width = this.canvas.height = size;\n\n this.ctx = this.canvas.getContext('2d');\n this.ctx.font = this.fontWeight + ' ' + this.fontSize + 'px ' + this.fontFamily;\n this.ctx.textBaseline = 'middle';\n this.ctx.fillStyle = 'black';\n\n // temporary arrays for the distance transform\n this.gridOuter = new Float64Array(size * size);\n this.gridInner = new Float64Array(size * size);\n this.f = new Float64Array(size);\n this.d = new Float64Array(size);\n this.z = new Float64Array(size + 1);\n this.v = new Int16Array(size);\n\n // hack around https://bugzilla.mozilla.org/show_bug.cgi?id=737852\n this.middle = Math.round((size / 2) * (navigator.userAgent.indexOf('Gecko/') >= 0 ? 1.2 : 1));\n}\n\nTinySDF.prototype.draw = function (char) {\n this.ctx.clearRect(0, 0, this.size, this.size);\n this.ctx.fillText(char, this.buffer, this.middle);\n\n var imgData = this.ctx.getImageData(0, 0, this.size, this.size);\n var alphaChannel = new Uint8ClampedArray(this.size * this.size);\n\n for (var i = 0; i < this.size * this.size; i++) {\n var a = imgData.data[i * 4 + 3] / 255; // alpha value\n this.gridOuter[i] = a === 1 ? 0 : a === 0 ? INF : Math.pow(Math.max(0, 0.5 - a), 2);\n this.gridInner[i] = a === 1 ? INF : a === 0 ? 0 : Math.pow(Math.max(0, a - 0.5), 2);\n }\n\n edt(this.gridOuter, this.size, this.size, this.f, this.d, this.v, this.z);\n edt(this.gridInner, this.size, this.size, this.f, this.d, this.v, this.z);\n\n for (i = 0; i < this.size * this.size; i++) {\n var d = this.gridOuter[i] - this.gridInner[i];\n alphaChannel[i] = Math.max(0, Math.min(255, Math.round(255 - 255 * (d / this.radius + this.cutoff))));\n }\n\n return alphaChannel;\n};\n\n// 2D Euclidean distance transform by Felzenszwalb & Huttenlocher https://cs.brown.edu/~pff/papers/dt-final.pdf\nfunction edt(data, width, height, f, d, v, z) {\n for (var x = 0; x < width; x++) {\n for (var y = 0; y < height; y++) {\n f[y] = data[y * width + x];\n }\n edt1d(f, d, v, z, height);\n for (y = 0; y < height; y++) {\n data[y * width + x] = d[y];\n }\n }\n for (y = 0; y < height; y++) {\n for (x = 0; x < width; x++) {\n f[x] = data[y * width + x];\n }\n edt1d(f, d, v, z, width);\n for (x = 0; x < width; x++) {\n data[y * width + x] = Math.sqrt(d[x]);\n }\n }\n}\n\n// 1D squared distance transform\nfunction edt1d(f, d, v, z, n) {\n v[0] = 0;\n z[0] = -INF;\n z[1] = +INF;\n\n for (var q = 1, k = 0; q < n; q++) {\n var s = ((f[q] + q * q) - (f[v[k]] + v[k] * v[k])) / (2 * q - 2 * v[k]);\n while (s <= z[k]) {\n k--;\n s = ((f[q] + q * q) - (f[v[k]] + v[k] * v[k])) / (2 * q - 2 * v[k]);\n }\n k++;\n v[k] = q;\n z[k] = s;\n z[k + 1] = +INF;\n }\n\n for (q = 0, k = 0; q < n; q++) {\n while (z[k + 1] < q) k++;\n d[q] = (q - v[k]) * (q - v[k]) + f[v[k]];\n }\n}\n","// @flow\n\nimport loadGlyphRange from '../style/load_glyph_range';\n\nimport TinySDF from '@mapbox/tiny-sdf';\nimport isChar from '../util/is_char_in_unicode_block';\nimport {asyncAll} from '../util/util';\nimport {AlphaImage} from '../util/image';\n\nimport type {StyleGlyph} from '../style/style_glyph';\nimport type {RequestManager} from '../util/mapbox';\nimport type {Callback} from '../types/callback';\n\ntype Entry = {\n // null means we've requested the range, but the glyph wasn't included in the result.\n glyphs: {[id: number]: StyleGlyph | null},\n requests: {[range: number]: Array>},\n ranges: {[range: number]: boolean | null},\n tinySDF?: TinySDF\n};\n\nclass GlyphManager {\n requestManager: RequestManager;\n localIdeographFontFamily: ?string;\n entries: {[_: string]: Entry};\n url: ?string;\n\n // exposed as statics to enable stubbing in unit tests\n static loadGlyphRange: typeof loadGlyphRange;\n static TinySDF: Class;\n\n constructor(requestManager: RequestManager, localIdeographFontFamily: ?string) {\n this.requestManager = requestManager;\n this.localIdeographFontFamily = localIdeographFontFamily;\n this.entries = {};\n }\n\n setURL(url: ?string) {\n this.url = url;\n }\n\n getGlyphs(glyphs: {[stack: string]: Array}, callback: Callback<{[stack: string]: {[id: number]: ?StyleGlyph}}>) {\n const all = [];\n\n for (const stack in glyphs) {\n for (const id of glyphs[stack]) {\n all.push({stack, id});\n }\n }\n\n asyncAll(all, ({stack, id}, callback: Callback<{stack: string, id: number, glyph: ?StyleGlyph}>) => {\n let entry = this.entries[stack];\n if (!entry) {\n entry = this.entries[stack] = {\n glyphs: {},\n requests: {},\n ranges: {}\n };\n }\n\n let glyph = entry.glyphs[id];\n if (glyph !== undefined) {\n callback(null, {stack, id, glyph});\n return;\n }\n\n glyph = this._tinySDF(entry, stack, id);\n if (glyph) {\n entry.glyphs[id] = glyph;\n callback(null, {stack, id, glyph});\n return;\n }\n\n const range = Math.floor(id / 256);\n if (range * 256 > 65535) {\n callback(new Error('glyphs > 65535 not supported'));\n return;\n }\n\n if (entry.ranges[range]) {\n callback(null, {stack, id, glyph});\n return;\n }\n\n let requests = entry.requests[range];\n if (!requests) {\n requests = entry.requests[range] = [];\n GlyphManager.loadGlyphRange(stack, range, (this.url: any), this.requestManager,\n (err, response: ?{[_: number]: StyleGlyph | null}) => {\n if (response) {\n for (const id in response) {\n if (!this._doesCharSupportLocalGlyph(+id)) {\n entry.glyphs[+id] = response[+id];\n }\n }\n entry.ranges[range] = true;\n }\n for (const cb of requests) {\n cb(err, response);\n }\n delete entry.requests[range];\n });\n }\n\n requests.push((err, result: ?{[_: number]: StyleGlyph | null}) => {\n if (err) {\n callback(err);\n } else if (result) {\n callback(null, {stack, id, glyph: result[id] || null});\n }\n });\n }, (err, glyphs: ?Array<{stack: string, id: number, glyph: ?StyleGlyph}>) => {\n if (err) {\n callback(err);\n } else if (glyphs) {\n const result = {};\n\n for (const {stack, id, glyph} of glyphs) {\n // Clone the glyph so that our own copy of its ArrayBuffer doesn't get transferred.\n (result[stack] || (result[stack] = {}))[id] = glyph && {\n id: glyph.id,\n bitmap: glyph.bitmap.clone(),\n metrics: glyph.metrics\n };\n }\n\n callback(null, result);\n }\n });\n }\n\n _doesCharSupportLocalGlyph(id: number): boolean {\n /* eslint-disable new-cap */\n return !!this.localIdeographFontFamily &&\n (isChar['CJK Unified Ideographs'](id) ||\n isChar['Hangul Syllables'](id) ||\n isChar['Hiragana'](id) ||\n isChar['Katakana'](id));\n /* eslint-enable new-cap */\n }\n\n _tinySDF(entry: Entry, stack: string, id: number): ?StyleGlyph {\n const family = this.localIdeographFontFamily;\n if (!family) {\n return;\n }\n\n if (!this._doesCharSupportLocalGlyph(id)) {\n return;\n }\n\n let tinySDF = entry.tinySDF;\n if (!tinySDF) {\n let fontWeight = '400';\n if (/bold/i.test(stack)) {\n fontWeight = '900';\n } else if (/medium/i.test(stack)) {\n fontWeight = '500';\n } else if (/light/i.test(stack)) {\n fontWeight = '200';\n }\n tinySDF = entry.tinySDF = new GlyphManager.TinySDF(24, 3, 8, .25, family, fontWeight);\n }\n\n return {\n id,\n bitmap: new AlphaImage({width: 30, height: 30}, tinySDF.draw(String.fromCharCode(id))),\n metrics: {\n width: 24,\n height: 24,\n left: 0,\n top: -8,\n advance: 24\n }\n };\n }\n}\n\nGlyphManager.loadGlyphRange = loadGlyphRange;\nGlyphManager.TinySDF = TinySDF;\n\nexport default GlyphManager;\n","// @flow\n\nimport {getArrayBuffer, ResourceType} from '../util/ajax';\n\nimport parseGlyphPBF from './parse_glyph_pbf';\n\nimport type {StyleGlyph} from './style_glyph';\nimport type {RequestManager} from '../util/mapbox';\nimport type {Callback} from '../types/callback';\n\nexport default function (fontstack: string,\n range: number,\n urlTemplate: string,\n requestManager: RequestManager,\n callback: Callback<{[_: number]: StyleGlyph | null}>) {\n const begin = range * 256;\n const end = begin + 255;\n\n const request = requestManager.transformRequest(\n requestManager.normalizeGlyphsURL(urlTemplate)\n .replace('{fontstack}', fontstack)\n .replace('{range}', `${begin}-${end}`),\n ResourceType.Glyphs);\n\n getArrayBuffer(request, (err: ?Error, data: ?ArrayBuffer) => {\n if (err) {\n callback(err);\n } else if (data) {\n const glyphs = {};\n\n for (const glyph of parseGlyphPBF(data)) {\n glyphs[glyph.id] = glyph;\n }\n\n callback(null, glyphs);\n }\n });\n}\n","// @flow\n\nimport styleSpec from '../style-spec/reference/latest';\n\nimport {endsWith, extend, sphericalToCartesian} from '../util/util';\nimport {Evented} from '../util/evented';\nimport {\n validateStyle,\n validateLight,\n emitValidationErrors\n} from './validate_style';\nimport Color from '../style-spec/util/color';\nimport {number as interpolate} from '../style-spec/util/interpolate';\n\nimport type {StylePropertySpecification} from '../style-spec/style-spec';\nimport type EvaluationParameters from './evaluation_parameters';\nimport type {StyleSetterOptions} from '../style/style';\nimport {Properties, Transitionable, Transitioning, PossiblyEvaluated, DataConstantProperty} from './properties';\n\nimport type {\n Property,\n PropertyValue,\n TransitionParameters\n} from './properties';\n\nimport type {LightSpecification} from '../style-spec/types';\n\ntype LightPosition = {\n x: number,\n y: number,\n z: number\n};\n\nclass LightPositionProperty implements Property<[number, number, number], LightPosition> {\n specification: StylePropertySpecification;\n\n constructor() {\n this.specification = styleSpec.light.position;\n }\n\n possiblyEvaluate(value: PropertyValue<[number, number, number], LightPosition>, parameters: EvaluationParameters): LightPosition {\n return sphericalToCartesian(value.expression.evaluate(parameters));\n }\n\n interpolate(a: LightPosition, b: LightPosition, t: number): LightPosition {\n return {\n x: interpolate(a.x, b.x, t),\n y: interpolate(a.y, b.y, t),\n z: interpolate(a.z, b.z, t),\n };\n }\n}\n\ntype Props = {|\n \"anchor\": DataConstantProperty<\"map\" | \"viewport\">,\n \"position\": LightPositionProperty,\n \"color\": DataConstantProperty,\n \"intensity\": DataConstantProperty,\n|};\n\nconst properties: Properties = new Properties({\n \"anchor\": new DataConstantProperty(styleSpec.light.anchor),\n \"position\": new LightPositionProperty(),\n \"color\": new DataConstantProperty(styleSpec.light.color),\n \"intensity\": new DataConstantProperty(styleSpec.light.intensity),\n});\n\nconst TRANSITION_SUFFIX = '-transition';\n\n/*\n * Represents the light used to light extruded features.\n */\nclass Light extends Evented {\n _transitionable: Transitionable;\n _transitioning: Transitioning;\n properties: PossiblyEvaluated;\n\n constructor(lightOptions?: LightSpecification) {\n super();\n this._transitionable = new Transitionable(properties);\n this.setLight(lightOptions);\n this._transitioning = this._transitionable.untransitioned();\n }\n\n getLight() {\n return this._transitionable.serialize();\n }\n\n setLight(light?: LightSpecification, options: StyleSetterOptions = {}) {\n if (this._validate(validateLight, light, options)) {\n return;\n }\n\n for (const name in light) {\n const value = light[name];\n if (endsWith(name, TRANSITION_SUFFIX)) {\n this._transitionable.setTransition(name.slice(0, -TRANSITION_SUFFIX.length), value);\n } else {\n this._transitionable.setValue(name, value);\n }\n }\n }\n\n updateTransitions(parameters: TransitionParameters) {\n this._transitioning = this._transitionable.transitioned(parameters, this._transitioning);\n }\n\n hasTransition() {\n return this._transitioning.hasTransition();\n }\n\n recalculate(parameters: EvaluationParameters) {\n this.properties = this._transitioning.possiblyEvaluate(parameters);\n }\n\n _validate(validate: Function, value: mixed, options?: {validate?: boolean}) {\n if (options && options.validate === false) {\n return false;\n }\n\n return emitValidationErrors(this, validate.call(validateStyle, extend({\n value,\n // Workaround for https://github.com/mapbox/mapbox-gl-js/issues/2407\n style: {glyphs: true, sprite: true},\n styleSpec\n })));\n }\n}\n\nexport default Light;\n","// @flow\n\nimport {warnOnce} from '../util/util';\n\nimport type Context from '../gl/context';\n\n/**\n * A LineAtlas lets us reuse rendered dashed lines\n * by writing many of them to a texture and then fetching their positions\n * using .getDash.\n *\n * @param {number} width\n * @param {number} height\n * @private\n */\nclass LineAtlas {\n width: number;\n height: number;\n nextRow: number;\n bytes: number;\n data: Uint8Array;\n dashEntry: {[_: string]: any};\n dirty: boolean;\n texture: WebGLTexture;\n\n constructor(width: number, height: number) {\n this.width = width;\n this.height = height;\n this.nextRow = 0;\n\n this.data = new Uint8Array(this.width * this.height);\n\n this.dashEntry = {};\n }\n\n /**\n * Get or create a dash line pattern.\n *\n * @param {Array} dasharray\n * @param {boolean} round whether to add circle caps in between dash segments\n * @returns {Object} position of dash texture in { y, height, width }\n * @private\n */\n getDash(dasharray: Array, round: boolean) {\n const key = dasharray.join(\",\") + String(round);\n\n if (!this.dashEntry[key]) {\n this.dashEntry[key] = this.addDash(dasharray, round);\n }\n return this.dashEntry[key];\n }\n\n getDashRanges(dasharray: Array, lineAtlasWidth: number, stretch: number) {\n // If dasharray has an odd length, both the first and last parts\n // are dashes and should be joined seamlessly.\n const oddDashArray = dasharray.length % 2 === 1;\n\n const ranges = [];\n\n let left = oddDashArray ? -dasharray[dasharray.length - 1] * stretch : 0;\n let right = dasharray[0] * stretch;\n let isDash = true;\n\n ranges.push({left, right, isDash, zeroLength: dasharray[0] === 0});\n\n let currentDashLength = dasharray[0];\n for (let i = 1; i < dasharray.length; i++) {\n isDash = !isDash;\n\n const dashLength = dasharray[i];\n left = currentDashLength * stretch;\n currentDashLength += dashLength;\n right = currentDashLength * stretch;\n\n ranges.push({left, right, isDash, zeroLength: dashLength === 0});\n }\n\n return ranges;\n }\n\n addRoundDash(ranges: Object, stretch: number, n: number) {\n const halfStretch = stretch / 2;\n\n for (let y = -n; y <= n; y++) {\n const row = this.nextRow + n + y;\n const index = this.width * row;\n let currIndex = 0;\n let range = ranges[currIndex];\n\n for (let x = 0; x < this.width; x++) {\n if (x / range.right > 1) { range = ranges[++currIndex]; }\n\n const distLeft = Math.abs(x - range.left);\n const distRight = Math.abs(x - range.right);\n const minDist = Math.min(distLeft, distRight);\n let signedDistance;\n\n const distMiddle = y / n * (halfStretch + 1);\n if (range.isDash) {\n const distEdge = halfStretch - Math.abs(distMiddle);\n signedDistance = Math.sqrt(minDist * minDist + distEdge * distEdge);\n } else {\n signedDistance = halfStretch - Math.sqrt(minDist * minDist + distMiddle * distMiddle);\n }\n\n this.data[index + x] = Math.max(0, Math.min(255, signedDistance + 128));\n }\n }\n }\n\n addRegularDash(ranges: Object) {\n\n // Collapse any zero-length range\n // Collapse neighbouring same-type parts into a single part\n for (let i = ranges.length - 1; i >= 0; --i) {\n const part = ranges[i];\n const next = ranges[i + 1];\n if (part.zeroLength) {\n ranges.splice(i, 1);\n } else if (next && next.isDash === part.isDash) {\n next.left = part.left;\n ranges.splice(i, 1);\n }\n }\n\n // Combine the first and last parts if possible\n const first = ranges[0];\n const last = ranges[ranges.length - 1];\n if (first.isDash === last.isDash) {\n first.left = last.left - this.width;\n last.right = first.right + this.width;\n }\n\n const index = this.width * this.nextRow;\n let currIndex = 0;\n let range = ranges[currIndex];\n\n for (let x = 0; x < this.width; x++) {\n if (x / range.right > 1) {\n range = ranges[++currIndex];\n }\n\n const distLeft = Math.abs(x - range.left);\n const distRight = Math.abs(x - range.right);\n\n const minDist = Math.min(distLeft, distRight);\n const signedDistance = range.isDash ? minDist : -minDist;\n\n this.data[index + x] = Math.max(0, Math.min(255, signedDistance + 128));\n }\n }\n\n addDash(dasharray: Array, round: boolean) {\n const n = round ? 7 : 0;\n const height = 2 * n + 1;\n\n if (this.nextRow + height > this.height) {\n warnOnce('LineAtlas out of space');\n return null;\n }\n\n let length = 0;\n for (let i = 0; i < dasharray.length; i++) { length += dasharray[i]; }\n\n if (length !== 0) {\n const stretch = this.width / length;\n const ranges = this.getDashRanges(dasharray, this.width, stretch);\n\n if (round) {\n this.addRoundDash(ranges, stretch, n);\n } else {\n this.addRegularDash(ranges);\n }\n }\n\n const dashEntry = {\n y: (this.nextRow + n + 0.5) / this.height,\n height: 2 * n / this.height,\n width: length\n };\n\n this.nextRow += height;\n this.dirty = true;\n\n return dashEntry;\n }\n\n bind(context: Context) {\n const gl = context.gl;\n if (!this.texture) {\n this.texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, this.texture);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.ALPHA, this.width, this.height, 0, gl.ALPHA, gl.UNSIGNED_BYTE, this.data);\n\n } else {\n gl.bindTexture(gl.TEXTURE_2D, this.texture);\n\n if (this.dirty) {\n this.dirty = false;\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, this.width, this.height, gl.ALPHA, gl.UNSIGNED_BYTE, this.data);\n }\n }\n }\n}\n\nexport default LineAtlas;\n","// @flow\n\nimport {uniqueId, asyncAll} from './util';\nimport Actor from './actor';\nimport assert from 'assert';\n\nimport type WorkerPool from './worker_pool';\n\n/**\n * Responsible for sending messages from a {@link Source} to an associated\n * {@link WorkerSource}.\n *\n * @private\n */\nclass Dispatcher {\n workerPool: WorkerPool;\n actors: Array;\n currentActor: number;\n id: number;\n\n // exposed to allow stubbing in unit tests\n static Actor: Class;\n\n constructor(workerPool: WorkerPool, parent: any) {\n this.workerPool = workerPool;\n this.actors = [];\n this.currentActor = 0;\n this.id = uniqueId();\n const workers = this.workerPool.acquire(this.id);\n for (let i = 0; i < workers.length; i++) {\n const worker = workers[i];\n const actor = new Dispatcher.Actor(worker, parent, this.id);\n actor.name = `Worker ${i}`;\n this.actors.push(actor);\n }\n assert(this.actors.length);\n }\n\n /**\n * Broadcast a message to all Workers.\n * @private\n */\n broadcast(type: string, data: mixed, cb?: Function) {\n assert(this.actors.length);\n cb = cb || function () {};\n asyncAll(this.actors, (actor, done) => {\n actor.send(type, data, done);\n }, cb);\n }\n\n /**\n * Acquires an actor to dispatch messages to. The actors are distributed in round-robin fashion.\n * @returns An actor object backed by a web worker for processing messages.\n */\n getActor(): Actor {\n assert(this.actors.length);\n this.currentActor = (this.currentActor + 1) % this.actors.length;\n return this.actors[this.currentActor];\n }\n\n remove() {\n this.actors.forEach((actor) => { actor.remove(); });\n this.actors = [];\n this.workerPool.release(this.id);\n }\n}\n\nDispatcher.Actor = Actor;\n\nexport default Dispatcher;\n","// @flow\n\nimport {pick, extend} from '../util/util';\n\nimport {getJSON, ResourceType} from '../util/ajax';\nimport browser from '../util/browser';\n\nimport type {RequestManager} from '../util/mapbox';\nimport type {Callback} from '../types/callback';\nimport type {TileJSON} from '../types/tilejson';\nimport type {Cancelable} from '../types/cancelable';\n\nexport default function(options: any, requestManager: RequestManager, callback: Callback): Cancelable {\n const loaded = function(err: ?Error, tileJSON: ?Object) {\n if (err) {\n return callback(err);\n } else if (tileJSON) {\n const result: any = pick(\n // explicit source options take precedence over TileJSON\n extend(tileJSON, options),\n ['tiles', 'minzoom', 'maxzoom', 'attribution', 'mapbox_logo', 'bounds', 'scheme', 'tileSize', 'encoding']\n );\n\n if (tileJSON.vector_layers) {\n result.vectorLayers = tileJSON.vector_layers;\n result.vectorLayerIds = result.vectorLayers.map((layer) => { return layer.id; });\n }\n\n result.tiles = requestManager.canonicalizeTileset(result, options.url);\n callback(null, result);\n }\n };\n\n if (options.url) {\n return getJSON(requestManager.transformRequest(requestManager.normalizeSourceURL(options.url), ResourceType.Source), loaded);\n } else {\n return browser.frame(() => loaded(null, options));\n }\n}\n","// @flow\n\nimport LngLatBounds from '../geo/lng_lat_bounds';\nimport {mercatorXfromLng, mercatorYfromLat} from '../geo/mercator_coordinate';\n\nimport type {CanonicalTileID} from './tile_id';\n\nclass TileBounds {\n bounds: LngLatBounds;\n minzoom: number;\n maxzoom: number;\n\n constructor(bounds: [number, number, number, number], minzoom: ?number, maxzoom: ?number) {\n this.bounds = LngLatBounds.convert(this.validateBounds(bounds));\n this.minzoom = minzoom || 0;\n this.maxzoom = maxzoom || 24;\n }\n\n validateBounds(bounds: [number, number, number, number]) {\n // make sure the bounds property contains valid longitude and latitudes\n if (!Array.isArray(bounds) || bounds.length !== 4) return [-180, -90, 180, 90];\n return [Math.max(-180, bounds[0]), Math.max(-90, bounds[1]), Math.min(180, bounds[2]), Math.min(90, bounds[3])];\n }\n\n contains(tileID: CanonicalTileID) {\n const worldSize = Math.pow(2, tileID.z);\n const level = {\n minX: Math.floor(mercatorXfromLng(this.bounds.getWest()) * worldSize),\n minY: Math.floor(mercatorYfromLat(this.bounds.getNorth()) * worldSize),\n maxX: Math.ceil(mercatorXfromLng(this.bounds.getEast()) * worldSize),\n maxY: Math.ceil(mercatorYfromLat(this.bounds.getSouth()) * worldSize)\n };\n const hit = tileID.x >= level.minX && tileID.x < level.maxX && tileID.y >= level.minY && tileID.y < level.maxY;\n return hit;\n }\n}\n\nexport default TileBounds;\n","// @flow\n\nimport {Event, ErrorEvent, Evented} from '../util/evented';\n\nimport {extend, pick} from '../util/util';\nimport loadTileJSON from './load_tilejson';\nimport {postTurnstileEvent, postMapLoadEvent} from '../util/mapbox';\nimport TileBounds from './tile_bounds';\nimport {ResourceType} from '../util/ajax';\nimport browser from '../util/browser';\nimport {cacheEntryPossiblyAdded} from '../util/tile_request_cache';\n\nimport type {Source} from './source';\nimport type {OverscaledTileID} from './tile_id';\nimport type Map from '../ui/map';\nimport type Dispatcher from '../util/dispatcher';\nimport type Tile from './tile';\nimport type {Callback} from '../types/callback';\nimport type {Cancelable} from '../types/cancelable';\nimport type {VectorSourceSpecification, PromoteIdSpecification} from '../style-spec/types';\n\n/**\n * A source containing vector tiles in [Mapbox Vector Tile format](https://docs.mapbox.com/vector-tiles/reference/).\n * (See the [Style Specification](https://docs.mapbox.com/mapbox-gl-js/style-spec/sources/#vector) for detailed documentation of options.)\n *\n * @example\n * map.addSource('some id', {\n * type: 'vector',\n * url: 'mapbox://mapbox.mapbox-streets-v6'\n * });\n *\n * @example\n * map.addSource('some id', {\n * type: 'vector',\n * tiles: ['https://d25uarhxywzl1j.cloudfront.net/v0.1/{z}/{x}/{y}.mvt'],\n * minzoom: 6,\n * maxzoom: 14\n * });\n *\n * @example\n * map.getSource('some id').setUrl(\"mapbox://mapbox.mapbox-streets-v6\");\n *\n * @example\n * map.getSource('some id').setTiles(['https://d25uarhxywzl1j.cloudfront.net/v0.1/{z}/{x}/{y}.mvt']);\n * @see [Add a vector tile source](https://maplibre.org/maplibre-gl-js-docs/example/vector-source/)\n * @see [Add a third party vector tile source](https://maplibre.org/maplibre-gl-js-docs/example/third-party/)\n */\nclass VectorTileSource extends Evented implements Source {\n type: 'vector';\n id: string;\n minzoom: number;\n maxzoom: number;\n url: string;\n scheme: string;\n tileSize: number;\n promoteId: ?PromoteIdSpecification;\n\n _options: VectorSourceSpecification;\n _collectResourceTiming: boolean;\n dispatcher: Dispatcher;\n map: Map;\n bounds: ?[number, number, number, number];\n tiles: Array;\n tileBounds: TileBounds;\n reparseOverscaled: boolean;\n isTileClipped: boolean;\n _tileJSONRequest: ?Cancelable;\n _loaded: boolean;\n\n constructor(id: string, options: VectorSourceSpecification & {collectResourceTiming: boolean}, dispatcher: Dispatcher, eventedParent: Evented) {\n super();\n this.id = id;\n this.dispatcher = dispatcher;\n\n this.type = 'vector';\n this.minzoom = 0;\n this.maxzoom = 22;\n this.scheme = 'xyz';\n this.tileSize = 512;\n this.reparseOverscaled = true;\n this.isTileClipped = true;\n this._loaded = false;\n\n extend(this, pick(options, ['url', 'scheme', 'tileSize', 'promoteId']));\n this._options = extend({type: 'vector'}, options);\n\n this._collectResourceTiming = options.collectResourceTiming;\n\n if (this.tileSize !== 512) {\n throw new Error('vector tile sources must have a tileSize of 512');\n }\n\n this.setEventedParent(eventedParent);\n }\n\n load() {\n this._loaded = false;\n this.fire(new Event('dataloading', {dataType: 'source'}));\n this._tileJSONRequest = loadTileJSON(this._options, this.map._requestManager, (err, tileJSON) => {\n this._tileJSONRequest = null;\n this._loaded = true;\n if (err) {\n this.fire(new ErrorEvent(err));\n } else if (tileJSON) {\n extend(this, tileJSON);\n if (tileJSON.bounds) this.tileBounds = new TileBounds(tileJSON.bounds, this.minzoom, this.maxzoom);\n postTurnstileEvent(tileJSON.tiles, this.map._requestManager._customAccessToken);\n postMapLoadEvent(tileJSON.tiles, this.map._getMapId(), this.map._requestManager._skuToken, this.map._requestManager._customAccessToken);\n\n // `content` is included here to prevent a race condition where `Style#_updateSources` is called\n // before the TileJSON arrives. this makes sure the tiles needed are loaded once TileJSON arrives\n // ref: https://github.com/mapbox/mapbox-gl-js/pull/4347#discussion_r104418088\n this.fire(new Event('data', {dataType: 'source', sourceDataType: 'metadata'}));\n this.fire(new Event('data', {dataType: 'source', sourceDataType: 'content'}));\n }\n });\n }\n\n loaded(): boolean {\n return this._loaded;\n }\n\n hasTile(tileID: OverscaledTileID) {\n return !this.tileBounds || this.tileBounds.contains(tileID.canonical);\n }\n\n onAdd(map: Map) {\n this.map = map;\n this.load();\n }\n\n setSourceProperty(callback: Function) {\n if (this._tileJSONRequest) {\n this._tileJSONRequest.cancel();\n }\n\n callback();\n\n const sourceCache = this.map.style.sourceCaches[this.id];\n sourceCache.clearTiles();\n this.load();\n }\n\n /**\n * Sets the source `tiles` property and re-renders the map.\n *\n * @param {string[]} tiles An array of one or more tile source URLs, as in the TileJSON spec.\n * @returns {VectorTileSource} this\n */\n setTiles(tiles: Array) {\n this.setSourceProperty(() => {\n this._options.tiles = tiles;\n });\n\n return this;\n }\n\n /**\n * Sets the source `url` property and re-renders the map.\n *\n * @param {string} url A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://`.\n * @returns {VectorTileSource} this\n */\n setUrl(url: string) {\n this.setSourceProperty(() => {\n this.url = url;\n this._options.url = url;\n });\n\n return this;\n }\n\n onRemove() {\n if (this._tileJSONRequest) {\n this._tileJSONRequest.cancel();\n this._tileJSONRequest = null;\n }\n }\n\n serialize() {\n return extend({}, this._options);\n }\n\n loadTile(tile: Tile, callback: Callback) {\n const url = this.map._requestManager.normalizeTileURL(tile.tileID.canonical.url(this.tiles, this.scheme));\n const params = {\n request: this.map._requestManager.transformRequest(url, ResourceType.Tile),\n uid: tile.uid,\n tileID: tile.tileID,\n zoom: tile.tileID.overscaledZ,\n tileSize: this.tileSize * tile.tileID.overscaleFactor(),\n type: this.type,\n source: this.id,\n pixelRatio: browser.devicePixelRatio,\n showCollisionBoxes: this.map.showCollisionBoxes,\n promoteId: this.promoteId\n };\n params.request.collectResourceTiming = this._collectResourceTiming;\n\n if (!tile.actor || tile.state === 'expired') {\n tile.actor = this.dispatcher.getActor();\n tile.request = tile.actor.send('loadTile', params, done.bind(this));\n } else if (tile.state === 'loading') {\n // schedule tile reloading after it has been loaded\n tile.reloadCallback = callback;\n } else {\n tile.request = tile.actor.send('reloadTile', params, done.bind(this));\n }\n\n function done(err, data) {\n delete tile.request;\n\n if (tile.aborted)\n return callback(null);\n\n if (err && err.status !== 404) {\n return callback(err);\n }\n\n if (data && data.resourceTiming)\n tile.resourceTiming = data.resourceTiming;\n\n if (this.map._refreshExpiredTiles && data) tile.setExpiryData(data);\n tile.loadVectorData(data, this.map.painter);\n\n cacheEntryPossiblyAdded(this.dispatcher);\n\n callback(null);\n\n if (tile.reloadCallback) {\n this.loadTile(tile, tile.reloadCallback);\n tile.reloadCallback = null;\n }\n }\n }\n\n abortTile(tile: Tile) {\n if (tile.request) {\n tile.request.cancel();\n delete tile.request;\n }\n if (tile.actor) {\n tile.actor.send('abortTile', {uid: tile.uid, type: this.type, source: this.id}, undefined);\n }\n }\n\n unloadTile(tile: Tile) {\n tile.unloadVectorData();\n if (tile.actor) {\n tile.actor.send('removeTile', {uid: tile.uid, type: this.type, source: this.id}, undefined);\n }\n }\n\n hasTransition() {\n return false;\n }\n}\n\nexport default VectorTileSource;\n","// @flow\n\nimport {extend, pick} from '../util/util';\n\nimport {getImage, ResourceType} from '../util/ajax';\nimport {Event, ErrorEvent, Evented} from '../util/evented';\nimport loadTileJSON from './load_tilejson';\nimport {postTurnstileEvent, postMapLoadEvent} from '../util/mapbox';\nimport TileBounds from './tile_bounds';\nimport Texture from '../render/texture';\n\nimport {cacheEntryPossiblyAdded} from '../util/tile_request_cache';\n\nimport type {Source} from './source';\nimport type {OverscaledTileID} from './tile_id';\nimport type Map from '../ui/map';\nimport type Dispatcher from '../util/dispatcher';\nimport type Tile from './tile';\nimport type {Callback} from '../types/callback';\nimport type {Cancelable} from '../types/cancelable';\nimport type {\n RasterSourceSpecification,\n RasterDEMSourceSpecification\n} from '../style-spec/types';\n\nclass RasterTileSource extends Evented implements Source {\n type: 'raster' | 'raster-dem';\n id: string;\n minzoom: number;\n maxzoom: number;\n url: string;\n scheme: string;\n tileSize: number;\n\n bounds: ?[number, number, number, number];\n tileBounds: TileBounds;\n roundZoom: boolean;\n dispatcher: Dispatcher;\n map: Map;\n tiles: Array;\n\n _loaded: boolean;\n _options: RasterSourceSpecification | RasterDEMSourceSpecification;\n _tileJSONRequest: ?Cancelable;\n\n constructor(id: string, options: RasterSourceSpecification | RasterDEMSourceSpecification, dispatcher: Dispatcher, eventedParent: Evented) {\n super();\n this.id = id;\n this.dispatcher = dispatcher;\n this.setEventedParent(eventedParent);\n\n this.type = 'raster';\n this.minzoom = 0;\n this.maxzoom = 22;\n this.roundZoom = true;\n this.scheme = 'xyz';\n this.tileSize = 512;\n this._loaded = false;\n\n this._options = extend({type: 'raster'}, options);\n extend(this, pick(options, ['url', 'scheme', 'tileSize']));\n }\n\n load() {\n this._loaded = false;\n this.fire(new Event('dataloading', {dataType: 'source'}));\n this._tileJSONRequest = loadTileJSON(this._options, this.map._requestManager, (err, tileJSON) => {\n this._tileJSONRequest = null;\n this._loaded = true;\n if (err) {\n this.fire(new ErrorEvent(err));\n } else if (tileJSON) {\n extend(this, tileJSON);\n if (tileJSON.bounds) this.tileBounds = new TileBounds(tileJSON.bounds, this.minzoom, this.maxzoom);\n\n postTurnstileEvent(tileJSON.tiles);\n postMapLoadEvent(tileJSON.tiles, this.map._getMapId(), this.map._requestManager._skuToken);\n\n // `content` is included here to prevent a race condition where `Style#_updateSources` is called\n // before the TileJSON arrives. this makes sure the tiles needed are loaded once TileJSON arrives\n // ref: https://github.com/mapbox/mapbox-gl-js/pull/4347#discussion_r104418088\n this.fire(new Event('data', {dataType: 'source', sourceDataType: 'metadata'}));\n this.fire(new Event('data', {dataType: 'source', sourceDataType: 'content'}));\n }\n });\n }\n\n loaded(): boolean {\n return this._loaded;\n }\n\n onAdd(map: Map) {\n this.map = map;\n this.load();\n }\n\n onRemove() {\n if (this._tileJSONRequest) {\n this._tileJSONRequest.cancel();\n this._tileJSONRequest = null;\n }\n }\n\n serialize() {\n return extend({}, this._options);\n }\n\n hasTile(tileID: OverscaledTileID) {\n return !this.tileBounds || this.tileBounds.contains(tileID.canonical);\n }\n\n loadTile(tile: Tile, callback: Callback) {\n const url = this.map._requestManager.normalizeTileURL(tile.tileID.canonical.url(this.tiles, this.scheme), this.tileSize);\n tile.request = getImage(this.map._requestManager.transformRequest(url, ResourceType.Tile), (err, img) => {\n delete tile.request;\n\n if (tile.aborted) {\n tile.state = 'unloaded';\n callback(null);\n } else if (err) {\n tile.state = 'errored';\n callback(err);\n } else if (img) {\n if (this.map._refreshExpiredTiles) tile.setExpiryData(img);\n delete (img: any).cacheControl;\n delete (img: any).expires;\n\n const context = this.map.painter.context;\n const gl = context.gl;\n tile.texture = this.map.painter.getTileTexture(img.width);\n if (tile.texture) {\n tile.texture.update(img, {useMipmap: true});\n } else {\n tile.texture = new Texture(context, img, gl.RGBA, {useMipmap: true});\n tile.texture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE, gl.LINEAR_MIPMAP_NEAREST);\n\n if (context.extTextureFilterAnisotropic) {\n gl.texParameterf(gl.TEXTURE_2D, context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT, context.extTextureFilterAnisotropicMax);\n }\n }\n\n tile.state = 'loaded';\n\n cacheEntryPossiblyAdded(this.dispatcher);\n\n callback(null);\n }\n });\n }\n\n abortTile(tile: Tile, callback: Callback) {\n if (tile.request) {\n tile.request.cancel();\n delete tile.request;\n }\n callback();\n }\n\n unloadTile(tile: Tile, callback: Callback) {\n if (tile.texture) this.map.painter.saveTileTexture(tile.texture);\n callback();\n }\n\n hasTransition() {\n return false;\n }\n}\n\nexport default RasterTileSource;\n","// @flow\n\nimport {getImage, ResourceType} from '../util/ajax';\nimport {extend} from '../util/util';\nimport {Evented} from '../util/evented';\nimport browser from '../util/browser';\nimport window from '../util/window';\nimport offscreenCanvasSupported from '../util/offscreen_canvas_supported';\nimport {OverscaledTileID} from './tile_id';\nimport RasterTileSource from './raster_tile_source';\n// ensure DEMData is registered for worker transfer on main thread:\nimport '../data/dem_data';\n\nimport type {Source} from './source';\nimport type Dispatcher from '../util/dispatcher';\nimport type Tile from './tile';\nimport type {Callback} from '../types/callback';\nimport type {RasterDEMSourceSpecification} from '../style-spec/types';\n\nclass RasterDEMTileSource extends RasterTileSource implements Source {\n encoding: \"mapbox\" | \"terrarium\";\n\n constructor(id: string, options: RasterDEMSourceSpecification, dispatcher: Dispatcher, eventedParent: Evented) {\n super(id, options, dispatcher, eventedParent);\n this.type = 'raster-dem';\n this.maxzoom = 22;\n this._options = extend({type: 'raster-dem'}, options);\n this.encoding = options.encoding || \"mapbox\";\n }\n\n serialize() {\n return {\n type: 'raster-dem',\n url: this.url,\n tileSize: this.tileSize,\n tiles: this.tiles,\n bounds: this.bounds,\n encoding: this.encoding\n };\n }\n\n loadTile(tile: Tile, callback: Callback) {\n const url = this.map._requestManager.normalizeTileURL(tile.tileID.canonical.url(this.tiles, this.scheme), this.tileSize);\n tile.request = getImage(this.map._requestManager.transformRequest(url, ResourceType.Tile), imageLoaded.bind(this));\n\n tile.neighboringTiles = this._getNeighboringTiles(tile.tileID);\n function imageLoaded(err, img) {\n delete tile.request;\n if (tile.aborted) {\n tile.state = 'unloaded';\n callback(null);\n } else if (err) {\n tile.state = 'errored';\n callback(err);\n } else if (img) {\n if (this.map._refreshExpiredTiles) tile.setExpiryData(img);\n delete (img: any).cacheControl;\n delete (img: any).expires;\n const transfer = window.ImageBitmap && img instanceof window.ImageBitmap && offscreenCanvasSupported();\n const rawImageData = transfer ? img : browser.getImageData(img, 1);\n const params = {\n uid: tile.uid,\n coord: tile.tileID,\n source: this.id,\n rawImageData,\n encoding: this.encoding\n };\n\n if (!tile.actor || tile.state === 'expired') {\n tile.actor = this.dispatcher.getActor();\n tile.actor.send('loadDEMTile', params, done.bind(this));\n }\n }\n }\n\n function done(err, dem) {\n if (err) {\n tile.state = 'errored';\n callback(err);\n }\n\n if (dem) {\n tile.dem = dem;\n tile.needsHillshadePrepare = true;\n tile.state = 'loaded';\n callback(null);\n }\n }\n }\n\n _getNeighboringTiles(tileID: OverscaledTileID) {\n const canonical = tileID.canonical;\n const dim = Math.pow(2, canonical.z);\n\n const px = (canonical.x - 1 + dim) % dim;\n const pxw = canonical.x === 0 ? tileID.wrap - 1 : tileID.wrap;\n const nx = (canonical.x + 1 + dim) % dim;\n const nxw = canonical.x + 1 === dim ? tileID.wrap + 1 : tileID.wrap;\n\n const neighboringTiles = {};\n // add adjacent tiles\n neighboringTiles[new OverscaledTileID(tileID.overscaledZ, pxw, canonical.z, px, canonical.y).key] = {backfilled: false};\n neighboringTiles[new OverscaledTileID(tileID.overscaledZ, nxw, canonical.z, nx, canonical.y).key] = {backfilled: false};\n\n // Add upper neighboringTiles\n if (canonical.y > 0) {\n neighboringTiles[new OverscaledTileID(tileID.overscaledZ, pxw, canonical.z, px, canonical.y - 1).key] = {backfilled: false};\n neighboringTiles[new OverscaledTileID(tileID.overscaledZ, tileID.wrap, canonical.z, canonical.x, canonical.y - 1).key] = {backfilled: false};\n neighboringTiles[new OverscaledTileID(tileID.overscaledZ, nxw, canonical.z, nx, canonical.y - 1).key] = {backfilled: false};\n }\n // Add lower neighboringTiles\n if (canonical.y + 1 < dim) {\n neighboringTiles[new OverscaledTileID(tileID.overscaledZ, pxw, canonical.z, px, canonical.y + 1).key] = {backfilled: false};\n neighboringTiles[new OverscaledTileID(tileID.overscaledZ, tileID.wrap, canonical.z, canonical.x, canonical.y + 1).key] = {backfilled: false};\n neighboringTiles[new OverscaledTileID(tileID.overscaledZ, nxw, canonical.z, nx, canonical.y + 1).key] = {backfilled: false};\n }\n\n return neighboringTiles;\n }\n\n unloadTile(tile: Tile) {\n if (tile.demTexture) this.map.painter.saveTileTexture(tile.demTexture);\n if (tile.fbo) {\n tile.fbo.destroy();\n delete tile.fbo;\n }\n if (tile.dem) delete tile.dem;\n delete tile.neighboringTiles;\n\n tile.state = 'unloaded';\n if (tile.actor) {\n tile.actor.send('removeDEMTile', {uid: tile.uid, source: this.id});\n }\n }\n\n}\n\nexport default RasterDEMTileSource;\n","// @flow\n\nimport {Event, ErrorEvent, Evented} from '../util/evented';\n\nimport {extend} from '../util/util';\nimport EXTENT from '../data/extent';\nimport {ResourceType} from '../util/ajax';\nimport browser from '../util/browser';\n\nimport type {Source} from './source';\nimport type Map from '../ui/map';\nimport type Dispatcher from '../util/dispatcher';\nimport type Tile from './tile';\nimport type Actor from '../util/actor';\nimport type {Callback} from '../types/callback';\nimport type {GeoJSON, GeoJSONFeature} from '@mapbox/geojson-types';\nimport type {GeoJSONSourceSpecification, PromoteIdSpecification} from '../style-spec/types';\n\n/**\n * A source containing GeoJSON.\n * (See the [Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/#sources-geojson) for detailed documentation of options.)\n *\n * @example\n * map.addSource('some id', {\n * type: 'geojson',\n * data: 'https://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_10m_ports.geojson'\n * });\n *\n * @example\n * map.addSource('some id', {\n * type: 'geojson',\n * data: {\n * \"type\": \"FeatureCollection\",\n * \"features\": [{\n * \"type\": \"Feature\",\n * \"properties\": {},\n * \"geometry\": {\n * \"type\": \"Point\",\n * \"coordinates\": [\n * -76.53063297271729,\n * 39.18174077994108\n * ]\n * }\n * }]\n * }\n * });\n *\n * @example\n * map.getSource('some id').setData({\n * \"type\": \"FeatureCollection\",\n * \"features\": [{\n * \"type\": \"Feature\",\n * \"properties\": { \"name\": \"Null Island\" },\n * \"geometry\": {\n * \"type\": \"Point\",\n * \"coordinates\": [ 0, 0 ]\n * }\n * }]\n * });\n * @see [Draw GeoJSON points](https://maplibre.org/maplibre-gl-js-docs/example/geojson-markers/)\n * @see [Add a GeoJSON line](https://maplibre.org/maplibre-gl-js-docs/example/geojson-line/)\n * @see [Create a heatmap from points](https://maplibre.org/maplibre-gl-js-docs/example/heatmap/)\n * @see [Create and style clusters](https://maplibre.org/maplibre-gl-js-docs/example/cluster/)\n */\nclass GeoJSONSource extends Evented implements Source {\n type: 'geojson';\n id: string;\n minzoom: number;\n maxzoom: number;\n tileSize: number;\n attribution: string;\n promoteId: ?PromoteIdSpecification;\n\n isTileClipped: boolean;\n reparseOverscaled: boolean;\n _data: GeoJSON | string;\n _options: any;\n workerOptions: any;\n map: Map;\n actor: Actor;\n _loaded: boolean;\n _collectResourceTiming: boolean;\n _resourceTiming: Array;\n _removed: boolean;\n\n /**\n * @private\n */\n constructor(id: string, options: GeoJSONSourceSpecification & {workerOptions?: any, collectResourceTiming: boolean}, dispatcher: Dispatcher, eventedParent: Evented) {\n super();\n\n this.id = id;\n\n // `type` is a property rather than a constant to make it easy for 3rd\n // parties to use GeoJSONSource to build their own source types.\n this.type = 'geojson';\n\n this.minzoom = 0;\n this.maxzoom = 18;\n this.tileSize = 512;\n this.isTileClipped = true;\n this.reparseOverscaled = true;\n this._removed = false;\n this._loaded = false;\n\n this.actor = dispatcher.getActor();\n this.setEventedParent(eventedParent);\n\n this._data = (options.data: any);\n this._options = extend({}, options);\n\n this._collectResourceTiming = options.collectResourceTiming;\n this._resourceTiming = [];\n\n if (options.maxzoom !== undefined) this.maxzoom = options.maxzoom;\n if (options.type) this.type = options.type;\n if (options.attribution) this.attribution = options.attribution;\n this.promoteId = options.promoteId;\n\n const scale = EXTENT / this.tileSize;\n\n // sent to the worker, along with `url: ...` or `data: literal geojson`,\n // so that it can load/parse/index the geojson data\n // extending with `options.workerOptions` helps to make it easy for\n // third-party sources to hack/reuse GeoJSONSource.\n this.workerOptions = extend({\n source: this.id,\n cluster: options.cluster || false,\n geojsonVtOptions: {\n buffer: (options.buffer !== undefined ? options.buffer : 128) * scale,\n tolerance: (options.tolerance !== undefined ? options.tolerance : 0.375) * scale,\n extent: EXTENT,\n maxZoom: this.maxzoom,\n lineMetrics: options.lineMetrics || false,\n generateId: options.generateId || false\n },\n superclusterOptions: {\n maxZoom: options.clusterMaxZoom !== undefined ?\n Math.min(options.clusterMaxZoom, this.maxzoom - 1) :\n (this.maxzoom - 1),\n minPoints: Math.max(2, options.clusterMinPoints || 2),\n extent: EXTENT,\n radius: (options.clusterRadius || 50) * scale,\n log: false,\n generateId: options.generateId || false\n },\n clusterProperties: options.clusterProperties,\n filter: options.filter\n }, options.workerOptions);\n }\n\n load() {\n this.fire(new Event('dataloading', {dataType: 'source'}));\n this._updateWorkerData((err) => {\n if (err) {\n this.fire(new ErrorEvent(err));\n return;\n }\n\n const data: Object = {dataType: 'source', sourceDataType: 'metadata'};\n if (this._collectResourceTiming && this._resourceTiming && (this._resourceTiming.length > 0)) {\n data.resourceTiming = this._resourceTiming;\n this._resourceTiming = [];\n }\n\n // although GeoJSON sources contain no metadata, we fire this event to let the SourceCache\n // know its ok to start requesting tiles.\n this.fire(new Event('data', data));\n });\n }\n\n onAdd(map: Map) {\n this.map = map;\n this.load();\n }\n\n /**\n * Sets the GeoJSON data and re-renders the map.\n *\n * @param {Object|string} data A GeoJSON data object or a URL to one. The latter is preferable in the case of large GeoJSON files.\n * @returns {GeoJSONSource} this\n */\n setData(data: GeoJSON | string) {\n this._data = data;\n this.fire(new Event('dataloading', {dataType: 'source'}));\n this._updateWorkerData((err) => {\n if (err) {\n this.fire(new ErrorEvent(err));\n return;\n }\n\n const data: Object = {dataType: 'source', sourceDataType: 'content'};\n if (this._collectResourceTiming && this._resourceTiming && (this._resourceTiming.length > 0)) {\n data.resourceTiming = this._resourceTiming;\n this._resourceTiming = [];\n }\n this.fire(new Event('data', data));\n });\n\n return this;\n }\n\n /**\n * For clustered sources, fetches the zoom at which the given cluster expands.\n *\n * @param clusterId The value of the cluster's `cluster_id` property.\n * @param callback A callback to be called when the zoom value is retrieved (`(error, zoom) => { ... }`).\n * @returns {GeoJSONSource} this\n */\n getClusterExpansionZoom(clusterId: number, callback: Callback) {\n this.actor.send('geojson.getClusterExpansionZoom', {clusterId, source: this.id}, callback);\n return this;\n }\n\n /**\n * For clustered sources, fetches the children of the given cluster on the next zoom level (as an array of GeoJSON features).\n *\n * @param clusterId The value of the cluster's `cluster_id` property.\n * @param callback A callback to be called when the features are retrieved (`(error, features) => { ... }`).\n * @returns {GeoJSONSource} this\n */\n getClusterChildren(clusterId: number, callback: Callback>) {\n this.actor.send('geojson.getClusterChildren', {clusterId, source: this.id}, callback);\n return this;\n }\n\n /**\n * For clustered sources, fetches the original points that belong to the cluster (as an array of GeoJSON features).\n *\n * @param clusterId The value of the cluster's `cluster_id` property.\n * @param limit The maximum number of features to return.\n * @param offset The number of features to skip (e.g. for pagination).\n * @param callback A callback to be called when the features are retrieved (`(error, features) => { ... }`).\n * @returns {GeoJSONSource} this\n * @example\n * // Retrieve cluster leaves on click\n * map.on('click', 'clusters', function(e) {\n * var features = map.queryRenderedFeatures(e.point, {\n * layers: ['clusters']\n * });\n *\n * var clusterId = features[0].properties.cluster_id;\n * var pointCount = features[0].properties.point_count;\n * var clusterSource = map.getSource('clusters');\n *\n * clusterSource.getClusterLeaves(clusterId, pointCount, 0, function(error, features) {\n * // Print cluster leaves in the console\n * console.log('Cluster leaves:', error, features);\n * })\n * });\n */\n getClusterLeaves(clusterId: number, limit: number, offset: number, callback: Callback>) {\n this.actor.send('geojson.getClusterLeaves', {\n source: this.id,\n clusterId,\n limit,\n offset\n }, callback);\n return this;\n }\n\n /*\n * Responsible for invoking WorkerSource's geojson.loadData target, which\n * handles loading the geojson data and preparing to serve it up as tiles,\n * using geojson-vt or supercluster as appropriate.\n */\n _updateWorkerData(callback: Callback) {\n this._loaded = false;\n const options = extend({}, this.workerOptions);\n const data = this._data;\n if (typeof data === 'string') {\n options.request = this.map._requestManager.transformRequest(browser.resolveURL(data), ResourceType.Source);\n options.request.collectResourceTiming = this._collectResourceTiming;\n } else {\n options.data = JSON.stringify(data);\n }\n\n // target {this.type}.loadData rather than literally geojson.loadData,\n // so that other geojson-like source types can easily reuse this\n // implementation\n this.actor.send(`${this.type}.loadData`, options, (err, result) => {\n if (this._removed || (result && result.abandoned)) {\n return;\n }\n\n this._loaded = true;\n\n if (result && result.resourceTiming && result.resourceTiming[this.id])\n this._resourceTiming = result.resourceTiming[this.id].slice(0);\n // Any `loadData` calls that piled up while we were processing\n // this one will get coalesced into a single call when this\n // 'coalesce' message is processed.\n // We would self-send from the worker if we had access to its\n // message queue. Waiting instead for the 'coalesce' to round-trip\n // through the foreground just means we're throttling the worker\n // to run at a little less than full-throttle.\n this.actor.send(`${this.type}.coalesce`, {source: options.source}, null);\n callback(err);\n });\n }\n\n loaded(): boolean {\n return this._loaded;\n }\n\n loadTile(tile: Tile, callback: Callback) {\n const message = !tile.actor ? 'loadTile' : 'reloadTile';\n tile.actor = this.actor;\n const params = {\n type: this.type,\n uid: tile.uid,\n tileID: tile.tileID,\n zoom: tile.tileID.overscaledZ,\n maxZoom: this.maxzoom,\n tileSize: this.tileSize,\n source: this.id,\n pixelRatio: browser.devicePixelRatio,\n showCollisionBoxes: this.map.showCollisionBoxes,\n promoteId: this.promoteId\n };\n\n tile.request = this.actor.send(message, params, (err, data) => {\n delete tile.request;\n tile.unloadVectorData();\n\n if (tile.aborted) {\n return callback(null);\n }\n\n if (err) {\n return callback(err);\n }\n\n tile.loadVectorData(data, this.map.painter, message === 'reloadTile');\n\n return callback(null);\n });\n }\n\n abortTile(tile: Tile) {\n if (tile.request) {\n tile.request.cancel();\n delete tile.request;\n }\n tile.aborted = true;\n }\n\n unloadTile(tile: Tile) {\n tile.unloadVectorData();\n this.actor.send('removeTile', {uid: tile.uid, type: this.type, source: this.id});\n }\n\n onRemove() {\n this._removed = true;\n this.actor.send('removeSource', {type: this.type, source: this.id});\n }\n\n serialize() {\n return extend({}, this._options, {\n type: this.type,\n data: this._data\n });\n }\n\n hasTransition() {\n return false;\n }\n}\n\nexport default GeoJSONSource;\n","// @flow\n\nimport {CanonicalTileID} from './tile_id';\nimport {Event, ErrorEvent, Evented} from '../util/evented';\nimport {getImage, ResourceType} from '../util/ajax';\nimport EXTENT from '../data/extent';\nimport {RasterBoundsArray} from '../data/array_types';\nimport rasterBoundsAttributes from '../data/raster_bounds_attributes';\nimport SegmentVector from '../data/segment';\nimport Texture from '../render/texture';\nimport MercatorCoordinate from '../geo/mercator_coordinate';\n\nimport type {Source} from './source';\nimport type {CanvasSourceSpecification} from './canvas_source';\nimport type Map from '../ui/map';\nimport type Dispatcher from '../util/dispatcher';\nimport type Tile from './tile';\nimport type {Callback} from '../types/callback';\nimport type VertexBuffer from '../gl/vertex_buffer';\nimport type {\n ImageSourceSpecification,\n VideoSourceSpecification\n} from '../style-spec/types';\n\ntype Coordinates = [[number, number], [number, number], [number, number], [number, number]];\n\n/**\n * A data source containing an image.\n * (See the [Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/#sources-image) for detailed documentation of options.)\n *\n * @example\n * // add to map\n * map.addSource('some id', {\n * type: 'image',\n * url: 'https://www.mapbox.com/images/foo.png',\n * coordinates: [\n * [-76.54, 39.18],\n * [-76.52, 39.18],\n * [-76.52, 39.17],\n * [-76.54, 39.17]\n * ]\n * });\n *\n * // update coordinates\n * var mySource = map.getSource('some id');\n * mySource.setCoordinates([\n * [-76.54335737228394, 39.18579907229748],\n * [-76.52803659439087, 39.1838364847587],\n * [-76.5295386314392, 39.17683392507606],\n * [-76.54520273208618, 39.17876344106642]\n * ]);\n *\n * // update url and coordinates simultaneously\n * mySource.updateImage({\n * url: 'https://www.mapbox.com/images/bar.png',\n * coordinates: [\n * [-76.54335737228394, 39.18579907229748],\n * [-76.52803659439087, 39.1838364847587],\n * [-76.5295386314392, 39.17683392507606],\n * [-76.54520273208618, 39.17876344106642]\n * ]\n * })\n *\n * map.removeSource('some id'); // remove\n */\nclass ImageSource extends Evented implements Source {\n type: string;\n id: string;\n minzoom: number;\n maxzoom: number;\n tileSize: number;\n url: string;\n\n coordinates: Coordinates;\n tiles: {[_: string]: Tile};\n options: any;\n dispatcher: Dispatcher;\n map: Map;\n texture: Texture | null;\n image: HTMLImageElement | ImageBitmap;\n tileID: CanonicalTileID;\n _boundsArray: RasterBoundsArray;\n boundsBuffer: VertexBuffer;\n boundsSegments: SegmentVector;\n _loaded: boolean;\n\n /**\n * @private\n */\n constructor(id: string, options: ImageSourceSpecification | VideoSourceSpecification | CanvasSourceSpecification, dispatcher: Dispatcher, eventedParent: Evented) {\n super();\n this.id = id;\n this.dispatcher = dispatcher;\n this.coordinates = options.coordinates;\n\n this.type = 'image';\n this.minzoom = 0;\n this.maxzoom = 22;\n this.tileSize = 512;\n this.tiles = {};\n this._loaded = false;\n\n this.setEventedParent(eventedParent);\n\n this.options = options;\n }\n\n load(newCoordinates?: Coordinates, successCallback?: () => void) {\n this._loaded = false;\n this.fire(new Event('dataloading', {dataType: 'source'}));\n\n this.url = this.options.url;\n\n getImage(this.map._requestManager.transformRequest(this.url, ResourceType.Image), (err, image) => {\n this._loaded = true;\n if (err) {\n this.fire(new ErrorEvent(err));\n } else if (image) {\n this.image = image;\n if (newCoordinates) {\n this.coordinates = newCoordinates;\n }\n if (successCallback) {\n successCallback();\n }\n this._finishLoading();\n }\n });\n }\n\n loaded(): boolean {\n return this._loaded;\n }\n\n /**\n * Updates the image URL and, optionally, the coordinates. To avoid having the image flash after changing,\n * set the `raster-fade-duration` paint property on the raster layer to 0.\n *\n * @param {Object} options Options object.\n * @param {string} [options.url] Required image URL.\n * @param {Array>} [options.coordinates] Four geographical coordinates,\n * represented as arrays of longitude and latitude numbers, which define the corners of the image.\n * The coordinates start at the top left corner of the image and proceed in clockwise order.\n * They do not have to represent a rectangle.\n * @returns {ImageSource} this\n */\n updateImage(options: {url: string, coordinates?: Coordinates}) {\n if (!this.image || !options.url) {\n return this;\n }\n this.options.url = options.url;\n this.load(options.coordinates, () => { this.texture = null; });\n return this;\n }\n\n _finishLoading() {\n if (this.map) {\n this.setCoordinates(this.coordinates);\n this.fire(new Event('data', {dataType: 'source', sourceDataType: 'metadata'}));\n }\n }\n\n onAdd(map: Map) {\n this.map = map;\n this.load();\n }\n\n /**\n * Sets the image's coordinates and re-renders the map.\n *\n * @param {Array>} coordinates Four geographical coordinates,\n * represented as arrays of longitude and latitude numbers, which define the corners of the image.\n * The coordinates start at the top left corner of the image and proceed in clockwise order.\n * They do not have to represent a rectangle.\n * @returns {ImageSource} this\n */\n setCoordinates(coordinates: Coordinates) {\n this.coordinates = coordinates;\n\n // Calculate which mercator tile is suitable for rendering the video in\n // and create a buffer with the corner coordinates. These coordinates\n // may be outside the tile, because raster tiles aren't clipped when rendering.\n\n // transform the geo coordinates into (zoom 0) tile space coordinates\n const cornerCoords = coordinates.map(MercatorCoordinate.fromLngLat);\n\n // Compute the coordinates of the tile we'll use to hold this image's\n // render data\n this.tileID = getCoordinatesCenterTileID(cornerCoords);\n\n // Constrain min/max zoom to our tile's zoom level in order to force\n // SourceCache to request this tile (no matter what the map's zoom\n // level)\n this.minzoom = this.maxzoom = this.tileID.z;\n\n // Transform the corner coordinates into the coordinate space of our\n // tile.\n const tileCoords = cornerCoords.map((coord) => this.tileID.getTilePoint(coord)._round());\n\n this._boundsArray = new RasterBoundsArray();\n this._boundsArray.emplaceBack(tileCoords[0].x, tileCoords[0].y, 0, 0);\n this._boundsArray.emplaceBack(tileCoords[1].x, tileCoords[1].y, EXTENT, 0);\n this._boundsArray.emplaceBack(tileCoords[3].x, tileCoords[3].y, 0, EXTENT);\n this._boundsArray.emplaceBack(tileCoords[2].x, tileCoords[2].y, EXTENT, EXTENT);\n\n if (this.boundsBuffer) {\n this.boundsBuffer.destroy();\n delete this.boundsBuffer;\n }\n\n this.fire(new Event('data', {dataType:'source', sourceDataType: 'content'}));\n return this;\n }\n\n prepare() {\n if (Object.keys(this.tiles).length === 0 || !this.image) {\n return;\n }\n\n const context = this.map.painter.context;\n const gl = context.gl;\n\n if (!this.boundsBuffer) {\n this.boundsBuffer = context.createVertexBuffer(this._boundsArray, rasterBoundsAttributes.members);\n }\n\n if (!this.boundsSegments) {\n this.boundsSegments = SegmentVector.simpleSegment(0, 0, 4, 2);\n }\n\n if (!this.texture) {\n this.texture = new Texture(context, this.image, gl.RGBA);\n this.texture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n }\n\n for (const w in this.tiles) {\n const tile = this.tiles[w];\n if (tile.state !== 'loaded') {\n tile.state = 'loaded';\n tile.texture = this.texture;\n }\n }\n }\n\n loadTile(tile: Tile, callback: Callback) {\n // We have a single tile -- whoose coordinates are this.tileID -- that\n // covers the image we want to render. If that's the one being\n // requested, set it up with the image; otherwise, mark the tile as\n // `errored` to indicate that we have no data for it.\n // If the world wraps, we may have multiple \"wrapped\" copies of the\n // single tile.\n if (this.tileID && this.tileID.equals(tile.tileID.canonical)) {\n this.tiles[String(tile.tileID.wrap)] = tile;\n tile.buckets = {};\n callback(null);\n } else {\n tile.state = 'errored';\n callback(null);\n }\n }\n\n serialize(): Object {\n return {\n type: 'image',\n url: this.options.url,\n coordinates: this.coordinates\n };\n }\n\n hasTransition() {\n return false;\n }\n}\n\n/**\n * Given a list of coordinates, get their center as a coordinate.\n *\n * @returns centerpoint\n * @private\n */\nexport function getCoordinatesCenterTileID(coords: Array) {\n let minX = Infinity;\n let minY = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n\n for (const coord of coords) {\n minX = Math.min(minX, coord.x);\n minY = Math.min(minY, coord.y);\n maxX = Math.max(maxX, coord.x);\n maxY = Math.max(maxY, coord.y);\n }\n\n const dx = maxX - minX;\n const dy = maxY - minY;\n const dMax = Math.max(dx, dy);\n const zoom = Math.max(0, Math.floor(-Math.log(dMax) / Math.LN2));\n const tilesAtZoom = Math.pow(2, zoom);\n\n return new CanonicalTileID(\n zoom,\n Math.floor((minX + maxX) / 2 * tilesAtZoom),\n Math.floor((minY + maxY) / 2 * tilesAtZoom));\n}\n\nexport default ImageSource;\n","// @flow\n\nimport {getVideo, ResourceType} from '../util/ajax';\n\nimport ImageSource from './image_source';\nimport rasterBoundsAttributes from '../data/raster_bounds_attributes';\nimport SegmentVector from '../data/segment';\nimport Texture from '../render/texture';\nimport {ErrorEvent} from '../util/evented';\nimport ValidationError from '../style-spec/error/validation_error';\n\nimport type Map from '../ui/map';\nimport type Dispatcher from '../util/dispatcher';\nimport type {Evented} from '../util/evented';\nimport type {VideoSourceSpecification} from '../style-spec/types';\n\n/**\n * A data source containing video.\n * (See the [Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/#sources-video) for detailed documentation of options.)\n *\n * @example\n * // add to map\n * map.addSource('some id', {\n * type: 'video',\n * url: [\n * 'https://www.mapbox.com/blog/assets/baltimore-smoke.mp4',\n * 'https://www.mapbox.com/blog/assets/baltimore-smoke.webm'\n * ],\n * coordinates: [\n * [-76.54, 39.18],\n * [-76.52, 39.18],\n * [-76.52, 39.17],\n * [-76.54, 39.17]\n * ]\n * });\n *\n * // update\n * var mySource = map.getSource('some id');\n * mySource.setCoordinates([\n * [-76.54335737228394, 39.18579907229748],\n * [-76.52803659439087, 39.1838364847587],\n * [-76.5295386314392, 39.17683392507606],\n * [-76.54520273208618, 39.17876344106642]\n * ]);\n *\n * map.removeSource('some id'); // remove\n * @see [Add a video](https://maplibre.org/maplibre-gl-js-docs/example/video-on-a-map/)\n */\nclass VideoSource extends ImageSource {\n options: VideoSourceSpecification;\n urls: Array;\n video: HTMLVideoElement;\n roundZoom: boolean;\n\n /**\n * @private\n */\n constructor(id: string, options: VideoSourceSpecification, dispatcher: Dispatcher, eventedParent: Evented) {\n super(id, options, dispatcher, eventedParent);\n this.roundZoom = true;\n this.type = 'video';\n this.options = options;\n }\n\n load() {\n this._loaded = false;\n const options = this.options;\n\n this.urls = [];\n for (const url of options.urls) {\n this.urls.push(this.map._requestManager.transformRequest(url, ResourceType.Source).url);\n }\n\n getVideo(this.urls, (err, video) => {\n this._loaded = true;\n if (err) {\n this.fire(new ErrorEvent(err));\n } else if (video) {\n this.video = video;\n this.video.loop = true;\n\n // Start repainting when video starts playing. hasTransition() will then return\n // true to trigger additional frames as long as the videos continues playing.\n this.video.addEventListener('playing', () => {\n this.map.triggerRepaint();\n });\n\n if (this.map) {\n this.video.play();\n }\n\n this._finishLoading();\n }\n });\n }\n\n /**\n * Pauses the video.\n */\n pause() {\n if (this.video) {\n this.video.pause();\n }\n }\n\n /**\n * Plays the video.\n */\n play() {\n if (this.video) {\n this.video.play();\n }\n }\n\n /**\n * Sets playback to a timestamp, in seconds.\n * @private\n */\n seek(seconds: number) {\n if (this.video) {\n const seekableRange = this.video.seekable;\n if (seconds < seekableRange.start(0) || seconds > seekableRange.end(0)) {\n this.fire(new ErrorEvent(new ValidationError(`sources.${this.id}`, null, `Playback for this video can be set only between the ${seekableRange.start(0)} and ${seekableRange.end(0)}-second mark.`)));\n } else this.video.currentTime = seconds;\n }\n }\n\n /**\n * Returns the HTML `video` element.\n *\n * @returns {HTMLVideoElement} The HTML `video` element.\n */\n getVideo() {\n return this.video;\n }\n\n onAdd(map: Map) {\n if (this.map) return;\n this.map = map;\n this.load();\n if (this.video) {\n this.video.play();\n this.setCoordinates(this.coordinates);\n }\n }\n\n /**\n * Sets the video's coordinates and re-renders the map.\n *\n * @method setCoordinates\n * @instance\n * @memberof VideoSource\n * @returns {VideoSource} this\n */\n // setCoordinates inherited from ImageSource\n\n prepare() {\n if (Object.keys(this.tiles).length === 0 || this.video.readyState < 2) {\n return; // not enough data for current position\n }\n\n const context = this.map.painter.context;\n const gl = context.gl;\n\n if (!this.boundsBuffer) {\n this.boundsBuffer = context.createVertexBuffer(this._boundsArray, rasterBoundsAttributes.members);\n }\n\n if (!this.boundsSegments) {\n this.boundsSegments = SegmentVector.simpleSegment(0, 0, 4, 2);\n }\n\n if (!this.texture) {\n this.texture = new Texture(context, this.video, gl.RGBA);\n this.texture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n } else if (!this.video.paused) {\n this.texture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, this.video);\n }\n\n for (const w in this.tiles) {\n const tile = this.tiles[w];\n if (tile.state !== 'loaded') {\n tile.state = 'loaded';\n tile.texture = this.texture;\n }\n }\n }\n\n serialize() {\n return {\n type: 'video',\n urls: this.urls,\n coordinates: this.coordinates\n };\n }\n\n hasTransition() {\n return this.video && !this.video.paused;\n }\n}\n\nexport default VideoSource;\n","// @flow\n\nimport ImageSource from './image_source';\n\nimport window from '../util/window';\nimport rasterBoundsAttributes from '../data/raster_bounds_attributes';\nimport SegmentVector from '../data/segment';\nimport Texture from '../render/texture';\nimport {ErrorEvent} from '../util/evented';\nimport ValidationError from '../style-spec/error/validation_error';\n\nimport type Map from '../ui/map';\nimport type Dispatcher from '../util/dispatcher';\nimport type {Evented} from '../util/evented';\n\nexport type CanvasSourceSpecification = {|\n \"type\": \"canvas\",\n \"coordinates\": [[number, number], [number, number], [number, number], [number, number]],\n \"animate\"?: boolean,\n \"canvas\": string | HTMLCanvasElement\n|};\n\n/**\n * Options to add a canvas source type to the map.\n *\n * @typedef {Object} CanvasSourceOptions\n * @property {string} type Source type. Must be `\"canvas\"`.\n * @property {string|HTMLCanvasElement} canvas Canvas source from which to read pixels. Can be a string representing the ID of the canvas element, or the `HTMLCanvasElement` itself.\n * @property {Array>} coordinates Four geographical coordinates denoting where to place the corners of the canvas, specified in `[longitude, latitude]` pairs.\n * @property {boolean} [animate=true] Whether the canvas source is animated. If the canvas is static (i.e. pixels do not need to be re-read on every frame), `animate` should be set to `false` to improve performance.\n */\n\n/**\n * A data source containing the contents of an HTML canvas. See {@link CanvasSourceOptions} for detailed documentation of options.\n *\n * @example\n * // add to map\n * map.addSource('some id', {\n * type: 'canvas',\n * canvas: 'idOfMyHTMLCanvas',\n * animate: true,\n * coordinates: [\n * [-76.54, 39.18],\n * [-76.52, 39.18],\n * [-76.52, 39.17],\n * [-76.54, 39.17]\n * ]\n * });\n *\n * // update\n * var mySource = map.getSource('some id');\n * mySource.setCoordinates([\n * [-76.54335737228394, 39.18579907229748],\n * [-76.52803659439087, 39.1838364847587],\n * [-76.5295386314392, 39.17683392507606],\n * [-76.54520273208618, 39.17876344106642]\n * ]);\n *\n * map.removeSource('some id'); // remove\n */\nclass CanvasSource extends ImageSource {\n options: CanvasSourceSpecification;\n animate: boolean;\n canvas: HTMLCanvasElement;\n width: number;\n height: number;\n play: () => void;\n pause: () => void;\n _playing: boolean;\n\n /**\n * @private\n */\n constructor(id: string, options: CanvasSourceSpecification, dispatcher: Dispatcher, eventedParent: Evented) {\n super(id, options, dispatcher, eventedParent);\n\n // We build in some validation here, since canvas sources aren't included in the style spec:\n if (!options.coordinates) {\n this.fire(new ErrorEvent(new ValidationError(`sources.${id}`, null, 'missing required property \"coordinates\"')));\n } else if (!Array.isArray(options.coordinates) || options.coordinates.length !== 4 ||\n options.coordinates.some(c => !Array.isArray(c) || c.length !== 2 || c.some(l => typeof l !== 'number'))) {\n this.fire(new ErrorEvent(new ValidationError(`sources.${id}`, null, '\"coordinates\" property must be an array of 4 longitude/latitude array pairs')));\n }\n\n if (options.animate && typeof options.animate !== 'boolean') {\n this.fire(new ErrorEvent(new ValidationError(`sources.${id}`, null, 'optional \"animate\" property must be a boolean value')));\n }\n\n if (!options.canvas) {\n this.fire(new ErrorEvent(new ValidationError(`sources.${id}`, null, 'missing required property \"canvas\"')));\n } else if (typeof options.canvas !== 'string' && !(options.canvas instanceof window.HTMLCanvasElement)) {\n this.fire(new ErrorEvent(new ValidationError(`sources.${id}`, null, '\"canvas\" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance')));\n }\n\n this.options = options;\n this.animate = options.animate !== undefined ? options.animate : true;\n }\n\n /**\n * Enables animation. The image will be copied from the canvas to the map on each frame.\n * @method play\n * @instance\n * @memberof CanvasSource\n */\n\n /**\n * Disables animation. The map will display a static copy of the canvas image.\n * @method pause\n * @instance\n * @memberof CanvasSource\n */\n\n load() {\n this._loaded = true;\n if (!this.canvas) {\n this.canvas = (this.options.canvas instanceof window.HTMLCanvasElement) ?\n this.options.canvas :\n window.document.getElementById(this.options.canvas);\n }\n this.width = this.canvas.width;\n this.height = this.canvas.height;\n\n if (this._hasInvalidDimensions()) {\n this.fire(new ErrorEvent(new Error('Canvas dimensions cannot be less than or equal to zero.')));\n return;\n }\n\n this.play = function() {\n this._playing = true;\n this.map.triggerRepaint();\n };\n\n this.pause = function() {\n if (this._playing) {\n this.prepare();\n this._playing = false;\n }\n };\n\n this._finishLoading();\n }\n\n /**\n * Returns the HTML `canvas` element.\n *\n * @returns {HTMLCanvasElement} The HTML `canvas` element.\n */\n getCanvas() {\n return this.canvas;\n }\n\n onAdd(map: Map) {\n this.map = map;\n this.load();\n if (this.canvas) {\n if (this.animate) this.play();\n }\n }\n\n onRemove() {\n this.pause();\n }\n\n // /**\n // * Sets the canvas's coordinates and re-renders the map.\n // *\n // * @method setCoordinates\n // * @instance\n // * @memberof CanvasSource\n // * @param {Array>} coordinates Four geographical coordinates,\n // * represented as arrays of longitude and latitude numbers, which define the corners of the canvas.\n // * The coordinates start at the top left corner of the canvas and proceed in clockwise order.\n // * They do not have to represent a rectangle.\n // * @returns {CanvasSource} this\n // */\n // setCoordinates inherited from ImageSource\n\n prepare() {\n let resize = false;\n if (this.canvas.width !== this.width) {\n this.width = this.canvas.width;\n resize = true;\n }\n if (this.canvas.height !== this.height) {\n this.height = this.canvas.height;\n resize = true;\n }\n\n if (this._hasInvalidDimensions()) return;\n\n if (Object.keys(this.tiles).length === 0) return; // not enough data for current position\n\n const context = this.map.painter.context;\n const gl = context.gl;\n\n if (!this.boundsBuffer) {\n this.boundsBuffer = context.createVertexBuffer(this._boundsArray, rasterBoundsAttributes.members);\n }\n\n if (!this.boundsSegments) {\n this.boundsSegments = SegmentVector.simpleSegment(0, 0, 4, 2);\n }\n\n if (!this.texture) {\n this.texture = new Texture(context, this.canvas, gl.RGBA, {premultiply: true});\n } else if (resize || this._playing) {\n this.texture.update(this.canvas, {premultiply: true});\n }\n\n for (const w in this.tiles) {\n const tile = this.tiles[w];\n if (tile.state !== 'loaded') {\n tile.state = 'loaded';\n tile.texture = this.texture;\n }\n }\n }\n\n serialize(): Object {\n return {\n type: 'canvas',\n coordinates: this.coordinates\n };\n }\n\n hasTransition() {\n return this._playing;\n }\n\n _hasInvalidDimensions() {\n for (const x of [this.canvas.width, this.canvas.height]) {\n if (isNaN(x) || x <= 0) return true;\n }\n return false;\n }\n}\n\nexport default CanvasSource;\n","// @flow\n\nimport {bindAll} from '../util/util';\n\nimport type Dispatcher from '../util/dispatcher';\nimport type {Event, Evented} from '../util/evented';\nimport type Map from '../ui/map';\nimport type Tile from './tile';\nimport type {OverscaledTileID} from './tile_id';\nimport type {Callback} from '../types/callback';\nimport {CanonicalTileID} from './tile_id';\n\n/**\n * The `Source` interface must be implemented by each source type, including \"core\" types (`vector`, `raster`,\n * `video`, etc.) and all custom, third-party types.\n *\n * @private\n *\n * @param {string} id The id for the source. Must not be used by any existing source.\n * @param {Object} options Source options, specific to the source type (except for `options.type`, which is always\n * required).\n * @param {string} options.type The source type, matching the value of `name` used in {@link Style#addSourceType}.\n * @param {Dispatcher} dispatcher A {@link Dispatcher} instance, which can be used to send messages to the workers.\n *\n * @fires data with `{dataType: 'source', sourceDataType: 'metadata'}` to indicate that any necessary metadata\n * has been loaded so that it's okay to call `loadTile`; and with `{dataType: 'source', sourceDataType: 'content'}`\n * to indicate that the source data has changed, so that any current caches should be flushed.\n * @property {string} id The id for the source. Must match the id passed to the constructor.\n * @property {number} minzoom\n * @property {number} maxzoom\n * @property {boolean} isTileClipped `false` if tiles can be drawn outside their boundaries, `true` if they cannot.\n * @property {boolean} reparseOverscaled `true` if tiles should be sent back to the worker for each overzoomed zoom\n * level, `false` if not.\n * @property {boolean} roundZoom `true` if zoom levels are rounded to the nearest integer in the source data, `false`\n * if they are floor-ed to the nearest integer.\n */\nexport interface Source {\n +type: string;\n id: string;\n minzoom: number,\n maxzoom: number,\n tileSize: number,\n attribution?: string,\n\n roundZoom?: boolean,\n isTileClipped?: boolean,\n mapbox_logo?: boolean,\n tileID?: CanonicalTileID;\n reparseOverscaled?: boolean,\n vectorLayerIds?: Array,\n\n hasTransition(): boolean;\n loaded(): boolean;\n\n fire(event: Event): mixed;\n\n +onAdd?: (map: Map) => void;\n +onRemove?: (map: Map) => void;\n\n loadTile(tile: Tile, callback: Callback): void;\n +hasTile?: (tileID: OverscaledTileID) => boolean;\n +abortTile?: (tile: Tile, callback: Callback) => void;\n +unloadTile?: (tile: Tile, callback: Callback) => void;\n\n /**\n * @returns A plain (stringifiable) JS object representing the current state of the source.\n * Creating a source using the returned object as the `options` should result in a Source that is\n * equivalent to this one.\n * @private\n */\n serialize(): Object;\n\n +prepare?: () => void;\n}\n\ntype SourceStatics = {\n /*\n * An optional URL to a script which, when run by a Worker, registers a {@link WorkerSource}\n * implementation for this Source type by calling `self.registerWorkerSource(workerSource: WorkerSource)`.\n */\n workerSourceURL?: URL;\n};\n\nexport type SourceClass = Class & SourceStatics;\n\nimport vector from '../source/vector_tile_source';\nimport raster from '../source/raster_tile_source';\nimport rasterDem from '../source/raster_dem_tile_source';\nimport geojson from '../source/geojson_source';\nimport video from '../source/video_source';\nimport image from '../source/image_source';\nimport canvas from '../source/canvas_source';\n\nimport type {SourceSpecification} from '../style-spec/types';\n\nconst sourceTypes = {\n vector,\n raster,\n 'raster-dem': rasterDem,\n geojson,\n video,\n image,\n canvas\n};\n\n/*\n * Creates a tiled data source instance given an options object.\n *\n * @param id\n * @param {Object} source A source definition object compliant with\n * [`mapbox-gl-style-spec`](https://www.mapbox.com/mapbox-gl-style-spec/#sources) or, for a third-party source type,\n * with that type's requirements.\n * @param {Dispatcher} dispatcher\n * @returns {Source}\n */\nexport const create = function(id: string, specification: SourceSpecification, dispatcher: Dispatcher, eventedParent: Evented) {\n const source = new sourceTypes[specification.type](id, (specification: any), dispatcher, eventedParent);\n\n if (source.id !== id) {\n throw new Error(`Expected Source id to be ${id} instead of ${source.id}`);\n }\n\n bindAll(['load', 'abort', 'unload', 'serialize', 'prepare'], source);\n return source;\n};\n\nexport const getType = function (name: string) {\n return sourceTypes[name];\n};\n\nexport const setType = function (name: string, type: Class) {\n sourceTypes[name] = type;\n};\n\nexport interface Actor {\n send(type: string, data: Object, callback: Callback): void;\n}\n","// @flow\n\nimport type SourceCache from './source_cache';\nimport type StyleLayer from '../style/style_layer';\nimport type CollisionIndex from '../symbol/collision_index';\nimport type Transform from '../geo/transform';\nimport type {RetainedQueryData} from '../symbol/placement';\nimport type {FilterSpecification} from '../style-spec/types';\nimport assert from 'assert';\nimport {mat4} from 'gl-matrix';\n\n/*\n * Returns a matrix that can be used to convert from tile coordinates to viewport pixel coordinates.\n */\nfunction getPixelPosMatrix(transform, tileID) {\n const t = mat4.identity([]);\n mat4.translate(t, t, [1, 1, 0]);\n mat4.scale(t, t, [transform.width * 0.5, transform.height * 0.5, 1]);\n return mat4.multiply(t, t, transform.calculatePosMatrix(tileID.toUnwrapped()));\n}\n\nfunction queryIncludes3DLayer(layers?: Array, styleLayers: {[_: string]: StyleLayer}, sourceID: string) {\n if (layers) {\n for (const layerID of layers) {\n const layer = styleLayers[layerID];\n if (layer && layer.source === sourceID && layer.type === 'fill-extrusion') {\n return true;\n }\n }\n } else {\n for (const key in styleLayers) {\n const layer = styleLayers[key];\n if (layer.source === sourceID && layer.type === 'fill-extrusion') {\n return true;\n }\n }\n }\n return false;\n}\n\nexport function queryRenderedFeatures(sourceCache: SourceCache,\n styleLayers: {[_: string]: StyleLayer},\n serializedLayers: {[_: string]: Object},\n queryGeometry: Array,\n params: { filter: FilterSpecification, layers: Array, availableImages: Array },\n transform: Transform) {\n\n const has3DLayer = queryIncludes3DLayer(params && params.layers, styleLayers, sourceCache.id);\n const maxPitchScaleFactor = transform.maxPitchScaleFactor();\n const tilesIn = sourceCache.tilesIn(queryGeometry, maxPitchScaleFactor, has3DLayer);\n\n tilesIn.sort(sortTilesIn);\n const renderedFeatureLayers = [];\n for (const tileIn of tilesIn) {\n renderedFeatureLayers.push({\n wrappedTileID: tileIn.tileID.wrapped().key,\n queryResults: tileIn.tile.queryRenderedFeatures(\n styleLayers,\n serializedLayers,\n sourceCache._state,\n tileIn.queryGeometry,\n tileIn.cameraQueryGeometry,\n tileIn.scale,\n params,\n transform,\n maxPitchScaleFactor,\n getPixelPosMatrix(sourceCache.transform, tileIn.tileID))\n });\n }\n\n const result = mergeRenderedFeatureLayers(renderedFeatureLayers);\n\n // Merge state from SourceCache into the results\n for (const layerID in result) {\n result[layerID].forEach((featureWrapper) => {\n const feature = featureWrapper.feature;\n const state = sourceCache.getFeatureState(feature.layer['source-layer'], feature.id);\n feature.source = feature.layer.source;\n if (feature.layer['source-layer']) {\n feature.sourceLayer = feature.layer['source-layer'];\n }\n feature.state = state;\n });\n }\n return result;\n}\n\nexport function queryRenderedSymbols(styleLayers: {[_: string]: StyleLayer},\n serializedLayers: {[_: string]: StyleLayer},\n sourceCaches: {[_: string]: SourceCache},\n queryGeometry: Array,\n params: { filter: FilterSpecification, layers: Array, availableImages: Array },\n collisionIndex: CollisionIndex,\n retainedQueryData: {[_: number]: RetainedQueryData}) {\n const result = {};\n const renderedSymbols = collisionIndex.queryRenderedSymbols(queryGeometry);\n const bucketQueryData = [];\n for (const bucketInstanceId of Object.keys(renderedSymbols).map(Number)) {\n bucketQueryData.push(retainedQueryData[bucketInstanceId]);\n }\n bucketQueryData.sort(sortTilesIn);\n\n for (const queryData of bucketQueryData) {\n const bucketSymbols = queryData.featureIndex.lookupSymbolFeatures(\n renderedSymbols[queryData.bucketInstanceId],\n serializedLayers,\n queryData.bucketIndex,\n queryData.sourceLayerIndex,\n params.filter,\n params.layers,\n params.availableImages,\n styleLayers);\n\n for (const layerID in bucketSymbols) {\n const resultFeatures = result[layerID] = result[layerID] || [];\n const layerSymbols = bucketSymbols[layerID];\n layerSymbols.sort((a, b) => {\n // Match topDownFeatureComparator from FeatureIndex, but using\n // most recent sorting of features from bucket.sortFeatures\n const featureSortOrder = queryData.featureSortOrder;\n if (featureSortOrder) {\n // queryRenderedSymbols documentation says we'll return features in\n // \"top-to-bottom\" rendering order (aka last-to-first).\n // Actually there can be multiple symbol instances per feature, so\n // we sort each feature based on the first matching symbol instance.\n const sortedA = featureSortOrder.indexOf(a.featureIndex);\n const sortedB = featureSortOrder.indexOf(b.featureIndex);\n assert(sortedA >= 0);\n assert(sortedB >= 0);\n return sortedB - sortedA;\n } else {\n // Bucket hasn't been re-sorted based on angle, so use the\n // reverse of the order the features appeared in the data.\n return b.featureIndex - a.featureIndex;\n }\n });\n for (const symbolFeature of layerSymbols) {\n resultFeatures.push(symbolFeature);\n }\n }\n }\n\n // Merge state from SourceCache into the results\n for (const layerName in result) {\n result[layerName].forEach((featureWrapper) => {\n const feature = featureWrapper.feature;\n const layer = styleLayers[layerName];\n const sourceCache = sourceCaches[layer.source];\n const state = sourceCache.getFeatureState(feature.layer['source-layer'], feature.id);\n feature.source = feature.layer.source;\n if (feature.layer['source-layer']) {\n feature.sourceLayer = feature.layer['source-layer'];\n }\n feature.state = state;\n });\n }\n return result;\n}\n\nexport function querySourceFeatures(sourceCache: SourceCache, params: any) {\n const tiles = sourceCache.getRenderableIds().map((id) => {\n return sourceCache.getTileByID(id);\n });\n\n const result = [];\n\n const dataTiles = {};\n for (let i = 0; i < tiles.length; i++) {\n const tile = tiles[i];\n const dataID = tile.tileID.canonical.key;\n if (!dataTiles[dataID]) {\n dataTiles[dataID] = true;\n tile.querySourceFeatures(result, params);\n }\n }\n\n return result;\n}\n\nfunction sortTilesIn(a, b) {\n const idA = a.tileID;\n const idB = b.tileID;\n return (idA.overscaledZ - idB.overscaledZ) || (idA.canonical.y - idB.canonical.y) || (idA.wrap - idB.wrap) || (idA.canonical.x - idB.canonical.x);\n}\n\nfunction mergeRenderedFeatureLayers(tiles) {\n // Merge results from all tiles, but if two tiles share the same\n // wrapped ID, don't duplicate features between the two tiles\n const result = {};\n const wrappedIDLayerMap = {};\n for (const tile of tiles) {\n const queryResults = tile.queryResults;\n const wrappedID = tile.wrappedTileID;\n const wrappedIDLayers = wrappedIDLayerMap[wrappedID] = wrappedIDLayerMap[wrappedID] || {};\n for (const layerID in queryResults) {\n const tileFeatures = queryResults[layerID];\n const wrappedIDFeatures = wrappedIDLayers[layerID] = wrappedIDLayers[layerID] || {};\n const resultFeatures = result[layerID] = result[layerID] || [];\n for (const tileFeature of tileFeatures) {\n if (!wrappedIDFeatures[tileFeature.featureIndex]) {\n wrappedIDFeatures[tileFeature.featureIndex] = true;\n resultFeatures.push(tileFeature);\n }\n }\n }\n }\n return result;\n}\n","// @flow\n\nimport {OverscaledTileID} from './tile_id';\nimport type Tile from './tile';\n\n/**\n * A [least-recently-used cache](http://en.wikipedia.org/wiki/Cache_algorithms)\n * with hash lookup made possible by keeping a list of keys in parallel to\n * an array of dictionary of values\n *\n * @private\n */\nclass TileCache {\n max: number;\n data: {[key: string]: Array<{ value: Tile, timeout: ?TimeoutID}>};\n order: Array;\n onRemove: (element: Tile) => void;\n /**\n * @param {number} max number of permitted values\n * @param {Function} onRemove callback called with items when they expire\n */\n constructor(max: number, onRemove: (element: Tile) => void) {\n this.max = max;\n this.onRemove = onRemove;\n this.reset();\n }\n\n /**\n * Clear the cache\n *\n * @returns {TileCache} this cache\n * @private\n */\n reset() {\n for (const key in this.data) {\n for (const removedData of this.data[key]) {\n if (removedData.timeout) clearTimeout(removedData.timeout);\n this.onRemove(removedData.value);\n }\n }\n\n this.data = {};\n this.order = [];\n\n return this;\n }\n\n /**\n * Add a key, value combination to the cache, trimming its size if this pushes\n * it over max length.\n *\n * @param {OverscaledTileID} tileID lookup key for the item\n * @param {*} data any value\n *\n * @returns {TileCache} this cache\n * @private\n */\n add(tileID: OverscaledTileID, data: Tile, expiryTimeout: number | void) {\n const key = tileID.wrapped().key;\n if (this.data[key] === undefined) {\n this.data[key] = [];\n }\n\n const dataWrapper = {\n value: data,\n timeout: undefined\n };\n\n if (expiryTimeout !== undefined) {\n dataWrapper.timeout = setTimeout(() => {\n this.remove(tileID, dataWrapper);\n }, expiryTimeout);\n }\n\n this.data[key].push(dataWrapper);\n this.order.push(key);\n\n if (this.order.length > this.max) {\n const removedData = this._getAndRemoveByKey(this.order[0]);\n if (removedData) this.onRemove(removedData);\n }\n\n return this;\n }\n\n /**\n * Determine whether the value attached to `key` is present\n *\n * @param {OverscaledTileID} tileID the key to be looked-up\n * @returns {boolean} whether the cache has this value\n * @private\n */\n has(tileID: OverscaledTileID): boolean {\n return tileID.wrapped().key in this.data;\n }\n\n /**\n * Get the value attached to a specific key and remove data from cache.\n * If the key is not found, returns `null`\n *\n * @param {OverscaledTileID} tileID the key to look up\n * @returns {*} the data, or null if it isn't found\n * @private\n */\n getAndRemove(tileID: OverscaledTileID): ?Tile {\n if (!this.has(tileID)) { return null; }\n return this._getAndRemoveByKey(tileID.wrapped().key);\n }\n\n /*\n * Get and remove the value with the specified key.\n */\n _getAndRemoveByKey(key: string): ?Tile {\n const data = this.data[key].shift();\n if (data.timeout) clearTimeout(data.timeout);\n\n if (this.data[key].length === 0) {\n delete this.data[key];\n }\n this.order.splice(this.order.indexOf(key), 1);\n\n return data.value;\n }\n\n /*\n * Get the value with the specified (wrapped tile) key.\n */\n getByKey(key: string): ?Tile {\n const data = this.data[key];\n return data ? data[0].value : null;\n }\n\n /**\n * Get the value attached to a specific key without removing data\n * from the cache. If the key is not found, returns `null`\n *\n * @param {OverscaledTileID} tileID the key to look up\n * @returns {*} the data, or null if it isn't found\n * @private\n */\n get(tileID: OverscaledTileID): ?Tile {\n if (!this.has(tileID)) { return null; }\n\n const data = this.data[tileID.wrapped().key][0];\n return data.value;\n }\n\n /**\n * Remove a key/value combination from the cache.\n *\n * @param {OverscaledTileID} tileID the key for the pair to delete\n * @param {Tile} value If a value is provided, remove that exact version of the value.\n * @returns {TileCache} this cache\n * @private\n */\n remove(tileID: OverscaledTileID, value: ?{ value: Tile, timeout: ?TimeoutID}) {\n if (!this.has(tileID)) { return this; }\n const key = tileID.wrapped().key;\n\n const dataIndex = value === undefined ? 0 : this.data[key].indexOf(value);\n const data = this.data[key][dataIndex];\n this.data[key].splice(dataIndex, 1);\n if (data.timeout) clearTimeout(data.timeout);\n if (this.data[key].length === 0) {\n delete this.data[key];\n }\n this.onRemove(data.value);\n this.order.splice(this.order.indexOf(key), 1);\n\n return this;\n }\n\n /**\n * Change the max size of the cache.\n *\n * @param {number} max the max size of the cache\n * @returns {TileCache} this cache\n * @private\n */\n setMaxSize(max: number): TileCache {\n this.max = max;\n\n while (this.order.length > this.max) {\n const removedData = this._getAndRemoveByKey(this.order[0]);\n if (removedData) this.onRemove(removedData);\n }\n\n return this;\n }\n\n /**\n * Remove entries that do not pass a filter function. Used for removing\n * stale tiles from the cache.\n *\n * @param {function} filterFn Determines whether the tile is filtered. If the supplied function returns false, the tile will be filtered out.\n */\n filter(filterFn: (tile: Tile) => boolean) {\n const removed = [];\n for (const key in this.data) {\n for (const entry of this.data[key]) {\n if (!filterFn(entry.value)) {\n removed.push(entry);\n }\n }\n }\n for (const r of removed) {\n this.remove(r.value.tileID, r);\n }\n }\n}\n\nexport default TileCache;\n","// @flow\nimport assert from 'assert';\n\nimport type {StructArray} from '../util/struct_array';\nimport type {TriangleIndexArray, LineIndexArray, LineStripIndexArray} from '../data/index_array_type';\nimport type Context from '../gl/context';\n\nclass IndexBuffer {\n context: Context;\n buffer: WebGLBuffer;\n dynamicDraw: boolean;\n\n constructor(context: Context, array: TriangleIndexArray | LineIndexArray | LineStripIndexArray, dynamicDraw?: boolean) {\n this.context = context;\n const gl = context.gl;\n this.buffer = gl.createBuffer();\n this.dynamicDraw = Boolean(dynamicDraw);\n\n // The bound index buffer is part of vertex array object state. We don't want to\n // modify whatever VAO happens to be currently bound, so make sure the default\n // vertex array provided by the context is bound instead.\n this.context.unbindVAO();\n\n context.bindElementBuffer.set(this.buffer);\n gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, array.arrayBuffer, this.dynamicDraw ? gl.DYNAMIC_DRAW : gl.STATIC_DRAW);\n\n if (!this.dynamicDraw) {\n delete array.arrayBuffer;\n }\n }\n\n bind() {\n this.context.bindElementBuffer.set(this.buffer);\n }\n\n updateData(array: StructArray) {\n const gl = this.context.gl;\n assert(this.dynamicDraw);\n // The right VAO will get this buffer re-bound later in VertexArrayObject#bind\n // See https://github.com/mapbox/mapbox-gl-js/issues/5620\n this.context.unbindVAO();\n this.bind();\n gl.bufferSubData(gl.ELEMENT_ARRAY_BUFFER, 0, array.arrayBuffer);\n }\n\n destroy() {\n const gl = this.context.gl;\n if (this.buffer) {\n gl.deleteBuffer(this.buffer);\n delete this.buffer;\n }\n }\n}\n\nexport default IndexBuffer;\n","// @flow\n\nimport assert from 'assert';\n\nimport type {\n StructArray,\n StructArrayMember\n} from '../util/struct_array';\n\nimport type Program from '../render/program';\nimport type Context from '../gl/context';\n\n/**\n * @enum {string} AttributeType\n * @private\n * @readonly\n */\nconst AttributeType = {\n Int8: 'BYTE',\n Uint8: 'UNSIGNED_BYTE',\n Int16: 'SHORT',\n Uint16: 'UNSIGNED_SHORT',\n Int32: 'INT',\n Uint32: 'UNSIGNED_INT',\n Float32: 'FLOAT'\n};\n\n/**\n * The `VertexBuffer` class turns a `StructArray` into a WebGL buffer. Each member of the StructArray's\n * Struct type is converted to a WebGL atribute.\n * @private\n */\nclass VertexBuffer {\n length: number;\n attributes: $ReadOnlyArray;\n itemSize: number;\n dynamicDraw: ?boolean;\n context: Context;\n buffer: WebGLBuffer;\n\n /**\n * @param dynamicDraw Whether this buffer will be repeatedly updated.\n * @private\n */\n constructor(context: Context, array: StructArray, attributes: $ReadOnlyArray, dynamicDraw?: boolean) {\n this.length = array.length;\n this.attributes = attributes;\n this.itemSize = array.bytesPerElement;\n this.dynamicDraw = dynamicDraw;\n\n this.context = context;\n const gl = context.gl;\n this.buffer = gl.createBuffer();\n context.bindVertexBuffer.set(this.buffer);\n gl.bufferData(gl.ARRAY_BUFFER, array.arrayBuffer, this.dynamicDraw ? gl.DYNAMIC_DRAW : gl.STATIC_DRAW);\n\n if (!this.dynamicDraw) {\n delete array.arrayBuffer;\n }\n }\n\n bind() {\n this.context.bindVertexBuffer.set(this.buffer);\n }\n\n updateData(array: StructArray) {\n assert(array.length === this.length);\n const gl = this.context.gl;\n this.bind();\n gl.bufferSubData(gl.ARRAY_BUFFER, 0, array.arrayBuffer);\n }\n\n enableAttributes(gl: WebGLRenderingContext, program: Program<*>) {\n for (let j = 0; j < this.attributes.length; j++) {\n const member = this.attributes[j];\n const attribIndex: number | void = program.attributes[member.name];\n if (attribIndex !== undefined) {\n gl.enableVertexAttribArray(attribIndex);\n }\n }\n }\n\n /**\n * Set the attribute pointers in a WebGL context\n * @param gl The WebGL context\n * @param program The active WebGL program\n * @param vertexOffset Index of the starting vertex of the segment\n */\n setVertexAttribPointers(gl: WebGLRenderingContext, program: Program<*>, vertexOffset: ?number) {\n for (let j = 0; j < this.attributes.length; j++) {\n const member = this.attributes[j];\n const attribIndex: number | void = program.attributes[member.name];\n\n if (attribIndex !== undefined) {\n gl.vertexAttribPointer(\n attribIndex,\n member.components,\n (gl: any)[AttributeType[member.type]],\n false,\n this.itemSize,\n member.offset + (this.itemSize * (vertexOffset || 0))\n );\n }\n }\n }\n\n /**\n * Destroy the GL buffer bound to the given WebGL context\n */\n destroy() {\n const gl = this.context.gl;\n if (this.buffer) {\n gl.deleteBuffer(this.buffer);\n delete this.buffer;\n }\n }\n}\n\nexport default VertexBuffer;\n","// @flow\n\nimport Color from '../style-spec/util/color';\n\nimport type Context from './context';\nimport type {\n BlendFuncType,\n BlendEquationType,\n ColorMaskType,\n DepthRangeType,\n DepthMaskType,\n StencilFuncType,\n StencilOpType,\n DepthFuncType,\n TextureUnitType,\n ViewportType,\n CullFaceModeType,\n FrontFaceType,\n} from './types';\n\nexport interface Value {\n current: T;\n default: T;\n dirty: boolean;\n get(): T;\n setDefault(): void;\n set(value: T): void;\n}\n\nclass BaseValue implements Value {\n gl: WebGLRenderingContext;\n current: T;\n default: T;\n dirty: boolean;\n\n constructor(context: Context) {\n this.gl = context.gl;\n this.default = this.getDefault();\n this.current = this.default;\n this.dirty = false;\n }\n\n get(): T {\n return this.current;\n }\n set(value: T) { // eslint-disable-line\n // overridden in child classes;\n }\n\n getDefault(): T {\n return this.default; // overriden in child classes\n }\n setDefault() {\n this.set(this.default);\n }\n}\n\nexport class ClearColor extends BaseValue {\n getDefault(): Color {\n return Color.transparent;\n }\n set(v: Color) {\n const c = this.current;\n if (v.r === c.r && v.g === c.g && v.b === c.b && v.a === c.a && !this.dirty) return;\n this.gl.clearColor(v.r, v.g, v.b, v.a);\n this.current = v;\n this.dirty = false;\n }\n}\n\nexport class ClearDepth extends BaseValue {\n getDefault(): number {\n return 1;\n }\n set(v: number) {\n if (v === this.current && !this.dirty) return;\n this.gl.clearDepth(v);\n this.current = v;\n this.dirty = false;\n }\n}\n\nexport class ClearStencil extends BaseValue {\n getDefault(): number {\n return 0;\n }\n set(v: number) {\n if (v === this.current && !this.dirty) return;\n this.gl.clearStencil(v);\n this.current = v;\n this.dirty = false;\n }\n}\n\nexport class ColorMask extends BaseValue {\n getDefault(): ColorMaskType {\n return [true, true, true, true];\n }\n set(v: ColorMaskType) {\n const c = this.current;\n if (v[0] === c[0] && v[1] === c[1] && v[2] === c[2] && v[3] === c[3] && !this.dirty) return;\n this.gl.colorMask(v[0], v[1], v[2], v[3]);\n this.current = v;\n this.dirty = false;\n }\n}\n\nexport class DepthMask extends BaseValue {\n getDefault(): DepthMaskType {\n return true;\n }\n set(v: DepthMaskType): void {\n if (v === this.current && !this.dirty) return;\n this.gl.depthMask(v);\n this.current = v;\n this.dirty = false;\n }\n}\n\nexport class StencilMask extends BaseValue {\n getDefault(): number {\n return 0xFF;\n }\n set(v: number): void {\n if (v === this.current && !this.dirty) return;\n this.gl.stencilMask(v);\n this.current = v;\n this.dirty = false;\n }\n}\n\nexport class StencilFunc extends BaseValue {\n getDefault(): StencilFuncType {\n return {\n func: this.gl.ALWAYS,\n ref: 0,\n mask: 0xFF\n };\n }\n set(v: StencilFuncType): void {\n const c = this.current;\n if (v.func === c.func && v.ref === c.ref && v.mask === c.mask && !this.dirty) return;\n this.gl.stencilFunc(v.func, v.ref, v.mask);\n this.current = v;\n this.dirty = false;\n }\n}\n\nexport class StencilOp extends BaseValue {\n getDefault(): StencilOpType {\n const gl = this.gl;\n return [gl.KEEP, gl.KEEP, gl.KEEP];\n }\n set(v: StencilOpType) {\n const c = this.current;\n if (v[0] === c[0] && v[1] === c[1] && v[2] === c[2] && !this.dirty) return;\n this.gl.stencilOp(v[0], v[1], v[2]);\n this.current = v;\n this.dirty = false;\n }\n}\n\nexport class StencilTest extends BaseValue {\n getDefault(): boolean {\n return false;\n }\n set(v: boolean) {\n if (v === this.current && !this.dirty) return;\n const gl = this.gl;\n if (v) {\n gl.enable(gl.STENCIL_TEST);\n } else {\n gl.disable(gl.STENCIL_TEST);\n }\n this.current = v;\n this.dirty = false;\n }\n}\n\nexport class DepthRange extends BaseValue {\n getDefault(): DepthRangeType {\n return [0, 1];\n }\n set(v: DepthRangeType) {\n const c = this.current;\n if (v[0] === c[0] && v[1] === c[1] && !this.dirty) return;\n this.gl.depthRange(v[0], v[1]);\n this.current = v;\n this.dirty = false;\n }\n}\n\nexport class DepthTest extends BaseValue {\n getDefault(): boolean {\n return false;\n }\n set(v: boolean) {\n if (v === this.current && !this.dirty) return;\n const gl = this.gl;\n if (v) {\n gl.enable(gl.DEPTH_TEST);\n } else {\n gl.disable(gl.DEPTH_TEST);\n }\n this.current = v;\n this.dirty = false;\n }\n}\n\nexport class DepthFunc extends BaseValue {\n getDefault(): DepthFuncType {\n return this.gl.LESS;\n }\n set(v: DepthFuncType) {\n if (v === this.current && !this.dirty) return;\n this.gl.depthFunc(v);\n this.current = v;\n this.dirty = false;\n }\n}\n\nexport class Blend extends BaseValue {\n getDefault(): boolean {\n return false;\n }\n set(v: boolean) {\n if (v === this.current && !this.dirty) return;\n const gl = this.gl;\n if (v) {\n gl.enable(gl.BLEND);\n } else {\n gl.disable(gl.BLEND);\n }\n this.current = v;\n this.dirty = false;\n }\n}\n\nexport class BlendFunc extends BaseValue {\n getDefault(): BlendFuncType {\n const gl = this.gl;\n return [gl.ONE, gl.ZERO];\n }\n set(v: BlendFuncType) {\n const c = this.current;\n if (v[0] === c[0] && v[1] === c[1] && !this.dirty) return;\n this.gl.blendFunc(v[0], v[1]);\n this.current = v;\n this.dirty = false;\n }\n}\n\nexport class BlendColor extends BaseValue {\n getDefault(): Color {\n return Color.transparent;\n }\n set(v: Color) {\n const c = this.current;\n if (v.r === c.r && v.g === c.g && v.b === c.b && v.a === c.a && !this.dirty) return;\n this.gl.blendColor(v.r, v.g, v.b, v.a);\n this.current = v;\n this.dirty = false;\n }\n}\n\nexport class BlendEquation extends BaseValue {\n getDefault(): BlendEquationType {\n return this.gl.FUNC_ADD;\n }\n set(v: BlendEquationType) {\n if (v === this.current && !this.dirty) return;\n this.gl.blendEquation(v);\n this.current = v;\n this.dirty = false;\n }\n}\n\nexport class CullFace extends BaseValue {\n getDefault(): boolean {\n return false;\n }\n set(v: boolean) {\n if (v === this.current && !this.dirty) return;\n const gl = this.gl;\n if (v) {\n gl.enable(gl.CULL_FACE);\n } else {\n gl.disable(gl.CULL_FACE);\n }\n this.current = v;\n this.dirty = false;\n }\n}\n\nexport class CullFaceSide extends BaseValue {\n getDefault(): CullFaceModeType {\n return this.gl.BACK;\n }\n set(v: CullFaceModeType) {\n if (v === this.current && !this.dirty) return;\n this.gl.cullFace(v);\n this.current = v;\n this.dirty = false;\n }\n}\n\nexport class FrontFace extends BaseValue {\n getDefault(): FrontFaceType {\n return this.gl.CCW;\n }\n set(v: FrontFaceType) {\n if (v === this.current && !this.dirty) return;\n this.gl.frontFace(v);\n this.current = v;\n this.dirty = false;\n }\n}\n\nexport class Program extends BaseValue {\n getDefault(): WebGLProgram {\n return null;\n }\n set(v: ?WebGLProgram) {\n if (v === this.current && !this.dirty) return;\n this.gl.useProgram(v);\n this.current = v;\n this.dirty = false;\n }\n}\n\nexport class ActiveTextureUnit extends BaseValue {\n getDefault(): TextureUnitType {\n return this.gl.TEXTURE0;\n }\n set(v: TextureUnitType) {\n if (v === this.current && !this.dirty) return;\n this.gl.activeTexture(v);\n this.current = v;\n this.dirty = false;\n }\n}\n\nexport class Viewport extends BaseValue {\n getDefault(): ViewportType {\n const gl = this.gl;\n return [0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight];\n }\n set(v: ViewportType) {\n const c = this.current;\n if (v[0] === c[0] && v[1] === c[1] && v[2] === c[2] && v[3] === c[3] && !this.dirty) return;\n this.gl.viewport(v[0], v[1], v[2], v[3]);\n this.current = v;\n this.dirty = false;\n }\n}\n\nexport class BindFramebuffer extends BaseValue {\n getDefault(): WebGLFramebuffer {\n return null;\n }\n set(v: ?WebGLFramebuffer) {\n if (v === this.current && !this.dirty) return;\n const gl = this.gl;\n gl.bindFramebuffer(gl.FRAMEBUFFER, v);\n this.current = v;\n this.dirty = false;\n }\n}\n\nexport class BindRenderbuffer extends BaseValue {\n getDefault(): WebGLRenderbuffer {\n return null;\n }\n set(v: ?WebGLRenderbuffer) {\n if (v === this.current && !this.dirty) return;\n const gl = this.gl;\n gl.bindRenderbuffer(gl.RENDERBUFFER, v);\n this.current = v;\n this.dirty = false;\n }\n}\n\nexport class BindTexture extends BaseValue {\n getDefault(): WebGLTexture {\n return null;\n }\n set(v: ?WebGLTexture) {\n if (v === this.current && !this.dirty) return;\n const gl = this.gl;\n gl.bindTexture(gl.TEXTURE_2D, v);\n this.current = v;\n this.dirty = false;\n }\n}\n\nexport class BindVertexBuffer extends BaseValue {\n getDefault(): WebGLBuffer {\n return null;\n }\n set(v: ?WebGLBuffer) {\n if (v === this.current && !this.dirty) return;\n const gl = this.gl;\n gl.bindBuffer(gl.ARRAY_BUFFER, v);\n this.current = v;\n this.dirty = false;\n }\n}\n\nexport class BindElementBuffer extends BaseValue {\n getDefault(): WebGLBuffer {\n return null;\n }\n set(v: ?WebGLBuffer) {\n // Always rebind\n const gl = this.gl;\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, v);\n this.current = v;\n this.dirty = false;\n }\n}\n\nexport class BindVertexArrayOES extends BaseValue {\n vao: any;\n\n constructor(context: Context) {\n super(context);\n this.vao = context.extVertexArrayObject;\n }\n getDefault(): any {\n return null;\n }\n set(v: any) {\n if (!this.vao || v === this.current && !this.dirty) return;\n this.vao.bindVertexArrayOES(v);\n this.current = v;\n this.dirty = false;\n }\n}\n\nexport class PixelStoreUnpack extends BaseValue {\n getDefault(): number {\n return 4;\n }\n set(v: number) {\n if (v === this.current && !this.dirty) return;\n const gl = this.gl;\n gl.pixelStorei(gl.UNPACK_ALIGNMENT, v);\n this.current = v;\n this.dirty = false;\n }\n}\n\nexport class PixelStoreUnpackPremultiplyAlpha extends BaseValue {\n getDefault(): boolean {\n return false;\n }\n set(v: boolean): void {\n if (v === this.current && !this.dirty) return;\n const gl = this.gl;\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, (v: any));\n this.current = v;\n this.dirty = false;\n }\n}\n\nexport class PixelStoreUnpackFlipY extends BaseValue {\n getDefault(): boolean {\n return false;\n }\n set(v: boolean): void {\n if (v === this.current && !this.dirty) return;\n const gl = this.gl;\n gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, (v: any));\n this.current = v;\n this.dirty = false;\n }\n}\n\nclass FramebufferAttachment extends BaseValue {\n parent: WebGLFramebuffer;\n context: Context;\n\n constructor(context: Context, parent: WebGLFramebuffer) {\n super(context);\n this.context = context;\n this.parent = parent;\n }\n getDefault() {\n return null;\n }\n}\n\nexport class ColorAttachment extends FramebufferAttachment {\n setDirty() {\n this.dirty = true;\n }\n set(v: ?WebGLTexture): void {\n if (v === this.current && !this.dirty) return;\n this.context.bindFramebuffer.set(this.parent);\n // note: it's possible to attach a renderbuffer to the color\n // attachment point, but thus far MBGL only uses textures for color\n const gl = this.gl;\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, v, 0);\n this.current = v;\n this.dirty = false;\n }\n}\n\nexport class DepthAttachment extends FramebufferAttachment {\n set(v: ?WebGLRenderbuffer): void {\n if (v === this.current && !this.dirty) return;\n this.context.bindFramebuffer.set(this.parent);\n // note: it's possible to attach a texture to the depth attachment\n // point, but thus far MBGL only uses renderbuffers for depth\n const gl = this.gl;\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, v);\n this.current = v;\n this.dirty = false;\n }\n}\n","// @flow\nimport {ColorAttachment, DepthAttachment} from './value';\nimport assert from 'assert';\n\nimport type Context from './context';\n\nclass Framebuffer {\n context: Context;\n width: number;\n height: number;\n framebuffer: WebGLFramebuffer;\n colorAttachment: ColorAttachment;\n depthAttachment: DepthAttachment;\n\n constructor(context: Context, width: number, height: number, hasDepth: boolean) {\n this.context = context;\n this.width = width;\n this.height = height;\n const gl = context.gl;\n const fbo = this.framebuffer = gl.createFramebuffer();\n\n this.colorAttachment = new ColorAttachment(context, fbo);\n if (hasDepth) {\n this.depthAttachment = new DepthAttachment(context, fbo);\n }\n assert(gl.checkFramebufferStatus(gl.FRAMEBUFFER) === gl.FRAMEBUFFER_COMPLETE);\n }\n\n destroy() {\n const gl = this.context.gl;\n\n const texture = this.colorAttachment.get();\n if (texture) gl.deleteTexture(texture);\n\n if (this.depthAttachment) {\n const renderbuffer = this.depthAttachment.get();\n if (renderbuffer) gl.deleteRenderbuffer(renderbuffer);\n }\n\n gl.deleteFramebuffer(this.framebuffer);\n }\n}\n\nexport default Framebuffer;\n","// @flow\nimport type {DepthFuncType, DepthMaskType, DepthRangeType} from './types';\n\nconst ALWAYS = 0x0207;\n\nclass DepthMode {\n func: DepthFuncType;\n mask: DepthMaskType;\n range: DepthRangeType;\n\n // DepthMask enums\n static ReadOnly: boolean;\n static ReadWrite: boolean;\n\n constructor(depthFunc: DepthFuncType, depthMask: DepthMaskType, depthRange: DepthRangeType) {\n this.func = depthFunc;\n this.mask = depthMask;\n this.range = depthRange;\n }\n\n static disabled: $ReadOnly;\n}\n\nDepthMode.ReadOnly = false;\nDepthMode.ReadWrite = true;\n\nDepthMode.disabled = new DepthMode(ALWAYS, DepthMode.ReadOnly, [0, 1]);\n\nexport default DepthMode;\n","// @flow\nimport type {StencilOpConstant, StencilTest} from './types';\n\nconst ALWAYS = 0x0207;\nconst KEEP = 0x1E00;\n\nclass StencilMode {\n test: StencilTest;\n ref: number;\n mask: number;\n fail: StencilOpConstant;\n depthFail: StencilOpConstant;\n pass: StencilOpConstant;\n\n constructor(test: StencilTest, ref: number, mask: number, fail: StencilOpConstant,\n depthFail: StencilOpConstant, pass: StencilOpConstant) {\n this.test = test;\n this.ref = ref;\n this.mask = mask;\n this.fail = fail;\n this.depthFail = depthFail;\n this.pass = pass;\n }\n\n static disabled: $ReadOnly;\n}\n\nStencilMode.disabled = new StencilMode({func: ALWAYS, mask: 0}, 0, 0, KEEP, KEEP, KEEP);\n\nexport default StencilMode;\n","// @flow\nimport Color from '../style-spec/util/color';\n\nimport type {BlendFuncType, ColorMaskType} from './types';\n\nconst ZERO = 0x0000;\nconst ONE = 0x0001;\nconst ONE_MINUS_SRC_ALPHA = 0x0303;\n\nclass ColorMode {\n blendFunction: BlendFuncType;\n blendColor: Color;\n mask: ColorMaskType;\n\n constructor(blendFunction: BlendFuncType, blendColor: Color, mask: ColorMaskType) {\n this.blendFunction = blendFunction;\n this.blendColor = blendColor;\n this.mask = mask;\n }\n\n static Replace: BlendFuncType;\n\n static disabled: $ReadOnly;\n static unblended: $ReadOnly;\n static alphaBlended: $ReadOnly;\n}\n\nColorMode.Replace = [ONE, ZERO];\n\nColorMode.disabled = new ColorMode(ColorMode.Replace, Color.transparent, [false, false, false, false]);\nColorMode.unblended = new ColorMode(ColorMode.Replace, Color.transparent, [true, true, true, true]);\nColorMode.alphaBlended = new ColorMode([ONE, ONE_MINUS_SRC_ALPHA], Color.transparent, [true, true, true, true]);\n\nexport default ColorMode;\n","// @flow\n\nimport type {CullFaceModeType, FrontFaceType} from './types';\n\nconst BACK = 0x0405;\nconst CCW = 0x0901;\n\nclass CullFaceMode {\n enable: boolean;\n mode: CullFaceModeType;\n frontFace: FrontFaceType;\n\n constructor(enable: boolean, mode: CullFaceModeType, frontFace: FrontFaceType) {\n this.enable = enable;\n this.mode = mode;\n this.frontFace = frontFace;\n }\n\n static disabled: $ReadOnly;\n static backCCW: $ReadOnly;\n}\n\nCullFaceMode.disabled = new CullFaceMode(false, BACK, CCW);\nCullFaceMode.backCCW = new CullFaceMode(true, BACK, CCW);\n\nexport default CullFaceMode;\n","// @flow\nimport IndexBuffer from './index_buffer';\n\nimport VertexBuffer from './vertex_buffer';\nimport Framebuffer from './framebuffer';\nimport DepthMode from './depth_mode';\nimport StencilMode from './stencil_mode';\nimport ColorMode from './color_mode';\nimport CullFaceMode from './cull_face_mode';\nimport {deepEqual} from '../util/util';\nimport {ClearColor, ClearDepth, ClearStencil, ColorMask, DepthMask, StencilMask, StencilFunc, StencilOp, StencilTest, DepthRange, DepthTest, DepthFunc, Blend, BlendFunc, BlendColor, BlendEquation, CullFace, CullFaceSide, FrontFace, Program, ActiveTextureUnit, Viewport, BindFramebuffer, BindRenderbuffer, BindTexture, BindVertexBuffer, BindElementBuffer, BindVertexArrayOES, PixelStoreUnpack, PixelStoreUnpackPremultiplyAlpha, PixelStoreUnpackFlipY} from './value';\n\nimport type {TriangleIndexArray, LineIndexArray, LineStripIndexArray} from '../data/index_array_type';\nimport type {\n StructArray,\n StructArrayMember\n} from '../util/struct_array';\nimport type Color from '../style-spec/util/color';\n\ntype ClearArgs = {\n color?: Color,\n depth?: number,\n stencil?: number\n};\n\nclass Context {\n gl: WebGLRenderingContext;\n extVertexArrayObject: any;\n currentNumAttributes: ?number;\n maxTextureSize: number;\n\n clearColor: ClearColor;\n clearDepth: ClearDepth;\n clearStencil: ClearStencil;\n colorMask: ColorMask;\n depthMask: DepthMask;\n stencilMask: StencilMask;\n stencilFunc: StencilFunc;\n stencilOp: StencilOp;\n stencilTest: StencilTest;\n depthRange: DepthRange;\n depthTest: DepthTest;\n depthFunc: DepthFunc;\n blend: Blend;\n blendFunc: BlendFunc;\n blendColor: BlendColor;\n blendEquation: BlendEquation;\n cullFace: CullFace;\n cullFaceSide: CullFaceSide;\n frontFace: FrontFace;\n program: Program;\n activeTexture: ActiveTextureUnit;\n viewport: Viewport;\n bindFramebuffer: BindFramebuffer;\n bindRenderbuffer: BindRenderbuffer;\n bindTexture: BindTexture;\n bindVertexBuffer: BindVertexBuffer;\n bindElementBuffer: BindElementBuffer;\n bindVertexArrayOES: BindVertexArrayOES;\n pixelStoreUnpack: PixelStoreUnpack;\n pixelStoreUnpackPremultiplyAlpha: PixelStoreUnpackPremultiplyAlpha;\n pixelStoreUnpackFlipY: PixelStoreUnpackFlipY;\n\n extTextureFilterAnisotropic: any;\n extTextureFilterAnisotropicMax: any;\n extTextureHalfFloat: any;\n extRenderToTextureHalfFloat: any;\n extTimerQuery: any;\n\n constructor(gl: WebGLRenderingContext) {\n this.gl = gl;\n this.extVertexArrayObject = this.gl.getExtension('OES_vertex_array_object');\n\n this.clearColor = new ClearColor(this);\n this.clearDepth = new ClearDepth(this);\n this.clearStencil = new ClearStencil(this);\n this.colorMask = new ColorMask(this);\n this.depthMask = new DepthMask(this);\n this.stencilMask = new StencilMask(this);\n this.stencilFunc = new StencilFunc(this);\n this.stencilOp = new StencilOp(this);\n this.stencilTest = new StencilTest(this);\n this.depthRange = new DepthRange(this);\n this.depthTest = new DepthTest(this);\n this.depthFunc = new DepthFunc(this);\n this.blend = new Blend(this);\n this.blendFunc = new BlendFunc(this);\n this.blendColor = new BlendColor(this);\n this.blendEquation = new BlendEquation(this);\n this.cullFace = new CullFace(this);\n this.cullFaceSide = new CullFaceSide(this);\n this.frontFace = new FrontFace(this);\n this.program = new Program(this);\n this.activeTexture = new ActiveTextureUnit(this);\n this.viewport = new Viewport(this);\n this.bindFramebuffer = new BindFramebuffer(this);\n this.bindRenderbuffer = new BindRenderbuffer(this);\n this.bindTexture = new BindTexture(this);\n this.bindVertexBuffer = new BindVertexBuffer(this);\n this.bindElementBuffer = new BindElementBuffer(this);\n this.bindVertexArrayOES = this.extVertexArrayObject && new BindVertexArrayOES(this);\n this.pixelStoreUnpack = new PixelStoreUnpack(this);\n this.pixelStoreUnpackPremultiplyAlpha = new PixelStoreUnpackPremultiplyAlpha(this);\n this.pixelStoreUnpackFlipY = new PixelStoreUnpackFlipY(this);\n\n this.extTextureFilterAnisotropic = (\n gl.getExtension('EXT_texture_filter_anisotropic') ||\n gl.getExtension('MOZ_EXT_texture_filter_anisotropic') ||\n gl.getExtension('WEBKIT_EXT_texture_filter_anisotropic')\n );\n if (this.extTextureFilterAnisotropic) {\n this.extTextureFilterAnisotropicMax = gl.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT);\n }\n\n this.extTextureHalfFloat = gl.getExtension('OES_texture_half_float');\n if (this.extTextureHalfFloat) {\n gl.getExtension('OES_texture_half_float_linear');\n this.extRenderToTextureHalfFloat = gl.getExtension('EXT_color_buffer_half_float');\n }\n\n this.extTimerQuery = gl.getExtension('EXT_disjoint_timer_query');\n this.maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);\n }\n\n setDefault() {\n this.unbindVAO();\n\n this.clearColor.setDefault();\n this.clearDepth.setDefault();\n this.clearStencil.setDefault();\n this.colorMask.setDefault();\n this.depthMask.setDefault();\n this.stencilMask.setDefault();\n this.stencilFunc.setDefault();\n this.stencilOp.setDefault();\n this.stencilTest.setDefault();\n this.depthRange.setDefault();\n this.depthTest.setDefault();\n this.depthFunc.setDefault();\n this.blend.setDefault();\n this.blendFunc.setDefault();\n this.blendColor.setDefault();\n this.blendEquation.setDefault();\n this.cullFace.setDefault();\n this.cullFaceSide.setDefault();\n this.frontFace.setDefault();\n this.program.setDefault();\n this.activeTexture.setDefault();\n this.bindFramebuffer.setDefault();\n this.pixelStoreUnpack.setDefault();\n this.pixelStoreUnpackPremultiplyAlpha.setDefault();\n this.pixelStoreUnpackFlipY.setDefault();\n }\n\n setDirty() {\n this.clearColor.dirty = true;\n this.clearDepth.dirty = true;\n this.clearStencil.dirty = true;\n this.colorMask.dirty = true;\n this.depthMask.dirty = true;\n this.stencilMask.dirty = true;\n this.stencilFunc.dirty = true;\n this.stencilOp.dirty = true;\n this.stencilTest.dirty = true;\n this.depthRange.dirty = true;\n this.depthTest.dirty = true;\n this.depthFunc.dirty = true;\n this.blend.dirty = true;\n this.blendFunc.dirty = true;\n this.blendColor.dirty = true;\n this.blendEquation.dirty = true;\n this.cullFace.dirty = true;\n this.cullFaceSide.dirty = true;\n this.frontFace.dirty = true;\n this.program.dirty = true;\n this.activeTexture.dirty = true;\n this.viewport.dirty = true;\n this.bindFramebuffer.dirty = true;\n this.bindRenderbuffer.dirty = true;\n this.bindTexture.dirty = true;\n this.bindVertexBuffer.dirty = true;\n this.bindElementBuffer.dirty = true;\n if (this.extVertexArrayObject) {\n this.bindVertexArrayOES.dirty = true;\n }\n this.pixelStoreUnpack.dirty = true;\n this.pixelStoreUnpackPremultiplyAlpha.dirty = true;\n this.pixelStoreUnpackFlipY.dirty = true;\n }\n\n createIndexBuffer(array: TriangleIndexArray | LineIndexArray | LineStripIndexArray, dynamicDraw?: boolean) {\n return new IndexBuffer(this, array, dynamicDraw);\n }\n\n createVertexBuffer(array: StructArray, attributes: $ReadOnlyArray, dynamicDraw?: boolean) {\n return new VertexBuffer(this, array, attributes, dynamicDraw);\n }\n\n createRenderbuffer(storageFormat: number, width: number, height: number) {\n const gl = this.gl;\n\n const rbo = gl.createRenderbuffer();\n this.bindRenderbuffer.set(rbo);\n gl.renderbufferStorage(gl.RENDERBUFFER, storageFormat, width, height);\n this.bindRenderbuffer.set(null);\n\n return rbo;\n }\n\n createFramebuffer(width: number, height: number, hasDepth: boolean) {\n return new Framebuffer(this, width, height, hasDepth);\n }\n\n clear({color, depth}: ClearArgs) {\n const gl = this.gl;\n let mask = 0;\n\n if (color) {\n mask |= gl.COLOR_BUFFER_BIT;\n this.clearColor.set(color);\n this.colorMask.set([true, true, true, true]);\n }\n\n if (typeof depth !== 'undefined') {\n mask |= gl.DEPTH_BUFFER_BIT;\n\n // Workaround for platforms where clearDepth doesn't seem to work\n // without reseting the depthRange. See https://github.com/mapbox/mapbox-gl-js/issues/3437\n this.depthRange.set([0, 1]);\n\n this.clearDepth.set(depth);\n this.depthMask.set(true);\n }\n\n // See note in Painter#clearStencil: implement this the easy way once GPU bug/workaround is fixed upstream\n // if (typeof stencil !== 'undefined') {\n // mask |= gl.STENCIL_BUFFER_BIT;\n // this.clearStencil.set(stencil);\n // this.stencilMask.set(0xFF);\n // }\n\n gl.clear(mask);\n }\n\n setCullFace(cullFaceMode: $ReadOnly) {\n if (cullFaceMode.enable === false) {\n this.cullFace.set(false);\n } else {\n this.cullFace.set(true);\n this.cullFaceSide.set(cullFaceMode.mode);\n this.frontFace.set(cullFaceMode.frontFace);\n }\n }\n\n setDepthMode(depthMode: $ReadOnly) {\n if (depthMode.func === this.gl.ALWAYS && !depthMode.mask) {\n this.depthTest.set(false);\n } else {\n this.depthTest.set(true);\n this.depthFunc.set(depthMode.func);\n this.depthMask.set(depthMode.mask);\n this.depthRange.set(depthMode.range);\n }\n }\n\n setStencilMode(stencilMode: $ReadOnly) {\n if (stencilMode.test.func === this.gl.ALWAYS && !stencilMode.mask) {\n this.stencilTest.set(false);\n } else {\n this.stencilTest.set(true);\n this.stencilMask.set(stencilMode.mask);\n this.stencilOp.set([stencilMode.fail, stencilMode.depthFail, stencilMode.pass]);\n this.stencilFunc.set({\n func: stencilMode.test.func,\n ref: stencilMode.ref,\n mask: stencilMode.test.mask\n });\n }\n }\n\n setColorMode(colorMode: $ReadOnly) {\n if (deepEqual(colorMode.blendFunction, ColorMode.Replace)) {\n this.blend.set(false);\n } else {\n this.blend.set(true);\n this.blendFunc.set(colorMode.blendFunction);\n this.blendColor.set(colorMode.blendColor);\n }\n\n this.colorMask.set(colorMode.mask);\n }\n\n unbindVAO() {\n // Unbinding the VAO prevents other things (custom layers, new buffer creation) from\n // unintentionally changing the state of the last VAO used.\n if (this.extVertexArrayObject) {\n this.bindVertexArrayOES.set(null);\n }\n }\n}\n\nexport default Context;\n","// @flow\n\nimport {create as createSource} from './source';\n\nimport Tile from './tile';\nimport {Event, ErrorEvent, Evented} from '../util/evented';\nimport TileCache from './tile_cache';\nimport MercatorCoordinate from '../geo/mercator_coordinate';\nimport {keysDifference, values} from '../util/util';\nimport EXTENT from '../data/extent';\nimport Context from '../gl/context';\nimport Point from '@mapbox/point-geometry';\nimport browser from '../util/browser';\nimport {OverscaledTileID} from './tile_id';\nimport assert from 'assert';\nimport SourceFeatureState from './source_state';\n\nimport type {Source} from './source';\nimport type Map from '../ui/map';\nimport type Style from '../style/style';\nimport type Dispatcher from '../util/dispatcher';\nimport type Transform from '../geo/transform';\nimport type {TileState} from './tile';\nimport type {Callback} from '../types/callback';\nimport type {SourceSpecification} from '../style-spec/types';\n\n/**\n * `SourceCache` is responsible for\n *\n * - creating an instance of `Source`\n * - forwarding events from `Source`\n * - caching tiles loaded from an instance of `Source`\n * - loading the tiles needed to render a given viewport\n * - unloading the cached tiles not needed to render a given viewport\n *\n * @private\n */\nclass SourceCache extends Evented {\n id: string;\n dispatcher: Dispatcher;\n map: Map;\n style: Style;\n\n _source: Source;\n _sourceLoaded: boolean;\n _sourceErrored: boolean;\n _tiles: {[_: string]: Tile};\n _prevLng: number | void;\n _cache: TileCache;\n _timers: {[_: any]: TimeoutID};\n _cacheTimers: {[_: any]: TimeoutID};\n _maxTileCacheSize: ?number;\n _paused: boolean;\n _shouldReloadOnResume: boolean;\n _coveredTiles: {[_: string]: boolean};\n transform: Transform;\n _isIdRenderable: (id: string, symbolLayer?: boolean) => boolean;\n used: boolean;\n _state: SourceFeatureState;\n _loadedParentTiles: {[_: string]: ?Tile};\n\n static maxUnderzooming: number;\n static maxOverzooming: number;\n\n constructor(id: string, options: SourceSpecification, dispatcher: Dispatcher) {\n super();\n this.id = id;\n this.dispatcher = dispatcher;\n\n this.on('data', (e) => {\n // this._sourceLoaded signifies that the TileJSON is loaded if applicable.\n // if the source type does not come with a TileJSON, the flag signifies the\n // source data has loaded (i.e geojson has been tiled on the worker and is ready)\n if (e.dataType === 'source' && e.sourceDataType === 'metadata') this._sourceLoaded = true;\n\n // for sources with mutable data, this event fires when the underlying data\n // to a source is changed. (i.e. GeoJSONSource#setData and ImageSource#serCoordinates)\n if (this._sourceLoaded && !this._paused && e.dataType === \"source\" && e.sourceDataType === 'content') {\n this.reload();\n if (this.transform) {\n this.update(this.transform);\n }\n }\n });\n\n this.on('error', () => {\n this._sourceErrored = true;\n });\n\n this._source = createSource(id, options, dispatcher, this);\n\n this._tiles = {};\n this._cache = new TileCache(0, this._unloadTile.bind(this));\n this._timers = {};\n this._cacheTimers = {};\n this._maxTileCacheSize = null;\n this._loadedParentTiles = {};\n\n this._coveredTiles = {};\n this._state = new SourceFeatureState();\n }\n\n onAdd(map: Map) {\n this.map = map;\n this._maxTileCacheSize = map ? map._maxTileCacheSize : null;\n if (this._source && this._source.onAdd) {\n this._source.onAdd(map);\n }\n }\n\n onRemove(map: Map) {\n if (this._source && this._source.onRemove) {\n this._source.onRemove(map);\n }\n }\n\n /**\n * Return true if no tile data is pending, tiles will not change unless\n * an additional API call is received.\n * @private\n */\n loaded(): boolean {\n if (this._sourceErrored) { return true; }\n if (!this._sourceLoaded) { return false; }\n if (!this._source.loaded()) { return false; }\n for (const t in this._tiles) {\n const tile = this._tiles[t];\n if (tile.state !== 'loaded' && tile.state !== 'errored')\n return false;\n }\n return true;\n }\n\n getSource(): Source {\n return this._source;\n }\n\n pause() {\n this._paused = true;\n }\n\n resume() {\n if (!this._paused) return;\n const shouldReload = this._shouldReloadOnResume;\n this._paused = false;\n this._shouldReloadOnResume = false;\n if (shouldReload) this.reload();\n if (this.transform) this.update(this.transform);\n }\n\n _loadTile(tile: Tile, callback: Callback) {\n return this._source.loadTile(tile, callback);\n }\n\n _unloadTile(tile: Tile) {\n if (this._source.unloadTile)\n return this._source.unloadTile(tile, () => {});\n }\n\n _abortTile(tile: Tile) {\n if (this._source.abortTile)\n return this._source.abortTile(tile, () => {});\n }\n\n serialize() {\n return this._source.serialize();\n }\n\n prepare(context: Context) {\n if (this._source.prepare) {\n this._source.prepare();\n }\n\n this._state.coalesceChanges(this._tiles, this.map ? this.map.painter : null);\n for (const i in this._tiles) {\n const tile = this._tiles[i];\n tile.upload(context);\n tile.prepare(this.map.style.imageManager);\n }\n }\n\n /**\n * Return all tile ids ordered with z-order, and cast to numbers\n * @private\n */\n getIds(): Array {\n return (values(this._tiles): any).map((tile: Tile) => tile.tileID).sort(compareTileId).map(id => id.key);\n }\n\n getRenderableIds(symbolLayer?: boolean): Array {\n const renderables: Array = [];\n for (const id in this._tiles) {\n if (this._isIdRenderable(id, symbolLayer)) renderables.push(this._tiles[id]);\n }\n if (symbolLayer) {\n return renderables.sort((a_: Tile, b_: Tile) => {\n const a = a_.tileID;\n const b = b_.tileID;\n const rotatedA = (new Point(a.canonical.x, a.canonical.y))._rotate(this.transform.angle);\n const rotatedB = (new Point(b.canonical.x, b.canonical.y))._rotate(this.transform.angle);\n return a.overscaledZ - b.overscaledZ || rotatedB.y - rotatedA.y || rotatedB.x - rotatedA.x;\n }).map(tile => tile.tileID.key);\n }\n return renderables.map(tile => tile.tileID).sort(compareTileId).map(id => id.key);\n }\n\n hasRenderableParent(tileID: OverscaledTileID) {\n const parentTile = this.findLoadedParent(tileID, 0);\n if (parentTile) {\n return this._isIdRenderable(parentTile.tileID.key);\n }\n return false;\n }\n\n _isIdRenderable(id: string, symbolLayer?: boolean) {\n return this._tiles[id] && this._tiles[id].hasData() &&\n !this._coveredTiles[id] && (symbolLayer || !this._tiles[id].holdingForFade());\n }\n\n reload() {\n if (this._paused) {\n this._shouldReloadOnResume = true;\n return;\n }\n\n this._cache.reset();\n\n for (const i in this._tiles) {\n if (this._tiles[i].state !== \"errored\") this._reloadTile(i, 'reloading');\n }\n }\n\n _reloadTile(id: string, state: TileState) {\n const tile = this._tiles[id];\n\n // this potentially does not address all underlying\n // issues https://github.com/mapbox/mapbox-gl-js/issues/4252\n // - hard to tell without repro steps\n if (!tile) return;\n\n // The difference between \"loading\" tiles and \"reloading\" or \"expired\"\n // tiles is that \"reloading\"/\"expired\" tiles are \"renderable\".\n // Therefore, a \"loading\" tile cannot become a \"reloading\" tile without\n // first becoming a \"loaded\" tile.\n if (tile.state !== 'loading') {\n tile.state = state;\n }\n\n this._loadTile(tile, this._tileLoaded.bind(this, tile, id, state));\n }\n\n _tileLoaded(tile: Tile, id: string, previousState: TileState, err: ?Error) {\n if (err) {\n tile.state = 'errored';\n if ((err: any).status !== 404) this._source.fire(new ErrorEvent(err, {tile}));\n // continue to try loading parent/children tiles if a tile doesn't exist (404)\n else this.update(this.transform);\n return;\n }\n\n tile.timeAdded = browser.now();\n if (previousState === 'expired') tile.refreshedUponExpiration = true;\n this._setTileReloadTimer(id, tile);\n if (this.getSource().type === 'raster-dem' && tile.dem) this._backfillDEM(tile);\n this._state.initializeTileState(tile, this.map ? this.map.painter : null);\n\n this._source.fire(new Event('data', {dataType: 'source', tile, coord: tile.tileID}));\n }\n\n /**\n * For raster terrain source, backfill DEM to eliminate visible tile boundaries\n * @private\n */\n _backfillDEM(tile: Tile) {\n const renderables = this.getRenderableIds();\n for (let i = 0; i < renderables.length; i++) {\n const borderId = renderables[i];\n if (tile.neighboringTiles && tile.neighboringTiles[borderId]) {\n const borderTile = this.getTileByID(borderId);\n fillBorder(tile, borderTile);\n fillBorder(borderTile, tile);\n }\n }\n\n function fillBorder(tile, borderTile) {\n tile.needsHillshadePrepare = true;\n let dx = borderTile.tileID.canonical.x - tile.tileID.canonical.x;\n const dy = borderTile.tileID.canonical.y - tile.tileID.canonical.y;\n const dim = Math.pow(2, tile.tileID.canonical.z);\n const borderId = borderTile.tileID.key;\n if (dx === 0 && dy === 0) return;\n\n if (Math.abs(dy) > 1) {\n return;\n }\n if (Math.abs(dx) > 1) {\n // Adjust the delta coordinate for world wraparound.\n if (Math.abs(dx + dim) === 1) {\n dx += dim;\n } else if (Math.abs(dx - dim) === 1) {\n dx -= dim;\n }\n }\n if (!borderTile.dem || !tile.dem) return;\n tile.dem.backfillBorder(borderTile.dem, dx, dy);\n if (tile.neighboringTiles && tile.neighboringTiles[borderId])\n tile.neighboringTiles[borderId].backfilled = true;\n }\n }\n /**\n * Get a specific tile by TileID\n * @private\n */\n getTile(tileID: OverscaledTileID): Tile {\n return this.getTileByID(tileID.key);\n }\n\n /**\n * Get a specific tile by id\n * @private\n */\n getTileByID(id: string): Tile {\n return this._tiles[id];\n }\n\n /**\n * For a given set of tiles, retain children that are loaded and have a zoom\n * between `zoom` (exclusive) and `maxCoveringZoom` (inclusive)\n * @private\n */\n _retainLoadedChildren(\n idealTiles: {[_: any]: OverscaledTileID},\n zoom: number,\n maxCoveringZoom: number,\n retain: {[_: any]: OverscaledTileID}\n ) {\n for (const id in this._tiles) {\n let tile = this._tiles[id];\n\n // only consider renderable tiles up to maxCoveringZoom\n if (retain[id] ||\n !tile.hasData() ||\n tile.tileID.overscaledZ <= zoom ||\n tile.tileID.overscaledZ > maxCoveringZoom\n ) continue;\n\n // loop through parents and retain the topmost loaded one if found\n let topmostLoadedID = tile.tileID;\n while (tile && tile.tileID.overscaledZ > zoom + 1) {\n const parentID = tile.tileID.scaledTo(tile.tileID.overscaledZ - 1);\n\n tile = this._tiles[parentID.key];\n\n if (tile && tile.hasData()) {\n topmostLoadedID = parentID;\n }\n }\n\n // loop through ancestors of the topmost loaded child to see if there's one that needed it\n let tileID = topmostLoadedID;\n while (tileID.overscaledZ > zoom) {\n tileID = tileID.scaledTo(tileID.overscaledZ - 1);\n\n if (idealTiles[tileID.key]) {\n // found a parent that needed a loaded child; retain that child\n retain[topmostLoadedID.key] = topmostLoadedID;\n break;\n }\n }\n }\n }\n\n /**\n * Find a loaded parent of the given tile (up to minCoveringZoom)\n * @private\n */\n findLoadedParent(tileID: OverscaledTileID, minCoveringZoom: number): ?Tile {\n if (tileID.key in this._loadedParentTiles) {\n const parent = this._loadedParentTiles[tileID.key];\n if (parent && parent.tileID.overscaledZ >= minCoveringZoom) {\n return parent;\n } else {\n return null;\n }\n }\n for (let z = tileID.overscaledZ - 1; z >= minCoveringZoom; z--) {\n const parentTileID = tileID.scaledTo(z);\n const tile = this._getLoadedTile(parentTileID);\n if (tile) {\n return tile;\n }\n }\n }\n\n _getLoadedTile(tileID: OverscaledTileID): ?Tile {\n const tile = this._tiles[tileID.key];\n if (tile && tile.hasData()) {\n return tile;\n }\n // TileCache ignores wrap in lookup.\n const cachedTile = this._cache.getByKey(tileID.wrapped().key);\n return cachedTile;\n }\n\n /**\n * Resizes the tile cache based on the current viewport's size\n * or the maxTileCacheSize option passed during map creation\n *\n * Larger viewports use more tiles and need larger caches. Larger viewports\n * are more likely to be found on devices with more memory and on pages where\n * the map is more important.\n * @private\n */\n updateCacheSize(transform: Transform) {\n const widthInTiles = Math.ceil(transform.width / this._source.tileSize) + 1;\n const heightInTiles = Math.ceil(transform.height / this._source.tileSize) + 1;\n const approxTilesInView = widthInTiles * heightInTiles;\n const commonZoomRange = 5;\n\n const viewDependentMaxSize = Math.floor(approxTilesInView * commonZoomRange);\n const maxSize = typeof this._maxTileCacheSize === 'number' ? Math.min(this._maxTileCacheSize, viewDependentMaxSize) : viewDependentMaxSize;\n\n this._cache.setMaxSize(maxSize);\n }\n\n handleWrapJump(lng: number) {\n // On top of the regular z/x/y values, TileIDs have a `wrap` value that specify\n // which cppy of the world the tile belongs to. For example, at `lng: 10` you\n // might render z/x/y/0 while at `lng: 370` you would render z/x/y/1.\n //\n // When lng values get wrapped (going from `lng: 370` to `long: 10`) you expect\n // to see the same thing on the screen (370 degrees and 10 degrees is the same\n // place in the world) but all the TileIDs will have different wrap values.\n //\n // In order to make this transition seamless, we calculate the rounded difference of\n // \"worlds\" between the last frame and the current frame. If the map panned by\n // a world, then we can assign all the tiles new TileIDs with updated wrap values.\n // For example, assign z/x/y/1 a new id: z/x/y/0. It is the same tile, just rendered\n // in a different position.\n //\n // This enables us to reuse the tiles at more ideal locations and prevent flickering.\n const prevLng = this._prevLng === undefined ? lng : this._prevLng;\n const lngDifference = lng - prevLng;\n const worldDifference = lngDifference / 360;\n const wrapDelta = Math.round(worldDifference);\n this._prevLng = lng;\n\n if (wrapDelta) {\n const tiles: {[_: string]: Tile} = {};\n for (const key in this._tiles) {\n const tile = this._tiles[key];\n tile.tileID = tile.tileID.unwrapTo(tile.tileID.wrap + wrapDelta);\n tiles[tile.tileID.key] = tile;\n }\n this._tiles = tiles;\n\n // Reset tile reload timers\n for (const id in this._timers) {\n clearTimeout(this._timers[id]);\n delete this._timers[id];\n }\n for (const id in this._tiles) {\n const tile = this._tiles[id];\n this._setTileReloadTimer(id, tile);\n }\n }\n }\n\n /**\n * Removes tiles that are outside the viewport and adds new tiles that\n * are inside the viewport.\n * @private\n */\n update(transform: Transform) {\n this.transform = transform;\n if (!this._sourceLoaded || this._paused) { return; }\n\n this.updateCacheSize(transform);\n this.handleWrapJump(this.transform.center.lng);\n\n // Covered is a list of retained tiles who's areas are fully covered by other,\n // better, retained tiles. They are not drawn separately.\n this._coveredTiles = {};\n\n let idealTileIDs;\n if (!this.used) {\n idealTileIDs = [];\n } else if (this._source.tileID) {\n idealTileIDs = transform.getVisibleUnwrappedCoordinates(this._source.tileID)\n .map((unwrapped) => new OverscaledTileID(unwrapped.canonical.z, unwrapped.wrap, unwrapped.canonical.z, unwrapped.canonical.x, unwrapped.canonical.y));\n } else {\n idealTileIDs = transform.coveringTiles({\n tileSize: this._source.tileSize,\n minzoom: this._source.minzoom,\n maxzoom: this._source.maxzoom,\n roundZoom: this._source.roundZoom,\n reparseOverscaled: this._source.reparseOverscaled\n });\n\n if (this._source.hasTile) {\n idealTileIDs = idealTileIDs.filter((coord) => (this._source.hasTile: any)(coord));\n }\n }\n\n // Determine the overzooming/underzooming amounts.\n const zoom = transform.coveringZoomLevel(this._source);\n const minCoveringZoom = Math.max(zoom - SourceCache.maxOverzooming, this._source.minzoom);\n const maxCoveringZoom = Math.max(zoom + SourceCache.maxUnderzooming, this._source.minzoom);\n\n // Retain is a list of tiles that we shouldn't delete, even if they are not\n // the most ideal tile for the current viewport. This may include tiles like\n // parent or child tiles that are *already* loaded.\n const retain = this._updateRetainedTiles(idealTileIDs, zoom);\n\n if (isRasterType(this._source.type)) {\n const parentsForFading: {[_: string]: OverscaledTileID} = {};\n const fadingTiles = {};\n const ids = Object.keys(retain);\n for (const id of ids) {\n const tileID = retain[id];\n assert(tileID.key === id);\n\n const tile = this._tiles[id];\n if (!tile || tile.fadeEndTime && tile.fadeEndTime <= browser.now()) continue;\n\n // if the tile is loaded but still fading in, find parents to cross-fade with it\n const parentTile = this.findLoadedParent(tileID, minCoveringZoom);\n if (parentTile) {\n this._addTile(parentTile.tileID);\n parentsForFading[parentTile.tileID.key] = parentTile.tileID;\n }\n\n fadingTiles[id] = tileID;\n }\n\n // for tiles that are still fading in, also find children to cross-fade with\n this._retainLoadedChildren(fadingTiles, zoom, maxCoveringZoom, retain);\n\n for (const id in parentsForFading) {\n if (!retain[id]) {\n // If a tile is only needed for fading, mark it as covered so that it isn't rendered on it's own.\n this._coveredTiles[id] = true;\n retain[id] = parentsForFading[id];\n }\n }\n }\n\n for (const retainedId in retain) {\n // Make sure retained tiles always clear any existing fade holds\n // so that if they're removed again their fade timer starts fresh.\n this._tiles[retainedId].clearFadeHold();\n }\n\n // Remove the tiles we don't need anymore.\n const remove = keysDifference(this._tiles, retain);\n for (const tileID of remove) {\n const tile = this._tiles[tileID];\n if (tile.hasSymbolBuckets && !tile.holdingForFade()) {\n tile.setHoldDuration(this.map._fadeDuration);\n } else if (!tile.hasSymbolBuckets || tile.symbolFadeFinished()) {\n this._removeTile(tileID);\n }\n }\n\n // Construct a cache of loaded parents\n this._updateLoadedParentTileCache();\n }\n\n releaseSymbolFadeTiles() {\n for (const id in this._tiles) {\n if (this._tiles[id].holdingForFade()) {\n this._removeTile(id);\n }\n }\n }\n\n _updateRetainedTiles(idealTileIDs: Array, zoom: number): {[_: string]: OverscaledTileID} {\n const retain: {[_: string]: OverscaledTileID} = {};\n const checked: {[_: string]: boolean } = {};\n const minCoveringZoom = Math.max(zoom - SourceCache.maxOverzooming, this._source.minzoom);\n const maxCoveringZoom = Math.max(zoom + SourceCache.maxUnderzooming, this._source.minzoom);\n\n const missingTiles = {};\n for (const tileID of idealTileIDs) {\n const tile = this._addTile(tileID);\n\n // retain the tile even if it's not loaded because it's an ideal tile.\n retain[tileID.key] = tileID;\n\n if (tile.hasData()) continue;\n\n if (zoom < this._source.maxzoom) {\n // save missing tiles that potentially have loaded children\n missingTiles[tileID.key] = tileID;\n }\n }\n\n // retain any loaded children of ideal tiles up to maxCoveringZoom\n this._retainLoadedChildren(missingTiles, zoom, maxCoveringZoom, retain);\n\n for (const tileID of idealTileIDs) {\n let tile = this._tiles[tileID.key];\n\n if (tile.hasData()) continue;\n\n // The tile we require is not yet loaded or does not exist;\n // Attempt to find children that fully cover it.\n\n if (zoom + 1 > this._source.maxzoom) {\n // We're looking for an overzoomed child tile.\n const childCoord = tileID.children(this._source.maxzoom)[0];\n const childTile = this.getTile(childCoord);\n if (!!childTile && childTile.hasData()) {\n retain[childCoord.key] = childCoord;\n continue; // tile is covered by overzoomed child\n }\n } else {\n // check if all 4 immediate children are loaded (i.e. the missing ideal tile is covered)\n const children = tileID.children(this._source.maxzoom);\n\n if (retain[children[0].key] &&\n retain[children[1].key] &&\n retain[children[2].key] &&\n retain[children[3].key]) continue; // tile is covered by children\n }\n\n // We couldn't find child tiles that entirely cover the ideal tile; look for parents now.\n\n // As we ascend up the tile pyramid of the ideal tile, we check whether the parent\n // tile has been previously requested (and errored because we only loop over tiles with no data)\n // in order to determine if we need to request its parent.\n let parentWasRequested = tile.wasRequested();\n\n for (let overscaledZ = tileID.overscaledZ - 1; overscaledZ >= minCoveringZoom; --overscaledZ) {\n const parentId = tileID.scaledTo(overscaledZ);\n\n // Break parent tile ascent if this route has been previously checked by another child.\n if (checked[parentId.key]) break;\n checked[parentId.key] = true;\n\n tile = this.getTile(parentId);\n if (!tile && parentWasRequested) {\n tile = this._addTile(parentId);\n }\n if (tile) {\n retain[parentId.key] = parentId;\n // Save the current values, since they're the parent of the next iteration\n // of the parent tile ascent loop.\n parentWasRequested = tile.wasRequested();\n if (tile.hasData()) break;\n }\n }\n }\n\n return retain;\n }\n\n _updateLoadedParentTileCache() {\n this._loadedParentTiles = {};\n\n for (const tileKey in this._tiles) {\n const path = [];\n let parentTile: ?Tile;\n let currentId = this._tiles[tileKey].tileID;\n\n // Find the closest loaded ancestor by traversing the tile tree towards the root and\n // caching results along the way\n while (currentId.overscaledZ > 0) {\n\n // Do we have a cached result from previous traversals?\n if (currentId.key in this._loadedParentTiles) {\n parentTile = this._loadedParentTiles[currentId.key];\n break;\n }\n\n path.push(currentId.key);\n\n // Is the parent loaded?\n const parentId = currentId.scaledTo(currentId.overscaledZ - 1);\n parentTile = this._getLoadedTile(parentId);\n if (parentTile) {\n break;\n }\n\n currentId = parentId;\n }\n\n // Cache the result of this traversal to all newly visited tiles\n for (const key of path) {\n this._loadedParentTiles[key] = parentTile;\n }\n }\n }\n\n /**\n * Add a tile, given its coordinate, to the pyramid.\n * @private\n */\n _addTile(tileID: OverscaledTileID): Tile {\n let tile = this._tiles[tileID.key];\n if (tile)\n return tile;\n\n tile = this._cache.getAndRemove(tileID);\n if (tile) {\n this._setTileReloadTimer(tileID.key, tile);\n // set the tileID because the cached tile could have had a different wrap value\n tile.tileID = tileID;\n this._state.initializeTileState(tile, this.map ? this.map.painter : null);\n if (this._cacheTimers[tileID.key]) {\n clearTimeout(this._cacheTimers[tileID.key]);\n delete this._cacheTimers[tileID.key];\n this._setTileReloadTimer(tileID.key, tile);\n }\n }\n\n const cached = Boolean(tile);\n if (!cached) {\n tile = new Tile(tileID, this._source.tileSize * tileID.overscaleFactor());\n this._loadTile(tile, this._tileLoaded.bind(this, tile, tileID.key, tile.state));\n }\n\n // Impossible, but silence flow.\n if (!tile) return (null: any);\n\n tile.uses++;\n this._tiles[tileID.key] = tile;\n if (!cached) this._source.fire(new Event('dataloading', {tile, coord: tile.tileID, dataType: 'source'}));\n\n return tile;\n }\n\n _setTileReloadTimer(id: string, tile: Tile) {\n if (id in this._timers) {\n clearTimeout(this._timers[id]);\n delete this._timers[id];\n }\n\n const expiryTimeout = tile.getExpiryTimeout();\n if (expiryTimeout) {\n this._timers[id] = setTimeout(() => {\n this._reloadTile(id, 'expired');\n delete this._timers[id];\n }, expiryTimeout);\n }\n }\n\n /**\n * Remove a tile, given its id, from the pyramid\n * @private\n */\n _removeTile(id: string) {\n const tile = this._tiles[id];\n if (!tile)\n return;\n\n tile.uses--;\n delete this._tiles[id];\n if (this._timers[id]) {\n clearTimeout(this._timers[id]);\n delete this._timers[id];\n }\n\n if (tile.uses > 0)\n return;\n\n if (tile.hasData() && tile.state !== 'reloading') {\n this._cache.add(tile.tileID, tile, tile.getExpiryTimeout());\n } else {\n tile.aborted = true;\n this._abortTile(tile);\n this._unloadTile(tile);\n }\n }\n\n /**\n * Remove all tiles from this pyramid\n */\n clearTiles() {\n this._shouldReloadOnResume = false;\n this._paused = false;\n\n for (const id in this._tiles)\n this._removeTile(id);\n\n this._cache.reset();\n }\n\n /**\n * Search through our current tiles and attempt to find the tiles that\n * cover the given bounds.\n * @param pointQueryGeometry coordinates of the corners of bounding rectangle\n * @returns {Array} result items have {tile, minX, maxX, minY, maxY}, where min/max bounding values are the given bounds transformed in into the coordinate space of this tile.\n * @private\n */\n tilesIn(pointQueryGeometry: Array, maxPitchScaleFactor: number, has3DLayer: boolean) {\n\n const tileResults = [];\n\n const transform = this.transform;\n if (!transform) return tileResults;\n\n const cameraPointQueryGeometry = has3DLayer ?\n transform.getCameraQueryGeometry(pointQueryGeometry) :\n pointQueryGeometry;\n\n const queryGeometry = pointQueryGeometry.map((p) => transform.pointCoordinate(p));\n const cameraQueryGeometry = cameraPointQueryGeometry.map((p) => transform.pointCoordinate(p));\n\n const ids = this.getIds();\n\n let minX = Infinity;\n let minY = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n\n for (const p of cameraQueryGeometry) {\n minX = Math.min(minX, p.x);\n minY = Math.min(minY, p.y);\n maxX = Math.max(maxX, p.x);\n maxY = Math.max(maxY, p.y);\n }\n\n for (let i = 0; i < ids.length; i++) {\n const tile = this._tiles[ids[i]];\n if (tile.holdingForFade()) {\n // Tiles held for fading are covered by tiles that are closer to ideal\n continue;\n }\n const tileID = tile.tileID;\n const scale = Math.pow(2, transform.zoom - tile.tileID.overscaledZ);\n const queryPadding = maxPitchScaleFactor * tile.queryPadding * EXTENT / tile.tileSize / scale;\n\n const tileSpaceBounds = [\n tileID.getTilePoint(new MercatorCoordinate(minX, minY)),\n tileID.getTilePoint(new MercatorCoordinate(maxX, maxY))\n ];\n\n if (tileSpaceBounds[0].x - queryPadding < EXTENT && tileSpaceBounds[0].y - queryPadding < EXTENT &&\n tileSpaceBounds[1].x + queryPadding >= 0 && tileSpaceBounds[1].y + queryPadding >= 0) {\n\n const tileSpaceQueryGeometry: Array = queryGeometry.map((c) => tileID.getTilePoint(c));\n const tileSpaceCameraQueryGeometry = cameraQueryGeometry.map((c) => tileID.getTilePoint(c));\n\n tileResults.push({\n tile,\n tileID,\n queryGeometry: tileSpaceQueryGeometry,\n cameraQueryGeometry: tileSpaceCameraQueryGeometry,\n scale\n });\n }\n }\n\n return tileResults;\n }\n\n getVisibleCoordinates(symbolLayer?: boolean): Array {\n const coords = this.getRenderableIds(symbolLayer).map((id) => this._tiles[id].tileID);\n for (const coord of coords) {\n coord.posMatrix = this.transform.calculatePosMatrix(coord.toUnwrapped());\n }\n return coords;\n }\n\n hasTransition() {\n if (this._source.hasTransition()) {\n return true;\n }\n\n if (isRasterType(this._source.type)) {\n for (const id in this._tiles) {\n const tile = this._tiles[id];\n if (tile.fadeEndTime !== undefined && tile.fadeEndTime >= browser.now()) {\n return true;\n }\n }\n }\n\n return false;\n }\n\n /**\n * Set the value of a particular state for a feature\n * @private\n */\n setFeatureState(sourceLayer?: string, featureId: number | string, state: Object) {\n sourceLayer = sourceLayer || '_geojsonTileLayer';\n this._state.updateState(sourceLayer, featureId, state);\n }\n\n /**\n * Resets the value of a particular state key for a feature\n * @private\n */\n removeFeatureState(sourceLayer?: string, featureId?: number | string, key?: string) {\n sourceLayer = sourceLayer || '_geojsonTileLayer';\n this._state.removeFeatureState(sourceLayer, featureId, key);\n }\n\n /**\n * Get the entire state object for a feature\n * @private\n */\n getFeatureState(sourceLayer?: string, featureId: number | string) {\n sourceLayer = sourceLayer || '_geojsonTileLayer';\n return this._state.getState(sourceLayer, featureId);\n }\n\n /**\n * Sets the set of keys that the tile depends on. This allows tiles to\n * be reloaded when their dependencies change.\n * @private\n */\n setDependencies(tileKey: string, namespace: string, dependencies: Array) {\n const tile = this._tiles[tileKey];\n if (tile) {\n tile.setDependencies(namespace, dependencies);\n }\n }\n\n /**\n * Reloads all tiles that depend on the given keys.\n * @private\n */\n reloadTilesForDependencies(namespaces: Array, keys: Array) {\n for (const id in this._tiles) {\n const tile = this._tiles[id];\n if (tile.hasDependency(namespaces, keys)) {\n this._reloadTile(id, 'reloading');\n }\n }\n this._cache.filter(tile => !tile.hasDependency(namespaces, keys));\n }\n}\n\nSourceCache.maxOverzooming = 10;\nSourceCache.maxUnderzooming = 3;\n\nfunction compareTileId(a: OverscaledTileID, b: OverscaledTileID): number {\n // Different copies of the world are sorted based on their distance to the center.\n // Wrap values are converted to unsigned distances by reserving odd number for copies\n // with negative wrap and even numbers for copies with positive wrap.\n const aWrap = Math.abs(a.wrap * 2) - +(a.wrap < 0);\n const bWrap = Math.abs(b.wrap * 2) - +(b.wrap < 0);\n return a.overscaledZ - b.overscaledZ || bWrap - aWrap || b.canonical.y - a.canonical.y || b.canonical.x - a.canonical.x;\n}\n\nfunction isRasterType(type) {\n return type === 'raster' || type === 'image' || type === 'video';\n}\n\nexport default SourceCache;\n","// @flow\n\nimport window from '../window';\nimport mapboxgl from '../../';\n\nimport type {WorkerInterface} from '../web_worker';\n\nexport default function (): WorkerInterface {\n return (new window.Worker(mapboxgl.workerUrl): any);\n}\n","// @flow\n\nimport WebWorker from './web_worker';\nimport type {WorkerInterface} from './web_worker';\nimport browser from './browser';\n\nexport const PRELOAD_POOL_ID = 'mapboxgl_preloaded_worker_pool';\n\n/**\n * Constructs a worker pool.\n * @private\n */\nexport default class WorkerPool {\n static workerCount: number;\n\n active: {[_: number | string]: boolean};\n workers: Array;\n\n constructor() {\n this.active = {};\n }\n\n acquire(mapId: number | string): Array {\n if (!this.workers) {\n // Lazily look up the value of mapboxgl.workerCount so that\n // client code has had a chance to set it.\n this.workers = [];\n while (this.workers.length < WorkerPool.workerCount) {\n this.workers.push(new WebWorker());\n }\n }\n\n this.active[mapId] = true;\n return this.workers.slice();\n }\n\n release(mapId: number | string) {\n delete this.active[mapId];\n if (this.numActive() === 0) {\n this.workers.forEach((w) => {\n w.terminate();\n });\n this.workers = (null: any);\n }\n }\n\n isPreloaded(): boolean {\n return !!this.active[PRELOAD_POOL_ID];\n }\n\n numActive(): number {\n return Object.keys(this.active).length;\n }\n}\n\nconst availableLogicalProcessors = Math.floor(browser.hardwareConcurrency / 2);\nWorkerPool.workerCount = Math.max(Math.min(availableLogicalProcessors, 6), 1);\n","// @flow\n\nimport WorkerPool, {PRELOAD_POOL_ID} from './worker_pool';\n\nlet globalWorkerPool;\n\n/**\n * Creates (if necessary) and returns the single, global WorkerPool instance\n * to be shared across each Map\n * @private\n */\nexport default function getGlobalWorkerPool () {\n if (!globalWorkerPool) {\n globalWorkerPool = new WorkerPool();\n }\n return globalWorkerPool;\n}\n\nexport function prewarm() {\n const workerPool = getGlobalWorkerPool();\n workerPool.acquire(PRELOAD_POOL_ID);\n}\n\nexport function clearPrewarmedResources() {\n const pool = globalWorkerPool;\n if (pool) {\n // Remove the pool only if all maps that referenced the preloaded global worker pool have been removed.\n if (pool.isPreloaded() && pool.numActive() === 1) {\n pool.release(PRELOAD_POOL_ID);\n globalWorkerPool = null;\n } else {\n console.warn('Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()');\n }\n }\n}\n","\nimport refProperties from './util/ref_properties';\n\nfunction deref(layer, parent) {\n const result = {};\n\n for (const k in layer) {\n if (k !== 'ref') {\n result[k] = layer[k];\n }\n }\n\n refProperties.forEach((k) => {\n if (k in parent) {\n result[k] = parent[k];\n }\n });\n\n return result;\n}\n\nexport default derefLayers;\n\n/**\n * Given an array of layers, some of which may contain `ref` properties\n * whose value is the `id` of another property, return a new array where\n * such layers have been augmented with the 'type', 'source', etc. properties\n * from the parent layer, and the `ref` property has been removed.\n *\n * The input is not modified. The output may contain references to portions\n * of the input.\n *\n * @private\n * @param {Array} layers\n * @returns {Array}\n */\nfunction derefLayers(layers) {\n layers = layers.slice();\n\n const map = Object.create(null);\n for (let i = 0; i < layers.length; i++) {\n map[layers[i].id] = layers[i];\n }\n\n for (let i = 0; i < layers.length; i++) {\n if ('ref' in layers[i]) {\n layers[i] = deref(layers[i], map[layers[i].ref]);\n }\n }\n\n return layers;\n}\n","\nimport isEqual from './util/deep_equal';\n\nconst operations = {\n\n /*\n * { command: 'setStyle', args: [stylesheet] }\n */\n setStyle: 'setStyle',\n\n /*\n * { command: 'addLayer', args: [layer, 'beforeLayerId'] }\n */\n addLayer: 'addLayer',\n\n /*\n * { command: 'removeLayer', args: ['layerId'] }\n */\n removeLayer: 'removeLayer',\n\n /*\n * { command: 'setPaintProperty', args: ['layerId', 'prop', value] }\n */\n setPaintProperty: 'setPaintProperty',\n\n /*\n * { command: 'setLayoutProperty', args: ['layerId', 'prop', value] }\n */\n setLayoutProperty: 'setLayoutProperty',\n\n /*\n * { command: 'setFilter', args: ['layerId', filter] }\n */\n setFilter: 'setFilter',\n\n /*\n * { command: 'addSource', args: ['sourceId', source] }\n */\n addSource: 'addSource',\n\n /*\n * { command: 'removeSource', args: ['sourceId'] }\n */\n removeSource: 'removeSource',\n\n /*\n * { command: 'setGeoJSONSourceData', args: ['sourceId', data] }\n */\n setGeoJSONSourceData: 'setGeoJSONSourceData',\n\n /*\n * { command: 'setLayerZoomRange', args: ['layerId', 0, 22] }\n */\n setLayerZoomRange: 'setLayerZoomRange',\n\n /*\n * { command: 'setLayerProperty', args: ['layerId', 'prop', value] }\n */\n setLayerProperty: 'setLayerProperty',\n\n /*\n * { command: 'setCenter', args: [[lon, lat]] }\n */\n setCenter: 'setCenter',\n\n /*\n * { command: 'setZoom', args: [zoom] }\n */\n setZoom: 'setZoom',\n\n /*\n * { command: 'setBearing', args: [bearing] }\n */\n setBearing: 'setBearing',\n\n /*\n * { command: 'setPitch', args: [pitch] }\n */\n setPitch: 'setPitch',\n\n /*\n * { command: 'setSprite', args: ['spriteUrl'] }\n */\n setSprite: 'setSprite',\n\n /*\n * { command: 'setGlyphs', args: ['glyphsUrl'] }\n */\n setGlyphs: 'setGlyphs',\n\n /*\n * { command: 'setTransition', args: [transition] }\n */\n setTransition: 'setTransition',\n\n /*\n * { command: 'setLighting', args: [lightProperties] }\n */\n setLight: 'setLight'\n\n};\n\nfunction addSource(sourceId, after, commands) {\n commands.push({command: operations.addSource, args: [sourceId, after[sourceId]]});\n}\n\nfunction removeSource(sourceId, commands, sourcesRemoved) {\n commands.push({command: operations.removeSource, args: [sourceId]});\n sourcesRemoved[sourceId] = true;\n}\n\nfunction updateSource(sourceId, after, commands, sourcesRemoved) {\n removeSource(sourceId, commands, sourcesRemoved);\n addSource(sourceId, after, commands);\n}\n\nfunction canUpdateGeoJSON(before, after, sourceId) {\n let prop;\n for (prop in before[sourceId]) {\n if (!before[sourceId].hasOwnProperty(prop)) continue;\n if (prop !== 'data' && !isEqual(before[sourceId][prop], after[sourceId][prop])) {\n return false;\n }\n }\n for (prop in after[sourceId]) {\n if (!after[sourceId].hasOwnProperty(prop)) continue;\n if (prop !== 'data' && !isEqual(before[sourceId][prop], after[sourceId][prop])) {\n return false;\n }\n }\n return true;\n}\n\nfunction diffSources(before, after, commands, sourcesRemoved) {\n before = before || {};\n after = after || {};\n\n let sourceId;\n\n // look for sources to remove\n for (sourceId in before) {\n if (!before.hasOwnProperty(sourceId)) continue;\n if (!after.hasOwnProperty(sourceId)) {\n removeSource(sourceId, commands, sourcesRemoved);\n }\n }\n\n // look for sources to add/update\n for (sourceId in after) {\n if (!after.hasOwnProperty(sourceId)) continue;\n if (!before.hasOwnProperty(sourceId)) {\n addSource(sourceId, after, commands);\n } else if (!isEqual(before[sourceId], after[sourceId])) {\n if (before[sourceId].type === 'geojson' && after[sourceId].type === 'geojson' && canUpdateGeoJSON(before, after, sourceId)) {\n commands.push({command: operations.setGeoJSONSourceData, args: [sourceId, after[sourceId].data]});\n } else {\n // no update command, must remove then add\n updateSource(sourceId, after, commands, sourcesRemoved);\n }\n }\n }\n}\n\nfunction diffLayerPropertyChanges(before, after, commands, layerId, klass, command) {\n before = before || {};\n after = after || {};\n\n let prop;\n\n for (prop in before) {\n if (!before.hasOwnProperty(prop)) continue;\n if (!isEqual(before[prop], after[prop])) {\n commands.push({command, args: [layerId, prop, after[prop], klass]});\n }\n }\n for (prop in after) {\n if (!after.hasOwnProperty(prop) || before.hasOwnProperty(prop)) continue;\n if (!isEqual(before[prop], after[prop])) {\n commands.push({command, args: [layerId, prop, after[prop], klass]});\n }\n }\n}\n\nfunction pluckId(layer) {\n return layer.id;\n}\nfunction indexById(group, layer) {\n group[layer.id] = layer;\n return group;\n}\n\nfunction diffLayers(before, after, commands) {\n before = before || [];\n after = after || [];\n\n // order of layers by id\n const beforeOrder = before.map(pluckId);\n const afterOrder = after.map(pluckId);\n\n // index of layer by id\n const beforeIndex = before.reduce(indexById, {});\n const afterIndex = after.reduce(indexById, {});\n\n // track order of layers as if they have been mutated\n const tracker = beforeOrder.slice();\n\n // layers that have been added do not need to be diffed\n const clean = Object.create(null);\n\n let i, d, layerId, beforeLayer, afterLayer, insertBeforeLayerId, prop;\n\n // remove layers\n for (i = 0, d = 0; i < beforeOrder.length; i++) {\n layerId = beforeOrder[i];\n if (!afterIndex.hasOwnProperty(layerId)) {\n commands.push({command: operations.removeLayer, args: [layerId]});\n tracker.splice(tracker.indexOf(layerId, d), 1);\n } else {\n // limit where in tracker we need to look for a match\n d++;\n }\n }\n\n // add/reorder layers\n for (i = 0, d = 0; i < afterOrder.length; i++) {\n // work backwards as insert is before an existing layer\n layerId = afterOrder[afterOrder.length - 1 - i];\n\n if (tracker[tracker.length - 1 - i] === layerId) continue;\n\n if (beforeIndex.hasOwnProperty(layerId)) {\n // remove the layer before we insert at the correct position\n commands.push({command: operations.removeLayer, args: [layerId]});\n tracker.splice(tracker.lastIndexOf(layerId, tracker.length - d), 1);\n } else {\n // limit where in tracker we need to look for a match\n d++;\n }\n\n // add layer at correct position\n insertBeforeLayerId = tracker[tracker.length - i];\n commands.push({command: operations.addLayer, args: [afterIndex[layerId], insertBeforeLayerId]});\n tracker.splice(tracker.length - i, 0, layerId);\n clean[layerId] = true;\n }\n\n // update layers\n for (i = 0; i < afterOrder.length; i++) {\n layerId = afterOrder[i];\n beforeLayer = beforeIndex[layerId];\n afterLayer = afterIndex[layerId];\n\n // no need to update if previously added (new or moved)\n if (clean[layerId] || isEqual(beforeLayer, afterLayer)) continue;\n\n // If source, source-layer, or type have changes, then remove the layer\n // and add it back 'from scratch'.\n if (!isEqual(beforeLayer.source, afterLayer.source) || !isEqual(beforeLayer['source-layer'], afterLayer['source-layer']) || !isEqual(beforeLayer.type, afterLayer.type)) {\n commands.push({command: operations.removeLayer, args: [layerId]});\n // we add the layer back at the same position it was already in, so\n // there's no need to update the `tracker`\n insertBeforeLayerId = tracker[tracker.lastIndexOf(layerId) + 1];\n commands.push({command: operations.addLayer, args: [afterLayer, insertBeforeLayerId]});\n continue;\n }\n\n // layout, paint, filter, minzoom, maxzoom\n diffLayerPropertyChanges(beforeLayer.layout, afterLayer.layout, commands, layerId, null, operations.setLayoutProperty);\n diffLayerPropertyChanges(beforeLayer.paint, afterLayer.paint, commands, layerId, null, operations.setPaintProperty);\n if (!isEqual(beforeLayer.filter, afterLayer.filter)) {\n commands.push({command: operations.setFilter, args: [layerId, afterLayer.filter]});\n }\n if (!isEqual(beforeLayer.minzoom, afterLayer.minzoom) || !isEqual(beforeLayer.maxzoom, afterLayer.maxzoom)) {\n commands.push({command: operations.setLayerZoomRange, args: [layerId, afterLayer.minzoom, afterLayer.maxzoom]});\n }\n\n // handle all other layer props, including paint.*\n for (prop in beforeLayer) {\n if (!beforeLayer.hasOwnProperty(prop)) continue;\n if (prop === 'layout' || prop === 'paint' || prop === 'filter' ||\n prop === 'metadata' || prop === 'minzoom' || prop === 'maxzoom') continue;\n if (prop.indexOf('paint.') === 0) {\n diffLayerPropertyChanges(beforeLayer[prop], afterLayer[prop], commands, layerId, prop.slice(6), operations.setPaintProperty);\n } else if (!isEqual(beforeLayer[prop], afterLayer[prop])) {\n commands.push({command: operations.setLayerProperty, args: [layerId, prop, afterLayer[prop]]});\n }\n }\n for (prop in afterLayer) {\n if (!afterLayer.hasOwnProperty(prop) || beforeLayer.hasOwnProperty(prop)) continue;\n if (prop === 'layout' || prop === 'paint' || prop === 'filter' ||\n prop === 'metadata' || prop === 'minzoom' || prop === 'maxzoom') continue;\n if (prop.indexOf('paint.') === 0) {\n diffLayerPropertyChanges(beforeLayer[prop], afterLayer[prop], commands, layerId, prop.slice(6), operations.setPaintProperty);\n } else if (!isEqual(beforeLayer[prop], afterLayer[prop])) {\n commands.push({command: operations.setLayerProperty, args: [layerId, prop, afterLayer[prop]]});\n }\n }\n }\n}\n\n/**\n * Diff two stylesheet\n *\n * Creates semanticly aware diffs that can easily be applied at runtime.\n * Operations produced by the diff closely resemble the maplibre-gl-js API. Any\n * error creating the diff will fall back to the 'setStyle' operation.\n *\n * Example diff:\n * [\n * { command: 'setConstant', args: ['@water', '#0000FF'] },\n * { command: 'setPaintProperty', args: ['background', 'background-color', 'black'] }\n * ]\n *\n * @private\n * @param {*} [before] stylesheet to compare from\n * @param {*} after stylesheet to compare to\n * @returns Array list of changes\n */\nfunction diffStyles(before, after) {\n if (!before) return [{command: operations.setStyle, args: [after]}];\n\n let commands = [];\n\n try {\n // Handle changes to top-level properties\n if (!isEqual(before.version, after.version)) {\n return [{command: operations.setStyle, args: [after]}];\n }\n if (!isEqual(before.center, after.center)) {\n commands.push({command: operations.setCenter, args: [after.center]});\n }\n if (!isEqual(before.zoom, after.zoom)) {\n commands.push({command: operations.setZoom, args: [after.zoom]});\n }\n if (!isEqual(before.bearing, after.bearing)) {\n commands.push({command: operations.setBearing, args: [after.bearing]});\n }\n if (!isEqual(before.pitch, after.pitch)) {\n commands.push({command: operations.setPitch, args: [after.pitch]});\n }\n if (!isEqual(before.sprite, after.sprite)) {\n commands.push({command: operations.setSprite, args: [after.sprite]});\n }\n if (!isEqual(before.glyphs, after.glyphs)) {\n commands.push({command: operations.setGlyphs, args: [after.glyphs]});\n }\n if (!isEqual(before.transition, after.transition)) {\n commands.push({command: operations.setTransition, args: [after.transition]});\n }\n if (!isEqual(before.light, after.light)) {\n commands.push({command: operations.setLight, args: [after.light]});\n }\n\n // Handle changes to `sources`\n // If a source is to be removed, we also--before the removeSource\n // command--need to remove all the style layers that depend on it.\n const sourcesRemoved = {};\n\n // First collect the {add,remove}Source commands\n const removeOrAddSourceCommands = [];\n diffSources(before.sources, after.sources, removeOrAddSourceCommands, sourcesRemoved);\n\n // Push a removeLayer command for each style layer that depends on a\n // source that's being removed.\n // Also, exclude any such layers them from the input to `diffLayers`\n // below, so that diffLayers produces the appropriate `addLayers`\n // command\n const beforeLayers = [];\n if (before.layers) {\n before.layers.forEach((layer) => {\n if (sourcesRemoved[layer.source]) {\n commands.push({command: operations.removeLayer, args: [layer.id]});\n } else {\n beforeLayers.push(layer);\n }\n });\n }\n commands = commands.concat(removeOrAddSourceCommands);\n\n // Handle changes to `layers`\n diffLayers(beforeLayers, after.layers, commands);\n\n } catch (e) {\n // fall back to setStyle\n console.warn('Unable to compute style diff:', e);\n commands = [{command: operations.setStyle, args: [after]}];\n }\n\n return commands;\n}\n\nexport default diffStyles;\nexport {operations};\n","// @flow\n\nimport {clamp} from '../util/util';\nimport Point from '@mapbox/point-geometry';\nimport assert from 'assert';\n\nclass PathInterpolator {\n points: Array;\n length: number;\n paddedLength: number;\n padding: number;\n _distances: Array;\n\n constructor(points_: ?Array, padding_: ?number) {\n this.reset(points_, padding_);\n }\n\n reset(points_: ?Array, padding_: ?number) {\n this.points = points_ || [];\n\n // Compute cumulative distance from first point to every other point in the segment.\n // Last entry in the array is total length of the path\n this._distances = [0.0];\n\n for (let i = 1; i < this.points.length; i++) {\n this._distances[i] = this._distances[i - 1] + this.points[i].dist(this.points[i - 1]);\n }\n\n this.length = this._distances[this._distances.length - 1];\n this.padding = Math.min(padding_ || 0, this.length * 0.5);\n this.paddedLength = this.length - this.padding * 2.0;\n }\n\n lerp(t: number): Point {\n assert(this.points.length > 0);\n if (this.points.length === 1) {\n return this.points[0];\n }\n\n t = clamp(t, 0, 1);\n\n // Find the correct segment [p0, p1] where p0 <= x < p1\n let currentIndex = 1;\n let distOfCurrentIdx = this._distances[currentIndex];\n const distToTarget = t * this.paddedLength + this.padding;\n\n while (distOfCurrentIdx < distToTarget && currentIndex < this._distances.length) {\n distOfCurrentIdx = this._distances[++currentIndex];\n }\n\n // Interpolate between the two points of the segment\n const idxOfPrevPoint = currentIndex - 1;\n const distOfPrevIdx = this._distances[idxOfPrevPoint];\n const segmentLength = distOfCurrentIdx - distOfPrevIdx;\n const segmentT = segmentLength > 0 ? (distToTarget - distOfPrevIdx) / segmentLength : 0;\n\n return this.points[idxOfPrevPoint].mult(1.0 - segmentT).add(this.points[currentIndex].mult(segmentT));\n }\n}\n\nexport default PathInterpolator;\n","// @flow\n\n/**\n * GridIndex is a data structure for testing the intersection of\n * circles and rectangles in a 2d plane.\n * It is optimized for rapid insertion and querying.\n * GridIndex splits the plane into a set of \"cells\" and keeps track\n * of which geometries intersect with each cell. At query time,\n * full geometry comparisons are only done for items that share\n * at least one cell. As long as the geometries are relatively\n * uniformly distributed across the plane, this greatly reduces\n * the number of comparisons necessary.\n *\n * @private\n */\nclass GridIndex {\n circleKeys: Array;\n boxKeys: Array;\n boxCells: Array>;\n circleCells: Array>;\n bboxes: Array;\n circles: Array;\n xCellCount: number;\n yCellCount: number;\n width: number;\n height: number;\n xScale: number;\n yScale: number;\n boxUid: number;\n circleUid: number;\n\n constructor (width: number, height: number, cellSize: number) {\n const boxCells = this.boxCells = [];\n const circleCells = this.circleCells = [];\n\n // More cells -> fewer geometries to check per cell, but items tend\n // to be split across more cells.\n // Sweet spot allows most small items to fit in one cell\n this.xCellCount = Math.ceil(width / cellSize);\n this.yCellCount = Math.ceil(height / cellSize);\n\n for (let i = 0; i < this.xCellCount * this.yCellCount; i++) {\n boxCells.push([]);\n circleCells.push([]);\n }\n this.circleKeys = [];\n this.boxKeys = [];\n this.bboxes = [];\n this.circles = [];\n\n this.width = width;\n this.height = height;\n this.xScale = this.xCellCount / width;\n this.yScale = this.yCellCount / height;\n this.boxUid = 0;\n this.circleUid = 0;\n }\n\n keysLength() {\n return this.boxKeys.length + this.circleKeys.length;\n }\n\n insert(key: any, x1: number, y1: number, x2: number, y2: number) {\n this._forEachCell(x1, y1, x2, y2, this._insertBoxCell, this.boxUid++);\n this.boxKeys.push(key);\n this.bboxes.push(x1);\n this.bboxes.push(y1);\n this.bboxes.push(x2);\n this.bboxes.push(y2);\n }\n\n insertCircle(key: any, x: number, y: number, radius: number) {\n // Insert circle into grid for all cells in the circumscribing square\n // It's more than necessary (by a factor of 4/PI), but fast to insert\n this._forEachCell(x - radius, y - radius, x + radius, y + radius, this._insertCircleCell, this.circleUid++);\n this.circleKeys.push(key);\n this.circles.push(x);\n this.circles.push(y);\n this.circles.push(radius);\n }\n\n _insertBoxCell(x1: number, y1: number, x2: number, y2: number, cellIndex: number, uid: number) {\n this.boxCells[cellIndex].push(uid);\n }\n\n _insertCircleCell(x1: number, y1: number, x2: number, y2: number, cellIndex: number, uid: number) {\n this.circleCells[cellIndex].push(uid);\n }\n\n _query(x1: number, y1: number, x2: number, y2: number, hitTest: boolean, predicate?: any) {\n if (x2 < 0 || x1 > this.width || y2 < 0 || y1 > this.height) {\n return hitTest ? false : [];\n }\n const result = [];\n if (x1 <= 0 && y1 <= 0 && this.width <= x2 && this.height <= y2) {\n if (hitTest) {\n return true;\n }\n for (let boxUid = 0; boxUid < this.boxKeys.length; boxUid++) {\n result.push({\n key: this.boxKeys[boxUid],\n x1: this.bboxes[boxUid * 4],\n y1: this.bboxes[boxUid * 4 + 1],\n x2: this.bboxes[boxUid * 4 + 2],\n y2: this.bboxes[boxUid * 4 + 3]\n });\n }\n for (let circleUid = 0; circleUid < this.circleKeys.length; circleUid++) {\n const x = this.circles[circleUid * 3];\n const y = this.circles[circleUid * 3 + 1];\n const radius = this.circles[circleUid * 3 + 2];\n result.push({\n key: this.circleKeys[circleUid],\n x1: x - radius,\n y1: y - radius,\n x2: x + radius,\n y2: y + radius\n });\n }\n return predicate ? result.filter(predicate) : result;\n } else {\n const queryArgs = {\n hitTest,\n seenUids: {box: {}, circle: {}}\n };\n this._forEachCell(x1, y1, x2, y2, this._queryCell, result, queryArgs, predicate);\n return hitTest ? result.length > 0 : result;\n }\n }\n\n _queryCircle(x: number, y: number, radius: number, hitTest: boolean, predicate?: any) {\n // Insert circle into grid for all cells in the circumscribing square\n // It's more than necessary (by a factor of 4/PI), but fast to insert\n const x1 = x - radius;\n const x2 = x + radius;\n const y1 = y - radius;\n const y2 = y + radius;\n if (x2 < 0 || x1 > this.width || y2 < 0 || y1 > this.height) {\n return hitTest ? false : [];\n }\n\n // Box query early exits if the bounding box is larger than the grid, but we don't do\n // the equivalent calculation for circle queries because early exit is less likely\n // and the calculation is more expensive\n const result = [];\n const queryArgs = {\n hitTest,\n circle: {x, y, radius},\n seenUids: {box: {}, circle: {}}\n };\n this._forEachCell(x1, y1, x2, y2, this._queryCellCircle, result, queryArgs, predicate);\n return hitTest ? result.length > 0 : result;\n }\n\n query(x1: number, y1: number, x2: number, y2: number, predicate?: any): Array {\n return (this._query(x1, y1, x2, y2, false, predicate): any);\n }\n\n hitTest(x1: number, y1: number, x2: number, y2: number, predicate?: any): boolean {\n return (this._query(x1, y1, x2, y2, true, predicate): any);\n }\n\n hitTestCircle(x: number, y: number, radius: number, predicate?: any): boolean {\n return (this._queryCircle(x, y, radius, true, predicate): any);\n }\n\n _queryCell(x1: number, y1: number, x2: number, y2: number, cellIndex: number, result: any, queryArgs: any, predicate?: any) {\n const seenUids = queryArgs.seenUids;\n const boxCell = this.boxCells[cellIndex];\n if (boxCell !== null) {\n const bboxes = this.bboxes;\n for (const boxUid of boxCell) {\n if (!seenUids.box[boxUid]) {\n seenUids.box[boxUid] = true;\n const offset = boxUid * 4;\n if ((x1 <= bboxes[offset + 2]) &&\n (y1 <= bboxes[offset + 3]) &&\n (x2 >= bboxes[offset + 0]) &&\n (y2 >= bboxes[offset + 1]) &&\n (!predicate || predicate(this.boxKeys[boxUid]))) {\n if (queryArgs.hitTest) {\n result.push(true);\n return true;\n } else {\n result.push({\n key: this.boxKeys[boxUid],\n x1: bboxes[offset],\n y1: bboxes[offset + 1],\n x2: bboxes[offset + 2],\n y2: bboxes[offset + 3]\n });\n }\n }\n }\n }\n }\n const circleCell = this.circleCells[cellIndex];\n if (circleCell !== null) {\n const circles = this.circles;\n for (const circleUid of circleCell) {\n if (!seenUids.circle[circleUid]) {\n seenUids.circle[circleUid] = true;\n const offset = circleUid * 3;\n if (this._circleAndRectCollide(\n circles[offset],\n circles[offset + 1],\n circles[offset + 2],\n x1,\n y1,\n x2,\n y2) &&\n (!predicate || predicate(this.circleKeys[circleUid]))) {\n if (queryArgs.hitTest) {\n result.push(true);\n return true;\n } else {\n const x = circles[offset];\n const y = circles[offset + 1];\n const radius = circles[offset + 2];\n result.push({\n key: this.circleKeys[circleUid],\n x1: x - radius,\n y1: y - radius,\n x2: x + radius,\n y2: y + radius\n });\n }\n }\n }\n }\n }\n }\n\n _queryCellCircle(x1: number, y1: number, x2: number, y2: number, cellIndex: number, result: any, queryArgs: any, predicate?: any) {\n const circle = queryArgs.circle;\n const seenUids = queryArgs.seenUids;\n const boxCell = this.boxCells[cellIndex];\n if (boxCell !== null) {\n const bboxes = this.bboxes;\n for (const boxUid of boxCell) {\n if (!seenUids.box[boxUid]) {\n seenUids.box[boxUid] = true;\n const offset = boxUid * 4;\n if (this._circleAndRectCollide(\n circle.x,\n circle.y,\n circle.radius,\n bboxes[offset + 0],\n bboxes[offset + 1],\n bboxes[offset + 2],\n bboxes[offset + 3]) &&\n (!predicate || predicate(this.boxKeys[boxUid]))) {\n result.push(true);\n return true;\n }\n }\n }\n }\n\n const circleCell = this.circleCells[cellIndex];\n if (circleCell !== null) {\n const circles = this.circles;\n for (const circleUid of circleCell) {\n if (!seenUids.circle[circleUid]) {\n seenUids.circle[circleUid] = true;\n const offset = circleUid * 3;\n if (this._circlesCollide(\n circles[offset],\n circles[offset + 1],\n circles[offset + 2],\n circle.x,\n circle.y,\n circle.radius) &&\n (!predicate || predicate(this.circleKeys[circleUid]))) {\n result.push(true);\n return true;\n }\n }\n }\n }\n }\n\n _forEachCell(x1: number, y1: number, x2: number, y2: number, fn: any, arg1: any, arg2?: any, predicate?: any) {\n const cx1 = this._convertToXCellCoord(x1);\n const cy1 = this._convertToYCellCoord(y1);\n const cx2 = this._convertToXCellCoord(x2);\n const cy2 = this._convertToYCellCoord(y2);\n\n for (let x = cx1; x <= cx2; x++) {\n for (let y = cy1; y <= cy2; y++) {\n const cellIndex = this.xCellCount * y + x;\n if (fn.call(this, x1, y1, x2, y2, cellIndex, arg1, arg2, predicate)) return;\n }\n }\n }\n\n _convertToXCellCoord(x: number) {\n return Math.max(0, Math.min(this.xCellCount - 1, Math.floor(x * this.xScale)));\n }\n\n _convertToYCellCoord(y: number) {\n return Math.max(0, Math.min(this.yCellCount - 1, Math.floor(y * this.yScale)));\n }\n\n _circlesCollide(x1: number, y1: number, r1: number, x2: number, y2: number, r2: number): boolean {\n const dx = x2 - x1;\n const dy = y2 - y1;\n const bothRadii = r1 + r2;\n return (bothRadii * bothRadii) > (dx * dx + dy * dy);\n }\n\n _circleAndRectCollide(circleX: number, circleY: number, radius: number, x1: number, y1: number, x2: number, y2: number): boolean {\n const halfRectWidth = (x2 - x1) / 2;\n const distX = Math.abs(circleX - (x1 + halfRectWidth));\n if (distX > (halfRectWidth + radius)) {\n return false;\n }\n\n const halfRectHeight = (y2 - y1) / 2;\n const distY = Math.abs(circleY - (y1 + halfRectHeight));\n if (distY > (halfRectHeight + radius)) {\n return false;\n }\n\n if (distX <= halfRectWidth || distY <= halfRectHeight) {\n return true;\n }\n\n const dx = distX - halfRectWidth;\n const dy = distY - halfRectHeight;\n return (dx * dx + dy * dy <= (radius * radius));\n }\n}\n\nexport default GridIndex;\n","// @flow\n\nimport Point from '@mapbox/point-geometry';\n\nimport {mat4, vec4} from 'gl-matrix';\nimport * as symbolSize from './symbol_size';\nimport {addDynamicAttributes} from '../data/bucket/symbol_bucket';\n\nimport type Painter from '../render/painter';\nimport type Transform from '../geo/transform';\nimport type SymbolBucket from '../data/bucket/symbol_bucket';\nimport type {\n GlyphOffsetArray,\n SymbolLineVertexArray,\n SymbolDynamicLayoutArray\n} from '../data/array_types';\nimport {WritingMode} from '../symbol/shaping';\n\nexport {updateLineLabels, hideGlyphs, getLabelPlaneMatrix, getGlCoordMatrix, project, getPerspectiveRatio, placeFirstAndLastGlyph, placeGlyphAlongLine, xyTransformMat4};\n\n/*\n * # Overview of coordinate spaces\n *\n * ## Tile coordinate spaces\n * Each label has an anchor. Some labels have corresponding line geometries.\n * The points for both anchors and lines are stored in tile units. Each tile has it's own\n * coordinate space going from (0, 0) at the top left to (EXTENT, EXTENT) at the bottom right.\n *\n * ## GL coordinate space\n * At the end of everything, the vertex shader needs to produce a position in GL coordinate space,\n * which is (-1, 1) at the top left and (1, -1) in the bottom right.\n *\n * ## Map pixel coordinate spaces\n * Each tile has a pixel coordinate space. It's just the tile units scaled so that one unit is\n * whatever counts as 1 pixel at the current zoom.\n * This space is used for pitch-alignment=map, rotation-alignment=map\n *\n * ## Rotated map pixel coordinate spaces\n * Like the above, but rotated so axis of the space are aligned with the viewport instead of the tile.\n * This space is used for pitch-alignment=map, rotation-alignment=viewport\n *\n * ## Viewport pixel coordinate space\n * (0, 0) is at the top left of the canvas and (pixelWidth, pixelHeight) is at the bottom right corner\n * of the canvas. This space is used for pitch-alignment=viewport\n *\n *\n * # Vertex projection\n * It goes roughly like this:\n * 1. project the anchor and line from tile units into the correct label coordinate space\n * - map pixel space pitch-alignment=map rotation-alignment=map\n * - rotated map pixel space pitch-alignment=map rotation-alignment=viewport\n * - viewport pixel space pitch-alignment=viewport rotation-alignment=*\n * 2. if the label follows a line, find the point along the line that is the correct distance from the anchor.\n * 3. add the glyph's corner offset to the point from step 3\n * 4. convert from the label coordinate space to gl coordinates\n *\n * For horizontal labels we want to do step 1 in the shader for performance reasons (no cpu work).\n * This is what `u_label_plane_matrix` is used for.\n * For labels aligned with lines we have to steps 1 and 2 on the cpu since we need access to the line geometry.\n * This is what `updateLineLabels(...)` does.\n * Since the conversion is handled on the cpu we just set `u_label_plane_matrix` to an identity matrix.\n *\n * Steps 3 and 4 are done in the shaders for all labels.\n */\n\n/*\n * Returns a matrix for converting from tile units to the correct label coordinate space.\n */\nfunction getLabelPlaneMatrix(posMatrix: mat4,\n pitchWithMap: boolean,\n rotateWithMap: boolean,\n transform: Transform,\n pixelsToTileUnits: number) {\n const m = mat4.create();\n if (pitchWithMap) {\n mat4.scale(m, m, [1 / pixelsToTileUnits, 1 / pixelsToTileUnits, 1]);\n if (!rotateWithMap) {\n mat4.rotateZ(m, m, transform.angle);\n }\n } else {\n mat4.multiply(m, transform.labelPlaneMatrix, posMatrix);\n }\n return m;\n}\n\n/*\n * Returns a matrix for converting from the correct label coordinate space to gl coords.\n */\nfunction getGlCoordMatrix(posMatrix: mat4,\n pitchWithMap: boolean,\n rotateWithMap: boolean,\n transform: Transform,\n pixelsToTileUnits: number) {\n if (pitchWithMap) {\n const m = mat4.clone(posMatrix);\n mat4.scale(m, m, [pixelsToTileUnits, pixelsToTileUnits, 1]);\n if (!rotateWithMap) {\n mat4.rotateZ(m, m, -transform.angle);\n }\n return m;\n } else {\n return transform.glCoordMatrix;\n }\n}\n\nfunction project(point: Point, matrix: mat4) {\n const pos = [point.x, point.y, 0, 1];\n xyTransformMat4(pos, pos, matrix);\n const w = pos[3];\n return {\n point: new Point(pos[0] / w, pos[1] / w),\n signedDistanceFromCamera: w\n };\n}\n\nfunction getPerspectiveRatio(cameraToCenterDistance: number, signedDistanceFromCamera: number): number {\n return 0.5 + 0.5 * (cameraToCenterDistance / signedDistanceFromCamera);\n}\n\nfunction isVisible(anchorPos: [number, number, number, number],\n clippingBuffer: [number, number]) {\n const x = anchorPos[0] / anchorPos[3];\n const y = anchorPos[1] / anchorPos[3];\n const inPaddedViewport = (\n x >= -clippingBuffer[0] &&\n x <= clippingBuffer[0] &&\n y >= -clippingBuffer[1] &&\n y <= clippingBuffer[1]);\n return inPaddedViewport;\n}\n\n/*\n * Update the `dynamicLayoutVertexBuffer` for the buffer with the correct glyph positions for the current map view.\n * This is only run on labels that are aligned with lines. Horizontal labels are handled entirely in the shader.\n */\nfunction updateLineLabels(bucket: SymbolBucket,\n posMatrix: mat4,\n painter: Painter,\n isText: boolean,\n labelPlaneMatrix: mat4,\n glCoordMatrix: mat4,\n pitchWithMap: boolean,\n keepUpright: boolean) {\n\n const sizeData = isText ? bucket.textSizeData : bucket.iconSizeData;\n const partiallyEvaluatedSize = symbolSize.evaluateSizeForZoom(sizeData, painter.transform.zoom);\n\n const clippingBuffer = [256 / painter.width * 2 + 1, 256 / painter.height * 2 + 1];\n\n const dynamicLayoutVertexArray = isText ?\n bucket.text.dynamicLayoutVertexArray :\n bucket.icon.dynamicLayoutVertexArray;\n dynamicLayoutVertexArray.clear();\n\n const lineVertexArray = bucket.lineVertexArray;\n const placedSymbols = isText ? bucket.text.placedSymbolArray : bucket.icon.placedSymbolArray;\n\n const aspectRatio = painter.transform.width / painter.transform.height;\n\n let useVertical = false;\n\n for (let s = 0; s < placedSymbols.length; s++) {\n const symbol: any = placedSymbols.get(s);\n\n // Don't do calculations for vertical glyphs unless the previous symbol was horizontal\n // and we determined that vertical glyphs were necessary.\n // Also don't do calculations for symbols that are collided and fully faded out\n if (symbol.hidden || symbol.writingMode === WritingMode.vertical && !useVertical) {\n hideGlyphs(symbol.numGlyphs, dynamicLayoutVertexArray);\n continue;\n }\n // Awkward... but we're counting on the paired \"vertical\" symbol coming immediately after its horizontal counterpart\n useVertical = false;\n\n const anchorPos = [symbol.anchorX, symbol.anchorY, 0, 1];\n vec4.transformMat4(anchorPos, anchorPos, posMatrix);\n\n // Don't bother calculating the correct point for invisible labels.\n if (!isVisible(anchorPos, clippingBuffer)) {\n hideGlyphs(symbol.numGlyphs, dynamicLayoutVertexArray);\n continue;\n }\n\n const cameraToAnchorDistance = anchorPos[3];\n const perspectiveRatio = getPerspectiveRatio(painter.transform.cameraToCenterDistance, cameraToAnchorDistance);\n\n const fontSize = symbolSize.evaluateSizeForFeature(sizeData, partiallyEvaluatedSize, symbol);\n const pitchScaledFontSize = pitchWithMap ? fontSize / perspectiveRatio : fontSize * perspectiveRatio;\n\n const tileAnchorPoint = new Point(symbol.anchorX, symbol.anchorY);\n const anchorPoint = project(tileAnchorPoint, labelPlaneMatrix).point;\n const projectionCache = {};\n\n const placeUnflipped: any = placeGlyphsAlongLine(symbol, pitchScaledFontSize, false /*unflipped*/, keepUpright, posMatrix, labelPlaneMatrix, glCoordMatrix,\n bucket.glyphOffsetArray, lineVertexArray, dynamicLayoutVertexArray, anchorPoint, tileAnchorPoint, projectionCache, aspectRatio);\n\n useVertical = placeUnflipped.useVertical;\n\n if (placeUnflipped.notEnoughRoom || useVertical ||\n (placeUnflipped.needsFlipping &&\n placeGlyphsAlongLine(symbol, pitchScaledFontSize, true /*flipped*/, keepUpright, posMatrix, labelPlaneMatrix, glCoordMatrix,\n bucket.glyphOffsetArray, lineVertexArray, dynamicLayoutVertexArray, anchorPoint, tileAnchorPoint, projectionCache, aspectRatio).notEnoughRoom)) {\n hideGlyphs(symbol.numGlyphs, dynamicLayoutVertexArray);\n }\n }\n\n if (isText) {\n bucket.text.dynamicLayoutVertexBuffer.updateData(dynamicLayoutVertexArray);\n } else {\n bucket.icon.dynamicLayoutVertexBuffer.updateData(dynamicLayoutVertexArray);\n }\n}\n\nfunction placeFirstAndLastGlyph(fontScale: number, glyphOffsetArray: GlyphOffsetArray, lineOffsetX: number, lineOffsetY: number, flip: boolean, anchorPoint: Point, tileAnchorPoint: Point, symbol: any, lineVertexArray: SymbolLineVertexArray, labelPlaneMatrix: mat4, projectionCache: any) {\n const glyphEndIndex = symbol.glyphStartIndex + symbol.numGlyphs;\n const lineStartIndex = symbol.lineStartIndex;\n const lineEndIndex = symbol.lineStartIndex + symbol.lineLength;\n\n const firstGlyphOffset = glyphOffsetArray.getoffsetX(symbol.glyphStartIndex);\n const lastGlyphOffset = glyphOffsetArray.getoffsetX(glyphEndIndex - 1);\n\n const firstPlacedGlyph = placeGlyphAlongLine(fontScale * firstGlyphOffset, lineOffsetX, lineOffsetY, flip, anchorPoint, tileAnchorPoint, symbol.segment,\n lineStartIndex, lineEndIndex, lineVertexArray, labelPlaneMatrix, projectionCache);\n if (!firstPlacedGlyph)\n return null;\n\n const lastPlacedGlyph = placeGlyphAlongLine(fontScale * lastGlyphOffset, lineOffsetX, lineOffsetY, flip, anchorPoint, tileAnchorPoint, symbol.segment,\n lineStartIndex, lineEndIndex, lineVertexArray, labelPlaneMatrix, projectionCache);\n if (!lastPlacedGlyph)\n return null;\n\n return {first: firstPlacedGlyph, last: lastPlacedGlyph};\n}\n\nfunction requiresOrientationChange(writingMode, firstPoint, lastPoint, aspectRatio) {\n if (writingMode === WritingMode.horizontal) {\n // On top of choosing whether to flip, choose whether to render this version of the glyphs or the alternate\n // vertical glyphs. We can't just filter out vertical glyphs in the horizontal range because the horizontal\n // and vertical versions can have slightly different projections which could lead to angles where both or\n // neither showed.\n const rise = Math.abs(lastPoint.y - firstPoint.y);\n const run = Math.abs(lastPoint.x - firstPoint.x) * aspectRatio;\n if (rise > run) {\n return {useVertical: true};\n }\n }\n\n if (writingMode === WritingMode.vertical ? firstPoint.y < lastPoint.y : firstPoint.x > lastPoint.x) {\n // Includes \"horizontalOnly\" case for labels without vertical glyphs\n return {needsFlipping: true};\n }\n\n return null;\n}\n\nfunction placeGlyphsAlongLine(symbol, fontSize, flip, keepUpright, posMatrix, labelPlaneMatrix, glCoordMatrix, glyphOffsetArray, lineVertexArray, dynamicLayoutVertexArray, anchorPoint, tileAnchorPoint, projectionCache, aspectRatio) {\n const fontScale = fontSize / 24;\n const lineOffsetX = symbol.lineOffsetX * fontScale;\n const lineOffsetY = symbol.lineOffsetY * fontScale;\n\n let placedGlyphs;\n if (symbol.numGlyphs > 1) {\n const glyphEndIndex = symbol.glyphStartIndex + symbol.numGlyphs;\n const lineStartIndex = symbol.lineStartIndex;\n const lineEndIndex = symbol.lineStartIndex + symbol.lineLength;\n\n // Place the first and the last glyph in the label first, so we can figure out\n // the overall orientation of the label and determine whether it needs to be flipped in keepUpright mode\n const firstAndLastGlyph = placeFirstAndLastGlyph(fontScale, glyphOffsetArray, lineOffsetX, lineOffsetY, flip, anchorPoint, tileAnchorPoint, symbol, lineVertexArray, labelPlaneMatrix, projectionCache);\n if (!firstAndLastGlyph) {\n return {notEnoughRoom: true};\n }\n const firstPoint = project(firstAndLastGlyph.first.point, glCoordMatrix).point;\n const lastPoint = project(firstAndLastGlyph.last.point, glCoordMatrix).point;\n\n if (keepUpright && !flip) {\n const orientationChange = requiresOrientationChange(symbol.writingMode, firstPoint, lastPoint, aspectRatio);\n if (orientationChange) {\n return orientationChange;\n }\n }\n\n placedGlyphs = [firstAndLastGlyph.first];\n for (let glyphIndex = symbol.glyphStartIndex + 1; glyphIndex < glyphEndIndex - 1; glyphIndex++) {\n // Since first and last glyph fit on the line, we're sure that the rest of the glyphs can be placed\n // $FlowFixMe\n placedGlyphs.push(placeGlyphAlongLine(fontScale * glyphOffsetArray.getoffsetX(glyphIndex), lineOffsetX, lineOffsetY, flip, anchorPoint, tileAnchorPoint, symbol.segment,\n lineStartIndex, lineEndIndex, lineVertexArray, labelPlaneMatrix, projectionCache));\n }\n placedGlyphs.push(firstAndLastGlyph.last);\n } else {\n // Only a single glyph to place\n // So, determine whether to flip based on projected angle of the line segment it's on\n if (keepUpright && !flip) {\n const a = project(tileAnchorPoint, posMatrix).point;\n const tileVertexIndex = (symbol.lineStartIndex + symbol.segment + 1);\n // $FlowFixMe\n const tileSegmentEnd = new Point(lineVertexArray.getx(tileVertexIndex), lineVertexArray.gety(tileVertexIndex));\n const projectedVertex = project(tileSegmentEnd, posMatrix);\n // We know the anchor will be in the viewport, but the end of the line segment may be\n // behind the plane of the camera, in which case we can use a point at any arbitrary (closer)\n // point on the segment.\n const b = (projectedVertex.signedDistanceFromCamera > 0) ?\n projectedVertex.point :\n projectTruncatedLineSegment(tileAnchorPoint, tileSegmentEnd, a, 1, posMatrix);\n\n const orientationChange = requiresOrientationChange(symbol.writingMode, a, b, aspectRatio);\n if (orientationChange) {\n return orientationChange;\n }\n }\n // $FlowFixMe\n const singleGlyph = placeGlyphAlongLine(fontScale * glyphOffsetArray.getoffsetX(symbol.glyphStartIndex), lineOffsetX, lineOffsetY, flip, anchorPoint, tileAnchorPoint, symbol.segment,\n symbol.lineStartIndex, symbol.lineStartIndex + symbol.lineLength, lineVertexArray, labelPlaneMatrix, projectionCache);\n if (!singleGlyph)\n return {notEnoughRoom: true};\n\n placedGlyphs = [singleGlyph];\n }\n\n for (const glyph: any of placedGlyphs) {\n addDynamicAttributes(dynamicLayoutVertexArray, glyph.point, glyph.angle);\n }\n return {};\n}\n\nfunction projectTruncatedLineSegment(previousTilePoint: Point, currentTilePoint: Point, previousProjectedPoint: Point, minimumLength: number, projectionMatrix: mat4) {\n // We are assuming \"previousTilePoint\" won't project to a point within one unit of the camera plane\n // If it did, that would mean our label extended all the way out from within the viewport to a (very distant)\n // point near the plane of the camera. We wouldn't be able to render the label anyway once it crossed the\n // plane of the camera.\n const projectedUnitVertex = project(previousTilePoint.add(previousTilePoint.sub(currentTilePoint)._unit()), projectionMatrix).point;\n const projectedUnitSegment = previousProjectedPoint.sub(projectedUnitVertex);\n\n return previousProjectedPoint.add(projectedUnitSegment._mult(minimumLength / projectedUnitSegment.mag()));\n}\n\nfunction placeGlyphAlongLine(offsetX: number,\n lineOffsetX: number,\n lineOffsetY: number,\n flip: boolean,\n anchorPoint: Point,\n tileAnchorPoint: Point,\n anchorSegment: number,\n lineStartIndex: number,\n lineEndIndex: number,\n lineVertexArray: SymbolLineVertexArray,\n labelPlaneMatrix: mat4,\n projectionCache: {[_: number]: Point}) {\n\n const combinedOffsetX = flip ?\n offsetX - lineOffsetX :\n offsetX + lineOffsetX;\n\n let dir = combinedOffsetX > 0 ? 1 : -1;\n\n let angle = 0;\n if (flip) {\n // The label needs to be flipped to keep text upright.\n // Iterate in the reverse direction.\n dir *= -1;\n angle = Math.PI;\n }\n\n if (dir < 0) angle += Math.PI;\n\n let currentIndex = dir > 0 ?\n lineStartIndex + anchorSegment :\n lineStartIndex + anchorSegment + 1;\n\n let current = anchorPoint;\n let prev = anchorPoint;\n let distanceToPrev = 0;\n let currentSegmentDistance = 0;\n const absOffsetX = Math.abs(combinedOffsetX);\n const pathVertices = [];\n\n while (distanceToPrev + currentSegmentDistance <= absOffsetX) {\n currentIndex += dir;\n\n // offset does not fit on the projected line\n if (currentIndex < lineStartIndex || currentIndex >= lineEndIndex)\n return null;\n\n prev = current;\n pathVertices.push(current);\n\n current = projectionCache[currentIndex];\n if (current === undefined) {\n const currentVertex = new Point(lineVertexArray.getx(currentIndex), lineVertexArray.gety(currentIndex));\n const projection = project(currentVertex, labelPlaneMatrix);\n if (projection.signedDistanceFromCamera > 0) {\n current = projectionCache[currentIndex] = projection.point;\n } else {\n // The vertex is behind the plane of the camera, so we can't project it\n // Instead, we'll create a vertex along the line that's far enough to include the glyph\n const previousLineVertexIndex = currentIndex - dir;\n const previousTilePoint = distanceToPrev === 0 ?\n tileAnchorPoint :\n new Point(lineVertexArray.getx(previousLineVertexIndex), lineVertexArray.gety(previousLineVertexIndex));\n // Don't cache because the new vertex might not be far enough out for future glyphs on the same segment\n current = projectTruncatedLineSegment(previousTilePoint, currentVertex, prev, absOffsetX - distanceToPrev + 1, labelPlaneMatrix);\n }\n }\n\n distanceToPrev += currentSegmentDistance;\n currentSegmentDistance = prev.dist(current);\n }\n\n // The point is on the current segment. Interpolate to find it.\n const segmentInterpolationT = (absOffsetX - distanceToPrev) / currentSegmentDistance;\n const prevToCurrent = current.sub(prev);\n const p = prevToCurrent.mult(segmentInterpolationT)._add(prev);\n\n // offset the point from the line to text-offset and icon-offset\n p._add(prevToCurrent._unit()._perp()._mult(lineOffsetY * dir));\n\n const segmentAngle = angle + Math.atan2(current.y - prev.y, current.x - prev.x);\n\n pathVertices.push(p);\n\n return {\n point: p,\n angle: segmentAngle,\n path: pathVertices\n };\n}\n\nconst hiddenGlyphAttributes = new Float32Array([-Infinity, -Infinity, 0, -Infinity, -Infinity, 0, -Infinity, -Infinity, 0, -Infinity, -Infinity, 0]);\n\n// Hide them by moving them offscreen. We still need to add them to the buffer\n// because the dynamic buffer is paired with a static buffer that doesn't get updated.\nfunction hideGlyphs(num: number, dynamicLayoutVertexArray: SymbolDynamicLayoutArray) {\n for (let i = 0; i < num; i++) {\n const offset = dynamicLayoutVertexArray.length;\n dynamicLayoutVertexArray.resize(offset + 4);\n // Since all hidden glyphs have the same attributes, we can build up the array faster with a single call to Float32Array.set\n // for each set of four vertices, instead of calling addDynamicAttributes for each vertex.\n dynamicLayoutVertexArray.float32.set(hiddenGlyphAttributes, offset * 3);\n }\n}\n\n// For line label layout, we're not using z output and our w input is always 1\n// This custom matrix transformation ignores those components to make projection faster\nfunction xyTransformMat4(out: vec4, a: vec4, m: mat4) {\n const x = a[0], y = a[1];\n out[0] = m[0] * x + m[4] * y + m[12];\n out[1] = m[1] * x + m[5] * y + m[13];\n out[3] = m[3] * x + m[7] * y + m[15];\n return out;\n}\n","// @flow\n\nimport Point from '@mapbox/point-geometry';\nimport clipLine from './clip_line';\nimport PathInterpolator from './path_interpolator';\n\nimport * as intersectionTests from '../util/intersection_tests';\nimport Grid from './grid_index';\nimport {mat4} from 'gl-matrix';\nimport ONE_EM from '../symbol/one_em';\nimport assert from 'assert';\n\nimport * as projection from '../symbol/projection';\n\nimport type Transform from '../geo/transform';\nimport type {SingleCollisionBox} from '../data/bucket/symbol_bucket';\nimport type {\n GlyphOffsetArray,\n SymbolLineVertexArray\n} from '../data/array_types';\n\n// When a symbol crosses the edge that causes it to be included in\n// collision detection, it will cause changes in the symbols around\n// it. This constant specifies how many pixels to pad the edge of\n// the viewport for collision detection so that the bulk of the changes\n// occur offscreen. Making this constant greater increases label\n// stability, but it's expensive.\nconst viewportPadding = 100;\n\n/**\n * A collision index used to prevent symbols from overlapping. It keep tracks of\n * where previous symbols have been placed and is used to check if a new\n * symbol overlaps with any previously added symbols.\n *\n * There are two steps to insertion: first placeCollisionBox/Circles checks if\n * there's room for a symbol, then insertCollisionBox/Circles actually puts the\n * symbol in the index. The two step process allows paired symbols to be inserted\n * together even if they overlap.\n *\n * @private\n */\nclass CollisionIndex {\n grid: Grid;\n ignoredGrid: Grid;\n transform: Transform;\n pitchfactor: number;\n screenRightBoundary: number;\n screenBottomBoundary: number;\n gridRightBoundary: number;\n gridBottomBoundary: number;\n\n constructor(\n transform: Transform,\n grid: Grid = new Grid(transform.width + 2 * viewportPadding, transform.height + 2 * viewportPadding, 25),\n ignoredGrid: Grid = new Grid(transform.width + 2 * viewportPadding, transform.height + 2 * viewportPadding, 25)\n ) {\n this.transform = transform;\n\n this.grid = grid;\n this.ignoredGrid = ignoredGrid;\n this.pitchfactor = Math.cos(transform._pitch) * transform.cameraToCenterDistance;\n\n this.screenRightBoundary = transform.width + viewportPadding;\n this.screenBottomBoundary = transform.height + viewportPadding;\n this.gridRightBoundary = transform.width + 2 * viewportPadding;\n this.gridBottomBoundary = transform.height + 2 * viewportPadding;\n }\n\n placeCollisionBox(collisionBox: SingleCollisionBox, allowOverlap: boolean, textPixelRatio: number, posMatrix: mat4, collisionGroupPredicate?: any): { box: Array, offscreen: boolean } {\n const projectedPoint = this.projectAndGetPerspectiveRatio(posMatrix, collisionBox.anchorPointX, collisionBox.anchorPointY);\n const tileToViewport = textPixelRatio * projectedPoint.perspectiveRatio;\n const tlX = collisionBox.x1 * tileToViewport + projectedPoint.point.x;\n const tlY = collisionBox.y1 * tileToViewport + projectedPoint.point.y;\n const brX = collisionBox.x2 * tileToViewport + projectedPoint.point.x;\n const brY = collisionBox.y2 * tileToViewport + projectedPoint.point.y;\n\n if (!this.isInsideGrid(tlX, tlY, brX, brY) ||\n (!allowOverlap && this.grid.hitTest(tlX, tlY, brX, brY, collisionGroupPredicate))) {\n return {\n box: [],\n offscreen: false\n };\n }\n\n return {\n box: [tlX, tlY, brX, brY],\n offscreen: this.isOffscreen(tlX, tlY, brX, brY)\n };\n }\n\n placeCollisionCircles(allowOverlap: boolean,\n symbol: any,\n lineVertexArray: SymbolLineVertexArray,\n glyphOffsetArray: GlyphOffsetArray,\n fontSize: number,\n posMatrix: mat4,\n labelPlaneMatrix: mat4,\n labelToScreenMatrix?: mat4,\n showCollisionCircles: boolean,\n pitchWithMap: boolean,\n collisionGroupPredicate?: any,\n circlePixelDiameter: number,\n textPixelPadding: number): { circles: Array, offscreen: boolean, collisionDetected: boolean } {\n const placedCollisionCircles = [];\n\n const tileUnitAnchorPoint = new Point(symbol.anchorX, symbol.anchorY);\n const screenAnchorPoint = projection.project(tileUnitAnchorPoint, posMatrix);\n const perspectiveRatio = projection.getPerspectiveRatio(this.transform.cameraToCenterDistance, screenAnchorPoint.signedDistanceFromCamera);\n const labelPlaneFontSize = pitchWithMap ? fontSize / perspectiveRatio : fontSize * perspectiveRatio;\n const labelPlaneFontScale = labelPlaneFontSize / ONE_EM;\n\n const labelPlaneAnchorPoint = projection.project(tileUnitAnchorPoint, labelPlaneMatrix).point;\n\n const projectionCache = {};\n const lineOffsetX = symbol.lineOffsetX * labelPlaneFontScale;\n const lineOffsetY = symbol.lineOffsetY * labelPlaneFontScale;\n\n const firstAndLastGlyph = projection.placeFirstAndLastGlyph(\n labelPlaneFontScale,\n glyphOffsetArray,\n lineOffsetX,\n lineOffsetY,\n /*flip*/ false,\n labelPlaneAnchorPoint,\n tileUnitAnchorPoint,\n symbol,\n lineVertexArray,\n labelPlaneMatrix,\n projectionCache);\n\n let collisionDetected = false;\n let inGrid = false;\n let entirelyOffscreen = true;\n\n if (firstAndLastGlyph) {\n const radius = circlePixelDiameter * 0.5 * perspectiveRatio + textPixelPadding;\n const screenPlaneMin = new Point(-viewportPadding, -viewportPadding);\n const screenPlaneMax = new Point(this.screenRightBoundary, this.screenBottomBoundary);\n const interpolator = new PathInterpolator();\n\n // Construct a projected path from projected line vertices. Anchor points are ignored and removed\n const first = firstAndLastGlyph.first;\n const last = firstAndLastGlyph.last;\n\n let projectedPath = [];\n for (let i = first.path.length - 1; i >= 1; i--) {\n projectedPath.push(first.path[i]);\n }\n for (let i = 1; i < last.path.length; i++) {\n projectedPath.push(last.path[i]);\n }\n assert(projectedPath.length >= 2);\n\n // Tolerate a slightly longer distance than one diameter between two adjacent circles\n const circleDist = radius * 2.5;\n\n // The path might need to be converted into screen space if a pitched map is used as the label space\n if (labelToScreenMatrix) {\n const screenSpacePath = projectedPath.map(p => projection.project(p, labelToScreenMatrix));\n\n // Do not try to place collision circles if even of the points is behind the camera.\n // This is a plausible scenario with big camera pitch angles\n if (screenSpacePath.some(point => point.signedDistanceFromCamera <= 0)) {\n projectedPath = [];\n } else {\n projectedPath = screenSpacePath.map(p => p.point);\n }\n }\n\n let segments = [];\n\n if (projectedPath.length > 0) {\n // Quickly check if the path is fully inside or outside of the padded collision region.\n // For overlapping paths we'll only create collision circles for the visible segments\n const minPoint = projectedPath[0].clone();\n const maxPoint = projectedPath[0].clone();\n\n for (let i = 1; i < projectedPath.length; i++) {\n minPoint.x = Math.min(minPoint.x, projectedPath[i].x);\n minPoint.y = Math.min(minPoint.y, projectedPath[i].y);\n maxPoint.x = Math.max(maxPoint.x, projectedPath[i].x);\n maxPoint.y = Math.max(maxPoint.y, projectedPath[i].y);\n }\n\n if (minPoint.x >= screenPlaneMin.x && maxPoint.x <= screenPlaneMax.x &&\n minPoint.y >= screenPlaneMin.y && maxPoint.y <= screenPlaneMax.y) {\n // Quad fully visible\n segments = [projectedPath];\n } else if (maxPoint.x < screenPlaneMin.x || minPoint.x > screenPlaneMax.x ||\n maxPoint.y < screenPlaneMin.y || minPoint.y > screenPlaneMax.y) {\n // Not visible\n segments = [];\n } else {\n segments = clipLine([projectedPath], screenPlaneMin.x, screenPlaneMin.y, screenPlaneMax.x, screenPlaneMax.y);\n }\n }\n\n for (const seg of segments) {\n // interpolate positions for collision circles. Add a small padding to both ends of the segment\n assert(seg.length > 0);\n interpolator.reset(seg, radius * 0.25);\n\n let numCircles = 0;\n\n if (interpolator.length <= 0.5 * radius) {\n numCircles = 1;\n } else {\n numCircles = Math.ceil(interpolator.paddedLength / circleDist) + 1;\n }\n\n for (let i = 0; i < numCircles; i++) {\n const t = i / Math.max(numCircles - 1, 1);\n const circlePosition = interpolator.lerp(t);\n\n // add viewport padding to the position and perform initial collision check\n const centerX = circlePosition.x + viewportPadding;\n const centerY = circlePosition.y + viewportPadding;\n\n placedCollisionCircles.push(centerX, centerY, radius, 0);\n\n const x1 = centerX - radius;\n const y1 = centerY - radius;\n const x2 = centerX + radius;\n const y2 = centerY + radius;\n\n entirelyOffscreen = entirelyOffscreen && this.isOffscreen(x1, y1, x2, y2);\n inGrid = inGrid || this.isInsideGrid(x1, y1, x2, y2);\n\n if (!allowOverlap) {\n if (this.grid.hitTestCircle(centerX, centerY, radius, collisionGroupPredicate)) {\n // Don't early exit if we're showing the debug circles because we still want to calculate\n // which circles are in use\n collisionDetected = true;\n if (!showCollisionCircles) {\n return {\n circles: [],\n offscreen: false,\n collisionDetected\n };\n }\n }\n }\n }\n }\n }\n\n return {\n circles: ((!showCollisionCircles && collisionDetected) || !inGrid) ? [] : placedCollisionCircles,\n offscreen: entirelyOffscreen,\n collisionDetected\n };\n }\n\n /**\n * Because the geometries in the CollisionIndex are an approximation of the shape of\n * symbols on the map, we use the CollisionIndex to look up the symbol part of\n * `queryRenderedFeatures`.\n *\n * @private\n */\n queryRenderedSymbols(viewportQueryGeometry: Array) {\n if (viewportQueryGeometry.length === 0 || (this.grid.keysLength() === 0 && this.ignoredGrid.keysLength() === 0)) {\n return {};\n }\n\n const query = [];\n let minX = Infinity;\n let minY = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n for (const point of viewportQueryGeometry) {\n const gridPoint = new Point(point.x + viewportPadding, point.y + viewportPadding);\n minX = Math.min(minX, gridPoint.x);\n minY = Math.min(minY, gridPoint.y);\n maxX = Math.max(maxX, gridPoint.x);\n maxY = Math.max(maxY, gridPoint.y);\n query.push(gridPoint);\n }\n\n const features = this.grid.query(minX, minY, maxX, maxY)\n .concat(this.ignoredGrid.query(minX, minY, maxX, maxY));\n\n const seenFeatures = {};\n const result = {};\n\n for (const feature of features) {\n const featureKey = feature.key;\n // Skip already seen features.\n if (seenFeatures[featureKey.bucketInstanceId] === undefined) {\n seenFeatures[featureKey.bucketInstanceId] = {};\n }\n if (seenFeatures[featureKey.bucketInstanceId][featureKey.featureIndex]) {\n continue;\n }\n\n // Check if query intersects with the feature box\n // \"Collision Circles\" for line labels are treated as boxes here\n // Since there's no actual collision taking place, the circle vs. square\n // distinction doesn't matter as much, and box geometry is easier\n // to work with.\n const bbox = [\n new Point(feature.x1, feature.y1),\n new Point(feature.x2, feature.y1),\n new Point(feature.x2, feature.y2),\n new Point(feature.x1, feature.y2)\n ];\n if (!intersectionTests.polygonIntersectsPolygon(query, bbox)) {\n continue;\n }\n\n seenFeatures[featureKey.bucketInstanceId][featureKey.featureIndex] = true;\n if (result[featureKey.bucketInstanceId] === undefined) {\n result[featureKey.bucketInstanceId] = [];\n }\n result[featureKey.bucketInstanceId].push(featureKey.featureIndex);\n }\n\n return result;\n }\n\n insertCollisionBox(collisionBox: Array, ignorePlacement: boolean, bucketInstanceId: number, featureIndex: number, collisionGroupID: number) {\n const grid = ignorePlacement ? this.ignoredGrid : this.grid;\n\n const key = {bucketInstanceId, featureIndex, collisionGroupID};\n grid.insert(key, collisionBox[0], collisionBox[1], collisionBox[2], collisionBox[3]);\n }\n\n insertCollisionCircles(collisionCircles: Array, ignorePlacement: boolean, bucketInstanceId: number, featureIndex: number, collisionGroupID: number) {\n const grid = ignorePlacement ? this.ignoredGrid : this.grid;\n\n const key = {bucketInstanceId, featureIndex, collisionGroupID};\n for (let k = 0; k < collisionCircles.length; k += 4) {\n grid.insertCircle(key, collisionCircles[k], collisionCircles[k + 1], collisionCircles[k + 2]);\n }\n }\n\n projectAndGetPerspectiveRatio(posMatrix: mat4, x: number, y: number) {\n const p = [x, y, 0, 1];\n projection.xyTransformMat4(p, p, posMatrix);\n const a = new Point(\n (((p[0] / p[3] + 1) / 2) * this.transform.width) + viewportPadding,\n (((-p[1] / p[3] + 1) / 2) * this.transform.height) + viewportPadding\n );\n return {\n point: a,\n // See perspective ratio comment in symbol_sdf.vertex\n // We're doing collision detection in viewport space so we need\n // to scale down boxes in the distance\n perspectiveRatio: 0.5 + 0.5 * (this.transform.cameraToCenterDistance / p[3])\n };\n }\n\n isOffscreen(x1: number, y1: number, x2: number, y2: number) {\n return x2 < viewportPadding || x1 >= this.screenRightBoundary || y2 < viewportPadding || y1 > this.screenBottomBoundary;\n }\n\n isInsideGrid(x1: number, y1: number, x2: number, y2: number) {\n return x2 >= 0 && x1 < this.gridRightBoundary && y2 >= 0 && y1 < this.gridBottomBoundary;\n }\n\n /*\n * Returns a matrix for transforming collision shapes to viewport coordinate space.\n * Use this function to render e.g. collision circles on the screen.\n * example transformation: clipPos = glCoordMatrix * viewportMatrix * circle_pos\n */\n getViewportMatrix(): mat4 {\n const m = mat4.identity([]);\n mat4.translate(m, m, [-viewportPadding, -viewportPadding, 0.0]);\n return m;\n }\n}\n\nexport default CollisionIndex;\n","// @flow\n\nimport EXTENT from '../data/extent';\n\nimport type {OverscaledTileID} from './tile_id';\n\n/**\n * Converts a pixel value at a the given zoom level to tile units.\n *\n * The shaders mostly calculate everything in tile units so style\n * properties need to be converted from pixels to tile units using this.\n *\n * For example, a translation by 30 pixels at zoom 6.5 will be a\n * translation by pixelsToTileUnits(30, 6.5) tile units.\n *\n * @returns value in tile units\n * @private\n */\nexport default function(tile: {tileID: OverscaledTileID, tileSize: number}, pixelValue: number, z: number): number {\n return pixelValue * (EXTENT / (tile.tileSize * Math.pow(2, z - tile.tileID.overscaledZ)));\n}\n","// @flow\n\nimport CollisionIndex from './collision_index';\nimport EXTENT from '../data/extent';\nimport * as symbolSize from './symbol_size';\nimport * as projection from './projection';\nimport {getAnchorJustification, evaluateVariableOffset} from './symbol_layout';\nimport {getAnchorAlignment, WritingMode} from './shaping';\nimport {mat4} from 'gl-matrix';\nimport assert from 'assert';\nimport pixelsToTileUnits from '../source/pixels_to_tile_units';\nimport Point from '@mapbox/point-geometry';\nimport type Transform from '../geo/transform';\nimport type StyleLayer from '../style/style_layer';\n\nimport type Tile from '../source/tile';\nimport type SymbolBucket, {CollisionArrays, SingleCollisionBox} from '../data/bucket/symbol_bucket';\nimport type {CollisionBoxArray, CollisionVertexArray, SymbolInstance} from '../data/array_types';\nimport type FeatureIndex from '../data/feature_index';\nimport type {OverscaledTileID} from '../source/tile_id';\nimport type {TextAnchor} from './symbol_layout';\n\nclass OpacityState {\n opacity: number;\n placed: boolean;\n constructor(prevState: ?OpacityState, increment: number, placed: boolean, skipFade: ?boolean) {\n if (prevState) {\n this.opacity = Math.max(0, Math.min(1, prevState.opacity + (prevState.placed ? increment : -increment)));\n } else {\n this.opacity = (skipFade && placed) ? 1 : 0;\n }\n this.placed = placed;\n }\n isHidden() {\n return this.opacity === 0 && !this.placed;\n }\n}\n\nclass JointOpacityState {\n text: OpacityState;\n icon: OpacityState;\n constructor(prevState: ?JointOpacityState, increment: number, placedText: boolean, placedIcon: boolean, skipFade: ?boolean) {\n this.text = new OpacityState(prevState ? prevState.text : null, increment, placedText, skipFade);\n this.icon = new OpacityState(prevState ? prevState.icon : null, increment, placedIcon, skipFade);\n }\n isHidden() {\n return this.text.isHidden() && this.icon.isHidden();\n }\n}\n\nclass JointPlacement {\n text: boolean;\n icon: boolean;\n // skipFade = outside viewport, but within CollisionIndex::viewportPadding px of the edge\n // Because these symbols aren't onscreen yet, we can skip the \"fade in\" animation,\n // and if a subsequent viewport change brings them into view, they'll be fully\n // visible right away.\n skipFade: boolean;\n constructor(text: boolean, icon: boolean, skipFade: boolean) {\n this.text = text;\n this.icon = icon;\n this.skipFade = skipFade;\n }\n}\n\nclass CollisionCircleArray {\n // Stores collision circles and placement matrices of a bucket for debug rendering.\n invProjMatrix: mat4;\n viewportMatrix: mat4;\n circles: Array;\n\n constructor() {\n this.invProjMatrix = mat4.create();\n this.viewportMatrix = mat4.create();\n this.circles = [];\n }\n}\n\nexport class RetainedQueryData {\n bucketInstanceId: number;\n featureIndex: FeatureIndex;\n sourceLayerIndex: number;\n bucketIndex: number;\n tileID: OverscaledTileID;\n featureSortOrder: ?Array\n constructor(bucketInstanceId: number,\n featureIndex: FeatureIndex,\n sourceLayerIndex: number,\n bucketIndex: number,\n tileID: OverscaledTileID) {\n this.bucketInstanceId = bucketInstanceId;\n this.featureIndex = featureIndex;\n this.sourceLayerIndex = sourceLayerIndex;\n this.bucketIndex = bucketIndex;\n this.tileID = tileID;\n }\n}\n\ntype CollisionGroup = { ID: number, predicate?: any };\n\nclass CollisionGroups {\n collisionGroups: {[groupName: string]: CollisionGroup};\n maxGroupID: number;\n crossSourceCollisions: boolean;\n\n constructor(crossSourceCollisions: boolean) {\n this.crossSourceCollisions = crossSourceCollisions;\n this.maxGroupID = 0;\n this.collisionGroups = {};\n }\n\n get(sourceID: string) {\n // The predicate/groupID mechanism allows for arbitrary grouping,\n // but the current interface defines one source == one group when\n // crossSourceCollisions == true.\n if (!this.crossSourceCollisions) {\n if (!this.collisionGroups[sourceID]) {\n const nextGroupID = ++this.maxGroupID;\n this.collisionGroups[sourceID] = {\n ID: nextGroupID,\n predicate: (key) => {\n return key.collisionGroupID === nextGroupID;\n }\n };\n }\n return this.collisionGroups[sourceID];\n } else {\n return {ID: 0, predicate: null};\n }\n }\n}\n\nfunction calculateVariableLayoutShift(anchor: TextAnchor, width: number, height: number, textOffset: [number, number], textBoxScale: number): Point {\n const {horizontalAlign, verticalAlign} = getAnchorAlignment(anchor);\n const shiftX = -(horizontalAlign - 0.5) * width;\n const shiftY = -(verticalAlign - 0.5) * height;\n const offset = evaluateVariableOffset(anchor, textOffset);\n return new Point(\n shiftX + offset[0] * textBoxScale,\n shiftY + offset[1] * textBoxScale\n );\n}\n\nfunction shiftVariableCollisionBox(collisionBox: SingleCollisionBox,\n shiftX: number, shiftY: number,\n rotateWithMap: boolean, pitchWithMap: boolean,\n angle: number) {\n const {x1, x2, y1, y2, anchorPointX, anchorPointY} = collisionBox;\n const rotatedOffset = new Point(shiftX, shiftY);\n if (rotateWithMap) {\n rotatedOffset._rotate(pitchWithMap ? angle : -angle);\n }\n return {\n x1: x1 + rotatedOffset.x,\n y1: y1 + rotatedOffset.y,\n x2: x2 + rotatedOffset.x,\n y2: y2 + rotatedOffset.y,\n // symbol anchor point stays the same regardless of text-anchor\n anchorPointX,\n anchorPointY\n };\n}\n\nexport type VariableOffset = {\n textOffset: [number, number],\n width: number,\n height: number,\n anchor: TextAnchor,\n textBoxScale: number,\n prevAnchor?: TextAnchor\n};\n\ntype TileLayerParameters = {\n bucket: SymbolBucket,\n layout: any,\n posMatrix: mat4,\n textLabelPlaneMatrix: mat4,\n labelToScreenMatrix: mat4,\n scale: number,\n textPixelRatio: number,\n holdingForFade: boolean,\n collisionBoxArray: ?CollisionBoxArray,\n partiallyEvaluatedTextSize: any,\n collisionGroup: any\n};\n\nexport type BucketPart = {\n sortKey?: number | void,\n symbolInstanceStart: number,\n symbolInstanceEnd: number,\n parameters: TileLayerParameters\n};\n\nexport type CrossTileID = string | number;\n\nexport class Placement {\n transform: Transform;\n collisionIndex: CollisionIndex;\n placements: { [_: CrossTileID]: JointPlacement };\n opacities: { [_: CrossTileID]: JointOpacityState };\n variableOffsets: {[_: CrossTileID]: VariableOffset };\n placedOrientations: {[_: CrossTileID]: number };\n commitTime: number;\n prevZoomAdjustment: number;\n lastPlacementChangeTime: number;\n stale: boolean;\n fadeDuration: number;\n retainedQueryData: {[_: number]: RetainedQueryData};\n collisionGroups: CollisionGroups;\n prevPlacement: ?Placement;\n zoomAtLastRecencyCheck: number;\n collisionCircleArrays: {[any]: CollisionCircleArray};\n\n constructor(transform: Transform, fadeDuration: number, crossSourceCollisions: boolean, prevPlacement?: Placement) {\n this.transform = transform.clone();\n this.collisionIndex = new CollisionIndex(this.transform);\n this.placements = {};\n this.opacities = {};\n this.variableOffsets = {};\n this.stale = false;\n this.commitTime = 0;\n this.fadeDuration = fadeDuration;\n this.retainedQueryData = {};\n this.collisionGroups = new CollisionGroups(crossSourceCollisions);\n this.collisionCircleArrays = {};\n\n this.prevPlacement = prevPlacement;\n if (prevPlacement) {\n prevPlacement.prevPlacement = undefined; // Only hold on to one placement back\n }\n\n this.placedOrientations = {};\n }\n\n getBucketParts(results: Array, styleLayer: StyleLayer, tile: Tile, sortAcrossTiles: boolean) {\n const symbolBucket = ((tile.getBucket(styleLayer): any): SymbolBucket);\n const bucketFeatureIndex = tile.latestFeatureIndex;\n if (!symbolBucket || !bucketFeatureIndex || styleLayer.id !== symbolBucket.layerIds[0])\n return;\n\n const collisionBoxArray = tile.collisionBoxArray;\n\n const layout = symbolBucket.layers[0].layout;\n\n const scale = Math.pow(2, this.transform.zoom - tile.tileID.overscaledZ);\n const textPixelRatio = tile.tileSize / EXTENT;\n\n const posMatrix = this.transform.calculatePosMatrix(tile.tileID.toUnwrapped());\n\n const pitchWithMap = layout.get('text-pitch-alignment') === 'map';\n const rotateWithMap = layout.get('text-rotation-alignment') === 'map';\n const pixelsToTiles = pixelsToTileUnits(tile, 1, this.transform.zoom);\n\n const textLabelPlaneMatrix = projection.getLabelPlaneMatrix(posMatrix,\n pitchWithMap,\n rotateWithMap,\n this.transform,\n pixelsToTiles);\n\n let labelToScreenMatrix = null;\n\n if (pitchWithMap) {\n const glMatrix = projection.getGlCoordMatrix(\n posMatrix,\n pitchWithMap,\n rotateWithMap,\n this.transform,\n pixelsToTiles);\n\n labelToScreenMatrix = mat4.multiply([], this.transform.labelPlaneMatrix, glMatrix);\n }\n\n // As long as this placement lives, we have to hold onto this bucket's\n // matching FeatureIndex/data for querying purposes\n this.retainedQueryData[symbolBucket.bucketInstanceId] = new RetainedQueryData(\n symbolBucket.bucketInstanceId,\n bucketFeatureIndex,\n symbolBucket.sourceLayerIndex,\n symbolBucket.index,\n tile.tileID\n );\n\n const parameters = {\n bucket: symbolBucket,\n layout,\n posMatrix,\n textLabelPlaneMatrix,\n labelToScreenMatrix,\n scale,\n textPixelRatio,\n holdingForFade: tile.holdingForFade(),\n collisionBoxArray,\n partiallyEvaluatedTextSize: symbolSize.evaluateSizeForZoom(symbolBucket.textSizeData, this.transform.zoom),\n collisionGroup: this.collisionGroups.get(symbolBucket.sourceID)\n };\n\n if (sortAcrossTiles) {\n for (const range of symbolBucket.sortKeyRanges) {\n const {sortKey, symbolInstanceStart, symbolInstanceEnd} = range;\n results.push({sortKey, symbolInstanceStart, symbolInstanceEnd, parameters});\n }\n } else {\n results.push({\n symbolInstanceStart: 0,\n symbolInstanceEnd: symbolBucket.symbolInstances.length,\n parameters\n });\n }\n }\n\n attemptAnchorPlacement(anchor: TextAnchor, textBox: SingleCollisionBox, width: number, height: number,\n textBoxScale: number, rotateWithMap: boolean,\n pitchWithMap: boolean, textPixelRatio: number, posMatrix: mat4, collisionGroup: CollisionGroup,\n textAllowOverlap: boolean, symbolInstance: SymbolInstance, bucket: SymbolBucket, orientation: number, iconBox: ?SingleCollisionBox): ?{ shift: Point, placedGlyphBoxes: { box: Array, offscreen: boolean } } {\n\n const textOffset = [symbolInstance.textOffset0, symbolInstance.textOffset1];\n const shift = calculateVariableLayoutShift(anchor, width, height, textOffset, textBoxScale);\n\n const placedGlyphBoxes = this.collisionIndex.placeCollisionBox(\n shiftVariableCollisionBox(\n textBox, shift.x, shift.y,\n rotateWithMap, pitchWithMap, this.transform.angle),\n textAllowOverlap, textPixelRatio, posMatrix, collisionGroup.predicate);\n\n if (iconBox) {\n const placedIconBoxes = this.collisionIndex.placeCollisionBox(\n shiftVariableCollisionBox(\n iconBox, shift.x, shift.y,\n rotateWithMap, pitchWithMap, this.transform.angle),\n textAllowOverlap, textPixelRatio, posMatrix, collisionGroup.predicate);\n if (placedIconBoxes.box.length === 0) return;\n }\n\n if (placedGlyphBoxes.box.length > 0) {\n let prevAnchor;\n // If this label was placed in the previous placement, record the anchor position\n // to allow us to animate the transition\n if (this.prevPlacement &&\n this.prevPlacement.variableOffsets[symbolInstance.crossTileID] &&\n this.prevPlacement.placements[symbolInstance.crossTileID] &&\n this.prevPlacement.placements[symbolInstance.crossTileID].text) {\n prevAnchor = this.prevPlacement.variableOffsets[symbolInstance.crossTileID].anchor;\n }\n assert(symbolInstance.crossTileID !== 0);\n this.variableOffsets[symbolInstance.crossTileID] = {\n textOffset,\n width,\n height,\n anchor,\n textBoxScale,\n prevAnchor\n };\n this.markUsedJustification(bucket, anchor, symbolInstance, orientation);\n\n if (bucket.allowVerticalPlacement) {\n this.markUsedOrientation(bucket, orientation, symbolInstance);\n this.placedOrientations[symbolInstance.crossTileID] = orientation;\n }\n\n return {shift, placedGlyphBoxes};\n }\n }\n\n placeLayerBucketPart(bucketPart: Object, seenCrossTileIDs: { [string | number]: boolean }, showCollisionBoxes: boolean) {\n\n const {\n bucket,\n layout,\n posMatrix,\n textLabelPlaneMatrix,\n labelToScreenMatrix,\n textPixelRatio,\n holdingForFade,\n collisionBoxArray,\n partiallyEvaluatedTextSize,\n collisionGroup\n } = bucketPart.parameters;\n\n const textOptional = layout.get('text-optional');\n const iconOptional = layout.get('icon-optional');\n const textAllowOverlap = layout.get('text-allow-overlap');\n const iconAllowOverlap = layout.get('icon-allow-overlap');\n const rotateWithMap = layout.get('text-rotation-alignment') === 'map';\n const pitchWithMap = layout.get('text-pitch-alignment') === 'map';\n const hasIconTextFit = layout.get('icon-text-fit') !== 'none';\n const zOrderByViewportY = layout.get('symbol-z-order') === 'viewport-y';\n\n // This logic is similar to the \"defaultOpacityState\" logic below in updateBucketOpacities\n // If we know a symbol is always supposed to show, force it to be marked visible even if\n // it wasn't placed into the collision index (because some or all of it was outside the range\n // of the collision grid).\n // There is a subtle edge case here we're accepting:\n // Symbol A has text-allow-overlap: true, icon-allow-overlap: true, icon-optional: false\n // A's icon is outside the grid, so doesn't get placed\n // A's text would be inside grid, but doesn't get placed because of icon-optional: false\n // We still show A because of the allow-overlap settings.\n // Symbol B has allow-overlap: false, and gets placed where A's text would be\n // On panning in, there is a short period when Symbol B and Symbol A will overlap\n // This is the reverse of our normal policy of \"fade in on pan\", but should look like any other\n // collision and hopefully not be too noticeable.\n // See https://github.com/mapbox/mapbox-gl-js/issues/7172\n const alwaysShowText = textAllowOverlap && (iconAllowOverlap || !bucket.hasIconData() || iconOptional);\n const alwaysShowIcon = iconAllowOverlap && (textAllowOverlap || !bucket.hasTextData() || textOptional);\n\n if (!bucket.collisionArrays && collisionBoxArray) {\n bucket.deserializeCollisionBoxes(collisionBoxArray);\n }\n\n const placeSymbol = (symbolInstance: SymbolInstance, collisionArrays: CollisionArrays) => {\n if (seenCrossTileIDs[symbolInstance.crossTileID]) return;\n if (holdingForFade) {\n // Mark all symbols from this tile as \"not placed\", but don't add to seenCrossTileIDs, because we don't\n // know yet if we have a duplicate in a parent tile that _should_ be placed.\n this.placements[symbolInstance.crossTileID] = new JointPlacement(false, false, false);\n return;\n }\n\n let placeText = false;\n let placeIcon = false;\n let offscreen = true;\n let shift = null;\n\n let placed = {box: null, offscreen: null};\n let placedVerticalText = {box: null, offscreen: null};\n\n let placedGlyphBoxes = null;\n let placedGlyphCircles = null;\n let placedIconBoxes = null;\n let textFeatureIndex = 0;\n let verticalTextFeatureIndex = 0;\n let iconFeatureIndex = 0;\n\n if (collisionArrays.textFeatureIndex) {\n textFeatureIndex = collisionArrays.textFeatureIndex;\n } else if (symbolInstance.useRuntimeCollisionCircles) {\n textFeatureIndex = symbolInstance.featureIndex;\n }\n if (collisionArrays.verticalTextFeatureIndex) {\n verticalTextFeatureIndex = collisionArrays.verticalTextFeatureIndex;\n }\n\n const textBox = collisionArrays.textBox;\n if (textBox) {\n\n const updatePreviousOrientationIfNotPlaced = (isPlaced) => {\n let previousOrientation = WritingMode.horizontal;\n if (bucket.allowVerticalPlacement && !isPlaced && this.prevPlacement) {\n const prevPlacedOrientation = this.prevPlacement.placedOrientations[symbolInstance.crossTileID];\n if (prevPlacedOrientation) {\n this.placedOrientations[symbolInstance.crossTileID] = prevPlacedOrientation;\n previousOrientation = prevPlacedOrientation;\n this.markUsedOrientation(bucket, previousOrientation, symbolInstance);\n }\n }\n return previousOrientation;\n };\n\n const placeTextForPlacementModes = (placeHorizontalFn, placeVerticalFn) => {\n if (bucket.allowVerticalPlacement && symbolInstance.numVerticalGlyphVertices > 0 && collisionArrays.verticalTextBox) {\n for (const placementMode of bucket.writingModes) {\n if (placementMode === WritingMode.vertical) {\n placed = placeVerticalFn();\n placedVerticalText = placed;\n } else {\n placed = placeHorizontalFn();\n }\n if (placed && placed.box && placed.box.length) break;\n }\n } else {\n placed = placeHorizontalFn();\n }\n };\n\n if (!layout.get('text-variable-anchor')) {\n const placeBox = (collisionTextBox, orientation) => {\n const placedFeature = this.collisionIndex.placeCollisionBox(collisionTextBox, textAllowOverlap,\n textPixelRatio, posMatrix, collisionGroup.predicate);\n if (placedFeature && placedFeature.box && placedFeature.box.length) {\n this.markUsedOrientation(bucket, orientation, symbolInstance);\n this.placedOrientations[symbolInstance.crossTileID] = orientation;\n }\n return placedFeature;\n };\n\n const placeHorizontal = () => {\n return placeBox(textBox, WritingMode.horizontal);\n };\n\n const placeVertical = () => {\n const verticalTextBox = collisionArrays.verticalTextBox;\n if (bucket.allowVerticalPlacement && symbolInstance.numVerticalGlyphVertices > 0 && verticalTextBox) {\n return placeBox(verticalTextBox, WritingMode.vertical);\n }\n return {box: null, offscreen: null};\n };\n\n placeTextForPlacementModes(placeHorizontal, placeVertical);\n updatePreviousOrientationIfNotPlaced(placed && placed.box && placed.box.length);\n\n } else {\n let anchors = layout.get('text-variable-anchor');\n\n // If this symbol was in the last placement, shift the previously used\n // anchor to the front of the anchor list, only if the previous anchor\n // is still in the anchor list\n if (this.prevPlacement && this.prevPlacement.variableOffsets[symbolInstance.crossTileID]) {\n const prevOffsets = this.prevPlacement.variableOffsets[symbolInstance.crossTileID];\n if (anchors.indexOf(prevOffsets.anchor) > 0) {\n anchors = anchors.filter(anchor => anchor !== prevOffsets.anchor);\n anchors.unshift(prevOffsets.anchor);\n }\n }\n\n const placeBoxForVariableAnchors = (collisionTextBox, collisionIconBox, orientation) => {\n const width = collisionTextBox.x2 - collisionTextBox.x1;\n const height = collisionTextBox.y2 - collisionTextBox.y1;\n const textBoxScale = symbolInstance.textBoxScale;\n\n const variableIconBox = hasIconTextFit && !iconAllowOverlap ? collisionIconBox : null;\n\n let placedBox: ?{ box: Array, offscreen: boolean } = {box: [], offscreen: false};\n const placementAttempts = textAllowOverlap ? anchors.length * 2 : anchors.length;\n for (let i = 0; i < placementAttempts; ++i) {\n const anchor = anchors[i % anchors.length];\n const allowOverlap = (i >= anchors.length);\n const result = this.attemptAnchorPlacement(\n anchor, collisionTextBox, width, height,\n textBoxScale, rotateWithMap, pitchWithMap, textPixelRatio, posMatrix,\n collisionGroup, allowOverlap, symbolInstance, bucket, orientation, variableIconBox);\n\n if (result) {\n placedBox = result.placedGlyphBoxes;\n if (placedBox && placedBox.box && placedBox.box.length) {\n placeText = true;\n shift = result.shift;\n break;\n }\n }\n }\n\n return placedBox;\n };\n\n const placeHorizontal = () => {\n return placeBoxForVariableAnchors(textBox, collisionArrays.iconBox, WritingMode.horizontal);\n };\n\n const placeVertical = () => {\n const verticalTextBox = collisionArrays.verticalTextBox;\n const wasPlaced = placed && placed.box && placed.box.length;\n if (bucket.allowVerticalPlacement && !wasPlaced && symbolInstance.numVerticalGlyphVertices > 0 && verticalTextBox) {\n return placeBoxForVariableAnchors(verticalTextBox, collisionArrays.verticalIconBox, WritingMode.vertical);\n }\n return {box: null, offscreen: null};\n };\n\n placeTextForPlacementModes(placeHorizontal, placeVertical);\n\n if (placed) {\n placeText = placed.box;\n offscreen = placed.offscreen;\n }\n\n const prevOrientation = updatePreviousOrientationIfNotPlaced(placed && placed.box);\n\n // If we didn't get placed, we still need to copy our position from the last placement for\n // fade animations\n if (!placeText && this.prevPlacement) {\n const prevOffset = this.prevPlacement.variableOffsets[symbolInstance.crossTileID];\n if (prevOffset) {\n this.variableOffsets[symbolInstance.crossTileID] = prevOffset;\n this.markUsedJustification(bucket, prevOffset.anchor, symbolInstance, prevOrientation);\n }\n }\n\n }\n }\n\n placedGlyphBoxes = placed;\n placeText = placedGlyphBoxes && placedGlyphBoxes.box && placedGlyphBoxes.box.length > 0;\n\n offscreen = placedGlyphBoxes && placedGlyphBoxes.offscreen;\n\n if (symbolInstance.useRuntimeCollisionCircles) {\n const placedSymbol = bucket.text.placedSymbolArray.get(symbolInstance.centerJustifiedTextSymbolIndex);\n const fontSize = symbolSize.evaluateSizeForFeature(bucket.textSizeData, partiallyEvaluatedTextSize, placedSymbol);\n\n const textPixelPadding = layout.get('text-padding');\n const circlePixelDiameter = symbolInstance.collisionCircleDiameter;\n\n placedGlyphCircles = this.collisionIndex.placeCollisionCircles(textAllowOverlap,\n placedSymbol,\n bucket.lineVertexArray,\n bucket.glyphOffsetArray,\n fontSize,\n posMatrix,\n textLabelPlaneMatrix,\n labelToScreenMatrix,\n showCollisionBoxes,\n pitchWithMap,\n collisionGroup.predicate,\n circlePixelDiameter,\n textPixelPadding);\n\n assert(!placedGlyphCircles.circles.length || (!placedGlyphCircles.collisionDetected || showCollisionBoxes));\n // If text-allow-overlap is set, force \"placedCircles\" to true\n // In theory there should always be at least one circle placed\n // in this case, but for now quirks in text-anchor\n // and text-offset may prevent that from being true.\n placeText = textAllowOverlap || (placedGlyphCircles.circles.length > 0 && !placedGlyphCircles.collisionDetected);\n offscreen = offscreen && placedGlyphCircles.offscreen;\n }\n\n if (collisionArrays.iconFeatureIndex) {\n iconFeatureIndex = collisionArrays.iconFeatureIndex;\n }\n\n if (collisionArrays.iconBox) {\n\n const placeIconFeature = iconBox => {\n const shiftedIconBox = hasIconTextFit && shift ?\n shiftVariableCollisionBox(\n iconBox, shift.x, shift.y,\n rotateWithMap, pitchWithMap, this.transform.angle) :\n iconBox;\n return this.collisionIndex.placeCollisionBox(shiftedIconBox,\n iconAllowOverlap, textPixelRatio, posMatrix, collisionGroup.predicate);\n };\n\n if (placedVerticalText && placedVerticalText.box && placedVerticalText.box.length && collisionArrays.verticalIconBox) {\n placedIconBoxes = placeIconFeature(collisionArrays.verticalIconBox);\n placeIcon = placedIconBoxes.box.length > 0;\n } else {\n placedIconBoxes = placeIconFeature(collisionArrays.iconBox);\n placeIcon = placedIconBoxes.box.length > 0;\n }\n offscreen = offscreen && placedIconBoxes.offscreen;\n }\n\n const iconWithoutText = textOptional ||\n (symbolInstance.numHorizontalGlyphVertices === 0 && symbolInstance.numVerticalGlyphVertices === 0);\n const textWithoutIcon = iconOptional || symbolInstance.numIconVertices === 0;\n\n // Combine the scales for icons and text.\n if (!iconWithoutText && !textWithoutIcon) {\n placeIcon = placeText = placeIcon && placeText;\n } else if (!textWithoutIcon) {\n placeText = placeIcon && placeText;\n } else if (!iconWithoutText) {\n placeIcon = placeIcon && placeText;\n }\n\n if (placeText && placedGlyphBoxes && placedGlyphBoxes.box) {\n if (placedVerticalText && placedVerticalText.box && verticalTextFeatureIndex) {\n this.collisionIndex.insertCollisionBox(placedGlyphBoxes.box, layout.get('text-ignore-placement'),\n bucket.bucketInstanceId, verticalTextFeatureIndex, collisionGroup.ID);\n } else {\n this.collisionIndex.insertCollisionBox(placedGlyphBoxes.box, layout.get('text-ignore-placement'),\n bucket.bucketInstanceId, textFeatureIndex, collisionGroup.ID);\n }\n\n }\n if (placeIcon && placedIconBoxes) {\n this.collisionIndex.insertCollisionBox(placedIconBoxes.box, layout.get('icon-ignore-placement'),\n bucket.bucketInstanceId, iconFeatureIndex, collisionGroup.ID);\n }\n if (placedGlyphCircles) {\n if (placeText) {\n this.collisionIndex.insertCollisionCircles(placedGlyphCircles.circles, layout.get('text-ignore-placement'),\n bucket.bucketInstanceId, textFeatureIndex, collisionGroup.ID);\n }\n\n if (showCollisionBoxes) {\n const id = bucket.bucketInstanceId;\n let circleArray = this.collisionCircleArrays[id];\n\n // Group collision circles together by bucket. Circles can't be pushed forward for rendering yet as the symbol placement\n // for a bucket is not guaranteed to be complete before the commit-function has been called\n if (circleArray === undefined)\n circleArray = this.collisionCircleArrays[id] = new CollisionCircleArray();\n\n for (let i = 0; i < placedGlyphCircles.circles.length; i += 4) {\n circleArray.circles.push(placedGlyphCircles.circles[i + 0]); // x\n circleArray.circles.push(placedGlyphCircles.circles[i + 1]); // y\n circleArray.circles.push(placedGlyphCircles.circles[i + 2]); // radius\n circleArray.circles.push(placedGlyphCircles.collisionDetected ? 1 : 0); // collisionDetected-flag\n }\n }\n }\n\n assert(symbolInstance.crossTileID !== 0);\n assert(bucket.bucketInstanceId !== 0);\n\n this.placements[symbolInstance.crossTileID] = new JointPlacement(placeText || alwaysShowText, placeIcon || alwaysShowIcon, offscreen || bucket.justReloaded);\n seenCrossTileIDs[symbolInstance.crossTileID] = true;\n };\n\n if (zOrderByViewportY) {\n assert(bucketPart.symbolInstanceStart === 0);\n const symbolIndexes = bucket.getSortedSymbolIndexes(this.transform.angle);\n for (let i = symbolIndexes.length - 1; i >= 0; --i) {\n const symbolIndex = symbolIndexes[i];\n placeSymbol(bucket.symbolInstances.get(symbolIndex), bucket.collisionArrays[symbolIndex]);\n }\n } else {\n for (let i = bucketPart.symbolInstanceStart; i < bucketPart.symbolInstanceEnd; i++) {\n placeSymbol(bucket.symbolInstances.get(i), bucket.collisionArrays[i]);\n }\n }\n\n if (showCollisionBoxes && bucket.bucketInstanceId in this.collisionCircleArrays) {\n const circleArray = this.collisionCircleArrays[bucket.bucketInstanceId];\n\n // Store viewport and inverse projection matrices per bucket\n mat4.invert(circleArray.invProjMatrix, posMatrix);\n circleArray.viewportMatrix = this.collisionIndex.getViewportMatrix();\n }\n\n bucket.justReloaded = false;\n }\n\n markUsedJustification(bucket: SymbolBucket, placedAnchor: TextAnchor, symbolInstance: SymbolInstance, orientation: number) {\n const justifications = {\n \"left\": symbolInstance.leftJustifiedTextSymbolIndex,\n \"center\": symbolInstance.centerJustifiedTextSymbolIndex,\n \"right\": symbolInstance.rightJustifiedTextSymbolIndex\n };\n\n let autoIndex;\n if (orientation === WritingMode.vertical) {\n autoIndex = symbolInstance.verticalPlacedTextSymbolIndex;\n } else {\n autoIndex = justifications[getAnchorJustification(placedAnchor)];\n }\n\n const indexes = [\n symbolInstance.leftJustifiedTextSymbolIndex,\n symbolInstance.centerJustifiedTextSymbolIndex,\n symbolInstance.rightJustifiedTextSymbolIndex,\n symbolInstance.verticalPlacedTextSymbolIndex\n ];\n\n for (const index of indexes) {\n if (index >= 0) {\n if (autoIndex >= 0 && index !== autoIndex) {\n // There are multiple justifications and this one isn't it: shift offscreen\n bucket.text.placedSymbolArray.get(index).crossTileID = 0;\n } else {\n // Either this is the chosen justification or the justification is hardwired: use this one\n bucket.text.placedSymbolArray.get(index).crossTileID = symbolInstance.crossTileID;\n }\n }\n }\n }\n\n markUsedOrientation(bucket: SymbolBucket, orientation: number, symbolInstance: SymbolInstance) {\n const horizontal = (orientation === WritingMode.horizontal || orientation === WritingMode.horizontalOnly) ? orientation : 0;\n const vertical = orientation === WritingMode.vertical ? orientation : 0;\n\n const horizontalIndexes = [\n symbolInstance.leftJustifiedTextSymbolIndex,\n symbolInstance.centerJustifiedTextSymbolIndex,\n symbolInstance.rightJustifiedTextSymbolIndex\n ];\n\n for (const index of horizontalIndexes) {\n bucket.text.placedSymbolArray.get(index).placedOrientation = horizontal;\n }\n\n if (symbolInstance.verticalPlacedTextSymbolIndex) {\n bucket.text.placedSymbolArray.get(symbolInstance.verticalPlacedTextSymbolIndex).placedOrientation = vertical;\n }\n }\n\n commit(now: number): void {\n this.commitTime = now;\n this.zoomAtLastRecencyCheck = this.transform.zoom;\n\n const prevPlacement = this.prevPlacement;\n let placementChanged = false;\n\n this.prevZoomAdjustment = prevPlacement ? prevPlacement.zoomAdjustment(this.transform.zoom) : 0;\n const increment = prevPlacement ? prevPlacement.symbolFadeChange(now) : 1;\n\n const prevOpacities = prevPlacement ? prevPlacement.opacities : {};\n const prevOffsets = prevPlacement ? prevPlacement.variableOffsets : {};\n const prevOrientations = prevPlacement ? prevPlacement.placedOrientations : {};\n\n // add the opacities from the current placement, and copy their current values from the previous placement\n for (const crossTileID in this.placements) {\n const jointPlacement = this.placements[crossTileID];\n const prevOpacity = prevOpacities[crossTileID];\n if (prevOpacity) {\n this.opacities[crossTileID] = new JointOpacityState(prevOpacity, increment, jointPlacement.text, jointPlacement.icon);\n placementChanged = placementChanged ||\n jointPlacement.text !== prevOpacity.text.placed ||\n jointPlacement.icon !== prevOpacity.icon.placed;\n } else {\n this.opacities[crossTileID] = new JointOpacityState(null, increment, jointPlacement.text, jointPlacement.icon, jointPlacement.skipFade);\n placementChanged = placementChanged || jointPlacement.text || jointPlacement.icon;\n }\n }\n\n // copy and update values from the previous placement that aren't in the current placement but haven't finished fading\n for (const crossTileID in prevOpacities) {\n const prevOpacity = prevOpacities[crossTileID];\n if (!this.opacities[crossTileID]) {\n const jointOpacity = new JointOpacityState(prevOpacity, increment, false, false);\n if (!jointOpacity.isHidden()) {\n this.opacities[crossTileID] = jointOpacity;\n placementChanged = placementChanged || prevOpacity.text.placed || prevOpacity.icon.placed;\n }\n }\n }\n for (const crossTileID in prevOffsets) {\n if (!this.variableOffsets[crossTileID] && this.opacities[crossTileID] && !this.opacities[crossTileID].isHidden()) {\n this.variableOffsets[crossTileID] = prevOffsets[crossTileID];\n }\n }\n\n for (const crossTileID in prevOrientations) {\n if (!this.placedOrientations[crossTileID] && this.opacities[crossTileID] && !this.opacities[crossTileID].isHidden()) {\n this.placedOrientations[crossTileID] = prevOrientations[crossTileID];\n }\n }\n\n // this.lastPlacementChangeTime is the time of the last commit() that\n // resulted in a placement change -- in other words, the start time of\n // the last symbol fade animation\n assert(!prevPlacement || prevPlacement.lastPlacementChangeTime !== undefined);\n if (placementChanged) {\n this.lastPlacementChangeTime = now;\n } else if (typeof this.lastPlacementChangeTime !== 'number') {\n this.lastPlacementChangeTime = prevPlacement ? prevPlacement.lastPlacementChangeTime : now;\n }\n }\n\n updateLayerOpacities(styleLayer: StyleLayer, tiles: Array) {\n const seenCrossTileIDs = {};\n for (const tile of tiles) {\n const symbolBucket = ((tile.getBucket(styleLayer): any): SymbolBucket);\n if (symbolBucket && tile.latestFeatureIndex && styleLayer.id === symbolBucket.layerIds[0]) {\n this.updateBucketOpacities(symbolBucket, seenCrossTileIDs, tile.collisionBoxArray);\n }\n }\n }\n\n updateBucketOpacities(bucket: SymbolBucket, seenCrossTileIDs: { [string | number]: boolean }, collisionBoxArray: ?CollisionBoxArray) {\n if (bucket.hasTextData()) bucket.text.opacityVertexArray.clear();\n if (bucket.hasIconData()) bucket.icon.opacityVertexArray.clear();\n if (bucket.hasIconCollisionBoxData()) bucket.iconCollisionBox.collisionVertexArray.clear();\n if (bucket.hasTextCollisionBoxData()) bucket.textCollisionBox.collisionVertexArray.clear();\n\n const layout = bucket.layers[0].layout;\n const duplicateOpacityState = new JointOpacityState(null, 0, false, false, true);\n const textAllowOverlap = layout.get('text-allow-overlap');\n const iconAllowOverlap = layout.get('icon-allow-overlap');\n const variablePlacement = layout.get('text-variable-anchor');\n const rotateWithMap = layout.get('text-rotation-alignment') === 'map';\n const pitchWithMap = layout.get('text-pitch-alignment') === 'map';\n const hasIconTextFit = layout.get('icon-text-fit') !== 'none';\n // If allow-overlap is true, we can show symbols before placement runs on them\n // But we have to wait for placement if we potentially depend on a paired icon/text\n // with allow-overlap: false.\n // See https://github.com/mapbox/mapbox-gl-js/issues/7032\n const defaultOpacityState = new JointOpacityState(null, 0,\n textAllowOverlap && (iconAllowOverlap || !bucket.hasIconData() || layout.get('icon-optional')),\n iconAllowOverlap && (textAllowOverlap || !bucket.hasTextData() || layout.get('text-optional')),\n true);\n\n if (!bucket.collisionArrays && collisionBoxArray && ((bucket.hasIconCollisionBoxData() || bucket.hasTextCollisionBoxData()))) {\n bucket.deserializeCollisionBoxes(collisionBoxArray);\n }\n\n const addOpacities = (iconOrText, numVertices: number, opacity: number) => {\n for (let i = 0; i < numVertices / 4; i++) {\n iconOrText.opacityVertexArray.emplaceBack(opacity);\n }\n };\n\n for (let s = 0; s < bucket.symbolInstances.length; s++) {\n const symbolInstance = bucket.symbolInstances.get(s);\n const {\n numHorizontalGlyphVertices,\n numVerticalGlyphVertices,\n crossTileID\n } = symbolInstance;\n\n const isDuplicate = seenCrossTileIDs[crossTileID];\n\n let opacityState = this.opacities[crossTileID];\n if (isDuplicate) {\n opacityState = duplicateOpacityState;\n } else if (!opacityState) {\n opacityState = defaultOpacityState;\n // store the state so that future placements use it as a starting point\n this.opacities[crossTileID] = opacityState;\n }\n\n seenCrossTileIDs[crossTileID] = true;\n\n const hasText = numHorizontalGlyphVertices > 0 || numVerticalGlyphVertices > 0;\n const hasIcon = symbolInstance.numIconVertices > 0;\n\n const placedOrientation = this.placedOrientations[symbolInstance.crossTileID];\n const horizontalHidden = placedOrientation === WritingMode.vertical;\n const verticalHidden = placedOrientation === WritingMode.horizontal || placedOrientation === WritingMode.horizontalOnly;\n\n if (hasText) {\n const packedOpacity = packOpacity(opacityState.text);\n // Vertical text fades in/out on collision the same way as corresponding\n // horizontal text. Switch between vertical/horizontal should be instantaneous\n const horizontalOpacity = horizontalHidden ? PACKED_HIDDEN_OPACITY : packedOpacity;\n addOpacities(bucket.text, numHorizontalGlyphVertices, horizontalOpacity);\n const verticalOpacity = verticalHidden ? PACKED_HIDDEN_OPACITY : packedOpacity;\n addOpacities(bucket.text, numVerticalGlyphVertices, verticalOpacity);\n\n // If this label is completely faded, mark it so that we don't have to calculate\n // its position at render time. If this layer has variable placement, shift the various\n // symbol instances appropriately so that symbols from buckets that have yet to be placed\n // offset appropriately.\n const symbolHidden = opacityState.text.isHidden();\n [\n symbolInstance.rightJustifiedTextSymbolIndex,\n symbolInstance.centerJustifiedTextSymbolIndex,\n symbolInstance.leftJustifiedTextSymbolIndex\n ].forEach(index => {\n if (index >= 0) {\n bucket.text.placedSymbolArray.get(index).hidden = symbolHidden || horizontalHidden ? 1 : 0;\n }\n });\n\n if (symbolInstance.verticalPlacedTextSymbolIndex >= 0) {\n bucket.text.placedSymbolArray.get(symbolInstance.verticalPlacedTextSymbolIndex).hidden = symbolHidden || verticalHidden ? 1 : 0;\n }\n\n const prevOffset = this.variableOffsets[symbolInstance.crossTileID];\n if (prevOffset) {\n this.markUsedJustification(bucket, prevOffset.anchor, symbolInstance, placedOrientation);\n }\n\n const prevOrientation = this.placedOrientations[symbolInstance.crossTileID];\n if (prevOrientation) {\n this.markUsedJustification(bucket, 'left', symbolInstance, prevOrientation);\n this.markUsedOrientation(bucket, prevOrientation, symbolInstance);\n }\n }\n\n if (hasIcon) {\n const packedOpacity = packOpacity(opacityState.icon);\n\n const useHorizontal = !(hasIconTextFit && symbolInstance.verticalPlacedIconSymbolIndex && horizontalHidden);\n\n if (symbolInstance.placedIconSymbolIndex >= 0) {\n const horizontalOpacity = useHorizontal ? packedOpacity : PACKED_HIDDEN_OPACITY;\n addOpacities(bucket.icon, symbolInstance.numIconVertices, horizontalOpacity);\n bucket.icon.placedSymbolArray.get(symbolInstance.placedIconSymbolIndex).hidden =\n (opacityState.icon.isHidden(): any);\n }\n\n if (symbolInstance.verticalPlacedIconSymbolIndex >= 0) {\n const verticalOpacity = !useHorizontal ? packedOpacity : PACKED_HIDDEN_OPACITY;\n addOpacities(bucket.icon, symbolInstance.numVerticalIconVertices, verticalOpacity);\n bucket.icon.placedSymbolArray.get(symbolInstance.verticalPlacedIconSymbolIndex).hidden =\n (opacityState.icon.isHidden(): any);\n }\n }\n\n if (bucket.hasIconCollisionBoxData() || bucket.hasTextCollisionBoxData()) {\n const collisionArrays = bucket.collisionArrays[s];\n if (collisionArrays) {\n let shift = new Point(0, 0);\n if (collisionArrays.textBox || collisionArrays.verticalTextBox) {\n let used = true;\n if (variablePlacement) {\n const variableOffset = this.variableOffsets[crossTileID];\n if (variableOffset) {\n // This will show either the currently placed position or the last\n // successfully placed position (so you can visualize what collision\n // just made the symbol disappear, and the most likely place for the\n // symbol to come back)\n shift = calculateVariableLayoutShift(variableOffset.anchor,\n variableOffset.width,\n variableOffset.height,\n variableOffset.textOffset,\n variableOffset.textBoxScale);\n if (rotateWithMap) {\n shift._rotate(pitchWithMap ? this.transform.angle : -this.transform.angle);\n }\n } else {\n // No offset -> this symbol hasn't been placed since coming on-screen\n // No single box is particularly meaningful and all of them would be too noisy\n // Use the center box just to show something's there, but mark it \"not used\"\n used = false;\n }\n }\n\n if (collisionArrays.textBox) {\n updateCollisionVertices(bucket.textCollisionBox.collisionVertexArray, opacityState.text.placed, !used || horizontalHidden, shift.x, shift.y);\n }\n if (collisionArrays.verticalTextBox) {\n updateCollisionVertices(bucket.textCollisionBox.collisionVertexArray, opacityState.text.placed, !used || verticalHidden, shift.x, shift.y);\n }\n }\n\n const verticalIconUsed = Boolean(!verticalHidden && collisionArrays.verticalIconBox);\n\n if (collisionArrays.iconBox) {\n updateCollisionVertices(bucket.iconCollisionBox.collisionVertexArray, opacityState.icon.placed, verticalIconUsed,\n hasIconTextFit ? shift.x : 0,\n hasIconTextFit ? shift.y : 0);\n }\n\n if (collisionArrays.verticalIconBox) {\n updateCollisionVertices(bucket.iconCollisionBox.collisionVertexArray, opacityState.icon.placed, !verticalIconUsed,\n hasIconTextFit ? shift.x : 0,\n hasIconTextFit ? shift.y : 0);\n }\n }\n }\n }\n\n bucket.sortFeatures(this.transform.angle);\n if (this.retainedQueryData[bucket.bucketInstanceId]) {\n this.retainedQueryData[bucket.bucketInstanceId].featureSortOrder = bucket.featureSortOrder;\n }\n\n if (bucket.hasTextData() && bucket.text.opacityVertexBuffer) {\n bucket.text.opacityVertexBuffer.updateData(bucket.text.opacityVertexArray);\n }\n if (bucket.hasIconData() && bucket.icon.opacityVertexBuffer) {\n bucket.icon.opacityVertexBuffer.updateData(bucket.icon.opacityVertexArray);\n }\n if (bucket.hasIconCollisionBoxData() && bucket.iconCollisionBox.collisionVertexBuffer) {\n bucket.iconCollisionBox.collisionVertexBuffer.updateData(bucket.iconCollisionBox.collisionVertexArray);\n }\n if (bucket.hasTextCollisionBoxData() && bucket.textCollisionBox.collisionVertexBuffer) {\n bucket.textCollisionBox.collisionVertexBuffer.updateData(bucket.textCollisionBox.collisionVertexArray);\n }\n\n assert(bucket.text.opacityVertexArray.length === bucket.text.layoutVertexArray.length / 4);\n assert(bucket.icon.opacityVertexArray.length === bucket.icon.layoutVertexArray.length / 4);\n\n // Push generated collision circles to the bucket for debug rendering\n if (bucket.bucketInstanceId in this.collisionCircleArrays) {\n const instance = this.collisionCircleArrays[bucket.bucketInstanceId];\n\n bucket.placementInvProjMatrix = instance.invProjMatrix;\n bucket.placementViewportMatrix = instance.viewportMatrix;\n bucket.collisionCircleArray = instance.circles;\n\n delete this.collisionCircleArrays[bucket.bucketInstanceId];\n }\n }\n\n symbolFadeChange(now: number) {\n return this.fadeDuration === 0 ?\n 1 :\n ((now - this.commitTime) / this.fadeDuration + this.prevZoomAdjustment);\n }\n\n zoomAdjustment(zoom: number) {\n // When zooming out quickly, labels can overlap each other. This\n // adjustment is used to reduce the interval between placement calculations\n // and to reduce the fade duration when zooming out quickly. Discovering the\n // collisions more quickly and fading them more quickly reduces the unwanted effect.\n return Math.max(0, (this.transform.zoom - zoom) / 1.5);\n }\n\n hasTransitions(now: number) {\n return this.stale ||\n now - this.lastPlacementChangeTime < this.fadeDuration;\n }\n\n stillRecent(now: number, zoom: number) {\n // The adjustment makes placement more frequent when zooming.\n // This condition applies the adjustment only after the map has\n // stopped zooming. This avoids adding extra jank while zooming.\n const durationAdjustment = this.zoomAtLastRecencyCheck === zoom ?\n (1 - this.zoomAdjustment(zoom)) :\n 1;\n this.zoomAtLastRecencyCheck = zoom;\n\n return this.commitTime + this.fadeDuration * durationAdjustment > now;\n }\n\n setStale() {\n this.stale = true;\n }\n}\n\nfunction updateCollisionVertices(collisionVertexArray: CollisionVertexArray, placed: boolean, notUsed: boolean | number, shiftX?: number, shiftY?: number) {\n collisionVertexArray.emplaceBack(placed ? 1 : 0, notUsed ? 1 : 0, shiftX || 0, shiftY || 0);\n collisionVertexArray.emplaceBack(placed ? 1 : 0, notUsed ? 1 : 0, shiftX || 0, shiftY || 0);\n collisionVertexArray.emplaceBack(placed ? 1 : 0, notUsed ? 1 : 0, shiftX || 0, shiftY || 0);\n collisionVertexArray.emplaceBack(placed ? 1 : 0, notUsed ? 1 : 0, shiftX || 0, shiftY || 0);\n}\n\n// All four vertices for a glyph will have the same opacity state\n// So we pack the opacity into a uint8, and then repeat it four times\n// to make a single uint32 that we can upload for each glyph in the\n// label.\nconst shift25 = Math.pow(2, 25);\nconst shift24 = Math.pow(2, 24);\nconst shift17 = Math.pow(2, 17);\nconst shift16 = Math.pow(2, 16);\nconst shift9 = Math.pow(2, 9);\nconst shift8 = Math.pow(2, 8);\nconst shift1 = Math.pow(2, 1);\nfunction packOpacity(opacityState: OpacityState): number {\n if (opacityState.opacity === 0 && !opacityState.placed) {\n return 0;\n } else if (opacityState.opacity === 1 && opacityState.placed) {\n return 4294967295;\n }\n const targetBit = opacityState.placed ? 1 : 0;\n const opacityBits = Math.floor(opacityState.opacity * 127);\n return opacityBits * shift25 + targetBit * shift24 +\n opacityBits * shift17 + targetBit * shift16 +\n opacityBits * shift9 + targetBit * shift8 +\n opacityBits * shift1 + targetBit;\n}\n\nconst PACKED_HIDDEN_OPACITY = 0;\n","// @flow\n\nimport browser from '../util/browser';\n\nimport {Placement} from '../symbol/placement';\n\nimport type Transform from '../geo/transform';\nimport type StyleLayer from './style_layer';\nimport type SymbolStyleLayer from './style_layer/symbol_style_layer';\nimport type Tile from '../source/tile';\nimport type {BucketPart} from '../symbol/placement';\n\nclass LayerPlacement {\n _sortAcrossTiles: boolean;\n _currentTileIndex: number;\n _currentPartIndex: number;\n _seenCrossTileIDs: { [string | number]: boolean };\n _bucketParts: Array;\n\n constructor(styleLayer: SymbolStyleLayer) {\n this._sortAcrossTiles = styleLayer.layout.get('symbol-z-order') !== 'viewport-y' &&\n !styleLayer.layout.get('symbol-sort-key').isConstant();\n\n this._currentTileIndex = 0;\n this._currentPartIndex = 0;\n this._seenCrossTileIDs = {};\n this._bucketParts = [];\n }\n\n continuePlacement(tiles: Array, placement: Placement, showCollisionBoxes: boolean, styleLayer: StyleLayer, shouldPausePlacement: () => boolean) {\n\n const bucketParts = this._bucketParts;\n\n while (this._currentTileIndex < tiles.length) {\n const tile = tiles[this._currentTileIndex];\n placement.getBucketParts(bucketParts, styleLayer, tile, this._sortAcrossTiles);\n\n this._currentTileIndex++;\n if (shouldPausePlacement()) {\n return true;\n }\n }\n\n if (this._sortAcrossTiles) {\n this._sortAcrossTiles = false;\n bucketParts.sort((a, b) => ((a.sortKey: any): number) - ((b.sortKey: any): number));\n }\n\n while (this._currentPartIndex < bucketParts.length) {\n const bucketPart = bucketParts[this._currentPartIndex];\n placement.placeLayerBucketPart(bucketPart, this._seenCrossTileIDs, showCollisionBoxes);\n\n this._currentPartIndex++;\n if (shouldPausePlacement()) {\n return true;\n }\n }\n return false;\n }\n}\n\nclass PauseablePlacement {\n placement: Placement;\n _done: boolean;\n _currentPlacementIndex: number;\n _forceFullPlacement: boolean;\n _showCollisionBoxes: boolean;\n _inProgressLayer: ?LayerPlacement;\n\n constructor(transform: Transform, order: Array,\n forceFullPlacement: boolean,\n showCollisionBoxes: boolean,\n fadeDuration: number,\n crossSourceCollisions: boolean,\n prevPlacement?: Placement) {\n\n this.placement = new Placement(transform, fadeDuration, crossSourceCollisions, prevPlacement);\n this._currentPlacementIndex = order.length - 1;\n this._forceFullPlacement = forceFullPlacement;\n this._showCollisionBoxes = showCollisionBoxes;\n this._done = false;\n }\n\n isDone(): boolean {\n return this._done;\n }\n\n continuePlacement(order: Array, layers: {[_: string]: StyleLayer}, layerTiles: {[_: string]: Array}) {\n const startTime = browser.now();\n\n const shouldPausePlacement = () => {\n const elapsedTime = browser.now() - startTime;\n return this._forceFullPlacement ? false : elapsedTime > 2;\n };\n\n while (this._currentPlacementIndex >= 0) {\n const layerId = order[this._currentPlacementIndex];\n const layer = layers[layerId];\n const placementZoom = this.placement.collisionIndex.transform.zoom;\n if (layer.type === 'symbol' &&\n (!layer.minzoom || layer.minzoom <= placementZoom) &&\n (!layer.maxzoom || layer.maxzoom > placementZoom)) {\n\n if (!this._inProgressLayer) {\n this._inProgressLayer = new LayerPlacement(((layer: any): SymbolStyleLayer));\n }\n\n const pausePlacement = this._inProgressLayer.continuePlacement(layerTiles[layer.source], this.placement, this._showCollisionBoxes, layer, shouldPausePlacement);\n\n if (pausePlacement) {\n // We didn't finish placing all layers within 2ms,\n // but we can keep rendering with a partial placement\n // We'll resume here on the next frame\n return;\n }\n\n delete this._inProgressLayer;\n }\n\n this._currentPlacementIndex--;\n }\n\n this._done = true;\n }\n\n commit(now: number) {\n this.placement.commit(now);\n return this.placement;\n }\n}\n\nexport default PauseablePlacement;\n","// @flow\n\nimport EXTENT from '../data/extent';\n\nimport {SymbolInstanceArray} from '../data/array_types';\n\nimport type {SymbolInstance} from '../data/array_types';\nimport type {OverscaledTileID} from '../source/tile_id';\nimport type SymbolBucket from '../data/bucket/symbol_bucket';\nimport type StyleLayer from '../style/style_layer';\nimport type Tile from '../source/tile';\n\n/*\n The CrossTileSymbolIndex generally works on the assumption that\n a conceptual \"unique symbol\" can be identified by the text of\n the label combined with the anchor point. The goal is to assign\n these conceptual \"unique symbols\" a shared crossTileID that can be\n used by Placement to keep fading opacity states consistent and to\n deduplicate labels.\n\n The CrossTileSymbolIndex indexes all the current symbol instances and\n their crossTileIDs. When a symbol bucket gets added or updated, the\n index assigns a crossTileID to each of it's symbol instances by either\n matching it with an existing id or assigning a new one.\n*/\n\n// Round anchor positions to roughly 4 pixel grid\nconst roundingFactor = 512 / EXTENT / 2;\n\nclass TileLayerIndex {\n tileID: OverscaledTileID;\n indexedSymbolInstances: {[_: number]: Array<{\n crossTileID: number,\n coord: {\n x: number,\n y: number\n }\n }>};\n bucketInstanceId: number;\n\n constructor(tileID: OverscaledTileID, symbolInstances: SymbolInstanceArray, bucketInstanceId: number) {\n this.tileID = tileID;\n this.indexedSymbolInstances = {};\n this.bucketInstanceId = bucketInstanceId;\n\n for (let i = 0; i < symbolInstances.length; i++) {\n const symbolInstance = symbolInstances.get(i);\n const key = symbolInstance.key;\n if (!this.indexedSymbolInstances[key]) {\n this.indexedSymbolInstances[key] = [];\n }\n // This tile may have multiple symbol instances with the same key\n // Store each one along with its coordinates\n this.indexedSymbolInstances[key].push({\n crossTileID: symbolInstance.crossTileID,\n coord: this.getScaledCoordinates(symbolInstance, tileID)\n });\n }\n }\n\n // Converts the coordinates of the input symbol instance into coordinates that be can compared\n // against other symbols in this index. Coordinates are:\n // (1) world-based (so after conversion the source tile is irrelevant)\n // (2) converted to the z-scale of this TileLayerIndex\n // (3) down-sampled by \"roundingFactor\" from tile coordinate precision in order to be\n // more tolerant of small differences between tiles.\n getScaledCoordinates(symbolInstance: SymbolInstance, childTileID: OverscaledTileID) {\n const zDifference = childTileID.canonical.z - this.tileID.canonical.z;\n const scale = roundingFactor / Math.pow(2, zDifference);\n return {\n x: Math.floor((childTileID.canonical.x * EXTENT + symbolInstance.anchorX) * scale),\n y: Math.floor((childTileID.canonical.y * EXTENT + symbolInstance.anchorY) * scale)\n };\n }\n\n findMatches(symbolInstances: SymbolInstanceArray, newTileID: OverscaledTileID, zoomCrossTileIDs: {[crossTileID: number]: boolean}) {\n const tolerance = this.tileID.canonical.z < newTileID.canonical.z ? 1 : Math.pow(2, this.tileID.canonical.z - newTileID.canonical.z);\n\n for (let i = 0; i < symbolInstances.length; i++) {\n const symbolInstance = symbolInstances.get(i);\n if (symbolInstance.crossTileID) {\n // already has a match, skip\n continue;\n }\n\n const indexedInstances = this.indexedSymbolInstances[symbolInstance.key];\n if (!indexedInstances) {\n // No symbol with this key in this bucket\n continue;\n }\n\n const scaledSymbolCoord = this.getScaledCoordinates(symbolInstance, newTileID);\n\n for (const thisTileSymbol of indexedInstances) {\n // Return any symbol with the same keys whose coordinates are within 1\n // grid unit. (with a 4px grid, this covers a 12px by 12px area)\n if (Math.abs(thisTileSymbol.coord.x - scaledSymbolCoord.x) <= tolerance &&\n Math.abs(thisTileSymbol.coord.y - scaledSymbolCoord.y) <= tolerance &&\n !zoomCrossTileIDs[thisTileSymbol.crossTileID]) {\n // Once we've marked ourselves duplicate against this parent symbol,\n // don't let any other symbols at the same zoom level duplicate against\n // the same parent (see issue #5993)\n zoomCrossTileIDs[thisTileSymbol.crossTileID] = true;\n symbolInstance.crossTileID = thisTileSymbol.crossTileID;\n break;\n }\n }\n }\n }\n}\n\nclass CrossTileIDs {\n maxCrossTileID: number;\n constructor() {\n this.maxCrossTileID = 0;\n }\n generate() {\n return ++this.maxCrossTileID;\n }\n}\n\nclass CrossTileSymbolLayerIndex {\n indexes: {[zoom: string | number]: {[tileId: string | number]: TileLayerIndex}};\n usedCrossTileIDs: {[zoom: string | number]: {[crossTileID: number]: boolean}};\n lng: number;\n\n constructor() {\n this.indexes = {};\n this.usedCrossTileIDs = {};\n this.lng = 0;\n }\n\n /*\n * Sometimes when a user pans across the antimeridian the longitude value gets wrapped.\n * To prevent labels from flashing out and in we adjust the tileID values in the indexes\n * so that they match the new wrapped version of the map.\n */\n handleWrapJump(lng: number) {\n const wrapDelta = Math.round((lng - this.lng) / 360);\n if (wrapDelta !== 0) {\n for (const zoom in this.indexes) {\n const zoomIndexes = this.indexes[zoom];\n const newZoomIndex = {};\n for (const key in zoomIndexes) {\n // change the tileID's wrap and add it to a new index\n const index = zoomIndexes[key];\n index.tileID = index.tileID.unwrapTo(index.tileID.wrap + wrapDelta);\n newZoomIndex[index.tileID.key] = index;\n }\n this.indexes[zoom] = newZoomIndex;\n }\n }\n this.lng = lng;\n }\n\n addBucket(tileID: OverscaledTileID, bucket: SymbolBucket, crossTileIDs: CrossTileIDs) {\n if (this.indexes[tileID.overscaledZ] &&\n this.indexes[tileID.overscaledZ][tileID.key]) {\n if (this.indexes[tileID.overscaledZ][tileID.key].bucketInstanceId ===\n bucket.bucketInstanceId) {\n return false;\n } else {\n // We're replacing this bucket with an updated version\n // Remove the old bucket's \"used crossTileIDs\" now so that\n // the new bucket can claim them.\n // The old index entries themselves stick around until\n // 'removeStaleBuckets' is called.\n this.removeBucketCrossTileIDs(tileID.overscaledZ,\n this.indexes[tileID.overscaledZ][tileID.key]);\n }\n }\n\n for (let i = 0; i < bucket.symbolInstances.length; i++) {\n const symbolInstance = bucket.symbolInstances.get(i);\n symbolInstance.crossTileID = 0;\n }\n\n if (!this.usedCrossTileIDs[tileID.overscaledZ]) {\n this.usedCrossTileIDs[tileID.overscaledZ] = {};\n }\n const zoomCrossTileIDs = this.usedCrossTileIDs[tileID.overscaledZ];\n\n for (const zoom in this.indexes) {\n const zoomIndexes = this.indexes[zoom];\n if (Number(zoom) > tileID.overscaledZ) {\n for (const id in zoomIndexes) {\n const childIndex = zoomIndexes[id];\n if (childIndex.tileID.isChildOf(tileID)) {\n childIndex.findMatches(bucket.symbolInstances, tileID, zoomCrossTileIDs);\n }\n }\n } else {\n const parentCoord = tileID.scaledTo(Number(zoom));\n const parentIndex = zoomIndexes[parentCoord.key];\n if (parentIndex) {\n parentIndex.findMatches(bucket.symbolInstances, tileID, zoomCrossTileIDs);\n }\n }\n }\n\n for (let i = 0; i < bucket.symbolInstances.length; i++) {\n const symbolInstance = bucket.symbolInstances.get(i);\n if (!symbolInstance.crossTileID) {\n // symbol did not match any known symbol, assign a new id\n symbolInstance.crossTileID = crossTileIDs.generate();\n zoomCrossTileIDs[symbolInstance.crossTileID] = true;\n }\n }\n\n if (this.indexes[tileID.overscaledZ] === undefined) {\n this.indexes[tileID.overscaledZ] = {};\n }\n this.indexes[tileID.overscaledZ][tileID.key] = new TileLayerIndex(tileID, bucket.symbolInstances, bucket.bucketInstanceId);\n\n return true;\n }\n\n removeBucketCrossTileIDs(zoom: string | number, removedBucket: TileLayerIndex) {\n for (const key in removedBucket.indexedSymbolInstances) {\n for (const symbolInstance of removedBucket.indexedSymbolInstances[(key: any)]) {\n delete this.usedCrossTileIDs[zoom][symbolInstance.crossTileID];\n }\n }\n }\n\n removeStaleBuckets(currentIDs: { [string | number]: boolean }) {\n let tilesChanged = false;\n for (const z in this.indexes) {\n const zoomIndexes = this.indexes[z];\n for (const tileKey in zoomIndexes) {\n if (!currentIDs[zoomIndexes[tileKey].bucketInstanceId]) {\n this.removeBucketCrossTileIDs(z, zoomIndexes[tileKey]);\n delete zoomIndexes[tileKey];\n tilesChanged = true;\n }\n }\n }\n return tilesChanged;\n }\n}\n\nclass CrossTileSymbolIndex {\n layerIndexes: {[layerId: string]: CrossTileSymbolLayerIndex};\n crossTileIDs: CrossTileIDs;\n maxBucketInstanceId: number;\n bucketsInCurrentPlacement: {[_: number]: boolean};\n\n constructor() {\n this.layerIndexes = {};\n this.crossTileIDs = new CrossTileIDs();\n this.maxBucketInstanceId = 0;\n this.bucketsInCurrentPlacement = {};\n }\n\n addLayer(styleLayer: StyleLayer, tiles: Array, lng: number) {\n let layerIndex = this.layerIndexes[styleLayer.id];\n if (layerIndex === undefined) {\n layerIndex = this.layerIndexes[styleLayer.id] = new CrossTileSymbolLayerIndex();\n }\n\n let symbolBucketsChanged = false;\n const currentBucketIDs = {};\n\n layerIndex.handleWrapJump(lng);\n\n for (const tile of tiles) {\n const symbolBucket = ((tile.getBucket(styleLayer): any): SymbolBucket);\n if (!symbolBucket || styleLayer.id !== symbolBucket.layerIds[0])\n continue;\n\n if (!symbolBucket.bucketInstanceId) {\n symbolBucket.bucketInstanceId = ++this.maxBucketInstanceId;\n }\n\n if (layerIndex.addBucket(tile.tileID, symbolBucket, this.crossTileIDs)) {\n symbolBucketsChanged = true;\n }\n currentBucketIDs[symbolBucket.bucketInstanceId] = true;\n }\n\n if (layerIndex.removeStaleBuckets(currentBucketIDs)) {\n symbolBucketsChanged = true;\n }\n\n return symbolBucketsChanged;\n }\n\n pruneUnusedLayers(usedLayers: Array) {\n const usedLayerMap = {};\n usedLayers.forEach((usedLayer) => {\n usedLayerMap[usedLayer] = true;\n });\n for (const layerId in this.layerIndexes) {\n if (!usedLayerMap[layerId]) {\n delete this.layerIndexes[layerId];\n }\n }\n }\n}\n\nexport default CrossTileSymbolIndex;\n","// @flow\n\nimport assert from 'assert';\n\nimport {Event, ErrorEvent, Evented} from '../util/evented';\nimport StyleLayer from './style_layer';\nimport createStyleLayer from './create_style_layer';\nimport loadSprite from './load_sprite';\nimport ImageManager from '../render/image_manager';\nimport GlyphManager from '../render/glyph_manager';\nimport Light from './light';\nimport LineAtlas from '../render/line_atlas';\nimport {pick, clone, extend, deepEqual, filterObject, mapObject} from '../util/util';\nimport {getJSON, getReferrer, makeRequest, ResourceType} from '../util/ajax';\nimport {isMapboxURL} from '../util/mapbox';\nimport browser from '../util/browser';\nimport Dispatcher from '../util/dispatcher';\nimport {validateStyle, emitValidationErrors as _emitValidationErrors} from './validate_style';\nimport {\n getType as getSourceType,\n setType as setSourceType,\n type SourceClass\n} from '../source/source';\nimport {queryRenderedFeatures, queryRenderedSymbols, querySourceFeatures} from '../source/query_features';\nimport SourceCache from '../source/source_cache';\nimport GeoJSONSource from '../source/geojson_source';\nimport styleSpec from '../style-spec/reference/latest';\nimport getWorkerPool from '../util/global_worker_pool';\nimport deref from '../style-spec/deref';\nimport emptyStyle from '../style-spec/empty';\nimport diffStyles, {operations as diffOperations} from '../style-spec/diff';\nimport {\n registerForPluginStateChange,\n evented as rtlTextPluginEvented,\n triggerPluginCompletionEvent\n} from '../source/rtl_text_plugin';\nimport PauseablePlacement from './pauseable_placement';\nimport ZoomHistory from './zoom_history';\nimport CrossTileSymbolIndex from '../symbol/cross_tile_symbol_index';\nimport {validateCustomStyleLayer} from './style_layer/custom_style_layer';\n\n// We're skipping validation errors with the `source.canvas` identifier in order\n// to continue to allow canvas sources to be added at runtime/updated in\n// smart setStyle (see https://github.com/mapbox/mapbox-gl-js/pull/6424):\nconst emitValidationErrors = (evented: Evented, errors: ?$ReadOnlyArray<{message: string, identifier?: string}>) =>\n _emitValidationErrors(evented, errors && errors.filter(error => error.identifier !== 'source.canvas'));\n\nimport type Map from '../ui/map';\nimport type Transform from '../geo/transform';\nimport type {StyleImage} from './style_image';\nimport type {StyleGlyph} from './style_glyph';\nimport type {Callback} from '../types/callback';\nimport type EvaluationParameters from './evaluation_parameters';\nimport type {Placement} from '../symbol/placement';\nimport type {Cancelable} from '../types/cancelable';\nimport type {RequestParameters, ResponseCallback} from '../util/ajax';\nimport type {GeoJSON} from '@mapbox/geojson-types';\nimport type {\n LayerSpecification,\n FilterSpecification,\n StyleSpecification,\n LightSpecification,\n SourceSpecification\n} from '../style-spec/types';\nimport type {CustomLayerInterface} from './style_layer/custom_style_layer';\nimport type {Validator} from './validate_style';\nimport type {OverscaledTileID} from '../source/tile_id';\n\nconst supportedDiffOperations = pick(diffOperations, [\n 'addLayer',\n 'removeLayer',\n 'setPaintProperty',\n 'setLayoutProperty',\n 'setFilter',\n 'addSource',\n 'removeSource',\n 'setLayerZoomRange',\n 'setLight',\n 'setTransition',\n 'setGeoJSONSourceData'\n // 'setGlyphs',\n // 'setSprite',\n]);\n\nconst ignoredDiffOperations = pick(diffOperations, [\n 'setCenter',\n 'setZoom',\n 'setBearing',\n 'setPitch'\n]);\n\nconst empty = emptyStyle();\n\nexport type StyleOptions = {\n validate?: boolean,\n localIdeographFontFamily?: string\n};\n\nexport type StyleSetterOptions = {\n validate?: boolean\n};\n/**\n * @private\n */\nclass Style extends Evented {\n map: Map;\n stylesheet: StyleSpecification;\n dispatcher: Dispatcher;\n imageManager: ImageManager;\n glyphManager: GlyphManager;\n lineAtlas: LineAtlas;\n light: Light;\n\n _request: ?Cancelable;\n _spriteRequest: ?Cancelable;\n _layers: {[_: string]: StyleLayer};\n _serializedLayers: {[_: string]: Object};\n _order: Array;\n sourceCaches: {[_: string]: SourceCache};\n zoomHistory: ZoomHistory;\n _loaded: boolean;\n _rtlTextPluginCallback: Function;\n _changed: boolean;\n _updatedSources: {[_: string]: 'clear' | 'reload'};\n _updatedLayers: {[_: string]: true};\n _removedLayers: {[_: string]: StyleLayer};\n _changedImages: {[_: string]: true};\n _updatedPaintProps: {[layer: string]: true};\n _layerOrderChanged: boolean;\n _availableImages: Array;\n\n crossTileSymbolIndex: CrossTileSymbolIndex;\n pauseablePlacement: PauseablePlacement;\n placement: Placement;\n z: number;\n\n // exposed to allow stubbing by unit tests\n static getSourceType: typeof getSourceType;\n static setSourceType: typeof setSourceType;\n static registerForPluginStateChange: typeof registerForPluginStateChange;\n\n constructor(map: Map, options: StyleOptions = {}) {\n super();\n\n this.map = map;\n this.dispatcher = new Dispatcher(getWorkerPool(), this);\n this.imageManager = new ImageManager();\n this.imageManager.setEventedParent(this);\n this.glyphManager = new GlyphManager(map._requestManager, options.localIdeographFontFamily);\n this.lineAtlas = new LineAtlas(256, 512);\n this.crossTileSymbolIndex = new CrossTileSymbolIndex();\n\n this._layers = {};\n this._serializedLayers = {};\n this._order = [];\n this.sourceCaches = {};\n this.zoomHistory = new ZoomHistory();\n this._loaded = false;\n this._availableImages = [];\n\n this._resetUpdates();\n\n this.dispatcher.broadcast('setReferrer', getReferrer());\n\n const self = this;\n this._rtlTextPluginCallback = Style.registerForPluginStateChange((event) => {\n const state = {\n pluginStatus: event.pluginStatus,\n pluginURL: event.pluginURL\n };\n self.dispatcher.broadcast('syncRTLPluginState', state, (err, results) => {\n triggerPluginCompletionEvent(err);\n if (results) {\n const allComplete = results.every((elem) => elem);\n if (allComplete) {\n for (const id in self.sourceCaches) {\n self.sourceCaches[id].reload(); // Should be a no-op if the plugin loads before any tiles load\n }\n }\n }\n\n });\n });\n\n this.on('data', (event) => {\n if (event.dataType !== 'source' || event.sourceDataType !== 'metadata') {\n return;\n }\n\n const sourceCache = this.sourceCaches[event.sourceId];\n if (!sourceCache) {\n return;\n }\n\n const source = sourceCache.getSource();\n if (!source || !source.vectorLayerIds) {\n return;\n }\n\n for (const layerId in this._layers) {\n const layer = this._layers[layerId];\n if (layer.source === source.id) {\n this._validateLayer(layer);\n }\n }\n });\n }\n\n loadURL(url: string, options: {\n validate?: boolean,\n accessToken?: string\n } = {}) {\n this.fire(new Event('dataloading', {dataType: 'style'}));\n\n const validate = typeof options.validate === 'boolean' ?\n options.validate : !isMapboxURL(url);\n\n url = this.map._requestManager.normalizeStyleURL(url, options.accessToken);\n const request = this.map._requestManager.transformRequest(url, ResourceType.Style);\n this._request = getJSON(request, (error: ?Error, json: ?Object) => {\n this._request = null;\n if (error) {\n this.fire(new ErrorEvent(error));\n } else if (json) {\n this._load(json, validate);\n }\n });\n }\n\n loadJSON(json: StyleSpecification, options: StyleSetterOptions = {}) {\n this.fire(new Event('dataloading', {dataType: 'style'}));\n\n this._request = browser.frame(() => {\n this._request = null;\n this._load(json, options.validate !== false);\n });\n }\n\n loadEmpty() {\n this.fire(new Event('dataloading', {dataType: 'style'}));\n this._load(empty, false);\n }\n\n _load(json: StyleSpecification, validate: boolean) {\n if (validate && emitValidationErrors(this, validateStyle(json))) {\n return;\n }\n\n this._loaded = true;\n this.stylesheet = json;\n\n for (const id in json.sources) {\n this.addSource(id, json.sources[id], {validate: false});\n }\n\n if (json.sprite) {\n this._loadSprite(json.sprite);\n } else {\n this.imageManager.setLoaded(true);\n }\n\n this.glyphManager.setURL(json.glyphs);\n\n const layers = deref(this.stylesheet.layers);\n\n this._order = layers.map((layer) => layer.id);\n\n this._layers = {};\n this._serializedLayers = {};\n for (let layer of layers) {\n layer = createStyleLayer(layer);\n layer.setEventedParent(this, {layer: {id: layer.id}});\n this._layers[layer.id] = layer;\n this._serializedLayers[layer.id] = layer.serialize();\n }\n this.dispatcher.broadcast('setLayers', this._serializeLayers(this._order));\n\n this.light = new Light(this.stylesheet.light);\n\n this.fire(new Event('data', {dataType: 'style'}));\n this.fire(new Event('style.load'));\n }\n\n _loadSprite(url: string) {\n this._spriteRequest = loadSprite(url, this.map._requestManager, (err, images) => {\n this._spriteRequest = null;\n if (err) {\n this.fire(new ErrorEvent(err));\n } else if (images) {\n for (const id in images) {\n this.imageManager.addImage(id, images[id]);\n }\n }\n\n this.imageManager.setLoaded(true);\n this._availableImages = this.imageManager.listImages();\n this.dispatcher.broadcast('setImages', this._availableImages);\n this.fire(new Event('data', {dataType: 'style'}));\n });\n }\n\n _validateLayer(layer: StyleLayer) {\n const sourceCache = this.sourceCaches[layer.source];\n if (!sourceCache) {\n return;\n }\n\n const sourceLayer = layer.sourceLayer;\n if (!sourceLayer) {\n return;\n }\n\n const source = sourceCache.getSource();\n if (source.type === 'geojson' || (source.vectorLayerIds && source.vectorLayerIds.indexOf(sourceLayer) === -1)) {\n this.fire(new ErrorEvent(new Error(\n `Source layer \"${sourceLayer}\" ` +\n `does not exist on source \"${source.id}\" ` +\n `as specified by style layer \"${layer.id}\"`\n )));\n }\n }\n\n loaded() {\n if (!this._loaded)\n return false;\n\n if (Object.keys(this._updatedSources).length)\n return false;\n\n for (const id in this.sourceCaches)\n if (!this.sourceCaches[id].loaded())\n return false;\n\n if (!this.imageManager.isLoaded())\n return false;\n\n return true;\n }\n\n _serializeLayers(ids: Array): Array {\n const serializedLayers = [];\n for (const id of ids) {\n const layer = this._layers[id];\n if (layer.type !== 'custom') {\n serializedLayers.push(layer.serialize());\n }\n }\n return serializedLayers;\n }\n\n hasTransitions() {\n if (this.light && this.light.hasTransition()) {\n return true;\n }\n\n for (const id in this.sourceCaches) {\n if (this.sourceCaches[id].hasTransition()) {\n return true;\n }\n }\n\n for (const id in this._layers) {\n if (this._layers[id].hasTransition()) {\n return true;\n }\n }\n\n return false;\n }\n\n _checkLoaded() {\n if (!this._loaded) {\n throw new Error('Style is not done loading');\n }\n }\n\n /**\n * Apply queued style updates in a batch and recalculate zoom-dependent paint properties.\n * @private\n */\n update(parameters: EvaluationParameters) {\n if (!this._loaded) {\n return;\n }\n\n const changed = this._changed;\n if (this._changed) {\n const updatedIds = Object.keys(this._updatedLayers);\n const removedIds = Object.keys(this._removedLayers);\n\n if (updatedIds.length || removedIds.length) {\n this._updateWorkerLayers(updatedIds, removedIds);\n }\n for (const id in this._updatedSources) {\n const action = this._updatedSources[id];\n assert(action === 'reload' || action === 'clear');\n if (action === 'reload') {\n this._reloadSource(id);\n } else if (action === 'clear') {\n this._clearSource(id);\n }\n }\n\n this._updateTilesForChangedImages();\n\n for (const id in this._updatedPaintProps) {\n this._layers[id].updateTransitions(parameters);\n }\n\n this.light.updateTransitions(parameters);\n\n this._resetUpdates();\n }\n\n const sourcesUsedBefore = {};\n\n for (const sourceId in this.sourceCaches) {\n const sourceCache = this.sourceCaches[sourceId];\n sourcesUsedBefore[sourceId] = sourceCache.used;\n sourceCache.used = false;\n }\n\n for (const layerId of this._order) {\n const layer = this._layers[layerId];\n\n layer.recalculate(parameters, this._availableImages);\n if (!layer.isHidden(parameters.zoom) && layer.source) {\n this.sourceCaches[layer.source].used = true;\n }\n }\n\n for (const sourceId in sourcesUsedBefore) {\n const sourceCache = this.sourceCaches[sourceId];\n if (sourcesUsedBefore[sourceId] !== sourceCache.used) {\n sourceCache.fire(new Event('data', {sourceDataType: 'visibility', dataType:'source', sourceId}));\n }\n }\n\n this.light.recalculate(parameters);\n this.z = parameters.zoom;\n\n if (changed) {\n this.fire(new Event('data', {dataType: 'style'}));\n }\n\n }\n\n /*\n * Apply any queued image changes.\n */\n _updateTilesForChangedImages() {\n const changedImages = Object.keys(this._changedImages);\n if (changedImages.length) {\n for (const name in this.sourceCaches) {\n this.sourceCaches[name].reloadTilesForDependencies(['icons', 'patterns'], changedImages);\n }\n this._changedImages = {};\n }\n }\n\n _updateWorkerLayers(updatedIds: Array, removedIds: Array) {\n this.dispatcher.broadcast('updateLayers', {\n layers: this._serializeLayers(updatedIds),\n removedIds\n });\n }\n\n _resetUpdates() {\n this._changed = false;\n\n this._updatedLayers = {};\n this._removedLayers = {};\n\n this._updatedSources = {};\n this._updatedPaintProps = {};\n\n this._changedImages = {};\n }\n\n /**\n * Update this style's state to match the given style JSON, performing only\n * the necessary mutations.\n *\n * May throw an Error ('Unimplemented: METHOD') if the mapbox-gl-style-spec\n * diff algorithm produces an operation that is not supported.\n *\n * @returns {boolean} true if any changes were made; false otherwise\n * @private\n */\n setState(nextState: StyleSpecification) {\n this._checkLoaded();\n\n if (emitValidationErrors(this, validateStyle(nextState))) return false;\n\n nextState = clone(nextState);\n nextState.layers = deref(nextState.layers);\n\n const changes = diffStyles(this.serialize(), nextState)\n .filter(op => !(op.command in ignoredDiffOperations));\n\n if (changes.length === 0) {\n return false;\n }\n\n const unimplementedOps = changes.filter(op => !(op.command in supportedDiffOperations));\n if (unimplementedOps.length > 0) {\n throw new Error(`Unimplemented: ${unimplementedOps.map(op => op.command).join(', ')}.`);\n }\n\n changes.forEach((op) => {\n if (op.command === 'setTransition') {\n // `transition` is always read directly off of\n // `this.stylesheet`, which we update below\n return;\n }\n (this: any)[op.command].apply(this, op.args);\n });\n\n this.stylesheet = nextState;\n\n return true;\n }\n\n addImage(id: string, image: StyleImage) {\n if (this.getImage(id)) {\n return this.fire(new ErrorEvent(new Error('An image with this name already exists.')));\n }\n this.imageManager.addImage(id, image);\n this._afterImageUpdated(id);\n }\n\n updateImage(id: string, image: StyleImage) {\n this.imageManager.updateImage(id, image);\n }\n\n getImage(id: string): ?StyleImage {\n return this.imageManager.getImage(id);\n }\n\n removeImage(id: string) {\n if (!this.getImage(id)) {\n return this.fire(new ErrorEvent(new Error('No image with this name exists.')));\n }\n this.imageManager.removeImage(id);\n this._afterImageUpdated(id);\n }\n\n _afterImageUpdated(id: string) {\n this._availableImages = this.imageManager.listImages();\n this._changedImages[id] = true;\n this._changed = true;\n this.dispatcher.broadcast('setImages', this._availableImages);\n this.fire(new Event('data', {dataType: 'style'}));\n }\n\n listImages() {\n this._checkLoaded();\n\n return this.imageManager.listImages();\n }\n\n addSource(id: string, source: SourceSpecification, options: StyleSetterOptions = {}) {\n this._checkLoaded();\n\n if (this.sourceCaches[id] !== undefined) {\n throw new Error('There is already a source with this ID');\n }\n\n if (!source.type) {\n throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(source).join(', ')}.`);\n }\n\n const builtIns = ['vector', 'raster', 'geojson', 'video', 'image'];\n const shouldValidate = builtIns.indexOf(source.type) >= 0;\n if (shouldValidate && this._validate(validateStyle.source, `sources.${id}`, source, null, options)) return;\n\n if (this.map && this.map._collectResourceTiming) (source: any).collectResourceTiming = true;\n const sourceCache = this.sourceCaches[id] = new SourceCache(id, source, this.dispatcher);\n sourceCache.style = this;\n sourceCache.setEventedParent(this, () => ({\n isSourceLoaded: this.loaded(),\n source: sourceCache.serialize(),\n sourceId: id\n }));\n\n sourceCache.onAdd(this.map);\n this._changed = true;\n }\n\n /**\n * Remove a source from this stylesheet, given its id.\n * @param {string} id id of the source to remove\n * @throws {Error} if no source is found with the given ID\n * @returns {Map} The {@link Map} object.\n */\n removeSource(id: string) {\n this._checkLoaded();\n\n if (this.sourceCaches[id] === undefined) {\n throw new Error('There is no source with this ID');\n }\n for (const layerId in this._layers) {\n if (this._layers[layerId].source === id) {\n return this.fire(new ErrorEvent(new Error(`Source \"${id}\" cannot be removed while layer \"${layerId}\" is using it.`)));\n }\n }\n\n const sourceCache = this.sourceCaches[id];\n delete this.sourceCaches[id];\n delete this._updatedSources[id];\n sourceCache.fire(new Event('data', {sourceDataType: 'metadata', dataType:'source', sourceId: id}));\n sourceCache.setEventedParent(null);\n sourceCache.clearTiles();\n\n if (sourceCache.onRemove) sourceCache.onRemove(this.map);\n this._changed = true;\n }\n\n /**\n * Set the data of a GeoJSON source, given its id.\n * @param {string} id id of the source\n * @param {GeoJSON|string} data GeoJSON source\n */\n setGeoJSONSourceData(id: string, data: GeoJSON | string) {\n this._checkLoaded();\n\n assert(this.sourceCaches[id] !== undefined, 'There is no source with this ID');\n const geojsonSource: GeoJSONSource = (this.sourceCaches[id].getSource(): any);\n assert(geojsonSource.type === 'geojson');\n\n geojsonSource.setData(data);\n this._changed = true;\n }\n\n /**\n * Get a source by id.\n * @param {string} id id of the desired source\n * @returns {Object} source\n */\n getSource(id: string): Object {\n return this.sourceCaches[id] && this.sourceCaches[id].getSource();\n }\n\n /**\n * Add a layer to the map style. The layer will be inserted before the layer with\n * ID `before`, or appended if `before` is omitted.\n * @param {Object | CustomLayerInterface} layerObject The style layer to add.\n * @param {string} [before] ID of an existing layer to insert before\n * @param {Object} options Style setter options.\n * @returns {Map} The {@link Map} object.\n */\n addLayer(layerObject: LayerSpecification | CustomLayerInterface, before?: string, options: StyleSetterOptions = {}) {\n this._checkLoaded();\n\n const id = layerObject.id;\n\n if (this.getLayer(id)) {\n this.fire(new ErrorEvent(new Error(`Layer with id \"${id}\" already exists on this map`)));\n return;\n }\n\n let layer;\n if (layerObject.type === 'custom') {\n\n if (emitValidationErrors(this, validateCustomStyleLayer(layerObject))) return;\n\n layer = createStyleLayer(layerObject);\n\n } else {\n if (typeof layerObject.source === 'object') {\n this.addSource(id, layerObject.source);\n layerObject = clone(layerObject);\n layerObject = (extend(layerObject, {source: id}): any);\n }\n\n // this layer is not in the style.layers array, so we pass an impossible array index\n if (this._validate(validateStyle.layer,\n `layers.${id}`, layerObject, {arrayIndex: -1}, options)) return;\n\n layer = createStyleLayer(layerObject);\n this._validateLayer(layer);\n\n layer.setEventedParent(this, {layer: {id}});\n this._serializedLayers[layer.id] = layer.serialize();\n }\n\n const index = before ? this._order.indexOf(before) : this._order.length;\n if (before && index === -1) {\n this.fire(new ErrorEvent(new Error(`Layer with id \"${before}\" does not exist on this map.`)));\n return;\n }\n\n this._order.splice(index, 0, id);\n this._layerOrderChanged = true;\n\n this._layers[id] = layer;\n\n if (this._removedLayers[id] && layer.source && layer.type !== 'custom') {\n // If, in the current batch, we have already removed this layer\n // and we are now re-adding it with a different `type`, then we\n // need to clear (rather than just reload) the underyling source's\n // tiles. Otherwise, tiles marked 'reloading' will have buckets /\n // buffers that are set up for the _previous_ version of this\n // layer, causing, e.g.:\n // https://github.com/mapbox/mapbox-gl-js/issues/3633\n const removed = this._removedLayers[id];\n delete this._removedLayers[id];\n if (removed.type !== layer.type) {\n this._updatedSources[layer.source] = 'clear';\n } else {\n this._updatedSources[layer.source] = 'reload';\n this.sourceCaches[layer.source].pause();\n }\n }\n this._updateLayer(layer);\n\n if (layer.onAdd) {\n layer.onAdd(this.map);\n }\n }\n\n /**\n * Moves a layer to a different z-position. The layer will be inserted before the layer with\n * ID `before`, or appended if `before` is omitted.\n * @param {string} id ID of the layer to move\n * @param {string} [before] ID of an existing layer to insert before\n */\n moveLayer(id: string, before?: string) {\n this._checkLoaded();\n this._changed = true;\n\n const layer = this._layers[id];\n if (!layer) {\n this.fire(new ErrorEvent(new Error(`The layer '${id}' does not exist in the map's style and cannot be moved.`)));\n return;\n }\n\n if (id === before) {\n return;\n }\n\n const index = this._order.indexOf(id);\n this._order.splice(index, 1);\n\n const newIndex = before ? this._order.indexOf(before) : this._order.length;\n if (before && newIndex === -1) {\n this.fire(new ErrorEvent(new Error(`Layer with id \"${before}\" does not exist on this map.`)));\n return;\n }\n this._order.splice(newIndex, 0, id);\n\n this._layerOrderChanged = true;\n }\n\n /**\n * Remove the layer with the given id from the style.\n *\n * If no such layer exists, an `error` event is fired.\n *\n * @param {string} id id of the layer to remove\n * @fires error\n */\n removeLayer(id: string) {\n this._checkLoaded();\n\n const layer = this._layers[id];\n if (!layer) {\n this.fire(new ErrorEvent(new Error(`The layer '${id}' does not exist in the map's style and cannot be removed.`)));\n return;\n }\n\n layer.setEventedParent(null);\n\n const index = this._order.indexOf(id);\n this._order.splice(index, 1);\n\n this._layerOrderChanged = true;\n this._changed = true;\n this._removedLayers[id] = layer;\n delete this._layers[id];\n delete this._serializedLayers[id];\n delete this._updatedLayers[id];\n delete this._updatedPaintProps[id];\n\n if (layer.onRemove) {\n layer.onRemove(this.map);\n }\n }\n\n /**\n * Return the style layer object with the given `id`.\n *\n * @param {string} id - id of the desired layer\n * @returns {?Object} a layer, if one with the given `id` exists\n */\n getLayer(id: string): Object {\n return this._layers[id];\n }\n\n /**\n * checks if a specific layer is present within the style.\n *\n * @param {string} id - id of the desired layer\n * @returns {boolean} a boolean specifying if the given layer is present\n */\n hasLayer(id: string): boolean {\n return id in this._layers;\n }\n\n setLayerZoomRange(layerId: string, minzoom: ?number, maxzoom: ?number) {\n this._checkLoaded();\n\n const layer = this.getLayer(layerId);\n if (!layer) {\n this.fire(new ErrorEvent(new Error(`The layer '${layerId}' does not exist in the map's style and cannot have zoom extent.`)));\n return;\n }\n\n if (layer.minzoom === minzoom && layer.maxzoom === maxzoom) return;\n\n if (minzoom != null) {\n layer.minzoom = minzoom;\n }\n if (maxzoom != null) {\n layer.maxzoom = maxzoom;\n }\n this._updateLayer(layer);\n }\n\n setFilter(layerId: string, filter: ?FilterSpecification, options: StyleSetterOptions = {}) {\n this._checkLoaded();\n\n const layer = this.getLayer(layerId);\n if (!layer) {\n this.fire(new ErrorEvent(new Error(`The layer '${layerId}' does not exist in the map's style and cannot be filtered.`)));\n return;\n }\n\n if (deepEqual(layer.filter, filter)) {\n return;\n }\n\n if (filter === null || filter === undefined) {\n layer.filter = undefined;\n this._updateLayer(layer);\n return;\n }\n\n if (this._validate(validateStyle.filter, `layers.${layer.id}.filter`, filter, null, options)) {\n return;\n }\n\n layer.filter = clone(filter);\n this._updateLayer(layer);\n }\n\n /**\n * Get a layer's filter object\n * @param {string} layer the layer to inspect\n * @returns {*} the layer's filter, if any\n */\n getFilter(layer: string) {\n return clone(this.getLayer(layer).filter);\n }\n\n setLayoutProperty(layerId: string, name: string, value: any, options: StyleSetterOptions = {}) {\n this._checkLoaded();\n\n const layer = this.getLayer(layerId);\n if (!layer) {\n this.fire(new ErrorEvent(new Error(`The layer '${layerId}' does not exist in the map's style and cannot be styled.`)));\n return;\n }\n\n if (deepEqual(layer.getLayoutProperty(name), value)) return;\n\n layer.setLayoutProperty(name, value, options);\n this._updateLayer(layer);\n }\n\n /**\n * Get a layout property's value from a given layer\n * @param {string} layerId the layer to inspect\n * @param {string} name the name of the layout property\n * @returns {*} the property value\n */\n getLayoutProperty(layerId: string, name: string) {\n const layer = this.getLayer(layerId);\n if (!layer) {\n this.fire(new ErrorEvent(new Error(`The layer '${layerId}' does not exist in the map's style.`)));\n return;\n }\n\n return layer.getLayoutProperty(name);\n }\n\n setPaintProperty(layerId: string, name: string, value: any, options: StyleSetterOptions = {}) {\n this._checkLoaded();\n\n const layer = this.getLayer(layerId);\n if (!layer) {\n this.fire(new ErrorEvent(new Error(`The layer '${layerId}' does not exist in the map's style and cannot be styled.`)));\n return;\n }\n\n if (deepEqual(layer.getPaintProperty(name), value)) return;\n\n const requiresRelayout = layer.setPaintProperty(name, value, options);\n if (requiresRelayout) {\n this._updateLayer(layer);\n }\n\n this._changed = true;\n this._updatedPaintProps[layerId] = true;\n }\n\n getPaintProperty(layer: string, name: string) {\n return this.getLayer(layer).getPaintProperty(name);\n }\n\n setFeatureState(target: { source: string; sourceLayer?: string; id: string | number; }, state: Object) {\n this._checkLoaded();\n const sourceId = target.source;\n const sourceLayer = target.sourceLayer;\n const sourceCache = this.sourceCaches[sourceId];\n\n if (sourceCache === undefined) {\n this.fire(new ErrorEvent(new Error(`The source '${sourceId}' does not exist in the map's style.`)));\n return;\n }\n const sourceType = sourceCache.getSource().type;\n if (sourceType === 'geojson' && sourceLayer) {\n this.fire(new ErrorEvent(new Error(`GeoJSON sources cannot have a sourceLayer parameter.`)));\n return;\n }\n if (sourceType === 'vector' && !sourceLayer) {\n this.fire(new ErrorEvent(new Error(`The sourceLayer parameter must be provided for vector source types.`)));\n return;\n }\n if (target.id === undefined) {\n this.fire(new ErrorEvent(new Error(`The feature id parameter must be provided.`)));\n }\n\n sourceCache.setFeatureState(sourceLayer, target.id, state);\n }\n\n removeFeatureState(target: { source: string; sourceLayer?: string; id?: string | number; }, key?: string) {\n this._checkLoaded();\n const sourceId = target.source;\n const sourceCache = this.sourceCaches[sourceId];\n\n if (sourceCache === undefined) {\n this.fire(new ErrorEvent(new Error(`The source '${sourceId}' does not exist in the map's style.`)));\n return;\n }\n\n const sourceType = sourceCache.getSource().type;\n const sourceLayer = sourceType === 'vector' ? target.sourceLayer : undefined;\n\n if (sourceType === 'vector' && !sourceLayer) {\n this.fire(new ErrorEvent(new Error(`The sourceLayer parameter must be provided for vector source types.`)));\n return;\n }\n\n if (key && (typeof target.id !== 'string' && typeof target.id !== 'number')) {\n this.fire(new ErrorEvent(new Error(`A feature id is required to remove its specific state property.`)));\n return;\n }\n\n sourceCache.removeFeatureState(sourceLayer, target.id, key);\n }\n\n getFeatureState(target: { source: string; sourceLayer?: string; id: string | number; }) {\n this._checkLoaded();\n const sourceId = target.source;\n const sourceLayer = target.sourceLayer;\n const sourceCache = this.sourceCaches[sourceId];\n\n if (sourceCache === undefined) {\n this.fire(new ErrorEvent(new Error(`The source '${sourceId}' does not exist in the map's style.`)));\n return;\n }\n const sourceType = sourceCache.getSource().type;\n if (sourceType === 'vector' && !sourceLayer) {\n this.fire(new ErrorEvent(new Error(`The sourceLayer parameter must be provided for vector source types.`)));\n return;\n }\n if (target.id === undefined) {\n this.fire(new ErrorEvent(new Error(`The feature id parameter must be provided.`)));\n }\n\n return sourceCache.getFeatureState(sourceLayer, target.id);\n }\n\n getTransition() {\n return extend({duration: 300, delay: 0}, this.stylesheet && this.stylesheet.transition);\n }\n\n serialize() {\n return filterObject({\n version: this.stylesheet.version,\n name: this.stylesheet.name,\n metadata: this.stylesheet.metadata,\n light: this.stylesheet.light,\n center: this.stylesheet.center,\n zoom: this.stylesheet.zoom,\n bearing: this.stylesheet.bearing,\n pitch: this.stylesheet.pitch,\n sprite: this.stylesheet.sprite,\n glyphs: this.stylesheet.glyphs,\n transition: this.stylesheet.transition,\n sources: mapObject(this.sourceCaches, (source) => source.serialize()),\n layers: this._serializeLayers(this._order)\n }, (value) => { return value !== undefined; });\n }\n\n _updateLayer(layer: StyleLayer) {\n this._updatedLayers[layer.id] = true;\n if (layer.source && !this._updatedSources[layer.source] &&\n //Skip for raster layers (https://github.com/mapbox/mapbox-gl-js/issues/7865)\n this.sourceCaches[layer.source].getSource().type !== 'raster') {\n this._updatedSources[layer.source] = 'reload';\n this.sourceCaches[layer.source].pause();\n }\n this._changed = true;\n }\n\n _flattenAndSortRenderedFeatures(sourceResults: Array) {\n // Feature order is complicated.\n // The order between features in two 2D layers is always determined by layer order.\n // The order between features in two 3D layers is always determined by depth.\n // The order between a feature in a 2D layer and a 3D layer is tricky:\n // Most often layer order determines the feature order in this case. If\n // a line layer is above a extrusion layer the line feature will be rendered\n // above the extrusion. If the line layer is below the extrusion layer,\n // it will be rendered below it.\n //\n // There is a weird case though.\n // You have layers in this order: extrusion_layer_a, line_layer, extrusion_layer_b\n // Each layer has a feature that overlaps the other features.\n // The feature in extrusion_layer_a is closer than the feature in extrusion_layer_b so it is rendered above.\n // The feature in line_layer is rendered above extrusion_layer_a.\n // This means that that the line_layer feature is above the extrusion_layer_b feature despite\n // it being in an earlier layer.\n\n const isLayer3D = layerId => this._layers[layerId].type === 'fill-extrusion';\n\n const layerIndex = {};\n const features3D = [];\n for (let l = this._order.length - 1; l >= 0; l--) {\n const layerId = this._order[l];\n if (isLayer3D(layerId)) {\n layerIndex[layerId] = l;\n for (const sourceResult of sourceResults) {\n const layerFeatures = sourceResult[layerId];\n if (layerFeatures) {\n for (const featureWrapper of layerFeatures) {\n features3D.push(featureWrapper);\n }\n }\n }\n }\n }\n\n features3D.sort((a, b) => {\n return b.intersectionZ - a.intersectionZ;\n });\n\n const features = [];\n for (let l = this._order.length - 1; l >= 0; l--) {\n const layerId = this._order[l];\n\n if (isLayer3D(layerId)) {\n // add all 3D features that are in or above the current layer\n for (let i = features3D.length - 1; i >= 0; i--) {\n const topmost3D = features3D[i].feature;\n if (layerIndex[topmost3D.layer.id] < l) break;\n features.push(topmost3D);\n features3D.pop();\n }\n } else {\n for (const sourceResult of sourceResults) {\n const layerFeatures = sourceResult[layerId];\n if (layerFeatures) {\n for (const featureWrapper of layerFeatures) {\n features.push(featureWrapper.feature);\n }\n }\n }\n }\n }\n\n return features;\n }\n\n queryRenderedFeatures(queryGeometry: any, params: any, transform: Transform) {\n if (params && params.filter) {\n this._validate(validateStyle.filter, 'queryRenderedFeatures.filter', params.filter, null, params);\n }\n\n const includedSources = {};\n if (params && params.layers) {\n if (!Array.isArray(params.layers)) {\n this.fire(new ErrorEvent(new Error('parameters.layers must be an Array.')));\n return [];\n }\n for (const layerId of params.layers) {\n const layer = this._layers[layerId];\n if (!layer) {\n // this layer is not in the style.layers array\n this.fire(new ErrorEvent(new Error(`The layer '${layerId}' does not exist in the map's style and cannot be queried for features.`)));\n return [];\n }\n includedSources[layer.source] = true;\n }\n }\n\n const sourceResults = [];\n\n params.availableImages = this._availableImages;\n\n for (const id in this.sourceCaches) {\n if (params.layers && !includedSources[id]) continue;\n sourceResults.push(\n queryRenderedFeatures(\n this.sourceCaches[id],\n this._layers,\n this._serializedLayers,\n queryGeometry,\n params,\n transform)\n );\n }\n\n if (this.placement) {\n // If a placement has run, query against its CollisionIndex\n // for symbol results, and treat it as an extra source to merge\n sourceResults.push(\n queryRenderedSymbols(\n this._layers,\n this._serializedLayers,\n this.sourceCaches,\n queryGeometry,\n params,\n this.placement.collisionIndex,\n this.placement.retainedQueryData)\n );\n }\n\n return this._flattenAndSortRenderedFeatures(sourceResults);\n }\n\n querySourceFeatures(sourceID: string, params: ?{sourceLayer: ?string, filter: ?Array, validate?: boolean}) {\n if (params && params.filter) {\n this._validate(validateStyle.filter, 'querySourceFeatures.filter', params.filter, null, params);\n }\n const sourceCache = this.sourceCaches[sourceID];\n return sourceCache ? querySourceFeatures(sourceCache, params) : [];\n }\n\n addSourceType(name: string, SourceType: SourceClass, callback: Callback) {\n if (Style.getSourceType(name)) {\n return callback(new Error(`A source type called \"${name}\" already exists.`));\n }\n\n Style.setSourceType(name, SourceType);\n\n if (!SourceType.workerSourceURL) {\n return callback(null, null);\n }\n\n this.dispatcher.broadcast('loadWorkerSource', {\n name,\n url: SourceType.workerSourceURL\n }, callback);\n }\n\n getLight() {\n return this.light.getLight();\n }\n\n setLight(lightOptions: LightSpecification, options: StyleSetterOptions = {}) {\n this._checkLoaded();\n\n const light = this.light.getLight();\n let _update = false;\n for (const key in lightOptions) {\n if (!deepEqual(lightOptions[key], light[key])) {\n _update = true;\n break;\n }\n }\n if (!_update) return;\n\n const parameters = {\n now: browser.now(),\n transition: extend({\n duration: 300,\n delay: 0\n }, this.stylesheet.transition)\n };\n\n this.light.setLight(lightOptions, options);\n this.light.updateTransitions(parameters);\n }\n\n _validate(validate: Validator, key: string, value: any, props: any, options: { validate?: boolean } = {}) {\n if (options && options.validate === false) {\n return false;\n }\n return emitValidationErrors(this, validate.call(validateStyle, extend({\n key,\n style: this.serialize(),\n value,\n styleSpec\n }, props)));\n }\n\n _remove() {\n if (this._request) {\n this._request.cancel();\n this._request = null;\n }\n if (this._spriteRequest) {\n this._spriteRequest.cancel();\n this._spriteRequest = null;\n }\n rtlTextPluginEvented.off('pluginStateChange', this._rtlTextPluginCallback);\n for (const layerId in this._layers) {\n const layer: StyleLayer = this._layers[layerId];\n layer.setEventedParent(null);\n }\n for (const id in this.sourceCaches) {\n this.sourceCaches[id].clearTiles();\n this.sourceCaches[id].setEventedParent(null);\n }\n this.imageManager.setEventedParent(null);\n this.setEventedParent(null);\n this.dispatcher.remove();\n }\n\n _clearSource(id: string) {\n this.sourceCaches[id].clearTiles();\n }\n\n _reloadSource(id: string) {\n this.sourceCaches[id].resume();\n this.sourceCaches[id].reload();\n }\n\n _updateSources(transform: Transform) {\n for (const id in this.sourceCaches) {\n this.sourceCaches[id].update(transform);\n }\n }\n\n _generateCollisionBoxes() {\n for (const id in this.sourceCaches) {\n this._reloadSource(id);\n }\n }\n\n _updatePlacement(transform: Transform, showCollisionBoxes: boolean, fadeDuration: number, crossSourceCollisions: boolean, forceFullPlacement: boolean = false) {\n let symbolBucketsChanged = false;\n let placementCommitted = false;\n\n const layerTiles = {};\n\n for (const layerID of this._order) {\n const styleLayer = this._layers[layerID];\n if (styleLayer.type !== 'symbol') continue;\n\n if (!layerTiles[styleLayer.source]) {\n const sourceCache = this.sourceCaches[styleLayer.source];\n layerTiles[styleLayer.source] = sourceCache.getRenderableIds(true)\n .map((id) => sourceCache.getTileByID(id))\n .sort((a, b) => (b.tileID.overscaledZ - a.tileID.overscaledZ) || (a.tileID.isLessThan(b.tileID) ? -1 : 1));\n }\n\n const layerBucketsChanged = this.crossTileSymbolIndex.addLayer(styleLayer, layerTiles[styleLayer.source], transform.center.lng);\n symbolBucketsChanged = symbolBucketsChanged || layerBucketsChanged;\n }\n this.crossTileSymbolIndex.pruneUnusedLayers(this._order);\n\n // Anything that changes our \"in progress\" layer and tile indices requires us\n // to start over. When we start over, we do a full placement instead of incremental\n // to prevent starvation.\n // We need to restart placement to keep layer indices in sync.\n // Also force full placement when fadeDuration === 0 to ensure that newly loaded\n // tiles will fully display symbols in their first frame\n forceFullPlacement = forceFullPlacement || this._layerOrderChanged || fadeDuration === 0;\n\n if (forceFullPlacement || !this.pauseablePlacement || (this.pauseablePlacement.isDone() && !this.placement.stillRecent(browser.now(), transform.zoom))) {\n this.pauseablePlacement = new PauseablePlacement(transform, this._order, forceFullPlacement, showCollisionBoxes, fadeDuration, crossSourceCollisions, this.placement);\n this._layerOrderChanged = false;\n }\n\n if (this.pauseablePlacement.isDone()) {\n // the last placement finished running, but the next one hasn’t\n // started yet because of the `stillRecent` check immediately\n // above, so mark it stale to ensure that we request another\n // render frame\n this.placement.setStale();\n } else {\n this.pauseablePlacement.continuePlacement(this._order, this._layers, layerTiles);\n\n if (this.pauseablePlacement.isDone()) {\n this.placement = this.pauseablePlacement.commit(browser.now());\n placementCommitted = true;\n }\n\n if (symbolBucketsChanged) {\n // since the placement gets split over multiple frames it is possible\n // these buckets were processed before they were changed and so the\n // placement is already stale while it is in progress\n this.pauseablePlacement.placement.setStale();\n }\n }\n\n if (placementCommitted || symbolBucketsChanged) {\n for (const layerID of this._order) {\n const styleLayer = this._layers[layerID];\n if (styleLayer.type !== 'symbol') continue;\n this.placement.updateLayerOpacities(styleLayer, layerTiles[styleLayer.source]);\n }\n }\n\n // needsRender is false when we have just finished a placement that didn't change the visibility of any symbols\n const needsRerender = !this.pauseablePlacement.isDone() || this.placement.hasTransitions(browser.now());\n return needsRerender;\n }\n\n _releaseSymbolFadeTiles() {\n for (const id in this.sourceCaches) {\n this.sourceCaches[id].releaseSymbolFadeTiles();\n }\n }\n\n // Callbacks from web workers\n\n getImages(mapId: string, params: {icons: Array, source: string, tileID: OverscaledTileID, type: string}, callback: Callback<{[_: string]: StyleImage}>) {\n\n this.imageManager.getImages(params.icons, callback);\n\n // Apply queued image changes before setting the tile's dependencies so that the tile\n // is not reloaded unecessarily. Without this forced update the reload could happen in cases\n // like this one:\n // - icons contains \"my-image\"\n // - imageManager.getImages(...) triggers `onstyleimagemissing`\n // - the user adds \"my-image\" within the callback\n // - addImage adds \"my-image\" to this._changedImages\n // - the next frame triggers a reload of this tile even though it already has the latest version\n this._updateTilesForChangedImages();\n\n const sourceCache = this.sourceCaches[params.source];\n if (sourceCache) {\n sourceCache.setDependencies(params.tileID.key, params.type, params.icons);\n }\n }\n\n getGlyphs(mapId: string, params: {stacks: {[_: string]: Array}}, callback: Callback<{[_: string]: {[_: number]: ?StyleGlyph}}>) {\n this.glyphManager.getGlyphs(params.stacks, callback);\n }\n\n getResource(mapId: string, params: RequestParameters, callback: ResponseCallback): Cancelable {\n return makeRequest(params, callback);\n }\n}\n\nStyle.getSourceType = getSourceType;\nStyle.setSourceType = setSourceType;\nStyle.registerForPluginStateChange = registerForPluginStateChange;\n\nexport default Style;\n","import latest from './reference/latest';\n\nexport default function emptyStyle() {\n const style = {};\n\n const version = latest['$version'];\n for (const styleKey in latest['$root']) {\n const spec = latest['$root'][styleKey];\n\n if (spec.required) {\n let value = null;\n if (styleKey === 'version') {\n value = version;\n } else {\n if (spec.type === 'array') {\n value = [];\n } else {\n value = {};\n }\n }\n\n if (value != null) {\n style[styleKey] = value;\n }\n }\n }\n\n return style;\n}\n","// @flow\n\nimport {getJSON, getImage, ResourceType} from '../util/ajax';\n\nimport browser from '../util/browser';\nimport {RGBAImage} from '../util/image';\n\nimport type {StyleImage} from './style_image';\nimport type {RequestManager} from '../util/mapbox';\nimport type {Callback} from '../types/callback';\nimport type {Cancelable} from '../types/cancelable';\n\nexport default function(baseURL: string,\n requestManager: RequestManager,\n callback: Callback<{[_: string]: StyleImage}>): Cancelable {\n let json: any, image, error;\n const format = browser.devicePixelRatio > 1 ? '@2x' : '';\n\n let jsonRequest = getJSON(requestManager.transformRequest(requestManager.normalizeSpriteURL(baseURL, format, '.json'), ResourceType.SpriteJSON), (err: ?Error, data: ?Object) => {\n jsonRequest = null;\n if (!error) {\n error = err;\n json = data;\n maybeComplete();\n }\n });\n\n let imageRequest = getImage(requestManager.transformRequest(requestManager.normalizeSpriteURL(baseURL, format, '.png'), ResourceType.SpriteImage), (err, img) => {\n imageRequest = null;\n if (!error) {\n error = err;\n image = img;\n maybeComplete();\n }\n });\n\n function maybeComplete() {\n if (error) {\n callback(error);\n } else if (json && image) {\n const imageData = browser.getImageData(image);\n const result = {};\n\n for (const id in json) {\n const {width, height, x, y, sdf, pixelRatio, stretchX, stretchY, content} = json[id];\n const data = new RGBAImage({width, height});\n RGBAImage.copy(imageData, data, {x, y}, {x: 0, y: 0}, {width, height});\n result[id] = {data, pixelRatio, sdf, stretchX, stretchY, content};\n }\n\n callback(null, result);\n }\n }\n\n return {\n cancel() {\n if (jsonRequest) {\n jsonRequest.cancel();\n jsonRequest = null;\n }\n if (imageRequest) {\n imageRequest.cancel();\n imageRequest = null;\n }\n }\n };\n}\n","// @flow\nimport {createLayout} from '../util/struct_array';\n\nexport default createLayout([\n {name: 'a_pos', type: 'Int16', components: 2}\n]);\n","\n// Disable Flow annotations here because Flow doesn't support importing GLSL files\n/* eslint-disable flowtype/require-valid-file-annotation */\n\nimport preludeFrag from './_prelude.fragment.glsl';\nimport preludeVert from './_prelude.vertex.glsl';\nimport backgroundFrag from './background.fragment.glsl';\nimport backgroundVert from './background.vertex.glsl';\nimport backgroundPatternFrag from './background_pattern.fragment.glsl';\nimport backgroundPatternVert from './background_pattern.vertex.glsl';\nimport circleFrag from './circle.fragment.glsl';\nimport circleVert from './circle.vertex.glsl';\nimport clippingMaskFrag from './clipping_mask.fragment.glsl';\nimport clippingMaskVert from './clipping_mask.vertex.glsl';\nimport heatmapFrag from './heatmap.fragment.glsl';\nimport heatmapVert from './heatmap.vertex.glsl';\nimport heatmapTextureFrag from './heatmap_texture.fragment.glsl';\nimport heatmapTextureVert from './heatmap_texture.vertex.glsl';\nimport collisionBoxFrag from './collision_box.fragment.glsl';\nimport collisionBoxVert from './collision_box.vertex.glsl';\nimport collisionCircleFrag from './collision_circle.fragment.glsl';\nimport collisionCircleVert from './collision_circle.vertex.glsl';\nimport debugFrag from './debug.fragment.glsl';\nimport debugVert from './debug.vertex.glsl';\nimport fillFrag from './fill.fragment.glsl';\nimport fillVert from './fill.vertex.glsl';\nimport fillOutlineFrag from './fill_outline.fragment.glsl';\nimport fillOutlineVert from './fill_outline.vertex.glsl';\nimport fillOutlinePatternFrag from './fill_outline_pattern.fragment.glsl';\nimport fillOutlinePatternVert from './fill_outline_pattern.vertex.glsl';\nimport fillPatternFrag from './fill_pattern.fragment.glsl';\nimport fillPatternVert from './fill_pattern.vertex.glsl';\nimport fillExtrusionFrag from './fill_extrusion.fragment.glsl';\nimport fillExtrusionVert from './fill_extrusion.vertex.glsl';\nimport fillExtrusionPatternFrag from './fill_extrusion_pattern.fragment.glsl';\nimport fillExtrusionPatternVert from './fill_extrusion_pattern.vertex.glsl';\nimport hillshadePrepareFrag from './hillshade_prepare.fragment.glsl';\nimport hillshadePrepareVert from './hillshade_prepare.vertex.glsl';\nimport hillshadeFrag from './hillshade.fragment.glsl';\nimport hillshadeVert from './hillshade.vertex.glsl';\nimport lineFrag from './line.fragment.glsl';\nimport lineVert from './line.vertex.glsl';\nimport lineGradientFrag from './line_gradient.fragment.glsl';\nimport lineGradientVert from './line_gradient.vertex.glsl';\nimport linePatternFrag from './line_pattern.fragment.glsl';\nimport linePatternVert from './line_pattern.vertex.glsl';\nimport lineSDFFrag from './line_sdf.fragment.glsl';\nimport lineSDFVert from './line_sdf.vertex.glsl';\nimport rasterFrag from './raster.fragment.glsl';\nimport rasterVert from './raster.vertex.glsl';\nimport symbolIconFrag from './symbol_icon.fragment.glsl';\nimport symbolIconVert from './symbol_icon.vertex.glsl';\nimport symbolSDFFrag from './symbol_sdf.fragment.glsl';\nimport symbolSDFVert from './symbol_sdf.vertex.glsl';\nimport symbolTextAndIconFrag from './symbol_text_and_icon.fragment.glsl';\nimport symbolTextAndIconVert from './symbol_text_and_icon.vertex.glsl';\n\nexport const prelude = compile(preludeFrag, preludeVert);\nexport const background = compile(backgroundFrag, backgroundVert);\nexport const backgroundPattern = compile(backgroundPatternFrag, backgroundPatternVert);\nexport const circle = compile(circleFrag, circleVert);\nexport const clippingMask = compile(clippingMaskFrag, clippingMaskVert);\nexport const heatmap = compile(heatmapFrag, heatmapVert);\nexport const heatmapTexture = compile(heatmapTextureFrag, heatmapTextureVert);\nexport const collisionBox = compile(collisionBoxFrag, collisionBoxVert);\nexport const collisionCircle = compile(collisionCircleFrag, collisionCircleVert);\nexport const debug = compile(debugFrag, debugVert);\nexport const fill = compile(fillFrag, fillVert);\nexport const fillOutline = compile(fillOutlineFrag, fillOutlineVert);\nexport const fillOutlinePattern = compile(fillOutlinePatternFrag, fillOutlinePatternVert);\nexport const fillPattern = compile(fillPatternFrag, fillPatternVert);\nexport const fillExtrusion = compile(fillExtrusionFrag, fillExtrusionVert);\nexport const fillExtrusionPattern = compile(fillExtrusionPatternFrag, fillExtrusionPatternVert);\nexport const hillshadePrepare = compile(hillshadePrepareFrag, hillshadePrepareVert);\nexport const hillshade = compile(hillshadeFrag, hillshadeVert);\nexport const line = compile(lineFrag, lineVert);\nexport const lineGradient = compile(lineGradientFrag, lineGradientVert);\nexport const linePattern = compile(linePatternFrag, linePatternVert);\nexport const lineSDF = compile(lineSDFFrag, lineSDFVert);\nexport const raster = compile(rasterFrag, rasterVert);\nexport const symbolIcon = compile(symbolIconFrag, symbolIconVert);\nexport const symbolSDF = compile(symbolSDFFrag, symbolSDFVert);\nexport const symbolTextAndIcon = compile(symbolTextAndIconFrag, symbolTextAndIconVert);\n\n// Expand #pragmas to #ifdefs.\n\nfunction compile(fragmentSource, vertexSource) {\n const re = /#pragma mapbox: ([\\w]+) ([\\w]+) ([\\w]+) ([\\w]+)/g;\n\n const staticAttributes = vertexSource.match(/attribute ([\\w]+) ([\\w]+)/g);\n const fragmentUniforms = fragmentSource.match(/uniform ([\\w]+) ([\\w]+)([\\s]*)([\\w]*)/g);\n const vertexUniforms = vertexSource.match(/uniform ([\\w]+) ([\\w]+)([\\s]*)([\\w]*)/g);\n const staticUniforms = vertexUniforms ? vertexUniforms.concat(fragmentUniforms) : fragmentUniforms;\n\n const fragmentPragmas = {};\n\n fragmentSource = fragmentSource.replace(re, (match, operation, precision, type, name) => {\n fragmentPragmas[name] = true;\n if (operation === 'define') {\n return `\n#ifndef HAS_UNIFORM_u_${name}\nvarying ${precision} ${type} ${name};\n#else\nuniform ${precision} ${type} u_${name};\n#endif\n`;\n } else /* if (operation === 'initialize') */ {\n return `\n#ifdef HAS_UNIFORM_u_${name}\n ${precision} ${type} ${name} = u_${name};\n#endif\n`;\n }\n });\n\n vertexSource = vertexSource.replace(re, (match, operation, precision, type, name) => {\n const attrType = type === 'float' ? 'vec2' : 'vec4';\n const unpackType = name.match(/color/) ? 'color' : attrType;\n\n if (fragmentPragmas[name]) {\n if (operation === 'define') {\n return `\n#ifndef HAS_UNIFORM_u_${name}\nuniform lowp float u_${name}_t;\nattribute ${precision} ${attrType} a_${name};\nvarying ${precision} ${type} ${name};\n#else\nuniform ${precision} ${type} u_${name};\n#endif\n`;\n } else /* if (operation === 'initialize') */ {\n if (unpackType === 'vec4') {\n // vec4 attributes are only used for cross-faded properties, and are not packed\n return `\n#ifndef HAS_UNIFORM_u_${name}\n ${name} = a_${name};\n#else\n ${precision} ${type} ${name} = u_${name};\n#endif\n`;\n } else {\n return `\n#ifndef HAS_UNIFORM_u_${name}\n ${name} = unpack_mix_${unpackType}(a_${name}, u_${name}_t);\n#else\n ${precision} ${type} ${name} = u_${name};\n#endif\n`;\n }\n }\n } else {\n if (operation === 'define') {\n return `\n#ifndef HAS_UNIFORM_u_${name}\nuniform lowp float u_${name}_t;\nattribute ${precision} ${attrType} a_${name};\n#else\nuniform ${precision} ${type} u_${name};\n#endif\n`;\n } else /* if (operation === 'initialize') */ {\n if (unpackType === 'vec4') {\n // vec4 attributes are only used for cross-faded properties, and are not packed\n return `\n#ifndef HAS_UNIFORM_u_${name}\n ${precision} ${type} ${name} = a_${name};\n#else\n ${precision} ${type} ${name} = u_${name};\n#endif\n`;\n } else /* */{\n return `\n#ifndef HAS_UNIFORM_u_${name}\n ${precision} ${type} ${name} = unpack_mix_${unpackType}(a_${name}, u_${name}_t);\n#else\n ${precision} ${type} ${name} = u_${name};\n#endif\n`;\n }\n }\n }\n });\n\n return {fragmentSource, vertexSource, staticAttributes, staticUniforms};\n}\n","// @flow\n\nimport assert from 'assert';\n\nimport type Program from './program';\nimport type VertexBuffer from '../gl/vertex_buffer';\nimport type IndexBuffer from '../gl/index_buffer';\nimport type Context from '../gl/context';\n\nclass VertexArrayObject {\n context: Context;\n boundProgram: ?Program<*>;\n boundLayoutVertexBuffer: ?VertexBuffer;\n boundPaintVertexBuffers: Array;\n boundIndexBuffer: ?IndexBuffer;\n boundVertexOffset: ?number;\n boundDynamicVertexBuffer: ?VertexBuffer;\n boundDynamicVertexBuffer2: ?VertexBuffer;\n vao: any;\n\n constructor() {\n this.boundProgram = null;\n this.boundLayoutVertexBuffer = null;\n this.boundPaintVertexBuffers = [];\n this.boundIndexBuffer = null;\n this.boundVertexOffset = null;\n this.boundDynamicVertexBuffer = null;\n this.vao = null;\n }\n\n bind(context: Context,\n program: Program<*>,\n layoutVertexBuffer: VertexBuffer,\n paintVertexBuffers: Array,\n indexBuffer: ?IndexBuffer,\n vertexOffset: ?number,\n dynamicVertexBuffer: ?VertexBuffer,\n dynamicVertexBuffer2: ?VertexBuffer) {\n\n this.context = context;\n\n let paintBuffersDiffer = this.boundPaintVertexBuffers.length !== paintVertexBuffers.length;\n for (let i = 0; !paintBuffersDiffer && i < paintVertexBuffers.length; i++) {\n if (this.boundPaintVertexBuffers[i] !== paintVertexBuffers[i]) {\n paintBuffersDiffer = true;\n }\n }\n\n const isFreshBindRequired = (\n !this.vao ||\n this.boundProgram !== program ||\n this.boundLayoutVertexBuffer !== layoutVertexBuffer ||\n paintBuffersDiffer ||\n this.boundIndexBuffer !== indexBuffer ||\n this.boundVertexOffset !== vertexOffset ||\n this.boundDynamicVertexBuffer !== dynamicVertexBuffer ||\n this.boundDynamicVertexBuffer2 !== dynamicVertexBuffer2\n );\n\n if (!context.extVertexArrayObject || isFreshBindRequired) {\n this.freshBind(program, layoutVertexBuffer, paintVertexBuffers, indexBuffer, vertexOffset, dynamicVertexBuffer, dynamicVertexBuffer2);\n } else {\n context.bindVertexArrayOES.set(this.vao);\n\n if (dynamicVertexBuffer) {\n // The buffer may have been updated. Rebind to upload data.\n dynamicVertexBuffer.bind();\n }\n\n if (indexBuffer && indexBuffer.dynamicDraw) {\n indexBuffer.bind();\n }\n\n if (dynamicVertexBuffer2) {\n dynamicVertexBuffer2.bind();\n }\n }\n }\n\n freshBind(program: Program<*>,\n layoutVertexBuffer: VertexBuffer,\n paintVertexBuffers: Array,\n indexBuffer: ?IndexBuffer,\n vertexOffset: ?number,\n dynamicVertexBuffer: ?VertexBuffer,\n dynamicVertexBuffer2: ?VertexBuffer) {\n let numPrevAttributes;\n const numNextAttributes = program.numAttributes;\n\n const context = this.context;\n const gl = context.gl;\n\n if (context.extVertexArrayObject) {\n if (this.vao) this.destroy();\n this.vao = context.extVertexArrayObject.createVertexArrayOES();\n context.bindVertexArrayOES.set(this.vao);\n numPrevAttributes = 0;\n\n // store the arguments so that we can verify them when the vao is bound again\n this.boundProgram = program;\n this.boundLayoutVertexBuffer = layoutVertexBuffer;\n this.boundPaintVertexBuffers = paintVertexBuffers;\n this.boundIndexBuffer = indexBuffer;\n this.boundVertexOffset = vertexOffset;\n this.boundDynamicVertexBuffer = dynamicVertexBuffer;\n this.boundDynamicVertexBuffer2 = dynamicVertexBuffer2;\n\n } else {\n numPrevAttributes = context.currentNumAttributes || 0;\n\n // Disable all attributes from the previous program that aren't used in\n // the new program. Note: attribute indices are *not* program specific!\n for (let i = numNextAttributes; i < numPrevAttributes; i++) {\n // WebGL breaks if you disable attribute 0.\n // http://stackoverflow.com/questions/20305231\n assert(i !== 0);\n gl.disableVertexAttribArray(i);\n }\n }\n\n layoutVertexBuffer.enableAttributes(gl, program);\n for (const vertexBuffer of paintVertexBuffers) {\n vertexBuffer.enableAttributes(gl, program);\n }\n\n if (dynamicVertexBuffer) {\n dynamicVertexBuffer.enableAttributes(gl, program);\n }\n if (dynamicVertexBuffer2) {\n dynamicVertexBuffer2.enableAttributes(gl, program);\n }\n\n layoutVertexBuffer.bind();\n layoutVertexBuffer.setVertexAttribPointers(gl, program, vertexOffset);\n for (const vertexBuffer of paintVertexBuffers) {\n vertexBuffer.bind();\n vertexBuffer.setVertexAttribPointers(gl, program, vertexOffset);\n }\n\n if (dynamicVertexBuffer) {\n dynamicVertexBuffer.bind();\n dynamicVertexBuffer.setVertexAttribPointers(gl, program, vertexOffset);\n }\n if (indexBuffer) {\n indexBuffer.bind();\n }\n if (dynamicVertexBuffer2) {\n dynamicVertexBuffer2.bind();\n dynamicVertexBuffer2.setVertexAttribPointers(gl, program, vertexOffset);\n }\n\n context.currentNumAttributes = numNextAttributes;\n }\n\n destroy() {\n if (this.vao) {\n this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao);\n this.vao = null;\n }\n }\n}\n\nexport default VertexArrayObject;\n","// @flow\n\nimport {prelude} from '../shaders';\nimport assert from 'assert';\nimport ProgramConfiguration from '../data/program_configuration';\nimport VertexArrayObject from './vertex_array_object';\nimport Context from '../gl/context';\n\nimport type SegmentVector from '../data/segment';\nimport type VertexBuffer from '../gl/vertex_buffer';\nimport type IndexBuffer from '../gl/index_buffer';\nimport type DepthMode from '../gl/depth_mode';\nimport type StencilMode from '../gl/stencil_mode';\nimport type ColorMode from '../gl/color_mode';\nimport type CullFaceMode from '../gl/cull_face_mode';\nimport type {UniformBindings, UniformValues, UniformLocations} from './uniform_binding';\nimport type {BinderUniform} from '../data/program_configuration';\n\nexport type DrawMode =\n | $PropertyType\n | $PropertyType\n | $PropertyType;\n\nfunction getTokenizedAttributesAndUniforms (array: Array): Array {\n const result = [];\n\n for (let i = 0; i < array.length; i++) {\n if (array[i] === null) continue;\n const token = array[i].split(' ');\n result.push(token.pop());\n }\n return result;\n}\nclass Program {\n program: WebGLProgram;\n attributes: {[_: string]: number};\n numAttributes: number;\n fixedUniforms: Us;\n binderUniforms: Array;\n failedToCreate: boolean;\n\n constructor(context: Context,\n name: string,\n source: {fragmentSource: string, vertexSource: string, staticAttributes: Array, staticUniforms: Array},\n configuration: ?ProgramConfiguration,\n fixedUniforms: (Context, UniformLocations) => Us,\n showOverdrawInspector: boolean) {\n const gl = context.gl;\n this.program = gl.createProgram();\n\n const staticAttrInfo = getTokenizedAttributesAndUniforms(source.staticAttributes);\n const dynamicAttrInfo = configuration ? configuration.getBinderAttributes() : [];\n const allAttrInfo = staticAttrInfo.concat(dynamicAttrInfo);\n\n const staticUniformsInfo = source.staticUniforms ? getTokenizedAttributesAndUniforms(source.staticUniforms) : [];\n const dynamicUniformsInfo = configuration ? configuration.getBinderUniforms() : [];\n // remove duplicate uniforms\n const uniformList = staticUniformsInfo.concat(dynamicUniformsInfo);\n const allUniformsInfo = [];\n for (const uniform of uniformList) {\n if (allUniformsInfo.indexOf(uniform) < 0) allUniformsInfo.push(uniform);\n }\n\n const defines = configuration ? configuration.defines() : [];\n if (showOverdrawInspector) {\n defines.push('#define OVERDRAW_INSPECTOR;');\n }\n\n const fragmentSource = defines.concat(prelude.fragmentSource, source.fragmentSource).join('\\n');\n const vertexSource = defines.concat(prelude.vertexSource, source.vertexSource).join('\\n');\n const fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);\n if (gl.isContextLost()) {\n this.failedToCreate = true;\n return;\n }\n gl.shaderSource(fragmentShader, fragmentSource);\n gl.compileShader(fragmentShader);\n assert(gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS), (gl.getShaderInfoLog(fragmentShader): any));\n gl.attachShader(this.program, fragmentShader);\n\n const vertexShader = gl.createShader(gl.VERTEX_SHADER);\n if (gl.isContextLost()) {\n this.failedToCreate = true;\n return;\n }\n gl.shaderSource(vertexShader, vertexSource);\n gl.compileShader(vertexShader);\n assert(gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS), (gl.getShaderInfoLog(vertexShader): any));\n gl.attachShader(this.program, vertexShader);\n\n this.attributes = {};\n const uniformLocations = {};\n\n this.numAttributes = allAttrInfo.length;\n\n for (let i = 0; i < this.numAttributes; i++) {\n if (allAttrInfo[i]) {\n gl.bindAttribLocation(this.program, i, allAttrInfo[i]);\n this.attributes[allAttrInfo[i]] = i;\n }\n }\n\n gl.linkProgram(this.program);\n assert(gl.getProgramParameter(this.program, gl.LINK_STATUS), (gl.getProgramInfoLog(this.program): any));\n\n gl.deleteShader(vertexShader);\n gl.deleteShader(fragmentShader);\n\n for (let it = 0; it < allUniformsInfo.length; it++) {\n const uniform = allUniformsInfo[it];\n if (uniform && !uniformLocations[uniform]) {\n const uniformLocation = gl.getUniformLocation(this.program, uniform);\n if (uniformLocation) {\n uniformLocations[uniform] = uniformLocation;\n }\n }\n }\n\n this.fixedUniforms = fixedUniforms(context, uniformLocations);\n this.binderUniforms = configuration ? configuration.getUniforms(context, uniformLocations) : [];\n }\n\n draw(context: Context,\n drawMode: DrawMode,\n depthMode: $ReadOnly,\n stencilMode: $ReadOnly,\n colorMode: $ReadOnly,\n cullFaceMode: $ReadOnly,\n uniformValues: UniformValues,\n layerID: string,\n layoutVertexBuffer: VertexBuffer,\n indexBuffer: IndexBuffer,\n segments: SegmentVector,\n currentProperties: any,\n zoom: ?number,\n configuration: ?ProgramConfiguration,\n dynamicLayoutBuffer: ?VertexBuffer,\n dynamicLayoutBuffer2: ?VertexBuffer) {\n\n const gl = context.gl;\n\n if (this.failedToCreate) return;\n\n context.program.set(this.program);\n context.setDepthMode(depthMode);\n context.setStencilMode(stencilMode);\n context.setColorMode(colorMode);\n context.setCullFace(cullFaceMode);\n\n for (const name in this.fixedUniforms) {\n this.fixedUniforms[name].set(uniformValues[name]);\n }\n\n if (configuration) {\n configuration.setUniforms(context, this.binderUniforms, currentProperties, {zoom: (zoom: any)});\n }\n\n const primitiveSize = {\n [gl.LINES]: 2,\n [gl.TRIANGLES]: 3,\n [gl.LINE_STRIP]: 1\n }[drawMode];\n\n for (const segment of segments.get()) {\n const vaos = segment.vaos || (segment.vaos = {});\n const vao: VertexArrayObject = vaos[layerID] || (vaos[layerID] = new VertexArrayObject());\n\n vao.bind(\n context,\n this,\n layoutVertexBuffer,\n configuration ? configuration.getPaintVertexBuffers() : [],\n indexBuffer,\n segment.vertexOffset,\n dynamicLayoutBuffer,\n dynamicLayoutBuffer2\n );\n\n gl.drawElements(\n drawMode,\n segment.primitiveLength * primitiveSize,\n gl.UNSIGNED_SHORT,\n segment.primitiveOffset * primitiveSize * 2);\n }\n }\n}\n\nexport default Program;\n","// @flow\n\nimport assert from 'assert';\nimport {\n Uniform1i,\n Uniform1f,\n Uniform2f,\n Uniform3f\n} from '../uniform_binding';\nimport pixelsToTileUnits from '../../source/pixels_to_tile_units';\n\nimport type Painter from '../painter';\nimport type {OverscaledTileID} from '../../source/tile_id';\nimport type {CrossFaded} from '../../style/properties';\nimport type {CrossfadeParameters} from '../../style/evaluation_parameters';\nimport type {UniformValues} from '../uniform_binding';\nimport type Tile from '../../source/tile';\nimport type ResolvedImage from '../../style-spec/expression/types/resolved_image';\n\ntype BackgroundPatternUniformsType = {|\n 'u_image': Uniform1i,\n 'u_pattern_tl_a': Uniform2f,\n 'u_pattern_br_a': Uniform2f,\n 'u_pattern_tl_b': Uniform2f,\n 'u_pattern_br_b': Uniform2f,\n 'u_texsize': Uniform2f,\n 'u_mix': Uniform1f,\n 'u_pattern_size_a': Uniform2f,\n 'u_pattern_size_b': Uniform2f,\n 'u_scale_a': Uniform1f,\n 'u_scale_b': Uniform1f,\n 'u_pixel_coord_upper': Uniform2f,\n 'u_pixel_coord_lower': Uniform2f,\n 'u_tile_units_to_pixels': Uniform1f\n|};\n\nexport type PatternUniformsType = {|\n // pattern uniforms:\n 'u_image': Uniform1i,\n 'u_texsize': Uniform2f,\n 'u_scale': Uniform3f,\n 'u_fade': Uniform1f,\n 'u_pixel_coord_upper': Uniform2f,\n 'u_pixel_coord_lower': Uniform2f\n|};\n\nfunction patternUniformValues(crossfade: CrossfadeParameters, painter: Painter,\n tile: Tile\n): UniformValues {\n\n const tileRatio = 1 / pixelsToTileUnits(tile, 1, painter.transform.tileZoom);\n\n const numTiles = Math.pow(2, tile.tileID.overscaledZ);\n const tileSizeAtNearestZoom = tile.tileSize * Math.pow(2, painter.transform.tileZoom) / numTiles;\n\n const pixelX = tileSizeAtNearestZoom * (tile.tileID.canonical.x + tile.tileID.wrap * numTiles);\n const pixelY = tileSizeAtNearestZoom * tile.tileID.canonical.y;\n\n return {\n 'u_image': 0,\n 'u_texsize': tile.imageAtlasTexture.size,\n 'u_scale': [tileRatio, crossfade.fromScale, crossfade.toScale],\n 'u_fade': crossfade.t,\n // split the pixel coord into two pairs of 16 bit numbers. The glsl spec only guarantees 16 bits of precision.\n 'u_pixel_coord_upper': [pixelX >> 16, pixelY >> 16],\n 'u_pixel_coord_lower': [pixelX & 0xFFFF, pixelY & 0xFFFF]\n };\n}\n\nfunction bgPatternUniformValues(image: CrossFaded, crossfade: CrossfadeParameters, painter: Painter,\n tile: {tileID: OverscaledTileID, tileSize: number}\n): UniformValues {\n const imagePosA = painter.imageManager.getPattern(image.from.toString());\n const imagePosB = painter.imageManager.getPattern(image.to.toString());\n assert(imagePosA && imagePosB);\n const {width, height} = painter.imageManager.getPixelSize();\n\n const numTiles = Math.pow(2, tile.tileID.overscaledZ);\n const tileSizeAtNearestZoom = tile.tileSize * Math.pow(2, painter.transform.tileZoom) / numTiles;\n\n const pixelX = tileSizeAtNearestZoom * (tile.tileID.canonical.x + tile.tileID.wrap * numTiles);\n const pixelY = tileSizeAtNearestZoom * tile.tileID.canonical.y;\n\n return {\n 'u_image': 0,\n 'u_pattern_tl_a': (imagePosA: any).tl,\n 'u_pattern_br_a': (imagePosA: any).br,\n 'u_pattern_tl_b': (imagePosB: any).tl,\n 'u_pattern_br_b': (imagePosB: any).br,\n 'u_texsize': [width, height],\n 'u_mix': crossfade.t,\n 'u_pattern_size_a': (imagePosA: any).displaySize,\n 'u_pattern_size_b': (imagePosB: any).displaySize,\n 'u_scale_a': crossfade.fromScale,\n 'u_scale_b': crossfade.toScale,\n 'u_tile_units_to_pixels': 1 / pixelsToTileUnits(tile, 1, painter.transform.tileZoom),\n // split the pixel coord into two pairs of 16 bit numbers. The glsl spec only guarantees 16 bits of precision.\n 'u_pixel_coord_upper': [pixelX >> 16, pixelY >> 16],\n 'u_pixel_coord_lower': [pixelX & 0xFFFF, pixelY & 0xFFFF]\n };\n}\nexport {bgPatternUniformValues, patternUniformValues};\n","// @flow\n\nimport {patternUniformValues} from './pattern';\nimport {\n Uniform1i,\n Uniform1f,\n Uniform2f,\n Uniform3f,\n UniformMatrix4f\n} from '../uniform_binding';\n\nimport {mat3, vec3} from 'gl-matrix';\nimport {extend} from '../../util/util';\n\nimport type Context from '../../gl/context';\nimport type Painter from '../painter';\nimport type {OverscaledTileID} from '../../source/tile_id';\nimport type {UniformValues, UniformLocations} from '../uniform_binding';\nimport type {CrossfadeParameters} from '../../style/evaluation_parameters';\nimport type Tile from '../../source/tile';\n\nexport type FillExtrusionUniformsType = {|\n 'u_matrix': UniformMatrix4f,\n 'u_lightpos': Uniform3f,\n 'u_lightintensity': Uniform1f,\n 'u_lightcolor': Uniform3f,\n 'u_vertical_gradient': Uniform1f,\n 'u_opacity': Uniform1f\n|};\n\nexport type FillExtrusionPatternUniformsType = {|\n 'u_matrix': UniformMatrix4f,\n 'u_lightpos': Uniform3f,\n 'u_lightintensity': Uniform1f,\n 'u_lightcolor': Uniform3f,\n 'u_height_factor': Uniform1f,\n 'u_vertical_gradient': Uniform1f,\n // pattern uniforms:\n 'u_texsize': Uniform2f,\n 'u_image': Uniform1i,\n 'u_pixel_coord_upper': Uniform2f,\n 'u_pixel_coord_lower': Uniform2f,\n 'u_scale': Uniform3f,\n 'u_fade': Uniform1f,\n 'u_opacity': Uniform1f\n|};\n\nconst fillExtrusionUniforms = (context: Context, locations: UniformLocations): FillExtrusionUniformsType => ({\n 'u_matrix': new UniformMatrix4f(context, locations.u_matrix),\n 'u_lightpos': new Uniform3f(context, locations.u_lightpos),\n 'u_lightintensity': new Uniform1f(context, locations.u_lightintensity),\n 'u_lightcolor': new Uniform3f(context, locations.u_lightcolor),\n 'u_vertical_gradient': new Uniform1f(context, locations.u_vertical_gradient),\n 'u_opacity': new Uniform1f(context, locations.u_opacity)\n});\n\nconst fillExtrusionPatternUniforms = (context: Context, locations: UniformLocations): FillExtrusionPatternUniformsType => ({\n 'u_matrix': new UniformMatrix4f(context, locations.u_matrix),\n 'u_lightpos': new Uniform3f(context, locations.u_lightpos),\n 'u_lightintensity': new Uniform1f(context, locations.u_lightintensity),\n 'u_lightcolor': new Uniform3f(context, locations.u_lightcolor),\n 'u_vertical_gradient': new Uniform1f(context, locations.u_vertical_gradient),\n 'u_height_factor': new Uniform1f(context, locations.u_height_factor),\n // pattern uniforms\n 'u_image': new Uniform1i(context, locations.u_image),\n 'u_texsize': new Uniform2f(context, locations.u_texsize),\n 'u_pixel_coord_upper': new Uniform2f(context, locations.u_pixel_coord_upper),\n 'u_pixel_coord_lower': new Uniform2f(context, locations.u_pixel_coord_lower),\n 'u_scale': new Uniform3f(context, locations.u_scale),\n 'u_fade': new Uniform1f(context, locations.u_fade),\n 'u_opacity': new Uniform1f(context, locations.u_opacity)\n});\n\nconst fillExtrusionUniformValues = (\n matrix: Float32Array,\n painter: Painter,\n shouldUseVerticalGradient: boolean,\n opacity: number\n): UniformValues => {\n const light = painter.style.light;\n const _lp = light.properties.get('position');\n const lightPos = [_lp.x, _lp.y, _lp.z];\n const lightMat = mat3.create();\n if (light.properties.get('anchor') === 'viewport') {\n mat3.fromRotation(lightMat, -painter.transform.angle);\n }\n vec3.transformMat3(lightPos, lightPos, lightMat);\n\n const lightColor = light.properties.get('color');\n\n return {\n 'u_matrix': matrix,\n 'u_lightpos': lightPos,\n 'u_lightintensity': light.properties.get('intensity'),\n 'u_lightcolor': [lightColor.r, lightColor.g, lightColor.b],\n 'u_vertical_gradient': +shouldUseVerticalGradient,\n 'u_opacity': opacity\n };\n};\n\nconst fillExtrusionPatternUniformValues = (\n matrix: Float32Array,\n painter: Painter,\n shouldUseVerticalGradient: boolean,\n opacity: number,\n coord: OverscaledTileID,\n crossfade: CrossfadeParameters,\n tile: Tile\n): UniformValues => {\n return extend(fillExtrusionUniformValues(matrix, painter, shouldUseVerticalGradient, opacity),\n patternUniformValues(crossfade, painter, tile),\n {\n 'u_height_factor': -Math.pow(2, coord.overscaledZ) / tile.tileSize / 8\n });\n};\n\nexport {\n fillExtrusionUniforms,\n fillExtrusionPatternUniforms,\n fillExtrusionUniformValues,\n fillExtrusionPatternUniformValues\n};\n","// @flow\n\nimport {patternUniformValues} from './pattern';\nimport {\n Uniform1i,\n Uniform1f,\n Uniform2f,\n Uniform3f,\n UniformMatrix4f\n} from '../uniform_binding';\nimport {extend} from '../../util/util';\n\nimport type Painter from '../painter';\nimport type {UniformValues, UniformLocations} from '../uniform_binding';\nimport type Context from '../../gl/context';\nimport type {CrossfadeParameters} from '../../style/evaluation_parameters';\nimport type Tile from '../../source/tile';\n\nexport type FillUniformsType = {|\n 'u_matrix': UniformMatrix4f\n|};\n\nexport type FillOutlineUniformsType = {|\n 'u_matrix': UniformMatrix4f,\n 'u_world': Uniform2f\n|};\n\nexport type FillPatternUniformsType = {|\n 'u_matrix': UniformMatrix4f,\n // pattern uniforms:\n 'u_texsize': Uniform2f,\n 'u_image': Uniform1i,\n 'u_pixel_coord_upper': Uniform2f,\n 'u_pixel_coord_lower': Uniform2f,\n 'u_scale': Uniform3f,\n 'u_fade': Uniform1f\n|};\n\nexport type FillOutlinePatternUniformsType = {|\n 'u_matrix': UniformMatrix4f,\n 'u_world': Uniform2f,\n // pattern uniforms:\n 'u_texsize': Uniform2f,\n 'u_image': Uniform1i,\n 'u_pixel_coord_upper': Uniform2f,\n 'u_pixel_coord_lower': Uniform2f,\n 'u_scale': Uniform3f,\n 'u_fade': Uniform1f\n|};\n\nconst fillUniforms = (context: Context, locations: UniformLocations): FillUniformsType => ({\n 'u_matrix': new UniformMatrix4f(context, locations.u_matrix)\n});\n\nconst fillPatternUniforms = (context: Context, locations: UniformLocations): FillPatternUniformsType => ({\n 'u_matrix': new UniformMatrix4f(context, locations.u_matrix),\n 'u_image': new Uniform1i(context, locations.u_image),\n 'u_texsize': new Uniform2f(context, locations.u_texsize),\n 'u_pixel_coord_upper': new Uniform2f(context, locations.u_pixel_coord_upper),\n 'u_pixel_coord_lower': new Uniform2f(context, locations.u_pixel_coord_lower),\n 'u_scale': new Uniform3f(context, locations.u_scale),\n 'u_fade': new Uniform1f(context, locations.u_fade)\n\n});\n\nconst fillOutlineUniforms = (context: Context, locations: UniformLocations): FillOutlineUniformsType => ({\n 'u_matrix': new UniformMatrix4f(context, locations.u_matrix),\n 'u_world': new Uniform2f(context, locations.u_world)\n});\n\nconst fillOutlinePatternUniforms = (context: Context, locations: UniformLocations): FillOutlinePatternUniformsType => ({\n 'u_matrix': new UniformMatrix4f(context, locations.u_matrix),\n 'u_world': new Uniform2f(context, locations.u_world),\n 'u_image': new Uniform1i(context, locations.u_image),\n 'u_texsize': new Uniform2f(context, locations.u_texsize),\n 'u_pixel_coord_upper': new Uniform2f(context, locations.u_pixel_coord_upper),\n 'u_pixel_coord_lower': new Uniform2f(context, locations.u_pixel_coord_lower),\n 'u_scale': new Uniform3f(context, locations.u_scale),\n 'u_fade': new Uniform1f(context, locations.u_fade)\n});\n\nconst fillUniformValues = (matrix: Float32Array): UniformValues => ({\n 'u_matrix': matrix\n});\n\nconst fillPatternUniformValues = (\n matrix: Float32Array,\n painter: Painter,\n crossfade: CrossfadeParameters,\n tile: Tile\n): UniformValues => extend(\n fillUniformValues(matrix),\n patternUniformValues(crossfade, painter, tile)\n);\n\nconst fillOutlineUniformValues = (\n matrix: Float32Array,\n drawingBufferSize: [number, number]\n): UniformValues => ({\n 'u_matrix': matrix,\n 'u_world': drawingBufferSize\n});\n\nconst fillOutlinePatternUniformValues = (\n matrix: Float32Array,\n painter: Painter,\n crossfade: CrossfadeParameters,\n tile: Tile,\n drawingBufferSize: [number, number]\n): UniformValues => extend(\n fillPatternUniformValues(matrix, painter, crossfade, tile),\n {\n 'u_world': drawingBufferSize\n }\n);\n\nexport {\n fillUniforms,\n fillPatternUniforms,\n fillOutlineUniforms,\n fillOutlinePatternUniforms,\n fillUniformValues,\n fillPatternUniformValues,\n fillOutlineUniformValues,\n fillOutlinePatternUniformValues\n};\n","// @flow\n\nimport {\n Uniform1i,\n Uniform1f,\n Uniform2f,\n UniformMatrix4f\n} from '../uniform_binding';\nimport pixelsToTileUnits from '../../source/pixels_to_tile_units';\n\nimport type Context from '../../gl/context';\nimport type {UniformValues, UniformLocations} from '../uniform_binding';\nimport type {OverscaledTileID} from '../../source/tile_id';\nimport type Tile from '../../source/tile';\nimport type CircleStyleLayer from '../../style/style_layer/circle_style_layer';\nimport type Painter from '../painter';\nimport browser from '../../util/browser';\n\nexport type CircleUniformsType = {|\n 'u_camera_to_center_distance': Uniform1f,\n 'u_scale_with_map': Uniform1i,\n 'u_pitch_with_map': Uniform1i,\n 'u_extrude_scale': Uniform2f,\n 'u_device_pixel_ratio': Uniform1f,\n 'u_matrix': UniformMatrix4f\n|};\n\nconst circleUniforms = (context: Context, locations: UniformLocations): CircleUniformsType => ({\n 'u_camera_to_center_distance': new Uniform1f(context, locations.u_camera_to_center_distance),\n 'u_scale_with_map': new Uniform1i(context, locations.u_scale_with_map),\n 'u_pitch_with_map': new Uniform1i(context, locations.u_pitch_with_map),\n 'u_extrude_scale': new Uniform2f(context, locations.u_extrude_scale),\n 'u_device_pixel_ratio': new Uniform1f(context, locations.u_device_pixel_ratio),\n 'u_matrix': new UniformMatrix4f(context, locations.u_matrix)\n});\n\nconst circleUniformValues = (\n painter: Painter,\n coord: OverscaledTileID,\n tile: Tile,\n layer: CircleStyleLayer\n): UniformValues => {\n const transform = painter.transform;\n\n let pitchWithMap: boolean, extrudeScale: [number, number];\n if (layer.paint.get('circle-pitch-alignment') === 'map') {\n const pixelRatio = pixelsToTileUnits(tile, 1, transform.zoom);\n pitchWithMap = true;\n extrudeScale = [pixelRatio, pixelRatio];\n } else {\n pitchWithMap = false;\n extrudeScale = transform.pixelsToGLUnits;\n }\n\n return {\n 'u_camera_to_center_distance': transform.cameraToCenterDistance,\n 'u_scale_with_map': +(layer.paint.get('circle-pitch-scale') === 'map'),\n 'u_matrix': painter.translatePosMatrix(\n coord.posMatrix,\n tile,\n layer.paint.get('circle-translate'),\n layer.paint.get('circle-translate-anchor')),\n 'u_pitch_with_map': +(pitchWithMap),\n 'u_device_pixel_ratio': browser.devicePixelRatio,\n 'u_extrude_scale': extrudeScale\n };\n};\n\nexport {circleUniforms, circleUniformValues};\n","// @flow\n\nimport {\n Uniform1f,\n Uniform2f,\n UniformMatrix4f\n} from '../uniform_binding';\nimport pixelsToTileUnits from '../../source/pixels_to_tile_units';\n\nimport type Context from '../../gl/context';\nimport type {UniformValues, UniformLocations} from '../uniform_binding';\nimport type Transform from '../../geo/transform';\nimport type Tile from '../../source/tile';\n\nexport type CollisionUniformsType = {|\n 'u_matrix': UniformMatrix4f,\n 'u_camera_to_center_distance': Uniform1f,\n 'u_pixels_to_tile_units': Uniform1f,\n 'u_extrude_scale': Uniform2f,\n 'u_overscale_factor': Uniform1f\n|};\n\nexport type CollisionCircleUniformsType = {|\n 'u_matrix': UniformMatrix4f,\n 'u_inv_matrix': UniformMatrix4f,\n 'u_camera_to_center_distance': Uniform1f,\n 'u_viewport_size': Uniform2f\n|};\n\nconst collisionUniforms = (context: Context, locations: UniformLocations): CollisionUniformsType => ({\n 'u_matrix': new UniformMatrix4f(context, locations.u_matrix),\n 'u_camera_to_center_distance': new Uniform1f(context, locations.u_camera_to_center_distance),\n 'u_pixels_to_tile_units': new Uniform1f(context, locations.u_pixels_to_tile_units),\n 'u_extrude_scale': new Uniform2f(context, locations.u_extrude_scale),\n 'u_overscale_factor': new Uniform1f(context, locations.u_overscale_factor)\n});\n\nconst collisionCircleUniforms = (context: Context, locations: UniformLocations): CollisionCircleUniformsType => ({\n 'u_matrix': new UniformMatrix4f(context, locations.u_matrix),\n 'u_inv_matrix': new UniformMatrix4f(context, locations.u_inv_matrix),\n 'u_camera_to_center_distance': new Uniform1f(context, locations.u_camera_to_center_distance),\n 'u_viewport_size': new Uniform2f(context, locations.u_viewport_size)\n});\n\nconst collisionUniformValues = (\n matrix: Float32Array,\n transform: Transform,\n tile: Tile\n): UniformValues => {\n const pixelRatio = pixelsToTileUnits(tile, 1, transform.zoom);\n const scale = Math.pow(2, transform.zoom - tile.tileID.overscaledZ);\n const overscaleFactor = tile.tileID.overscaleFactor();\n return {\n 'u_matrix': matrix,\n 'u_camera_to_center_distance': transform.cameraToCenterDistance,\n 'u_pixels_to_tile_units': pixelRatio,\n 'u_extrude_scale': [transform.pixelsToGLUnits[0] / (pixelRatio * scale),\n transform.pixelsToGLUnits[1] / (pixelRatio * scale)],\n 'u_overscale_factor': overscaleFactor\n };\n};\n\nconst collisionCircleUniformValues = (\n matrix: Float32Array,\n invMatrix: Float32Array,\n transform: Transform\n): UniformValues => {\n return {\n 'u_matrix': matrix,\n 'u_inv_matrix': invMatrix,\n 'u_camera_to_center_distance': transform.cameraToCenterDistance,\n 'u_viewport_size': [transform.width, transform.height]\n };\n};\n\nexport {collisionUniforms, collisionUniformValues, collisionCircleUniforms, collisionCircleUniformValues};\n","// @flow\n\nimport {\n UniformColor,\n UniformMatrix4f,\n Uniform1i,\n Uniform1f\n} from '../uniform_binding';\n\nimport type Context from '../../gl/context';\nimport type {UniformValues, UniformLocations} from '../uniform_binding';\nimport type Color from '../../style-spec/util/color';\n\nexport type DebugUniformsType = {|\n 'u_color': UniformColor,\n 'u_matrix': UniformMatrix4f,\n 'u_overlay': Uniform1i,\n 'u_overlay_scale': Uniform1f\n|};\n\nconst debugUniforms = (context: Context, locations: UniformLocations): DebugUniformsType => ({\n 'u_color': new UniformColor(context, locations.u_color),\n 'u_matrix': new UniformMatrix4f(context, locations.u_matrix),\n 'u_overlay': new Uniform1i(context, locations.u_overlay),\n 'u_overlay_scale': new Uniform1f(context, locations.u_overlay_scale),\n});\n\nconst debugUniformValues = (matrix: Float32Array, color: Color, scaleRatio: number = 1): UniformValues => ({\n 'u_matrix': matrix,\n 'u_color': color,\n 'u_overlay': 0,\n 'u_overlay_scale': scaleRatio\n});\n\nexport {debugUniforms, debugUniformValues};\n","// @flow\n\nimport {UniformMatrix4f} from '../uniform_binding';\n\nimport type Context from '../../gl/context';\nimport type {UniformValues, UniformLocations} from '../uniform_binding';\n\nexport type ClippingMaskUniformsType = {|\n 'u_matrix': UniformMatrix4f\n|};\n\nconst clippingMaskUniforms = (context: Context, locations: UniformLocations): ClippingMaskUniformsType => ({\n 'u_matrix': new UniformMatrix4f(context, locations.u_matrix)\n});\n\nconst clippingMaskUniformValues = (matrix: Float32Array): UniformValues => ({\n 'u_matrix': matrix\n});\n\nexport {clippingMaskUniforms, clippingMaskUniformValues};\n","// @flow\n\nimport {mat4} from 'gl-matrix';\n\nimport {\n Uniform1i,\n Uniform1f,\n Uniform2f,\n UniformMatrix4f\n} from '../uniform_binding';\nimport pixelsToTileUnits from '../../source/pixels_to_tile_units';\n\nimport type Context from '../../gl/context';\nimport type Tile from '../../source/tile';\nimport type {UniformValues, UniformLocations} from '../uniform_binding';\nimport type Painter from '../painter';\nimport type HeatmapStyleLayer from '../../style/style_layer/heatmap_style_layer';\n\nexport type HeatmapUniformsType = {|\n 'u_extrude_scale': Uniform1f,\n 'u_intensity': Uniform1f,\n 'u_matrix': UniformMatrix4f\n|};\n\nexport type HeatmapTextureUniformsType = {|\n 'u_matrix': UniformMatrix4f,\n 'u_world': Uniform2f,\n 'u_image': Uniform1i,\n 'u_color_ramp': Uniform1i,\n 'u_opacity': Uniform1f\n|};\n\nconst heatmapUniforms = (context: Context, locations: UniformLocations): HeatmapUniformsType => ({\n 'u_extrude_scale': new Uniform1f(context, locations.u_extrude_scale),\n 'u_intensity': new Uniform1f(context, locations.u_intensity),\n 'u_matrix': new UniformMatrix4f(context, locations.u_matrix)\n});\n\nconst heatmapTextureUniforms = (context: Context, locations: UniformLocations): HeatmapTextureUniformsType => ({\n 'u_matrix': new UniformMatrix4f(context, locations.u_matrix),\n 'u_world': new Uniform2f(context, locations.u_world),\n 'u_image': new Uniform1i(context, locations.u_image),\n 'u_color_ramp': new Uniform1i(context, locations.u_color_ramp),\n 'u_opacity': new Uniform1f(context, locations.u_opacity)\n});\n\nconst heatmapUniformValues = (\n matrix: Float32Array,\n tile: Tile,\n zoom: number,\n intensity: number\n): UniformValues => ({\n 'u_matrix': matrix,\n 'u_extrude_scale': pixelsToTileUnits(tile, 1, zoom),\n 'u_intensity': intensity\n});\n\nconst heatmapTextureUniformValues = (\n painter: Painter,\n layer: HeatmapStyleLayer,\n textureUnit: number,\n colorRampUnit: number\n): UniformValues => {\n const matrix = mat4.create();\n mat4.ortho(matrix, 0, painter.width, painter.height, 0, 0, 1);\n\n const gl = painter.context.gl;\n\n return {\n 'u_matrix': matrix,\n 'u_world': [gl.drawingBufferWidth, gl.drawingBufferHeight],\n 'u_image': textureUnit,\n 'u_color_ramp': colorRampUnit,\n 'u_opacity': layer.paint.get('heatmap-opacity')\n };\n};\n\nexport {\n heatmapUniforms,\n heatmapTextureUniforms,\n heatmapUniformValues,\n heatmapTextureUniformValues\n};\n","// @flow\n\nimport {\n Uniform1i,\n Uniform1f,\n Uniform2f,\n Uniform3f,\n UniformMatrix4f\n} from '../uniform_binding';\nimport pixelsToTileUnits from '../../source/pixels_to_tile_units';\nimport {extend} from '../../util/util';\nimport browser from '../../util/browser';\n\nimport type Context from '../../gl/context';\nimport type {UniformValues, UniformLocations} from '../uniform_binding';\nimport type Transform from '../../geo/transform';\nimport type Tile from '../../source/tile';\nimport type {CrossFaded} from '../../style/properties';\nimport type LineStyleLayer from '../../style/style_layer/line_style_layer';\nimport type Painter from '../painter';\nimport type {CrossfadeParameters} from '../../style/evaluation_parameters';\n\nexport type LineUniformsType = {|\n 'u_matrix': UniformMatrix4f,\n 'u_ratio': Uniform1f,\n 'u_device_pixel_ratio': Uniform1f,\n 'u_units_to_pixels': Uniform2f\n|};\n\nexport type LineGradientUniformsType = {|\n 'u_matrix': UniformMatrix4f,\n 'u_ratio': Uniform1f,\n 'u_device_pixel_ratio': Uniform1f,\n 'u_units_to_pixels': Uniform2f,\n 'u_image': Uniform1i,\n 'u_image_height': Uniform1f,\n|};\n\nexport type LinePatternUniformsType = {|\n 'u_matrix': UniformMatrix4f,\n 'u_texsize': Uniform2f,\n 'u_ratio': Uniform1f,\n 'u_device_pixel_ratio': Uniform1f,\n 'u_units_to_pixels': Uniform2f,\n 'u_image': Uniform1i,\n 'u_scale': Uniform3f,\n 'u_fade': Uniform1f\n|};\n\nexport type LineSDFUniformsType = {|\n 'u_matrix': UniformMatrix4f,\n 'u_ratio': Uniform1f,\n 'u_device_pixel_ratio': Uniform1f,\n 'u_units_to_pixels': Uniform2f,\n 'u_patternscale_a': Uniform2f,\n 'u_patternscale_b': Uniform2f,\n 'u_sdfgamma': Uniform1f,\n 'u_image': Uniform1i,\n 'u_tex_y_a': Uniform1f,\n 'u_tex_y_b': Uniform1f,\n 'u_mix': Uniform1f\n|};\n\nconst lineUniforms = (context: Context, locations: UniformLocations): LineUniformsType => ({\n 'u_matrix': new UniformMatrix4f(context, locations.u_matrix),\n 'u_ratio': new Uniform1f(context, locations.u_ratio),\n 'u_device_pixel_ratio': new Uniform1f(context, locations.u_device_pixel_ratio),\n 'u_units_to_pixels': new Uniform2f(context, locations.u_units_to_pixels)\n});\n\nconst lineGradientUniforms = (context: Context, locations: UniformLocations): LineGradientUniformsType => ({\n 'u_matrix': new UniformMatrix4f(context, locations.u_matrix),\n 'u_ratio': new Uniform1f(context, locations.u_ratio),\n 'u_device_pixel_ratio': new Uniform1f(context, locations.u_device_pixel_ratio),\n 'u_units_to_pixels': new Uniform2f(context, locations.u_units_to_pixels),\n 'u_image': new Uniform1i(context, locations.u_image),\n 'u_image_height': new Uniform1f(context, locations.u_image_height),\n});\n\nconst linePatternUniforms = (context: Context, locations: UniformLocations): LinePatternUniformsType => ({\n 'u_matrix': new UniformMatrix4f(context, locations.u_matrix),\n 'u_texsize': new Uniform2f(context, locations.u_texsize),\n 'u_ratio': new Uniform1f(context, locations.u_ratio),\n 'u_device_pixel_ratio': new Uniform1f(context, locations.u_device_pixel_ratio),\n 'u_image': new Uniform1i(context, locations.u_image),\n 'u_units_to_pixels': new Uniform2f(context, locations.u_units_to_pixels),\n 'u_scale': new Uniform3f(context, locations.u_scale),\n 'u_fade': new Uniform1f(context, locations.u_fade)\n});\n\nconst lineSDFUniforms = (context: Context, locations: UniformLocations): LineSDFUniformsType => ({\n 'u_matrix': new UniformMatrix4f(context, locations.u_matrix),\n 'u_ratio': new Uniform1f(context, locations.u_ratio),\n 'u_device_pixel_ratio': new Uniform1f(context, locations.u_device_pixel_ratio),\n 'u_units_to_pixels': new Uniform2f(context, locations.u_units_to_pixels),\n 'u_patternscale_a': new Uniform2f(context, locations.u_patternscale_a),\n 'u_patternscale_b': new Uniform2f(context, locations.u_patternscale_b),\n 'u_sdfgamma': new Uniform1f(context, locations.u_sdfgamma),\n 'u_image': new Uniform1i(context, locations.u_image),\n 'u_tex_y_a': new Uniform1f(context, locations.u_tex_y_a),\n 'u_tex_y_b': new Uniform1f(context, locations.u_tex_y_b),\n 'u_mix': new Uniform1f(context, locations.u_mix)\n});\n\nconst lineUniformValues = (\n painter: Painter,\n tile: Tile,\n layer: LineStyleLayer\n): UniformValues => {\n const transform = painter.transform;\n\n return {\n 'u_matrix': calculateMatrix(painter, tile, layer),\n 'u_ratio': 1 / pixelsToTileUnits(tile, 1, transform.zoom),\n 'u_device_pixel_ratio': browser.devicePixelRatio,\n 'u_units_to_pixels': [\n 1 / transform.pixelsToGLUnits[0],\n 1 / transform.pixelsToGLUnits[1]\n ]\n };\n};\n\nconst lineGradientUniformValues = (\n painter: Painter,\n tile: Tile,\n layer: LineStyleLayer,\n imageHeight: number\n): UniformValues => {\n return extend(lineUniformValues(painter, tile, layer), {\n 'u_image': 0,\n 'u_image_height': imageHeight,\n });\n};\n\nconst linePatternUniformValues = (\n painter: Painter,\n tile: Tile,\n layer: LineStyleLayer,\n crossfade: CrossfadeParameters\n): UniformValues => {\n const transform = painter.transform;\n const tileZoomRatio = calculateTileRatio(tile, transform);\n return {\n 'u_matrix': calculateMatrix(painter, tile, layer),\n 'u_texsize': tile.imageAtlasTexture.size,\n // camera zoom ratio\n 'u_ratio': 1 / pixelsToTileUnits(tile, 1, transform.zoom),\n 'u_device_pixel_ratio': browser.devicePixelRatio,\n 'u_image': 0,\n 'u_scale': [tileZoomRatio, crossfade.fromScale, crossfade.toScale],\n 'u_fade': crossfade.t,\n 'u_units_to_pixels': [\n 1 / transform.pixelsToGLUnits[0],\n 1 / transform.pixelsToGLUnits[1]\n ]\n };\n};\n\nconst lineSDFUniformValues = (\n painter: Painter,\n tile: Tile,\n layer: LineStyleLayer,\n dasharray: CrossFaded>,\n crossfade: CrossfadeParameters\n): UniformValues => {\n const transform = painter.transform;\n const lineAtlas = painter.lineAtlas;\n const tileRatio = calculateTileRatio(tile, transform);\n\n const round = layer.layout.get('line-cap') === 'round';\n\n const posA = lineAtlas.getDash(dasharray.from, round);\n const posB = lineAtlas.getDash(dasharray.to, round);\n\n const widthA = posA.width * crossfade.fromScale;\n const widthB = posB.width * crossfade.toScale;\n\n return extend(lineUniformValues(painter, tile, layer), {\n 'u_patternscale_a': [tileRatio / widthA, -posA.height / 2],\n 'u_patternscale_b': [tileRatio / widthB, -posB.height / 2],\n 'u_sdfgamma': lineAtlas.width / (Math.min(widthA, widthB) * 256 * browser.devicePixelRatio) / 2,\n 'u_image': 0,\n 'u_tex_y_a': posA.y,\n 'u_tex_y_b': posB.y,\n 'u_mix': crossfade.t\n });\n};\n\nfunction calculateTileRatio(tile: Tile, transform: Transform) {\n return 1 / pixelsToTileUnits(tile, 1, transform.tileZoom);\n}\n\nfunction calculateMatrix(painter, tile, layer) {\n return painter.translatePosMatrix(\n tile.tileID.posMatrix,\n tile,\n layer.paint.get('line-translate'),\n layer.paint.get('line-translate-anchor')\n );\n}\n\nexport {\n lineUniforms,\n lineGradientUniforms,\n linePatternUniforms,\n lineSDFUniforms,\n lineUniformValues,\n lineGradientUniformValues,\n linePatternUniformValues,\n lineSDFUniformValues\n};\n","// @flow\n\nimport {\n Uniform1i,\n Uniform1f,\n Uniform2f,\n Uniform3f,\n UniformMatrix4f\n} from '../uniform_binding';\n\nimport type Context from '../../gl/context';\nimport type {UniformValues, UniformLocations} from '../uniform_binding';\nimport type RasterStyleLayer from '../../style/style_layer/raster_style_layer';\n\nexport type RasterUniformsType = {|\n 'u_matrix': UniformMatrix4f,\n 'u_tl_parent': Uniform2f,\n 'u_scale_parent': Uniform1f,\n 'u_buffer_scale': Uniform1f,\n 'u_fade_t': Uniform1f,\n 'u_opacity': Uniform1f,\n 'u_image0': Uniform1i,\n 'u_image1': Uniform1i,\n 'u_brightness_low': Uniform1f,\n 'u_brightness_high': Uniform1f,\n 'u_saturation_factor': Uniform1f,\n 'u_contrast_factor': Uniform1f,\n 'u_spin_weights': Uniform3f\n|};\n\nconst rasterUniforms = (context: Context, locations: UniformLocations): RasterUniformsType => ({\n 'u_matrix': new UniformMatrix4f(context, locations.u_matrix),\n 'u_tl_parent': new Uniform2f(context, locations.u_tl_parent),\n 'u_scale_parent': new Uniform1f(context, locations.u_scale_parent),\n 'u_buffer_scale': new Uniform1f(context, locations.u_buffer_scale),\n 'u_fade_t': new Uniform1f(context, locations.u_fade_t),\n 'u_opacity': new Uniform1f(context, locations.u_opacity),\n 'u_image0': new Uniform1i(context, locations.u_image0),\n 'u_image1': new Uniform1i(context, locations.u_image1),\n 'u_brightness_low': new Uniform1f(context, locations.u_brightness_low),\n 'u_brightness_high': new Uniform1f(context, locations.u_brightness_high),\n 'u_saturation_factor': new Uniform1f(context, locations.u_saturation_factor),\n 'u_contrast_factor': new Uniform1f(context, locations.u_contrast_factor),\n 'u_spin_weights': new Uniform3f(context, locations.u_spin_weights)\n});\n\nconst rasterUniformValues = (\n matrix: Float32Array,\n parentTL: [number, number],\n parentScaleBy: number,\n fade: {mix: number, opacity: number},\n layer: RasterStyleLayer\n): UniformValues => ({\n 'u_matrix': matrix,\n 'u_tl_parent': parentTL,\n 'u_scale_parent': parentScaleBy,\n 'u_buffer_scale': 1,\n 'u_fade_t': fade.mix,\n 'u_opacity': fade.opacity * layer.paint.get('raster-opacity'),\n 'u_image0': 0,\n 'u_image1': 1,\n 'u_brightness_low': layer.paint.get('raster-brightness-min'),\n 'u_brightness_high': layer.paint.get('raster-brightness-max'),\n 'u_saturation_factor': saturationFactor(layer.paint.get('raster-saturation')),\n 'u_contrast_factor': contrastFactor(layer.paint.get('raster-contrast')),\n 'u_spin_weights': spinWeights(layer.paint.get('raster-hue-rotate'))\n});\n\nfunction spinWeights(angle) {\n angle *= Math.PI / 180;\n const s = Math.sin(angle);\n const c = Math.cos(angle);\n return [\n (2 * c + 1) / 3,\n (-Math.sqrt(3) * s - c + 1) / 3,\n (Math.sqrt(3) * s - c + 1) / 3\n ];\n}\n\nfunction contrastFactor(contrast) {\n return contrast > 0 ?\n 1 / (1 - contrast) :\n 1 + contrast;\n}\n\nfunction saturationFactor(saturation) {\n return saturation > 0 ?\n 1 - 1 / (1.001 - saturation) :\n -saturation;\n}\n\nexport {rasterUniforms, rasterUniformValues};\n","// @flow\n\nimport {\n Uniform1i,\n Uniform1f,\n Uniform2f,\n UniformMatrix4f\n} from '../uniform_binding';\nimport {extend} from '../../util/util';\nimport browser from '../../util/browser';\n\nimport type Context from '../../gl/context';\nimport type Painter from '../painter';\nimport type {UniformValues, UniformLocations} from '../uniform_binding';\n\nexport type SymbolIconUniformsType = {|\n 'u_is_size_zoom_constant': Uniform1i,\n 'u_is_size_feature_constant': Uniform1i,\n 'u_size_t': Uniform1f,\n 'u_size': Uniform1f,\n 'u_camera_to_center_distance': Uniform1f,\n 'u_pitch': Uniform1f,\n 'u_rotate_symbol': Uniform1i,\n 'u_aspect_ratio': Uniform1f,\n 'u_fade_change': Uniform1f,\n 'u_matrix': UniformMatrix4f,\n 'u_label_plane_matrix': UniformMatrix4f,\n 'u_coord_matrix': UniformMatrix4f,\n 'u_is_text': Uniform1i,\n 'u_pitch_with_map': Uniform1i,\n 'u_texsize': Uniform2f,\n 'u_texture': Uniform1i\n|};\n\nexport type SymbolSDFUniformsType = {|\n 'u_is_size_zoom_constant': Uniform1i,\n 'u_is_size_feature_constant': Uniform1i,\n 'u_size_t': Uniform1f,\n 'u_size': Uniform1f,\n 'u_camera_to_center_distance': Uniform1f,\n 'u_pitch': Uniform1f,\n 'u_rotate_symbol': Uniform1i,\n 'u_aspect_ratio': Uniform1f,\n 'u_fade_change': Uniform1f,\n 'u_matrix': UniformMatrix4f,\n 'u_label_plane_matrix': UniformMatrix4f,\n 'u_coord_matrix': UniformMatrix4f,\n 'u_is_text': Uniform1i,\n 'u_pitch_with_map': Uniform1i,\n 'u_texsize': Uniform2f,\n 'u_texture': Uniform1i,\n 'u_gamma_scale': Uniform1f,\n 'u_device_pixel_ratio': Uniform1f,\n 'u_is_halo': Uniform1i\n|};\n\nexport type symbolTextAndIconUniformsType = {|\n 'u_is_size_zoom_constant': Uniform1i,\n 'u_is_size_feature_constant': Uniform1i,\n 'u_size_t': Uniform1f,\n 'u_size': Uniform1f,\n 'u_camera_to_center_distance': Uniform1f,\n 'u_pitch': Uniform1f,\n 'u_rotate_symbol': Uniform1i,\n 'u_aspect_ratio': Uniform1f,\n 'u_fade_change': Uniform1f,\n 'u_matrix': UniformMatrix4f,\n 'u_label_plane_matrix': UniformMatrix4f,\n 'u_coord_matrix': UniformMatrix4f,\n 'u_is_text': Uniform1i,\n 'u_pitch_with_map': Uniform1i,\n 'u_texsize': Uniform2f,\n 'u_texsize_icon': Uniform2f,\n 'u_texture': Uniform1i,\n 'u_texture_icon': Uniform1i,\n 'u_gamma_scale': Uniform1f,\n 'u_device_pixel_ratio': Uniform1f,\n 'u_is_halo': Uniform1i\n|};\n\nconst symbolIconUniforms = (context: Context, locations: UniformLocations): SymbolIconUniformsType => ({\n 'u_is_size_zoom_constant': new Uniform1i(context, locations.u_is_size_zoom_constant),\n 'u_is_size_feature_constant': new Uniform1i(context, locations.u_is_size_feature_constant),\n 'u_size_t': new Uniform1f(context, locations.u_size_t),\n 'u_size': new Uniform1f(context, locations.u_size),\n 'u_camera_to_center_distance': new Uniform1f(context, locations.u_camera_to_center_distance),\n 'u_pitch': new Uniform1f(context, locations.u_pitch),\n 'u_rotate_symbol': new Uniform1i(context, locations.u_rotate_symbol),\n 'u_aspect_ratio': new Uniform1f(context, locations.u_aspect_ratio),\n 'u_fade_change': new Uniform1f(context, locations.u_fade_change),\n 'u_matrix': new UniformMatrix4f(context, locations.u_matrix),\n 'u_label_plane_matrix': new UniformMatrix4f(context, locations.u_label_plane_matrix),\n 'u_coord_matrix': new UniformMatrix4f(context, locations.u_coord_matrix),\n 'u_is_text': new Uniform1i(context, locations.u_is_text),\n 'u_pitch_with_map': new Uniform1i(context, locations.u_pitch_with_map),\n 'u_texsize': new Uniform2f(context, locations.u_texsize),\n 'u_texture': new Uniform1i(context, locations.u_texture)\n});\n\nconst symbolSDFUniforms = (context: Context, locations: UniformLocations): SymbolSDFUniformsType => ({\n 'u_is_size_zoom_constant': new Uniform1i(context, locations.u_is_size_zoom_constant),\n 'u_is_size_feature_constant': new Uniform1i(context, locations.u_is_size_feature_constant),\n 'u_size_t': new Uniform1f(context, locations.u_size_t),\n 'u_size': new Uniform1f(context, locations.u_size),\n 'u_camera_to_center_distance': new Uniform1f(context, locations.u_camera_to_center_distance),\n 'u_pitch': new Uniform1f(context, locations.u_pitch),\n 'u_rotate_symbol': new Uniform1i(context, locations.u_rotate_symbol),\n 'u_aspect_ratio': new Uniform1f(context, locations.u_aspect_ratio),\n 'u_fade_change': new Uniform1f(context, locations.u_fade_change),\n 'u_matrix': new UniformMatrix4f(context, locations.u_matrix),\n 'u_label_plane_matrix': new UniformMatrix4f(context, locations.u_label_plane_matrix),\n 'u_coord_matrix': new UniformMatrix4f(context, locations.u_coord_matrix),\n 'u_is_text': new Uniform1i(context, locations.u_is_text),\n 'u_pitch_with_map': new Uniform1i(context, locations.u_pitch_with_map),\n 'u_texsize': new Uniform2f(context, locations.u_texsize),\n 'u_texture': new Uniform1i(context, locations.u_texture),\n 'u_gamma_scale': new Uniform1f(context, locations.u_gamma_scale),\n 'u_device_pixel_ratio': new Uniform1f(context, locations.u_device_pixel_ratio),\n 'u_is_halo': new Uniform1i(context, locations.u_is_halo)\n});\n\nconst symbolTextAndIconUniforms = (context: Context, locations: UniformLocations): symbolTextAndIconUniformsType => ({\n 'u_is_size_zoom_constant': new Uniform1i(context, locations.u_is_size_zoom_constant),\n 'u_is_size_feature_constant': new Uniform1i(context, locations.u_is_size_feature_constant),\n 'u_size_t': new Uniform1f(context, locations.u_size_t),\n 'u_size': new Uniform1f(context, locations.u_size),\n 'u_camera_to_center_distance': new Uniform1f(context, locations.u_camera_to_center_distance),\n 'u_pitch': new Uniform1f(context, locations.u_pitch),\n 'u_rotate_symbol': new Uniform1i(context, locations.u_rotate_symbol),\n 'u_aspect_ratio': new Uniform1f(context, locations.u_aspect_ratio),\n 'u_fade_change': new Uniform1f(context, locations.u_fade_change),\n 'u_matrix': new UniformMatrix4f(context, locations.u_matrix),\n 'u_label_plane_matrix': new UniformMatrix4f(context, locations.u_label_plane_matrix),\n 'u_coord_matrix': new UniformMatrix4f(context, locations.u_coord_matrix),\n 'u_is_text': new Uniform1i(context, locations.u_is_text),\n 'u_pitch_with_map': new Uniform1i(context, locations.u_pitch_with_map),\n 'u_texsize': new Uniform2f(context, locations.u_texsize),\n 'u_texsize_icon': new Uniform2f(context, locations.u_texsize_icon),\n 'u_texture': new Uniform1i(context, locations.u_texture),\n 'u_texture_icon': new Uniform1i(context, locations.u_texture_icon),\n 'u_gamma_scale': new Uniform1f(context, locations.u_gamma_scale),\n 'u_device_pixel_ratio': new Uniform1f(context, locations.u_device_pixel_ratio),\n 'u_is_halo': new Uniform1i(context, locations.u_is_halo)\n});\n\nconst symbolIconUniformValues = (\n functionType: string,\n size: ?{uSizeT: number, uSize: number},\n rotateInShader: boolean,\n pitchWithMap: boolean,\n painter: Painter,\n matrix: Float32Array,\n labelPlaneMatrix: Float32Array,\n glCoordMatrix: Float32Array,\n isText: boolean,\n texSize: [number, number]\n): UniformValues => {\n const transform = painter.transform;\n\n return {\n 'u_is_size_zoom_constant': +(functionType === 'constant' || functionType === 'source'),\n 'u_is_size_feature_constant': +(functionType === 'constant' || functionType === 'camera'),\n 'u_size_t': size ? size.uSizeT : 0,\n 'u_size': size ? size.uSize : 0,\n 'u_camera_to_center_distance': transform.cameraToCenterDistance,\n 'u_pitch': transform.pitch / 360 * 2 * Math.PI,\n 'u_rotate_symbol': +rotateInShader,\n 'u_aspect_ratio': transform.width / transform.height,\n 'u_fade_change': painter.options.fadeDuration ? painter.symbolFadeChange : 1,\n 'u_matrix': matrix,\n 'u_label_plane_matrix': labelPlaneMatrix,\n 'u_coord_matrix': glCoordMatrix,\n 'u_is_text': +isText,\n 'u_pitch_with_map': +pitchWithMap,\n 'u_texsize': texSize,\n 'u_texture': 0\n };\n};\n\nconst symbolSDFUniformValues = (\n functionType: string,\n size: ?{uSizeT: number, uSize: number},\n rotateInShader: boolean,\n pitchWithMap: boolean,\n painter: Painter,\n matrix: Float32Array,\n labelPlaneMatrix: Float32Array,\n glCoordMatrix: Float32Array,\n isText: boolean,\n texSize: [number, number],\n isHalo: boolean\n): UniformValues => {\n const transform = painter.transform;\n\n return extend(symbolIconUniformValues(functionType, size,\n rotateInShader, pitchWithMap, painter, matrix, labelPlaneMatrix,\n glCoordMatrix, isText, texSize), {\n 'u_gamma_scale': (pitchWithMap ? Math.cos(transform._pitch) * transform.cameraToCenterDistance : 1),\n 'u_device_pixel_ratio': browser.devicePixelRatio,\n 'u_is_halo': +isHalo\n });\n};\n\nconst symbolTextAndIconUniformValues = (\n functionType: string,\n size: ?{uSizeT: number, uSize: number},\n rotateInShader: boolean,\n pitchWithMap: boolean,\n painter: Painter,\n matrix: Float32Array,\n labelPlaneMatrix: Float32Array,\n glCoordMatrix: Float32Array,\n texSizeSDF: [number, number],\n texSizeIcon: [number, number]\n): UniformValues => {\n return extend(symbolSDFUniformValues(functionType, size,\n rotateInShader, pitchWithMap, painter, matrix, labelPlaneMatrix,\n glCoordMatrix, true, texSizeSDF, true), {\n 'u_texsize_icon': texSizeIcon,\n 'u_texture_icon': 1\n });\n};\n\nexport {symbolIconUniforms, symbolSDFUniforms, symbolIconUniformValues, symbolSDFUniformValues, symbolTextAndIconUniformValues, symbolTextAndIconUniforms};\n","// @flow\n\nimport type Painter from './painter';\nimport type SourceCache from '../source/source_cache';\nimport type StyleLayer from '../style/style_layer';\nimport type {OverscaledTileID} from '../source/tile_id';\nimport type SymbolBucket from '../data/bucket/symbol_bucket';\nimport DepthMode from '../gl/depth_mode';\nimport StencilMode from '../gl/stencil_mode';\nimport CullFaceMode from '../gl/cull_face_mode';\nimport {collisionUniformValues, collisionCircleUniformValues} from './program/collision_program';\n\nimport {QuadTriangleArray, CollisionCircleLayoutArray} from '../data/array_types';\nimport {collisionCircleLayout} from '../data/bucket/symbol_attributes';\nimport SegmentVector from '../data/segment';\nimport {mat4} from 'gl-matrix';\nimport VertexBuffer from '../gl/vertex_buffer';\nimport IndexBuffer from '../gl/index_buffer';\n\nexport default drawCollisionDebug;\n\ntype TileBatch = {\n circleArray: Array,\n circleOffset: number,\n transform: mat4,\n invTransform: mat4\n};\n\nlet quadTriangles: ?QuadTriangleArray;\n\nfunction drawCollisionDebug(painter: Painter, sourceCache: SourceCache, layer: StyleLayer, coords: Array, translate: [number, number], translateAnchor: 'map' | 'viewport', isText: boolean) {\n const context = painter.context;\n const gl = context.gl;\n const program = painter.useProgram('collisionBox');\n const tileBatches: Array = [];\n let circleCount = 0;\n let circleOffset = 0;\n\n for (let i = 0; i < coords.length; i++) {\n const coord = coords[i];\n const tile = sourceCache.getTile(coord);\n const bucket: ?SymbolBucket = (tile.getBucket(layer): any);\n if (!bucket) continue;\n let posMatrix = coord.posMatrix;\n if (translate[0] !== 0 || translate[1] !== 0) {\n posMatrix = painter.translatePosMatrix(coord.posMatrix, tile, translate, translateAnchor);\n }\n const buffers = isText ? bucket.textCollisionBox : bucket.iconCollisionBox;\n // Get collision circle data of this bucket\n const circleArray: Array = bucket.collisionCircleArray;\n if (circleArray.length > 0) {\n // We need to know the projection matrix that was used for projecting collision circles to the screen.\n // This might vary between buckets as the symbol placement is a continous process. This matrix is\n // required for transforming points from previous screen space to the current one\n const invTransform = mat4.create();\n const transform = posMatrix;\n\n mat4.mul(invTransform, bucket.placementInvProjMatrix, painter.transform.glCoordMatrix);\n mat4.mul(invTransform, invTransform, bucket.placementViewportMatrix);\n\n tileBatches.push({\n circleArray,\n circleOffset,\n transform,\n invTransform\n });\n\n circleCount += circleArray.length / 4; // 4 values per circle\n circleOffset = circleCount;\n }\n if (!buffers) continue;\n program.draw(context, gl.LINES,\n DepthMode.disabled, StencilMode.disabled,\n painter.colorModeForRenderPass(),\n CullFaceMode.disabled,\n collisionUniformValues(\n posMatrix,\n painter.transform,\n tile),\n layer.id, buffers.layoutVertexBuffer, buffers.indexBuffer,\n buffers.segments, null, painter.transform.zoom, null, null,\n buffers.collisionVertexBuffer);\n }\n\n if (!isText || !tileBatches.length) {\n return;\n }\n\n // Render collision circles\n const circleProgram = painter.useProgram('collisionCircle');\n\n // Construct vertex data\n const vertexData = new CollisionCircleLayoutArray();\n vertexData.resize(circleCount * 4);\n vertexData._trim();\n\n let vertexOffset = 0;\n\n for (const batch of tileBatches) {\n for (let i = 0; i < batch.circleArray.length / 4; i++) {\n const circleIdx = i * 4;\n const x = batch.circleArray[circleIdx + 0];\n const y = batch.circleArray[circleIdx + 1];\n const radius = batch.circleArray[circleIdx + 2];\n const collision = batch.circleArray[circleIdx + 3];\n\n // 4 floats per vertex, 4 vertices per quad\n vertexData.emplace(vertexOffset++, x, y, radius, collision, 0);\n vertexData.emplace(vertexOffset++, x, y, radius, collision, 1);\n vertexData.emplace(vertexOffset++, x, y, radius, collision, 2);\n vertexData.emplace(vertexOffset++, x, y, radius, collision, 3);\n }\n }\n if (!quadTriangles || quadTriangles.length < circleCount * 2) {\n quadTriangles = createQuadTriangles(circleCount);\n }\n\n const indexBuffer: IndexBuffer = context.createIndexBuffer(quadTriangles, true);\n const vertexBuffer: VertexBuffer = context.createVertexBuffer(vertexData, collisionCircleLayout.members, true);\n\n // Render batches\n for (const batch of tileBatches) {\n const uniforms = collisionCircleUniformValues(\n batch.transform,\n batch.invTransform,\n painter.transform\n );\n\n circleProgram.draw(\n context,\n gl.TRIANGLES,\n DepthMode.disabled,\n StencilMode.disabled,\n painter.colorModeForRenderPass(),\n CullFaceMode.disabled,\n uniforms,\n layer.id,\n vertexBuffer,\n indexBuffer,\n SegmentVector.simpleSegment(0, batch.circleOffset * 2, batch.circleArray.length, batch.circleArray.length / 2),\n null,\n painter.transform.zoom,\n null,\n null,\n null);\n }\n\n vertexBuffer.destroy();\n indexBuffer.destroy();\n}\n\nfunction createQuadTriangles(quadCount: number): QuadTriangleArray {\n const triCount = quadCount * 2;\n const array = new QuadTriangleArray();\n\n array.resize(triCount);\n array._trim();\n\n // Two triangles and 4 vertices per quad.\n for (let i = 0; i < triCount; i++) {\n const idx = i * 6;\n\n array.uint16[idx + 0] = i * 4 + 0;\n array.uint16[idx + 1] = i * 4 + 1;\n array.uint16[idx + 2] = i * 4 + 2;\n array.uint16[idx + 3] = i * 4 + 2;\n array.uint16[idx + 4] = i * 4 + 3;\n array.uint16[idx + 5] = i * 4 + 0;\n }\n\n return array;\n}\n","// @flow\n\nimport {bgPatternUniformValues} from './pattern';\nimport {\n Uniform1i,\n Uniform1f,\n Uniform2f,\n UniformColor,\n UniformMatrix4f\n} from '../uniform_binding';\nimport {extend} from '../../util/util';\n\nimport type Painter from '../painter';\nimport type {UniformValues, UniformLocations} from '../uniform_binding';\nimport type Context from '../../gl/context';\nimport type Color from '../../style-spec/util/color';\nimport type {CrossFaded} from '../../style/properties';\nimport type {CrossfadeParameters} from '../../style/evaluation_parameters';\nimport type {OverscaledTileID} from '../../source/tile_id';\nimport type ResolvedImage from '../../style-spec/expression/types/resolved_image';\n\nexport type BackgroundUniformsType = {|\n 'u_matrix': UniformMatrix4f,\n 'u_opacity': Uniform1f,\n 'u_color': UniformColor\n|};\n\nexport type BackgroundPatternUniformsType = {|\n 'u_matrix': UniformMatrix4f,\n 'u_opacity': Uniform1f,\n // pattern uniforms:\n 'u_image': Uniform1i,\n 'u_pattern_tl_a': Uniform2f,\n 'u_pattern_br_a': Uniform2f,\n 'u_pattern_tl_b': Uniform2f,\n 'u_pattern_br_b': Uniform2f,\n 'u_texsize': Uniform2f,\n 'u_mix': Uniform1f,\n 'u_pattern_size_a': Uniform2f,\n 'u_pattern_size_b': Uniform2f,\n 'u_scale_a': Uniform1f,\n 'u_scale_b': Uniform1f,\n 'u_pixel_coord_upper': Uniform2f,\n 'u_pixel_coord_lower': Uniform2f,\n 'u_tile_units_to_pixels': Uniform1f\n|};\n\nconst backgroundUniforms = (context: Context, locations: UniformLocations): BackgroundUniformsType => ({\n 'u_matrix': new UniformMatrix4f(context, locations.u_matrix),\n 'u_opacity': new Uniform1f(context, locations.u_opacity),\n 'u_color': new UniformColor(context, locations.u_color)\n});\n\nconst backgroundPatternUniforms = (context: Context, locations: UniformLocations): BackgroundPatternUniformsType => ({\n 'u_matrix': new UniformMatrix4f(context, locations.u_matrix),\n 'u_opacity': new Uniform1f(context, locations.u_opacity),\n 'u_image': new Uniform1i(context, locations.u_image),\n 'u_pattern_tl_a': new Uniform2f(context, locations.u_pattern_tl_a),\n 'u_pattern_br_a': new Uniform2f(context, locations.u_pattern_br_a),\n 'u_pattern_tl_b': new Uniform2f(context, locations.u_pattern_tl_b),\n 'u_pattern_br_b': new Uniform2f(context, locations.u_pattern_br_b),\n 'u_texsize': new Uniform2f(context, locations.u_texsize),\n 'u_mix': new Uniform1f(context, locations.u_mix),\n 'u_pattern_size_a': new Uniform2f(context, locations.u_pattern_size_a),\n 'u_pattern_size_b': new Uniform2f(context, locations.u_pattern_size_b),\n 'u_scale_a': new Uniform1f(context, locations.u_scale_a),\n 'u_scale_b': new Uniform1f(context, locations.u_scale_b),\n 'u_pixel_coord_upper': new Uniform2f(context, locations.u_pixel_coord_upper),\n 'u_pixel_coord_lower': new Uniform2f(context, locations.u_pixel_coord_lower),\n 'u_tile_units_to_pixels': new Uniform1f(context, locations.u_tile_units_to_pixels)\n});\n\nconst backgroundUniformValues = (\n matrix: Float32Array,\n opacity: number,\n color: Color\n): UniformValues => ({\n 'u_matrix': matrix,\n 'u_opacity': opacity,\n 'u_color': color\n});\n\nconst backgroundPatternUniformValues = (\n matrix: Float32Array,\n opacity: number,\n painter: Painter,\n image: CrossFaded,\n tile: {tileID: OverscaledTileID, tileSize: number},\n crossfade: CrossfadeParameters\n): UniformValues => extend(\n bgPatternUniformValues(image, crossfade, painter, tile),\n {\n 'u_matrix': matrix,\n 'u_opacity': opacity\n }\n);\n\nexport {\n backgroundUniforms,\n backgroundPatternUniforms,\n backgroundUniformValues,\n backgroundPatternUniformValues\n};\n","// @flow\n\nimport {fillExtrusionUniforms, fillExtrusionPatternUniforms} from './fill_extrusion_program';\nimport {fillUniforms, fillPatternUniforms, fillOutlineUniforms, fillOutlinePatternUniforms} from './fill_program';\nimport {circleUniforms} from './circle_program';\nimport {collisionUniforms, collisionCircleUniforms} from './collision_program';\nimport {debugUniforms} from './debug_program';\nimport {clippingMaskUniforms} from './clipping_mask_program';\nimport {heatmapUniforms, heatmapTextureUniforms} from './heatmap_program';\nimport {hillshadeUniforms, hillshadePrepareUniforms} from './hillshade_program';\nimport {lineUniforms, lineGradientUniforms, linePatternUniforms, lineSDFUniforms} from './line_program';\nimport {rasterUniforms} from './raster_program';\nimport {symbolIconUniforms, symbolSDFUniforms, symbolTextAndIconUniforms} from './symbol_program';\nimport {backgroundUniforms, backgroundPatternUniforms} from './background_program';\n\nexport const programUniforms = {\n fillExtrusion: fillExtrusionUniforms,\n fillExtrusionPattern: fillExtrusionPatternUniforms,\n fill: fillUniforms,\n fillPattern: fillPatternUniforms,\n fillOutline: fillOutlineUniforms,\n fillOutlinePattern: fillOutlinePatternUniforms,\n circle: circleUniforms,\n collisionBox: collisionUniforms,\n collisionCircle: collisionCircleUniforms,\n debug: debugUniforms,\n clippingMask: clippingMaskUniforms,\n heatmap: heatmapUniforms,\n heatmapTexture: heatmapTextureUniforms,\n hillshade: hillshadeUniforms,\n hillshadePrepare: hillshadePrepareUniforms,\n line: lineUniforms,\n lineGradient: lineGradientUniforms,\n linePattern: linePatternUniforms,\n lineSDF: lineSDFUniforms,\n raster: rasterUniforms,\n symbolIcon: symbolIconUniforms,\n symbolSDF: symbolSDFUniforms,\n symbolTextAndIcon: symbolTextAndIconUniforms,\n background: backgroundUniforms,\n backgroundPattern: backgroundPatternUniforms\n};\n","// @flow\n\nimport {mat4} from 'gl-matrix';\n\nimport {\n Uniform1i,\n Uniform1f,\n Uniform2f,\n UniformColor,\n UniformMatrix4f,\n Uniform4f\n} from '../uniform_binding';\nimport EXTENT from '../../data/extent';\nimport MercatorCoordinate from '../../geo/mercator_coordinate';\n\nimport type Context from '../../gl/context';\nimport type {UniformValues, UniformLocations} from '../uniform_binding';\nimport type Tile from '../../source/tile';\nimport type Painter from '../painter';\nimport type HillshadeStyleLayer from '../../style/style_layer/hillshade_style_layer';\nimport type DEMData from '../../data/dem_data';\nimport type {OverscaledTileID} from '../../source/tile_id';\n\nexport type HillshadeUniformsType = {|\n 'u_matrix': UniformMatrix4f,\n 'u_image': Uniform1i,\n 'u_latrange': Uniform2f,\n 'u_light': Uniform2f,\n 'u_shadow': UniformColor,\n 'u_highlight': UniformColor,\n 'u_accent': UniformColor\n|};\n\nexport type HillshadePrepareUniformsType = {|\n 'u_matrix': UniformMatrix4f,\n 'u_image': Uniform1i,\n 'u_dimension': Uniform2f,\n 'u_zoom': Uniform1f,\n 'u_unpack': Uniform4f\n|};\n\nconst hillshadeUniforms = (context: Context, locations: UniformLocations): HillshadeUniformsType => ({\n 'u_matrix': new UniformMatrix4f(context, locations.u_matrix),\n 'u_image': new Uniform1i(context, locations.u_image),\n 'u_latrange': new Uniform2f(context, locations.u_latrange),\n 'u_light': new Uniform2f(context, locations.u_light),\n 'u_shadow': new UniformColor(context, locations.u_shadow),\n 'u_highlight': new UniformColor(context, locations.u_highlight),\n 'u_accent': new UniformColor(context, locations.u_accent)\n});\n\nconst hillshadePrepareUniforms = (context: Context, locations: UniformLocations): HillshadePrepareUniformsType => ({\n 'u_matrix': new UniformMatrix4f(context, locations.u_matrix),\n 'u_image': new Uniform1i(context, locations.u_image),\n 'u_dimension': new Uniform2f(context, locations.u_dimension),\n 'u_zoom': new Uniform1f(context, locations.u_zoom),\n 'u_unpack': new Uniform4f(context, locations.u_unpack)\n});\n\nconst hillshadeUniformValues = (\n painter: Painter,\n tile: Tile,\n layer: HillshadeStyleLayer\n): UniformValues => {\n const shadow = layer.paint.get(\"hillshade-shadow-color\");\n const highlight = layer.paint.get(\"hillshade-highlight-color\");\n const accent = layer.paint.get(\"hillshade-accent-color\");\n\n let azimuthal = layer.paint.get('hillshade-illumination-direction') * (Math.PI / 180);\n // modify azimuthal angle by map rotation if light is anchored at the viewport\n if (layer.paint.get('hillshade-illumination-anchor') === 'viewport') {\n azimuthal -= painter.transform.angle;\n }\n const align = !painter.options.moving;\n return {\n 'u_matrix': painter.transform.calculatePosMatrix(tile.tileID.toUnwrapped(), align),\n 'u_image': 0,\n 'u_latrange': getTileLatRange(painter, tile.tileID),\n 'u_light': [layer.paint.get('hillshade-exaggeration'), azimuthal],\n 'u_shadow': shadow,\n 'u_highlight': highlight,\n 'u_accent': accent\n };\n};\n\nconst hillshadeUniformPrepareValues = (\n tileID: OverscaledTileID, dem: DEMData\n): UniformValues => {\n\n const stride = dem.stride;\n const matrix = mat4.create();\n // Flip rendering at y axis.\n mat4.ortho(matrix, 0, EXTENT, -EXTENT, 0, 0, 1);\n mat4.translate(matrix, matrix, [0, -EXTENT, 0]);\n\n return {\n 'u_matrix': matrix,\n 'u_image': 1,\n 'u_dimension': [stride, stride],\n 'u_zoom': tileID.overscaledZ,\n 'u_unpack': dem.getUnpackVector()\n };\n};\n\nfunction getTileLatRange(painter: Painter, tileID: OverscaledTileID) {\n // for scaling the magnitude of a points slope by its latitude\n const tilesAtZoom = Math.pow(2, tileID.canonical.z);\n const y = tileID.canonical.y;\n return [\n new MercatorCoordinate(0, y / tilesAtZoom).toLngLat().lat,\n new MercatorCoordinate(0, (y + 1) / tilesAtZoom).toLngLat().lat];\n}\n\nexport {\n hillshadeUniforms,\n hillshadePrepareUniforms,\n hillshadeUniformValues,\n hillshadeUniformPrepareValues\n};\n","// @flow\n\nimport Point from '@mapbox/point-geometry';\nimport drawCollisionDebug from './draw_collision_debug';\n\nimport SegmentVector from '../data/segment';\nimport pixelsToTileUnits from '../source/pixels_to_tile_units';\nimport * as symbolProjection from '../symbol/projection';\nimport * as symbolSize from '../symbol/symbol_size';\nimport {mat4} from 'gl-matrix';\nconst identityMat4 = mat4.identity(new Float32Array(16));\nimport StencilMode from '../gl/stencil_mode';\nimport DepthMode from '../gl/depth_mode';\nimport CullFaceMode from '../gl/cull_face_mode';\nimport {addDynamicAttributes} from '../data/bucket/symbol_bucket';\n\nimport {getAnchorAlignment, WritingMode} from '../symbol/shaping';\nimport ONE_EM from '../symbol/one_em';\nimport {evaluateVariableOffset} from '../symbol/symbol_layout';\n\nimport {\n symbolIconUniformValues,\n symbolSDFUniformValues,\n symbolTextAndIconUniformValues\n} from './program/symbol_program';\n\nimport type Painter from './painter';\nimport type SourceCache from '../source/source_cache';\nimport type SymbolStyleLayer from '../style/style_layer/symbol_style_layer';\nimport type SymbolBucket, {SymbolBuffers} from '../data/bucket/symbol_bucket';\nimport type Texture from '../render/texture';\nimport type {OverscaledTileID} from '../source/tile_id';\nimport type {UniformValues} from './uniform_binding';\nimport type {SymbolSDFUniformsType} from '../render/program/symbol_program';\nimport type {CrossTileID, VariableOffset} from '../symbol/placement';\n\nexport default drawSymbols;\n\ntype SymbolTileRenderState = {\n segments: SegmentVector,\n sortKey: number,\n state: {\n program: any,\n buffers: SymbolBuffers,\n uniformValues: any,\n atlasTexture: Texture,\n atlasTextureIcon: Texture | null,\n atlasInterpolation: any,\n atlasInterpolationIcon: any,\n isSDF: boolean,\n hasHalo: boolean\n }\n};\n\nfunction drawSymbols(painter: Painter, sourceCache: SourceCache, layer: SymbolStyleLayer, coords: Array, variableOffsets: {[_: CrossTileID]: VariableOffset}) {\n if (painter.renderPass !== 'translucent') return;\n\n // Disable the stencil test so that labels aren't clipped to tile boundaries.\n const stencilMode = StencilMode.disabled;\n const colorMode = painter.colorModeForRenderPass();\n const variablePlacement = layer.layout.get('text-variable-anchor');\n\n //Compute variable-offsets before painting since icons and text data positioning\n //depend on each other in this case.\n if (variablePlacement) {\n updateVariableAnchors(coords, painter, layer, sourceCache,\n layer.layout.get('text-rotation-alignment'),\n layer.layout.get('text-pitch-alignment'),\n variableOffsets\n );\n }\n\n if (layer.paint.get('icon-opacity').constantOr(1) !== 0) {\n drawLayerSymbols(painter, sourceCache, layer, coords, false,\n layer.paint.get('icon-translate'),\n layer.paint.get('icon-translate-anchor'),\n layer.layout.get('icon-rotation-alignment'),\n layer.layout.get('icon-pitch-alignment'),\n layer.layout.get('icon-keep-upright'),\n stencilMode, colorMode\n );\n }\n\n if (layer.paint.get('text-opacity').constantOr(1) !== 0) {\n drawLayerSymbols(painter, sourceCache, layer, coords, true,\n layer.paint.get('text-translate'),\n layer.paint.get('text-translate-anchor'),\n layer.layout.get('text-rotation-alignment'),\n layer.layout.get('text-pitch-alignment'),\n layer.layout.get('text-keep-upright'),\n stencilMode, colorMode\n );\n }\n\n if (sourceCache.map.showCollisionBoxes) {\n drawCollisionDebug(painter, sourceCache, layer, coords, layer.paint.get('text-translate'),\n layer.paint.get('text-translate-anchor'), true);\n drawCollisionDebug(painter, sourceCache, layer, coords, layer.paint.get('icon-translate'),\n layer.paint.get('icon-translate-anchor'), false);\n }\n}\n\nfunction calculateVariableRenderShift(anchor, width, height, textOffset, textBoxScale, renderTextSize): Point {\n const {horizontalAlign, verticalAlign} = getAnchorAlignment(anchor);\n const shiftX = -(horizontalAlign - 0.5) * width;\n const shiftY = -(verticalAlign - 0.5) * height;\n const variableOffset = evaluateVariableOffset(anchor, textOffset);\n return new Point(\n (shiftX / textBoxScale + variableOffset[0]) * renderTextSize,\n (shiftY / textBoxScale + variableOffset[1]) * renderTextSize\n );\n}\n\nfunction updateVariableAnchors(coords, painter, layer, sourceCache, rotationAlignment, pitchAlignment, variableOffsets) {\n const tr = painter.transform;\n const rotateWithMap = rotationAlignment === 'map';\n const pitchWithMap = pitchAlignment === 'map';\n\n for (const coord of coords) {\n const tile = sourceCache.getTile(coord);\n const bucket: SymbolBucket = (tile.getBucket(layer): any);\n if (!bucket || !bucket.text || !bucket.text.segments.get().length) continue;\n\n const sizeData = bucket.textSizeData;\n const size = symbolSize.evaluateSizeForZoom(sizeData, tr.zoom);\n\n const pixelToTileScale = pixelsToTileUnits(tile, 1, painter.transform.zoom);\n const labelPlaneMatrix = symbolProjection.getLabelPlaneMatrix(coord.posMatrix, pitchWithMap, rotateWithMap, painter.transform, pixelToTileScale);\n const updateTextFitIcon = layer.layout.get('icon-text-fit') !== 'none' && bucket.hasIconData();\n\n if (size) {\n const tileScale = Math.pow(2, tr.zoom - tile.tileID.overscaledZ);\n updateVariableAnchorsForBucket(bucket, rotateWithMap, pitchWithMap, variableOffsets, symbolSize,\n tr, labelPlaneMatrix, coord.posMatrix, tileScale, size, updateTextFitIcon);\n }\n }\n}\n\nfunction updateVariableAnchorsForBucket(bucket, rotateWithMap, pitchWithMap, variableOffsets, symbolSize,\n transform, labelPlaneMatrix, posMatrix, tileScale, size, updateTextFitIcon) {\n const placedSymbols = bucket.text.placedSymbolArray;\n const dynamicTextLayoutVertexArray = bucket.text.dynamicLayoutVertexArray;\n const dynamicIconLayoutVertexArray = bucket.icon.dynamicLayoutVertexArray;\n const placedTextShifts = {};\n\n dynamicTextLayoutVertexArray.clear();\n for (let s = 0; s < placedSymbols.length; s++) {\n const symbol: any = placedSymbols.get(s);\n const skipOrientation = bucket.allowVerticalPlacement && !symbol.placedOrientation;\n const variableOffset = (!symbol.hidden && symbol.crossTileID && !skipOrientation) ? variableOffsets[symbol.crossTileID] : null;\n\n if (!variableOffset) {\n // These symbols are from a justification that is not being used, or a label that wasn't placed\n // so we don't need to do the extra math to figure out what incremental shift to apply.\n symbolProjection.hideGlyphs(symbol.numGlyphs, dynamicTextLayoutVertexArray);\n } else {\n const tileAnchor = new Point(symbol.anchorX, symbol.anchorY);\n const projectedAnchor = symbolProjection.project(tileAnchor, pitchWithMap ? posMatrix : labelPlaneMatrix);\n const perspectiveRatio = symbolProjection.getPerspectiveRatio(transform.cameraToCenterDistance, projectedAnchor.signedDistanceFromCamera);\n let renderTextSize = symbolSize.evaluateSizeForFeature(bucket.textSizeData, size, symbol) * perspectiveRatio / ONE_EM;\n if (pitchWithMap) {\n // Go from size in pixels to equivalent size in tile units\n renderTextSize *= bucket.tilePixelRatio / tileScale;\n }\n\n const {width, height, anchor, textOffset, textBoxScale} = variableOffset;\n\n const shift = calculateVariableRenderShift(\n anchor, width, height, textOffset, textBoxScale, renderTextSize);\n\n // Usual case is that we take the projected anchor and add the pixel-based shift\n // calculated above. In the (somewhat weird) case of pitch-aligned text, we add an equivalent\n // tile-unit based shift to the anchor before projecting to the label plane.\n const shiftedAnchor = pitchWithMap ?\n symbolProjection.project(tileAnchor.add(shift), labelPlaneMatrix).point :\n projectedAnchor.point.add(rotateWithMap ?\n shift.rotate(-transform.angle) :\n shift);\n\n const angle = (bucket.allowVerticalPlacement && symbol.placedOrientation === WritingMode.vertical) ? Math.PI / 2 : 0;\n for (let g = 0; g < symbol.numGlyphs; g++) {\n addDynamicAttributes(dynamicTextLayoutVertexArray, shiftedAnchor, angle);\n }\n //Only offset horizontal text icons\n if (updateTextFitIcon && symbol.associatedIconIndex >= 0) {\n placedTextShifts[symbol.associatedIconIndex] = {shiftedAnchor, angle};\n }\n }\n }\n\n if (updateTextFitIcon) {\n dynamicIconLayoutVertexArray.clear();\n const placedIcons = bucket.icon.placedSymbolArray;\n for (let i = 0; i < placedIcons.length; i++) {\n const placedIcon = placedIcons.get(i);\n if (placedIcon.hidden) {\n symbolProjection.hideGlyphs(placedIcon.numGlyphs, dynamicIconLayoutVertexArray);\n } else {\n const shift = placedTextShifts[i];\n if (!shift) {\n symbolProjection.hideGlyphs(placedIcon.numGlyphs, dynamicIconLayoutVertexArray);\n } else {\n for (let g = 0; g < placedIcon.numGlyphs; g++) {\n addDynamicAttributes(dynamicIconLayoutVertexArray, shift.shiftedAnchor, shift.angle);\n }\n }\n }\n }\n bucket.icon.dynamicLayoutVertexBuffer.updateData(dynamicIconLayoutVertexArray);\n }\n bucket.text.dynamicLayoutVertexBuffer.updateData(dynamicTextLayoutVertexArray);\n}\n\nfunction getSymbolProgramName(isSDF: boolean, isText: boolean, bucket: SymbolBucket) {\n if (bucket.iconsInText && isText) {\n return 'symbolTextAndIcon';\n } else if (isSDF) {\n return 'symbolSDF';\n } else {\n return 'symbolIcon';\n }\n}\n\nfunction drawLayerSymbols(painter, sourceCache, layer, coords, isText, translate, translateAnchor,\n rotationAlignment, pitchAlignment, keepUpright, stencilMode, colorMode) {\n\n const context = painter.context;\n const gl = context.gl;\n const tr = painter.transform;\n\n const rotateWithMap = rotationAlignment === 'map';\n const pitchWithMap = pitchAlignment === 'map';\n const alongLine = rotateWithMap && layer.layout.get('symbol-placement') !== 'point';\n // Line label rotation happens in `updateLineLabels`\n // Pitched point labels are automatically rotated by the labelPlaneMatrix projection\n // Unpitched point labels need to have their rotation applied after projection\n const rotateInShader = rotateWithMap && !pitchWithMap && !alongLine;\n\n const hasSortKey = !layer.layout.get('symbol-sort-key').isConstant();\n let sortFeaturesByKey = false;\n\n const depthMode = painter.depthModeForSublayer(0, DepthMode.ReadOnly);\n\n const variablePlacement = layer.layout.get('text-variable-anchor');\n\n const tileRenderState: Array = [];\n\n for (const coord of coords) {\n const tile = sourceCache.getTile(coord);\n const bucket: SymbolBucket = (tile.getBucket(layer): any);\n if (!bucket) continue;\n const buffers = isText ? bucket.text : bucket.icon;\n if (!buffers || !buffers.segments.get().length) continue;\n const programConfiguration = buffers.programConfigurations.get(layer.id);\n\n const isSDF = isText || bucket.sdfIcons;\n\n const sizeData = isText ? bucket.textSizeData : bucket.iconSizeData;\n const transformed = pitchWithMap || tr.pitch !== 0;\n\n const program = painter.useProgram(getSymbolProgramName(isSDF, isText, bucket), programConfiguration);\n const size = symbolSize.evaluateSizeForZoom(sizeData, tr.zoom);\n\n let texSize: [number, number];\n let texSizeIcon: [number, number] = [0, 0];\n let atlasTexture;\n let atlasInterpolation;\n let atlasTextureIcon = null;\n let atlasInterpolationIcon;\n if (isText) {\n atlasTexture = tile.glyphAtlasTexture;\n atlasInterpolation = gl.LINEAR;\n texSize = tile.glyphAtlasTexture.size;\n if (bucket.iconsInText) {\n texSizeIcon = tile.imageAtlasTexture.size;\n atlasTextureIcon = tile.imageAtlasTexture;\n const zoomDependentSize = sizeData.kind === 'composite' || sizeData.kind === 'camera';\n atlasInterpolationIcon = transformed || painter.options.rotating || painter.options.zooming || zoomDependentSize ? gl.LINEAR : gl.NEAREST;\n }\n } else {\n const iconScaled = layer.layout.get('icon-size').constantOr(0) !== 1 || bucket.iconsNeedLinear;\n atlasTexture = tile.imageAtlasTexture;\n atlasInterpolation = isSDF || painter.options.rotating || painter.options.zooming || iconScaled || transformed ?\n gl.LINEAR :\n gl.NEAREST;\n texSize = tile.imageAtlasTexture.size;\n }\n\n const s = pixelsToTileUnits(tile, 1, painter.transform.zoom);\n const labelPlaneMatrix = symbolProjection.getLabelPlaneMatrix(coord.posMatrix, pitchWithMap, rotateWithMap, painter.transform, s);\n const glCoordMatrix = symbolProjection.getGlCoordMatrix(coord.posMatrix, pitchWithMap, rotateWithMap, painter.transform, s);\n\n const hasVariableAnchors = variablePlacement && bucket.hasTextData();\n const updateTextFitIcon = layer.layout.get('icon-text-fit') !== 'none' &&\n hasVariableAnchors &&\n bucket.hasIconData();\n\n if (alongLine) {\n symbolProjection.updateLineLabels(bucket, coord.posMatrix, painter, isText, labelPlaneMatrix, glCoordMatrix, pitchWithMap, keepUpright);\n }\n\n const matrix = painter.translatePosMatrix(coord.posMatrix, tile, translate, translateAnchor),\n uLabelPlaneMatrix = (alongLine || (isText && variablePlacement) || updateTextFitIcon) ? identityMat4 : labelPlaneMatrix,\n uglCoordMatrix = painter.translatePosMatrix(glCoordMatrix, tile, translate, translateAnchor, true);\n\n const hasHalo = isSDF && layer.paint.get(isText ? 'text-halo-width' : 'icon-halo-width').constantOr(1) !== 0;\n\n let uniformValues;\n if (isSDF) {\n if (!bucket.iconsInText) {\n uniformValues = symbolSDFUniformValues(sizeData.kind,\n size, rotateInShader, pitchWithMap, painter, matrix,\n uLabelPlaneMatrix, uglCoordMatrix, isText, texSize, true);\n } else {\n uniformValues = symbolTextAndIconUniformValues(sizeData.kind,\n size, rotateInShader, pitchWithMap, painter, matrix,\n uLabelPlaneMatrix, uglCoordMatrix, texSize, texSizeIcon);\n }\n } else {\n uniformValues = symbolIconUniformValues(sizeData.kind,\n size, rotateInShader, pitchWithMap, painter, matrix,\n uLabelPlaneMatrix, uglCoordMatrix, isText, texSize);\n }\n\n const state = {\n program,\n buffers,\n uniformValues,\n atlasTexture,\n atlasTextureIcon,\n atlasInterpolation,\n atlasInterpolationIcon,\n isSDF,\n hasHalo\n };\n\n if (hasSortKey && bucket.canOverlap) {\n sortFeaturesByKey = true;\n const oldSegments = buffers.segments.get();\n for (const segment of oldSegments) {\n tileRenderState.push({\n segments: new SegmentVector([segment]),\n sortKey: ((segment.sortKey: any): number),\n state\n });\n }\n } else {\n tileRenderState.push({\n segments: buffers.segments,\n sortKey: 0,\n state\n });\n }\n }\n\n if (sortFeaturesByKey) {\n tileRenderState.sort((a, b) => a.sortKey - b.sortKey);\n }\n\n for (const segmentState of tileRenderState) {\n const state = segmentState.state;\n\n context.activeTexture.set(gl.TEXTURE0);\n state.atlasTexture.bind(state.atlasInterpolation, gl.CLAMP_TO_EDGE);\n if (state.atlasTextureIcon) {\n context.activeTexture.set(gl.TEXTURE1);\n if (state.atlasTextureIcon) {\n state.atlasTextureIcon.bind(state.atlasInterpolationIcon, gl.CLAMP_TO_EDGE);\n }\n }\n\n if (state.isSDF) {\n const uniformValues = ((state.uniformValues: any): UniformValues);\n if (state.hasHalo) {\n uniformValues['u_is_halo'] = 1;\n drawSymbolElements(state.buffers, segmentState.segments, layer, painter, state.program, depthMode, stencilMode, colorMode, uniformValues);\n }\n uniformValues['u_is_halo'] = 0;\n }\n drawSymbolElements(state.buffers, segmentState.segments, layer, painter, state.program, depthMode, stencilMode, colorMode, state.uniformValues);\n }\n}\n\nfunction drawSymbolElements(buffers, segments, layer, painter, program, depthMode, stencilMode, colorMode, uniformValues) {\n const context = painter.context;\n const gl = context.gl;\n program.draw(context, gl.TRIANGLES, depthMode, stencilMode, colorMode, CullFaceMode.disabled,\n uniformValues, layer.id, buffers.layoutVertexBuffer,\n buffers.indexBuffer, segments, layer.paint,\n painter.transform.zoom, buffers.programConfigurations.get(layer.id),\n buffers.dynamicLayoutVertexBuffer, buffers.opacityVertexBuffer);\n}\n","// @flow\n\nimport Color from '../style-spec/util/color';\nimport DepthMode from '../gl/depth_mode';\nimport CullFaceMode from '../gl/cull_face_mode';\nimport {\n fillUniformValues,\n fillPatternUniformValues,\n fillOutlineUniformValues,\n fillOutlinePatternUniformValues\n} from './program/fill_program';\n\nimport type Painter from './painter';\nimport type SourceCache from '../source/source_cache';\nimport type FillStyleLayer from '../style/style_layer/fill_style_layer';\nimport type FillBucket from '../data/bucket/fill_bucket';\nimport type {OverscaledTileID} from '../source/tile_id';\n\nexport default drawFill;\n\nfunction drawFill(painter: Painter, sourceCache: SourceCache, layer: FillStyleLayer, coords: Array) {\n const color = layer.paint.get('fill-color');\n const opacity = layer.paint.get('fill-opacity');\n\n if (opacity.constantOr(1) === 0) {\n return;\n }\n\n const colorMode = painter.colorModeForRenderPass();\n\n const pattern = layer.paint.get('fill-pattern');\n const pass = painter.opaquePassEnabledForLayer() &&\n (!pattern.constantOr((1: any)) &&\n color.constantOr(Color.transparent).a === 1 &&\n opacity.constantOr(0) === 1) ? 'opaque' : 'translucent';\n\n // Draw fill\n if (painter.renderPass === pass) {\n const depthMode = painter.depthModeForSublayer(\n 1, painter.renderPass === 'opaque' ? DepthMode.ReadWrite : DepthMode.ReadOnly);\n drawFillTiles(painter, sourceCache, layer, coords, depthMode, colorMode, false);\n }\n\n // Draw stroke\n if (painter.renderPass === 'translucent' && layer.paint.get('fill-antialias')) {\n\n // If we defined a different color for the fill outline, we are\n // going to ignore the bits in 0x07 and just care about the global\n // clipping mask.\n // Otherwise, we only want to drawFill the antialiased parts that are\n // *outside* the current shape. This is important in case the fill\n // or stroke color is translucent. If we wouldn't clip to outside\n // the current shape, some pixels from the outline stroke overlapped\n // the (non-antialiased) fill.\n const depthMode = painter.depthModeForSublayer(\n layer.getPaintProperty('fill-outline-color') ? 2 : 0, DepthMode.ReadOnly);\n drawFillTiles(painter, sourceCache, layer, coords, depthMode, colorMode, true);\n }\n}\n\nfunction drawFillTiles(painter, sourceCache, layer, coords, depthMode, colorMode, isOutline) {\n const gl = painter.context.gl;\n\n const patternProperty = layer.paint.get('fill-pattern');\n const image = patternProperty && patternProperty.constantOr((1: any));\n const crossfade = layer.getCrossfadeParameters();\n let drawMode, programName, uniformValues, indexBuffer, segments;\n\n if (!isOutline) {\n programName = image ? 'fillPattern' : 'fill';\n drawMode = gl.TRIANGLES;\n } else {\n programName = image && !layer.getPaintProperty('fill-outline-color') ? 'fillOutlinePattern' : 'fillOutline';\n drawMode = gl.LINES;\n }\n\n for (const coord of coords) {\n const tile = sourceCache.getTile(coord);\n if (image && !tile.patternsLoaded()) continue;\n\n const bucket: ?FillBucket = (tile.getBucket(layer): any);\n if (!bucket) continue;\n\n const programConfiguration = bucket.programConfigurations.get(layer.id);\n const program = painter.useProgram(programName, programConfiguration);\n\n if (image) {\n painter.context.activeTexture.set(gl.TEXTURE0);\n tile.imageAtlasTexture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n programConfiguration.updatePaintBuffers(crossfade);\n }\n\n const constantPattern = patternProperty.constantOr(null);\n if (constantPattern && tile.imageAtlas) {\n const atlas = tile.imageAtlas;\n const posTo = atlas.patternPositions[constantPattern.to.toString()];\n const posFrom = atlas.patternPositions[constantPattern.from.toString()];\n if (posTo && posFrom) programConfiguration.setConstantPatternPositions(posTo, posFrom);\n }\n\n const tileMatrix = painter.translatePosMatrix(coord.posMatrix, tile,\n layer.paint.get('fill-translate'), layer.paint.get('fill-translate-anchor'));\n\n if (!isOutline) {\n indexBuffer = bucket.indexBuffer;\n segments = bucket.segments;\n uniformValues = image ?\n fillPatternUniformValues(tileMatrix, painter, crossfade, tile) :\n fillUniformValues(tileMatrix);\n } else {\n indexBuffer = bucket.indexBuffer2;\n segments = bucket.segments2;\n const drawingBufferSize = [gl.drawingBufferWidth, gl.drawingBufferHeight];\n uniformValues = (programName === 'fillOutlinePattern' && image) ?\n fillOutlinePatternUniformValues(tileMatrix, painter, crossfade, tile, drawingBufferSize) :\n fillOutlineUniformValues(tileMatrix, drawingBufferSize);\n }\n\n program.draw(painter.context, drawMode, depthMode,\n painter.stencilModeForClipping(coord), colorMode, CullFaceMode.disabled, uniformValues,\n layer.id, bucket.layoutVertexBuffer, indexBuffer, segments,\n layer.paint, painter.transform.zoom, programConfiguration);\n }\n}\n","// @flow\n\nimport DepthMode from '../gl/depth_mode';\nimport StencilMode from '../gl/stencil_mode';\nimport ColorMode from '../gl/color_mode';\nimport CullFaceMode from '../gl/cull_face_mode';\nimport {\n fillExtrusionUniformValues,\n fillExtrusionPatternUniformValues,\n} from './program/fill_extrusion_program';\n\nimport type Painter from './painter';\nimport type SourceCache from '../source/source_cache';\nimport type FillExtrusionStyleLayer from '../style/style_layer/fill_extrusion_style_layer';\nimport type FillExtrusionBucket from '../data/bucket/fill_extrusion_bucket';\nimport type {OverscaledTileID} from '../source/tile_id';\n\nexport default draw;\n\nfunction draw(painter: Painter, source: SourceCache, layer: FillExtrusionStyleLayer, coords: Array) {\n const opacity = layer.paint.get('fill-extrusion-opacity');\n if (opacity === 0) {\n return;\n }\n\n if (painter.renderPass === 'translucent') {\n const depthMode = new DepthMode(painter.context.gl.LEQUAL, DepthMode.ReadWrite, painter.depthRangeFor3D);\n\n if (opacity === 1 && !layer.paint.get('fill-extrusion-pattern').constantOr((1: any))) {\n const colorMode = painter.colorModeForRenderPass();\n drawExtrusionTiles(painter, source, layer, coords, depthMode, StencilMode.disabled, colorMode);\n\n } else {\n // Draw transparent buildings in two passes so that only the closest surface is drawn.\n // First draw all the extrusions into only the depth buffer. No colors are drawn.\n drawExtrusionTiles(painter, source, layer, coords, depthMode,\n StencilMode.disabled,\n ColorMode.disabled);\n\n // Then draw all the extrusions a second type, only coloring fragments if they have the\n // same depth value as the closest fragment in the previous pass. Use the stencil buffer\n // to prevent the second draw in cases where we have coincident polygons.\n drawExtrusionTiles(painter, source, layer, coords, depthMode,\n painter.stencilModeFor3D(),\n painter.colorModeForRenderPass());\n }\n }\n}\n\nfunction drawExtrusionTiles(painter, source, layer, coords, depthMode, stencilMode, colorMode) {\n const context = painter.context;\n const gl = context.gl;\n const patternProperty = layer.paint.get('fill-extrusion-pattern');\n const image = patternProperty.constantOr((1: any));\n const crossfade = layer.getCrossfadeParameters();\n const opacity = layer.paint.get('fill-extrusion-opacity');\n\n for (const coord of coords) {\n const tile = source.getTile(coord);\n const bucket: ?FillExtrusionBucket = (tile.getBucket(layer): any);\n if (!bucket) continue;\n\n const programConfiguration = bucket.programConfigurations.get(layer.id);\n const program = painter.useProgram(image ? 'fillExtrusionPattern' : 'fillExtrusion', programConfiguration);\n\n if (image) {\n painter.context.activeTexture.set(gl.TEXTURE0);\n tile.imageAtlasTexture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n programConfiguration.updatePaintBuffers(crossfade);\n }\n const constantPattern = patternProperty.constantOr(null);\n if (constantPattern && tile.imageAtlas) {\n const atlas = tile.imageAtlas;\n const posTo = atlas.patternPositions[constantPattern.to.toString()];\n const posFrom = atlas.patternPositions[constantPattern.from.toString()];\n if (posTo && posFrom) programConfiguration.setConstantPatternPositions(posTo, posFrom);\n }\n\n const matrix = painter.translatePosMatrix(\n coord.posMatrix,\n tile,\n layer.paint.get('fill-extrusion-translate'),\n layer.paint.get('fill-extrusion-translate-anchor'));\n\n const shouldUseVerticalGradient = layer.paint.get('fill-extrusion-vertical-gradient');\n const uniformValues = image ?\n fillExtrusionPatternUniformValues(matrix, painter, shouldUseVerticalGradient, opacity, coord, crossfade, tile) :\n fillExtrusionUniformValues(matrix, painter, shouldUseVerticalGradient, opacity);\n\n program.draw(context, context.gl.TRIANGLES, depthMode, stencilMode, colorMode, CullFaceMode.backCCW,\n uniformValues, layer.id, bucket.layoutVertexBuffer, bucket.indexBuffer,\n bucket.segments, layer.paint, painter.transform.zoom,\n programConfiguration);\n }\n}\n","// @flow\n\nimport Texture from './texture';\nimport StencilMode from '../gl/stencil_mode';\nimport DepthMode from '../gl/depth_mode';\nimport CullFaceMode from '../gl/cull_face_mode';\nimport {\n hillshadeUniformValues,\n hillshadeUniformPrepareValues\n} from './program/hillshade_program';\n\nimport type Painter from './painter';\nimport type SourceCache from '../source/source_cache';\nimport type HillshadeStyleLayer from '../style/style_layer/hillshade_style_layer';\nimport type {OverscaledTileID} from '../source/tile_id';\n\nexport default drawHillshade;\n\nfunction drawHillshade(painter: Painter, sourceCache: SourceCache, layer: HillshadeStyleLayer, tileIDs: Array) {\n if (painter.renderPass !== 'offscreen' && painter.renderPass !== 'translucent') return;\n\n const context = painter.context;\n\n const depthMode = painter.depthModeForSublayer(0, DepthMode.ReadOnly);\n const colorMode = painter.colorModeForRenderPass();\n\n const [stencilModes, coords] = painter.renderPass === 'translucent' ?\n painter.stencilConfigForOverlap(tileIDs) : [{}, tileIDs];\n\n for (const coord of coords) {\n const tile = sourceCache.getTile(coord);\n if (tile.needsHillshadePrepare && painter.renderPass === 'offscreen') {\n prepareHillshade(painter, tile, layer, depthMode, StencilMode.disabled, colorMode);\n } else if (painter.renderPass === 'translucent') {\n renderHillshade(painter, tile, layer, depthMode, stencilModes[coord.overscaledZ], colorMode);\n }\n }\n\n context.viewport.set([0, 0, painter.width, painter.height]);\n}\n\nfunction renderHillshade(painter, tile, layer, depthMode, stencilMode, colorMode) {\n const context = painter.context;\n const gl = context.gl;\n const fbo = tile.fbo;\n if (!fbo) return;\n\n const program = painter.useProgram('hillshade');\n\n context.activeTexture.set(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_2D, fbo.colorAttachment.get());\n\n const uniformValues = hillshadeUniformValues(painter, tile, layer);\n\n program.draw(context, gl.TRIANGLES, depthMode, stencilMode, colorMode, CullFaceMode.disabled,\n uniformValues, layer.id, painter.rasterBoundsBuffer,\n painter.quadTriangleIndexBuffer, painter.rasterBoundsSegments);\n}\n\n// hillshade rendering is done in two steps. the prepare step first calculates the slope of the terrain in the x and y\n// directions for each pixel, and saves those values to a framebuffer texture in the r and g channels.\nfunction prepareHillshade(painter, tile, layer, depthMode, stencilMode, colorMode) {\n const context = painter.context;\n const gl = context.gl;\n const dem = tile.dem;\n if (dem && dem.data) {\n const tileSize = dem.dim;\n const textureStride = dem.stride;\n\n const pixelData = dem.getPixels();\n context.activeTexture.set(gl.TEXTURE1);\n\n context.pixelStoreUnpackPremultiplyAlpha.set(false);\n tile.demTexture = tile.demTexture || painter.getTileTexture(textureStride);\n if (tile.demTexture) {\n const demTexture = tile.demTexture;\n demTexture.update(pixelData, {premultiply: false});\n demTexture.bind(gl.NEAREST, gl.CLAMP_TO_EDGE);\n } else {\n tile.demTexture = new Texture(context, pixelData, gl.RGBA, {premultiply: false});\n tile.demTexture.bind(gl.NEAREST, gl.CLAMP_TO_EDGE);\n }\n\n context.activeTexture.set(gl.TEXTURE0);\n\n let fbo = tile.fbo;\n\n if (!fbo) {\n const renderTexture = new Texture(context, {width: tileSize, height: tileSize, data: null}, gl.RGBA);\n renderTexture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n\n fbo = tile.fbo = context.createFramebuffer(tileSize, tileSize, true);\n fbo.colorAttachment.set(renderTexture.texture);\n }\n\n context.bindFramebuffer.set(fbo.framebuffer);\n context.viewport.set([0, 0, tileSize, tileSize]);\n\n painter.useProgram('hillshadePrepare').draw(context, gl.TRIANGLES,\n depthMode, stencilMode, colorMode, CullFaceMode.disabled,\n hillshadeUniformPrepareValues(tile.tileID, dem),\n layer.id, painter.rasterBoundsBuffer,\n painter.quadTriangleIndexBuffer, painter.rasterBoundsSegments);\n\n tile.needsHillshadePrepare = false;\n }\n}\n","// @flow\n\nimport {clamp} from '../util/util';\n\nimport ImageSource from '../source/image_source';\nimport browser from '../util/browser';\nimport StencilMode from '../gl/stencil_mode';\nimport DepthMode from '../gl/depth_mode';\nimport CullFaceMode from '../gl/cull_face_mode';\nimport {rasterUniformValues} from './program/raster_program';\n\nimport type Painter from './painter';\nimport type SourceCache from '../source/source_cache';\nimport type RasterStyleLayer from '../style/style_layer/raster_style_layer';\nimport type {OverscaledTileID} from '../source/tile_id';\n\nexport default drawRaster;\n\nfunction drawRaster(painter: Painter, sourceCache: SourceCache, layer: RasterStyleLayer, tileIDs: Array) {\n if (painter.renderPass !== 'translucent') return;\n if (layer.paint.get('raster-opacity') === 0) return;\n if (!tileIDs.length) return;\n\n const context = painter.context;\n const gl = context.gl;\n const source = sourceCache.getSource();\n const program = painter.useProgram('raster');\n\n const colorMode = painter.colorModeForRenderPass();\n\n const [stencilModes, coords] = source instanceof ImageSource ? [{}, tileIDs] :\n painter.stencilConfigForOverlap(tileIDs);\n\n const minTileZ = coords[coords.length - 1].overscaledZ;\n\n const align = !painter.options.moving;\n for (const coord of coords) {\n // Set the lower zoom level to sublayer 0, and higher zoom levels to higher sublayers\n // Use gl.LESS to prevent double drawing in areas where tiles overlap.\n const depthMode = painter.depthModeForSublayer(coord.overscaledZ - minTileZ,\n layer.paint.get('raster-opacity') === 1 ? DepthMode.ReadWrite : DepthMode.ReadOnly, gl.LESS);\n\n const tile = sourceCache.getTile(coord);\n const posMatrix = painter.transform.calculatePosMatrix(coord.toUnwrapped(), align);\n\n tile.registerFadeDuration(layer.paint.get('raster-fade-duration'));\n\n const parentTile = sourceCache.findLoadedParent(coord, 0),\n fade = getFadeValues(tile, parentTile, sourceCache, layer, painter.transform);\n\n let parentScaleBy, parentTL;\n\n const textureFilter = layer.paint.get('raster-resampling') === 'nearest' ? gl.NEAREST : gl.LINEAR;\n\n context.activeTexture.set(gl.TEXTURE0);\n tile.texture.bind(textureFilter, gl.CLAMP_TO_EDGE, gl.LINEAR_MIPMAP_NEAREST);\n\n context.activeTexture.set(gl.TEXTURE1);\n\n if (parentTile) {\n parentTile.texture.bind(textureFilter, gl.CLAMP_TO_EDGE, gl.LINEAR_MIPMAP_NEAREST);\n parentScaleBy = Math.pow(2, parentTile.tileID.overscaledZ - tile.tileID.overscaledZ);\n parentTL = [tile.tileID.canonical.x * parentScaleBy % 1, tile.tileID.canonical.y * parentScaleBy % 1];\n\n } else {\n tile.texture.bind(textureFilter, gl.CLAMP_TO_EDGE, gl.LINEAR_MIPMAP_NEAREST);\n }\n\n const uniformValues = rasterUniformValues(posMatrix, parentTL || [0, 0], parentScaleBy || 1, fade, layer);\n\n if (source instanceof ImageSource) {\n program.draw(context, gl.TRIANGLES, depthMode, StencilMode.disabled, colorMode, CullFaceMode.disabled,\n uniformValues, layer.id, source.boundsBuffer,\n painter.quadTriangleIndexBuffer, source.boundsSegments);\n } else {\n program.draw(context, gl.TRIANGLES, depthMode, stencilModes[coord.overscaledZ], colorMode, CullFaceMode.disabled,\n uniformValues, layer.id, painter.rasterBoundsBuffer,\n painter.quadTriangleIndexBuffer, painter.rasterBoundsSegments);\n }\n }\n}\n\nfunction getFadeValues(tile, parentTile, sourceCache, layer, transform) {\n const fadeDuration = layer.paint.get('raster-fade-duration');\n\n if (fadeDuration > 0) {\n const now = browser.now();\n const sinceTile = (now - tile.timeAdded) / fadeDuration;\n const sinceParent = parentTile ? (now - parentTile.timeAdded) / fadeDuration : -1;\n\n const source = sourceCache.getSource();\n const idealZ = transform.coveringZoomLevel({\n tileSize: source.tileSize,\n roundZoom: source.roundZoom\n });\n\n // if no parent or parent is older, fade in; if parent is younger, fade out\n const fadeIn = !parentTile || Math.abs(parentTile.tileID.overscaledZ - idealZ) > Math.abs(tile.tileID.overscaledZ - idealZ);\n\n const childOpacity = (fadeIn && tile.refreshedUponExpiration) ? 1 : clamp(fadeIn ? sinceTile : 1 - sinceParent, 0, 1);\n\n // we don't crossfade tiles that were just refreshed upon expiring:\n // once they're old enough to pass the crossfading threshold\n // (fadeDuration), unset the `refreshedUponExpiration` flag so we don't\n // incorrectly fail to crossfade them when zooming\n if (tile.refreshedUponExpiration && sinceTile >= 1) tile.refreshedUponExpiration = false;\n\n if (parentTile) {\n return {\n opacity: 1,\n mix: 1 - childOpacity\n };\n } else {\n return {\n opacity: childOpacity,\n mix: 0\n };\n }\n } else {\n return {\n opacity: 1,\n mix: 0\n };\n }\n}\n","// @flow\n\nimport DepthMode from '../gl/depth_mode';\nimport StencilMode from '../gl/stencil_mode';\nimport CullFaceMode from '../gl/cull_face_mode';\nimport {debugUniformValues} from './program/debug_program';\nimport Color from '../style-spec/util/color';\nimport ColorMode from '../gl/color_mode';\nimport browser from '../util/browser';\n\nimport type Painter from './painter';\nimport type SourceCache from '../source/source_cache';\nimport type {OverscaledTileID} from '../source/tile_id';\n\nexport default drawDebug;\n\nconst topColor = new Color(1, 0, 0, 1);\nconst btmColor = new Color(0, 1, 0, 1);\nconst leftColor = new Color(0, 0, 1, 1);\nconst rightColor = new Color(1, 0, 1, 1);\nconst centerColor = new Color(0, 1, 1, 1);\n\nexport function drawDebugPadding(painter: Painter) {\n const padding = painter.transform.padding;\n const lineWidth = 3;\n // Top\n drawHorizontalLine(painter, painter.transform.height - (padding.top || 0), lineWidth, topColor);\n // Bottom\n drawHorizontalLine(painter, padding.bottom || 0, lineWidth, btmColor);\n // Left\n drawVerticalLine(painter, padding.left || 0, lineWidth, leftColor);\n // Right\n drawVerticalLine(painter, painter.transform.width - (padding.right || 0), lineWidth, rightColor);\n // Center\n const center = painter.transform.centerPoint;\n drawCrosshair(painter, center.x, painter.transform.height - center.y, centerColor);\n}\n\nfunction drawCrosshair(painter: Painter, x: number, y: number, color: Color) {\n const size = 20;\n const lineWidth = 2;\n //Vertical line\n drawDebugSSRect(painter, x - lineWidth / 2, y - size / 2, lineWidth, size, color);\n //Horizontal line\n drawDebugSSRect(painter, x - size / 2, y - lineWidth / 2, size, lineWidth, color);\n}\n\nfunction drawHorizontalLine(painter: Painter, y: number, lineWidth: number, color: Color) {\n drawDebugSSRect(painter, 0, y + lineWidth / 2, painter.transform.width, lineWidth, color);\n}\n\nfunction drawVerticalLine(painter: Painter, x: number, lineWidth: number, color: Color) {\n drawDebugSSRect(painter, x - lineWidth / 2, 0, lineWidth, painter.transform.height, color);\n}\n\nfunction drawDebugSSRect(painter: Painter, x: number, y: number, width: number, height: number, color: Color) {\n const context = painter.context;\n const gl = context.gl;\n\n gl.enable(gl.SCISSOR_TEST);\n gl.scissor(x * browser.devicePixelRatio, y * browser.devicePixelRatio, width * browser.devicePixelRatio, height * browser.devicePixelRatio);\n context.clear({color});\n gl.disable(gl.SCISSOR_TEST);\n}\n\nfunction drawDebug(painter: Painter, sourceCache: SourceCache, coords: Array) {\n for (let i = 0; i < coords.length; i++) {\n drawDebugTile(painter, sourceCache, coords[i]);\n }\n}\n\nfunction drawDebugTile(painter, sourceCache, coord: OverscaledTileID) {\n const context = painter.context;\n const gl = context.gl;\n\n const posMatrix = coord.posMatrix;\n const program = painter.useProgram('debug');\n\n const depthMode = DepthMode.disabled;\n const stencilMode = StencilMode.disabled;\n const colorMode = painter.colorModeForRenderPass();\n const id = '$debug';\n\n context.activeTexture.set(gl.TEXTURE0);\n // Bind the empty texture for drawing outlines\n painter.emptyTexture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n\n program.draw(context, gl.LINE_STRIP, depthMode, stencilMode, colorMode, CullFaceMode.disabled,\n debugUniformValues(posMatrix, Color.red), id,\n painter.debugBuffer, painter.tileBorderIndexBuffer, painter.debugSegments);\n\n const tileRawData = sourceCache.getTileByID(coord.key).latestRawTileData;\n const tileByteLength = (tileRawData && tileRawData.byteLength) || 0;\n const tileSizeKb = Math.floor(tileByteLength / 1024);\n const tileSize = sourceCache.getTile(coord).tileSize;\n const scaleRatio = (512 / Math.min(tileSize, 512) * (coord.overscaledZ / painter.transform.zoom)) * 0.5;\n let tileIdText = coord.canonical.toString();\n if (coord.overscaledZ !== coord.canonical.z) {\n tileIdText += ` => ${coord.overscaledZ}`;\n }\n const tileLabel = `${tileIdText} ${tileSizeKb}kb`;\n drawTextToOverlay(painter, tileLabel);\n\n program.draw(context, gl.TRIANGLES, depthMode, stencilMode, ColorMode.alphaBlended, CullFaceMode.disabled,\n debugUniformValues(posMatrix, Color.transparent, scaleRatio), id,\n painter.debugBuffer, painter.quadTriangleIndexBuffer, painter.debugSegments);\n}\n\nfunction drawTextToOverlay(painter: Painter, text: string) {\n painter.initDebugOverlayCanvas();\n const canvas = painter.debugOverlayCanvas;\n const gl = painter.context.gl;\n const ctx2d = painter.debugOverlayCanvas.getContext('2d');\n ctx2d.clearRect(0, 0, canvas.width, canvas.height);\n\n ctx2d.shadowColor = 'white';\n ctx2d.shadowBlur = 2;\n ctx2d.lineWidth = 1.5;\n ctx2d.strokeStyle = 'white';\n ctx2d.textBaseline = 'top';\n ctx2d.font = `bold ${36}px Open Sans, sans-serif`;\n ctx2d.fillText(text, 5, 5);\n ctx2d.strokeText(text, 5, 5);\n\n painter.debugOverlayTexture.update(canvas);\n painter.debugOverlayTexture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n}\n","// @flow\n\nimport browser from '../util/browser';\nimport window from '../util/window';\n\nimport {mat4} from 'gl-matrix';\nimport SourceCache from '../source/source_cache';\nimport EXTENT from '../data/extent';\nimport pixelsToTileUnits from '../source/pixels_to_tile_units';\nimport SegmentVector from '../data/segment';\nimport {RasterBoundsArray, PosArray, TriangleIndexArray, LineStripIndexArray} from '../data/array_types';\nimport {values} from '../util/util';\nimport rasterBoundsAttributes from '../data/raster_bounds_attributes';\nimport posAttributes from '../data/pos_attributes';\nimport ProgramConfiguration from '../data/program_configuration';\nimport CrossTileSymbolIndex from '../symbol/cross_tile_symbol_index';\nimport * as shaders from '../shaders';\nimport Program from './program';\nimport {programUniforms} from './program/program_uniforms';\nimport Context from '../gl/context';\nimport DepthMode from '../gl/depth_mode';\nimport StencilMode from '../gl/stencil_mode';\nimport ColorMode from '../gl/color_mode';\nimport CullFaceMode from '../gl/cull_face_mode';\nimport Texture from './texture';\nimport {clippingMaskUniformValues} from './program/clipping_mask_program';\nimport Color from '../style-spec/util/color';\nimport symbol from './draw_symbol';\nimport circle from './draw_circle';\nimport heatmap from './draw_heatmap';\nimport line from './draw_line';\nimport fill from './draw_fill';\nimport fillExtrusion from './draw_fill_extrusion';\nimport hillshade from './draw_hillshade';\nimport raster from './draw_raster';\nimport background from './draw_background';\nimport debug, {drawDebugPadding} from './draw_debug';\nimport custom from './draw_custom';\n\nconst draw = {\n symbol,\n circle,\n heatmap,\n line,\n fill,\n 'fill-extrusion': fillExtrusion,\n hillshade,\n raster,\n background,\n debug,\n custom\n};\n\nimport type Transform from '../geo/transform';\nimport type Tile from '../source/tile';\nimport type {OverscaledTileID} from '../source/tile_id';\nimport type Style from '../style/style';\nimport type StyleLayer from '../style/style_layer';\nimport type {CrossFaded} from '../style/properties';\nimport type LineAtlas from './line_atlas';\nimport type ImageManager from './image_manager';\nimport type GlyphManager from './glyph_manager';\nimport type VertexBuffer from '../gl/vertex_buffer';\nimport type IndexBuffer from '../gl/index_buffer';\nimport type {DepthRangeType, DepthMaskType, DepthFuncType} from '../gl/types';\nimport type ResolvedImage from '../style-spec/expression/types/resolved_image';\n\nexport type RenderPass = 'offscreen' | 'opaque' | 'translucent';\n\ntype PainterOptions = {\n showOverdrawInspector: boolean,\n showTileBoundaries: boolean,\n showPadding: boolean,\n rotating: boolean,\n zooming: boolean,\n moving: boolean,\n gpuTiming: boolean,\n fadeDuration: number\n}\n\n/**\n * Initialize a new painter object.\n *\n * @param {Canvas} gl an experimental-webgl drawing context\n * @private\n */\nclass Painter {\n context: Context;\n transform: Transform;\n _tileTextures: {[_: number]: Array };\n numSublayers: number;\n depthEpsilon: number;\n emptyProgramConfiguration: ProgramConfiguration;\n width: number;\n height: number;\n tileExtentBuffer: VertexBuffer;\n tileExtentSegments: SegmentVector;\n debugBuffer: VertexBuffer;\n debugSegments: SegmentVector;\n rasterBoundsBuffer: VertexBuffer;\n rasterBoundsSegments: SegmentVector;\n viewportBuffer: VertexBuffer;\n viewportSegments: SegmentVector;\n quadTriangleIndexBuffer: IndexBuffer;\n tileBorderIndexBuffer: IndexBuffer;\n _tileClippingMaskIDs: {[_: string]: number };\n stencilClearMode: StencilMode;\n style: Style;\n options: PainterOptions;\n lineAtlas: LineAtlas;\n imageManager: ImageManager;\n glyphManager: GlyphManager;\n depthRangeFor3D: DepthRangeType;\n opaquePassCutoff: number;\n renderPass: RenderPass;\n currentLayer: number;\n currentStencilSource: ?string;\n nextStencilID: number;\n id: string;\n _showOverdrawInspector: boolean;\n cache: {[_: string]: Program<*> };\n crossTileSymbolIndex: CrossTileSymbolIndex;\n symbolFadeChange: number;\n gpuTimers: {[_: string]: any };\n emptyTexture: Texture;\n debugOverlayTexture: Texture;\n debugOverlayCanvas: HTMLCanvasElement;\n\n constructor(gl: WebGLRenderingContext, transform: Transform) {\n this.context = new Context(gl);\n this.transform = transform;\n this._tileTextures = {};\n\n this.setup();\n\n // Within each layer there are multiple distinct z-planes that can be drawn to.\n // This is implemented using the WebGL depth buffer.\n this.numSublayers = SourceCache.maxUnderzooming + SourceCache.maxOverzooming + 1;\n this.depthEpsilon = 1 / Math.pow(2, 16);\n\n this.crossTileSymbolIndex = new CrossTileSymbolIndex();\n\n this.gpuTimers = {};\n }\n\n /*\n * Update the GL viewport, projection matrix, and transforms to compensate\n * for a new width and height value.\n */\n resize(width: number, height: number) {\n this.width = width * browser.devicePixelRatio;\n this.height = height * browser.devicePixelRatio;\n this.context.viewport.set([0, 0, this.width, this.height]);\n\n if (this.style) {\n for (const layerId of this.style._order) {\n this.style._layers[layerId].resize();\n }\n }\n }\n\n setup() {\n const context = this.context;\n\n const tileExtentArray = new PosArray();\n tileExtentArray.emplaceBack(0, 0);\n tileExtentArray.emplaceBack(EXTENT, 0);\n tileExtentArray.emplaceBack(0, EXTENT);\n tileExtentArray.emplaceBack(EXTENT, EXTENT);\n this.tileExtentBuffer = context.createVertexBuffer(tileExtentArray, posAttributes.members);\n this.tileExtentSegments = SegmentVector.simpleSegment(0, 0, 4, 2);\n\n const debugArray = new PosArray();\n debugArray.emplaceBack(0, 0);\n debugArray.emplaceBack(EXTENT, 0);\n debugArray.emplaceBack(0, EXTENT);\n debugArray.emplaceBack(EXTENT, EXTENT);\n this.debugBuffer = context.createVertexBuffer(debugArray, posAttributes.members);\n this.debugSegments = SegmentVector.simpleSegment(0, 0, 4, 5);\n\n const rasterBoundsArray = new RasterBoundsArray();\n rasterBoundsArray.emplaceBack(0, 0, 0, 0);\n rasterBoundsArray.emplaceBack(EXTENT, 0, EXTENT, 0);\n rasterBoundsArray.emplaceBack(0, EXTENT, 0, EXTENT);\n rasterBoundsArray.emplaceBack(EXTENT, EXTENT, EXTENT, EXTENT);\n this.rasterBoundsBuffer = context.createVertexBuffer(rasterBoundsArray, rasterBoundsAttributes.members);\n this.rasterBoundsSegments = SegmentVector.simpleSegment(0, 0, 4, 2);\n\n const viewportArray = new PosArray();\n viewportArray.emplaceBack(0, 0);\n viewportArray.emplaceBack(1, 0);\n viewportArray.emplaceBack(0, 1);\n viewportArray.emplaceBack(1, 1);\n this.viewportBuffer = context.createVertexBuffer(viewportArray, posAttributes.members);\n this.viewportSegments = SegmentVector.simpleSegment(0, 0, 4, 2);\n\n const tileLineStripIndices = new LineStripIndexArray();\n tileLineStripIndices.emplaceBack(0);\n tileLineStripIndices.emplaceBack(1);\n tileLineStripIndices.emplaceBack(3);\n tileLineStripIndices.emplaceBack(2);\n tileLineStripIndices.emplaceBack(0);\n this.tileBorderIndexBuffer = context.createIndexBuffer(tileLineStripIndices);\n\n const quadTriangleIndices = new TriangleIndexArray();\n quadTriangleIndices.emplaceBack(0, 1, 2);\n quadTriangleIndices.emplaceBack(2, 1, 3);\n this.quadTriangleIndexBuffer = context.createIndexBuffer(quadTriangleIndices);\n\n this.emptyTexture = new Texture(context, {\n width: 1,\n height: 1,\n data: new Uint8Array([0, 0, 0, 0])\n }, context.gl.RGBA);\n\n const gl = this.context.gl;\n this.stencilClearMode = new StencilMode({func: gl.ALWAYS, mask: 0}, 0x0, 0xFF, gl.ZERO, gl.ZERO, gl.ZERO);\n }\n\n /*\n * Reset the drawing canvas by clearing the stencil buffer so that we can draw\n * new tiles at the same location, while retaining previously drawn pixels.\n */\n clearStencil() {\n const context = this.context;\n const gl = context.gl;\n\n this.nextStencilID = 1;\n this.currentStencilSource = undefined;\n\n // As a temporary workaround for https://github.com/mapbox/mapbox-gl-js/issues/5490,\n // pending an upstream fix, we draw a fullscreen stencil=0 clipping mask here,\n // effectively clearing the stencil buffer: once an upstream patch lands, remove\n // this function in favor of context.clear({ stencil: 0x0 })\n\n const matrix = mat4.create();\n mat4.ortho(matrix, 0, this.width, this.height, 0, 0, 1);\n mat4.scale(matrix, matrix, [gl.drawingBufferWidth, gl.drawingBufferHeight, 0]);\n\n this.useProgram('clippingMask').draw(context, gl.TRIANGLES,\n DepthMode.disabled, this.stencilClearMode, ColorMode.disabled, CullFaceMode.disabled,\n clippingMaskUniformValues(matrix),\n '$clipping', this.viewportBuffer,\n this.quadTriangleIndexBuffer, this.viewportSegments);\n }\n\n _renderTileClippingMasks(layer: StyleLayer, tileIDs: Array) {\n if (this.currentStencilSource === layer.source || !layer.isTileClipped() || !tileIDs || !tileIDs.length) return;\n\n this.currentStencilSource = layer.source;\n\n const context = this.context;\n const gl = context.gl;\n\n if (this.nextStencilID + tileIDs.length > 256) {\n // we'll run out of fresh IDs so we need to clear and start from scratch\n this.clearStencil();\n }\n\n context.setColorMode(ColorMode.disabled);\n context.setDepthMode(DepthMode.disabled);\n\n const program = this.useProgram('clippingMask');\n\n this._tileClippingMaskIDs = {};\n\n for (const tileID of tileIDs) {\n const id = this._tileClippingMaskIDs[tileID.key] = this.nextStencilID++;\n\n program.draw(context, gl.TRIANGLES, DepthMode.disabled,\n // Tests will always pass, and ref value will be written to stencil buffer.\n new StencilMode({func: gl.ALWAYS, mask: 0}, id, 0xFF, gl.KEEP, gl.KEEP, gl.REPLACE),\n ColorMode.disabled, CullFaceMode.disabled, clippingMaskUniformValues(tileID.posMatrix),\n '$clipping', this.tileExtentBuffer,\n this.quadTriangleIndexBuffer, this.tileExtentSegments);\n }\n }\n\n stencilModeFor3D(): StencilMode {\n this.currentStencilSource = undefined;\n\n if (this.nextStencilID + 1 > 256) {\n this.clearStencil();\n }\n\n const id = this.nextStencilID++;\n const gl = this.context.gl;\n return new StencilMode({func: gl.NOTEQUAL, mask: 0xFF}, id, 0xFF, gl.KEEP, gl.KEEP, gl.REPLACE);\n }\n\n stencilModeForClipping(tileID: OverscaledTileID): StencilMode {\n const gl = this.context.gl;\n return new StencilMode({func: gl.EQUAL, mask: 0xFF}, this._tileClippingMaskIDs[tileID.key], 0x00, gl.KEEP, gl.KEEP, gl.REPLACE);\n }\n\n /*\n * Sort coordinates by Z as drawing tiles is done in Z-descending order.\n * All children with the same Z write the same stencil value. Children\n * stencil values are greater than parent's. This is used only for raster\n * and raster-dem tiles, which are already clipped to tile boundaries, to\n * mask area of tile overlapped by children tiles.\n * Stencil ref values continue range used in _tileClippingMaskIDs.\n *\n * Returns [StencilMode for tile overscaleZ map, sortedCoords].\n */\n stencilConfigForOverlap(tileIDs: Array): [{[_: number]: $ReadOnly}, Array] {\n const gl = this.context.gl;\n const coords = tileIDs.sort((a, b) => b.overscaledZ - a.overscaledZ);\n const minTileZ = coords[coords.length - 1].overscaledZ;\n const stencilValues = coords[0].overscaledZ - minTileZ + 1;\n if (stencilValues > 1) {\n this.currentStencilSource = undefined;\n if (this.nextStencilID + stencilValues > 256) {\n this.clearStencil();\n }\n const zToStencilMode = {};\n for (let i = 0; i < stencilValues; i++) {\n zToStencilMode[i + minTileZ] = new StencilMode({func: gl.GEQUAL, mask: 0xFF}, i + this.nextStencilID, 0xFF, gl.KEEP, gl.KEEP, gl.REPLACE);\n }\n this.nextStencilID += stencilValues;\n return [zToStencilMode, coords];\n }\n return [{[minTileZ]: StencilMode.disabled}, coords];\n }\n\n colorModeForRenderPass(): $ReadOnly {\n const gl = this.context.gl;\n if (this._showOverdrawInspector) {\n const numOverdrawSteps = 8;\n const a = 1 / numOverdrawSteps;\n\n return new ColorMode([gl.CONSTANT_COLOR, gl.ONE], new Color(a, a, a, 0), [true, true, true, true]);\n } else if (this.renderPass === 'opaque') {\n return ColorMode.unblended;\n } else {\n return ColorMode.alphaBlended;\n }\n }\n\n depthModeForSublayer(n: number, mask: DepthMaskType, func: ?DepthFuncType): $ReadOnly {\n if (!this.opaquePassEnabledForLayer()) return DepthMode.disabled;\n const depth = 1 - ((1 + this.currentLayer) * this.numSublayers + n) * this.depthEpsilon;\n return new DepthMode(func || this.context.gl.LEQUAL, mask, [depth, depth]);\n }\n\n /*\n * The opaque pass and 3D layers both use the depth buffer.\n * Layers drawn above 3D layers need to be drawn using the\n * painter's algorithm so that they appear above 3D features.\n * This returns true for layers that can be drawn using the\n * opaque pass.\n */\n opaquePassEnabledForLayer() {\n return this.currentLayer < this.opaquePassCutoff;\n }\n\n render(style: Style, options: PainterOptions) {\n this.style = style;\n this.options = options;\n\n this.lineAtlas = style.lineAtlas;\n this.imageManager = style.imageManager;\n this.glyphManager = style.glyphManager;\n\n this.symbolFadeChange = style.placement.symbolFadeChange(browser.now());\n\n this.imageManager.beginFrame();\n\n const layerIds = this.style._order;\n const sourceCaches = this.style.sourceCaches;\n\n for (const id in sourceCaches) {\n const sourceCache = sourceCaches[id];\n if (sourceCache.used) {\n sourceCache.prepare(this.context);\n }\n }\n\n const coordsAscending: {[_: string]: Array} = {};\n const coordsDescending: {[_: string]: Array} = {};\n const coordsDescendingSymbol: {[_: string]: Array} = {};\n\n for (const id in sourceCaches) {\n const sourceCache = sourceCaches[id];\n coordsAscending[id] = sourceCache.getVisibleCoordinates();\n coordsDescending[id] = coordsAscending[id].slice().reverse();\n coordsDescendingSymbol[id] = sourceCache.getVisibleCoordinates(true).reverse();\n }\n\n this.opaquePassCutoff = Infinity;\n for (let i = 0; i < layerIds.length; i++) {\n const layerId = layerIds[i];\n if (this.style._layers[layerId].is3D()) {\n this.opaquePassCutoff = i;\n break;\n }\n }\n\n // Offscreen pass ===============================================\n // We first do all rendering that requires rendering to a separate\n // framebuffer, and then save those for rendering back to the map\n // later: in doing this we avoid doing expensive framebuffer restores.\n this.renderPass = 'offscreen';\n\n for (const layerId of layerIds) {\n const layer = this.style._layers[layerId];\n if (!layer.hasOffscreenPass() || layer.isHidden(this.transform.zoom)) continue;\n\n const coords = coordsDescending[layer.source];\n if (layer.type !== 'custom' && !coords.length) continue;\n\n this.renderLayer(this, sourceCaches[layer.source], layer, coords);\n }\n\n // Rebind the main framebuffer now that all offscreen layers have been rendered:\n this.context.bindFramebuffer.set(null);\n\n // Clear buffers in preparation for drawing to the main framebuffer\n this.context.clear({color: options.showOverdrawInspector ? Color.black : Color.transparent, depth: 1});\n this.clearStencil();\n\n this._showOverdrawInspector = options.showOverdrawInspector;\n this.depthRangeFor3D = [0, 1 - ((style._order.length + 2) * this.numSublayers * this.depthEpsilon)];\n\n // Opaque pass ===============================================\n // Draw opaque layers top-to-bottom first.\n this.renderPass = 'opaque';\n\n for (this.currentLayer = layerIds.length - 1; this.currentLayer >= 0; this.currentLayer--) {\n const layer = this.style._layers[layerIds[this.currentLayer]];\n const sourceCache = sourceCaches[layer.source];\n const coords = coordsAscending[layer.source];\n\n this._renderTileClippingMasks(layer, coords);\n this.renderLayer(this, sourceCache, layer, coords);\n }\n\n // Translucent pass ===============================================\n // Draw all other layers bottom-to-top.\n this.renderPass = 'translucent';\n\n for (this.currentLayer = 0; this.currentLayer < layerIds.length; this.currentLayer++) {\n const layer = this.style._layers[layerIds[this.currentLayer]];\n const sourceCache = sourceCaches[layer.source];\n\n // For symbol layers in the translucent pass, we add extra tiles to the renderable set\n // for cross-tile symbol fading. Symbol layers don't use tile clipping, so no need to render\n // separate clipping masks\n const coords = (layer.type === 'symbol' ? coordsDescendingSymbol : coordsDescending)[layer.source];\n\n this._renderTileClippingMasks(layer, coordsAscending[layer.source]);\n this.renderLayer(this, sourceCache, layer, coords);\n }\n\n if (this.options.showTileBoundaries) {\n //Use source with highest maxzoom\n let selectedSource;\n let sourceCache;\n const layers = values(this.style._layers);\n layers.forEach((layer) => {\n if (layer.source && !layer.isHidden(this.transform.zoom)) {\n if (layer.source !== (sourceCache && sourceCache.id)) {\n sourceCache = this.style.sourceCaches[layer.source];\n }\n if (!selectedSource || (selectedSource.getSource().maxzoom < sourceCache.getSource().maxzoom)) {\n selectedSource = sourceCache;\n }\n }\n });\n if (selectedSource) {\n draw.debug(this, selectedSource, selectedSource.getVisibleCoordinates());\n }\n }\n\n if (this.options.showPadding) {\n drawDebugPadding(this);\n }\n\n // Set defaults for most GL values so that anyone using the state after the render\n // encounters more expected values.\n this.context.setDefault();\n }\n\n renderLayer(painter: Painter, sourceCache: SourceCache, layer: StyleLayer, coords: Array) {\n if (layer.isHidden(this.transform.zoom)) return;\n if (layer.type !== 'background' && layer.type !== 'custom' && !coords.length) return;\n this.id = layer.id;\n\n this.gpuTimingStart(layer);\n draw[layer.type](painter, sourceCache, layer, coords, this.style.placement.variableOffsets);\n this.gpuTimingEnd();\n }\n\n gpuTimingStart(layer: StyleLayer) {\n if (!this.options.gpuTiming) return;\n const ext = this.context.extTimerQuery;\n // This tries to time the draw call itself, but note that the cost for drawing a layer\n // may be dominated by the cost of uploading vertices to the GPU.\n // To instrument that, we'd need to pass the layerTimers object down into the bucket\n // uploading logic.\n let layerTimer = this.gpuTimers[layer.id];\n if (!layerTimer) {\n layerTimer = this.gpuTimers[layer.id] = {\n calls: 0,\n cpuTime: 0,\n query: ext.createQueryEXT()\n };\n }\n layerTimer.calls++;\n ext.beginQueryEXT(ext.TIME_ELAPSED_EXT, layerTimer.query);\n }\n\n gpuTimingEnd() {\n if (!this.options.gpuTiming) return;\n const ext = this.context.extTimerQuery;\n ext.endQueryEXT(ext.TIME_ELAPSED_EXT);\n }\n\n collectGpuTimers() {\n const currentLayerTimers = this.gpuTimers;\n this.gpuTimers = {};\n return currentLayerTimers;\n }\n\n queryGpuTimers(gpuTimers: {[_: string]: any}) {\n const layers = {};\n for (const layerId in gpuTimers) {\n const gpuTimer = gpuTimers[layerId];\n const ext = this.context.extTimerQuery;\n const gpuTime = ext.getQueryObjectEXT(gpuTimer.query, ext.QUERY_RESULT_EXT) / (1000 * 1000);\n ext.deleteQueryEXT(gpuTimer.query);\n layers[layerId] = gpuTime;\n }\n return layers;\n }\n\n /**\n * Transform a matrix to incorporate the *-translate and *-translate-anchor properties into it.\n * @param inViewportPixelUnitsUnits True when the units accepted by the matrix are in viewport pixels instead of tile units.\n * @returns {Float32Array} matrix\n * @private\n */\n translatePosMatrix(matrix: Float32Array, tile: Tile, translate: [number, number], translateAnchor: 'map' | 'viewport', inViewportPixelUnitsUnits?: boolean) {\n if (!translate[0] && !translate[1]) return matrix;\n\n const angle = inViewportPixelUnitsUnits ?\n (translateAnchor === 'map' ? this.transform.angle : 0) :\n (translateAnchor === 'viewport' ? -this.transform.angle : 0);\n\n if (angle) {\n const sinA = Math.sin(angle);\n const cosA = Math.cos(angle);\n translate = [\n translate[0] * cosA - translate[1] * sinA,\n translate[0] * sinA + translate[1] * cosA\n ];\n }\n\n const translation = [\n inViewportPixelUnitsUnits ? translate[0] : pixelsToTileUnits(tile, translate[0], this.transform.zoom),\n inViewportPixelUnitsUnits ? translate[1] : pixelsToTileUnits(tile, translate[1], this.transform.zoom),\n 0\n ];\n\n const translatedMatrix = new Float32Array(16);\n mat4.translate(translatedMatrix, matrix, translation);\n return translatedMatrix;\n }\n\n saveTileTexture(texture: Texture) {\n const textures = this._tileTextures[texture.size[0]];\n if (!textures) {\n this._tileTextures[texture.size[0]] = [texture];\n } else {\n textures.push(texture);\n }\n }\n\n getTileTexture(size: number) {\n const textures = this._tileTextures[size];\n return textures && textures.length > 0 ? textures.pop() : null;\n }\n\n /**\n * Checks whether a pattern image is needed, and if it is, whether it is not loaded.\n *\n * @returns true if a needed image is missing and rendering needs to be skipped.\n * @private\n */\n isPatternMissing(image: ?CrossFaded): boolean {\n if (!image) return false;\n if (!image.from || !image.to) return true;\n const imagePosA = this.imageManager.getPattern(image.from.toString());\n const imagePosB = this.imageManager.getPattern(image.to.toString());\n return !imagePosA || !imagePosB;\n }\n\n useProgram(name: string, programConfiguration: ?ProgramConfiguration): Program {\n this.cache = this.cache || {};\n const key = `${name}${programConfiguration ? programConfiguration.cacheKey : ''}${this._showOverdrawInspector ? '/overdraw' : ''}`;\n if (!this.cache[key]) {\n this.cache[key] = new Program(this.context, name, shaders[name], programConfiguration, programUniforms[name], this._showOverdrawInspector);\n }\n return this.cache[key];\n }\n\n /*\n * Reset some GL state to default values to avoid hard-to-debug bugs\n * in custom layers.\n */\n setCustomLayerDefaults() {\n // Prevent custom layers from unintentionally modify the last VAO used.\n // All other state is state is restored on it's own, but for VAOs it's\n // simpler to unbind so that we don't have to track the state of VAOs.\n this.context.unbindVAO();\n\n // The default values for this state is meaningful and often expected.\n // Leaving this state dirty could cause a lot of confusion for users.\n this.context.cullFace.setDefault();\n this.context.activeTexture.setDefault();\n this.context.pixelStoreUnpack.setDefault();\n this.context.pixelStoreUnpackPremultiplyAlpha.setDefault();\n this.context.pixelStoreUnpackFlipY.setDefault();\n }\n\n /*\n * Set GL state that is shared by all layers.\n */\n setBaseState() {\n const gl = this.context.gl;\n this.context.cullFace.set(false);\n this.context.viewport.set([0, 0, this.width, this.height]);\n this.context.blendEquation.set(gl.FUNC_ADD);\n }\n\n initDebugOverlayCanvas() {\n if (this.debugOverlayCanvas == null) {\n this.debugOverlayCanvas = window.document.createElement('canvas');\n this.debugOverlayCanvas.width = 512;\n this.debugOverlayCanvas.height = 512;\n const gl = this.context.gl;\n this.debugOverlayTexture = new Texture(this.context, this.debugOverlayCanvas, gl.RGBA);\n }\n }\n\n destroy() {\n this.emptyTexture.destroy();\n if (this.debugOverlayTexture) {\n this.debugOverlayTexture.destroy();\n }\n }\n}\n\nexport default Painter;\n","// @flow\n\nimport StencilMode from '../gl/stencil_mode';\nimport DepthMode from '../gl/depth_mode';\nimport CullFaceMode from '../gl/cull_face_mode';\nimport Program from './program';\nimport {circleUniformValues} from './program/circle_program';\nimport SegmentVector from '../data/segment';\nimport {OverscaledTileID} from '../source/tile_id';\n\nimport type Painter from './painter';\nimport type SourceCache from '../source/source_cache';\nimport type CircleStyleLayer from '../style/style_layer/circle_style_layer';\nimport type CircleBucket from '../data/bucket/circle_bucket';\nimport type ProgramConfiguration from '../data/program_configuration';\nimport type VertexBuffer from '../gl/vertex_buffer';\nimport type IndexBuffer from '../gl/index_buffer';\nimport type {UniformValues} from './uniform_binding';\nimport type {CircleUniformsType} from './program/circle_program';\n\nexport default drawCircles;\n\ntype TileRenderState = {\n programConfiguration: ProgramConfiguration,\n program: Program<*>,\n layoutVertexBuffer: VertexBuffer,\n indexBuffer: IndexBuffer,\n uniformValues: UniformValues\n};\n\ntype SegmentsTileRenderState = {\n segments: SegmentVector,\n sortKey: number,\n state: TileRenderState\n};\n\nfunction drawCircles(painter: Painter, sourceCache: SourceCache, layer: CircleStyleLayer, coords: Array) {\n if (painter.renderPass !== 'translucent') return;\n\n const opacity = layer.paint.get('circle-opacity');\n const strokeWidth = layer.paint.get('circle-stroke-width');\n const strokeOpacity = layer.paint.get('circle-stroke-opacity');\n const sortFeaturesByKey = !layer.layout.get('circle-sort-key').isConstant();\n\n if (opacity.constantOr(1) === 0 && (strokeWidth.constantOr(1) === 0 || strokeOpacity.constantOr(1) === 0)) {\n return;\n }\n\n const context = painter.context;\n const gl = context.gl;\n\n const depthMode = painter.depthModeForSublayer(0, DepthMode.ReadOnly);\n // Turn off stencil testing to allow circles to be drawn across boundaries,\n // so that large circles are not clipped to tiles\n const stencilMode = StencilMode.disabled;\n const colorMode = painter.colorModeForRenderPass();\n\n const segmentsRenderStates: Array = [];\n\n for (let i = 0; i < coords.length; i++) {\n const coord = coords[i];\n\n const tile = sourceCache.getTile(coord);\n const bucket: ?CircleBucket<*> = (tile.getBucket(layer): any);\n if (!bucket) continue;\n\n const programConfiguration = bucket.programConfigurations.get(layer.id);\n const program = painter.useProgram('circle', programConfiguration);\n const layoutVertexBuffer = bucket.layoutVertexBuffer;\n const indexBuffer = bucket.indexBuffer;\n const uniformValues = circleUniformValues(painter, coord, tile, layer);\n\n const state: TileRenderState = {\n programConfiguration,\n program,\n layoutVertexBuffer,\n indexBuffer,\n uniformValues,\n };\n\n if (sortFeaturesByKey) {\n const oldSegments = bucket.segments.get();\n for (const segment of oldSegments) {\n segmentsRenderStates.push({\n segments: new SegmentVector([segment]),\n sortKey: ((segment.sortKey: any): number),\n state\n });\n }\n } else {\n segmentsRenderStates.push({\n segments: bucket.segments,\n sortKey: 0,\n state\n });\n }\n\n }\n\n if (sortFeaturesByKey) {\n segmentsRenderStates.sort((a, b) => a.sortKey - b.sortKey);\n }\n\n for (const segmentsState of segmentsRenderStates) {\n const {programConfiguration, program, layoutVertexBuffer, indexBuffer, uniformValues} = segmentsState.state;\n const segments = segmentsState.segments;\n\n program.draw(context, gl.TRIANGLES, depthMode, stencilMode, colorMode, CullFaceMode.disabled,\n uniformValues, layer.id,\n layoutVertexBuffer, indexBuffer, segments,\n layer.paint, painter.transform.zoom, programConfiguration);\n }\n}\n","// @flow\n\nimport Texture from './texture';\nimport Color from '../style-spec/util/color';\nimport DepthMode from '../gl/depth_mode';\nimport StencilMode from '../gl/stencil_mode';\nimport ColorMode from '../gl/color_mode';\nimport CullFaceMode from '../gl/cull_face_mode';\nimport {\n heatmapUniformValues,\n heatmapTextureUniformValues\n} from './program/heatmap_program';\n\nimport type Painter from './painter';\nimport type SourceCache from '../source/source_cache';\nimport type HeatmapStyleLayer from '../style/style_layer/heatmap_style_layer';\nimport type HeatmapBucket from '../data/bucket/heatmap_bucket';\nimport type {OverscaledTileID} from '../source/tile_id';\n\nexport default drawHeatmap;\n\nfunction drawHeatmap(painter: Painter, sourceCache: SourceCache, layer: HeatmapStyleLayer, coords: Array) {\n if (layer.paint.get('heatmap-opacity') === 0) {\n return;\n }\n\n if (painter.renderPass === 'offscreen') {\n const context = painter.context;\n const gl = context.gl;\n\n // Allow kernels to be drawn across boundaries, so that\n // large kernels are not clipped to tiles\n const stencilMode = StencilMode.disabled;\n // Turn on additive blending for kernels, which is a key aspect of kernel density estimation formula\n const colorMode = new ColorMode([gl.ONE, gl.ONE], Color.transparent, [true, true, true, true]);\n\n bindFramebuffer(context, painter, layer);\n\n context.clear({color: Color.transparent});\n\n for (let i = 0; i < coords.length; i++) {\n const coord = coords[i];\n\n // Skip tiles that have uncovered parents to avoid flickering; we don't need\n // to use complex tile masking here because the change between zoom levels is subtle,\n // so it's fine to simply render the parent until all its 4 children are loaded\n if (sourceCache.hasRenderableParent(coord)) continue;\n\n const tile = sourceCache.getTile(coord);\n const bucket: ?HeatmapBucket = (tile.getBucket(layer): any);\n if (!bucket) continue;\n\n const programConfiguration = bucket.programConfigurations.get(layer.id);\n const program = painter.useProgram('heatmap', programConfiguration);\n const {zoom} = painter.transform;\n\n program.draw(context, gl.TRIANGLES, DepthMode.disabled, stencilMode, colorMode, CullFaceMode.disabled,\n heatmapUniformValues(coord.posMatrix,\n tile, zoom, layer.paint.get('heatmap-intensity')),\n layer.id, bucket.layoutVertexBuffer, bucket.indexBuffer,\n bucket.segments, layer.paint, painter.transform.zoom,\n programConfiguration);\n }\n\n context.viewport.set([0, 0, painter.width, painter.height]);\n\n } else if (painter.renderPass === 'translucent') {\n painter.context.setColorMode(painter.colorModeForRenderPass());\n renderTextureToMap(painter, layer);\n }\n}\n\nfunction bindFramebuffer(context, painter, layer) {\n const gl = context.gl;\n context.activeTexture.set(gl.TEXTURE1);\n\n // Use a 4x downscaled screen texture for better performance\n context.viewport.set([0, 0, painter.width / 4, painter.height / 4]);\n\n let fbo = layer.heatmapFbo;\n\n if (!fbo) {\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n\n fbo = layer.heatmapFbo = context.createFramebuffer(painter.width / 4, painter.height / 4, false);\n\n bindTextureToFramebuffer(context, painter, texture, fbo);\n\n } else {\n gl.bindTexture(gl.TEXTURE_2D, fbo.colorAttachment.get());\n context.bindFramebuffer.set(fbo.framebuffer);\n }\n}\n\nfunction bindTextureToFramebuffer(context, painter, texture, fbo) {\n const gl = context.gl;\n // Use the higher precision half-float texture where available (producing much smoother looking heatmaps);\n // Otherwise, fall back to a low precision texture\n const internalFormat = context.extRenderToTextureHalfFloat ? context.extTextureHalfFloat.HALF_FLOAT_OES : gl.UNSIGNED_BYTE;\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, painter.width / 4, painter.height / 4, 0, gl.RGBA, internalFormat, null);\n fbo.colorAttachment.set(texture);\n}\n\nfunction renderTextureToMap(painter, layer) {\n const context = painter.context;\n const gl = context.gl;\n\n // Here we bind two different textures from which we'll sample in drawing\n // heatmaps: the kernel texture, prepared in the offscreen pass, and a\n // color ramp texture.\n const fbo = layer.heatmapFbo;\n if (!fbo) return;\n context.activeTexture.set(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_2D, fbo.colorAttachment.get());\n\n context.activeTexture.set(gl.TEXTURE1);\n let colorRampTexture = layer.colorRampTexture;\n if (!colorRampTexture) {\n colorRampTexture = layer.colorRampTexture = new Texture(context, layer.colorRamp, gl.RGBA);\n }\n colorRampTexture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n\n painter.useProgram('heatmapTexture').draw(context, gl.TRIANGLES,\n DepthMode.disabled, StencilMode.disabled, painter.colorModeForRenderPass(), CullFaceMode.disabled,\n heatmapTextureUniformValues(painter, layer, 0, 1),\n layer.id, painter.viewportBuffer, painter.quadTriangleIndexBuffer,\n painter.viewportSegments, layer.paint, painter.transform.zoom);\n}\n","// @flow\n\nimport DepthMode from '../gl/depth_mode';\nimport CullFaceMode from '../gl/cull_face_mode';\nimport Texture from './texture';\nimport {\n lineUniformValues,\n linePatternUniformValues,\n lineSDFUniformValues,\n lineGradientUniformValues\n} from './program/line_program';\n\nimport type Painter from './painter';\nimport type SourceCache from '../source/source_cache';\nimport type LineStyleLayer from '../style/style_layer/line_style_layer';\nimport type LineBucket from '../data/bucket/line_bucket';\nimport type {OverscaledTileID} from '../source/tile_id';\nimport {clamp, nextPowerOfTwo} from '../util/util';\nimport {renderColorRamp} from '../util/color_ramp';\nimport EXTENT from '../data/extent';\n\nexport default function drawLine(painter: Painter, sourceCache: SourceCache, layer: LineStyleLayer, coords: Array) {\n if (painter.renderPass !== 'translucent') return;\n\n const opacity = layer.paint.get('line-opacity');\n const width = layer.paint.get('line-width');\n if (opacity.constantOr(1) === 0 || width.constantOr(1) === 0) return;\n\n const depthMode = painter.depthModeForSublayer(0, DepthMode.ReadOnly);\n const colorMode = painter.colorModeForRenderPass();\n\n const dasharray = layer.paint.get('line-dasharray');\n const patternProperty = layer.paint.get('line-pattern');\n const image = patternProperty.constantOr((1: any));\n\n const gradient = layer.paint.get('line-gradient');\n const crossfade = layer.getCrossfadeParameters();\n\n const programId =\n image ? 'linePattern' :\n dasharray ? 'lineSDF' :\n gradient ? 'lineGradient' : 'line';\n\n const context = painter.context;\n const gl = context.gl;\n\n let firstTile = true;\n\n for (const coord of coords) {\n const tile = sourceCache.getTile(coord);\n\n if (image && !tile.patternsLoaded()) continue;\n\n const bucket: ?LineBucket = (tile.getBucket(layer): any);\n if (!bucket) continue;\n\n const programConfiguration = bucket.programConfigurations.get(layer.id);\n const prevProgram = painter.context.program.get();\n const program = painter.useProgram(programId, programConfiguration);\n const programChanged = firstTile || program.program !== prevProgram;\n\n const constantPattern = patternProperty.constantOr(null);\n if (constantPattern && tile.imageAtlas) {\n const atlas = tile.imageAtlas;\n const posTo = atlas.patternPositions[constantPattern.to.toString()];\n const posFrom = atlas.patternPositions[constantPattern.from.toString()];\n if (posTo && posFrom) programConfiguration.setConstantPatternPositions(posTo, posFrom);\n }\n\n const uniformValues = image ? linePatternUniformValues(painter, tile, layer, crossfade) :\n dasharray ? lineSDFUniformValues(painter, tile, layer, dasharray, crossfade) :\n gradient ? lineGradientUniformValues(painter, tile, layer, bucket.lineClipsArray.length) :\n lineUniformValues(painter, tile, layer);\n\n if (image) {\n context.activeTexture.set(gl.TEXTURE0);\n tile.imageAtlasTexture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n programConfiguration.updatePaintBuffers(crossfade);\n } else if (dasharray && (programChanged || painter.lineAtlas.dirty)) {\n context.activeTexture.set(gl.TEXTURE0);\n painter.lineAtlas.bind(context);\n } else if (gradient) {\n const layerGradient = bucket.gradients[layer.id];\n let gradientTexture = layerGradient.texture;\n if (layer.gradientVersion !== layerGradient.version) {\n let textureResolution = 256;\n if (layer.stepInterpolant) {\n const sourceMaxZoom = sourceCache.getSource().maxzoom;\n const potentialOverzoom = coord.canonical.z === sourceMaxZoom ?\n Math.ceil(1 << (painter.transform.maxZoom - coord.canonical.z)) : 1;\n const lineLength = bucket.maxLineLength / EXTENT;\n // Logical pixel tile size is 512px, and 1024px right before current zoom + 1\n const maxTilePixelSize = 1024;\n // Maximum possible texture coverage heuristic, bound by hardware max texture size\n const maxTextureCoverage = lineLength * maxTilePixelSize * potentialOverzoom;\n textureResolution = clamp(nextPowerOfTwo(maxTextureCoverage), 256, context.maxTextureSize);\n }\n layerGradient.gradient = renderColorRamp({\n expression: layer.gradientExpression(),\n evaluationKey: 'lineProgress',\n resolution: textureResolution,\n image: layerGradient.gradient || undefined,\n clips: bucket.lineClipsArray\n });\n if (layerGradient.texture) {\n layerGradient.texture.update(layerGradient.gradient);\n } else {\n layerGradient.texture = new Texture(context, layerGradient.gradient, gl.RGBA);\n }\n layerGradient.version = layer.gradientVersion;\n gradientTexture = layerGradient.texture;\n }\n context.activeTexture.set(gl.TEXTURE0);\n gradientTexture.bind(layer.stepInterpolant ? gl.NEAREST : gl.LINEAR, gl.CLAMP_TO_EDGE);\n }\n\n program.draw(context, gl.TRIANGLES, depthMode,\n painter.stencilModeForClipping(coord), colorMode, CullFaceMode.disabled, uniformValues,\n layer.id, bucket.layoutVertexBuffer, bucket.indexBuffer, bucket.segments,\n layer.paint, painter.transform.zoom, programConfiguration, bucket.layoutVertexBuffer2);\n\n firstTile = false;\n // once refactored so that bound texture state is managed, we'll also be able to remove this firstTile/programChanged logic\n }\n}\n","// @flow\n\nimport StencilMode from '../gl/stencil_mode';\nimport DepthMode from '../gl/depth_mode';\nimport CullFaceMode from '../gl/cull_face_mode';\nimport {\n backgroundUniformValues,\n backgroundPatternUniformValues\n} from './program/background_program';\n\nimport type Painter from './painter';\nimport type SourceCache from '../source/source_cache';\nimport type BackgroundStyleLayer from '../style/style_layer/background_style_layer';\n\nexport default drawBackground;\n\nfunction drawBackground(painter: Painter, sourceCache: SourceCache, layer: BackgroundStyleLayer) {\n const color = layer.paint.get('background-color');\n const opacity = layer.paint.get('background-opacity');\n\n if (opacity === 0) return;\n\n const context = painter.context;\n const gl = context.gl;\n const transform = painter.transform;\n const tileSize = transform.tileSize;\n const image = layer.paint.get('background-pattern');\n if (painter.isPatternMissing(image)) return;\n\n const pass = (!image && color.a === 1 && opacity === 1 && painter.opaquePassEnabledForLayer()) ? 'opaque' : 'translucent';\n if (painter.renderPass !== pass) return;\n\n const stencilMode = StencilMode.disabled;\n const depthMode = painter.depthModeForSublayer(0, pass === 'opaque' ? DepthMode.ReadWrite : DepthMode.ReadOnly);\n const colorMode = painter.colorModeForRenderPass();\n\n const program = painter.useProgram(image ? 'backgroundPattern' : 'background');\n\n const tileIDs = transform.coveringTiles({tileSize});\n\n if (image) {\n context.activeTexture.set(gl.TEXTURE0);\n painter.imageManager.bind(painter.context);\n }\n\n const crossfade = layer.getCrossfadeParameters();\n for (const tileID of tileIDs) {\n const matrix = painter.transform.calculatePosMatrix(tileID.toUnwrapped());\n const uniformValues = image ?\n backgroundPatternUniformValues(matrix, opacity, painter, image, {tileID, tileSize}, crossfade) :\n backgroundUniformValues(matrix, opacity, color);\n\n program.draw(context, gl.TRIANGLES, depthMode, stencilMode, colorMode, CullFaceMode.disabled,\n uniformValues, layer.id, painter.tileExtentBuffer,\n painter.quadTriangleIndexBuffer, painter.tileExtentSegments);\n }\n}\n","// @flow\n\nexport default drawCustom;\n\nimport DepthMode from '../gl/depth_mode';\nimport StencilMode from '../gl/stencil_mode';\n\nimport type Painter from './painter';\nimport type SourceCache from '../source/source_cache';\nimport type CustomStyleLayer from '../style/style_layer/custom_style_layer';\n\nfunction drawCustom(painter: Painter, sourceCache: SourceCache, layer: CustomStyleLayer) {\n\n const context = painter.context;\n const implementation = layer.implementation;\n\n if (painter.renderPass === 'offscreen') {\n\n const prerender = implementation.prerender;\n if (prerender) {\n painter.setCustomLayerDefaults();\n context.setColorMode(painter.colorModeForRenderPass());\n\n prerender.call(implementation, context.gl, painter.transform.customLayerMatrix());\n\n context.setDirty();\n painter.setBaseState();\n }\n\n } else if (painter.renderPass === 'translucent') {\n\n painter.setCustomLayerDefaults();\n\n context.setColorMode(painter.colorModeForRenderPass());\n context.setStencilMode(StencilMode.disabled);\n\n const depthMode = implementation.renderingMode === '3d' ?\n new DepthMode(painter.context.gl.LEQUAL, DepthMode.ReadWrite, painter.depthRangeFor3D) :\n painter.depthModeForSublayer(0, DepthMode.ReadOnly);\n\n context.setDepthMode(depthMode);\n\n implementation.render(context.gl, painter.transform.customLayerMatrix());\n\n context.setDirty();\n painter.setBaseState();\n context.bindFramebuffer.set(null);\n }\n}\n","// @flow\n\nimport {vec3, vec4} from 'gl-matrix';\nimport assert from 'assert';\n\nclass Frustum {\n points: Array>;\n planes: Array>;\n\n constructor(points_: Array>, planes_: Array>) {\n this.points = points_;\n this.planes = planes_;\n }\n\n static fromInvProjectionMatrix(invProj: Float64Array, worldSize: number, zoom: number): Frustum {\n const clipSpaceCorners = [\n [-1, 1, -1, 1],\n [ 1, 1, -1, 1],\n [ 1, -1, -1, 1],\n [-1, -1, -1, 1],\n [-1, 1, 1, 1],\n [ 1, 1, 1, 1],\n [ 1, -1, 1, 1],\n [-1, -1, 1, 1]\n ];\n\n const scale = Math.pow(2, zoom);\n\n // Transform frustum corner points from clip space to tile space\n const frustumCoords = clipSpaceCorners\n .map(v => vec4.transformMat4([], v, invProj))\n .map(v => vec4.scale([], v, 1.0 / v[3] / worldSize * scale));\n\n const frustumPlanePointIndices = [\n [0, 1, 2], // near\n [6, 5, 4], // far\n [0, 3, 7], // left\n [2, 1, 5], // right\n [3, 2, 6], // bottom\n [0, 4, 5] // top\n ];\n\n const frustumPlanes = frustumPlanePointIndices.map((p: Array) => {\n const a = vec3.sub([], frustumCoords[p[0]], frustumCoords[p[1]]);\n const b = vec3.sub([], frustumCoords[p[2]], frustumCoords[p[1]]);\n const n = vec3.normalize([], vec3.cross([], a, b));\n const d = -vec3.dot(n, frustumCoords[p[1]]);\n return n.concat(d);\n });\n\n return new Frustum(frustumCoords, frustumPlanes);\n }\n}\n\nclass Aabb {\n min: vec3;\n max: vec3;\n center: vec3;\n\n constructor(min_: vec3, max_: vec3) {\n this.min = min_;\n this.max = max_;\n this.center = vec3.scale([], vec3.add([], this.min, this.max), 0.5);\n }\n\n quadrant(index: number): Aabb {\n const split = [(index % 2) === 0, index < 2];\n const qMin = vec3.clone(this.min);\n const qMax = vec3.clone(this.max);\n for (let axis = 0; axis < split.length; axis++) {\n qMin[axis] = split[axis] ? this.min[axis] : this.center[axis];\n qMax[axis] = split[axis] ? this.center[axis] : this.max[axis];\n }\n // Elevation is always constant, hence quadrant.max.z = this.max.z\n qMax[2] = this.max[2];\n return new Aabb(qMin, qMax);\n }\n\n distanceX(point: Array): number {\n const pointOnAabb = Math.max(Math.min(this.max[0], point[0]), this.min[0]);\n return pointOnAabb - point[0];\n }\n\n distanceY(point: Array): number {\n const pointOnAabb = Math.max(Math.min(this.max[1], point[1]), this.min[1]);\n return pointOnAabb - point[1];\n }\n\n // Performs a frustum-aabb intersection test. Returns 0 if there's no intersection,\n // 1 if shapes are intersecting and 2 if the aabb if fully inside the frustum.\n intersects(frustum: Frustum): number {\n // Execute separating axis test between two convex objects to find intersections\n // Each frustum plane together with 3 major axes define the separating axes\n // Note: test only 4 points as both min and max points have equal elevation\n assert(this.min[2] === 0 && this.max[2] === 0);\n\n const aabbPoints = [\n [this.min[0], this.min[1], 0.0, 1],\n [this.max[0], this.min[1], 0.0, 1],\n [this.max[0], this.max[1], 0.0, 1],\n [this.min[0], this.max[1], 0.0, 1]\n ];\n\n let fullyInside = true;\n\n for (let p = 0; p < frustum.planes.length; p++) {\n const plane = frustum.planes[p];\n let pointsInside = 0;\n\n for (let i = 0; i < aabbPoints.length; i++) {\n pointsInside += vec4.dot(plane, aabbPoints[i]) >= 0;\n }\n\n if (pointsInside === 0)\n return 0;\n\n if (pointsInside !== aabbPoints.length)\n fullyInside = false;\n }\n\n if (fullyInside)\n return 2;\n\n for (let axis = 0; axis < 3; axis++) {\n let projMin = Number.MAX_VALUE;\n let projMax = -Number.MAX_VALUE;\n\n for (let p = 0; p < frustum.points.length; p++) {\n const projectedPoint = frustum.points[p][axis] - this.min[axis];\n\n projMin = Math.min(projMin, projectedPoint);\n projMax = Math.max(projMax, projectedPoint);\n }\n\n if (projMax < 0 || projMin > this.max[axis] - this.min[axis])\n return 0;\n }\n\n return 1;\n }\n}\nexport {\n Aabb,\n Frustum\n};\n","// @flow\nimport {number} from \"../style-spec/util/interpolate\";\nimport Point from \"@mapbox/point-geometry\";\nimport {clamp} from \"../util/util\";\n\n/**\n * An `EdgeInset` object represents screen space padding applied to the edges of the viewport.\n * This shifts the apprent center or the vanishing point of the map. This is useful for adding floating UI elements\n * on top of the map and having the vanishing point shift as UI elements resize.\n *\n * @param {number} [top=0]\n * @param {number} [bottom=0]\n * @param {number} [left=0]\n * @param {number} [right=0]\n */\nclass EdgeInsets {\n top: number;\n bottom: number;\n left: number;\n right: number;\n\n constructor(top: number = 0, bottom: number = 0, left: number = 0, right: number = 0) {\n if (isNaN(top) || top < 0 ||\n isNaN(bottom) || bottom < 0 ||\n isNaN(left) || left < 0 ||\n isNaN(right) || right < 0\n ) {\n throw new Error('Invalid value for edge-insets, top, bottom, left and right must all be numbers');\n }\n\n this.top = top;\n this.bottom = bottom;\n this.left = left;\n this.right = right;\n }\n\n /**\n * Interpolates the inset in-place.\n * This maintains the current inset value for any inset not present in `target`.\n * @param {PaddingOptions | EdgeInsets} start interpolation start\n * @param {PaddingOptions} target interpolation target\n * @param {number} t interpolation step/weight\n * @returns {EdgeInsets} the insets\n * @memberof EdgeInsets\n */\n interpolate(start: PaddingOptions | EdgeInsets, target: PaddingOptions, t: number): EdgeInsets {\n if (target.top != null && start.top != null) this.top = number(start.top, target.top, t);\n if (target.bottom != null && start.bottom != null) this.bottom = number(start.bottom, target.bottom, t);\n if (target.left != null && start.left != null) this.left = number(start.left, target.left, t);\n if (target.right != null && start.right != null) this.right = number(start.right, target.right, t);\n\n return this;\n }\n\n /**\n * Utility method that computes the new apprent center or vanishing point after applying insets.\n * This is in pixels and with the top left being (0.0) and +y being downwards.\n *\n * @param {number} width the width\n * @param {number} height the height\n * @returns {Point} the point\n * @memberof EdgeInsets\n */\n getCenter(width: number, height: number): Point {\n // Clamp insets so they never overflow width/height and always calculate a valid center\n const x = clamp((this.left + width - this.right) / 2, 0, width);\n const y = clamp((this.top + height - this.bottom) / 2, 0, height);\n\n return new Point(x, y);\n }\n\n equals(other: PaddingOptions): boolean {\n return this.top === other.top &&\n this.bottom === other.bottom &&\n this.left === other.left &&\n this.right === other.right;\n }\n\n clone(): EdgeInsets {\n return new EdgeInsets(this.top, this.bottom, this.left, this.right);\n }\n\n /**\n * Returns the current state as json, useful when you want to have a\n * read-only representation of the inset.\n *\n * @returns {PaddingOptions} state as json\n * @memberof EdgeInsets\n */\n toJSON(): PaddingOptions {\n return {\n top: this.top,\n bottom: this.bottom,\n left: this.left,\n right: this.right\n };\n }\n}\n\nexport type PaddingOptions = {top: ?number, bottom: ?number, right: ?number, left: ?number};\n\nexport default EdgeInsets;\n","// @flow\n\nimport LngLat from './lng_lat';\nimport LngLatBounds from './lng_lat_bounds';\nimport MercatorCoordinate, {mercatorXfromLng, mercatorYfromLat, mercatorZfromAltitude} from './mercator_coordinate';\nimport Point from '@mapbox/point-geometry';\nimport {wrap, clamp} from '../util/util';\nimport {number as interpolate} from '../style-spec/util/interpolate';\nimport EXTENT from '../data/extent';\nimport {vec4, mat4, mat2, vec2} from 'gl-matrix';\nimport {Aabb, Frustum} from '../util/primitives.js';\nimport EdgeInsets from './edge_insets';\n\nimport {UnwrappedTileID, OverscaledTileID, CanonicalTileID} from '../source/tile_id';\nimport type {PaddingOptions} from './edge_insets';\n\n/**\n * A single transform, generally used for a single tile to be\n * scaled, rotated, and zoomed.\n * @private\n */\nclass Transform {\n tileSize: number;\n tileZoom: number;\n lngRange: ?[number, number];\n latRange: ?[number, number];\n maxValidLatitude: number;\n scale: number;\n width: number;\n height: number;\n angle: number;\n rotationMatrix: Float64Array;\n zoomFraction: number;\n pixelsToGLUnits: [number, number];\n cameraToCenterDistance: number;\n mercatorMatrix: Array;\n projMatrix: Float64Array;\n invProjMatrix: Float64Array;\n alignedProjMatrix: Float64Array;\n pixelMatrix: Float64Array;\n pixelMatrixInverse: Float64Array;\n glCoordMatrix: Float32Array;\n labelPlaneMatrix: Float32Array;\n _fov: number;\n _pitch: number;\n _zoom: number;\n _unmodified: boolean;\n _renderWorldCopies: boolean;\n _minZoom: number;\n _maxZoom: number;\n _minPitch: number;\n _maxPitch: number;\n _center: LngLat;\n _edgeInsets: EdgeInsets;\n _constraining: boolean;\n _posMatrixCache: {[_: string]: Float32Array};\n _alignedPosMatrixCache: {[_: string]: Float32Array};\n\n constructor(minZoom: ?number, maxZoom: ?number, minPitch: ?number, maxPitch: ?number, renderWorldCopies: boolean | void) {\n this.tileSize = 512; // constant\n this.maxValidLatitude = 85.051129; // constant\n\n this._renderWorldCopies = renderWorldCopies === undefined ? true : renderWorldCopies;\n this._minZoom = minZoom || 0;\n this._maxZoom = maxZoom || 22;\n\n this._minPitch = (minPitch === undefined || minPitch === null) ? 0 : minPitch;\n this._maxPitch = (maxPitch === undefined || maxPitch === null) ? 60 : maxPitch;\n\n this.setMaxBounds();\n\n this.width = 0;\n this.height = 0;\n this._center = new LngLat(0, 0);\n this.zoom = 0;\n this.angle = 0;\n this._fov = 0.6435011087932844;\n this._pitch = 0;\n this._unmodified = true;\n this._edgeInsets = new EdgeInsets();\n this._posMatrixCache = {};\n this._alignedPosMatrixCache = {};\n }\n\n clone(): Transform {\n const clone = new Transform(this._minZoom, this._maxZoom, this._minPitch, this.maxPitch, this._renderWorldCopies);\n clone.tileSize = this.tileSize;\n clone.latRange = this.latRange;\n clone.width = this.width;\n clone.height = this.height;\n clone._center = this._center;\n clone.zoom = this.zoom;\n clone.angle = this.angle;\n clone._fov = this._fov;\n clone._pitch = this._pitch;\n clone._unmodified = this._unmodified;\n clone._edgeInsets = this._edgeInsets.clone();\n clone._calcMatrices();\n return clone;\n }\n\n get minZoom(): number { return this._minZoom; }\n set minZoom(zoom: number) {\n if (this._minZoom === zoom) return;\n this._minZoom = zoom;\n this.zoom = Math.max(this.zoom, zoom);\n }\n\n get maxZoom(): number { return this._maxZoom; }\n set maxZoom(zoom: number) {\n if (this._maxZoom === zoom) return;\n this._maxZoom = zoom;\n this.zoom = Math.min(this.zoom, zoom);\n }\n\n get minPitch(): number { return this._minPitch; }\n set minPitch(pitch: number) {\n if (this._minPitch === pitch) return;\n this._minPitch = pitch;\n this.pitch = Math.max(this.pitch, pitch);\n }\n\n get maxPitch(): number { return this._maxPitch; }\n set maxPitch(pitch: number) {\n if (this._maxPitch === pitch) return;\n this._maxPitch = pitch;\n this.pitch = Math.min(this.pitch, pitch);\n }\n\n get renderWorldCopies(): boolean { return this._renderWorldCopies; }\n set renderWorldCopies(renderWorldCopies?: ?boolean) {\n if (renderWorldCopies === undefined) {\n renderWorldCopies = true;\n } else if (renderWorldCopies === null) {\n renderWorldCopies = false;\n }\n\n this._renderWorldCopies = renderWorldCopies;\n }\n\n get worldSize(): number {\n return this.tileSize * this.scale;\n }\n\n get centerOffset(): Point {\n return this.centerPoint._sub(this.size._div(2));\n }\n\n get size(): Point {\n return new Point(this.width, this.height);\n }\n\n get bearing(): number {\n return -this.angle / Math.PI * 180;\n }\n set bearing(bearing: number) {\n const b = -wrap(bearing, -180, 180) * Math.PI / 180;\n if (this.angle === b) return;\n this._unmodified = false;\n this.angle = b;\n this._calcMatrices();\n\n // 2x2 matrix for rotating points\n this.rotationMatrix = mat2.create();\n mat2.rotate(this.rotationMatrix, this.rotationMatrix, this.angle);\n }\n\n get pitch(): number {\n return this._pitch / Math.PI * 180;\n }\n set pitch(pitch: number) {\n const p = clamp(pitch, this.minPitch, this.maxPitch) / 180 * Math.PI;\n if (this._pitch === p) return;\n this._unmodified = false;\n this._pitch = p;\n this._calcMatrices();\n }\n\n get fov(): number {\n return this._fov / Math.PI * 180;\n }\n set fov(fov: number) {\n fov = Math.max(0.01, Math.min(60, fov));\n if (this._fov === fov) return;\n this._unmodified = false;\n this._fov = fov / 180 * Math.PI;\n this._calcMatrices();\n }\n\n get zoom(): number { return this._zoom; }\n set zoom(zoom: number) {\n const z = Math.min(Math.max(zoom, this.minZoom), this.maxZoom);\n if (this._zoom === z) return;\n this._unmodified = false;\n this._zoom = z;\n this.scale = this.zoomScale(z);\n this.tileZoom = Math.floor(z);\n this.zoomFraction = z - this.tileZoom;\n this._constrain();\n this._calcMatrices();\n }\n\n get center(): LngLat { return this._center; }\n set center(center: LngLat) {\n if (center.lat === this._center.lat && center.lng === this._center.lng) return;\n this._unmodified = false;\n this._center = center;\n this._constrain();\n this._calcMatrices();\n }\n\n get padding(): PaddingOptions { return this._edgeInsets.toJSON(); }\n set padding(padding: PaddingOptions) {\n if (this._edgeInsets.equals(padding)) return;\n this._unmodified = false;\n //Update edge-insets inplace\n this._edgeInsets.interpolate(this._edgeInsets, padding, 1);\n this._calcMatrices();\n }\n\n /**\n * The center of the screen in pixels with the top-left corner being (0,0)\n * and +y axis pointing downwards. This accounts for padding.\n *\n * @readonly\n * @type {Point}\n * @memberof Transform\n */\n get centerPoint(): Point {\n return this._edgeInsets.getCenter(this.width, this.height);\n }\n\n /**\n * Returns if the padding params match\n *\n * @param {PaddingOptions} padding the padding to check against\n * @returns {boolean} true if they are equal, false otherwise\n * @memberof Transform\n */\n isPaddingEqual(padding: PaddingOptions): boolean {\n return this._edgeInsets.equals(padding);\n }\n\n /**\n * Helper method to upadte edge-insets inplace\n *\n * @param {PaddingOptions} start the starting padding\n * @param {PaddingOptions} target the target padding\n * @param {number} t the step/weight\n * @memberof Transform\n */\n interpolatePadding(start: PaddingOptions, target: PaddingOptions, t: number) {\n this._unmodified = false;\n this._edgeInsets.interpolate(start, target, t);\n this._constrain();\n this._calcMatrices();\n }\n\n /**\n * Return a zoom level that will cover all tiles the transform\n * @param {Object} options options\n * @param {number} options.tileSize Tile size, expressed in screen pixels.\n * @param {boolean} options.roundZoom Target zoom level. If true, the value will be rounded to the closest integer. Otherwise the value will be floored.\n * @returns {number} zoom level An integer zoom level at which all tiles will be visible.\n */\n coveringZoomLevel(options: {roundZoom?: boolean, tileSize: number}) {\n const z = (options.roundZoom ? Math.round : Math.floor)(\n this.zoom + this.scaleZoom(this.tileSize / options.tileSize)\n );\n // At negative zoom levels load tiles from z0 because negative tile zoom levels don't exist.\n return Math.max(0, z);\n }\n\n /**\n * Return any \"wrapped\" copies of a given tile coordinate that are visible\n * in the current view.\n *\n * @private\n */\n getVisibleUnwrappedCoordinates(tileID: CanonicalTileID) {\n const result = [new UnwrappedTileID(0, tileID)];\n if (this._renderWorldCopies) {\n const utl = this.pointCoordinate(new Point(0, 0));\n const utr = this.pointCoordinate(new Point(this.width, 0));\n const ubl = this.pointCoordinate(new Point(this.width, this.height));\n const ubr = this.pointCoordinate(new Point(0, this.height));\n const w0 = Math.floor(Math.min(utl.x, utr.x, ubl.x, ubr.x));\n const w1 = Math.floor(Math.max(utl.x, utr.x, ubl.x, ubr.x));\n\n // Add an extra copy of the world on each side to properly render ImageSources and CanvasSources.\n // Both sources draw outside the tile boundaries of the tile that \"contains them\" so we need\n // to add extra copies on both sides in case offscreen tiles need to draw into on-screen ones.\n const extraWorldCopy = 1;\n\n for (let w = w0 - extraWorldCopy; w <= w1 + extraWorldCopy; w++) {\n if (w === 0) continue;\n result.push(new UnwrappedTileID(w, tileID));\n }\n }\n return result;\n }\n\n /**\n * Return all coordinates that could cover this transform for a covering\n * zoom level.\n * @param {Object} options\n * @param {number} options.tileSize\n * @param {number} options.minzoom\n * @param {number} options.maxzoom\n * @param {boolean} options.roundZoom\n * @param {boolean} options.reparseOverscaled\n * @param {boolean} options.renderWorldCopies\n * @returns {Array} OverscaledTileIDs\n * @private\n */\n coveringTiles(\n options: {\n tileSize: number,\n minzoom?: number,\n maxzoom?: number,\n roundZoom?: boolean,\n reparseOverscaled?: boolean,\n renderWorldCopies?: boolean\n }\n ): Array {\n let z = this.coveringZoomLevel(options);\n const actualZ = z;\n\n if (options.minzoom !== undefined && z < options.minzoom) return [];\n if (options.maxzoom !== undefined && z > options.maxzoom) z = options.maxzoom;\n\n const centerCoord = MercatorCoordinate.fromLngLat(this.center);\n const numTiles = Math.pow(2, z);\n const centerPoint = [numTiles * centerCoord.x, numTiles * centerCoord.y, 0];\n const cameraFrustum = Frustum.fromInvProjectionMatrix(this.invProjMatrix, this.worldSize, z);\n\n // No change of LOD behavior for pitch lower than 60 and when there is no top padding: return only tile ids from the requested zoom level\n let minZoom = options.minzoom || 0;\n // Use 0.1 as an epsilon to avoid for explicit == 0.0 floating point checks\n if (this.pitch <= 60.0 && this._edgeInsets.top < 0.1)\n minZoom = z;\n\n // There should always be a certain number of maximum zoom level tiles surrounding the center location\n const radiusOfMaxLvlLodInTiles = 3;\n\n const newRootTile = (wrap: number): any => {\n return {\n // All tiles are on zero elevation plane => z difference is zero\n aabb: new Aabb([wrap * numTiles, 0, 0], [(wrap + 1) * numTiles, numTiles, 0]),\n zoom: 0,\n x: 0,\n y: 0,\n wrap,\n fullyVisible: false\n };\n };\n\n // Do a depth-first traversal to find visible tiles and proper levels of detail\n const stack = [];\n const result = [];\n const maxZoom = z;\n const overscaledZ = options.reparseOverscaled ? actualZ : z;\n\n if (this._renderWorldCopies) {\n // Render copy of the globe thrice on both sides\n for (let i = 1; i <= 3; i++) {\n stack.push(newRootTile(-i));\n stack.push(newRootTile(i));\n }\n }\n\n stack.push(newRootTile(0));\n\n while (stack.length > 0) {\n const it = stack.pop();\n const x = it.x;\n const y = it.y;\n let fullyVisible = it.fullyVisible;\n\n // Visibility of a tile is not required if any of its ancestor if fully inside the frustum\n if (!fullyVisible) {\n const intersectResult = it.aabb.intersects(cameraFrustum);\n\n if (intersectResult === 0)\n continue;\n\n fullyVisible = intersectResult === 2;\n }\n\n const distanceX = it.aabb.distanceX(centerPoint);\n const distanceY = it.aabb.distanceY(centerPoint);\n const longestDim = Math.max(Math.abs(distanceX), Math.abs(distanceY));\n\n // We're using distance based heuristics to determine if a tile should be split into quadrants or not.\n // radiusOfMaxLvlLodInTiles defines that there's always a certain number of maxLevel tiles next to the map center.\n // Using the fact that a parent node in quadtree is twice the size of its children (per dimension)\n // we can define distance thresholds for each relative level:\n // f(k) = offset + 2 + 4 + 8 + 16 + ... + 2^k. This is the same as \"offset+2^(k+1)-2\"\n const distToSplit = radiusOfMaxLvlLodInTiles + (1 << (maxZoom - it.zoom)) - 2;\n\n // Have we reached the target depth or is the tile too far away to be any split further?\n if (it.zoom === maxZoom || (longestDim > distToSplit && it.zoom >= minZoom)) {\n result.push({\n tileID: new OverscaledTileID(it.zoom === maxZoom ? overscaledZ : it.zoom, it.wrap, it.zoom, x, y),\n distanceSq: vec2.sqrLen([centerPoint[0] - 0.5 - x, centerPoint[1] - 0.5 - y])\n });\n continue;\n }\n\n for (let i = 0; i < 4; i++) {\n const childX = (x << 1) + (i % 2);\n const childY = (y << 1) + (i >> 1);\n\n stack.push({aabb: it.aabb.quadrant(i), zoom: it.zoom + 1, x: childX, y: childY, wrap: it.wrap, fullyVisible});\n }\n }\n\n return result.sort((a, b) => a.distanceSq - b.distanceSq).map(a => a.tileID);\n }\n\n resize(width: number, height: number) {\n this.width = width;\n this.height = height;\n\n this.pixelsToGLUnits = [2 / width, -2 / height];\n this._constrain();\n this._calcMatrices();\n }\n\n get unmodified(): boolean { return this._unmodified; }\n\n zoomScale(zoom: number) { return Math.pow(2, zoom); }\n scaleZoom(scale: number) { return Math.log(scale) / Math.LN2; }\n\n project(lnglat: LngLat) {\n const lat = clamp(lnglat.lat, -this.maxValidLatitude, this.maxValidLatitude);\n return new Point(\n mercatorXfromLng(lnglat.lng) * this.worldSize,\n mercatorYfromLat(lat) * this.worldSize);\n }\n\n unproject(point: Point): LngLat {\n return new MercatorCoordinate(point.x / this.worldSize, point.y / this.worldSize).toLngLat();\n }\n\n get point(): Point { return this.project(this.center); }\n\n setLocationAtPoint(lnglat: LngLat, point: Point) {\n const a = this.pointCoordinate(point);\n const b = this.pointCoordinate(this.centerPoint);\n const loc = this.locationCoordinate(lnglat);\n const newCenter = new MercatorCoordinate(\n loc.x - (a.x - b.x),\n loc.y - (a.y - b.y));\n this.center = this.coordinateLocation(newCenter);\n if (this._renderWorldCopies) {\n this.center = this.center.wrap();\n }\n }\n\n /**\n * Given a location, return the screen point that corresponds to it\n * @param {LngLat} lnglat location\n * @returns {Point} screen point\n * @private\n */\n locationPoint(lnglat: LngLat) {\n return this.coordinatePoint(this.locationCoordinate(lnglat));\n }\n\n /**\n * Given a point on screen, return its lnglat\n * @param {Point} p screen point\n * @returns {LngLat} lnglat location\n * @private\n */\n pointLocation(p: Point) {\n return this.coordinateLocation(this.pointCoordinate(p));\n }\n\n /**\n * Given a geographical lnglat, return an unrounded\n * coordinate that represents it at this transform's zoom level.\n * @param {LngLat} lnglat\n * @returns {Coordinate}\n * @private\n */\n locationCoordinate(lnglat: LngLat) {\n return MercatorCoordinate.fromLngLat(lnglat);\n }\n\n /**\n * Given a Coordinate, return its geographical position.\n * @param {Coordinate} coord\n * @returns {LngLat} lnglat\n * @private\n */\n coordinateLocation(coord: MercatorCoordinate) {\n return coord.toLngLat();\n }\n\n pointCoordinate(p: Point) {\n const targetZ = 0;\n // since we don't know the correct projected z value for the point,\n // unproject two points to get a line and then find the point on that\n // line with z=0\n\n const coord0 = [p.x, p.y, 0, 1];\n const coord1 = [p.x, p.y, 1, 1];\n\n vec4.transformMat4(coord0, coord0, this.pixelMatrixInverse);\n vec4.transformMat4(coord1, coord1, this.pixelMatrixInverse);\n\n const w0 = coord0[3];\n const w1 = coord1[3];\n const x0 = coord0[0] / w0;\n const x1 = coord1[0] / w1;\n const y0 = coord0[1] / w0;\n const y1 = coord1[1] / w1;\n const z0 = coord0[2] / w0;\n const z1 = coord1[2] / w1;\n\n const t = z0 === z1 ? 0 : (targetZ - z0) / (z1 - z0);\n\n return new MercatorCoordinate(\n interpolate(x0, x1, t) / this.worldSize,\n interpolate(y0, y1, t) / this.worldSize);\n }\n\n /**\n * Given a coordinate, return the screen point that corresponds to it\n * @param {Coordinate} coord\n * @returns {Point} screen point\n * @private\n */\n coordinatePoint(coord: MercatorCoordinate) {\n const p = [coord.x * this.worldSize, coord.y * this.worldSize, 0, 1];\n vec4.transformMat4(p, p, this.pixelMatrix);\n return new Point(p[0] / p[3], p[1] / p[3]);\n }\n\n /**\n * Returns the map's geographical bounds. When the bearing or pitch is non-zero, the visible region is not\n * an axis-aligned rectangle, and the result is the smallest bounds that encompasses the visible region.\n * @returns {LngLatBounds} Returns a {@link LngLatBounds} object describing the map's geographical bounds.\n */\n getBounds(): LngLatBounds {\n return new LngLatBounds()\n .extend(this.pointLocation(new Point(0, 0)))\n .extend(this.pointLocation(new Point(this.width, 0)))\n .extend(this.pointLocation(new Point(this.width, this.height)))\n .extend(this.pointLocation(new Point(0, this.height)));\n }\n\n /**\n * Returns the maximum geographical bounds the map is constrained to, or `null` if none set.\n * @returns {LngLatBounds} {@link LngLatBounds}\n */\n getMaxBounds(): LngLatBounds | null {\n if (!this.latRange || this.latRange.length !== 2 ||\n !this.lngRange || this.lngRange.length !== 2) return null;\n\n return new LngLatBounds([this.lngRange[0], this.latRange[0]], [this.lngRange[1], this.latRange[1]]);\n }\n\n /**\n * Sets or clears the map's geographical constraints.\n * @param {LngLatBounds} bounds A {@link LngLatBounds} object describing the new geographic boundaries of the map.\n */\n setMaxBounds(bounds?: LngLatBounds) {\n if (bounds) {\n this.lngRange = [bounds.getWest(), bounds.getEast()];\n this.latRange = [bounds.getSouth(), bounds.getNorth()];\n this._constrain();\n } else {\n this.lngRange = null;\n this.latRange = [-this.maxValidLatitude, this.maxValidLatitude];\n }\n }\n\n /**\n * Calculate the posMatrix that, given a tile coordinate, would be used to display the tile on a map.\n * @param {UnwrappedTileID} unwrappedTileID;\n * @private\n */\n calculatePosMatrix(unwrappedTileID: UnwrappedTileID, aligned: boolean = false): Float32Array {\n const posMatrixKey = unwrappedTileID.key;\n const cache = aligned ? this._alignedPosMatrixCache : this._posMatrixCache;\n if (cache[posMatrixKey]) {\n return cache[posMatrixKey];\n }\n\n const canonical = unwrappedTileID.canonical;\n const scale = this.worldSize / this.zoomScale(canonical.z);\n const unwrappedX = canonical.x + Math.pow(2, canonical.z) * unwrappedTileID.wrap;\n\n const posMatrix = mat4.identity(new Float64Array(16));\n mat4.translate(posMatrix, posMatrix, [unwrappedX * scale, canonical.y * scale, 0]);\n mat4.scale(posMatrix, posMatrix, [scale / EXTENT, scale / EXTENT, 1]);\n mat4.multiply(posMatrix, aligned ? this.alignedProjMatrix : this.projMatrix, posMatrix);\n\n cache[posMatrixKey] = new Float32Array(posMatrix);\n return cache[posMatrixKey];\n }\n\n customLayerMatrix(): Array {\n return this.mercatorMatrix.slice();\n }\n\n _constrain() {\n if (!this.center || !this.width || !this.height || this._constraining) return;\n\n this._constraining = true;\n\n let minY = -90;\n let maxY = 90;\n let minX = -180;\n let maxX = 180;\n let sy, sx, x2, y2;\n const size = this.size,\n unmodified = this._unmodified;\n\n if (this.latRange) {\n const latRange = this.latRange;\n minY = mercatorYfromLat(latRange[1]) * this.worldSize;\n maxY = mercatorYfromLat(latRange[0]) * this.worldSize;\n sy = maxY - minY < size.y ? size.y / (maxY - minY) : 0;\n }\n\n if (this.lngRange) {\n const lngRange = this.lngRange;\n minX = mercatorXfromLng(lngRange[0]) * this.worldSize;\n maxX = mercatorXfromLng(lngRange[1]) * this.worldSize;\n sx = maxX - minX < size.x ? size.x / (maxX - minX) : 0;\n }\n\n const point = this.point;\n\n // how much the map should scale to fit the screen into given latitude/longitude ranges\n const s = Math.max(sx || 0, sy || 0);\n\n if (s) {\n this.center = this.unproject(new Point(\n sx ? (maxX + minX) / 2 : point.x,\n sy ? (maxY + minY) / 2 : point.y));\n this.zoom += this.scaleZoom(s);\n this._unmodified = unmodified;\n this._constraining = false;\n return;\n }\n\n if (this.latRange) {\n const y = point.y,\n h2 = size.y / 2;\n\n if (y - h2 < minY) y2 = minY + h2;\n if (y + h2 > maxY) y2 = maxY - h2;\n }\n\n if (this.lngRange) {\n const x = point.x,\n w2 = size.x / 2;\n\n if (x - w2 < minX) x2 = minX + w2;\n if (x + w2 > maxX) x2 = maxX - w2;\n }\n\n // pan the map if the screen goes off the range\n if (x2 !== undefined || y2 !== undefined) {\n this.center = this.unproject(new Point(\n x2 !== undefined ? x2 : point.x,\n y2 !== undefined ? y2 : point.y));\n }\n\n this._unmodified = unmodified;\n this._constraining = false;\n }\n\n _calcMatrices() {\n if (!this.height) return;\n\n const halfFov = this._fov / 2;\n const offset = this.centerOffset;\n this.cameraToCenterDistance = 0.5 / Math.tan(halfFov) * this.height;\n\n // Find the distance from the center point [width/2 + offset.x, height/2 + offset.y] to the\n // center top point [width/2 + offset.x, 0] in Z units, using the law of sines.\n // 1 Z unit is equivalent to 1 horizontal px at the center of the map\n // (the distance between[width/2, height/2] and [width/2 + 1, height/2])\n const groundAngle = Math.PI / 2 + this._pitch;\n const fovAboveCenter = this._fov * (0.5 + offset.y / this.height);\n const topHalfSurfaceDistance = Math.sin(fovAboveCenter) * this.cameraToCenterDistance / Math.sin(clamp(Math.PI - groundAngle - fovAboveCenter, 0.01, Math.PI - 0.01));\n const point = this.point;\n const x = point.x, y = point.y;\n\n // Calculate z distance of the farthest fragment that should be rendered.\n const furthestDistance = Math.cos(Math.PI / 2 - this._pitch) * topHalfSurfaceDistance + this.cameraToCenterDistance;\n // Add a bit extra to avoid precision problems when a fragment's distance is exactly `furthestDistance`\n const farZ = furthestDistance * 1.01;\n\n // The larger the value of nearZ is\n // - the more depth precision is available for features (good)\n // - clipping starts appearing sooner when the camera is close to 3d features (bad)\n //\n // Smaller values worked well for mapbox-gl-js but deckgl was encountering precision issues\n // when rendering it's layers using custom layers. This value was experimentally chosen and\n // seems to solve z-fighting issues in deckgl while not clipping buildings too close to the camera.\n const nearZ = this.height / 50;\n\n // matrix for conversion from location to GL coordinates (-1 .. 1)\n let m = new Float64Array(16);\n mat4.perspective(m, this._fov, this.width / this.height, nearZ, farZ);\n\n //Apply center of perspective offset\n m[8] = -offset.x * 2 / this.width;\n m[9] = offset.y * 2 / this.height;\n\n mat4.scale(m, m, [1, -1, 1]);\n mat4.translate(m, m, [0, 0, -this.cameraToCenterDistance]);\n mat4.rotateX(m, m, this._pitch);\n mat4.rotateZ(m, m, this.angle);\n mat4.translate(m, m, [-x, -y, 0]);\n\n // The mercatorMatrix can be used to transform points from mercator coordinates\n // ([0, 0] nw, [1, 1] se) to GL coordinates.\n this.mercatorMatrix = mat4.scale([], m, [this.worldSize, this.worldSize, this.worldSize]);\n\n // scale vertically to meters per pixel (inverse of ground resolution):\n mat4.scale(m, m, [1, 1, mercatorZfromAltitude(1, this.center.lat) * this.worldSize, 1]);\n\n this.projMatrix = m;\n this.invProjMatrix = mat4.invert([], this.projMatrix);\n\n // Make a second projection matrix that is aligned to a pixel grid for rendering raster tiles.\n // We're rounding the (floating point) x/y values to achieve to avoid rendering raster images to fractional\n // coordinates. Additionally, we adjust by half a pixel in either direction in case that viewport dimension\n // is an odd integer to preserve rendering to the pixel grid. We're rotating this shift based on the angle\n // of the transformation so that 0°, 90°, 180°, and 270° rasters are crisp, and adjust the shift so that\n // it is always <= 0.5 pixels.\n const xShift = (this.width % 2) / 2, yShift = (this.height % 2) / 2,\n angleCos = Math.cos(this.angle), angleSin = Math.sin(this.angle),\n dx = x - Math.round(x) + angleCos * xShift + angleSin * yShift,\n dy = y - Math.round(y) + angleCos * yShift + angleSin * xShift;\n const alignedM = new Float64Array(m);\n mat4.translate(alignedM, alignedM, [ dx > 0.5 ? dx - 1 : dx, dy > 0.5 ? dy - 1 : dy, 0 ]);\n this.alignedProjMatrix = alignedM;\n\n m = mat4.create();\n mat4.scale(m, m, [this.width / 2, -this.height / 2, 1]);\n mat4.translate(m, m, [1, -1, 0]);\n this.labelPlaneMatrix = m;\n\n m = mat4.create();\n mat4.scale(m, m, [1, -1, 1]);\n mat4.translate(m, m, [-1, -1, 0]);\n mat4.scale(m, m, [2 / this.width, 2 / this.height, 1]);\n this.glCoordMatrix = m;\n\n // matrix for conversion from location to screen coordinates\n this.pixelMatrix = mat4.multiply(new Float64Array(16), this.labelPlaneMatrix, this.projMatrix);\n\n // inverse matrix for conversion from screen coordinaes to location\n m = mat4.invert(new Float64Array(16), this.pixelMatrix);\n if (!m) throw new Error(\"failed to invert matrix\");\n this.pixelMatrixInverse = m;\n\n this._posMatrixCache = {};\n this._alignedPosMatrixCache = {};\n }\n\n maxPitchScaleFactor() {\n // calcMatrices hasn't run yet\n if (!this.pixelMatrixInverse) return 1;\n\n const coord = this.pointCoordinate(new Point(0, 0));\n const p = [coord.x * this.worldSize, coord.y * this.worldSize, 0, 1];\n const topPoint = vec4.transformMat4(p, p, this.pixelMatrix);\n return topPoint[3] / this.cameraToCenterDistance;\n }\n\n /*\n * The camera looks at the map from a 3D (lng, lat, altitude) location. Let's use `cameraLocation`\n * as the name for the location under the camera and on the surface of the earth (lng, lat, 0).\n * `cameraPoint` is the projected position of the `cameraLocation`.\n *\n * This point is useful to us because only fill-extrusions that are between `cameraPoint` and\n * the query point on the surface of the earth can extend and intersect the query.\n *\n * When the map is not pitched the `cameraPoint` is equivalent to the center of the map because\n * the camera is right above the center of the map.\n */\n getCameraPoint() {\n const pitch = this._pitch;\n const yOffset = Math.tan(pitch) * (this.cameraToCenterDistance || 1);\n return this.centerPoint.add(new Point(0, yOffset));\n }\n\n /*\n * When the map is pitched, some of the 3D features that intersect a query will not intersect\n * the query at the surface of the earth. Instead the feature may be closer and only intersect\n * the query because it extrudes into the air.\n *\n * This returns a geometry that includes all of the original query as well as all possible ares of the\n * screen where the *base* of a visible extrusion could be.\n * - For point queries, the line from the query point to the \"camera point\"\n * - For other geometries, the envelope of the query geometry and the \"camera point\"\n */\n getCameraQueryGeometry(queryGeometry: Array): Array {\n const c = this.getCameraPoint();\n\n if (queryGeometry.length === 1) {\n return [queryGeometry[0], c];\n } else {\n let minX = c.x;\n let minY = c.y;\n let maxX = c.x;\n let maxY = c.y;\n for (const p of queryGeometry) {\n minX = Math.min(minX, p.x);\n minY = Math.min(minY, p.y);\n maxX = Math.max(maxX, p.x);\n maxY = Math.max(maxY, p.y);\n }\n return [\n new Point(minX, minY),\n new Point(maxX, minY),\n new Point(maxX, maxY),\n new Point(minX, maxY),\n new Point(minX, minY)\n ];\n }\n }\n}\n\nexport default Transform;\n","// @flow\n\nimport {bindAll} from '../util/util';\nimport window from '../util/window';\nimport throttle from '../util/throttle';\n\nimport type Map from './map';\n\n/*\n * Adds the map's position to its page's location hash.\n * Passed as an option to the map object.\n *\n * @returns {Hash} `this`\n */\nclass Hash {\n _map: Map;\n _updateHash: () => ?TimeoutID;\n _hashName: ?string;\n\n constructor(hashName: ?string) {\n this._hashName = hashName && encodeURIComponent(hashName);\n bindAll([\n '_getCurrentHash',\n '_onHashChange',\n '_updateHash'\n ], this);\n\n // Mobile Safari doesn't allow updating the hash more than 100 times per 30 seconds.\n this._updateHash = throttle(this._updateHashUnthrottled.bind(this), 30 * 1000 / 100);\n }\n\n /*\n * Map element to listen for coordinate changes\n *\n * @param {Object} map\n * @returns {Hash} `this`\n */\n addTo(map: Map) {\n this._map = map;\n window.addEventListener('hashchange', this._onHashChange, false);\n this._map.on('moveend', this._updateHash);\n return this;\n }\n\n /*\n * Removes hash\n *\n * @returns {Popup} `this`\n */\n remove() {\n window.removeEventListener('hashchange', this._onHashChange, false);\n this._map.off('moveend', this._updateHash);\n clearTimeout(this._updateHash());\n\n delete this._map;\n return this;\n }\n\n getHashString(mapFeedback?: boolean) {\n const center = this._map.getCenter(),\n zoom = Math.round(this._map.getZoom() * 100) / 100,\n // derived from equation: 512px * 2^z / 360 / 10^d < 0.5px\n precision = Math.ceil((zoom * Math.LN2 + Math.log(512 / 360 / 0.5)) / Math.LN10),\n m = Math.pow(10, precision),\n lng = Math.round(center.lng * m) / m,\n lat = Math.round(center.lat * m) / m,\n bearing = this._map.getBearing(),\n pitch = this._map.getPitch();\n let hash = '';\n if (mapFeedback) {\n // new map feedback site has some constraints that don't allow\n // us to use the same hash format as we do for the Map hash option.\n hash += `/${lng}/${lat}/${zoom}`;\n } else {\n hash += `${zoom}/${lat}/${lng}`;\n }\n\n if (bearing || pitch) hash += (`/${Math.round(bearing * 10) / 10}`);\n if (pitch) hash += (`/${Math.round(pitch)}`);\n\n if (this._hashName) {\n const hashName = this._hashName;\n let found = false;\n const parts = window.location.hash.slice(1).split('&').map(part => {\n const key = part.split('=')[0];\n if (key === hashName) {\n found = true;\n return `${key}=${hash}`;\n }\n return part;\n }).filter(a => a);\n if (!found) {\n parts.push(`${hashName}=${hash}`);\n }\n return `#${parts.join('&')}`;\n }\n\n return `#${hash}`;\n }\n\n _getCurrentHash() {\n // Get the current hash from location, stripped from its number sign\n const hash = window.location.hash.replace('#', '');\n if (this._hashName) {\n // Split the parameter-styled hash into parts and find the value we need\n let keyval;\n hash.split('&').map(\n part => part.split('=')\n ).forEach(part => {\n if (part[0] === this._hashName) {\n keyval = part;\n }\n });\n return (keyval ? keyval[1] || '' : '').split('/');\n }\n return hash.split('/');\n }\n\n _onHashChange() {\n const loc = this._getCurrentHash();\n if (loc.length >= 3 && !loc.some(v => isNaN(v))) {\n const bearing = this._map.dragRotate.isEnabled() && this._map.touchZoomRotate.isEnabled() ? +(loc[3] || 0) : this._map.getBearing();\n this._map.jumpTo({\n center: [+loc[2], +loc[1]],\n zoom: +loc[0],\n bearing,\n pitch: +(loc[4] || 0)\n });\n return true;\n }\n return false;\n }\n\n _updateHashUnthrottled() {\n // Replace if already present, else append the updated hash string\n const location = window.location.href.replace(/(#.+)?$/, this.getHashString());\n try {\n window.history.replaceState(window.history.state, null, location);\n } catch (SecurityError) {\n // IE11 does not allow this if the page is within an iframe created\n // with iframe.contentWindow.document.write(...).\n // https://github.com/mapbox/mapbox-gl-js/issues/7410\n }\n }\n\n}\n\nexport default Hash;\n","// @flow strict\n\n/**\n * Throttle the given function to run at most every `period` milliseconds.\n * @private\n */\nexport default function throttle(fn: () => void, time: number): () => ?TimeoutID {\n let pending = false;\n let timerId: ?TimeoutID = null;\n\n const later = () => {\n timerId = null;\n if (pending) {\n fn();\n timerId = setTimeout(later, time);\n pending = false;\n }\n };\n\n return () => {\n pending = true;\n if (!timerId) {\n later();\n }\n return timerId;\n };\n}\n","// @flow\n\nimport browser from '../util/browser';\nimport type Map from './map';\nimport {bezier, clamp, extend} from '../util/util';\nimport Point from '@mapbox/point-geometry';\nimport type {DragPanOptions} from './handler/shim/drag_pan';\n\nconst defaultInertiaOptions = {\n linearity: 0.3,\n easing: bezier(0, 0, 0.3, 1),\n};\n\nconst defaultPanInertiaOptions = extend({\n deceleration: 2500,\n maxSpeed: 1400\n}, defaultInertiaOptions);\n\nconst defaultZoomInertiaOptions = extend({\n deceleration: 20,\n maxSpeed: 1400\n}, defaultInertiaOptions);\n\nconst defaultBearingInertiaOptions = extend({\n deceleration: 1000,\n maxSpeed: 360\n}, defaultInertiaOptions);\n\nconst defaultPitchInertiaOptions = extend({\n deceleration: 1000,\n maxSpeed: 90\n}, defaultInertiaOptions);\n\nexport type InertiaOptions = {\n linearity: number;\n easing: (t: number) => number;\n deceleration: number;\n maxSpeed: number;\n};\n\nexport type InputEvent = MouseEvent | TouchEvent | KeyboardEvent | WheelEvent;\n\nexport default class HandlerInertia {\n _map: Map;\n _inertiaBuffer: Array<{ time: number, settings: Object }>;\n\n constructor(map: Map) {\n this._map = map;\n this.clear();\n }\n\n clear() {\n this._inertiaBuffer = [];\n }\n\n record(settings: any) {\n this._drainInertiaBuffer();\n this._inertiaBuffer.push({time: browser.now(), settings});\n }\n\n _drainInertiaBuffer() {\n const inertia = this._inertiaBuffer,\n now = browser.now(),\n cutoff = 160; //msec\n\n while (inertia.length > 0 && now - inertia[0].time > cutoff)\n inertia.shift();\n }\n\n _onMoveEnd(panInertiaOptions?: DragPanOptions) {\n this._drainInertiaBuffer();\n if (this._inertiaBuffer.length < 2) {\n return;\n }\n\n const deltas = {\n zoom: 0,\n bearing: 0,\n pitch: 0,\n pan: new Point(0, 0),\n pinchAround: undefined,\n around: undefined\n };\n\n for (const {settings} of this._inertiaBuffer) {\n deltas.zoom += settings.zoomDelta || 0;\n deltas.bearing += settings.bearingDelta || 0;\n deltas.pitch += settings.pitchDelta || 0;\n if (settings.panDelta) deltas.pan._add(settings.panDelta);\n if (settings.around) deltas.around = settings.around;\n if (settings.pinchAround) deltas.pinchAround = settings.pinchAround;\n }\n\n const lastEntry = this._inertiaBuffer[this._inertiaBuffer.length - 1];\n const duration = (lastEntry.time - this._inertiaBuffer[0].time);\n\n const easeOptions = {};\n\n if (deltas.pan.mag()) {\n const result = calculateEasing(deltas.pan.mag(), duration, extend({}, defaultPanInertiaOptions, panInertiaOptions || {}));\n easeOptions.offset = deltas.pan.mult(result.amount / deltas.pan.mag());\n easeOptions.center = this._map.transform.center;\n extendDuration(easeOptions, result);\n }\n\n if (deltas.zoom) {\n const result = calculateEasing(deltas.zoom, duration, defaultZoomInertiaOptions);\n easeOptions.zoom = this._map.transform.zoom + result.amount;\n extendDuration(easeOptions, result);\n }\n\n if (deltas.bearing) {\n const result = calculateEasing(deltas.bearing, duration, defaultBearingInertiaOptions);\n easeOptions.bearing = this._map.transform.bearing + clamp(result.amount, -179, 179);\n extendDuration(easeOptions, result);\n }\n\n if (deltas.pitch) {\n const result = calculateEasing(deltas.pitch, duration, defaultPitchInertiaOptions);\n easeOptions.pitch = this._map.transform.pitch + result.amount;\n extendDuration(easeOptions, result);\n }\n\n if (easeOptions.zoom || easeOptions.bearing) {\n const last = deltas.pinchAround === undefined ? deltas.around : deltas.pinchAround;\n easeOptions.around = last ? this._map.unproject(last) : this._map.getCenter();\n }\n\n this.clear();\n return extend(easeOptions, {\n noMoveStart: true\n });\n\n }\n}\n\n// Unfortunately zoom, bearing, etc can't have different durations and easings so\n// we need to choose one. We use the longest duration and it's corresponding easing.\nfunction extendDuration(easeOptions, result) {\n if (!easeOptions.duration || easeOptions.duration < result.duration) {\n easeOptions.duration = result.duration;\n easeOptions.easing = result.easing;\n }\n}\n\nfunction calculateEasing(amount, inertiaDuration: number, inertiaOptions) {\n const {maxSpeed, linearity, deceleration} = inertiaOptions;\n const speed = clamp(\n amount * linearity / (inertiaDuration / 1000),\n -maxSpeed,\n maxSpeed);\n const duration = Math.abs(speed) / (deceleration * linearity);\n return {\n easing: inertiaOptions.easing,\n duration: duration * 1000,\n amount: speed * (duration / 2)\n };\n}\n","// @flow\n\nimport {Event} from '../util/evented';\n\nimport DOM from '../util/dom';\nimport Point from '@mapbox/point-geometry';\nimport {extend} from '../util/util';\n\nimport type Map from './map';\nimport type LngLat from '../geo/lng_lat';\n\n/**\n * `MapMouseEvent` is the event type for mouse-related map events.\n * @extends {Object}\n * @example\n * // The `click` event is an example of a `MapMouseEvent`.\n * // Set up an event listener on the map.\n * map.on('click', function(e) {\n * // The event object (e) contains information like the\n * // coordinates of the point on the map that was clicked.\n * console.log('A click event has occurred at ' + e.lngLat);\n * });\n */\nexport class MapMouseEvent extends Event {\n /**\n * The event type (one of {@link Map.event:mousedown},\n * {@link Map.event:mouseup},\n * {@link Map.event:click},\n * {@link Map.event:dblclick},\n * {@link Map.event:mousemove},\n * {@link Map.event:mouseover},\n * {@link Map.event:mouseenter},\n * {@link Map.event:mouseleave},\n * {@link Map.event:mouseout},\n * {@link Map.event:contextmenu}).\n */\n type: 'mousedown'\n | 'mouseup'\n | 'click'\n | 'dblclick'\n | 'mousemove'\n | 'mouseover'\n | 'mouseenter'\n | 'mouseleave'\n | 'mouseout'\n | 'contextmenu';\n\n /**\n * The `Map` object that fired the event.\n */\n target: Map;\n\n /**\n * The DOM event which caused the map event.\n */\n originalEvent: MouseEvent;\n\n /**\n * The pixel coordinates of the mouse cursor, relative to the map and measured from the top left corner.\n */\n point: Point;\n\n /**\n * The geographic location on the map of the mouse cursor.\n */\n lngLat: LngLat;\n\n /**\n * Prevents subsequent default processing of the event by the map.\n *\n * Calling this method will prevent the following default map behaviors:\n *\n * * On `mousedown` events, the behavior of {@link DragPanHandler}\n * * On `mousedown` events, the behavior of {@link DragRotateHandler}\n * * On `mousedown` events, the behavior of {@link BoxZoomHandler}\n * * On `dblclick` events, the behavior of {@link DoubleClickZoomHandler}\n *\n */\n preventDefault() {\n this._defaultPrevented = true;\n }\n\n /**\n * `true` if `preventDefault` has been called.\n * @private\n */\n get defaultPrevented(): boolean {\n return this._defaultPrevented;\n }\n\n _defaultPrevented: boolean;\n\n /**\n * @private\n */\n constructor(type: string, map: Map, originalEvent: MouseEvent, data: Object = {}) {\n const point = DOM.mousePos(map.getCanvasContainer(), originalEvent);\n const lngLat = map.unproject(point);\n super(type, extend({point, lngLat, originalEvent}, data));\n this._defaultPrevented = false;\n this.target = map;\n }\n}\n\n/**\n * `MapTouchEvent` is the event type for touch-related map events.\n * @extends {Object}\n */\nexport class MapTouchEvent extends Event {\n /**\n * The event type.\n */\n type: 'touchstart'\n | 'touchend'\n | 'touchcancel';\n\n /**\n * The `Map` object that fired the event.\n */\n target: Map;\n\n /**\n * The DOM event which caused the map event.\n */\n originalEvent: TouchEvent;\n\n /**\n * The geographic location on the map of the center of the touch event points.\n */\n lngLat: LngLat;\n\n /**\n * The pixel coordinates of the center of the touch event points, relative to the map and measured from the top left\n * corner.\n */\n point: Point;\n\n /**\n * The array of pixel coordinates corresponding to a\n * [touch event's `touches`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/touches) property.\n */\n points: Array;\n\n /**\n * The geographical locations on the map corresponding to a\n * [touch event's `touches`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/touches) property.\n */\n lngLats: Array;\n\n /**\n * Prevents subsequent default processing of the event by the map.\n *\n * Calling this method will prevent the following default map behaviors:\n *\n * * On `touchstart` events, the behavior of {@link DragPanHandler}\n * * On `touchstart` events, the behavior of {@link TouchZoomRotateHandler}\n *\n */\n preventDefault() {\n this._defaultPrevented = true;\n }\n\n /**\n * `true` if `preventDefault` has been called.\n * @private\n */\n get defaultPrevented(): boolean {\n return this._defaultPrevented;\n }\n\n _defaultPrevented: boolean;\n\n /**\n * @private\n */\n constructor(type: string, map: Map, originalEvent: TouchEvent) {\n const touches = type === \"touchend\" ? originalEvent.changedTouches : originalEvent.touches;\n const points = DOM.touchPos(map.getCanvasContainer(), touches);\n const lngLats = points.map((t) => map.unproject(t));\n const point = points.reduce((prev, curr, i, arr) => {\n return prev.add(curr.div(arr.length));\n }, new Point(0, 0));\n const lngLat = map.unproject(point);\n super(type, {points, point, lngLats, lngLat, originalEvent});\n this._defaultPrevented = false;\n }\n}\n\n/**\n * `MapWheelEvent` is the event type for the `wheel` map event.\n * @extends {Object}\n */\nexport class MapWheelEvent extends Event {\n /**\n * The event type.\n */\n type: 'wheel';\n\n /**\n * The `Map` object that fired the event.\n */\n target: Map;\n\n /**\n * The DOM event which caused the map event.\n */\n originalEvent: WheelEvent;\n\n /**\n * Prevents subsequent default processing of the event by the map.\n *\n * Calling this method will prevent the the behavior of {@link ScrollZoomHandler}.\n */\n preventDefault() {\n this._defaultPrevented = true;\n }\n\n /**\n * `true` if `preventDefault` has been called.\n * @private\n */\n get defaultPrevented(): boolean {\n return this._defaultPrevented;\n }\n\n _defaultPrevented: boolean;\n\n /**\n * @private\n */\n constructor(type: string, map: Map, originalEvent: WheelEvent) {\n super(type, {originalEvent});\n this._defaultPrevented = false;\n }\n}\n\n/**\n * A `MapBoxZoomEvent` is the event type for the boxzoom-related map events emitted by the {@link BoxZoomHandler}.\n *\n * @typedef {Object} MapBoxZoomEvent\n * @property {MouseEvent} originalEvent The DOM event that triggered the boxzoom event. Can be a `MouseEvent` or `KeyboardEvent`\n * @property {string} type The type of boxzoom event. One of `boxzoomstart`, `boxzoomend` or `boxzoomcancel`\n * @property {Map} target The `Map` instance that triggerred the event\n */\nexport type MapBoxZoomEvent = {\n type: 'boxzoomstart'\n | 'boxzoomend'\n | 'boxzoomcancel',\n target: Map,\n originalEvent: MouseEvent\n};\n\n/**\n * A `MapDataEvent` object is emitted with the {@link Map.event:data}\n * and {@link Map.event:dataloading} events. Possible values for\n * `dataType`s are:\n *\n * - `'source'`: The non-tile data associated with any source\n * - `'style'`: The [style](https://www.mapbox.com/mapbox-gl-style-spec/) used by the map\n *\n * @typedef {Object} MapDataEvent\n * @property {string} type The event type.\n * @property {string} dataType The type of data that has changed. One of `'source'`, `'style'`.\n * @property {boolean} [isSourceLoaded] True if the event has a `dataType` of `source` and the source has no outstanding network requests.\n * @property {Object} [source] The [style spec representation of the source](https://www.mapbox.com/mapbox-gl-style-spec/#sources) if the event has a `dataType` of `source`.\n * @property {string} [sourceDataType] Included if the event has a `dataType` of `source` and the event signals\n * that internal data has been received or changed. Possible values are `metadata`, `content` and `visibility`.\n * @property {Object} [tile] The tile being loaded or changed, if the event has a `dataType` of `source` and\n * the event is related to loading of a tile.\n * @property {Coordinate} [coord] The coordinate of the tile if the event has a `dataType` of `source` and\n * the event is related to loading of a tile.\n * @example\n * // The sourcedata event is an example of MapDataEvent.\n * // Set up an event listener on the map.\n * map.on('sourcedata', function(e) {\n * if (e.isSourceLoaded) {\n * // Do something when the source has finished loading\n * }\n * });\n */\nexport type MapDataEvent = {\n type: string,\n dataType: string\n};\n\nexport type MapContextEvent = {\n type: 'webglcontextlost' | 'webglcontextrestored',\n originalEvent: WebGLContextEvent\n}\n\nexport type MapEvent =\n /**\n * Fired when a pointing device (usually a mouse) is pressed within the map.\n *\n * **Note:** This event is compatible with the optional `layerId` parameter.\n * If `layerId` is included as the second argument in {@link Map#on}, the event listener will fire only when the\n * the cursor is pressed while inside a visible portion of the specifed layer.\n *\n * @event mousedown\n * @memberof Map\n * @instance\n * @property {MapMouseEvent} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener\n * map.on('mousedown', function() {\n * console.log('A mousedown event has occurred.');\n * });\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener for a specific layer\n * map.on('mousedown', 'poi-label', function() {\n * console.log('A mousedown event has occurred on a visible portion of the poi-label layer.');\n * });\n * @see [Create a draggable point](https://maplibre.org/maplibre-gl-js-docs/example/drag-a-point/)\n */\n | 'mousedown'\n\n /**\n * Fired when a pointing device (usually a mouse) is released within the map.\n *\n * **Note:** This event is compatible with the optional `layerId` parameter.\n * If `layerId` is included as the second argument in {@link Map#on}, the event listener will fire only when the\n * the cursor is released while inside a visible portion of the specifed layer.\n *\n * @event mouseup\n * @memberof Map\n * @instance\n * @property {MapMouseEvent} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener\n * map.on('mouseup', function() {\n * console.log('A mouseup event has occurred.');\n * });\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener for a specific layer\n * map.on('mouseup', 'poi-label', function() {\n * console.log('A mouseup event has occurred on a visible portion of the poi-label layer.');\n * });\n * @see [Create a draggable point](https://maplibre.org/maplibre-gl-js-docs/example/drag-a-point/)\n */\n | 'mouseup'\n\n /**\n * Fired when a pointing device (usually a mouse) is moved within the map.\n * As you move the cursor across a web page containing a map,\n * the event will fire each time it enters the map or any child elements.\n *\n * **Note:** This event is compatible with the optional `layerId` parameter.\n * If `layerId` is included as the second argument in {@link Map#on}, the event listener will fire only when the\n * the cursor is moved inside a visible portion of the specifed layer.\n *\n * @event mouseover\n * @memberof Map\n * @instance\n * @property {MapMouseEvent} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener\n * map.on('mouseover', function() {\n * console.log('A mouseover event has occurred.');\n * });\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener for a specific layer\n * map.on('mouseover', 'poi-label', function() {\n * console.log('A mouseover event has occurred on a visible portion of the poi-label layer.');\n * });\n * @see [Get coordinates of the mouse pointer](https://maplibre.org/maplibre-gl-js-docs/example/mouse-position/)\n * @see [Highlight features under the mouse pointer](https://maplibre.org/maplibre-gl-js-docs/example/hover-styles/)\n * @see [Display a popup on hover](https://maplibre.org/maplibre-gl-js-docs/example/popup-on-hover/)\n */\n | 'mouseover'\n\n /**\n * Fired when a pointing device (usually a mouse) is moved while the cursor is inside the map.\n * As you move the cursor across the map, the event will fire every time the cursor changes position within the map.\n *\n * **Note:** This event is compatible with the optional `layerId` parameter.\n * If `layerId` is included as the second argument in {@link Map#on}, the event listener will fire only when the\n * the cursor is inside a visible portion of the specified layer.\n *\n * @event mousemove\n * @memberof Map\n * @instance\n * @property {MapMouseEvent} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener\n * map.on('mousemove', function() {\n * console.log('A mousemove event has occurred.');\n * });\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener for a specific layer\n * map.on('mousemove', 'poi-label', function() {\n * console.log('A mousemove event has occurred on a visible portion of the poi-label layer.');\n * });\n * @see [Get coordinates of the mouse pointer](https://maplibre.org/maplibre-gl-js-docs/example/mouse-position/)\n * @see [Highlight features under the mouse pointer](https://maplibre.org/maplibre-gl-js-docs/example/hover-styles/)\n * @see [Display a popup on over](https://maplibre.org/maplibre-gl-js-docs/example/popup-on-hover/)\n */\n | 'mousemove'\n\n /**\n * Fired when a pointing device (usually a mouse) is pressed and released at the same point on the map.\n *\n * **Note:** This event is compatible with the optional `layerId` parameter.\n * If `layerId` is included as the second argument in {@link Map#on}, the event listener will fire only when the\n * point that is pressed and released contains a visible portion of the specifed layer.\n *\n * @event click\n * @memberof Map\n * @instance\n * @property {MapMouseEvent} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener\n * map.on('click', function(e) {\n * console.log('A click event has occurred at ' + e.lngLat);\n * });\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener for a specific layer\n * map.on('click', 'poi-label', function(e) {\n * console.log('A click event has occurred on a visible portion of the poi-label layer at ' + e.lngLat);\n * });\n * @see [Measure distances](https://maplibre.org/maplibre-gl-js-docs/example/measure/)\n * @see [Center the map on a clicked symbol](https://maplibre.org/maplibre-gl-js-docs/example/center-on-symbol/)\n */\n | 'click'\n\n /**\n * Fired when a pointing device (usually a mouse) is pressed and released twice at the same point on\n * the map in rapid succession.\n *\n * **Note:** This event is compatible with the optional `layerId` parameter.\n * If `layerId` is included as the second argument in {@link Map#on}, the event listener will fire only\n * when the point that is clicked twice contains a visible portion of the specifed layer.\n *\n * @event dblclick\n * @memberof Map\n * @instance\n * @property {MapMouseEvent} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener\n * map.on('dblclick', function(e) {\n * console.log('A dblclick event has occurred at ' + e.lngLat);\n * });\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener for a specific layer\n * map.on('dblclick', 'poi-label', function(e) {\n * console.log('A dblclick event has occurred on a visible portion of the poi-label layer at ' + e.lngLat);\n * });\n */\n | 'dblclick'\n\n /**\n * Fired when a pointing device (usually a mouse) enters a visible portion of a specified layer from\n * outside that layer or outside the map canvas.\n *\n * **Important:** This event can only be listened for when {@link Map#on} includes three arguments,\n * where the second argument specifies the desired layer.\n *\n * @event mouseenter\n * @memberof Map\n * @instance\n * @property {MapMouseEvent} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener\n * map.on('mouseenter', 'water', function() {\n * console.log('A mouseenter event occurred on a visible portion of the water layer.');\n * });\n * @see [Center the map on a clicked symbol](https://maplibre.org/maplibre-gl-js-docs/example/center-on-symbol/)\n * @see [Display a popup on click](https://maplibre.org/maplibre-gl-js-docs/example/popup-on-click/)\n */\n | 'mouseenter'\n\n /**\n * Fired when a pointing device (usually a mouse) leaves a visible portion of a specified layer, or leaves\n * the map canvas.\n *\n * **Important:** This event can only be listened for when {@link Map#on} includes three arguements,\n * where the second argument specifies the desired layer.\n *\n * @event mouseleave\n * @memberof Map\n * @instance\n * @property {MapMouseEvent} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // when the pointing device leaves\n * // a visible portion of the specified layer.\n * map.on('mouseleave', 'water', function() {\n * console.log('A mouseleave event occurred.');\n * });\n * @see [Highlight features under the mouse pointer](https://maplibre.org/maplibre-gl-js-docs/example/hover-styles/)\n * @see [Display a popup on click](https://maplibre.org/maplibre-gl-js-docs/example/popup-on-click/)\n */\n | 'mouseleave'\n\n /**\n * Fired when a point device (usually a mouse) leaves the map's canvas.\n *\n * @event mouseout\n * @memberof Map\n * @instance\n * @property {MapMouseEvent} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // when the pointing device leave's\n * // the map's canvas.\n * map.on('mouseout', function() {\n * console.log('A mouseout event occurred.');\n * });\n */\n | 'mouseout'\n\n /**\n * Fired when the right button of the mouse is clicked or the context menu key is pressed within the map.\n *\n * @event contextmenu\n * @memberof Map\n * @instance\n * @property {MapMouseEvent} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // when the right mouse button is\n * // pressed within the map.\n * map.on('contextmenu', function() {\n * console.log('A contextmenu event occurred.');\n * });\n */\n | 'contextmenu'\n\n /**\n * Fired when a [`wheel`](https://developer.mozilla.org/en-US/docs/Web/Events/wheel) event occurs within the map.\n *\n * @event wheel\n * @memberof Map\n * @instance\n * @property {MapWheelEvent} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // when a wheel event occurs within the map.\n * map.on('wheel', function() {\n * console.log('A wheel event occurred.');\n * });\n */\n | 'wheel'\n\n /**\n * Fired when a [`touchstart`](https://developer.mozilla.org/en-US/docs/Web/Events/touchstart) event occurs within the map.\n *\n * @event touchstart\n * @memberof Map\n * @instance\n * @property {MapTouchEvent} data\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // when a touchstart event occurs within the map.\n * map.on('touchstart', function() {\n * console.log('A touchstart event occurred.');\n * });\n * @see [Create a draggable point](https://maplibre.org/maplibre-gl-js-docs/example/drag-a-point/)\n */\n | 'touchstart'\n\n /**\n * Fired when a [`touchend`](https://developer.mozilla.org/en-US/docs/Web/Events/touchend) event occurs within the map.\n *\n * @event touchend\n * @memberof Map\n * @instance\n * @property {MapTouchEvent} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // when a touchstart event occurs within the map.\n * map.on('touchstart', function() {\n * console.log('A touchstart event occurred.');\n * });\n * @see [Create a draggable point](https://maplibre.org/maplibre-gl-js-docs/example/drag-a-point/)\n */\n | 'touchend'\n\n /**\n * Fired when a [`touchmove`](https://developer.mozilla.org/en-US/docs/Web/Events/touchmove) event occurs within the map.\n *\n * @event touchmove\n * @memberof Map\n * @instance\n * @property {MapTouchEvent} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // when a touchmove event occurs within the map.\n * map.on('touchmove', function() {\n * console.log('A touchmove event occurred.');\n * });\n * @see [Create a draggable point](https://maplibre.org/maplibre-gl-js-docs/example/drag-a-point/)\n */\n | 'touchmove'\n\n /**\n * Fired when a [`touchcancel`](https://developer.mozilla.org/en-US/docs/Web/Events/touchcancel) event occurs within the map.\n *\n * @event touchcancel\n * @memberof Map\n * @instance\n * @property {MapTouchEvent} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // when a touchcancel event occurs within the map.\n * map.on('touchcancel', function() {\n * console.log('A touchcancel event occurred.');\n * });\n */\n | 'touchcancel'\n\n /**\n * Fired just before the map begins a transition from one\n * view to another, as the result of either user interaction or methods such as {@link Map#jumpTo}.\n *\n * @event movestart\n * @memberof Map\n * @instance\n * @property {{originalEvent: DragEvent}} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // just before the map begins a transition\n * // from one view to another.\n * map.on('movestart', function() {\n * console.log('A movestart` event occurred.');\n * });\n */\n | 'movestart'\n\n /**\n * Fired repeatedly during an animated transition from one view to\n * another, as the result of either user interaction or methods such as {@link Map#flyTo}.\n *\n * @event move\n * @memberof Map\n * @instance\n * @property {MapMouseEvent | MapTouchEvent} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // repeatedly during an animated transition.\n * map.on('move', function() {\n * console.log('A move event occurred.');\n * });\n * @see [Display HTML clusters with custom properties](https://maplibre.org/maplibre-gl-js-docs/example/cluster-html/)\n */\n | 'move'\n\n /**\n * Fired just after the map completes a transition from one\n * view to another, as the result of either user interaction or methods such as {@link Map#jumpTo}.\n *\n * @event moveend\n * @memberof Map\n * @instance\n * @property {{originalEvent: DragEvent}} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // just after the map completes a transition.\n * map.on('moveend', function() {\n * console.log('A moveend event occurred.');\n * });\n * @see [Display HTML clusters with custom properties](https://maplibre.org/maplibre-gl-js-docs/example/cluster-html/)\n */\n | 'moveend'\n\n /**\n * Fired when a \"drag to pan\" interaction starts. See {@link DragPanHandler}.\n *\n * @event dragstart\n * @memberof Map\n * @instance\n * @property {{originalEvent: DragEvent}} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // when a \"drag to pan\" interaction starts.\n * map.on('dragstart', function() {\n * console.log('A dragstart event occurred.');\n * });\n */\n | 'dragstart'\n\n /**\n * Fired repeatedly during a \"drag to pan\" interaction. See {@link DragPanHandler}.\n *\n * @event drag\n * @memberof Map\n * @instance\n * @property {MapMouseEvent | MapTouchEvent} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // repeatedly during a \"drag to pan\" interaction.\n * map.on('drag', function() {\n * console.log('A drag event occurred.');\n * });\n */\n | 'drag'\n\n /**\n * Fired when a \"drag to pan\" interaction ends. See {@link DragPanHandler}.\n *\n * @event dragend\n * @memberof Map\n * @instance\n * @property {{originalEvent: DragEvent}} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // when a \"drag to pan\" interaction ends.\n * map.on('dragend', function() {\n * console.log('A dragend event occurred.');\n * });\n * @see [Create a draggable marker](https://maplibre.org/maplibre-gl-js-docs/example/drag-a-marker/)\n */\n | 'dragend'\n\n /**\n * Fired just before the map begins a transition from one zoom level to another,\n * as the result of either user interaction or methods such as {@link Map#flyTo}.\n *\n * @event zoomstart\n * @memberof Map\n * @instance\n * @property {MapMouseEvent | MapTouchEvent} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // just before a zoom transition starts.\n * map.on('zoomstart', function() {\n * console.log('A zoomstart event occurred.');\n * });\n */\n | 'zoomstart'\n\n /**\n * Fired repeatedly during an animated transition from one zoom level to another,\n * as the result of either user interaction or methods such as {@link Map#flyTo}.\n *\n * @event zoom\n * @memberof Map\n * @instance\n * @property {MapMouseEvent | MapTouchEvent} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // repeatedly during a zoom transition.\n * map.on('zoom', function() {\n * console.log('A zoom event occurred.');\n * });\n */\n | 'zoom'\n\n /**\n * Fired just after the map completes a transition from one zoom level to another,\n * as the result of either user interaction or methods such as {@link Map#flyTo}.\n *\n * @event zoomend\n * @memberof Map\n * @instance\n * @property {MapMouseEvent | MapTouchEvent} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // just after a zoom transition finishes.\n * map.on('zoomend', function() {\n * console.log('A zoomend event occurred.');\n * });\n */\n | 'zoomend'\n\n /**\n * Fired when a \"drag to rotate\" interaction starts. See {@link DragRotateHandler}.\n *\n * @event rotatestart\n * @memberof Map\n * @instance\n * @property {MapMouseEvent | MapTouchEvent} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // just before a \"drag to rotate\" interaction starts.\n * map.on('rotatestart', function() {\n * console.log('A rotatestart event occurred.');\n * });\n */\n | 'rotatestart'\n\n /**\n * Fired repeatedly during a \"drag to rotate\" interaction. See {@link DragRotateHandler}.\n *\n * @event rotate\n * @memberof Map\n * @instance\n * @property {MapMouseEvent | MapTouchEvent} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // repeatedly during \"drag to rotate\" interaction.\n * map.on('rotate', function() {\n * console.log('A rotate event occurred.');\n * });\n */\n | 'rotate'\n\n /**\n * Fired when a \"drag to rotate\" interaction ends. See {@link DragRotateHandler}.\n *\n * @event rotateend\n * @memberof Map\n * @instance\n * @property {MapMouseEvent | MapTouchEvent} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // just after a \"drag to rotate\" interaction ends.\n * map.on('rotateend', function() {\n * console.log('A rotateend event occurred.');\n * });\n */\n | 'rotateend'\n\n /**\n * Fired whenever the map's pitch (tilt) begins a change as\n * the result of either user interaction or methods such as {@link Map#flyTo} .\n *\n * @event pitchstart\n * @memberof Map\n * @instance\n * @property {MapEventData} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // just before a pitch (tilt) transition starts.\n * map.on('pitchstart', function() {\n * console.log('A pitchstart event occurred.');\n * });\n */\n | 'pitchstart'\n\n /**\n * Fired repeatedly during the map's pitch (tilt) animation between\n * one state and another as the result of either user interaction\n * or methods such as {@link Map#flyTo}.\n *\n * @event pitch\n * @memberof Map\n * @instance\n * @property {MapEventData} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // repeatedly during a pitch (tilt) transition.\n * map.on('pitch', function() {\n * console.log('A pitch event occurred.');\n * });\n */\n | 'pitch'\n\n /**\n * Fired immediately after the map's pitch (tilt) finishes changing as\n * the result of either user interaction or methods such as {@link Map#flyTo}.\n *\n * @event pitchend\n * @memberof Map\n * @instance\n * @property {MapEventData} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // just after a pitch (tilt) transition ends.\n * map.on('pitchend', function() {\n * console.log('A pitchend event occurred.');\n * });\n */\n | 'pitchend'\n\n /**\n * Fired when a \"box zoom\" interaction starts. See {@link BoxZoomHandler}.\n *\n * @event boxzoomstart\n * @memberof Map\n * @instance\n * @property {MapBoxZoomEvent} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // just before a \"box zoom\" interaction starts.\n * map.on('boxzoomstart', function() {\n * console.log('A boxzoomstart event occurred.');\n * });\n */\n | 'boxzoomstart'\n\n /**\n * Fired when a \"box zoom\" interaction ends. See {@link BoxZoomHandler}.\n *\n * @event boxzoomend\n * @memberof Map\n * @instance\n * @type {Object}\n * @property {MapBoxZoomEvent} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // just after a \"box zoom\" interaction ends.\n * map.on('boxzoomend', function() {\n * console.log('A boxzoomend event occurred.');\n * });\n */\n | 'boxzoomend'\n\n /**\n * Fired when the user cancels a \"box zoom\" interaction, or when the bounding box does not meet the minimum size threshold.\n * See {@link BoxZoomHandler}.\n *\n * @event boxzoomcancel\n * @memberof Map\n * @instance\n * @property {MapBoxZoomEvent} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // the user cancels a \"box zoom\" interaction.\n * map.on('boxzoomcancel', function() {\n * console.log('A boxzoomcancel event occurred.');\n * });\n */\n | 'boxzoomcancel'\n\n /**\n * Fired immediately after the map has been resized.\n *\n * @event resize\n * @memberof Map\n * @instance\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // immediately after the map has been resized.\n * map.on('resize', function() {\n * console.log('A resize event occurred.');\n * });\n */\n | 'resize'\n\n /**\n * Fired when the WebGL context is lost.\n *\n * @event webglcontextlost\n * @memberof Map\n * @instance\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // when the WebGL context is lost.\n * map.on('webglcontextlost', function() {\n * console.log('A webglcontextlost event occurred.');\n * });\n */\n | 'webglcontextlost'\n\n /**\n * Fired when the WebGL context is restored.\n *\n * @event webglcontextrestored\n * @memberof Map\n * @instance\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // when the WebGL context is restored.\n * map.on('webglcontextrestored', function() {\n * console.log('A webglcontextrestored event occurred.');\n * });\n */\n | 'webglcontextrestored'\n\n /**\n * Fired immediately after all necessary resources have been downloaded\n * and the first visually complete rendering of the map has occurred.\n *\n * @event load\n * @memberof Map\n * @instance\n * @type {Object}\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // when the map has finished loading.\n * map.on('load', function() {\n * console.log('A load event occurred.');\n * });\n * @see [Draw GeoJSON points](https://maplibre.org/maplibre-gl-js-docs/example/geojson-markers/)\n * @see [Add live realtime data](https://maplibre.org/maplibre-gl-js-docs/example/live-geojson/)\n * @see [Animate a point](https://maplibre.org/maplibre-gl-js-docs/example/animate-point-along-line/)\n */\n | 'load'\n\n /**\n * Fired whenever the map is drawn to the screen, as the result of\n *\n * - a change to the map's position, zoom, pitch, or bearing\n * - a change to the map's style\n * - a change to a GeoJSON source\n * - the loading of a vector tile, GeoJSON file, glyph, or sprite\n *\n * @event render\n * @memberof Map\n * @instance\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // whenever the map is drawn to the screen.\n * map.on('render', function() {\n * console.log('A render event occurred.');\n * });\n */\n | 'render'\n\n /**\n * Fired after the last frame rendered before the map enters an\n * \"idle\" state:\n *\n * - No camera transitions are in progress\n * - All currently requested tiles have loaded\n * - All fade/transition animations have completed\n *\n * @event idle\n * @memberof Map\n * @instance\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // just before the map enters an \"idle\" state.\n * map.on('idle', function() {\n * console.log('A idle event occurred.');\n * });\n */\n | 'idle'\n\n /**\n * Fired immediately after the map has been removed with {@link Map.event:remove}.\n *\n * @event remove\n * @memberof Map\n * @instance\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // just after the map is removed.\n * map.on('remove', function() {\n * console.log('A remove event occurred.');\n * });\n */\n | 'remove'\n\n /**\n * Fired when an error occurs. This is GL JS's primary error reporting\n * mechanism. We use an event instead of `throw` to better accommodate\n * asyncronous operations. If no listeners are bound to the `error` event, the\n * error will be printed to the console.\n *\n * @event error\n * @memberof Map\n * @instance\n * @property {{error: {message: string}}} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // when an error occurs.\n * map.on('error', function() {\n * console.log('A error event occurred.');\n * });\n */\n | 'error'\n\n /**\n * Fired when any map data loads or changes. See {@link MapDataEvent}\n * for more information.\n *\n * @event data\n * @memberof Map\n * @instance\n * @property {MapDataEvent} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // when map data loads or changes.\n * map.on('data', function() {\n * console.log('A data event occurred.');\n * });\n * @see [Display HTML clusters with custom properties](https://maplibre.org/maplibre-gl-js-docs/example/cluster-html/)\n */\n | 'data'\n\n /**\n * Fired when the map's style loads or changes. See\n * {@link MapDataEvent} for more information.\n *\n * @event styledata\n * @memberof Map\n * @instance\n * @property {MapDataEvent} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // when the map's style loads or changes.\n * map.on('styledata', function() {\n * console.log('A styledata event occurred.');\n * });\n */\n | 'styledata'\n\n /**\n * Fired when one of the map's sources loads or changes, including if a tile belonging\n * to a source loads or changes. See {@link MapDataEvent} for more information.\n *\n * @event sourcedata\n * @memberof Map\n * @instance\n * @property {MapDataEvent} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // when one of the map's sources loads or changes.\n * map.on('sourcedata', function() {\n * console.log('A sourcedata event occurred.');\n * });\n */\n | 'sourcedata'\n\n /**\n * Fired when any map data (style, source, tile, etc) begins loading or\n * changing asyncronously. All `dataloading` events are followed by a `data`\n * or `error` event. See {@link MapDataEvent} for more information.\n *\n * @event dataloading\n * @memberof Map\n * @instance\n * @property {MapDataEvent} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // when any map data begins loading\n * // or changing asynchronously.\n * map.on('dataloading', function() {\n * console.log('A dataloading event occurred.');\n * });\n */\n | 'dataloading'\n\n /**\n * Fired when the map's style begins loading or changing asyncronously.\n * All `styledataloading` events are followed by a `styledata`\n * or `error` event. See {@link MapDataEvent} for more information.\n *\n * @event styledataloading\n * @memberof Map\n * @instance\n * @property {MapDataEvent} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // map's style begins loading or\n * // changing asyncronously.\n * map.on('styledataloading', function() {\n * console.log('A styledataloading event occurred.');\n * });\n */\n | 'styledataloading'\n\n /**\n * Fired when one of the map's sources begins loading or changing asyncronously.\n * All `sourcedataloading` events are followed by a `sourcedata` or `error` event.\n * See {@link MapDataEvent} for more information.\n *\n * @event sourcedataloading\n * @memberof Map\n * @instance\n * @property {MapDataEvent} data\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // map's sources begin loading or\n * // changing asyncronously.\n * map.on('sourcedataloading', function() {\n * console.log('A sourcedataloading event occurred.');\n * });\n */\n | 'sourcedataloading'\n\n /**\n * Fired when an icon or pattern needed by the style is missing. The missing image can\n * be added with {@link Map#addImage} within this event listener callback to prevent the image from\n * being skipped. This event can be used to dynamically generate icons and patterns.\n *\n * @event styleimagemissing\n * @memberof Map\n * @instance\n * @property {string} id The id of the missing image.\n * @example\n * // Initialize the map\n * var map = new maplibregl.Map({ // map options });\n * // Set an event listener that fires\n * // an icon or pattern is missing.\n * map.on('styleimagemissing', function() {\n * console.log('A styleimagemissing event occurred.');\n * });\n * @see [Generate and add a missing icon to the map](https://mapbox.com/mapbox-gl-js/example/add-image-missing-generated/)\n */\n | 'styleimagemissing'\n\n /**\n * @event style.load\n * @memberof Map\n * @instance\n * @private\n */\n | 'style.load';\n","// @flow\n\nimport {MapMouseEvent, MapTouchEvent, MapWheelEvent} from '../events';\nimport type Map from '../map';\n\nexport class MapEventHandler {\n\n _mousedownPos: Point;\n _clickTolerance: number;\n _map: Map;\n\n constructor(map: Map, options: { clickTolerance: number }) {\n this._map = map;\n this._clickTolerance = options.clickTolerance;\n }\n\n reset() {\n delete this._mousedownPos;\n }\n\n wheel(e: WheelEvent) {\n // If mapEvent.preventDefault() is called by the user, prevent handlers such as:\n // - ScrollZoom\n return this._firePreventable(new MapWheelEvent(e.type, this._map, e));\n }\n\n mousedown(e: MouseEvent, point: Point) {\n this._mousedownPos = point;\n // If mapEvent.preventDefault() is called by the user, prevent handlers such as:\n // - MousePan\n // - MouseRotate\n // - MousePitch\n // - DblclickHandler\n return this._firePreventable(new MapMouseEvent(e.type, this._map, e));\n }\n\n mouseup(e: MouseEvent) {\n this._map.fire(new MapMouseEvent(e.type, this._map, e));\n }\n\n click(e: MouseEvent, point: Point) {\n if (this._mousedownPos && this._mousedownPos.dist(point) >= this._clickTolerance) return;\n this._map.fire(new MapMouseEvent(e.type, this._map, e));\n }\n\n dblclick(e: MouseEvent) {\n // If mapEvent.preventDefault() is called by the user, prevent handlers such as:\n // - DblClickZoom\n return this._firePreventable(new MapMouseEvent(e.type, this._map, e));\n }\n\n mouseover(e: MouseEvent) {\n this._map.fire(new MapMouseEvent(e.type, this._map, e));\n }\n\n mouseout(e: MouseEvent) {\n this._map.fire(new MapMouseEvent(e.type, this._map, e));\n }\n\n touchstart(e: TouchEvent) {\n // If mapEvent.preventDefault() is called by the user, prevent handlers such as:\n // - TouchPan\n // - TouchZoom\n // - TouchRotate\n // - TouchPitch\n // - TapZoom\n // - SwipeZoom\n return this._firePreventable(new MapTouchEvent(e.type, this._map, e));\n }\n\n touchmove(e: TouchEvent) {\n this._map.fire(new MapTouchEvent(e.type, this._map, e));\n }\n\n touchend(e: TouchEvent) {\n this._map.fire(new MapTouchEvent(e.type, this._map, e));\n }\n\n touchcancel(e: TouchEvent) {\n this._map.fire(new MapTouchEvent(e.type, this._map, e));\n }\n\n _firePreventable(mapEvent: MapMouseEvent | MapTouchEvent | MapWheelEvent) {\n this._map.fire(mapEvent);\n if (mapEvent.defaultPrevented) {\n // returning an object marks the handler as active and resets other handlers\n return {};\n }\n }\n\n isEnabled() {\n return true;\n }\n\n isActive() {\n return false;\n }\n enable() {}\n disable() {}\n}\n\nexport class BlockableMapEventHandler {\n _map: Map;\n _delayContextMenu: boolean;\n _contextMenuEvent: MouseEvent;\n\n constructor(map: Map) {\n this._map = map;\n }\n\n reset() {\n this._delayContextMenu = false;\n delete this._contextMenuEvent;\n }\n\n mousemove(e: MouseEvent) {\n // mousemove map events should not be fired when interaction handlers (pan, rotate, etc) are active\n this._map.fire(new MapMouseEvent(e.type, this._map, e));\n }\n\n mousedown() {\n this._delayContextMenu = true;\n }\n\n mouseup() {\n this._delayContextMenu = false;\n if (this._contextMenuEvent) {\n this._map.fire(new MapMouseEvent('contextmenu', this._map, this._contextMenuEvent));\n delete this._contextMenuEvent;\n }\n }\n contextmenu(e: MouseEvent) {\n if (this._delayContextMenu) {\n // Mac: contextmenu fired on mousedown; we save it until mouseup for consistency's sake\n this._contextMenuEvent = e;\n } else {\n // Windows: contextmenu fired on mouseup, so fire event now\n this._map.fire(new MapMouseEvent(e.type, this._map, e));\n }\n\n // prevent browser context menu when necessary\n if (this._map.listens('contextmenu')) {\n e.preventDefault();\n }\n }\n\n isEnabled() {\n return true;\n }\n\n isActive() {\n return false;\n }\n enable() {}\n disable() {}\n}\n","// @flow\n\nimport DOM from '../../util/dom';\n\nimport {Event} from '../../util/evented';\n\nimport type Map from '../map';\n\n/**\n * The `BoxZoomHandler` allows the user to zoom the map to fit within a bounding box.\n * The bounding box is defined by clicking and holding `shift` while dragging the cursor.\n */\nclass BoxZoomHandler {\n _map: Map;\n _el: HTMLElement;\n _container: HTMLElement;\n _enabled: boolean;\n _active: boolean;\n _startPos: Point;\n _lastPos: Point;\n _box: HTMLElement;\n _clickTolerance: number;\n\n /**\n * @private\n */\n constructor(map: Map, options: {\n clickTolerance: number\n }) {\n this._map = map;\n this._el = map.getCanvasContainer();\n this._container = map.getContainer();\n this._clickTolerance = options.clickTolerance || 1;\n }\n\n /**\n * Returns a Boolean indicating whether the \"box zoom\" interaction is enabled.\n *\n * @returns {boolean} `true` if the \"box zoom\" interaction is enabled.\n */\n isEnabled() {\n return !!this._enabled;\n }\n\n /**\n * Returns a Boolean indicating whether the \"box zoom\" interaction is active, i.e. currently being used.\n *\n * @returns {boolean} `true` if the \"box zoom\" interaction is active.\n */\n isActive() {\n return !!this._active;\n }\n\n /**\n * Enables the \"box zoom\" interaction.\n *\n * @example\n * map.boxZoom.enable();\n */\n enable() {\n if (this.isEnabled()) return;\n this._enabled = true;\n }\n\n /**\n * Disables the \"box zoom\" interaction.\n *\n * @example\n * map.boxZoom.disable();\n */\n disable() {\n if (!this.isEnabled()) return;\n this._enabled = false;\n }\n\n mousedown(e: MouseEvent, point: Point) {\n if (!this.isEnabled()) return;\n if (!(e.shiftKey && e.button === 0)) return;\n\n DOM.disableDrag();\n this._startPos = this._lastPos = point;\n this._active = true;\n }\n\n mousemoveWindow(e: MouseEvent, point: Point) {\n if (!this._active) return;\n\n const pos = point;\n\n if (this._lastPos.equals(pos) || (!this._box && pos.dist(this._startPos) < this._clickTolerance)) {\n return;\n }\n\n const p0 = this._startPos;\n this._lastPos = pos;\n\n if (!this._box) {\n this._box = DOM.create('div', 'maplibregl-boxzoom mapboxgl-boxzoom', this._container);\n this._container.classList.add('maplibregl-crosshair', 'mapboxgl-crosshair');\n this._fireEvent('boxzoomstart', e);\n }\n\n const minX = Math.min(p0.x, pos.x),\n maxX = Math.max(p0.x, pos.x),\n minY = Math.min(p0.y, pos.y),\n maxY = Math.max(p0.y, pos.y);\n\n DOM.setTransform(this._box, `translate(${minX}px,${minY}px)`);\n\n this._box.style.width = `${maxX - minX}px`;\n this._box.style.height = `${maxY - minY}px`;\n }\n\n mouseupWindow(e: MouseEvent, point: Point) {\n if (!this._active) return;\n\n if (e.button !== 0) return;\n\n const p0 = this._startPos,\n p1 = point;\n\n this.reset();\n\n DOM.suppressClick();\n\n if (p0.x === p1.x && p0.y === p1.y) {\n this._fireEvent('boxzoomcancel', e);\n } else {\n this._map.fire(new Event('boxzoomend', {originalEvent: e}));\n return {\n cameraAnimation: map => map.fitScreenCoordinates(p0, p1, this._map.getBearing(), {linear: true})\n };\n }\n }\n\n keydown(e: KeyboardEvent) {\n if (!this._active) return;\n\n if (e.keyCode === 27) {\n this.reset();\n this._fireEvent('boxzoomcancel', e);\n }\n }\n\n reset() {\n this._active = false;\n\n this._container.classList.remove('maplibregl-crosshair', 'mapboxgl-crosshair');\n\n if (this._box) {\n DOM.remove(this._box);\n this._box = (null: any);\n }\n\n DOM.enableDrag();\n\n delete this._startPos;\n delete this._lastPos;\n }\n\n _fireEvent(type: string, e: *) {\n return this._map.fire(new Event(type, {originalEvent: e}));\n }\n}\n\nexport default BoxZoomHandler;\n","// @flow\n\nimport assert from 'assert';\n\nexport function indexTouches(touches: Array, points: Array) {\n assert(touches.length === points.length);\n const obj = {};\n for (let i = 0; i < touches.length; i++) {\n obj[touches[i].identifier] = points[i];\n }\n return obj;\n}\n","// @flow\n\nimport Point from '@mapbox/point-geometry';\nimport {indexTouches} from './handler_util';\n\nfunction getCentroid(points: Array) {\n const sum = new Point(0, 0);\n for (const point of points) {\n sum._add(point);\n }\n return sum.div(points.length);\n}\n\nexport const MAX_TAP_INTERVAL = 500;\nconst MAX_TOUCH_TIME = 500;\nconst MAX_DIST = 30;\n\nexport class SingleTapRecognizer {\n\n numTouches: number;\n centroid: Point;\n startTime: number;\n aborted: boolean;\n touches: { [number | string]: Point };\n\n constructor(options: { numTouches: number }) {\n this.reset();\n this.numTouches = options.numTouches;\n }\n\n reset() {\n delete this.centroid;\n delete this.startTime;\n delete this.touches;\n this.aborted = false;\n }\n\n touchstart(e: TouchEvent, points: Array, mapTouches: Array) {\n\n if (this.centroid || mapTouches.length > this.numTouches) {\n this.aborted = true;\n }\n if (this.aborted) {\n return;\n }\n\n if (this.startTime === undefined) {\n this.startTime = e.timeStamp;\n }\n\n if (mapTouches.length === this.numTouches) {\n this.centroid = getCentroid(points);\n this.touches = indexTouches(mapTouches, points);\n }\n }\n\n touchmove(e: TouchEvent, points: Array, mapTouches: Array) {\n if (this.aborted || !this.centroid) return;\n\n const newTouches = indexTouches(mapTouches, points);\n for (const id in this.touches) {\n const prevPos = this.touches[id];\n const pos = newTouches[id];\n if (!pos || pos.dist(prevPos) > MAX_DIST) {\n this.aborted = true;\n }\n }\n }\n\n touchend(e: TouchEvent, points: Array, mapTouches: Array) {\n if (!this.centroid || e.timeStamp - this.startTime > MAX_TOUCH_TIME) {\n this.aborted = true;\n }\n\n if (mapTouches.length === 0) {\n const centroid = !this.aborted && this.centroid;\n this.reset();\n if (centroid) return centroid;\n }\n }\n\n}\n\nexport class TapRecognizer {\n\n singleTap: SingleTapRecognizer;\n numTaps: number;\n lastTime: number;\n lastTap: Point;\n count: number;\n\n constructor(options: { numTaps: number, numTouches: number }) {\n this.singleTap = new SingleTapRecognizer(options);\n this.numTaps = options.numTaps;\n this.reset();\n }\n\n reset() {\n this.lastTime = Infinity;\n delete this.lastTap;\n this.count = 0;\n this.singleTap.reset();\n }\n\n touchstart(e: TouchEvent, points: Array, mapTouches: Array) {\n this.singleTap.touchstart(e, points, mapTouches);\n }\n\n touchmove(e: TouchEvent, points: Array, mapTouches: Array) {\n this.singleTap.touchmove(e, points, mapTouches);\n }\n\n touchend(e: TouchEvent, points: Array, mapTouches: Array) {\n const tap = this.singleTap.touchend(e, points, mapTouches);\n if (tap) {\n const soonEnough = e.timeStamp - this.lastTime < MAX_TAP_INTERVAL;\n const closeEnough = !this.lastTap || this.lastTap.dist(tap) < MAX_DIST;\n\n if (!soonEnough || !closeEnough) {\n this.reset();\n }\n\n this.count++;\n this.lastTime = e.timeStamp;\n this.lastTap = tap;\n\n if (this.count === this.numTaps) {\n this.reset();\n return tap;\n }\n }\n }\n}\n","// @flow\n\nimport {TapRecognizer} from './tap_recognizer';\nimport type Point from '@mapbox/point-geometry';\nimport type Map from '../map';\n\nexport default class TapZoomHandler {\n\n _enabled: boolean;\n _active: boolean;\n _zoomIn: TapRecognizer;\n _zoomOut: TapRecognizer;\n\n constructor() {\n this._zoomIn = new TapRecognizer({\n numTouches: 1,\n numTaps: 2\n });\n\n this._zoomOut = new TapRecognizer({\n numTouches: 2,\n numTaps: 1\n });\n\n this.reset();\n }\n\n reset() {\n this._active = false;\n this._zoomIn.reset();\n this._zoomOut.reset();\n }\n\n touchstart(e: TouchEvent, points: Array, mapTouches: Array) {\n this._zoomIn.touchstart(e, points, mapTouches);\n this._zoomOut.touchstart(e, points, mapTouches);\n }\n\n touchmove(e: TouchEvent, points: Array, mapTouches: Array) {\n this._zoomIn.touchmove(e, points, mapTouches);\n this._zoomOut.touchmove(e, points, mapTouches);\n }\n\n touchend(e: TouchEvent, points: Array, mapTouches: Array) {\n const zoomInPoint = this._zoomIn.touchend(e, points, mapTouches);\n const zoomOutPoint = this._zoomOut.touchend(e, points, mapTouches);\n\n if (zoomInPoint) {\n this._active = true;\n e.preventDefault();\n setTimeout(() => this.reset(), 0);\n return {\n cameraAnimation: (map: Map) => map.easeTo({\n duration: 300,\n zoom: map.getZoom() + 1,\n around: map.unproject(zoomInPoint)\n }, {originalEvent: e})\n };\n } else if (zoomOutPoint) {\n this._active = true;\n e.preventDefault();\n setTimeout(() => this.reset(), 0);\n return {\n cameraAnimation: (map: Map) => map.easeTo({\n duration: 300,\n zoom: map.getZoom() - 1,\n around: map.unproject(zoomOutPoint)\n }, {originalEvent: e})\n };\n }\n }\n\n touchcancel() {\n this.reset();\n }\n\n enable() {\n this._enabled = true;\n }\n\n disable() {\n this._enabled = false;\n this.reset();\n }\n\n isEnabled() {\n return this._enabled;\n }\n\n isActive() {\n return this._active;\n }\n}\n","// @flow\n\nimport DOM from '../../util/dom';\nimport type Point from '@mapbox/point-geometry';\n\nconst LEFT_BUTTON = 0;\nconst RIGHT_BUTTON = 2;\n\n// the values for each button in MouseEvent.buttons\nconst BUTTONS_FLAGS = {\n [LEFT_BUTTON]: 1,\n [RIGHT_BUTTON]: 2\n};\n\nfunction buttonStillPressed(e: MouseEvent, button: number) {\n const flag = BUTTONS_FLAGS[button];\n return e.buttons === undefined || (e.buttons & flag) !== flag;\n}\n\nclass MouseHandler {\n\n _enabled: boolean;\n _active: boolean;\n _lastPoint: Point;\n _eventButton: number;\n _moved: boolean;\n _clickTolerance: number;\n\n constructor(options: { clickTolerance: number }) {\n this.reset();\n this._clickTolerance = options.clickTolerance || 1;\n }\n\n reset() {\n this._active = false;\n this._moved = false;\n delete this._lastPoint;\n delete this._eventButton;\n }\n\n _correctButton(e: MouseEvent, button: number) { //eslint-disable-line\n return false; // implemented by child\n }\n\n _move(lastPoint: Point, point: Point) { //eslint-disable-line\n return {}; // implemented by child\n }\n\n mousedown(e: MouseEvent, point: Point) {\n if (this._lastPoint) return;\n\n const eventButton = DOM.mouseButton(e);\n if (!this._correctButton(e, eventButton)) return;\n\n this._lastPoint = point;\n this._eventButton = eventButton;\n }\n\n mousemoveWindow(e: MouseEvent, point: Point) {\n const lastPoint = this._lastPoint;\n if (!lastPoint) return;\n e.preventDefault();\n\n if (buttonStillPressed(e, this._eventButton)) {\n // Some browsers don't fire a `mouseup` when the mouseup occurs outside\n // the window or iframe:\n // https://github.com/mapbox/mapbox-gl-js/issues/4622\n //\n // If the button is no longer pressed during this `mousemove` it may have\n // been released outside of the window or iframe.\n this.reset();\n return;\n }\n\n if (!this._moved && point.dist(lastPoint) < this._clickTolerance) return;\n this._moved = true;\n this._lastPoint = point;\n\n // implemented by child class\n return this._move(lastPoint, point);\n }\n\n mouseupWindow(e: MouseEvent) {\n if (!this._lastPoint) return;\n const eventButton = DOM.mouseButton(e);\n if (eventButton !== this._eventButton) return;\n if (this._moved) DOM.suppressClick();\n this.reset();\n }\n\n enable() {\n this._enabled = true;\n }\n\n disable() {\n this._enabled = false;\n this.reset();\n }\n\n isEnabled() {\n return this._enabled;\n }\n\n isActive() {\n return this._active;\n }\n}\n\nexport class MousePanHandler extends MouseHandler {\n\n mousedown(e: MouseEvent, point: Point) {\n super.mousedown(e, point);\n if (this._lastPoint) this._active = true;\n }\n _correctButton(e: MouseEvent, button: number) {\n return button === LEFT_BUTTON && !e.ctrlKey;\n }\n\n _move(lastPoint: Point, point: Point) {\n return {\n around: point,\n panDelta: point.sub(lastPoint)\n };\n }\n}\n\nexport class MouseRotateHandler extends MouseHandler {\n _correctButton(e: MouseEvent, button: number) {\n return (button === LEFT_BUTTON && e.ctrlKey) || (button === RIGHT_BUTTON);\n }\n\n _move(lastPoint: Point, point: Point) {\n const degreesPerPixelMoved = 0.8;\n const bearingDelta = (point.x - lastPoint.x) * degreesPerPixelMoved;\n if (bearingDelta) {\n this._active = true;\n return {bearingDelta};\n }\n }\n\n contextmenu(e: MouseEvent) {\n // prevent browser context menu when necessary; we don't allow it with rotation\n // because we can't discern rotation gesture start from contextmenu on Mac\n e.preventDefault();\n }\n}\n\nexport class MousePitchHandler extends MouseHandler {\n _correctButton(e: MouseEvent, button: number) {\n return (button === LEFT_BUTTON && e.ctrlKey) || (button === RIGHT_BUTTON);\n }\n\n _move(lastPoint: Point, point: Point) {\n const degreesPerPixelMoved = -0.5;\n const pitchDelta = (point.y - lastPoint.y) * degreesPerPixelMoved;\n if (pitchDelta) {\n this._active = true;\n return {pitchDelta};\n }\n }\n\n contextmenu(e: MouseEvent) {\n // prevent browser context menu when necessary; we don't allow it with rotation\n // because we can't discern rotation gesture start from contextmenu on Mac\n e.preventDefault();\n }\n}\n","// @flow\n\nimport Point from '@mapbox/point-geometry';\nimport {indexTouches} from './handler_util';\n\nexport default class TouchPanHandler {\n\n _enabled: boolean;\n _active: boolean;\n _touches: { [string | number]: Point };\n _minTouches: number;\n _clickTolerance: number;\n _sum: Point;\n\n constructor(options: { clickTolerance: number }) {\n this._minTouches = 1;\n this._clickTolerance = options.clickTolerance || 1;\n this.reset();\n }\n\n reset() {\n this._active = false;\n this._touches = {};\n this._sum = new Point(0, 0);\n }\n\n touchstart(e: TouchEvent, points: Array, mapTouches: Array) {\n return this._calculateTransform(e, points, mapTouches);\n }\n\n touchmove(e: TouchEvent, points: Array, mapTouches: Array) {\n if (!this._active || mapTouches.length < this._minTouches) return;\n e.preventDefault();\n return this._calculateTransform(e, points, mapTouches);\n }\n\n touchend(e: TouchEvent, points: Array, mapTouches: Array) {\n this._calculateTransform(e, points, mapTouches);\n\n if (this._active && mapTouches.length < this._minTouches) {\n this.reset();\n }\n }\n\n touchcancel() {\n this.reset();\n }\n\n _calculateTransform(e: TouchEvent, points: Array, mapTouches: Array) {\n if (mapTouches.length > 0) this._active = true;\n\n const touches = indexTouches(mapTouches, points);\n\n const touchPointSum = new Point(0, 0);\n const touchDeltaSum = new Point(0, 0);\n let touchDeltaCount = 0;\n\n for (const identifier in touches) {\n const point = touches[identifier];\n const prevPoint = this._touches[identifier];\n if (prevPoint) {\n touchPointSum._add(point);\n touchDeltaSum._add(point.sub(prevPoint));\n touchDeltaCount++;\n touches[identifier] = point;\n }\n }\n\n this._touches = touches;\n\n if (touchDeltaCount < this._minTouches || !touchDeltaSum.mag()) return;\n\n const panDelta = touchDeltaSum.div(touchDeltaCount);\n this._sum._add(panDelta);\n if (this._sum.mag() < this._clickTolerance) return;\n\n const around = touchPointSum.div(touchDeltaCount);\n\n return {\n around,\n panDelta\n };\n }\n\n enable() {\n this._enabled = true;\n }\n\n disable() {\n this._enabled = false;\n this.reset();\n }\n\n isEnabled() {\n return this._enabled;\n }\n\n isActive() {\n return this._active;\n }\n}\n","// @flow\n\nimport Point from '@mapbox/point-geometry';\nimport DOM from '../../util/dom';\n\nclass TwoTouchHandler {\n\n _enabled: boolean;\n _active: boolean;\n _firstTwoTouches: [number, number];\n _vector: Point;\n _startVector: Point;\n _aroundCenter: boolean;\n\n constructor() {\n this.reset();\n }\n\n reset() {\n this._active = false;\n delete this._firstTwoTouches;\n }\n\n _start(points: [Point, Point]) {} //eslint-disable-line\n _move(points: [Point, Point], pinchAround: Point, e: TouchEvent) { return {}; } //eslint-disable-line\n\n touchstart(e: TouchEvent, points: Array, mapTouches: Array) {\n //console.log(e.target, e.targetTouches.length ? e.targetTouches[0].target : null);\n //log('touchstart', points, e.target.innerHTML, e.targetTouches.length ? e.targetTouches[0].target.innerHTML: undefined);\n if (this._firstTwoTouches || mapTouches.length < 2) return;\n\n this._firstTwoTouches = [\n mapTouches[0].identifier,\n mapTouches[1].identifier\n ];\n\n // implemented by child classes\n this._start([points[0], points[1]]);\n }\n\n touchmove(e: TouchEvent, points: Array, mapTouches: Array) {\n if (!this._firstTwoTouches) return;\n\n e.preventDefault();\n\n const [idA, idB] = this._firstTwoTouches;\n const a = getTouchById(mapTouches, points, idA);\n const b = getTouchById(mapTouches, points, idB);\n if (!a || !b) return;\n const pinchAround = this._aroundCenter ? null : a.add(b).div(2);\n\n // implemented by child classes\n return this._move([a, b], pinchAround, e);\n\n }\n\n touchend(e: TouchEvent, points: Array, mapTouches: Array) {\n if (!this._firstTwoTouches) return;\n\n const [idA, idB] = this._firstTwoTouches;\n const a = getTouchById(mapTouches, points, idA);\n const b = getTouchById(mapTouches, points, idB);\n if (a && b) return;\n\n if (this._active) DOM.suppressClick();\n\n this.reset();\n }\n\n touchcancel() {\n this.reset();\n }\n\n enable(options: ?{around?: 'center'}) {\n this._enabled = true;\n this._aroundCenter = !!options && options.around === 'center';\n }\n\n disable() {\n this._enabled = false;\n this.reset();\n }\n\n isEnabled() {\n return this._enabled;\n }\n\n isActive() {\n return this._active;\n }\n}\n\nfunction getTouchById(mapTouches: Array, points: Array, identifier: number) {\n for (let i = 0; i < mapTouches.length; i++) {\n if (mapTouches[i].identifier === identifier) return points[i];\n }\n}\n\n/* ZOOM */\n\nconst ZOOM_THRESHOLD = 0.1;\n\nfunction getZoomDelta(distance, lastDistance) {\n return Math.log(distance / lastDistance) / Math.LN2;\n}\n\nexport class TouchZoomHandler extends TwoTouchHandler {\n\n _distance: number;\n _startDistance: number;\n\n reset() {\n super.reset();\n delete this._distance;\n delete this._startDistance;\n }\n\n _start(points: [Point, Point]) {\n this._startDistance = this._distance = points[0].dist(points[1]);\n }\n\n _move(points: [Point, Point], pinchAround: Point) {\n const lastDistance = this._distance;\n this._distance = points[0].dist(points[1]);\n if (!this._active && Math.abs(getZoomDelta(this._distance, this._startDistance)) < ZOOM_THRESHOLD) return;\n this._active = true;\n return {\n zoomDelta: getZoomDelta(this._distance, lastDistance),\n pinchAround\n };\n }\n}\n\n/* ROTATE */\n\nconst ROTATION_THRESHOLD = 25; // pixels along circumference of touch circle\n\nfunction getBearingDelta(a, b) {\n return a.angleWith(b) * 180 / Math.PI;\n}\n\nexport class TouchRotateHandler extends TwoTouchHandler {\n _minDiameter: number;\n\n reset() {\n super.reset();\n delete this._minDiameter;\n delete this._startVector;\n delete this._vector;\n }\n\n _start(points: [Point, Point]) {\n this._startVector = this._vector = points[0].sub(points[1]);\n this._minDiameter = points[0].dist(points[1]);\n }\n\n _move(points: [Point, Point], pinchAround: Point) {\n const lastVector = this._vector;\n this._vector = points[0].sub(points[1]);\n\n if (!this._active && this._isBelowThreshold(this._vector)) return;\n this._active = true;\n\n return {\n bearingDelta: getBearingDelta(this._vector, lastVector),\n pinchAround\n };\n }\n\n _isBelowThreshold(vector: Point) {\n /*\n * The threshold before a rotation actually happens is configured in\n * pixels alongth circumference of the circle formed by the two fingers.\n * This makes the threshold in degrees larger when the fingers are close\n * together and smaller when the fingers are far apart.\n *\n * Use the smallest diameter from the whole gesture to reduce sensitivity\n * when pinching in and out.\n */\n\n this._minDiameter = Math.min(this._minDiameter, vector.mag());\n const circumference = Math.PI * this._minDiameter;\n const threshold = ROTATION_THRESHOLD / circumference * 360;\n\n const bearingDeltaSinceStart = getBearingDelta(vector, this._startVector);\n return Math.abs(bearingDeltaSinceStart) < threshold;\n }\n}\n\n/* PITCH */\n\nfunction isVertical(vector) {\n return Math.abs(vector.y) > Math.abs(vector.x);\n}\n\nconst ALLOWED_SINGLE_TOUCH_TIME = 100;\n\n/**\n * The `TouchPitchHandler` allows the user to pitch the map by dragging up and down with two fingers.\n */\nexport class TouchPitchHandler extends TwoTouchHandler {\n\n _valid: boolean | void;\n _firstMove: number;\n _lastPoints: [Point, Point];\n\n reset() {\n super.reset();\n this._valid = undefined;\n delete this._firstMove;\n delete this._lastPoints;\n }\n\n _start(points: [Point, Point]) {\n this._lastPoints = points;\n if (isVertical(points[0].sub(points[1]))) {\n // fingers are more horizontal than vertical\n this._valid = false;\n\n }\n }\n\n _move(points: [Point, Point], center: Point, e: TouchEvent) {\n const vectorA = points[0].sub(this._lastPoints[0]);\n const vectorB = points[1].sub(this._lastPoints[1]);\n\n this._valid = this.gestureBeginsVertically(vectorA, vectorB, e.timeStamp);\n if (!this._valid) return;\n\n this._lastPoints = points;\n this._active = true;\n const yDeltaAverage = (vectorA.y + vectorB.y) / 2;\n const degreesPerPixelMoved = -0.5;\n return {\n pitchDelta: yDeltaAverage * degreesPerPixelMoved\n };\n }\n\n gestureBeginsVertically(vectorA: Point, vectorB: Point, timeStamp: number) {\n if (this._valid !== undefined) return this._valid;\n\n const threshold = 2;\n const movedA = vectorA.mag() >= threshold;\n const movedB = vectorB.mag() >= threshold;\n\n // neither finger has moved a meaningful amount, wait\n if (!movedA && !movedB) return;\n\n // One finger has moved and the other has not.\n // If enough time has passed, decide it is not a pitch.\n if (!movedA || !movedB) {\n if (this._firstMove === undefined) {\n this._firstMove = timeStamp;\n }\n\n if (timeStamp - this._firstMove < ALLOWED_SINGLE_TOUCH_TIME) {\n // still waiting for a movement from the second finger\n return undefined;\n } else {\n return false;\n }\n }\n\n const isSameDirection = vectorA.y > 0 === vectorB.y > 0;\n return isVertical(vectorA) && isVertical(vectorB) && isSameDirection;\n }\n\n /**\n * Returns a Boolean indicating whether the \"drag to pitch\" interaction is enabled.\n *\n * @memberof TouchPitchHandler\n * @name isEnabled\n * @instance\n * @returns {boolean} `true` if the \"drag to pitch\" interaction is enabled.\n */\n\n /**\n * Returns a Boolean indicating whether the \"drag to pitch\" interaction is active, i.e. currently being used.\n *\n * @memberof TouchPitchHandler\n * @name isActive\n * @instance\n * @returns {boolean} `true` if the \"drag to pitch\" interaction is active.\n */\n\n /**\n * Enables the \"drag to pitch\" interaction.\n *\n * @memberof TouchPitchHandler\n * @name enable\n * @instance\n * @example\n * map.touchPitch.enable();\n */\n\n /**\n * Disables the \"drag to pitch\" interaction.\n *\n * @memberof TouchPitchHandler\n * @name disable\n * @instance\n * @example\n * map.touchPitch.disable();\n */\n}\n","// @flow\n\nimport type Map from '../map';\n\nconst defaultOptions = {\n panStep: 100,\n bearingStep: 15,\n pitchStep: 10\n};\n\n/**\n * The `KeyboardHandler` allows the user to zoom, rotate, and pan the map using\n * the following keyboard shortcuts:\n *\n * - `=` / `+`: Increase the zoom level by 1.\n * - `Shift-=` / `Shift-+`: Increase the zoom level by 2.\n * - `-`: Decrease the zoom level by 1.\n * - `Shift--`: Decrease the zoom level by 2.\n * - Arrow keys: Pan by 100 pixels.\n * - `Shift+⇢`: Increase the rotation by 15 degrees.\n * - `Shift+⇠`: Decrease the rotation by 15 degrees.\n * - `Shift+⇡`: Increase the pitch by 10 degrees.\n * - `Shift+⇣`: Decrease the pitch by 10 degrees.\n */\nclass KeyboardHandler {\n _enabled: boolean;\n _active: boolean;\n _panStep: number;\n _bearingStep: number;\n _pitchStep: number;\n _rotationDisabled: boolean;\n\n /**\n * @private\n */\n constructor() {\n const stepOptions = defaultOptions;\n this._panStep = stepOptions.panStep;\n this._bearingStep = stepOptions.bearingStep;\n this._pitchStep = stepOptions.pitchStep;\n this._rotationDisabled = false;\n }\n\n reset() {\n this._active = false;\n }\n\n keydown(e: KeyboardEvent) {\n if (e.altKey || e.ctrlKey || e.metaKey) return;\n\n let zoomDir = 0;\n let bearingDir = 0;\n let pitchDir = 0;\n let xDir = 0;\n let yDir = 0;\n\n switch (e.keyCode) {\n case 61:\n case 107:\n case 171:\n case 187:\n zoomDir = 1;\n break;\n\n case 189:\n case 109:\n case 173:\n zoomDir = -1;\n break;\n\n case 37:\n if (e.shiftKey) {\n bearingDir = -1;\n } else {\n e.preventDefault();\n xDir = -1;\n }\n break;\n\n case 39:\n if (e.shiftKey) {\n bearingDir = 1;\n } else {\n e.preventDefault();\n xDir = 1;\n }\n break;\n\n case 38:\n if (e.shiftKey) {\n pitchDir = 1;\n } else {\n e.preventDefault();\n yDir = -1;\n }\n break;\n\n case 40:\n if (e.shiftKey) {\n pitchDir = -1;\n } else {\n e.preventDefault();\n yDir = 1;\n }\n break;\n\n default:\n return;\n }\n\n if (this._rotationDisabled) {\n bearingDir = 0;\n pitchDir = 0;\n }\n\n return {\n cameraAnimation: (map: Map) => {\n const zoom = map.getZoom();\n map.easeTo({\n duration: 300,\n easeId: 'keyboardHandler',\n easing: easeOut,\n\n zoom: zoomDir ? Math.round(zoom) + zoomDir * (e.shiftKey ? 2 : 1) : zoom,\n bearing: map.getBearing() + bearingDir * this._bearingStep,\n pitch: map.getPitch() + pitchDir * this._pitchStep,\n offset: [-xDir * this._panStep, -yDir * this._panStep],\n center: map.getCenter()\n }, {originalEvent: e});\n }\n };\n }\n\n /**\n * Enables the \"keyboard rotate and zoom\" interaction.\n *\n * @example\n * map.keyboard.enable();\n */\n enable() {\n this._enabled = true;\n }\n\n /**\n * Disables the \"keyboard rotate and zoom\" interaction.\n *\n * @example\n * map.keyboard.disable();\n */\n disable() {\n this._enabled = false;\n this.reset();\n }\n\n /**\n * Returns a Boolean indicating whether the \"keyboard rotate and zoom\"\n * interaction is enabled.\n *\n * @returns {boolean} `true` if the \"keyboard rotate and zoom\"\n * interaction is enabled.\n */\n isEnabled() {\n return this._enabled;\n }\n\n /**\n * Returns true if the handler is enabled and has detected the start of a\n * zoom/rotate gesture.\n *\n * @returns {boolean} `true` if the handler is enabled and has detected the\n * start of a zoom/rotate gesture.\n */\n isActive() {\n return this._active;\n }\n\n /**\n * Disables the \"keyboard pan/rotate\" interaction, leaving the\n * \"keyboard zoom\" interaction enabled.\n *\n * @example\n * map.keyboard.disableRotation();\n */\n disableRotation() {\n this._rotationDisabled = true;\n }\n\n /**\n * Enables the \"keyboard pan/rotate\" interaction.\n *\n * @example\n * map.keyboard.enable();\n * map.keyboard.enableRotation();\n */\n enableRotation() {\n this._rotationDisabled = false;\n }\n}\n\nfunction easeOut(t: number) {\n return t * (2 - t);\n}\n\nexport default KeyboardHandler;\n","// @flow\n\nimport assert from 'assert';\nimport DOM from '../../util/dom';\n\nimport {ease as _ease, bindAll, bezier} from '../../util/util';\nimport browser from '../../util/browser';\nimport window from '../../util/window';\nimport {number as interpolate} from '../../style-spec/util/interpolate';\nimport LngLat from '../../geo/lng_lat';\n\nimport type Map from '../map';\nimport type HandlerManager from '../handler_manager';\nimport type Point from '@mapbox/point-geometry';\n\n// deltaY value for mouse scroll wheel identification\nconst wheelZoomDelta = 4.000244140625;\n\n// These magic numbers control the rate of zoom. Trackpad events fire at a greater\n// frequency than mouse scroll wheel, so reduce the zoom rate per wheel tick\nconst defaultZoomRate = 1 / 100;\nconst wheelZoomRate = 1 / 450;\n\n// upper bound on how much we scale the map in any single render frame; this\n// is used to limit zoom rate in the case of very fast scrolling\nconst maxScalePerFrame = 2;\n\n/**\n * The `ScrollZoomHandler` allows the user to zoom the map by scrolling.\n */\nclass ScrollZoomHandler {\n _map: Map;\n _el: HTMLElement;\n _enabled: boolean;\n _active: boolean;\n _zooming: boolean;\n _aroundCenter: boolean;\n _around: Point;\n _aroundPoint: Point;\n _type: 'wheel' | 'trackpad' | null;\n _lastValue: number;\n _timeout: ?TimeoutID; // used for delayed-handling of a single wheel movement\n _finishTimeout: ?TimeoutID; // used to delay final '{move,zoom}end' events\n\n _lastWheelEvent: any;\n _lastWheelEventTime: number;\n\n _startZoom: ?number;\n _targetZoom: ?number;\n _delta: number;\n _easing: ?((number) => number);\n _prevEase: ?{start: number, duration: number, easing: (_: number) => number};\n\n _frameId: ?boolean;\n _handler: HandlerManager;\n\n _defaultZoomRate: number;\n _wheelZoomRate: number;\n\n /**\n * @private\n */\n constructor(map: Map, handler: HandlerManager) {\n this._map = map;\n this._el = map.getCanvasContainer();\n this._handler = handler;\n\n this._delta = 0;\n\n this._defaultZoomRate = defaultZoomRate;\n this._wheelZoomRate = wheelZoomRate;\n\n bindAll(['_onTimeout'], this);\n }\n\n /**\n * Set the zoom rate of a trackpad\n * @param {number} [zoomRate=1/100] The rate used to scale trackpad movement to a zoom value.\n * @example\n * // Speed up trackpad zoom\n * map.scrollZoom.setZoomRate(1/25);\n */\n setZoomRate(zoomRate: number) {\n this._defaultZoomRate = zoomRate;\n }\n\n /**\n * Set the zoom rate of a mouse wheel\n * @param {number} [wheelZoomRate=1/450] The rate used to scale mouse wheel movement to a zoom value.\n * @example\n * // Slow down zoom of mouse wheel\n * map.scrollZoom.setWheelZoomRate(1/600);\n */\n setWheelZoomRate(wheelZoomRate: number) {\n this._wheelZoomRate = wheelZoomRate;\n }\n\n /**\n * Returns a Boolean indicating whether the \"scroll to zoom\" interaction is enabled.\n *\n * @returns {boolean} `true` if the \"scroll to zoom\" interaction is enabled.\n */\n isEnabled() {\n return !!this._enabled;\n }\n\n /*\n * Active state is turned on and off with every scroll wheel event and is set back to false before the map\n * render is called, so _active is not a good candidate for determining if a scroll zoom animation is in\n * progress.\n */\n isActive() {\n return !!this._active || this._finishTimeout !== undefined;\n }\n\n isZooming() {\n return !!this._zooming;\n }\n\n /**\n * Enables the \"scroll to zoom\" interaction.\n *\n * @param {Object} [options] Options object.\n * @param {string} [options.around] If \"center\" is passed, map will zoom around center of map\n *\n * @example\n * map.scrollZoom.enable();\n * @example\n * map.scrollZoom.enable({ around: 'center' })\n */\n enable(options: any) {\n if (this.isEnabled()) return;\n this._enabled = true;\n this._aroundCenter = options && options.around === 'center';\n }\n\n /**\n * Disables the \"scroll to zoom\" interaction.\n *\n * @example\n * map.scrollZoom.disable();\n */\n disable() {\n if (!this.isEnabled()) return;\n this._enabled = false;\n }\n\n wheel(e: WheelEvent) {\n if (!this.isEnabled()) return;\n\n // Remove `any` cast when https://github.com/facebook/flow/issues/4879 is fixed.\n let value = e.deltaMode === (window.WheelEvent: any).DOM_DELTA_LINE ? e.deltaY * 40 : e.deltaY;\n const now = browser.now(),\n timeDelta = now - (this._lastWheelEventTime || 0);\n\n this._lastWheelEventTime = now;\n\n if (value !== 0 && (value % wheelZoomDelta) === 0) {\n // This one is definitely a mouse wheel event.\n this._type = 'wheel';\n\n } else if (value !== 0 && Math.abs(value) < 4) {\n // This one is definitely a trackpad event because it is so small.\n this._type = 'trackpad';\n\n } else if (timeDelta > 400) {\n // This is likely a new scroll action.\n this._type = null;\n this._lastValue = value;\n\n // Start a timeout in case this was a singular event, and dely it by up to 40ms.\n this._timeout = setTimeout(this._onTimeout, 40, e);\n\n } else if (!this._type) {\n // This is a repeating event, but we don't know the type of event just yet.\n // If the delta per time is small, we assume it's a fast trackpad; otherwise we switch into wheel mode.\n this._type = (Math.abs(timeDelta * value) < 200) ? 'trackpad' : 'wheel';\n\n // Make sure our delayed event isn't fired again, because we accumulate\n // the previous event (which was less than 40ms ago) into this event.\n if (this._timeout) {\n clearTimeout(this._timeout);\n this._timeout = null;\n value += this._lastValue;\n }\n }\n\n // Slow down zoom if shift key is held for more precise zooming\n if (e.shiftKey && value) value = value / 4;\n\n // Only fire the callback if we actually know what type of scrolling device the user uses.\n if (this._type) {\n this._lastWheelEvent = e;\n this._delta -= value;\n if (!this._active) {\n this._start(e);\n }\n }\n\n e.preventDefault();\n }\n\n _onTimeout(initialEvent: any) {\n this._type = 'wheel';\n this._delta -= this._lastValue;\n if (!this._active) {\n this._start(initialEvent);\n }\n }\n\n _start(e: any) {\n if (!this._delta) return;\n\n if (this._frameId) {\n this._frameId = null;\n }\n\n this._active = true;\n if (!this.isZooming()) {\n this._zooming = true;\n }\n\n if (this._finishTimeout) {\n clearTimeout(this._finishTimeout);\n delete this._finishTimeout;\n }\n\n const pos = DOM.mousePos(this._el, e);\n\n this._around = LngLat.convert(this._aroundCenter ? this._map.getCenter() : this._map.unproject(pos));\n this._aroundPoint = this._map.transform.locationPoint(this._around);\n if (!this._frameId) {\n this._frameId = true;\n this._handler._triggerRenderFrame();\n }\n }\n\n renderFrame() {\n if (!this._frameId) return;\n this._frameId = null;\n\n if (!this.isActive()) return;\n const tr = this._map.transform;\n\n // if we've had scroll events since the last render frame, consume the\n // accumulated delta, and update the target zoom level accordingly\n if (this._delta !== 0) {\n // For trackpad events and single mouse wheel ticks, use the default zoom rate\n const zoomRate = (this._type === 'wheel' && Math.abs(this._delta) > wheelZoomDelta) ? this._wheelZoomRate : this._defaultZoomRate;\n // Scale by sigmoid of scroll wheel delta.\n let scale = maxScalePerFrame / (1 + Math.exp(-Math.abs(this._delta * zoomRate)));\n\n if (this._delta < 0 && scale !== 0) {\n scale = 1 / scale;\n }\n\n const fromScale = typeof this._targetZoom === 'number' ? tr.zoomScale(this._targetZoom) : tr.scale;\n this._targetZoom = Math.min(tr.maxZoom, Math.max(tr.minZoom, tr.scaleZoom(fromScale * scale)));\n\n // if this is a mouse wheel, refresh the starting zoom and easing\n // function we're using to smooth out the zooming between wheel\n // events\n if (this._type === 'wheel') {\n this._startZoom = tr.zoom;\n this._easing = this._smoothOutEasing(200);\n }\n\n this._delta = 0;\n }\n\n const targetZoom = typeof this._targetZoom === 'number' ?\n this._targetZoom : tr.zoom;\n const startZoom = this._startZoom;\n const easing = this._easing;\n\n let finished = false;\n let zoom;\n if (this._type === 'wheel' && startZoom && easing) {\n assert(easing && typeof startZoom === 'number');\n\n const t = Math.min((browser.now() - this._lastWheelEventTime) / 200, 1);\n const k = easing(t);\n zoom = interpolate(startZoom, targetZoom, k);\n if (t < 1) {\n if (!this._frameId) {\n this._frameId = true;\n }\n } else {\n finished = true;\n }\n } else {\n zoom = targetZoom;\n finished = true;\n }\n\n this._active = true;\n\n if (finished) {\n this._active = false;\n this._finishTimeout = setTimeout(() => {\n this._zooming = false;\n this._handler._triggerRenderFrame();\n delete this._targetZoom;\n delete this._finishTimeout;\n }, 200);\n }\n\n return {\n noInertia: true,\n needsRenderFrame: !finished,\n zoomDelta: zoom - tr.zoom,\n around: this._aroundPoint,\n originalEvent: this._lastWheelEvent\n };\n }\n\n _smoothOutEasing(duration: number) {\n let easing = _ease;\n\n if (this._prevEase) {\n const ease = this._prevEase,\n t = (browser.now() - ease.start) / ease.duration,\n speed = ease.easing(t + 0.01) - ease.easing(t),\n\n // Quick hack to make new bezier that is continuous with last\n x = 0.27 / Math.sqrt(speed * speed + 0.0001) * 0.01,\n y = Math.sqrt(0.27 * 0.27 - x * x);\n\n easing = bezier(x, y, 0.25, 1);\n }\n\n this._prevEase = {\n start: browser.now(),\n duration,\n easing\n };\n\n return easing;\n }\n\n reset() {\n this._active = false;\n }\n}\n\nexport default ScrollZoomHandler;\n","// @flow\n\nimport type ClickZoomHandler from '../click_zoom';\nimport type TapZoomHandler from './../tap_zoom';\n\n/**\n * The `DoubleClickZoomHandler` allows the user to zoom the map at a point by\n * double clicking or double tapping.\n */\nexport default class DoubleClickZoomHandler {\n\n _clickZoom: ClickZoomHandler;\n _tapZoom: TapZoomHandler;\n\n /**\n * @private\n */\n constructor(clickZoom: ClickZoomHandler, TapZoom: TapZoomHandler) {\n this._clickZoom = clickZoom;\n this._tapZoom = TapZoom;\n }\n\n /**\n * Enables the \"double click to zoom\" interaction.\n *\n * @example\n * map.doubleClickZoom.enable();\n */\n enable() {\n this._clickZoom.enable();\n this._tapZoom.enable();\n }\n\n /**\n * Disables the \"double click to zoom\" interaction.\n *\n * @example\n * map.doubleClickZoom.disable();\n */\n disable() {\n this._clickZoom.disable();\n this._tapZoom.disable();\n }\n\n /**\n * Returns a Boolean indicating whether the \"double click to zoom\" interaction is enabled.\n *\n * @returns {boolean} `true` if the \"double click to zoom\" interaction is enabled.\n */\n isEnabled() {\n return this._clickZoom.isEnabled() && this._tapZoom.isEnabled();\n }\n\n /**\n * Returns a Boolean indicating whether the \"double click to zoom\" interaction is active, i.e. currently being used.\n *\n * @returns {boolean} `true` if the \"double click to zoom\" interaction is active.\n */\n isActive() {\n return this._clickZoom.isActive() || this._tapZoom.isActive();\n }\n}\n","// @flow\n\nimport type Point from '@mapbox/point-geometry';\nimport type Map from '../map';\n\nexport default class ClickZoomHandler {\n\n _enabled: boolean;\n _active: boolean;\n\n constructor() {\n this.reset();\n }\n\n reset() {\n this._active = false;\n }\n\n dblclick(e: MouseEvent, point: Point) {\n e.preventDefault();\n return {\n cameraAnimation: (map: Map) => {\n map.easeTo({\n duration: 300,\n zoom: map.getZoom() + (e.shiftKey ? -1 : 1),\n around: map.unproject(point)\n }, {originalEvent: e});\n }\n };\n }\n\n enable() {\n this._enabled = true;\n }\n\n disable() {\n this._enabled = false;\n this.reset();\n }\n\n isEnabled() {\n return this._enabled;\n }\n\n isActive() {\n return this._active;\n }\n}\n","// @flow\n\nimport {TapRecognizer, MAX_TAP_INTERVAL} from './tap_recognizer';\nimport type Point from '@mapbox/point-geometry';\n\nexport default class TapDragZoomHandler {\n\n _enabled: boolean;\n _active: boolean;\n _swipePoint: Point;\n _swipeTouch: number;\n _tapTime: number;\n _tap: TapRecognizer;\n\n constructor() {\n\n this._tap = new TapRecognizer({\n numTouches: 1,\n numTaps: 1\n });\n\n this.reset();\n }\n\n reset() {\n this._active = false;\n delete this._swipePoint;\n delete this._swipeTouch;\n delete this._tapTime;\n this._tap.reset();\n }\n\n touchstart(e: TouchEvent, points: Array, mapTouches: Array) {\n if (this._swipePoint) return;\n\n if (this._tapTime && e.timeStamp - this._tapTime > MAX_TAP_INTERVAL) {\n this.reset();\n }\n\n if (!this._tapTime) {\n this._tap.touchstart(e, points, mapTouches);\n } else if (mapTouches.length > 0) {\n this._swipePoint = points[0];\n this._swipeTouch = mapTouches[0].identifier;\n }\n\n }\n\n touchmove(e: TouchEvent, points: Array, mapTouches: Array) {\n if (!this._tapTime) {\n this._tap.touchmove(e, points, mapTouches);\n } else if (this._swipePoint) {\n if (mapTouches[0].identifier !== this._swipeTouch) {\n return;\n }\n\n const newSwipePoint = points[0];\n const dist = newSwipePoint.y - this._swipePoint.y;\n this._swipePoint = newSwipePoint;\n\n e.preventDefault();\n this._active = true;\n\n return {\n zoomDelta: dist / 128\n };\n }\n }\n\n touchend(e: TouchEvent, points: Array, mapTouches: Array) {\n if (!this._tapTime) {\n const point = this._tap.touchend(e, points, mapTouches);\n if (point) {\n this._tapTime = e.timeStamp;\n }\n } else if (this._swipePoint) {\n if (mapTouches.length === 0) {\n this.reset();\n }\n }\n }\n\n touchcancel() {\n this.reset();\n }\n\n enable() {\n this._enabled = true;\n }\n\n disable() {\n this._enabled = false;\n this.reset();\n }\n\n isEnabled() {\n return this._enabled;\n }\n\n isActive() {\n return this._active;\n }\n}\n","// @flow\n\nimport type {MousePanHandler} from '../mouse';\nimport type TouchPanHandler from './../touch_pan';\n\nexport type DragPanOptions = {\n linearity?: number;\n easing?: (t: number) => number;\n deceleration?: number;\n maxSpeed?: number;\n};\n\n/**\n * The `DragPanHandler` allows the user to pan the map by clicking and dragging\n * the cursor.\n */\nexport default class DragPanHandler {\n\n _el: HTMLElement;\n _mousePan: MousePanHandler;\n _touchPan: TouchPanHandler;\n _inertiaOptions: DragPanOptions\n\n /**\n * @private\n */\n constructor(el: HTMLElement, mousePan: MousePanHandler, touchPan: TouchPanHandler) {\n this._el = el;\n this._mousePan = mousePan;\n this._touchPan = touchPan;\n }\n\n /**\n * Enables the \"drag to pan\" interaction.\n *\n * @param {Object} [options] Options object\n * @param {number} [options.linearity=0] factor used to scale the drag velocity\n * @param {Function} [options.easing=bezier(0, 0, 0.3, 1)] easing function applled to `map.panTo` when applying the drag.\n * @param {number} [options.maxSpeed=1400] the maximum value of the drag velocity.\n * @param {number} [options.deceleration=2500] the rate at which the speed reduces after the pan ends.\n *\n * @example\n * map.dragPan.enable();\n * @example\n * map.dragPan.enable({\n * linearity: 0.3,\n * easing: bezier(0, 0, 0.3, 1),\n * maxSpeed: 1400,\n * deceleration: 2500,\n * });\n */\n enable(options?: DragPanOptions) {\n this._inertiaOptions = options || {};\n this._mousePan.enable();\n this._touchPan.enable();\n this._el.classList.add('maplibregl-touch-drag-pan', 'mapboxgl-touch-drag-pan');\n }\n\n /**\n * Disables the \"drag to pan\" interaction.\n *\n * @example\n * map.dragPan.disable();\n */\n disable() {\n this._mousePan.disable();\n this._touchPan.disable();\n this._el.classList.remove('maplibregl-touch-drag-pan', 'mapboxgl-touch-drag-pan');\n }\n\n /**\n * Returns a Boolean indicating whether the \"drag to pan\" interaction is enabled.\n *\n * @returns {boolean} `true` if the \"drag to pan\" interaction is enabled.\n */\n isEnabled() {\n return this._mousePan.isEnabled() && this._touchPan.isEnabled();\n }\n\n /**\n * Returns a Boolean indicating whether the \"drag to pan\" interaction is active, i.e. currently being used.\n *\n * @returns {boolean} `true` if the \"drag to pan\" interaction is active.\n */\n isActive() {\n return this._mousePan.isActive() || this._touchPan.isActive();\n }\n}\n","// @flow\n\nimport type {MouseRotateHandler, MousePitchHandler} from '../mouse';\n\n/**\n * The `DragRotateHandler` allows the user to rotate the map by clicking and\n * dragging the cursor while holding the right mouse button or `ctrl` key.\n */\nexport default class DragRotateHandler {\n\n _mouseRotate: MouseRotateHandler;\n _mousePitch: MousePitchHandler;\n _pitchWithRotate: boolean;\n\n /**\n * @param {Object} [options]\n * @param {number} [options.bearingSnap] The threshold, measured in degrees, that determines when the map's\n * bearing will snap to north.\n * @param {bool} [options.pitchWithRotate=true] Control the map pitch in addition to the bearing\n * @private\n */\n constructor(options: {pitchWithRotate: boolean}, mouseRotate: MouseRotateHandler, mousePitch: MousePitchHandler) {\n this._pitchWithRotate = options.pitchWithRotate;\n this._mouseRotate = mouseRotate;\n this._mousePitch = mousePitch;\n }\n\n /**\n * Enables the \"drag to rotate\" interaction.\n *\n * @example\n * map.dragRotate.enable();\n */\n enable() {\n this._mouseRotate.enable();\n if (this._pitchWithRotate) this._mousePitch.enable();\n }\n\n /**\n * Disables the \"drag to rotate\" interaction.\n *\n * @example\n * map.dragRotate.disable();\n */\n disable() {\n this._mouseRotate.disable();\n this._mousePitch.disable();\n }\n\n /**\n * Returns a Boolean indicating whether the \"drag to rotate\" interaction is enabled.\n *\n * @returns {boolean} `true` if the \"drag to rotate\" interaction is enabled.\n */\n isEnabled() {\n return this._mouseRotate.isEnabled() && (!this._pitchWithRotate || this._mousePitch.isEnabled());\n }\n\n /**\n * Returns a Boolean indicating whether the \"drag to rotate\" interaction is active, i.e. currently being used.\n *\n * @returns {boolean} `true` if the \"drag to rotate\" interaction is active.\n */\n isActive() {\n return this._mouseRotate.isActive() || this._mousePitch.isActive();\n }\n}\n","// @flow\n\nimport type {TouchZoomHandler, TouchRotateHandler} from '../touch_zoom_rotate';\nimport type TapDragZoomHandler from '../tap_drag_zoom';\n\n/**\n * The `TouchZoomRotateHandler` allows the user to zoom and rotate the map by\n * pinching on a touchscreen.\n *\n * They can zoom with one finger by double tapping and dragging. On the second tap,\n * hold the finger down and drag up or down to zoom in or out.\n */\nexport default class TouchZoomRotateHandler {\n\n _el: HTMLElement;\n _touchZoom: TouchZoomHandler;\n _touchRotate: TouchRotateHandler;\n _tapDragZoom: TapDragZoomHandler;\n _rotationDisabled: boolean;\n _enabled: boolean;\n\n /**\n * @private\n */\n constructor(el: HTMLElement, touchZoom: TouchZoomHandler, touchRotate: TouchRotateHandler, tapDragZoom: TapDragZoomHandler) {\n this._el = el;\n this._touchZoom = touchZoom;\n this._touchRotate = touchRotate;\n this._tapDragZoom = tapDragZoom;\n this._rotationDisabled = false;\n this._enabled = true;\n }\n\n /**\n * Enables the \"pinch to rotate and zoom\" interaction.\n *\n * @param {Object} [options] Options object.\n * @param {string} [options.around] If \"center\" is passed, map will zoom around the center\n *\n * @example\n * map.touchZoomRotate.enable();\n * @example\n * map.touchZoomRotate.enable({ around: 'center' });\n */\n enable(options: ?{around?: 'center'}) {\n this._touchZoom.enable(options);\n if (!this._rotationDisabled) this._touchRotate.enable(options);\n this._tapDragZoom.enable();\n this._el.classList.add('maplibregl-touch-zoom-rotate', 'mapboxgl-touch-zoom-rotate');\n }\n\n /**\n * Disables the \"pinch to rotate and zoom\" interaction.\n *\n * @example\n * map.touchZoomRotate.disable();\n */\n disable() {\n this._touchZoom.disable();\n this._touchRotate.disable();\n this._tapDragZoom.disable();\n this._el.classList.remove('maplibregl-touch-zoom-rotate', 'mapboxgl-touch-zoom-rotate');\n }\n\n /**\n * Returns a Boolean indicating whether the \"pinch to rotate and zoom\" interaction is enabled.\n *\n * @returns {boolean} `true` if the \"pinch to rotate and zoom\" interaction is enabled.\n */\n isEnabled() {\n return this._touchZoom.isEnabled() &&\n (this._rotationDisabled || this._touchRotate.isEnabled()) &&\n this._tapDragZoom.isEnabled();\n }\n\n /**\n * Returns true if the handler is enabled and has detected the start of a zoom/rotate gesture.\n *\n * @returns {boolean} //eslint-disable-line\n */\n isActive() {\n return this._touchZoom.isActive() || this._touchRotate.isActive() || this._tapDragZoom.isActive();\n }\n\n /**\n * Disables the \"pinch to rotate\" interaction, leaving the \"pinch to zoom\"\n * interaction enabled.\n *\n * @example\n * map.touchZoomRotate.disableRotation();\n */\n disableRotation() {\n this._rotationDisabled = true;\n this._touchRotate.disable();\n }\n\n /**\n * Enables the \"pinch to rotate\" interaction.\n *\n * @example\n * map.touchZoomRotate.enable();\n * map.touchZoomRotate.enableRotation();\n */\n enableRotation() {\n this._rotationDisabled = false;\n if (this._touchZoom.isEnabled()) this._touchRotate.enable();\n }\n}\n","// @flow\n\nimport {Event} from '../util/evented';\nimport DOM from '../util/dom';\nimport type Map from './map';\nimport HandlerInertia from './handler_inertia';\nimport {MapEventHandler, BlockableMapEventHandler} from './handler/map_event';\nimport BoxZoomHandler from './handler/box_zoom';\nimport TapZoomHandler from './handler/tap_zoom';\nimport {MousePanHandler, MouseRotateHandler, MousePitchHandler} from './handler/mouse';\nimport TouchPanHandler from './handler/touch_pan';\nimport {TouchZoomHandler, TouchRotateHandler, TouchPitchHandler} from './handler/touch_zoom_rotate';\nimport KeyboardHandler from './handler/keyboard';\nimport ScrollZoomHandler from './handler/scroll_zoom';\nimport DoubleClickZoomHandler from './handler/shim/dblclick_zoom';\nimport ClickZoomHandler from './handler/click_zoom';\nimport TapDragZoomHandler from './handler/tap_drag_zoom';\nimport DragPanHandler from './handler/shim/drag_pan';\nimport DragRotateHandler from './handler/shim/drag_rotate';\nimport TouchZoomRotateHandler from './handler/shim/touch_zoom_rotate';\nimport {bindAll, extend} from '../util/util';\nimport window from '../util/window';\nimport Point from '@mapbox/point-geometry';\nimport assert from 'assert';\n\nexport type InputEvent = MouseEvent | TouchEvent | KeyboardEvent | WheelEvent;\n\nconst isMoving = p => p.zoom || p.drag || p.pitch || p.rotate;\n\nclass RenderFrameEvent extends Event {\n type: 'renderFrame';\n timeStamp: number;\n}\n\n// Handlers interpret dom events and return camera changes that should be\n// applied to the map (`HandlerResult`s). The camera changes are all deltas.\n// The handler itself should have no knowledge of the map's current state.\n// This makes it easier to merge multiple results and keeps handlers simpler.\n// For example, if there is a mousedown and mousemove, the mousePan handler\n// would return a `panDelta` on the mousemove.\nexport interface Handler {\n enable(): void;\n disable(): void;\n isEnabled(): boolean;\n isActive(): boolean;\n\n // `reset` can be called by the manager at any time and must reset everything to it's original state\n reset(): void;\n\n // Handlers can optionally implement these methods.\n // They are called with dom events whenever those dom evens are received.\n +touchstart?: (e: TouchEvent, points: Array, mapTouches: Array) => HandlerResult | void;\n +touchmove?: (e: TouchEvent, points: Array, mapTouches: Array) => HandlerResult | void;\n +touchend?: (e: TouchEvent, points: Array, mapTouches: Array) => HandlerResult | void;\n +touchcancel?: (e: TouchEvent, points: Array, mapTouches: Array) => HandlerResult | void;\n +mousedown?: (e: MouseEvent, point: Point) => HandlerResult | void;\n +mousemove?: (e: MouseEvent, point: Point) => HandlerResult | void;\n +mouseup?: (e: MouseEvent, point: Point) => HandlerResult | void;\n +dblclick?: (e: MouseEvent, point: Point) => HandlerResult | void;\n +wheel?: (e: WheelEvent, point: Point) => HandlerResult | void;\n +keydown?: (e: KeyboardEvent) => HandlerResult | void;\n +keyup?: (e: KeyboardEvent) => HandlerResult | void;\n\n // `renderFrame` is the only non-dom event. It is called during render\n // frames and can be used to smooth camera changes (see scroll handler).\n +renderFrame?: () => HandlerResult | void;\n}\n\n// All handler methods that are called with events can optionally return a `HandlerResult`.\nexport type HandlerResult = {|\n panDelta?: Point,\n zoomDelta?: number,\n bearingDelta?: number,\n pitchDelta?: number,\n // the point to not move when changing the camera\n around?: Point | null,\n // same as above, except for pinch actions, which are given higher priority\n pinchAround?: Point | null,\n // A method that can fire a one-off easing by directly changing the map's camera.\n cameraAnimation?: (map: Map) => any;\n\n // The last three properties are needed by only one handler: scrollzoom.\n // The DOM event to be used as the `originalEvent` on any camera change events.\n originalEvent?: any,\n // Makes the manager trigger a frame, allowing the handler to return multiple results over time (see scrollzoom).\n needsRenderFrame?: boolean,\n // The camera changes won't get recorded for inertial zooming.\n noInertia?: boolean\n|};\n\nfunction hasChange(result: HandlerResult) {\n return (result.panDelta && result.panDelta.mag()) || result.zoomDelta || result.bearingDelta || result.pitchDelta;\n}\n\nclass HandlerManager {\n _map: Map;\n _el: HTMLElement;\n _handlers: Array<{ handlerName: string, handler: Handler, allowed: any }>;\n _eventsInProgress: Object;\n _frameId: number;\n _inertia: HandlerInertia;\n _bearingSnap: number;\n _handlersById: { [string]: Handler };\n _updatingCamera: boolean;\n _changes: Array<[HandlerResult, Object, any]>;\n _previousActiveHandlers: { [string]: Handler };\n _listeners: Array<[HTMLElement, string, void | {passive?: boolean, capture?: boolean}]>;\n\n constructor(map: Map, options: { interactive: boolean, pitchWithRotate: boolean, clickTolerance: number, bearingSnap: number}) {\n this._map = map;\n this._el = this._map.getCanvasContainer();\n this._handlers = [];\n this._handlersById = {};\n this._changes = [];\n\n this._inertia = new HandlerInertia(map);\n this._bearingSnap = options.bearingSnap;\n this._previousActiveHandlers = {};\n\n // Track whether map is currently moving, to compute start/move/end events\n this._eventsInProgress = {};\n\n this._addDefaultHandlers(options);\n\n bindAll(['handleEvent', 'handleWindowEvent'], this);\n\n const el = this._el;\n\n this._listeners = [\n // This needs to be `passive: true` so that a double tap fires two\n // pairs of touchstart/end events in iOS Safari 13. If this is set to\n // `passive: false` then the second pair of events is only fired if\n // preventDefault() is called on the first touchstart. Calling preventDefault()\n // undesirably prevents click events.\n [el, 'touchstart', {passive: true}],\n // This needs to be `passive: false` so that scrolls and pinches can be\n // prevented in browsers that don't support `touch-actions: none`, for example iOS Safari 12.\n [el, 'touchmove', {passive: false}],\n [el, 'touchend', undefined],\n [el, 'touchcancel', undefined],\n\n [el, 'mousedown', undefined],\n [el, 'mousemove', undefined],\n [el, 'mouseup', undefined],\n\n // Bind window-level event listeners for move and up/end events. In the absence of\n // the pointer capture API, which is not supported by all necessary platforms,\n // window-level event listeners give us the best shot at capturing events that\n // fall outside the map canvas element. Use `{capture: true}` for the move event\n // to prevent map move events from being fired during a drag.\n [window.document, 'mousemove', {capture: true}],\n [window.document, 'mouseup', undefined],\n\n [el, 'mouseover', undefined],\n [el, 'mouseout', undefined],\n [el, 'dblclick', undefined],\n [el, 'click', undefined],\n\n [el, 'keydown', {capture: false}],\n [el, 'keyup', undefined],\n\n [el, 'wheel', {passive: false}],\n [el, 'contextmenu', undefined],\n\n [window, 'blur', undefined]\n ];\n\n for (const [target, type, listenerOptions] of this._listeners) {\n DOM.addEventListener(target, type, target === window.document ? this.handleWindowEvent : this.handleEvent, listenerOptions);\n }\n }\n\n destroy() {\n for (const [target, type, listenerOptions] of this._listeners) {\n DOM.removeEventListener(target, type, target === window.document ? this.handleWindowEvent : this.handleEvent, listenerOptions);\n }\n }\n\n _addDefaultHandlers(options: { interactive: boolean, pitchWithRotate: boolean, clickTolerance: number }) {\n const map = this._map;\n const el = map.getCanvasContainer();\n this._add('mapEvent', new MapEventHandler(map, options));\n\n const boxZoom = map.boxZoom = new BoxZoomHandler(map, options);\n this._add('boxZoom', boxZoom);\n\n const tapZoom = new TapZoomHandler();\n const clickZoom = new ClickZoomHandler();\n map.doubleClickZoom = new DoubleClickZoomHandler(clickZoom, tapZoom);\n this._add('tapZoom', tapZoom);\n this._add('clickZoom', clickZoom);\n\n const tapDragZoom = new TapDragZoomHandler();\n this._add('tapDragZoom', tapDragZoom);\n\n const touchPitch = map.touchPitch = new TouchPitchHandler();\n this._add('touchPitch', touchPitch);\n\n const mouseRotate = new MouseRotateHandler(options);\n const mousePitch = new MousePitchHandler(options);\n map.dragRotate = new DragRotateHandler(options, mouseRotate, mousePitch);\n this._add('mouseRotate', mouseRotate, ['mousePitch']);\n this._add('mousePitch', mousePitch, ['mouseRotate']);\n\n const mousePan = new MousePanHandler(options);\n const touchPan = new TouchPanHandler(options);\n map.dragPan = new DragPanHandler(el, mousePan, touchPan);\n this._add('mousePan', mousePan);\n this._add('touchPan', touchPan, ['touchZoom', 'touchRotate']);\n\n const touchRotate = new TouchRotateHandler();\n const touchZoom = new TouchZoomHandler();\n map.touchZoomRotate = new TouchZoomRotateHandler(el, touchZoom, touchRotate, tapDragZoom);\n this._add('touchRotate', touchRotate, ['touchPan', 'touchZoom']);\n this._add('touchZoom', touchZoom, ['touchPan', 'touchRotate']);\n\n const scrollZoom = map.scrollZoom = new ScrollZoomHandler(map, this);\n this._add('scrollZoom', scrollZoom, ['mousePan']);\n\n const keyboard = map.keyboard = new KeyboardHandler();\n this._add('keyboard', keyboard);\n\n this._add('blockableMapEvent', new BlockableMapEventHandler(map));\n\n for (const name of ['boxZoom', 'doubleClickZoom', 'tapDragZoom', 'touchPitch', 'dragRotate', 'dragPan', 'touchZoomRotate', 'scrollZoom', 'keyboard']) {\n if (options.interactive && (options: any)[name]) {\n (map: any)[name].enable((options: any)[name]);\n }\n }\n }\n\n _add(handlerName: string, handler: Handler, allowed?: Array) {\n this._handlers.push({handlerName, handler, allowed});\n this._handlersById[handlerName] = handler;\n }\n\n stop(allowEndAnimation: boolean) {\n // do nothing if this method was triggered by a gesture update\n if (this._updatingCamera) return;\n\n for (const {handler} of this._handlers) {\n handler.reset();\n }\n this._inertia.clear();\n this._fireEvents({}, {}, allowEndAnimation);\n this._changes = [];\n }\n\n isActive() {\n for (const {handler} of this._handlers) {\n if (handler.isActive()) return true;\n }\n return false;\n }\n\n isZooming() {\n return !!this._eventsInProgress.zoom || this._map.scrollZoom.isZooming();\n }\n isRotating() {\n return !!this._eventsInProgress.rotate;\n }\n\n isMoving() {\n return Boolean(isMoving(this._eventsInProgress)) || this.isZooming();\n }\n\n _blockedByActive(activeHandlers: { [string]: Handler }, allowed: Array, myName: string) {\n for (const name in activeHandlers) {\n if (name === myName) continue;\n if (!allowed || allowed.indexOf(name) < 0) {\n return true;\n }\n }\n return false;\n }\n\n handleWindowEvent(e: InputEvent) {\n this.handleEvent(e, `${e.type}Window`);\n }\n\n _getMapTouches(touches: TouchList) {\n const mapTouches = [];\n for (const t of touches) {\n const target = ((t.target: any): Node);\n if (this._el.contains(target)) {\n mapTouches.push(t);\n }\n }\n return ((mapTouches: any): TouchList);\n }\n\n handleEvent(e: InputEvent | RenderFrameEvent, eventName?: string) {\n\n if (e.type === 'blur') {\n this.stop(true);\n return;\n }\n\n this._updatingCamera = true;\n assert(e.timeStamp !== undefined);\n\n const inputEvent = e.type === 'renderFrame' ? undefined : ((e: any): InputEvent);\n\n /*\n * We don't call e.preventDefault() for any events by default.\n * Handlers are responsible for calling it where necessary.\n */\n\n const mergedHandlerResult: HandlerResult = {needsRenderFrame: false};\n const eventsInProgress = {};\n const activeHandlers = {};\n\n const mapTouches = e.touches ? this._getMapTouches(((e: any): TouchEvent).touches) : undefined;\n const points = mapTouches ? DOM.touchPos(this._el, mapTouches) : DOM.mousePos(this._el, ((e: any): MouseEvent));\n\n for (const {handlerName, handler, allowed} of this._handlers) {\n if (!handler.isEnabled()) continue;\n\n let data: HandlerResult | void;\n if (this._blockedByActive(activeHandlers, allowed, handlerName)) {\n handler.reset();\n\n } else {\n if ((handler: any)[eventName || e.type]) {\n data = (handler: any)[eventName || e.type](e, points, mapTouches);\n this.mergeHandlerResult(mergedHandlerResult, eventsInProgress, data, handlerName, inputEvent);\n if (data && data.needsRenderFrame) {\n this._triggerRenderFrame();\n }\n }\n }\n\n if (data || handler.isActive()) {\n activeHandlers[handlerName] = handler;\n }\n }\n\n const deactivatedHandlers = {};\n for (const name in this._previousActiveHandlers) {\n if (!activeHandlers[name]) {\n deactivatedHandlers[name] = inputEvent;\n }\n }\n this._previousActiveHandlers = activeHandlers;\n\n if (Object.keys(deactivatedHandlers).length || hasChange(mergedHandlerResult)) {\n this._changes.push([mergedHandlerResult, eventsInProgress, deactivatedHandlers]);\n this._triggerRenderFrame();\n }\n\n if (Object.keys(activeHandlers).length || hasChange(mergedHandlerResult)) {\n this._map._stop(true);\n }\n\n this._updatingCamera = false;\n\n const {cameraAnimation} = mergedHandlerResult;\n if (cameraAnimation) {\n this._inertia.clear();\n this._fireEvents({}, {}, true);\n this._changes = [];\n cameraAnimation(this._map);\n }\n }\n\n mergeHandlerResult(mergedHandlerResult: HandlerResult, eventsInProgress: Object, handlerResult: HandlerResult, name: string, e?: InputEvent) {\n if (!handlerResult) return;\n\n extend(mergedHandlerResult, handlerResult);\n\n const eventData = {handlerName: name, originalEvent: handlerResult.originalEvent || e};\n\n // track which handler changed which camera property\n if (handlerResult.zoomDelta !== undefined) {\n eventsInProgress.zoom = eventData;\n }\n if (handlerResult.panDelta !== undefined) {\n eventsInProgress.drag = eventData;\n }\n if (handlerResult.pitchDelta !== undefined) {\n eventsInProgress.pitch = eventData;\n }\n if (handlerResult.bearingDelta !== undefined) {\n eventsInProgress.rotate = eventData;\n }\n\n }\n\n _applyChanges() {\n const combined = {};\n const combinedEventsInProgress = {};\n const combinedDeactivatedHandlers = {};\n\n for (const [change, eventsInProgress, deactivatedHandlers] of this._changes) {\n\n if (change.panDelta) combined.panDelta = (combined.panDelta || new Point(0, 0))._add(change.panDelta);\n if (change.zoomDelta) combined.zoomDelta = (combined.zoomDelta || 0) + change.zoomDelta;\n if (change.bearingDelta) combined.bearingDelta = (combined.bearingDelta || 0) + change.bearingDelta;\n if (change.pitchDelta) combined.pitchDelta = (combined.pitchDelta || 0) + change.pitchDelta;\n if (change.around !== undefined) combined.around = change.around;\n if (change.pinchAround !== undefined) combined.pinchAround = change.pinchAround;\n if (change.noInertia) combined.noInertia = change.noInertia;\n\n extend(combinedEventsInProgress, eventsInProgress);\n extend(combinedDeactivatedHandlers, deactivatedHandlers);\n }\n\n this._updateMapTransform(combined, combinedEventsInProgress, combinedDeactivatedHandlers);\n this._changes = [];\n }\n\n _updateMapTransform(combinedResult: any, combinedEventsInProgress: Object, deactivatedHandlers: Object) {\n\n const map = this._map;\n const tr = map.transform;\n\n if (!hasChange(combinedResult)) {\n return this._fireEvents(combinedEventsInProgress, deactivatedHandlers, true);\n }\n\n let {panDelta, zoomDelta, bearingDelta, pitchDelta, around, pinchAround} = combinedResult;\n\n if (pinchAround !== undefined) {\n around = pinchAround;\n }\n\n // stop any ongoing camera animations (easeTo, flyTo)\n map._stop(true);\n\n around = around || map.transform.centerPoint;\n const loc = tr.pointLocation(panDelta ? around.sub(panDelta) : around);\n if (bearingDelta) tr.bearing += bearingDelta;\n if (pitchDelta) tr.pitch += pitchDelta;\n if (zoomDelta) tr.zoom += zoomDelta;\n tr.setLocationAtPoint(loc, around);\n\n this._map._update();\n if (!combinedResult.noInertia) this._inertia.record(combinedResult);\n this._fireEvents(combinedEventsInProgress, deactivatedHandlers, true);\n\n }\n\n _fireEvents(newEventsInProgress: { [string]: Object }, deactivatedHandlers: Object, allowEndAnimation: boolean) {\n\n const wasMoving = isMoving(this._eventsInProgress);\n const nowMoving = isMoving(newEventsInProgress);\n\n const startEvents = {};\n\n for (const eventName in newEventsInProgress) {\n const {originalEvent} = newEventsInProgress[eventName];\n if (!this._eventsInProgress[eventName]) {\n startEvents[`${eventName}start`] = originalEvent;\n }\n this._eventsInProgress[eventName] = newEventsInProgress[eventName];\n }\n\n // fire start events only after this._eventsInProgress has been updated\n if (!wasMoving && nowMoving) {\n this._fireEvent('movestart', nowMoving.originalEvent);\n }\n\n for (const name in startEvents) {\n this._fireEvent(name, startEvents[name]);\n }\n\n if (nowMoving) {\n this._fireEvent('move', nowMoving.originalEvent);\n }\n\n for (const eventName in newEventsInProgress) {\n const {originalEvent} = newEventsInProgress[eventName];\n this._fireEvent(eventName, originalEvent);\n }\n\n const endEvents = {};\n\n let originalEndEvent;\n for (const eventName in this._eventsInProgress) {\n const {handlerName, originalEvent} = this._eventsInProgress[eventName];\n if (!this._handlersById[handlerName].isActive()) {\n delete this._eventsInProgress[eventName];\n originalEndEvent = deactivatedHandlers[handlerName] || originalEvent;\n endEvents[`${eventName}end`] = originalEndEvent;\n }\n }\n\n for (const name in endEvents) {\n this._fireEvent(name, endEvents[name]);\n }\n\n const stillMoving = isMoving(this._eventsInProgress);\n if (allowEndAnimation && (wasMoving || nowMoving) && !stillMoving) {\n this._updatingCamera = true;\n const inertialEase = this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions);\n\n const shouldSnapToNorth = bearing => bearing !== 0 && -this._bearingSnap < bearing && bearing < this._bearingSnap;\n\n if (inertialEase) {\n if (shouldSnapToNorth(inertialEase.bearing || this._map.getBearing())) {\n inertialEase.bearing = 0;\n }\n this._map.easeTo(inertialEase, {originalEvent: originalEndEvent});\n } else {\n this._map.fire(new Event('moveend', {originalEvent: originalEndEvent}));\n if (shouldSnapToNorth(this._map.getBearing())) {\n this._map.resetNorth();\n }\n }\n this._updatingCamera = false;\n }\n\n }\n\n _fireEvent(type: string, e: *) {\n this._map.fire(new Event(type, e ? {originalEvent: e} : {}));\n }\n\n _requestFrame() {\n this._map.triggerRepaint();\n return this._map._renderTaskQueue.add(timeStamp => {\n delete this._frameId;\n this.handleEvent(new RenderFrameEvent('renderFrame', {timeStamp}));\n this._applyChanges();\n });\n }\n\n _triggerRenderFrame() {\n if (this._frameId === undefined) {\n this._frameId = this._requestFrame();\n }\n }\n\n}\n\nexport default HandlerManager;\n","// @flow\n\nimport {\n bindAll,\n extend,\n warnOnce,\n clamp,\n wrap,\n ease as defaultEasing,\n pick\n} from '../util/util';\nimport {number as interpolate} from '../style-spec/util/interpolate';\nimport browser from '../util/browser';\nimport LngLat from '../geo/lng_lat';\nimport LngLatBounds from '../geo/lng_lat_bounds';\nimport Point from '@mapbox/point-geometry';\nimport {Event, Evented} from '../util/evented';\nimport assert from 'assert';\nimport {Debug} from '../util/debug';\n\nimport type Transform from '../geo/transform';\nimport type {LngLatLike} from '../geo/lng_lat';\nimport type {LngLatBoundsLike} from '../geo/lng_lat_bounds';\nimport type {TaskID} from '../util/task_queue';\nimport type {PointLike} from '@mapbox/point-geometry';\nimport type {PaddingOptions} from '../geo/edge_insets';\n\n/**\n * Options common to {@link Map#jumpTo}, {@link Map#easeTo}, and {@link Map#flyTo}, controlling the desired location,\n * zoom, bearing, and pitch of the camera. All properties are optional, and when a property is omitted, the current\n * camera value for that property will remain unchanged.\n *\n * @typedef {Object} CameraOptions\n * @property {LngLatLike} center The desired center.\n * @property {number} zoom The desired zoom level.\n * @property {number} bearing The desired bearing in degrees. The bearing is the compass direction that\n * is \"up\". For example, `bearing: 90` orients the map so that east is up.\n * @property {number} pitch The desired pitch in degrees. The pitch is the angle towards the horizon\n * measured in degrees with a range between 0 and 60 degrees. For example, pitch: 0 provides the appearance\n * of looking straight down at the map, while pitch: 60 tilts the user's perspective towards the horizon.\n * Increasing the pitch value is often used to display 3D objects.\n * @property {LngLatLike} around If `zoom` is specified, `around` determines the point around which the zoom is centered.\n * @property {PaddingOptions} padding Dimensions in pixels applied on each side of the viewport for shifting the vanishing point.\n * @example\n * // set the map's initial perspective with CameraOptions\n * var map = new maplibregl.Map({\n * container: 'map',\n * style: 'mapbox://styles/mapbox/streets-v11',\n * center: [-73.5804, 45.53483],\n * pitch: 60,\n * bearing: -60,\n * zoom: 10\n * });\n * @see [Set pitch and bearing](https://maplibre.org/maplibre-gl-js-docs/example/set-perspective/)\n * @see [Jump to a series of locations](https://maplibre.org/maplibre-gl-js-docs/example/jump-to/)\n * @see [Fly to a location](https://maplibre.org/maplibre-gl-js-docs/example/flyto/)\n * @see [Display buildings in 3D](https://maplibre.org/maplibre-gl-js-docs/example/3d-buildings/)\n */\nexport type CameraOptions = {\n center?: LngLatLike,\n zoom?: number,\n bearing?: number,\n pitch?: number,\n around?: LngLatLike,\n padding?: PaddingOptions\n};\n\n/**\n * Options common to map movement methods that involve animation, such as {@link Map#panBy} and\n * {@link Map#easeTo}, controlling the duration and easing function of the animation. All properties\n * are optional.\n *\n * @typedef {Object} AnimationOptions\n * @property {number} duration The animation's duration, measured in milliseconds.\n * @property {Function} easing A function taking a time in the range 0..1 and returning a number where 0 is\n * the initial state and 1 is the final state.\n * @property {PointLike} offset of the target center relative to real map container center at the end of animation.\n * @property {boolean} animate If `false`, no animation will occur.\n * @property {boolean} essential If `true`, then the animation is considered essential and will not be affected by\n * [`prefers-reduced-motion`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion).\n */\nexport type AnimationOptions = {\n duration?: number,\n easing?: (_: number) => number,\n offset?: PointLike,\n animate?: boolean,\n essential?: boolean\n};\n\n/**\n * Options for setting padding on calls to methods such as {@link Map#fitBounds}, {@link Map#fitScreenCoordinates}, and {@link Map#setPadding}. Adjust these options to set the amount of padding in pixels added to the edges of the canvas. Set a uniform padding on all edges or individual values for each edge. All properties of this object must be\n * non-negative integers.\n *\n * @typedef {Object} PaddingOptions\n * @property {number} top Padding in pixels from the top of the map canvas.\n * @property {number} bottom Padding in pixels from the bottom of the map canvas.\n * @property {number} left Padding in pixels from the left of the map canvas.\n * @property {number} right Padding in pixels from the right of the map canvas.\n *\n * @example\n * var bbox = [[-79, 43], [-73, 45]];\n * map.fitBounds(bbox, {\n * padding: {top: 10, bottom:25, left: 15, right: 5}\n * });\n *\n * @example\n * var bbox = [[-79, 43], [-73, 45]];\n * map.fitBounds(bbox, {\n * padding: 20\n * });\n * @see [Fit to the bounds of a LineString](https://maplibre.org/maplibre-gl-js-docs/example/zoomto-linestring/)\n * @see [Fit a map to a bounding box](https://maplibre.org/maplibre-gl-js-docs/example/fitbounds/)\n */\n\nclass Camera extends Evented {\n transform: Transform;\n _moving: boolean;\n _zooming: boolean;\n _rotating: boolean;\n _pitching: boolean;\n _padding: boolean;\n\n _bearingSnap: number;\n _easeStart: number;\n _easeOptions: {duration: number, easing: (_: number) => number};\n _easeId: string | void;\n\n _onEaseFrame: (_: number) => void;\n _onEaseEnd: (easeId?: string) => void;\n _easeFrameId: ?TaskID;\n\n +_requestRenderFrame: (() => void) => TaskID;\n +_cancelRenderFrame: (_: TaskID) => void;\n\n constructor(transform: Transform, options: {bearingSnap: number}) {\n super();\n this._moving = false;\n this._zooming = false;\n this.transform = transform;\n this._bearingSnap = options.bearingSnap;\n\n bindAll(['_renderFrameCallback'], this);\n\n //addAssertions(this);\n }\n\n /**\n * Returns the map's geographical centerpoint.\n *\n * @memberof Map#\n * @returns The map's geographical centerpoint.\n * @example\n * // return a LngLat object such as {lng: 0, lat: 0}\n * var center = map.getCenter();\n * // access longitude and latitude values directly\n * var {lng, lat} = map.getCenter();\n * @see Tutorial: [Use Mapbox GL JS in a React app](https://docs.mapbox.com/help/tutorials/use-mapbox-gl-js-with-react/#store-the-new-coordinates)\n */\n getCenter(): LngLat { return new LngLat(this.transform.center.lng, this.transform.center.lat); }\n\n /**\n * Sets the map's geographical centerpoint. Equivalent to `jumpTo({center: center})`.\n *\n * @memberof Map#\n * @param center The centerpoint to set.\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires moveend\n * @returns {Map} `this`\n * @example\n * map.setCenter([-74, 38]);\n */\n setCenter(center: LngLatLike, eventData?: Object) {\n return this.jumpTo({center}, eventData);\n }\n\n /**\n * Pans the map by the specified offset.\n *\n * @memberof Map#\n * @param offset `x` and `y` coordinates by which to pan the map.\n * @param options Options object\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires moveend\n * @returns {Map} `this`\n * @see [Navigate the map with game-like controls](https://maplibre.org/maplibre-gl-js-docs/example/game-controls/)\n */\n panBy(offset: PointLike, options?: AnimationOptions, eventData?: Object) {\n offset = Point.convert(offset).mult(-1);\n return this.panTo(this.transform.center, extend({offset}, options), eventData);\n }\n\n /**\n * Pans the map to the specified location with an animated transition.\n *\n * @memberof Map#\n * @param lnglat The location to pan the map to.\n * @param options Options describing the destination and animation of the transition.\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires moveend\n * @returns {Map} `this`\n * @example\n * map.panTo([-74, 38]);\n * @example\n * // Specify that the panTo animation should last 5000 milliseconds.\n * map.panTo([-74, 38], {duration: 5000});\n * @see [Update a feature in realtime](https://maplibre.org/maplibre-gl-js-docs/example/live-update-feature/)\n */\n panTo(lnglat: LngLatLike, options?: AnimationOptions, eventData?: Object) {\n return this.easeTo(extend({\n center: lnglat\n }, options), eventData);\n }\n\n /**\n * Returns the map's current zoom level.\n *\n * @memberof Map#\n * @returns The map's current zoom level.\n * @example\n * map.getZoom();\n */\n getZoom(): number { return this.transform.zoom; }\n\n /**\n * Sets the map's zoom level. Equivalent to `jumpTo({zoom: zoom})`.\n *\n * @memberof Map#\n * @param zoom The zoom level to set (0-20).\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires zoomstart\n * @fires move\n * @fires zoom\n * @fires moveend\n * @fires zoomend\n * @returns {Map} `this`\n * @example\n * // Zoom to the zoom level 5 without an animated transition\n * map.setZoom(5);\n */\n setZoom(zoom: number, eventData?: Object) {\n this.jumpTo({zoom}, eventData);\n return this;\n }\n\n /**\n * Zooms the map to the specified zoom level, with an animated transition.\n *\n * @memberof Map#\n * @param zoom The zoom level to transition to.\n * @param options Options object\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires zoomstart\n * @fires move\n * @fires zoom\n * @fires moveend\n * @fires zoomend\n * @returns {Map} `this`\n * @example\n * // Zoom to the zoom level 5 without an animated transition\n * map.zoomTo(5);\n * // Zoom to the zoom level 8 with an animated transition\n * map.zoomTo(8, {\n * duration: 2000,\n * offset: [100, 50]\n * });\n */\n zoomTo(zoom: number, options: ? AnimationOptions, eventData?: Object) {\n return this.easeTo(extend({\n zoom\n }, options), eventData);\n }\n\n /**\n * Increases the map's zoom level by 1.\n *\n * @memberof Map#\n * @param options Options object\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires zoomstart\n * @fires move\n * @fires zoom\n * @fires moveend\n * @fires zoomend\n * @returns {Map} `this`\n * @example\n * // zoom the map in one level with a custom animation duration\n * map.zoomIn({duration: 1000});\n */\n zoomIn(options?: AnimationOptions, eventData?: Object) {\n this.zoomTo(this.getZoom() + 1, options, eventData);\n return this;\n }\n\n /**\n * Decreases the map's zoom level by 1.\n *\n * @memberof Map#\n * @param options Options object\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires zoomstart\n * @fires move\n * @fires zoom\n * @fires moveend\n * @fires zoomend\n * @returns {Map} `this`\n * @example\n * // zoom the map out one level with a custom animation offset\n * map.zoomOut({offset: [80, 60]});\n */\n zoomOut(options?: AnimationOptions, eventData?: Object) {\n this.zoomTo(this.getZoom() - 1, options, eventData);\n return this;\n }\n\n /**\n * Returns the map's current bearing. The bearing is the compass direction that is \"up\"; for example, a bearing\n * of 90° orients the map so that east is up.\n *\n * @memberof Map#\n * @returns The map's current bearing.\n * @see [Navigate the map with game-like controls](https://maplibre.org/maplibre-gl-js-docs/example/game-controls/)\n */\n getBearing(): number { return this.transform.bearing; }\n\n /**\n * Sets the map's bearing (rotation). The bearing is the compass direction that is \"up\"; for example, a bearing\n * of 90° orients the map so that east is up.\n *\n * Equivalent to `jumpTo({bearing: bearing})`.\n *\n * @memberof Map#\n * @param bearing The desired bearing.\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires moveend\n * @returns {Map} `this`\n * @example\n * // rotate the map to 90 degrees\n * map.setBearing(90);\n */\n setBearing(bearing: number, eventData?: Object) {\n this.jumpTo({bearing}, eventData);\n return this;\n }\n\n /**\n * Returns the current padding applied around the map viewport.\n *\n * @memberof Map#\n * @returns The current padding around the map viewport.\n */\n getPadding(): PaddingOptions { return this.transform.padding; }\n\n /**\n * Sets the padding in pixels around the viewport.\n *\n * Equivalent to `jumpTo({padding: padding})`.\n *\n * @memberof Map#\n * @param padding The desired padding. Format: { left: number, right: number, top: number, bottom: number }\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires moveend\n * @returns {Map} `this`\n * @example\n * // Sets a left padding of 300px, and a top padding of 50px\n * map.setPadding({ left: 300, top: 50 });\n */\n setPadding(padding: PaddingOptions, eventData?: Object) {\n this.jumpTo({padding}, eventData);\n return this;\n }\n\n /**\n * Rotates the map to the specified bearing, with an animated transition. The bearing is the compass direction\n * that is \\\"up\\\"; for example, a bearing of 90° orients the map so that east is up.\n *\n * @memberof Map#\n * @param bearing The desired bearing.\n * @param options Options object\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires moveend\n * @returns {Map} `this`\n */\n rotateTo(bearing: number, options?: AnimationOptions, eventData?: Object) {\n return this.easeTo(extend({\n bearing\n }, options), eventData);\n }\n\n /**\n * Rotates the map so that north is up (0° bearing), with an animated transition.\n *\n * @memberof Map#\n * @param options Options object\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires moveend\n * @returns {Map} `this`\n */\n resetNorth(options?: AnimationOptions, eventData?: Object) {\n this.rotateTo(0, extend({duration: 1000}, options), eventData);\n return this;\n }\n\n /**\n * Rotates and pitches the map so that north is up (0° bearing) and pitch is 0°, with an animated transition.\n *\n * @memberof Map#\n * @param options Options object\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires moveend\n * @returns {Map} `this`\n */\n resetNorthPitch(options?: AnimationOptions, eventData?: Object) {\n this.easeTo(extend({\n bearing: 0,\n pitch: 0,\n duration: 1000\n }, options), eventData);\n return this;\n }\n\n /**\n * Snaps the map so that north is up (0° bearing), if the current bearing is close enough to it (i.e. within the\n * `bearingSnap` threshold).\n *\n * @memberof Map#\n * @param options Options object\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires moveend\n * @returns {Map} `this`\n */\n snapToNorth(options?: AnimationOptions, eventData?: Object) {\n if (Math.abs(this.getBearing()) < this._bearingSnap) {\n return this.resetNorth(options, eventData);\n }\n return this;\n }\n\n /**\n * Returns the map's current pitch (tilt).\n *\n * @memberof Map#\n * @returns The map's current pitch, measured in degrees away from the plane of the screen.\n */\n getPitch(): number { return this.transform.pitch; }\n\n /**\n * Sets the map's pitch (tilt). Equivalent to `jumpTo({pitch: pitch})`.\n *\n * @memberof Map#\n * @param pitch The pitch to set, measured in degrees away from the plane of the screen (0-60).\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires pitchstart\n * @fires movestart\n * @fires moveend\n * @returns {Map} `this`\n */\n setPitch(pitch: number, eventData?: Object) {\n this.jumpTo({pitch}, eventData);\n return this;\n }\n\n /**\n * @memberof Map#\n * @param {LngLatBoundsLike} bounds Calculate the center for these bounds in the viewport and use\n * the highest zoom level up to and including `Map#getMaxZoom()` that fits\n * in the viewport. LngLatBounds represent a box that is always axis-aligned with bearing 0.\n * @param options Options object\n * @param {number | PaddingOptions} [options.padding] The amount of padding in pixels to add to the given bounds.\n * @param {number} [options.bearing=0] Desired map bearing at end of animation, in degrees.\n * @param {PointLike} [options.offset=[0, 0]] The center of the given bounds relative to the map's center, measured in pixels.\n * @param {number} [options.maxZoom] The maximum zoom level to allow when the camera would transition to the specified bounds.\n * @returns {CameraOptions | void} If map is able to fit to provided bounds, returns `CameraOptions` with\n * `center`, `zoom`, and `bearing`. If map is unable to fit, method will warn and return undefined.\n * @example\n * var bbox = [[-79, 43], [-73, 45]];\n * var newCameraTransform = map.cameraForBounds(bbox, {\n * padding: {top: 10, bottom:25, left: 15, right: 5}\n * });\n */\n cameraForBounds(bounds: LngLatBoundsLike, options?: CameraOptions): void | CameraOptions & AnimationOptions {\n bounds = LngLatBounds.convert(bounds);\n const bearing = options && options.bearing || 0;\n return this._cameraForBoxAndBearing(bounds.getNorthWest(), bounds.getSouthEast(), bearing, options);\n }\n\n /**\n * Calculate the center of these two points in the viewport and use\n * the highest zoom level up to and including `Map#getMaxZoom()` that fits\n * the points in the viewport at the specified bearing.\n * @memberof Map#\n * @param {LngLatLike} p0 First point\n * @param {LngLatLike} p1 Second point\n * @param bearing Desired map bearing at end of animation, in degrees\n * @param options\n * @param {number | PaddingOptions} [options.padding] The amount of padding in pixels to add to the given bounds.\n * @param {PointLike} [options.offset=[0, 0]] The center of the given bounds relative to the map's center, measured in pixels.\n * @param {number} [options.maxZoom] The maximum zoom level to allow when the camera would transition to the specified bounds.\n * @returns {CameraOptions | void} If map is able to fit to provided bounds, returns `CameraOptions` with\n * `center`, `zoom`, and `bearing`. If map is unable to fit, method will warn and return undefined.\n * @private\n * @example\n * var p0 = [-79, 43];\n * var p1 = [-73, 45];\n * var bearing = 90;\n * var newCameraTransform = map._cameraForBoxAndBearing(p0, p1, bearing, {\n * padding: {top: 10, bottom:25, left: 15, right: 5}\n * });\n */\n _cameraForBoxAndBearing(p0: LngLatLike, p1: LngLatLike, bearing: number, options?: CameraOptions): void | CameraOptions & AnimationOptions {\n const defaultPadding = {\n top: 0,\n bottom: 0,\n right: 0,\n left: 0\n };\n options = extend({\n padding: defaultPadding,\n offset: [0, 0],\n maxZoom: this.transform.maxZoom\n }, options);\n\n if (typeof options.padding === 'number') {\n const p = options.padding;\n options.padding = {\n top: p,\n bottom: p,\n right: p,\n left: p\n };\n }\n\n options.padding = extend(defaultPadding, options.padding);\n const tr = this.transform;\n const edgePadding = tr.padding;\n\n // We want to calculate the upper right and lower left of the box defined by p0 and p1\n // in a coordinate system rotate to match the destination bearing.\n const p0world = tr.project(LngLat.convert(p0));\n const p1world = tr.project(LngLat.convert(p1));\n const p0rotated = p0world.rotate(-bearing * Math.PI / 180);\n const p1rotated = p1world.rotate(-bearing * Math.PI / 180);\n\n const upperRight = new Point(Math.max(p0rotated.x, p1rotated.x), Math.max(p0rotated.y, p1rotated.y));\n const lowerLeft = new Point(Math.min(p0rotated.x, p1rotated.x), Math.min(p0rotated.y, p1rotated.y));\n\n // Calculate zoom: consider the original bbox and padding.\n const size = upperRight.sub(lowerLeft);\n const scaleX = (tr.width - (edgePadding.left + edgePadding.right + options.padding.left + options.padding.right)) / size.x;\n const scaleY = (tr.height - (edgePadding.top + edgePadding.bottom + options.padding.top + options.padding.bottom)) / size.y;\n\n if (scaleY < 0 || scaleX < 0) {\n warnOnce(\n 'Map cannot fit within canvas with the given bounds, padding, and/or offset.'\n );\n return;\n }\n\n const zoom = Math.min(tr.scaleZoom(tr.scale * Math.min(scaleX, scaleY)), options.maxZoom);\n\n // Calculate center: apply the zoom, the configured offset, as well as offset that exists as a result of padding.\n const offset = (typeof options.offset.x === 'number') ? new Point(options.offset.x, options.offset.y) : Point.convert(options.offset);\n const paddingOffsetX = (options.padding.left - options.padding.right) / 2;\n const paddingOffsetY = (options.padding.top - options.padding.bottom) / 2;\n const paddingOffset = new Point(paddingOffsetX, paddingOffsetY);\n const rotatedPaddingOffset = paddingOffset.rotate(bearing * Math.PI / 180);\n const offsetAtInitialZoom = offset.add(rotatedPaddingOffset);\n const offsetAtFinalZoom = offsetAtInitialZoom.mult(tr.scale / tr.zoomScale(zoom));\n\n const center = tr.unproject(p0world.add(p1world).div(2).sub(offsetAtFinalZoom));\n\n return {\n center,\n zoom,\n bearing\n };\n }\n\n /**\n * Pans and zooms the map to contain its visible area within the specified geographical bounds.\n * This function will also reset the map's bearing to 0 if bearing is nonzero.\n *\n * @memberof Map#\n * @param bounds Center these bounds in the viewport and use the highest\n * zoom level up to and including `Map#getMaxZoom()` that fits them in the viewport.\n * @param {Object} [options] Options supports all properties from {@link AnimationOptions} and {@link CameraOptions} in addition to the fields below.\n * @param {number | PaddingOptions} [options.padding] The amount of padding in pixels to add to the given bounds.\n * @param {boolean} [options.linear=false] If `true`, the map transitions using\n * {@link Map#easeTo}. If `false`, the map transitions using {@link Map#flyTo}. See\n * those functions and {@link AnimationOptions} for information about options available.\n * @param {Function} [options.easing] An easing function for the animated transition. See {@link AnimationOptions}.\n * @param {PointLike} [options.offset=[0, 0]] The center of the given bounds relative to the map's center, measured in pixels.\n * @param {number} [options.maxZoom] The maximum zoom level to allow when the map view transitions to the specified bounds.\n * @param {Object} [eventData] Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires moveend\n * @returns {Map} `this`\n\t * @example\n * var bbox = [[-79, 43], [-73, 45]];\n * map.fitBounds(bbox, {\n * padding: {top: 10, bottom:25, left: 15, right: 5}\n * });\n * @see [Fit a map to a bounding box](https://maplibre.org/maplibre-gl-js-docs/example/fitbounds/)\n */\n fitBounds(bounds: LngLatBoundsLike, options?: AnimationOptions & CameraOptions, eventData?: Object) {\n return this._fitInternal(\n this.cameraForBounds(bounds, options),\n options,\n eventData);\n }\n\n /**\n * Pans, rotates and zooms the map to to fit the box made by points p0 and p1\n * once the map is rotated to the specified bearing. To zoom without rotating,\n * pass in the current map bearing.\n *\n * @memberof Map#\n * @param p0 First point on screen, in pixel coordinates\n * @param p1 Second point on screen, in pixel coordinates\n * @param bearing Desired map bearing at end of animation, in degrees\n * @param options Options object\n * @param {number | PaddingOptions} [options.padding] The amount of padding in pixels to add to the given bounds.\n * @param {boolean} [options.linear=false] If `true`, the map transitions using\n * {@link Map#easeTo}. If `false`, the map transitions using {@link Map#flyTo}. See\n * those functions and {@link AnimationOptions} for information about options available.\n * @param {Function} [options.easing] An easing function for the animated transition. See {@link AnimationOptions}.\n * @param {PointLike} [options.offset=[0, 0]] The center of the given bounds relative to the map's center, measured in pixels.\n * @param {number} [options.maxZoom] The maximum zoom level to allow when the map view transitions to the specified bounds.\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires moveend\n * @returns {Map} `this`\n\t * @example\n * var p0 = [220, 400];\n * var p1 = [500, 900];\n * map.fitScreenCoordinates(p0, p1, map.getBearing(), {\n * padding: {top: 10, bottom:25, left: 15, right: 5}\n * });\n * @see Used by {@link BoxZoomHandler}\n */\n fitScreenCoordinates(p0: PointLike, p1: PointLike, bearing: number, options?: AnimationOptions & CameraOptions, eventData?: Object) {\n return this._fitInternal(\n this._cameraForBoxAndBearing(\n this.transform.pointLocation(Point.convert(p0)),\n this.transform.pointLocation(Point.convert(p1)),\n bearing,\n options),\n options,\n eventData);\n }\n\n _fitInternal(calculatedOptions?: CameraOptions & AnimationOptions, options?: AnimationOptions & CameraOptions, eventData?: Object) {\n // cameraForBounds warns + returns undefined if unable to fit:\n if (!calculatedOptions) return this;\n\n options = extend(calculatedOptions, options);\n // Explictly remove the padding field because, calculatedOptions already accounts for padding by setting zoom and center accordingly.\n delete options.padding;\n\n return options.linear ?\n this.easeTo(options, eventData) :\n this.flyTo(options, eventData);\n }\n\n /**\n * Changes any combination of center, zoom, bearing, and pitch, without\n * an animated transition. The map will retain its current values for any\n * details not specified in `options`.\n *\n * @memberof Map#\n * @param options Options object\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires zoomstart\n * @fires pitchstart\n * @fires rotate\n * @fires move\n * @fires zoom\n * @fires pitch\n * @fires moveend\n * @fires zoomend\n * @fires pitchend\n * @returns {Map} `this`\n * @example\n * // jump to coordinates at current zoom\n * map.jumpTo({center: [0, 0]});\n * // jump with zoom, pitch, and bearing options\n * map.jumpTo({\n * center: [0, 0],\n * zoom: 8,\n * pitch: 45,\n * bearing: 90\n * });\n * @see [Jump to a series of locations](https://maplibre.org/maplibre-gl-js-docs/example/jump-to/)\n * @see [Update a feature in realtime](https://maplibre.org/maplibre-gl-js-docs/example/live-update-feature/)\n */\n jumpTo(options: CameraOptions, eventData?: Object) {\n this.stop();\n\n const tr = this.transform;\n let zoomChanged = false,\n bearingChanged = false,\n pitchChanged = false;\n\n if ('zoom' in options && tr.zoom !== +options.zoom) {\n zoomChanged = true;\n tr.zoom = +options.zoom;\n }\n\n if (options.center !== undefined) {\n tr.center = LngLat.convert(options.center);\n }\n\n if ('bearing' in options && tr.bearing !== +options.bearing) {\n bearingChanged = true;\n tr.bearing = +options.bearing;\n }\n\n if ('pitch' in options && tr.pitch !== +options.pitch) {\n pitchChanged = true;\n tr.pitch = +options.pitch;\n }\n\n if (options.padding != null && !tr.isPaddingEqual(options.padding)) {\n tr.padding = options.padding;\n }\n\n this.fire(new Event('movestart', eventData))\n .fire(new Event('move', eventData));\n\n if (zoomChanged) {\n this.fire(new Event('zoomstart', eventData))\n .fire(new Event('zoom', eventData))\n .fire(new Event('zoomend', eventData));\n }\n\n if (bearingChanged) {\n this.fire(new Event('rotatestart', eventData))\n .fire(new Event('rotate', eventData))\n .fire(new Event('rotateend', eventData));\n }\n\n if (pitchChanged) {\n this.fire(new Event('pitchstart', eventData))\n .fire(new Event('pitch', eventData))\n .fire(new Event('pitchend', eventData));\n }\n\n return this.fire(new Event('moveend', eventData));\n }\n\n /**\n * Changes any combination of `center`, `zoom`, `bearing`, `pitch`, and `padding` with an animated transition\n * between old and new values. The map will retain its current values for any\n * details not specified in `options`.\n *\n * Note: The transition will happen instantly if the user has enabled\n * the `reduced motion` accesibility feature enabled in their operating system,\n * unless `options` includes `essential: true`.\n *\n * @memberof Map#\n * @param options Options describing the destination and animation of the transition.\n * Accepts {@link CameraOptions} and {@link AnimationOptions}.\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires zoomstart\n * @fires pitchstart\n * @fires rotate\n * @fires move\n * @fires zoom\n * @fires pitch\n * @fires moveend\n * @fires zoomend\n * @fires pitchend\n * @returns {Map} `this`\n * @see [Navigate the map with game-like controls](https://maplibre.org/maplibre-gl-js-docs/example/game-controls/)\n */\n easeTo(options: CameraOptions & AnimationOptions & {easeId?: string}, eventData?: Object) {\n this._stop(false, options.easeId);\n\n options = extend({\n offset: [0, 0],\n duration: 500,\n easing: defaultEasing\n }, options);\n\n if (options.animate === false || (!options.essential && browser.prefersReducedMotion)) options.duration = 0;\n\n const tr = this.transform,\n startZoom = this.getZoom(),\n startBearing = this.getBearing(),\n startPitch = this.getPitch(),\n startPadding = this.getPadding(),\n\n zoom = 'zoom' in options ? +options.zoom : startZoom,\n bearing = 'bearing' in options ? this._normalizeBearing(options.bearing, startBearing) : startBearing,\n pitch = 'pitch' in options ? +options.pitch : startPitch,\n padding = 'padding' in options ? options.padding : tr.padding;\n\n const offsetAsPoint = Point.convert(options.offset);\n let pointAtOffset = tr.centerPoint.add(offsetAsPoint);\n const locationAtOffset = tr.pointLocation(pointAtOffset);\n const center = LngLat.convert(options.center || locationAtOffset);\n this._normalizeCenter(center);\n\n const from = tr.project(locationAtOffset);\n const delta = tr.project(center).sub(from);\n const finalScale = tr.zoomScale(zoom - startZoom);\n\n let around, aroundPoint;\n\n if (options.around) {\n around = LngLat.convert(options.around);\n aroundPoint = tr.locationPoint(around);\n }\n\n const currently = {\n moving: this._moving,\n zooming: this._zooming,\n rotating: this._rotating,\n pitching: this._pitching\n };\n\n this._zooming = this._zooming || (zoom !== startZoom);\n this._rotating = this._rotating || (startBearing !== bearing);\n this._pitching = this._pitching || (pitch !== startPitch);\n this._padding = !tr.isPaddingEqual(padding);\n\n this._easeId = options.easeId;\n this._prepareEase(eventData, options.noMoveStart, currently);\n\n this._ease((k) => {\n if (this._zooming) {\n tr.zoom = interpolate(startZoom, zoom, k);\n }\n if (this._rotating) {\n tr.bearing = interpolate(startBearing, bearing, k);\n }\n if (this._pitching) {\n tr.pitch = interpolate(startPitch, pitch, k);\n }\n if (this._padding) {\n tr.interpolatePadding(startPadding, padding, k);\n // When padding is being applied, Transform#centerPoint is changing continously,\n // thus we need to recalculate offsetPoint every fra,e\n pointAtOffset = tr.centerPoint.add(offsetAsPoint);\n }\n\n if (around) {\n tr.setLocationAtPoint(around, aroundPoint);\n } else {\n const scale = tr.zoomScale(tr.zoom - startZoom);\n const base = zoom > startZoom ?\n Math.min(2, finalScale) :\n Math.max(0.5, finalScale);\n const speedup = Math.pow(base, 1 - k);\n const newCenter = tr.unproject(from.add(delta.mult(k * speedup)).mult(scale));\n tr.setLocationAtPoint(tr.renderWorldCopies ? newCenter.wrap() : newCenter, pointAtOffset);\n }\n\n this._fireMoveEvents(eventData);\n\n }, (interruptingEaseId?: string) => {\n this._afterEase(eventData, interruptingEaseId);\n }, options);\n\n return this;\n }\n\n _prepareEase(eventData?: Object, noMoveStart: boolean, currently: Object = {}) {\n this._moving = true;\n\n if (!noMoveStart && !currently.moving) {\n this.fire(new Event('movestart', eventData));\n }\n if (this._zooming && !currently.zooming) {\n this.fire(new Event('zoomstart', eventData));\n }\n if (this._rotating && !currently.rotating) {\n this.fire(new Event('rotatestart', eventData));\n }\n if (this._pitching && !currently.pitching) {\n this.fire(new Event('pitchstart', eventData));\n }\n }\n\n _fireMoveEvents(eventData?: Object) {\n this.fire(new Event('move', eventData));\n if (this._zooming) {\n this.fire(new Event('zoom', eventData));\n }\n if (this._rotating) {\n this.fire(new Event('rotate', eventData));\n }\n if (this._pitching) {\n this.fire(new Event('pitch', eventData));\n }\n }\n\n _afterEase(eventData?: Object, easeId?: string) {\n // if this easing is being stopped to start another easing with\n // the same id then don't fire any events to avoid extra start/stop events\n if (this._easeId && easeId && this._easeId === easeId) {\n return;\n }\n delete this._easeId;\n\n const wasZooming = this._zooming;\n const wasRotating = this._rotating;\n const wasPitching = this._pitching;\n this._moving = false;\n this._zooming = false;\n this._rotating = false;\n this._pitching = false;\n this._padding = false;\n\n if (wasZooming) {\n this.fire(new Event('zoomend', eventData));\n }\n if (wasRotating) {\n this.fire(new Event('rotateend', eventData));\n }\n if (wasPitching) {\n this.fire(new Event('pitchend', eventData));\n }\n this.fire(new Event('moveend', eventData));\n }\n\n /**\n * Changes any combination of center, zoom, bearing, and pitch, animating the transition along a curve that\n * evokes flight. The animation seamlessly incorporates zooming and panning to help\n * the user maintain her bearings even after traversing a great distance.\n *\n * Note: The animation will be skipped, and this will behave equivalently to `jumpTo`\n * if the user has the `reduced motion` accesibility feature enabled in their operating system,\n * unless 'options' includes `essential: true`.\n *\n * @memberof Map#\n * @param {Object} options Options describing the destination and animation of the transition.\n * Accepts {@link CameraOptions}, {@link AnimationOptions},\n * and the following additional options.\n * @param {number} [options.curve=1.42] The zooming \"curve\" that will occur along the\n * flight path. A high value maximizes zooming for an exaggerated animation, while a low\n * value minimizes zooming for an effect closer to {@link Map#easeTo}. 1.42 is the average\n * value selected by participants in the user study discussed in\n * [van Wijk (2003)](https://www.win.tue.nl/~vanwijk/zoompan.pdf). A value of\n * `Math.pow(6, 0.25)` would be equivalent to the root mean squared average velocity. A\n * value of 1 would produce a circular motion.\n * @param {number} [options.minZoom] The zero-based zoom level at the peak of the flight path. If\n * `options.curve` is specified, this option is ignored.\n * @param {number} [options.speed=1.2] The average speed of the animation defined in relation to\n * `options.curve`. A speed of 1.2 means that the map appears to move along the flight path\n * by 1.2 times `options.curve` screenfuls every second. A _screenful_ is the map's visible span.\n * It does not correspond to a fixed physical distance, but varies by zoom level.\n * @param {number} [options.screenSpeed] The average speed of the animation measured in screenfuls\n * per second, assuming a linear timing curve. If `options.speed` is specified, this option is ignored.\n * @param {number} [options.maxDuration] The animation's maximum duration, measured in milliseconds.\n * If duration exceeds maximum duration, it resets to 0.\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires zoomstart\n * @fires pitchstart\n * @fires move\n * @fires zoom\n * @fires rotate\n * @fires pitch\n * @fires moveend\n * @fires zoomend\n * @fires pitchend\n * @returns {Map} `this`\n * @example\n * // fly with default options to null island\n * map.flyTo({center: [0, 0], zoom: 9});\n * // using flyTo options\n * map.flyTo({\n * center: [0, 0],\n * zoom: 9,\n * speed: 0.2,\n * curve: 1,\n * easing(t) {\n * return t;\n * }\n * });\n * @see [Fly to a location](https://maplibre.org/maplibre-gl-js-docs/example/flyto/)\n * @see [Slowly fly to a location](https://maplibre.org/maplibre-gl-js-docs/example/flyto-options/)\n * @see [Fly to a location based on scroll position](https://maplibre.org/maplibre-gl-js-docs/example/scroll-fly-to/)\n */\n flyTo(options: Object, eventData?: Object) {\n // Fall through to jumpTo if user has set prefers-reduced-motion\n if (!options.essential && browser.prefersReducedMotion) {\n const coercedOptions = (pick(options, ['center', 'zoom', 'bearing', 'pitch', 'around']): CameraOptions);\n return this.jumpTo(coercedOptions, eventData);\n }\n\n // This method implements an “optimal path” animation, as detailed in:\n //\n // Van Wijk, Jarke J.; Nuij, Wim A. A. “Smooth and efficient zooming and panning.” INFOVIS\n // ’03. pp. 15–22. .\n //\n // Where applicable, local variable documentation begins with the associated variable or\n // function in van Wijk (2003).\n\n this.stop();\n\n options = extend({\n offset: [0, 0],\n speed: 1.2,\n curve: 1.42,\n easing: defaultEasing\n }, options);\n\n const tr = this.transform,\n startZoom = this.getZoom(),\n startBearing = this.getBearing(),\n startPitch = this.getPitch(),\n startPadding = this.getPadding();\n\n const zoom = 'zoom' in options ? clamp(+options.zoom, tr.minZoom, tr.maxZoom) : startZoom;\n const bearing = 'bearing' in options ? this._normalizeBearing(options.bearing, startBearing) : startBearing;\n const pitch = 'pitch' in options ? +options.pitch : startPitch;\n const padding = 'padding' in options ? options.padding : tr.padding;\n\n const scale = tr.zoomScale(zoom - startZoom);\n const offsetAsPoint = Point.convert(options.offset);\n let pointAtOffset = tr.centerPoint.add(offsetAsPoint);\n const locationAtOffset = tr.pointLocation(pointAtOffset);\n const center = LngLat.convert(options.center || locationAtOffset);\n this._normalizeCenter(center);\n\n const from = tr.project(locationAtOffset);\n const delta = tr.project(center).sub(from);\n\n let rho = options.curve;\n\n // w₀: Initial visible span, measured in pixels at the initial scale.\n const w0 = Math.max(tr.width, tr.height),\n // w₁: Final visible span, measured in pixels with respect to the initial scale.\n w1 = w0 / scale,\n // Length of the flight path as projected onto the ground plane, measured in pixels from\n // the world image origin at the initial scale.\n u1 = delta.mag();\n\n if ('minZoom' in options) {\n const minZoom = clamp(Math.min(options.minZoom, startZoom, zoom), tr.minZoom, tr.maxZoom);\n // wm: Maximum visible span, measured in pixels with respect to the initial\n // scale.\n const wMax = w0 / tr.zoomScale(minZoom - startZoom);\n rho = Math.sqrt(wMax / u1 * 2);\n }\n\n // ρ²\n const rho2 = rho * rho;\n\n /**\n * rᵢ: Returns the zoom-out factor at one end of the animation.\n *\n * @param i 0 for the ascent or 1 for the descent.\n * @private\n */\n function r(i) {\n const b = (w1 * w1 - w0 * w0 + (i ? -1 : 1) * rho2 * rho2 * u1 * u1) / (2 * (i ? w1 : w0) * rho2 * u1);\n return Math.log(Math.sqrt(b * b + 1) - b);\n }\n\n function sinh(n) { return (Math.exp(n) - Math.exp(-n)) / 2; }\n function cosh(n) { return (Math.exp(n) + Math.exp(-n)) / 2; }\n function tanh(n) { return sinh(n) / cosh(n); }\n\n // r₀: Zoom-out factor during ascent.\n const r0 = r(0);\n\n // w(s): Returns the visible span on the ground, measured in pixels with respect to the\n // initial scale. Assumes an angular field of view of 2 arctan ½ ≈ 53°.\n let w: (_: number) => number = function (s) {\n return (cosh(r0) / cosh(r0 + rho * s));\n };\n\n // u(s): Returns the distance along the flight path as projected onto the ground plane,\n // measured in pixels from the world image origin at the initial scale.\n let u: (_: number) => number = function (s) {\n return w0 * ((cosh(r0) * tanh(r0 + rho * s) - sinh(r0)) / rho2) / u1;\n };\n\n // S: Total length of the flight path, measured in ρ-screenfuls.\n let S = (r(1) - r0) / rho;\n\n // When u₀ = u₁, the optimal path doesn’t require both ascent and descent.\n if (Math.abs(u1) < 0.000001 || !isFinite(S)) {\n // Perform a more or less instantaneous transition if the path is too short.\n if (Math.abs(w0 - w1) < 0.000001) return this.easeTo(options, eventData);\n\n const k = w1 < w0 ? -1 : 1;\n S = Math.abs(Math.log(w1 / w0)) / rho;\n\n u = function() { return 0; };\n w = function(s) { return Math.exp(k * rho * s); };\n }\n\n if ('duration' in options) {\n options.duration = +options.duration;\n } else {\n const V = 'screenSpeed' in options ? +options.screenSpeed / rho : +options.speed;\n options.duration = 1000 * S / V;\n }\n\n if (options.maxDuration && options.duration > options.maxDuration) {\n options.duration = 0;\n }\n\n this._zooming = true;\n this._rotating = (startBearing !== bearing);\n this._pitching = (pitch !== startPitch);\n this._padding = !tr.isPaddingEqual(padding);\n\n this._prepareEase(eventData, false);\n\n this._ease((k) => {\n // s: The distance traveled along the flight path, measured in ρ-screenfuls.\n const s = k * S;\n const scale = 1 / w(s);\n tr.zoom = k === 1 ? zoom : startZoom + tr.scaleZoom(scale);\n\n if (this._rotating) {\n tr.bearing = interpolate(startBearing, bearing, k);\n }\n if (this._pitching) {\n tr.pitch = interpolate(startPitch, pitch, k);\n }\n if (this._padding) {\n tr.interpolatePadding(startPadding, padding, k);\n // When padding is being applied, Transform#centerPoint is changing continously,\n // thus we need to recalculate offsetPoint every frame\n pointAtOffset = tr.centerPoint.add(offsetAsPoint);\n }\n\n const newCenter = k === 1 ? center : tr.unproject(from.add(delta.mult(u(s))).mult(scale));\n tr.setLocationAtPoint(tr.renderWorldCopies ? newCenter.wrap() : newCenter, pointAtOffset);\n\n this._fireMoveEvents(eventData);\n\n }, () => this._afterEase(eventData), options);\n\n return this;\n }\n\n isEasing() {\n return !!this._easeFrameId;\n }\n\n /**\n * Stops any animated transition underway.\n *\n * @memberof Map#\n * @returns {Map} `this`\n */\n stop(): this {\n return this._stop();\n }\n\n _stop(allowGestures?: boolean, easeId?: string): this {\n if (this._easeFrameId) {\n this._cancelRenderFrame(this._easeFrameId);\n delete this._easeFrameId;\n delete this._onEaseFrame;\n }\n\n if (this._onEaseEnd) {\n // The _onEaseEnd function might emit events which trigger new\n // animation, which sets a new _onEaseEnd. Ensure we don't delete\n // it unintentionally.\n const onEaseEnd = this._onEaseEnd;\n delete this._onEaseEnd;\n onEaseEnd.call(this, easeId);\n }\n if (!allowGestures) {\n const handlers = (this: any).handlers;\n if (handlers) handlers.stop(false);\n }\n return this;\n }\n\n _ease(frame: (_: number) => void,\n finish: () => void,\n options: {animate: boolean, duration: number, easing: (_: number) => number}) {\n if (options.animate === false || options.duration === 0) {\n frame(1);\n finish();\n } else {\n this._easeStart = browser.now();\n this._easeOptions = options;\n this._onEaseFrame = frame;\n this._onEaseEnd = finish;\n this._easeFrameId = this._requestRenderFrame(this._renderFrameCallback);\n }\n }\n\n // Callback for map._requestRenderFrame\n _renderFrameCallback() {\n const t = Math.min((browser.now() - this._easeStart) / this._easeOptions.duration, 1);\n this._onEaseFrame(this._easeOptions.easing(t));\n if (t < 1) {\n this._easeFrameId = this._requestRenderFrame(this._renderFrameCallback);\n } else {\n this.stop();\n }\n }\n\n // convert bearing so that it's numerically close to the current one so that it interpolates properly\n _normalizeBearing(bearing: number, currentBearing: number) {\n bearing = wrap(bearing, -180, 180);\n const diff = Math.abs(bearing - currentBearing);\n if (Math.abs(bearing - 360 - currentBearing) < diff) bearing -= 360;\n if (Math.abs(bearing + 360 - currentBearing) < diff) bearing += 360;\n return bearing;\n }\n\n // If a path crossing the antimeridian would be shorter, extend the final coordinate so that\n // interpolating between the two endpoints will cross it.\n _normalizeCenter(center: LngLat) {\n const tr = this.transform;\n if (!tr.renderWorldCopies || tr.lngRange) return;\n\n const delta = center.lng - tr.center.lng;\n center.lng +=\n delta > 180 ? -360 :\n delta < -180 ? 360 : 0;\n }\n}\n\n// In debug builds, check that camera change events are fired in the correct order.\n// - ___start events needs to be fired before ___ and ___end events\n// - another ___start event can't be fired before a ___end event has been fired for the previous one\nfunction addAssertions(camera: Camera) { //eslint-disable-line\n Debug.run(() => {\n const inProgress = {};\n\n ['drag', 'zoom', 'rotate', 'pitch', 'move'].forEach(name => {\n inProgress[name] = false;\n\n camera.on(`${name}start`, () => {\n assert(!inProgress[name], `\"${name}start\" fired twice without a \"${name}end\"`);\n inProgress[name] = true;\n assert(inProgress.move);\n });\n\n camera.on(name, () => {\n assert(inProgress[name]);\n assert(inProgress.move);\n });\n\n camera.on(`${name}end`, () => {\n assert(inProgress.move);\n assert(inProgress[name]);\n inProgress[name] = false;\n });\n });\n\n // Canary used to test whether this function is stripped in prod build\n canary = 'canary debug run';\n });\n}\n\nlet canary; //eslint-disable-line\n\nexport default Camera;\n","// @flow\n\nimport DOM from '../../util/dom';\nimport {bindAll} from '../../util/util';\nimport config from '../../util/config';\n\nimport type Map from '../map';\n\ntype Options = {\n compact?: boolean,\n customAttribution?: string | Array\n};\n\n/**\n * An `AttributionControl` control presents the map's [attribution information](https://docs.mapbox.com/help/how-mapbox-works/attribution/).\n *\n * @implements {IControl}\n * @param {Object} [options]\n * @param {boolean} [options.compact] If `true`, force a compact attribution that shows the full attribution on mouse hover. If `false`, force the full attribution control. The default is a responsive attribution that collapses when the map is less than 640 pixels wide. **Attribution should not be collapsed if it can comfortably fit on the map. `compact` should only be used to modify default attribution when map size makes it impossible to fit [default attribution](https://docs.mapbox.com/help/how-mapbox-works/attribution/) and when the automatic compact resizing for default settings are not sufficient.**\n * @param {string | Array} [options.customAttribution] String or strings to show in addition to any other attributions.\n * @example\n * var map = new maplibregl.Map({attributionControl: false})\n * .addControl(new maplibregl.AttributionControl({\n * compact: true\n * }));\n */\nclass AttributionControl {\n options: Options;\n _map: Map;\n _container: HTMLElement;\n _innerContainer: HTMLElement;\n _compactButton: HTMLButtonElement;\n _editLink: ?HTMLAnchorElement;\n _attribHTML: string;\n styleId: string;\n styleOwner: string;\n\n constructor(options: Options = {}) {\n this.options = options;\n\n bindAll([\n '_toggleAttribution',\n '_updateEditLink',\n '_updateData',\n '_updateCompact'\n ], this);\n }\n\n getDefaultPosition() {\n return 'bottom-right';\n }\n\n onAdd(map: Map) {\n const compact = this.options && this.options.compact;\n\n this._map = map;\n this._container = DOM.create('div', 'maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib');\n this._compactButton = DOM.create('button', 'maplibregl-ctrl-attrib-button mapboxgl-ctrl-attrib-button', this._container);\n this._compactButton.addEventListener('click', this._toggleAttribution);\n this._compactButton.type = 'button';\n this._setElementTitle(this._compactButton, 'ToggleAttribution');\n this._innerContainer = DOM.create('div', 'maplibregl-ctrl-attrib-inner mapboxgl-ctrl-attrib-inner', this._container);\n this._innerContainer.setAttribute('role', 'list');\n\n if (compact) {\n this._container.classList.add('maplibregl-compact', 'mapboxgl-compact');\n }\n\n this._updateAttributions();\n this._updateEditLink();\n\n this._map.on('styledata', this._updateData);\n this._map.on('sourcedata', this._updateData);\n this._map.on('moveend', this._updateEditLink);\n\n if (compact === undefined) {\n this._map.on('resize', this._updateCompact);\n this._updateCompact();\n }\n\n return this._container;\n }\n\n onRemove() {\n DOM.remove(this._container);\n\n this._map.off('styledata', this._updateData);\n this._map.off('sourcedata', this._updateData);\n this._map.off('moveend', this._updateEditLink);\n this._map.off('resize', this._updateCompact);\n\n this._map = (undefined: any);\n this._attribHTML = (undefined: any);\n }\n\n _setElementTitle(element: HTMLElement, title: string) {\n const str = this._map._getUIString(`AttributionControl.${title}`);\n element.title = str;\n element.setAttribute('aria-label', str);\n }\n\n _toggleAttribution() {\n if (this._container.classList.contains('maplibregl-compact-show') || this._container.classList.contains('mapboxgl-compact-show')) {\n this._container.classList.remove('maplibregl-compact-show', 'mapboxgl-compact-show');\n this._compactButton.setAttribute('aria-pressed', 'false');\n } else {\n this._container.classList.add('maplibregl-compact-show', 'mapboxgl-compact-show');\n this._compactButton.setAttribute('aria-pressed', 'true');\n }\n }\n\n _updateEditLink() {\n let editLink = this._editLink;\n if (!editLink) {\n editLink = this._editLink = (this._container.querySelector('.mapbox-improve-map'): any);\n }\n\n const params = [\n {key: 'owner', value: this.styleOwner},\n {key: 'id', value: this.styleId},\n {key: 'access_token', value: this._map._requestManager._customAccessToken || config.ACCESS_TOKEN}\n ];\n\n if (editLink) {\n const paramString = params.reduce((acc, next, i) => {\n if (next.value) {\n acc += `${next.key}=${next.value}${i < params.length - 1 ? '&' : ''}`;\n }\n return acc;\n }, `?`);\n editLink.href = `${config.FEEDBACK_URL}/${paramString}${this._map._hash ? this._map._hash.getHashString(true) : ''}`;\n editLink.rel = 'noopener nofollow';\n this._setElementTitle(editLink, 'MapFeedback');\n }\n }\n\n _updateData(e: any) {\n if (e && (e.sourceDataType === 'metadata' || e.sourceDataType === 'visibility' || e.dataType === 'style')) {\n this._updateAttributions();\n this._updateEditLink();\n }\n }\n\n _updateAttributions() {\n if (!this._map.style) return;\n let attributions: Array = [];\n if (this.options.customAttribution) {\n if (Array.isArray(this.options.customAttribution)) {\n attributions = attributions.concat(\n this.options.customAttribution.map(attribution => {\n if (typeof attribution !== 'string') return '';\n return attribution;\n })\n );\n } else if (typeof this.options.customAttribution === 'string') {\n attributions.push(this.options.customAttribution);\n }\n }\n\n if (this._map.style.stylesheet) {\n const stylesheet: any = this._map.style.stylesheet;\n this.styleOwner = stylesheet.owner;\n this.styleId = stylesheet.id;\n }\n\n const sourceCaches = this._map.style.sourceCaches;\n for (const id in sourceCaches) {\n const sourceCache = sourceCaches[id];\n if (sourceCache.used) {\n const source = sourceCache.getSource();\n if (source.attribution && attributions.indexOf(source.attribution) < 0) {\n attributions.push(source.attribution);\n }\n }\n }\n\n // remove any entries that are substrings of another entry.\n // first sort by length so that substrings come first\n attributions.sort((a, b) => a.length - b.length);\n attributions = attributions.filter((attrib, i) => {\n for (let j = i + 1; j < attributions.length; j++) {\n if (attributions[j].indexOf(attrib) >= 0) { return false; }\n }\n return true;\n });\n\n // check if attribution string is different to minimize DOM changes\n const attribHTML = attributions.join(' | ');\n if (attribHTML === this._attribHTML) return;\n\n this._attribHTML = attribHTML;\n\n if (attributions.length) {\n this._innerContainer.innerHTML = attribHTML;\n this._container.classList.remove('maplibregl-attrib-empty', 'mapboxgl-attrib-empty');\n } else {\n this._container.classList.add('maplibregl-attrib-empty', 'mapboxgl-attrib-empty');\n }\n // remove old DOM node from _editLink\n this._editLink = null;\n }\n\n _updateCompact() {\n if (this._map.getCanvasContainer().offsetWidth <= 640) {\n this._container.classList.add('maplibregl-compact', 'mapboxgl-compact');\n } else {\n this._container.classList.remove('maplibregl-compact', 'maplibregl-compact-show', 'mapboxgl-compact', 'mapboxgl-compact-show');\n }\n }\n\n}\n\nexport default AttributionControl;\n","// @flow\n\nimport DOM from '../../util/dom';\n\nimport {bindAll} from '../../util/util';\n\nimport type Map from '../map';\n\n/**\n * A `LogoControl` is a control that adds the watermark.\n *\n * @implements {IControl}\n * @private\n**/\n\nclass LogoControl {\n _map: Map;\n _container: HTMLElement;\n\n constructor() {\n bindAll(['_updateLogo'], this);\n bindAll(['_updateCompact'], this);\n }\n\n onAdd(map: Map) {\n this._map = map;\n this._container = DOM.create('div', 'maplibregl-ctrl mapboxgl-ctrl');\n const anchor = DOM.create('a', 'maplibregl-ctrl-logo mapboxgl-ctrl-logo');\n anchor.target = \"_blank\";\n anchor.rel = \"noopener nofollow\";\n anchor.href = \"https://maplibre.org/\";\n anchor.setAttribute(\"aria-label\", this._map._getUIString('LogoControl.Title'));\n anchor.setAttribute(\"rel\", \"noopener nofollow\");\n this._container.appendChild(anchor);\n this._container.style.display = 'none';\n\n this._map.on('sourcedata', this._updateLogo);\n this._updateLogo();\n\n this._map.on('resize', this._updateCompact);\n this._updateCompact();\n\n return this._container;\n }\n\n onRemove() {\n DOM.remove(this._container);\n this._map.off('sourcedata', this._updateLogo);\n this._map.off('resize', this._updateCompact);\n }\n\n getDefaultPosition() {\n return 'bottom-left';\n }\n\n _updateLogo(e: any) {\n if (!e || e.sourceDataType === 'metadata') {\n this._container.style.display = this._logoRequired() ? 'block' : 'none';\n }\n }\n\n _logoRequired() {\n if (!this._map.style) return;\n\n const sourceCaches = this._map.style.sourceCaches;\n for (const id in sourceCaches) {\n const source = sourceCaches[id].getSource();\n if (source.mapbox_logo) {\n return true;\n }\n }\n\n return false;\n }\n\n _updateCompact() {\n const containerChildren = this._container.children;\n if (containerChildren.length) {\n const anchor = containerChildren[0];\n if (this._map.getCanvasContainer().offsetWidth < 250) {\n anchor.classList.add('maplibregl-compact', 'mapboxgl-compact');\n } else {\n anchor.classList.remove('maplibregl-compact', 'mapboxgl-compact');\n }\n }\n }\n\n}\n\nexport default LogoControl;\n","// @flow strict\nimport assert from 'assert';\n\nexport type TaskID = number; // can't mark opaque due to https://github.com/flowtype/flow-remove-types/pull/61\ntype Task = {\n callback: (timeStamp: number) => void;\n id: TaskID;\n cancelled: boolean;\n};\n\nclass TaskQueue {\n _queue: Array;\n _id: TaskID;\n _cleared: boolean;\n _currentlyRunning: Array | false;\n\n constructor() {\n this._queue = [];\n this._id = 0;\n this._cleared = false;\n this._currentlyRunning = false;\n }\n\n add(callback: (timeStamp: number) => void): TaskID {\n const id = ++this._id;\n const queue = this._queue;\n queue.push({callback, id, cancelled: false});\n return id;\n }\n\n remove(id: TaskID) {\n const running = this._currentlyRunning;\n const queue = running ? this._queue.concat(running) : this._queue;\n for (const task of queue) {\n if (task.id === id) {\n task.cancelled = true;\n return;\n }\n }\n }\n\n run(timeStamp: number = 0) {\n assert(!this._currentlyRunning);\n const queue = this._currentlyRunning = this._queue;\n\n // Tasks queued by callbacks in the current queue should be executed\n // on the next run, not the current run.\n this._queue = [];\n\n for (const task of queue) {\n if (task.cancelled) continue;\n task.callback(timeStamp);\n if (this._cleared) break;\n }\n\n this._cleared = false;\n this._currentlyRunning = false;\n }\n\n clear() {\n if (this._currentlyRunning) {\n this._cleared = true;\n }\n this._queue = [];\n }\n}\n\nexport default TaskQueue;\n","// @flow\n\nconst defaultLocale = {\n 'AttributionControl.ToggleAttribution': 'Toggle attribution',\n 'AttributionControl.MapFeedback': 'Map feedback',\n 'FullscreenControl.Enter': 'Enter fullscreen',\n 'FullscreenControl.Exit': 'Exit fullscreen',\n 'GeolocateControl.FindMyLocation': 'Find my location',\n 'GeolocateControl.LocationNotAvailable': 'Location not available',\n 'LogoControl.Title': 'Mapbox logo',\n 'NavigationControl.ResetBearing': 'Reset bearing to north',\n 'NavigationControl.ZoomIn': 'Zoom in',\n 'NavigationControl.ZoomOut': 'Zoom out',\n 'ScaleControl.Feet': 'ft',\n 'ScaleControl.Meters': 'm',\n 'ScaleControl.Kilometers': 'km',\n 'ScaleControl.Miles': 'mi',\n 'ScaleControl.NauticalMiles': 'nm'\n\n};\n\nexport default defaultLocale;\n","// @flow\n\nimport {version} from '../../package.json';\nimport {extend, bindAll, warnOnce, uniqueId} from '../util/util';\nimport browser from '../util/browser';\nimport window from '../util/window';\nconst {HTMLImageElement, HTMLElement, ImageBitmap} = window;\nimport DOM from '../util/dom';\nimport {getImage, getJSON, ResourceType} from '../util/ajax';\nimport {RequestManager} from '../util/mapbox';\nimport Style from '../style/style';\nimport EvaluationParameters from '../style/evaluation_parameters';\nimport Painter from '../render/painter';\nimport Transform from '../geo/transform';\nimport Hash from './hash';\nimport HandlerManager from './handler_manager';\nimport Camera from './camera';\nimport LngLat from '../geo/lng_lat';\nimport LngLatBounds from '../geo/lng_lat_bounds';\nimport Point from '@mapbox/point-geometry';\nimport AttributionControl from './control/attribution_control';\nimport LogoControl from './control/logo_control';\nimport isSupported from '@mapbox/mapbox-gl-supported';\nimport {RGBAImage} from '../util/image';\nimport {Event, ErrorEvent} from '../util/evented';\nimport {MapMouseEvent} from './events';\nimport TaskQueue from '../util/task_queue';\nimport webpSupported from '../util/webp_supported';\nimport {PerformanceMarkers, PerformanceUtils} from '../util/performance';\n\nimport {setCacheLimits} from '../util/tile_request_cache';\n\nimport type {PointLike} from '@mapbox/point-geometry';\nimport type {RequestTransformFunction} from '../util/mapbox';\nimport type {LngLatLike} from '../geo/lng_lat';\nimport type {LngLatBoundsLike} from '../geo/lng_lat_bounds';\nimport type {StyleOptions, StyleSetterOptions} from '../style/style';\nimport type {MapEvent, MapDataEvent} from './events';\nimport type {CustomLayerInterface} from '../style/style_layer/custom_style_layer';\nimport type {StyleImageInterface, StyleImageMetadata} from '../style/style_image';\n\nimport type ScrollZoomHandler from './handler/scroll_zoom';\nimport type BoxZoomHandler from './handler/box_zoom';\nimport type {TouchPitchHandler} from './handler/touch_zoom_rotate';\nimport type DragRotateHandler from './handler/shim/drag_rotate';\nimport type DragPanHandler, {DragPanOptions} from './handler/shim/drag_pan';\nimport type KeyboardHandler from './handler/keyboard';\nimport type DoubleClickZoomHandler from './handler/shim/dblclick_zoom';\nimport type TouchZoomRotateHandler from './handler/shim/touch_zoom_rotate';\nimport defaultLocale from './default_locale';\nimport type {TaskID} from '../util/task_queue';\nimport type {Cancelable} from '../types/cancelable';\nimport type {\n LayerSpecification,\n FilterSpecification,\n StyleSpecification,\n LightSpecification,\n SourceSpecification\n} from '../style-spec/types';\n\ntype ControlPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';\n/* eslint-disable no-use-before-define */\ntype IControl = {\n onAdd(map: Map): HTMLElement;\n onRemove(map: Map): void;\n\n +getDefaultPosition?: () => ControlPosition;\n}\n/* eslint-enable no-use-before-define */\n\ntype MapOptions = {\n hash?: boolean | string,\n interactive?: boolean,\n container: HTMLElement | string,\n bearingSnap?: number,\n attributionControl?: boolean,\n customAttribution?: string | Array,\n logoPosition?: ControlPosition,\n failIfMajorPerformanceCaveat?: boolean,\n preserveDrawingBuffer?: boolean,\n antialias?: boolean,\n refreshExpiredTiles?: boolean,\n maxBounds?: LngLatBoundsLike,\n scrollZoom?: boolean,\n minZoom?: ?number,\n maxZoom?: ?number,\n minPitch?: ?number,\n maxPitch?: ?number,\n boxZoom?: boolean,\n dragRotate?: boolean,\n dragPan?: DragPanOptions,\n keyboard?: boolean,\n doubleClickZoom?: boolean,\n touchZoomRotate?: boolean,\n touchPitch?: boolean,\n trackResize?: boolean,\n center?: LngLatLike,\n zoom?: number,\n bearing?: number,\n pitch?: number,\n renderWorldCopies?: boolean,\n maxTileCacheSize?: number,\n transformRequest?: RequestTransformFunction,\n accessToken: string,\n locale?: Object\n};\n\nconst defaultMinZoom = -2;\nconst defaultMaxZoom = 22;\n\n// the default values, but also the valid range\nconst defaultMinPitch = 0;\nconst defaultMaxPitch = 60;\n\nconst defaultOptions = {\n center: [0, 0],\n zoom: 0,\n bearing: 0,\n pitch: 0,\n\n minZoom: defaultMinZoom,\n maxZoom: defaultMaxZoom,\n\n minPitch: defaultMinPitch,\n maxPitch: defaultMaxPitch,\n\n interactive: true,\n scrollZoom: true,\n boxZoom: true,\n dragRotate: true,\n dragPan: true,\n keyboard: true,\n doubleClickZoom: true,\n touchZoomRotate: true,\n touchPitch: true,\n\n bearingSnap: 7,\n clickTolerance: 3,\n pitchWithRotate: true,\n\n hash: false,\n attributionControl: true,\n\n failIfMajorPerformanceCaveat: false,\n preserveDrawingBuffer: false,\n trackResize: true,\n renderWorldCopies: true,\n refreshExpiredTiles: true,\n maxTileCacheSize: null,\n localIdeographFontFamily: 'sans-serif',\n transformRequest: null,\n accessToken: null,\n fadeDuration: 300,\n crossSourceCollisions: true\n};\n\n/**\n * The `Map` object represents the map on your page. It exposes methods\n * and properties that enable you to programmatically change the map,\n * and fires events as users interact with it.\n *\n * You create a `Map` by specifying a `container` and other options.\n * Then Mapbox GL JS initializes the map on the page and returns your `Map`\n * object.\n *\n * @extends Evented\n * @param {Object} options\n * @param {HTMLElement|string} options.container The HTML element in which Mapbox GL JS will render the map, or the element's string `id`. The specified element must have no children.\n * @param {number} [options.minZoom=0] The minimum zoom level of the map (0-24).\n * @param {number} [options.maxZoom=22] The maximum zoom level of the map (0-24).\n * @param {number} [options.minPitch=0] The minimum pitch of the map (0-60).\n * @param {number} [options.maxPitch=60] The maximum pitch of the map (0-60).\n * @param {Object|string} [options.style] The map's Mapbox style. This must be an a JSON object conforming to\n * the schema described in the [Mapbox Style Specification](https://mapbox.com/mapbox-gl-style-spec/), or a URL to\n * such JSON.\n *\n * To load a style from the Mapbox API, you can use a URL of the form `mapbox://styles/:owner/:style`,\n * where `:owner` is your Mapbox account name and `:style` is the style ID. Or you can use one of the following\n * [the predefined Mapbox styles](https://www.mapbox.com/maps/):\n *\n * * `mapbox://styles/mapbox/streets-v11`\n * * `mapbox://styles/mapbox/outdoors-v11`\n * * `mapbox://styles/mapbox/light-v10`\n * * `mapbox://styles/mapbox/dark-v10`\n * * `mapbox://styles/mapbox/satellite-v9`\n * * `mapbox://styles/mapbox/satellite-streets-v11`\n * * `mapbox://styles/mapbox/navigation-preview-day-v4`\n * * `mapbox://styles/mapbox/navigation-preview-night-v4`\n * * `mapbox://styles/mapbox/navigation-guidance-day-v4`\n * * `mapbox://styles/mapbox/navigation-guidance-night-v4`\n *\n * Tilesets hosted with Mapbox can be style-optimized if you append `?optimize=true` to the end of your style URL, like `mapbox://styles/mapbox/streets-v11?optimize=true`.\n * Learn more about style-optimized vector tiles in our [API documentation](https://www.mapbox.com/api-documentation/maps/#retrieve-tiles).\n *\n * @param {(boolean|string)} [options.hash=false] If `true`, the map's position (zoom, center latitude, center longitude, bearing, and pitch) will be synced with the hash fragment of the page's URL.\n * For example, `http://path/to/my/page.html#2.59/39.26/53.07/-24.1/60`.\n * An additional string may optionally be provided to indicate a parameter-styled hash,\n * e.g. http://path/to/my/page.html#map=2.59/39.26/53.07/-24.1/60&foo=bar, where foo\n * is a custom parameter and bar is an arbitrary hash distinct from the map hash.\n * @param {boolean} [options.interactive=true] If `false`, no mouse, touch, or keyboard listeners will be attached to the map, so it will not respond to interaction.\n * @param {number} [options.bearingSnap=7] The threshold, measured in degrees, that determines when the map's\n * bearing will snap to north. For example, with a `bearingSnap` of 7, if the user rotates\n * the map within 7 degrees of north, the map will automatically snap to exact north.\n * @param {boolean} [options.pitchWithRotate=true] If `false`, the map's pitch (tilt) control with \"drag to rotate\" interaction will be disabled.\n * @param {number} [options.clickTolerance=3] The max number of pixels a user can shift the mouse pointer during a click for it to be considered a valid click (as opposed to a mouse drag).\n * @param {boolean} [options.attributionControl=true] If `true`, an {@link AttributionControl} will be added to the map.\n * @param {string | Array} [options.customAttribution] String or strings to show in an {@link AttributionControl}. Only applicable if `options.attributionControl` is `true`.\n * @param {string} [options.logoPosition='bottom-left'] A string representing the position of the Mapbox wordmark on the map. Valid options are `top-left`,`top-right`, `bottom-left`, `bottom-right`.\n * @param {boolean} [options.failIfMajorPerformanceCaveat=false] If `true`, map creation will fail if the performance of Mapbox\n * GL JS would be dramatically worse than expected (i.e. a software renderer would be used).\n * @param {boolean} [options.preserveDrawingBuffer=false] If `true`, the map's canvas can be exported to a PNG using `map.getCanvas().toDataURL()`. This is `false` by default as a performance optimization.\n * @param {boolean} [options.antialias] If `true`, the gl context will be created with MSAA antialiasing, which can be useful for antialiasing custom layers. this is `false` by default as a performance optimization.\n * @param {boolean} [options.refreshExpiredTiles=true] If `false`, the map won't attempt to re-request tiles once they expire per their HTTP `cacheControl`/`expires` headers.\n * @param {LngLatBoundsLike} [options.maxBounds] If set, the map will be constrained to the given bounds.\n * @param {boolean|Object} [options.scrollZoom=true] If `true`, the \"scroll to zoom\" interaction is enabled. An `Object` value is passed as options to {@link ScrollZoomHandler#enable}.\n * @param {boolean} [options.boxZoom=true] If `true`, the \"box zoom\" interaction is enabled (see {@link BoxZoomHandler}).\n * @param {boolean} [options.dragRotate=true] If `true`, the \"drag to rotate\" interaction is enabled (see {@link DragRotateHandler}).\n * @param {boolean|Object} [options.dragPan=true] If `true`, the \"drag to pan\" interaction is enabled. An `Object` value is passed as options to {@link DragPanHandler#enable}.\n * @param {boolean} [options.keyboard=true] If `true`, keyboard shortcuts are enabled (see {@link KeyboardHandler}).\n * @param {boolean} [options.doubleClickZoom=true] If `true`, the \"double click to zoom\" interaction is enabled (see {@link DoubleClickZoomHandler}).\n * @param {boolean|Object} [options.touchZoomRotate=true] If `true`, the \"pinch to rotate and zoom\" interaction is enabled. An `Object` value is passed as options to {@link TouchZoomRotateHandler#enable}.\n * @param {boolean|Object} [options.touchPitch=true] If `true`, the \"drag to pitch\" interaction is enabled. An `Object` value is passed as options to {@link TouchPitchHandler#enable}.\n * @param {boolean} [options.trackResize=true] If `true`, the map will automatically resize when the browser window resizes.\n * @param {LngLatLike} [options.center=[0, 0]] The inital geographical centerpoint of the map. If `center` is not specified in the constructor options, Mapbox GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to `[0, 0]` Note: Mapbox GL uses longitude, latitude coordinate order (as opposed to latitude, longitude) to match GeoJSON.\n * @param {number} [options.zoom=0] The initial zoom level of the map. If `zoom` is not specified in the constructor options, Mapbox GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to `0`.\n * @param {number} [options.bearing=0] The initial bearing (rotation) of the map, measured in degrees counter-clockwise from north. If `bearing` is not specified in the constructor options, Mapbox GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to `0`.\n * @param {number} [options.pitch=0] The initial pitch (tilt) of the map, measured in degrees away from the plane of the screen (0-60). If `pitch` is not specified in the constructor options, Mapbox GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to `0`.\n * @param {LngLatBoundsLike} [options.bounds] The initial bounds of the map. If `bounds` is specified, it overrides `center` and `zoom` constructor options.\n * @param {Object} [options.fitBoundsOptions] A {@link Map#fitBounds} options object to use _only_ when fitting the initial `bounds` provided above.\n * @param {boolean} [options.renderWorldCopies=true] If `true`, multiple copies of the world will be rendered side by side beyond -180 and 180 degrees longitude. If set to `false`:\n * - When the map is zoomed out far enough that a single representation of the world does not fill the map's entire\n * container, there will be blank space beyond 180 and -180 degrees longitude.\n * - Features that cross 180 and -180 degrees longitude will be cut in two (with one portion on the right edge of the\n * map and the other on the left edge of the map) at every zoom level.\n * @param {number} [options.maxTileCacheSize=null] The maximum number of tiles stored in the tile cache for a given source. If omitted, the cache will be dynamically sized based on the current viewport.\n * @param {string} [options.localIdeographFontFamily='sans-serif'] Defines a CSS\n * font-family for locally overriding generation of glyphs in the 'CJK Unified Ideographs', 'Hiragana', 'Katakana' and 'Hangul Syllables' ranges.\n * In these ranges, font settings from the map's style will be ignored, except for font-weight keywords (light/regular/medium/bold).\n * Set to `false`, to enable font settings from the map's style for these glyph ranges. Note that [Mapbox Studio](https://studio.mapbox.com/) sets this value to `false` by default.\n * The purpose of this option is to avoid bandwidth-intensive glyph server requests. (See [Use locally generated ideographs](https://maplibre.org/maplibre-gl-js-docs/example/local-ideographs).)\n * @param {RequestTransformFunction} [options.transformRequest=null] A callback run before the Map makes a request for an external URL. The callback can be used to modify the url, set headers, or set the credentials property for cross-origin requests.\n * Expected to return an object with a `url` property and optionally `headers` and `credentials` properties.\n * @param {boolean} [options.collectResourceTiming=false] If `true`, Resource Timing API information will be collected for requests made by GeoJSON and Vector Tile web workers (this information is normally inaccessible from the main Javascript thread). Information will be returned in a `resourceTiming` property of relevant `data` events.\n * @param {number} [options.fadeDuration=300] Controls the duration of the fade-in/fade-out animation for label collisions, in milliseconds. This setting affects all symbol layers. This setting does not affect the duration of runtime styling transitions or raster tile cross-fading.\n * @param {boolean} [options.crossSourceCollisions=true] If `true`, symbols from multiple sources can collide with each other during collision detection. If `false`, collision detection is run separately for the symbols in each source.\n * @param {string} [options.accessToken=null] If specified, map will use this token instead of the one defined in mapboxgl.accessToken.\n * @param {Object} [options.locale=null] A patch to apply to the default localization table for UI strings, e.g. control tooltips. The `locale` object maps namespaced UI string IDs to translated strings in the target language; see `src/ui/default_locale.js` for an example with all supported string IDs. The object may specify all UI strings (thereby adding support for a new translation) or only a subset of strings (thereby patching the default translation table).\n * @example\n * var map = new maplibregl.Map({\n * container: 'map',\n * center: [-122.420679, 37.772537],\n * zoom: 13,\n * style: style_object,\n * hash: true,\n * transformRequest: (url, resourceType)=> {\n * if(resourceType === 'Source' && url.startsWith('http://myHost')) {\n * return {\n * url: url.replace('http', 'https'),\n * headers: { 'my-custom-header': true},\n * credentials: 'include' // Include cookies for cross-origin requests\n * }\n * }\n * }\n * });\n * @see [Display a map](https://www.mapbox.com/mapbox-gl-js/examples/)\n */\nclass Map extends Camera {\n style: Style;\n painter: Painter;\n handlers: HandlerManager;\n\n _container: HTMLElement;\n _canvasContainer: HTMLElement;\n _controlContainer: HTMLElement;\n _controlPositions: {[_: string]: HTMLElement};\n _interactive: ?boolean;\n _showTileBoundaries: ?boolean;\n _showCollisionBoxes: ?boolean;\n _showPadding: ?boolean;\n _showOverdrawInspector: boolean;\n _repaint: ?boolean;\n _vertices: ?boolean;\n _canvas: HTMLCanvasElement;\n _maxTileCacheSize: number;\n _frame: ?Cancelable;\n _styleDirty: ?boolean;\n _sourcesDirty: ?boolean;\n _placementDirty: ?boolean;\n _loaded: boolean;\n // accounts for placement finishing as well\n _fullyLoaded: boolean;\n _trackResize: boolean;\n _preserveDrawingBuffer: boolean;\n _failIfMajorPerformanceCaveat: boolean;\n _antialias: boolean;\n _refreshExpiredTiles: boolean;\n _hash: Hash;\n _delegatedListeners: any;\n _fadeDuration: number;\n _crossSourceCollisions: boolean;\n _crossFadingFactor: number;\n _collectResourceTiming: boolean;\n _renderTaskQueue: TaskQueue;\n _controls: Array;\n _mapId: number;\n _localIdeographFontFamily: string;\n _requestManager: RequestManager;\n _locale: Object;\n _removed: boolean;\n _clickTolerance: number;\n\n /**\n * The map's {@link ScrollZoomHandler}, which implements zooming in and out with a scroll wheel or trackpad.\n * Find more details and examples using `scrollZoom` in the {@link ScrollZoomHandler} section.\n */\n scrollZoom: ScrollZoomHandler;\n\n /**\n * The map's {@link BoxZoomHandler}, which implements zooming using a drag gesture with the Shift key pressed.\n * Find more details and examples using `boxZoom` in the {@link BoxZoomHandler} section.\n */\n boxZoom: BoxZoomHandler;\n\n /**\n * The map's {@link DragRotateHandler}, which implements rotating the map while dragging with the right\n * mouse button or with the Control key pressed. Find more details and examples using `dragRotate`\n * in the {@link DragRotateHandler} section.\n */\n dragRotate: DragRotateHandler;\n\n /**\n * The map's {@link DragPanHandler}, which implements dragging the map with a mouse or touch gesture.\n * Find more details and examples using `dragPan` in the {@link DragPanHandler} section.\n */\n dragPan: DragPanHandler;\n\n /**\n * The map's {@link KeyboardHandler}, which allows the user to zoom, rotate, and pan the map using keyboard\n * shortcuts. Find more details and examples using `keyboard` in the {@link KeyboardHandler} section.\n */\n keyboard: KeyboardHandler;\n\n /**\n * The map's {@link DoubleClickZoomHandler}, which allows the user to zoom by double clicking.\n * Find more details and examples using `doubleClickZoom` in the {@link DoubleClickZoomHandler} section.\n */\n doubleClickZoom: DoubleClickZoomHandler;\n\n /**\n * The map's {@link TouchZoomRotateHandler}, which allows the user to zoom or rotate the map with touch gestures.\n * Find more details and examples using `touchZoomRotate` in the {@link TouchZoomRotateHandler} section.\n */\n touchZoomRotate: TouchZoomRotateHandler;\n\n /**\n * The map's {@link TouchPitchHandler}, which allows the user to pitch the map with touch gestures.\n * Find more details and examples using `touchPitch` in the {@link TouchPitchHandler} section.\n */\n touchPitch: TouchPitchHandler;\n\n constructor(options: MapOptions) {\n PerformanceUtils.mark(PerformanceMarkers.create);\n\n options = extend({}, defaultOptions, options);\n\n if (options.minZoom != null && options.maxZoom != null && options.minZoom > options.maxZoom) {\n throw new Error(`maxZoom must be greater than or equal to minZoom`);\n }\n\n if (options.minPitch != null && options.maxPitch != null && options.minPitch > options.maxPitch) {\n throw new Error(`maxPitch must be greater than or equal to minPitch`);\n }\n\n if (options.minPitch != null && options.minPitch < defaultMinPitch) {\n throw new Error(`minPitch must be greater than or equal to ${defaultMinPitch}`);\n }\n\n if (options.maxPitch != null && options.maxPitch > defaultMaxPitch) {\n throw new Error(`maxPitch must be less than or equal to ${defaultMaxPitch}`);\n }\n\n const transform = new Transform(options.minZoom, options.maxZoom, options.minPitch, options.maxPitch, options.renderWorldCopies);\n super(transform, options);\n\n this._interactive = options.interactive;\n this._maxTileCacheSize = options.maxTileCacheSize;\n this._failIfMajorPerformanceCaveat = options.failIfMajorPerformanceCaveat;\n this._preserveDrawingBuffer = options.preserveDrawingBuffer;\n this._antialias = options.antialias;\n this._trackResize = options.trackResize;\n this._bearingSnap = options.bearingSnap;\n this._refreshExpiredTiles = options.refreshExpiredTiles;\n this._fadeDuration = options.fadeDuration;\n this._crossSourceCollisions = options.crossSourceCollisions;\n this._crossFadingFactor = 1;\n this._collectResourceTiming = options.collectResourceTiming;\n this._renderTaskQueue = new TaskQueue();\n this._controls = [];\n this._mapId = uniqueId();\n this._locale = extend({}, defaultLocale, options.locale);\n this._clickTolerance = options.clickTolerance;\n\n this._requestManager = new RequestManager(options.transformRequest, options.accessToken);\n\n if (typeof options.container === 'string') {\n this._container = window.document.getElementById(options.container);\n if (!this._container) {\n throw new Error(`Container '${options.container}' not found.`);\n }\n } else if (options.container instanceof HTMLElement) {\n this._container = options.container;\n } else {\n throw new Error(`Invalid type: 'container' must be a String or HTMLElement.`);\n }\n\n if (options.maxBounds) {\n this.setMaxBounds(options.maxBounds);\n }\n\n bindAll([\n '_onWindowOnline',\n '_onWindowResize',\n '_onMapScroll',\n '_contextLost',\n '_contextRestored'\n ], this);\n\n this._setupContainer();\n this._setupPainter();\n if (this.painter === undefined) {\n throw new Error(`Failed to initialize WebGL.`);\n }\n\n this.on('move', () => this._update(false));\n this.on('moveend', () => this._update(false));\n this.on('zoom', () => this._update(true));\n\n if (typeof window !== 'undefined') {\n window.addEventListener('online', this._onWindowOnline, false);\n window.addEventListener('resize', this._onWindowResize, false);\n window.addEventListener('orientationchange', this._onWindowResize, false);\n }\n\n this.handlers = new HandlerManager(this, options);\n\n const hashName = (typeof options.hash === 'string' && options.hash) || undefined;\n this._hash = options.hash && (new Hash(hashName)).addTo(this);\n // don't set position from options if set through hash\n if (!this._hash || !this._hash._onHashChange()) {\n this.jumpTo({\n center: options.center,\n zoom: options.zoom,\n bearing: options.bearing,\n pitch: options.pitch\n });\n\n if (options.bounds) {\n this.resize();\n this.fitBounds(options.bounds, extend({}, options.fitBoundsOptions, {duration: 0}));\n }\n }\n\n this.resize();\n\n this._localIdeographFontFamily = options.localIdeographFontFamily;\n if (options.style) this.setStyle(options.style, {localIdeographFontFamily: options.localIdeographFontFamily});\n\n if (options.attributionControl)\n this.addControl(new AttributionControl({customAttribution: options.customAttribution}));\n\n this.addControl(new LogoControl(), options.logoPosition);\n\n this.on('style.load', () => {\n if (this.transform.unmodified) {\n this.jumpTo((this.style.stylesheet: any));\n }\n });\n this.on('data', (event: MapDataEvent) => {\n this._update(event.dataType === 'style');\n this.fire(new Event(`${event.dataType}data`, event));\n });\n this.on('dataloading', (event: MapDataEvent) => {\n this.fire(new Event(`${event.dataType}dataloading`, event));\n });\n }\n\n /*\n * Returns a unique number for this map instance which is used for the MapLoadEvent\n * to make sure we only fire one event per instantiated map object.\n * @private\n * @returns {number}\n */\n _getMapId() {\n return this._mapId;\n }\n\n /**\n * Adds an {@link IControl} to the map, calling `control.onAdd(this)`.\n *\n * @param {IControl} control The {@link IControl} to add.\n * @param {string} [position] position on the map to which the control will be added.\n * Valid values are `'top-left'`, `'top-right'`, `'bottom-left'`, and `'bottom-right'`. Defaults to `'top-right'`.\n * @returns {Map} `this`\n * @example\n * // Add zoom and rotation controls to the map.\n * map.addControl(new maplibregl.NavigationControl());\n * @see [Display map navigation controls](https://maplibre.org/maplibre-gl-js-docs/example/navigation/)\n */\n addControl(control: IControl, position?: ControlPosition) {\n if (position === undefined) {\n if (control.getDefaultPosition) {\n position = control.getDefaultPosition();\n } else {\n position = 'top-right';\n }\n }\n if (!control || !control.onAdd) {\n return this.fire(new ErrorEvent(new Error(\n 'Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.')));\n }\n const controlElement = control.onAdd(this);\n this._controls.push(control);\n\n const positionContainer = this._controlPositions[position];\n if (position.indexOf('bottom') !== -1) {\n positionContainer.insertBefore(controlElement, positionContainer.firstChild);\n } else {\n positionContainer.appendChild(controlElement);\n }\n return this;\n }\n\n /**\n * Removes the control from the map.\n *\n * @param {IControl} control The {@link IControl} to remove.\n * @returns {Map} `this`\n * @example\n * // Define a new navigation control.\n * var navigation = new maplibregl.NavigationControl();\n * // Add zoom and rotation controls to the map.\n * map.addControl(navigation);\n * // Remove zoom and rotation controls from the map.\n * map.removeControl(navigation);\n */\n removeControl(control: IControl) {\n if (!control || !control.onRemove) {\n return this.fire(new ErrorEvent(new Error(\n 'Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.')));\n }\n const ci = this._controls.indexOf(control);\n if (ci > -1) this._controls.splice(ci, 1);\n control.onRemove(this);\n return this;\n }\n\n /**\n * Checks if a control exists on the map.\n *\n * @param {IControl} control The {@link IControl} to check.\n * @returns {boolean} True if map contains control.\n * @example\n * // Define a new navigation control.\n * var navigation = new maplibregl.NavigationControl();\n * // Add zoom and rotation controls to the map.\n * map.addControl(navigation);\n * // Check that the navigation control exists on the map.\n * map.hasControl(navigation);\n */\n hasControl(control: IControl) {\n return this._controls.indexOf(control) > -1;\n }\n\n /**\n * Resizes the map according to the dimensions of its\n * `container` element.\n *\n * Checks if the map container size changed and updates the map if it has changed.\n * This method must be called after the map's `container` is resized programmatically\n * or when the map is shown after being initially hidden with CSS.\n *\n * @param eventData Additional properties to be passed to `movestart`, `move`, `resize`, and `moveend`\n * events that get triggered as a result of resize. This can be useful for differentiating the\n * source of an event (for example, user-initiated or programmatically-triggered events).\n * @returns {Map} `this`\n * @example\n * // Resize the map when the map container is shown\n * // after being initially hidden with CSS.\n * var mapDiv = document.getElementById('map');\n * if (mapDiv.style.visibility === true) map.resize();\n */\n resize(eventData?: Object) {\n const dimensions = this._containerDimensions();\n const width = dimensions[0];\n const height = dimensions[1];\n\n this._resizeCanvas(width, height);\n this.transform.resize(width, height);\n this.painter.resize(width, height);\n\n const fireMoving = !this._moving;\n if (fireMoving) {\n this.stop();\n this.fire(new Event('movestart', eventData))\n .fire(new Event('move', eventData));\n }\n\n this.fire(new Event('resize', eventData));\n\n if (fireMoving) this.fire(new Event('moveend', eventData));\n\n return this;\n }\n\n /**\n * Returns the map's geographical bounds. When the bearing or pitch is non-zero, the visible region is not\n * an axis-aligned rectangle, and the result is the smallest bounds that encompasses the visible region.\n * @returns {LngLatBounds} The geographical bounds of the map as {@link LngLatBounds}.\n * @example\n * var bounds = map.getBounds();\n */\n getBounds(): LngLatBounds {\n return this.transform.getBounds();\n }\n\n /**\n * Returns the maximum geographical bounds the map is constrained to, or `null` if none set.\n * @returns The map object.\n * @example\n * var maxBounds = map.getMaxBounds();\n */\n getMaxBounds(): LngLatBounds | null {\n return this.transform.getMaxBounds();\n }\n\n /**\n * Sets or clears the map's geographical bounds.\n *\n * Pan and zoom operations are constrained within these bounds.\n * If a pan or zoom is performed that would\n * display regions outside these bounds, the map will\n * instead display a position and zoom level\n * as close as possible to the operation's request while still\n * remaining within the bounds.\n *\n * @param {LngLatBoundsLike | null | undefined} bounds The maximum bounds to set. If `null` or `undefined` is provided, the function removes the map's maximum bounds.\n * @returns {Map} `this`\n * @example\n * // Define bounds that conform to the `LngLatBoundsLike` object.\n * var bounds = [\n * [-74.04728, 40.68392], // [west, south]\n * [-73.91058, 40.87764] // [east, north]\n * ];\n * // Set the map's max bounds.\n * map.setMaxBounds(bounds);\n */\n setMaxBounds(bounds: LngLatBoundsLike) {\n this.transform.setMaxBounds(LngLatBounds.convert(bounds));\n return this._update();\n }\n\n /**\n * Sets or clears the map's minimum zoom level.\n * If the map's current zoom level is lower than the new minimum,\n * the map will zoom to the new minimum.\n *\n * It is not always possible to zoom out and reach the set `minZoom`.\n * Other factors such as map height may restrict zooming. For example,\n * if the map is 512px tall it will not be possible to zoom below zoom 0\n * no matter what the `minZoom` is set to.\n *\n * @param {number | null | undefined} minZoom The minimum zoom level to set (-2 - 24).\n * If `null` or `undefined` is provided, the function removes the current minimum zoom (i.e. sets it to -2).\n * @returns {Map} `this`\n * @example\n * map.setMinZoom(12.25);\n */\n setMinZoom(minZoom?: ?number) {\n\n minZoom = minZoom === null || minZoom === undefined ? defaultMinZoom : minZoom;\n\n if (minZoom >= defaultMinZoom && minZoom <= this.transform.maxZoom) {\n this.transform.minZoom = minZoom;\n this._update();\n\n if (this.getZoom() < minZoom) this.setZoom(minZoom);\n\n return this;\n\n } else throw new Error(`minZoom must be between ${defaultMinZoom} and the current maxZoom, inclusive`);\n }\n\n /**\n * Returns the map's minimum allowable zoom level.\n *\n * @returns {number} minZoom\n * @example\n * var minZoom = map.getMinZoom();\n */\n getMinZoom() { return this.transform.minZoom; }\n\n /**\n * Sets or clears the map's maximum zoom level.\n * If the map's current zoom level is higher than the new maximum,\n * the map will zoom to the new maximum.\n *\n * @param {number | null | undefined} maxZoom The maximum zoom level to set.\n * If `null` or `undefined` is provided, the function removes the current maximum zoom (sets it to 22).\n * @returns {Map} `this`\n * @example\n * map.setMaxZoom(18.75);\n */\n setMaxZoom(maxZoom?: ?number) {\n\n maxZoom = maxZoom === null || maxZoom === undefined ? defaultMaxZoom : maxZoom;\n\n if (maxZoom >= this.transform.minZoom) {\n this.transform.maxZoom = maxZoom;\n this._update();\n\n if (this.getZoom() > maxZoom) this.setZoom(maxZoom);\n\n return this;\n\n } else throw new Error(`maxZoom must be greater than the current minZoom`);\n }\n\n /**\n * Returns the map's maximum allowable zoom level.\n *\n * @returns {number} maxZoom\n * @example\n * var maxZoom = map.getMaxZoom();\n */\n getMaxZoom() { return this.transform.maxZoom; }\n\n /**\n * Sets or clears the map's minimum pitch.\n * If the map's current pitch is lower than the new minimum,\n * the map will pitch to the new minimum.\n *\n * @param {number | null | undefined} minPitch The minimum pitch to set (0-60).\n * If `null` or `undefined` is provided, the function removes the current minimum pitch (i.e. sets it to 0).\n * @returns {Map} `this`\n */\n setMinPitch(minPitch?: ?number) {\n\n minPitch = minPitch === null || minPitch === undefined ? defaultMinPitch : minPitch;\n\n if (minPitch < defaultMinPitch) {\n throw new Error(`minPitch must be greater than or equal to ${defaultMinPitch}`);\n }\n\n if (minPitch >= defaultMinPitch && minPitch <= this.transform.maxPitch) {\n this.transform.minPitch = minPitch;\n this._update();\n\n if (this.getPitch() < minPitch) this.setPitch(minPitch);\n\n return this;\n\n } else throw new Error(`minPitch must be between ${defaultMinPitch} and the current maxPitch, inclusive`);\n }\n\n /**\n * Returns the map's minimum allowable pitch.\n *\n * @returns {number} minPitch\n */\n getMinPitch() { return this.transform.minPitch; }\n\n /**\n * Sets or clears the map's maximum pitch.\n * If the map's current pitch is higher than the new maximum,\n * the map will pitch to the new maximum.\n *\n * @param {number | null | undefined} maxPitch The maximum pitch to set.\n * If `null` or `undefined` is provided, the function removes the current maximum pitch (sets it to 60).\n * @returns {Map} `this`\n */\n setMaxPitch(maxPitch?: ?number) {\n\n maxPitch = maxPitch === null || maxPitch === undefined ? defaultMaxPitch : maxPitch;\n\n if (maxPitch > defaultMaxPitch) {\n throw new Error(`maxPitch must be less than or equal to ${defaultMaxPitch}`);\n }\n\n if (maxPitch >= this.transform.minPitch) {\n this.transform.maxPitch = maxPitch;\n this._update();\n\n if (this.getPitch() > maxPitch) this.setPitch(maxPitch);\n\n return this;\n\n } else throw new Error(`maxPitch must be greater than the current minPitch`);\n }\n\n /**\n * Returns the map's maximum allowable pitch.\n *\n * @returns {number} maxPitch\n */\n getMaxPitch() { return this.transform.maxPitch; }\n\n /**\n * Returns the state of `renderWorldCopies`. If `true`, multiple copies of the world will be rendered side by side beyond -180 and 180 degrees longitude. If set to `false`:\n * - When the map is zoomed out far enough that a single representation of the world does not fill the map's entire\n * container, there will be blank space beyond 180 and -180 degrees longitude.\n * - Features that cross 180 and -180 degrees longitude will be cut in two (with one portion on the right edge of the\n * map and the other on the left edge of the map) at every zoom level.\n * @returns {boolean} renderWorldCopies\n * @example\n * var worldCopiesRendered = map.getRenderWorldCopies();\n * @see [Render world copies](https://maplibre.org/maplibre-gl-js-docs/example/render-world-copies/)\n */\n getRenderWorldCopies() { return this.transform.renderWorldCopies; }\n\n /**\n * Sets the state of `renderWorldCopies`.\n *\n * @param {boolean} renderWorldCopies If `true`, multiple copies of the world will be rendered side by side beyond -180 and 180 degrees longitude. If set to `false`:\n * - When the map is zoomed out far enough that a single representation of the world does not fill the map's entire\n * container, there will be blank space beyond 180 and -180 degrees longitude.\n * - Features that cross 180 and -180 degrees longitude will be cut in two (with one portion on the right edge of the\n * map and the other on the left edge of the map) at every zoom level.\n *\n * `undefined` is treated as `true`, `null` is treated as `false`.\n * @returns {Map} `this`\n * @example\n * map.setRenderWorldCopies(true);\n * @see [Render world copies](https://maplibre.org/maplibre-gl-js-docs/example/render-world-copies/)\n */\n setRenderWorldCopies(renderWorldCopies?: ?boolean) {\n this.transform.renderWorldCopies = renderWorldCopies;\n return this._update();\n }\n\n /**\n * Returns a {@link Point} representing pixel coordinates, relative to the map's `container`,\n * that correspond to the specified geographical location.\n *\n * @param {LngLatLike} lnglat The geographical location to project.\n * @returns {Point} The {@link Point} corresponding to `lnglat`, relative to the map's `container`.\n * @example\n * var coordinate = [-122.420679, 37.772537];\n * var point = map.project(coordinate);\n */\n project(lnglat: LngLatLike) {\n return this.transform.locationPoint(LngLat.convert(lnglat));\n }\n\n /**\n * Returns a {@link LngLat} representing geographical coordinates that correspond\n * to the specified pixel coordinates.\n *\n * @param {PointLike} point The pixel coordinates to unproject.\n * @returns {LngLat} The {@link LngLat} corresponding to `point`.\n * @example\n * map.on('click', function(e) {\n * // When the map is clicked, get the geographic coordinate.\n * var coordinate = map.unproject(e.point);\n * });\n */\n unproject(point: PointLike) {\n return this.transform.pointLocation(Point.convert(point));\n }\n\n /**\n * Returns true if the map is panning, zooming, rotating, or pitching due to a camera animation or user gesture.\n * @returns {boolean} True if the map is moving.\n * @example\n * var isMoving = map.isMoving();\n */\n isMoving(): boolean {\n return this._moving || this.handlers.isMoving();\n }\n\n /**\n * Returns true if the map is zooming due to a camera animation or user gesture.\n * @returns {boolean} True if the map is zooming.\n * @example\n * var isZooming = map.isZooming();\n */\n isZooming(): boolean {\n return this._zooming || this.handlers.isZooming();\n }\n\n /**\n * Returns true if the map is rotating due to a camera animation or user gesture.\n * @returns {boolean} True if the map is rotating.\n * @example\n * map.isRotating();\n */\n isRotating(): boolean {\n return this._rotating || this.handlers.isRotating();\n }\n\n _createDelegatedListener(type: MapEvent, layerId: any, listener: any) {\n if (type === 'mouseenter' || type === 'mouseover') {\n let mousein = false;\n const mousemove = (e) => {\n const features = this.getLayer(layerId) ? this.queryRenderedFeatures(e.point, {layers: [layerId]}) : [];\n if (!features.length) {\n mousein = false;\n } else if (!mousein) {\n mousein = true;\n listener.call(this, new MapMouseEvent(type, this, e.originalEvent, {features}));\n }\n };\n const mouseout = () => {\n mousein = false;\n };\n return {layer: layerId, listener, delegates: {mousemove, mouseout}};\n } else if (type === 'mouseleave' || type === 'mouseout') {\n let mousein = false;\n const mousemove = (e) => {\n const features = this.getLayer(layerId) ? this.queryRenderedFeatures(e.point, {layers: [layerId]}) : [];\n if (features.length) {\n mousein = true;\n } else if (mousein) {\n mousein = false;\n listener.call(this, new MapMouseEvent(type, this, e.originalEvent));\n }\n };\n const mouseout = (e) => {\n if (mousein) {\n mousein = false;\n listener.call(this, new MapMouseEvent(type, this, e.originalEvent));\n }\n };\n return {layer: layerId, listener, delegates: {mousemove, mouseout}};\n } else {\n const delegate = (e) => {\n const features = this.getLayer(layerId) ? this.queryRenderedFeatures(e.point, {layers: [layerId]}) : [];\n if (features.length) {\n // Here we need to mutate the original event, so that preventDefault works as expected.\n e.features = features;\n listener.call(this, e);\n delete e.features;\n }\n };\n return {layer: layerId, listener, delegates: {[type]: delegate}};\n }\n }\n\n /**\n * Adds a listener for events of a specified type, optionally limited to features in a specified style layer.\n *\n * @param {string} type The event type to listen for. Events compatible with the optional `layerId` parameter are triggered\n * when the cursor enters a visible portion of the specified layer from outside that layer or outside the map canvas.\n *\n * | Event | Compatible with `layerId` |\n * |-----------------------------------------------------------|---------------------------|\n * | [`mousedown`](#map.event:mousedown) | yes |\n * | [`mouseup`](#map.event:mouseup) | yes |\n * | [`mouseover`](#map.event:mouseover) | yes |\n * | [`mouseout`](#map.event:mouseout) | yes |\n * | [`mousemove`](#map.event:mousemove) | yes |\n * | [`mouseenter`](#map.event:mouseenter) | yes (required) |\n * | [`mouseleave`](#map.event:mouseleave) | yes (required) |\n * | [`click`](#map.event:click) | yes |\n * | [`dblclick`](#map.event:dblclick) | yes |\n * | [`contextmenu`](#map.event:contextmenu) | yes |\n * | [`touchstart`](#map.event:touchstart) | yes |\n * | [`touchend`](#map.event:touchend) | yes |\n * | [`touchcancel`](#map.event:touchcancel) | yes |\n * | [`wheel`](#map.event:wheel) | |\n * | [`resize`](#map.event:resize) | |\n * | [`remove`](#map.event:remove) | |\n * | [`touchmove`](#map.event:touchmove) | |\n * | [`movestart`](#map.event:movestart) | |\n * | [`move`](#map.event:move) | |\n * | [`moveend`](#map.event:moveend) | |\n * | [`dragstart`](#map.event:dragstart) | |\n * | [`drag`](#map.event:drag) | |\n * | [`dragend`](#map.event:dragend) | |\n * | [`zoomstart`](#map.event:zoomstart) | |\n * | [`zoom`](#map.event:zoom) | |\n * | [`zoomend`](#map.event:zoomend) | |\n * | [`rotatestart`](#map.event:rotatestart) | |\n * | [`rotate`](#map.event:rotate) | |\n * | [`rotateend`](#map.event:rotateend) | |\n * | [`pitchstart`](#map.event:pitchstart) | |\n * | [`pitch`](#map.event:pitch) | |\n * | [`pitchend`](#map.event:pitchend) | |\n * | [`boxzoomstart`](#map.event:boxzoomstart) | |\n * | [`boxzoomend`](#map.event:boxzoomend) | |\n * | [`boxzoomcancel`](#map.event:boxzoomcancel) | |\n * | [`webglcontextlost`](#map.event:webglcontextlost) | |\n * | [`webglcontextrestored`](#map.event:webglcontextrestored) | |\n * | [`load`](#map.event:load) | |\n * | [`render`](#map.event:render) | |\n * | [`idle`](#map.event:idle) | |\n * | [`error`](#map.event:error) | |\n * | [`data`](#map.event:data) | |\n * | [`styledata`](#map.event:styledata) | |\n * | [`sourcedata`](#map.event:sourcedata) | |\n * | [`dataloading`](#map.event:dataloading) | |\n * | [`styledataloading`](#map.event:styledataloading) | |\n * | [`sourcedataloading`](#map.event:sourcedataloading) | |\n * | [`styleimagemissing`](#map.event:styleimagemissing) | |\n *\n * @param {string} layerId (optional) The ID of a style layer. Event will only be triggered if its location\n * is within a visible feature in this layer. The event will have a `features` property containing\n * an array of the matching features. If `layerId` is not supplied, the event will not have a `features` property.\n * Please note that many event types are not compatible with the optional `layerId` parameter.\n * @param {Function} listener The function to be called when the event is fired.\n * @returns {Map} `this`\n * @example\n * // Set an event listener that will fire\n * // when the map has finished loading\n * map.on('load', function() {\n * // Once the map has finished loading,\n * // add a new layer\n * map.addLayer({\n * id: 'points-of-interest',\n * source: {\n * type: 'vector',\n * url: 'mapbox://mapbox.mapbox-streets-v8'\n * },\n * 'source-layer': 'poi_label',\n * type: 'circle',\n * paint: {\n * // Mapbox Style Specification paint properties\n * },\n * layout: {\n * // Mapbox Style Specification layout properties\n * }\n * });\n * });\n * @example\n * // Set an event listener that will fire\n * // when a feature on the countries layer of the map is clicked\n * map.on('click', 'countries', function(e) {\n * new maplibregl.Popup()\n * .setLngLat(e.lngLat)\n * .setHTML(`Country name: ${e.features[0].properties.name}`)\n * .addTo(map);\n * });\n * @see [Display popup on click](https://maplibre.org/maplibre-gl-js-docs/example/popup-on-click/)\n * @see [Center the map on a clicked symbol](https://maplibre.org/maplibre-gl-js-docs/example/center-on-symbol/)\n * @see [Create a hover effect](https://maplibre.org/maplibre-gl-js-docs/example/hover-styles/)\n * @see [Create a draggable marker](https://maplibre.org/maplibre-gl-js-docs/example/drag-a-point/)\n */\n on(type: MapEvent, layerId: any, listener: any) {\n if (listener === undefined) {\n return super.on(type, layerId);\n }\n\n const delegatedListener = this._createDelegatedListener(type, layerId, listener);\n\n this._delegatedListeners = this._delegatedListeners || {};\n this._delegatedListeners[type] = this._delegatedListeners[type] || [];\n this._delegatedListeners[type].push(delegatedListener);\n\n for (const event in delegatedListener.delegates) {\n this.on((event: any), delegatedListener.delegates[event]);\n }\n\n return this;\n }\n\n /**\n * Adds a listener that will be called only once to a specified event type.\n *\n * @method\n * @name once\n * @memberof Map\n * @instance\n * @param {string} type The event type to add a listener for.\n * @param {Function} listener The function to be called when the event is fired.\n * The listener function is called with the data object passed to `fire`,\n * extended with `target` and `type` properties.\n * @returns {Map} `this`\n */\n\n /**\n * Adds a listener that will be called only once to a specified event type occurring on features in a specified style layer.\n *\n * @param {string} type The event type to listen for; one of `'mousedown'`, `'mouseup'`, `'click'`, `'dblclick'`,\n * `'mousemove'`, `'mouseenter'`, `'mouseleave'`, `'mouseover'`, `'mouseout'`, `'contextmenu'`, `'touchstart'`,\n * `'touchend'`, or `'touchcancel'`. `mouseenter` and `mouseover` events are triggered when the cursor enters\n * a visible portion of the specified layer from outside that layer or outside the map canvas. `mouseleave`\n * and `mouseout` events are triggered when the cursor leaves a visible portion of the specified layer, or leaves\n * the map canvas.\n * @param {string} layerId The ID of a style layer. Only events whose location is within a visible\n * feature in this layer will trigger the listener. The event will have a `features` property containing\n * an array of the matching features.\n * @param {Function} listener The function to be called when the event is fired.\n * @returns {Map} `this`\n */\n\n once(type: MapEvent, layerId: any, listener: any) {\n\n if (listener === undefined) {\n return super.once(type, layerId);\n }\n\n const delegatedListener = this._createDelegatedListener(type, layerId, listener);\n\n for (const event in delegatedListener.delegates) {\n this.once((event: any), delegatedListener.delegates[event]);\n }\n\n return this;\n }\n\n /**\n * Removes an event listener previously added with `Map#on`.\n *\n * @method\n * @name off\n * @memberof Map\n * @instance\n * @param {string} type The event type previously used to install the listener.\n * @param {Function} listener The function previously installed as a listener.\n * @returns {Map} `this`\n */\n\n /**\n * Removes an event listener for layer-specific events previously added with `Map#on`.\n *\n * @param {string} type The event type previously used to install the listener.\n * @param {string} layerId The layer ID previously used to install the listener.\n * @param {Function} listener The function previously installed as a listener.\n * @returns {Map} `this`\n */\n off(type: MapEvent, layerId: any, listener: any) {\n if (listener === undefined) {\n return super.off(type, layerId);\n }\n\n const removeDelegatedListener = (delegatedListeners) => {\n const listeners = delegatedListeners[type];\n for (let i = 0; i < listeners.length; i++) {\n const delegatedListener = listeners[i];\n if (delegatedListener.layer === layerId && delegatedListener.listener === listener) {\n for (const event in delegatedListener.delegates) {\n this.off((event: any), delegatedListener.delegates[event]);\n }\n listeners.splice(i, 1);\n return this;\n }\n }\n };\n\n if (this._delegatedListeners && this._delegatedListeners[type]) {\n removeDelegatedListener(this._delegatedListeners);\n }\n\n return this;\n }\n\n /**\n * Returns an array of [GeoJSON](http://geojson.org/)\n * [Feature objects](https://tools.ietf.org/html/rfc7946#section-3.2)\n * representing visible features that satisfy the query parameters.\n *\n * @param {PointLike|Array} [geometry] - The geometry of the query region:\n * either a single point or southwest and northeast points describing a bounding box.\n * Omitting this parameter (i.e. calling {@link Map#queryRenderedFeatures} with zero arguments,\n * or with only a `options` argument) is equivalent to passing a bounding box encompassing the entire\n * map viewport.\n * @param {Object} [options] Options object.\n * @param {Array} [options.layers] An array of [style layer IDs](https://docs.mapbox.com/mapbox-gl-js/style-spec/#layer-id) for the query to inspect.\n * Only features within these layers will be returned. If this parameter is undefined, all layers will be checked.\n * @param {Array} [options.filter] A [filter](https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#filter)\n * to limit query results.\n * @param {boolean} [options.validate=true] Whether to check if the [options.filter] conforms to the Mapbox GL Style Specification. Disabling validation is a performance optimization that should only be used if you have previously validated the values you will be passing to this function.\n *\n * @returns {Array} An array of [GeoJSON](http://geojson.org/)\n * [feature objects](https://tools.ietf.org/html/rfc7946#section-3.2).\n *\n * The `properties` value of each returned feature object contains the properties of its source feature. For GeoJSON sources, only\n * string and numeric property values are supported (i.e. `null`, `Array`, and `Object` values are not supported).\n *\n * Each feature includes top-level `layer`, `source`, and `sourceLayer` properties. The `layer` property is an object\n * representing the style layer to which the feature belongs. Layout and paint properties in this object contain values\n * which are fully evaluated for the given zoom level and feature.\n *\n * Only features that are currently rendered are included. Some features will **not** be included, like:\n *\n * - Features from layers whose `visibility` property is `\"none\"`.\n * - Features from layers whose zoom range excludes the current zoom level.\n * - Symbol features that have been hidden due to text or icon collision.\n *\n * Features from all other layers are included, including features that may have no visible\n * contribution to the rendered result; for example, because the layer's opacity or color alpha component is set to\n * 0.\n *\n * The topmost rendered feature appears first in the returned array, and subsequent features are sorted by\n * descending z-order. Features that are rendered multiple times (due to wrapping across the antimeridian at low\n * zoom levels) are returned only once (though subject to the following caveat).\n *\n * Because features come from tiled vector data or GeoJSON data that is converted to tiles internally, feature\n * geometries may be split or duplicated across tile boundaries and, as a result, features may appear multiple\n * times in query results. For example, suppose there is a highway running through the bounding rectangle of a query.\n * The results of the query will be those parts of the highway that lie within the map tiles covering the bounding\n * rectangle, even if the highway extends into other tiles, and the portion of the highway within each map tile\n * will be returned as a separate feature. Similarly, a point feature near a tile boundary may appear in multiple\n * tiles due to tile buffering.\n *\n * @example\n * // Find all features at a point\n * var features = map.queryRenderedFeatures(\n * [20, 35],\n * { layers: ['my-layer-name'] }\n * );\n *\n * @example\n * // Find all features within a static bounding box\n * var features = map.queryRenderedFeatures(\n * [[10, 20], [30, 50]],\n * { layers: ['my-layer-name'] }\n * );\n *\n * @example\n * // Find all features within a bounding box around a point\n * var width = 10;\n * var height = 20;\n * var features = map.queryRenderedFeatures([\n * [point.x - width / 2, point.y - height / 2],\n * [point.x + width / 2, point.y + height / 2]\n * ], { layers: ['my-layer-name'] });\n *\n * @example\n * // Query all rendered features from a single layer\n * var features = map.queryRenderedFeatures({ layers: ['my-layer-name'] });\n * @see [Get features under the mouse pointer](https://maplibre.org/maplibre-gl-js-docs/example/queryrenderedfeatures/)\n */\n queryRenderedFeatures(geometry?: PointLike | [PointLike, PointLike], options?: Object) {\n // The first parameter can be omitted entirely, making this effectively an overloaded method\n // with two signatures:\n //\n // queryRenderedFeatures(geometry: PointLike | [PointLike, PointLike], options?: Object)\n // queryRenderedFeatures(options?: Object)\n //\n // There no way to express that in a way that's compatible with both flow and documentation.js.\n // Related: https://github.com/facebook/flow/issues/1556\n\n if (!this.style) {\n return [];\n }\n\n if (options === undefined && geometry !== undefined && !(geometry instanceof Point) && !Array.isArray(geometry)) {\n options = (geometry: Object);\n geometry = undefined;\n }\n\n options = options || {};\n geometry = geometry || [[0, 0], [this.transform.width, this.transform.height]];\n\n let queryGeometry;\n if (geometry instanceof Point || typeof geometry[0] === 'number') {\n queryGeometry = [Point.convert(geometry)];\n } else {\n const tl = Point.convert(geometry[0]);\n const br = Point.convert(geometry[1]);\n queryGeometry = [tl, new Point(br.x, tl.y), br, new Point(tl.x, br.y), tl];\n }\n\n return this.style.queryRenderedFeatures(queryGeometry, options, this.transform);\n }\n\n /**\n * Returns an array of [GeoJSON](http://geojson.org/)\n * [Feature objects](https://tools.ietf.org/html/rfc7946#section-3.2)\n * representing features within the specified vector tile or GeoJSON source that satisfy the query parameters.\n *\n * @param {string} sourceId The ID of the vector tile or GeoJSON source to query.\n * @param {Object} [parameters] Options object.\n * @param {string} [parameters.sourceLayer] The name of the [source layer](https://docs.mapbox.com/help/glossary/source-layer/)\n * to query. *For vector tile sources, this parameter is required.* For GeoJSON sources, it is ignored.\n * @param {Array} [parameters.filter] A [filter](https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#filter)\n * to limit query results.\n * @param {boolean} [parameters.validate=true] Whether to check if the [parameters.filter] conforms to the Mapbox GL Style Specification. Disabling validation is a performance optimization that should only be used if you have previously validated the values you will be passing to this function.\n *\n * @returns {Array} An array of [GeoJSON](http://geojson.org/)\n * [Feature objects](https://tools.ietf.org/html/rfc7946#section-3.2).\n *\n * In contrast to {@link Map#queryRenderedFeatures}, this function returns all features matching the query parameters,\n * whether or not they are rendered by the current style (i.e. visible). The domain of the query includes all currently-loaded\n * vector tiles and GeoJSON source tiles: this function does not check tiles outside the currently\n * visible viewport.\n *\n * Because features come from tiled vector data or GeoJSON data that is converted to tiles internally, feature\n * geometries may be split or duplicated across tile boundaries and, as a result, features may appear multiple\n * times in query results. For example, suppose there is a highway running through the bounding rectangle of a query.\n * The results of the query will be those parts of the highway that lie within the map tiles covering the bounding\n * rectangle, even if the highway extends into other tiles, and the portion of the highway within each map tile\n * will be returned as a separate feature. Similarly, a point feature near a tile boundary may appear in multiple\n * tiles due to tile buffering.\n *\n * @example\n * // Find all features in one source layer in a vector source\n * var features = map.querySourceFeatures('your-source-id', {\n * sourceLayer: 'your-source-layer'\n * });\n *\n */\n querySourceFeatures(sourceId: string, parameters: ?{sourceLayer: ?string, filter: ?Array, validate?: boolean}) {\n return this.style.querySourceFeatures(sourceId, parameters);\n }\n\n /**\n * Updates the map's Mapbox style object with a new value.\n *\n * If a style is already set when this is used and options.diff is set to true, the map renderer will attempt to compare the given style\n * against the map's current state and perform only the changes necessary to make the map style match the desired state. Changes in sprites\n * (images used for icons and patterns) and glyphs (fonts for label text) **cannot** be diffed. If the sprites or fonts used in the current\n * style and the given style are different in any way, the map renderer will force a full update, removing the current style and building\n * the given one from scratch.\n *\n *\n * @param style A JSON object conforming to the schema described in the\n * [Mapbox Style Specification](https://mapbox.com/mapbox-gl-style-spec/), or a URL to such JSON.\n * @param {Object} [options] Options object.\n * @param {boolean} [options.diff=true] If false, force a 'full' update, removing the current style\n * and building the given one instead of attempting a diff-based update.\n * @param {string} [options.localIdeographFontFamily='sans-serif'] Defines a CSS\n * font-family for locally overriding generation of glyphs in the 'CJK Unified Ideographs', 'Hiragana', 'Katakana' and 'Hangul Syllables' ranges.\n * In these ranges, font settings from the map's style will be ignored, except for font-weight keywords (light/regular/medium/bold).\n * Set to `false`, to enable font settings from the map's style for these glyph ranges.\n * Forces a full update.\n * @returns {Map} `this`\n *\n * @example\n * map.setStyle(\"mapbox://styles/mapbox/streets-v11\");\n *\n */\n setStyle(style: StyleSpecification | string | null, options?: {diff?: boolean} & StyleOptions) {\n options = extend({}, {localIdeographFontFamily: this._localIdeographFontFamily}, options);\n\n if ((options.diff !== false && options.localIdeographFontFamily === this._localIdeographFontFamily) && this.style && style) {\n this._diffStyle(style, options);\n return this;\n } else {\n this._localIdeographFontFamily = options.localIdeographFontFamily;\n return this._updateStyle(style, options);\n }\n }\n\n /**\n * Updates the requestManager's transform request with a new function\n *\n * @param transformRequest A callback run before the Map makes a request for an external URL. The callback can be used to modify the url, set headers, or set the credentials property for cross-origin requests.\n * Expected to return an object with a `url` property and optionally `headers` and `credentials` properties\n *\n * @returns {Map} `this`\n *\n * @example\n * map.setTransformRequest((url: string, resourceType: string) => {});\n */\n setTransformRequest(transformRequest: RequestTransformFunction) {\n this._requestManager.setTransformRequest(transformRequest);\n return this;\n }\n\n _getUIString(key: string) {\n const str = this._locale[key];\n if (str == null) {\n throw new Error(`Missing UI string '${key}'`);\n }\n\n return str;\n }\n\n _updateStyle(style: StyleSpecification | string | null, options?: {diff?: boolean} & StyleOptions) {\n if (this.style) {\n this.style.setEventedParent(null);\n this.style._remove();\n }\n\n if (!style) {\n delete this.style;\n return this;\n } else {\n this.style = new Style(this, options || {});\n }\n\n this.style.setEventedParent(this, {style: this.style});\n\n if (typeof style === 'string') {\n this.style.loadURL(style);\n } else {\n this.style.loadJSON(style);\n }\n\n return this;\n }\n\n _lazyInitEmptyStyle() {\n if (!this.style) {\n this.style = new Style(this, {});\n this.style.setEventedParent(this, {style: this.style});\n this.style.loadEmpty();\n }\n }\n\n _diffStyle(style: StyleSpecification | string, options?: {diff?: boolean} & StyleOptions) {\n if (typeof style === 'string') {\n const url = this._requestManager.normalizeStyleURL(style);\n const request = this._requestManager.transformRequest(url, ResourceType.Style);\n getJSON(request, (error: ?Error, json: ?Object) => {\n if (error) {\n this.fire(new ErrorEvent(error));\n } else if (json) {\n this._updateDiff(json, options);\n }\n });\n } else if (typeof style === 'object') {\n this._updateDiff(style, options);\n }\n }\n\n _updateDiff(style: StyleSpecification, options?: {diff?: boolean} & StyleOptions) {\n try {\n if (this.style.setState(style)) {\n this._update(true);\n }\n } catch (e) {\n warnOnce(\n `Unable to perform style diff: ${e.message || e.error || e}. Rebuilding the style from scratch.`\n );\n this._updateStyle(style, options);\n }\n }\n\n /**\n * Returns the map's Mapbox [style](https://docs.mapbox.com/help/glossary/style/) object, a JSON object which can be used to recreate the map's style.\n *\n * @returns {Object} The map's style JSON object.\n *\n * @example\n * var styleJson = map.getStyle();\n *\n */\n getStyle() {\n if (this.style) {\n return this.style.serialize();\n }\n }\n\n /**\n * Returns a Boolean indicating whether the map's style is fully loaded.\n *\n * @returns {boolean} A Boolean indicating whether the style is fully loaded.\n *\n * @example\n * var styleLoadStatus = map.isStyleLoaded();\n */\n isStyleLoaded() {\n if (!this.style) return warnOnce('There is no style added to the map.');\n return this.style.loaded();\n }\n\n /**\n * Adds a source to the map's style.\n *\n * @param {string} id The ID of the source to add. Must not conflict with existing sources.\n * @param {Object} source The source object, conforming to the\n * Mapbox Style Specification's [source definition](https://www.mapbox.com/mapbox-gl-style-spec/#sources) or\n * {@link CanvasSourceOptions}.\n * @fires source.add\n * @returns {Map} `this`\n * @example\n * map.addSource('my-data', {\n * type: 'vector',\n * url: 'mapbox://myusername.tilesetid'\n * });\n * @example\n * map.addSource('my-data', {\n * \"type\": \"geojson\",\n * \"data\": {\n * \"type\": \"Feature\",\n * \"geometry\": {\n * \"type\": \"Point\",\n * \"coordinates\": [-77.0323, 38.9131]\n * },\n * \"properties\": {\n * \"title\": \"Mapbox DC\",\n * \"marker-symbol\": \"monument\"\n * }\n * }\n * });\n * @see GeoJSON source: [Add live realtime data](https://maplibre.org/maplibre-gl-js-docs/example/live-geojson/)\n */\n addSource(id: string, source: SourceSpecification) {\n this._lazyInitEmptyStyle();\n this.style.addSource(id, source);\n return this._update(true);\n }\n\n /**\n * Returns a Boolean indicating whether the source is loaded. Returns `true` if the source with\n * the given ID in the map's style has no outstanding network requests, otherwise `false`.\n *\n * @param {string} id The ID of the source to be checked.\n * @returns {boolean} A Boolean indicating whether the source is loaded.\n * @example\n * var sourceLoaded = map.isSourceLoaded('bathymetry-data');\n */\n isSourceLoaded(id: string) {\n const source = this.style && this.style.sourceCaches[id];\n if (source === undefined) {\n this.fire(new ErrorEvent(new Error(`There is no source with ID '${id}'`)));\n return;\n }\n return source.loaded();\n }\n\n /**\n * Returns a Boolean indicating whether all tiles in the viewport from all sources on\n * the style are loaded.\n *\n * @returns {boolean} A Boolean indicating whether all tiles are loaded.\n * @example\n * var tilesLoaded = map.areTilesLoaded();\n */\n\n areTilesLoaded() {\n const sources = this.style && this.style.sourceCaches;\n for (const id in sources) {\n const source = sources[id];\n const tiles = source._tiles;\n for (const t in tiles) {\n const tile = tiles[t];\n if (!(tile.state === 'loaded' || tile.state === 'errored')) return false;\n }\n }\n return true;\n }\n\n /**\n * Adds a [custom source type](#Custom Sources), making it available for use with\n * {@link Map#addSource}.\n * @private\n * @param {string} name The name of the source type; source definition objects use this name in the `{type: ...}` field.\n * @param {Function} SourceType A {@link Source} constructor.\n * @param {Function} callback Called when the source type is ready or with an error argument if there is an error.\n */\n addSourceType(name: string, SourceType: any, callback: Function) {\n this._lazyInitEmptyStyle();\n return this.style.addSourceType(name, SourceType, callback);\n }\n\n /**\n * Removes a source from the map's style.\n *\n * @param {string} id The ID of the source to remove.\n * @returns {Map} `this`\n * @example\n * map.removeSource('bathymetry-data');\n */\n removeSource(id: string) {\n this.style.removeSource(id);\n return this._update(true);\n }\n\n /**\n * Returns the source with the specified ID in the map's style.\n *\n * This method is often used to update a source using the instance members for the relevant\n * source type as defined in [Sources](#sources).\n * For example, setting the `data` for a GeoJSON source or updating the `url` and `coordinates`\n * of an image source.\n *\n * @param {string} id The ID of the source to get.\n * @returns {?Object} The style source with the specified ID or `undefined` if the ID\n * corresponds to no existing sources.\n * The shape of the object varies by source type.\n * A list of options for each source type is available on the Mapbox Style Specification's\n * [Sources](https://docs.mapbox.com/mapbox-gl-js/style-spec/sources/) page.\n * @example\n * var sourceObject = map.getSource('points');\n * @see [Create a draggable point](https://maplibre.org/maplibre-gl-js-docs/example/drag-a-point/)\n * @see [Animate a point](https://maplibre.org/maplibre-gl-js-docs/example/animate-point-along-line/)\n * @see [Add live realtime data](https://maplibre.org/maplibre-gl-js-docs/example/live-geojson/)\n */\n getSource(id: string) {\n return this.style.getSource(id);\n }\n\n // eslint-disable-next-line jsdoc/require-returns\n /**\n * Add an image to the style. This image can be displayed on the map like any other icon in the style's\n * [sprite](https://docs.mapbox.com/help/glossary/sprite/) using the image's ID with\n * [`icon-image`](https://docs.mapbox.com/mapbox-gl-js/style-spec/#layout-symbol-icon-image),\n * [`background-pattern`](https://docs.mapbox.com/mapbox-gl-js/style-spec/#paint-background-background-pattern),\n * [`fill-pattern`](https://docs.mapbox.com/mapbox-gl-js/style-spec/#paint-fill-fill-pattern),\n * or [`line-pattern`](https://docs.mapbox.com/mapbox-gl-js/style-spec/#paint-line-line-pattern).\n * A {@link Map.event:error} event will be fired if there is not enough space in the sprite to add this image.\n *\n * @param id The ID of the image.\n * @param image The image as an `HTMLImageElement`, `ImageData`, `ImageBitmap` or object with `width`, `height`, and `data`\n * properties with the same format as `ImageData`.\n * @param options Options object.\n * @param options.pixelRatio The ratio of pixels in the image to physical pixels on the screen\n * @param options.sdf Whether the image should be interpreted as an SDF image\n * @param options.content `[x1, y1, x2, y2]` If `icon-text-fit` is used in a layer with this image, this option defines the part of the image that can be covered by the content in `text-field`.\n * @param options.stretchX `[[x1, x2], ...]` If `icon-text-fit` is used in a layer with this image, this option defines the part(s) of the image that can be stretched horizontally.\n * @param options.stretchY `[[y1, y2], ...]` If `icon-text-fit` is used in a layer with this image, this option defines the part(s) of the image that can be stretched vertically.\n *\n * @example\n * // If the style's sprite does not already contain an image with ID 'cat',\n * // add the image 'cat-icon.png' to the style's sprite with the ID 'cat'.\n * map.loadImage('https://upload.wikimedia.org/wikipedia/commons/thumb/6/60/Cat_silhouette.svg/400px-Cat_silhouette.svg.png', function(error, image) {\n * if (error) throw error;\n * if (!map.hasImage('cat')) map.addImage('cat', image);\n * });\n *\n *\n * // Add a stretchable image that can be used with `icon-text-fit`\n * // In this example, the image is 600px wide by 400px high.\n * map.loadImage('https://upload.wikimedia.org/wikipedia/commons/8/89/Black_and_White_Boxed_%28bordered%29.png', function(error, image) {\n * if (error) throw error;\n * if (!map.hasImage('border-image')) {\n * map.addImage('border-image', image, {\n * content: [16, 16, 300, 384], // place text over left half of image, avoiding the 16px border\n * stretchX: [[16, 584]], // stretch everything horizontally except the 16px border\n * stretchY: [[16, 384]], // stretch everything vertically except the 16px border\n * });\n * }\n * });\n *\n *\n * @see Use `HTMLImageElement`: [Add an icon to the map](https://maplibre.org/maplibre-gl-js-docs/example/add-image/)\n * @see Use `ImageData`: [Add a generated icon to the map](https://maplibre.org/maplibre-gl-js-docs/example/add-image-generated/)\n */\n addImage(id: string,\n image: HTMLImageElement | ImageBitmap | ImageData | {width: number, height: number, data: Uint8Array | Uint8ClampedArray} | StyleImageInterface,\n {pixelRatio = 1, sdf = false, stretchX, stretchY, content}: $Shape = {}) {\n this._lazyInitEmptyStyle();\n const version = 0;\n\n if (image instanceof HTMLImageElement || (ImageBitmap && image instanceof ImageBitmap)) {\n const {width, height, data} = browser.getImageData(image);\n this.style.addImage(id, {data: new RGBAImage({width, height}, data), pixelRatio, stretchX, stretchY, content, sdf, version});\n } else if (image.width === undefined || image.height === undefined) {\n return this.fire(new ErrorEvent(new Error(\n 'Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, ' +\n 'or object with `width`, `height`, and `data` properties with the same format as `ImageData`')));\n } else {\n const {width, height, data} = image;\n const userImage = ((image: any): StyleImageInterface);\n\n this.style.addImage(id, {\n data: new RGBAImage({width, height}, new Uint8Array(data)),\n pixelRatio,\n stretchX,\n stretchY,\n content,\n sdf,\n version,\n userImage\n });\n\n if (userImage.onAdd) {\n userImage.onAdd(this, id);\n }\n }\n }\n\n // eslint-disable-next-line jsdoc/require-returns\n /**\n * Update an existing image in a style. This image can be displayed on the map like any other icon in the style's\n * [sprite](https://docs.mapbox.com/help/glossary/sprite/) using the image's ID with\n * [`icon-image`](https://docs.mapbox.com/mapbox-gl-js/style-spec/#layout-symbol-icon-image),\n * [`background-pattern`](https://docs.mapbox.com/mapbox-gl-js/style-spec/#paint-background-background-pattern),\n * [`fill-pattern`](https://docs.mapbox.com/mapbox-gl-js/style-spec/#paint-fill-fill-pattern),\n * or [`line-pattern`](https://docs.mapbox.com/mapbox-gl-js/style-spec/#paint-line-line-pattern).\n *\n * @param id The ID of the image.\n * @param image The image as an `HTMLImageElement`, `ImageData`, `ImageBitmap` or object with `width`, `height`, and `data`\n * properties with the same format as `ImageData`.\n *\n * @example\n * // If an image with the ID 'cat' already exists in the style's sprite,\n * // replace that image with a new image, 'other-cat-icon.png'.\n * if (map.hasImage('cat')) map.updateImage('cat', './other-cat-icon.png');\n */\n updateImage(id: string,\n image: HTMLImageElement | ImageBitmap | ImageData | {width: number, height: number, data: Uint8Array | Uint8ClampedArray} | StyleImageInterface) {\n\n const existingImage = this.style.getImage(id);\n if (!existingImage) {\n return this.fire(new ErrorEvent(new Error(\n 'The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.')));\n }\n const imageData = (image instanceof HTMLImageElement || (ImageBitmap && image instanceof ImageBitmap)) ? browser.getImageData(image) : image;\n const {width, height, data} = imageData;\n\n if (width === undefined || height === undefined) {\n return this.fire(new ErrorEvent(new Error(\n 'Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, ' +\n 'or object with `width`, `height`, and `data` properties with the same format as `ImageData`')));\n }\n\n if (width !== existingImage.data.width || height !== existingImage.data.height) {\n return this.fire(new ErrorEvent(new Error(\n 'The width and height of the updated image must be that same as the previous version of the image')));\n }\n\n const copy = !(image instanceof HTMLImageElement || (ImageBitmap && image instanceof ImageBitmap));\n existingImage.data.replace(data, copy);\n\n this.style.updateImage(id, existingImage);\n }\n\n /**\n * Check whether or not an image with a specific ID exists in the style. This checks both images\n * in the style's original [sprite](https://docs.mapbox.com/help/glossary/sprite/) and any images\n * that have been added at runtime using {@link Map#addImage}.\n *\n * @param id The ID of the image.\n *\n * @returns {boolean} A Boolean indicating whether the image exists.\n * @example\n * // Check if an image with the ID 'cat' exists in\n * // the style's sprite.\n * var catIconExists = map.hasImage('cat');\n */\n hasImage(id: string): boolean {\n if (!id) {\n this.fire(new ErrorEvent(new Error('Missing required image id')));\n return false;\n }\n\n return !!this.style.getImage(id);\n }\n\n /**\n * Remove an image from a style. This can be an image from the style's original\n * [sprite](https://docs.mapbox.com/help/glossary/sprite/) or any images\n * that have been added at runtime using {@link Map#addImage}.\n *\n * @param id The ID of the image.\n *\n * @example\n * // If an image with the ID 'cat' exists in\n * // the style's sprite, remove it.\n * if (map.hasImage('cat')) map.removeImage('cat');\n */\n removeImage(id: string) {\n this.style.removeImage(id);\n }\n\n /**\n * Load an image from an external URL to be used with {@link Map#addImage}. External\n * domains must support [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS).\n *\n * @param {string} url The URL of the image file. Image file must be in png, webp, or jpg format.\n * @param {Function} callback Expecting `callback(error, data)`. Called when the image has loaded or with an error argument if there is an error.\n *\n * @example\n * // Load an image from an external URL.\n * map.loadImage('http://placekitten.com/50/50', function(error, image) {\n * if (error) throw error;\n * // Add the loaded image to the style's sprite with the ID 'kitten'.\n * map.addImage('kitten', image);\n * });\n *\n * @see [Add an icon to the map](https://maplibre.org/maplibre-gl-js-docs/example/add-image/)\n */\n loadImage(url: string, callback: Function) {\n getImage(this._requestManager.transformRequest(url, ResourceType.Image), callback);\n }\n\n /**\n * Returns an Array of strings containing the IDs of all images currently available in the map.\n * This includes both images from the style's original [sprite](https://docs.mapbox.com/help/glossary/sprite/)\n * and any images that have been added at runtime using {@link Map#addImage}.\n *\n * @returns {Array} An Array of strings containing the names of all sprites/images currently available in the map.\n *\n * @example\n * var allImages = map.listImages();\n *\n */\n listImages() {\n return this.style.listImages();\n }\n\n /**\n * Adds a [Mapbox style layer](https://docs.mapbox.com/mapbox-gl-js/style-spec/#layers)\n * to the map's style.\n *\n * A layer defines how data from a specified source will be styled. Read more about layer types\n * and available paint and layout properties in the [Mapbox Style Specification](https://docs.mapbox.com/mapbox-gl-js/style-spec/#layers).\n *\n * @param {Object | CustomLayerInterface} layer The layer to add, conforming to either the Mapbox Style Specification's [layer definition](https://docs.mapbox.com/mapbox-gl-js/style-spec/#layers) or, less commonly, the {@link CustomLayerInterface} specification.\n * The Mapbox Style Specification's layer definition is appropriate for most layers.\n *\n * @param {string} layer.id A unique idenfier that you define.\n * @param {string} layer.type The type of layer (for example `fill` or `symbol`).\n * A list of layer types is available in the [Mapbox Style Specification](https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#type).\n *\n * (This can also be `custom`. For more information, see {@link CustomLayerInterface}.)\n * @param {string | Object} [layer.source] The data source for the layer.\n * Reference a source that has _already been defined_ using the source's unique id.\n * Reference a _new source_ using a source object (as defined in the [Mapbox Style Specification](https://docs.mapbox.com/mapbox-gl-js/style-spec/sources/)) directly.\n * This is **required** for all `layer.type` options _except_ for `custom`.\n * @param {string} [layer.sourceLayer] (optional) The name of the [source layer](https://docs.mapbox.com/help/glossary/source-layer/) within the specified `layer.source` to use for this style layer.\n * This is only applicable for vector tile sources and is **required** when `layer.source` is of the type `vector`.\n * @param {array} [layer.filter] (optional) An expression specifying conditions on source features.\n * Only features that match the filter are displayed.\n * The Mapbox Style Specification includes more information on the limitations of the [`filter`](https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#filter) parameter\n * and a complete list of available [expressions](https://docs.mapbox.com/mapbox-gl-js/style-spec/expressions/).\n * If no filter is provided, all features in the source (or source layer for vector tilesets) will be displayed.\n * @param {Object} [layer.paint] (optional) Paint properties for the layer.\n * Available paint properties vary by `layer.type`.\n * A full list of paint properties for each layer type is available in the [Mapbox Style Specification](https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/).\n * If no paint properties are specified, default values will be used.\n * @param {Object} [layer.layout] (optional) Layout properties for the layer.\n * Available layout properties vary by `layer.type`.\n * A full list of layout properties for each layer type is available in the [Mapbox Style Specification](https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/).\n * If no layout properties are specified, default values will be used.\n * @param {number} [layer.maxzoom] (optional) The maximum zoom level for the layer.\n * At zoom levels equal to or greater than the maxzoom, the layer will be hidden.\n * The value can be any number between `0` and `24` (inclusive).\n * If no maxzoom is provided, the layer will be visible at all zoom levels for which there are tiles available.\n * @param {number} [layer.minzoom] (optional) The minimum zoom level for the layer.\n * At zoom levels less than the minzoom, the layer will be hidden.\n * The value can be any number between `0` and `24` (inclusive).\n * If no minzoom is provided, the layer will be visible at all zoom levels for which there are tiles available.\n * @param {Object} [layer.metadata] (optional) Arbitrary properties useful to track with the layer, but do not influence rendering.\n * @param {string} [layer.renderingMode] This is only applicable for layers with the type `custom`.\n * See {@link CustomLayerInterface} for more information.\n * @param {string} [beforeId] The ID of an existing layer to insert the new layer before,\n * resulting in the new layer appearing visually beneath the existing layer.\n * If this argument is not specified, the layer will be appended to the end of the layers array\n * and appear visually above all other layers.\n *\n * @returns {Map} `this`\n *\n * @example\n * // Add a circle layer with a vector source\n * map.addLayer({\n * id: 'points-of-interest',\n * source: {\n * type: 'vector',\n * url: 'mapbox://mapbox.mapbox-streets-v8'\n * },\n * 'source-layer': 'poi_label',\n * type: 'circle',\n * paint: {\n * // Mapbox Style Specification paint properties\n * },\n * layout: {\n * // Mapbox Style Specification layout properties\n * }\n * });\n *\n * @example\n * // Define a source before using it to create a new layer\n * map.addSource('state-data', {\n * type: 'geojson',\n * data: 'path/to/data.geojson'\n * });\n *\n * map.addLayer({\n * id: 'states',\n * // References the GeoJSON source defined above\n * // and does not require a `source-layer`\n * source: 'state-data',\n * type: 'symbol',\n * layout: {\n * // Set the label content to the\n * // feature's `name` property\n * text-field: ['get', 'name']\n * }\n * });\n *\n * @example\n * // Add a new symbol layer before an existing layer\n * map.addLayer({\n * id: 'states',\n * // References a source that's already been defined\n * source: 'state-data',\n * type: 'symbol',\n * layout: {\n * // Set the label content to the\n * // feature's `name` property\n * text-field: ['get', 'name']\n * }\n * // Add the layer before the existing `cities` layer\n * }, 'cities');\n *\n * @see [Create and style clusters](https://maplibre.org/maplibre-gl-js-docs/example/cluster/)\n * @see [Add a vector tile source](https://maplibre.org/maplibre-gl-js-docs/example/vector-source/)\n * @see [Add a WMS source](https://maplibre.org/maplibre-gl-js-docs/example/wms/)\n */\n addLayer(layer: LayerSpecification | CustomLayerInterface, beforeId?: string) {\n this._lazyInitEmptyStyle();\n this.style.addLayer(layer, beforeId);\n return this._update(true);\n }\n\n /**\n * Moves a layer to a different z-position.\n *\n * @param {string} id The ID of the layer to move.\n * @param {string} [beforeId] The ID of an existing layer to insert the new layer before. When viewing the map, the `id` layer will appear beneath the `beforeId` layer. If `beforeId` is omitted, the layer will be appended to the end of the layers array and appear above all other layers on the map.\n * @returns {Map} `this`\n *\n * @example\n * // Move a layer with ID 'polygon' before the layer with ID 'country-label'. The `polygon` layer will appear beneath the `country-label` layer on the map.\n * map.moveLayer('polygon', 'country-label');\n */\n moveLayer(id: string, beforeId?: string) {\n this.style.moveLayer(id, beforeId);\n return this._update(true);\n }\n\n // eslint-disable-next-line jsdoc/require-returns\n /**\n * Removes the layer with the given ID from the map's style.\n *\n * If no such layer exists, an `error` event is fired.\n *\n * @param {string} id id of the layer to remove\n * @fires error\n *\n * @example\n * // If a layer with ID 'state-data' exists, remove it.\n * if (map.getLayer('state-data')) map.removeLayer('state-data');\n */\n removeLayer(id: string) {\n this.style.removeLayer(id);\n return this._update(true);\n }\n\n /**\n * Returns the layer with the specified ID in the map's style.\n *\n * @param {string} id The ID of the layer to get.\n * @returns {?Object} The layer with the specified ID, or `undefined`\n * if the ID corresponds to no existing layers.\n *\n * @example\n * var stateDataLayer = map.getLayer('state-data');\n *\n * @see [Filter symbols by toggling a list](https://maplibre.org/maplibre-gl-js-docs/example/filter-markers/)\n * @see [Filter symbols by text input](https://maplibre.org/maplibre-gl-js-docs/example/filter-markers-by-input/)\n */\n getLayer(id: string) {\n return this.style.getLayer(id);\n }\n\n /**\n * Sets the zoom extent for the specified style layer. The zoom extent includes the\n * [minimum zoom level](https://docs.mapbox.com/mapbox-gl-js/style-spec/#layer-minzoom)\n * and [maximum zoom level](https://docs.mapbox.com/mapbox-gl-js/style-spec/#layer-maxzoom))\n * at which the layer will be rendered.\n *\n * Note: For style layers using vector sources, style layers cannot be rendered at zoom levels lower than the\n * minimum zoom level of the _source layer_ because the data does not exist at those zoom levels. If the minimum\n * zoom level of the source layer is higher than the minimum zoom level defined in the style layer, the style\n * layer will not be rendered at all zoom levels in the zoom range.\n *\n * @param {string} layerId The ID of the layer to which the zoom extent will be applied.\n * @param {number} minzoom The minimum zoom to set (0-24).\n * @param {number} maxzoom The maximum zoom to set (0-24).\n * @returns {Map} `this`\n *\n * @example\n * map.setLayerZoomRange('my-layer', 2, 5);\n *\n */\n setLayerZoomRange(layerId: string, minzoom: number, maxzoom: number) {\n this.style.setLayerZoomRange(layerId, minzoom, maxzoom);\n return this._update(true);\n }\n\n /**\n * Sets the filter for the specified style layer.\n *\n * Filters control which features a style layer renders from its source.\n * Any feature for which the filter expression evaluates to `true` will be\n * rendered on the map. Those that are false will be hidden.\n *\n * Use `setFilter` to show a subset of your source data.\n *\n * To clear the filter, pass `null` or `undefined` as the second parameter.\n *\n * @param {string} layerId The ID of the layer to which the filter will be applied.\n * @param {Array | null | undefined} filter The filter, conforming to the Mapbox Style Specification's\n * [filter definition](https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#filter). If `null` or `undefined` is provided, the function removes any existing filter from the layer.\n * @param {Object} [options] Options object.\n * @param {boolean} [options.validate=true] Whether to check if the filter conforms to the Mapbox GL Style Specification. Disabling validation is a performance optimization that should only be used if you have previously validated the values you will be passing to this function.\n * @returns {Map} `this`\n *\n * @example\n * // display only features with the 'name' property 'USA'\n * map.setFilter('my-layer', ['==', ['get', 'name'], 'USA']);\n * @example\n * // display only features with five or more 'available-spots'\n * map.setFilter('bike-docks', ['>=', ['get', 'available-spots'], 5]);\n * @example\n * // remove the filter for the 'bike-docks' style layer\n * map.setFilter('bike-docks', null);\n *\n * @see [Create a timeline animation](https://maplibre.org/maplibre-gl-js-docs/example/timeline-animation/)\n * @see Tutorial: [Show changes over time](https://docs.mapbox.com/help/tutorials/show-changes-over-time/)\n */\n setFilter(layerId: string, filter: ?FilterSpecification, options: StyleSetterOptions = {}) {\n this.style.setFilter(layerId, filter, options);\n return this._update(true);\n }\n\n /**\n * Returns the filter applied to the specified style layer.\n *\n * @param {string} layerId The ID of the style layer whose filter to get.\n * @returns {Array} The layer's filter.\n */\n getFilter(layerId: string) {\n return this.style.getFilter(layerId);\n }\n\n /**\n * Sets the value of a paint property in the specified style layer.\n *\n * @param {string} layerId The ID of the layer to set the paint property in.\n * @param {string} name The name of the paint property to set.\n * @param {*} value The value of the paint property to set.\n * Must be of a type appropriate for the property, as defined in the [Mapbox Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/).\n * @param {Object} [options] Options object.\n * @param {boolean} [options.validate=true] Whether to check if `value` conforms to the Mapbox GL Style Specification. Disabling validation is a performance optimization that should only be used if you have previously validated the values you will be passing to this function.\n * @returns {Map} `this`\n * @example\n * map.setPaintProperty('my-layer', 'fill-color', '#faafee');\n * @see [Change a layer's color with buttons](https://maplibre.org/maplibre-gl-js-docs/example/color-switcher/)\n * @see [Create a draggable point](https://maplibre.org/maplibre-gl-js-docs/example/drag-a-point/)\n */\n setPaintProperty(layerId: string, name: string, value: any, options: StyleSetterOptions = {}) {\n this.style.setPaintProperty(layerId, name, value, options);\n return this._update(true);\n }\n\n /**\n * Returns the value of a paint property in the specified style layer.\n *\n * @param {string} layerId The ID of the layer to get the paint property from.\n * @param {string} name The name of a paint property to get.\n * @returns {*} The value of the specified paint property.\n */\n getPaintProperty(layerId: string, name: string) {\n return this.style.getPaintProperty(layerId, name);\n }\n\n /**\n * Sets the value of a layout property in the specified style layer.\n *\n * @param {string} layerId The ID of the layer to set the layout property in.\n * @param {string} name The name of the layout property to set.\n * @param {*} value The value of the layout property. Must be of a type appropriate for the property, as defined in the [Mapbox Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/).\n * @param {Object} [options] Options object.\n * @param {boolean} [options.validate=true] Whether to check if `value` conforms to the Mapbox GL Style Specification. Disabling validation is a performance optimization that should only be used if you have previously validated the values you will be passing to this function.\n * @returns {Map} `this`\n * @example\n * map.setLayoutProperty('my-layer', 'visibility', 'none');\n */\n setLayoutProperty(layerId: string, name: string, value: any, options: StyleSetterOptions = {}) {\n this.style.setLayoutProperty(layerId, name, value, options);\n return this._update(true);\n }\n\n /**\n * Returns the value of a layout property in the specified style layer.\n *\n * @param {string} layerId The ID of the layer to get the layout property from.\n * @param {string} name The name of the layout property to get.\n * @returns {*} The value of the specified layout property.\n */\n getLayoutProperty(layerId: string, name: string) {\n return this.style.getLayoutProperty(layerId, name);\n }\n\n /**\n * Sets the any combination of light values.\n *\n * @param light Light properties to set. Must conform to the [Mapbox Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/#light).\n * @param {Object} [options] Options object.\n * @param {boolean} [options.validate=true] Whether to check if the filter conforms to the Mapbox GL Style Specification. Disabling validation is a performance optimization that should only be used if you have previously validated the values you will be passing to this function.\n * @returns {Map} `this`\n * @example\n * var layerVisibility = map.getLayoutProperty('my-layer', 'visibility');\n */\n setLight(light: LightSpecification, options: StyleSetterOptions = {}) {\n this._lazyInitEmptyStyle();\n this.style.setLight(light, options);\n return this._update(true);\n }\n\n /**\n * Returns the value of the light object.\n *\n * @returns {Object} light Light properties of the style.\n */\n getLight() {\n return this.style.getLight();\n }\n\n // eslint-disable-next-line jsdoc/require-returns\n /**\n * Sets the `state` of a feature.\n * A feature's `state` is a set of user-defined key-value pairs that are assigned to a feature at runtime.\n * When using this method, the `state` object is merged with any existing key-value pairs in the feature's state.\n * Features are identified by their `feature.id` attribute, which can be any number or string.\n *\n * This method can only be used with sources that have a `feature.id` attribute. The `feature.id` attribute can be defined in three ways:\n * - For vector or GeoJSON sources, including an `id` attribute in the original data file.\n * - For vector or GeoJSON sources, using the [`promoteId`](https://docs.mapbox.com/mapbox-gl-js/style-spec/sources/#vector-promoteId) option at the time the source is defined.\n * - For GeoJSON sources, using the [`generateId`](https://docs.mapbox.com/mapbox-gl-js/style-spec/sources/#geojson-generateId) option to auto-assign an `id` based on the feature's index in the source data. If you change feature data using `map.getSource('some id').setData(..)`, you may need to re-apply state taking into account updated `id` values.\n *\n * _Note: You can use the [`feature-state` expression](https://docs.mapbox.com/mapbox-gl-js/style-spec/expressions/#feature-state) to access the values in a feature's state object for the purposes of styling._\n *\n * @param {Object} feature Feature identifier. Feature objects returned from\n * {@link Map#queryRenderedFeatures} or event handlers can be used as feature identifiers.\n * @param {string | number} feature.id Unique id of the feature.\n * @param {string} feature.source The id of the vector or GeoJSON source for the feature.\n * @param {string} [feature.sourceLayer] (optional) *For vector tile sources, `sourceLayer` is required.*\n * @param {Object} state A set of key-value pairs. The values should be valid JSON types.\n *\n * @example\n * // When the mouse moves over the `my-layer` layer, update\n * // the feature state for the feature under the mouse\n * map.on('mousemove', 'my-layer', function(e) {\n * if (e.features.length > 0) {\n * map.setFeatureState({\n * source: 'my-source',\n * sourceLayer: 'my-source-layer',\n * id: e.features[0].id,\n * }, {\n * hover: true\n * });\n * }\n * });\n *\n * @see [Create a hover effect](https://maplibre.org/maplibre-gl-js-docs/example/hover-styles/)\n * @see Tutorial: [Create interactive hover effects with Mapbox GL JS](https://docs.mapbox.com/help/tutorials/create-interactive-hover-effects-with-mapbox-gl-js/)\n */\n setFeatureState(feature: { source: string; sourceLayer?: string; id: string | number; }, state: Object) {\n this.style.setFeatureState(feature, state);\n return this._update();\n }\n\n // eslint-disable-next-line jsdoc/require-returns\n /**\n * Removes the `state` of a feature, setting it back to the default behavior.\n * If only a `target.source` is specified, it will remove the state for all features from that source.\n * If `target.id` is also specified, it will remove all keys for that feature's state.\n * If `key` is also specified, it removes only that key from that feature's state.\n * Features are identified by their `feature.id` attribute, which can be any number or string.\n *\n * @param {Object} target Identifier of where to remove state. It can be a source, a feature, or a specific key of feature.\n * Feature objects returned from {@link Map#queryRenderedFeatures} or event handlers can be used as feature identifiers.\n * @param {string | number} target.id (optional) Unique id of the feature. Optional if key is not specified.\n * @param {string} target.source The id of the vector or GeoJSON source for the feature.\n * @param {string} [target.sourceLayer] (optional) *For vector tile sources, `sourceLayer` is required.*\n * @param {string} key (optional) The key in the feature state to reset.\n *\n * @example\n * // Reset the entire state object for all features\n * // in the `my-source` source\n * map.removeFeatureState({\n * source: 'my-source'\n * });\n *\n * @example\n * // When the mouse leaves the `my-layer` layer,\n * // reset the entire state object for the\n * // feature under the mouse\n * map.on('mouseleave', 'my-layer', function(e) {\n * map.removeFeatureState({\n * source: 'my-source',\n * sourceLayer: 'my-source-layer',\n * id: e.features[0].id\n * });\n * });\n *\n * @example\n * // When the mouse leaves the `my-layer` layer,\n * // reset only the `hover` key-value pair in the\n * // state for the feature under the mouse\n * map.on('mouseleave', 'my-layer', function(e) {\n * map.removeFeatureState({\n * source: 'my-source',\n * sourceLayer: 'my-source-layer',\n * id: e.features[0].id\n * }, 'hover');\n * });\n *\n */\n removeFeatureState(target: { source: string; sourceLayer?: string; id?: string | number; }, key?: string) {\n this.style.removeFeatureState(target, key);\n return this._update();\n }\n\n /**\n * Gets the `state` of a feature.\n * A feature's `state` is a set of user-defined key-value pairs that are assigned to a feature at runtime.\n * Features are identified by their `feature.id` attribute, which can be any number or string.\n *\n * _Note: To access the values in a feature's state object for the purposes of styling the feature, use the [`feature-state` expression](https://docs.mapbox.com/mapbox-gl-js/style-spec/expressions/#feature-state)._\n *\n * @param {Object} feature Feature identifier. Feature objects returned from\n * {@link Map#queryRenderedFeatures} or event handlers can be used as feature identifiers.\n * @param {string | number} feature.id Unique id of the feature.\n * @param {string} feature.source The id of the vector or GeoJSON source for the feature.\n * @param {string} [feature.sourceLayer] (optional) *For vector tile sources, `sourceLayer` is required.*\n *\n * @returns {Object} The state of the feature: a set of key-value pairs that was assigned to the feature at runtime.\n *\n * @example\n * // When the mouse moves over the `my-layer` layer,\n * // get the feature state for the feature under the mouse\n * map.on('mousemove', 'my-layer', function(e) {\n * if (e.features.length > 0) {\n * map.getFeatureState({\n * source: 'my-source',\n * sourceLayer: 'my-source-layer',\n * id: e.features[0].id\n * });\n * }\n * });\n *\n */\n getFeatureState(feature: { source: string; sourceLayer?: string; id: string | number; }): any {\n return this.style.getFeatureState(feature);\n }\n\n /**\n * Returns the map's containing HTML element.\n *\n * @returns {HTMLElement} The map's container.\n */\n getContainer() {\n return this._container;\n }\n\n /**\n * Returns the HTML element containing the map's `` element.\n *\n * If you want to add non-GL overlays to the map, you should append them to this element.\n *\n * This is the element to which event bindings for map interactivity (such as panning and zooming) are\n * attached. It will receive bubbled events from child elements such as the ``, but not from\n * map controls.\n *\n * @returns {HTMLElement} The container of the map's ``.\n * @see [Create a draggable point](https://maplibre.org/maplibre-gl-js-docs/example/drag-a-point/)\n */\n getCanvasContainer() {\n return this._canvasContainer;\n }\n\n /**\n * Returns the map's `` element.\n *\n * @returns {HTMLCanvasElement} The map's `` element.\n * @see [Measure distances](https://maplibre.org/maplibre-gl-js-docs/example/measure/)\n * @see [Display a popup on hover](https://maplibre.org/maplibre-gl-js-docs/example/popup-on-hover/)\n * @see [Center the map on a clicked symbol](https://maplibre.org/maplibre-gl-js-docs/example/center-on-symbol/)\n */\n getCanvas() {\n return this._canvas;\n }\n\n _containerDimensions() {\n let width = 0;\n let height = 0;\n\n if (this._container) {\n width = this._container.clientWidth || 400;\n height = this._container.clientHeight || 300;\n }\n\n return [width, height];\n }\n\n _setupContainer() {\n const container = this._container;\n container.classList.add('maplibregl-map', 'mapboxgl-map');\n\n const canvasContainer = this._canvasContainer = DOM.create('div', 'maplibregl-canvas-container mapboxgl-canvas-container', container);\n if (this._interactive) {\n canvasContainer.classList.add('maplibregl-interactive', 'mapboxgl-interactive');\n }\n\n this._canvas = DOM.create('canvas', 'maplibregl-canvas mapboxgl-canvas', canvasContainer);\n this._canvas.addEventListener('webglcontextlost', this._contextLost, false);\n this._canvas.addEventListener('webglcontextrestored', this._contextRestored, false);\n this._canvas.setAttribute('tabindex', '0');\n this._canvas.setAttribute('aria-label', 'Map');\n this._canvas.setAttribute('role', 'region');\n\n const dimensions = this._containerDimensions();\n this._resizeCanvas(dimensions[0], dimensions[1]);\n\n const controlContainer = this._controlContainer = DOM.create('div', 'maplibregl-control-container mapboxgl-control-container', container);\n const positions = this._controlPositions = {};\n ['top-left', 'top-right', 'bottom-left', 'bottom-right'].forEach((positionName) => {\n positions[positionName] = DOM.create('div', `maplibregl-ctrl-${positionName} mapboxgl-ctrl-${positionName}`, controlContainer);\n });\n\n this._container.addEventListener('scroll', this._onMapScroll, false);\n }\n\n _resizeCanvas(width: number, height: number) {\n const pixelRatio = browser.devicePixelRatio || 1;\n\n // Request the required canvas size taking the pixelratio into account.\n this._canvas.width = pixelRatio * width;\n this._canvas.height = pixelRatio * height;\n\n // Maintain the same canvas size, potentially downscaling it for HiDPI displays\n this._canvas.style.width = `${width}px`;\n this._canvas.style.height = `${height}px`;\n }\n\n _setupPainter() {\n const attributes = extend({}, isSupported.webGLContextAttributes, {\n failIfMajorPerformanceCaveat: this._failIfMajorPerformanceCaveat,\n preserveDrawingBuffer: this._preserveDrawingBuffer,\n antialias: this._antialias || false\n });\n\n const gl = this._canvas.getContext('webgl', attributes) ||\n this._canvas.getContext('experimental-webgl', attributes);\n\n if (!gl) {\n this.fire(new ErrorEvent(new Error('Failed to initialize WebGL')));\n return;\n }\n\n this.painter = new Painter(gl, this.transform);\n\n webpSupported.testSupport(gl);\n }\n\n _contextLost(event: *) {\n event.preventDefault();\n if (this._frame) {\n this._frame.cancel();\n this._frame = null;\n }\n this.fire(new Event('webglcontextlost', {originalEvent: event}));\n }\n\n _contextRestored(event: *) {\n this._setupPainter();\n this.resize();\n this._update();\n this.fire(new Event('webglcontextrestored', {originalEvent: event}));\n }\n\n _onMapScroll(event: *) {\n if (event.target !== this._container) return;\n\n // Revert any scroll which would move the canvas outside of the view\n this._container.scrollTop = 0;\n this._container.scrollLeft = 0;\n return false;\n }\n\n /**\n * Returns a Boolean indicating whether the map is fully loaded.\n *\n * Returns `false` if the style is not yet fully loaded,\n * or if there has been a change to the sources or style that\n * has not yet fully loaded.\n *\n * @returns {boolean} A Boolean indicating whether the map is fully loaded.\n */\n loaded() {\n return !this._styleDirty && !this._sourcesDirty && !!this.style && this.style.loaded();\n }\n\n /**\n * Update this map's style and sources, and re-render the map.\n *\n * @param {boolean} updateStyle mark the map's style for reprocessing as\n * well as its sources\n * @returns {Map} this\n * @private\n */\n _update(updateStyle?: boolean) {\n if (!this.style) return this;\n\n this._styleDirty = this._styleDirty || updateStyle;\n this._sourcesDirty = true;\n this.triggerRepaint();\n\n return this;\n }\n\n /**\n * Request that the given callback be executed during the next render\n * frame. Schedule a render frame if one is not already scheduled.\n * @returns An id that can be used to cancel the callback\n * @private\n */\n _requestRenderFrame(callback: () => void): TaskID {\n this._update();\n return this._renderTaskQueue.add(callback);\n }\n\n _cancelRenderFrame(id: TaskID) {\n this._renderTaskQueue.remove(id);\n }\n\n /**\n * Call when a (re-)render of the map is required:\n * - The style has changed (`setPaintProperty()`, etc.)\n * - Source data has changed (e.g. tiles have finished loading)\n * - The map has is moving (or just finished moving)\n * - A transition is in progress\n *\n * @param {number} paintStartTimeStamp The time when the animation frame began executing.\n *\n * @returns {Map} this\n * @private\n */\n _render(paintStartTimeStamp: number) {\n let gpuTimer, frameStartTime = 0;\n const extTimerQuery = this.painter.context.extTimerQuery;\n if (this.listens('gpu-timing-frame')) {\n gpuTimer = extTimerQuery.createQueryEXT();\n extTimerQuery.beginQueryEXT(extTimerQuery.TIME_ELAPSED_EXT, gpuTimer);\n frameStartTime = browser.now();\n }\n\n // A custom layer may have used the context asynchronously. Mark the state as dirty.\n this.painter.context.setDirty();\n this.painter.setBaseState();\n\n this._renderTaskQueue.run(paintStartTimeStamp);\n // A task queue callback may have fired a user event which may have removed the map\n if (this._removed) return;\n\n let crossFading = false;\n\n // If the style has changed, the map is being zoomed, or a transition or fade is in progress:\n // - Apply style changes (in a batch)\n // - Recalculate paint properties.\n if (this.style && this._styleDirty) {\n this._styleDirty = false;\n\n const zoom = this.transform.zoom;\n const now = browser.now();\n this.style.zoomHistory.update(zoom, now);\n\n const parameters = new EvaluationParameters(zoom, {\n now,\n fadeDuration: this._fadeDuration,\n zoomHistory: this.style.zoomHistory,\n transition: this.style.getTransition()\n });\n\n const factor = parameters.crossFadingFactor();\n if (factor !== 1 || factor !== this._crossFadingFactor) {\n crossFading = true;\n this._crossFadingFactor = factor;\n }\n\n this.style.update(parameters);\n }\n\n // If we are in _render for any reason other than an in-progress paint\n // transition, update source caches to check for and load any tiles we\n // need for the current transform\n if (this.style && this._sourcesDirty) {\n this._sourcesDirty = false;\n this.style._updateSources(this.transform);\n }\n\n this._placementDirty = this.style && this.style._updatePlacement(this.painter.transform, this.showCollisionBoxes, this._fadeDuration, this._crossSourceCollisions);\n\n // Actually draw\n this.painter.render(this.style, {\n showTileBoundaries: this.showTileBoundaries,\n showOverdrawInspector: this._showOverdrawInspector,\n rotating: this.isRotating(),\n zooming: this.isZooming(),\n moving: this.isMoving(),\n fadeDuration: this._fadeDuration,\n showPadding: this.showPadding,\n gpuTiming: !!this.listens('gpu-timing-layer'),\n });\n\n this.fire(new Event('render'));\n\n if (this.loaded() && !this._loaded) {\n this._loaded = true;\n PerformanceUtils.mark(PerformanceMarkers.load);\n this.fire(new Event('load'));\n }\n\n if (this.style && (this.style.hasTransitions() || crossFading)) {\n this._styleDirty = true;\n }\n\n if (this.style && !this._placementDirty) {\n // Since no fade operations are in progress, we can release\n // all tiles held for fading. If we didn't do this, the tiles\n // would just sit in the SourceCaches until the next render\n this.style._releaseSymbolFadeTiles();\n }\n\n if (this.listens('gpu-timing-frame')) {\n const renderCPUTime = browser.now() - frameStartTime;\n extTimerQuery.endQueryEXT(extTimerQuery.TIME_ELAPSED_EXT, gpuTimer);\n setTimeout(() => {\n const renderGPUTime = extTimerQuery.getQueryObjectEXT(gpuTimer, extTimerQuery.QUERY_RESULT_EXT) / (1000 * 1000);\n extTimerQuery.deleteQueryEXT(gpuTimer);\n this.fire(new Event('gpu-timing-frame', {\n cpuTime: renderCPUTime,\n gpuTime: renderGPUTime\n }));\n }, 50); // Wait 50ms to give time for all GPU calls to finish before querying\n }\n\n if (this.listens('gpu-timing-layer')) {\n // Resetting the Painter's per-layer timing queries here allows us to isolate\n // the queries to individual frames.\n const frameLayerQueries = this.painter.collectGpuTimers();\n\n setTimeout(() => {\n const renderedLayerTimes = this.painter.queryGpuTimers(frameLayerQueries);\n\n this.fire(new Event('gpu-timing-layer', {\n layerTimes: renderedLayerTimes\n }));\n }, 50); // Wait 50ms to give time for all GPU calls to finish before querying\n }\n\n // Schedule another render frame if it's needed.\n //\n // Even though `_styleDirty` and `_sourcesDirty` are reset in this\n // method, synchronous events fired during Style#update or\n // Style#_updateSources could have caused them to be set again.\n const somethingDirty = this._sourcesDirty || this._styleDirty || this._placementDirty;\n if (somethingDirty || this._repaint) {\n this.triggerRepaint();\n } else if (!this.isMoving() && this.loaded()) {\n this.fire(new Event('idle'));\n }\n\n if (this._loaded && !this._fullyLoaded && !somethingDirty) {\n this._fullyLoaded = true;\n PerformanceUtils.mark(PerformanceMarkers.fullLoad);\n }\n\n return this;\n }\n\n /**\n * Clean up and release all internal resources associated with this map.\n *\n * This includes DOM elements, event bindings, web workers, and WebGL resources.\n *\n * Use this method when you are done using the map and wish to ensure that it no\n * longer consumes browser resources. Afterwards, you must not call any other\n * methods on the map.\n */\n remove() {\n if (this._hash) this._hash.remove();\n\n for (const control of this._controls) control.onRemove(this);\n this._controls = [];\n\n if (this._frame) {\n this._frame.cancel();\n this._frame = null;\n }\n this._renderTaskQueue.clear();\n this.painter.destroy();\n this.handlers.destroy();\n delete this.handlers;\n this.setStyle(null);\n if (typeof window !== 'undefined') {\n window.removeEventListener('resize', this._onWindowResize, false);\n window.removeEventListener('orientationchange', this._onWindowResize, false);\n window.removeEventListener('online', this._onWindowOnline, false);\n }\n\n const extension = this.painter.context.gl.getExtension('WEBGL_lose_context');\n if (extension) extension.loseContext();\n removeNode(this._canvasContainer);\n removeNode(this._controlContainer);\n this._container.classList.remove('maplibregl-map', 'mapboxgl-map');\n\n PerformanceUtils.clearMetrics();\n\n this._removed = true;\n this.fire(new Event('remove'));\n }\n\n /**\n * Trigger the rendering of a single frame. Use this method with custom layers to\n * repaint the map when the layer changes. Calling this multiple times before the\n * next frame is rendered will still result in only a single frame being rendered.\n * @example\n * map.triggerRepaint();\n * @see [Add a 3D model](https://maplibre.org/maplibre-gl-js-docs/example/add-3d-model/)\n * @see [Add an animated icon to the map](https://maplibre.org/maplibre-gl-js-docs/example/add-image-animated/)\n */\n triggerRepaint() {\n if (this.style && !this._frame) {\n this._frame = browser.frame((paintStartTimeStamp: number) => {\n PerformanceUtils.frame(paintStartTimeStamp);\n this._frame = null;\n this._render(paintStartTimeStamp);\n });\n }\n }\n\n _onWindowOnline() {\n this._update();\n }\n\n _onWindowResize(event: Event) {\n if (this._trackResize) {\n this.resize({originalEvent: event})._update();\n }\n }\n\n /**\n * Gets and sets a Boolean indicating whether the map will render an outline\n * around each tile and the tile ID. These tile boundaries are useful for\n * debugging.\n *\n * The uncompressed file size of the first vector source is drawn in the top left\n * corner of each tile, next to the tile ID.\n *\n * @name showTileBoundaries\n * @type {boolean}\n * @instance\n * @memberof Map\n * @example\n * map.showTileBoundaries = true;\n */\n get showTileBoundaries(): boolean { return !!this._showTileBoundaries; }\n set showTileBoundaries(value: boolean) {\n if (this._showTileBoundaries === value) return;\n this._showTileBoundaries = value;\n this._update();\n }\n\n /**\n * Gets and sets a Boolean indicating whether the map will visualize\n * the padding offsets.\n *\n * @name showPadding\n * @type {boolean}\n * @instance\n * @memberof Map\n */\n get showPadding(): boolean { return !!this._showPadding; }\n set showPadding(value: boolean) {\n if (this._showPadding === value) return;\n this._showPadding = value;\n this._update();\n }\n\n /**\n * Gets and sets a Boolean indicating whether the map will render boxes\n * around all symbols in the data source, revealing which symbols\n * were rendered or which were hidden due to collisions.\n * This information is useful for debugging.\n *\n * @name showCollisionBoxes\n * @type {boolean}\n * @instance\n * @memberof Map\n */\n get showCollisionBoxes(): boolean { return !!this._showCollisionBoxes; }\n set showCollisionBoxes(value: boolean) {\n if (this._showCollisionBoxes === value) return;\n this._showCollisionBoxes = value;\n if (value) {\n // When we turn collision boxes on we have to generate them for existing tiles\n // When we turn them off, there's no cost to leaving existing boxes in place\n this.style._generateCollisionBoxes();\n } else {\n // Otherwise, call an update to remove collision boxes\n this._update();\n }\n }\n\n /*\n * Gets and sets a Boolean indicating whether the map should color-code\n * each fragment to show how many times it has been shaded.\n * White fragments have been shaded 8 or more times.\n * Black fragments have been shaded 0 times.\n * This information is useful for debugging.\n *\n * @name showOverdraw\n * @type {boolean}\n * @instance\n * @memberof Map\n */\n get showOverdrawInspector(): boolean { return !!this._showOverdrawInspector; }\n set showOverdrawInspector(value: boolean) {\n if (this._showOverdrawInspector === value) return;\n this._showOverdrawInspector = value;\n this._update();\n }\n\n /**\n * Gets and sets a Boolean indicating whether the map will\n * continuously repaint. This information is useful for analyzing performance.\n *\n * @name repaint\n * @type {boolean}\n * @instance\n * @memberof Map\n */\n get repaint(): boolean { return !!this._repaint; }\n set repaint(value: boolean) {\n if (this._repaint !== value) {\n this._repaint = value;\n this.triggerRepaint();\n }\n }\n // show vertices\n get vertices(): boolean { return !!this._vertices; }\n set vertices(value: boolean) { this._vertices = value; this._update(); }\n\n // for cache browser tests\n _setCacheLimits(limit: number, checkThreshold: number) {\n setCacheLimits(limit, checkThreshold);\n }\n\n /**\n * The version of Mapbox GL JS in use as specified in package.json, CHANGELOG.md, and the GitHub release.\n *\n * @name version\n * @instance\n * @memberof Map\n * @var {string} version\n */\n\n get version(): string { return version; }\n}\n\nexport default Map;\n\nfunction removeNode(node) {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n}\n\n/**\n * Interface for interactive controls added to the map. This is a\n * specification for implementers to model: it is not\n * an exported method or class.\n *\n * Controls must implement `onAdd` and `onRemove`, and must own an\n * element, which is often a `div` element. To use Mapbox GL JS's\n * default control styling, add the `maplibregl-ctrl` class to your control's\n * node.\n *\n * @interface IControl\n * @example\n * // Control implemented as ES6 class\n * class HelloWorldControl {\n * onAdd(map) {\n * this._map = map;\n * this._container = document.createElement('div');\n * this._container.className = 'maplibregl-ctrl';\n * this._container.textContent = 'Hello, world';\n * return this._container;\n * }\n *\n * onRemove() {\n * this._container.parentNode.removeChild(this._container);\n * this._map = undefined;\n * }\n * }\n *\n * // Control implemented as ES5 prototypical class\n * function HelloWorldControl() { }\n *\n * HelloWorldControl.prototype.onAdd = function(map) {\n * this._map = map;\n * this._container = document.createElement('div');\n * this._container.className = 'maplibregl-ctrl';\n * this._container.textContent = 'Hello, world';\n * return this._container;\n * };\n *\n * HelloWorldControl.prototype.onRemove = function () {\n * this._container.parentNode.removeChild(this._container);\n * this._map = undefined;\n * };\n */\n\n/**\n * Register a control on the map and give it a chance to register event listeners\n * and resources. This method is called by {@link Map#addControl}\n * internally.\n *\n * @function\n * @memberof IControl\n * @instance\n * @name onAdd\n * @param {Map} map the Map this control will be added to\n * @returns {HTMLElement} The control's container element. This should\n * be created by the control and returned by onAdd without being attached\n * to the DOM: the map will insert the control's element into the DOM\n * as necessary.\n */\n\n/**\n * Unregister a control on the map and give it a chance to detach event listeners\n * and resources. This method is called by {@link Map#removeControl}\n * internally.\n *\n * @function\n * @memberof IControl\n * @instance\n * @name onRemove\n * @param {Map} map the Map this control will be removed from\n * @returns {undefined} there is no required return value for this method\n */\n\n/**\n * Optionally provide a default position for this control. If this method\n * is implemented and {@link Map#addControl} is called without the `position`\n * parameter, the value returned by getDefaultPosition will be used as the\n * control's position.\n *\n * @function\n * @memberof IControl\n * @instance\n * @name getDefaultPosition\n * @returns {string} a control position, one of the values valid in addControl.\n */\n\n/**\n * A [`Point` geometry](https://github.com/mapbox/point-geometry) object, which has\n * `x` and `y` properties representing screen coordinates in pixels.\n *\n * @typedef {Object} Point\n * @example\n * var point = new maplibregl.Point(-77, 38);\n */\n\n/**\n * A {@link Point} or an array of two numbers representing `x` and `y` screen coordinates in pixels.\n *\n * @typedef {(Point | Array)} PointLike\n * @example\n * var p1 = new maplibregl.Point(-77, 38); // a PointLike which is a Point\n * var p2 = [-77, 38]; // a PointLike which is an array of two numbers\n */\n","// @flow\n\nimport DOM from '../../util/dom';\nimport {extend, bindAll} from '../../util/util';\nimport {MouseRotateHandler, MousePitchHandler} from '../handler/mouse';\nimport window from '../../util/window';\n\nimport type Map from '../map';\n\ntype Options = {\n showCompass?: boolean,\n showZoom?: boolean,\n visualizePitch?: boolean\n};\n\nconst defaultOptions: Options = {\n showCompass: true,\n showZoom: true,\n visualizePitch: false\n};\n\n/**\n * A `NavigationControl` control contains zoom buttons and a compass.\n *\n * @implements {IControl}\n * @param {Object} [options]\n * @param {Boolean} [options.showCompass=true] If `true` the compass button is included.\n * @param {Boolean} [options.showZoom=true] If `true` the zoom-in and zoom-out buttons are included.\n * @param {Boolean} [options.visualizePitch=false] If `true` the pitch is visualized by rotating X-axis of compass.\n * @example\n * var nav = new maplibregl.NavigationControl();\n * map.addControl(nav, 'top-left');\n * @see [Display map navigation controls](https://maplibre.org/maplibre-gl-js-docs/example/navigation/)\n * @see [Add a third party vector tile source](https://maplibre.org/maplibre-gl-js-docs/example/third-party/)\n */\nclass NavigationControl {\n _map: Map;\n options: Options;\n _container: HTMLElement;\n _zoomInButton: HTMLButtonElement;\n _zoomOutButton: HTMLButtonElement;\n _compass: HTMLButtonElement;\n _compassIcon: HTMLElement;\n _handler: MouseRotateWrapper;\n\n constructor(options: Options) {\n this.options = extend({}, defaultOptions, options);\n\n this._container = DOM.create('div', 'maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group');\n this._container.addEventListener('contextmenu', (e) => e.preventDefault());\n\n if (this.options.showZoom) {\n bindAll([\n '_setButtonTitle',\n '_updateZoomButtons'\n ], this);\n this._zoomInButton = this._createButton('maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in', (e) => this._map.zoomIn({}, {originalEvent: e}));\n DOM.create('span', `maplibregl-ctrl-icon mapboxgl-ctrl-icon`, this._zoomInButton).setAttribute('aria-hidden', true);\n this._zoomOutButton = this._createButton('maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out', (e) => this._map.zoomOut({}, {originalEvent: e}));\n DOM.create('span', `maplibregl-ctrl-icon mapboxgl-ctrl-icon`, this._zoomOutButton).setAttribute('aria-hidden', true);\n }\n if (this.options.showCompass) {\n bindAll([\n '_rotateCompassArrow'\n ], this);\n this._compass = this._createButton('maplibregl-ctrl-compass mapboxgl-ctrl-compass', (e) => {\n if (this.options.visualizePitch) {\n this._map.resetNorthPitch({}, {originalEvent: e});\n } else {\n this._map.resetNorth({}, {originalEvent: e});\n }\n });\n this._compassIcon = DOM.create('span', 'maplibregl-ctrl-icon mapboxgl-ctrl-icon', this._compass);\n this._compassIcon.setAttribute('aria-hidden', true);\n }\n }\n\n _updateZoomButtons() {\n const zoom = this._map.getZoom();\n const isMax = zoom === this._map.getMaxZoom();\n const isMin = zoom === this._map.getMinZoom();\n this._zoomInButton.disabled = isMax;\n this._zoomOutButton.disabled = isMin;\n this._zoomInButton.setAttribute('aria-disabled', isMax.toString());\n this._zoomOutButton.setAttribute('aria-disabled', isMin.toString());\n }\n\n _rotateCompassArrow() {\n const rotate = this.options.visualizePitch ?\n `scale(${1 / Math.pow(Math.cos(this._map.transform.pitch * (Math.PI / 180)), 0.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle * (180 / Math.PI)}deg)` :\n `rotate(${this._map.transform.angle * (180 / Math.PI)}deg)`;\n\n this._compassIcon.style.transform = rotate;\n }\n\n onAdd(map: Map) {\n this._map = map;\n if (this.options.showZoom) {\n this._setButtonTitle(this._zoomInButton, 'ZoomIn');\n this._setButtonTitle(this._zoomOutButton, 'ZoomOut');\n this._map.on('zoom', this._updateZoomButtons);\n this._updateZoomButtons();\n }\n if (this.options.showCompass) {\n this._setButtonTitle(this._compass, 'ResetBearing');\n if (this.options.visualizePitch) {\n this._map.on('pitch', this._rotateCompassArrow);\n }\n this._map.on('rotate', this._rotateCompassArrow);\n this._rotateCompassArrow();\n this._handler = new MouseRotateWrapper(this._map, this._compass, this.options.visualizePitch);\n }\n return this._container;\n }\n\n onRemove() {\n DOM.remove(this._container);\n if (this.options.showZoom) {\n this._map.off('zoom', this._updateZoomButtons);\n }\n if (this.options.showCompass) {\n if (this.options.visualizePitch) {\n this._map.off('pitch', this._rotateCompassArrow);\n }\n this._map.off('rotate', this._rotateCompassArrow);\n this._handler.off();\n delete this._handler;\n }\n\n delete this._map;\n }\n\n _createButton(className: string, fn: () => mixed) {\n const a = DOM.create('button', className, this._container);\n a.type = 'button';\n a.addEventListener('click', fn);\n return a;\n }\n\n _setButtonTitle(button: HTMLButtonElement, title: string) {\n const str = this._map._getUIString(`NavigationControl.${title}`);\n button.title = str;\n button.setAttribute('aria-label', str);\n }\n}\n\nclass MouseRotateWrapper {\n\n map: Map;\n _clickTolerance: number;\n element: HTMLElement;\n mouseRotate: MouseRotateHandler;\n mousePitch: MousePitchHandler;\n _startPos: Point;\n _lastPos: Point;\n\n constructor(map: Map, element: HTMLElement, pitch?: boolean = false) {\n this._clickTolerance = 10;\n this.element = element;\n this.mouseRotate = new MouseRotateHandler({clickTolerance: map.dragRotate._mouseRotate._clickTolerance});\n this.map = map;\n if (pitch) this.mousePitch = new MousePitchHandler({clickTolerance: map.dragRotate._mousePitch._clickTolerance});\n\n bindAll(['mousedown', 'mousemove', 'mouseup', 'touchstart', 'touchmove', 'touchend', 'reset'], this);\n DOM.addEventListener(element, 'mousedown', this.mousedown);\n DOM.addEventListener(element, 'touchstart', this.touchstart, {passive: false});\n DOM.addEventListener(element, 'touchmove', this.touchmove);\n DOM.addEventListener(element, 'touchend', this.touchend);\n DOM.addEventListener(element, 'touchcancel', this.reset);\n }\n\n down(e: MouseEvent, point: Point) {\n this.mouseRotate.mousedown(e, point);\n if (this.mousePitch) this.mousePitch.mousedown(e, point);\n DOM.disableDrag();\n }\n\n move(e: MouseEvent, point: Point) {\n const map = this.map;\n const r = this.mouseRotate.mousemoveWindow(e, point);\n if (r && r.bearingDelta) map.setBearing(map.getBearing() + r.bearingDelta);\n if (this.mousePitch) {\n const p = this.mousePitch.mousemoveWindow(e, point);\n if (p && p.pitchDelta) map.setPitch(map.getPitch() + p.pitchDelta);\n }\n }\n\n off() {\n const element = this.element;\n DOM.removeEventListener(element, 'mousedown', this.mousedown);\n DOM.removeEventListener(element, 'touchstart', this.touchstart, {passive: false});\n DOM.removeEventListener(element, 'touchmove', this.touchmove);\n DOM.removeEventListener(element, 'touchend', this.touchend);\n DOM.removeEventListener(element, 'touchcancel', this.reset);\n this.offTemp();\n }\n\n offTemp() {\n DOM.enableDrag();\n DOM.removeEventListener(window, 'mousemove', this.mousemove);\n DOM.removeEventListener(window, 'mouseup', this.mouseup);\n }\n\n mousedown(e: MouseEvent) {\n this.down(extend({}, e, {ctrlKey: true, preventDefault: () => e.preventDefault()}), DOM.mousePos(this.element, e));\n DOM.addEventListener(window, 'mousemove', this.mousemove);\n DOM.addEventListener(window, 'mouseup', this.mouseup);\n }\n\n mousemove(e: MouseEvent) {\n this.move(e, DOM.mousePos(this.element, e));\n }\n\n mouseup(e: MouseEvent) {\n this.mouseRotate.mouseupWindow(e);\n if (this.mousePitch) this.mousePitch.mouseupWindow(e);\n this.offTemp();\n }\n\n touchstart(e: TouchEvent) {\n if (e.targetTouches.length !== 1) {\n this.reset();\n } else {\n this._startPos = this._lastPos = DOM.touchPos(this.element, e.targetTouches)[0];\n this.down((({type: 'mousedown', button: 0, ctrlKey: true, preventDefault: () => e.preventDefault()}: any): MouseEvent), this._startPos);\n }\n }\n\n touchmove(e: TouchEvent) {\n if (e.targetTouches.length !== 1) {\n this.reset();\n } else {\n this._lastPos = DOM.touchPos(this.element, e.targetTouches)[0];\n this.move((({preventDefault: () => e.preventDefault()}: any): MouseEvent), this._lastPos);\n }\n }\n\n touchend(e: TouchEvent) {\n if (e.targetTouches.length === 0 &&\n this._startPos &&\n this._lastPos &&\n this._startPos.dist(this._lastPos) < this._clickTolerance) {\n this.element.click();\n }\n this.reset();\n }\n\n reset() {\n this.mouseRotate.reset();\n if (this.mousePitch) this.mousePitch.reset();\n delete this._startPos;\n delete this._lastPos;\n this.offTemp();\n }\n}\n\nexport default NavigationControl;\n","// @flow\n\nimport LngLat from '../geo/lng_lat';\n\nimport type Point from '@mapbox/point-geometry';\nimport type Transform from '../geo/transform';\n\n/**\n * Given a LngLat, prior projected position, and a transform, return a new LngLat shifted\n * n × 360° east or west for some n ≥ 0 such that:\n *\n * * the projected location of the result is on screen, if possible, and secondarily:\n * * the difference between the projected location of the result and the prior position\n * is minimized.\n *\n * The object is to preserve perceived object constancy for Popups and Markers as much as\n * possible; they should avoid shifting large distances across the screen, even when the\n * map center changes by ±360° due to automatic wrapping, and when about to go off screen,\n * should wrap just enough to avoid doing so.\n *\n * @private\n */\nexport default function(lngLat: LngLat, priorPos: ?Point, transform: Transform): LngLat {\n lngLat = new LngLat(lngLat.lng, lngLat.lat);\n\n // First, try shifting one world in either direction, and see if either is closer to the\n // prior position. This preserves object constancy when the map center is auto-wrapped\n // during animations.\n if (priorPos) {\n const left = new LngLat(lngLat.lng - 360, lngLat.lat);\n const right = new LngLat(lngLat.lng + 360, lngLat.lat);\n const delta = transform.locationPoint(lngLat).distSqr(priorPos);\n if (transform.locationPoint(left).distSqr(priorPos) < delta) {\n lngLat = left;\n } else if (transform.locationPoint(right).distSqr(priorPos) < delta) {\n lngLat = right;\n }\n }\n\n // Second, wrap toward the center until the new position is on screen, or we can't get\n // any closer.\n while (Math.abs(lngLat.lng - transform.center.lng) > 180) {\n const pos = transform.locationPoint(lngLat);\n if (pos.x >= 0 && pos.y >= 0 && pos.x <= transform.width && pos.y <= transform.height) {\n break;\n }\n if (lngLat.lng > transform.center.lng) {\n lngLat.lng -= 360;\n } else {\n lngLat.lng += 360;\n }\n }\n\n return lngLat;\n}\n","// @flow\n\nexport type Anchor =\n | 'center'\n | 'top'\n | 'bottom'\n | 'left'\n | 'right'\n | 'top-left'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-right';\n\nexport const anchorTranslate: {[_: Anchor]: string} = {\n 'center': 'translate(-50%,-50%)',\n 'top': 'translate(-50%,0)',\n 'top-left': 'translate(0,0)',\n 'top-right': 'translate(-100%,0)',\n 'bottom': 'translate(-50%,-100%)',\n 'bottom-left': 'translate(0,-100%)',\n 'bottom-right': 'translate(-100%,-100%)',\n 'left': 'translate(0,-50%)',\n 'right': 'translate(-100%,-50%)'\n};\n\nexport function applyAnchorClass(element: HTMLElement, anchor: Anchor, prefix: string) {\n const classList = element.classList;\n for (const key in anchorTranslate) {\n classList.remove(`maplibregl-${prefix}-anchor-${key}`, `mapboxgl-${prefix}-anchor-${key}`);\n }\n classList.add(`maplibregl-${prefix}-anchor-${anchor}`, `mapboxgl-${prefix}-anchor-${anchor}`);\n}\n","// @flow\n\nimport DOM from '../util/dom';\nimport window from '../util/window';\nimport LngLat from '../geo/lng_lat';\nimport Point from '@mapbox/point-geometry';\nimport smartWrap from '../util/smart_wrap';\nimport {bindAll, extend} from '../util/util';\nimport {type Anchor, anchorTranslate, applyAnchorClass} from './anchor';\nimport {Event, Evented} from '../util/evented';\nimport type Map from './map';\nimport type Popup from './popup';\nimport type {LngLatLike} from \"../geo/lng_lat\";\nimport type {MapMouseEvent, MapTouchEvent} from './events';\nimport type {PointLike} from '@mapbox/point-geometry';\n\ntype Options = {\n element?: HTMLElement,\n offset?: PointLike,\n anchor?: Anchor,\n color?: string,\n scale?: number,\n draggable?: boolean,\n clickTolerance?: number,\n rotation?: number,\n rotationAlignment?: string,\n pitchAlignment?: string\n};\n\n/**\n * Creates a marker component\n * @param {Object} [options]\n * @param {HTMLElement} [options.element] DOM element to use as a marker. The default is a light blue, droplet-shaped SVG marker.\n * @param {string} [options.anchor='center'] A string indicating the part of the Marker that should be positioned closest to the coordinate set via {@link Marker#setLngLat}.\n * Options are `'center'`, `'top'`, `'bottom'`, `'left'`, `'right'`, `'top-left'`, `'top-right'`, `'bottom-left'`, and `'bottom-right'`.\n * @param {PointLike} [options.offset] The offset in pixels as a {@link PointLike} object to apply relative to the element's center. Negatives indicate left and up.\n * @param {string} [options.color='#3FB1CE'] The color to use for the default marker if options.element is not provided. The default is light blue.\n * @param {number} [options.scale=1] The scale to use for the default marker if options.element is not provided. The default scale corresponds to a height of `41px` and a width of `27px`.\n * @param {boolean} [options.draggable=false] A boolean indicating whether or not a marker is able to be dragged to a new position on the map.\n * @param {number} [options.clickTolerance=0] The max number of pixels a user can shift the mouse pointer during a click on the marker for it to be considered a valid click (as opposed to a marker drag). The default is to inherit map's clickTolerance.\n * @param {number} [options.rotation=0] The rotation angle of the marker in degrees, relative to its respective `rotationAlignment` setting. A positive value will rotate the marker clockwise.\n * @param {string} [options.pitchAlignment='auto'] `map` aligns the `Marker` to the plane of the map. `viewport` aligns the `Marker` to the plane of the viewport. `auto` automatically matches the value of `rotationAlignment`.\n * @param {string} [options.rotationAlignment='auto'] `map` aligns the `Marker`'s rotation relative to the map, maintaining a bearing as the map rotates. `viewport` aligns the `Marker`'s rotation relative to the viewport, agnostic to map rotations. `auto` is equivalent to `viewport`.\n * @example\n * var marker = new maplibregl.Marker()\n * .setLngLat([30.5, 50.5])\n * .addTo(map);\n * @example\n * // Set options\n * var marker = new maplibregl.Marker({\n * color: \"#FFFFFF\",\n * draggable: true\n * }).setLngLat([30.5, 50.5])\n * .addTo(map);\n * @see [Add custom icons with Markers](https://maplibre.org/maplibre-gl-js-docs/example/custom-marker-icons/)\n * @see [Create a draggable Marker](https://maplibre.org/maplibre-gl-js-docs/example/drag-a-marker/)\n */\nexport default class Marker extends Evented {\n _map: Map;\n _anchor: Anchor;\n _offset: Point;\n _element: HTMLElement;\n _popup: ?Popup;\n _lngLat: LngLat;\n _pos: ?Point;\n _color: ?string;\n _scale: number;\n _defaultMarker: boolean;\n _draggable: boolean;\n _clickTolerance: number;\n _isDragging: boolean;\n _state: 'inactive' | 'pending' | 'active'; // used for handling drag events\n _positionDelta: ?Point;\n _pointerdownPos: ?Point;\n _rotation: number;\n _pitchAlignment: string;\n _rotationAlignment: string;\n _originalTabIndex: ?string; // original tabindex of _element\n\n constructor(options?: Options, legacyOptions?: Options) {\n super();\n // For backward compatibility -- the constructor used to accept the element as a\n // required first argument, before it was made optional.\n if (options instanceof window.HTMLElement || legacyOptions) {\n options = extend({element: options}, legacyOptions);\n }\n\n bindAll([\n '_update',\n '_onMove',\n '_onUp',\n '_addDragHandler',\n '_onMapClick',\n '_onKeyPress'\n ], this);\n\n this._anchor = options && options.anchor || 'center';\n this._color = options && options.color || '#3FB1CE';\n this._scale = options && options.scale || 1;\n this._draggable = options && options.draggable || false;\n this._clickTolerance = options && options.clickTolerance || 0;\n this._isDragging = false;\n this._state = 'inactive';\n this._rotation = options && options.rotation || 0;\n this._rotationAlignment = options && options.rotationAlignment || 'auto';\n this._pitchAlignment = options && options.pitchAlignment && options.pitchAlignment !== 'auto' ? options.pitchAlignment : this._rotationAlignment;\n\n if (!options || !options.element) {\n this._defaultMarker = true;\n this._element = DOM.create('div');\n this._element.setAttribute('aria-label', 'Map marker');\n\n // create default map marker SVG\n const svg = DOM.createNS('http://www.w3.org/2000/svg', 'svg');\n const defaultHeight = 41;\n const defaultWidth = 27;\n svg.setAttributeNS(null, 'display', 'block');\n svg.setAttributeNS(null, 'height', `${defaultHeight}px`);\n svg.setAttributeNS(null, 'width', `${defaultWidth}px`);\n svg.setAttributeNS(null, 'viewBox', `0 0 ${defaultWidth} ${defaultHeight}`);\n\n const markerLarge = DOM.createNS('http://www.w3.org/2000/svg', 'g');\n markerLarge.setAttributeNS(null, 'stroke', 'none');\n markerLarge.setAttributeNS(null, 'stroke-width', '1');\n markerLarge.setAttributeNS(null, 'fill', 'none');\n markerLarge.setAttributeNS(null, 'fill-rule', 'evenodd');\n\n const page1 = DOM.createNS('http://www.w3.org/2000/svg', 'g');\n page1.setAttributeNS(null, 'fill-rule', 'nonzero');\n\n const shadow = DOM.createNS('http://www.w3.org/2000/svg', 'g');\n shadow.setAttributeNS(null, 'transform', 'translate(3.0, 29.0)');\n shadow.setAttributeNS(null, 'fill', '#000000');\n\n const ellipses = [\n {'rx': '10.5', 'ry': '5.25002273'},\n {'rx': '10.5', 'ry': '5.25002273'},\n {'rx': '9.5', 'ry': '4.77275007'},\n {'rx': '8.5', 'ry': '4.29549936'},\n {'rx': '7.5', 'ry': '3.81822308'},\n {'rx': '6.5', 'ry': '3.34094679'},\n {'rx': '5.5', 'ry': '2.86367051'},\n {'rx': '4.5', 'ry': '2.38636864'}\n ];\n\n for (const data of ellipses) {\n const ellipse = DOM.createNS('http://www.w3.org/2000/svg', 'ellipse');\n ellipse.setAttributeNS(null, 'opacity', '0.04');\n ellipse.setAttributeNS(null, 'cx', '10.5');\n ellipse.setAttributeNS(null, 'cy', '5.80029008');\n ellipse.setAttributeNS(null, 'rx', data['rx']);\n ellipse.setAttributeNS(null, 'ry', data['ry']);\n shadow.appendChild(ellipse);\n }\n\n const background = DOM.createNS('http://www.w3.org/2000/svg', 'g');\n background.setAttributeNS(null, 'fill', this._color);\n\n const bgPath = DOM.createNS('http://www.w3.org/2000/svg', 'path');\n bgPath.setAttributeNS(null, 'd', 'M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z');\n\n background.appendChild(bgPath);\n\n const border = DOM.createNS('http://www.w3.org/2000/svg', 'g');\n border.setAttributeNS(null, 'opacity', '0.25');\n border.setAttributeNS(null, 'fill', '#000000');\n\n const borderPath = DOM.createNS('http://www.w3.org/2000/svg', 'path');\n borderPath.setAttributeNS(null, 'd', 'M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z');\n\n border.appendChild(borderPath);\n\n const maki = DOM.createNS('http://www.w3.org/2000/svg', 'g');\n maki.setAttributeNS(null, 'transform', 'translate(6.0, 7.0)');\n maki.setAttributeNS(null, 'fill', '#FFFFFF');\n\n const circleContainer = DOM.createNS('http://www.w3.org/2000/svg', 'g');\n circleContainer.setAttributeNS(null, 'transform', 'translate(8.0, 8.0)');\n\n const circle1 = DOM.createNS('http://www.w3.org/2000/svg', 'circle');\n circle1.setAttributeNS(null, 'fill', '#000000');\n circle1.setAttributeNS(null, 'opacity', '0.25');\n circle1.setAttributeNS(null, 'cx', '5.5');\n circle1.setAttributeNS(null, 'cy', '5.5');\n circle1.setAttributeNS(null, 'r', '5.4999962');\n\n const circle2 = DOM.createNS('http://www.w3.org/2000/svg', 'circle');\n circle2.setAttributeNS(null, 'fill', '#FFFFFF');\n circle2.setAttributeNS(null, 'cx', '5.5');\n circle2.setAttributeNS(null, 'cy', '5.5');\n circle2.setAttributeNS(null, 'r', '5.4999962');\n\n circleContainer.appendChild(circle1);\n circleContainer.appendChild(circle2);\n\n page1.appendChild(shadow);\n page1.appendChild(background);\n page1.appendChild(border);\n page1.appendChild(maki);\n page1.appendChild(circleContainer);\n\n svg.appendChild(page1);\n\n svg.setAttributeNS(null, 'height', `${defaultHeight * this._scale}px`);\n svg.setAttributeNS(null, 'width', `${defaultWidth * this._scale}px`);\n\n this._element.appendChild(svg);\n\n // if no element and no offset option given apply an offset for the default marker\n // the -14 as the y value of the default marker offset was determined as follows\n //\n // the marker tip is at the center of the shadow ellipse from the default svg\n // the y value of the center of the shadow ellipse relative to the svg top left is \"shadow transform translate-y (29.0) + ellipse cy (5.80029008)\"\n // offset to the svg center \"height (41 / 2)\" gives (29.0 + 5.80029008) - (41 / 2) and rounded for an integer pixel offset gives 14\n // negative is used to move the marker up from the center so the tip is at the Marker lngLat\n this._offset = Point.convert(options && options.offset || [0, -14]);\n } else {\n this._element = options.element;\n this._offset = Point.convert(options && options.offset || [0, 0]);\n }\n\n this._element.classList.add('maplibregl-marker', 'mapboxgl-marker');\n this._element.addEventListener('dragstart', (e: DragEvent) => {\n e.preventDefault();\n });\n this._element.addEventListener('mousedown', (e: MouseEvent) => {\n // prevent focusing on click\n e.preventDefault();\n });\n applyAnchorClass(this._element, this._anchor, 'marker');\n\n this._popup = null;\n }\n\n /**\n * Attaches the `Marker` to a `Map` object.\n * @param {Map} map The Mapbox GL JS map to add the marker to.\n * @returns {Marker} `this`\n * @example\n * var marker = new maplibregl.Marker()\n * .setLngLat([30.5, 50.5])\n * .addTo(map); // add the marker to the map\n */\n addTo(map: Map) {\n this.remove();\n this._map = map;\n map.getCanvasContainer().appendChild(this._element);\n map.on('move', this._update);\n map.on('moveend', this._update);\n this.setDraggable(this._draggable);\n this._update();\n\n // If we attached the `click` listener to the marker element, the popup\n // would close once the event propogated to `map` due to the\n // `Popup#_onClickClose` listener.\n this._map.on('click', this._onMapClick);\n\n return this;\n }\n\n /**\n * Removes the marker from a map\n * @example\n * var marker = new maplibregl.Marker().addTo(map);\n * marker.remove();\n * @returns {Marker} `this`\n */\n remove() {\n if (this._map) {\n this._map.off('click', this._onMapClick);\n this._map.off('move', this._update);\n this._map.off('moveend', this._update);\n this._map.off('mousedown', this._addDragHandler);\n this._map.off('touchstart', this._addDragHandler);\n this._map.off('mouseup', this._onUp);\n this._map.off('touchend', this._onUp);\n this._map.off('mousemove', this._onMove);\n this._map.off('touchmove', this._onMove);\n delete this._map;\n }\n DOM.remove(this._element);\n if (this._popup) this._popup.remove();\n return this;\n }\n\n /**\n * Get the marker's geographical location.\n *\n * The longitude of the result may differ by a multiple of 360 degrees from the longitude previously\n * set by `setLngLat` because `Marker` wraps the anchor longitude across copies of the world to keep\n * the marker on screen.\n *\n * @returns {LngLat} A {@link LngLat} describing the marker's location.\n * @example\n * // Store the marker's longitude and latitude coordinates in a variable\n * var lngLat = marker.getLngLat();\n * // Print the marker's longitude and latitude values in the console\n * console.log('Longitude: ' + lngLat.lng + ', Latitude: ' + lngLat.lat )\n * @see [Create a draggable Marker](https://maplibre.org/maplibre-gl-js-docs/example/drag-a-marker/)\n */\n getLngLat() {\n return this._lngLat;\n }\n\n /**\n * Set the marker's geographical position and move it.\n * @param {LngLat} lnglat A {@link LngLat} describing where the marker should be located.\n * @returns {Marker} `this`\n * @example\n * // Create a new marker, set the longitude and latitude, and add it to the map\n * new maplibregl.Marker()\n * .setLngLat([-65.017, -16.457])\n * .addTo(map);\n * @see [Add custom icons with Markers](https://maplibre.org/maplibre-gl-js-docs/example/custom-marker-icons/)\n * @see [Create a draggable Marker](https://maplibre.org/maplibre-gl-js-docs/example/drag-a-marker/)\n */\n setLngLat(lnglat: LngLatLike) {\n this._lngLat = LngLat.convert(lnglat);\n this._pos = null;\n if (this._popup) this._popup.setLngLat(this._lngLat);\n this._update();\n return this;\n }\n\n /**\n * Returns the `Marker`'s HTML element.\n * @returns {HTMLElement} element\n */\n getElement() {\n return this._element;\n }\n\n /**\n * Binds a {@link Popup} to the {@link Marker}.\n * @param popup An instance of the {@link Popup} class. If undefined or null, any popup\n * set on this {@link Marker} instance is unset.\n * @returns {Marker} `this`\n * @example\n * var marker = new maplibregl.Marker()\n * .setLngLat([0, 0])\n * .setPopup(new maplibregl.Popup().setHTML(\"

Hello World!

\")) // add popup\n * .addTo(map);\n * @see [Attach a popup to a marker instance](https://maplibre.org/maplibre-gl-js-docs/example/set-popup/)\n */\n setPopup(popup: ?Popup) {\n if (this._popup) {\n this._popup.remove();\n this._popup = null;\n this._element.removeEventListener('keypress', this._onKeyPress);\n\n if (!this._originalTabIndex) {\n this._element.removeAttribute('tabindex');\n }\n }\n\n if (popup) {\n if (!('offset' in popup.options)) {\n const markerHeight = 41 - (5.8 / 2);\n const markerRadius = 13.5;\n const linearOffset = Math.sqrt(Math.pow(markerRadius, 2) / 2);\n popup.options.offset = this._defaultMarker ? {\n 'top': [0, 0],\n 'top-left': [0, 0],\n 'top-right': [0, 0],\n 'bottom': [0, -markerHeight],\n 'bottom-left': [linearOffset, (markerHeight - markerRadius + linearOffset) * -1],\n 'bottom-right': [-linearOffset, (markerHeight - markerRadius + linearOffset) * -1],\n 'left': [markerRadius, (markerHeight - markerRadius) * -1],\n 'right': [-markerRadius, (markerHeight - markerRadius) * -1]\n } : this._offset;\n }\n this._popup = popup;\n if (this._lngLat) this._popup.setLngLat(this._lngLat);\n\n this._originalTabIndex = this._element.getAttribute('tabindex');\n if (!this._originalTabIndex) {\n this._element.setAttribute('tabindex', '0');\n }\n this._element.addEventListener('keypress', this._onKeyPress);\n }\n\n return this;\n }\n\n _onKeyPress(e: KeyboardEvent) {\n const code = e.code;\n const legacyCode = e.charCode || e.keyCode;\n\n if (\n (code === 'Space') || (code === 'Enter') ||\n (legacyCode === 32) || (legacyCode === 13) // space or enter\n ) {\n this.togglePopup();\n }\n }\n\n _onMapClick(e: MapMouseEvent) {\n const targetElement = e.originalEvent.target;\n const element = this._element;\n\n if (this._popup && (targetElement === element || element.contains((targetElement: any)))) {\n this.togglePopup();\n }\n }\n\n /**\n * Returns the {@link Popup} instance that is bound to the {@link Marker}.\n * @returns {Popup} popup\n * @example\n * var marker = new maplibregl.Marker()\n * .setLngLat([0, 0])\n * .setPopup(new maplibregl.Popup().setHTML(\"

Hello World!

\"))\n * .addTo(map);\n *\n * console.log(marker.getPopup()); // return the popup instance\n */\n getPopup() {\n return this._popup;\n }\n\n /**\n * Opens or closes the {@link Popup} instance that is bound to the {@link Marker}, depending on the current state of the {@link Popup}.\n * @returns {Marker} `this`\n * @example\n * var marker = new maplibregl.Marker()\n * .setLngLat([0, 0])\n * .setPopup(new maplibregl.Popup().setHTML(\"

Hello World!

\"))\n * .addTo(map);\n *\n * marker.togglePopup(); // toggle popup open or closed\n */\n togglePopup() {\n const popup = this._popup;\n\n if (!popup) return this;\n else if (popup.isOpen()) popup.remove();\n else popup.addTo(this._map);\n return this;\n }\n\n _update(e?: {type: 'move' | 'moveend'}) {\n if (!this._map) return;\n\n if (this._map.transform.renderWorldCopies) {\n this._lngLat = smartWrap(this._lngLat, this._pos, this._map.transform);\n }\n\n this._pos = this._map.project(this._lngLat)._add(this._offset);\n\n let rotation = \"\";\n if (this._rotationAlignment === \"viewport\" || this._rotationAlignment === \"auto\") {\n rotation = `rotateZ(${this._rotation}deg)`;\n } else if (this._rotationAlignment === \"map\") {\n rotation = `rotateZ(${this._rotation - this._map.getBearing()}deg)`;\n }\n\n let pitch = \"\";\n if (this._pitchAlignment === \"viewport\" || this._pitchAlignment === \"auto\") {\n pitch = \"rotateX(0deg)\";\n } else if (this._pitchAlignment === \"map\") {\n pitch = `rotateX(${this._map.getPitch()}deg)`;\n }\n\n // because rounding the coordinates at every `move` event causes stuttered zooming\n // we only round them when _update is called with `moveend` or when its called with\n // no arguments (when the Marker is initialized or Marker#setLngLat is invoked).\n if (!e || e.type === \"moveend\") {\n this._pos = this._pos.round();\n }\n\n DOM.setTransform(this._element, `${anchorTranslate[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${pitch} ${rotation}`);\n }\n\n /**\n * Get the marker's offset.\n * @returns {Point} The marker's screen coordinates in pixels.\n */\n getOffset() {\n return this._offset;\n }\n\n /**\n * Sets the offset of the marker\n * @param {PointLike} offset The offset in pixels as a {@link PointLike} object to apply relative to the element's center. Negatives indicate left and up.\n * @returns {Marker} `this`\n */\n setOffset(offset: PointLike) {\n this._offset = Point.convert(offset);\n this._update();\n return this;\n }\n\n _onMove(e: MapMouseEvent | MapTouchEvent) {\n if (!this._isDragging) {\n const clickTolerance = this._clickTolerance || this._map._clickTolerance;\n this._isDragging = e.point.dist(this._pointerdownPos) >= clickTolerance;\n }\n if (!this._isDragging) return;\n\n this._pos = e.point.sub(this._positionDelta);\n this._lngLat = this._map.unproject(this._pos);\n this.setLngLat(this._lngLat);\n // suppress click event so that popups don't toggle on drag\n this._element.style.pointerEvents = 'none';\n\n // make sure dragstart only fires on the first move event after mousedown.\n // this can't be on mousedown because that event doesn't necessarily\n // imply that a drag is about to happen.\n if (this._state === 'pending') {\n this._state = 'active';\n\n /**\n * Fired when dragging starts\n *\n * @event dragstart\n * @memberof Marker\n * @instance\n * @type {Object}\n * @property {Marker} marker object that is being dragged\n */\n this.fire(new Event('dragstart'));\n }\n\n /**\n * Fired while dragging\n *\n * @event drag\n * @memberof Marker\n * @instance\n * @type {Object}\n * @property {Marker} marker object that is being dragged\n */\n this.fire(new Event('drag'));\n }\n\n _onUp() {\n // revert to normal pointer event handling\n this._element.style.pointerEvents = 'auto';\n this._positionDelta = null;\n this._pointerdownPos = null;\n this._isDragging = false;\n this._map.off('mousemove', this._onMove);\n this._map.off('touchmove', this._onMove);\n\n // only fire dragend if it was preceded by at least one drag event\n if (this._state === 'active') {\n /**\n * Fired when the marker is finished being dragged\n *\n * @event dragend\n * @memberof Marker\n * @instance\n * @type {Object}\n * @property {Marker} marker object that was dragged\n */\n this.fire(new Event('dragend'));\n }\n\n this._state = 'inactive';\n }\n\n _addDragHandler(e: MapMouseEvent | MapTouchEvent) {\n if (this._element.contains((e.originalEvent.target: any))) {\n e.preventDefault();\n\n // We need to calculate the pixel distance between the click point\n // and the marker position, with the offset accounted for. Then we\n // can subtract this distance from the mousemove event's position\n // to calculate the new marker position.\n // If we don't do this, the marker 'jumps' to the click position\n // creating a jarring UX effect.\n this._positionDelta = e.point.sub(this._pos).add(this._offset);\n\n this._pointerdownPos = e.point;\n\n this._state = 'pending';\n this._map.on('mousemove', this._onMove);\n this._map.on('touchmove', this._onMove);\n this._map.once('mouseup', this._onUp);\n this._map.once('touchend', this._onUp);\n }\n }\n\n /**\n * Sets the `draggable` property and functionality of the marker\n * @param {boolean} [shouldBeDraggable=false] Turns drag functionality on/off\n * @returns {Marker} `this`\n */\n setDraggable(shouldBeDraggable: boolean) {\n this._draggable = !!shouldBeDraggable; // convert possible undefined value to false\n\n // handle case where map may not exist yet\n // e.g. when setDraggable is called before addTo\n if (this._map) {\n if (shouldBeDraggable) {\n this._map.on('mousedown', this._addDragHandler);\n this._map.on('touchstart', this._addDragHandler);\n } else {\n this._map.off('mousedown', this._addDragHandler);\n this._map.off('touchstart', this._addDragHandler);\n }\n }\n\n return this;\n }\n\n /**\n * Returns true if the marker can be dragged\n * @returns {boolean} True if the marker is draggable.\n */\n isDraggable() {\n return this._draggable;\n }\n\n /**\n * Sets the `rotation` property of the marker.\n * @param {number} [rotation=0] The rotation angle of the marker (clockwise, in degrees), relative to its respective {@link Marker#setRotationAlignment} setting.\n * @returns {Marker} `this`\n */\n setRotation(rotation: number) {\n this._rotation = rotation || 0;\n this._update();\n return this;\n }\n\n /**\n * Returns the current rotation angle of the marker (in degrees).\n * @returns {number} The current rotation angle of the marker.\n */\n getRotation() {\n return this._rotation;\n }\n\n /**\n * Sets the `rotationAlignment` property of the marker.\n * @param {string} [alignment='auto'] Sets the `rotationAlignment` property of the marker.\n * @returns {Marker} `this`\n */\n setRotationAlignment(alignment: string) {\n this._rotationAlignment = alignment || 'auto';\n this._update();\n return this;\n }\n\n /**\n * Returns the current `rotationAlignment` property of the marker.\n * @returns {string} The current rotational alignment of the marker.\n */\n getRotationAlignment() {\n return this._rotationAlignment;\n }\n\n /**\n * Sets the `pitchAlignment` property of the marker.\n * @param {string} [alignment] Sets the `pitchAlignment` property of the marker. If alignment is 'auto', it will automatically match `rotationAlignment`.\n * @returns {Marker} `this`\n */\n setPitchAlignment(alignment: string) {\n this._pitchAlignment = alignment && alignment !== 'auto' ? alignment : this._rotationAlignment;\n this._update();\n return this;\n }\n\n /**\n * Returns the current `pitchAlignment` property of the marker.\n * @returns {string} The current pitch alignment of the marker in degrees.\n */\n getPitchAlignment() {\n return this._pitchAlignment;\n }\n}\n","// @flow\n\nimport {Event, Evented} from '../../util/evented';\nimport DOM from '../../util/dom';\nimport window from '../../util/window';\nimport {extend, bindAll, warnOnce} from '../../util/util';\nimport assert from 'assert';\nimport LngLat from '../../geo/lng_lat';\nimport Marker from '../marker';\n\nimport type Map from '../map';\nimport type {AnimationOptions, CameraOptions} from '../camera';\n\ntype Options = {\n positionOptions?: PositionOptions,\n fitBoundsOptions?: AnimationOptions & CameraOptions,\n trackUserLocation?: boolean,\n showAccuracyCircle?: boolean,\n showUserLocation?: boolean\n};\n\nconst defaultOptions: Options = {\n positionOptions: {\n enableHighAccuracy: false,\n maximumAge: 0,\n timeout: 6000 /* 6 sec */\n },\n fitBoundsOptions: {\n maxZoom: 15\n },\n trackUserLocation: false,\n showAccuracyCircle: true,\n showUserLocation: true\n};\n\nlet supportsGeolocation;\n\nfunction checkGeolocationSupport(callback) {\n if (supportsGeolocation !== undefined) {\n callback(supportsGeolocation);\n\n } else if (window.navigator.permissions !== undefined) {\n // navigator.permissions has incomplete browser support\n // http://caniuse.com/#feat=permissions-api\n // Test for the case where a browser disables Geolocation because of an\n // insecure origin\n window.navigator.permissions.query({name: 'geolocation'}).then((p) => {\n supportsGeolocation = p.state !== 'denied';\n callback(supportsGeolocation);\n });\n\n } else {\n supportsGeolocation = !!window.navigator.geolocation;\n callback(supportsGeolocation);\n }\n}\n\nlet numberOfWatches = 0;\nlet noTimeout = false;\n\n/**\n * A `GeolocateControl` control provides a button that uses the browser's geolocation\n * API to locate the user on the map.\n *\n * Not all browsers support geolocation,\n * and some users may disable the feature. Geolocation support for modern\n * browsers including Chrome requires sites to be served over HTTPS. If\n * geolocation support is not available, the GeolocateControl will show\n * as disabled.\n *\n * The zoom level applied will depend on the accuracy of the geolocation provided by the device.\n *\n * The GeolocateControl has two modes. If `trackUserLocation` is `false` (default) the control acts as a button, which when pressed will set the map's camera to target the user location. If the user moves, the map won't update. This is most suited for the desktop. If `trackUserLocation` is `true` the control acts as a toggle button that when active the user's location is actively monitored for changes. In this mode the GeolocateControl has three interaction states:\n * * active - the map's camera automatically updates as the user's location changes, keeping the location dot in the center. Initial state and upon clicking the `GeolocateControl` button.\n * * passive - the user's location dot automatically updates, but the map's camera does not. Occurs upon the user initiating a map movement.\n * * disabled - occurs if Geolocation is not available, disabled or denied.\n *\n * These interaction states can't be controlled programmatically, rather they are set based on user interactions.\n *\n * @implements {IControl}\n * @param {Object} [options]\n * @param {Object} [options.positionOptions={enableHighAccuracy: false, timeout: 6000}] A Geolocation API [PositionOptions](https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions) object.\n * @param {Object} [options.fitBoundsOptions={maxZoom: 15}] A {@link Map#fitBounds} options object to use when the map is panned and zoomed to the user's location. The default is to use a `maxZoom` of 15 to limit how far the map will zoom in for very accurate locations.\n * @param {Object} [options.trackUserLocation=false] If `true` the Geolocate Control becomes a toggle button and when active the map will receive updates to the user's location as it changes.\n * @param {Object} [options.showAccuracyCircle=true] By default, if showUserLocation is `true`, a transparent circle will be drawn around the user location indicating the accuracy (95% confidence level) of the user's location. Set to `false` to disable. Always disabled when showUserLocation is `false`.\n * @param {Object} [options.showUserLocation=true] By default a dot will be shown on the map at the user's location. Set to `false` to disable.\n *\n * @example\n * map.addControl(new maplibregl.GeolocateControl({\n * positionOptions: {\n * enableHighAccuracy: true\n * },\n * trackUserLocation: true\n * }));\n * @see [Locate the user](https://maplibre.org/maplibre-gl-js-docs/example/locate-user/)\n */\nclass GeolocateControl extends Evented {\n _map: Map;\n options: Options;\n _container: HTMLElement;\n _dotElement: HTMLElement;\n _circleElement: HTMLElement;\n _geolocateButton: HTMLButtonElement;\n _geolocationWatchID: number;\n _timeoutId: ?TimeoutID;\n _watchState: 'OFF' | 'ACTIVE_LOCK' | 'WAITING_ACTIVE' | 'ACTIVE_ERROR' | 'BACKGROUND' | 'BACKGROUND_ERROR';\n _lastKnownPosition: any;\n _userLocationDotMarker: Marker;\n _accuracyCircleMarker: Marker;\n _accuracy: number;\n _setup: boolean; // set to true once the control has been setup\n\n constructor(options: Options) {\n super();\n this.options = extend({}, defaultOptions, options);\n\n bindAll([\n '_onSuccess',\n '_onError',\n '_onZoom',\n '_finish',\n '_setupUI',\n '_updateCamera',\n '_updateMarker'\n ], this);\n }\n\n onAdd(map: Map) {\n this._map = map;\n this._container = DOM.create('div', `maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group`);\n checkGeolocationSupport(this._setupUI);\n return this._container;\n }\n\n onRemove() {\n // clear the geolocation watch if exists\n if (this._geolocationWatchID !== undefined) {\n window.navigator.geolocation.clearWatch(this._geolocationWatchID);\n this._geolocationWatchID = (undefined: any);\n }\n\n // clear the markers from the map\n if (this.options.showUserLocation && this._userLocationDotMarker) {\n this._userLocationDotMarker.remove();\n }\n if (this.options.showAccuracyCircle && this._accuracyCircleMarker) {\n this._accuracyCircleMarker.remove();\n }\n\n DOM.remove(this._container);\n this._map.off('zoom', this._onZoom);\n this._map = (undefined: any);\n numberOfWatches = 0;\n noTimeout = false;\n }\n\n /**\n * Check if the Geolocation API Position is outside the map's maxbounds.\n *\n * @param {Position} position the Geolocation API Position\n * @returns {boolean} Returns `true` if position is outside the map's maxbounds, otherwise returns `false`.\n * @private\n */\n _isOutOfMapMaxBounds(position: Position) {\n const bounds = this._map.getMaxBounds();\n const coordinates = position.coords;\n\n return bounds && (\n coordinates.longitude < bounds.getWest() ||\n coordinates.longitude > bounds.getEast() ||\n coordinates.latitude < bounds.getSouth() ||\n coordinates.latitude > bounds.getNorth()\n );\n }\n\n _setErrorState() {\n switch (this._watchState) {\n case 'WAITING_ACTIVE':\n this._watchState = 'ACTIVE_ERROR';\n this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-active', 'mapboxgl-ctrl-geolocate-active');\n this._geolocateButton.classList.add('maplibregl-ctrl-geolocate-active-error', 'mapboxgl-ctrl-geolocate-active-error');\n break;\n case 'ACTIVE_LOCK':\n this._watchState = 'ACTIVE_ERROR';\n this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-active', 'mapboxgl-ctrl-geolocate-active');\n this._geolocateButton.classList.add('maplibregl-ctrl-geolocate-active-error', 'mapboxgl-ctrl-geolocate-active-error');\n this._geolocateButton.classList.add('maplibregl-ctrl-geolocate-waiting', 'mapboxgl-ctrl-geolocate-waiting');\n // turn marker grey\n break;\n case 'BACKGROUND':\n this._watchState = 'BACKGROUND_ERROR';\n this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-background', 'mapboxgl-ctrl-geolocate-background');\n this._geolocateButton.classList.add('maplibregl-ctrl-geolocate-background-error', 'mapboxgl-ctrl-geolocate-background-error');\n this._geolocateButton.classList.add('maplibregl-ctrl-geolocate-waiting', 'mapboxgl-ctrl-geolocate-waiting');\n // turn marker grey\n break;\n case 'ACTIVE_ERROR':\n break;\n default:\n assert(false, `Unexpected watchState ${this._watchState}`);\n }\n }\n\n /**\n * When the Geolocation API returns a new location, update the GeolocateControl.\n *\n * @param {Position} position the Geolocation API Position\n * @private\n */\n _onSuccess(position: Position) {\n if (!this._map) {\n // control has since been removed\n return;\n }\n\n if (this._isOutOfMapMaxBounds(position)) {\n this._setErrorState();\n\n this.fire(new Event('outofmaxbounds', position));\n this._updateMarker();\n this._finish();\n\n return;\n }\n\n if (this.options.trackUserLocation) {\n // keep a record of the position so that if the state is BACKGROUND and the user\n // clicks the button, we can move to ACTIVE_LOCK immediately without waiting for\n // watchPosition to trigger _onSuccess\n this._lastKnownPosition = position;\n\n switch (this._watchState) {\n case 'WAITING_ACTIVE':\n case 'ACTIVE_LOCK':\n case 'ACTIVE_ERROR':\n this._watchState = 'ACTIVE_LOCK';\n this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-waiting', 'mapboxgl-ctrl-geolocate-waiting');\n this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-active-error', 'mapboxgl-ctrl-geolocate-active-error');\n this._geolocateButton.classList.add('maplibregl-ctrl-geolocate-active', 'mapboxgl-ctrl-geolocate-active');\n break;\n case 'BACKGROUND':\n case 'BACKGROUND_ERROR':\n this._watchState = 'BACKGROUND';\n this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-waiting', 'mapboxgl-ctrl-geolocate-waiting');\n this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-background-error', 'mapboxgl-ctrl-geolocate-background-error');\n this._geolocateButton.classList.add('maplibregl-ctrl-geolocate-background', 'mapboxgl-ctrl-geolocate-background');\n break;\n default:\n assert(false, `Unexpected watchState ${this._watchState}`);\n }\n }\n\n // if showUserLocation and the watch state isn't off then update the marker location\n if (this.options.showUserLocation && this._watchState !== 'OFF') {\n this._updateMarker(position);\n }\n\n // if in normal mode (not watch mode), or if in watch mode and the state is active watch\n // then update the camera\n if (!this.options.trackUserLocation || this._watchState === 'ACTIVE_LOCK') {\n this._updateCamera(position);\n }\n\n if (this.options.showUserLocation) {\n this._dotElement.classList.remove('maplibregl-user-location-dot-stale', 'mapboxgl-user-location-dot-stale');\n }\n\n this.fire(new Event('geolocate', position));\n this._finish();\n }\n\n /**\n * Update the camera location to center on the current position\n *\n * @param {Position} position the Geolocation API Position\n * @private\n */\n _updateCamera(position: Position) {\n const center = new LngLat(position.coords.longitude, position.coords.latitude);\n const radius = position.coords.accuracy;\n const bearing = this._map.getBearing();\n const options = extend({bearing}, this.options.fitBoundsOptions);\n\n this._map.fitBounds(center.toBounds(radius), options, {\n geolocateSource: true // tag this camera change so it won't cause the control to change to background state\n });\n }\n\n /**\n * Update the user location dot Marker to the current position\n *\n * @param {Position} [position] the Geolocation API Position\n * @private\n */\n _updateMarker(position: ?Position) {\n if (position) {\n const center = new LngLat(position.coords.longitude, position.coords.latitude);\n this._accuracyCircleMarker.setLngLat(center).addTo(this._map);\n this._userLocationDotMarker.setLngLat(center).addTo(this._map);\n this._accuracy = position.coords.accuracy;\n if (this.options.showUserLocation && this.options.showAccuracyCircle) {\n this._updateCircleRadius();\n }\n } else {\n this._userLocationDotMarker.remove();\n this._accuracyCircleMarker.remove();\n }\n }\n\n _updateCircleRadius() {\n assert(this._circleElement);\n const y = this._map._container.clientHeight / 2;\n const a = this._map.unproject([0, y]);\n const b = this._map.unproject([1, y]);\n const metersPerPixel = a.distanceTo(b);\n const circleDiameter = Math.ceil(2.0 * this._accuracy / metersPerPixel);\n this._circleElement.style.width = `${circleDiameter}px`;\n this._circleElement.style.height = `${circleDiameter}px`;\n }\n\n _onZoom() {\n if (this.options.showUserLocation && this.options.showAccuracyCircle) {\n this._updateCircleRadius();\n }\n }\n\n _onError(error: PositionError) {\n if (!this._map) {\n // control has since been removed\n return;\n }\n\n if (this.options.trackUserLocation) {\n if (error.code === 1) {\n // PERMISSION_DENIED\n this._watchState = 'OFF';\n this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-waiting', 'mapboxgl-ctrl-geolocate-waiting');\n this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-active', 'mapboxgl-ctrl-geolocate-active');\n this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-active-error', 'mapboxgl-ctrl-geolocate-active-error');\n this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-background', 'mapboxgl-ctrl-geolocate-background');\n this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-background-error', 'mapboxgl-ctrl-geolocate-background-error');\n this._geolocateButton.disabled = true;\n const title = this._map._getUIString('GeolocateControl.LocationNotAvailable');\n this._geolocateButton.title = title;\n this._geolocateButton.setAttribute('aria-label', title);\n\n if (this._geolocationWatchID !== undefined) {\n this._clearWatch();\n }\n } else if (error.code === 3 && noTimeout) {\n // this represents a forced error state\n // this was triggered to force immediate geolocation when a watch is already present\n // see https://github.com/mapbox/mapbox-gl-js/issues/8214\n // and https://w3c.github.io/geolocation-api/#example-5-forcing-the-user-agent-to-return-a-fresh-cached-position\n return;\n } else {\n this._setErrorState();\n }\n }\n\n if (this._watchState !== 'OFF' && this.options.showUserLocation) {\n this._dotElement.classList.add('maplibregl-user-location-dot-stale', 'mapboxgl-user-location-dot-stale');\n }\n\n this.fire(new Event('error', error));\n\n this._finish();\n }\n\n _finish() {\n if (this._timeoutId) { clearTimeout(this._timeoutId); }\n this._timeoutId = undefined;\n }\n\n _setupUI(supported: boolean) {\n this._container.addEventListener('contextmenu', (e: MouseEvent) => e.preventDefault());\n this._geolocateButton = DOM.create('button', `maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate`, this._container);\n DOM.create('span', `maplibregl-ctrl-icon mapboxgl-ctrl-icon`, this._geolocateButton).setAttribute('aria-hidden', true);\n this._geolocateButton.type = 'button';\n\n if (supported === false) {\n warnOnce('Geolocation support is not available so the GeolocateControl will be disabled.');\n const title = this._map._getUIString('GeolocateControl.LocationNotAvailable');\n this._geolocateButton.disabled = true;\n this._geolocateButton.title = title;\n this._geolocateButton.setAttribute('aria-label', title);\n } else {\n const title = this._map._getUIString('GeolocateControl.FindMyLocation');\n this._geolocateButton.title = title;\n this._geolocateButton.setAttribute('aria-label', title);\n }\n\n if (this.options.trackUserLocation) {\n this._geolocateButton.setAttribute('aria-pressed', 'false');\n this._watchState = 'OFF';\n }\n\n // when showUserLocation is enabled, keep the Geolocate button disabled until the device location marker is setup on the map\n if (this.options.showUserLocation) {\n this._dotElement = DOM.create('div', 'maplibregl-user-location-dot mapboxgl-user-location-dot');\n\n this._userLocationDotMarker = new Marker(this._dotElement);\n\n this._circleElement = DOM.create('div', 'maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle');\n this._accuracyCircleMarker = new Marker({element: this._circleElement, pitchAlignment: 'map'});\n\n if (this.options.trackUserLocation) this._watchState = 'OFF';\n\n this._map.on('zoom', this._onZoom);\n }\n\n this._geolocateButton.addEventListener('click',\n this.trigger.bind(this));\n\n this._setup = true;\n\n // when the camera is changed (and it's not as a result of the Geolocation Control) change\n // the watch mode to background watch, so that the marker is updated but not the camera.\n if (this.options.trackUserLocation) {\n this._map.on('movestart', (event) => {\n const fromResize = event.originalEvent && event.originalEvent.type === 'resize';\n if (!event.geolocateSource && this._watchState === 'ACTIVE_LOCK' && !fromResize) {\n this._watchState = 'BACKGROUND';\n this._geolocateButton.classList.add('maplibregl-ctrl-geolocate-background', 'mapboxgl-ctrl-geolocate-background');\n this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-active', 'mapboxgl-ctrl-geolocate-active');\n\n this.fire(new Event('trackuserlocationend'));\n }\n });\n }\n }\n\n /**\n * Programmatically request and move the map to the user's location.\n *\n * @returns {boolean} Returns `false` if called before control was added to a map, otherwise returns `true`.\n * @example\n * // Initialize the geolocate control.\n * var geolocate = new maplibregl.GeolocateControl({\n * positionOptions: {\n * enableHighAccuracy: true\n * },\n * trackUserLocation: true\n * });\n * // Add the control to the map.\n * map.addControl(geolocate);\n * map.on('load', function() {\n * geolocate.trigger();\n * });\n */\n trigger() {\n if (!this._setup) {\n warnOnce('Geolocate control triggered before added to a map');\n return false;\n }\n if (this.options.trackUserLocation) {\n // update watchState and do any outgoing state cleanup\n switch (this._watchState) {\n case 'OFF':\n // turn on the Geolocate Control\n this._watchState = 'WAITING_ACTIVE';\n\n this.fire(new Event('trackuserlocationstart'));\n break;\n case 'WAITING_ACTIVE':\n case 'ACTIVE_LOCK':\n case 'ACTIVE_ERROR':\n case 'BACKGROUND_ERROR':\n // turn off the Geolocate Control\n numberOfWatches--;\n noTimeout = false;\n this._watchState = 'OFF';\n this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-waiting', 'mapboxgl-ctrl-geolocate-waiting');\n this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-active', 'mapboxgl-ctrl-geolocate-active');\n this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-active-error', 'mapboxgl-ctrl-geolocate-active-error');\n this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-background', 'mapboxgl-ctrl-geolocate-background');\n this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-background-error', 'mapboxgl-ctrl-geolocate-background-error');\n\n this.fire(new Event('trackuserlocationend'));\n break;\n case 'BACKGROUND':\n this._watchState = 'ACTIVE_LOCK';\n this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-background', 'mapboxgl-ctrl-geolocate-background');\n // set camera to last known location\n if (this._lastKnownPosition) this._updateCamera(this._lastKnownPosition);\n\n this.fire(new Event('trackuserlocationstart'));\n break;\n default:\n assert(false, `Unexpected watchState ${this._watchState}`);\n }\n\n // incoming state setup\n switch (this._watchState) {\n case 'WAITING_ACTIVE':\n this._geolocateButton.classList.add('maplibregl-ctrl-geolocate-waiting', 'mapboxgl-ctrl-geolocate-waiting');\n this._geolocateButton.classList.add('maplibregl-ctrl-geolocate-active', 'mapboxgl-ctrl-geolocate-active');\n break;\n case 'ACTIVE_LOCK':\n this._geolocateButton.classList.add('maplibregl-ctrl-geolocate-active', 'mapboxgl-ctrl-geolocate-active');\n break;\n case 'ACTIVE_ERROR':\n this._geolocateButton.classList.add('maplibregl-ctrl-geolocate-waiting', 'mapboxgl-ctrl-geolocate-waiting');\n this._geolocateButton.classList.add('maplibregl-ctrl-geolocate-active-error', 'mapboxgl-ctrl-geolocate-active-error');\n break;\n case 'BACKGROUND':\n this._geolocateButton.classList.add('maplibregl-ctrl-geolocate-background', 'mapboxgl-ctrl-geolocate-background');\n break;\n case 'BACKGROUND_ERROR':\n this._geolocateButton.classList.add('maplibregl-ctrl-geolocate-waiting', 'mapboxgl-ctrl-geolocate-waiting');\n this._geolocateButton.classList.add('maplibregl-ctrl-geolocate-background-error', 'mapboxgl-ctrl-geolocate-background-error');\n break;\n case 'OFF':\n break;\n default:\n assert(false, `Unexpected watchState ${this._watchState}`);\n }\n\n // manage geolocation.watchPosition / geolocation.clearWatch\n if (this._watchState === 'OFF' && this._geolocationWatchID !== undefined) {\n // clear watchPosition as we've changed to an OFF state\n this._clearWatch();\n } else if (this._geolocationWatchID === undefined) {\n // enable watchPosition since watchState is not OFF and there is no watchPosition already running\n\n this._geolocateButton.classList.add('maplibregl-ctrl-geolocate-waiting', 'mapboxgl-ctrl-geolocate-waiting');\n this._geolocateButton.setAttribute('aria-pressed', 'true');\n\n numberOfWatches++;\n let positionOptions;\n if (numberOfWatches > 1) {\n positionOptions = {maximumAge:600000, timeout:0};\n noTimeout = true;\n } else {\n positionOptions = this.options.positionOptions;\n noTimeout = false;\n }\n\n this._geolocationWatchID = window.navigator.geolocation.watchPosition(\n this._onSuccess, this._onError, positionOptions);\n }\n } else {\n window.navigator.geolocation.getCurrentPosition(\n this._onSuccess, this._onError, this.options.positionOptions);\n\n // This timeout ensures that we still call finish() even if\n // the user declines to share their location in Firefox\n this._timeoutId = setTimeout(this._finish, 10000 /* 10sec */);\n }\n\n return true;\n }\n\n _clearWatch() {\n window.navigator.geolocation.clearWatch(this._geolocationWatchID);\n\n this._geolocationWatchID = (undefined: any);\n this._geolocateButton.classList.remove('maplibregl-ctrl-geolocate-waiting', 'mapboxgl-ctrl-geolocate-waiting');\n this._geolocateButton.setAttribute('aria-pressed', 'false');\n\n if (this.options.showUserLocation) {\n this._updateMarker(null);\n }\n }\n}\n\nexport default GeolocateControl;\n\n/* Geolocate Control Watch States\n * This is the private state of the control.\n *\n * OFF\n * off/inactive\n * WAITING_ACTIVE\n * Geolocate Control was clicked but still waiting for Geolocation API response with user location\n * ACTIVE_LOCK\n * Showing the user location as a dot AND tracking the camera to be fixed to their location. If their location changes the map moves to follow.\n * ACTIVE_ERROR\n * There was en error from the Geolocation API while trying to show and track the user location.\n * BACKGROUND\n * Showing the user location as a dot but the camera doesn't follow their location as it changes.\n * BACKGROUND_ERROR\n * There was an error from the Geolocation API while trying to show (but not track) the user location.\n */\n\n/**\n * Fired on each Geolocation API position update which returned as success.\n *\n * @event geolocate\n * @memberof GeolocateControl\n * @instance\n * @property {Position} data The returned [Position](https://developer.mozilla.org/en-US/docs/Web/API/Position) object from the callback in [Geolocation.getCurrentPosition()](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/getCurrentPosition) or [Geolocation.watchPosition()](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/watchPosition).\n * @example\n * // Initialize the geolocate control.\n * var geolocate = new maplibregl.GeolocateControl({\n * positionOptions: {\n * enableHighAccuracy: true\n * },\n * trackUserLocation: true\n * });\n * // Add the control to the map.\n * map.addControl(geolocate);\n * // Set an event listener that fires\n * // when a geolocate event occurs.\n * geolocate.on('geolocate', function() {\n * console.log('A geolocate event has occurred.')\n * });\n *\n */\n\n/**\n * Fired on each Geolocation API position update which returned as an error.\n *\n * @event error\n * @memberof GeolocateControl\n * @instance\n * @property {PositionError} data The returned [PositionError](https://developer.mozilla.org/en-US/docs/Web/API/PositionError) object from the callback in [Geolocation.getCurrentPosition()](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/getCurrentPosition) or [Geolocation.watchPosition()](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/watchPosition).\n * @example\n * // Initialize the geolocate control.\n * var geolocate = new maplibregl.GeolocateControl({\n * positionOptions: {\n * enableHighAccuracy: true\n * },\n * trackUserLocation: true\n * });\n * // Add the control to the map.\n * map.addControl(geolocate);\n * // Set an event listener that fires\n * // when an error event occurs.\n * geolocate.on('error', function() {\n * console.log('An error event has occurred.')\n * });\n *\n */\n\n/**\n * Fired on each Geolocation API position update which returned as success but user position is out of map maxBounds.\n *\n * @event outofmaxbounds\n * @memberof GeolocateControl\n * @instance\n * @property {Position} data The returned [Position](https://developer.mozilla.org/en-US/docs/Web/API/Position) object from the callback in [Geolocation.getCurrentPosition()](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/getCurrentPosition) or [Geolocation.watchPosition()](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/watchPosition).\n * @example\n * // Initialize the geolocate control.\n * var geolocate = new maplibregl.GeolocateControl({\n * positionOptions: {\n * enableHighAccuracy: true\n * },\n * trackUserLocation: true\n * });\n * // Add the control to the map.\n * map.addControl(geolocate);\n * // Set an event listener that fires\n * // when an outofmaxbounds event occurs.\n * geolocate.on('outofmaxbounds', function() {\n * console.log('An outofmaxbounds event has occurred.')\n * });\n *\n */\n\n/**\n * Fired when the Geolocate Control changes to the active lock state, which happens either upon first obtaining a successful Geolocation API position for the user (a geolocate event will follow), or the user clicks the geolocate button when in the background state which uses the last known position to recenter the map and enter active lock state (no geolocate event will follow unless the users's location changes).\n *\n * @event trackuserlocationstart\n * @memberof GeolocateControl\n * @instance\n * @example\n * // Initialize the geolocate control.\n * var geolocate = new maplibregl.GeolocateControl({\n * positionOptions: {\n * enableHighAccuracy: true\n * },\n * trackUserLocation: true\n * });\n * // Add the control to the map.\n * map.addControl(geolocate);\n * // Set an event listener that fires\n * // when a trackuserlocationstart event occurs.\n * geolocate.on('trackuserlocationstart', function() {\n * console.log('A trackuserlocationstart event has occurred.')\n * });\n *\n */\n\n/**\n * Fired when the Geolocate Control changes to the background state, which happens when a user changes the camera during an active position lock. This only applies when trackUserLocation is true. In the background state, the dot on the map will update with location updates but the camera will not.\n *\n * @event trackuserlocationend\n * @memberof GeolocateControl\n * @instance\n * @example\n * // Initialize the geolocate control.\n * var geolocate = new maplibregl.GeolocateControl({\n * positionOptions: {\n * enableHighAccuracy: true\n * },\n * trackUserLocation: true\n * });\n * // Add the control to the map.\n * map.addControl(geolocate);\n * // Set an event listener that fires\n * // when a trackuserlocationend event occurs.\n * geolocate.on('trackuserlocationend', function() {\n * console.log('A trackuserlocationend event has occurred.')\n * });\n *\n */\n","// @flow\n\nimport DOM from '../../util/dom';\nimport {extend, bindAll} from '../../util/util';\n\nimport type Map from '../map';\n\ntype Unit = 'imperial' | 'metric' | 'nautical';\n\ntype Options = {\n maxWidth?: number,\n unit?: Unit;\n};\n\nconst defaultOptions: Options = {\n maxWidth: 100,\n unit: 'metric'\n};\n\n/**\n * A `ScaleControl` control displays the ratio of a distance on the map to the corresponding distance on the ground.\n *\n * @implements {IControl}\n * @param {Object} [options]\n * @param {number} [options.maxWidth='100'] The maximum length of the scale control in pixels.\n * @param {string} [options.unit='metric'] Unit of the distance (`'imperial'`, `'metric'` or `'nautical'`).\n * @example\n * var scale = new maplibregl.ScaleControl({\n * maxWidth: 80,\n * unit: 'imperial'\n * });\n * map.addControl(scale);\n *\n * scale.setUnit('metric');\n */\nclass ScaleControl {\n _map: Map;\n _container: HTMLElement;\n options: Options;\n\n constructor(options: Options) {\n this.options = extend({}, defaultOptions, options);\n\n bindAll([\n '_onMove',\n 'setUnit'\n ], this);\n }\n\n getDefaultPosition() {\n return 'bottom-left';\n }\n\n _onMove() {\n updateScale(this._map, this._container, this.options);\n }\n\n onAdd(map: Map) {\n this._map = map;\n this._container = DOM.create('div', 'maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale', map.getContainer());\n\n this._map.on('move', this._onMove);\n this._onMove();\n\n return this._container;\n }\n\n onRemove() {\n DOM.remove(this._container);\n this._map.off('move', this._onMove);\n this._map = (undefined: any);\n }\n\n /**\n * Set the scale's unit of the distance\n *\n * @param unit Unit of the distance (`'imperial'`, `'metric'` or `'nautical'`).\n */\n setUnit(unit: Unit) {\n this.options.unit = unit;\n updateScale(this._map, this._container, this.options);\n }\n}\n\nexport default ScaleControl;\n\nfunction updateScale(map, container, options) {\n // A horizontal scale is imagined to be present at center of the map\n // container with maximum length (Default) as 100px.\n // Using spherical law of cosines approximation, the real distance is\n // found between the two coordinates.\n const maxWidth = options && options.maxWidth || 100;\n\n const y = map._container.clientHeight / 2;\n const left = map.unproject([0, y]);\n const right = map.unproject([maxWidth, y]);\n const maxMeters = left.distanceTo(right);\n // The real distance corresponding to 100px scale length is rounded off to\n // near pretty number and the scale length for the same is found out.\n // Default unit of the scale is based on User's locale.\n if (options && options.unit === 'imperial') {\n const maxFeet = 3.2808 * maxMeters;\n if (maxFeet > 5280) {\n const maxMiles = maxFeet / 5280;\n setScale(container, maxWidth, maxMiles, map._getUIString('ScaleControl.Miles'));\n } else {\n setScale(container, maxWidth, maxFeet, map._getUIString('ScaleControl.Feet'));\n }\n } else if (options && options.unit === 'nautical') {\n const maxNauticals = maxMeters / 1852;\n setScale(container, maxWidth, maxNauticals, map._getUIString('ScaleControl.NauticalMiles'));\n } else if (maxMeters >= 1000) {\n setScale(container, maxWidth, maxMeters / 1000, map._getUIString('ScaleControl.Kilometers'));\n } else {\n setScale(container, maxWidth, maxMeters, map._getUIString('ScaleControl.Meters'));\n }\n}\n\nfunction setScale(container, maxWidth, maxDistance, unit) {\n const distance = getRoundNum(maxDistance);\n const ratio = distance / maxDistance;\n container.style.width = `${maxWidth * ratio}px`;\n container.innerHTML = `${distance} ${unit}`;\n}\n\nfunction getDecimalRoundNum(d) {\n const multiplier = Math.pow(10, Math.ceil(-Math.log(d) / Math.LN10));\n return Math.round(d * multiplier) / multiplier;\n}\n\nfunction getRoundNum(num) {\n const pow10 = Math.pow(10, (`${Math.floor(num)}`).length - 1);\n let d = num / pow10;\n\n d = d >= 10 ? 10 :\n d >= 5 ? 5 :\n d >= 3 ? 3 :\n d >= 2 ? 2 :\n d >= 1 ? 1 : getDecimalRoundNum(d);\n\n return pow10 * d;\n}\n","// @flow\n\nimport DOM from '../../util/dom';\n\nimport {bindAll, warnOnce} from '../../util/util';\nimport window from '../../util/window';\n\nimport type Map from '../map';\n\ntype Options = {\n container?: HTMLElement\n};\n\n/**\n * A `FullscreenControl` control contains a button for toggling the map in and out of fullscreen mode.\n *\n * @implements {IControl}\n * @param {Object} [options]\n * @param {HTMLElement} [options.container] `container` is the [compatible DOM element](https://developer.mozilla.org/en-US/docs/Web/API/Element/requestFullScreen#Compatible_elements) which should be made full screen. By default, the map container element will be made full screen.\n *\n * @example\n * map.addControl(new maplibregl.FullscreenControl({container: document.querySelector('body')}));\n * @see [View a fullscreen map](https://maplibre.org/maplibre-gl-js-docs/example/fullscreen/)\n */\n\nclass FullscreenControl {\n _map: Map;\n _controlContainer: HTMLElement;\n _fullscreen: boolean;\n _fullscreenchange: string;\n _fullscreenButton: HTMLElement;\n _container: HTMLElement;\n\n constructor(options: Options) {\n this._fullscreen = false;\n if (options && options.container) {\n if (options.container instanceof window.HTMLElement) {\n this._container = options.container;\n } else {\n warnOnce('Full screen control \\'container\\' must be a DOM element.');\n }\n }\n bindAll([\n '_onClickFullscreen',\n '_changeIcon'\n ], this);\n if ('onfullscreenchange' in window.document) {\n this._fullscreenchange = 'fullscreenchange';\n } else if ('onmozfullscreenchange' in window.document) {\n this._fullscreenchange = 'mozfullscreenchange';\n } else if ('onwebkitfullscreenchange' in window.document) {\n this._fullscreenchange = 'webkitfullscreenchange';\n } else if ('onmsfullscreenchange' in window.document) {\n this._fullscreenchange = 'MSFullscreenChange';\n }\n }\n\n onAdd(map: Map) {\n this._map = map;\n if (!this._container) this._container = this._map.getContainer();\n this._controlContainer = DOM.create('div', `maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group`);\n if (this._checkFullscreenSupport()) {\n this._setupUI();\n } else {\n this._controlContainer.style.display = 'none';\n warnOnce('This device does not support fullscreen mode.');\n }\n return this._controlContainer;\n }\n\n onRemove() {\n DOM.remove(this._controlContainer);\n this._map = (null: any);\n window.document.removeEventListener(this._fullscreenchange, this._changeIcon);\n }\n\n _checkFullscreenSupport() {\n return !!(\n window.document.fullscreenEnabled ||\n (window.document: any).mozFullScreenEnabled ||\n (window.document: any).msFullscreenEnabled ||\n (window.document: any).webkitFullscreenEnabled\n );\n }\n\n _setupUI() {\n const button = this._fullscreenButton = DOM.create('button', (`maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen`), this._controlContainer);\n DOM.create('span', `maplibregl-ctrl-icon mapboxgl-ctrl-icon`, button).setAttribute('aria-hidden', true);\n button.type = 'button';\n this._updateTitle();\n this._fullscreenButton.addEventListener('click', this._onClickFullscreen);\n window.document.addEventListener(this._fullscreenchange, this._changeIcon);\n }\n\n _updateTitle() {\n const title = this._getTitle();\n this._fullscreenButton.setAttribute(\"aria-label\", title);\n this._fullscreenButton.title = title;\n }\n\n _getTitle() {\n return this._map._getUIString(this._isFullscreen() ? 'FullscreenControl.Exit' : 'FullscreenControl.Enter');\n }\n\n _isFullscreen() {\n return this._fullscreen;\n }\n\n _changeIcon() {\n const fullscreenElement =\n window.document.fullscreenElement ||\n (window.document: any).mozFullScreenElement ||\n (window.document: any).webkitFullscreenElement ||\n (window.document: any).msFullscreenElement;\n\n if ((fullscreenElement === this._container) !== this._fullscreen) {\n this._fullscreen = !this._fullscreen;\n this._fullscreenButton.classList.toggle(`maplibregl-ctrl-shrink`);\n this._fullscreenButton.classList.toggle(`mapboxgl-ctrl-shrink`);\n this._fullscreenButton.classList.toggle(`maplibregl-ctrl-fullscreen`);\n this._fullscreenButton.classList.toggle(`mapboxgl-ctrl-fullscreen`);\n this._updateTitle();\n }\n }\n\n _onClickFullscreen() {\n if (this._isFullscreen()) {\n if (window.document.exitFullscreen) {\n (window.document: any).exitFullscreen();\n } else if (window.document.mozCancelFullScreen) {\n (window.document: any).mozCancelFullScreen();\n } else if (window.document.msExitFullscreen) {\n (window.document: any).msExitFullscreen();\n } else if (window.document.webkitCancelFullScreen) {\n (window.document: any).webkitCancelFullScreen();\n }\n } else if (this._container.requestFullscreen) {\n this._container.requestFullscreen();\n } else if ((this._container: any).mozRequestFullScreen) {\n (this._container: any).mozRequestFullScreen();\n } else if ((this._container: any).msRequestFullscreen) {\n (this._container: any).msRequestFullscreen();\n } else if ((this._container: any).webkitRequestFullscreen) {\n (this._container: any).webkitRequestFullscreen();\n }\n }\n}\n\nexport default FullscreenControl;\n","// @flow\n\nimport {extend, bindAll} from '../util/util';\nimport {Event, Evented} from '../util/evented';\nimport {MapMouseEvent} from '../ui/events';\nimport DOM from '../util/dom';\nimport LngLat from '../geo/lng_lat';\nimport Point from '@mapbox/point-geometry';\nimport window from '../util/window';\nimport smartWrap from '../util/smart_wrap';\nimport {type Anchor, anchorTranslate, applyAnchorClass} from './anchor';\n\nimport type Map from './map';\nimport type {LngLatLike} from '../geo/lng_lat';\nimport type {PointLike} from '@mapbox/point-geometry';\n\nconst defaultOptions = {\n closeButton: true,\n closeOnClick: true,\n focusAfterOpen: true,\n className: '',\n maxWidth: \"240px\"\n};\n\nexport type Offset = number | PointLike | {[_: Anchor]: PointLike};\n\nexport type PopupOptions = {\n closeButton?: boolean,\n closeOnClick?: boolean,\n closeOnMove?: boolean,\n focusAfterOpen?: boolean,\n anchor?: Anchor,\n offset?: Offset,\n className?: string,\n maxWidth?: string\n};\n\nconst focusQuerySelector = [\n \"a[href]\",\n \"[tabindex]:not([tabindex='-1'])\",\n \"[contenteditable]:not([contenteditable='false'])\",\n \"button:not([disabled])\",\n \"input:not([disabled])\",\n \"select:not([disabled])\",\n \"textarea:not([disabled])\",\n].join(\", \");\n\n/**\n * A popup component.\n *\n * @param {Object} [options]\n * @param {boolean} [options.closeButton=true] If `true`, a close button will appear in the\n * top right corner of the popup.\n * @param {boolean} [options.closeOnClick=true] If `true`, the popup will closed when the\n * map is clicked.\n * @param {boolean} [options.closeOnMove=false] If `true`, the popup will closed when the\n * map moves.\n * @param {boolean} [options.focusAfterOpen=true] If `true`, the popup will try to focus the\n * first focusable element inside the popup.\n * @param {string} [options.anchor] - A string indicating the part of the Popup that should\n * be positioned closest to the coordinate set via {@link Popup#setLngLat}.\n * Options are `'center'`, `'top'`, `'bottom'`, `'left'`, `'right'`, `'top-left'`,\n * `'top-right'`, `'bottom-left'`, and `'bottom-right'`. If unset the anchor will be\n * dynamically set to ensure the popup falls within the map container with a preference\n * for `'bottom'`.\n * @param {number|PointLike|Object} [options.offset] -\n * A pixel offset applied to the popup's location specified as:\n * - a single number specifying a distance from the popup's location\n * - a {@link PointLike} specifying a constant offset\n * - an object of {@link Point}s specifing an offset for each anchor position\n * Negative offsets indicate left and up.\n * @param {string} [options.className] Space-separated CSS class names to add to popup container\n * @param {string} [options.maxWidth='240px'] -\n * A string that sets the CSS property of the popup's maximum width, eg `'300px'`.\n * To ensure the popup resizes to fit its content, set this property to `'none'`.\n * Available values can be found here: https://developer.mozilla.org/en-US/docs/Web/CSS/max-width\n * @example\n * var markerHeight = 50, markerRadius = 10, linearOffset = 25;\n * var popupOffsets = {\n * 'top': [0, 0],\n * 'top-left': [0,0],\n * 'top-right': [0,0],\n * 'bottom': [0, -markerHeight],\n * 'bottom-left': [linearOffset, (markerHeight - markerRadius + linearOffset) * -1],\n * 'bottom-right': [-linearOffset, (markerHeight - markerRadius + linearOffset) * -1],\n * 'left': [markerRadius, (markerHeight - markerRadius) * -1],\n * 'right': [-markerRadius, (markerHeight - markerRadius) * -1]\n * };\n * var popup = new maplibregl.Popup({offset: popupOffsets, className: 'my-class'})\n * .setLngLat(e.lngLat)\n * .setHTML(\"

Hello World!

\")\n * .setMaxWidth(\"300px\")\n * .addTo(map);\n * @see [Display a popup](https://maplibre.org/maplibre-gl-js-docs/example/popup/)\n * @see [Display a popup on hover](https://maplibre.org/maplibre-gl-js-docs/example/popup-on-hover/)\n * @see [Display a popup on click](https://maplibre.org/maplibre-gl-js-docs/example/popup-on-click/)\n * @see [Attach a popup to a marker instance](https://maplibre.org/maplibre-gl-js-docs/example/set-popup/)\n */\nexport default class Popup extends Evented {\n _map: Map;\n options: PopupOptions;\n _content: HTMLElement;\n _container: HTMLElement;\n _closeButton: HTMLElement;\n _tip: HTMLElement;\n _lngLat: LngLat;\n _trackPointer: boolean;\n _pos: ?Point;\n\n constructor(options: PopupOptions) {\n super();\n this.options = extend(Object.create(defaultOptions), options);\n bindAll(['_update', '_onClose', 'remove', '_onMouseMove', '_onMouseUp', '_onDrag'], this);\n }\n\n /**\n * Adds the popup to a map.\n *\n * @param {Map} map The Mapbox GL JS map to add the popup to.\n * @returns {Popup} `this`\n * @example\n * new maplibregl.Popup()\n * .setLngLat([0, 0])\n * .setHTML(\"

Null Island

\")\n * .addTo(map);\n * @see [Display a popup](https://maplibre.org/maplibre-gl-js-docs/example/popup/)\n * @see [Display a popup on hover](https://maplibre.org/maplibre-gl-js-docs/example/popup-on-hover/)\n * @see [Display a popup on click](https://maplibre.org/maplibre-gl-js-docs/example/popup-on-click/)\n * @see [Show polygon information on click](https://maplibre.org/maplibre-gl-js-docs/example/polygon-popup-on-click/)\n */\n addTo(map: Map) {\n if (this._map) this.remove();\n\n this._map = map;\n if (this.options.closeOnClick) {\n this._map.on('click', this._onClose);\n }\n\n if (this.options.closeOnMove) {\n this._map.on('move', this._onClose);\n }\n\n this._map.on('remove', this.remove);\n this._update();\n this._focusFirstElement();\n\n if (this._trackPointer) {\n this._map.on('mousemove', this._onMouseMove);\n this._map.on('mouseup', this._onMouseUp);\n if (this._container) {\n this._container.classList.add('maplibregl-popup-track-pointer', 'mapboxgl-popup-track-pointer');\n }\n this._map._canvasContainer.classList.add('maplibregl-track-pointer', 'mapboxgl-track-pointer');\n } else {\n this._map.on('move', this._update);\n }\n\n /**\n * Fired when the popup is opened manually or programatically.\n *\n * @event open\n * @memberof Popup\n * @instance\n * @type {Object}\n * @property {Popup} popup object that was opened\n *\n * @example\n * // Create a popup\n * var popup = new maplibregl.Popup();\n * // Set an event listener that will fire\n * // any time the popup is opened\n * popup.on('open', function(){\n * console.log('popup was opened');\n * });\n *\n */\n this.fire(new Event('open'));\n\n return this;\n }\n\n /**\n * @returns {boolean} `true` if the popup is open, `false` if it is closed.\n */\n isOpen() {\n return !!this._map;\n }\n\n /**\n * Removes the popup from the map it has been added to.\n *\n * @example\n * var popup = new maplibregl.Popup().addTo(map);\n * popup.remove();\n * @returns {Popup} `this`\n */\n remove() {\n if (this._content) {\n DOM.remove(this._content);\n }\n\n if (this._container) {\n DOM.remove(this._container);\n delete this._container;\n }\n\n if (this._map) {\n this._map.off('move', this._update);\n this._map.off('move', this._onClose);\n this._map.off('click', this._onClose);\n this._map.off('remove', this.remove);\n this._map.off('mousemove', this._onMouseMove);\n this._map.off('mouseup', this._onMouseUp);\n this._map.off('drag', this._onDrag);\n delete this._map;\n }\n\n /**\n * Fired when the popup is closed manually or programatically.\n *\n * @event close\n * @memberof Popup\n * @instance\n * @type {Object}\n * @property {Popup} popup object that was closed\n *\n * @example\n * // Create a popup\n * var popup = new maplibregl.Popup();\n * // Set an event listener that will fire\n * // any time the popup is closed\n * popup.on('close', function(){\n * console.log('popup was closed');\n * });\n *\n */\n this.fire(new Event('close'));\n\n return this;\n }\n\n /**\n * Returns the geographical location of the popup's anchor.\n *\n * The longitude of the result may differ by a multiple of 360 degrees from the longitude previously\n * set by `setLngLat` because `Popup` wraps the anchor longitude across copies of the world to keep\n * the popup on screen.\n *\n * @returns {LngLat} The geographical location of the popup's anchor.\n */\n getLngLat() {\n return this._lngLat;\n }\n\n /**\n * Sets the geographical location of the popup's anchor, and moves the popup to it. Replaces trackPointer() behavior.\n *\n * @param lnglat The geographical location to set as the popup's anchor.\n * @returns {Popup} `this`\n */\n setLngLat(lnglat: LngLatLike) {\n this._lngLat = LngLat.convert(lnglat);\n this._pos = null;\n\n this._trackPointer = false;\n\n this._update();\n\n if (this._map) {\n this._map.on('move', this._update);\n this._map.off('mousemove', this._onMouseMove);\n if (this._container) {\n this._container.classList.remove('maplibregl-popup-track-pointer', 'mapboxgl-popup-track-pointer');\n }\n this._map._canvasContainer.classList.remove('maplibregl-track-pointer', 'mapboxgl-track-pointer');\n }\n\n return this;\n }\n\n /**\n * Tracks the popup anchor to the cursor position on screens with a pointer device (it will be hidden on touchscreens). Replaces the `setLngLat` behavior.\n * For most use cases, set `closeOnClick` and `closeButton` to `false`.\n * @example\n * var popup = new maplibregl.Popup({ closeOnClick: false, closeButton: false })\n * .setHTML(\"

Hello World!

\")\n * .trackPointer()\n * .addTo(map);\n * @returns {Popup} `this`\n */\n trackPointer() {\n this._trackPointer = true;\n this._pos = null;\n this._update();\n if (this._map) {\n this._map.off('move', this._update);\n this._map.on('mousemove', this._onMouseMove);\n this._map.on('drag', this._onDrag);\n if (this._container) {\n this._container.classList.add('maplibregl-popup-track-pointer', 'mapboxgl-popup-track-pointer');\n }\n this._map._canvasContainer.classList.add('maplibregl-track-pointer', 'mapboxgl-track-pointer');\n }\n\n return this;\n\n }\n\n /**\n * Returns the `Popup`'s HTML element.\n * @example\n * // Change the `Popup` element's font size\n * var popup = new maplibregl.Popup()\n * .setLngLat([-96, 37.8])\n * .setHTML(\"

Hello World!

\")\n * .addTo(map);\n * var popupElem = popup.getElement();\n * popupElem.style.fontSize = \"25px\";\n * @returns {HTMLElement} element\n */\n getElement() {\n return this._container;\n }\n\n /**\n * Sets the popup's content to a string of text.\n *\n * This function creates a [Text](https://developer.mozilla.org/en-US/docs/Web/API/Text) node in the DOM,\n * so it cannot insert raw HTML. Use this method for security against XSS\n * if the popup content is user-provided.\n *\n * @param text Textual content for the popup.\n * @returns {Popup} `this`\n * @example\n * var popup = new maplibregl.Popup()\n * .setLngLat(e.lngLat)\n * .setText('Hello, world!')\n * .addTo(map);\n */\n setText(text: string) {\n return this.setDOMContent(window.document.createTextNode(text));\n }\n\n /**\n * Sets the popup's content to the HTML provided as a string.\n *\n * This method does not perform HTML filtering or sanitization, and must be\n * used only with trusted content. Consider {@link Popup#setText} if\n * the content is an untrusted text string.\n *\n * @param html A string representing HTML content for the popup.\n * @returns {Popup} `this`\n * @example\n * var popup = new maplibregl.Popup()\n * .setLngLat(e.lngLat)\n * .setHTML(\"

Hello World!

\")\n * .addTo(map);\n * @see [Display a popup](https://maplibre.org/maplibre-gl-js-docs/example/popup/)\n * @see [Display a popup on hover](https://maplibre.org/maplibre-gl-js-docs/example/popup-on-hover/)\n * @see [Display a popup on click](https://maplibre.org/maplibre-gl-js-docs/example/popup-on-click/)\n * @see [Attach a popup to a marker instance](https://maplibre.org/maplibre-gl-js-docs/example/set-popup/)\n */\n setHTML(html: string) {\n const frag = window.document.createDocumentFragment();\n const temp = window.document.createElement('body');\n let child;\n temp.innerHTML = html;\n while (true) {\n child = temp.firstChild;\n if (!child) break;\n frag.appendChild(child);\n }\n\n return this.setDOMContent(frag);\n }\n\n /**\n * Returns the popup's maximum width.\n *\n * @returns {string} The maximum width of the popup.\n */\n getMaxWidth() {\n return this._container && this._container.style.maxWidth;\n }\n\n /**\n * Sets the popup's maximum width. This is setting the CSS property `max-width`.\n * Available values can be found here: https://developer.mozilla.org/en-US/docs/Web/CSS/max-width\n *\n * @param maxWidth A string representing the value for the maximum width.\n * @returns {Popup} `this`\n */\n setMaxWidth(maxWidth: string) {\n this.options.maxWidth = maxWidth;\n this._update();\n return this;\n }\n\n /**\n * Sets the popup's content to the element provided as a DOM node.\n *\n * @param htmlNode A DOM node to be used as content for the popup.\n * @returns {Popup} `this`\n * @example\n * // create an element with the popup content\n * var div = window.document.createElement('div');\n * div.innerHTML = 'Hello, world!';\n * var popup = new maplibregl.Popup()\n * .setLngLat(e.lngLat)\n * .setDOMContent(div)\n * .addTo(map);\n */\n setDOMContent(htmlNode: Node) {\n if (this._content) {\n // Clear out children first.\n while (this._content.hasChildNodes()) {\n if (this._content.firstChild) {\n this._content.removeChild(this._content.firstChild);\n }\n }\n } else {\n this._content = DOM.create('div', 'maplibregl-popup-content mapboxgl-popup-content', this._container);\n }\n\n // The close button should be the last tabbable element inside the popup for a good keyboard UX.\n this._content.appendChild(htmlNode);\n this._createCloseButton();\n this._update();\n this._focusFirstElement();\n return this;\n }\n\n /**\n * Adds a CSS class to the popup container element.\n *\n * @param {string} className Non-empty string with CSS class name to add to popup container\n *\n * @example\n * let popup = new maplibregl.Popup()\n * popup.addClassName('some-class')\n */\n addClassName(className: string) {\n if (this._container) {\n this._container.classList.add(className);\n }\n }\n\n /**\n * Removes a CSS class from the popup container element.\n *\n * @param {string} className Non-empty string with CSS class name to remove from popup container\n *\n * @example\n * let popup = new maplibregl.Popup()\n * popup.removeClassName('some-class')\n */\n removeClassName(className: string) {\n if (this._container) {\n this._container.classList.remove(className);\n }\n }\n\n /**\n * Sets the popup's offset.\n *\n * @param offset Sets the popup's offset.\n * @returns {Popup} `this`\n */\n setOffset (offset?: Offset) {\n this.options.offset = offset;\n this._update();\n return this;\n }\n\n /**\n * Add or remove the given CSS class on the popup container, depending on whether the container currently has that class.\n *\n * @param {string} className Non-empty string with CSS class name to add/remove\n *\n * @returns {boolean} if the class was removed return false, if class was added, then return true\n *\n * @example\n * let popup = new maplibregl.Popup()\n * popup.toggleClassName('toggleClass')\n */\n toggleClassName(className: string) {\n if (this._container) {\n return this._container.classList.toggle(className);\n }\n }\n\n _createCloseButton() {\n if (this.options.closeButton) {\n this._closeButton = DOM.create('button', 'maplibregl-popup-close-button mapboxgl-popup-close-button', this._content);\n this._closeButton.type = 'button';\n this._closeButton.setAttribute('aria-label', 'Close popup');\n this._closeButton.innerHTML = '×';\n this._closeButton.addEventListener('click', this._onClose);\n }\n }\n\n _onMouseUp(event: MapMouseEvent) {\n this._update(event.point);\n }\n\n _onMouseMove(event: MapMouseEvent) {\n this._update(event.point);\n }\n\n _onDrag(event: MapMouseEvent) {\n this._update(event.point);\n }\n\n _update(cursor: ?PointLike) {\n const hasPosition = this._lngLat || this._trackPointer;\n\n if (!this._map || !hasPosition || !this._content) { return; }\n\n if (!this._container) {\n this._container = DOM.create('div', 'maplibregl-popup mapboxgl-popup', this._map.getContainer());\n this._tip = DOM.create('div', 'maplibregl-popup-tip mapboxgl-popup-tip', this._container);\n this._container.appendChild(this._content);\n if (this.options.className) {\n this.options.className.split(' ').forEach(name =>\n this._container.classList.add(name));\n }\n\n if (this._trackPointer) {\n this._container.classList.add('maplibregl-popup-track-pointer', 'mapboxgl-popup-track-pointer');\n }\n }\n\n if (this.options.maxWidth && this._container.style.maxWidth !== this.options.maxWidth) {\n this._container.style.maxWidth = this.options.maxWidth;\n }\n\n if (this._map.transform.renderWorldCopies && !this._trackPointer) {\n this._lngLat = smartWrap(this._lngLat, this._pos, this._map.transform);\n }\n\n if (this._trackPointer && !cursor) return;\n\n const pos = this._pos = this._trackPointer && cursor ? cursor : this._map.project(this._lngLat);\n\n let anchor: ?Anchor = this.options.anchor;\n const offset = normalizeOffset(this.options.offset);\n\n if (!anchor) {\n const width = this._container.offsetWidth;\n const height = this._container.offsetHeight;\n let anchorComponents;\n\n if (pos.y + offset.bottom.y < height) {\n anchorComponents = ['top'];\n } else if (pos.y > this._map.transform.height - height) {\n anchorComponents = ['bottom'];\n } else {\n anchorComponents = [];\n }\n\n if (pos.x < width / 2) {\n anchorComponents.push('left');\n } else if (pos.x > this._map.transform.width - width / 2) {\n anchorComponents.push('right');\n }\n\n if (anchorComponents.length === 0) {\n anchor = 'bottom';\n } else {\n anchor = (anchorComponents.join('-'): any);\n }\n }\n\n const offsetedPos = pos.add(offset[anchor]).round();\n DOM.setTransform(this._container, `${anchorTranslate[anchor]} translate(${offsetedPos.x}px,${offsetedPos.y}px)`);\n applyAnchorClass(this._container, anchor, 'popup');\n }\n\n _focusFirstElement() {\n if (!this.options.focusAfterOpen || !this._container) return;\n\n const firstFocusable = this._container.querySelector(focusQuerySelector);\n\n if (firstFocusable) firstFocusable.focus();\n }\n\n _onClose() {\n this.remove();\n }\n}\n\nfunction normalizeOffset(offset: ?Offset) {\n if (!offset) {\n return normalizeOffset(new Point(0, 0));\n\n } else if (typeof offset === 'number') {\n // input specifies a radius from which to calculate offsets at all positions\n const cornerOffset = Math.round(Math.sqrt(0.5 * Math.pow(offset, 2)));\n return {\n 'center': new Point(0, 0),\n 'top': new Point(0, offset),\n 'top-left': new Point(cornerOffset, cornerOffset),\n 'top-right': new Point(-cornerOffset, cornerOffset),\n 'bottom': new Point(0, -offset),\n 'bottom-left': new Point(cornerOffset, -cornerOffset),\n 'bottom-right': new Point(-cornerOffset, -cornerOffset),\n 'left': new Point(offset, 0),\n 'right': new Point(-offset, 0)\n };\n\n } else if (offset instanceof Point || Array.isArray(offset)) {\n // input specifies a single offset to be applied to all positions\n const convertedOffset = Point.convert(offset);\n return {\n 'center': convertedOffset,\n 'top': convertedOffset,\n 'top-left': convertedOffset,\n 'top-right': convertedOffset,\n 'bottom': convertedOffset,\n 'bottom-left': convertedOffset,\n 'bottom-right': convertedOffset,\n 'left': convertedOffset,\n 'right': convertedOffset\n };\n\n } else {\n // input specifies an offset per position\n return {\n 'center': Point.convert(offset['center'] || [0, 0]),\n 'top': Point.convert(offset['top'] || [0, 0]),\n 'top-left': Point.convert(offset['top-left'] || [0, 0]),\n 'top-right': Point.convert(offset['top-right'] || [0, 0]),\n 'bottom': Point.convert(offset['bottom'] || [0, 0]),\n 'bottom-left': Point.convert(offset['bottom-left'] || [0, 0]),\n 'bottom-right': Point.convert(offset['bottom-right'] || [0, 0]),\n 'left': Point.convert(offset['left'] || [0, 0]),\n 'right': Point.convert(offset['right'] || [0, 0])\n };\n }\n}\n","// @flow\n\nimport assert from 'assert';\nimport supported from '@mapbox/mapbox-gl-supported';\n\nimport {version} from '../package.json';\nimport Map from './ui/map';\nimport NavigationControl from './ui/control/navigation_control';\nimport GeolocateControl from './ui/control/geolocate_control';\nimport AttributionControl from './ui/control/attribution_control';\nimport ScaleControl from './ui/control/scale_control';\nimport FullscreenControl from './ui/control/fullscreen_control';\nimport Popup from './ui/popup';\nimport Marker from './ui/marker';\nimport Style from './style/style';\nimport LngLat from './geo/lng_lat';\nimport LngLatBounds from './geo/lng_lat_bounds';\nimport Point from '@mapbox/point-geometry';\nimport MercatorCoordinate from './geo/mercator_coordinate';\nimport {Evented} from './util/evented';\nimport config from './util/config';\nimport {Debug} from './util/debug';\nimport {isSafari} from './util/util';\nimport {setRTLTextPlugin, getRTLTextPluginStatus} from './source/rtl_text_plugin';\nimport WorkerPool from './util/worker_pool';\nimport {prewarm, clearPrewarmedResources} from './util/global_worker_pool';\nimport {clearTileCache} from './util/tile_request_cache';\nimport {PerformanceUtils} from './util/performance';\nimport type {RequestParameters, ResponseCallback} from './util/ajax';\nimport type {Cancelable} from './types/cancelable';\n\nconst exported = {\n version,\n supported,\n setRTLTextPlugin,\n getRTLTextPluginStatus,\n Map,\n NavigationControl,\n GeolocateControl,\n AttributionControl,\n ScaleControl,\n FullscreenControl,\n Popup,\n Marker,\n Style,\n LngLat,\n LngLatBounds,\n Point,\n MercatorCoordinate,\n Evented,\n config,\n /**\n * Initializes resources like WebWorkers that can be shared across maps to lower load\n * times in some situations. `maplibregl.workerUrl` and `maplibregl.workerCount`, if being\n * used, must be set before `prewarm()` is called to have an effect.\n *\n * By default, the lifecycle of these resources is managed automatically, and they are\n * lazily initialized when a Map is first created. By invoking `prewarm()`, these\n * resources will be created ahead of time, and will not be cleared when the last Map\n * is removed from the page. This allows them to be re-used by new Map instances that\n * are created later. They can be manually cleared by calling\n * `maplibregl.clearPrewarmedResources()`. This is only necessary if your web page remains\n * active but stops using maps altogether.\n *\n * This is primarily useful when using GL-JS maps in a single page app, wherein a user\n * would navigate between various views that can cause Map instances to constantly be\n * created and destroyed.\n *\n * @function prewarm\n * @example\n * maplibregl.prewarm()\n */\n prewarm,\n /**\n * Clears up resources that have previously been created by `maplibregl.prewarm()`.\n * Note that this is typically not necessary. You should only call this function\n * if you expect the user of your app to not return to a Map view at any point\n * in your application.\n *\n * @function clearPrewarmedResources\n * @example\n * maplibregl.clearPrewarmedResources()\n */\n clearPrewarmedResources,\n\n /**\n * Gets and sets the map's [access token](https://www.mapbox.com/help/define-access-token/).\n *\n * @var {string} accessToken\n * @returns {string} The currently set access token.\n * @example\n * maplibregl.accessToken = myAccessToken;\n * @see [Display a map](https://maplibre.org/maplibre-gl-js-docs/examples/)\n */\n get accessToken(): ?string {\n return config.ACCESS_TOKEN;\n },\n\n set accessToken(token: string) {\n config.ACCESS_TOKEN = token;\n },\n\n /**\n * Gets and sets the map's default API URL for requesting tiles, styles, sprites, and glyphs\n *\n * @var {string} baseApiUrl\n * @returns {string} The current base API URL.\n * @example\n * maplibregl.baseApiUrl = 'https://api.mapbox.com';\n */\n get baseApiUrl(): ?string {\n return config.API_URL;\n },\n\n set baseApiUrl(url: string) {\n config.API_URL = url;\n },\n\n /**\n * Gets and sets the number of web workers instantiated on a page with GL JS maps.\n * By default, it is set to half the number of CPU cores (capped at 6).\n * Make sure to set this property before creating any map instances for it to have effect.\n *\n * @var {string} workerCount\n * @returns {number} Number of workers currently configured.\n * @example\n * maplibregl.workerCount = 2;\n */\n get workerCount(): number {\n return WorkerPool.workerCount;\n },\n\n set workerCount(count: number) {\n WorkerPool.workerCount = count;\n },\n\n /**\n * Gets and sets the maximum number of images (raster tiles, sprites, icons) to load in parallel,\n * which affects performance in raster-heavy maps. 16 by default.\n *\n * @var {string} maxParallelImageRequests\n * @returns {number} Number of parallel requests currently configured.\n * @example\n * maplibregl.maxParallelImageRequests = 10;\n */\n get maxParallelImageRequests(): number {\n return config.MAX_PARALLEL_IMAGE_REQUESTS;\n },\n\n set maxParallelImageRequests(numRequests: number) {\n config.MAX_PARALLEL_IMAGE_REQUESTS = numRequests;\n },\n\n /**\n * Clears browser storage used by this library. Using this method flushes the Mapbox tile\n * cache that is managed by this library. Tiles may still be cached by the browser\n * in some cases.\n *\n * This API is supported on browsers where the [`Cache` API](https://developer.mozilla.org/en-US/docs/Web/API/Cache)\n * is supported and enabled. This includes all major browsers when pages are served over\n * `https://`, except Internet Explorer and Edge Mobile.\n *\n * When called in unsupported browsers or environments (private or incognito mode), the\n * callback will be called with an error argument.\n *\n * @function clearStorage\n * @param {Function} callback Called with an error argument if there is an error.\n * @example\n * maplibregl.clearStorage();\n */\n clearStorage(callback?: (err: ?Error) => void) {\n clearTileCache(callback);\n },\n\n workerUrl: '',\n\n /**\n * Sets a custom load tile function that will be called when using a source that starts with a custom url schema.\n * The example below will be triggered for custom:// urls defined in the sources list in the style definitions.\n * The function passed will receive the request parameters and should call the callback with the resulting request,\n * for example a pbf vector tile, non-compressed, represented as ArrayBuffer.\n * @param {string} customProtocol - the protocol to hook, for example 'custom'\n * @param {Function} loadFn - the function to use when trying to fetch a tile specified by the customProtocol\n * @example\n * // this will fetch a file using the fetch API (this is obviously a non iteresting example...)\n * maplibre.addProtocol('custom', (params, callback) => {\n fetch(`https://${params.url.split(\"://\")[1]}`)\n .then(t => {\n if (t.status == 200) {\n t.arrayBuffer().then(arr => {\n callback(null, arr, null, null);\n });\n } else {\n callback(new Error(`Tile fetch error: ${t.statusText}`));\n }\n })\n .catch(e => {\n callback(new Error(e));\n });\n return { cancel: () => { } };\n });\n * // the following is an example of a way to return an error when trying to load a tile\n * maplibre.addProtocol('custom2', (params, callback) => {\n * callback(new Error('someErrorMessage'));\n * return { cancel: () => { } };\n * });\n */\n addProtocol(customProtocol: string, loadFn: (requestParameters: RequestParameters, callback: ResponseCallback) => Cancelable) {\n config.REGISTERED_PROTOCOLS[customProtocol] = loadFn;\n },\n\n /**\n * Removes a previusly added protocol\n * @param {string} customProtocol - the custom protocol to remove registration for\n * @example\n * maplibregl.removeProtocol('custom');\n */\n removeProtocol(customProtocol: string) {\n delete config.REGISTERED_PROTOCOLS[customProtocol];\n }\n};\n\n//This gets automatically stripped out in production builds.\nDebug.extend(exported, {isSafari, getPerformanceMetrics: PerformanceUtils.getPerformanceMetrics});\n\n/**\n * The version of Mapbox GL JS in use as specified in `package.json`,\n * `CHANGELOG.md`, and the GitHub release.\n *\n * @var {string} version\n */\n\n/**\n * Test whether the browser [supports Mapbox GL JS](https://www.mapbox.com/help/mapbox-browser-support/#mapbox-gl-js).\n *\n * @function supported\n * @param {Object} [options]\n * @param {boolean} [options.failIfMajorPerformanceCaveat=false] If `true`,\n * the function will return `false` if the performance of Mapbox GL JS would\n * be dramatically worse than expected (e.g. a software WebGL renderer would be used).\n * @return {boolean}\n * @example\n * // Show an alert if the browser does not support Mapbox GL\n * if (!maplibregl.supported()) {\n * alert('Your browser does not support Mapbox GL');\n * }\n * @see [Check for browser support](https://maplibre.org/maplibre-gl-js-docs/example/check-for-support/)\n */\n\n/**\n * Sets the map's [RTL text plugin](https://www.mapbox.com/mapbox-gl-js/plugins/#mapbox-gl-rtl-text).\n * Necessary for supporting the Arabic and Hebrew languages, which are written right-to-left. Mapbox Studio loads this plugin by default.\n *\n * @function setRTLTextPlugin\n * @param {string} pluginURL URL pointing to the Mapbox RTL text plugin source.\n * @param {Function} callback Called with an error argument if there is an error.\n * @param {boolean} lazy If set to `true`, mapboxgl will defer loading the plugin until rtl text is encountered,\n * rtl text will then be rendered only after the plugin finishes loading.\n * @example\n * maplibregl.setRTLTextPlugin('https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js');\n * @see [Add support for right-to-left scripts](https://maplibre.org/maplibre-gl-js-docs/example/mapbox-gl-rtl-text/)\n */\n\n/**\n * Gets the map's [RTL text plugin](https://www.mapbox.com/mapbox-gl-js/plugins/#mapbox-gl-rtl-text) status.\n * The status can be `unavailable` (i.e. not requested or removed), `loading`, `loaded` or `error`.\n * If the status is `loaded` and the plugin is requested again, an error will be thrown.\n *\n * @function getRTLTextPluginStatus\n * @example\n * const pluginStatus = maplibregl.getRTLTextPluginStatus();\n */\n\nexport default exported;\n\n// canary assert: used to confirm that asserts have been removed from production build\nassert(true, 'canary assert');\n","//\n// Our custom intro provides a specialized \"define()\" function, called by the\n// AMD modules below, that sets up the worker blob URL and then executes the\n// main module, storing its exported value as 'maplibregl'\n\n// The three \"chunks\" imported here are produced by a first Rollup pass,\n// which outputs them as AMD modules.\n\n// Shared dependencies, i.e.:\n/*\ndefine(['exports'], function (exports) {\n // Code for all common dependencies\n // Each module's exports are attached attached to 'exports' (with\n // names rewritten to avoid collisions, etc.)\n})\n*/\nimport './build/maplibregl/shared';\n\n// Worker and its unique dependencies, i.e.:\n/*\ndefine(['./shared.js'], function (__shared__js) {\n // Code for worker script and its unique dependencies.\n // Expects the output of 'shared' module to be passed in as an argument,\n // since all references to common deps look like, e.g.,\n // __shared__js.shapeText().\n});\n*/\n// When this wrapper function is passed to our custom define() above,\n// it gets stringified, together with the shared wrapper (using\n// Function.toString()), and the resulting string of code is made into a\n// Blob URL that gets used by the main module to create the web workers.\nimport './build/maplibregl/worker';\n\n// Main module and its unique dependencies\n/*\ndefine(['./shared.js'], function (__shared__js) {\n // Code for main GL JS module and its unique dependencies.\n // Expects the output of 'shared' module to be passed in as an argument,\n // since all references to common deps look like, e.g.,\n // __shared__js.shapeText().\n //\n // Returns the actual maplibregl (i.e. src/index.js)\n});\n*/\nimport './build/maplibregl/index';\n\nexport default maplibregl;\n"],"names":["UnitBezier","p1x","p1y","p2x","p2y","this","cx","bx","ax","cy","by","ay","prototype","sampleCurveX","t","sampleCurveY","sampleCurveDerivativeX","solveCurveX","x","epsilon","t0","t1","t2","x2","i","Math","abs","d2","solve","module","Point","y","clone","add","p","_add","sub","_sub","multByPoint","_multByPoint","divByPoint","_divByPoint","mult","k","_mult","div","_div","rotate","a","_rotate","rotateAround","_rotateAround","matMult","m","_matMult","unit","_unit","perp","_perp","round","_round","mag","sqrt","equals","other","dist","distSqr","dx","dy","angle","atan2","angleTo","b","angleWith","angleWithSep","cos","sin","convert","Array","isArray","MAX_SAFE_INTEGER","pow","bezier","const","ease","clamp","n","min","max","wrap","d","w","extend","dest","sources","src","let","id","uniqueId","uuid","random","toString","replace","validateUuid","str","test","bindAll","fns","context","forEach","fn","bind","endsWith","string","suffix","indexOf","length","mapObject","input","iterator","output","key","call","filterObject","map","warnOnceHistory","warnOnce","message","console","warn","isCounterClockwise","c","calculateSignedArea","ring","sum","len","j","p1","p2","isWorker","WorkerGlobalScope","self","parseCacheControl","cacheControl","header","$0","$1","$2","$3","value","toLowerCase","maxAge","parseInt","isNaN","_isSafari","isSafari","scope","userAgent","navigator","safari","match","storageAvailable","type","storage","window","setItem","removeItem","e","linkEl","reducedMotionQuery","glForTesting","webpImgTest","now","performance","Date","raf","requestAnimationFrame","mozRequestAnimationFrame","webkitRequestAnimationFrame","msRequestAnimationFrame","cancel","cancelAnimationFrame","mozCancelAnimationFrame","webkitCancelAnimationFrame","msCancelAnimationFrame","exported","frame","getImageData","img","padding","canvas","document","createElement","getContext","Error","width","height","drawImage","resolveURL","path","href","hardwareConcurrency","devicePixelRatio","prefersReducedMotion","matchMedia","matches","config","API_URL","EVENTS_URL","FEEDBACK_URL","REQUIRE_ACCESS_TOKEN","ACCESS_TOKEN","MAX_PARALLEL_IMAGE_REQUESTS","REGISTERED_PROTOCOLS","supported","gl","webpCheckComplete","webpImgTestOnloadComplete","testWebpTextureUpload","texture","createTexture","bindTexture","TEXTURE_2D","texImage2D","RGBA","UNSIGNED_BYTE","isContextLost","deleteTexture","onload","onerror","SKU_ID","RequestManager","transformRequestFn","customAccessToken","_transformRequestFn","_customAccessToken","_createSkuToken","isMapboxURL","url","skuToken","sessionRandomizer","floor","join","createSkuToken","_skuToken","token","_skuTokenExpiresAt","tokenExpiresAt","_isSkuTokenExpired","transformRequest","normalizeStyleURL","accessToken","urlObject","parseUrl","_makeAPIURL","normalizeGlyphsURL","normalizeSourceURL","authority","params","push","normalizeSpriteURL","format","extension","formatUrl","normalizeTileURL","tileURL","tileSize","browser","webpSupported","getAccessToken","canonicalizeTileURL","removeAccessToken","result","filter","canonicalizeTileset","tileJSON","sourceURL","canonical","tiles","isMapboxHTTPURL","help","apiUrlObject","protocol","splice","setTransformRequest","mapboxHTTPURLRe","urlRe","parts","split","obj","parseAccessToken","JSON","parse","decodeURIComponent","atob","charCodeAt","slice","TelemetryEvent","anonId","eventData","queue","pendingRequest","getStorageKey","domain","u","tokenData","btoa","encodeURIComponent","String","fromCharCode","Number","telemEventKey","fetchEventData","isLocalStorageAvailable","storageKey","uuidKey","data","localStorage","getItem","saveEventData","Object","keys","stringify","processRequests","_","postEvent","timestamp","additionalPayload","callback","eventsUrlObject","payload","event","created","toISOString","sdkIdentifier","skuId","userId","finalPayload","request","headers","Content-Type","body","postData","error","queueRequest","sharedCache","responseConstructorSupportsReadableStream","MapLoadEvent","super","success","postMapLoadEvent","tileUrls","mapId","some","shift","err","turnstileEvent_","postTurnstileEvent","lastSuccess","tokenU","dueForEvent","nextUpdate","lastUpdate","nextDate","daysElapsed","getDate","enabled.telemetry","mapLoadEvent_","cacheLimit","cacheCheckThreshold","cacheOpen","caches","open","stripQueryParameters","start","supportsOffscreenCanvas","globalEntryCounter","Infinity","offscreenCanvasSupported","OffscreenCanvas","createImageBitmap","ResourceType","Unknown","Style","Source","Tile","Glyphs","SpriteImage","SpriteJSON","Image","freeze","AJAXError","status","name","constructor","getReferrer","worker","referrer","location","parent","makeFetchRequest","requestParameters","controller","AbortController","Request","method","credentials","signal","complete","aborted","cacheIgnoringSearch","set","validateOrFetch","cachedResponse","responseIsFresh","finishRequest","requestTime","fetch","then","response","ok","cacheableResponse","statusText","catch","code","arrayBuffer","json","text","options","Headers","v","get","toUTCString","getTime","undefined","Response","ReadableStream","blob","prepareBody","clonedResponse","cache","put","cachePut","strippedURL","fresh","expires","isFresh","delete","cacheGet","abort","imageQueue","numImageRequests","makeRequest","actor","send","substring","hasOwnProperty","xhr","XMLHttpRequest","responseType","setRequestHeader","withCredentials","getResponseHeader","makeXMLHttpRequest","getArrayBuffer","transparentPngUrl","getImage","accept","queued","cancelled","advanced","advanceImageRequestQueue","Blob","Uint8Array","imgBitmap","arrayBufferToImageBitmap","URL","revokeObjectURL","byteLength","createObjectURL","arrayBufferToImage","_addEventListener","listener","listenerList","_removeEventListener","index","Event","ErrorEvent","Evented","on","_listeners","off","_oneTimeListeners","once","fire","properties","listens","target","_eventedParent","_eventedParentData","setEventedParent","ValidationError","identifier","__line__","line","validateConstants","constants","inputs","unbundle","Boolean","valueOf","deepUnbundle","unbundledValue","ParsingError","Scope","bindings","concat","has","NullType","kind","NumberType","StringType","BooleanType","ColorType","ObjectType","ValueType","CollatorType","FormattedType","ResolvedImageType","array","itemType","N","valueMemberTypes","checkSubtype","expected","isValidType","provided","allowedTypes","isValidNativeType","kCSSColorTable","transparent","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","clamp_css_byte","parse_css_int","parseFloat","parse_css_float","f","css_hue_to_rgb","m1","m2","h","exports","css_str","iv","substr","op","ep","fname","alpha","pop","s","l","Color","r","g","rgba","parseCSSColor","toArray","Collator","caseSensitive","diacriticSensitive","locale","sensitivity","collator","Intl","usage","compare","lhs","rhs","resolvedLocale","resolvedOptions","FormattedSection","image","scale","fontStack","textColor","Formatted","sections","fromString","unformatted","isEmpty","section","factory","serialize","serialized","ResolvedImage","available","validateRGBA","isValue","mixed","typeOf","Literal","args","expectedType","evaluate","eachChild","outputDefined","RuntimeError","toJSON","types","number","boolean","object","Assertion","parsed","ctx","every","arg","FormatExpression","firstArg","nextTokenMayBeObject","font","lastExpression","content","evaluatedContent","ImageExpression","evaluatedImageName","availableImages","to-boolean","to-color","to-number","to-string","Coercion","parseColor","num","valueToString","child","geometryTypes","EvaluationContext","globals","feature","featureState","formattedSection","_parseColorCache","geometryType","geometry","canonicalID","cached","CompoundExpression","_evaluate","definition","definitions","availableOverloads","overloads","signature","signatureContext","ParsingContext","registry","parsedArgs","argParseFailed","errors","signatures","actualTypes","register","CollatorExpression","updateBBox","bbox","coord","boxWithinBox","bbox1","bbox2","getTileCoordinates","PI","log","tilesAtZoom","z","rayIntersect","pointWithinPolygon","point","rings","x1","y1","y2","inside","len2","pointWithinPolygons","polygons","twoSided","q1","q2","x3","y3","det1","det2","lineIntersectPolygon","polygon","v1","v2","lineStringWithinPolygon","lineStringWithinPolygons","getTilePolygon","coordinates","getTilePolygons","updatePoint","polyBBox","worldSize","halfWorldSize","getTilePoints","pointBBox","shifts","tilePoints","getTileLines","lineBBox","tileLines","tileLine","Within","geojson","geometries","isFeatureConstant","isStateConstant","isGlobalPropertyConstant","features","polygonGeometry","tilePolygon","tilePolygons","pointsWithinPolygons","linesWithinPolygons","Var","boundExpression","part","findStopLessThanOrEqualTo","stops","currentValue","lastIndex","lowerIndex","upperIndex","currentIndex","expr","_parse","annotate","typeAnnotation","Expr","actual","isConstant","expression","isTypeAnnotation","childrenConstant","ec","Step","labels","outputs","outputType","label","labelKey","valueKey","stopCount","out","from","to","deg2rad","rad2deg","xyz2lab","lab2xyz","xyz2rgb","rgb2xyz","rgbToLab","rgbColor","labToRgb","labColor","interpolateHue","lab","forward","reverse","interpolate","interpolateNumber","hcl","hclColor","Interpolate","operator","interpolation","exponentialInterpolation","base","lowerValue","upperValue","difference","progress","interpolationFactor","lower","upper","controlPoints","rest","outputLower","outputUpper","Coalesce","needsAnnotation","requestedImageName","argCount","Let","At","In","needle","haystack","IndexOf","fromIndex","Match","inputType","cases","otherwise","labelContext","groupedByOutput","outputLookup","sort","outputIndex","coerceLabel","Case","branches","Slice","beginIndex","endIndex","isComparableType","eqCollate","makeComparison","compareBasic","compareWithCollator","isOrderComparison","hasUntypedArgument","Comparison","lt","rt","Equals","NotEquals","LessThan","GreaterThan","LessThanOrEqual","GreaterThanOrEqual","NumberFormat","currency","minFractionDigits","maxFractionDigits","style","minimumFractionDigits","maximumFractionDigits","Length","expressions","==","!=",">","<",">=","<=","at","case","coalesce","in","index-of","interpolate-hcl","interpolate-lab","literal","number-format","step","var","within","varargs","supportsPropertyExpression","spec","supportsZoomExpression","parameters","supportsInterpolation","interpolated","getType","val","isFunction","identityFunction","evaluateCategoricalFunction","propertySpec","hashedStops","keyType","default","evaluateIntervalFunction","stop","evaluateExponentialFunction","interp","colorSpace","colorspace","colorSpaces","evaluatedLower","apply","evaluatedUpper","evaluateIdentityFunction","values","typeof","typeToString","to-rgba","rgb","feature-state","geometry-type","zoom","heatmap-density","heatmapDensity","line-progress","lineProgress","accumulated","+","*","-","/","%","ln2","LN2","pi","E","^","log10","LN10","ln","log2","asin","acos","atan","ceil","filter-==","filter-id-==","filter-type-==","filter-<","filter-id-<","filter->","filter-id->","filter-<=","filter-id-<=","filter->=","filter-id->=","filter-has","filter-has-id","filter-type-in","filter-id-in","filter-in-small","filter-in-large","binarySearch","all","any","!","is-supported-script","isSupportedScript","upcase","toUpperCase","downcase","resolved-locale","StyleExpression","_warningHistory","_evaluator","_defaultValue","getDefaultValue","_enumValues","isExpression","createExpression","parser","color","enum","formatted","resolvedImage","getExpectedType","evaluateWithoutErrorHandling","ZoomConstantExpression","_styleExpression","isStateDependent","ZoomDependentExpression","zoomStops","interpolationType","createPropertyExpression","isZoomConstant","zoomCurve","findZoomCurve","childResult","StylePropertyFunction","specification","_parameters","_specification","createFunction","innerFun","categoricalKeyType","isColor","zoomAndFeatureDependent","zoomDependent","property","create","featureFunctions","featureFunctionStops","validateObject","elementSpecs","valueSpec","elementValidators","objectElementValidators","styleSpec","objectKey","elementSpecKey","elementSpec","validateElement","validateSpec","required","validateArray","arraySpec","validateArrayElement","arrayElementValidator","validate","arrayElementSpec","$version","function","arrayIndex","validateNumber","minimum","maximum","validateFunction","stopKeyType","previousStopDomainValue","previousStopDomainZoom","functionValueSpec","functionType","stopDomainValues","isZoomFunction","isPropertyFunction","isZoomAndPropertyFunction","validateFunctionStop","validateStopDomainValue","reportValue","isFinite","validateExpression","expressionContext","expressionObj","propertyKey","propertyType","validateEnum","isExpressionFilter","deserialize","filterSpec","transition","property-type","createFilter","needGeometry","convertFilter","compiled","globalProperties","geometryNeeded","filters","convertComparisonOp","convertNegation","convertInOp","convertHasOp","validateFilter","validateNonExpressionFilter","filter_operator","geometry_type","validateProperty","layerSpec","layerType","transitionMatch","tokenMatch","tokens","exec","glyphs","validatePaintProperty","validateLayoutProperty","validateLayer","layer","ref","layerId","otherLayer","layers","source","sourceType","paint","lineMetrics","layout","validateString","promoteId","prop","validateSource","source_geojson","cluster","clusterProperties","reduceExpr","source_video","source_image","validateLight","light","lightSpec","rootType","VALIDATORS","validateStyleMin","latestStyleSpec","$root","validateGlyphsURL","sortErrors","wrapCleanErrors","inner","paintProperty","layoutProperty","validateStyle","emitValidationErrors","emitter","hasErrors","GridIndex","extent","cells","ArrayBuffer","Int32Array","end","subarray","bboxesOffset","bboxes","insert","_insertReadonly","uid","_forEachCell","_insertCell","cellIndex","query","intersectionTest","_queryCell","seenUids","cell","offset","arg1","arg2","cx1","_convertToCellCoord","cy1","cx2","cy2","_convertFromCellCoord","toArrayBuffer","metadataLength","totalCellLength","buffer","klass","defineProperty","writeable","omit","shallow","Grid","grid","transferables","_classRegistryKey","isArrayBuffer","isImageBitmap","ImageBitmap","RegExp","isView","view","ImageData","$name","ZoomHistory","first","update","floorZ","lastIntegerZoom","lastIntegerZoomTime","lastZoom","lastFloorZoom","unicodeBlockLookup","Latin-1 Supplement","char","Arabic","Arabic Supplement","Arabic Extended-A","Hangul Jamo","Unified Canadian Aboriginal Syllabics","Khmer","Unified Canadian Aboriginal Syllabics Extended","General Punctuation","Letterlike Symbols","Number Forms","Miscellaneous Technical","Control Pictures","Optical Character Recognition","Enclosed Alphanumerics","Geometric Shapes","Miscellaneous Symbols","Miscellaneous Symbols and Arrows","CJK Radicals Supplement","Kangxi Radicals","Ideographic Description Characters","CJK Symbols and Punctuation","Hiragana","Katakana","Bopomofo","Hangul Compatibility Jamo","Kanbun","Bopomofo Extended","CJK Strokes","Katakana Phonetic Extensions","Enclosed CJK Letters and Months","CJK Compatibility","CJK Unified Ideographs Extension A","Yijing Hexagram Symbols","CJK Unified Ideographs","Yi Syllables","Yi Radicals","Hangul Jamo Extended-A","Hangul Syllables","Hangul Jamo Extended-B","Private Use Area","CJK Compatibility Ideographs","Arabic Presentation Forms-A","Vertical Forms","CJK Compatibility Forms","Small Form Variants","Arabic Presentation Forms-B","Halfwidth and Fullwidth Forms","allowsVerticalWritingMode","chars","charHasUprightVerticalOrientation","isChar","charHasRotatedVerticalOrientation","charHasNeutralVerticalOrientation","charInRTLScript","charInSupportedScript","canRenderRTL","stringContainsRTLText","_completionCallback","pluginStatus","pluginURL","triggerPluginCompletionEvent","sendPluginStateToWorker","evented","getRTLTextPluginStatus","downloadRTLTextPlugin","plugin","applyArabicShaping","processBidirectionalText","processStyledBidirectionalText","isLoaded","isLoading","setState","state","isParsed","getPluginURL","EvaluationParameters","fadeDuration","zoomHistory","isStringInSupportedScript","rtlTextPlugin","crossFadingFactor","getCrossfadeParameters","fraction","fromScale","toScale","PropertyValue","constant","normalizePropertyExpression","isDataDriven","possiblyEvaluate","TransitionablePropertyValue","transitioned","prior","TransitioningPropertyValue","untransitioned","Transitionable","_properties","_values","defaultTransitionablePropertyValues","getValue","setValue","getTransition","setTransition","Transitioning","begin","delay","duration","finalValue","t3","easeCubicInOut","defaultTransitioningPropertyValues","PossiblyEvaluated","hasTransition","Layout","defaultPropertyValues","PossiblyEvaluatedPropertyValue","constantOr","defaultPossiblyEvaluatedValues","DataConstantProperty","DataDrivenProperty","overrides","CrossFadedDataDrivenProperty","evaluatedValue","constantValue","_calculate","cameraVal","mid","CrossFadedProperty","ColorRampProperty","Properties","overridableProperties","overridable","defaultPropertyValue","defaultTransitionablePropertyValue","StyleLayer","_featureFilter","metadata","minzoom","maxzoom","sourceLayer","_unevaluatedLayout","_transitionablePaint","setPaintProperty","setLayoutProperty","_transitioningPaint","_crossfadeParameters","getLayoutProperty","visibility","_validate","getPaintProperty","transitionable","isCrossFadedProperty","wasDataDriven","oldValue","_handleSpecialPaintPropertyUpdate","newValue","_handleOverridablePaintPropertyUpdate","isHidden","updateTransitions","recalculate","source-layer","sprite","is3D","isTileClipped","hasOffscreenPass","resize","viewTypes","Int8","Int8Array","Uint8","Int16","Int16Array","Uint16","Uint16Array","Int32","Uint32","Uint32Array","Float32","Float32Array","Struct","structArray","_structArray","_pos1","size","_pos2","_pos4","_pos8","StructArray","isTransferred","capacity","createLayout","members","alignment","maxSize","member","typeSize","BYTES_PER_ELEMENT","memberOffset","align","components","_trim","bytesPerElement","_refreshViews","clear","reserve","oldUint8Array","uint8","StructArrayLayout2i4","int16","emplaceBack","v0","emplace","o2","StructArrayLayout4i8","v3","StructArrayLayout2i4i12","v4","v5","StructArrayLayout2i4ub8","o1","StructArrayLayout2f8","float32","o4","StructArrayLayout10ui20","uint16","v6","v7","v8","v9","StructArrayLayout4i4ui4i24","v10","v11","StructArrayLayout3f12","StructArrayLayout1ul4","uint32","StructArrayLayout6i1ul2ui20","StructArrayLayout2i2i2i12","StructArrayLayout2f1f2i16","StructArrayLayout2ub2f12","StructArrayLayout3ui6","StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48","v12","v13","v14","v15","v16","StructArrayLayout8i15ui1ul4f68","v17","v18","v19","v20","v21","v22","v23","v24","v25","v26","v27","StructArrayLayout1f4","StructArrayLayout3i6","StructArrayLayout1ul2ui8","StructArrayLayout2ui4","StructArrayLayout1ui2","StructArrayLayout4f16","CollisionBoxStruct","prototypeAccessors","anchorPointX","anchorPointY","featureIndex","sourceLayerIndex","bucketIndex","anchorPoint","CollisionBoxArray","PlacedSymbolStruct","prototypeAccessors$1","anchorX","anchorY","glyphStartIndex","numGlyphs","vertexStartIndex","lineStartIndex","lineLength","segment","lowerSize","upperSize","lineOffsetX","lineOffsetY","writingMode","placedOrientation","hidden","crossTileID","associatedIconIndex","PlacedSymbolArray","SymbolInstanceStruct","prototypeAccessors$2","rightJustifiedTextSymbolIndex","centerJustifiedTextSymbolIndex","leftJustifiedTextSymbolIndex","verticalPlacedTextSymbolIndex","placedIconSymbolIndex","verticalPlacedIconSymbolIndex","textBoxStartIndex","textBoxEndIndex","verticalTextBoxStartIndex","verticalTextBoxEndIndex","iconBoxStartIndex","iconBoxEndIndex","verticalIconBoxStartIndex","verticalIconBoxEndIndex","numHorizontalGlyphVertices","numVerticalGlyphVertices","numIconVertices","numVerticalIconVertices","useRuntimeCollisionCircles","textBoxScale","textOffset0","textOffset1","collisionCircleDiameter","SymbolInstanceArray","GlyphOffsetArray","getoffsetX","SymbolLineVertexArray","getx","gety","gettileUnitDistanceFromAnchor","FeatureIndexStruct","prototypeAccessors$3","FeatureIndexArray","SegmentVector","segments","packUint8ToFloat","prepareSegment","numVertices","layoutVertexArray","indexArray","sortKey","MAX_VERTEX_ARRAY_LENGTH","vertexLength","vertexOffset","primitiveOffset","primitiveLength","destroy","vaos","simpleSegment","patternAttributes","seed","remainder","bytes","h1","h1b","c1","c2","k1","murmur3","murmur2","FeaturePositionMap","ids","positions","indexed","getNumericId","getPositions","intId","Float64Array","left","right","pivot","swap","numValue","arr","tmp","Uniform","Uniform1i","current","uniform1i","Uniform1f","uniform1f","Uniform2f","uniform2f","Uniform3f","uniform3f","Uniform4f","uniform4f","UniformColor","emptyMat4","UniformMatrix4f","uniformMatrix4fv","packColor","ConstantBinder","names","uniformNames","setUniform","uniform","getBinding","CrossFadedConstantBinder","patternFrom","patternTo","pixelRatioFrom","pixelRatioTo","setConstantPatternPositions","posTo","posFrom","pixelRatio","tlbr","uniformName","pos","SourceExpressionBinder","PaintVertexArray","maxValue","paintVertexAttributes","paintVertexArray","populatePaintArray","newLength","imagePositions","_setPaintValue","updatePaintArray","upload","paintVertexBuffer","updateData","createVertexBuffer","CompositeExpressionBinder","useIntegerZoom","minColor","maxColor","currentZoom","factor","CrossFadedCompositeBinder","zoomInPaintVertexArray","zoomOutPaintVertexArray","_setPaintValues","patterns","imageMin","imageMid","imageMax","tl","br","zoomInPaintVertexBuffer","zoomOutPaintVertexBuffer","ProgramConfiguration","filterProperties","binders","_buffers","paintAttributeNames","propType","isCrossFaded","StructArrayLayout","layoutType","cacheKey","getMaxValue","binder","populatePaintArrays","updatePaintArrays","featureStates","featureMap","vtLayer","dirty","defines","getBinderAttributes","getBinderUniforms","uniforms","getPaintVertexBuffers","getUniforms","locations","binding","setUniforms","binderUniforms","updatePaintBuffers","crossfade","patternVertexBuffer","ProgramConfigurationSet","programConfigurations","needsUpload","_featureMap","_bufferOffset","text-opacity","icon-opacity","text-color","icon-color","text-halo-color","icon-halo-color","text-halo-blur","icon-halo-blur","text-halo-width","icon-halo-width","line-gap-width","line-pattern","fill-pattern","fill-extrusion-pattern","binderType","defaultLayouts","composite","layoutException","PatternLayoutArray","getLayoutException","MAX","BITS","MIN","loadGeometry","toEvaluationFeature","addCircleVertex","extrudeX","extrudeY","CircleBucket","overscaling","layerIds","hasPattern","CircleLayoutArray","TriangleIndexArray","stateDependentLayerIds","polygonIntersectsPolygon","polygonA","polygonB","polygonContainsPoint","lineIntersectsLine","polygonIntersectsBufferedPoint","radius","pointIntersectsBufferedLine","polygonIntersectsMultiPolygon","multiPolygon","multiPolygonContainsPoint","lineIntersectsBufferedLine","lineA","lineB","a0","a1","lineSegmentIntersectsLineSegment","b0","b1","radiusSquared","distToSegmentSquared","l2","edgeIntersectsBox","e1","e2","corners","dir","getMaximumPaintValue","bucket","translateDistance","translate","queryGeometry","translateAnchor","bearing","pixelsToTileUnits","pt","translated","populate","styleLayer","bucketFeatures","circleSortKey","sortFeaturesByKey","evaluationFeature","bucketFeature","addFeature","states","stateDependentLayers","uploadPending","uploaded","layoutVertexBuffer","layoutAttributes","indexBuffer","createIndexBuffer","circle-sort-key","circle-radius","circle-color","circle-blur","circle-opacity","circle-translate","circle-translate-anchor","circle-pitch-scale","circle-pitch-alignment","circle-stroke-width","circle-stroke-color","circle-stroke-opacity","ARRAY_TYPE","identity","multiply","a00","a01","a02","a03","a10","a11","a12","a13","a20","a21","a22","a23","a30","a31","a32","a33","b2","b3","hypot","arguments","mul","transformMat4","glMatrix","CircleStyleLayer","createBucket","queryRadius","circleBucket","queryIntersectsFeature","transform","pixelPosMatrix","translatedPolygon","alignWithMap","transformedPolygon","projectPoint","projectQueryGeometry","transformedSize","transformedPoint","adjustedSize","projectedCenter","vec4","cameraToCenterDistance","HeatmapBucket","createImage","channels","Uint8ClampedArray","RangeError","resizeImage","newImage","copyImage","srcImg","dstImg","srcPt","dstPt","srcData","dstData","srcOffset","dstOffset","AlphaImage","copy","RGBAImage","heatmap-radius","heatmap-weight","heatmap-intensity","heatmap-color","heatmap-opacity","renderColorRamp","evaluationGlobals","resolution","clips","renderPixel","stride","evaluationKey","pxColor","clip","HeatmapStyleLayer","_updateColorRamp","colorRamp","colorRampTexture","heatmapFbo","hillshade-illumination-direction","hillshade-illumination-anchor","hillshade-exaggeration","hillshade-shadow-color","hillshade-highlight-color","hillshade-accent-color","HillshadeStyleLayer","earcut","holeIndices","dim","minX","minY","maxX","maxY","invSize","hasHoles","outerLen","outerNode","linkedList","triangles","next","prev","list","steiner","getLeftmost","compareX","eliminateHole","filterPoints","eliminateHoles","earcutLinked","clockwise","last","signedArea","insertNode","removeNode","again","area","ear","pass","zOrder","prevZ","nextZ","q","tail","numMerges","pSize","qSize","inSize","sortLinked","indexCurve","isEarHashed","isEar","cureLocalIntersections","splitEarcut","pointInTriangle","maxTX","maxTY","minZ","maxZ","intersects","locallyInside","isValidDiagonal","splitPolygon","hole","hx","hy","qx","mx","my","tanMin","sectorContainsSector","findHoleBridge","leftmost","px","py","intersectsPolygon","middleInside","sign","o3","onSegment","a2","Node","an","bp","quickselect","quickselectStep","exp","sd","defaultCompare","classifyRings","maxRings","ccw","compareAreas","patternDependencies","patternProperty","constantPattern","addPatternDependencies","patternFeature","patternPropertyValue","deviation","polygonArea","trianglesArea","flatten","vertices","holes","dimensions","holeIndex","FillBucket","patternFeatures","FillLayoutArray","indexArray2","LineIndexArray","segments2","fillSortKey","addFeatures","indexBuffer2","triangleSegment","triangleIndex","flattened","lineSegment","lineIndex","indices","fill-sort-key","fill-antialias","fill-opacity","fill-color","fill-outline-color","fill-translate","fill-translate-anchor","FillStyleLayer","outlineColor","VectorTileFeature","pbf","_pbf","_geometry","_keys","readFields","readFeature","tag","readVarint","readTag","cmd","lines","cmdLen","readSVarint","toGeoJSON","x0","y0","coords","project","points","VectorTileLayer","version","_features","readLayer","readString","readFloat","readDouble","readVarint64","readBoolean","readValueMessage","readTile","require","vectorTileFeatureTypes","mvt","FACTOR","addVertex","vertexArray","nx","ny","nz","FillExtrusionBucket","FillExtrusionLayoutArray","isBoundaryEdge","edgeDistance","bottomRight","fill-extrusion-opacity","fill-extrusion-color","fill-extrusion-translate","fill-extrusion-translate-anchor","fill-extrusion-height","fill-extrusion-base","fill-extrusion-vertical-gradient","FillExtrusionStyleLayer","projectedQueryGeometry","projected","zBase","zTop","projectedBase","projectedTop","baseXZ","baseYZ","baseZZ","baseWZ","topXZ","topYZ","topZZ","topWZ","ringBase","ringTop","sX","sY","sZ","sW","baseZ","baseW","topX","topY","topZ","topW","projectExtrusion","closestDistance","getIntersectionDistance","topA","face","checkIntersection","dot","projectedFace","ab","ac","ap","dotABAB","dotABAC","dotACAC","dotAPAB","dotAPAC","denom","distance","COS_HALF_SHARP_CORNER","MAX_LINE_DISTANCE","LINE_DISTANCE_BUFFER_BITS","LineBucket","lineClipsArray","gradients","LineLayoutArray","layoutVertexArray2","LineExtLayoutArray","maxLineLength","lineSortKey","patternBucketFeature","layoutVertexBuffer2","layoutAttributesExt","lineFeatureClips","cap","miterLimit","roundLimit","lineClips","addLine","scaledDistance","totalDistance","updateScaledDistance","isPolygon","currentVertex","sharpCornerOffset","SHARP_CORNER_OFFSET","prevVertex","nextVertex","prevNormal","nextNormal","joinNormal","cosAngle","cosHalfAngle","miterLength","approxAngle","isSharpCorner","lineTurnsLeft","prevSegmentLength","newPrevVertex","updateDistance","addCurrentVertex","middleVertex","currentJoin","bevelLength","offsetA","offsetB","extrude","addHalfVertex","nextSegmentLength","newCurrentVertex","normal","endLeft","endRight","rightX","rightY","up","linesofarScaled","line-cap","line-join","line-miter-limit","line-round-limit","line-sort-key","line-opacity","line-color","line-translate","line-translate-anchor","line-width","line-offset","line-blur","line-dasharray","line-gradient","lineFloorwidthProperty","LineStyleLayer","gradientVersion","stepInterpolant","gradientExpression","lineBucket","getLineWidth","halfWidth","lineOffset","newRings","zero","newRing","aToB","bToC","offsetLine","multiLine","polygonIntersectsBufferedMultiLine","lineWidth","lineGapWidth","symbolLayoutAttributes","dynamicLayoutAttributes","collisionVertexAttributes","collisionBoxLayout","collisionCircleLayout","toLocaleUpperCase","toLocaleLowerCase","transformText","verticalizedCharacterMap","#","$","&","(",")",",",".",":",";","=","?","@","[","\\","]","`","{","|","}","~","¢","£","Â¥","¦","¬","¯","–","—","‘","’","“","”","…","‧","₩","、","。","〈","〉","《","》","「","」","『","』","【","】","〔","〕","〖","〗","!","(",")",",","-",".",":",";","<",">","?","ï¼»","ï¼½","_","{","|","}","⦅","ï½ ","。","ï½¢","ï½£","isLE","mLen","nBytes","eLen","eMax","eBias","nBits","NaN","Pbf","buf","Varint","Fixed64","Bytes","Fixed32","utf8TextDecoder","TextDecoder","readPackedEnd","toNum","low","high","isSigned","makeRoomForExtraLength","startPos","extraLen","realloc","writePackedVarint","writeVarint","writePackedSVarint","writeSVarint","writePackedFloat","writeFloat","writePackedDouble","writeDouble","writePackedBoolean","writeBoolean","writePackedFixed32","writeFixed32","writePackedSFixed32","writeSFixed32","writePackedFixed64","writeFixed64","writePackedSFixed64","writeSFixed64","readUInt32","writeInt32","readInt32","readFontstacks","readMessage","readFontstack","readGlyph","bitmap","metrics","top","advance","glyph","readBytes","potpack","boxes","maxWidth","box","spaces","space","fill","readField","skip","readFixed32","readSFixed32","readFixed64","readSFixed64","ieee754","readVarintRemainder","decode","readUtf8TextDecoder","bytesPerSequence","readUtf8","readPackedVarint","readPackedSVarint","readPackedBoolean","readPackedFloat","readPackedDouble","readPackedFixed32","readPackedSFixed32","readPackedFixed64","readPackedSFixed64","writeTag","finish","writeBigVarintLow","lsb","writeBigVarintHigh","writeBigVarint","writeString","lead","writeUtf8","writeBytes","writeRawMessage","writeMessage","writeBytesField","writeFixed32Field","writeSFixed32Field","writeFixed64Field","writeSFixed64Field","writeVarintField","writeSVarintField","writeStringField","writeFloatField","writeDoubleField","writeBooleanField","ImagePosition","paddedRect","stretchX","stretchY","displaySize","IMAGE_PADDING","ImageAtlas","icons","iconPositions","patternPositions","haveRenderCallbacks","bins","addImages","bin","images","hasRenderCallback","patchUpdatedImages","imageManager","dispatchRenderCallbacks","updatedImages","patchUpdatedImage","position","WritingMode","horizontal","vertical","horizontalOnly","SectionOptions","imageName","forText","textOptions","forImage","imageOptions","TaggedString","sectionIndex","imageSectionID","shapeText","glyphMap","glyphPositions","defaultFontStack","lineHeight","textAnchor","textJustify","spacing","allowVerticalPlacement","symbolPlacement","layoutTextSize","layoutTextSizeThisZoom","logicalInput","fromFeature","verticalizePunctuation","determineLineBreaks","taggedLine","lineBreakPoints","lineBreak","breakLines","positionedLines","shaping","bottom","iconsInText","verticalizable","maxLineHeight","justify","trim","lineMaxScale","getMaxScale","maxLineOffset","positionedLine","positionedGlyphs","getSection","getSectionIndex","codePoint","getCharCode","baselineOffset","rect","verticalAdvance","whitespace","imagePosition","glyphPosition","justifyLine","currentLineHeight","getAnchorAlignment","horizontalAlign","verticalAlign","blockHeight","lineCount","shiftY","shiftX","positionedGlyph","shapeLines","addImageSection","addTextSection","nextCharCode","prevCharCode","beginningWhitespace","trailingWhitespace","reduce","nextImageSectionCharCode","getNextImageSectionCharCode","breakable","getGlyphAdvance","calculateBadness","targetWidth","penalty","isLastBreak","raggedness","calculatePenalty","nextCodePoint","penalizableIdeographicBreak","evaluateBreak","breakIndex","breakX","potentialBreaks","bestPriorBreak","bestBreakBadness","potentialBreak","breakBadness","badness","priorBreak","potentialLineBreaks","totalWidth","determineAverageLineWidth","hasServerSuggestedBreakpoints","currentX","ideographicBreak","leastBadBreaks","lastLineBreak","anchor","lastPositionedGlyph","lineIndent","fitIconToText","shapedIcon","shapedText","textFit","iconOffset","fontScale","collisionPadding","textLeft","textRight","textTop","textBottom","Anchor","getSizeData","tileZoom","minZoom","maxZoom","evaluateSizeForFeature","sizeData","uSize","evaluateSizeForZoom","uSizeT","layoutSize","minSize","checkMaxAngle","labelLength","windowSize","maxAngle","anchorDistance","recentCorners","recentAngleDelta","angleDelta","getLineLength","getAngleWindowSize","glyphSize","boxScale","getShapedLabelLength","getCenterAnchor","angleWindowSize","prevDistance","centerDistance","segmentDistance","getAnchors","tileExtent","shapedLabelLength","isLineContinued","resample","placeAtMiddle","halfLabelLength","markedDistance","anchors","segmentDist","clipLine","clippedLines","clippedLine","p0","getIconQuads","iconRotate","isSDFIcon","hasIconTextFit","quads","imageWidth","imageHeight","iconWidth","iconHeight","reduceRanges","range","stretchWidth","stretchHeight","fixedWidth","fixedHeight","stretchOffsetX","stretchContentWidth","stretchOffsetY","stretchContentHeight","fixedOffsetX","fixedContentWidth","fixedOffsetY","fixedContentHeight","sumWithinRange","makeBox","leftEm","getEmOffset","stretch","leftPx","getPxOffset","fixed","topEm","topPx","rightEm","rightPx","bottomEm","bottomPx","tr","bl","pixelOffsetTL","pixelOffsetBR","matrix","tex","glyphOffset","isSDF","xCuts","stretchZonesToCuts","yCuts","xi","yi","ranges","stretchZones","fixedSize","stretchSize","cuts","stretchOffset","iconSize","fixedOffset","CollisionFeature","collisionBoxArray","shaped","alignLine","boxStartIndex","circleDiameter","rotateRadians","boxEndIndex","TinyQueue","_down","polygonRings","precision","debug","outerRing","cellSize","cellQueue","Queue","compareMax","Cell","bestCell","getCentroidCell","numProbes","minDistSq","pointToPolygonDist","SQRT2","item","_up","peek","halfLength","best","INVALID_TEXT_OFFSET","POSITIVE_INFINITY","evaluateVariableOffset","offsetX","offsetY","fromTextOffset","radialOffset","hypotenuse","fromRadialOffset","getAnchorJustification","addTextVertices","imageMap","textAlongLine","textOffset","lineArray","placementTypes","placedTextSymbolIndices","placedIconIndex","sizes","glyphQuads","alongLine","textRotate","textureRect","rectBuffer","GLYPH_PBF_BORDER","rotateVerticalGlyph","halfAdvance","sdf","builtInOffset","verticalizedLabelOffset","center","verticalRotation","xHalfWidthOffsetCorrection","ONE_EM","halfWidthOffsetCorrection","verticalOffsetCorrection","getGlyphQuads","textSizeData","MAX_GLYPH_ICON_SIZE","compositeTextSizes","addSymbols","placedSymbolArray","getDefaultHorizontalShaping","horizontalShaping","justification","anchorIsTooClose","repeatDistance","compareText","otherAnchors","shaderOpacityAttributes","ox","oy","tx","ty","sizeVertex","pixelOffsetX","pixelOffsetY","minFontScaleX","minFontScaleY","aSizeX","aSizeY","addDynamicAttributes","dynamicLayoutVertexArray","containsRTLText","formattedText","SymbolBuffers","SymbolLayoutArray","SymbolDynamicLayoutArray","opacityVertexArray","SymbolOpacityArray","dynamicIndexBuffer","dynamicLayoutVertexBuffer","opacityVertexBuffer","itemSize","CollisionBuffers","LayoutArray","IndexArray","collisionVertexArray","CollisionVertexArray","collisionVertexBuffer","SymbolBucket","hasRTLText","sortKeyRanges","collisionCircleArray","placementInvProjMatrix","mat4","placementViewportMatrix","unevaluatedLayoutValues","iconSizeData","canOverlap","sortFeaturesByY","writingModes","wm","sourceID","createArrays","icon","glyphOffsetArray","lineVertexArray","symbolInstances","calculateGlyphDependencies","stack","doesAllowVerticalWritingMode","verticalChar","charAt","textFont","textField","iconImage","hasText","hasIcon","symbolSortKey","iconDependencies","stacks","glyphDependencies","resolvedTokens","getValueAndResolveTokens","globalRTLTextPlugin","sectionFont","sectionStack","leftIndex","rightIndex","mergedFeatures","mergedIndex","mergeFromRight","leftKey","rightKey","geom","mergeFromLeft","getKey","onRight","mergeLines","hasDebugData","textCollisionBox","iconCollisionBox","destroyDebugData","addToLineVertexArray","sumForwardLength","sumBackwardLength","tileUnitDistanceFromAnchor","vertex","arrays","labelAnchor","glyphOffsetArrayStart","_addCollisionDebugVertex","addCollisionDebugVertices","boxAnchorPoint","symbolInstance","addDebugCollisionBoxes","startIndex","isText","generateCollisionDebugBuffers","CollisionBoxLayoutArray","_deserializeCollisionBoxesForSymbol","textStartIndex","textEndIndex","verticalTextStartIndex","verticalTextEndIndex","iconStartIndex","iconEndIndex","verticalIconStartIndex","verticalIconEndIndex","collisionArrays","textBox","textFeatureIndex","verticalTextBox","verticalTextFeatureIndex","iconBox","iconFeatureIndex","verticalIconBox","verticalIconFeatureIndex","deserializeCollisionBoxes","hasTextData","hasIconData","hasTextCollisionBoxData","hasIconCollisionBoxData","addIndicesForPlacedSymbol","iconOrText","placedSymbolIndex","placedSymbol","vertexIndex","getSortedSymbolIndexes","sortedAngle","symbolInstanceIndexes","rotatedYs","featureIndexes","aIndex","bIndex","addToSortKeyRanges","symbolInstanceIndex","symbolInstanceEnd","symbolInstanceStart","sortFeatures","featureSortOrder","MAX_GLYPHS","symbol-placement","symbol-spacing","symbol-avoid-edges","symbol-sort-key","symbol-z-order","icon-allow-overlap","icon-ignore-placement","icon-optional","icon-rotation-alignment","icon-size","icon-text-fit","icon-text-fit-padding","icon-image","icon-rotate","icon-padding","icon-keep-upright","icon-offset","icon-anchor","icon-pitch-alignment","text-pitch-alignment","text-rotation-alignment","text-field","text-font","text-size","text-max-width","text-line-height","text-letter-spacing","text-justify","text-radial-offset","text-variable-anchor","text-anchor","text-max-angle","text-writing-mode","text-rotate","text-padding","text-keep-upright","text-transform","text-offset","text-allow-overlap","text-ignore-placement","text-optional","icon-translate","icon-translate-anchor","runtimeType","getOverride","o","hasOverride","text-translate","text-translate-anchor","FormatSectionOverride","defaultValue","SymbolStyleLayer","deduped","_setPaintOverrides","unevaluated","resolveTokens","hasPaintOverride","overriden","override","styleExpression","_interpolationType","propertyName","hasOverrides","checkSections","checkExpression","background-color","background-pattern","background-opacity","BackgroundStyleLayer","raster-opacity","raster-hue-rotate","raster-brightness-min","raster-brightness-max","raster-saturation","raster-contrast","raster-resampling","raster-fade-duration","RasterStyleLayer","CustomStyleLayer","implementation","renderingMode","prerender","onAdd","painter","onRemove","subclasses","circle","heatmap","hillshade","fill-extrusion","fillExtrusion","symbol","background","raster","Texture","useMipmap","pixelStoreUnpackFlipY","pixelStoreUnpack","pixelStoreUnpackPremultiplyAlpha","premultiply","HTMLImageElement","HTMLCanvasElement","HTMLVideoElement","texSubImage2D","isSizePowerOfTwo","generateMipmap","minFilter","LINEAR_MIPMAP_NEAREST","LINEAR","texParameteri","TEXTURE_MAG_FILTER","TEXTURE_MIN_FILTER","TEXTURE_WRAP_S","TEXTURE_WRAP_T","ThrottledInvoker","_callback","_triggered","MessageChannel","_channel","port2","onmessage","trigger","port1","postMessage","setTimeout","remove","Actor","callbacks","tasks","taskQueue","cancelCallbacks","invoker","process","addEventListener","receive","globalScope","getMercCoords","targetMapId","mustQueue","buffers","hasCallback","sourceMapId","processTask","task","completed","done","getWorkerSource","removeEventListener","LngLatBounds","sw","ne","setSouthWest","setNorthEast","_ne","LngLat","lng","lat","_sw","sw2","ne2","getCenter","getSouthWest","getNorthEast","getNorthWest","getWest","getNorth","getSouthEast","getEast","getSouth","contains","lnglat","containsLongitude","distanceTo","lngLat","rad","lat1","lat2","toBounds","latAccuracy","lngAccuracy","lon","earthCircumfrence","circumferenceAtLatitude","latitude","mercatorXfromLng","mercatorYfromLat","mercatorZfromAltitude","altitude","latFromMercatorY","MercatorCoordinate","fromLngLat","lngLatLike","toLngLat","toAltitude","meterInMercatorCoordinateUnits","CanonicalTileID","calculateKey","urls","scheme","quadkey","mask","getQuadkey","getTilePoint","UnwrappedTileID","OverscaledTileID","overscaledZ","scaledTo","targetZ","zDifference","calculateScaledKey","withWrap","isChildOf","children","sourceMaxZoom","isLessThan","wrapped","unwrapTo","overscaleFactor","toUnwrapped","DEMData","encoding","_idx","pixels","_unpackTerrarium","_unpackMapbox","getUnpackVector","getPixels","backfillBorder","borderTile","xMin","xMax","yMin","yMax","DictionaryCoder","strings","_stringToNumber","_numberToString","encode","Feature","vectorTileFeature","_vectorTileFeature","_z","_x","_y","SourceFeatureState","stateChanges","deletedStates","updateState","featureId","newState","ft","removeFeatureState","getState","reconciledState","featureDeletions","initializeTileState","tile","setFeatureState","coalesceChanges","featuresChanged","layerStates","FeatureIndex","tileID","grid3D","featureIndexArray","evaluateProperties","serializedProperties","styleLayerProperties","getBounds","topDownFeatureComparator","loadVTLayers","vtLayers","vt","VectorTile","Protobuf","rawTileData","sourceLayerCoder","styleLayers","serializedLayers","sourceFeatureState","featureFilter","queryPadding","bounds","matching","cameraBounds","cameraQueryGeometry","matching3D","bx1","by1","bx2","by2","boxX1","boxY1","boxX2","boxY2","polygonIntersectsBox","previousIndex","featureGeometry","loadMatchingFeature","filterLayerIDs","layerIDs","bucketLayerIDs","arraysIntersect","sourceLayerName","getId","layerID","serializedLayer","intersectionZ","geojsonFeature","GeoJSONFeature","layerResult","lookupSymbolFeatures","symbolFeatureIndexes","hasLayer","sourceLayerId","uses","buckets","expirationTime","hasSymbolBuckets","dependencies","expiredRequestCount","registerFadeDuration","fadeEndTime","timeAdded","wasRequested","loadVectorData","justReloaded","hasData","unloadVectorData","latestFeatureIndex","latestRawTileData","getLayer","lId","deserializeBucket","imageAtlas","glyphAtlasImage","imageAtlasTexture","glyphAtlasTexture","getBucket","ALPHA","prepare","queryRenderedFeatures","maxPitchScaleFactor","querySourceFeatures","_geojsonTileLayer","patternsLoaded","setExpiryData","parsedCC","isExpired","delta","getExpiryTimeout","sourceLayerStates","holdingForFade","symbolFadeHoldUntil","symbolFadeFinished","clearFadeHold","setHoldDuration","setDependencies","namespace","hasDependency","namespaces","RequestPerformance","_marks","measure","mark","resourceTimingData","getEntriesByName","clearMarks","clearMeasures","remaining","results","dispatcher","getActor","promise","az","bz","deepEqual","limit","video","muted","onloadstart","host","crossOrigin","appendChild","b00","b01","b02","b03","b04","b05","b06","b07","b08","b09","b10","b11","det","near","far","lr","bt","nf","showCollisionBoxes","tilePixelRatio","iconsNeedLinear","compositeIconSizes","layoutIconSize","textMaxSize","keepUpright","textSize","fontstack","shapedTextOrientations","unformattedText","spacingIfAllowed","allowsLetterSpacing","variableTextAnchor","addVerticalShapingForPointLabelIfNeeded","justifications","singleLine","iconAnchor","shapeIcon","sdfIcons","verticallyShapedIcon","defaultHorizontalShaping","textMaxBoxScale","iconBoxScale","symbolMinDistance","textPadding","iconPadding","textMaxAngle","iconAlongLine","textRepeatDistance","iconTextFit","addSymbolAtAnchor","textCollisionFeature","iconCollisionFeature","verticalTextCollisionFeature","verticalIconCollisionFeature","verticalTextRotation","iconQuads","verticalIconQuads","getCollisionCircleHeight","prevHeight","addSymbol","poi","findPoleOfInaccessibility","fovy","aspect","a3","checkThreshold","deferred","azimuthal","polar","layerObject","render","refProperties","StyleLayerIndex","layerConfigs","keyCache","_layerConfigs","_layers","removedIds","layerConfig","createStyleLayer","familiesBySource","cachedKeys","groups","group","groupByLayout","sourceId","sourceGroup","sourceLayerFamilies","GlyphAtlas","stackPositions","WorkerTile","collectResourceTiming","returnDependencies","recalculateLayers","loadVectorTile","vectorTile","rawData","layerIndex","iconMap","patternMap","layerFamilies","family","maybePrepare","glyphAtlas","performSymbolLayout","VectorTileWorkerSource","loading","loaded","loadTile","perf","workerTile","resourceTiming","reloadTile","vtSource","reloadCallback","abortTile","removeTile","RasterDEMTileWorkerSource","rewindRings","outer","rewindRing","imagePixels","rawImageData","dem","offscreenCanvas","offscreenCanvasContext","imgData","clearRect","FeatureWrapper","_feature","EXTENT","tags","GeoJSONWrapper","rawGeometry","fromVectorTileJs","writeLayer","writeTile","keycache","valuecache","writeFeature","writeValue","writeProperties","writeGeometry","keyIndex","valueIndex","command","zigzag","count","swapItem","sqDist","defaultGetX","defaultGetY","KDBush","getX","getY","nodeSize","ArrayType","IndexArrayType","sortKD","depth","select","inc","axis","nextAxis","qy","r2","defaultOptions","minPoints","generateId","props","Supercluster","trees","createCluster","numPoints","parentId","createPointCluster","lngX","latY","getClusterJSON","getClusterProperties","abbrev","cluster_id","point_count","point_count_abbreviated","getSqSegDist","createFeature","calcLineBBox","calcBBox","convertFeature","tolerance","convertPoint","convertLine","convertLines","projectX","projectY","simplify","sqTolerance","maxSqDist","minPosToMid","posToMid","k2","minAll","maxAll","clipped","newGeometry","clipPoints","clipLines","newGeom","trackMetrics","segLen","newSlice","intersect","intersectX","intersectY","exited","addPoint","shiftFeatureCoords","newFeatures","shiftCoords","newPolygon","newPoints","transformTile","transformed","z2","transformPoint","createTile","numSimplified","numFeatures","simplified","tileFeature","isOuter","rewind","GeoJSONVT","time","tileCoords","timeEnd","indexMaxZoom","indexMaxPoints","stats","total","merged","splitTile","toID","loadGeoJSONTile","_geoJSONIndex","geoJSONTile","getTile","geojsonWrapper","vtpbf","byteOffset","load","timerId","clusters","_cluster","getClusters","minLng","minLat","maxLng","maxLat","easternHem","westernHem","tree","_limitZoom","getChildren","clusterId","originId","_getOriginId","originZoom","_getOriginZoom","errorMsg","origin","getLeaves","leaves","_appendLeaves","_addTileFeatures","getClusterExpansionZoom","expansionZoom","skipped","isCluster","neighborIds","numPointsOrigin","wx","wy","_map","numPoints2","original","cz","k3","k4","z0","GeoJSONWorkerSource","loadGeoJSON","loadData","_pendingCallback","abandoned","_pendingLoadDataParams","_state","_loadData","gj","superclusterOptions","mapExpressions","reduceExpressions","propertyNames","mapExpressionParsed","reduceExpressionParsed","pointProperties","getSuperclusterOptions","geojsonvt","geojsonVtOptions","getJSON","removeSource","getClusterChildren","getClusterLeaves","Worker","layerIndexes","workerSourceTypes","vector","workerSources","demWorkerSources","registerWorkerSource","WorkerSource","registerRTLTextPlugin","setReferrer","mapID","setImages","workerSource","ws","setLayers","getLayerIndex","updateLayers","loadDEMTile","getDEMWorkerSource","removeDEMTile","loadWorkerSource","importScripts","syncRTLPluginState","getAvailableImages","enforceCacheSizeLimit","isSupported","notSupportedReason","lastIndexOf","reduceRight","Function","getPrototypeOf","getOwnPropertyNames","isSealed","isFrozen","isExtensible","getOwnPropertyDescriptor","defineProperties","seal","preventExtensions","workerURL","terminate","isWorkerSupported","imageData","isCanvasGetImageDataSupported","isWebGLSupportedCache","failIfMajorPerformanceCaveat","attributes","webGLContextAttributes","probablySupportsContext","supportsContext","getWebGLContext","shader","createShader","VERTEX_SHADER","shaderSource","compileShader","getShaderParameter","COMPILE_STATUS","isWebGLSupported","mapboxgl","antialias","stencil","DOM","tagName","className","container","el","namespaceURI","createElementNS","docStyle","documentElement","testProp","userSelect","selectProp","disableDrag","enableDrag","transformProp","setTransform","passiveSupported","capture","suppressClick","preventDefault","stopPropagation","renderStyleImage","userImage","mousePos","getBoundingClientRect","clientX","clientLeft","clientY","clientTop","touchPos","touches","mouseButton","InstallTrigger","button","ctrlKey","platform","node","parentNode","removeChild","ImageManager","callbackDispatchedThisFrame","requestors","atlasImage","setLoaded","_notify","addImage","valid","_validateStretch","_validateContent","updateImage","removeImage","listImages","getImages","hasAllDependencies","getPixelSize","getPattern","pattern","_updatePatternAtlas","atlasTexture","CLAMP_TO_EDGE","dst","beginFrame","TinySDF","INF","fontSize","cutoff","fontFamily","fontWeight","textBaseline","fillStyle","gridOuter","gridInner","middle","edt","edt1d","draw","fillText","alphaChannel","GlyphManager","requestManager","localIdeographFontFamily","entries","setURL","getGlyphs","asyncAll","entry","requests","_tinySDF","loadGlyphRange","_doesCharSupportLocalGlyph","cb","tinySDF","urlTemplate","parseGlyphPBF","LightPositionProperty","sphericalToCartesian","intensity","Light","lightOptions","_transitionable","setLight","_transitioning","getLight","LineAtlas","nextRow","dashEntry","getDash","dasharray","addDash","getDashRanges","lineAtlasWidth","isDash","zeroLength","currentDashLength","dashLength","addRoundDash","halfStretch","currIndex","distLeft","distRight","minDist","signedDistance","distMiddle","distEdge","addRegularDash","REPEAT","Dispatcher","workerPool","actors","currentActor","workers","acquire","pick","vector_layers","vectorLayers","vectorLayerIds","broadcast","release","TileBounds","validateBounds","level","VectorTileSource","eventedParent","reparseOverscaled","_loaded","_options","_collectResourceTiming","dataType","_tileJSONRequest","loadTileJSON","_requestManager","tileBounds","_getMapId","sourceDataType","hasTile","setSourceProperty","sourceCaches","clearTiles","setTiles","setUrl","_refreshExpiredTiles","cacheEntryPossiblyAdded","unloadTile","RasterTileSource","roundZoom","getTileTexture","extTextureFilterAnisotropic","texParameterf","TEXTURE_MAX_ANISOTROPY_EXT","extTextureFilterAnisotropicMax","saveTileTexture","RasterDEMTileSource","needsHillshadePrepare","neighboringTiles","_getNeighboringTiles","pxw","nxw","backfilled","demTexture","fbo","GeoJSONSource","_removed","_data","_resourceTiming","attribution","workerOptions","clusterMaxZoom","clusterMinPoints","clusterRadius","_updateWorkerData","setData","ImageSource","newCoordinates","successCallback","_finishLoading","setCoordinates","cornerCoords","dMax","getCoordinatesCenterTileID","_boundsArray","RasterBoundsArray","boundsBuffer","rasterBoundsAttributes","boundsSegments","VideoSource","getVideo","loop","triggerRepaint","play","pause","seek","seconds","seekableRange","seekable","currentTime","readyState","paused","CanvasSource","animate","getElementById","_hasInvalidDimensions","_playing","getCanvas","sourceTypes","raster-dem","rasterDem","getPixelPosMatrix","calculatePosMatrix","sourceCache","has3DLayer","queryIncludes3DLayer","tilesIn","sortTilesIn","renderedFeatureLayers","tileIn","wrappedTileID","queryResults","wrappedIDLayerMap","wrappedID","wrappedIDLayers","tileFeatures","wrappedIDFeatures","resultFeatures","mergeRenderedFeatureLayers","featureWrapper","getFeatureState","idA","idB","TileCache","reset","removedData","timeout","clearTimeout","order","expiryTimeout","dataWrapper","_getAndRemoveByKey","getAndRemove","getByKey","dataIndex","setMaxSize","filterFn","removed","IndexBuffer","dynamicDraw","createBuffer","unbindVAO","bindElementBuffer","bufferData","ELEMENT_ARRAY_BUFFER","DYNAMIC_DRAW","STATIC_DRAW","bufferSubData","deleteBuffer","AttributeType","VertexBuffer","bindVertexBuffer","ARRAY_BUFFER","enableAttributes","program","attribIndex","enableVertexAttribArray","setVertexAttribPointers","vertexAttribPointer","BaseValue","getDefault","setDefault","ClearColor","clearColor","ClearDepth","clearDepth","ClearStencil","clearStencil","ColorMask","colorMask","DepthMask","depthMask","StencilMask","stencilMask","StencilFunc","func","ALWAYS","stencilFunc","StencilOp","KEEP","stencilOp","StencilTest","enable","STENCIL_TEST","disable","DepthRange","depthRange","DepthTest","DEPTH_TEST","DepthFunc","LESS","depthFunc","Blend","BLEND","BlendFunc","ONE","ZERO","blendFunc","BlendColor","blendColor","BlendEquation","FUNC_ADD","blendEquation","CullFace","CULL_FACE","CullFaceSide","BACK","cullFace","FrontFace","CCW","frontFace","Program","useProgram","ActiveTextureUnit","TEXTURE0","activeTexture","Viewport","drawingBufferWidth","drawingBufferHeight","viewport","BindFramebuffer","bindFramebuffer","FRAMEBUFFER","BindRenderbuffer","bindRenderbuffer","RENDERBUFFER","BindTexture","BindVertexBuffer","bindBuffer","BindElementBuffer","BindVertexArrayOES","vao","extVertexArrayObject","bindVertexArrayOES","PixelStoreUnpack","pixelStorei","UNPACK_ALIGNMENT","PixelStoreUnpackPremultiplyAlpha","UNPACK_PREMULTIPLY_ALPHA_WEBGL","PixelStoreUnpackFlipY","UNPACK_FLIP_Y_WEBGL","FramebufferAttachment","ColorAttachment","setDirty","framebufferTexture2D","COLOR_ATTACHMENT0","DepthAttachment","framebufferRenderbuffer","DEPTH_ATTACHMENT","Framebuffer","hasDepth","framebuffer","createFramebuffer","colorAttachment","depthAttachment","renderbuffer","deleteRenderbuffer","deleteFramebuffer","DepthMode","ReadOnly","ReadWrite","disabled","StencilMode","fail","depthFail","ColorMode","blendFunction","Replace","unblended","alphaBlended","CullFaceMode","mode","backCCW","Context","getExtension","stencilTest","depthTest","blend","cullFaceSide","getParameter","MAX_TEXTURE_MAX_ANISOTROPY_EXT","extTextureHalfFloat","extRenderToTextureHalfFloat","extTimerQuery","maxTextureSize","MAX_TEXTURE_SIZE","createRenderbuffer","storageFormat","rbo","renderbufferStorage","COLOR_BUFFER_BIT","DEPTH_BUFFER_BIT","setCullFace","cullFaceMode","setDepthMode","depthMode","setStencilMode","stencilMode","setColorMode","colorMode","SourceCache","_sourceLoaded","_paused","reload","_sourceErrored","_source","createSource","_tiles","_cache","_unloadTile","_timers","_cacheTimers","_maxTileCacheSize","_loadedParentTiles","_coveredTiles","getSource","resume","shouldReload","_shouldReloadOnResume","_loadTile","_abortTile","getIds","compareTileId","getRenderableIds","symbolLayer","renderables","_isIdRenderable","a_","b_","rotatedA","rotatedB","hasRenderableParent","parentTile","findLoadedParent","_reloadTile","_tileLoaded","previousState","refreshedUponExpiration","_setTileReloadTimer","_backfillDEM","borderId","getTileByID","fillBorder","_retainLoadedChildren","idealTiles","maxCoveringZoom","retain","topmostLoadedID","parentID","minCoveringZoom","parentTileID","_getLoadedTile","updateCacheSize","widthInTiles","heightInTiles","viewDependentMaxSize","handleWrapJump","wrapDelta","_prevLng","idealTileIDs","used","getVisibleUnwrappedCoordinates","unwrapped","coveringTiles","coveringZoomLevel","maxOverzooming","maxUnderzooming","_updateRetainedTiles","isRasterType","parentsForFading","fadingTiles","_addTile","retainedId","keysDifference","_fadeDuration","_removeTile","_updateLoadedParentTileCache","releaseSymbolFadeTiles","checked","missingTiles","childCoord","childTile","parentWasRequested","tileKey","currentId","pointQueryGeometry","tileResults","cameraPointQueryGeometry","getCameraQueryGeometry","pointCoordinate","tileSpaceBounds","tileSpaceQueryGeometry","tileSpaceCameraQueryGeometry","getVisibleCoordinates","posMatrix","reloadTilesForDependencies","aWrap","bWrap","workerUrl","PRELOAD_POOL_ID","WorkerPool","active","workerCount","WebWorker","numActive","isPreloaded","globalWorkerPool","availableLogicalProcessors","getGlobalWorkerPool","deref","derefLayers","operations","setStyle","addLayer","removeLayer","setFilter","addSource","setGeoJSONSourceData","setLayerZoomRange","setLayerProperty","setCenter","setZoom","setBearing","setPitch","setSprite","setGlyphs","after","commands","sourcesRemoved","updateSource","canUpdateGeoJSON","before","isEqual","diffLayerPropertyChanges","pluckId","indexById","PathInterpolator","points_","padding_","_distances","paddedLength","lerp","distOfCurrentIdx","distToTarget","idxOfPrevPoint","distOfPrevIdx","segmentLength","segmentT","boxCells","circleCells","xCellCount","yCellCount","circleKeys","boxKeys","circles","xScale","yScale","boxUid","circleUid","getLabelPlaneMatrix","pitchWithMap","rotateWithMap","labelPlaneMatrix","getGlCoordMatrix","glCoordMatrix","xyTransformMat4","signedDistanceFromCamera","getPerspectiveRatio","isVisible","anchorPos","clippingBuffer","updateLineLabels","partiallyEvaluatedSize","symbolSize","placedSymbols","aspectRatio","useVertical","hideGlyphs","perspectiveRatio","pitchScaledFontSize","tileAnchorPoint","projectionCache","placeUnflipped","placeGlyphsAlongLine","notEnoughRoom","needsFlipping","placeFirstAndLastGlyph","flip","glyphEndIndex","lineEndIndex","firstGlyphOffset","lastGlyphOffset","firstPlacedGlyph","placeGlyphAlongLine","lastPlacedGlyph","requiresOrientationChange","firstPoint","lastPoint","placedGlyphs","firstAndLastGlyph","orientationChange","glyphIndex","tileVertexIndex","tileSegmentEnd","projectedVertex","projectTruncatedLineSegment","singleGlyph","previousTilePoint","currentTilePoint","previousProjectedPoint","minimumLength","projectionMatrix","projectedUnitVertex","projectedUnitSegment","anchorSegment","combinedOffsetX","distanceToPrev","currentSegmentDistance","absOffsetX","pathVertices","projection","previousLineVertexIndex","segmentInterpolationT","prevToCurrent","segmentAngle","keysLength","_insertBoxCell","insertCircle","_insertCircleCell","_query","hitTest","predicate","_queryCircle","_queryCellCircle","hitTestCircle","queryArgs","boxCell","circleCell","_circleAndRectCollide","_circlesCollide","_convertToXCellCoord","_convertToYCellCoord","r1","bothRadii","circleX","circleY","halfRectWidth","distX","halfRectHeight","distY","hiddenGlyphAttributes","CollisionIndex","ignoredGrid","pitchfactor","_pitch","screenRightBoundary","screenBottomBoundary","gridRightBoundary","gridBottomBoundary","pixelValue","placeCollisionBox","collisionBox","allowOverlap","textPixelRatio","collisionGroupPredicate","projectedPoint","projectAndGetPerspectiveRatio","tileToViewport","tlX","tlY","brX","brY","isInsideGrid","offscreen","isOffscreen","placeCollisionCircles","labelToScreenMatrix","showCollisionCircles","circlePixelDiameter","textPixelPadding","placedCollisionCircles","tileUnitAnchorPoint","screenAnchorPoint","labelPlaneFontScale","labelPlaneAnchorPoint","collisionDetected","inGrid","entirelyOffscreen","screenPlaneMin","screenPlaneMax","interpolator","projectedPath","circleDist","screenSpacePath","minPoint","maxPoint","numCircles","circlePosition","centerX","centerY","queryRenderedSymbols","viewportQueryGeometry","gridPoint","seenFeatures","featureKey","bucketInstanceId","intersectionTests","insertCollisionBox","ignorePlacement","collisionGroupID","insertCollisionCircles","collisionCircles","getViewportMatrix","OpacityState","prevState","increment","placed","skipFade","opacity","JointOpacityState","placedText","placedIcon","JointPlacement","CollisionCircleArray","invProjMatrix","viewportMatrix","RetainedQueryData","CollisionGroups","crossSourceCollisions","maxGroupID","collisionGroups","calculateVariableLayoutShift","shiftVariableCollisionBox","rotatedOffset","ID","nextGroupID","Placement","prevPlacement","collisionIndex","placements","opacities","variableOffsets","stale","commitTime","retainedQueryData","collisionCircleArrays","placedOrientations","updateCollisionVertices","notUsed","getBucketParts","sortAcrossTiles","symbolBucket","bucketFeatureIndex","pixelsToTiles","textLabelPlaneMatrix","partiallyEvaluatedTextSize","collisionGroup","attemptAnchorPlacement","textAllowOverlap","orientation","prevAnchor","placedGlyphBoxes","markUsedJustification","markUsedOrientation","placeLayerBucketPart","bucketPart","seenCrossTileIDs","textOptional","iconOptional","iconAllowOverlap","zOrderByViewportY","alwaysShowText","alwaysShowIcon","placeSymbol","placeText","placeIcon","placedVerticalText","placedGlyphCircles","placedIconBoxes","updatePreviousOrientationIfNotPlaced","isPlaced","previousOrientation","prevPlacedOrientation","placeTextForPlacementModes","placeHorizontalFn","placeVerticalFn","prevOffsets","unshift","placeBoxForVariableAnchors","collisionTextBox","collisionIconBox","variableIconBox","placedBox","placementAttempts","prevOrientation","prevOffset","placeBox","placedFeature","placeIconFeature","shiftedIconBox","iconWithoutText","textWithoutIcon","circleArray","symbolIndexes","symbolIndex","placedAnchor","autoIndex","commit","zoomAtLastRecencyCheck","placementChanged","prevZoomAdjustment","zoomAdjustment","symbolFadeChange","prevOpacities","prevOrientations","jointPlacement","prevOpacity","jointOpacity","lastPlacementChangeTime","updateLayerOpacities","updateBucketOpacities","duplicateOpacityState","variablePlacement","defaultOpacityState","addOpacities","opacityState","horizontalHidden","verticalHidden","packedOpacity","packOpacity","PACKED_HIDDEN_OPACITY","symbolHidden","useHorizontal","variableOffset","verticalIconUsed","instance","hasTransitions","stillRecent","durationAdjustment","setStale","shift25","shift24","shift17","shift16","shift9","shift8","shift1","targetBit","opacityBits","LayerPlacement","_sortAcrossTiles","_currentTileIndex","_currentPartIndex","_seenCrossTileIDs","_bucketParts","continuePlacement","placement","shouldPausePlacement","bucketParts","PauseablePlacement","forceFullPlacement","_currentPlacementIndex","_forceFullPlacement","_showCollisionBoxes","_done","isDone","layerTiles","startTime","elapsedTime","placementZoom","_inProgressLayer","roundingFactor","TileLayerIndex","indexedSymbolInstances","getScaledCoordinates","childTileID","findMatches","newTileID","zoomCrossTileIDs","indexedInstances","scaledSymbolCoord","thisTileSymbol","CrossTileIDs","maxCrossTileID","generate","CrossTileSymbolLayerIndex","indexes","usedCrossTileIDs","zoomIndexes","newZoomIndex","addBucket","crossTileIDs","removeBucketCrossTileIDs","childIndex","parentIndex","removedBucket","removeStaleBuckets","currentIDs","tilesChanged","CrossTileSymbolIndex","maxBucketInstanceId","bucketsInCurrentPlacement","symbolBucketsChanged","currentBucketIDs","pruneUnusedLayers","usedLayers","usedLayerMap","usedLayer","_emitValidationErrors","supportedDiffOperations","diffOperations","ignoredDiffOperations","empty","latest","styleKey","emptyStyle","getWorkerPool","glyphManager","lineAtlas","crossTileSymbolIndex","_serializedLayers","_order","_availableImages","_resetUpdates","_rtlTextPluginCallback","registerForPluginStateChange","elem","_validateLayer","loadURL","_request","_load","loadJSON","loadEmpty","stylesheet","_loadSprite","_serializeLayers","_spriteRequest","baseURL","jsonRequest","maybeComplete","imageRequest","loadSprite","_updatedSources","_checkLoaded","changed","_changed","updatedIds","_updatedLayers","_removedLayers","_updateWorkerLayers","action","_reloadSource","_clearSource","_updateTilesForChangedImages","_updatedPaintProps","sourcesUsedBefore","changedImages","_changedImages","nextState","changes","pitch","removeOrAddSourceCommands","diffSources","beforeLayers","beforeLayer","afterLayer","insertBeforeLayerId","beforeOrder","afterOrder","beforeIndex","afterIndex","tracker","clean","diffLayers","diffStyles","unimplementedOps","_afterImageUpdated","isSourceLoaded","validateCustomStyleLayer","_layerOrderChanged","_updateLayer","moveLayer","newIndex","getFilter","_flattenAndSortRenderedFeatures","sourceResults","isLayer3D","features3D","layerFeatures","topmost3D","includedSources","renderedSymbols","bucketQueryData","queryData","bucketSymbols","layerSymbols","sortedA","layerName","dataTiles","dataID","addSourceType","SourceType","getSourceType","setSourceType","workerSourceURL","_update","_remove","rtlTextPluginEvented","_updateSources","_generateCollisionBoxes","_updatePlacement","placementCommitted","layerBucketsChanged","pauseablePlacement","_releaseSymbolFadeTiles","getResource","prelude","compile","backgroundPattern","clippingMask","heatmapTexture","collisionCircle","fillOutline","fillOutlinePattern","fillPattern","fillExtrusionPattern","hillshadePrepare","lineGradient","linePattern","lineSDF","symbolIcon","symbolSDF","symbolTextAndIcon","fragmentSource","vertexSource","re","staticAttributes","fragmentUniforms","vertexUniforms","staticUniforms","fragmentPragmas","operation","attrType","unpackType","VertexArrayObject","boundProgram","boundLayoutVertexBuffer","boundPaintVertexBuffers","boundIndexBuffer","boundVertexOffset","boundDynamicVertexBuffer","getTokenizedAttributesAndUniforms","paintVertexBuffers","dynamicVertexBuffer","dynamicVertexBuffer2","paintBuffersDiffer","boundDynamicVertexBuffer2","freshBind","numPrevAttributes","numNextAttributes","numAttributes","createVertexArrayOES","currentNumAttributes","disableVertexAttribArray","vertexBuffer","deleteVertexArrayOES","configuration","fixedUniforms","showOverdrawInspector","createProgram","staticAttrInfo","dynamicAttrInfo","allAttrInfo","staticUniformsInfo","dynamicUniformsInfo","allUniformsInfo","fragmentShader","FRAGMENT_SHADER","failedToCreate","attachShader","vertexShader","uniformLocations","bindAttribLocation","linkProgram","deleteShader","it","uniformLocation","getUniformLocation","patternUniformValues","tileRatio","numTiles","tileSizeAtNearestZoom","pixelX","pixelY","u_image","u_texsize","u_scale","u_fade","u_pixel_coord_upper","u_pixel_coord_lower","drawMode","uniformValues","currentProperties","dynamicLayoutBuffer","dynamicLayoutBuffer2","primitiveSize","LINES","TRIANGLES","LINE_STRIP","drawElements","UNSIGNED_SHORT","fillExtrusionUniformValues","shouldUseVerticalGradient","_lp","lightPos","lightMat","mat3","vec3","lightColor","u_matrix","u_lightpos","u_lightintensity","u_lightcolor","u_vertical_gradient","u_opacity","fillExtrusionPatternUniformValues","u_height_factor","fillUniformValues","fillPatternUniformValues","fillOutlineUniformValues","drawingBufferSize","u_world","fillOutlinePatternUniformValues","circleUniformValues","extrudeScale","pixelsToGLUnits","u_camera_to_center_distance","u_scale_with_map","translatePosMatrix","u_pitch_with_map","u_device_pixel_ratio","u_extrude_scale","collisionUniformValues","u_pixels_to_tile_units","u_overscale_factor","collisionCircleUniformValues","invMatrix","u_inv_matrix","u_viewport_size","debugUniformValues","scaleRatio","u_color","u_overlay","u_overlay_scale","clippingMaskUniformValues","heatmapUniformValues","u_intensity","lineUniformValues","calculateMatrix","u_ratio","u_units_to_pixels","lineGradientUniformValues","u_image_height","linePatternUniformValues","tileZoomRatio","calculateTileRatio","lineSDFUniformValues","posA","posB","widthA","widthB","u_patternscale_a","u_patternscale_b","u_sdfgamma","u_tex_y_a","u_tex_y_b","u_mix","rasterUniformValues","parentTL","parentScaleBy","fade","u_tl_parent","u_scale_parent","u_buffer_scale","u_fade_t","mix","u_image0","u_image1","u_brightness_low","u_brightness_high","u_saturation_factor","saturation","u_contrast_factor","contrast","u_spin_weights","spinWeights","quadTriangles","symbolIconUniformValues","rotateInShader","texSize","u_is_size_zoom_constant","u_is_size_feature_constant","u_size_t","u_size","u_pitch","u_rotate_symbol","u_aspect_ratio","u_fade_change","u_label_plane_matrix","u_coord_matrix","u_is_text","u_texture","symbolSDFUniformValues","isHalo","u_gamma_scale","u_is_halo","symbolTextAndIconUniformValues","texSizeSDF","texSizeIcon","u_texsize_icon","u_texture_icon","backgroundUniformValues","backgroundPatternUniformValues","imagePosA","imagePosB","u_pattern_tl_a","u_pattern_br_a","u_pattern_tl_b","u_pattern_br_b","u_pattern_size_a","u_pattern_size_b","u_scale_a","u_scale_b","u_tile_units_to_pixels","bgPatternUniformValues","programUniforms","u_color_ramp","u_latrange","u_light","u_shadow","u_highlight","u_accent","u_dimension","u_zoom","u_unpack","drawCollisionDebug","tileBatches","circleCount","circleOffset","invTransform","colorModeForRenderPass","circleProgram","vertexData","CollisionCircleLayoutArray","batch","circleIdx","collision","quadCount","triCount","QuadTriangleArray","idx","createQuadTriangles","identityMat4","calculateVariableRenderShift","renderTextSize","updateVariableAnchorsForBucket","tileScale","updateTextFitIcon","dynamicTextLayoutVertexArray","dynamicIconLayoutVertexArray","placedTextShifts","tileAnchor","projectedAnchor","symbolProjection","shiftedAnchor","placedIcons","getSymbolProgramName","drawLayerSymbols","rotationAlignment","pitchAlignment","hasSortKey","depthModeForSublayer","tileRenderState","programConfiguration","atlasInterpolation","atlasTextureIcon","atlasInterpolationIcon","rotating","zooming","NEAREST","iconScaled","hasVariableAnchors","uLabelPlaneMatrix","uglCoordMatrix","hasHalo","segmentState","TEXTURE1","drawSymbolElements","drawFillTiles","isOutline","programName","atlas","tileMatrix","stencilModeForClipping","drawExtrusionTiles","renderHillshade","shadow","highlight","accent","moving","hillshadeUniformValues","rasterBoundsBuffer","quadTriangleIndexBuffer","rasterBoundsSegments","prepareHillshade","textureStride","pixelData","renderTexture","hillshadeUniformPrepareValues","getFadeValues","sinceTile","sinceParent","idealZ","fadeIn","childOpacity","topColor","btmColor","leftColor","rightColor","centerColor","drawHorizontalLine","drawDebugSSRect","drawVerticalLine","SCISSOR_TEST","scissor","drawDebugTile","emptyTexture","debugBuffer","tileBorderIndexBuffer","debugSegments","tileRawData","tileSizeKb","tileIdText","initDebugOverlayCanvas","debugOverlayCanvas","ctx2d","shadowColor","shadowBlur","strokeStyle","strokeText","debugOverlayTexture","drawTextToOverlay","renderPass","pixelToTileScale","updateVariableAnchors","strokeWidth","strokeOpacity","segmentsRenderStates","segmentsState","HALF_FLOAT_OES","bindTextureToFramebuffer","textureUnit","colorRampUnit","heatmapTextureUniformValues","viewportBuffer","viewportSegments","renderTextureToMap","gradient","programId","firstTile","prevProgram","programChanged","layerGradient","gradientTexture","textureResolution","potentialOverzoom","nextPowerOfTwo","opaquePassEnabledForLayer","LEQUAL","depthRangeFor3D","stencilModeFor3D","tileIDs","stencilConfigForOverlap","stencilModes","minTileZ","textureFilter","isPatternMissing","tileExtentBuffer","tileExtentSegments","setCustomLayerDefaults","customLayerMatrix","setBaseState","Painter","_tileTextures","setup","numSublayers","depthEpsilon","gpuTimers","tileExtentArray","PosArray","posAttributes","debugArray","rasterBoundsArray","viewportArray","tileLineStripIndices","LineStripIndexArray","quadTriangleIndices","stencilClearMode","nextStencilID","currentStencilSource","_renderTileClippingMasks","_tileClippingMaskIDs","REPLACE","NOTEQUAL","EQUAL","stencilValues","zToStencilMode","GEQUAL","_showOverdrawInspector","CONSTANT_COLOR","currentLayer","opaquePassCutoff","selectedSource","coordsAscending","coordsDescending","coordsDescendingSymbol","renderLayer","showTileBoundaries","showPadding","centerPoint","drawCrosshair","drawDebugPadding","gpuTimingStart","gpuTimingEnd","gpuTiming","ext","layerTimer","calls","cpuTime","createQueryEXT","beginQueryEXT","TIME_ELAPSED_EXT","endQueryEXT","collectGpuTimers","currentLayerTimers","queryGpuTimers","gpuTimer","gpuTime","getQueryObjectEXT","QUERY_RESULT_EXT","deleteQueryEXT","inViewportPixelUnitsUnits","sinA","cosA","translation","translatedMatrix","textures","shaders","Frustum","planes_","planes","fromInvProjectionMatrix","invProj","frustumCoords","frustumPlanes","Aabb","min_","max_","quadrant","qMin","qMax","distanceX","distanceY","frustum","aabbPoints","fullyInside","plane","pointsInside","projMin","MAX_VALUE","projMax","EdgeInsets","Transform","minPitch","maxPitch","renderWorldCopies","maxValidLatitude","_renderWorldCopies","_minZoom","_maxZoom","_minPitch","_maxPitch","setMaxBounds","_center","_fov","_unmodified","_edgeInsets","_posMatrixCache","_alignedPosMatrixCache","latRange","_calcMatrices","centerOffset","rotationMatrix","mat2","fov","_zoom","zoomScale","zoomFraction","_constrain","isPaddingEqual","interpolatePadding","scaleZoom","utl","utr","ubl","ubr","w0","w1","actualZ","centerCoord","cameraFrustum","newRootTile","aabb","fullyVisible","intersectResult","longestDim","distanceSq","vec2","childX","childY","unmodified","unproject","setLocationAtPoint","loc","locationCoordinate","newCenter","coordinateLocation","locationPoint","coordinatePoint","pointLocation","coord0","coord1","pixelMatrixInverse","z1","pixelMatrix","getMaxBounds","lngRange","unwrappedTileID","aligned","posMatrixKey","unwrappedX","alignedProjMatrix","projMatrix","mercatorMatrix","_constraining","sy","sx","h2","w2","groundAngle","fovAboveCenter","topHalfSurfaceDistance","farZ","nearZ","xShift","yShift","angleCos","angleSin","alignedM","getCameraPoint","yOffset","Hash","hashName","pending","later","_hashName","_updateHash","_updateHashUnthrottled","addTo","_onHashChange","getHashString","mapFeedback","getZoom","getBearing","getPitch","hash","found","_getCurrentHash","keyval","dragRotate","isEnabled","touchZoomRotate","jumpTo","history","replaceState","SecurityError","defaultInertiaOptions","linearity","easing","defaultPanInertiaOptions","deceleration","maxSpeed","defaultZoomInertiaOptions","defaultBearingInertiaOptions","defaultPitchInertiaOptions","HandlerInertia","extendDuration","easeOptions","calculateEasing","amount","inertiaDuration","inertiaOptions","speed","_inertiaBuffer","record","settings","_drainInertiaBuffer","inertia","_onMoveEnd","panInertiaOptions","deltas","pan","pinchAround","around","zoomDelta","bearingDelta","pitchDelta","panDelta","noMoveStart","MapMouseEvent","originalEvent","getCanvasContainer","_defaultPrevented","defaultPrevented","MapTouchEvent","changedTouches","lngLats","curr","MapWheelEvent","MapEventHandler","_clickTolerance","clickTolerance","_mousedownPos","wheel","_firePreventable","mousedown","mouseup","click","dblclick","mouseover","mouseout","touchstart","touchmove","touchend","touchcancel","mapEvent","isActive","BlockableMapEventHandler","_delayContextMenu","_contextMenuEvent","mousemove","contextmenu","BoxZoomHandler","_el","_container","getContainer","indexTouches","_enabled","_active","shiftKey","_startPos","_lastPos","mousemoveWindow","_box","classList","_fireEvent","mouseupWindow","cameraAnimation","fitScreenCoordinates","linear","keydown","keyCode","SingleTapRecognizer","numTouches","centroid","mapTouches","timeStamp","getCentroid","newTouches","TapRecognizer","singleTap","numTaps","lastTime","lastTap","tap","soonEnough","closeEnough","TapZoomHandler","_zoomIn","_zoomOut","zoomInPoint","zoomOutPoint","easeTo","BUTTONS_FLAGS","MouseHandler","_moved","_lastPoint","_eventButton","_correctButton","_move","eventButton","flag","buttons","buttonStillPressed","MousePanHandler","MouseRotateHandler","MousePitchHandler","TouchPanHandler","_minTouches","_touches","_sum","_calculateTransform","touchPointSum","touchDeltaSum","touchDeltaCount","prevPoint","TwoTouchHandler","getTouchById","getZoomDelta","lastDistance","_firstTwoTouches","_start","_aroundCenter","TouchZoomHandler","_distance","_startDistance","getBearingDelta","TouchRotateHandler","_minDiameter","_startVector","_vector","lastVector","_isBelowThreshold","threshold","bearingDeltaSinceStart","isVertical","TouchPitchHandler","_valid","_firstMove","_lastPoints","vectorA","vectorB","gestureBeginsVertically","movedA","movedB","isSameDirection","panStep","bearingStep","pitchStep","KeyboardHandler","stepOptions","_panStep","_bearingStep","_pitchStep","_rotationDisabled","easeOut","altKey","metaKey","zoomDir","bearingDir","pitchDir","xDir","yDir","easeId","disableRotation","enableRotation","ScrollZoomHandler","handler","_handler","_delta","_defaultZoomRate","_wheelZoomRate","setZoomRate","zoomRate","setWheelZoomRate","wheelZoomRate","_finishTimeout","isZooming","_zooming","deltaMode","WheelEvent","DOM_DELTA_LINE","deltaY","timeDelta","_lastWheelEventTime","_type","_lastValue","_timeout","_onTimeout","_lastWheelEvent","initialEvent","_frameId","_around","_aroundPoint","_triggerRenderFrame","renderFrame","_targetZoom","_startZoom","_easing","_smoothOutEasing","targetZoom","startZoom","finished","noInertia","needsRenderFrame","_ease","_prevEase","DoubleClickZoomHandler","clickZoom","TapZoom","_clickZoom","_tapZoom","ClickZoomHandler","TapDragZoomHandler","_tap","_swipePoint","_swipeTouch","_tapTime","newSwipePoint","DragPanHandler","mousePan","touchPan","_mousePan","_touchPan","_inertiaOptions","DragRotateHandler","mouseRotate","mousePitch","_pitchWithRotate","pitchWithRotate","_mouseRotate","_mousePitch","TouchZoomRotateHandler","touchZoom","touchRotate","tapDragZoom","_touchZoom","_touchRotate","_tapDragZoom","isMoving","drag","RenderFrameEvent","hasChange","HandlerManager","_handlers","_handlersById","_changes","_inertia","_bearingSnap","bearingSnap","_previousActiveHandlers","_eventsInProgress","_addDefaultHandlers","passive","handleWindowEvent","handleEvent","boxZoom","tapZoom","doubleClickZoom","touchPitch","dragPan","scrollZoom","keyboard","interactive","handlerName","allowed","allowEndAnimation","_updatingCamera","_fireEvents","isRotating","_blockedByActive","activeHandlers","myName","_getMapTouches","eventName","inputEvent","mergedHandlerResult","eventsInProgress","mergeHandlerResult","deactivatedHandlers","_stop","handlerResult","_applyChanges","combined","combinedEventsInProgress","combinedDeactivatedHandlers","change","_updateMapTransform","combinedResult","newEventsInProgress","wasMoving","nowMoving","startEvents","originalEndEvent","endEvents","stillMoving","inertialEase","shouldSnapToNorth","resetNorth","_requestFrame","_renderTaskQueue","Camera","_moving","panBy","panTo","zoomTo","zoomIn","zoomOut","getPadding","setPadding","rotateTo","resetNorthPitch","snapToNorth","cameraForBounds","_cameraForBoxAndBearing","defaultPadding","edgePadding","p0world","p1world","p0rotated","p1rotated","upperRight","lowerLeft","scaleX","scaleY","rotatedPaddingOffset","offsetAtFinalZoom","fitBounds","_fitInternal","calculatedOptions","flyTo","zoomChanged","bearingChanged","pitchChanged","defaultEasing","essential","startBearing","startPitch","startPadding","_normalizeBearing","offsetAsPoint","pointAtOffset","locationAtOffset","_normalizeCenter","aroundPoint","finalScale","currently","_rotating","pitching","_pitching","_padding","_easeId","_prepareEase","speedup","_fireMoveEvents","interruptingEaseId","_afterEase","wasZooming","wasRotating","wasPitching","coercedOptions","curve","rho","u1","wMax","rho2","sinh","cosh","r0","S","screenSpeed","maxDuration","isEasing","_easeFrameId","allowGestures","_cancelRenderFrame","_onEaseFrame","_onEaseEnd","onEaseEnd","handlers","_easeStart","_easeOptions","_requestRenderFrame","_renderFrameCallback","currentBearing","diff","AttributionControl","getDefaultPosition","compact","_compactButton","_toggleAttribution","_setElementTitle","_innerContainer","setAttribute","_updateAttributions","_updateEditLink","_updateData","_updateCompact","_attribHTML","element","title","_getUIString","editLink","_editLink","querySelector","styleOwner","styleId","paramString","acc","_hash","rel","attributions","customAttribution","owner","attribHTML","attrib","innerHTML","offsetWidth","LogoControl","display","_updateLogo","_logoRequired","mapbox_logo","containerChildren","TaskQueue","_queue","_id","_cleared","_currentlyRunning","running","run","defaultLocale","AttributionControl.ToggleAttribution","AttributionControl.MapFeedback","FullscreenControl.Enter","FullscreenControl.Exit","GeolocateControl.FindMyLocation","GeolocateControl.LocationNotAvailable","LogoControl.Title","NavigationControl.ResetBearing","NavigationControl.ZoomIn","NavigationControl.ZoomOut","ScaleControl.Feet","ScaleControl.Meters","ScaleControl.Kilometers","ScaleControl.Miles","ScaleControl.NauticalMiles","attributionControl","preserveDrawingBuffer","trackResize","refreshExpiredTiles","maxTileCacheSize","Map","_interactive","_failIfMajorPerformanceCaveat","_preserveDrawingBuffer","_antialias","_trackResize","_crossSourceCollisions","_crossFadingFactor","_controls","_mapId","_locale","HTMLElement","maxBounds","_setupContainer","_setupPainter","_onWindowOnline","_onWindowResize","fitBoundsOptions","_localIdeographFontFamily","addControl","logoPosition","control","controlElement","positionContainer","_controlPositions","insertBefore","firstChild","removeControl","ci","hasControl","_containerDimensions","_resizeCanvas","fireMoving","setMinZoom","getMinZoom","setMaxZoom","getMaxZoom","setMinPitch","getMinPitch","setMaxPitch","getMaxPitch","getRenderWorldCopies","setRenderWorldCopies","_createDelegatedListener","mousein","delegates","delegatedListener","_delegatedListeners","delegatedListeners","listeners","removeDelegatedListener","_diffStyle","_updateStyle","_lazyInitEmptyStyle","_updateDiff","getStyle","isStyleLoaded","areTilesLoaded","existingImage","hasImage","loadImage","beforeId","_canvasContainer","_canvas","clientWidth","clientHeight","canvasContainer","_contextLost","_contextRestored","controlContainer","_controlContainer","positionName","_onMapScroll","testSupport","_frame","scrollTop","scrollLeft","_styleDirty","_sourcesDirty","updateStyle","_render","paintStartTimeStamp","frameStartTime","crossFading","_placementDirty","renderCPUTime","renderGPUTime","frameLayerQueries","renderedLayerTimes","layerTimes","somethingDirty","_repaint","_fullyLoaded","loseContext","_showTileBoundaries","_showPadding","repaint","_vertices","_setCacheLimits","setCacheLimits","showCompass","showZoom","visualizePitch","NavigationControl","_zoomInButton","_createButton","_zoomOutButton","_compass","_compassIcon","_updateZoomButtons","isMax","isMin","_rotateCompassArrow","_setButtonTitle","MouseRotateWrapper","priorPos","down","move","offTemp","targetTouches","anchorTranslate","top-left","top-right","bottom-left","bottom-right","applyAnchorClass","prefix","supportsGeolocation","Marker","legacyOptions","_anchor","_color","_scale","_draggable","draggable","_isDragging","_rotation","rotation","_rotationAlignment","_pitchAlignment","_element","_offset","_defaultMarker","svg","createNS","setAttributeNS","defaultHeight","defaultWidth","markerLarge","page1","rx","ry","ellipse","bgPath","border","borderPath","maki","circleContainer","circle1","circle2","_popup","setDraggable","_onMapClick","_addDragHandler","_onUp","_onMove","getLngLat","_lngLat","setLngLat","_pos","getElement","setPopup","popup","_onKeyPress","_originalTabIndex","removeAttribute","linearOffset","markerHeight","getAttribute","legacyCode","charCode","togglePopup","targetElement","getPopup","isOpen","smartWrap","getOffset","setOffset","_pointerdownPos","_positionDelta","pointerEvents","shouldBeDraggable","isDraggable","setRotation","getRotation","setRotationAlignment","getRotationAlignment","setPitchAlignment","getPitchAlignment","positionOptions","enableHighAccuracy","maximumAge","trackUserLocation","showAccuracyCircle","showUserLocation","numberOfWatches","noTimeout","GeolocateControl","_setupUI","permissions","geolocation","_geolocationWatchID","clearWatch","_userLocationDotMarker","_accuracyCircleMarker","_onZoom","_isOutOfMapMaxBounds","longitude","_setErrorState","_watchState","_geolocateButton","_onSuccess","_updateMarker","_finish","_lastKnownPosition","_updateCamera","_dotElement","accuracy","geolocateSource","_accuracy","_updateCircleRadius","metersPerPixel","_circleElement","_onError","_clearWatch","_timeoutId","_setup","watchPosition","getCurrentPosition","ScaleControl","updateScale","maxMeters","maxFeet","setScale","maxDistance","pow10","multiplier","getDecimalRoundNum","setUnit","FullscreenControl","_fullscreen","_fullscreenchange","_checkFullscreenSupport","_changeIcon","fullscreenEnabled","mozFullScreenEnabled","msFullscreenEnabled","webkitFullscreenEnabled","_fullscreenButton","_updateTitle","_onClickFullscreen","_getTitle","_isFullscreen","fullscreenElement","mozFullScreenElement","webkitFullscreenElement","msFullscreenElement","toggle","exitFullscreen","mozCancelFullScreen","msExitFullscreen","webkitCancelFullScreen","requestFullscreen","mozRequestFullScreen","msRequestFullscreen","webkitRequestFullscreen","closeButton","closeOnClick","focusAfterOpen","focusQuerySelector","Popup","_onClose","closeOnMove","_focusFirstElement","_trackPointer","_onMouseMove","_onMouseUp","_content","_onDrag","trackPointer","setText","setDOMContent","createTextNode","setHTML","html","frag","createDocumentFragment","temp","getMaxWidth","setMaxWidth","htmlNode","hasChildNodes","_createCloseButton","addClassName","removeClassName","toggleClassName","_closeButton","cursor","_tip","normalizeOffset","cornerOffset","convertedOffset","anchorComponents","offsetHeight","offsetedPos","firstFocusable","focus","setRTLTextPlugin","pool","baseApiUrl","maxParallelImageRequests","numRequests","clearStorage","clearTileCache","addProtocol","customProtocol","loadFn","removeProtocol"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gHA4BiBA,EAEjB,SAASA,EAAWC,EAAKC,EAAKC,EAAKC,GAE/BC,KAAKC,GAAK,EAAML,EAChBI,KAAKE,GAAK,GAAOJ,EAAMF,GAAOI,KAAKC,GACnCD,KAAKG,GAAK,EAAMH,KAAKC,GAAKD,KAAKE,GAE/BF,KAAKI,GAAK,EAAMP,EAChBG,KAAKK,GAAK,GAAON,EAAMF,GAAOG,KAAKI,GACnCJ,KAAKM,GAAK,EAAMN,KAAKI,GAAKJ,KAAKK,GAE/BL,KAAKJ,IAAMA,EACXI,KAAKH,IAAME,EACXC,KAAKF,IAAMA,EACXE,KAAKD,IAAMA,GAGfJ,EAAWY,UAAUC,aAAe,SAASC,GAEzC,cAAcN,GAAKM,EAAIT,KAAKE,IAAMO,EAAIT,KAAKC,IAAMQ,GAGrDd,EAAWY,UAAUG,aAAe,SAASD,GACzC,cAAcH,GAAKG,EAAIT,KAAKK,IAAMI,EAAIT,KAAKI,IAAMK,GAGrDd,EAAWY,UAAUI,uBAAyB,SAASF,GACnD,UAAcT,KAAKG,GAAKM,EAAI,EAAMT,KAAKE,IAAMO,EAAIT,KAAKC,IAG1DN,EAAWY,UAAUK,YAAc,SAASC,EAAGC,GAG3C,IAAIC,EAAIC,EAAIC,EAAIC,EAAIC,EAGpB,SALuB,IAAZL,IAAyBA,EAAU,MAKzCG,EAAKJ,EAAGM,EAAI,EAAGA,EAAI,EAAGA,IAAK,CAG5B,GADAD,EAAKlB,KAAKQ,aAAaS,GAAMJ,EACzBO,KAAKC,IAAIH,GAAMJ,EAAS,OAAOG,EAEnC,IAAIK,EAAKtB,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AO87L,EAAYj7L,SACzGovL,GAAiB9wL,KAAKmwK,WAAYnuF,EAAQ,wBAG9C44G,8BACI,GAAK56L,KAAKua,QAAQggL,gBAAmBv6L,KAAKmwK,WAA1C,CAEArrK,IAAM83L,EAAiB58L,KAAKmwK,WAAW8V,cAAcuU,IAEjDoC,GAAgBA,EAAeC,uBAGvCnC,oBACI16L,KAAKg/F,cAzesB7gF,WCnE7B/S,GAAW,SACb04D,oBACA72D,mBACA6vL,0CACAxnJ,6BACA2zI,qBACAuG,oBACAwG,sBACAjR,gBACAiT,qBACAU,SACA+B,UACAxJ,SACAv5K,UACAmpF,sBACAN,qBACA9+F,2BACAuhG,6BACA7kF,iBACA1R,iBnFhCJ,WACuBs7H,KACRlZ,QAAQyY,8BAGvB,WACIxiI,IAAMi4L,EAAOl1D,GACTk1D,IAEIA,EAAKn1D,eAAsC,IAArBm1D,EAAKp1D,aAC3Bo1D,EAAK5tE,QAAQmY,IACbO,GAAmB,MAEnBlgI,QAAQC,KAAK,4MmF+DrB0H,kBACI,OAAO7C,SAAOK,cAGlBwC,gBAAgBN,GACZvC,SAAOK,aAAekC,IAW1BguL,iBACI,OAAOvwL,SAAOC,SAGlBswL,eAAevuL,GACXhC,SAAOC,QAAU+B,IAarBg5H,kBACI,OAAOF,GAAWE,aAGtBA,gBAAgBnvB,GACZivB,GAAWE,YAAcnvB,IAY7B2kF,+BACI,OAAOxwL,SAAOM,6BAGlBkwL,6BAA6BC,GACzBzwL,SAAOM,4BAA8BmwL,IAoBzCC,sBAAahpL,GACTipL,iBAAejpL,KAGnBkzH,UAAW,GAiCXg2D,qBAAYC,EAAwBC,GAChC9wL,SAAOO,qBAAqBswL,GAAkBC,IASlDC,wBAAeF,UACJ7wL,SAAOO,qBAAqBswL;;AC1N3C,EAAE;;;;;;;;"} \ No newline at end of file diff --git a/web/client/components/infrastructure/infrastructure.css b/web/client/components/infrastructure/infrastructure.css deleted file mode 100644 index 65b6bbb5..00000000 --- a/web/client/components/infrastructure/infrastructure.css +++ /dev/null @@ -1,49 +0,0 @@ -#map { - padding: 0; - margin: 0; - position: absolute; - height: 100%; - width: 100%; -} - -#infrastructureTooltip { - display: none; - left: 0; - top: 0; - background: white; - border: 2px; - border-radius: 5px; -} - -.map-overlay { - position: absolute; - bottom: 0; - right: 0; - background: var(--overlay-color); - margin-right: 20px; - font-family: var(--main-font-family); - overflow: auto; - border-radius: var(--border-radius) -} - -#mapLegend { - padding: 10px; - box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); - line-height: 18px; - height: fit-content; - margin-bottom: 40px; - width: fit-content; - background: var(--overlay-color); -} - -.legend-key { - height: 1em; - margin-right: 5px; - margin-left: 5px; -} - -.legend-key-icon { - margin-right: 7px; - display: inline-block; - height: 1em; -} diff --git a/web/client/components/infrastructure/infrastructure_component.html b/web/client/components/infrastructure/infrastructure_component.html deleted file mode 100644 index 085d5634..00000000 --- a/web/client/components/infrastructure/infrastructure_component.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - -Infrastructure - - - - - - - -
-
-
- -
-
    -
  • -
  • -
-
- - - - diff --git a/web/client/components/infrastructure/map/addIcons.js b/web/client/components/infrastructure/map/addIcons.js deleted file mode 100644 index 8a23d693..00000000 --- a/web/client/components/infrastructure/map/addIcons.js +++ /dev/null @@ -1,18 +0,0 @@ -import { elementTypes } from "./elementTypes.js"; - -export const iconUrl = window.origin + '/icons/'; -export const iconExtension = '.png'; - -export function addIcons(map) { - for (const type of elementTypes) { - const iconName = 'icon-' + type; - - map.loadImage(iconUrl + type + iconExtension, (error, image) => { - if (error) { - throw error; - } - - map.addImage(iconName, image); - }); - } -} diff --git a/web/client/components/infrastructure/map/elementTypes.js b/web/client/components/infrastructure/map/elementTypes.js deleted file mode 100644 index 83b276b4..00000000 --- a/web/client/components/infrastructure/map/elementTypes.js +++ /dev/null @@ -1,26 +0,0 @@ -export const elementTypes = ['bumper', 'border', 'track_end', 'simple_switch', - 'as', 'ms', 'ps', 'eotd', 'spl', 'tunnel', 'hlt', - 'rtcp', 'km_jump', 'line_switch', 'slope', 'cross', - 'ctc', 'station']; - -export const elementTypesReadable = { - 'bumper': 'Bumper', - 'border': 'Border', - 'track_end': 'Track End', - 'simple_switch': 'Switch', - 'as': 'Approach Signal', - 'ms': 'Main Signal', - 'ps': 'Protection Signal', - 'eotd': 'End of Train Detector', - 'spl': 'Speed Limit', - 'tunnel': 'Tunnel', - 'hlt': 'Halt', - 'rtcp': 'RTCP', - 'km_jump': 'KM Jump', - 'line_switch': 'Line Switch', - 'slope': 'Slope', - 'cross': 'Cross', - 'ctc': 'CTC', - 'station': 'Station' -}; - diff --git a/web/client/components/infrastructure/map/infrastructureMap.js b/web/client/components/infrastructure/map/infrastructureMap.js deleted file mode 100644 index 5ae34dc5..00000000 --- a/web/client/components/infrastructure/map/infrastructureMap.js +++ /dev/null @@ -1,239 +0,0 @@ -import { infrastructureMapStyle, mapLayers } from './mapStyle.js' -import * as maplibre from "./../deps/maplibre-gl.js"; -import { addIcons } from "./addIcons.js"; -import { iconUrl } from "./addIcons.js"; -import { iconExtension } from "./addIcons.js"; -import { iterate } from "../../../utl/iterate.js"; -import { elementTypes } from "./elementTypes.js"; -import { elementTypesReadable } from "./elementTypes.js"; - -function getMaxBounds(infrastructure) { - // lon_max, lon_min, lat_max, lat_min, - let boundingBox = [[-360, 360], [-360, 360]]; - - for (const gps of iterate(infrastructure.station_coords)) { - boundingBox[0][0] = Math.max(boundingBox[0][0], gps.lon); - boundingBox[0][1] = Math.min(boundingBox[0][1], gps.lon); - boundingBox[1][0] = Math.max(boundingBox[1][0], gps.lat); - boundingBox[1][1] = Math.min(boundingBox[1][1], gps.lat); - } - - return boundingBox; -} - -function getMiddle(infrastructure) { - const boundingBox = getMaxBounds(infrastructure); - - return [ - boundingBox[0][1] + (boundingBox[0][0] - boundingBox[0][1]) / 2, - boundingBox[1][1] + (boundingBox[1][0] - boundingBox[1][1]) / 2 - ]; -} - -function createLegend(map, rootElement) { - const legendCallback = event => { - map.setLayoutProperty(event.target.value + '-layer', 'visibility', event.target.checked ? 'visible' : 'none'); - - if (event.target.value !== 'station') { - map.setLayoutProperty('circle-' + event.target.value + '-layer', 'visibility', event.target.checked ? 'visible' : 'none'); - } - }; - - const initially_checked = new Set(['station', 'ms', 'as', 'eotd']); - - const legend = rootElement.querySelector('#mapLegend'); - for (const elementType of elementTypes) { - const input = document.createElement('input'); - input.id = elementType; - input.type = 'checkbox'; - input.value = elementType; - input.checked = initially_checked.has(elementType); - input.addEventListener('input', legendCallback); - - input.dispatchEvent(new Event('input')) - - const icon = document.createElement('img'); - icon.classList.add('legend-key-icon'); - icon.src = iconUrl + elementType + iconExtension; - - const label = document.createElement('label'); - label.classList.add('legend-key'); - label.htmlFor = elementType; - label.appendChild(icon); - label.append(elementTypesReadable[elementType]); - - const br = document.createElement('br'); - - legend.appendChild(input); - legend.appendChild(label); - legend.appendChild(br); - } - - const dirLegendCallback = event => { - const rising_checked = event.target.value === 'Rising' ? event.target.checked : - rootElement.querySelector('#Rising').checked; - - const falling_checked = event.target.value === 'Falling' ? event.target.checked : - rootElement.querySelector('#Falling').checked; - - let filter = undefined; - - if (!rising_checked && falling_checked) { - filter = ['!', ['get', 'rising']]; - } else if (rising_checked && !falling_checked) { - filter = ['get', 'rising']; - } else if (!rising_checked && !falling_checked) { - filter = ['boolean', false]; - } - - for (const elementType of elementTypes) { - if (elementType === 'station') { - continue; - } - - map.setFilter(elementType + '-layer', filter); - map.setFilter('circle-' + elementType + '-layer', filter); - } - } - - for (const dir of ['Rising', 'Falling']) { - const input = document.createElement('input'); - input.id = dir; - input.type = 'checkbox'; - input.value = dir; - input.checked = true; - input.addEventListener('input', dirLegendCallback); - - const label = document.createElement('label'); - label.classList.add('legend-key'); - label.htmlFor = dir; - label.append(dir); - - const br = document.createElement('br'); - - legend.appendChild(input); - legend.appendChild(label); - legend.appendChild(br); - } -} - -export function createMap(rootElement, infrastructureName, tooltip) { - let map = new maplibregl.Map({ - container: rootElement.querySelector('#map'), - style: infrastructureMapStyle, - attributionControl: false, - zoom: 14, - hash: "location", - center: [14, 49], - maxBounds: [[6, 45], [17, 55]], // [SW Point] [NE Point] in LonLat - bearing: 0, - transformRequest: (relative_url, _resourceType) => { - if (relative_url.startsWith('/')) { - const url = window.origin + '/' + infrastructureName + relative_url; - return {url: url}; - } - } - }); - - map.on('load', () => { - addIcons(map); - createLegend(map, rootElement); - }); - - map.dragPan.enable({ - linearity: 0.01, - easing: t => t, - maxSpeed: 1400, - deceleration: 2500 - }); - - map.on('click', e => { - const features = e.target.queryRenderedFeatures(e.point, {layers: mapLayers}); - - if (features.length === 0) { - return; - } - - if (features.length > 1) { - console.warn("More than one feature found after click event! Using the first one.", features); - } - - const clickedFeature = features[0]; - const clickedID = clickedFeature.properties.id; - - // if (clickedFeature.layer['source-layer'] === 'station') { - // const station = infrastructure.stations.get(clickedID); - // const gps = infrastructure.station_coords.get(clickedID); - // showStation(station, infrastructure, map.getSource('station-routes')._data.features, - // map.getSource('signal-station-routes')._data.features); - // } else { - // console.log("clicked", clickedFeature); - // - // const element = infrastructure.element(clickedFeature.properties.id); - // - // if (element.is_track_element()) { - // const km = element.as_track_element().km; - // tooltip.select('#kilometerPoint').text((km * 1000).toFixed(0) + 'm'); - // const rising = element.as_track_element().rising; - // tooltip.select('#risingOrFalling').text(rising ? 'Rising' : 'Falling'); - // } - // - // tooltip.click(e, e => e.point.x, e => e.point.y); - // } - }); - - return map; -} - -function highlightPath(mapSource, infrastructure, nodeID, nodePath) { - let pathGeoJSON = { - type: 'Feature', - properties: {id: nodeID}, - geometry: { - coordinates: [], - type: 'LineString' - } - }; - - for (const node of iterate(nodePath)) { - const gps = infrastructure.element_coords.get(node.element.id); - pathGeoJSON.geometry.coordinates.push([gps.lon, gps.lat]); - } - - // this is probably illegal, but very convenient - let newData = mapSource._data; - - newData.features.push(pathGeoJSON); - mapSource.setData(newData); -} - -function deHighlightPath(mapSource, pathID) { - // again: probably quite unethical - let newData = mapSource._data; - const idx = newData.features.findIndex(f => f.properties.id === pathID); - newData.features.splice(idx, 1); - - mapSource.setData(newData); -} - -export function highlightSignalStationRoute(map, infrastructure, signalStationRouteID) { - highlightPath(map.getSource('signal-station-routes'), - infrastructure, - signalStationRouteID, - infrastructure.signal_station_routes.get(signalStationRouteID).nodes); -} - -export function deHighlightSignalStationRoute(map, signalStationRouteID) { - deHighlightPath(map.getSource('signal-station-routes'), signalStationRouteID); -} - -export function highlightStationRoute(map, infrastructure, stationRouteID) { - highlightPath(map.getSource('station-routes'), - infrastructure, - stationRouteID, - infrastructure.station_routes.get(stationRouteID).nodes); -} - -export function deHighlightStationRoute(map, stationRouteID) { - deHighlightPath(map.getSource('station-routes'), stationRouteID); -} diff --git a/web/client/components/infrastructure/map/mapStyle.js b/web/client/components/infrastructure/map/mapStyle.js deleted file mode 100644 index 2a37dd18..00000000 --- a/web/client/components/infrastructure/map/mapStyle.js +++ /dev/null @@ -1,161 +0,0 @@ -import { elementTypes } from "./elementTypes.js"; - -export const mapLayers = elementTypes.map(type => type + '-layer'); - -export const infrastructureMapStyle = (() => { - let style = { - "version": 8, - "sources": { - "osm": { - "type": "vector", - "tiles": [`/tiles/{z}/{x}/{y}.mvt`], - "maxzoom": 20 - }, - "station-routes": { - "type": "geojson", - "data": { - type: "FeatureCollection", - features: [], - } - }, - "signal-station-routes": { - "type": "geojson", - "data": { - type: "FeatureCollection", - features: [], - } - } - }, - "glyphs": `${origin}/font/{fontstack}/{range}.pbf`, - "layers": [ - { - "id": "background", - "type": "background", - "paint": { - "background-color": "#e0e0e0" - } - }, - { - "id": "rail", - "type": "line", - "source": "osm", - "source-layer": "rail", - "filter": ["==", "rail", "primary"], - "paint": { - "line-color": "#444", - "line-width": 2.0 - } - }, - { - "id": "station-route-layer", - "type": "line", - "source": "station-routes", - "layout": { - "line-join": "round", - "line-cap": "round" - }, - "paint": { - "line-color": "#ff0000", - "line-width": 6 - } - }, - { - "id": "station-route-element-layer", - "type": "circle", - "source": "station-routes", - "minzoom": 16, - "maxzoom": 24, - "paint": { - "circle-color": "#ff0000", - "circle-radius": ['interpolate', ['linear'], ['zoom'], 10, 1, 20, 19] - } - }, - { - "id": "signal-station-route-layer", - "type": "line", - "source": "signal-station-routes", - "layout": { - "line-join": "round", - "line-cap": "round" - }, - "paint": { - "line-color": "#ff0000", - "line-width": 6 - } - }, - { - "id": "signal-station-route-element-layer", - "type": "circle", - "source": "signal-station-routes", - "minzoom": 16, - "maxzoom": 24, - "paint": { - "circle-color": "#ff0000", - "circle-radius": ['interpolate', ['linear'], ['zoom'], 10, 1, 20, 19] - } - }, - ] - }; - - elementTypes.forEach(type => { - if (type === 'station') { - style.layers.push({ - "id": type + "-layer", - "source": "osm", - "source-layer": type, - "type": "symbol", - "minzoom": 5, - "maxzoom:": 24, - "paint": { - "text-halo-width": 1, - "text-halo-color": "#ffffff", - }, - "layout": { - "text-field": ['get', 'name'], - "text-anchor": "top", - "text-offset": [0, 1], - "text-font": ["Noto Sans Display Bold"], - "icon-image": "icon-" + type, - "icon-size": ['interpolate', ['linear'], ['zoom'], 10, 0.8, 20, 1.0] - } - }); - } else { - // gives us the small black dots for icon stand ins - style.layers.push({ - "id": "circle-" + type + "-layer", - "source": "osm", - "source-layer": type, - "type": "circle", - "minzoom": 13, - "maxzoom:": 24, - "paint": { - "circle-radius": 3, - "circle-color": "#000000", - "circle-stroke-width": 1, - "circle-stroke-color": "#FFFFFF" - } - }); - - // gives us the elements as icons - style.layers.push({ - "id": type + "-layer", - "source": "osm", - "source-layer": type, - "type": "symbol", - "minzoom": 15, - "maxzoom:": 24, - "layout": { - "text-field": ['get', 'id'], - "text-anchor": "top", - "text-offset": [0, 1], - "text-font": ["Noto Sans Display Regular"], - "icon-image": "icon-" + type, - "icon-size": ['interpolate', ['linear'], ['zoom'], 10, 0.2, 20, 0.4] - }, - // "filter": ['==', 'direction', 'rising'] - }); - } - }); - - return style; -})(); diff --git a/web/client/components/infrastructure/station_detail/stationDetail.js b/web/client/components/infrastructure/station_detail/stationDetail.js deleted file mode 100644 index 0c26182f..00000000 --- a/web/client/components/infrastructure/station_detail/stationDetail.js +++ /dev/null @@ -1,80 +0,0 @@ -import { getFileContents } from "../../../utl/getFileContents.js"; -import { iterate } from "../../../utl/iterate.js"; - -const routeSwitchCallback = e => { - if (e.target.checked) { - window.infrastructureManager.highlightStationRoute(Number(e.target.value)); - } else { - window.infrastructureManager.deHighlightStationRoute(Number(e.target.value)); - } -} - -const signalRouteSwitchCallback = e => { - if (e.target.checked) { - window.infrastructureManager.highlightSignalStationRoute(Number(e.target.value)); - } else { - window.infrastructureManager.deHighlightSignalStationRoute(Number(e.target.value)); - } -} - -function fillStation(station, infrastructure, highlightedStationRoutes, highlightedSignalStationRoutes) { - let stationDetailName = document.getElementById('stationDetailName'); - stationDetailName.innerText = station.name; - - let routeContent = document.getElementById('stationRouteCollapsibleContent'); - let newRoutes = []; - for (let i = 0; i < station.station_routes.size(); i++) { - const key = station.station_routes.keys().get(i); - const sr = station.station_routes.get(key); - - let route = document.createElement('label'); - route.classList.add('matter-switch', 'station-detail-route'); - - let input = document.createElement('input'); - input.type = 'checkbox'; - input.value = sr.id; - input.checked = highlightedStationRoutes.find(f => f.properties.id === sr.id); - input.addEventListener('input', routeSwitchCallback); - - let span = document.createElement('span'); - span.innerHTML = key; - - route.appendChild(input); - route.appendChild(span); - newRoutes.push(route); - } - - routeContent.replaceChildren(...newRoutes); - - let newSignalStationRoutes = []; - for (const ssr of iterate(infrastructure.station_to_ssrs.get(station.id))) { - let route = document.createElement('label'); - route.classList.add('matter-switch', 'station-detail-signal-route'); - - let input = document.createElement('input'); - input.type = 'checkbox'; - input.value = ssr.id; - input.checked = highlightedSignalStationRoutes.find(f => f.properties.id === ssr.id); - input.addEventListener('input', signalRouteSwitchCallback); - - let span = document.createElement('span'); - span.innerHTML = 'ID: ' + ssr.id; - - route.appendChild(input); - route.appendChild(span); - newSignalStationRoutes.push(route); - } - - let signalStationRouteContent = document.getElementById('signalStationRouteCollapsibleContent'); - signalStationRouteContent.replaceChildren(...newSignalStationRoutes); - - showSubOverlay(); -} - -export function showStation(station, infrastructure, highlightedStationRoutes, highlightedSignalStationRoutes) { - getFileContents("./components/infrastructure/station_detail/station_detail.html") - .then(html => { - document.getElementById('subOverlayContent').innerHTML = html; - fillStation(station, infrastructure, highlightedStationRoutes, highlightedSignalStationRoutes); - }); -} diff --git a/web/client/components/infrastructure/station_detail/station_detail.html b/web/client/components/infrastructure/station_detail/station_detail.html deleted file mode 100644 index 7e8351b4..00000000 --- a/web/client/components/infrastructure/station_detail/station_detail.html +++ /dev/null @@ -1,21 +0,0 @@ - diff --git a/web/client/components/ordering_graph/OrderingGraphComponent.js b/web/client/components/ordering_graph/OrderingGraphComponent.js deleted file mode 100644 index 225b7bdb..00000000 --- a/web/client/components/ordering_graph/OrderingGraphComponent.js +++ /dev/null @@ -1,13 +0,0 @@ -import { getFileContents } from "../../utl/getFileContents.js"; - -export class OrderingGraphComponent { - constructor(container) { - this.container = container; - this.rootElement = container.element; - - getFileContents("./components/ordering_graph/ordering_graph_component.html") - .then((html) => { - this.rootElement.innerHTML = html; - }); - } -} diff --git a/web/client/components/ordering_graph/ordering_graph_component.html b/web/client/components/ordering_graph/ordering_graph_component.html deleted file mode 100644 index 5798ad51..00000000 --- a/web/client/components/ordering_graph/ordering_graph_component.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - OrderingGraph - - - - -
-

Graph coming soon tm.

-
- - - - - diff --git a/web/client/components/simulation/SimulationComponent.js b/web/client/components/simulation/SimulationComponent.js deleted file mode 100644 index e63b4e7f..00000000 --- a/web/client/components/simulation/SimulationComponent.js +++ /dev/null @@ -1,421 +0,0 @@ -import * as d3 from "../../deps/d3/d3.js"; -import { getFileContents } from "../../utl/getFileContents.js"; -// import { Module } from "../../soro-client.js"; -import { iterate } from "../../utl/iterate.js"; -import { Tooltip } from "./Tooltip.js"; -import { iterateDist } from "../../utl/iterate.js"; -import { timeFormat } from "../../deps/d3/d3.js"; - -const nodeWidth = 100; -const nodeHeight = 80; -const nodeDiagonal = Math.sqrt(Math.pow(nodeWidth, 2) + Math.pow(nodeHeight, 2)); -const nodeSpacingHorizontal = nodeWidth * 0.5; -const nodeSpacingVertical = nodeHeight * 0.5; - -const outerWidthPadding = nodeWidth * 0.1; -const outerHeightPadding = nodeHeight * 0.1; - -const innerNodeCount = 3; - -const innerNodeWidth = (nodeWidth - outerWidthPadding * 2); -const innerNodeHeight = (nodeHeight - outerHeightPadding * 2) / innerNodeCount; - -const innerHeightPadding = innerNodeHeight * 0.1; - -class d3Graph { - constructor(rootElement, width, height) { - this._width = width; - this._height = height; - - let selected = d3.select(rootElement.querySelector('#simGraph')); - - this._svg = selected - .append("svg") - .attr("width", "100%") - .attr("height", "100%") - .attr("viewBox", [0, 0, 1000, 1000]); - - this._svg.call(d3.zoom().scaleExtent([0, 1000]).on("zoom", ({transform}) => { - this._d3_graph.attr("transform", transform); - })); - - this._d3_graph = this._svg - .append("g"); - - let selectedDistGraph = d3.select(rootElement.querySelector('#distGraph')); - - this._dist_svg = selectedDistGraph.append("svg") - .attr("width", "100%") - .attr("height", "100%") - .attr("viewBox", "0 0 1000 1000"); - - this._tooltip = new Tooltip(rootElement); - } - - resizeSVG(width, height) { - this._svg.attr("width", width / 2) - .attr("height", height) - .attr("viewBox", [0, 0, width / 2, height]); - - this._dist_svg.attr("width", width / 2) - .attr("height", height) - .attr("viewBox", [0, 0, width / 2, height]); - } - - // upper left X - getX(nodeID) { - const node = this._sim_graph.nodes.get(nodeID); - const idRange = this._sim_graph.train_to_sim_nodes.get(node.TrainID); - return (nodeID - idRange.first) * (nodeWidth + nodeSpacingHorizontal); - } - - // upper left Y - getY(nodeID) { - const node = this._sim_graph.nodes.get(nodeID); - return node.TrainID * (nodeHeight + nodeSpacingVertical); - } - - // upper left coords - getCoords(nodeID) { - return [this.getX(nodeID), this.getY(nodeID)]; - } - - getXCenter(nodeID) { - return this.getX(nodeID) + (nodeHeight / 2); - } - - getYCenter(nodeID) { - return this.getY(nodeID) + (nodeHeight / 2); - } - - getCoordsCenter(nodeID) { - return [this.getXCenter(nodeID), this.getYCenter(nodeID)]; - } - - getTrainEdgeSourceCoords(sourceID) { - let sourceCoords = this.getCoords(sourceID); - sourceCoords[0] += nodeWidth; - sourceCoords[1] += nodeHeight / 2; - return sourceCoords; - } - - getTrainEdgeTargetCoords(targetID) { - let targetCoords = this.getCoords(targetID); - targetCoords[1] += nodeHeight / 2; - return targetCoords; - } - - getOrderEdgeCoords(sourceID, targetID) { - const sourceCoords = this.getCoords(sourceID); - const targetCoords = this.getCoords(targetID); - - let [X, Y] = targetCoords; - - // source is right of target - if (sourceCoords[0] > targetCoords[0]) { - X += nodeWidth; - } - - // source is lower than target - if (sourceCoords[1] > targetCoords[1]) { - Y += nodeHeight; - } - - return [X, Y]; - } - - createNodes() { - let nodes = this._d3_graph - .selectAll('node') - .data(iterate(this._sim_graph.nodes)); - - // this creates the node rectangles - nodes.enter().append('rect') - .attr('x', d => this.getX(d.ID)) - .attr('y', d => this.getY(d.ID)) - .attr('width', nodeWidth) - .attr('height', nodeHeight) - .style("fill", 'white') - .on('mouseover', e => this._tooltip.mouseover(e)) - .on('mouseout', e => this._tooltip.mouseout(e)) - .on('mousemove', this._tooltip.mousemove.bind(this._tooltip)) - .on('click', this._tooltip.click.bind(this._tooltip)); - - nodes.enter().append('rect') - .attr('x', d => this.getX(d.ID) + outerWidthPadding) - .attr('y', d => this.getY(d.ID) + outerHeightPadding) - .attr('width', innerNodeWidth) - .attr('height', innerNodeHeight) - .style('fill', 'lightgrey') - .on('click', e => this.showDist(e.target.__data__.EntryDPD)); - - nodes.enter().append('rect') - .attr('x', d => this.getX(d.ID) + outerWidthPadding) - .attr('y', d => this.getY(d.ID) + outerHeightPadding + innerNodeHeight + innerHeightPadding) - .attr('width', innerNodeWidth) - .attr('height', innerNodeHeight) - .style('fill', 'lightgrey') - .on('click', e => this.showDist(e.target.__data__.EotdDPD)); - - nodes.enter().append('rect') - .attr('x', d => this.getX(d.ID) + outerWidthPadding) - .attr('y', d => this.getY(d.ID) + outerHeightPadding + (2 * (innerNodeHeight + innerHeightPadding))) - .attr('width', innerNodeWidth) - .attr('height', innerNodeHeight) - .style('fill', 'lightgrey') - .on('click', e => this.showDist(e.target.__data__.ExitDPD)); - - // this creates the node text labels - nodes.enter().append('text') - .attr('x', d => this.getXCenter(d.ID)) - .attr('y', d => this.getYCenter(d.ID)) - .attr('text-anchor', 'middle') - .attr('dominant-baseline', 'middle') - .attr('pointer-events', 'none') - .text(d => d.ID); - } - - createEdges() { - for (const node of iterate(this._sim_graph.nodes)) { - if (node.hasSucc()) { - this._links.push({ - source: node.ID, - target: node.trainSucc, - type: 'trainEdge' - }); - } - - for (const out of iterate(node.OrderOut())) { - this._links.push({ - source: node.ID, - target: out, - type: 'orderEdge' - }); - } - } - - console.log('inks', this._links); - - let linkGen = d3.linkHorizontal() - .source(d => d.type === 'trainEdge' ? - this.getTrainEdgeSourceCoords(d.source) : this.getOrderEdgeCoords(d.target, d.source)) - .target(d => d.type === 'trainEdge' ? - this.getTrainEdgeTargetCoords(d.target) : this.getOrderEdgeCoords(d.source, d.target)) - - const color = type => { - if (type === 'trainEdge') { - return 'black'; - } - if (type === 'orderEdge') { - return 'red'; - } - } - - var types = ['trainEdge', 'orderEdge']; - this._svg.append("defs").selectAll("marker") - .data(types) - .join("marker") - .attr("id", d => `${d}Arrow`) - .attr("viewBox", "0 -5 10 10") - .attr("refX", 0) - .attr("refY", 0) - .attr("markerWidth", 6) - .attr("markerHeight", 6) - .attr("orient", "auto") - .append("path") - .attr("fill", color) - .attr("d", "M0,-5L10,0L0,5"); - - this._d3_graph - .selectAll('path') - .data(this._links) - .join('path') - .attr('stroke', d => color(d.type)) - .attr('fill', 'none') - .attr("marker-end", d => `url(${new URL(`#${d.type}Arrow`, location)})`) - .attr('d', linkGen); - } - - showDist(dist) { - this._dist_svg.selectAll("*").remove(); - - let minTime = Number.MAX_VALUE; - let maxTime = 0; - - let minSpeed = Number.MAX_VALUE; - let maxSpeed = 0; - - for (const [time, speed,] of iterateDist(dist)) { - minTime = Math.min(minTime, time); - maxTime = Math.max(maxTime, time); - - minSpeed = Math.min(minSpeed, speed); - maxSpeed = Math.max(maxSpeed, speed); - } - - const color = d3.scaleSequential(d3.interpolateWarm) - - const xScaleStep = 6; // We want every 'time-bucket' to be 6 seconds in size - const yScaleStep = 1; // We want every 'speed-bucket' to be 1 second in size - - const xRangeFrom = 0; // SVG coordinate - const xRangeTo = this._width / 2; // SVG coordinate - - const yRangeFrom = 0; // SVG coordinate - const yRangeTo = this._height; // SVG coordinate - - const fontSize = 30; - - const x = d3.scaleBand() - .domain(d3.range(minTime, maxTime + xScaleStep, xScaleStep)) - .range([xRangeFrom, xRangeTo]) - .padding(0.1); - - const y = d3.scaleBand() - .domain(d3.range(minSpeed, maxSpeed + yScaleStep, yScaleStep)) - .range([yRangeFrom, yRangeTo]) - .padding(0.1); - - const boxWidth = x.bandwidth(); - const boxHeight = y.bandwidth(); - - const timeFormat = t => d3.timeFormat('%X')(t * 1000); - - const xAxis = d3.axisTop(x) - .ticks(10) - .tickFormat(timeFormat); - - const yAxis = d3.axisLeft(y).ticks(10); - - const x_g = this._dist_svg.append("g") - .call(xAxis); - - const y_g = this._dist_svg.append("g") - .call(yAxis); - - const g_g = this._dist_svg.selectAll('.groups') - .data(iterateDist(dist)) - .enter() - .append('g'); - - const filterEmpty = ([, , prob]) => prob !== 0; - - g_g.append('rect') - .filter(filterEmpty) - .attr('x', ([time, ,]) => x(time)) - .attr('y', ([, speed,]) => y(speed)) - .attr('height', boxHeight) - .attr('width', boxWidth) - .attr('fill', ([, , prob]) => color(prob)); - - g_g.append('text') - .filter(filterEmpty) - .attr('x', ([time, speed, prob]) => x(time) + boxWidth / 2) - .attr('y', ([time, speed, prob]) => y(speed) + boxHeight / 2) - .attr('font-size', fontSize) - .attr('text-anchor', 'middle') - .attr('dominant-baseline', 'middle') - .attr('pointer-events', 'none') - .text(([time, ,]) => timeFormat(time)); - - g_g.append('text') - .filter(filterEmpty) - .attr('x', ([time, speed, prob]) => x(time) + boxWidth / 2) - .attr('y', ([time, speed, prob]) => y(speed) + fontSize + boxHeight / 2) - .attr('font-size', fontSize) - .attr('text-anchor', 'middle') - .attr('dominant-baseline', 'middle') - .attr('pointer-events', 'none') - .text(([, speed,]) => "Speed: " + speed + " km/h"); - - g_g.append('text') - .filter(filterEmpty) - .attr('x', ([time, speed, prob]) => x(time) + boxWidth / 2) - .attr('y', ([time, speed, prob]) => y(speed) + fontSize * 2 + boxHeight / 2) - .attr('font-size', fontSize) - .attr('text-anchor', 'middle') - .attr('dominant-baseline', 'middle') - .attr('pointer-events', 'none') - .text(([, , prob]) => "Prob: " + prob.toFixed(2) * 100 + "%"); - - this._dist_svg.call(d3.zoom().scaleExtent([0, 1000]).on('zoom', ({transform}) => { - x_g.attr('transform', transform); - y_g.attr('transform', transform); - g_g.attr('transform', transform); - })); - } - - createGraph(infrastructure, timetable) { - this._infrastructure = infrastructure; - this._timetable = timetable; - this._sim_graph = new Module.SimGraph(infrastructure, timetable); - this.createNodes(); - this.createEdges(); - } - - simulate() { - this._sim_graph.simulate(this._infrastructure, this._timetable, disruptionDists, - disruptionMap.get('1'), disruptionMap.get('2')); - this.createNodes(); - this.createEdges(); - } - - resize(width, height) { - this._width = width; - this._height = height; - this.createNodes(); - this.createEdges(); - } - - _svg = undefined; - _d3_graph = undefined; - - _infrastructure = undefined; - _timetable = undefined; - _sim_graph = undefined; - - _links = []; - _tooltip = undefined; - - _width = undefined; - _height = undefined; -} - -export class SimulationComponent { - constructor(container) { - this.container = container; - this.rootElement = container.element; - - getFileContents("./components/simulation/simulation_component.html") - .then((html) => { - this.rootElement.innerHTML = html; - }).then(() => { - this._d3Graph = new d3Graph(this.rootElement, container.width, container.height); - - // resize on golden layout component resize event - container.on('resize', () => { - this._d3Graph.resizeSVG(container.width, container.height); - }); - }); - } - - changeInfrastructure(newInfrastructure) { - const currentTimetable = window.timetableManager.get(); - if (currentTimetable) { - this._d3Graph.createGraph(newInfrastructure, currentTimetable); - } - } - - changeTimetable(newTimetable) { - const currentInfrastructure = window.infrastructureManager.get(); - if (currentInfrastructure) { - this._d3Graph.createGraph(currentInfrastructure, newTimetable); - } - } - - simulate() { - this._d3Graph.simulate(); - } - - _d3Graph = undefined; -} diff --git a/web/client/components/simulation/Tooltip.js b/web/client/components/simulation/Tooltip.js deleted file mode 100644 index 2658e02d..00000000 --- a/web/client/components/simulation/Tooltip.js +++ /dev/null @@ -1,87 +0,0 @@ -import * as d3 from "../../deps/d3/d3.js"; - -function cloneIntoPermanent(mouseTooltip, highlightedSSR) { - let permanentTooltip = mouseTooltip.clone(true); - - // on rightclick dismiss permanent tooltip - const rightclick = event => { - event.preventDefault(); - permanentTooltip.remove(); - window.infrastructureManager.deHighlightSignalStationRoute(highlightedSSR); - } - - // make the permanent tooltip draggable - const mousedown = event => { - event.preventDefault(); - - // when the mouse is released stop dragging the element - document.onmouseup = () => { - document.onmouseup = undefined; - document.onmousemove = undefined; - } - - // update the position on mouse movement - let deltaX = 0, deltaY = 0, tmpX = event.clientX, tmpY = event.clientY; - document.onmousemove = event => { - event.preventDefault(); - - deltaX = tmpX - event.clientX; - deltaY = tmpY - event.clientY; - tmpX = event.clientX; - tmpY = event.clientY; - - permanentTooltip - .style('left', (permanentTooltip.node().offsetLeft - deltaX) + 'px') - .style('top', (permanentTooltip.node().offsetTop - deltaY) + 'px'); - } - } - - permanentTooltip - .on('mouseout', undefined) // make tooltip permanent - .on('contextmenu', rightclick) - .on('mousedown', mousedown); -} - -export class Tooltip { - constructor(rootElement) { - this._mouse_tooltip = d3.select(rootElement.querySelector('#toolTip')) - .style('position', 'absolute'); - } - - mouseover(event) { - this._mouse_tooltip.style('display', 'inline') - .style('left', (event.layerX + 10) + 'px') - .style('top', (event.layerY + 10) + 'px') - - const simNode = event.target.__data__; - - this._mouse_tooltip.select('#tooltipID').text('ID: ' + simNode.ID); - this._mouse_tooltip.select('#tooltipSSRID').text('SSR ID: ' + simNode.SSRID); - - window.infrastructureManager.highlightSignalStationRoute(simNode.SSRID); - - d3.select(event.target).style('stroke', 'black'); - } - - mousemove(event) { - this._mouse_tooltip - .style('left', (event.layerX + 10) + 'px') - .style('top', (event.layerY + 10) + 'px'); - } - - mouseout(event) { - this._mouse_tooltip.style('display', 'none'); - event.target.style.stroke = 'none'; - - const simNode = event.target.__data__; - window.infrastructureManager.deHighlightSignalStationRoute(simNode.SSRID); - } - - click(e) { - const ssrID = e.target.__data__.SSRID; - cloneIntoPermanent(this._mouse_tooltip, ssrID); - window.infrastructureManager.highlightSignalStationRoute(ssrID); - } - - _mouse_tooltip = undefined; -} \ No newline at end of file diff --git a/web/client/components/simulation/simulation.css b/web/client/components/simulation/simulation.css deleted file mode 100644 index 7372da6e..00000000 --- a/web/client/components/simulation/simulation.css +++ /dev/null @@ -1,17 +0,0 @@ -#simWrapper { - display: grid; - grid-template-columns: 1fr 1fr; -} - -#simDivider { - border-right: 1px solid #DEDEDE; -} - -#toolTip { - display: none; - left: 0; - top: 0; - background: lightsteelblue; - border: 2px; - border-radius: 5px; -} \ No newline at end of file diff --git a/web/client/components/simulation/simulation_component.html b/web/client/components/simulation/simulation_component.html deleted file mode 100644 index ae8c3702..00000000 --- a/web/client/components/simulation/simulation_component.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - Simulation - - - - - -
-
-
-
-
-
- -
-
    -
  • -
  • -
-
- - - \ No newline at end of file diff --git a/web/client/components/timetable/TimetableComponent.js b/web/client/components/timetable/TimetableComponent.js deleted file mode 100644 index bf96c147..00000000 --- a/web/client/components/timetable/TimetableComponent.js +++ /dev/null @@ -1,13 +0,0 @@ -import { getFileContents } from "../../utl/getFileContents.js"; - -export class TimetableComponent { - constructor(container) { - this.container = container; - this.rootElement = container.element; - - getFileContents("./components/timetable/timetable_component.html") - .then((html) => { - this.rootElement.innerHTML = html; - }); - } -} diff --git a/web/client/components/timetable/timetable_component.html b/web/client/components/timetable/timetable_component.html deleted file mode 100644 index 7d7cce85..00000000 --- a/web/client/components/timetable/timetable_component.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - Timetable - - - - -
-

This is tt.

-
- - - - - diff --git a/web/client/deps/GoldenLayout/GoldenLayout.js b/web/client/deps/GoldenLayout/GoldenLayout.js deleted file mode 100644 index 528ab453..00000000 --- a/web/client/deps/GoldenLayout/GoldenLayout.js +++ /dev/null @@ -1,6353 +0,0 @@ -class ExternalError extends Error { - constructor(type, message) { - super(message); - this.type = type; - } -} -class ConfigurationError extends ExternalError { - constructor(message, node) { - super("Configuration", message); - this.node = node; - } -} -class PopoutBlockedError extends ExternalError { - constructor(message) { - super("PopoutBlocked", message); - } -} -class ApiError extends ExternalError { - constructor(message) { - super("API", message); - } -} -class BindError extends ExternalError { - constructor(message) { - super("Bind", message); - } -} -class InternalError extends Error { - constructor(type, code, message) { - super(`${type}: ${code}${message === void 0 ? "" : ": " + message}`); - } -} -class AssertError extends InternalError { - constructor(code, message) { - super("Assert", code, message); - } -} -class UnreachableCaseError extends InternalError { - constructor(code, variableValue, message) { - super("UnreachableCase", code, `${variableValue}${message === void 0 ? "" : ": " + message}`); - } -} -class UnexpectedNullError extends InternalError { - constructor(code, message) { - super("UnexpectedNull", code, message); - } -} -class UnexpectedUndefinedError extends InternalError { - constructor(code, message) { - super("UnexpectedUndefined", code, message); - } -} -var WidthOrHeightPropertyName; -(function(WidthOrHeightPropertyName2) { - WidthOrHeightPropertyName2.width = "width"; - WidthOrHeightPropertyName2.height = "height"; -})(WidthOrHeightPropertyName || (WidthOrHeightPropertyName = {})); -var Side; -(function(Side2) { - Side2.top = "top"; - Side2.left = "left"; - Side2.right = "right"; - Side2.bottom = "bottom"; -})(Side || (Side = {})); -var LogicalZIndex; -(function(LogicalZIndex2) { - LogicalZIndex2.base = "base"; - LogicalZIndex2.drag = "drag"; - LogicalZIndex2.stackMaximised = "stackMaximised"; -})(LogicalZIndex || (LogicalZIndex = {})); -var JsonValue; -(function(JsonValue2) { - function isJson(value) { - return isJsonObject(value); - } - JsonValue2.isJson = isJson; - function isJsonObject(value) { - return !Array.isArray(value) && value !== null && typeof value === "object"; - } - JsonValue2.isJsonObject = isJsonObject; -})(JsonValue || (JsonValue = {})); -var ItemType; -(function(ItemType2) { - ItemType2.ground = "ground"; - ItemType2.row = "row"; - ItemType2.column = "column"; - ItemType2.stack = "stack"; - ItemType2.component = "component"; -})(ItemType || (ItemType = {})); -var ResponsiveMode; -(function(ResponsiveMode2) { - ResponsiveMode2.none = "none"; - ResponsiveMode2.always = "always"; - ResponsiveMode2.onload = "onload"; -})(ResponsiveMode || (ResponsiveMode = {})); -var ConfigMinifier; -(function(ConfigMinifier2) { - const keys = [ - "settings", - "hasHeaders", - "constrainDragToContainer", - "selectionEnabled", - "dimensions", - "borderWidth", - "minItemHeight", - "minItemWidth", - "headerHeight", - "dragProxyWidth", - "dragProxyHeight", - "labels", - "close", - "maximise", - "minimise", - "popout", - "content", - "componentType", - "componentState", - "id", - "width", - "type", - "height", - "isClosable", - "title", - "popoutWholeStack", - "openPopouts", - "parentId", - "activeItemIndex", - "reorderEnabled", - "borderGrabWidth" - ]; - const values = [ - true, - false, - "row", - "column", - "stack", - "component", - "close", - "maximise", - "minimise", - "open in new window" - ]; - function checkInitialise() { - if (keys.length > 36) { - throw new Error("Too many keys in config minifier map"); - } - } - ConfigMinifier2.checkInitialise = checkInitialise; - function translateObject(from, minify) { - const to = {}; - for (const key in from) { - if (from.hasOwnProperty(key)) { - let translatedKey; - if (minify) { - translatedKey = minifyKey(key); - } else { - translatedKey = unminifyKey(key); - } - const fromValue = from[key]; - to[translatedKey] = translateValue(fromValue, minify); - } - } - return to; - } - ConfigMinifier2.translateObject = translateObject; - function translateArray(from, minify) { - const length = from.length; - const to = new Array(length); - for (let i = 0; i < length; i++) { - const fromValue = from[i]; - to[i] = translateValue(fromValue, minify); - } - return to; - } - function translateValue(from, minify) { - if (typeof from === "object") { - if (from === null) { - return null; - } else { - if (Array.isArray(from)) { - return translateArray(from, minify); - } else { - return translateObject(from, minify); - } - } - } else { - if (minify) { - return minifyValue(from); - } else { - return unminifyValue(from); - } - } - } - function minifyKey(value) { - if (typeof value === "string" && value.length === 1) { - return "___" + value; - } - const index = indexOfKey(value); - if (index === -1) { - return value; - } else { - return index.toString(36); - } - } - function unminifyKey(key) { - if (key.length === 1) { - return keys[parseInt(key, 36)]; - } - if (key.substr(0, 3) === "___") { - return key[3]; - } - return key; - } - function minifyValue(value) { - if (typeof value === "string" && value.length === 1) { - return "___" + value; - } - const index = indexOfValue(value); - if (index === -1) { - return value; - } else { - return index.toString(36); - } - } - function unminifyValue(value) { - if (typeof value === "string" && value.length === 1) { - return values[parseInt(value, 36)]; - } - if (typeof value === "string" && value.substr(0, 3) === "___") { - return value[3]; - } - return value; - } - function indexOfKey(key) { - for (let i = 0; i < keys.length; i++) { - if (keys[i] === key) { - return i; - } - } - return -1; - } - function indexOfValue(value) { - for (let i = 0; i < values.length; i++) { - if (values[i] === value) { - return i; - } - } - return -1; - } -})(ConfigMinifier || (ConfigMinifier = {})); -function numberToPixels(value) { - return value.toString(10) + "px"; -} -function pixelsToNumber(value) { - const numberStr = value.replace("px", ""); - return parseFloat(numberStr); -} -function getElementWidth(element) { - return element.offsetWidth; -} -function setElementWidth(element, width) { - const widthAsPixels = numberToPixels(width); - element.style.width = widthAsPixels; -} -function getElementHeight(element) { - return element.offsetHeight; -} -function setElementHeight(element, height) { - const heightAsPixels = numberToPixels(height); - element.style.height = heightAsPixels; -} -function getElementWidthAndHeight(element) { - return { - width: element.offsetWidth, - height: element.offsetHeight - }; -} -function setElementDisplayVisibility(element, visible) { - if (visible) { - element.style.display = ""; - } else { - element.style.display = "none"; - } -} -function ensureElementPositionAbsolute(element) { - const absolutePosition = "absolute"; - if (element.style.position !== absolutePosition) { - element.style.position = absolutePosition; - } -} -function deepExtend(target, obj) { - if (obj !== void 0) { - for (const key in obj) { - if (obj.hasOwnProperty(key)) { - const value = obj[key]; - const existingTarget = target[key]; - target[key] = deepExtendValue(existingTarget, value); - } - } - } - return target; -} -function deepExtendValue(existingTarget, value) { - if (typeof value !== "object") { - return value; - } else { - if (Array.isArray(value)) { - const length = value.length; - const targetArray = new Array(length); - for (let i = 0; i < length; i++) { - const element = value[i]; - targetArray[i] = deepExtendValue({}, element); - } - return targetArray; - } else { - if (value === null) { - return null; - } else { - const valueObj = value; - if (existingTarget === void 0) { - return deepExtend({}, valueObj); - } else { - if (typeof existingTarget !== "object") { - return deepExtend({}, valueObj); - } else { - if (Array.isArray(existingTarget)) { - return deepExtend({}, valueObj); - } else { - if (existingTarget === null) { - return deepExtend({}, valueObj); - } else { - const existingTargetObj = existingTarget; - return deepExtend(existingTargetObj, valueObj); - } - } - } - } - } - } - } -} -function removeFromArray(item, array) { - const index = array.indexOf(item); - if (index === -1) { - throw new Error("Can't remove item from array. Item is not in the array"); - } - array.splice(index, 1); -} -function getUniqueId() { - return (Math.random() * 1e15).toString(36).replace(".", ""); -} -var ResolvedItemConfig; -(function(ResolvedItemConfig2) { - ResolvedItemConfig2.defaults = { - type: ItemType.ground, - content: [], - width: 50, - minWidth: 0, - height: 50, - minHeight: 0, - id: "", - isClosable: true - }; - function createCopy(original, content) { - switch (original.type) { - case ItemType.ground: - case ItemType.row: - case ItemType.column: - return ResolvedRowOrColumnItemConfig.createCopy(original, content); - case ItemType.stack: - return ResolvedStackItemConfig.createCopy(original, content); - case ItemType.component: - return ResolvedComponentItemConfig.createCopy(original); - default: - throw new UnreachableCaseError("CICC91354", original.type, "Invalid Config Item type specified"); - } - } - ResolvedItemConfig2.createCopy = createCopy; - function createDefault(type) { - switch (type) { - case ItemType.ground: - throw new AssertError("CICCDR91562"); - case ItemType.row: - case ItemType.column: - return ResolvedRowOrColumnItemConfig.createDefault(type); - case ItemType.stack: - return ResolvedStackItemConfig.createDefault(); - case ItemType.component: - return ResolvedComponentItemConfig.createDefault(); - default: - throw new UnreachableCaseError("CICCDD91563", type, "Invalid Config Item type specified"); - } - } - ResolvedItemConfig2.createDefault = createDefault; - function isComponentItem(itemConfig) { - return itemConfig.type === ItemType.component; - } - ResolvedItemConfig2.isComponentItem = isComponentItem; - function isStackItem(itemConfig) { - return itemConfig.type === ItemType.stack; - } - ResolvedItemConfig2.isStackItem = isStackItem; - function isGroundItem(itemConfig) { - return itemConfig.type === ItemType.ground; - } - ResolvedItemConfig2.isGroundItem = isGroundItem; -})(ResolvedItemConfig || (ResolvedItemConfig = {})); -var ResolvedHeaderedItemConfig; -(function(ResolvedHeaderedItemConfig2) { - ResolvedHeaderedItemConfig2.defaultMaximised = false; - (function(Header2) { - function createCopy(original, show) { - if (original === void 0) { - return void 0; - } else { - return { - show: show !== null && show !== void 0 ? show : original.show, - popout: original.popout, - close: original.close, - maximise: original.maximise, - minimise: original.minimise, - tabDropdown: original.tabDropdown - }; - } - } - Header2.createCopy = createCopy; - })(ResolvedHeaderedItemConfig2.Header || (ResolvedHeaderedItemConfig2.Header = {})); -})(ResolvedHeaderedItemConfig || (ResolvedHeaderedItemConfig = {})); -var ResolvedStackItemConfig; -(function(ResolvedStackItemConfig2) { - ResolvedStackItemConfig2.defaultActiveItemIndex = 0; - function createCopy(original, content) { - const result = { - type: original.type, - content: content !== void 0 ? copyContent(content) : copyContent(original.content), - width: original.width, - minWidth: original.minWidth, - height: original.height, - minHeight: original.minHeight, - id: original.id, - maximised: original.maximised, - isClosable: original.isClosable, - activeItemIndex: original.activeItemIndex, - header: ResolvedHeaderedItemConfig.Header.createCopy(original.header) - }; - return result; - } - ResolvedStackItemConfig2.createCopy = createCopy; - function copyContent(original) { - const count = original.length; - const result = new Array(count); - for (let i = 0; i < count; i++) { - result[i] = ResolvedItemConfig.createCopy(original[i]); - } - return result; - } - ResolvedStackItemConfig2.copyContent = copyContent; - function createDefault() { - const result = { - type: ItemType.stack, - content: [], - width: ResolvedItemConfig.defaults.width, - minWidth: ResolvedItemConfig.defaults.minWidth, - height: ResolvedItemConfig.defaults.height, - minHeight: ResolvedItemConfig.defaults.minHeight, - id: ResolvedItemConfig.defaults.id, - maximised: ResolvedHeaderedItemConfig.defaultMaximised, - isClosable: ResolvedItemConfig.defaults.isClosable, - activeItemIndex: ResolvedStackItemConfig2.defaultActiveItemIndex, - header: void 0 - }; - return result; - } - ResolvedStackItemConfig2.createDefault = createDefault; -})(ResolvedStackItemConfig || (ResolvedStackItemConfig = {})); -var ResolvedComponentItemConfig; -(function(ResolvedComponentItemConfig2) { - ResolvedComponentItemConfig2.defaultReorderEnabled = true; - function resolveComponentTypeName(itemConfig) { - const componentType = itemConfig.componentType; - if (typeof componentType === "string") { - return componentType; - } else { - return void 0; - } - } - ResolvedComponentItemConfig2.resolveComponentTypeName = resolveComponentTypeName; - function createCopy(original) { - const result = { - type: original.type, - content: [], - width: original.width, - minWidth: original.minWidth, - height: original.height, - minHeight: original.minHeight, - id: original.id, - maximised: original.maximised, - isClosable: original.isClosable, - reorderEnabled: original.reorderEnabled, - title: original.title, - header: ResolvedHeaderedItemConfig.Header.createCopy(original.header), - componentType: original.componentType, - componentState: deepExtendValue(void 0, original.componentState) - }; - return result; - } - ResolvedComponentItemConfig2.createCopy = createCopy; - function createDefault(componentType = "", componentState, title = "") { - const result = { - type: ItemType.component, - content: [], - width: ResolvedItemConfig.defaults.width, - minWidth: ResolvedItemConfig.defaults.minWidth, - height: ResolvedItemConfig.defaults.height, - minHeight: ResolvedItemConfig.defaults.minHeight, - id: ResolvedItemConfig.defaults.id, - maximised: ResolvedHeaderedItemConfig.defaultMaximised, - isClosable: ResolvedItemConfig.defaults.isClosable, - reorderEnabled: ResolvedComponentItemConfig2.defaultReorderEnabled, - title, - header: void 0, - componentType, - componentState - }; - return result; - } - ResolvedComponentItemConfig2.createDefault = createDefault; - function copyComponentType(componentType) { - return deepExtendValue({}, componentType); - } - ResolvedComponentItemConfig2.copyComponentType = copyComponentType; -})(ResolvedComponentItemConfig || (ResolvedComponentItemConfig = {})); -var ResolvedRowOrColumnItemConfig; -(function(ResolvedRowOrColumnItemConfig2) { - function isChildItemConfig(itemConfig) { - switch (itemConfig.type) { - case ItemType.row: - case ItemType.column: - case ItemType.stack: - case ItemType.component: - return true; - case ItemType.ground: - return false; - default: - throw new UnreachableCaseError("CROCOSPCICIC13687", itemConfig.type); - } - } - ResolvedRowOrColumnItemConfig2.isChildItemConfig = isChildItemConfig; - function createCopy(original, content) { - const result = { - type: original.type, - content: content !== void 0 ? copyContent(content) : copyContent(original.content), - width: original.width, - minWidth: original.minWidth, - height: original.height, - minHeight: original.minHeight, - id: original.id, - isClosable: original.isClosable - }; - return result; - } - ResolvedRowOrColumnItemConfig2.createCopy = createCopy; - function copyContent(original) { - const count = original.length; - const result = new Array(count); - for (let i = 0; i < count; i++) { - result[i] = ResolvedItemConfig.createCopy(original[i]); - } - return result; - } - ResolvedRowOrColumnItemConfig2.copyContent = copyContent; - function createDefault(type) { - const result = { - type, - content: [], - width: ResolvedItemConfig.defaults.width, - minWidth: ResolvedItemConfig.defaults.minWidth, - height: ResolvedItemConfig.defaults.height, - minHeight: ResolvedItemConfig.defaults.minHeight, - id: ResolvedItemConfig.defaults.id, - isClosable: ResolvedItemConfig.defaults.isClosable - }; - return result; - } - ResolvedRowOrColumnItemConfig2.createDefault = createDefault; -})(ResolvedRowOrColumnItemConfig || (ResolvedRowOrColumnItemConfig = {})); -var ResolvedRootItemConfig; -(function(ResolvedRootItemConfig2) { - function createCopy(config) { - return ResolvedItemConfig.createCopy(config); - } - ResolvedRootItemConfig2.createCopy = createCopy; - function isRootItemConfig(itemConfig) { - switch (itemConfig.type) { - case ItemType.row: - case ItemType.column: - case ItemType.stack: - case ItemType.component: - return true; - case ItemType.ground: - return false; - default: - throw new UnreachableCaseError("CROCOSPCICIC13687", itemConfig.type); - } - } - ResolvedRootItemConfig2.isRootItemConfig = isRootItemConfig; -})(ResolvedRootItemConfig || (ResolvedRootItemConfig = {})); -var ResolvedGroundItemConfig; -(function(ResolvedGroundItemConfig2) { - function create(rootItemConfig) { - const content = rootItemConfig === void 0 ? [] : [rootItemConfig]; - return { - type: ItemType.ground, - content, - width: 100, - minWidth: 0, - height: 100, - minHeight: 0, - id: "", - isClosable: false, - title: "", - reorderEnabled: false - }; - } - ResolvedGroundItemConfig2.create = create; -})(ResolvedGroundItemConfig || (ResolvedGroundItemConfig = {})); -var ResolvedLayoutConfig; -(function(ResolvedLayoutConfig2) { - (function(Settings) { - Settings.defaults = { - constrainDragToContainer: true, - reorderEnabled: true, - popoutWholeStack: false, - blockedPopoutsThrowError: true, - closePopoutsOnUnload: true, - responsiveMode: ResponsiveMode.none, - tabOverlapAllowance: 0, - reorderOnTabMenuClick: true, - tabControlOffset: 10, - popInOnClose: false - }; - function createCopy2(original) { - return { - constrainDragToContainer: original.constrainDragToContainer, - reorderEnabled: original.reorderEnabled, - popoutWholeStack: original.popoutWholeStack, - blockedPopoutsThrowError: original.blockedPopoutsThrowError, - closePopoutsOnUnload: original.closePopoutsOnUnload, - responsiveMode: original.responsiveMode, - tabOverlapAllowance: original.tabOverlapAllowance, - reorderOnTabMenuClick: original.reorderOnTabMenuClick, - tabControlOffset: original.tabControlOffset, - popInOnClose: original.popInOnClose - }; - } - Settings.createCopy = createCopy2; - })(ResolvedLayoutConfig2.Settings || (ResolvedLayoutConfig2.Settings = {})); - (function(Dimensions) { - function createCopy2(original) { - return { - borderWidth: original.borderWidth, - borderGrabWidth: original.borderGrabWidth, - minItemHeight: original.minItemHeight, - minItemWidth: original.minItemWidth, - headerHeight: original.headerHeight, - dragProxyWidth: original.dragProxyWidth, - dragProxyHeight: original.dragProxyHeight - }; - } - Dimensions.createCopy = createCopy2; - Dimensions.defaults = { - borderWidth: 5, - borderGrabWidth: 5, - minItemHeight: 10, - minItemWidth: 10, - headerHeight: 20, - dragProxyWidth: 300, - dragProxyHeight: 200 - }; - })(ResolvedLayoutConfig2.Dimensions || (ResolvedLayoutConfig2.Dimensions = {})); - (function(Header2) { - function createCopy2(original) { - return { - show: original.show, - popout: original.popout, - dock: original.dock, - close: original.close, - maximise: original.maximise, - minimise: original.minimise, - tabDropdown: original.tabDropdown - }; - } - Header2.createCopy = createCopy2; - Header2.defaults = { - show: Side.top, - popout: "open in new window", - dock: "dock", - maximise: "maximise", - minimise: "minimise", - close: "close", - tabDropdown: "additional tabs" - }; - })(ResolvedLayoutConfig2.Header || (ResolvedLayoutConfig2.Header = {})); - function isPopout(config) { - return "parentId" in config; - } - ResolvedLayoutConfig2.isPopout = isPopout; - function createDefault() { - const result = { - root: void 0, - openPopouts: [], - dimensions: ResolvedLayoutConfig2.Dimensions.defaults, - settings: ResolvedLayoutConfig2.Settings.defaults, - header: ResolvedLayoutConfig2.Header.defaults, - resolved: true - }; - return result; - } - ResolvedLayoutConfig2.createDefault = createDefault; - function createCopy(config) { - if (isPopout(config)) { - return ResolvedPopoutLayoutConfig.createCopy(config); - } else { - const result = { - root: config.root === void 0 ? void 0 : ResolvedRootItemConfig.createCopy(config.root), - openPopouts: ResolvedLayoutConfig2.copyOpenPopouts(config.openPopouts), - settings: ResolvedLayoutConfig2.Settings.createCopy(config.settings), - dimensions: ResolvedLayoutConfig2.Dimensions.createCopy(config.dimensions), - header: ResolvedLayoutConfig2.Header.createCopy(config.header), - resolved: config.resolved - }; - return result; - } - } - ResolvedLayoutConfig2.createCopy = createCopy; - function copyOpenPopouts(original) { - const count = original.length; - const result = new Array(count); - for (let i = 0; i < count; i++) { - result[i] = ResolvedPopoutLayoutConfig.createCopy(original[i]); - } - return result; - } - ResolvedLayoutConfig2.copyOpenPopouts = copyOpenPopouts; - function minifyConfig(layoutConfig) { - return ConfigMinifier.translateObject(layoutConfig, true); - } - ResolvedLayoutConfig2.minifyConfig = minifyConfig; - function unminifyConfig(minifiedConfig) { - return ConfigMinifier.translateObject(minifiedConfig, false); - } - ResolvedLayoutConfig2.unminifyConfig = unminifyConfig; -})(ResolvedLayoutConfig || (ResolvedLayoutConfig = {})); -var ResolvedPopoutLayoutConfig; -(function(ResolvedPopoutLayoutConfig2) { - (function(Window) { - function createCopy2(original) { - return { - width: original.width, - height: original.height, - left: original.left, - top: original.top - }; - } - Window.createCopy = createCopy2; - Window.defaults = { - width: null, - height: null, - left: null, - top: null - }; - })(ResolvedPopoutLayoutConfig2.Window || (ResolvedPopoutLayoutConfig2.Window = {})); - function createCopy(original) { - const result = { - root: original.root === void 0 ? void 0 : ResolvedRootItemConfig.createCopy(original.root), - openPopouts: ResolvedLayoutConfig.copyOpenPopouts(original.openPopouts), - settings: ResolvedLayoutConfig.Settings.createCopy(original.settings), - dimensions: ResolvedLayoutConfig.Dimensions.createCopy(original.dimensions), - header: ResolvedLayoutConfig.Header.createCopy(original.header), - parentId: original.parentId, - indexInParent: original.indexInParent, - window: ResolvedPopoutLayoutConfig2.Window.createCopy(original.window), - resolved: original.resolved - }; - return result; - } - ResolvedPopoutLayoutConfig2.createCopy = createCopy; -})(ResolvedPopoutLayoutConfig || (ResolvedPopoutLayoutConfig = {})); -var ItemConfig; -(function(ItemConfig2) { - function resolve(itemConfig) { - switch (itemConfig.type) { - case ItemType.ground: - throw new ConfigurationError("ItemConfig cannot specify type ground", JSON.stringify(itemConfig)); - case ItemType.row: - case ItemType.column: - return RowOrColumnItemConfig.resolve(itemConfig); - case ItemType.stack: - return StackItemConfig.resolve(itemConfig); - case ItemType.component: - return ComponentItemConfig.resolve(itemConfig); - default: - throw new UnreachableCaseError("UCUICR55499", itemConfig.type); - } - } - ItemConfig2.resolve = resolve; - function resolveContent(content) { - if (content === void 0) { - return []; - } else { - const count = content.length; - const result = new Array(count); - for (let i = 0; i < count; i++) { - result[i] = ItemConfig2.resolve(content[i]); - } - return result; - } - } - ItemConfig2.resolveContent = resolveContent; - function resolveId(id) { - if (id === void 0) { - return ResolvedItemConfig.defaults.id; - } else { - if (Array.isArray(id)) { - if (id.length === 0) { - return ResolvedItemConfig.defaults.id; - } else { - return id[0]; - } - } else { - return id; - } - } - } - ItemConfig2.resolveId = resolveId; - function isGround(config) { - return config.type === ItemType.ground; - } - ItemConfig2.isGround = isGround; - function isRow(config) { - return config.type === ItemType.row; - } - ItemConfig2.isRow = isRow; - function isColumn(config) { - return config.type === ItemType.column; - } - ItemConfig2.isColumn = isColumn; - function isStack(config) { - return config.type === ItemType.stack; - } - ItemConfig2.isStack = isStack; - function isComponent(config) { - return config.type === ItemType.component; - } - ItemConfig2.isComponent = isComponent; -})(ItemConfig || (ItemConfig = {})); -var HeaderedItemConfig; -(function(HeaderedItemConfig2) { - const legacyMaximisedId = "__glMaximised"; - (function(Header2) { - function resolve(header, hasHeaders) { - var _a; - if (header === void 0 && hasHeaders === void 0) { - return void 0; - } else { - const result = { - show: (_a = header === null || header === void 0 ? void 0 : header.show) !== null && _a !== void 0 ? _a : hasHeaders === void 0 ? void 0 : hasHeaders ? ResolvedLayoutConfig.Header.defaults.show : false, - popout: header === null || header === void 0 ? void 0 : header.popout, - maximise: header === null || header === void 0 ? void 0 : header.maximise, - close: header === null || header === void 0 ? void 0 : header.close, - minimise: header === null || header === void 0 ? void 0 : header.minimise, - tabDropdown: header === null || header === void 0 ? void 0 : header.tabDropdown - }; - return result; - } - } - Header2.resolve = resolve; - })(HeaderedItemConfig2.Header || (HeaderedItemConfig2.Header = {})); - function resolveIdAndMaximised(config) { - let id; - let legacyId = config.id; - let legacyMaximised = false; - if (legacyId === void 0) { - id = ResolvedItemConfig.defaults.id; - } else { - if (Array.isArray(legacyId)) { - const idx = legacyId.findIndex((id2) => id2 === legacyMaximisedId); - if (idx > 0) { - legacyMaximised = true; - legacyId = legacyId.splice(idx, 1); - } - if (legacyId.length > 0) { - id = legacyId[0]; - } else { - id = ResolvedItemConfig.defaults.id; - } - } else { - id = legacyId; - } - } - let maximised; - if (config.maximised !== void 0) { - maximised = config.maximised; - } else { - maximised = legacyMaximised; - } - return {id, maximised}; - } - HeaderedItemConfig2.resolveIdAndMaximised = resolveIdAndMaximised; -})(HeaderedItemConfig || (HeaderedItemConfig = {})); -var StackItemConfig; -(function(StackItemConfig2) { - function resolve(itemConfig) { - var _a, _b, _c, _d, _e, _f; - const {id, maximised} = HeaderedItemConfig.resolveIdAndMaximised(itemConfig); - const result = { - type: ItemType.stack, - content: resolveContent(itemConfig.content), - width: (_a = itemConfig.width) !== null && _a !== void 0 ? _a : ResolvedItemConfig.defaults.width, - minWidth: (_b = itemConfig.minWidth) !== null && _b !== void 0 ? _b : ResolvedItemConfig.defaults.minWidth, - height: (_c = itemConfig.height) !== null && _c !== void 0 ? _c : ResolvedItemConfig.defaults.height, - minHeight: (_d = itemConfig.minHeight) !== null && _d !== void 0 ? _d : ResolvedItemConfig.defaults.minHeight, - id, - maximised, - isClosable: (_e = itemConfig.isClosable) !== null && _e !== void 0 ? _e : ResolvedItemConfig.defaults.isClosable, - activeItemIndex: (_f = itemConfig.activeItemIndex) !== null && _f !== void 0 ? _f : ResolvedStackItemConfig.defaultActiveItemIndex, - header: HeaderedItemConfig.Header.resolve(itemConfig.header, itemConfig.hasHeaders) - }; - return result; - } - StackItemConfig2.resolve = resolve; - function resolveContent(content) { - if (content === void 0) { - return []; - } else { - const count = content.length; - const result = new Array(count); - for (let i = 0; i < count; i++) { - const childItemConfig = content[i]; - const itemConfig = ItemConfig.resolve(childItemConfig); - if (!ResolvedItemConfig.isComponentItem(itemConfig)) { - throw new AssertError("UCUSICRC91114", JSON.stringify(itemConfig)); - } else { - result[i] = itemConfig; - } - } - return result; - } - } - StackItemConfig2.resolveContent = resolveContent; -})(StackItemConfig || (StackItemConfig = {})); -var ComponentItemConfig; -(function(ComponentItemConfig2) { - function resolve(itemConfig) { - var _a, _b, _c, _d, _e, _f, _g; - let componentType = itemConfig.componentType; - if (componentType === void 0) { - componentType = itemConfig.componentName; - } - if (componentType === void 0) { - throw new Error("ComponentItemConfig.componentType is undefined"); - } else { - const {id, maximised} = HeaderedItemConfig.resolveIdAndMaximised(itemConfig); - let title; - if (itemConfig.title === void 0 || itemConfig.title === "") { - title = ComponentItemConfig2.componentTypeToTitle(componentType); - } else { - title = itemConfig.title; - } - const result = { - type: itemConfig.type, - content: [], - width: (_a = itemConfig.width) !== null && _a !== void 0 ? _a : ResolvedItemConfig.defaults.width, - minWidth: (_b = itemConfig.minWidth) !== null && _b !== void 0 ? _b : ResolvedItemConfig.defaults.minWidth, - height: (_c = itemConfig.height) !== null && _c !== void 0 ? _c : ResolvedItemConfig.defaults.height, - minHeight: (_d = itemConfig.minHeight) !== null && _d !== void 0 ? _d : ResolvedItemConfig.defaults.minHeight, - id, - maximised, - isClosable: (_e = itemConfig.isClosable) !== null && _e !== void 0 ? _e : ResolvedItemConfig.defaults.isClosable, - reorderEnabled: (_f = itemConfig.reorderEnabled) !== null && _f !== void 0 ? _f : ResolvedComponentItemConfig.defaultReorderEnabled, - title, - header: HeaderedItemConfig.Header.resolve(itemConfig.header, itemConfig.hasHeaders), - componentType, - componentState: (_g = itemConfig.componentState) !== null && _g !== void 0 ? _g : {} - }; - return result; - } - } - ComponentItemConfig2.resolve = resolve; - function componentTypeToTitle(componentType) { - const componentTypeType = typeof componentType; - switch (componentTypeType) { - case "string": - return componentType; - case "number": - return componentType.toString(); - case "boolean": - return componentType.toString(); - default: - return ""; - } - } - ComponentItemConfig2.componentTypeToTitle = componentTypeToTitle; -})(ComponentItemConfig || (ComponentItemConfig = {})); -var RowOrColumnItemConfig; -(function(RowOrColumnItemConfig2) { - function isChildItemConfig(itemConfig) { - switch (itemConfig.type) { - case ItemType.row: - case ItemType.column: - case ItemType.stack: - case ItemType.component: - return true; - case ItemType.ground: - return false; - default: - throw new UnreachableCaseError("UROCOSPCICIC13687", itemConfig.type); - } - } - RowOrColumnItemConfig2.isChildItemConfig = isChildItemConfig; - function resolve(itemConfig) { - var _a, _b, _c, _d, _e; - const result = { - type: itemConfig.type, - content: RowOrColumnItemConfig2.resolveContent(itemConfig.content), - width: (_a = itemConfig.width) !== null && _a !== void 0 ? _a : ResolvedItemConfig.defaults.width, - minWidth: (_b = itemConfig.width) !== null && _b !== void 0 ? _b : ResolvedItemConfig.defaults.minWidth, - height: (_c = itemConfig.height) !== null && _c !== void 0 ? _c : ResolvedItemConfig.defaults.height, - minHeight: (_d = itemConfig.height) !== null && _d !== void 0 ? _d : ResolvedItemConfig.defaults.minHeight, - id: ItemConfig.resolveId(itemConfig.id), - isClosable: (_e = itemConfig.isClosable) !== null && _e !== void 0 ? _e : ResolvedItemConfig.defaults.isClosable - }; - return result; - } - RowOrColumnItemConfig2.resolve = resolve; - function resolveContent(content) { - if (content === void 0) { - return []; - } else { - const count = content.length; - const result = new Array(count); - for (let i = 0; i < count; i++) { - const childItemConfig = content[i]; - if (!RowOrColumnItemConfig2.isChildItemConfig(childItemConfig)) { - throw new ConfigurationError("ItemConfig is not Row, Column or Stack", childItemConfig); - } else { - const resolvedChildItemConfig = ItemConfig.resolve(childItemConfig); - if (!ResolvedRowOrColumnItemConfig.isChildItemConfig(resolvedChildItemConfig)) { - throw new AssertError("UROCOSPIC99512", JSON.stringify(resolvedChildItemConfig)); - } else { - result[i] = resolvedChildItemConfig; - } - } - } - return result; - } - } - RowOrColumnItemConfig2.resolveContent = resolveContent; -})(RowOrColumnItemConfig || (RowOrColumnItemConfig = {})); -var RootItemConfig; -(function(RootItemConfig2) { - function isRootItemConfig(itemConfig) { - switch (itemConfig.type) { - case ItemType.row: - case ItemType.column: - case ItemType.stack: - case ItemType.component: - return true; - case ItemType.ground: - return false; - default: - throw new UnreachableCaseError("URICIR23687", itemConfig.type); - } - } - RootItemConfig2.isRootItemConfig = isRootItemConfig; - function resolve(itemConfig) { - if (itemConfig === void 0) { - return void 0; - } else { - const result = ItemConfig.resolve(itemConfig); - if (!ResolvedRootItemConfig.isRootItemConfig(result)) { - throw new ConfigurationError("ItemConfig is not Row, Column or Stack", JSON.stringify(itemConfig)); - } else { - return result; - } - } - } - RootItemConfig2.resolve = resolve; -})(RootItemConfig || (RootItemConfig = {})); -var LayoutConfig; -(function(LayoutConfig2) { - (function(Settings) { - function resolve2(settings) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; - const result = { - constrainDragToContainer: (_a = settings === null || settings === void 0 ? void 0 : settings.constrainDragToContainer) !== null && _a !== void 0 ? _a : ResolvedLayoutConfig.Settings.defaults.constrainDragToContainer, - reorderEnabled: (_b = settings === null || settings === void 0 ? void 0 : settings.reorderEnabled) !== null && _b !== void 0 ? _b : ResolvedLayoutConfig.Settings.defaults.reorderEnabled, - popoutWholeStack: (_c = settings === null || settings === void 0 ? void 0 : settings.popoutWholeStack) !== null && _c !== void 0 ? _c : ResolvedLayoutConfig.Settings.defaults.popoutWholeStack, - blockedPopoutsThrowError: (_d = settings === null || settings === void 0 ? void 0 : settings.blockedPopoutsThrowError) !== null && _d !== void 0 ? _d : ResolvedLayoutConfig.Settings.defaults.blockedPopoutsThrowError, - closePopoutsOnUnload: (_e = settings === null || settings === void 0 ? void 0 : settings.closePopoutsOnUnload) !== null && _e !== void 0 ? _e : ResolvedLayoutConfig.Settings.defaults.closePopoutsOnUnload, - responsiveMode: (_f = settings === null || settings === void 0 ? void 0 : settings.responsiveMode) !== null && _f !== void 0 ? _f : ResolvedLayoutConfig.Settings.defaults.responsiveMode, - tabOverlapAllowance: (_g = settings === null || settings === void 0 ? void 0 : settings.tabOverlapAllowance) !== null && _g !== void 0 ? _g : ResolvedLayoutConfig.Settings.defaults.tabOverlapAllowance, - reorderOnTabMenuClick: (_h = settings === null || settings === void 0 ? void 0 : settings.reorderOnTabMenuClick) !== null && _h !== void 0 ? _h : ResolvedLayoutConfig.Settings.defaults.reorderOnTabMenuClick, - tabControlOffset: (_j = settings === null || settings === void 0 ? void 0 : settings.tabControlOffset) !== null && _j !== void 0 ? _j : ResolvedLayoutConfig.Settings.defaults.tabControlOffset, - popInOnClose: (_k = settings === null || settings === void 0 ? void 0 : settings.popInOnClose) !== null && _k !== void 0 ? _k : ResolvedLayoutConfig.Settings.defaults.popInOnClose - }; - return result; - } - Settings.resolve = resolve2; - })(LayoutConfig2.Settings || (LayoutConfig2.Settings = {})); - (function(Dimensions) { - function resolve2(dimensions) { - var _a, _b, _c, _d, _e, _f, _g; - const result = { - borderWidth: (_a = dimensions === null || dimensions === void 0 ? void 0 : dimensions.borderWidth) !== null && _a !== void 0 ? _a : ResolvedLayoutConfig.Dimensions.defaults.borderWidth, - borderGrabWidth: (_b = dimensions === null || dimensions === void 0 ? void 0 : dimensions.borderGrabWidth) !== null && _b !== void 0 ? _b : ResolvedLayoutConfig.Dimensions.defaults.borderGrabWidth, - minItemHeight: (_c = dimensions === null || dimensions === void 0 ? void 0 : dimensions.minItemHeight) !== null && _c !== void 0 ? _c : ResolvedLayoutConfig.Dimensions.defaults.minItemHeight, - minItemWidth: (_d = dimensions === null || dimensions === void 0 ? void 0 : dimensions.minItemWidth) !== null && _d !== void 0 ? _d : ResolvedLayoutConfig.Dimensions.defaults.minItemWidth, - headerHeight: (_e = dimensions === null || dimensions === void 0 ? void 0 : dimensions.headerHeight) !== null && _e !== void 0 ? _e : ResolvedLayoutConfig.Dimensions.defaults.headerHeight, - dragProxyWidth: (_f = dimensions === null || dimensions === void 0 ? void 0 : dimensions.dragProxyWidth) !== null && _f !== void 0 ? _f : ResolvedLayoutConfig.Dimensions.defaults.dragProxyWidth, - dragProxyHeight: (_g = dimensions === null || dimensions === void 0 ? void 0 : dimensions.dragProxyHeight) !== null && _g !== void 0 ? _g : ResolvedLayoutConfig.Dimensions.defaults.dragProxyHeight - }; - return result; - } - Dimensions.resolve = resolve2; - })(LayoutConfig2.Dimensions || (LayoutConfig2.Dimensions = {})); - (function(Header2) { - function resolve2(header, settings, labels) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m; - let show; - if ((header === null || header === void 0 ? void 0 : header.show) !== void 0) { - show = header.show; - } else { - if (settings !== void 0 && settings.hasHeaders !== void 0) { - show = settings.hasHeaders ? ResolvedLayoutConfig.Header.defaults.show : false; - } else { - show = ResolvedLayoutConfig.Header.defaults.show; - } - } - const result = { - show, - popout: (_b = (_a = header === null || header === void 0 ? void 0 : header.popout) !== null && _a !== void 0 ? _a : labels === null || labels === void 0 ? void 0 : labels.popout) !== null && _b !== void 0 ? _b : (settings === null || settings === void 0 ? void 0 : settings.showPopoutIcon) === false ? false : ResolvedLayoutConfig.Header.defaults.popout, - dock: (_d = (_c = header === null || header === void 0 ? void 0 : header.popin) !== null && _c !== void 0 ? _c : labels === null || labels === void 0 ? void 0 : labels.popin) !== null && _d !== void 0 ? _d : ResolvedLayoutConfig.Header.defaults.dock, - maximise: (_f = (_e = header === null || header === void 0 ? void 0 : header.maximise) !== null && _e !== void 0 ? _e : labels === null || labels === void 0 ? void 0 : labels.maximise) !== null && _f !== void 0 ? _f : (settings === null || settings === void 0 ? void 0 : settings.showMaximiseIcon) === false ? false : ResolvedLayoutConfig.Header.defaults.maximise, - close: (_h = (_g = header === null || header === void 0 ? void 0 : header.close) !== null && _g !== void 0 ? _g : labels === null || labels === void 0 ? void 0 : labels.close) !== null && _h !== void 0 ? _h : (settings === null || settings === void 0 ? void 0 : settings.showCloseIcon) === false ? false : ResolvedLayoutConfig.Header.defaults.close, - minimise: (_k = (_j = header === null || header === void 0 ? void 0 : header.minimise) !== null && _j !== void 0 ? _j : labels === null || labels === void 0 ? void 0 : labels.minimise) !== null && _k !== void 0 ? _k : ResolvedLayoutConfig.Header.defaults.minimise, - tabDropdown: (_m = (_l = header === null || header === void 0 ? void 0 : header.tabDropdown) !== null && _l !== void 0 ? _l : labels === null || labels === void 0 ? void 0 : labels.tabDropdown) !== null && _m !== void 0 ? _m : ResolvedLayoutConfig.Header.defaults.tabDropdown - }; - return result; - } - Header2.resolve = resolve2; - })(LayoutConfig2.Header || (LayoutConfig2.Header = {})); - function isPopout(config) { - return "parentId" in config || "indexInParent" in config || "window" in config; - } - LayoutConfig2.isPopout = isPopout; - function resolve(layoutConfig) { - if (isPopout(layoutConfig)) { - return PopoutLayoutConfig.resolve(layoutConfig); - } else { - let root; - if (layoutConfig.root !== void 0) { - root = layoutConfig.root; - } else { - if (layoutConfig.content !== void 0 && layoutConfig.content.length > 0) { - root = layoutConfig.content[0]; - } else { - root = void 0; - } - } - const config = { - resolved: true, - root: RootItemConfig.resolve(root), - openPopouts: LayoutConfig2.resolveOpenPopouts(layoutConfig.openPopouts), - dimensions: LayoutConfig2.Dimensions.resolve(layoutConfig.dimensions), - settings: LayoutConfig2.Settings.resolve(layoutConfig.settings), - header: LayoutConfig2.Header.resolve(layoutConfig.header, layoutConfig.settings, layoutConfig.labels) - }; - return config; - } - } - LayoutConfig2.resolve = resolve; - function fromResolved(config) { - const copiedConfig = ResolvedLayoutConfig.createCopy(config); - const result = { - root: copiedConfig.root, - openPopouts: copiedConfig.openPopouts, - dimensions: copiedConfig.dimensions, - settings: copiedConfig.settings, - header: copiedConfig.header - }; - return result; - } - LayoutConfig2.fromResolved = fromResolved; - function isResolved(configOrResolvedConfig) { - const config = configOrResolvedConfig; - return config.resolved !== void 0 && config.resolved === true; - } - LayoutConfig2.isResolved = isResolved; - function resolveOpenPopouts(popoutConfigs) { - if (popoutConfigs === void 0) { - return []; - } else { - const count = popoutConfigs.length; - const result = new Array(count); - for (let i = 0; i < count; i++) { - result[i] = PopoutLayoutConfig.resolve(popoutConfigs[i]); - } - return result; - } - } - LayoutConfig2.resolveOpenPopouts = resolveOpenPopouts; -})(LayoutConfig || (LayoutConfig = {})); -var PopoutLayoutConfig; -(function(PopoutLayoutConfig2) { - (function(Window) { - function resolve2(window2, dimensions) { - var _a, _b, _c, _d, _e, _f, _g, _h; - let result; - const defaults = ResolvedPopoutLayoutConfig.Window.defaults; - if (window2 !== void 0) { - result = { - width: (_a = window2.width) !== null && _a !== void 0 ? _a : defaults.width, - height: (_b = window2.height) !== null && _b !== void 0 ? _b : defaults.height, - left: (_c = window2.left) !== null && _c !== void 0 ? _c : defaults.left, - top: (_d = window2.top) !== null && _d !== void 0 ? _d : defaults.top - }; - } else { - result = { - width: (_e = dimensions === null || dimensions === void 0 ? void 0 : dimensions.width) !== null && _e !== void 0 ? _e : defaults.width, - height: (_f = dimensions === null || dimensions === void 0 ? void 0 : dimensions.height) !== null && _f !== void 0 ? _f : defaults.height, - left: (_g = dimensions === null || dimensions === void 0 ? void 0 : dimensions.left) !== null && _g !== void 0 ? _g : defaults.left, - top: (_h = dimensions === null || dimensions === void 0 ? void 0 : dimensions.top) !== null && _h !== void 0 ? _h : defaults.top - }; - } - return result; - } - Window.resolve = resolve2; - })(PopoutLayoutConfig2.Window || (PopoutLayoutConfig2.Window = {})); - function resolve(popoutConfig) { - var _a, _b; - let root; - if (popoutConfig.root !== void 0) { - root = popoutConfig.root; - } else { - if (popoutConfig.content !== void 0 && popoutConfig.content.length > 0) { - root = popoutConfig.content[0]; - } else { - root = void 0; - } - } - const config = { - root: RootItemConfig.resolve(root), - openPopouts: LayoutConfig.resolveOpenPopouts(popoutConfig.openPopouts), - settings: LayoutConfig.Settings.resolve(popoutConfig.settings), - dimensions: LayoutConfig.Dimensions.resolve(popoutConfig.dimensions), - header: LayoutConfig.Header.resolve(popoutConfig.header, popoutConfig.settings, popoutConfig.labels), - parentId: (_a = popoutConfig.parentId) !== null && _a !== void 0 ? _a : null, - indexInParent: (_b = popoutConfig.indexInParent) !== null && _b !== void 0 ? _b : null, - window: PopoutLayoutConfig2.Window.resolve(popoutConfig.window, popoutConfig.dimensions), - resolved: true - }; - return config; - } - PopoutLayoutConfig2.resolve = resolve; -})(PopoutLayoutConfig || (PopoutLayoutConfig = {})); -class EventEmitter { - constructor() { - this._allEventSubscriptions = []; - this._subscriptionsMap = new Map(); - this.unbind = this.removeEventListener; - this.trigger = this.emit; - } - tryBubbleEvent(name, args) { - } - emit(eventName, ...args) { - let subcriptions = this._subscriptionsMap.get(eventName); - if (subcriptions !== void 0) { - subcriptions = subcriptions.slice(); - for (let i = 0; i < subcriptions.length; i++) { - const subscription = subcriptions[i]; - subscription(...args); - } - } - this.emitAllEvent(eventName, args); - this.tryBubbleEvent(eventName, args); - } - emitUnknown(eventName, ...args) { - let subs = this._subscriptionsMap.get(eventName); - if (subs !== void 0) { - subs = subs.slice(); - for (let i = 0; i < subs.length; i++) { - subs[i](...args); - } - } - this.emitAllEvent(eventName, args); - this.tryBubbleEvent(eventName, args); - } - emitBaseBubblingEvent(eventName) { - const event = new EventEmitter.BubblingEvent(eventName, this); - this.emitUnknown(eventName, event); - } - emitUnknownBubblingEvent(eventName) { - const event = new EventEmitter.BubblingEvent(eventName, this); - this.emitUnknown(eventName, event); - } - removeEventListener(eventName, callback) { - const unknownCallback = callback; - this.removeUnknownEventListener(eventName, unknownCallback); - } - off(eventName, callback) { - this.removeEventListener(eventName, callback); - } - addEventListener(eventName, callback) { - const unknownCallback = callback; - this.addUnknownEventListener(eventName, unknownCallback); - } - on(eventName, callback) { - this.addEventListener(eventName, callback); - } - addUnknownEventListener(eventName, callback) { - if (eventName === EventEmitter.ALL_EVENT) { - this._allEventSubscriptions.push(callback); - } else { - let subscriptions = this._subscriptionsMap.get(eventName); - if (subscriptions !== void 0) { - subscriptions.push(callback); - } else { - subscriptions = [callback]; - this._subscriptionsMap.set(eventName, subscriptions); - } - } - } - removeUnknownEventListener(eventName, callback) { - if (eventName === EventEmitter.ALL_EVENT) { - this.removeSubscription(eventName, this._allEventSubscriptions, callback); - } else { - const subscriptions = this._subscriptionsMap.get(eventName); - if (subscriptions === void 0) { - throw new Error("No subscribtions to unsubscribe for event " + eventName); - } else { - this.removeSubscription(eventName, subscriptions, callback); - } - } - } - removeSubscription(eventName, subscriptions, callback) { - const idx = subscriptions.indexOf(callback); - if (idx < 0) { - throw new Error("Nothing to unbind for " + eventName); - } else { - subscriptions.splice(idx, 1); - } - } - emitAllEvent(eventName, args) { - const allEventSubscriptionsCount = this._allEventSubscriptions.length; - if (allEventSubscriptionsCount > 0) { - const unknownArgs = args.slice(); - unknownArgs.unshift(eventName); - const allEventSubcriptions = this._allEventSubscriptions.slice(); - for (let i = 0; i < allEventSubscriptionsCount; i++) { - allEventSubcriptions[i](...unknownArgs); - } - } - } -} -(function(EventEmitter2) { - EventEmitter2.ALL_EVENT = "__all"; - EventEmitter2.headerClickEventName = "stackHeaderClick"; - EventEmitter2.headerTouchStartEventName = "stackHeaderTouchStart"; - class BubblingEvent { - constructor(_name, _target) { - this._name = _name; - this._target = _target; - this._isPropagationStopped = false; - } - get name() { - return this._name; - } - get target() { - return this._target; - } - get origin() { - return this._target; - } - get isPropagationStopped() { - return this._isPropagationStopped; - } - stopPropagation() { - this._isPropagationStopped = true; - } - } - EventEmitter2.BubblingEvent = BubblingEvent; - class ClickBubblingEvent extends BubblingEvent { - constructor(name, target, _mouseEvent) { - super(name, target); - this._mouseEvent = _mouseEvent; - } - get mouseEvent() { - return this._mouseEvent; - } - } - EventEmitter2.ClickBubblingEvent = ClickBubblingEvent; - class TouchStartBubblingEvent extends BubblingEvent { - constructor(name, target, _touchEvent) { - super(name, target); - this._touchEvent = _touchEvent; - } - get touchEvent() { - return this._touchEvent; - } - } - EventEmitter2.TouchStartBubblingEvent = TouchStartBubblingEvent; -})(EventEmitter || (EventEmitter = {})); -var StyleConstants; -(function(StyleConstants2) { - StyleConstants2.defaultComponentBaseZIndex = "auto"; - StyleConstants2.defaultComponentDragZIndex = "32"; - StyleConstants2.defaultComponentStackMaximisedZIndex = "41"; -})(StyleConstants || (StyleConstants = {})); -class ComponentContainer extends EventEmitter { - constructor(_config, _parent, _layoutManager, _element, _updateItemConfigEvent, _showEvent, _hideEvent, _focusEvent, _blurEvent) { - super(); - this._config = _config; - this._parent = _parent; - this._layoutManager = _layoutManager; - this._element = _element; - this._updateItemConfigEvent = _updateItemConfigEvent; - this._showEvent = _showEvent; - this._hideEvent = _hideEvent; - this._focusEvent = _focusEvent; - this._blurEvent = _blurEvent; - this._stackMaximised = false; - this._width = 0; - this._height = 0; - this._visible = true; - this._isShownWithZeroDimensions = true; - this._componentType = _config.componentType; - this._isClosable = _config.isClosable; - this._initialState = _config.componentState; - this._state = this._initialState; - this._boundComponent = this.layoutManager.bindComponent(this, _config); - this.updateElementPositionPropertyFromBoundComponent(); - } - get width() { - return this._width; - } - get height() { - return this._height; - } - get parent() { - return this._parent; - } - get componentName() { - return this._componentType; - } - get componentType() { - return this._componentType; - } - get virtual() { - return this._boundComponent.virtual; - } - get component() { - return this._boundComponent.component; - } - get tab() { - return this._tab; - } - get title() { - return this._parent.title; - } - get layoutManager() { - return this._layoutManager; - } - get isHidden() { - return !this._visible; - } - get visible() { - return this._visible; - } - get state() { - return this._state; - } - get initialState() { - return this._initialState; - } - get element() { - return this._element; - } - destroy() { - this.releaseComponent(); - this.stateRequestEvent = void 0; - this.emit("destroy"); - } - getElement() { - return this._element; - } - hide() { - this._hideEvent(); - } - show() { - this._showEvent(); - } - focus(suppressEvent = false) { - this._focusEvent(suppressEvent); - } - blur(suppressEvent = false) { - this._blurEvent(suppressEvent); - } - setSize(width, height) { - let ancestorItem = this._parent; - if (ancestorItem.isColumn || ancestorItem.isRow || ancestorItem.parent === null) { - throw new AssertError("ICSSPRC", "ComponentContainer cannot have RowColumn Parent"); - } else { - let ancestorChildItem; - do { - ancestorChildItem = ancestorItem; - ancestorItem = ancestorItem.parent; - } while (ancestorItem !== null && !ancestorItem.isColumn && !ancestorItem.isRow); - if (ancestorItem === null) { - return false; - } else { - const direction = ancestorItem.isColumn ? "height" : "width"; - const currentSize = this[direction]; - if (currentSize === null) { - throw new UnexpectedNullError("ICSSCS11194"); - } else { - const newSize = direction === "height" ? height : width; - const totalPixel = currentSize * (1 / (ancestorChildItem[direction] / 100)); - const percentage = newSize / totalPixel * 100; - const delta = (ancestorChildItem[direction] - percentage) / (ancestorItem.contentItems.length - 1); - for (let i = 0; i < ancestorItem.contentItems.length; i++) { - if (ancestorItem.contentItems[i] === ancestorChildItem) { - ancestorItem.contentItems[i][direction] = percentage; - } else { - ancestorItem.contentItems[i][direction] += delta; - } - } - ancestorItem.updateSize(); - return true; - } - } - } - } - close() { - if (this._isClosable) { - this.emit("close"); - this._parent.close(); - } - } - replaceComponent(itemConfig) { - this.releaseComponent(); - if (!ItemConfig.isComponent(itemConfig)) { - throw new Error("ReplaceComponent not passed a component ItemConfig"); - } else { - const config = ComponentItemConfig.resolve(itemConfig); - this._initialState = config.componentState; - this._state = this._initialState; - this._componentType = config.componentType; - this._updateItemConfigEvent(config); - this._boundComponent = this.layoutManager.bindComponent(this, config); - this.updateElementPositionPropertyFromBoundComponent(); - if (this._boundComponent.virtual) { - if (this.virtualVisibilityChangeRequiredEvent !== void 0) { - this.virtualVisibilityChangeRequiredEvent(this, this._visible); - } - if (this.virtualRectingRequiredEvent !== void 0) { - this._layoutManager.fireBeforeVirtualRectingEvent(1); - try { - this.virtualRectingRequiredEvent(this, this._width, this._height); - } finally { - this._layoutManager.fireAfterVirtualRectingEvent(); - } - } - if (this.virtualZIndexChangeRequiredEvent !== void 0) { - this.virtualZIndexChangeRequiredEvent(this, LogicalZIndex.base, StyleConstants.defaultComponentBaseZIndex); - } - } - this.emit("stateChanged"); - } - } - getState() { - return this._state; - } - extendState(state) { - const extendedState = deepExtend(this._state, state); - this.setState(extendedState); - } - setState(state) { - this._state = state; - this._parent.emitBaseBubblingEvent("stateChanged"); - } - setTitle(title) { - this._parent.setTitle(title); - } - setTab(tab) { - this._tab = tab; - this.emit("tab", tab); - } - setVisibility(value) { - if (this._boundComponent.virtual) { - if (this.virtualVisibilityChangeRequiredEvent !== void 0) { - this.virtualVisibilityChangeRequiredEvent(this, value); - } - } - if (value) { - if (!this._visible) { - this._visible = true; - if (this._height === 0 && this._width === 0) { - this._isShownWithZeroDimensions = true; - } else { - this._isShownWithZeroDimensions = false; - this.setSizeToNodeSize(this._width, this._height, true); - this.emitShow(); - } - } else { - if (this._isShownWithZeroDimensions && (this._height !== 0 || this._width !== 0)) { - this._isShownWithZeroDimensions = false; - this.setSizeToNodeSize(this._width, this._height, true); - this.emitShow(); - } - } - } else { - if (this._visible) { - this._visible = false; - this._isShownWithZeroDimensions = false; - this.emitHide(); - } - } - } - enterDragMode(width, height) { - this._width = width; - this._height = height; - setElementWidth(this._element, width); - setElementHeight(this._element, height); - if (this.virtualZIndexChangeRequiredEvent !== void 0) { - this.virtualZIndexChangeRequiredEvent(this, LogicalZIndex.drag, StyleConstants.defaultComponentDragZIndex); - } - this.drag(); - } - exitDragMode() { - if (this.virtualZIndexChangeRequiredEvent !== void 0) { - this.virtualZIndexChangeRequiredEvent(this, LogicalZIndex.base, StyleConstants.defaultComponentBaseZIndex); - } - } - enterStackMaximised() { - this._stackMaximised = true; - if (this.virtualZIndexChangeRequiredEvent !== void 0) { - this.virtualZIndexChangeRequiredEvent(this, LogicalZIndex.stackMaximised, StyleConstants.defaultComponentStackMaximisedZIndex); - } - } - exitStackMaximised() { - if (this.virtualZIndexChangeRequiredEvent !== void 0) { - this.virtualZIndexChangeRequiredEvent(this, LogicalZIndex.base, StyleConstants.defaultComponentBaseZIndex); - } - this._stackMaximised = false; - } - drag() { - if (this._boundComponent.virtual) { - if (this.virtualRectingRequiredEvent !== void 0) { - this._layoutManager.fireBeforeVirtualRectingEvent(1); - try { - this.virtualRectingRequiredEvent(this, this._width, this._height); - } finally { - this._layoutManager.fireAfterVirtualRectingEvent(); - } - } - } - } - setSizeToNodeSize(width, height, force) { - if (width !== this._width || height !== this._height || force) { - this._width = width; - this._height = height; - setElementWidth(this._element, width); - setElementHeight(this._element, height); - if (this._boundComponent.virtual) { - this.addVirtualSizedContainerToLayoutManager(); - } else { - this.emit("resize"); - this.checkShownFromZeroDimensions(); - } - } - } - notifyVirtualRectingRequired() { - if (this.virtualRectingRequiredEvent !== void 0) { - this.virtualRectingRequiredEvent(this, this._width, this._height); - this.emit("resize"); - this.checkShownFromZeroDimensions(); - } - } - updateElementPositionPropertyFromBoundComponent() { - if (this._boundComponent.virtual) { - this._element.style.position = "static"; - } else { - this._element.style.position = ""; - } - } - addVirtualSizedContainerToLayoutManager() { - this._layoutManager.beginVirtualSizedContainerAdding(); - try { - this._layoutManager.addVirtualSizedContainer(this); - } finally { - this._layoutManager.endVirtualSizedContainerAdding(); - } - } - checkShownFromZeroDimensions() { - if (this._isShownWithZeroDimensions && (this._height !== 0 || this._width !== 0)) { - this._isShownWithZeroDimensions = false; - this.emitShow(); - } - } - emitShow() { - this.emit("shown"); - this.emit("show"); - } - emitHide() { - this.emit("hide"); - } - releaseComponent() { - if (this._stackMaximised) { - this.exitStackMaximised(); - } - this.emit("beforeComponentRelease", this._boundComponent.component); - this.layoutManager.unbindComponent(this, this._boundComponent.virtual, this._boundComponent.component); - } -} -class BrowserPopout extends EventEmitter { - constructor(_config, _initialWindowSize, _layoutManager) { - super(); - this._config = _config; - this._initialWindowSize = _initialWindowSize; - this._layoutManager = _layoutManager; - this._isInitialised = false; - this._popoutWindow = null; - this.createWindow(); - } - toConfig() { - var _a, _b; - if (this._isInitialised === false) { - throw new Error("Can't create config, layout not yet initialised"); - } - const glInstance = this.getGlInstance(); - const glInstanceConfig = glInstance.saveLayout(); - let left; - let top; - if (this._popoutWindow === null) { - left = null; - top = null; - } else { - left = (_a = this._popoutWindow.screenX) !== null && _a !== void 0 ? _a : this._popoutWindow.screenLeft; - top = (_b = this._popoutWindow.screenY) !== null && _b !== void 0 ? _b : this._popoutWindow.screenTop; - } - const window2 = { - width: this.getGlInstance().width, - height: this.getGlInstance().height, - left, - top - }; - const config = { - root: glInstanceConfig.root, - openPopouts: glInstanceConfig.openPopouts, - settings: glInstanceConfig.settings, - dimensions: glInstanceConfig.dimensions, - header: glInstanceConfig.header, - window: window2, - parentId: this._config.parentId, - indexInParent: this._config.indexInParent, - resolved: true - }; - return config; - } - getGlInstance() { - if (this._popoutWindow === null) { - throw new UnexpectedNullError("BPGGI24693"); - } - return this._popoutWindow.__glInstance; - } - getWindow() { - if (this._popoutWindow === null) { - throw new UnexpectedNullError("BPGW087215"); - } - return this._popoutWindow; - } - close() { - if (this.getGlInstance()) { - this.getGlInstance().closeWindow(); - } else { - try { - this.getWindow().close(); - } catch (e) { - } - } - } - popIn() { - let parentItem; - let index = this._config.indexInParent; - if (!this._config.parentId) { - return; - } - const glInstanceLayoutConfig = this.getGlInstance().saveLayout(); - const copiedGlInstanceLayoutConfig = deepExtend({}, glInstanceLayoutConfig); - const copiedRoot = copiedGlInstanceLayoutConfig.root; - if (copiedRoot === void 0) { - throw new UnexpectedUndefinedError("BPPIR19998"); - } - const groundItem = this._layoutManager.groundItem; - if (groundItem === void 0) { - throw new UnexpectedUndefinedError("BPPIG34972"); - } - parentItem = groundItem.getItemsByPopInParentId(this._config.parentId)[0]; - if (!parentItem) { - if (groundItem.contentItems.length > 0) { - parentItem = groundItem.contentItems[0]; - } else { - parentItem = groundItem; - } - index = 0; - } - const newContentItem = this._layoutManager.createAndInitContentItem(copiedRoot, parentItem); - parentItem.addChild(newContentItem, index); - if (this._layoutManager.layoutConfig.settings.popInOnClose) { - this._onClose(); - } else { - this.close(); - } - } - createWindow() { - const url = this.createUrl(); - const target = Math.floor(Math.random() * 1e6).toString(36); - const features = this.serializeWindowFeatures({ - width: this._initialWindowSize.width, - height: this._initialWindowSize.height, - innerWidth: this._initialWindowSize.width, - innerHeight: this._initialWindowSize.height, - menubar: "no", - toolbar: "no", - location: "no", - personalbar: "no", - resizable: "yes", - scrollbars: "no", - status: "no" - }); - this._popoutWindow = globalThis.open(url, target, features); - if (!this._popoutWindow) { - if (this._layoutManager.layoutConfig.settings.blockedPopoutsThrowError === true) { - const error = new PopoutBlockedError("Popout blocked"); - throw error; - } else { - return; - } - } - this._popoutWindow.addEventListener("load", () => this.positionWindow(), {passive: true}); - this._popoutWindow.addEventListener("beforeunload", () => { - if (this._layoutManager.layoutConfig.settings.popInOnClose) { - this.popIn(); - } else { - this._onClose(); - } - }, {passive: true}); - this._checkReadyInterval = setInterval(() => this.checkReady(), 10); - } - checkReady() { - if (this._popoutWindow === null) { - throw new UnexpectedNullError("BPCR01844"); - } else { - if (this._popoutWindow.__glInstance && this._popoutWindow.__glInstance.isInitialised) { - this.onInitialised(); - if (this._checkReadyInterval !== void 0) { - clearInterval(this._checkReadyInterval); - this._checkReadyInterval = void 0; - } - } - } - } - serializeWindowFeatures(windowOptions) { - const windowOptionsString = []; - for (const key in windowOptions) { - windowOptionsString.push(key + "=" + windowOptions[key].toString()); - } - return windowOptionsString.join(","); - } - createUrl() { - const storageKey = "gl-window-config-" + getUniqueId(); - const config = ResolvedLayoutConfig.minifyConfig(this._config); - try { - localStorage.setItem(storageKey, JSON.stringify(config)); - } catch (e) { - throw new Error("Error while writing to localStorage " + e.toString()); - } - const url = new URL(location.href); - url.searchParams.set("gl-window", storageKey); - return url.toString(); - } - positionWindow() { - if (this._popoutWindow === null) { - throw new Error("BrowserPopout.positionWindow: null popoutWindow"); - } else { - this._popoutWindow.moveTo(this._initialWindowSize.left, this._initialWindowSize.top); - this._popoutWindow.focus(); - } - } - onInitialised() { - this._isInitialised = true; - this.getGlInstance().on("popIn", () => this.popIn()); - this.emit("initialised"); - } - _onClose() { - setTimeout(() => this.emit("closed"), 50); - } -} -function getJQueryOffset(element) { - const rect = element.getBoundingClientRect(); - return { - top: rect.top + document.body.scrollTop, - left: rect.left + document.body.scrollLeft - }; -} -class ContentItem extends EventEmitter { - constructor(layoutManager, config, _parent, _element) { - super(); - this.layoutManager = layoutManager; - this._parent = _parent; - this._element = _element; - this._popInParentIds = []; - this._type = config.type; - this._id = config.id; - this._isInitialised = false; - this.isGround = false; - this.isRow = false; - this.isColumn = false; - this.isStack = false; - this.isComponent = false; - this.width = config.width; - this.minWidth = config.minWidth; - this.height = config.height; - this.minHeight = config.minHeight; - this._isClosable = config.isClosable; - this._pendingEventPropagations = {}; - this._throttledEvents = ["stateChanged"]; - this._contentItems = this.createContentItems(config.content); - } - get type() { - return this._type; - } - get id() { - return this._id; - } - set id(value) { - this._id = value; - } - get popInParentIds() { - return this._popInParentIds; - } - get parent() { - return this._parent; - } - get contentItems() { - return this._contentItems; - } - get isClosable() { - return this._isClosable; - } - get element() { - return this._element; - } - get isInitialised() { - return this._isInitialised; - } - static isStack(item) { - return item.isStack; - } - static isComponentItem(item) { - return item.isComponent; - } - static isComponentParentableItem(item) { - return item.isStack || item.isGround; - } - removeChild(contentItem, keepChild = false) { - const index = this._contentItems.indexOf(contentItem); - if (index === -1) { - throw new Error("Can't remove child item. Unknown content item"); - } - if (!keepChild) { - this._contentItems[index].destroy(); - } - this._contentItems.splice(index, 1); - if (this._contentItems.length > 0) { - this.updateSize(); - } else { - if (!this.isGround && this._isClosable === true) { - if (this._parent === null) { - throw new UnexpectedNullError("CIUC00874"); - } else { - this._parent.removeChild(this); - } - } - } - } - addChild(contentItem, index, suspendResize) { - index !== null && index !== void 0 ? index : index = this._contentItems.length; - this._contentItems.splice(index, 0, contentItem); - contentItem.setParent(this); - if (this._isInitialised === true && contentItem._isInitialised === false) { - contentItem.init(); - } - return index; - } - replaceChild(oldChild, newChild, destroyOldChild = false) { - const index = this._contentItems.indexOf(oldChild); - const parentNode = oldChild._element.parentNode; - if (index === -1) { - throw new AssertError("CIRCI23232", "Can't replace child. oldChild is not child of this"); - } - if (parentNode === null) { - throw new UnexpectedNullError("CIRCP23232"); - } else { - parentNode.replaceChild(newChild._element, oldChild._element); - if (destroyOldChild === true) { - oldChild._parent = null; - oldChild.destroy(); - } - this._contentItems[index] = newChild; - newChild.setParent(this); - newChild.height = oldChild.height; - newChild.width = oldChild.width; - if (newChild._parent === null) { - throw new UnexpectedNullError("CIRCNC45699"); - } else { - if (newChild._parent._isInitialised === true && newChild._isInitialised === false) { - newChild.init(); - } - this.updateSize(); - } - } - } - remove() { - if (this._parent === null) { - throw new UnexpectedNullError("CIR11110"); - } else { - this._parent.removeChild(this); - } - } - popout() { - const parentId = getUniqueId(); - const browserPopout = this.layoutManager.createPopoutFromContentItem(this, void 0, parentId, void 0); - this.emitBaseBubblingEvent("stateChanged"); - return browserPopout; - } - calculateConfigContent() { - const contentItems = this._contentItems; - const count = contentItems.length; - const result = new Array(count); - for (let i = 0; i < count; i++) { - const item = contentItems[i]; - result[i] = item.toConfig(); - } - return result; - } - highlightDropZone(x, y, area) { - const dropTargetIndicator = this.layoutManager.dropTargetIndicator; - if (dropTargetIndicator === null) { - throw new UnexpectedNullError("ACIHDZ5593"); - } else { - dropTargetIndicator.highlightArea(area); - } - } - onDrop(contentItem, area) { - this.addChild(contentItem); - } - show() { - setElementDisplayVisibility(this._element, true); - this.layoutManager.updateSizeFromContainer(); - for (let i = 0; i < this._contentItems.length; i++) { - this._contentItems[i].show(); - } - } - destroy() { - for (let i = 0; i < this._contentItems.length; i++) { - this._contentItems[i].destroy(); - } - this._contentItems = []; - this.emitBaseBubblingEvent("beforeItemDestroyed"); - this._element.remove(); - this.emitBaseBubblingEvent("itemDestroyed"); - } - getElementArea(element) { - element = element !== null && element !== void 0 ? element : this._element; - const offset = getJQueryOffset(element); - const width = element.offsetWidth; - const height = element.offsetHeight; - return { - x1: offset.left + 1, - y1: offset.top + 1, - x2: offset.left + width - 1, - y2: offset.top + height - 1, - surface: width * height, - contentItem: this - }; - } - init() { - this._isInitialised = true; - this.emitBaseBubblingEvent("itemCreated"); - this.emitUnknownBubblingEvent(this.type + "Created"); - } - setParent(parent) { - this._parent = parent; - } - addPopInParentId(id) { - if (!this.popInParentIds.includes(id)) { - this.popInParentIds.push(id); - } - } - initContentItems() { - for (let i = 0; i < this._contentItems.length; i++) { - this._contentItems[i].init(); - } - } - hide() { - setElementDisplayVisibility(this._element, false); - this.layoutManager.updateSizeFromContainer(); - } - updateContentItemsSize() { - for (let i = 0; i < this._contentItems.length; i++) { - this._contentItems[i].updateSize(); - } - } - createContentItems(content) { - const count = content.length; - const result = new Array(count); - for (let i = 0; i < content.length; i++) { - result[i] = this.layoutManager.createContentItem(content[i], this); - } - return result; - } - propagateEvent(name, args) { - if (args.length === 1) { - const event = args[0]; - if (event instanceof EventEmitter.BubblingEvent && event.isPropagationStopped === false && this._isInitialised === true) { - if (this.isGround === false && this._parent) { - this._parent.emitUnknown(name, event); - } else { - this.scheduleEventPropagationToLayoutManager(name, event); - } - } - } - } - tryBubbleEvent(name, args) { - if (args.length === 1) { - const event = args[0]; - if (event instanceof EventEmitter.BubblingEvent && event.isPropagationStopped === false && this._isInitialised === true) { - if (this.isGround === false && this._parent) { - this._parent.emitUnknown(name, event); - } else { - this.scheduleEventPropagationToLayoutManager(name, event); - } - } - } - } - scheduleEventPropagationToLayoutManager(name, event) { - if (this._throttledEvents.indexOf(name) === -1) { - this.layoutManager.emitUnknown(name, event); - } else { - if (this._pendingEventPropagations[name] !== true) { - this._pendingEventPropagations[name] = true; - globalThis.requestAnimationFrame(() => this.propagateEventToLayoutManager(name, event)); - } - } - } - propagateEventToLayoutManager(name, event) { - this._pendingEventPropagations[name] = false; - this.layoutManager.emitUnknown(name, event); - } -} -class ComponentItem extends ContentItem { - constructor(layoutManager, config, _parentItem) { - super(layoutManager, config, _parentItem, document.createElement("div")); - this._parentItem = _parentItem; - this._focused = false; - this.isComponent = true; - this._reorderEnabled = config.reorderEnabled; - this.applyUpdatableConfig(config); - this._initialWantMaximise = config.maximised; - const containerElement = document.createElement("div"); - containerElement.classList.add("lm_content"); - this.element.appendChild(containerElement); - this._container = new ComponentContainer(config, this, layoutManager, containerElement, (itemConfig) => this.handleUpdateItemConfigEvent(itemConfig), () => this.show(), () => this.hide(), (suppressEvent) => this.focus(suppressEvent), (suppressEvent) => this.blur(suppressEvent)); - } - get componentName() { - return this._container.componentType; - } - get componentType() { - return this._container.componentType; - } - get reorderEnabled() { - return this._reorderEnabled; - } - get initialWantMaximise() { - return this._initialWantMaximise; - } - get component() { - return this._container.component; - } - get container() { - return this._container; - } - get parentItem() { - return this._parentItem; - } - get headerConfig() { - return this._headerConfig; - } - get title() { - return this._title; - } - get tab() { - return this._tab; - } - get focused() { - return this._focused; - } - destroy() { - this._container.destroy(); - super.destroy(); - } - applyUpdatableConfig(config) { - this.setTitle(config.title); - this._headerConfig = config.header; - } - toConfig() { - const stateRequestEvent = this._container.stateRequestEvent; - const state = stateRequestEvent === void 0 ? this._container.state : stateRequestEvent(); - const result = { - type: ItemType.component, - content: [], - width: this.width, - minWidth: this.minWidth, - height: this.height, - minHeight: this.minHeight, - id: this.id, - maximised: false, - isClosable: this.isClosable, - reorderEnabled: this._reorderEnabled, - title: this._title, - header: ResolvedHeaderedItemConfig.Header.createCopy(this._headerConfig), - componentType: ResolvedComponentItemConfig.copyComponentType(this.componentType), - componentState: state - }; - return result; - } - close() { - if (this.parent === null) { - throw new UnexpectedNullError("CIC68883"); - } else { - this.parent.removeChild(this, false); - } - } - enterDragMode(width, height) { - setElementWidth(this.element, width); - setElementHeight(this.element, height); - this._container.enterDragMode(width, height); - } - exitDragMode() { - this._container.exitDragMode(); - } - enterStackMaximised() { - this._container.enterStackMaximised(); - } - exitStackMaximised() { - this._container.exitStackMaximised(); - } - drag() { - this._container.drag(); - } - updateSize() { - this.updateNodeSize(); - } - init() { - this.updateNodeSize(); - super.init(); - this._container.emit("open"); - this.initContentItems(); - } - setTitle(title) { - this._title = title; - this.emit("titleChanged", title); - this.emit("stateChanged"); - } - setTab(tab) { - this._tab = tab; - this.emit("tab", tab); - this._container.setTab(tab); - } - hide() { - super.hide(); - this._container.setVisibility(false); - } - show() { - super.show(); - this._container.setVisibility(true); - } - focus(suppressEvent = false) { - this.parentItem.setActiveComponentItem(this, true, suppressEvent); - } - setFocused(suppressEvent) { - this._focused = true; - this.tab.setFocused(); - if (!suppressEvent) { - this.emitBaseBubblingEvent("focus"); - } - } - blur(suppressEvent = false) { - if (this._focused) { - this.layoutManager.setFocusedComponentItem(void 0, suppressEvent); - } - } - setBlurred(suppressEvent) { - this._focused = false; - this.tab.setBlurred(); - if (!suppressEvent) { - this.emitBaseBubblingEvent("blur"); - } - } - setParent(parent) { - this._parentItem = parent; - super.setParent(parent); - } - handleUpdateItemConfigEvent(itemConfig) { - this.applyUpdatableConfig(itemConfig); - } - updateNodeSize() { - if (this.element.style.display !== "none") { - const {width, height} = getElementWidthAndHeight(this.element); - this._container.setSizeToNodeSize(width, height, false); - } - } -} -class ComponentParentableItem extends ContentItem { - constructor() { - super(...arguments); - this._focused = false; - } - get focused() { - return this._focused; - } - setFocusedValue(value) { - this._focused = value; - } -} -class DragListener extends EventEmitter { - constructor(_eElement, extraAllowableChildTargets) { - super(); - this._eElement = _eElement; - this._pointerTracking = false; - this._pointerDownEventListener = (ev) => this.onPointerDown(ev); - this._pointerMoveEventListener = (ev) => this.onPointerMove(ev); - this._pointerUpEventListener = (ev) => this.onPointerUp(ev); - this._timeout = void 0; - this._allowableTargets = [_eElement, ...extraAllowableChildTargets]; - this._oDocument = document; - this._eBody = document.body; - this._nDelay = 1800; - this._nDistance = 10; - this._nX = 0; - this._nY = 0; - this._nOriginalX = 0; - this._nOriginalY = 0; - this._dragging = false; - this._eElement.addEventListener("pointerdown", this._pointerDownEventListener, {passive: true}); - } - destroy() { - this.checkRemovePointerTrackingEventListeners(); - this._eElement.removeEventListener("pointerdown", this._pointerDownEventListener); - } - cancelDrag() { - this.processDragStop(void 0); - } - onPointerDown(oEvent) { - if (this._allowableTargets.includes(oEvent.target) && oEvent.isPrimary) { - const coordinates = this.getPointerCoordinates(oEvent); - this.processPointerDown(coordinates); - } - } - processPointerDown(coordinates) { - this._nOriginalX = coordinates.x; - this._nOriginalY = coordinates.y; - this._oDocument.addEventListener("pointermove", this._pointerMoveEventListener); - this._oDocument.addEventListener("pointerup", this._pointerUpEventListener, {passive: true}); - this._pointerTracking = true; - this._timeout = setTimeout(() => { - try { - this.startDrag(); - } catch (err) { - console.error(err); - throw err; - } - }, this._nDelay); - } - onPointerMove(oEvent) { - if (this._pointerTracking) { - this.processDragMove(oEvent); - oEvent.preventDefault(); - } - } - processDragMove(dragEvent) { - this._nX = dragEvent.pageX - this._nOriginalX; - this._nY = dragEvent.pageY - this._nOriginalY; - if (this._dragging === false) { - if (Math.abs(this._nX) > this._nDistance || Math.abs(this._nY) > this._nDistance) { - this.startDrag(); - } - } - if (this._dragging) { - this.emit("drag", this._nX, this._nY, dragEvent); - } - } - onPointerUp(oEvent) { - this.processDragStop(oEvent); - } - processDragStop(dragEvent) { - var _a; - if (this._timeout !== void 0) { - clearTimeout(this._timeout); - this._timeout = void 0; - } - this.checkRemovePointerTrackingEventListeners(); - if (this._dragging === true) { - this._eBody.classList.remove("lm_dragging"); - this._eElement.classList.remove("lm_dragging"); - (_a = this._oDocument.querySelector("iframe")) === null || _a === void 0 ? void 0 : _a.style.setProperty("pointer-events", ""); - this._dragging = false; - this.emit("dragStop", dragEvent); - } - } - checkRemovePointerTrackingEventListeners() { - if (this._pointerTracking) { - this._oDocument.removeEventListener("pointermove", this._pointerMoveEventListener); - this._oDocument.removeEventListener("pointerup", this._pointerUpEventListener); - this._pointerTracking = false; - } - } - startDrag() { - var _a; - if (this._timeout !== void 0) { - clearTimeout(this._timeout); - this._timeout = void 0; - } - this._dragging = true; - this._eBody.classList.add("lm_dragging"); - this._eElement.classList.add("lm_dragging"); - (_a = this._oDocument.querySelector("iframe")) === null || _a === void 0 ? void 0 : _a.style.setProperty("pointer-events", "none"); - this.emit("dragStart", this._nOriginalX, this._nOriginalY); - } - getPointerCoordinates(event) { - const result = { - x: event.pageX, - y: event.pageY - }; - return result; - } -} -class Splitter { - constructor(_isVertical, _size, grabSize) { - this._isVertical = _isVertical; - this._size = _size; - this._grabSize = grabSize < this._size ? this._size : grabSize; - this._element = document.createElement("div"); - this._element.classList.add("lm_splitter"); - const dragHandleElement = document.createElement("div"); - dragHandleElement.classList.add("lm_drag_handle"); - const handleExcessSize = this._grabSize - this._size; - const handleExcessPos = handleExcessSize / 2; - if (this._isVertical) { - dragHandleElement.style.top = numberToPixels(-handleExcessPos); - dragHandleElement.style.height = numberToPixels(this._size + handleExcessSize); - this._element.classList.add("lm_vertical"); - this._element.style.height = numberToPixels(this._size); - } else { - dragHandleElement.style.left = numberToPixels(-handleExcessPos); - dragHandleElement.style.width = numberToPixels(this._size + handleExcessSize); - this._element.classList.add("lm_horizontal"); - this._element.style.width = numberToPixels(this._size); - } - this._element.appendChild(dragHandleElement); - this._dragListener = new DragListener(this._element, [dragHandleElement]); - } - get element() { - return this._element; - } - destroy() { - this._element.remove(); - } - on(eventName, callback) { - this._dragListener.on(eventName, callback); - } -} -class RowOrColumn extends ContentItem { - constructor(isColumn, layoutManager, config, _rowOrColumnParent) { - super(layoutManager, config, _rowOrColumnParent, RowOrColumn.createElement(document, isColumn)); - this._rowOrColumnParent = _rowOrColumnParent; - this._splitter = []; - this.isRow = !isColumn; - this.isColumn = isColumn; - this._childElementContainer = this.element; - this._splitterSize = layoutManager.layoutConfig.dimensions.borderWidth; - this._splitterGrabSize = layoutManager.layoutConfig.dimensions.borderGrabWidth; - this._isColumn = isColumn; - this._dimension = isColumn ? "height" : "width"; - this._splitterPosition = null; - this._splitterMinPosition = null; - this._splitterMaxPosition = null; - switch (config.type) { - case ItemType.row: - case ItemType.column: - this._configType = config.type; - break; - default: - throw new AssertError("ROCCCT00925"); - } - } - newComponent(componentType, componentState, title, index) { - const itemConfig = { - type: "component", - componentType, - componentState, - title - }; - return this.newItem(itemConfig, index); - } - addComponent(componentType, componentState, title, index) { - const itemConfig = { - type: "component", - componentType, - componentState, - title - }; - return this.addItem(itemConfig, index); - } - newItem(itemConfig, index) { - index = this.addItem(itemConfig, index); - const createdItem = this.contentItems[index]; - if (ContentItem.isStack(createdItem) && ItemConfig.isComponent(itemConfig)) { - return createdItem.contentItems[0]; - } else { - return createdItem; - } - } - addItem(itemConfig, index) { - this.layoutManager.checkMinimiseMaximisedStack(); - const resolvedItemConfig = ItemConfig.resolve(itemConfig); - const contentItem = this.layoutManager.createAndInitContentItem(resolvedItemConfig, this); - return this.addChild(contentItem, index, false); - } - addChild(contentItem, index, suspendResize) { - if (index === void 0) { - index = this.contentItems.length; - } - if (this.contentItems.length > 0) { - const splitterElement = this.createSplitter(Math.max(0, index - 1)).element; - if (index > 0) { - this.contentItems[index - 1].element.insertAdjacentElement("afterend", splitterElement); - splitterElement.insertAdjacentElement("afterend", contentItem.element); - } else { - this.contentItems[0].element.insertAdjacentElement("beforebegin", splitterElement); - splitterElement.insertAdjacentElement("beforebegin", contentItem.element); - } - } else { - this._childElementContainer.appendChild(contentItem.element); - } - super.addChild(contentItem, index); - const newItemSize = 1 / this.contentItems.length * 100; - if (suspendResize === true) { - this.emitBaseBubblingEvent("stateChanged"); - return index; - } - for (let i = 0; i < this.contentItems.length; i++) { - if (this.contentItems[i] === contentItem) { - contentItem[this._dimension] = newItemSize; - } else { - const itemSize = this.contentItems[i][this._dimension] *= (100 - newItemSize) / 100; - this.contentItems[i][this._dimension] = itemSize; - } - } - this.updateSize(); - this.emitBaseBubblingEvent("stateChanged"); - return index; - } - removeChild(contentItem, keepChild) { - const index = this.contentItems.indexOf(contentItem); - const splitterIndex = Math.max(index - 1, 0); - if (index === -1) { - throw new Error("Can't remove child. ContentItem is not child of this Row or Column"); - } - if (this._splitter[splitterIndex]) { - this._splitter[splitterIndex].destroy(); - this._splitter.splice(splitterIndex, 1); - } - super.removeChild(contentItem, keepChild); - if (this.contentItems.length === 1 && this.isClosable === true) { - const childItem = this.contentItems[0]; - this.contentItems.length = 0; - this._rowOrColumnParent.replaceChild(this, childItem, true); - } else { - this.updateSize(); - this.emitBaseBubblingEvent("stateChanged"); - } - } - replaceChild(oldChild, newChild) { - const size = oldChild[this._dimension]; - super.replaceChild(oldChild, newChild); - newChild[this._dimension] = size; - this.updateSize(); - this.emitBaseBubblingEvent("stateChanged"); - } - updateSize() { - this.layoutManager.beginVirtualSizedContainerAdding(); - try { - this.updateNodeSize(); - this.updateContentItemsSize(); - } finally { - this.layoutManager.endVirtualSizedContainerAdding(); - } - } - init() { - if (this.isInitialised === true) - return; - this.updateNodeSize(); - for (let i = 0; i < this.contentItems.length; i++) { - this._childElementContainer.appendChild(this.contentItems[i].element); - } - super.init(); - for (let i = 0; i < this.contentItems.length - 1; i++) { - this.contentItems[i].element.insertAdjacentElement("afterend", this.createSplitter(i).element); - } - this.initContentItems(); - } - toConfig() { - const result = { - type: this.type, - content: this.calculateConfigContent(), - width: this.width, - minWidth: this.minWidth, - height: this.height, - minHeight: this.minHeight, - id: this.id, - isClosable: this.isClosable - }; - return result; - } - setParent(parent) { - this._rowOrColumnParent = parent; - super.setParent(parent); - } - updateNodeSize() { - if (this.contentItems.length > 0) { - this.calculateRelativeSizes(); - this.setAbsoluteSizes(); - } - this.emitBaseBubblingEvent("stateChanged"); - this.emit("resize"); - } - setAbsoluteSizes() { - const sizeData = this.calculateAbsoluteSizes(); - for (let i = 0; i < this.contentItems.length; i++) { - if (sizeData.additionalPixel - i > 0) { - sizeData.itemSizes[i]++; - } - if (this._isColumn) { - setElementWidth(this.contentItems[i].element, sizeData.totalWidth); - setElementHeight(this.contentItems[i].element, sizeData.itemSizes[i]); - } else { - setElementWidth(this.contentItems[i].element, sizeData.itemSizes[i]); - setElementHeight(this.contentItems[i].element, sizeData.totalHeight); - } - } - } - calculateAbsoluteSizes() { - const totalSplitterSize = (this.contentItems.length - 1) * this._splitterSize; - let {width: totalWidth, height: totalHeight} = getElementWidthAndHeight(this.element); - if (this._isColumn) { - totalHeight -= totalSplitterSize; - } else { - totalWidth -= totalSplitterSize; - } - let totalAssigned = 0; - const itemSizes = []; - for (let i = 0; i < this.contentItems.length; i++) { - let itemSize; - if (this._isColumn) { - itemSize = Math.floor(totalHeight * (this.contentItems[i].height / 100)); - } else { - itemSize = Math.floor(totalWidth * (this.contentItems[i].width / 100)); - } - totalAssigned += itemSize; - itemSizes.push(itemSize); - } - const additionalPixel = Math.floor((this._isColumn ? totalHeight : totalWidth) - totalAssigned); - return { - itemSizes, - additionalPixel, - totalWidth, - totalHeight - }; - } - calculateRelativeSizes() { - let total = 0; - const itemsWithoutSetDimension = []; - for (let i = 0; i < this.contentItems.length; i++) { - if (this.contentItems[i][this._dimension] !== void 0) { - total += this.contentItems[i][this._dimension]; - } else { - itemsWithoutSetDimension.push(this.contentItems[i]); - } - } - if (Math.round(total) === 100) { - this.respectMinItemWidth(); - return; - } - if (Math.round(total) < 100 && itemsWithoutSetDimension.length > 0) { - for (let i = 0; i < itemsWithoutSetDimension.length; i++) { - itemsWithoutSetDimension[i][this._dimension] = (100 - total) / itemsWithoutSetDimension.length; - } - this.respectMinItemWidth(); - return; - } - if (Math.round(total) > 100) { - for (let i = 0; i < itemsWithoutSetDimension.length; i++) { - itemsWithoutSetDimension[i][this._dimension] = 50; - total += 50; - } - } - for (let i = 0; i < this.contentItems.length; i++) { - this.contentItems[i][this._dimension] = this.contentItems[i][this._dimension] / total * 100; - } - this.respectMinItemWidth(); - } - respectMinItemWidth() { - const minItemWidth = this.layoutManager.layoutConfig.dimensions.minItemWidth; - let totalOverMin = 0; - let totalUnderMin = 0; - const entriesOverMin = []; - const allEntries = []; - if (this._isColumn || !minItemWidth || this.contentItems.length <= 1) { - return; - } - const sizeData = this.calculateAbsoluteSizes(); - for (let i = 0; i < sizeData.itemSizes.length; i++) { - const itemSize = sizeData.itemSizes[i]; - let entry; - if (itemSize < minItemWidth) { - totalUnderMin += minItemWidth - itemSize; - entry = { - width: minItemWidth - }; - } else { - totalOverMin += itemSize - minItemWidth; - entry = { - width: itemSize - }; - entriesOverMin.push(entry); - } - allEntries.push(entry); - } - if (totalUnderMin === 0 || totalUnderMin > totalOverMin) { - return; - } - const reducePercent = totalUnderMin / totalOverMin; - let remainingWidth = totalUnderMin; - for (let i = 0; i < entriesOverMin.length; i++) { - const entry = entriesOverMin[i]; - const reducedWidth = Math.round((entry.width - minItemWidth) * reducePercent); - remainingWidth -= reducedWidth; - entry.width -= reducedWidth; - } - if (remainingWidth !== 0) { - allEntries[allEntries.length - 1].width -= remainingWidth; - } - for (let i = 0; i < this.contentItems.length; i++) { - this.contentItems[i].width = allEntries[i].width / sizeData.totalWidth * 100; - } - } - createSplitter(index) { - const splitter = new Splitter(this._isColumn, this._splitterSize, this._splitterGrabSize); - splitter.on("drag", (offsetX, offsetY) => this.onSplitterDrag(splitter, offsetX, offsetY)); - splitter.on("dragStop", () => this.onSplitterDragStop(splitter)); - splitter.on("dragStart", () => this.onSplitterDragStart(splitter)); - this._splitter.splice(index, 0, splitter); - return splitter; - } - getItemsForSplitter(splitter) { - const index = this._splitter.indexOf(splitter); - return { - before: this.contentItems[index], - after: this.contentItems[index + 1] - }; - } - getMinimumDimensions(arr) { - var _a, _b; - let minWidth = 0; - let minHeight = 0; - for (let i = 0; i < arr.length; ++i) { - minWidth = Math.max((_a = arr[i].minWidth) !== null && _a !== void 0 ? _a : 0, minWidth); - minHeight = Math.max((_b = arr[i].minHeight) !== null && _b !== void 0 ? _b : 0, minHeight); - } - return { - horizontal: minWidth, - vertical: minHeight - }; - } - onSplitterDragStart(splitter) { - const items = this.getItemsForSplitter(splitter); - const minSize = this.layoutManager.layoutConfig.dimensions[this._isColumn ? "minItemHeight" : "minItemWidth"]; - const beforeMinDim = this.getMinimumDimensions(items.before.contentItems); - const beforeMinSize = this._isColumn ? beforeMinDim.vertical : beforeMinDim.horizontal; - const afterMinDim = this.getMinimumDimensions(items.after.contentItems); - const afterMinSize = this._isColumn ? afterMinDim.vertical : afterMinDim.horizontal; - this._splitterPosition = 0; - this._splitterMinPosition = -1 * (pixelsToNumber(items.before.element.style[this._dimension]) - (beforeMinSize || minSize)); - this._splitterMaxPosition = pixelsToNumber(items.after.element.style[this._dimension]) - (afterMinSize || minSize); - } - onSplitterDrag(splitter, offsetX, offsetY) { - let offset = this._isColumn ? offsetY : offsetX; - if (this._splitterMinPosition === null || this._splitterMaxPosition === null) { - throw new UnexpectedNullError("ROCOSD59226"); - } - offset = Math.max(offset, this._splitterMinPosition); - offset = Math.min(offset, this._splitterMaxPosition); - this._splitterPosition = offset; - const offsetPixels = numberToPixels(offset); - if (this._isColumn) { - splitter.element.style.top = offsetPixels; - } else { - splitter.element.style.left = offsetPixels; - } - } - onSplitterDragStop(splitter) { - if (this._splitterPosition === null) { - throw new UnexpectedNullError("ROCOSDS66932"); - } else { - const items = this.getItemsForSplitter(splitter); - const sizeBefore = pixelsToNumber(items.before.element.style[this._dimension]); - const sizeAfter = pixelsToNumber(items.after.element.style[this._dimension]); - const splitterPositionInRange = (this._splitterPosition + sizeBefore) / (sizeBefore + sizeAfter); - const totalRelativeSize = items.before[this._dimension] + items.after[this._dimension]; - items.before[this._dimension] = splitterPositionInRange * totalRelativeSize; - items.after[this._dimension] = (1 - splitterPositionInRange) * totalRelativeSize; - splitter.element.style.top = numberToPixels(0); - splitter.element.style.left = numberToPixels(0); - globalThis.requestAnimationFrame(() => this.updateSize()); - } - } -} -(function(RowOrColumn2) { - function getElementDimensionSize(element, dimension) { - if (dimension === "width") { - return getElementWidth(element); - } else { - return getElementHeight(element); - } - } - RowOrColumn2.getElementDimensionSize = getElementDimensionSize; - function setElementDimensionSize(element, dimension, value) { - if (dimension === "width") { - return setElementWidth(element, value); - } else { - return setElementHeight(element, value); - } - } - RowOrColumn2.setElementDimensionSize = setElementDimensionSize; - function createElement(document2, isColumn) { - const element = document2.createElement("div"); - element.classList.add("lm_item"); - if (isColumn) { - element.classList.add("lm_column"); - } else { - element.classList.add("lm_row"); - } - return element; - } - RowOrColumn2.createElement = createElement; -})(RowOrColumn || (RowOrColumn = {})); -class GroundItem extends ComponentParentableItem { - constructor(layoutManager, rootItemConfig, containerElement) { - super(layoutManager, ResolvedGroundItemConfig.create(rootItemConfig), null, GroundItem.createElement(document)); - this.isGround = true; - this._childElementContainer = this.element; - this._containerElement = containerElement; - this._containerElement.appendChild(this.element); - } - init() { - if (this.isInitialised === true) - return; - this.updateNodeSize(); - for (let i = 0; i < this.contentItems.length; i++) { - this._childElementContainer.appendChild(this.contentItems[i].element); - } - super.init(); - this.initContentItems(); - } - loadRoot(rootItemConfig) { - this.clearRoot(); - if (rootItemConfig !== void 0) { - const rootContentItem = this.layoutManager.createAndInitContentItem(rootItemConfig, this); - this.addChild(rootContentItem, 0); - } - } - clearRoot() { - const contentItems = this.contentItems; - switch (contentItems.length) { - case 0: { - return; - } - case 1: { - const existingRootContentItem = contentItems[0]; - existingRootContentItem.remove(); - return; - } - default: { - throw new AssertError("GILR07721"); - } - } - } - addItem(itemConfig, index) { - this.layoutManager.checkMinimiseMaximisedStack(); - const resolvedItemConfig = ItemConfig.resolve(itemConfig); - let parent; - if (this.contentItems.length > 0) { - parent = this.contentItems[0]; - } else { - parent = this; - } - if (parent.isComponent) { - throw new Error("Cannot add item as child to ComponentItem"); - } else { - const contentItem = this.layoutManager.createAndInitContentItem(resolvedItemConfig, parent); - index = parent.addChild(contentItem, index); - return parent === this ? -1 : index; - } - } - loadComponentAsRoot(itemConfig) { - this.clearRoot(); - const resolvedItemConfig = ItemConfig.resolve(itemConfig); - if (resolvedItemConfig.maximised) { - throw new Error("Root Component cannot be maximised"); - } else { - const rootContentItem = new ComponentItem(this.layoutManager, resolvedItemConfig, this); - rootContentItem.init(); - this.addChild(rootContentItem, 0); - } - } - addChild(contentItem, index) { - if (this.contentItems.length > 0) { - throw new Error("Ground node can only have a single child"); - } else { - this._childElementContainer.appendChild(contentItem.element); - index = super.addChild(contentItem, index); - this.updateSize(); - this.emitBaseBubblingEvent("stateChanged"); - return index; - } - } - calculateConfigContent() { - const contentItems = this.contentItems; - const count = contentItems.length; - const result = new Array(count); - for (let i = 0; i < count; i++) { - const item = contentItems[i]; - const itemConfig = item.toConfig(); - if (ResolvedRootItemConfig.isRootItemConfig(itemConfig)) { - result[i] = itemConfig; - } else { - throw new AssertError("RCCC66832"); - } - } - return result; - } - setSize(width, height) { - if (width === void 0 || height === void 0) { - this.updateSize(); - } else { - setElementWidth(this.element, width); - setElementHeight(this.element, height); - if (this.contentItems.length > 0) { - setElementWidth(this.contentItems[0].element, width); - setElementHeight(this.contentItems[0].element, height); - } - this.updateContentItemsSize(); - } - } - updateSize() { - this.layoutManager.beginVirtualSizedContainerAdding(); - try { - this.updateNodeSize(); - this.updateContentItemsSize(); - } finally { - this.layoutManager.endVirtualSizedContainerAdding(); - } - } - createSideAreas() { - const areaSize = 50; - const oppositeSides = GroundItem.Area.oppositeSides; - const result = new Array(Object.keys(oppositeSides).length); - let idx = 0; - for (const key in oppositeSides) { - const side = key; - const area = this.getElementArea(); - if (area === null) { - throw new UnexpectedNullError("RCSA77553"); - } else { - area.side = side; - if (oppositeSides[side][1] === "2") - area[side] = area[oppositeSides[side]] - areaSize; - else - area[side] = area[oppositeSides[side]] + areaSize; - area.surface = (area.x2 - area.x1) * (area.y2 - area.y1); - result[idx++] = area; - } - } - return result; - } - highlightDropZone(x, y, area) { - this.layoutManager.tabDropPlaceholder.remove(); - super.highlightDropZone(x, y, area); - } - onDrop(contentItem, area) { - if (contentItem.isComponent) { - const itemConfig = ResolvedStackItemConfig.createDefault(); - const component = contentItem; - itemConfig.header = ResolvedHeaderedItemConfig.Header.createCopy(component.headerConfig); - const stack = this.layoutManager.createAndInitContentItem(itemConfig, this); - stack.addChild(contentItem); - contentItem = stack; - } - if (this.contentItems.length === 0) { - this.addChild(contentItem); - } else { - if (contentItem.type === ItemType.row || contentItem.type === ItemType.column) { - const itemConfig = ResolvedStackItemConfig.createDefault(); - const stack = this.layoutManager.createContentItem(itemConfig, this); - stack.addChild(contentItem); - contentItem = stack; - } - const type = area.side[0] == "x" ? ItemType.row : ItemType.column; - const dimension = area.side[0] == "x" ? "width" : "height"; - const insertBefore = area.side[1] == "2"; - const column = this.contentItems[0]; - if (!(column instanceof RowOrColumn) || column.type !== type) { - const itemConfig = ResolvedItemConfig.createDefault(type); - const rowOrColumn = this.layoutManager.createContentItem(itemConfig, this); - this.replaceChild(column, rowOrColumn); - rowOrColumn.addChild(contentItem, insertBefore ? 0 : void 0, true); - rowOrColumn.addChild(column, insertBefore ? void 0 : 0, true); - column[dimension] = 50; - contentItem[dimension] = 50; - rowOrColumn.updateSize(); - } else { - const sibling = column.contentItems[insertBefore ? 0 : column.contentItems.length - 1]; - column.addChild(contentItem, insertBefore ? 0 : void 0, true); - sibling[dimension] *= 0.5; - contentItem[dimension] = sibling[dimension]; - column.updateSize(); - } - } - } - dock() { - throw new AssertError("GID87731"); - } - validateDocking() { - throw new AssertError("GIVD87732"); - } - getAllContentItems() { - const result = [this]; - this.deepGetAllContentItems(this.contentItems, result); - return result; - } - getConfigMaximisedItems() { - const result = []; - this.deepFilterContentItems(this.contentItems, result, (item) => { - if (ContentItem.isStack(item) && item.initialWantMaximise) { - return true; - } else { - if (ContentItem.isComponentItem(item) && item.initialWantMaximise) { - return true; - } else { - return false; - } - } - }); - return result; - } - getItemsByPopInParentId(popInParentId) { - const result = []; - this.deepFilterContentItems(this.contentItems, result, (item) => item.popInParentIds.includes(popInParentId)); - return result; - } - toConfig() { - throw new Error("Cannot generate GroundItem config"); - } - setActiveComponentItem(item, focus, suppressFocusEvent) { - } - updateNodeSize() { - const {width, height} = getElementWidthAndHeight(this._containerElement); - setElementWidth(this.element, width); - setElementHeight(this.element, height); - if (this.contentItems.length > 0) { - setElementWidth(this.contentItems[0].element, width); - setElementHeight(this.contentItems[0].element, height); - } - } - deepGetAllContentItems(content, result) { - for (let i = 0; i < content.length; i++) { - const contentItem = content[i]; - result.push(contentItem); - this.deepGetAllContentItems(contentItem.contentItems, result); - } - } - deepFilterContentItems(content, result, checkAcceptFtn) { - for (let i = 0; i < content.length; i++) { - const contentItem = content[i]; - if (checkAcceptFtn(contentItem)) { - result.push(contentItem); - } - this.deepFilterContentItems(contentItem.contentItems, result, checkAcceptFtn); - } - } -} -(function(GroundItem2) { - (function(Area) { - Area.oppositeSides = { - y2: "y1", - x2: "x1", - y1: "y2", - x1: "x2" - }; - })(GroundItem2.Area || (GroundItem2.Area = {})); - function createElement(document2) { - const element = document2.createElement("div"); - element.classList.add("lm_goldenlayout"); - element.classList.add("lm_item"); - element.classList.add("lm_root"); - return element; - } - GroundItem2.createElement = createElement; -})(GroundItem || (GroundItem = {})); -class HeaderButton { - constructor(_header, label, cssClass, _pushEvent) { - this._header = _header; - this._pushEvent = _pushEvent; - this._clickEventListener = (ev) => this.onClick(ev); - this._touchStartEventListener = (ev) => this.onTouchStart(ev); - this._element = document.createElement("div"); - this._element.classList.add(cssClass); - this._element.title = label; - this._header.on("destroy", () => this.destroy()); - this._element.addEventListener("click", this._clickEventListener, {passive: true}); - this._element.addEventListener("touchstart", this._touchStartEventListener, {passive: true}); - this._header.controlsContainerElement.appendChild(this._element); - } - get element() { - return this._element; - } - destroy() { - var _a; - this._element.removeEventListener("click", this._clickEventListener); - this._element.removeEventListener("touchstart", this._touchStartEventListener); - (_a = this._element.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(this._element); - } - onClick(ev) { - this._pushEvent(ev); - } - onTouchStart(ev) { - this._pushEvent(ev); - } -} -class Tab { - constructor(_layoutManager, _componentItem, _closeEvent, _focusEvent, _dragStartEvent) { - var _a; - this._layoutManager = _layoutManager; - this._componentItem = _componentItem; - this._closeEvent = _closeEvent; - this._focusEvent = _focusEvent; - this._dragStartEvent = _dragStartEvent; - this._isActive = false; - this._tabClickListener = (ev) => this.onTabClickDown(ev); - this._tabTouchStartListener = (ev) => this.onTabTouchStart(ev); - this._closeClickListener = () => this.onCloseClick(); - this._closeTouchStartListener = () => this.onCloseTouchStart(); - this._dragStartListener = (x, y) => this.onDragStart(x, y); - this._contentItemDestroyListener = () => this.onContentItemDestroy(); - this._tabTitleChangedListener = (title) => this.setTitle(title); - this._element = document.createElement("div"); - this._element.classList.add("lm_tab"); - this._titleElement = document.createElement("span"); - this._titleElement.classList.add("lm_title"); - this._closeElement = document.createElement("div"); - this._closeElement.classList.add("lm_close_tab"); - this._element.appendChild(this._titleElement); - this._element.appendChild(this._closeElement); - if (_componentItem.isClosable) { - this._closeElement.style.display = ""; - } else { - this._closeElement.style.display = "none"; - } - this.setTitle(_componentItem.title); - this._componentItem.on("titleChanged", this._tabTitleChangedListener); - const reorderEnabled = (_a = _componentItem.reorderEnabled) !== null && _a !== void 0 ? _a : this._layoutManager.layoutConfig.settings.reorderEnabled; - if (reorderEnabled) { - this.enableReorder(); - } - this._element.addEventListener("click", this._tabClickListener, {passive: true}); - this._element.addEventListener("touchstart", this._tabTouchStartListener, {passive: true}); - if (this._componentItem.isClosable) { - this._closeElement.addEventListener("click", this._closeClickListener, {passive: true}); - this._closeElement.addEventListener("touchstart", this._closeTouchStartListener, {passive: true}); - } else { - this._closeElement.remove(); - this._closeElement = void 0; - } - this._componentItem.setTab(this); - this._layoutManager.emit("tabCreated", this); - } - get isActive() { - return this._isActive; - } - get componentItem() { - return this._componentItem; - } - get contentItem() { - return this._componentItem; - } - get element() { - return this._element; - } - get titleElement() { - return this._titleElement; - } - get closeElement() { - return this._closeElement; - } - get reorderEnabled() { - return this._dragListener !== void 0; - } - set reorderEnabled(value) { - if (value !== this.reorderEnabled) { - if (value) { - this.enableReorder(); - } else { - this.disableReorder(); - } - } - } - setTitle(title) { - this._titleElement.innerText = title; - this._element.title = title; - } - setActive(isActive) { - if (isActive === this._isActive) { - return; - } - this._isActive = isActive; - if (isActive) { - this._element.classList.add("lm_active"); - } else { - this._element.classList.remove("lm_active"); - } - } - destroy() { - var _a, _b; - this._closeEvent = void 0; - this._focusEvent = void 0; - this._dragStartEvent = void 0; - this._element.removeEventListener("click", this._tabClickListener); - this._element.removeEventListener("touchstart", this._tabTouchStartListener); - (_a = this._closeElement) === null || _a === void 0 ? void 0 : _a.removeEventListener("click", this._closeClickListener); - (_b = this._closeElement) === null || _b === void 0 ? void 0 : _b.removeEventListener("touchstart", this._closeTouchStartListener); - this._componentItem.off("titleChanged", this._tabTitleChangedListener); - if (this.reorderEnabled) { - this.disableReorder(); - } - this._element.remove(); - } - setBlurred() { - this._element.classList.remove("lm_focused"); - this._titleElement.classList.remove("lm_focused"); - } - setFocused() { - this._element.classList.add("lm_focused"); - this._titleElement.classList.add("lm_focused"); - } - onDragStart(x, y) { - if (this._dragListener === void 0) { - throw new UnexpectedUndefinedError("TODSDLU10093"); - } else { - if (this._dragStartEvent === void 0) { - throw new UnexpectedUndefinedError("TODS23309"); - } else { - this._dragStartEvent(x, y, this._dragListener, this.componentItem); - } - } - } - onContentItemDestroy() { - if (this._dragListener !== void 0) { - this._dragListener.destroy(); - this._dragListener = void 0; - } - } - onTabClickDown(event) { - const target = event.target; - if (target === this._element || target === this._titleElement) { - if (event.button === 0) { - this.notifyFocus(); - } else if (event.button === 1 && this._componentItem.isClosable) { - this.notifyClose(); - } - } - } - onTabTouchStart(event) { - if (event.target === this._element) { - this.notifyFocus(); - } - } - onCloseClick() { - this.notifyClose(); - } - onCloseTouchStart() { - this.notifyClose(); - } - notifyClose() { - if (this._closeEvent === void 0) { - throw new UnexpectedUndefinedError("TNC15007"); - } else { - this._closeEvent(this._componentItem); - } - } - notifyFocus() { - if (this._focusEvent === void 0) { - throw new UnexpectedUndefinedError("TNA15007"); - } else { - this._focusEvent(this._componentItem); - } - } - enableReorder() { - this._dragListener = new DragListener(this._element, [this._titleElement]); - this._dragListener.on("dragStart", this._dragStartListener); - this._componentItem.on("destroy", this._contentItemDestroyListener); - } - disableReorder() { - if (this._dragListener === void 0) { - throw new UnexpectedUndefinedError("TDR87745"); - } else { - this._componentItem.off("destroy", this._contentItemDestroyListener); - this._dragListener.off("dragStart", this._dragStartListener); - this._dragListener = void 0; - } - } -} -class TabsContainer { - constructor(_layoutManager, _componentRemoveEvent, _componentFocusEvent, _componentDragStartEvent, _dropdownActiveChangedEvent) { - this._layoutManager = _layoutManager; - this._componentRemoveEvent = _componentRemoveEvent; - this._componentFocusEvent = _componentFocusEvent; - this._componentDragStartEvent = _componentDragStartEvent; - this._dropdownActiveChangedEvent = _dropdownActiveChangedEvent; - this._tabs = []; - this._lastVisibleTabIndex = -1; - this._dropdownActive = false; - this._element = document.createElement("section"); - this._element.classList.add("lm_tabs"); - this._dropdownElement = document.createElement("section"); - this._dropdownElement.classList.add("lm_tabdropdown_list"); - this._dropdownElement.style.display = "none"; - } - get tabs() { - return this._tabs; - } - get tabCount() { - return this._tabs.length; - } - get lastVisibleTabIndex() { - return this._lastVisibleTabIndex; - } - get element() { - return this._element; - } - get dropdownElement() { - return this._dropdownElement; - } - get dropdownActive() { - return this._dropdownActive; - } - destroy() { - for (let i = 0; i < this._tabs.length; i++) { - this._tabs[i].destroy(); - } - } - createTab(componentItem, index) { - for (let i = 0; i < this._tabs.length; i++) { - if (this._tabs[i].componentItem === componentItem) { - return; - } - } - const tab = new Tab(this._layoutManager, componentItem, (item) => this.handleTabCloseEvent(item), (item) => this.handleTabFocusEvent(item), (x, y, dragListener, item) => this.handleTabDragStartEvent(x, y, dragListener, item)); - if (this._tabs.length === 0) { - this._tabs.push(tab); - this._element.appendChild(tab.element); - } else { - if (index === void 0) { - index = this._tabs.length; - } - if (index > 0) { - this._tabs[index - 1].element.insertAdjacentElement("afterend", tab.element); - } else { - this._tabs[0].element.insertAdjacentElement("beforebegin", tab.element); - } - this._tabs.splice(index, 0, tab); - } - } - removeTab(componentItem) { - for (let i = 0; i < this._tabs.length; i++) { - if (this._tabs[i].componentItem === componentItem) { - const tab = this._tabs[i]; - tab.destroy(); - this._tabs.splice(i, 1); - return; - } - } - throw new Error("contentItem is not controlled by this header"); - } - processActiveComponentChanged(newActiveComponentItem) { - let activeIndex = -1; - for (let i = 0; i < this._tabs.length; i++) { - const isActive = this._tabs[i].componentItem === newActiveComponentItem; - this._tabs[i].setActive(isActive); - if (isActive) { - activeIndex = i; - } - } - if (activeIndex < 0) { - throw new AssertError("HSACI56632"); - } else { - if (this._layoutManager.layoutConfig.settings.reorderOnTabMenuClick) { - if (this._lastVisibleTabIndex !== -1 && activeIndex > this._lastVisibleTabIndex) { - const activeTab = this._tabs[activeIndex]; - for (let j = activeIndex; j > 0; j--) { - this._tabs[j] = this._tabs[j - 1]; - } - this._tabs[0] = activeTab; - } - } - } - } - updateTabSizes(availableWidth, activeComponentItem) { - let dropDownActive = false; - const success = this.tryUpdateTabSizes(dropDownActive, availableWidth, activeComponentItem); - if (!success) { - dropDownActive = true; - this.tryUpdateTabSizes(dropDownActive, availableWidth, activeComponentItem); - } - if (dropDownActive !== this._dropdownActive) { - this._dropdownActive = dropDownActive; - this._dropdownActiveChangedEvent(); - } - } - tryUpdateTabSizes(dropdownActive, availableWidth, activeComponentItem) { - if (this._tabs.length > 0) { - if (activeComponentItem === void 0) { - throw new Error("non-empty tabs must have active component item"); - } - let cumulativeTabWidth = 0; - let tabOverlapAllowanceExceeded = false; - const tabOverlapAllowance = this._layoutManager.layoutConfig.settings.tabOverlapAllowance; - const activeIndex = this._tabs.indexOf(activeComponentItem.tab); - const activeTab = this._tabs[activeIndex]; - this._lastVisibleTabIndex = -1; - for (let i = 0; i < this._tabs.length; i++) { - const tabElement = this._tabs[i].element; - if (tabElement.parentElement !== this._element) { - this._element.appendChild(tabElement); - } - const tabMarginRightPixels = getComputedStyle(activeTab.element).marginRight; - const tabMarginRight = pixelsToNumber(tabMarginRightPixels); - const tabWidth = tabElement.offsetWidth + tabMarginRight; - cumulativeTabWidth += tabWidth; - let visibleTabWidth = 0; - if (activeIndex <= i) { - visibleTabWidth = cumulativeTabWidth; - } else { - const activeTabMarginRightPixels = getComputedStyle(activeTab.element).marginRight; - const activeTabMarginRight = pixelsToNumber(activeTabMarginRightPixels); - visibleTabWidth = cumulativeTabWidth + activeTab.element.offsetWidth + activeTabMarginRight; - } - if (visibleTabWidth > availableWidth) { - if (!tabOverlapAllowanceExceeded) { - let overlap; - if (activeIndex > 0 && activeIndex <= i) { - overlap = (visibleTabWidth - availableWidth) / (i - 1); - } else { - overlap = (visibleTabWidth - availableWidth) / i; - } - if (overlap < tabOverlapAllowance) { - for (let j = 0; j <= i; j++) { - const marginLeft = j !== activeIndex && j !== 0 ? "-" + numberToPixels(overlap) : ""; - this._tabs[j].element.style.zIndex = numberToPixels(i - j); - this._tabs[j].element.style.marginLeft = marginLeft; - } - this._lastVisibleTabIndex = i; - if (tabElement.parentElement !== this._element) { - this._element.appendChild(tabElement); - } - } else { - tabOverlapAllowanceExceeded = true; - } - } else if (i === activeIndex) { - tabElement.style.zIndex = "auto"; - tabElement.style.marginLeft = ""; - if (tabElement.parentElement !== this._element) { - this._element.appendChild(tabElement); - } - } - if (tabOverlapAllowanceExceeded && i !== activeIndex) { - if (dropdownActive) { - tabElement.style.zIndex = "auto"; - tabElement.style.marginLeft = ""; - if (tabElement.parentElement !== this._dropdownElement) { - this._dropdownElement.appendChild(tabElement); - } - } else { - return false; - } - } - } else { - this._lastVisibleTabIndex = i; - tabElement.style.zIndex = "auto"; - tabElement.style.marginLeft = ""; - if (tabElement.parentElement !== this._element) { - this._element.appendChild(tabElement); - } - } - } - } - return true; - } - showAdditionalTabsDropdown() { - this._dropdownElement.style.display = ""; - } - hideAdditionalTabsDropdown() { - this._dropdownElement.style.display = "none"; - } - handleTabCloseEvent(componentItem) { - this._componentRemoveEvent(componentItem); - } - handleTabFocusEvent(componentItem) { - this._componentFocusEvent(componentItem); - } - handleTabDragStartEvent(x, y, dragListener, componentItem) { - this._componentDragStartEvent(x, y, dragListener, componentItem); - } -} -class Header extends EventEmitter { - constructor(_layoutManager, _parent, settings, _configClosable, _getActiveComponentItemEvent, closeEvent, _popoutEvent, _maximiseToggleEvent, _clickEvent, _touchStartEvent, _componentRemoveEvent, _componentFocusEvent, _componentDragStartEvent) { - super(); - this._layoutManager = _layoutManager; - this._parent = _parent; - this._configClosable = _configClosable; - this._getActiveComponentItemEvent = _getActiveComponentItemEvent; - this._popoutEvent = _popoutEvent; - this._maximiseToggleEvent = _maximiseToggleEvent; - this._clickEvent = _clickEvent; - this._touchStartEvent = _touchStartEvent; - this._componentRemoveEvent = _componentRemoveEvent; - this._componentFocusEvent = _componentFocusEvent; - this._componentDragStartEvent = _componentDragStartEvent; - this._clickListener = (ev) => this.onClick(ev); - this._touchStartListener = (ev) => this.onTouchStart(ev); - this._rowColumnClosable = true; - this._closeButton = null; - this._popoutButton = null; - this._tabsContainer = new TabsContainer(this._layoutManager, (item) => this.handleTabInitiatedComponentRemoveEvent(item), (item) => this.handleTabInitiatedComponentFocusEvent(item), (x, y, dragListener, item) => this.handleTabInitiatedDragStartEvent(x, y, dragListener, item), () => this.processTabDropdownActiveChanged()); - this._show = settings.show; - this._popoutEnabled = settings.popoutEnabled; - this._popoutLabel = settings.popoutLabel; - this._maximiseEnabled = settings.maximiseEnabled; - this._maximiseLabel = settings.maximiseLabel; - this._minimiseEnabled = settings.minimiseEnabled; - this._minimiseLabel = settings.minimiseLabel; - this._closeEnabled = settings.closeEnabled; - this._closeLabel = settings.closeLabel; - this._tabDropdownEnabled = settings.tabDropdownEnabled; - this._tabDropdownLabel = settings.tabDropdownLabel; - this.setSide(settings.side); - this._canRemoveComponent = this._configClosable; - this._element = document.createElement("section"); - this._element.classList.add("lm_header"); - this._controlsContainerElement = document.createElement("section"); - this._controlsContainerElement.classList.add("lm_controls"); - this._element.appendChild(this._tabsContainer.element); - this._element.appendChild(this._controlsContainerElement); - this._element.appendChild(this._tabsContainer.dropdownElement); - this._element.addEventListener("click", this._clickListener, {passive: true}); - this._element.addEventListener("touchstart", this._touchStartListener, {passive: true}); - this._documentMouseUpListener = () => this._tabsContainer.hideAdditionalTabsDropdown(); - globalThis.document.addEventListener("mouseup", this._documentMouseUpListener, {passive: true}); - this._tabControlOffset = this._layoutManager.layoutConfig.settings.tabControlOffset; - if (this._tabDropdownEnabled) { - this._tabDropdownButton = new HeaderButton(this, this._tabDropdownLabel, "lm_tabdropdown", () => this._tabsContainer.showAdditionalTabsDropdown()); - } - if (this._popoutEnabled) { - this._popoutButton = new HeaderButton(this, this._popoutLabel, "lm_popout", () => this.handleButtonPopoutEvent()); - } - if (this._maximiseEnabled) { - this._maximiseButton = new HeaderButton(this, this._maximiseLabel, "lm_maximise", (ev) => this.handleButtonMaximiseToggleEvent(ev)); - } - if (this._configClosable) { - this._closeButton = new HeaderButton(this, this._closeLabel, "lm_close", () => closeEvent()); - } - this.processTabDropdownActiveChanged(); - } - get show() { - return this._show; - } - get side() { - return this._side; - } - get leftRightSided() { - return this._leftRightSided; - } - get layoutManager() { - return this._layoutManager; - } - get parent() { - return this._parent; - } - get tabs() { - return this._tabsContainer.tabs; - } - get lastVisibleTabIndex() { - return this._tabsContainer.lastVisibleTabIndex; - } - get element() { - return this._element; - } - get tabsContainerElement() { - return this._tabsContainer.element; - } - get controlsContainerElement() { - return this._controlsContainerElement; - } - destroy() { - this.emit("destroy"); - this._popoutEvent = void 0; - this._maximiseToggleEvent = void 0; - this._clickEvent = void 0; - this._touchStartEvent = void 0; - this._componentRemoveEvent = void 0; - this._componentFocusEvent = void 0; - this._componentDragStartEvent = void 0; - this._tabsContainer.destroy(); - globalThis.document.removeEventListener("mouseup", this._documentMouseUpListener); - this._element.remove(); - } - createTab(componentItem, index) { - this._tabsContainer.createTab(componentItem, index); - } - removeTab(componentItem) { - this._tabsContainer.removeTab(componentItem); - } - processActiveComponentChanged(newActiveComponentItem) { - this._tabsContainer.processActiveComponentChanged(newActiveComponentItem); - this.updateTabSizes(); - } - setSide(value) { - this._side = value; - this._leftRightSided = [Side.right, Side.left].includes(this._side); - } - setRowColumnClosable(value) { - this._rowColumnClosable = value; - this.updateClosability(); - } - updateClosability() { - let isClosable; - if (!this._configClosable) { - isClosable = false; - } else { - if (!this._rowColumnClosable) { - isClosable = false; - } else { - isClosable = true; - const len = this.tabs.length; - for (let i = 0; i < len; i++) { - const tab = this._tabsContainer.tabs[i]; - const item = tab.componentItem; - if (!item.isClosable) { - isClosable = false; - break; - } - } - } - } - if (this._closeButton !== null) { - setElementDisplayVisibility(this._closeButton.element, isClosable); - } - if (this._popoutButton !== null) { - setElementDisplayVisibility(this._popoutButton.element, isClosable); - } - this._canRemoveComponent = isClosable || this._tabsContainer.tabCount > 1; - } - applyFocusedValue(value) { - if (value) { - this._element.classList.add("lm_focused"); - } else { - this._element.classList.remove("lm_focused"); - } - } - processMaximised() { - if (this._maximiseButton === void 0) { - throw new UnexpectedUndefinedError("HPMAX16997"); - } else { - this._maximiseButton.element.setAttribute("title", this._minimiseLabel); - } - } - processMinimised() { - if (this._maximiseButton === void 0) { - throw new UnexpectedUndefinedError("HPMIN16997"); - } else { - this._maximiseButton.element.setAttribute("title", this._maximiseLabel); - } - } - updateTabSizes() { - if (this._tabsContainer.tabCount > 0) { - const headerHeight = this._show ? this._layoutManager.layoutConfig.dimensions.headerHeight : 0; - if (this._leftRightSided) { - this._element.style.height = ""; - this._element.style.width = numberToPixels(headerHeight); - } else { - this._element.style.width = ""; - this._element.style.height = numberToPixels(headerHeight); - } - let availableWidth; - if (this._leftRightSided) { - availableWidth = this._element.offsetHeight - this._controlsContainerElement.offsetHeight - this._tabControlOffset; - } else { - availableWidth = this._element.offsetWidth - this._controlsContainerElement.offsetWidth - this._tabControlOffset; - } - this._tabsContainer.updateTabSizes(availableWidth, this._getActiveComponentItemEvent()); - } - } - handleTabInitiatedComponentRemoveEvent(componentItem) { - if (this._canRemoveComponent) { - if (this._componentRemoveEvent === void 0) { - throw new UnexpectedUndefinedError("HHTCE22294"); - } else { - this._componentRemoveEvent(componentItem); - } - } - } - handleTabInitiatedComponentFocusEvent(componentItem) { - if (this._componentFocusEvent === void 0) { - throw new UnexpectedUndefinedError("HHTAE22294"); - } else { - this._componentFocusEvent(componentItem); - } - } - handleTabInitiatedDragStartEvent(x, y, dragListener, componentItem) { - if (!this._canRemoveComponent) { - dragListener.cancelDrag(); - } else { - if (this._componentDragStartEvent === void 0) { - throw new UnexpectedUndefinedError("HHTDSE22294"); - } else { - this._componentDragStartEvent(x, y, dragListener, componentItem); - } - } - } - processTabDropdownActiveChanged() { - if (this._tabDropdownButton !== void 0) { - setElementDisplayVisibility(this._tabDropdownButton.element, this._tabsContainer.dropdownActive); - } - } - handleButtonPopoutEvent() { - if (this._layoutManager.layoutConfig.settings.popoutWholeStack) { - if (this._popoutEvent === void 0) { - throw new UnexpectedUndefinedError("HHBPOE17834"); - } else { - this._popoutEvent(); - } - } else { - const activeComponentItem = this._getActiveComponentItemEvent(); - if (activeComponentItem) { - activeComponentItem.popout(); - } - } - } - handleButtonMaximiseToggleEvent(ev) { - if (this._maximiseToggleEvent === void 0) { - throw new UnexpectedUndefinedError("HHBMTE16834"); - } else { - this._maximiseToggleEvent(); - } - } - onClick(event) { - if (event.target === this._element) { - this.notifyClick(event); - } - } - onTouchStart(event) { - if (event.target === this._element) { - this.notifyTouchStart(event); - } - } - notifyClick(ev) { - if (this._clickEvent === void 0) { - throw new UnexpectedUndefinedError("HNHC46834"); - } else { - this._clickEvent(ev); - } - } - notifyTouchStart(ev) { - if (this._touchStartEvent === void 0) { - throw new UnexpectedUndefinedError("HNHTS46834"); - } else { - this._touchStartEvent(ev); - } - } -} -class Stack extends ComponentParentableItem { - constructor(layoutManager, config, parent) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u; - super(layoutManager, config, parent, Stack.createElement(document)); - this._headerSideChanged = false; - this._resizeListener = () => this.handleResize(); - this._maximisedListener = () => this.handleMaximised(); - this._minimisedListener = () => this.handleMinimised(); - this._headerConfig = config.header; - const layoutHeaderConfig = layoutManager.layoutConfig.header; - const configContent = config.content; - let componentHeaderConfig; - if (configContent.length !== 1) { - componentHeaderConfig = void 0; - } else { - const firstChildItemConfig = configContent[0]; - componentHeaderConfig = firstChildItemConfig.header; - } - this._initialWantMaximise = config.maximised; - this._initialActiveItemIndex = (_a = config.activeItemIndex) !== null && _a !== void 0 ? _a : 0; - const show = (_d = (_c = (_b = this._headerConfig) === null || _b === void 0 ? void 0 : _b.show) !== null && _c !== void 0 ? _c : componentHeaderConfig === null || componentHeaderConfig === void 0 ? void 0 : componentHeaderConfig.show) !== null && _d !== void 0 ? _d : layoutHeaderConfig.show; - const popout = (_g = (_f = (_e = this._headerConfig) === null || _e === void 0 ? void 0 : _e.popout) !== null && _f !== void 0 ? _f : componentHeaderConfig === null || componentHeaderConfig === void 0 ? void 0 : componentHeaderConfig.popout) !== null && _g !== void 0 ? _g : layoutHeaderConfig.popout; - const maximise = (_k = (_j = (_h = this._headerConfig) === null || _h === void 0 ? void 0 : _h.maximise) !== null && _j !== void 0 ? _j : componentHeaderConfig === null || componentHeaderConfig === void 0 ? void 0 : componentHeaderConfig.maximise) !== null && _k !== void 0 ? _k : layoutHeaderConfig.maximise; - const close = (_o = (_m = (_l = this._headerConfig) === null || _l === void 0 ? void 0 : _l.close) !== null && _m !== void 0 ? _m : componentHeaderConfig === null || componentHeaderConfig === void 0 ? void 0 : componentHeaderConfig.close) !== null && _o !== void 0 ? _o : layoutHeaderConfig.close; - const minimise = (_r = (_q = (_p = this._headerConfig) === null || _p === void 0 ? void 0 : _p.minimise) !== null && _q !== void 0 ? _q : componentHeaderConfig === null || componentHeaderConfig === void 0 ? void 0 : componentHeaderConfig.minimise) !== null && _r !== void 0 ? _r : layoutHeaderConfig.minimise; - const tabDropdown = (_u = (_t = (_s = this._headerConfig) === null || _s === void 0 ? void 0 : _s.tabDropdown) !== null && _t !== void 0 ? _t : componentHeaderConfig === null || componentHeaderConfig === void 0 ? void 0 : componentHeaderConfig.tabDropdown) !== null && _u !== void 0 ? _u : layoutHeaderConfig.tabDropdown; - this._maximisedEnabled = maximise !== false; - const headerSettings = { - show: show !== false, - side: show === false ? Side.top : show, - popoutEnabled: popout !== false, - popoutLabel: popout === false ? "" : popout, - maximiseEnabled: this._maximisedEnabled, - maximiseLabel: maximise === false ? "" : maximise, - closeEnabled: close !== false, - closeLabel: close === false ? "" : close, - minimiseEnabled: true, - minimiseLabel: minimise, - tabDropdownEnabled: tabDropdown !== false, - tabDropdownLabel: tabDropdown === false ? "" : tabDropdown - }; - this._header = new Header(layoutManager, this, headerSettings, config.isClosable && close !== false, () => this.getActiveComponentItem(), () => this.remove(), () => this.handlePopoutEvent(), () => this.toggleMaximise(), (ev) => this.handleHeaderClickEvent(ev), (ev) => this.handleHeaderTouchStartEvent(ev), (item) => this.handleHeaderComponentRemoveEvent(item), (item) => this.handleHeaderComponentFocusEvent(item), (x, y, dragListener, item) => this.handleHeaderComponentStartDragEvent(x, y, dragListener, item)); - this.isStack = true; - this._childElementContainer = document.createElement("section"); - this._childElementContainer.classList.add("lm_items"); - this.on("resize", this._resizeListener); - if (this._maximisedEnabled) { - this.on("maximised", this._maximisedListener); - this.on("minimised", this._minimisedListener); - } - this.element.appendChild(this._header.element); - this.element.appendChild(this._childElementContainer); - this.setupHeaderPosition(); - this._header.updateClosability(); - } - get childElementContainer() { - return this._childElementContainer; - } - get header() { - return this._header; - } - get headerShow() { - return this._header.show; - } - get headerSide() { - return this._header.side; - } - get headerLeftRightSided() { - return this._header.leftRightSided; - } - get contentAreaDimensions() { - return this._contentAreaDimensions; - } - get initialWantMaximise() { - return this._initialWantMaximise; - } - get isMaximised() { - return this === this.layoutManager.maximisedStack; - } - get stackParent() { - if (!this.parent) { - throw new Error("Stack should always have a parent"); - } - return this.parent; - } - updateSize() { - this.layoutManager.beginVirtualSizedContainerAdding(); - try { - this.updateNodeSize(); - this.updateContentItemsSize(); - } finally { - this.layoutManager.endVirtualSizedContainerAdding(); - } - } - init() { - if (this.isInitialised === true) - return; - this.updateNodeSize(); - for (let i = 0; i < this.contentItems.length; i++) { - this._childElementContainer.appendChild(this.contentItems[i].element); - } - super.init(); - const contentItems = this.contentItems; - const contentItemCount = contentItems.length; - if (contentItemCount > 0) { - if (this._initialActiveItemIndex < 0 || this._initialActiveItemIndex >= contentItemCount) { - throw new Error(`ActiveItemIndex out of range: ${this._initialActiveItemIndex} id: ${this.id}`); - } else { - for (let i = 0; i < contentItemCount; i++) { - const contentItem = contentItems[i]; - if (!(contentItem instanceof ComponentItem)) { - throw new Error(`Stack Content Item is not of type ComponentItem: ${i} id: ${this.id}`); - } else { - this._header.createTab(contentItem, i); - contentItem.hide(); - } - } - this.setActiveComponentItem(contentItems[this._initialActiveItemIndex], false); - this._header.updateTabSizes(); - } - } - this._header.updateClosability(); - this.initContentItems(); - } - setActiveContentItem(item) { - if (!ContentItem.isComponentItem(item)) { - throw new Error("Stack.setActiveContentItem: item is not a ComponentItem"); - } else { - this.setActiveComponentItem(item, false); - } - } - setActiveComponentItem(componentItem, focus, suppressFocusEvent = false) { - if (this._activeComponentItem !== componentItem) { - if (this.contentItems.indexOf(componentItem) === -1) { - throw new Error("componentItem is not a child of this stack"); - } else { - if (this._activeComponentItem !== void 0) { - this._activeComponentItem.hide(); - } - this._activeComponentItem = componentItem; - this._header.processActiveComponentChanged(componentItem); - componentItem.show(); - this.emit("activeContentItemChanged", componentItem); - this.layoutManager.emit("activeContentItemChanged", componentItem); - this.emitStateChangedEvent(); - } - } - if (this.focused || focus) { - this.layoutManager.setFocusedComponentItem(componentItem, suppressFocusEvent); - } - } - getActiveContentItem() { - var _a; - return (_a = this.getActiveComponentItem()) !== null && _a !== void 0 ? _a : null; - } - getActiveComponentItem() { - return this._activeComponentItem; - } - focusActiveContentItem() { - var _a; - (_a = this._activeComponentItem) === null || _a === void 0 ? void 0 : _a.focus(); - } - setFocusedValue(value) { - this._header.applyFocusedValue(value); - super.setFocusedValue(value); - } - setRowColumnClosable(value) { - this._header.setRowColumnClosable(value); - } - newComponent(componentType, componentState, title, index) { - const itemConfig = { - type: "component", - componentType, - componentState, - title - }; - return this.newItem(itemConfig, index); - } - addComponent(componentType, componentState, title, index) { - const itemConfig = { - type: "component", - componentType, - componentState, - title - }; - return this.addItem(itemConfig, index); - } - newItem(itemConfig, index) { - index = this.addItem(itemConfig, index); - return this.contentItems[index]; - } - addItem(itemConfig, index) { - this.layoutManager.checkMinimiseMaximisedStack(); - const resolvedItemConfig = ItemConfig.resolve(itemConfig); - const contentItem = this.layoutManager.createAndInitContentItem(resolvedItemConfig, this); - return this.addChild(contentItem, index); - } - addChild(contentItem, index, focus = false) { - if (index !== void 0 && index > this.contentItems.length) { - index -= 1; - throw new AssertError("SAC99728"); - } - if (!(contentItem instanceof ComponentItem)) { - throw new AssertError("SACC88532"); - } else { - index = super.addChild(contentItem, index); - this._childElementContainer.appendChild(contentItem.element); - this._header.createTab(contentItem, index); - this.setActiveComponentItem(contentItem, focus); - this._header.updateTabSizes(); - this.updateSize(); - this._header.updateClosability(); - this.emitStateChangedEvent(); - return index; - } - } - removeChild(contentItem, keepChild) { - const componentItem = contentItem; - const index = this.contentItems.indexOf(componentItem); - const stackWillBeDeleted = this.contentItems.length === 1; - if (this._activeComponentItem === componentItem) { - if (componentItem.focused) { - componentItem.blur(); - } - if (!stackWillBeDeleted) { - const newActiveComponentIdx = index === 0 ? 1 : index - 1; - this.setActiveComponentItem(this.contentItems[newActiveComponentIdx], false); - } - } - this._header.removeTab(componentItem); - super.removeChild(componentItem, keepChild); - if (!stackWillBeDeleted) { - this._header.updateClosability(); - } - this.emitStateChangedEvent(); - } - toggleMaximise() { - if (this.isMaximised) { - this.minimise(); - } else { - this.maximise(); - } - } - maximise() { - if (!this.isMaximised) { - this.layoutManager.setMaximisedStack(this); - const contentItems = this.contentItems; - const contentItemCount = contentItems.length; - for (let i = 0; i < contentItemCount; i++) { - const contentItem = contentItems[i]; - if (contentItem instanceof ComponentItem) { - contentItem.enterStackMaximised(); - } else { - throw new AssertError("SMAXI87773"); - } - } - this.emitStateChangedEvent(); - } - } - minimise() { - if (this.isMaximised) { - this.layoutManager.setMaximisedStack(void 0); - const contentItems = this.contentItems; - const contentItemCount = contentItems.length; - for (let i = 0; i < contentItemCount; i++) { - const contentItem = contentItems[i]; - if (contentItem instanceof ComponentItem) { - contentItem.exitStackMaximised(); - } else { - throw new AssertError("SMINI87773"); - } - } - this.emitStateChangedEvent(); - } - } - destroy() { - var _a; - if ((_a = this._activeComponentItem) === null || _a === void 0 ? void 0 : _a.focused) { - this._activeComponentItem.blur(); - } - super.destroy(); - this.off("resize", this._resizeListener); - if (this._maximisedEnabled) { - this.off("maximised", this._maximisedListener); - this.off("minimised", this._minimisedListener); - } - this._header.destroy(); - } - toConfig() { - let activeItemIndex; - if (this._activeComponentItem) { - activeItemIndex = this.contentItems.indexOf(this._activeComponentItem); - if (activeItemIndex < 0) { - throw new Error("active component item not found in stack"); - } - } - if (this.contentItems.length > 0 && activeItemIndex === void 0) { - throw new Error("expected non-empty stack to have an active component item"); - } else { - const result = { - type: "stack", - content: this.calculateConfigContent(), - width: this.width, - minWidth: this.minWidth, - height: this.height, - minHeight: this.minHeight, - id: this.id, - isClosable: this.isClosable, - maximised: this.isMaximised, - header: this.createHeaderConfig(), - activeItemIndex - }; - return result; - } - } - onDrop(contentItem, area) { - if (this._dropSegment === "header") { - this.resetHeaderDropZone(); - if (this._dropIndex === void 0) { - throw new UnexpectedUndefinedError("SODDI68990"); - } else { - this.addChild(contentItem, this._dropIndex); - return; - } - } - if (this._dropSegment === "body") { - this.addChild(contentItem, 0, true); - return; - } - const isVertical = this._dropSegment === "top" || this._dropSegment === "bottom"; - const isHorizontal = this._dropSegment === "left" || this._dropSegment === "right"; - const insertBefore = this._dropSegment === "top" || this._dropSegment === "left"; - const hasCorrectParent = isVertical && this.stackParent.isColumn || isHorizontal && this.stackParent.isRow; - const dimension = isVertical ? "height" : "width"; - if (contentItem.isComponent) { - const itemConfig = ResolvedStackItemConfig.createDefault(); - itemConfig.header = this.createHeaderConfig(); - const stack = this.layoutManager.createAndInitContentItem(itemConfig, this); - stack.addChild(contentItem); - contentItem = stack; - } - if (contentItem.type === ItemType.row || contentItem.type === ItemType.column) { - const itemConfig = ResolvedStackItemConfig.createDefault(); - itemConfig.header = this.createHeaderConfig(); - const stack = this.layoutManager.createContentItem(itemConfig, this); - stack.addChild(contentItem); - contentItem = stack; - } - if (hasCorrectParent) { - const index = this.stackParent.contentItems.indexOf(this); - this.stackParent.addChild(contentItem, insertBefore ? index : index + 1, true); - this[dimension] *= 0.5; - contentItem[dimension] = this[dimension]; - this.stackParent.updateSize(); - } else { - const type = isVertical ? ItemType.column : ItemType.row; - const itemConfig = ResolvedItemConfig.createDefault(type); - const rowOrColumn = this.layoutManager.createContentItem(itemConfig, this); - this.stackParent.replaceChild(this, rowOrColumn); - rowOrColumn.addChild(contentItem, insertBefore ? 0 : void 0, true); - rowOrColumn.addChild(this, insertBefore ? void 0 : 0, true); - this[dimension] = 50; - contentItem[dimension] = 50; - rowOrColumn.updateSize(); - } - } - highlightDropZone(x, y) { - for (const key in this._contentAreaDimensions) { - const segment = key; - const area = this._contentAreaDimensions[segment].hoverArea; - if (area.x1 < x && area.x2 > x && area.y1 < y && area.y2 > y) { - if (segment === "header") { - this._dropSegment = "header"; - this.highlightHeaderDropZone(this._header.leftRightSided ? y : x); - } else { - this.resetHeaderDropZone(); - this.highlightBodyDropZone(segment); - } - return; - } - } - } - getArea() { - if (this.element.style.display === "none") { - return null; - } - const headerArea = super.getElementArea(this._header.element); - const contentArea = super.getElementArea(this._childElementContainer); - if (headerArea === null || contentArea === null) { - throw new UnexpectedNullError("SGAHC13086"); - } - const contentWidth = contentArea.x2 - contentArea.x1; - const contentHeight = contentArea.y2 - contentArea.y1; - this._contentAreaDimensions = { - header: { - hoverArea: { - x1: headerArea.x1, - y1: headerArea.y1, - x2: headerArea.x2, - y2: headerArea.y2 - }, - highlightArea: { - x1: headerArea.x1, - y1: headerArea.y1, - x2: headerArea.x2, - y2: headerArea.y2 - } - } - }; - if (this.contentItems.length === 0) { - this._contentAreaDimensions.body = { - hoverArea: { - x1: contentArea.x1, - y1: contentArea.y1, - x2: contentArea.x2, - y2: contentArea.y2 - }, - highlightArea: { - x1: contentArea.x1, - y1: contentArea.y1, - x2: contentArea.x2, - y2: contentArea.y2 - } - }; - return super.getElementArea(this.element); - } else { - this._contentAreaDimensions.left = { - hoverArea: { - x1: contentArea.x1, - y1: contentArea.y1, - x2: contentArea.x1 + contentWidth * 0.25, - y2: contentArea.y2 - }, - highlightArea: { - x1: contentArea.x1, - y1: contentArea.y1, - x2: contentArea.x1 + contentWidth * 0.5, - y2: contentArea.y2 - } - }; - this._contentAreaDimensions.top = { - hoverArea: { - x1: contentArea.x1 + contentWidth * 0.25, - y1: contentArea.y1, - x2: contentArea.x1 + contentWidth * 0.75, - y2: contentArea.y1 + contentHeight * 0.5 - }, - highlightArea: { - x1: contentArea.x1, - y1: contentArea.y1, - x2: contentArea.x2, - y2: contentArea.y1 + contentHeight * 0.5 - } - }; - this._contentAreaDimensions.right = { - hoverArea: { - x1: contentArea.x1 + contentWidth * 0.75, - y1: contentArea.y1, - x2: contentArea.x2, - y2: contentArea.y2 - }, - highlightArea: { - x1: contentArea.x1 + contentWidth * 0.5, - y1: contentArea.y1, - x2: contentArea.x2, - y2: contentArea.y2 - } - }; - this._contentAreaDimensions.bottom = { - hoverArea: { - x1: contentArea.x1 + contentWidth * 0.25, - y1: contentArea.y1 + contentHeight * 0.5, - x2: contentArea.x1 + contentWidth * 0.75, - y2: contentArea.y2 - }, - highlightArea: { - x1: contentArea.x1, - y1: contentArea.y1 + contentHeight * 0.5, - x2: contentArea.x2, - y2: contentArea.y2 - } - }; - return super.getElementArea(this.element); - } - } - positionHeader(position) { - if (this._header.side !== position) { - this._header.setSide(position); - this._headerSideChanged = true; - this.setupHeaderPosition(); - } - } - updateNodeSize() { - if (this.element.style.display !== "none") { - const content = getElementWidthAndHeight(this.element); - if (this._header.show) { - const dimension = this._header.leftRightSided ? WidthOrHeightPropertyName.width : WidthOrHeightPropertyName.height; - content[dimension] -= this.layoutManager.layoutConfig.dimensions.headerHeight; - } - this._childElementContainer.style.width = numberToPixels(content.width); - this._childElementContainer.style.height = numberToPixels(content.height); - for (let i = 0; i < this.contentItems.length; i++) { - this.contentItems[i].element.style.width = numberToPixels(content.width); - this.contentItems[i].element.style.height = numberToPixels(content.height); - } - this.emit("resize"); - this.emitStateChangedEvent(); - } - } - highlightHeaderDropZone(x) { - const tabsLength = this._header.lastVisibleTabIndex + 1; - const dropTargetIndicator = this.layoutManager.dropTargetIndicator; - if (dropTargetIndicator === null) { - throw new UnexpectedNullError("SHHDZDTI97110"); - } - let area; - if (tabsLength === 0) { - const headerOffset = getJQueryOffset(this._header.element); - const elementHeight = getElementHeight(this._header.element); - area = { - x1: headerOffset.left, - x2: headerOffset.left + 100, - y1: headerOffset.top + elementHeight - 20, - y2: headerOffset.top + elementHeight - }; - } else { - let tabIndex = 0; - let isAboveTab = false; - let tabTop; - let tabLeft; - let tabWidth; - let tabElement; - do { - tabElement = this._header.tabs[tabIndex].element; - const offset = getJQueryOffset(tabElement); - if (this._header.leftRightSided) { - tabLeft = offset.top; - tabTop = offset.left; - tabWidth = getElementHeight(tabElement); - } else { - tabLeft = offset.left; - tabTop = offset.top; - tabWidth = getElementWidth(tabElement); - } - if (x >= tabLeft && x < tabLeft + tabWidth) { - isAboveTab = true; - } else { - tabIndex++; - } - } while (tabIndex < tabsLength && !isAboveTab); - if (isAboveTab === false && x < tabLeft) { - return; - } - const halfX = tabLeft + tabWidth / 2; - if (x < halfX) { - this._dropIndex = tabIndex; - tabElement.insertAdjacentElement("beforebegin", this.layoutManager.tabDropPlaceholder); - } else { - this._dropIndex = Math.min(tabIndex + 1, tabsLength); - tabElement.insertAdjacentElement("afterend", this.layoutManager.tabDropPlaceholder); - } - const tabDropPlaceholderOffset = getJQueryOffset(this.layoutManager.tabDropPlaceholder); - const tabDropPlaceholderWidth = getElementWidth(this.layoutManager.tabDropPlaceholder); - if (this._header.leftRightSided) { - const placeHolderTop = tabDropPlaceholderOffset.top; - area = { - x1: tabTop, - x2: tabTop + tabElement.clientHeight, - y1: placeHolderTop, - y2: placeHolderTop + tabDropPlaceholderWidth - }; - } else { - const placeHolderLeft = tabDropPlaceholderOffset.left; - area = { - x1: placeHolderLeft, - x2: placeHolderLeft + tabDropPlaceholderWidth, - y1: tabTop, - y2: tabTop + tabElement.clientHeight - }; - } - } - dropTargetIndicator.highlightArea(area); - return; - } - resetHeaderDropZone() { - this.layoutManager.tabDropPlaceholder.remove(); - } - setupHeaderPosition() { - setElementDisplayVisibility(this._header.element, this._header.show); - this.element.classList.remove("lm_left", "lm_right", "lm_bottom"); - if (this._header.leftRightSided) { - this.element.classList.add("lm_" + this._header.side); - } - this.updateSize(); - } - highlightBodyDropZone(segment) { - if (this._contentAreaDimensions === void 0) { - throw new UnexpectedUndefinedError("SHBDZC82265"); - } else { - const highlightArea = this._contentAreaDimensions[segment].highlightArea; - const dropTargetIndicator = this.layoutManager.dropTargetIndicator; - if (dropTargetIndicator === null) { - throw new UnexpectedNullError("SHBDZD96110"); - } else { - dropTargetIndicator.highlightArea(highlightArea); - this._dropSegment = segment; - } - } - } - handleResize() { - this._header.updateTabSizes(); - } - handleMaximised() { - this._header.processMaximised(); - } - handleMinimised() { - this._header.processMinimised(); - } - handlePopoutEvent() { - this.popout(); - } - handleHeaderClickEvent(ev) { - const eventName = EventEmitter.headerClickEventName; - const bubblingEvent = new EventEmitter.ClickBubblingEvent(eventName, this, ev); - this.emit(eventName, bubblingEvent); - } - handleHeaderTouchStartEvent(ev) { - const eventName = EventEmitter.headerTouchStartEventName; - const bubblingEvent = new EventEmitter.TouchStartBubblingEvent(eventName, this, ev); - this.emit(eventName, bubblingEvent); - } - handleHeaderComponentRemoveEvent(item) { - this.removeChild(item, false); - } - handleHeaderComponentFocusEvent(item) { - this.setActiveComponentItem(item, true); - } - handleHeaderComponentStartDragEvent(x, y, dragListener, componentItem) { - if (this.isMaximised === true) { - this.toggleMaximise(); - } - this.layoutManager.startComponentDrag(x, y, dragListener, componentItem, this); - } - createHeaderConfig() { - if (!this._headerSideChanged) { - return ResolvedHeaderedItemConfig.Header.createCopy(this._headerConfig); - } else { - const show = this._header.show ? this._header.side : false; - let result = ResolvedHeaderedItemConfig.Header.createCopy(this._headerConfig, show); - if (result === void 0) { - result = { - show, - popout: void 0, - maximise: void 0, - close: void 0, - minimise: void 0, - tabDropdown: void 0 - }; - } - return result; - } - } - emitStateChangedEvent() { - this.emitBaseBubblingEvent("stateChanged"); - } -} -(function(Stack2) { - function createElement(document2) { - const element = document2.createElement("div"); - element.classList.add("lm_item"); - element.classList.add("lm_stack"); - return element; - } - Stack2.createElement = createElement; -})(Stack || (Stack = {})); -class DragProxy extends EventEmitter { - constructor(x, y, _dragListener, _layoutManager, _componentItem, _originalParent) { - super(); - this._dragListener = _dragListener; - this._layoutManager = _layoutManager; - this._componentItem = _componentItem; - this._originalParent = _originalParent; - this._area = null; - this._lastValidArea = null; - this._dragListener.on("drag", (offsetX, offsetY, event) => this.onDrag(offsetX, offsetY, event)); - this._dragListener.on("dragStop", () => this.onDrop()); - this.createDragProxyElements(x, y); - if (this._componentItem.parent === null) { - throw new UnexpectedNullError("DPC10097"); - } - this._componentItemFocused = this._componentItem.focused; - if (this._componentItemFocused) { - this._componentItem.blur(); - } - this._componentItem.parent.removeChild(this._componentItem, true); - this.setDimensions(); - document.body.appendChild(this._element); - this.determineMinMaxXY(); - if (this._layoutManager.layoutConfig.settings.constrainDragToContainer) { - const constrainedPosition = this.getXYWithinMinMax(x, y); - x = constrainedPosition.x; - y = constrainedPosition.y; - } - this._layoutManager.calculateItemAreas(); - this.setDropPosition(x, y); - } - get element() { - return this._element; - } - createDragProxyElements(initialX, initialY) { - this._element = document.createElement("div"); - this._element.classList.add("lm_dragProxy"); - const headerElement = document.createElement("div"); - headerElement.classList.add("lm_header"); - const tabsElement = document.createElement("div"); - tabsElement.classList.add("lm_tabs"); - const tabElement = document.createElement("div"); - tabElement.classList.add("lm_tab"); - const titleElement = document.createElement("span"); - titleElement.classList.add("lm_title"); - tabElement.appendChild(titleElement); - tabsElement.appendChild(tabElement); - headerElement.appendChild(tabsElement); - this._proxyContainerElement = document.createElement("div"); - this._proxyContainerElement.classList.add("lm_content"); - this._element.appendChild(headerElement); - this._element.appendChild(this._proxyContainerElement); - if (this._originalParent instanceof Stack && this._originalParent.headerShow) { - this._sided = this._originalParent.headerLeftRightSided; - this._element.classList.add("lm_" + this._originalParent.headerSide); - if ([Side.right, Side.bottom].indexOf(this._originalParent.headerSide) >= 0) { - this._proxyContainerElement.insertAdjacentElement("afterend", headerElement); - } - } - this._element.style.left = numberToPixels(initialX); - this._element.style.top = numberToPixels(initialY); - tabElement.setAttribute("title", this._componentItem.title); - titleElement.insertAdjacentText("afterbegin", this._componentItem.title); - this._proxyContainerElement.appendChild(this._componentItem.element); - } - determineMinMaxXY() { - const offset = getJQueryOffset(this._layoutManager.container); - this._minX = offset.left; - this._minY = offset.top; - const {width: containerWidth, height: containerHeight} = getElementWidthAndHeight(this._layoutManager.container); - this._maxX = containerWidth + this._minX; - this._maxY = containerHeight + this._minY; - } - getXYWithinMinMax(x, y) { - if (x <= this._minX) { - x = Math.ceil(this._minX + 1); - } else if (x >= this._maxX) { - x = Math.floor(this._maxX - 1); - } - if (y <= this._minY) { - y = Math.ceil(this._minY + 1); - } else if (y >= this._maxY) { - y = Math.floor(this._maxY - 1); - } - return {x, y}; - } - onDrag(offsetX, offsetY, event) { - const x = event.pageX; - const y = event.pageY; - if (!this._layoutManager.layoutConfig.settings.constrainDragToContainer) { - this.setDropPosition(x, y); - } else { - const isWithinContainer = x > this._minX && x < this._maxX && y > this._minY && y < this._maxY; - if (isWithinContainer) { - this.setDropPosition(x, y); - } - } - this._componentItem.drag(); - } - setDropPosition(x, y) { - this._element.style.left = numberToPixels(x); - this._element.style.top = numberToPixels(y); - this._area = this._layoutManager.getArea(x, y); - if (this._area !== null) { - this._lastValidArea = this._area; - this._area.contentItem.highlightDropZone(x, y, this._area); - } - } - onDrop() { - const dropTargetIndicator = this._layoutManager.dropTargetIndicator; - if (dropTargetIndicator === null) { - throw new UnexpectedNullError("DPOD30011"); - } else { - dropTargetIndicator.hide(); - } - this._componentItem.exitDragMode(); - let droppedComponentItem; - if (this._area !== null) { - droppedComponentItem = this._componentItem; - this._area.contentItem.onDrop(droppedComponentItem, this._area); - } else if (this._lastValidArea !== null) { - droppedComponentItem = this._componentItem; - const newParentContentItem = this._lastValidArea.contentItem; - newParentContentItem.onDrop(droppedComponentItem, this._lastValidArea); - } else if (this._originalParent) { - droppedComponentItem = this._componentItem; - this._originalParent.addChild(droppedComponentItem); - } else { - this._componentItem.destroy(); - } - this._element.remove(); - this._layoutManager.emit("itemDropped", this._componentItem); - if (this._componentItemFocused && droppedComponentItem !== void 0) { - droppedComponentItem.focus(); - } - } - setDimensions() { - const dimensions = this._layoutManager.layoutConfig.dimensions; - if (dimensions === void 0) { - throw new Error("DragProxy.setDimensions: dimensions undefined"); - } - let width = dimensions.dragProxyWidth; - let height = dimensions.dragProxyHeight; - if (width === void 0 || height === void 0) { - throw new Error("DragProxy.setDimensions: width and/or height undefined"); - } - const headerHeight = this._layoutManager.layoutConfig.header.show === false ? 0 : dimensions.headerHeight; - this._element.style.width = numberToPixels(width); - this._element.style.height = numberToPixels(height); - width -= this._sided ? headerHeight : 0; - height -= !this._sided ? headerHeight : 0; - this._proxyContainerElement.style.width = numberToPixels(width); - this._proxyContainerElement.style.height = numberToPixels(height); - this._componentItem.enterDragMode(width, height); - this._componentItem.show(); - } -} -class DragSource { - constructor(_layoutManager, _element, _extraAllowableChildTargets, _componentTypeOrFtn, _componentState, _title) { - this._layoutManager = _layoutManager; - this._element = _element; - this._extraAllowableChildTargets = _extraAllowableChildTargets; - this._componentTypeOrFtn = _componentTypeOrFtn; - this._componentState = _componentState; - this._title = _title; - this._dragListener = null; - this._dummyGroundContainer = document.createElement("div"); - const dummyRootItemConfig = ResolvedRowOrColumnItemConfig.createDefault("row"); - this._dummyGroundContentItem = new GroundItem(this._layoutManager, dummyRootItemConfig, this._dummyGroundContainer); - this.createDragListener(); - } - destroy() { - this.removeDragListener(); - } - createDragListener() { - this.removeDragListener(); - this._dragListener = new DragListener(this._element, this._extraAllowableChildTargets); - this._dragListener.on("dragStart", (x, y) => this.onDragStart(x, y)); - this._dragListener.on("dragStop", () => this.onDragStop()); - } - onDragStart(x, y) { - let componentType; - let componentState; - let title; - if (typeof this._componentTypeOrFtn === "function") { - const dragSourceItemConfig = this._componentTypeOrFtn(); - componentType = dragSourceItemConfig.type; - componentState = dragSourceItemConfig.state; - title = dragSourceItemConfig.title; - } else { - componentType = this._componentTypeOrFtn; - componentState = this._componentState; - title = this._title; - } - const itemConfig = { - type: "component", - componentType, - componentState, - title - }; - const resolvedItemConfig = ComponentItemConfig.resolve(itemConfig); - const componentItem = new ComponentItem(this._layoutManager, resolvedItemConfig, this._dummyGroundContentItem); - this._dummyGroundContentItem.contentItems.push(componentItem); - if (this._dragListener === null) { - throw new UnexpectedNullError("DSODSD66746"); - } else { - const dragProxy = new DragProxy(x, y, this._dragListener, this._layoutManager, componentItem, this._dummyGroundContentItem); - const transitionIndicator = this._layoutManager.transitionIndicator; - if (transitionIndicator === null) { - throw new UnexpectedNullError("DSODST66746"); - } else { - transitionIndicator.transitionElements(this._element, dragProxy.element); - } - } - } - onDragStop() { - this.createDragListener(); - } - removeDragListener() { - if (this._dragListener !== null) { - this._dragListener.destroy(); - this._dragListener = null; - } - } -} -var I18nStrings; -(function(I18nStrings2) { - let initialised = false; - const infosObject = { - PopoutCannotBeCreatedWithGroundItemConfig: { - id: 0, - default: "Popout cannot be created with ground ItemConfig" - }, - PleaseRegisterAConstructorFunction: { - id: 1, - default: "Please register a constructor function" - }, - ComponentTypeNotRegisteredAndBindComponentEventHandlerNotAssigned: { - id: 2, - default: "Component type not registered and BindComponentEvent handler not assigned" - }, - ComponentIsAlreadyRegistered: { - id: 3, - default: "Component is already registered" - }, - ComponentIsNotVirtuable: { - id: 4, - default: "Component is not virtuable. Requires rootHtmlElement field/getter" - }, - VirtualComponentDoesNotHaveRootHtmlElement: { - id: 5, - default: 'Virtual component does not have getter "rootHtmlElement"' - }, - ItemConfigIsNotTypeComponent: { - id: 6, - default: "ItemConfig is not of type component" - } - }; - I18nStrings2.idCount = Object.keys(infosObject).length; - const infos = Object.values(infosObject); - function checkInitialise() { - if (!initialised) { - for (let i = 0; i < I18nStrings2.idCount; i++) { - const info = infos[i]; - if (info.id !== i) { - throw new AssertError("INSI00110", `${i}: ${info.id}`); - } else { - i18nStrings[i] = info.default; - } - } - } - initialised = true; - } - I18nStrings2.checkInitialise = checkInitialise; -})(I18nStrings || (I18nStrings = {})); -const i18nStrings = new Array(I18nStrings.idCount); -class DropTargetIndicator { - constructor() { - this._element = document.createElement("div"); - this._element.classList.add("lm_dropTargetIndicator"); - const innerElement = document.createElement("div"); - innerElement.classList.add("lm_inner"); - this._element.appendChild(innerElement); - document.body.appendChild(this._element); - } - destroy() { - this._element.remove(); - } - highlightArea(area) { - this._element.style.left = numberToPixels(area.x1); - this._element.style.top = numberToPixels(area.y1); - this._element.style.width = numberToPixels(area.x2 - area.x1); - this._element.style.height = numberToPixels(area.y2 - area.y1); - this._element.style.display = "block"; - } - hide() { - setElementDisplayVisibility(this._element, false); - } -} -class TransitionIndicator { - constructor() { - this._element = document.createElement("div"); - this._element.classList.add("lm_transition_indicator"); - document.body.appendChild(this._element); - this._toElement = null; - this._fromDimensions = null; - this._totalAnimationDuration = 200; - this._animationStartTime = null; - } - destroy() { - this._element.remove(); - } - transitionElements(fromElement, toElement) { - return; - } - nextAnimationFrame() { - } - measure(element) { - const rect = element.getBoundingClientRect(); - return { - left: rect.left, - top: rect.top, - width: element.offsetWidth, - height: element.offsetHeight - }; - } -} -class EventHub extends EventEmitter { - constructor(_layoutManager) { - super(); - this._layoutManager = _layoutManager; - this._childEventListener = (childEvent) => this.onEventFromChild(childEvent); - globalThis.addEventListener(EventHub.ChildEventName, this._childEventListener, {passive: true}); - } - emit(eventName, ...args) { - if (eventName === "userBroadcast") { - this.emitUserBroadcast(...args); - } else { - super.emit(eventName, ...args); - } - } - emitUserBroadcast(...args) { - this.handleUserBroadcastEvent("userBroadcast", args); - } - destroy() { - globalThis.removeEventListener(EventHub.ChildEventName, this._childEventListener); - } - handleUserBroadcastEvent(eventName, args) { - if (this._layoutManager.isSubWindow) { - this.propagateToParent(eventName, args); - } else { - this.propagateToThisAndSubtree(eventName, args); - } - } - onEventFromChild(event) { - const detail = event.detail; - this.handleUserBroadcastEvent(detail.eventName, detail.args); - } - propagateToParent(eventName, args) { - const detail = { - layoutManager: this._layoutManager, - eventName, - args - }; - const eventInit = { - bubbles: true, - cancelable: true, - detail - }; - const event = new CustomEvent(EventHub.ChildEventName, eventInit); - const opener = globalThis.opener; - if (opener === null) { - throw new UnexpectedNullError("EHPTP15778"); - } - opener.dispatchEvent(event); - } - propagateToThisAndSubtree(eventName, args) { - this.emitUnknown(eventName, ...args); - for (let i = 0; i < this._layoutManager.openPopouts.length; i++) { - const childGl = this._layoutManager.openPopouts[i].getGlInstance(); - if (childGl) { - childGl.eventHub.propagateToThisAndSubtree(eventName, args); - } - } - } -} -(function(EventHub2) { - EventHub2.ChildEventName = "gl_child_event"; -})(EventHub || (EventHub = {})); -class LayoutManager extends EventEmitter { - constructor(parameters) { - super(); - this._isFullPage = false; - this._isInitialised = false; - this._groundItem = void 0; - this._openPopouts = []; - this._dropTargetIndicator = null; - this._transitionIndicator = null; - this._itemAreas = []; - this._maximisePlaceholder = LayoutManager.createMaximisePlaceElement(document); - this._tabDropPlaceholder = LayoutManager.createTabDropPlaceholderElement(document); - this._dragSources = []; - this._updatingColumnsResponsive = false; - this._firstLoad = true; - this._eventHub = new EventHub(this); - this._width = null; - this._height = null; - this._virtualSizedContainers = []; - this._virtualSizedContainerAddingBeginCount = 0; - this._windowResizeListener = () => this.processResizeWithDebounce(); - this._windowUnloadListener = () => this.onUnload(); - this._maximisedStackBeforeDestroyedListener = (ev) => this.cleanupBeforeMaximisedStackDestroyed(ev); - this.isSubWindow = parameters.isSubWindow; - this._constructorOrSubWindowLayoutConfig = parameters.constructorOrSubWindowLayoutConfig; - I18nStrings.checkInitialise(); - ConfigMinifier.checkInitialise(); - if (parameters.containerElement !== void 0) { - this._containerElement = parameters.containerElement; - } - } - get container() { - return this._containerElement; - } - get isInitialised() { - return this._isInitialised; - } - get groundItem() { - return this._groundItem; - } - get root() { - return this._groundItem; - } - get openPopouts() { - return this._openPopouts; - } - get dropTargetIndicator() { - return this._dropTargetIndicator; - } - get transitionIndicator() { - return this._transitionIndicator; - } - get width() { - return this._width; - } - get height() { - return this._height; - } - get eventHub() { - return this._eventHub; - } - get rootItem() { - if (this._groundItem === void 0) { - throw new Error("Cannot access rootItem before init"); - } else { - const groundContentItems = this._groundItem.contentItems; - if (groundContentItems.length === 0) { - return void 0; - } else { - return this._groundItem.contentItems[0]; - } - } - } - get focusedComponentItem() { - return this._focusedComponentItem; - } - get tabDropPlaceholder() { - return this._tabDropPlaceholder; - } - get maximisedStack() { - return this._maximisedStack; - } - get deprecatedConstructor() { - return !this.isSubWindow && this._constructorOrSubWindowLayoutConfig !== void 0; - } - destroy() { - if (this._isInitialised) { - if (this.layoutConfig.settings.closePopoutsOnUnload === true) { - for (let i = 0; i < this._openPopouts.length; i++) { - this._openPopouts[i].close(); - } - } - if (this._isFullPage) { - globalThis.removeEventListener("resize", this._windowResizeListener); - } - globalThis.removeEventListener("unload", this._windowUnloadListener); - globalThis.removeEventListener("beforeunload", this._windowUnloadListener); - if (this._groundItem !== void 0) { - this._groundItem.destroy(); - } - this._tabDropPlaceholder.remove(); - if (this._dropTargetIndicator !== null) { - this._dropTargetIndicator.destroy(); - } - if (this._transitionIndicator !== null) { - this._transitionIndicator.destroy(); - } - this._eventHub.destroy(); - for (const dragSource of this._dragSources) { - dragSource.destroy(); - } - this._dragSources = []; - this._isInitialised = false; - } - } - minifyConfig(config) { - return ResolvedLayoutConfig.minifyConfig(config); - } - unminifyConfig(config) { - return ResolvedLayoutConfig.unminifyConfig(config); - } - init() { - this.setContainer(); - this._dropTargetIndicator = new DropTargetIndicator(); - this._transitionIndicator = new TransitionIndicator(); - this.updateSizeFromContainer(); - let subWindowRootConfig; - if (this.isSubWindow) { - if (this._constructorOrSubWindowLayoutConfig === void 0) { - throw new UnexpectedUndefinedError("LMIU07155"); - } else { - if (ItemConfig.isComponent(this._constructorOrSubWindowLayoutConfig.root)) { - subWindowRootConfig = this._constructorOrSubWindowLayoutConfig.root; - } else { - throw new AssertError("LMIC07155"); - } - const resolvedLayoutConfig = LayoutConfig.resolve(this._constructorOrSubWindowLayoutConfig); - this.layoutConfig = Object.assign(Object.assign({}, resolvedLayoutConfig), {root: void 0}); - } - } else { - if (this._constructorOrSubWindowLayoutConfig === void 0) { - this.layoutConfig = ResolvedLayoutConfig.createDefault(); - } else { - this.layoutConfig = LayoutConfig.resolve(this._constructorOrSubWindowLayoutConfig); - } - } - const layoutConfig = this.layoutConfig; - this._groundItem = new GroundItem(this, layoutConfig.root, this._containerElement); - this._groundItem.init(); - this.checkLoadedLayoutMaximiseItem(); - this.bindEvents(); - this._isInitialised = true; - this.adjustColumnsResponsive(); - this.emit("initialised"); - if (subWindowRootConfig !== void 0) { - this.loadComponentAsRoot(subWindowRootConfig); - } - } - loadLayout(layoutConfig) { - if (!this.isInitialised) { - throw new Error("GoldenLayout: Need to call init() if LayoutConfig with defined root passed to constructor"); - } else { - if (this._groundItem === void 0) { - throw new UnexpectedUndefinedError("LMLL11119"); - } else { - this.createSubWindows(); - this.layoutConfig = LayoutConfig.resolve(layoutConfig); - this._groundItem.loadRoot(this.layoutConfig.root); - this.checkLoadedLayoutMaximiseItem(); - this.adjustColumnsResponsive(); - } - } - } - saveLayout() { - if (this._isInitialised === false) { - throw new Error("Can't create config, layout not yet initialised"); - } else { - if (this._groundItem === void 0) { - throw new UnexpectedUndefinedError("LMTC18244"); - } else { - const groundContent = this._groundItem.calculateConfigContent(); - let rootItemConfig; - if (groundContent.length !== 1) { - rootItemConfig = void 0; - } else { - rootItemConfig = groundContent[0]; - } - this.reconcilePopoutWindows(); - const openPopouts = []; - for (let i = 0; i < this._openPopouts.length; i++) { - openPopouts.push(this._openPopouts[i].toConfig()); - } - const config = { - root: rootItemConfig, - openPopouts, - settings: ResolvedLayoutConfig.Settings.createCopy(this.layoutConfig.settings), - dimensions: ResolvedLayoutConfig.Dimensions.createCopy(this.layoutConfig.dimensions), - header: ResolvedLayoutConfig.Header.createCopy(this.layoutConfig.header), - resolved: true - }; - return config; - } - } - } - clear() { - if (this._groundItem === void 0) { - throw new UnexpectedUndefinedError("LMCL11129"); - } else { - this._groundItem.clearRoot(); - } - } - toConfig() { - return this.saveLayout(); - } - newComponent(componentType, componentState, title) { - const componentItem = this.newComponentAtLocation(componentType, componentState, title); - if (componentItem === void 0) { - throw new AssertError("LMNC65588"); - } else { - return componentItem; - } - } - newComponentAtLocation(componentType, componentState, title, locationSelectors) { - if (this._groundItem === void 0) { - throw new Error("Cannot add component before init"); - } else { - const location2 = this.addComponentAtLocation(componentType, componentState, title, locationSelectors); - if (location2 === void 0) { - return void 0; - } else { - const createdItem = location2.parentItem.contentItems[location2.index]; - if (!ContentItem.isComponentItem(createdItem)) { - throw new AssertError("LMNC992877533"); - } else { - return createdItem; - } - } - } - } - addComponent(componentType, componentState, title) { - const location2 = this.addComponentAtLocation(componentType, componentState, title); - if (location2 === void 0) { - throw new AssertError("LMAC99943"); - } else { - return location2; - } - } - addComponentAtLocation(componentType, componentState, title, locationSelectors) { - const itemConfig = { - type: "component", - componentType, - componentState, - title - }; - return this.addItemAtLocation(itemConfig, locationSelectors); - } - newItem(itemConfig) { - const contentItem = this.newItemAtLocation(itemConfig); - if (contentItem === void 0) { - throw new AssertError("LMNC65588"); - } else { - return contentItem; - } - } - newItemAtLocation(itemConfig, locationSelectors) { - if (this._groundItem === void 0) { - throw new Error("Cannot add component before init"); - } else { - const location2 = this.addItemAtLocation(itemConfig, locationSelectors); - if (location2 === void 0) { - return void 0; - } else { - const createdItem = location2.parentItem.contentItems[location2.index]; - return createdItem; - } - } - } - addItem(itemConfig) { - const location2 = this.addItemAtLocation(itemConfig); - if (location2 === void 0) { - throw new AssertError("LMAI99943"); - } else { - return location2; - } - } - addItemAtLocation(itemConfig, locationSelectors) { - if (this._groundItem === void 0) { - throw new Error("Cannot add component before init"); - } else { - if (locationSelectors === void 0) { - locationSelectors = LayoutManager.defaultLocationSelectors; - } - const location2 = this.findFirstLocation(locationSelectors); - if (location2 === void 0) { - return void 0; - } else { - let parentItem = location2.parentItem; - let addIdx; - switch (parentItem.type) { - case ItemType.ground: { - const groundItem = parentItem; - addIdx = groundItem.addItem(itemConfig, location2.index); - if (addIdx >= 0) { - parentItem = this._groundItem.contentItems[0]; - } else { - addIdx = 0; - } - break; - } - case ItemType.row: - case ItemType.column: { - const rowOrColumn = parentItem; - addIdx = rowOrColumn.addItem(itemConfig, location2.index); - break; - } - case ItemType.stack: { - if (!ItemConfig.isComponent(itemConfig)) { - throw Error(i18nStrings[6]); - } else { - const stack = parentItem; - addIdx = stack.addItem(itemConfig, location2.index); - break; - } - } - case ItemType.component: { - throw new AssertError("LMAIALC87444602"); - } - default: - throw new UnreachableCaseError("LMAIALU98881733", parentItem.type); - } - if (ItemConfig.isComponent(itemConfig)) { - const item = parentItem.contentItems[addIdx]; - if (ContentItem.isStack(item)) { - parentItem = item; - addIdx = 0; - } - } - location2.parentItem = parentItem; - location2.index = addIdx; - return location2; - } - } - } - loadComponentAsRoot(itemConfig) { - if (this._groundItem === void 0) { - throw new Error("Cannot add item before init"); - } else { - this._groundItem.loadComponentAsRoot(itemConfig); - } - } - updateSize(width, height) { - this.setSize(width, height); - } - setSize(width, height) { - this._width = width; - this._height = height; - if (this._isInitialised === true) { - if (this._groundItem === void 0) { - throw new UnexpectedUndefinedError("LMUS18881"); - } else { - this._groundItem.setSize(this._width, this._height); - if (this._maximisedStack) { - const {width: width2, height: height2} = getElementWidthAndHeight(this._containerElement); - setElementWidth(this._maximisedStack.element, width2); - setElementHeight(this._maximisedStack.element, height2); - this._maximisedStack.updateSize(); - } - this.adjustColumnsResponsive(); - } - } - } - updateSizeFromContainer() { - const {width, height} = getElementWidthAndHeight(this._containerElement); - this.setSize(width, height); - } - updateRootSize() { - if (this._groundItem === void 0) { - throw new UnexpectedUndefinedError("LMURS28881"); - } else { - this._groundItem.updateSize(); - } - } - createAndInitContentItem(config, parent) { - const newItem = this.createContentItem(config, parent); - newItem.init(); - return newItem; - } - createContentItem(config, parent) { - if (typeof config.type !== "string") { - throw new ConfigurationError("Missing parameter 'type'", JSON.stringify(config)); - } - if (ResolvedItemConfig.isComponentItem(config) && !(parent instanceof Stack) && !!parent && !(this.isSubWindow === true && parent instanceof GroundItem)) { - const stackConfig = { - type: ItemType.stack, - content: [config], - width: config.width, - minWidth: config.minWidth, - height: config.height, - minHeight: config.minHeight, - id: config.id, - maximised: config.maximised, - isClosable: config.isClosable, - activeItemIndex: 0, - header: void 0 - }; - config = stackConfig; - } - const contentItem = this.createContentItemFromConfig(config, parent); - return contentItem; - } - findFirstComponentItemById(id) { - if (this._groundItem === void 0) { - throw new UnexpectedUndefinedError("LMFFCIBI82446"); - } else { - return this.findFirstContentItemTypeByIdRecursive(ItemType.component, id, this._groundItem); - } - } - createPopout(itemConfigOrContentItem, positionAndSize, parentId, indexInParent) { - if (itemConfigOrContentItem instanceof ContentItem) { - return this.createPopoutFromContentItem(itemConfigOrContentItem, positionAndSize, parentId, indexInParent); - } else { - return this.createPopoutFromItemConfig(itemConfigOrContentItem, positionAndSize, parentId, indexInParent); - } - } - createPopoutFromContentItem(item, window2, parentId, indexInParent) { - let parent = item.parent; - let child = item; - while (parent !== null && parent.contentItems.length === 1 && !parent.isGround) { - child = parent; - parent = parent.parent; - } - if (parent === null) { - throw new UnexpectedNullError("LMCPFCI00834"); - } else { - if (indexInParent === void 0) { - indexInParent = parent.contentItems.indexOf(child); - } - if (parentId !== null) { - parent.addPopInParentId(parentId); - } - if (window2 === void 0) { - const windowLeft = globalThis.screenX || globalThis.screenLeft; - const windowTop = globalThis.screenY || globalThis.screenTop; - const offsetLeft = item.element.offsetLeft; - const offsetTop = item.element.offsetTop; - const {width, height} = getElementWidthAndHeight(item.element); - window2 = { - left: windowLeft + offsetLeft, - top: windowTop + offsetTop, - width, - height - }; - } - const itemConfig = item.toConfig(); - item.remove(); - if (!ResolvedRootItemConfig.isRootItemConfig(itemConfig)) { - throw new Error(`${i18nStrings[0]}`); - } else { - return this.createPopoutFromItemConfig(itemConfig, window2, parentId, indexInParent); - } - } - } - beginVirtualSizedContainerAdding() { - if (++this._virtualSizedContainerAddingBeginCount === 0) { - this._virtualSizedContainers.length = 0; - } - } - addVirtualSizedContainer(container) { - this._virtualSizedContainers.push(container); - } - endVirtualSizedContainerAdding() { - if (--this._virtualSizedContainerAddingBeginCount === 0) { - const count = this._virtualSizedContainers.length; - if (count > 0) { - this.fireBeforeVirtualRectingEvent(count); - for (let i = 0; i < count; i++) { - const container = this._virtualSizedContainers[i]; - container.notifyVirtualRectingRequired(); - } - this.fireAfterVirtualRectingEvent(); - this._virtualSizedContainers.length = 0; - } - } - } - fireBeforeVirtualRectingEvent(count) { - if (this.beforeVirtualRectingEvent !== void 0) { - this.beforeVirtualRectingEvent(count); - } - } - fireAfterVirtualRectingEvent() { - if (this.afterVirtualRectingEvent !== void 0) { - this.afterVirtualRectingEvent(); - } - } - createPopoutFromItemConfig(rootItemConfig, window2, parentId, indexInParent) { - const layoutConfig = this.toConfig(); - const popoutLayoutConfig = { - root: rootItemConfig, - openPopouts: [], - settings: layoutConfig.settings, - dimensions: layoutConfig.dimensions, - header: layoutConfig.header, - window: window2, - parentId, - indexInParent, - resolved: true - }; - return this.createPopoutFromPopoutLayoutConfig(popoutLayoutConfig); - } - createPopoutFromPopoutLayoutConfig(config) { - var _a, _b, _c, _d; - const configWindow = config.window; - const initialWindow = { - left: (_a = configWindow.left) !== null && _a !== void 0 ? _a : globalThis.screenX || globalThis.screenLeft + 20, - top: (_b = configWindow.top) !== null && _b !== void 0 ? _b : globalThis.screenY || globalThis.screenTop + 20, - width: (_c = configWindow.width) !== null && _c !== void 0 ? _c : 500, - height: (_d = configWindow.height) !== null && _d !== void 0 ? _d : 309 - }; - const browserPopout = new BrowserPopout(config, initialWindow, this); - browserPopout.on("initialised", () => this.emit("windowOpened", browserPopout)); - browserPopout.on("closed", () => this.reconcilePopoutWindows()); - this._openPopouts.push(browserPopout); - return browserPopout; - } - newDragSource(element, componentTypeOrItemConfigCallback, componentState, title) { - const dragSource = new DragSource(this, element, [], componentTypeOrItemConfigCallback, componentState, title); - this._dragSources.push(dragSource); - return dragSource; - } - removeDragSource(dragSource) { - removeFromArray(dragSource, this._dragSources); - dragSource.destroy(); - } - startComponentDrag(x, y, dragListener, componentItem, stack) { - new DragProxy(x, y, dragListener, this, componentItem, stack); - } - focusComponent(item, suppressEvent = false) { - item.focus(suppressEvent); - } - clearComponentFocus(suppressEvent = false) { - this.setFocusedComponentItem(void 0, suppressEvent); - } - setFocusedComponentItem(item, suppressEvents = false) { - if (item !== this._focusedComponentItem) { - let newFocusedParentItem; - if (item === void 0) - ; - else { - newFocusedParentItem = item.parentItem; - } - if (this._focusedComponentItem !== void 0) { - const oldFocusedItem = this._focusedComponentItem; - this._focusedComponentItem = void 0; - oldFocusedItem.setBlurred(suppressEvents); - const oldFocusedParentItem = oldFocusedItem.parentItem; - if (newFocusedParentItem === oldFocusedParentItem) { - newFocusedParentItem = void 0; - } else { - oldFocusedParentItem.setFocusedValue(false); - } - } - if (item !== void 0) { - this._focusedComponentItem = item; - item.setFocused(suppressEvents); - if (newFocusedParentItem !== void 0) { - newFocusedParentItem.setFocusedValue(true); - } - } - } - } - createContentItemFromConfig(config, parent) { - switch (config.type) { - case ItemType.ground: - throw new AssertError("LMCCIFC68871"); - case ItemType.row: - return new RowOrColumn(false, this, config, parent); - case ItemType.column: - return new RowOrColumn(true, this, config, parent); - case ItemType.stack: - return new Stack(this, config, parent); - case ItemType.component: - return new ComponentItem(this, config, parent); - default: - throw new UnreachableCaseError("CCC913564", config.type, "Invalid Config Item type specified"); - } - } - setMaximisedStack(stack) { - if (stack === void 0) { - if (this._maximisedStack !== void 0) { - this.processMinimiseMaximisedStack(); - } - } else { - if (stack !== this._maximisedStack) { - if (this._maximisedStack !== void 0) { - this.processMinimiseMaximisedStack(); - } - this.processMaximiseStack(stack); - } - } - } - checkMinimiseMaximisedStack() { - if (this._maximisedStack !== void 0) { - this._maximisedStack.minimise(); - } - } - cleanupBeforeMaximisedStackDestroyed(event) { - if (this._maximisedStack !== null && this._maximisedStack === event.target) { - this._maximisedStack.off("beforeItemDestroyed", this._maximisedStackBeforeDestroyedListener); - this._maximisedStack = void 0; - } - } - closeWindow() { - globalThis.setTimeout(() => globalThis.close(), 1); - } - getArea(x, y) { - let matchingArea = null; - let smallestSurface = Infinity; - for (let i = 0; i < this._itemAreas.length; i++) { - const area = this._itemAreas[i]; - if (x > area.x1 && x < area.x2 && y > area.y1 && y < area.y2 && smallestSurface > area.surface) { - smallestSurface = area.surface; - matchingArea = area; - } - } - return matchingArea; - } - calculateItemAreas() { - const allContentItems = this.getAllContentItems(); - const groundItem = this._groundItem; - if (groundItem === void 0) { - throw new UnexpectedUndefinedError("LMCIAR44365"); - } else { - if (allContentItems.length === 1) { - const groundArea = groundItem.getElementArea(); - if (groundArea === null) { - throw new UnexpectedNullError("LMCIARA44365"); - } else { - this._itemAreas = [groundArea]; - } - return; - } else { - if (groundItem.contentItems[0].isStack) { - this._itemAreas = []; - } else { - this._itemAreas = groundItem.createSideAreas(); - } - for (let i = 0; i < allContentItems.length; i++) { - const stack = allContentItems[i]; - if (ContentItem.isStack(stack)) { - const area = stack.getArea(); - if (area === null) { - continue; - } else { - this._itemAreas.push(area); - const stackContentAreaDimensions = stack.contentAreaDimensions; - if (stackContentAreaDimensions === void 0) { - throw new UnexpectedUndefinedError("LMCIASC45599"); - } else { - const highlightArea = stackContentAreaDimensions.header.highlightArea; - const surface = (highlightArea.x2 - highlightArea.x1) * (highlightArea.y2 - highlightArea.y1); - const header = { - x1: highlightArea.x1, - x2: highlightArea.x2, - y1: highlightArea.y1, - y2: highlightArea.y2, - contentItem: stack, - surface - }; - this._itemAreas.push(header); - } - } - } - } - } - } - } - checkLoadedLayoutMaximiseItem() { - if (this._groundItem === void 0) { - throw new UnexpectedUndefinedError("LMCLLMI43432"); - } else { - const configMaximisedItems = this._groundItem.getConfigMaximisedItems(); - if (configMaximisedItems.length > 0) { - let item = configMaximisedItems[0]; - if (ContentItem.isComponentItem(item)) { - const stack = item.parent; - if (stack === null) { - throw new UnexpectedNullError("LMXLLMI69999"); - } else { - item = stack; - } - } - if (!ContentItem.isStack(item)) { - throw new AssertError("LMCLLMI19993"); - } else { - item.maximise(); - } - } - } - } - processMaximiseStack(stack) { - this._maximisedStack = stack; - stack.on("beforeItemDestroyed", this._maximisedStackBeforeDestroyedListener); - stack.element.classList.add("lm_maximised"); - stack.element.insertAdjacentElement("afterend", this._maximisePlaceholder); - if (this._groundItem === void 0) { - throw new UnexpectedUndefinedError("LMMXI19993"); - } else { - this._groundItem.element.prepend(stack.element); - const {width, height} = getElementWidthAndHeight(this._containerElement); - setElementWidth(stack.element, width); - setElementHeight(stack.element, height); - stack.updateSize(); - stack.focusActiveContentItem(); - this._maximisedStack.emit("maximised"); - this.emit("stateChanged"); - } - } - processMinimiseMaximisedStack() { - if (this._maximisedStack === void 0) { - throw new AssertError("LMMMS74422"); - } else { - const stack = this._maximisedStack; - if (stack.parent === null) { - throw new UnexpectedNullError("LMMI13668"); - } else { - stack.element.classList.remove("lm_maximised"); - this._maximisePlaceholder.insertAdjacentElement("afterend", stack.element); - this._maximisePlaceholder.remove(); - stack.parent.updateSize(); - this._maximisedStack = void 0; - stack.off("beforeItemDestroyed", this._maximisedStackBeforeDestroyedListener); - stack.emit("minimised"); - this.emit("stateChanged"); - } - } - } - reconcilePopoutWindows() { - const openPopouts = []; - for (let i = 0; i < this._openPopouts.length; i++) { - if (this._openPopouts[i].getWindow().closed === false) { - openPopouts.push(this._openPopouts[i]); - } else { - this.emit("windowClosed", this._openPopouts[i]); - } - } - if (this._openPopouts.length !== openPopouts.length) { - this._openPopouts = openPopouts; - this.emit("stateChanged"); - } - } - getAllContentItems() { - if (this._groundItem === void 0) { - throw new UnexpectedUndefinedError("LMGACI13130"); - } else { - return this._groundItem.getAllContentItems(); - } - } - bindEvents() { - if (this._isFullPage) { - globalThis.addEventListener("resize", this._windowResizeListener, {passive: true}); - } - globalThis.addEventListener("unload", this._windowUnloadListener, {passive: true}); - globalThis.addEventListener("beforeunload", this._windowUnloadListener, {passive: true}); - } - createSubWindows() { - for (let i = 0; i < this.layoutConfig.openPopouts.length; i++) { - const popoutConfig = this.layoutConfig.openPopouts[i]; - this.createPopoutFromPopoutLayoutConfig(popoutConfig); - } - } - processResizeWithDebounce() { - if (this._resizeTimeoutId !== void 0) { - clearTimeout(this._resizeTimeoutId); - } - this._resizeTimeoutId = setTimeout(() => this.updateSizeFromContainer(), 100); - } - setContainer() { - var _a; - const bodyElement = document.body; - const containerElement = (_a = this._containerElement) !== null && _a !== void 0 ? _a : bodyElement; - if (containerElement === bodyElement) { - this._isFullPage = true; - const documentElement = document.documentElement; - documentElement.style.height = "100%"; - documentElement.style.margin = "0"; - documentElement.style.padding = "0"; - documentElement.style.overflow = "hidden"; - bodyElement.style.height = "100%"; - bodyElement.style.margin = "0"; - bodyElement.style.padding = "0"; - bodyElement.style.overflow = "hidden"; - } - this._containerElement = containerElement; - } - onUnload() { - this.destroy(); - } - adjustColumnsResponsive() { - if (this._groundItem === void 0) { - throw new UnexpectedUndefinedError("LMACR20883"); - } else { - this._firstLoad = false; - if (this.useResponsiveLayout() && !this._updatingColumnsResponsive && this._groundItem.contentItems.length > 0 && this._groundItem.contentItems[0].isRow) { - if (this._groundItem === void 0 || this._width === null) { - throw new UnexpectedUndefinedError("LMACR77412"); - } else { - const columnCount = this._groundItem.contentItems[0].contentItems.length; - if (columnCount <= 1) { - return; - } else { - const minItemWidth = this.layoutConfig.dimensions.minItemWidth; - const totalMinWidth = columnCount * minItemWidth; - if (totalMinWidth <= this._width) { - return; - } else { - this._updatingColumnsResponsive = true; - const finalColumnCount = Math.max(Math.floor(this._width / minItemWidth), 1); - const stackColumnCount = columnCount - finalColumnCount; - const rootContentItem = this._groundItem.contentItems[0]; - const allStacks = this.getAllStacks(); - if (allStacks.length === 0) { - throw new AssertError("LMACRS77413"); - } else { - const firstStackContainer = allStacks[0]; - for (let i = 0; i < stackColumnCount; i++) { - const column = rootContentItem.contentItems[rootContentItem.contentItems.length - 1]; - this.addChildContentItemsToContainer(firstStackContainer, column); - } - this._updatingColumnsResponsive = false; - } - } - } - } - } - } - } - useResponsiveLayout() { - const settings = this.layoutConfig.settings; - const alwaysResponsiveMode = settings.responsiveMode === ResponsiveMode.always; - const onLoadResponsiveModeAndFirst = settings.responsiveMode === ResponsiveMode.onload && this._firstLoad; - return alwaysResponsiveMode || onLoadResponsiveModeAndFirst; - } - addChildContentItemsToContainer(container, node) { - const contentItems = node.contentItems; - if (node instanceof Stack) { - for (let i = 0; i < contentItems.length; i++) { - const item = contentItems[i]; - node.removeChild(item, true); - container.addChild(item); - } - } else { - for (let i = 0; i < contentItems.length; i++) { - const item = contentItems[i]; - this.addChildContentItemsToContainer(container, item); - } - } - } - getAllStacks() { - if (this._groundItem === void 0) { - throw new UnexpectedUndefinedError("LMFASC52778"); - } else { - const stacks = []; - this.findAllStacksRecursive(stacks, this._groundItem); - return stacks; - } - } - findFirstContentItemType(type) { - if (this._groundItem === void 0) { - throw new UnexpectedUndefinedError("LMFFCIT82446"); - } else { - return this.findFirstContentItemTypeRecursive(type, this._groundItem); - } - } - findFirstContentItemTypeRecursive(type, node) { - const contentItems = node.contentItems; - const contentItemCount = contentItems.length; - if (contentItemCount === 0) { - return void 0; - } else { - for (let i = 0; i < contentItemCount; i++) { - const contentItem = contentItems[i]; - if (contentItem.type === type) { - return contentItem; - } - } - for (let i = 0; i < contentItemCount; i++) { - const contentItem = contentItems[i]; - const foundContentItem = this.findFirstContentItemTypeRecursive(type, contentItem); - if (foundContentItem !== void 0) { - return foundContentItem; - } - } - return void 0; - } - } - findFirstContentItemTypeByIdRecursive(type, id, node) { - const contentItems = node.contentItems; - const contentItemCount = contentItems.length; - if (contentItemCount === 0) { - return void 0; - } else { - for (let i = 0; i < contentItemCount; i++) { - const contentItem = contentItems[i]; - if (contentItem.type === type && contentItem.id === id) { - return contentItem; - } - } - for (let i = 0; i < contentItemCount; i++) { - const contentItem = contentItems[i]; - const foundContentItem = this.findFirstContentItemTypeByIdRecursive(type, id, contentItem); - if (foundContentItem !== void 0) { - return foundContentItem; - } - } - return void 0; - } - } - findAllStacksRecursive(stacks, node) { - const contentItems = node.contentItems; - for (let i = 0; i < contentItems.length; i++) { - const item = contentItems[i]; - if (item instanceof Stack) { - stacks.push(item); - } else { - if (!item.isComponent) { - this.findAllStacksRecursive(stacks, item); - } - } - } - } - findFirstLocation(selectors) { - const count = selectors.length; - for (let i = 0; i < count; i++) { - const selector = selectors[i]; - const location2 = this.findLocation(selector); - if (location2 !== void 0) { - return location2; - } - } - return void 0; - } - findLocation(selector) { - const selectorIndex = selector.index; - switch (selector.typeId) { - case 0: { - if (this._focusedComponentItem === void 0) { - return void 0; - } else { - const parentItem = this._focusedComponentItem.parentItem; - const parentContentItems = parentItem.contentItems; - const parentContentItemCount = parentContentItems.length; - if (selectorIndex === void 0) { - return {parentItem, index: parentContentItemCount}; - } else { - const focusedIndex = parentContentItems.indexOf(this._focusedComponentItem); - const index = focusedIndex + selectorIndex; - if (index < 0 || index > parentContentItemCount) { - return void 0; - } else { - return {parentItem, index}; - } - } - } - } - case 1: { - if (this._focusedComponentItem === void 0) { - return void 0; - } else { - const parentItem = this._focusedComponentItem.parentItem; - return this.tryCreateLocationFromParentItem(parentItem, selectorIndex); - } - } - case 2: { - const parentItem = this.findFirstContentItemType(ItemType.stack); - if (parentItem === void 0) { - return void 0; - } else { - return this.tryCreateLocationFromParentItem(parentItem, selectorIndex); - } - } - case 3: { - let parentItem = this.findFirstContentItemType(ItemType.row); - if (parentItem !== void 0) { - return this.tryCreateLocationFromParentItem(parentItem, selectorIndex); - } else { - parentItem = this.findFirstContentItemType(ItemType.column); - if (parentItem !== void 0) { - return this.tryCreateLocationFromParentItem(parentItem, selectorIndex); - } else { - return void 0; - } - } - } - case 4: { - const parentItem = this.findFirstContentItemType(ItemType.row); - if (parentItem === void 0) { - return void 0; - } else { - return this.tryCreateLocationFromParentItem(parentItem, selectorIndex); - } - } - case 5: { - const parentItem = this.findFirstContentItemType(ItemType.column); - if (parentItem === void 0) { - return void 0; - } else { - return this.tryCreateLocationFromParentItem(parentItem, selectorIndex); - } - } - case 6: { - if (this._groundItem === void 0) { - throw new UnexpectedUndefinedError("LMFLRIF18244"); - } else { - if (this.rootItem !== void 0) { - return void 0; - } else { - if (selectorIndex === void 0 || selectorIndex === 0) - return {parentItem: this._groundItem, index: 0}; - else { - return void 0; - } - } - } - } - case 7: { - if (this._groundItem === void 0) { - throw new UnexpectedUndefinedError("LMFLF18244"); - } else { - const groundContentItems = this._groundItem.contentItems; - if (groundContentItems.length === 0) { - if (selectorIndex === void 0 || selectorIndex === 0) - return {parentItem: this._groundItem, index: 0}; - else { - return void 0; - } - } else { - const parentItem = groundContentItems[0]; - return this.tryCreateLocationFromParentItem(parentItem, selectorIndex); - } - } - } - } - } - tryCreateLocationFromParentItem(parentItem, selectorIndex) { - const parentContentItems = parentItem.contentItems; - const parentContentItemCount = parentContentItems.length; - if (selectorIndex === void 0) { - return {parentItem, index: parentContentItemCount}; - } else { - if (selectorIndex < 0 || selectorIndex > parentContentItemCount) { - return void 0; - } else { - return {parentItem, index: selectorIndex}; - } - } - } -} -(function(LayoutManager2) { - function createMaximisePlaceElement(document2) { - const element = document2.createElement("div"); - element.classList.add("lm_maximise_place"); - return element; - } - LayoutManager2.createMaximisePlaceElement = createMaximisePlaceElement; - function createTabDropPlaceholderElement(document2) { - const element = document2.createElement("div"); - element.classList.add("lm_drop_tab_placeholder"); - return element; - } - LayoutManager2.createTabDropPlaceholderElement = createTabDropPlaceholderElement; - LayoutManager2.defaultLocationSelectors = [ - {typeId: 1, index: void 0}, - {typeId: 2, index: void 0}, - {typeId: 3, index: void 0}, - {typeId: 7, index: void 0} - ]; - LayoutManager2.afterFocusedItemIfPossibleLocationSelectors = [ - {typeId: 0, index: 1}, - {typeId: 2, index: void 0}, - {typeId: 3, index: void 0}, - {typeId: 7, index: void 0} - ]; -})(LayoutManager || (LayoutManager = {})); -class VirtualLayout extends LayoutManager { - constructor(configOrOptionalContainer, containerOrBindComponentEventHandler, unbindComponentEventHandler, skipInit) { - super(VirtualLayout.createLayoutManagerConstructorParameters(configOrOptionalContainer, containerOrBindComponentEventHandler)); - this._bindComponentEventHanlderPassedInConstructor = false; - this._creationTimeoutPassed = false; - if (containerOrBindComponentEventHandler !== void 0) { - if (typeof containerOrBindComponentEventHandler === "function") { - this.bindComponentEvent = containerOrBindComponentEventHandler; - this._bindComponentEventHanlderPassedInConstructor = true; - if (unbindComponentEventHandler !== void 0) { - this.unbindComponentEvent = unbindComponentEventHandler; - } - } - } - if (!this._bindComponentEventHanlderPassedInConstructor) { - if (this.isSubWindow) { - if (this._constructorOrSubWindowLayoutConfig === void 0) { - throw new UnexpectedUndefinedError("VLC98823"); - } else { - const resolvedLayoutConfig = LayoutConfig.resolve(this._constructorOrSubWindowLayoutConfig); - this.layoutConfig = Object.assign(Object.assign({}, resolvedLayoutConfig), {root: void 0}); - } - } - } - if (skipInit !== true) { - if (!this.deprecatedConstructor) { - this.init(); - } - } - } - destroy() { - this.bindComponentEvent = void 0; - this.unbindComponentEvent = void 0; - super.destroy(); - } - init() { - if (!this._bindComponentEventHanlderPassedInConstructor && (document.readyState === "loading" || document.body === null)) { - document.addEventListener("DOMContentLoaded", () => this.init(), {passive: true}); - return; - } - if (!this._bindComponentEventHanlderPassedInConstructor && this.isSubWindow === true && !this._creationTimeoutPassed) { - setTimeout(() => this.init(), 7); - this._creationTimeoutPassed = true; - return; - } - if (this.isSubWindow === true) { - if (!this._bindComponentEventHanlderPassedInConstructor) { - this.clearHtmlAndAdjustStylesForSubWindow(); - } - window.__glInstance = this; - } - super.init(); - } - clearHtmlAndAdjustStylesForSubWindow() { - const headElement = document.head; - const appendNodeLists = new Array(4); - appendNodeLists[0] = document.querySelectorAll("body link"); - appendNodeLists[1] = document.querySelectorAll("body style"); - appendNodeLists[2] = document.querySelectorAll("template"); - appendNodeLists[3] = document.querySelectorAll(".gl_keep"); - for (let listIdx = 0; listIdx < appendNodeLists.length; listIdx++) { - const appendNodeList = appendNodeLists[listIdx]; - for (let nodeIdx = 0; nodeIdx < appendNodeList.length; nodeIdx++) { - const node = appendNodeList[nodeIdx]; - headElement.appendChild(node); - } - } - const bodyElement = document.body; - bodyElement.innerHTML = ""; - bodyElement.style.visibility = "visible"; - this.checkAddDefaultPopinButton(); - const x = document.body.offsetHeight; - } - checkAddDefaultPopinButton() { - if (this.layoutConfig.settings.popInOnClose) { - return false; - } else { - const popInButtonElement = document.createElement("div"); - popInButtonElement.classList.add("lm_popin"); - popInButtonElement.setAttribute("title", this.layoutConfig.header.dock); - const iconElement = document.createElement("div"); - iconElement.classList.add("lm_icon"); - const bgElement = document.createElement("div"); - bgElement.classList.add("lm_bg"); - popInButtonElement.appendChild(iconElement); - popInButtonElement.appendChild(bgElement); - popInButtonElement.addEventListener("click", () => this.emit("popIn")); - document.body.appendChild(popInButtonElement); - return true; - } - } - bindComponent(container, itemConfig) { - if (this.bindComponentEvent !== void 0) { - const bindableComponent = this.bindComponentEvent(container, itemConfig); - return bindableComponent; - } else { - if (this.getComponentEvent !== void 0) { - return { - virtual: false, - component: this.getComponentEvent(container, itemConfig) - }; - } else { - const text = i18nStrings[2]; - const message = `${text}: ${JSON.stringify(itemConfig)}`; - throw new BindError(message); - } - } - } - unbindComponent(container, virtual, component) { - if (virtual) { - if (this.unbindComponentEvent !== void 0) { - this.unbindComponentEvent(container); - } - } else { - if (this.releaseComponentEvent !== void 0) { - if (component === void 0) { - throw new UnexpectedUndefinedError("VCUCRCU333998"); - } else { - this.releaseComponentEvent(container, component); - } - } - } - } -} -(function(VirtualLayout2) { - let subWindowChecked = false; - function createLayoutManagerConstructorParameters(configOrOptionalContainer, containerOrBindComponentEventHandler) { - const windowConfigKey = subWindowChecked ? null : new URL(document.location.href).searchParams.get("gl-window"); - subWindowChecked = true; - const isSubWindow = windowConfigKey !== null; - let containerElement; - let config; - if (windowConfigKey !== null) { - const windowConfigStr = localStorage.getItem(windowConfigKey); - if (windowConfigStr === null) { - throw new Error("Null gl-window Config"); - } - localStorage.removeItem(windowConfigKey); - const minifiedWindowConfig = JSON.parse(windowConfigStr); - const resolvedConfig = ResolvedLayoutConfig.unminifyConfig(minifiedWindowConfig); - config = LayoutConfig.fromResolved(resolvedConfig); - if (configOrOptionalContainer instanceof HTMLElement) { - containerElement = configOrOptionalContainer; - } - } else { - if (configOrOptionalContainer === void 0) { - config = void 0; - } else { - if (configOrOptionalContainer instanceof HTMLElement) { - config = void 0; - containerElement = configOrOptionalContainer; - } else { - config = configOrOptionalContainer; - } - } - if (containerElement === void 0) { - if (containerOrBindComponentEventHandler instanceof HTMLElement) { - containerElement = containerOrBindComponentEventHandler; - } - } - } - return { - constructorOrSubWindowLayoutConfig: config, - isSubWindow, - containerElement - }; - } - VirtualLayout2.createLayoutManagerConstructorParameters = createLayoutManagerConstructorParameters; -})(VirtualLayout || (VirtualLayout = {})); -class GoldenLayout extends VirtualLayout { - constructor(configOrOptionalContainer, containerOrBindComponentEventHandler, unbindComponentEventHandler) { - super(configOrOptionalContainer, containerOrBindComponentEventHandler, unbindComponentEventHandler, true); - this._componentTypesMap = new Map(); - this._virtuableComponentMap = new Map(); - this._containerVirtualRectingRequiredEventListener = (container, width, height) => this.handleContainerVirtualRectingRequiredEvent(container, width, height); - this._containerVirtualVisibilityChangeRequiredEventListener = (container, visible) => this.handleContainerVirtualVisibilityChangeRequiredEvent(container, visible); - this._containerVirtualZIndexChangeRequiredEventListener = (container, logicalZIndex, defaultZIndex) => this.handleContainerVirtualZIndexChangeRequiredEvent(container, logicalZIndex, defaultZIndex); - if (!this.deprecatedConstructor) { - this.init(); - } - } - registerComponent(name, componentConstructorOrFactoryFtn, virtual = false) { - if (typeof componentConstructorOrFactoryFtn !== "function") { - throw new ApiError("registerComponent() componentConstructorOrFactoryFtn parameter is not a function"); - } else { - if (componentConstructorOrFactoryFtn.hasOwnProperty("prototype")) { - const componentConstructor = componentConstructorOrFactoryFtn; - this.registerComponentConstructor(name, componentConstructor, virtual); - } else { - const componentFactoryFtn = componentConstructorOrFactoryFtn; - this.registerComponentFactoryFunction(name, componentFactoryFtn, virtual); - } - } - } - registerComponentConstructor(typeName, componentConstructor, virtual = false) { - if (typeof componentConstructor !== "function") { - throw new Error(i18nStrings[1]); - } - const existingComponentType = this._componentTypesMap.get(typeName); - if (existingComponentType !== void 0) { - throw new BindError(`${i18nStrings[3]}: ${typeName}`); - } - this._componentTypesMap.set(typeName, { - constructor: componentConstructor, - factoryFunction: void 0, - virtual - }); - } - registerComponentFactoryFunction(typeName, componentFactoryFunction, virtual = false) { - if (typeof componentFactoryFunction !== "function") { - throw new BindError("Please register a constructor function"); - } - const existingComponentType = this._componentTypesMap.get(typeName); - if (existingComponentType !== void 0) { - throw new BindError(`${i18nStrings[3]}: ${typeName}`); - } - this._componentTypesMap.set(typeName, { - constructor: void 0, - factoryFunction: componentFactoryFunction, - virtual - }); - } - registerComponentFunction(callback) { - this.registerGetComponentConstructorCallback(callback); - } - registerGetComponentConstructorCallback(callback) { - if (typeof callback !== "function") { - throw new Error("Please register a callback function"); - } - if (this._getComponentConstructorFtn !== void 0) { - console.warn("Multiple component functions are being registered. Only the final registered function will be used."); - } - this._getComponentConstructorFtn = callback; - } - getRegisteredComponentTypeNames() { - const typeNamesIterableIterator = this._componentTypesMap.keys(); - return Array.from(typeNamesIterableIterator); - } - getComponentInstantiator(config) { - let instantiator; - const typeName = ResolvedComponentItemConfig.resolveComponentTypeName(config); - if (typeName !== void 0) { - instantiator = this._componentTypesMap.get(typeName); - } - if (instantiator === void 0) { - if (this._getComponentConstructorFtn !== void 0) { - instantiator = { - constructor: this._getComponentConstructorFtn(config), - factoryFunction: void 0, - virtual: false - }; - } - } - return instantiator; - } - bindComponent(container, itemConfig) { - let instantiator; - const typeName = ResolvedComponentItemConfig.resolveComponentTypeName(itemConfig); - if (typeName !== void 0) { - instantiator = this._componentTypesMap.get(typeName); - } - if (instantiator === void 0) { - if (this._getComponentConstructorFtn !== void 0) { - instantiator = { - constructor: this._getComponentConstructorFtn(itemConfig), - factoryFunction: void 0, - virtual: false - }; - } - } - let result; - if (instantiator !== void 0) { - const virtual = instantiator.virtual; - let componentState; - if (itemConfig.componentState === void 0) { - componentState = void 0; - } else { - componentState = deepExtendValue({}, itemConfig.componentState); - } - let component; - const componentConstructor = instantiator.constructor; - if (componentConstructor !== void 0) { - component = new componentConstructor(container, componentState, virtual); - } else { - const factoryFunction = instantiator.factoryFunction; - if (factoryFunction !== void 0) { - component = factoryFunction(container, componentState, virtual); - } else { - throw new AssertError("LMBCFFU10008"); - } - } - if (virtual) { - if (component === void 0) { - throw new UnexpectedUndefinedError("GLBCVCU988774"); - } else { - const virtuableComponent = component; - const componentRootElement = virtuableComponent.rootHtmlElement; - if (componentRootElement === void 0) { - throw new BindError(`${i18nStrings[5]}: ${typeName}`); - } else { - ensureElementPositionAbsolute(componentRootElement); - this.container.appendChild(componentRootElement); - this._virtuableComponentMap.set(container, virtuableComponent); - container.virtualRectingRequiredEvent = this._containerVirtualRectingRequiredEventListener; - container.virtualVisibilityChangeRequiredEvent = this._containerVirtualVisibilityChangeRequiredEventListener; - container.virtualZIndexChangeRequiredEvent = this._containerVirtualZIndexChangeRequiredEventListener; - } - } - } - result = { - virtual: instantiator.virtual, - component - }; - } else { - result = super.bindComponent(container, itemConfig); - } - return result; - } - unbindComponent(container, virtual, component) { - const virtuableComponent = this._virtuableComponentMap.get(container); - if (virtuableComponent === void 0) { - super.unbindComponent(container, virtual, component); - } else { - const componentRootElement = virtuableComponent.rootHtmlElement; - if (componentRootElement === void 0) { - throw new AssertError("GLUC77743", container.title); - } else { - this.container.removeChild(componentRootElement); - this._virtuableComponentMap.delete(container); - } - } - } - fireBeforeVirtualRectingEvent(count) { - this._goldenLayoutBoundingClientRect = this.container.getBoundingClientRect(); - super.fireBeforeVirtualRectingEvent(count); - } - handleContainerVirtualRectingRequiredEvent(container, width, height) { - const virtuableComponent = this._virtuableComponentMap.get(container); - if (virtuableComponent === void 0) { - throw new UnexpectedUndefinedError("GLHCSCE55933"); - } else { - const rootElement = virtuableComponent.rootHtmlElement; - if (rootElement === void 0) { - throw new BindError(i18nStrings[4] + " " + container.title); - } else { - const containerBoundingClientRect = container.element.getBoundingClientRect(); - const left = containerBoundingClientRect.left - this._goldenLayoutBoundingClientRect.left; - rootElement.style.left = numberToPixels(left); - const top = containerBoundingClientRect.top - this._goldenLayoutBoundingClientRect.top; - rootElement.style.top = numberToPixels(top); - setElementWidth(rootElement, width); - setElementHeight(rootElement, height); - } - } - } - handleContainerVirtualVisibilityChangeRequiredEvent(container, visible) { - const virtuableComponent = this._virtuableComponentMap.get(container); - if (virtuableComponent === void 0) { - throw new UnexpectedUndefinedError("GLHCVVCRE55934"); - } else { - const rootElement = virtuableComponent.rootHtmlElement; - if (rootElement === void 0) { - throw new BindError(i18nStrings[4] + " " + container.title); - } else { - setElementDisplayVisibility(rootElement, visible); - } - } - } - handleContainerVirtualZIndexChangeRequiredEvent(container, logicalZIndex, defaultZIndex) { - const virtuableComponent = this._virtuableComponentMap.get(container); - if (virtuableComponent === void 0) { - throw new UnexpectedUndefinedError("GLHCVZICRE55935"); - } else { - const rootElement = virtuableComponent.rootHtmlElement; - if (rootElement === void 0) { - throw new BindError(i18nStrings[4] + " " + container.title); - } else { - rootElement.style.zIndex = defaultZIndex; - } - } - } -} -export {ApiError, BindError, BrowserPopout, ComponentContainer, ComponentItem, ComponentItemConfig, ConfigurationError, ContentItem, DragSource, EventEmitter, EventHub, ExternalError, GoldenLayout, Header, HeaderedItemConfig, I18nStrings, ItemConfig, ItemType, JsonValue, LayoutConfig, LayoutManager, LogicalZIndex, PopoutBlockedError, PopoutLayoutConfig, ResolvedComponentItemConfig, ResolvedGroundItemConfig, ResolvedHeaderedItemConfig, ResolvedItemConfig, ResolvedLayoutConfig, ResolvedPopoutLayoutConfig, ResolvedRootItemConfig, ResolvedRowOrColumnItemConfig, ResolvedStackItemConfig, ResponsiveMode, RootItemConfig, RowOrColumn, RowOrColumnItemConfig, Side, Stack, StackItemConfig, StyleConstants, Tab, VirtualLayout, WidthOrHeightPropertyName, i18nStrings}; -export default null; diff --git a/web/client/deps/d3/d3-array.js b/web/client/deps/d3/d3-array.js deleted file mode 100644 index b5252809..00000000 --- a/web/client/deps/d3/d3-array.js +++ /dev/null @@ -1,1026 +0,0 @@ -import {InternMap, InternSet} from "./internmap.js"; -export {InternMap, InternSet} from "./internmap.js"; -function ascending(a, b) { - return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; -} -function descending(a, b) { - return a == null || b == null ? NaN : b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; -} -function bisector(f) { - let compare1, compare2, delta; - if (f.length !== 2) { - compare1 = ascending; - compare2 = (d, x) => ascending(f(d), x); - delta = (d, x) => f(d) - x; - } else { - compare1 = f === ascending || f === descending ? f : zero; - compare2 = f; - delta = f; - } - function left(a, x, lo = 0, hi = a.length) { - if (lo < hi) { - if (compare1(x, x) !== 0) - return hi; - do { - const mid = lo + hi >>> 1; - if (compare2(a[mid], x) < 0) - lo = mid + 1; - else - hi = mid; - } while (lo < hi); - } - return lo; - } - function right(a, x, lo = 0, hi = a.length) { - if (lo < hi) { - if (compare1(x, x) !== 0) - return hi; - do { - const mid = lo + hi >>> 1; - if (compare2(a[mid], x) <= 0) - lo = mid + 1; - else - hi = mid; - } while (lo < hi); - } - return lo; - } - function center(a, x, lo = 0, hi = a.length) { - const i = left(a, x, lo, hi - 1); - return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i; - } - return {left, center, right}; -} -function zero() { - return 0; -} -function number(x) { - return x === null ? NaN : +x; -} -function* numbers(values, valueof) { - if (valueof === void 0) { - for (let value of values) { - if (value != null && (value = +value) >= value) { - yield value; - } - } - } else { - let index2 = -1; - for (let value of values) { - if ((value = valueof(value, ++index2, values)) != null && (value = +value) >= value) { - yield value; - } - } - } -} -const ascendingBisect = bisector(ascending); -const bisectRight = ascendingBisect.right; -const bisectLeft = ascendingBisect.left; -const bisectCenter = bisector(number).center; -function count(values, valueof) { - let count2 = 0; - if (valueof === void 0) { - for (let value of values) { - if (value != null && (value = +value) >= value) { - ++count2; - } - } - } else { - let index2 = -1; - for (let value of values) { - if ((value = valueof(value, ++index2, values)) != null && (value = +value) >= value) { - ++count2; - } - } - } - return count2; -} -function length(array2) { - return array2.length | 0; -} -function empty(length2) { - return !(length2 > 0); -} -function arrayify(values) { - return typeof values !== "object" || "length" in values ? values : Array.from(values); -} -function reducer(reduce2) { - return (values) => reduce2(...values); -} -function cross(...values) { - const reduce2 = typeof values[values.length - 1] === "function" && reducer(values.pop()); - values = values.map(arrayify); - const lengths = values.map(length); - const j = values.length - 1; - const index2 = new Array(j + 1).fill(0); - const product = []; - if (j < 0 || lengths.some(empty)) - return product; - while (true) { - product.push(index2.map((j2, i2) => values[i2][j2])); - let i = j; - while (++index2[i] === lengths[i]) { - if (i === 0) - return reduce2 ? product.map(reduce2) : product; - index2[i--] = 0; - } - } -} -function cumsum(values, valueof) { - var sum2 = 0, index2 = 0; - return Float64Array.from(values, valueof === void 0 ? (v) => sum2 += +v || 0 : (v) => sum2 += +valueof(v, index2++, values) || 0); -} -function variance(values, valueof) { - let count2 = 0; - let delta; - let mean2 = 0; - let sum2 = 0; - if (valueof === void 0) { - for (let value of values) { - if (value != null && (value = +value) >= value) { - delta = value - mean2; - mean2 += delta / ++count2; - sum2 += delta * (value - mean2); - } - } - } else { - let index2 = -1; - for (let value of values) { - if ((value = valueof(value, ++index2, values)) != null && (value = +value) >= value) { - delta = value - mean2; - mean2 += delta / ++count2; - sum2 += delta * (value - mean2); - } - } - } - if (count2 > 1) - return sum2 / (count2 - 1); -} -function deviation(values, valueof) { - const v = variance(values, valueof); - return v ? Math.sqrt(v) : v; -} -function extent(values, valueof) { - let min2; - let max2; - if (valueof === void 0) { - for (const value of values) { - if (value != null) { - if (min2 === void 0) { - if (value >= value) - min2 = max2 = value; - } else { - if (min2 > value) - min2 = value; - if (max2 < value) - max2 = value; - } - } - } - } else { - let index2 = -1; - for (let value of values) { - if ((value = valueof(value, ++index2, values)) != null) { - if (min2 === void 0) { - if (value >= value) - min2 = max2 = value; - } else { - if (min2 > value) - min2 = value; - if (max2 < value) - max2 = value; - } - } - } - } - return [min2, max2]; -} -class Adder { - constructor() { - this._partials = new Float64Array(32); - this._n = 0; - } - add(x) { - const p = this._partials; - let i = 0; - for (let j = 0; j < this._n && j < 32; j++) { - const y = p[j], hi = x + y, lo = Math.abs(x) < Math.abs(y) ? x - (hi - y) : y - (hi - x); - if (lo) - p[i++] = lo; - x = hi; - } - p[i] = x; - this._n = i + 1; - return this; - } - valueOf() { - const p = this._partials; - let n = this._n, x, y, lo, hi = 0; - if (n > 0) { - hi = p[--n]; - while (n > 0) { - x = hi; - y = p[--n]; - hi = x + y; - lo = y - (hi - x); - if (lo) - break; - } - if (n > 0 && (lo < 0 && p[n - 1] < 0 || lo > 0 && p[n - 1] > 0)) { - y = lo * 2; - x = hi + y; - if (y == x - hi) - hi = x; - } - } - return hi; - } -} -function fsum(values, valueof) { - const adder = new Adder(); - if (valueof === void 0) { - for (let value of values) { - if (value = +value) { - adder.add(value); - } - } - } else { - let index2 = -1; - for (let value of values) { - if (value = +valueof(value, ++index2, values)) { - adder.add(value); - } - } - } - return +adder; -} -function fcumsum(values, valueof) { - const adder = new Adder(); - let index2 = -1; - return Float64Array.from(values, valueof === void 0 ? (v) => adder.add(+v || 0) : (v) => adder.add(+valueof(v, ++index2, values) || 0)); -} -function identity(x) { - return x; -} -function group(values, ...keys) { - return nest(values, identity, identity, keys); -} -function groups(values, ...keys) { - return nest(values, Array.from, identity, keys); -} -function flatten(groups2, keys) { - for (let i = 1, n = keys.length; i < n; ++i) { - groups2 = groups2.flatMap((g) => g.pop().map(([key, value]) => [...g, key, value])); - } - return groups2; -} -function flatGroup(values, ...keys) { - return flatten(groups(values, ...keys), keys); -} -function flatRollup(values, reduce2, ...keys) { - return flatten(rollups(values, reduce2, ...keys), keys); -} -function rollup(values, reduce2, ...keys) { - return nest(values, identity, reduce2, keys); -} -function rollups(values, reduce2, ...keys) { - return nest(values, Array.from, reduce2, keys); -} -function index(values, ...keys) { - return nest(values, identity, unique, keys); -} -function indexes(values, ...keys) { - return nest(values, Array.from, unique, keys); -} -function unique(values) { - if (values.length !== 1) - throw new Error("duplicate key"); - return values[0]; -} -function nest(values, map2, reduce2, keys) { - return function regroup(values2, i) { - if (i >= keys.length) - return reduce2(values2); - const groups2 = new InternMap(); - const keyof = keys[i++]; - let index2 = -1; - for (const value of values2) { - const key = keyof(value, ++index2, values2); - const group2 = groups2.get(key); - if (group2) - group2.push(value); - else - groups2.set(key, [value]); - } - for (const [key, values3] of groups2) { - groups2.set(key, regroup(values3, i)); - } - return map2(groups2); - }(values, 0); -} -function permute(source, keys) { - return Array.from(keys, (key) => source[key]); -} -function sort(values, ...F) { - if (typeof values[Symbol.iterator] !== "function") - throw new TypeError("values is not iterable"); - values = Array.from(values); - let [f] = F; - if (f && f.length !== 2 || F.length > 1) { - const index2 = Uint32Array.from(values, (d, i) => i); - if (F.length > 1) { - F = F.map((f2) => values.map(f2)); - index2.sort((i, j) => { - for (const f2 of F) { - const c = ascendingDefined(f2[i], f2[j]); - if (c) - return c; - } - }); - } else { - f = values.map(f); - index2.sort((i, j) => ascendingDefined(f[i], f[j])); - } - return permute(values, index2); - } - return values.sort(compareDefined(f)); -} -function compareDefined(compare = ascending) { - if (compare === ascending) - return ascendingDefined; - if (typeof compare !== "function") - throw new TypeError("compare is not a function"); - return (a, b) => { - const x = compare(a, b); - if (x || x === 0) - return x; - return (compare(b, b) === 0) - (compare(a, a) === 0); - }; -} -function ascendingDefined(a, b) { - return (a == null || !(a >= a)) - (b == null || !(b >= b)) || (a < b ? -1 : a > b ? 1 : 0); -} -function groupSort(values, reduce2, key) { - return (reduce2.length !== 2 ? sort(rollup(values, reduce2, key), ([ak, av], [bk, bv]) => ascending(av, bv) || ascending(ak, bk)) : sort(group(values, key), ([ak, av], [bk, bv]) => reduce2(av, bv) || ascending(ak, bk))).map(([key2]) => key2); -} -var array = Array.prototype; -var slice = array.slice; -function constant(x) { - return () => x; -} -var e10 = Math.sqrt(50), e5 = Math.sqrt(10), e2 = Math.sqrt(2); -function ticks(start, stop, count2) { - var reverse2, i = -1, n, ticks2, step; - stop = +stop, start = +start, count2 = +count2; - if (start === stop && count2 > 0) - return [start]; - if (reverse2 = stop < start) - n = start, start = stop, stop = n; - if ((step = tickIncrement(start, stop, count2)) === 0 || !isFinite(step)) - return []; - if (step > 0) { - let r0 = Math.round(start / step), r1 = Math.round(stop / step); - if (r0 * step < start) - ++r0; - if (r1 * step > stop) - --r1; - ticks2 = new Array(n = r1 - r0 + 1); - while (++i < n) - ticks2[i] = (r0 + i) * step; - } else { - step = -step; - let r0 = Math.round(start * step), r1 = Math.round(stop * step); - if (r0 / step < start) - ++r0; - if (r1 / step > stop) - --r1; - ticks2 = new Array(n = r1 - r0 + 1); - while (++i < n) - ticks2[i] = (r0 + i) / step; - } - if (reverse2) - ticks2.reverse(); - return ticks2; -} -function tickIncrement(start, stop, count2) { - var step = (stop - start) / Math.max(0, count2), power = Math.floor(Math.log(step) / Math.LN10), error = step / Math.pow(10, power); - return power >= 0 ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power) : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1); -} -function tickStep(start, stop, count2) { - var step0 = Math.abs(stop - start) / Math.max(0, count2), step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), error = step0 / step1; - if (error >= e10) - step1 *= 10; - else if (error >= e5) - step1 *= 5; - else if (error >= e2) - step1 *= 2; - return stop < start ? -step1 : step1; -} -function nice(start, stop, count2) { - let prestep; - while (true) { - const step = tickIncrement(start, stop, count2); - if (step === prestep || step === 0 || !isFinite(step)) { - return [start, stop]; - } else if (step > 0) { - start = Math.floor(start / step) * step; - stop = Math.ceil(stop / step) * step; - } else if (step < 0) { - start = Math.ceil(start * step) / step; - stop = Math.floor(stop * step) / step; - } - prestep = step; - } -} -function thresholdSturges(values) { - return Math.ceil(Math.log(count(values)) / Math.LN2) + 1; -} -function bin() { - var value = identity, domain = extent, threshold = thresholdSturges; - function histogram(data) { - if (!Array.isArray(data)) - data = Array.from(data); - var i, n = data.length, x, step, values = new Array(n); - for (i = 0; i < n; ++i) { - values[i] = value(data[i], i, data); - } - var xz = domain(values), x0 = xz[0], x1 = xz[1], tz = threshold(values, x0, x1); - if (!Array.isArray(tz)) { - const max2 = x1, tn = +tz; - if (domain === extent) - [x0, x1] = nice(x0, x1, tn); - tz = ticks(x0, x1, tn); - if (tz[0] <= x0) - step = tickIncrement(x0, x1, tn); - if (tz[tz.length - 1] >= x1) { - if (max2 >= x1 && domain === extent) { - const step2 = tickIncrement(x0, x1, tn); - if (isFinite(step2)) { - if (step2 > 0) { - x1 = (Math.floor(x1 / step2) + 1) * step2; - } else if (step2 < 0) { - x1 = (Math.ceil(x1 * -step2) + 1) / -step2; - } - } - } else { - tz.pop(); - } - } - } - var m = tz.length; - while (tz[0] <= x0) - tz.shift(), --m; - while (tz[m - 1] > x1) - tz.pop(), --m; - var bins = new Array(m + 1), bin2; - for (i = 0; i <= m; ++i) { - bin2 = bins[i] = []; - bin2.x0 = i > 0 ? tz[i - 1] : x0; - bin2.x1 = i < m ? tz[i] : x1; - } - if (isFinite(step)) { - if (step > 0) { - for (i = 0; i < n; ++i) { - if ((x = values[i]) != null && x0 <= x && x <= x1) { - bins[Math.min(m, Math.floor((x - x0) / step))].push(data[i]); - } - } - } else if (step < 0) { - for (i = 0; i < n; ++i) { - if ((x = values[i]) != null && x0 <= x && x <= x1) { - const j = Math.floor((x0 - x) * step); - bins[Math.min(m, j + (tz[j] <= x))].push(data[i]); - } - } - } - } else { - for (i = 0; i < n; ++i) { - if ((x = values[i]) != null && x0 <= x && x <= x1) { - bins[bisectRight(tz, x, 0, m)].push(data[i]); - } - } - } - return bins; - } - histogram.value = function(_) { - return arguments.length ? (value = typeof _ === "function" ? _ : constant(_), histogram) : value; - }; - histogram.domain = function(_) { - return arguments.length ? (domain = typeof _ === "function" ? _ : constant([_[0], _[1]]), histogram) : domain; - }; - histogram.thresholds = function(_) { - return arguments.length ? (threshold = typeof _ === "function" ? _ : Array.isArray(_) ? constant(slice.call(_)) : constant(_), histogram) : threshold; - }; - return histogram; -} -function max(values, valueof) { - let max2; - if (valueof === void 0) { - for (const value of values) { - if (value != null && (max2 < value || max2 === void 0 && value >= value)) { - max2 = value; - } - } - } else { - let index2 = -1; - for (let value of values) { - if ((value = valueof(value, ++index2, values)) != null && (max2 < value || max2 === void 0 && value >= value)) { - max2 = value; - } - } - } - return max2; -} -function min(values, valueof) { - let min2; - if (valueof === void 0) { - for (const value of values) { - if (value != null && (min2 > value || min2 === void 0 && value >= value)) { - min2 = value; - } - } - } else { - let index2 = -1; - for (let value of values) { - if ((value = valueof(value, ++index2, values)) != null && (min2 > value || min2 === void 0 && value >= value)) { - min2 = value; - } - } - } - return min2; -} -function quickselect(array2, k, left = 0, right = array2.length - 1, compare) { - compare = compare === void 0 ? ascendingDefined : compareDefined(compare); - while (right > left) { - if (right - left > 600) { - const n = right - left + 1; - const m = k - left + 1; - const z = Math.log(n); - const s = 0.5 * Math.exp(2 * z / 3); - const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1); - const newLeft = Math.max(left, Math.floor(k - m * s / n + sd)); - const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd)); - quickselect(array2, k, newLeft, newRight, compare); - } - const t = array2[k]; - let i = left; - let j = right; - swap(array2, left, k); - if (compare(array2[right], t) > 0) - swap(array2, left, right); - while (i < j) { - swap(array2, i, j), ++i, --j; - while (compare(array2[i], t) < 0) - ++i; - while (compare(array2[j], t) > 0) - --j; - } - if (compare(array2[left], t) === 0) - swap(array2, left, j); - else - ++j, swap(array2, j, right); - if (j <= k) - left = j + 1; - if (k <= j) - right = j - 1; - } - return array2; -} -function swap(array2, i, j) { - const t = array2[i]; - array2[i] = array2[j]; - array2[j] = t; -} -function quantile(values, p, valueof) { - values = Float64Array.from(numbers(values, valueof)); - if (!(n = values.length)) - return; - if ((p = +p) <= 0 || n < 2) - return min(values); - if (p >= 1) - return max(values); - var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = max(quickselect(values, i0).subarray(0, i0 + 1)), value1 = min(values.subarray(i0 + 1)); - return value0 + (value1 - value0) * (i - i0); -} -function quantileSorted(values, p, valueof = number) { - if (!(n = values.length)) - return; - if ((p = +p) <= 0 || n < 2) - return +valueof(values[0], 0, values); - if (p >= 1) - return +valueof(values[n - 1], n - 1, values); - var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = +valueof(values[i0], i0, values), value1 = +valueof(values[i0 + 1], i0 + 1, values); - return value0 + (value1 - value0) * (i - i0); -} -function thresholdFreedmanDiaconis(values, min2, max2) { - return Math.ceil((max2 - min2) / (2 * (quantile(values, 0.75) - quantile(values, 0.25)) * Math.pow(count(values), -1 / 3))); -} -function thresholdScott(values, min2, max2) { - return Math.ceil((max2 - min2) * Math.cbrt(count(values)) / (3.49 * deviation(values))); -} -function maxIndex(values, valueof) { - let max2; - let maxIndex2 = -1; - let index2 = -1; - if (valueof === void 0) { - for (const value of values) { - ++index2; - if (value != null && (max2 < value || max2 === void 0 && value >= value)) { - max2 = value, maxIndex2 = index2; - } - } - } else { - for (let value of values) { - if ((value = valueof(value, ++index2, values)) != null && (max2 < value || max2 === void 0 && value >= value)) { - max2 = value, maxIndex2 = index2; - } - } - } - return maxIndex2; -} -function mean(values, valueof) { - let count2 = 0; - let sum2 = 0; - if (valueof === void 0) { - for (let value of values) { - if (value != null && (value = +value) >= value) { - ++count2, sum2 += value; - } - } - } else { - let index2 = -1; - for (let value of values) { - if ((value = valueof(value, ++index2, values)) != null && (value = +value) >= value) { - ++count2, sum2 += value; - } - } - } - if (count2) - return sum2 / count2; -} -function median(values, valueof) { - return quantile(values, 0.5, valueof); -} -function* flatten$1(arrays) { - for (const array2 of arrays) { - yield* array2; - } -} -function merge(arrays) { - return Array.from(flatten$1(arrays)); -} -function minIndex(values, valueof) { - let min2; - let minIndex2 = -1; - let index2 = -1; - if (valueof === void 0) { - for (const value of values) { - ++index2; - if (value != null && (min2 > value || min2 === void 0 && value >= value)) { - min2 = value, minIndex2 = index2; - } - } - } else { - for (let value of values) { - if ((value = valueof(value, ++index2, values)) != null && (min2 > value || min2 === void 0 && value >= value)) { - min2 = value, minIndex2 = index2; - } - } - } - return minIndex2; -} -function mode(values, valueof) { - const counts = new InternMap(); - if (valueof === void 0) { - for (let value of values) { - if (value != null && value >= value) { - counts.set(value, (counts.get(value) || 0) + 1); - } - } - } else { - let index2 = -1; - for (let value of values) { - if ((value = valueof(value, ++index2, values)) != null && value >= value) { - counts.set(value, (counts.get(value) || 0) + 1); - } - } - } - let modeValue; - let modeCount = 0; - for (const [value, count2] of counts) { - if (count2 > modeCount) { - modeCount = count2; - modeValue = value; - } - } - return modeValue; -} -function pairs(values, pairof = pair) { - const pairs2 = []; - let previous; - let first = false; - for (const value of values) { - if (first) - pairs2.push(pairof(previous, value)); - previous = value; - first = true; - } - return pairs2; -} -function pair(a, b) { - return [a, b]; -} -function range(start, stop, step) { - start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step; - var i = -1, n = Math.max(0, Math.ceil((stop - start) / step)) | 0, range2 = new Array(n); - while (++i < n) { - range2[i] = start + i * step; - } - return range2; -} -function rank(values, valueof = ascending) { - if (typeof values[Symbol.iterator] !== "function") - throw new TypeError("values is not iterable"); - let V = Array.from(values); - const R = new Float64Array(V.length); - if (valueof.length !== 2) - V = V.map(valueof), valueof = ascending; - const compareIndex = (i, j) => valueof(V[i], V[j]); - let k, r; - Uint32Array.from(V, (_, i) => i).sort(valueof === ascending ? (i, j) => ascendingDefined(V[i], V[j]) : compareDefined(compareIndex)).forEach((j, i) => { - const c = compareIndex(j, k === void 0 ? j : k); - if (c >= 0) { - if (k === void 0 || c > 0) - k = j, r = i; - R[j] = r; - } else { - R[j] = NaN; - } - }); - return R; -} -function least(values, compare = ascending) { - let min2; - let defined = false; - if (compare.length === 1) { - let minValue; - for (const element of values) { - const value = compare(element); - if (defined ? ascending(value, minValue) < 0 : ascending(value, value) === 0) { - min2 = element; - minValue = value; - defined = true; - } - } - } else { - for (const value of values) { - if (defined ? compare(value, min2) < 0 : compare(value, value) === 0) { - min2 = value; - defined = true; - } - } - } - return min2; -} -function leastIndex(values, compare = ascending) { - if (compare.length === 1) - return minIndex(values, compare); - let minValue; - let min2 = -1; - let index2 = -1; - for (const value of values) { - ++index2; - if (min2 < 0 ? compare(value, value) === 0 : compare(value, minValue) < 0) { - minValue = value; - min2 = index2; - } - } - return min2; -} -function greatest(values, compare = ascending) { - let max2; - let defined = false; - if (compare.length === 1) { - let maxValue; - for (const element of values) { - const value = compare(element); - if (defined ? ascending(value, maxValue) > 0 : ascending(value, value) === 0) { - max2 = element; - maxValue = value; - defined = true; - } - } - } else { - for (const value of values) { - if (defined ? compare(value, max2) > 0 : compare(value, value) === 0) { - max2 = value; - defined = true; - } - } - } - return max2; -} -function greatestIndex(values, compare = ascending) { - if (compare.length === 1) - return maxIndex(values, compare); - let maxValue; - let max2 = -1; - let index2 = -1; - for (const value of values) { - ++index2; - if (max2 < 0 ? compare(value, value) === 0 : compare(value, maxValue) > 0) { - maxValue = value; - max2 = index2; - } - } - return max2; -} -function scan(values, compare) { - const index2 = leastIndex(values, compare); - return index2 < 0 ? void 0 : index2; -} -var shuffle = shuffler(Math.random); -function shuffler(random) { - return function shuffle2(array2, i0 = 0, i1 = array2.length) { - let m = i1 - (i0 = +i0); - while (m) { - const i = random() * m-- | 0, t = array2[m + i0]; - array2[m + i0] = array2[i + i0]; - array2[i + i0] = t; - } - return array2; - }; -} -function sum(values, valueof) { - let sum2 = 0; - if (valueof === void 0) { - for (let value of values) { - if (value = +value) { - sum2 += value; - } - } - } else { - let index2 = -1; - for (let value of values) { - if (value = +valueof(value, ++index2, values)) { - sum2 += value; - } - } - } - return sum2; -} -function transpose(matrix) { - if (!(n = matrix.length)) - return []; - for (var i = -1, m = min(matrix, length$1), transpose2 = new Array(m); ++i < m; ) { - for (var j = -1, n, row = transpose2[i] = new Array(n); ++j < n; ) { - row[j] = matrix[j][i]; - } - } - return transpose2; -} -function length$1(d) { - return d.length; -} -function zip() { - return transpose(arguments); -} -function every(values, test) { - if (typeof test !== "function") - throw new TypeError("test is not a function"); - let index2 = -1; - for (const value of values) { - if (!test(value, ++index2, values)) { - return false; - } - } - return true; -} -function some(values, test) { - if (typeof test !== "function") - throw new TypeError("test is not a function"); - let index2 = -1; - for (const value of values) { - if (test(value, ++index2, values)) { - return true; - } - } - return false; -} -function filter(values, test) { - if (typeof test !== "function") - throw new TypeError("test is not a function"); - const array2 = []; - let index2 = -1; - for (const value of values) { - if (test(value, ++index2, values)) { - array2.push(value); - } - } - return array2; -} -function map(values, mapper) { - if (typeof values[Symbol.iterator] !== "function") - throw new TypeError("values is not iterable"); - if (typeof mapper !== "function") - throw new TypeError("mapper is not a function"); - return Array.from(values, (value, index2) => mapper(value, index2, values)); -} -function reduce(values, reducer2, value) { - if (typeof reducer2 !== "function") - throw new TypeError("reducer is not a function"); - const iterator = values[Symbol.iterator](); - let done, next, index2 = -1; - if (arguments.length < 3) { - ({done, value} = iterator.next()); - if (done) - return; - ++index2; - } - while ({done, value: next} = iterator.next(), !done) { - value = reducer2(value, next, ++index2, values); - } - return value; -} -function reverse(values) { - if (typeof values[Symbol.iterator] !== "function") - throw new TypeError("values is not iterable"); - return Array.from(values).reverse(); -} -function difference(values, ...others) { - values = new InternSet(values); - for (const other of others) { - for (const value of other) { - values.delete(value); - } - } - return values; -} -function disjoint(values, other) { - const iterator = other[Symbol.iterator](), set2 = new InternSet(); - for (const v of values) { - if (set2.has(v)) - return false; - let value, done; - while ({value, done} = iterator.next()) { - if (done) - break; - if (Object.is(v, value)) - return false; - set2.add(value); - } - } - return true; -} -function intersection(values, ...others) { - values = new InternSet(values); - others = others.map(set); - out: - for (const value of values) { - for (const other of others) { - if (!other.has(value)) { - values.delete(value); - continue out; - } - } - } - return values; -} -function set(values) { - return values instanceof InternSet ? values : new InternSet(values); -} -function superset(values, other) { - const iterator = values[Symbol.iterator](), set2 = new Set(); - for (const o of other) { - const io = intern(o); - if (set2.has(io)) - continue; - let value, done; - while ({value, done} = iterator.next()) { - if (done) - return false; - const ivalue = intern(value); - set2.add(ivalue); - if (Object.is(io, ivalue)) - break; - } - } - return true; -} -function intern(value) { - return value !== null && typeof value === "object" ? value.valueOf() : value; -} -function subset(values, other) { - return superset(other, values); -} -function union(...others) { - const set2 = new InternSet(); - for (const other of others) { - for (const o of other) { - set2.add(o); - } - } - return set2; -} -export {Adder, ascending, bin, bisectRight as bisect, bisectCenter, bisectLeft, bisectRight, bisector, count, cross, cumsum, descending, deviation, difference, disjoint, every, extent, fcumsum, filter, flatGroup, flatRollup, fsum, greatest, greatestIndex, group, groupSort, groups, bin as histogram, index, indexes, intersection, least, leastIndex, map, max, maxIndex, mean, median, merge, min, minIndex, mode, nice, pairs, permute, quantile, quantileSorted, quickselect, range, rank, reduce, reverse, rollup, rollups, scan, shuffle, shuffler, some, sort, subset, sum, superset, thresholdFreedmanDiaconis, thresholdScott, thresholdSturges, tickIncrement, tickStep, ticks, transpose, union, variance, zip}; -export default null; diff --git a/web/client/deps/d3/d3-axis.js b/web/client/deps/d3/d3-axis.js deleted file mode 100644 index 3b0824d3..00000000 --- a/web/client/deps/d3/d3-axis.js +++ /dev/null @@ -1,101 +0,0 @@ -function identity(x) { - return x; -} -var top = 1, right = 2, bottom = 3, left = 4, epsilon = 1e-6; -function translateX(x) { - return "translate(" + x + ",0)"; -} -function translateY(y) { - return "translate(0," + y + ")"; -} -function number(scale) { - return (d) => +scale(d); -} -function center(scale, offset) { - offset = Math.max(0, scale.bandwidth() - offset * 2) / 2; - if (scale.round()) - offset = Math.round(offset); - return (d) => +scale(d) + offset; -} -function entering() { - return !this.__axis; -} -function axis(orient, scale) { - var tickArguments = [], tickValues = null, tickFormat = null, tickSizeInner = 6, tickSizeOuter = 6, tickPadding = 3, offset = typeof window !== "undefined" && window.devicePixelRatio > 1 ? 0 : 0.5, k = orient === top || orient === left ? -1 : 1, x = orient === left || orient === right ? "x" : "y", transform = orient === top || orient === bottom ? translateX : translateY; - function axis2(context) { - var values = tickValues == null ? scale.ticks ? scale.ticks.apply(scale, tickArguments) : scale.domain() : tickValues, format = tickFormat == null ? scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments) : identity : tickFormat, spacing = Math.max(tickSizeInner, 0) + tickPadding, range = scale.range(), range0 = +range[0] + offset, range1 = +range[range.length - 1] + offset, position = (scale.bandwidth ? center : number)(scale.copy(), offset), selection = context.selection ? context.selection() : context, path = selection.selectAll(".domain").data([null]), tick = selection.selectAll(".tick").data(values, scale).order(), tickExit = tick.exit(), tickEnter = tick.enter().append("g").attr("class", "tick"), line = tick.select("line"), text = tick.select("text"); - path = path.merge(path.enter().insert("path", ".tick").attr("class", "domain").attr("stroke", "currentColor")); - tick = tick.merge(tickEnter); - line = line.merge(tickEnter.append("line").attr("stroke", "currentColor").attr(x + "2", k * tickSizeInner)); - text = text.merge(tickEnter.append("text").attr("fill", "currentColor").attr(x, k * spacing).attr("dy", orient === top ? "0em" : orient === bottom ? "0.71em" : "0.32em")); - if (context !== selection) { - path = path.transition(context); - tick = tick.transition(context); - line = line.transition(context); - text = text.transition(context); - tickExit = tickExit.transition(context).attr("opacity", epsilon).attr("transform", function(d) { - return isFinite(d = position(d)) ? transform(d + offset) : this.getAttribute("transform"); - }); - tickEnter.attr("opacity", epsilon).attr("transform", function(d) { - var p = this.parentNode.__axis; - return transform((p && isFinite(p = p(d)) ? p : position(d)) + offset); - }); - } - tickExit.remove(); - path.attr("d", orient === left || orient === right ? tickSizeOuter ? "M" + k * tickSizeOuter + "," + range0 + "H" + offset + "V" + range1 + "H" + k * tickSizeOuter : "M" + offset + "," + range0 + "V" + range1 : tickSizeOuter ? "M" + range0 + "," + k * tickSizeOuter + "V" + offset + "H" + range1 + "V" + k * tickSizeOuter : "M" + range0 + "," + offset + "H" + range1); - tick.attr("opacity", 1).attr("transform", function(d) { - return transform(position(d) + offset); - }); - line.attr(x + "2", k * tickSizeInner); - text.attr(x, k * spacing).text(format); - selection.filter(entering).attr("fill", "none").attr("font-size", 10).attr("font-family", "sans-serif").attr("text-anchor", orient === right ? "start" : orient === left ? "end" : "middle"); - selection.each(function() { - this.__axis = position; - }); - } - axis2.scale = function(_) { - return arguments.length ? (scale = _, axis2) : scale; - }; - axis2.ticks = function() { - return tickArguments = Array.from(arguments), axis2; - }; - axis2.tickArguments = function(_) { - return arguments.length ? (tickArguments = _ == null ? [] : Array.from(_), axis2) : tickArguments.slice(); - }; - axis2.tickValues = function(_) { - return arguments.length ? (tickValues = _ == null ? null : Array.from(_), axis2) : tickValues && tickValues.slice(); - }; - axis2.tickFormat = function(_) { - return arguments.length ? (tickFormat = _, axis2) : tickFormat; - }; - axis2.tickSize = function(_) { - return arguments.length ? (tickSizeInner = tickSizeOuter = +_, axis2) : tickSizeInner; - }; - axis2.tickSizeInner = function(_) { - return arguments.length ? (tickSizeInner = +_, axis2) : tickSizeInner; - }; - axis2.tickSizeOuter = function(_) { - return arguments.length ? (tickSizeOuter = +_, axis2) : tickSizeOuter; - }; - axis2.tickPadding = function(_) { - return arguments.length ? (tickPadding = +_, axis2) : tickPadding; - }; - axis2.offset = function(_) { - return arguments.length ? (offset = +_, axis2) : offset; - }; - return axis2; -} -function axisTop(scale) { - return axis(top, scale); -} -function axisRight(scale) { - return axis(right, scale); -} -function axisBottom(scale) { - return axis(bottom, scale); -} -function axisLeft(scale) { - return axis(left, scale); -} -export {axisBottom, axisLeft, axisRight, axisTop}; -export default null; diff --git a/web/client/deps/d3/d3-brush.js b/web/client/deps/d3/d3-brush.js deleted file mode 100644 index f44bc097..00000000 --- a/web/client/deps/d3/d3-brush.js +++ /dev/null @@ -1,552 +0,0 @@ -import {dispatch} from "./d3-dispatch.js"; -import {dragDisable, dragEnable} from "./d3-drag.js"; -import {interpolate} from "./d3-interpolate.js"; -import {select, pointer} from "./d3-selection.js"; -import {interrupt} from "./d3-transition.js"; -var constant = (x) => () => x; -function BrushEvent(type2, { - sourceEvent, - target, - selection, - mode, - dispatch: dispatch2 -}) { - Object.defineProperties(this, { - type: {value: type2, enumerable: true, configurable: true}, - sourceEvent: {value: sourceEvent, enumerable: true, configurable: true}, - target: {value: target, enumerable: true, configurable: true}, - selection: {value: selection, enumerable: true, configurable: true}, - mode: {value: mode, enumerable: true, configurable: true}, - _: {value: dispatch2} - }); -} -function nopropagation(event) { - event.stopImmediatePropagation(); -} -function noevent(event) { - event.preventDefault(); - event.stopImmediatePropagation(); -} -var MODE_DRAG = {name: "drag"}, MODE_SPACE = {name: "space"}, MODE_HANDLE = {name: "handle"}, MODE_CENTER = {name: "center"}; -const {abs, max, min} = Math; -function number1(e) { - return [+e[0], +e[1]]; -} -function number2(e) { - return [number1(e[0]), number1(e[1])]; -} -var X = { - name: "x", - handles: ["w", "e"].map(type), - input: function(x, e) { - return x == null ? null : [[+x[0], e[0][1]], [+x[1], e[1][1]]]; - }, - output: function(xy) { - return xy && [xy[0][0], xy[1][0]]; - } -}; -var Y = { - name: "y", - handles: ["n", "s"].map(type), - input: function(y, e) { - return y == null ? null : [[e[0][0], +y[0]], [e[1][0], +y[1]]]; - }, - output: function(xy) { - return xy && [xy[0][1], xy[1][1]]; - } -}; -var XY = { - name: "xy", - handles: ["n", "w", "e", "s", "nw", "ne", "sw", "se"].map(type), - input: function(xy) { - return xy == null ? null : number2(xy); - }, - output: function(xy) { - return xy; - } -}; -var cursors = { - overlay: "crosshair", - selection: "move", - n: "ns-resize", - e: "ew-resize", - s: "ns-resize", - w: "ew-resize", - nw: "nwse-resize", - ne: "nesw-resize", - se: "nwse-resize", - sw: "nesw-resize" -}; -var flipX = { - e: "w", - w: "e", - nw: "ne", - ne: "nw", - se: "sw", - sw: "se" -}; -var flipY = { - n: "s", - s: "n", - nw: "sw", - ne: "se", - se: "ne", - sw: "nw" -}; -var signsX = { - overlay: 1, - selection: 1, - n: null, - e: 1, - s: null, - w: -1, - nw: -1, - ne: 1, - se: 1, - sw: -1 -}; -var signsY = { - overlay: 1, - selection: 1, - n: -1, - e: null, - s: 1, - w: null, - nw: -1, - ne: -1, - se: 1, - sw: 1 -}; -function type(t) { - return {type: t}; -} -function defaultFilter(event) { - return !event.ctrlKey && !event.button; -} -function defaultExtent() { - var svg = this.ownerSVGElement || this; - if (svg.hasAttribute("viewBox")) { - svg = svg.viewBox.baseVal; - return [[svg.x, svg.y], [svg.x + svg.width, svg.y + svg.height]]; - } - return [[0, 0], [svg.width.baseVal.value, svg.height.baseVal.value]]; -} -function defaultTouchable() { - return navigator.maxTouchPoints || "ontouchstart" in this; -} -function local(node) { - while (!node.__brush) - if (!(node = node.parentNode)) - return; - return node.__brush; -} -function empty(extent) { - return extent[0][0] === extent[1][0] || extent[0][1] === extent[1][1]; -} -function brushSelection(node) { - var state = node.__brush; - return state ? state.dim.output(state.selection) : null; -} -function brushX() { - return brush$1(X); -} -function brushY() { - return brush$1(Y); -} -function brush() { - return brush$1(XY); -} -function brush$1(dim) { - var extent = defaultExtent, filter = defaultFilter, touchable = defaultTouchable, keys = true, listeners = dispatch("start", "brush", "end"), handleSize = 6, touchending; - function brush2(group) { - var overlay = group.property("__brush", initialize).selectAll(".overlay").data([type("overlay")]); - overlay.enter().append("rect").attr("class", "overlay").attr("pointer-events", "all").attr("cursor", cursors.overlay).merge(overlay).each(function() { - var extent2 = local(this).extent; - select(this).attr("x", extent2[0][0]).attr("y", extent2[0][1]).attr("width", extent2[1][0] - extent2[0][0]).attr("height", extent2[1][1] - extent2[0][1]); - }); - group.selectAll(".selection").data([type("selection")]).enter().append("rect").attr("class", "selection").attr("cursor", cursors.selection).attr("fill", "#777").attr("fill-opacity", 0.3).attr("stroke", "#fff").attr("shape-rendering", "crispEdges"); - var handle = group.selectAll(".handle").data(dim.handles, function(d) { - return d.type; - }); - handle.exit().remove(); - handle.enter().append("rect").attr("class", function(d) { - return "handle handle--" + d.type; - }).attr("cursor", function(d) { - return cursors[d.type]; - }); - group.each(redraw).attr("fill", "none").attr("pointer-events", "all").on("mousedown.brush", started).filter(touchable).on("touchstart.brush", started).on("touchmove.brush", touchmoved).on("touchend.brush touchcancel.brush", touchended).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)"); - } - brush2.move = function(group, selection, event) { - if (group.tween) { - group.on("start.brush", function(event2) { - emitter(this, arguments).beforestart().start(event2); - }).on("interrupt.brush end.brush", function(event2) { - emitter(this, arguments).end(event2); - }).tween("brush", function() { - var that = this, state = that.__brush, emit = emitter(that, arguments), selection0 = state.selection, selection1 = dim.input(typeof selection === "function" ? selection.apply(this, arguments) : selection, state.extent), i = interpolate(selection0, selection1); - function tween(t) { - state.selection = t === 1 && selection1 === null ? null : i(t); - redraw.call(that); - emit.brush(); - } - return selection0 !== null && selection1 !== null ? tween : tween(1); - }); - } else { - group.each(function() { - var that = this, args = arguments, state = that.__brush, selection1 = dim.input(typeof selection === "function" ? selection.apply(that, args) : selection, state.extent), emit = emitter(that, args).beforestart(); - interrupt(that); - state.selection = selection1 === null ? null : selection1; - redraw.call(that); - emit.start(event).brush(event).end(event); - }); - } - }; - brush2.clear = function(group, event) { - brush2.move(group, null, event); - }; - function redraw() { - var group = select(this), selection = local(this).selection; - if (selection) { - group.selectAll(".selection").style("display", null).attr("x", selection[0][0]).attr("y", selection[0][1]).attr("width", selection[1][0] - selection[0][0]).attr("height", selection[1][1] - selection[0][1]); - group.selectAll(".handle").style("display", null).attr("x", function(d) { - return d.type[d.type.length - 1] === "e" ? selection[1][0] - handleSize / 2 : selection[0][0] - handleSize / 2; - }).attr("y", function(d) { - return d.type[0] === "s" ? selection[1][1] - handleSize / 2 : selection[0][1] - handleSize / 2; - }).attr("width", function(d) { - return d.type === "n" || d.type === "s" ? selection[1][0] - selection[0][0] + handleSize : handleSize; - }).attr("height", function(d) { - return d.type === "e" || d.type === "w" ? selection[1][1] - selection[0][1] + handleSize : handleSize; - }); - } else { - group.selectAll(".selection,.handle").style("display", "none").attr("x", null).attr("y", null).attr("width", null).attr("height", null); - } - } - function emitter(that, args, clean) { - var emit = that.__brush.emitter; - return emit && (!clean || !emit.clean) ? emit : new Emitter(that, args, clean); - } - function Emitter(that, args, clean) { - this.that = that; - this.args = args; - this.state = that.__brush; - this.active = 0; - this.clean = clean; - } - Emitter.prototype = { - beforestart: function() { - if (++this.active === 1) - this.state.emitter = this, this.starting = true; - return this; - }, - start: function(event, mode) { - if (this.starting) - this.starting = false, this.emit("start", event, mode); - else - this.emit("brush", event); - return this; - }, - brush: function(event, mode) { - this.emit("brush", event, mode); - return this; - }, - end: function(event, mode) { - if (--this.active === 0) - delete this.state.emitter, this.emit("end", event, mode); - return this; - }, - emit: function(type2, event, mode) { - var d = select(this.that).datum(); - listeners.call(type2, this.that, new BrushEvent(type2, { - sourceEvent: event, - target: brush2, - selection: dim.output(this.state.selection), - mode, - dispatch: listeners - }), d); - } - }; - function started(event) { - if (touchending && !event.touches) - return; - if (!filter.apply(this, arguments)) - return; - var that = this, type2 = event.target.__data__.type, mode = (keys && event.metaKey ? type2 = "overlay" : type2) === "selection" ? MODE_DRAG : keys && event.altKey ? MODE_CENTER : MODE_HANDLE, signX = dim === Y ? null : signsX[type2], signY = dim === X ? null : signsY[type2], state = local(that), extent2 = state.extent, selection = state.selection, W = extent2[0][0], w0, w1, N = extent2[0][1], n0, n1, E = extent2[1][0], e0, e1, S = extent2[1][1], s0, s1, dx = 0, dy = 0, moving, shifting = signX && signY && keys && event.shiftKey, lockX, lockY, points = Array.from(event.touches || [event], (t) => { - const i = t.identifier; - t = pointer(t, that); - t.point0 = t.slice(); - t.identifier = i; - return t; - }); - interrupt(that); - var emit = emitter(that, arguments, true).beforestart(); - if (type2 === "overlay") { - if (selection) - moving = true; - const pts = [points[0], points[1] || points[0]]; - state.selection = selection = [[ - w0 = dim === Y ? W : min(pts[0][0], pts[1][0]), - n0 = dim === X ? N : min(pts[0][1], pts[1][1]) - ], [ - e0 = dim === Y ? E : max(pts[0][0], pts[1][0]), - s0 = dim === X ? S : max(pts[0][1], pts[1][1]) - ]]; - if (points.length > 1) - move(event); - } else { - w0 = selection[0][0]; - n0 = selection[0][1]; - e0 = selection[1][0]; - s0 = selection[1][1]; - } - w1 = w0; - n1 = n0; - e1 = e0; - s1 = s0; - var group = select(that).attr("pointer-events", "none"); - var overlay = group.selectAll(".overlay").attr("cursor", cursors[type2]); - if (event.touches) { - emit.moved = moved; - emit.ended = ended; - } else { - var view = select(event.view).on("mousemove.brush", moved, true).on("mouseup.brush", ended, true); - if (keys) - view.on("keydown.brush", keydowned, true).on("keyup.brush", keyupped, true); - dragDisable(event.view); - } - redraw.call(that); - emit.start(event, mode.name); - function moved(event2) { - for (const p of event2.changedTouches || [event2]) { - for (const d of points) - if (d.identifier === p.identifier) - d.cur = pointer(p, that); - } - if (shifting && !lockX && !lockY && points.length === 1) { - const point = points[0]; - if (abs(point.cur[0] - point[0]) > abs(point.cur[1] - point[1])) - lockY = true; - else - lockX = true; - } - for (const point of points) - if (point.cur) - point[0] = point.cur[0], point[1] = point.cur[1]; - moving = true; - noevent(event2); - move(event2); - } - function move(event2) { - const point = points[0], point0 = point.point0; - var t; - dx = point[0] - point0[0]; - dy = point[1] - point0[1]; - switch (mode) { - case MODE_SPACE: - case MODE_DRAG: { - if (signX) - dx = max(W - w0, min(E - e0, dx)), w1 = w0 + dx, e1 = e0 + dx; - if (signY) - dy = max(N - n0, min(S - s0, dy)), n1 = n0 + dy, s1 = s0 + dy; - break; - } - case MODE_HANDLE: { - if (points[1]) { - if (signX) - w1 = max(W, min(E, points[0][0])), e1 = max(W, min(E, points[1][0])), signX = 1; - if (signY) - n1 = max(N, min(S, points[0][1])), s1 = max(N, min(S, points[1][1])), signY = 1; - } else { - if (signX < 0) - dx = max(W - w0, min(E - w0, dx)), w1 = w0 + dx, e1 = e0; - else if (signX > 0) - dx = max(W - e0, min(E - e0, dx)), w1 = w0, e1 = e0 + dx; - if (signY < 0) - dy = max(N - n0, min(S - n0, dy)), n1 = n0 + dy, s1 = s0; - else if (signY > 0) - dy = max(N - s0, min(S - s0, dy)), n1 = n0, s1 = s0 + dy; - } - break; - } - case MODE_CENTER: { - if (signX) - w1 = max(W, min(E, w0 - dx * signX)), e1 = max(W, min(E, e0 + dx * signX)); - if (signY) - n1 = max(N, min(S, n0 - dy * signY)), s1 = max(N, min(S, s0 + dy * signY)); - break; - } - } - if (e1 < w1) { - signX *= -1; - t = w0, w0 = e0, e0 = t; - t = w1, w1 = e1, e1 = t; - if (type2 in flipX) - overlay.attr("cursor", cursors[type2 = flipX[type2]]); - } - if (s1 < n1) { - signY *= -1; - t = n0, n0 = s0, s0 = t; - t = n1, n1 = s1, s1 = t; - if (type2 in flipY) - overlay.attr("cursor", cursors[type2 = flipY[type2]]); - } - if (state.selection) - selection = state.selection; - if (lockX) - w1 = selection[0][0], e1 = selection[1][0]; - if (lockY) - n1 = selection[0][1], s1 = selection[1][1]; - if (selection[0][0] !== w1 || selection[0][1] !== n1 || selection[1][0] !== e1 || selection[1][1] !== s1) { - state.selection = [[w1, n1], [e1, s1]]; - redraw.call(that); - emit.brush(event2, mode.name); - } - } - function ended(event2) { - nopropagation(event2); - if (event2.touches) { - if (event2.touches.length) - return; - if (touchending) - clearTimeout(touchending); - touchending = setTimeout(function() { - touchending = null; - }, 500); - } else { - dragEnable(event2.view, moving); - view.on("keydown.brush keyup.brush mousemove.brush mouseup.brush", null); - } - group.attr("pointer-events", "all"); - overlay.attr("cursor", cursors.overlay); - if (state.selection) - selection = state.selection; - if (empty(selection)) - state.selection = null, redraw.call(that); - emit.end(event2, mode.name); - } - function keydowned(event2) { - switch (event2.keyCode) { - case 16: { - shifting = signX && signY; - break; - } - case 18: { - if (mode === MODE_HANDLE) { - if (signX) - e0 = e1 - dx * signX, w0 = w1 + dx * signX; - if (signY) - s0 = s1 - dy * signY, n0 = n1 + dy * signY; - mode = MODE_CENTER; - move(event2); - } - break; - } - case 32: { - if (mode === MODE_HANDLE || mode === MODE_CENTER) { - if (signX < 0) - e0 = e1 - dx; - else if (signX > 0) - w0 = w1 - dx; - if (signY < 0) - s0 = s1 - dy; - else if (signY > 0) - n0 = n1 - dy; - mode = MODE_SPACE; - overlay.attr("cursor", cursors.selection); - move(event2); - } - break; - } - default: - return; - } - noevent(event2); - } - function keyupped(event2) { - switch (event2.keyCode) { - case 16: { - if (shifting) { - lockX = lockY = shifting = false; - move(event2); - } - break; - } - case 18: { - if (mode === MODE_CENTER) { - if (signX < 0) - e0 = e1; - else if (signX > 0) - w0 = w1; - if (signY < 0) - s0 = s1; - else if (signY > 0) - n0 = n1; - mode = MODE_HANDLE; - move(event2); - } - break; - } - case 32: { - if (mode === MODE_SPACE) { - if (event2.altKey) { - if (signX) - e0 = e1 - dx * signX, w0 = w1 + dx * signX; - if (signY) - s0 = s1 - dy * signY, n0 = n1 + dy * signY; - mode = MODE_CENTER; - } else { - if (signX < 0) - e0 = e1; - else if (signX > 0) - w0 = w1; - if (signY < 0) - s0 = s1; - else if (signY > 0) - n0 = n1; - mode = MODE_HANDLE; - } - overlay.attr("cursor", cursors[type2]); - move(event2); - } - break; - } - default: - return; - } - noevent(event2); - } - } - function touchmoved(event) { - emitter(this, arguments).moved(event); - } - function touchended(event) { - emitter(this, arguments).ended(event); - } - function initialize() { - var state = this.__brush || {selection: null}; - state.extent = number2(extent.apply(this, arguments)); - state.dim = dim; - return state; - } - brush2.extent = function(_) { - return arguments.length ? (extent = typeof _ === "function" ? _ : constant(number2(_)), brush2) : extent; - }; - brush2.filter = function(_) { - return arguments.length ? (filter = typeof _ === "function" ? _ : constant(!!_), brush2) : filter; - }; - brush2.touchable = function(_) { - return arguments.length ? (touchable = typeof _ === "function" ? _ : constant(!!_), brush2) : touchable; - }; - brush2.handleSize = function(_) { - return arguments.length ? (handleSize = +_, brush2) : handleSize; - }; - brush2.keyModifiers = function(_) { - return arguments.length ? (keys = !!_, brush2) : keys; - }; - brush2.on = function() { - var value = listeners.on.apply(listeners, arguments); - return value === listeners ? brush2 : value; - }; - return brush2; -} -export {brush, brushSelection, brushX, brushY}; -export default null; diff --git a/web/client/deps/d3/d3-chord.js b/web/client/deps/d3/d3-chord.js deleted file mode 100644 index 672d2e2b..00000000 --- a/web/client/deps/d3/d3-chord.js +++ /dev/null @@ -1,205 +0,0 @@ -import {path} from "./d3-path.js"; -var abs = Math.abs; -var cos = Math.cos; -var sin = Math.sin; -var pi = Math.PI; -var halfPi = pi / 2; -var tau = pi * 2; -var max = Math.max; -var epsilon = 1e-12; -function range(i, j) { - return Array.from({length: j - i}, (_, k) => i + k); -} -function compareValue(compare) { - return function(a, b) { - return compare(a.source.value + a.target.value, b.source.value + b.target.value); - }; -} -function chord() { - return chord$1(false, false); -} -function chordTranspose() { - return chord$1(false, true); -} -function chordDirected() { - return chord$1(true, false); -} -function chord$1(directed, transpose) { - var padAngle = 0, sortGroups = null, sortSubgroups = null, sortChords = null; - function chord2(matrix) { - var n = matrix.length, groupSums = new Array(n), groupIndex = range(0, n), chords = new Array(n * n), groups = new Array(n), k = 0, dx; - matrix = Float64Array.from({length: n * n}, transpose ? (_, i) => matrix[i % n][i / n | 0] : (_, i) => matrix[i / n | 0][i % n]); - for (let i = 0; i < n; ++i) { - let x = 0; - for (let j = 0; j < n; ++j) - x += matrix[i * n + j] + directed * matrix[j * n + i]; - k += groupSums[i] = x; - } - k = max(0, tau - padAngle * n) / k; - dx = k ? padAngle : tau / n; - { - let x = 0; - if (sortGroups) - groupIndex.sort((a, b) => sortGroups(groupSums[a], groupSums[b])); - for (const i of groupIndex) { - const x0 = x; - if (directed) { - const subgroupIndex = range(~n + 1, n).filter((j) => j < 0 ? matrix[~j * n + i] : matrix[i * n + j]); - if (sortSubgroups) - subgroupIndex.sort((a, b) => sortSubgroups(a < 0 ? -matrix[~a * n + i] : matrix[i * n + a], b < 0 ? -matrix[~b * n + i] : matrix[i * n + b])); - for (const j of subgroupIndex) { - if (j < 0) { - const chord3 = chords[~j * n + i] || (chords[~j * n + i] = {source: null, target: null}); - chord3.target = {index: i, startAngle: x, endAngle: x += matrix[~j * n + i] * k, value: matrix[~j * n + i]}; - } else { - const chord3 = chords[i * n + j] || (chords[i * n + j] = {source: null, target: null}); - chord3.source = {index: i, startAngle: x, endAngle: x += matrix[i * n + j] * k, value: matrix[i * n + j]}; - } - } - groups[i] = {index: i, startAngle: x0, endAngle: x, value: groupSums[i]}; - } else { - const subgroupIndex = range(0, n).filter((j) => matrix[i * n + j] || matrix[j * n + i]); - if (sortSubgroups) - subgroupIndex.sort((a, b) => sortSubgroups(matrix[i * n + a], matrix[i * n + b])); - for (const j of subgroupIndex) { - let chord3; - if (i < j) { - chord3 = chords[i * n + j] || (chords[i * n + j] = {source: null, target: null}); - chord3.source = {index: i, startAngle: x, endAngle: x += matrix[i * n + j] * k, value: matrix[i * n + j]}; - } else { - chord3 = chords[j * n + i] || (chords[j * n + i] = {source: null, target: null}); - chord3.target = {index: i, startAngle: x, endAngle: x += matrix[i * n + j] * k, value: matrix[i * n + j]}; - if (i === j) - chord3.source = chord3.target; - } - if (chord3.source && chord3.target && chord3.source.value < chord3.target.value) { - const source = chord3.source; - chord3.source = chord3.target; - chord3.target = source; - } - } - groups[i] = {index: i, startAngle: x0, endAngle: x, value: groupSums[i]}; - } - x += dx; - } - } - chords = Object.values(chords); - chords.groups = groups; - return sortChords ? chords.sort(sortChords) : chords; - } - chord2.padAngle = function(_) { - return arguments.length ? (padAngle = max(0, _), chord2) : padAngle; - }; - chord2.sortGroups = function(_) { - return arguments.length ? (sortGroups = _, chord2) : sortGroups; - }; - chord2.sortSubgroups = function(_) { - return arguments.length ? (sortSubgroups = _, chord2) : sortSubgroups; - }; - chord2.sortChords = function(_) { - return arguments.length ? (_ == null ? sortChords = null : (sortChords = compareValue(_))._ = _, chord2) : sortChords && sortChords._; - }; - return chord2; -} -var slice = Array.prototype.slice; -function constant(x) { - return function() { - return x; - }; -} -function defaultSource(d) { - return d.source; -} -function defaultTarget(d) { - return d.target; -} -function defaultRadius(d) { - return d.radius; -} -function defaultStartAngle(d) { - return d.startAngle; -} -function defaultEndAngle(d) { - return d.endAngle; -} -function defaultPadAngle() { - return 0; -} -function defaultArrowheadRadius() { - return 10; -} -function ribbon(headRadius) { - var source = defaultSource, target = defaultTarget, sourceRadius = defaultRadius, targetRadius = defaultRadius, startAngle = defaultStartAngle, endAngle = defaultEndAngle, padAngle = defaultPadAngle, context = null; - function ribbon2() { - var buffer, s = source.apply(this, arguments), t = target.apply(this, arguments), ap = padAngle.apply(this, arguments) / 2, argv = slice.call(arguments), sr = +sourceRadius.apply(this, (argv[0] = s, argv)), sa0 = startAngle.apply(this, argv) - halfPi, sa1 = endAngle.apply(this, argv) - halfPi, tr = +targetRadius.apply(this, (argv[0] = t, argv)), ta0 = startAngle.apply(this, argv) - halfPi, ta1 = endAngle.apply(this, argv) - halfPi; - if (!context) - context = buffer = path(); - if (ap > epsilon) { - if (abs(sa1 - sa0) > ap * 2 + epsilon) - sa1 > sa0 ? (sa0 += ap, sa1 -= ap) : (sa0 -= ap, sa1 += ap); - else - sa0 = sa1 = (sa0 + sa1) / 2; - if (abs(ta1 - ta0) > ap * 2 + epsilon) - ta1 > ta0 ? (ta0 += ap, ta1 -= ap) : (ta0 -= ap, ta1 += ap); - else - ta0 = ta1 = (ta0 + ta1) / 2; - } - context.moveTo(sr * cos(sa0), sr * sin(sa0)); - context.arc(0, 0, sr, sa0, sa1); - if (sa0 !== ta0 || sa1 !== ta1) { - if (headRadius) { - var hr = +headRadius.apply(this, arguments), tr2 = tr - hr, ta2 = (ta0 + ta1) / 2; - context.quadraticCurveTo(0, 0, tr2 * cos(ta0), tr2 * sin(ta0)); - context.lineTo(tr * cos(ta2), tr * sin(ta2)); - context.lineTo(tr2 * cos(ta1), tr2 * sin(ta1)); - } else { - context.quadraticCurveTo(0, 0, tr * cos(ta0), tr * sin(ta0)); - context.arc(0, 0, tr, ta0, ta1); - } - } - context.quadraticCurveTo(0, 0, sr * cos(sa0), sr * sin(sa0)); - context.closePath(); - if (buffer) - return context = null, buffer + "" || null; - } - if (headRadius) - ribbon2.headRadius = function(_) { - return arguments.length ? (headRadius = typeof _ === "function" ? _ : constant(+_), ribbon2) : headRadius; - }; - ribbon2.radius = function(_) { - return arguments.length ? (sourceRadius = targetRadius = typeof _ === "function" ? _ : constant(+_), ribbon2) : sourceRadius; - }; - ribbon2.sourceRadius = function(_) { - return arguments.length ? (sourceRadius = typeof _ === "function" ? _ : constant(+_), ribbon2) : sourceRadius; - }; - ribbon2.targetRadius = function(_) { - return arguments.length ? (targetRadius = typeof _ === "function" ? _ : constant(+_), ribbon2) : targetRadius; - }; - ribbon2.startAngle = function(_) { - return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), ribbon2) : startAngle; - }; - ribbon2.endAngle = function(_) { - return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), ribbon2) : endAngle; - }; - ribbon2.padAngle = function(_) { - return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), ribbon2) : padAngle; - }; - ribbon2.source = function(_) { - return arguments.length ? (source = _, ribbon2) : source; - }; - ribbon2.target = function(_) { - return arguments.length ? (target = _, ribbon2) : target; - }; - ribbon2.context = function(_) { - return arguments.length ? (context = _ == null ? null : _, ribbon2) : context; - }; - return ribbon2; -} -function ribbon$1() { - return ribbon(); -} -function ribbonArrow() { - return ribbon(defaultArrowheadRadius); -} -export {chord, chordDirected, chordTranspose, ribbon$1 as ribbon, ribbonArrow}; -export default null; diff --git a/web/client/deps/d3/d3-color.js b/web/client/deps/d3/d3-color.js deleted file mode 100644 index 43ac154a..00000000 --- a/web/client/deps/d3/d3-color.js +++ /dev/null @@ -1,448 +0,0 @@ -function define(constructor, factory, prototype) { - constructor.prototype = factory.prototype = prototype; - prototype.constructor = constructor; -} -function extend(parent, definition) { - var prototype = Object.create(parent.prototype); - for (var key in definition) - prototype[key] = definition[key]; - return prototype; -} -function Color() { -} -var darker = 0.7; -var brighter = 1 / darker; -var reI = "\\s*([+-]?\\d+)\\s*", reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*", reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*", reHex = /^#([0-9a-f]{3,8})$/, reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$"), reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$"), reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$"), reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$"), reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$"), reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$"); -var named = { - 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 -}; -define(Color, color, { - copy: function(channels) { - return Object.assign(new this.constructor(), this, channels); - }, - displayable: function() { - return this.rgb().displayable(); - }, - hex: color_formatHex, - formatHex: color_formatHex, - formatHsl: color_formatHsl, - formatRgb: color_formatRgb, - toString: color_formatRgb -}); -function color_formatHex() { - return this.rgb().formatHex(); -} -function color_formatHsl() { - return hslConvert(this).formatHsl(); -} -function color_formatRgb() { - return this.rgb().formatRgb(); -} -function color(format) { - var m, l; - format = (format + "").trim().toLowerCase(); - return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) : l === 3 ? new Rgb(m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, (m & 15) << 4 | m & 15, 1) : l === 8 ? rgba(m >> 24 & 255, m >> 16 & 255, m >> 8 & 255, (m & 255) / 255) : l === 4 ? rgba(m >> 12 & 15 | m >> 8 & 240, m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, ((m & 15) << 4 | m & 15) / 255) : null) : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) : named.hasOwnProperty(format) ? rgbn(named[format]) : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null; -} -function rgbn(n) { - return new Rgb(n >> 16 & 255, n >> 8 & 255, n & 255, 1); -} -function rgba(r, g, b, a) { - if (a <= 0) - r = g = b = NaN; - return new Rgb(r, g, b, a); -} -function rgbConvert(o) { - if (!(o instanceof Color)) - o = color(o); - if (!o) - return new Rgb(); - o = o.rgb(); - return new Rgb(o.r, o.g, o.b, o.opacity); -} -function rgb(r, g, b, opacity) { - return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity); -} -function Rgb(r, g, b, opacity) { - this.r = +r; - this.g = +g; - this.b = +b; - this.opacity = +opacity; -} -define(Rgb, rgb, extend(Color, { - brighter: function(k) { - k = k == null ? brighter : Math.pow(brighter, k); - return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); - }, - darker: function(k) { - k = k == null ? darker : Math.pow(darker, k); - return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); - }, - rgb: function() { - return this; - }, - displayable: function() { - return -0.5 <= this.r && this.r < 255.5 && (-0.5 <= this.g && this.g < 255.5) && (-0.5 <= this.b && this.b < 255.5) && (0 <= this.opacity && this.opacity <= 1); - }, - hex: rgb_formatHex, - formatHex: rgb_formatHex, - formatRgb: rgb_formatRgb, - toString: rgb_formatRgb -})); -function rgb_formatHex() { - return "#" + hex(this.r) + hex(this.g) + hex(this.b); -} -function rgb_formatRgb() { - var a = this.opacity; - a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a)); - return (a === 1 ? "rgb(" : "rgba(") + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.b) || 0)) + (a === 1 ? ")" : ", " + a + ")"); -} -function hex(value) { - value = Math.max(0, Math.min(255, Math.round(value) || 0)); - return (value < 16 ? "0" : "") + value.toString(16); -} -function hsla(h, s, l, a) { - if (a <= 0) - h = s = l = NaN; - else if (l <= 0 || l >= 1) - h = s = NaN; - else if (s <= 0) - h = NaN; - return new Hsl(h, s, l, a); -} -function hslConvert(o) { - if (o instanceof Hsl) - return new Hsl(o.h, o.s, o.l, o.opacity); - if (!(o instanceof Color)) - o = color(o); - if (!o) - return new Hsl(); - if (o instanceof Hsl) - return o; - o = o.rgb(); - var r = o.r / 255, g = o.g / 255, b = o.b / 255, min = Math.min(r, g, b), max = Math.max(r, g, b), h = NaN, s = max - min, l = (max + min) / 2; - if (s) { - if (r === max) - h = (g - b) / s + (g < b) * 6; - else if (g === max) - h = (b - r) / s + 2; - else - h = (r - g) / s + 4; - s /= l < 0.5 ? max + min : 2 - max - min; - h *= 60; - } else { - s = l > 0 && l < 1 ? 0 : h; - } - return new Hsl(h, s, l, o.opacity); -} -function hsl(h, s, l, opacity) { - return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity); -} -function Hsl(h, s, l, opacity) { - this.h = +h; - this.s = +s; - this.l = +l; - this.opacity = +opacity; -} -define(Hsl, hsl, extend(Color, { - brighter: function(k) { - k = k == null ? brighter : Math.pow(brighter, k); - return new Hsl(this.h, this.s, this.l * k, this.opacity); - }, - darker: function(k) { - k = k == null ? darker : Math.pow(darker, k); - return new Hsl(this.h, this.s, this.l * k, this.opacity); - }, - rgb: function() { - var h = this.h % 360 + (this.h < 0) * 360, s = isNaN(h) || isNaN(this.s) ? 0 : this.s, l = this.l, m2 = l + (l < 0.5 ? l : 1 - l) * s, m1 = 2 * l - m2; - return new Rgb(hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), hsl2rgb(h, m1, m2), hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), 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); - }, - formatHsl: function() { - var a = this.opacity; - a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a)); - return (a === 1 ? "hsl(" : "hsla(") + (this.h || 0) + ", " + (this.s || 0) * 100 + "%, " + (this.l || 0) * 100 + "%" + (a === 1 ? ")" : ", " + a + ")"); - } -})); -function hsl2rgb(h, m1, m2) { - return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255; -} -const radians = Math.PI / 180; -const degrees = 180 / Math.PI; -const K = 18, Xn = 0.96422, Yn = 1, Zn = 0.82521, t0 = 4 / 29, t1 = 6 / 29, t2 = 3 * t1 * t1, t3 = t1 * t1 * t1; -function labConvert(o) { - if (o instanceof Lab) - return new Lab(o.l, o.a, o.b, o.opacity); - if (o instanceof Hcl) - return hcl2lab(o); - if (!(o instanceof Rgb)) - o = rgbConvert(o); - var r = rgb2lrgb(o.r), g = rgb2lrgb(o.g), b = rgb2lrgb(o.b), y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z; - if (r === g && g === b) - x = z = y; - else { - x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn); - z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn); - } - return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity); -} -function gray(l, opacity) { - return new Lab(l, 0, 0, opacity == null ? 1 : opacity); -} -function lab(l, a, b, opacity) { - return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity); -} -function Lab(l, a, b, opacity) { - this.l = +l; - this.a = +a; - this.b = +b; - this.opacity = +opacity; -} -define(Lab, lab, extend(Color, { - brighter: function(k) { - return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity); - }, - darker: function(k) { - return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity); - }, - rgb: function() { - var y = (this.l + 16) / 116, x = isNaN(this.a) ? y : y + this.a / 500, z = isNaN(this.b) ? y : y - this.b / 200; - x = Xn * lab2xyz(x); - y = Yn * lab2xyz(y); - z = Zn * lab2xyz(z); - return new Rgb(lrgb2rgb(3.1338561 * x - 1.6168667 * y - 0.4906146 * z), lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.033454 * z), lrgb2rgb(0.0719453 * x - 0.2289914 * y + 1.4052427 * z), this.opacity); - } -})); -function xyz2lab(t) { - return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0; -} -function lab2xyz(t) { - return t > t1 ? t * t * t : t2 * (t - t0); -} -function lrgb2rgb(x) { - return 255 * (x <= 31308e-7 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055); -} -function rgb2lrgb(x) { - return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4); -} -function hclConvert(o) { - if (o instanceof Hcl) - return new Hcl(o.h, o.c, o.l, o.opacity); - if (!(o instanceof Lab)) - o = labConvert(o); - if (o.a === 0 && o.b === 0) - return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity); - var h = Math.atan2(o.b, o.a) * degrees; - return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity); -} -function lch(l, c, h, opacity) { - return arguments.length === 1 ? hclConvert(l) : new Hcl(h, c, l, opacity == null ? 1 : opacity); -} -function hcl(h, c, l, opacity) { - return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity); -} -function Hcl(h, c, l, opacity) { - this.h = +h; - this.c = +c; - this.l = +l; - this.opacity = +opacity; -} -function hcl2lab(o) { - if (isNaN(o.h)) - return new Lab(o.l, 0, 0, o.opacity); - var h = o.h * radians; - return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity); -} -define(Hcl, hcl, extend(Color, { - brighter: function(k) { - return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity); - }, - darker: function(k) { - return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity); - }, - rgb: function() { - return hcl2lab(this).rgb(); - } -})); -var A = -0.14861, B = 1.78277, C = -0.29227, D = -0.90649, E = 1.97294, ED = E * D, EB = E * B, BC_DA = B * C - D * A; -function cubehelixConvert(o) { - if (o instanceof Cubehelix) - return new Cubehelix(o.h, o.s, o.l, o.opacity); - if (!(o instanceof Rgb)) - o = rgbConvert(o); - var r = o.r / 255, g = o.g / 255, b = o.b / 255, l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB), bl = b - l, k = (E * (g - l) - C * bl) / D, s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), h = s ? Math.atan2(k, bl) * degrees - 120 : NaN; - return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity); -} -function cubehelix(h, s, l, opacity) { - return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity); -} -function Cubehelix(h, s, l, opacity) { - this.h = +h; - this.s = +s; - this.l = +l; - this.opacity = +opacity; -} -define(Cubehelix, cubehelix, extend(Color, { - brighter: function(k) { - k = k == null ? brighter : Math.pow(brighter, k); - return new Cubehelix(this.h, this.s, this.l * k, this.opacity); - }, - darker: function(k) { - k = k == null ? darker : Math.pow(darker, k); - return new Cubehelix(this.h, this.s, this.l * k, this.opacity); - }, - rgb: function() { - var h = isNaN(this.h) ? 0 : (this.h + 120) * radians, l = +this.l, a = isNaN(this.s) ? 0 : this.s * l * (1 - l), cosh = Math.cos(h), sinh = Math.sin(h); - return new Rgb(255 * (l + a * (A * cosh + B * sinh)), 255 * (l + a * (C * cosh + D * sinh)), 255 * (l + a * (E * cosh)), this.opacity); - } -})); -export {color, cubehelix, gray, hcl, hsl, lab, lch, rgb}; -export default null; diff --git a/web/client/deps/d3/d3-contour.js b/web/client/deps/d3/d3-contour.js deleted file mode 100644 index e16180ea..00000000 --- a/web/client/deps/d3/d3-contour.js +++ /dev/null @@ -1,325 +0,0 @@ -import {extent, tickStep, ticks, thresholdSturges, max, range} from "./d3-array.js"; -var array = Array.prototype; -var slice = array.slice; -function ascending(a, b) { - return a - b; -} -function area(ring) { - var i = 0, n = ring.length, area2 = ring[n - 1][1] * ring[0][0] - ring[n - 1][0] * ring[0][1]; - while (++i < n) - area2 += ring[i - 1][1] * ring[i][0] - ring[i - 1][0] * ring[i][1]; - return area2; -} -var constant = (x) => () => x; -function contains(ring, hole) { - var i = -1, n = hole.length, c; - while (++i < n) - if (c = ringContains(ring, hole[i])) - return c; - return 0; -} -function ringContains(ring, point) { - var x = point[0], y = point[1], contains2 = -1; - for (var i = 0, n = ring.length, j = n - 1; i < n; j = i++) { - var pi = ring[i], xi = pi[0], yi = pi[1], pj = ring[j], xj = pj[0], yj = pj[1]; - if (segmentContains(pi, pj, point)) - return 0; - if (yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi) - contains2 = -contains2; - } - return contains2; -} -function segmentContains(a, b, c) { - var i; - return collinear(a, b, c) && within(a[i = +(a[0] === b[0])], c[i], b[i]); -} -function collinear(a, b, c) { - return (b[0] - a[0]) * (c[1] - a[1]) === (c[0] - a[0]) * (b[1] - a[1]); -} -function within(p, q, r) { - return p <= q && q <= r || r <= q && q <= p; -} -function noop() { -} -var cases = [ - [], - [[[1, 1.5], [0.5, 1]]], - [[[1.5, 1], [1, 1.5]]], - [[[1.5, 1], [0.5, 1]]], - [[[1, 0.5], [1.5, 1]]], - [[[1, 1.5], [0.5, 1]], [[1, 0.5], [1.5, 1]]], - [[[1, 0.5], [1, 1.5]]], - [[[1, 0.5], [0.5, 1]]], - [[[0.5, 1], [1, 0.5]]], - [[[1, 1.5], [1, 0.5]]], - [[[0.5, 1], [1, 0.5]], [[1.5, 1], [1, 1.5]]], - [[[1.5, 1], [1, 0.5]]], - [[[0.5, 1], [1.5, 1]]], - [[[1, 1.5], [1.5, 1]]], - [[[0.5, 1], [1, 1.5]]], - [] -]; -function contours() { - var dx = 1, dy = 1, threshold = thresholdSturges, smooth = smoothLinear; - function contours2(values) { - var tz = threshold(values); - if (!Array.isArray(tz)) { - const e = extent(values), ts = tickStep(e[0], e[1], tz); - tz = ticks(Math.floor(e[0] / ts) * ts, Math.floor(e[1] / ts - 1) * ts, tz); - } else { - tz = tz.slice().sort(ascending); - } - return tz.map((value) => contour(values, value)); - } - function contour(values, value) { - var polygons = [], holes = []; - isorings(values, value, function(ring) { - smooth(ring, values, value); - if (area(ring) > 0) - polygons.push([ring]); - else - holes.push(ring); - }); - holes.forEach(function(hole) { - for (var i = 0, n = polygons.length, polygon; i < n; ++i) { - if (contains((polygon = polygons[i])[0], hole) !== -1) { - polygon.push(hole); - return; - } - } - }); - return { - type: "MultiPolygon", - value, - coordinates: polygons - }; - } - function isorings(values, value, callback) { - var fragmentByStart = new Array(), fragmentByEnd = new Array(), x, y, t0, t1, t2, t3; - x = y = -1; - t1 = values[0] >= value; - cases[t1 << 1].forEach(stitch); - while (++x < dx - 1) { - t0 = t1, t1 = values[x + 1] >= value; - cases[t0 | t1 << 1].forEach(stitch); - } - cases[t1 << 0].forEach(stitch); - while (++y < dy - 1) { - x = -1; - t1 = values[y * dx + dx] >= value; - t2 = values[y * dx] >= value; - cases[t1 << 1 | t2 << 2].forEach(stitch); - while (++x < dx - 1) { - t0 = t1, t1 = values[y * dx + dx + x + 1] >= value; - t3 = t2, t2 = values[y * dx + x + 1] >= value; - cases[t0 | t1 << 1 | t2 << 2 | t3 << 3].forEach(stitch); - } - cases[t1 | t2 << 3].forEach(stitch); - } - x = -1; - t2 = values[y * dx] >= value; - cases[t2 << 2].forEach(stitch); - while (++x < dx - 1) { - t3 = t2, t2 = values[y * dx + x + 1] >= value; - cases[t2 << 2 | t3 << 3].forEach(stitch); - } - cases[t2 << 3].forEach(stitch); - function stitch(line) { - var start = [line[0][0] + x, line[0][1] + y], end = [line[1][0] + x, line[1][1] + y], startIndex = index(start), endIndex = index(end), f, g; - if (f = fragmentByEnd[startIndex]) { - if (g = fragmentByStart[endIndex]) { - delete fragmentByEnd[f.end]; - delete fragmentByStart[g.start]; - if (f === g) { - f.ring.push(end); - callback(f.ring); - } else { - fragmentByStart[f.start] = fragmentByEnd[g.end] = {start: f.start, end: g.end, ring: f.ring.concat(g.ring)}; - } - } else { - delete fragmentByEnd[f.end]; - f.ring.push(end); - fragmentByEnd[f.end = endIndex] = f; - } - } else if (f = fragmentByStart[endIndex]) { - if (g = fragmentByEnd[startIndex]) { - delete fragmentByStart[f.start]; - delete fragmentByEnd[g.end]; - if (f === g) { - f.ring.push(end); - callback(f.ring); - } else { - fragmentByStart[g.start] = fragmentByEnd[f.end] = {start: g.start, end: f.end, ring: g.ring.concat(f.ring)}; - } - } else { - delete fragmentByStart[f.start]; - f.ring.unshift(start); - fragmentByStart[f.start = startIndex] = f; - } - } else { - fragmentByStart[startIndex] = fragmentByEnd[endIndex] = {start: startIndex, end: endIndex, ring: [start, end]}; - } - } - } - function index(point) { - return point[0] * 2 + point[1] * (dx + 1) * 4; - } - function smoothLinear(ring, values, value) { - ring.forEach(function(point) { - var x = point[0], y = point[1], xt = x | 0, yt = y | 0, v0, v1 = values[yt * dx + xt]; - if (x > 0 && x < dx && xt === x) { - v0 = values[yt * dx + xt - 1]; - point[0] = x + (value - v0) / (v1 - v0) - 0.5; - } - if (y > 0 && y < dy && yt === y) { - v0 = values[(yt - 1) * dx + xt]; - point[1] = y + (value - v0) / (v1 - v0) - 0.5; - } - }); - } - contours2.contour = contour; - contours2.size = function(_) { - if (!arguments.length) - return [dx, dy]; - var _0 = Math.floor(_[0]), _1 = Math.floor(_[1]); - if (!(_0 >= 0 && _1 >= 0)) - throw new Error("invalid size"); - return dx = _0, dy = _1, contours2; - }; - contours2.thresholds = function(_) { - return arguments.length ? (threshold = typeof _ === "function" ? _ : Array.isArray(_) ? constant(slice.call(_)) : constant(_), contours2) : threshold; - }; - contours2.smooth = function(_) { - return arguments.length ? (smooth = _ ? smoothLinear : noop, contours2) : smooth === smoothLinear; - }; - return contours2; -} -function blurX(source, target, r) { - var n = source.width, m = source.height, w = (r << 1) + 1; - for (var j = 0; j < m; ++j) { - for (var i = 0, sr = 0; i < n + r; ++i) { - if (i < n) { - sr += source.data[i + j * n]; - } - if (i >= r) { - if (i >= w) { - sr -= source.data[i - w + j * n]; - } - target.data[i - r + j * n] = sr / Math.min(i + 1, n - 1 + w - i, w); - } - } - } -} -function blurY(source, target, r) { - var n = source.width, m = source.height, w = (r << 1) + 1; - for (var i = 0; i < n; ++i) { - for (var j = 0, sr = 0; j < m + r; ++j) { - if (j < m) { - sr += source.data[i + j * n]; - } - if (j >= r) { - if (j >= w) { - sr -= source.data[i + (j - w) * n]; - } - target.data[i + (j - r) * n] = sr / Math.min(j + 1, m - 1 + w - j, w); - } - } - } -} -function defaultX(d) { - return d[0]; -} -function defaultY(d) { - return d[1]; -} -function defaultWeight() { - return 1; -} -function density() { - var x = defaultX, y = defaultY, weight = defaultWeight, dx = 960, dy = 500, r = 20, k = 2, o = r * 3, n = dx + o * 2 >> k, m = dy + o * 2 >> k, threshold = constant(20); - function density2(data) { - var values0 = new Float32Array(n * m), values1 = new Float32Array(n * m), pow2k = Math.pow(2, -k); - data.forEach(function(d, i, data2) { - var xi = (x(d, i, data2) + o) * pow2k, yi = (y(d, i, data2) + o) * pow2k, wi = +weight(d, i, data2); - if (xi >= 0 && xi < n && yi >= 0 && yi < m) { - var x0 = Math.floor(xi), y0 = Math.floor(yi), xt = xi - x0 - 0.5, yt = yi - y0 - 0.5; - values0[x0 + y0 * n] += (1 - xt) * (1 - yt) * wi; - values0[x0 + 1 + y0 * n] += xt * (1 - yt) * wi; - values0[x0 + 1 + (y0 + 1) * n] += xt * yt * wi; - values0[x0 + (y0 + 1) * n] += (1 - xt) * yt * wi; - } - }); - blurX({width: n, height: m, data: values0}, {width: n, height: m, data: values1}, r >> k); - blurY({width: n, height: m, data: values1}, {width: n, height: m, data: values0}, r >> k); - blurX({width: n, height: m, data: values0}, {width: n, height: m, data: values1}, r >> k); - blurY({width: n, height: m, data: values1}, {width: n, height: m, data: values0}, r >> k); - blurX({width: n, height: m, data: values0}, {width: n, height: m, data: values1}, r >> k); - blurY({width: n, height: m, data: values1}, {width: n, height: m, data: values0}, r >> k); - var tz = threshold(values0); - if (!Array.isArray(tz)) { - var stop = max(values0); - tz = tickStep(0, stop, tz); - tz = range(0, Math.floor(stop / tz) * tz, tz); - tz.shift(); - } - return contours().thresholds(tz).size([n, m])(values0).map(transform); - } - function transform(geometry) { - geometry.value *= Math.pow(2, -2 * k); - geometry.coordinates.forEach(transformPolygon); - return geometry; - } - function transformPolygon(coordinates) { - coordinates.forEach(transformRing); - } - function transformRing(coordinates) { - coordinates.forEach(transformPoint); - } - function transformPoint(coordinates) { - coordinates[0] = coordinates[0] * Math.pow(2, k) - o; - coordinates[1] = coordinates[1] * Math.pow(2, k) - o; - } - function resize() { - o = r * 3; - n = dx + o * 2 >> k; - m = dy + o * 2 >> k; - return density2; - } - density2.x = function(_) { - return arguments.length ? (x = typeof _ === "function" ? _ : constant(+_), density2) : x; - }; - density2.y = function(_) { - return arguments.length ? (y = typeof _ === "function" ? _ : constant(+_), density2) : y; - }; - density2.weight = function(_) { - return arguments.length ? (weight = typeof _ === "function" ? _ : constant(+_), density2) : weight; - }; - density2.size = function(_) { - if (!arguments.length) - return [dx, dy]; - var _0 = +_[0], _1 = +_[1]; - if (!(_0 >= 0 && _1 >= 0)) - throw new Error("invalid size"); - return dx = _0, dy = _1, resize(); - }; - density2.cellSize = function(_) { - if (!arguments.length) - return 1 << k; - if (!((_ = +_) >= 1)) - throw new Error("invalid cell size"); - return k = Math.floor(Math.log(_) / Math.LN2), resize(); - }; - density2.thresholds = function(_) { - return arguments.length ? (threshold = typeof _ === "function" ? _ : Array.isArray(_) ? constant(slice.call(_)) : constant(_), density2) : threshold; - }; - density2.bandwidth = function(_) { - if (!arguments.length) - return Math.sqrt(r * (r + 1)); - if (!((_ = +_) >= 0)) - throw new Error("invalid bandwidth"); - return r = Math.round((Math.sqrt(4 * _ * _ + 1) - 1) / 2), resize(); - }; - return density2; -} -export {density as contourDensity, contours}; -export default null; diff --git a/web/client/deps/d3/d3-delaunay.js b/web/client/deps/d3/d3-delaunay.js deleted file mode 100644 index 9fcfaa59..00000000 --- a/web/client/deps/d3/d3-delaunay.js +++ /dev/null @@ -1,641 +0,0 @@ -import Delaunator from "./delaunator.js"; -const epsilon = 1e-6; -class Path { - constructor() { - this._x0 = this._y0 = this._x1 = this._y1 = null; - this._ = ""; - } - moveTo(x, y) { - this._ += `M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`; - } - closePath() { - if (this._x1 !== null) { - this._x1 = this._x0, this._y1 = this._y0; - this._ += "Z"; - } - } - lineTo(x, y) { - this._ += `L${this._x1 = +x},${this._y1 = +y}`; - } - arc(x, y, r) { - x = +x, y = +y, r = +r; - const x0 = x + r; - const y0 = y; - if (r < 0) - throw new Error("negative radius"); - if (this._x1 === null) - this._ += `M${x0},${y0}`; - else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) - this._ += "L" + x0 + "," + y0; - if (!r) - return; - this._ += `A${r},${r},0,1,1,${x - r},${y}A${r},${r},0,1,1,${this._x1 = x0},${this._y1 = y0}`; - } - rect(x, y, w, h) { - this._ += `M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${+w}v${+h}h${-w}Z`; - } - value() { - return this._ || null; - } -} -class Polygon { - constructor() { - this._ = []; - } - moveTo(x, y) { - this._.push([x, y]); - } - closePath() { - this._.push(this._[0].slice()); - } - lineTo(x, y) { - this._.push([x, y]); - } - value() { - return this._.length ? this._ : null; - } -} -class Voronoi { - constructor(delaunay, [xmin, ymin, xmax, ymax] = [0, 0, 960, 500]) { - if (!((xmax = +xmax) >= (xmin = +xmin)) || !((ymax = +ymax) >= (ymin = +ymin))) - throw new Error("invalid bounds"); - this.delaunay = delaunay; - this._circumcenters = new Float64Array(delaunay.points.length * 2); - this.vectors = new Float64Array(delaunay.points.length * 2); - this.xmax = xmax, this.xmin = xmin; - this.ymax = ymax, this.ymin = ymin; - this._init(); - } - update() { - this.delaunay.update(); - this._init(); - return this; - } - _init() { - const {delaunay: {points, hull, triangles}, vectors} = this; - const circumcenters = this.circumcenters = this._circumcenters.subarray(0, triangles.length / 3 * 2); - for (let i = 0, j = 0, n = triangles.length, x, y; i < n; i += 3, j += 2) { - const t1 = triangles[i] * 2; - const t2 = triangles[i + 1] * 2; - const t3 = triangles[i + 2] * 2; - const x12 = points[t1]; - const y12 = points[t1 + 1]; - const x2 = points[t2]; - const y2 = points[t2 + 1]; - const x3 = points[t3]; - const y3 = points[t3 + 1]; - const dx = x2 - x12; - const dy = y2 - y12; - const ex = x3 - x12; - const ey = y3 - y12; - const ab = (dx * ey - dy * ex) * 2; - if (Math.abs(ab) < 1e-9) { - let a = 1e9; - const r = triangles[0] * 2; - a *= Math.sign((points[r] - x12) * ey - (points[r + 1] - y12) * ex); - x = (x12 + x3) / 2 - a * ey; - y = (y12 + y3) / 2 + a * ex; - } else { - const d = 1 / ab; - const bl = dx * dx + dy * dy; - const cl = ex * ex + ey * ey; - x = x12 + (ey * bl - dy * cl) * d; - y = y12 + (dx * cl - ex * bl) * d; - } - circumcenters[j] = x; - circumcenters[j + 1] = y; - } - let h = hull[hull.length - 1]; - let p0, p1 = h * 4; - let x0, x1 = points[2 * h]; - let y0, y1 = points[2 * h + 1]; - vectors.fill(0); - for (let i = 0; i < hull.length; ++i) { - h = hull[i]; - p0 = p1, x0 = x1, y0 = y1; - p1 = h * 4, x1 = points[2 * h], y1 = points[2 * h + 1]; - vectors[p0 + 2] = vectors[p1] = y0 - y1; - vectors[p0 + 3] = vectors[p1 + 1] = x1 - x0; - } - } - render(context) { - const buffer = context == null ? context = new Path() : void 0; - const {delaunay: {halfedges, inedges, hull}, circumcenters, vectors} = this; - if (hull.length <= 1) - return null; - for (let i = 0, n = halfedges.length; i < n; ++i) { - const j = halfedges[i]; - if (j < i) - continue; - const ti = Math.floor(i / 3) * 2; - const tj = Math.floor(j / 3) * 2; - const xi = circumcenters[ti]; - const yi = circumcenters[ti + 1]; - const xj = circumcenters[tj]; - const yj = circumcenters[tj + 1]; - this._renderSegment(xi, yi, xj, yj, context); - } - let h0, h1 = hull[hull.length - 1]; - for (let i = 0; i < hull.length; ++i) { - h0 = h1, h1 = hull[i]; - const t = Math.floor(inedges[h1] / 3) * 2; - const x = circumcenters[t]; - const y = circumcenters[t + 1]; - const v = h0 * 4; - const p = this._project(x, y, vectors[v + 2], vectors[v + 3]); - if (p) - this._renderSegment(x, y, p[0], p[1], context); - } - return buffer && buffer.value(); - } - renderBounds(context) { - const buffer = context == null ? context = new Path() : void 0; - context.rect(this.xmin, this.ymin, this.xmax - this.xmin, this.ymax - this.ymin); - return buffer && buffer.value(); - } - renderCell(i, context) { - const buffer = context == null ? context = new Path() : void 0; - const points = this._clip(i); - if (points === null || !points.length) - return; - context.moveTo(points[0], points[1]); - let n = points.length; - while (points[0] === points[n - 2] && points[1] === points[n - 1] && n > 1) - n -= 2; - for (let i2 = 2; i2 < n; i2 += 2) { - if (points[i2] !== points[i2 - 2] || points[i2 + 1] !== points[i2 - 1]) - context.lineTo(points[i2], points[i2 + 1]); - } - context.closePath(); - return buffer && buffer.value(); - } - *cellPolygons() { - const {delaunay: {points}} = this; - for (let i = 0, n = points.length / 2; i < n; ++i) { - const cell = this.cellPolygon(i); - if (cell) - cell.index = i, yield cell; - } - } - cellPolygon(i) { - const polygon = new Polygon(); - this.renderCell(i, polygon); - return polygon.value(); - } - _renderSegment(x0, y0, x1, y1, context) { - let S; - const c0 = this._regioncode(x0, y0); - const c1 = this._regioncode(x1, y1); - if (c0 === 0 && c1 === 0) { - context.moveTo(x0, y0); - context.lineTo(x1, y1); - } else if (S = this._clipSegment(x0, y0, x1, y1, c0, c1)) { - context.moveTo(S[0], S[1]); - context.lineTo(S[2], S[3]); - } - } - contains(i, x, y) { - if ((x = +x, x !== x) || (y = +y, y !== y)) - return false; - return this.delaunay._step(i, x, y) === i; - } - *neighbors(i) { - const ci = this._clip(i); - if (ci) - for (const j of this.delaunay.neighbors(i)) { - const cj = this._clip(j); - if (cj) - loop: - for (let ai = 0, li = ci.length; ai < li; ai += 2) { - for (let aj = 0, lj = cj.length; aj < lj; aj += 2) { - if (ci[ai] == cj[aj] && ci[ai + 1] == cj[aj + 1] && ci[(ai + 2) % li] == cj[(aj + lj - 2) % lj] && ci[(ai + 3) % li] == cj[(aj + lj - 1) % lj]) { - yield j; - break loop; - } - } - } - } - } - _cell(i) { - const {circumcenters, delaunay: {inedges, halfedges, triangles}} = this; - const e0 = inedges[i]; - if (e0 === -1) - return null; - const points = []; - let e = e0; - do { - const t = Math.floor(e / 3); - points.push(circumcenters[t * 2], circumcenters[t * 2 + 1]); - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) - break; - e = halfedges[e]; - } while (e !== e0 && e !== -1); - return points; - } - _clip(i) { - if (i === 0 && this.delaunay.hull.length === 1) { - return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin]; - } - const points = this._cell(i); - if (points === null) - return null; - const {vectors: V} = this; - const v = i * 4; - return V[v] || V[v + 1] ? this._clipInfinite(i, points, V[v], V[v + 1], V[v + 2], V[v + 3]) : this._clipFinite(i, points); - } - _clipFinite(i, points) { - const n = points.length; - let P = null; - let x0, y0, x1 = points[n - 2], y1 = points[n - 1]; - let c0, c1 = this._regioncode(x1, y1); - let e0, e1 = 0; - for (let j = 0; j < n; j += 2) { - x0 = x1, y0 = y1, x1 = points[j], y1 = points[j + 1]; - c0 = c1, c1 = this._regioncode(x1, y1); - if (c0 === 0 && c1 === 0) { - e0 = e1, e1 = 0; - if (P) - P.push(x1, y1); - else - P = [x1, y1]; - } else { - let S, sx0, sy0, sx1, sy1; - if (c0 === 0) { - if ((S = this._clipSegment(x0, y0, x1, y1, c0, c1)) === null) - continue; - [sx0, sy0, sx1, sy1] = S; - } else { - if ((S = this._clipSegment(x1, y1, x0, y0, c1, c0)) === null) - continue; - [sx1, sy1, sx0, sy0] = S; - e0 = e1, e1 = this._edgecode(sx0, sy0); - if (e0 && e1) - this._edge(i, e0, e1, P, P.length); - if (P) - P.push(sx0, sy0); - else - P = [sx0, sy0]; - } - e0 = e1, e1 = this._edgecode(sx1, sy1); - if (e0 && e1) - this._edge(i, e0, e1, P, P.length); - if (P) - P.push(sx1, sy1); - else - P = [sx1, sy1]; - } - } - if (P) { - e0 = e1, e1 = this._edgecode(P[0], P[1]); - if (e0 && e1) - this._edge(i, e0, e1, P, P.length); - } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) { - return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin]; - } - return P; - } - _clipSegment(x0, y0, x1, y1, c0, c1) { - while (true) { - if (c0 === 0 && c1 === 0) - return [x0, y0, x1, y1]; - if (c0 & c1) - return null; - let x, y, c = c0 || c1; - if (c & 8) - x = x0 + (x1 - x0) * (this.ymax - y0) / (y1 - y0), y = this.ymax; - else if (c & 4) - x = x0 + (x1 - x0) * (this.ymin - y0) / (y1 - y0), y = this.ymin; - else if (c & 2) - y = y0 + (y1 - y0) * (this.xmax - x0) / (x1 - x0), x = this.xmax; - else - y = y0 + (y1 - y0) * (this.xmin - x0) / (x1 - x0), x = this.xmin; - if (c0) - x0 = x, y0 = y, c0 = this._regioncode(x0, y0); - else - x1 = x, y1 = y, c1 = this._regioncode(x1, y1); - } - } - _clipInfinite(i, points, vx0, vy0, vxn, vyn) { - let P = Array.from(points), p; - if (p = this._project(P[0], P[1], vx0, vy0)) - P.unshift(p[0], p[1]); - if (p = this._project(P[P.length - 2], P[P.length - 1], vxn, vyn)) - P.push(p[0], p[1]); - if (P = this._clipFinite(i, P)) { - for (let j = 0, n = P.length, c0, c1 = this._edgecode(P[n - 2], P[n - 1]); j < n; j += 2) { - c0 = c1, c1 = this._edgecode(P[j], P[j + 1]); - if (c0 && c1) - j = this._edge(i, c0, c1, P, j), n = P.length; - } - } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) { - P = [this.xmin, this.ymin, this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax]; - } - return P; - } - _edge(i, e0, e1, P, j) { - while (e0 !== e1) { - let x, y; - switch (e0) { - case 5: - e0 = 4; - continue; - case 4: - e0 = 6, x = this.xmax, y = this.ymin; - break; - case 6: - e0 = 2; - continue; - case 2: - e0 = 10, x = this.xmax, y = this.ymax; - break; - case 10: - e0 = 8; - continue; - case 8: - e0 = 9, x = this.xmin, y = this.ymax; - break; - case 9: - e0 = 1; - continue; - case 1: - e0 = 5, x = this.xmin, y = this.ymin; - break; - } - if ((P[j] !== x || P[j + 1] !== y) && this.contains(i, x, y)) { - P.splice(j, 0, x, y), j += 2; - } - } - if (P.length > 4) { - for (let i2 = 0; i2 < P.length; i2 += 2) { - const j2 = (i2 + 2) % P.length, k = (i2 + 4) % P.length; - if (P[i2] === P[j2] && P[j2] === P[k] || P[i2 + 1] === P[j2 + 1] && P[j2 + 1] === P[k + 1]) - P.splice(j2, 2), i2 -= 2; - } - } - return j; - } - _project(x0, y0, vx, vy) { - let t = Infinity, c, x, y; - if (vy < 0) { - if (y0 <= this.ymin) - return null; - if ((c = (this.ymin - y0) / vy) < t) - y = this.ymin, x = x0 + (t = c) * vx; - } else if (vy > 0) { - if (y0 >= this.ymax) - return null; - if ((c = (this.ymax - y0) / vy) < t) - y = this.ymax, x = x0 + (t = c) * vx; - } - if (vx > 0) { - if (x0 >= this.xmax) - return null; - if ((c = (this.xmax - x0) / vx) < t) - x = this.xmax, y = y0 + (t = c) * vy; - } else if (vx < 0) { - if (x0 <= this.xmin) - return null; - if ((c = (this.xmin - x0) / vx) < t) - x = this.xmin, y = y0 + (t = c) * vy; - } - return [x, y]; - } - _edgecode(x, y) { - return (x === this.xmin ? 1 : x === this.xmax ? 2 : 0) | (y === this.ymin ? 4 : y === this.ymax ? 8 : 0); - } - _regioncode(x, y) { - return (x < this.xmin ? 1 : x > this.xmax ? 2 : 0) | (y < this.ymin ? 4 : y > this.ymax ? 8 : 0); - } -} -const tau = 2 * Math.PI, pow = Math.pow; -function pointX(p) { - return p[0]; -} -function pointY(p) { - return p[1]; -} -function collinear(d) { - const {triangles, coords} = d; - for (let i = 0; i < triangles.length; i += 3) { - const a = 2 * triangles[i], b = 2 * triangles[i + 1], c = 2 * triangles[i + 2], cross = (coords[c] - coords[a]) * (coords[b + 1] - coords[a + 1]) - (coords[b] - coords[a]) * (coords[c + 1] - coords[a + 1]); - if (cross > 1e-10) - return false; - } - return true; -} -function jitter(x, y, r) { - return [x + Math.sin(x + y) * r, y + Math.cos(x - y) * r]; -} -class Delaunay { - static from(points, fx = pointX, fy = pointY, that) { - return new Delaunay("length" in points ? flatArray(points, fx, fy, that) : Float64Array.from(flatIterable(points, fx, fy, that))); - } - constructor(points) { - this._delaunator = new Delaunator(points); - this.inedges = new Int32Array(points.length / 2); - this._hullIndex = new Int32Array(points.length / 2); - this.points = this._delaunator.coords; - this._init(); - } - update() { - this._delaunator.update(); - this._init(); - return this; - } - _init() { - const d = this._delaunator, points = this.points; - if (d.hull && d.hull.length > 2 && collinear(d)) { - this.collinear = Int32Array.from({length: points.length / 2}, (_, i) => i).sort((i, j) => points[2 * i] - points[2 * j] || points[2 * i + 1] - points[2 * j + 1]); - const e = this.collinear[0], f = this.collinear[this.collinear.length - 1], bounds = [points[2 * e], points[2 * e + 1], points[2 * f], points[2 * f + 1]], r = 1e-8 * Math.hypot(bounds[3] - bounds[1], bounds[2] - bounds[0]); - for (let i = 0, n = points.length / 2; i < n; ++i) { - const p = jitter(points[2 * i], points[2 * i + 1], r); - points[2 * i] = p[0]; - points[2 * i + 1] = p[1]; - } - this._delaunator = new Delaunator(points); - } else { - delete this.collinear; - } - const halfedges = this.halfedges = this._delaunator.halfedges; - const hull = this.hull = this._delaunator.hull; - const triangles = this.triangles = this._delaunator.triangles; - const inedges = this.inedges.fill(-1); - const hullIndex = this._hullIndex.fill(-1); - for (let e = 0, n = halfedges.length; e < n; ++e) { - const p = triangles[e % 3 === 2 ? e - 2 : e + 1]; - if (halfedges[e] === -1 || inedges[p] === -1) - inedges[p] = e; - } - for (let i = 0, n = hull.length; i < n; ++i) { - hullIndex[hull[i]] = i; - } - if (hull.length <= 2 && hull.length > 0) { - this.triangles = new Int32Array(3).fill(-1); - this.halfedges = new Int32Array(3).fill(-1); - this.triangles[0] = hull[0]; - inedges[hull[0]] = 1; - if (hull.length === 2) { - inedges[hull[1]] = 0; - this.triangles[1] = hull[1]; - this.triangles[2] = hull[1]; - } - } - } - voronoi(bounds) { - return new Voronoi(this, bounds); - } - *neighbors(i) { - const {inedges, hull, _hullIndex, halfedges, triangles, collinear: collinear2} = this; - if (collinear2) { - const l = collinear2.indexOf(i); - if (l > 0) - yield collinear2[l - 1]; - if (l < collinear2.length - 1) - yield collinear2[l + 1]; - return; - } - const e0 = inedges[i]; - if (e0 === -1) - return; - let e = e0, p0 = -1; - do { - yield p0 = triangles[e]; - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) - return; - e = halfedges[e]; - if (e === -1) { - const p = hull[(_hullIndex[i] + 1) % hull.length]; - if (p !== p0) - yield p; - return; - } - } while (e !== e0); - } - find(x, y, i = 0) { - if ((x = +x, x !== x) || (y = +y, y !== y)) - return -1; - const i0 = i; - let c; - while ((c = this._step(i, x, y)) >= 0 && c !== i && c !== i0) - i = c; - return c; - } - _step(i, x, y) { - const {inedges, hull, _hullIndex, halfedges, triangles, points} = this; - if (inedges[i] === -1 || !points.length) - return (i + 1) % (points.length >> 1); - let c = i; - let dc = pow(x - points[i * 2], 2) + pow(y - points[i * 2 + 1], 2); - const e0 = inedges[i]; - let e = e0; - do { - let t = triangles[e]; - const dt = pow(x - points[t * 2], 2) + pow(y - points[t * 2 + 1], 2); - if (dt < dc) - dc = dt, c = t; - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) - break; - e = halfedges[e]; - if (e === -1) { - e = hull[(_hullIndex[i] + 1) % hull.length]; - if (e !== t) { - if (pow(x - points[e * 2], 2) + pow(y - points[e * 2 + 1], 2) < dc) - return e; - } - break; - } - } while (e !== e0); - return c; - } - render(context) { - const buffer = context == null ? context = new Path() : void 0; - const {points, halfedges, triangles} = this; - for (let i = 0, n = halfedges.length; i < n; ++i) { - const j = halfedges[i]; - if (j < i) - continue; - const ti = triangles[i] * 2; - const tj = triangles[j] * 2; - context.moveTo(points[ti], points[ti + 1]); - context.lineTo(points[tj], points[tj + 1]); - } - this.renderHull(context); - return buffer && buffer.value(); - } - renderPoints(context, r) { - if (r === void 0 && (!context || typeof context.moveTo !== "function")) - r = context, context = null; - r = r == void 0 ? 2 : +r; - const buffer = context == null ? context = new Path() : void 0; - const {points} = this; - for (let i = 0, n = points.length; i < n; i += 2) { - const x = points[i], y = points[i + 1]; - context.moveTo(x + r, y); - context.arc(x, y, r, 0, tau); - } - return buffer && buffer.value(); - } - renderHull(context) { - const buffer = context == null ? context = new Path() : void 0; - const {hull, points} = this; - const h = hull[0] * 2, n = hull.length; - context.moveTo(points[h], points[h + 1]); - for (let i = 1; i < n; ++i) { - const h2 = 2 * hull[i]; - context.lineTo(points[h2], points[h2 + 1]); - } - context.closePath(); - return buffer && buffer.value(); - } - hullPolygon() { - const polygon = new Polygon(); - this.renderHull(polygon); - return polygon.value(); - } - renderTriangle(i, context) { - const buffer = context == null ? context = new Path() : void 0; - const {points, triangles} = this; - const t0 = triangles[i *= 3] * 2; - const t1 = triangles[i + 1] * 2; - const t2 = triangles[i + 2] * 2; - context.moveTo(points[t0], points[t0 + 1]); - context.lineTo(points[t1], points[t1 + 1]); - context.lineTo(points[t2], points[t2 + 1]); - context.closePath(); - return buffer && buffer.value(); - } - *trianglePolygons() { - const {triangles} = this; - for (let i = 0, n = triangles.length / 3; i < n; ++i) { - yield this.trianglePolygon(i); - } - } - trianglePolygon(i) { - const polygon = new Polygon(); - this.renderTriangle(i, polygon); - return polygon.value(); - } -} -function flatArray(points, fx, fy, that) { - const n = points.length; - const array = new Float64Array(n * 2); - for (let i = 0; i < n; ++i) { - const p = points[i]; - array[i * 2] = fx.call(that, p, i, points); - array[i * 2 + 1] = fy.call(that, p, i, points); - } - return array; -} -function* flatIterable(points, fx, fy, that) { - let i = 0; - for (const p of points) { - yield fx.call(that, p, i, points); - yield fy.call(that, p, i, points); - ++i; - } -} -export {Delaunay, Voronoi}; -export default null; diff --git a/web/client/deps/d3/d3-dispatch.js b/web/client/deps/d3/d3-dispatch.js deleted file mode 100644 index fe1c903c..00000000 --- a/web/client/deps/d3/d3-dispatch.js +++ /dev/null @@ -1,86 +0,0 @@ -var noop = {value: () => { -}}; -function dispatch() { - for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) { - if (!(t = arguments[i] + "") || t in _ || /[\s.]/.test(t)) - throw new Error("illegal type: " + t); - _[t] = []; - } - return new Dispatch(_); -} -function Dispatch(_) { - this._ = _; -} -function parseTypenames(typenames, types) { - return typenames.trim().split(/^|\s+/).map(function(t) { - var name = "", i = t.indexOf("."); - if (i >= 0) - name = t.slice(i + 1), t = t.slice(0, i); - if (t && !types.hasOwnProperty(t)) - throw new Error("unknown type: " + t); - return {type: t, name}; - }); -} -Dispatch.prototype = dispatch.prototype = { - constructor: Dispatch, - on: function(typename, callback) { - var _ = this._, T = parseTypenames(typename + "", _), t, i = -1, n = T.length; - if (arguments.length < 2) { - while (++i < n) - if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) - return t; - return; - } - if (callback != null && typeof callback !== "function") - throw new Error("invalid callback: " + callback); - while (++i < n) { - if (t = (typename = T[i]).type) - _[t] = set(_[t], typename.name, callback); - else if (callback == null) - for (t in _) - _[t] = set(_[t], typename.name, null); - } - return this; - }, - copy: function() { - var copy = {}, _ = this._; - for (var t in _) - copy[t] = _[t].slice(); - return new Dispatch(copy); - }, - call: function(type, that) { - if ((n = arguments.length - 2) > 0) - for (var args = new Array(n), i = 0, n, t; i < n; ++i) - args[i] = arguments[i + 2]; - if (!this._.hasOwnProperty(type)) - throw new Error("unknown type: " + type); - for (t = this._[type], i = 0, n = t.length; i < n; ++i) - t[i].value.apply(that, args); - }, - apply: function(type, that, args) { - if (!this._.hasOwnProperty(type)) - throw new Error("unknown type: " + type); - for (var t = this._[type], i = 0, n = t.length; i < n; ++i) - t[i].value.apply(that, args); - } -}; -function get(type, name) { - for (var i = 0, n = type.length, c; i < n; ++i) { - if ((c = type[i]).name === name) { - return c.value; - } - } -} -function set(type, name, callback) { - for (var i = 0, n = type.length; i < n; ++i) { - if (type[i].name === name) { - type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1)); - break; - } - } - if (callback != null) - type.push({name, value: callback}); - return type; -} -export {dispatch}; -export default null; diff --git a/web/client/deps/d3/d3-drag.js b/web/client/deps/d3/d3-drag.js deleted file mode 100644 index a5c26f20..00000000 --- a/web/client/deps/d3/d3-drag.js +++ /dev/null @@ -1,210 +0,0 @@ -import {dispatch} from "./d3-dispatch.js"; -import {select, pointer} from "./d3-selection.js"; -const nonpassive = {passive: false}; -const nonpassivecapture = {capture: true, passive: false}; -function nopropagation(event) { - event.stopImmediatePropagation(); -} -function noevent(event) { - event.preventDefault(); - event.stopImmediatePropagation(); -} -function nodrag(view) { - var root = view.document.documentElement, selection = select(view).on("dragstart.drag", noevent, nonpassivecapture); - if ("onselectstart" in root) { - selection.on("selectstart.drag", noevent, nonpassivecapture); - } else { - root.__noselect = root.style.MozUserSelect; - root.style.MozUserSelect = "none"; - } -} -function yesdrag(view, noclick) { - var root = view.document.documentElement, selection = select(view).on("dragstart.drag", null); - if (noclick) { - selection.on("click.drag", noevent, nonpassivecapture); - setTimeout(function() { - selection.on("click.drag", null); - }, 0); - } - if ("onselectstart" in root) { - selection.on("selectstart.drag", null); - } else { - root.style.MozUserSelect = root.__noselect; - delete root.__noselect; - } -} -var constant = (x) => () => x; -function DragEvent(type, { - sourceEvent, - subject, - target, - identifier, - active, - x, - y, - dx, - dy, - dispatch: dispatch2 -}) { - Object.defineProperties(this, { - type: {value: type, enumerable: true, configurable: true}, - sourceEvent: {value: sourceEvent, enumerable: true, configurable: true}, - subject: {value: subject, enumerable: true, configurable: true}, - target: {value: target, enumerable: true, configurable: true}, - identifier: {value: identifier, enumerable: true, configurable: true}, - active: {value: active, enumerable: true, configurable: true}, - x: {value: x, enumerable: true, configurable: true}, - y: {value: y, enumerable: true, configurable: true}, - dx: {value: dx, enumerable: true, configurable: true}, - dy: {value: dy, enumerable: true, configurable: true}, - _: {value: dispatch2} - }); -} -DragEvent.prototype.on = function() { - var value = this._.on.apply(this._, arguments); - return value === this._ ? this : value; -}; -function defaultFilter(event) { - return !event.ctrlKey && !event.button; -} -function defaultContainer() { - return this.parentNode; -} -function defaultSubject(event, d) { - return d == null ? {x: event.x, y: event.y} : d; -} -function defaultTouchable() { - return navigator.maxTouchPoints || "ontouchstart" in this; -} -function drag() { - var filter = defaultFilter, container = defaultContainer, subject = defaultSubject, touchable = defaultTouchable, gestures = {}, listeners = dispatch("start", "drag", "end"), active = 0, mousedownx, mousedowny, mousemoving, touchending, clickDistance2 = 0; - function drag2(selection) { - selection.on("mousedown.drag", mousedowned).filter(touchable).on("touchstart.drag", touchstarted).on("touchmove.drag", touchmoved, nonpassive).on("touchend.drag touchcancel.drag", touchended).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)"); - } - function mousedowned(event, d) { - if (touchending || !filter.call(this, event, d)) - return; - var gesture = beforestart(this, container.call(this, event, d), event, d, "mouse"); - if (!gesture) - return; - select(event.view).on("mousemove.drag", mousemoved, nonpassivecapture).on("mouseup.drag", mouseupped, nonpassivecapture); - nodrag(event.view); - nopropagation(event); - mousemoving = false; - mousedownx = event.clientX; - mousedowny = event.clientY; - gesture("start", event); - } - function mousemoved(event) { - noevent(event); - if (!mousemoving) { - var dx = event.clientX - mousedownx, dy = event.clientY - mousedowny; - mousemoving = dx * dx + dy * dy > clickDistance2; - } - gestures.mouse("drag", event); - } - function mouseupped(event) { - select(event.view).on("mousemove.drag mouseup.drag", null); - yesdrag(event.view, mousemoving); - noevent(event); - gestures.mouse("end", event); - } - function touchstarted(event, d) { - if (!filter.call(this, event, d)) - return; - var touches = event.changedTouches, c = container.call(this, event, d), n = touches.length, i, gesture; - for (i = 0; i < n; ++i) { - if (gesture = beforestart(this, c, event, d, touches[i].identifier, touches[i])) { - nopropagation(event); - gesture("start", event, touches[i]); - } - } - } - function touchmoved(event) { - var touches = event.changedTouches, n = touches.length, i, gesture; - for (i = 0; i < n; ++i) { - if (gesture = gestures[touches[i].identifier]) { - noevent(event); - gesture("drag", event, touches[i]); - } - } - } - function touchended(event) { - var touches = event.changedTouches, n = touches.length, i, gesture; - if (touchending) - clearTimeout(touchending); - touchending = setTimeout(function() { - touchending = null; - }, 500); - for (i = 0; i < n; ++i) { - if (gesture = gestures[touches[i].identifier]) { - nopropagation(event); - gesture("end", event, touches[i]); - } - } - } - function beforestart(that, container2, event, d, identifier, touch) { - var dispatch2 = listeners.copy(), p = pointer(touch || event, container2), dx, dy, s; - if ((s = subject.call(that, new DragEvent("beforestart", { - sourceEvent: event, - target: drag2, - identifier, - active, - x: p[0], - y: p[1], - dx: 0, - dy: 0, - dispatch: dispatch2 - }), d)) == null) - return; - dx = s.x - p[0] || 0; - dy = s.y - p[1] || 0; - return function gesture(type, event2, touch2) { - var p0 = p, n; - switch (type) { - case "start": - gestures[identifier] = gesture, n = active++; - break; - case "end": - delete gestures[identifier], --active; - case "drag": - p = pointer(touch2 || event2, container2), n = active; - break; - } - dispatch2.call(type, that, new DragEvent(type, { - sourceEvent: event2, - subject: s, - target: drag2, - identifier, - active: n, - x: p[0] + dx, - y: p[1] + dy, - dx: p[0] - p0[0], - dy: p[1] - p0[1], - dispatch: dispatch2 - }), d); - }; - } - drag2.filter = function(_) { - return arguments.length ? (filter = typeof _ === "function" ? _ : constant(!!_), drag2) : filter; - }; - drag2.container = function(_) { - return arguments.length ? (container = typeof _ === "function" ? _ : constant(_), drag2) : container; - }; - drag2.subject = function(_) { - return arguments.length ? (subject = typeof _ === "function" ? _ : constant(_), drag2) : subject; - }; - drag2.touchable = function(_) { - return arguments.length ? (touchable = typeof _ === "function" ? _ : constant(!!_), drag2) : touchable; - }; - drag2.on = function() { - var value = listeners.on.apply(listeners, arguments); - return value === listeners ? drag2 : value; - }; - drag2.clickDistance = function(_) { - return arguments.length ? (clickDistance2 = (_ = +_) * _, drag2) : Math.sqrt(clickDistance2); - }; - return drag2; -} -export {drag, nodrag as dragDisable, yesdrag as dragEnable}; -export default null; diff --git a/web/client/deps/d3/d3-dsv.js b/web/client/deps/d3/d3-dsv.js deleted file mode 100644 index 338eea51..00000000 --- a/web/client/deps/d3/d3-dsv.js +++ /dev/null @@ -1,172 +0,0 @@ -var EOL = {}, EOF = {}, QUOTE = 34, NEWLINE = 10, RETURN = 13; -function objectConverter(columns) { - return new Function("d", "return {" + columns.map(function(name, i) { - return JSON.stringify(name) + ": d[" + i + '] || ""'; - }).join(",") + "}"); -} -function customConverter(columns, f) { - var object = objectConverter(columns); - return function(row, i) { - return f(object(row), i, columns); - }; -} -function inferColumns(rows) { - var columnSet = Object.create(null), columns = []; - rows.forEach(function(row) { - for (var column in row) { - if (!(column in columnSet)) { - columns.push(columnSet[column] = column); - } - } - }); - return columns; -} -function pad(value, width) { - var s = value + "", length = s.length; - return length < width ? new Array(width - length + 1).join(0) + s : s; -} -function formatYear(year) { - return year < 0 ? "-" + pad(-year, 6) : year > 9999 ? "+" + pad(year, 6) : pad(year, 4); -} -function formatDate(date) { - var hours = date.getUTCHours(), minutes = date.getUTCMinutes(), seconds = date.getUTCSeconds(), milliseconds = date.getUTCMilliseconds(); - return isNaN(date) ? "Invalid Date" : formatYear(date.getUTCFullYear()) + "-" + pad(date.getUTCMonth() + 1, 2) + "-" + pad(date.getUTCDate(), 2) + (milliseconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "." + pad(milliseconds, 3) + "Z" : seconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "Z" : minutes || hours ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + "Z" : ""); -} -function dsv(delimiter) { - var reFormat = new RegExp('["' + delimiter + "\n\r]"), DELIMITER = delimiter.charCodeAt(0); - function parse(text, f) { - var convert, columns, rows = parseRows(text, function(row, i) { - if (convert) - return convert(row, i - 1); - columns = row, convert = f ? customConverter(row, f) : objectConverter(row); - }); - rows.columns = columns || []; - return rows; - } - function parseRows(text, f) { - var rows = [], N = text.length, I = 0, n = 0, t, eof = N <= 0, eol = false; - if (text.charCodeAt(N - 1) === NEWLINE) - --N; - if (text.charCodeAt(N - 1) === RETURN) - --N; - function token() { - if (eof) - return EOF; - if (eol) - return eol = false, EOL; - var i, j = I, c; - if (text.charCodeAt(j) === QUOTE) { - while (I++ < N && text.charCodeAt(I) !== QUOTE || text.charCodeAt(++I) === QUOTE) - ; - if ((i = I) >= N) - eof = true; - else if ((c = text.charCodeAt(I++)) === NEWLINE) - eol = true; - else if (c === RETURN) { - eol = true; - if (text.charCodeAt(I) === NEWLINE) - ++I; - } - return text.slice(j + 1, i - 1).replace(/""/g, '"'); - } - while (I < N) { - if ((c = text.charCodeAt(i = I++)) === NEWLINE) - eol = true; - else if (c === RETURN) { - eol = true; - if (text.charCodeAt(I) === NEWLINE) - ++I; - } else if (c !== DELIMITER) - continue; - return text.slice(j, i); - } - return eof = true, text.slice(j, N); - } - while ((t = token()) !== EOF) { - var row = []; - while (t !== EOL && t !== EOF) - row.push(t), t = token(); - if (f && (row = f(row, n++)) == null) - continue; - rows.push(row); - } - return rows; - } - function preformatBody(rows, columns) { - return rows.map(function(row) { - return columns.map(function(column) { - return formatValue(row[column]); - }).join(delimiter); - }); - } - function format(rows, columns) { - if (columns == null) - columns = inferColumns(rows); - return [columns.map(formatValue).join(delimiter)].concat(preformatBody(rows, columns)).join("\n"); - } - function formatBody(rows, columns) { - if (columns == null) - columns = inferColumns(rows); - return preformatBody(rows, columns).join("\n"); - } - function formatRows(rows) { - return rows.map(formatRow).join("\n"); - } - function formatRow(row) { - return row.map(formatValue).join(delimiter); - } - function formatValue(value) { - return value == null ? "" : value instanceof Date ? formatDate(value) : reFormat.test(value += "") ? '"' + value.replace(/"/g, '""') + '"' : value; - } - return { - parse, - parseRows, - format, - formatBody, - formatRows, - formatRow, - formatValue - }; -} -var csv = dsv(","); -var csvParse = csv.parse; -var csvParseRows = csv.parseRows; -var csvFormat = csv.format; -var csvFormatBody = csv.formatBody; -var csvFormatRows = csv.formatRows; -var csvFormatRow = csv.formatRow; -var csvFormatValue = csv.formatValue; -var tsv = dsv(" "); -var tsvParse = tsv.parse; -var tsvParseRows = tsv.parseRows; -var tsvFormat = tsv.format; -var tsvFormatBody = tsv.formatBody; -var tsvFormatRows = tsv.formatRows; -var tsvFormatRow = tsv.formatRow; -var tsvFormatValue = tsv.formatValue; -function autoType(object) { - for (var key in object) { - var value = object[key].trim(), number, m; - if (!value) - value = null; - else if (value === "true") - value = true; - else if (value === "false") - value = false; - else if (value === "NaN") - value = NaN; - else if (!isNaN(number = +value)) - value = number; - else if (m = value.match(/^([-+]\d{2})?\d{4}(-\d{2}(-\d{2})?)?(T\d{2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|[-+]\d{2}:\d{2})?)?$/)) { - if (fixtz && !!m[4] && !m[7]) - value = value.replace(/-/g, "/").replace(/T/, " "); - value = new Date(value); - } else - continue; - object[key] = value; - } - return object; -} -const fixtz = new Date("2019-01-01T00:00").getHours() || new Date("2019-07-01T00:00").getHours(); -export {autoType, csvFormat, csvFormatBody, csvFormatRow, csvFormatRows, csvFormatValue, csvParse, csvParseRows, dsv as dsvFormat, tsvFormat, tsvFormatBody, tsvFormatRow, tsvFormatRows, tsvFormatValue, tsvParse, tsvParseRows}; -export default null; diff --git a/web/client/deps/d3/d3-ease.js b/web/client/deps/d3/d3-ease.js deleted file mode 100644 index 9e73466f..00000000 --- a/web/client/deps/d3/d3-ease.js +++ /dev/null @@ -1,152 +0,0 @@ -const linear = (t) => +t; -function quadIn(t) { - return t * t; -} -function quadOut(t) { - return t * (2 - t); -} -function quadInOut(t) { - return ((t *= 2) <= 1 ? t * t : --t * (2 - t) + 1) / 2; -} -function cubicIn(t) { - return t * t * t; -} -function cubicOut(t) { - return --t * t * t + 1; -} -function cubicInOut(t) { - return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2; -} -var exponent = 3; -var polyIn = function custom(e) { - e = +e; - function polyIn2(t) { - return Math.pow(t, e); - } - polyIn2.exponent = custom; - return polyIn2; -}(exponent); -var polyOut = function custom2(e) { - e = +e; - function polyOut2(t) { - return 1 - Math.pow(1 - t, e); - } - polyOut2.exponent = custom2; - return polyOut2; -}(exponent); -var polyInOut = function custom3(e) { - e = +e; - function polyInOut2(t) { - return ((t *= 2) <= 1 ? Math.pow(t, e) : 2 - Math.pow(2 - t, e)) / 2; - } - polyInOut2.exponent = custom3; - return polyInOut2; -}(exponent); -var pi = Math.PI, halfPi = pi / 2; -function sinIn(t) { - return +t === 1 ? 1 : 1 - Math.cos(t * halfPi); -} -function sinOut(t) { - return Math.sin(t * halfPi); -} -function sinInOut(t) { - return (1 - Math.cos(pi * t)) / 2; -} -function tpmt(x) { - return (Math.pow(2, -10 * x) - 9765625e-10) * 1.0009775171065494; -} -function expIn(t) { - return tpmt(1 - +t); -} -function expOut(t) { - return 1 - tpmt(t); -} -function expInOut(t) { - return ((t *= 2) <= 1 ? tpmt(1 - t) : 2 - tpmt(t - 1)) / 2; -} -function circleIn(t) { - return 1 - Math.sqrt(1 - t * t); -} -function circleOut(t) { - return Math.sqrt(1 - --t * t); -} -function circleInOut(t) { - return ((t *= 2) <= 1 ? 1 - Math.sqrt(1 - t * t) : Math.sqrt(1 - (t -= 2) * t) + 1) / 2; -} -var b1 = 4 / 11, b2 = 6 / 11, b3 = 8 / 11, b4 = 3 / 4, b5 = 9 / 11, b6 = 10 / 11, b7 = 15 / 16, b8 = 21 / 22, b9 = 63 / 64, b0 = 1 / b1 / b1; -function bounceIn(t) { - return 1 - bounceOut(1 - t); -} -function bounceOut(t) { - return (t = +t) < b1 ? b0 * t * t : t < b3 ? b0 * (t -= b2) * t + b4 : t < b6 ? b0 * (t -= b5) * t + b7 : b0 * (t -= b8) * t + b9; -} -function bounceInOut(t) { - return ((t *= 2) <= 1 ? 1 - bounceOut(1 - t) : bounceOut(t - 1) + 1) / 2; -} -var overshoot = 1.70158; -var backIn = function custom4(s) { - s = +s; - function backIn2(t) { - return (t = +t) * t * (s * (t - 1) + t); - } - backIn2.overshoot = custom4; - return backIn2; -}(overshoot); -var backOut = function custom5(s) { - s = +s; - function backOut2(t) { - return --t * t * ((t + 1) * s + t) + 1; - } - backOut2.overshoot = custom5; - return backOut2; -}(overshoot); -var backInOut = function custom6(s) { - s = +s; - function backInOut2(t) { - return ((t *= 2) < 1 ? t * t * ((s + 1) * t - s) : (t -= 2) * t * ((s + 1) * t + s) + 2) / 2; - } - backInOut2.overshoot = custom6; - return backInOut2; -}(overshoot); -var tau = 2 * Math.PI, amplitude = 1, period = 0.3; -var elasticIn = function custom7(a, p) { - var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau); - function elasticIn2(t) { - return a * tpmt(- --t) * Math.sin((s - t) / p); - } - elasticIn2.amplitude = function(a2) { - return custom7(a2, p * tau); - }; - elasticIn2.period = function(p2) { - return custom7(a, p2); - }; - return elasticIn2; -}(amplitude, period); -var elasticOut = function custom8(a, p) { - var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau); - function elasticOut2(t) { - return 1 - a * tpmt(t = +t) * Math.sin((t + s) / p); - } - elasticOut2.amplitude = function(a2) { - return custom8(a2, p * tau); - }; - elasticOut2.period = function(p2) { - return custom8(a, p2); - }; - return elasticOut2; -}(amplitude, period); -var elasticInOut = function custom9(a, p) { - var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau); - function elasticInOut2(t) { - return ((t = t * 2 - 1) < 0 ? a * tpmt(-t) * Math.sin((s - t) / p) : 2 - a * tpmt(t) * Math.sin((s + t) / p)) / 2; - } - elasticInOut2.amplitude = function(a2) { - return custom9(a2, p * tau); - }; - elasticInOut2.period = function(p2) { - return custom9(a, p2); - }; - return elasticInOut2; -}(amplitude, period); -export {backInOut as easeBack, backIn as easeBackIn, backInOut as easeBackInOut, backOut as easeBackOut, bounceOut as easeBounce, bounceIn as easeBounceIn, bounceInOut as easeBounceInOut, bounceOut as easeBounceOut, circleInOut as easeCircle, circleIn as easeCircleIn, circleInOut as easeCircleInOut, circleOut as easeCircleOut, cubicInOut as easeCubic, cubicIn as easeCubicIn, cubicInOut as easeCubicInOut, cubicOut as easeCubicOut, elasticOut as easeElastic, elasticIn as easeElasticIn, elasticInOut as easeElasticInOut, elasticOut as easeElasticOut, expInOut as easeExp, expIn as easeExpIn, expInOut as easeExpInOut, expOut as easeExpOut, linear as easeLinear, polyInOut as easePoly, polyIn as easePolyIn, polyInOut as easePolyInOut, polyOut as easePolyOut, quadInOut as easeQuad, quadIn as easeQuadIn, quadInOut as easeQuadInOut, quadOut as easeQuadOut, sinInOut as easeSin, sinIn as easeSinIn, sinInOut as easeSinInOut, sinOut as easeSinOut}; -export default null; diff --git a/web/client/deps/d3/d3-fetch.js b/web/client/deps/d3/d3-fetch.js deleted file mode 100644 index b077efd1..00000000 --- a/web/client/deps/d3/d3-fetch.js +++ /dev/null @@ -1,74 +0,0 @@ -import {dsvFormat, tsvParse, csvParse} from "./d3-dsv.js"; -function responseBlob(response) { - if (!response.ok) - throw new Error(response.status + " " + response.statusText); - return response.blob(); -} -function blob(input, init) { - return fetch(input, init).then(responseBlob); -} -function responseArrayBuffer(response) { - if (!response.ok) - throw new Error(response.status + " " + response.statusText); - return response.arrayBuffer(); -} -function buffer(input, init) { - return fetch(input, init).then(responseArrayBuffer); -} -function responseText(response) { - if (!response.ok) - throw new Error(response.status + " " + response.statusText); - return response.text(); -} -function text(input, init) { - return fetch(input, init).then(responseText); -} -function dsvParse(parse) { - return function(input, init, row) { - if (arguments.length === 2 && typeof init === "function") - row = init, init = void 0; - return text(input, init).then(function(response) { - return parse(response, row); - }); - }; -} -function dsv(delimiter, input, init, row) { - if (arguments.length === 3 && typeof init === "function") - row = init, init = void 0; - var format = dsvFormat(delimiter); - return text(input, init).then(function(response) { - return format.parse(response, row); - }); -} -var csv = dsvParse(csvParse); -var tsv = dsvParse(tsvParse); -function image(input, init) { - return new Promise(function(resolve, reject) { - var image2 = new Image(); - for (var key in init) - image2[key] = init[key]; - image2.onerror = reject; - image2.onload = function() { - resolve(image2); - }; - image2.src = input; - }); -} -function responseJson(response) { - if (!response.ok) - throw new Error(response.status + " " + response.statusText); - if (response.status === 204 || response.status === 205) - return; - return response.json(); -} -function json(input, init) { - return fetch(input, init).then(responseJson); -} -function parser(type) { - return (input, init) => text(input, init).then((text2) => new DOMParser().parseFromString(text2, type)); -} -var xml = parser("application/xml"); -var html = parser("text/html"); -var svg = parser("image/svg+xml"); -export {blob, buffer, csv, dsv, html, image, json, svg, text, tsv, xml}; -export default null; diff --git a/web/client/deps/d3/d3-force.js b/web/client/deps/d3/d3-force.js deleted file mode 100644 index 9cc5d1de..00000000 --- a/web/client/deps/d3/d3-force.js +++ /dev/null @@ -1,524 +0,0 @@ -import {quadtree} from "./d3-quadtree.js"; -import {dispatch} from "./d3-dispatch.js"; -import {timer} from "./d3-timer.js"; -function center(x2, y2) { - var nodes, strength = 1; - if (x2 == null) - x2 = 0; - if (y2 == null) - y2 = 0; - function force() { - var i, n = nodes.length, node, sx = 0, sy = 0; - for (i = 0; i < n; ++i) { - node = nodes[i], sx += node.x, sy += node.y; - } - for (sx = (sx / n - x2) * strength, sy = (sy / n - y2) * strength, i = 0; i < n; ++i) { - node = nodes[i], node.x -= sx, node.y -= sy; - } - } - force.initialize = function(_) { - nodes = _; - }; - force.x = function(_) { - return arguments.length ? (x2 = +_, force) : x2; - }; - force.y = function(_) { - return arguments.length ? (y2 = +_, force) : y2; - }; - force.strength = function(_) { - return arguments.length ? (strength = +_, force) : strength; - }; - return force; -} -function constant(x2) { - return function() { - return x2; - }; -} -function jiggle(random) { - return (random() - 0.5) * 1e-6; -} -function x(d) { - return d.x + d.vx; -} -function y(d) { - return d.y + d.vy; -} -function collide(radius) { - var nodes, radii, random, strength = 1, iterations = 1; - if (typeof radius !== "function") - radius = constant(radius == null ? 1 : +radius); - function force() { - var i, n = nodes.length, tree, node, xi, yi, ri, ri2; - for (var k = 0; k < iterations; ++k) { - tree = quadtree(nodes, x, y).visitAfter(prepare); - for (i = 0; i < n; ++i) { - node = nodes[i]; - ri = radii[node.index], ri2 = ri * ri; - xi = node.x + node.vx; - yi = node.y + node.vy; - tree.visit(apply); - } - } - function apply(quad, x0, y0, x1, y1) { - var data = quad.data, rj = quad.r, r = ri + rj; - if (data) { - if (data.index > node.index) { - var x2 = xi - data.x - data.vx, y2 = yi - data.y - data.vy, l = x2 * x2 + y2 * y2; - if (l < r * r) { - if (x2 === 0) - x2 = jiggle(random), l += x2 * x2; - if (y2 === 0) - y2 = jiggle(random), l += y2 * y2; - l = (r - (l = Math.sqrt(l))) / l * strength; - node.vx += (x2 *= l) * (r = (rj *= rj) / (ri2 + rj)); - node.vy += (y2 *= l) * r; - data.vx -= x2 * (r = 1 - r); - data.vy -= y2 * r; - } - } - return; - } - return x0 > xi + r || x1 < xi - r || y0 > yi + r || y1 < yi - r; - } - } - function prepare(quad) { - if (quad.data) - return quad.r = radii[quad.data.index]; - for (var i = quad.r = 0; i < 4; ++i) { - if (quad[i] && quad[i].r > quad.r) { - quad.r = quad[i].r; - } - } - } - function initialize() { - if (!nodes) - return; - var i, n = nodes.length, node; - radii = new Array(n); - for (i = 0; i < n; ++i) - node = nodes[i], radii[node.index] = +radius(node, i, nodes); - } - force.initialize = function(_nodes, _random) { - nodes = _nodes; - random = _random; - initialize(); - }; - force.iterations = function(_) { - return arguments.length ? (iterations = +_, force) : iterations; - }; - force.strength = function(_) { - return arguments.length ? (strength = +_, force) : strength; - }; - force.radius = function(_) { - return arguments.length ? (radius = typeof _ === "function" ? _ : constant(+_), initialize(), force) : radius; - }; - return force; -} -function index(d) { - return d.index; -} -function find(nodeById, nodeId) { - var node = nodeById.get(nodeId); - if (!node) - throw new Error("node not found: " + nodeId); - return node; -} -function link(links) { - var id = index, strength = defaultStrength, strengths, distance = constant(30), distances, nodes, count, bias, random, iterations = 1; - if (links == null) - links = []; - function defaultStrength(link2) { - return 1 / Math.min(count[link2.source.index], count[link2.target.index]); - } - function force(alpha) { - for (var k = 0, n = links.length; k < iterations; ++k) { - for (var i = 0, link2, source, target, x2, y2, l, b; i < n; ++i) { - link2 = links[i], source = link2.source, target = link2.target; - x2 = target.x + target.vx - source.x - source.vx || jiggle(random); - y2 = target.y + target.vy - source.y - source.vy || jiggle(random); - l = Math.sqrt(x2 * x2 + y2 * y2); - l = (l - distances[i]) / l * alpha * strengths[i]; - x2 *= l, y2 *= l; - target.vx -= x2 * (b = bias[i]); - target.vy -= y2 * b; - source.vx += x2 * (b = 1 - b); - source.vy += y2 * b; - } - } - } - function initialize() { - if (!nodes) - return; - var i, n = nodes.length, m2 = links.length, nodeById = new Map(nodes.map((d, i2) => [id(d, i2, nodes), d])), link2; - for (i = 0, count = new Array(n); i < m2; ++i) { - link2 = links[i], link2.index = i; - if (typeof link2.source !== "object") - link2.source = find(nodeById, link2.source); - if (typeof link2.target !== "object") - link2.target = find(nodeById, link2.target); - count[link2.source.index] = (count[link2.source.index] || 0) + 1; - count[link2.target.index] = (count[link2.target.index] || 0) + 1; - } - for (i = 0, bias = new Array(m2); i < m2; ++i) { - link2 = links[i], bias[i] = count[link2.source.index] / (count[link2.source.index] + count[link2.target.index]); - } - strengths = new Array(m2), initializeStrength(); - distances = new Array(m2), initializeDistance(); - } - function initializeStrength() { - if (!nodes) - return; - for (var i = 0, n = links.length; i < n; ++i) { - strengths[i] = +strength(links[i], i, links); - } - } - function initializeDistance() { - if (!nodes) - return; - for (var i = 0, n = links.length; i < n; ++i) { - distances[i] = +distance(links[i], i, links); - } - } - force.initialize = function(_nodes, _random) { - nodes = _nodes; - random = _random; - initialize(); - }; - force.links = function(_) { - return arguments.length ? (links = _, initialize(), force) : links; - }; - force.id = function(_) { - return arguments.length ? (id = _, force) : id; - }; - force.iterations = function(_) { - return arguments.length ? (iterations = +_, force) : iterations; - }; - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initializeStrength(), force) : strength; - }; - force.distance = function(_) { - return arguments.length ? (distance = typeof _ === "function" ? _ : constant(+_), initializeDistance(), force) : distance; - }; - return force; -} -const a = 1664525; -const c = 1013904223; -const m = 4294967296; -function lcg() { - let s = 1; - return () => (s = (a * s + c) % m) / m; -} -function x$1(d) { - return d.x; -} -function y$1(d) { - return d.y; -} -var initialRadius = 10, initialAngle = Math.PI * (3 - Math.sqrt(5)); -function simulation(nodes) { - var simulation2, alpha = 1, alphaMin = 1e-3, alphaDecay = 1 - Math.pow(alphaMin, 1 / 300), alphaTarget = 0, velocityDecay = 0.6, forces = new Map(), stepper = timer(step), event = dispatch("tick", "end"), random = lcg(); - if (nodes == null) - nodes = []; - function step() { - tick(); - event.call("tick", simulation2); - if (alpha < alphaMin) { - stepper.stop(); - event.call("end", simulation2); - } - } - function tick(iterations) { - var i, n = nodes.length, node; - if (iterations === void 0) - iterations = 1; - for (var k = 0; k < iterations; ++k) { - alpha += (alphaTarget - alpha) * alphaDecay; - forces.forEach(function(force) { - force(alpha); - }); - for (i = 0; i < n; ++i) { - node = nodes[i]; - if (node.fx == null) - node.x += node.vx *= velocityDecay; - else - node.x = node.fx, node.vx = 0; - if (node.fy == null) - node.y += node.vy *= velocityDecay; - else - node.y = node.fy, node.vy = 0; - } - } - return simulation2; - } - function initializeNodes() { - for (var i = 0, n = nodes.length, node; i < n; ++i) { - node = nodes[i], node.index = i; - if (node.fx != null) - node.x = node.fx; - if (node.fy != null) - node.y = node.fy; - if (isNaN(node.x) || isNaN(node.y)) { - var radius = initialRadius * Math.sqrt(0.5 + i), angle = i * initialAngle; - node.x = radius * Math.cos(angle); - node.y = radius * Math.sin(angle); - } - if (isNaN(node.vx) || isNaN(node.vy)) { - node.vx = node.vy = 0; - } - } - } - function initializeForce(force) { - if (force.initialize) - force.initialize(nodes, random); - return force; - } - initializeNodes(); - return simulation2 = { - tick, - restart: function() { - return stepper.restart(step), simulation2; - }, - stop: function() { - return stepper.stop(), simulation2; - }, - nodes: function(_) { - return arguments.length ? (nodes = _, initializeNodes(), forces.forEach(initializeForce), simulation2) : nodes; - }, - alpha: function(_) { - return arguments.length ? (alpha = +_, simulation2) : alpha; - }, - alphaMin: function(_) { - return arguments.length ? (alphaMin = +_, simulation2) : alphaMin; - }, - alphaDecay: function(_) { - return arguments.length ? (alphaDecay = +_, simulation2) : +alphaDecay; - }, - alphaTarget: function(_) { - return arguments.length ? (alphaTarget = +_, simulation2) : alphaTarget; - }, - velocityDecay: function(_) { - return arguments.length ? (velocityDecay = 1 - _, simulation2) : 1 - velocityDecay; - }, - randomSource: function(_) { - return arguments.length ? (random = _, forces.forEach(initializeForce), simulation2) : random; - }, - force: function(name, _) { - return arguments.length > 1 ? (_ == null ? forces.delete(name) : forces.set(name, initializeForce(_)), simulation2) : forces.get(name); - }, - find: function(x2, y2, radius) { - var i = 0, n = nodes.length, dx, dy, d2, node, closest; - if (radius == null) - radius = Infinity; - else - radius *= radius; - for (i = 0; i < n; ++i) { - node = nodes[i]; - dx = x2 - node.x; - dy = y2 - node.y; - d2 = dx * dx + dy * dy; - if (d2 < radius) - closest = node, radius = d2; - } - return closest; - }, - on: function(name, _) { - return arguments.length > 1 ? (event.on(name, _), simulation2) : event.on(name); - } - }; -} -function manyBody() { - var nodes, node, random, alpha, strength = constant(-30), strengths, distanceMin2 = 1, distanceMax2 = Infinity, theta2 = 0.81; - function force(_) { - var i, n = nodes.length, tree = quadtree(nodes, x$1, y$1).visitAfter(accumulate); - for (alpha = _, i = 0; i < n; ++i) - node = nodes[i], tree.visit(apply); - } - function initialize() { - if (!nodes) - return; - var i, n = nodes.length, node2; - strengths = new Array(n); - for (i = 0; i < n; ++i) - node2 = nodes[i], strengths[node2.index] = +strength(node2, i, nodes); - } - function accumulate(quad) { - var strength2 = 0, q, c2, weight = 0, x2, y2, i; - if (quad.length) { - for (x2 = y2 = i = 0; i < 4; ++i) { - if ((q = quad[i]) && (c2 = Math.abs(q.value))) { - strength2 += q.value, weight += c2, x2 += c2 * q.x, y2 += c2 * q.y; - } - } - quad.x = x2 / weight; - quad.y = y2 / weight; - } else { - q = quad; - q.x = q.data.x; - q.y = q.data.y; - do - strength2 += strengths[q.data.index]; - while (q = q.next); - } - quad.value = strength2; - } - function apply(quad, x1, _, x2) { - if (!quad.value) - return true; - var x3 = quad.x - node.x, y2 = quad.y - node.y, w = x2 - x1, l = x3 * x3 + y2 * y2; - if (w * w / theta2 < l) { - if (l < distanceMax2) { - if (x3 === 0) - x3 = jiggle(random), l += x3 * x3; - if (y2 === 0) - y2 = jiggle(random), l += y2 * y2; - if (l < distanceMin2) - l = Math.sqrt(distanceMin2 * l); - node.vx += x3 * quad.value * alpha / l; - node.vy += y2 * quad.value * alpha / l; - } - return true; - } else if (quad.length || l >= distanceMax2) - return; - if (quad.data !== node || quad.next) { - if (x3 === 0) - x3 = jiggle(random), l += x3 * x3; - if (y2 === 0) - y2 = jiggle(random), l += y2 * y2; - if (l < distanceMin2) - l = Math.sqrt(distanceMin2 * l); - } - do - if (quad.data !== node) { - w = strengths[quad.data.index] * alpha / l; - node.vx += x3 * w; - node.vy += y2 * w; - } - while (quad = quad.next); - } - force.initialize = function(_nodes, _random) { - nodes = _nodes; - random = _random; - initialize(); - }; - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initialize(), force) : strength; - }; - force.distanceMin = function(_) { - return arguments.length ? (distanceMin2 = _ * _, force) : Math.sqrt(distanceMin2); - }; - force.distanceMax = function(_) { - return arguments.length ? (distanceMax2 = _ * _, force) : Math.sqrt(distanceMax2); - }; - force.theta = function(_) { - return arguments.length ? (theta2 = _ * _, force) : Math.sqrt(theta2); - }; - return force; -} -function radial(radius, x2, y2) { - var nodes, strength = constant(0.1), strengths, radiuses; - if (typeof radius !== "function") - radius = constant(+radius); - if (x2 == null) - x2 = 0; - if (y2 == null) - y2 = 0; - function force(alpha) { - for (var i = 0, n = nodes.length; i < n; ++i) { - var node = nodes[i], dx = node.x - x2 || 1e-6, dy = node.y - y2 || 1e-6, r = Math.sqrt(dx * dx + dy * dy), k = (radiuses[i] - r) * strengths[i] * alpha / r; - node.vx += dx * k; - node.vy += dy * k; - } - } - function initialize() { - if (!nodes) - return; - var i, n = nodes.length; - strengths = new Array(n); - radiuses = new Array(n); - for (i = 0; i < n; ++i) { - radiuses[i] = +radius(nodes[i], i, nodes); - strengths[i] = isNaN(radiuses[i]) ? 0 : +strength(nodes[i], i, nodes); - } - } - force.initialize = function(_) { - nodes = _, initialize(); - }; - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initialize(), force) : strength; - }; - force.radius = function(_) { - return arguments.length ? (radius = typeof _ === "function" ? _ : constant(+_), initialize(), force) : radius; - }; - force.x = function(_) { - return arguments.length ? (x2 = +_, force) : x2; - }; - force.y = function(_) { - return arguments.length ? (y2 = +_, force) : y2; - }; - return force; -} -function x$2(x2) { - var strength = constant(0.1), nodes, strengths, xz; - if (typeof x2 !== "function") - x2 = constant(x2 == null ? 0 : +x2); - function force(alpha) { - for (var i = 0, n = nodes.length, node; i < n; ++i) { - node = nodes[i], node.vx += (xz[i] - node.x) * strengths[i] * alpha; - } - } - function initialize() { - if (!nodes) - return; - var i, n = nodes.length; - strengths = new Array(n); - xz = new Array(n); - for (i = 0; i < n; ++i) { - strengths[i] = isNaN(xz[i] = +x2(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); - } - } - force.initialize = function(_) { - nodes = _; - initialize(); - }; - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initialize(), force) : strength; - }; - force.x = function(_) { - return arguments.length ? (x2 = typeof _ === "function" ? _ : constant(+_), initialize(), force) : x2; - }; - return force; -} -function y$2(y2) { - var strength = constant(0.1), nodes, strengths, yz; - if (typeof y2 !== "function") - y2 = constant(y2 == null ? 0 : +y2); - function force(alpha) { - for (var i = 0, n = nodes.length, node; i < n; ++i) { - node = nodes[i], node.vy += (yz[i] - node.y) * strengths[i] * alpha; - } - } - function initialize() { - if (!nodes) - return; - var i, n = nodes.length; - strengths = new Array(n); - yz = new Array(n); - for (i = 0; i < n; ++i) { - strengths[i] = isNaN(yz[i] = +y2(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); - } - } - force.initialize = function(_) { - nodes = _; - initialize(); - }; - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initialize(), force) : strength; - }; - force.y = function(_) { - return arguments.length ? (y2 = typeof _ === "function" ? _ : constant(+_), initialize(), force) : y2; - }; - return force; -} -export {center as forceCenter, collide as forceCollide, link as forceLink, manyBody as forceManyBody, radial as forceRadial, simulation as forceSimulation, x$2 as forceX, y$2 as forceY}; -export default null; diff --git a/web/client/deps/d3/d3-format.js b/web/client/deps/d3/d3-format.js deleted file mode 100644 index b7b680d0..00000000 --- a/web/client/deps/d3/d3-format.js +++ /dev/null @@ -1,229 +0,0 @@ -function formatDecimal(x) { - return Math.abs(x = Math.round(x)) >= 1e21 ? x.toLocaleString("en").replace(/,/g, "") : x.toString(10); -} -function formatDecimalParts(x, p) { - if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) - return null; - var i, coefficient = x.slice(0, i); - return [ - coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient, - +x.slice(i + 1) - ]; -} -function exponent(x) { - return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN; -} -function formatGroup(grouping, thousands) { - return function(value, width) { - var i = value.length, t = [], j = 0, g = grouping[0], length = 0; - while (i > 0 && g > 0) { - if (length + g + 1 > width) - g = Math.max(1, width - length); - t.push(value.substring(i -= g, i + g)); - if ((length += g + 1) > width) - break; - g = grouping[j = (j + 1) % grouping.length]; - } - return t.reverse().join(thousands); - }; -} -function formatNumerals(numerals) { - return function(value) { - return value.replace(/[0-9]/g, function(i) { - return numerals[+i]; - }); - }; -} -var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i; -function formatSpecifier(specifier) { - if (!(match = re.exec(specifier))) - throw new Error("invalid format: " + specifier); - var match; - return new FormatSpecifier({ - fill: match[1], - align: match[2], - sign: match[3], - symbol: match[4], - zero: match[5], - width: match[6], - comma: match[7], - precision: match[8] && match[8].slice(1), - trim: match[9], - type: match[10] - }); -} -formatSpecifier.prototype = FormatSpecifier.prototype; -function FormatSpecifier(specifier) { - this.fill = specifier.fill === void 0 ? " " : specifier.fill + ""; - this.align = specifier.align === void 0 ? ">" : specifier.align + ""; - this.sign = specifier.sign === void 0 ? "-" : specifier.sign + ""; - this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + ""; - this.zero = !!specifier.zero; - this.width = specifier.width === void 0 ? void 0 : +specifier.width; - this.comma = !!specifier.comma; - this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision; - this.trim = !!specifier.trim; - this.type = specifier.type === void 0 ? "" : specifier.type + ""; -} -FormatSpecifier.prototype.toString = function() { - return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type; -}; -function formatTrim(s) { - out: - for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) { - switch (s[i]) { - case ".": - i0 = i1 = i; - break; - case "0": - if (i0 === 0) - i0 = i; - i1 = i; - break; - default: - if (!+s[i]) - break out; - if (i0 > 0) - i0 = 0; - break; - } - } - return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s; -} -var prefixExponent; -function formatPrefixAuto(x, p) { - var d = formatDecimalParts(x, p); - if (!d) - return x + ""; - var coefficient = d[0], exponent2 = d[1], i = exponent2 - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent2 / 3))) * 3) + 1, n = coefficient.length; - return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + formatDecimalParts(x, Math.max(0, p + i - 1))[0]; -} -function formatRounded(x, p) { - var d = formatDecimalParts(x, p); - if (!d) - return x + ""; - var coefficient = d[0], exponent2 = d[1]; - return exponent2 < 0 ? "0." + new Array(-exponent2).join("0") + coefficient : coefficient.length > exponent2 + 1 ? coefficient.slice(0, exponent2 + 1) + "." + coefficient.slice(exponent2 + 1) : coefficient + new Array(exponent2 - coefficient.length + 2).join("0"); -} -var formatTypes = { - "%": (x, p) => (x * 100).toFixed(p), - b: (x) => Math.round(x).toString(2), - c: (x) => x + "", - d: formatDecimal, - e: (x, p) => x.toExponential(p), - f: (x, p) => x.toFixed(p), - g: (x, p) => x.toPrecision(p), - o: (x) => Math.round(x).toString(8), - p: (x, p) => formatRounded(x * 100, p), - r: formatRounded, - s: formatPrefixAuto, - X: (x) => Math.round(x).toString(16).toUpperCase(), - x: (x) => Math.round(x).toString(16) -}; -function identity(x) { - return x; -} -var map = Array.prototype.map, prefixes = ["y", "z", "a", "f", "p", "n", "\xB5", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"]; -function formatLocale(locale2) { - var group = locale2.grouping === void 0 || locale2.thousands === void 0 ? identity : formatGroup(map.call(locale2.grouping, Number), locale2.thousands + ""), currencyPrefix = locale2.currency === void 0 ? "" : locale2.currency[0] + "", currencySuffix = locale2.currency === void 0 ? "" : locale2.currency[1] + "", decimal = locale2.decimal === void 0 ? "." : locale2.decimal + "", numerals = locale2.numerals === void 0 ? identity : formatNumerals(map.call(locale2.numerals, String)), percent = locale2.percent === void 0 ? "%" : locale2.percent + "", minus = locale2.minus === void 0 ? "\u2212" : locale2.minus + "", nan = locale2.nan === void 0 ? "NaN" : locale2.nan + ""; - function newFormat(specifier) { - specifier = formatSpecifier(specifier); - var fill = specifier.fill, align = specifier.align, sign = specifier.sign, symbol = specifier.symbol, zero = specifier.zero, width = specifier.width, comma = specifier.comma, precision = specifier.precision, trim = specifier.trim, type = specifier.type; - if (type === "n") - comma = true, type = "g"; - else if (!formatTypes[type]) - precision === void 0 && (precision = 12), trim = true, type = "g"; - if (zero || fill === "0" && align === "=") - zero = true, fill = "0", align = "="; - var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : ""; - var formatType = formatTypes[type], maybeSuffix = /[defgprs%]/.test(type); - precision = precision === void 0 ? 6 : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision)); - function format2(value) { - var valuePrefix = prefix, valueSuffix = suffix, i, n, c; - if (type === "c") { - valueSuffix = formatType(value) + valueSuffix; - value = ""; - } else { - value = +value; - var valueNegative = value < 0 || 1 / value < 0; - value = isNaN(value) ? nan : formatType(Math.abs(value), precision); - if (trim) - value = formatTrim(value); - if (valueNegative && +value === 0 && sign !== "+") - valueNegative = false; - valuePrefix = (valueNegative ? sign === "(" ? sign : minus : sign === "-" || sign === "(" ? "" : sign) + valuePrefix; - valueSuffix = (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : ""); - if (maybeSuffix) { - i = -1, n = value.length; - while (++i < n) { - if (c = value.charCodeAt(i), 48 > c || c > 57) { - valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix; - value = value.slice(0, i); - break; - } - } - } - } - if (comma && !zero) - value = group(value, Infinity); - var length = valuePrefix.length + value.length + valueSuffix.length, padding = length < width ? new Array(width - length + 1).join(fill) : ""; - if (comma && zero) - value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = ""; - switch (align) { - case "<": - value = valuePrefix + value + valueSuffix + padding; - break; - case "=": - value = valuePrefix + padding + value + valueSuffix; - break; - case "^": - value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); - break; - default: - value = padding + valuePrefix + value + valueSuffix; - break; - } - return numerals(value); - } - format2.toString = function() { - return specifier + ""; - }; - return format2; - } - function formatPrefix2(specifier, value) { - var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3, k = Math.pow(10, -e), prefix = prefixes[8 + e / 3]; - return function(value2) { - return f(k * value2) + prefix; - }; - } - return { - format: newFormat, - formatPrefix: formatPrefix2 - }; -} -var locale; -var format; -var formatPrefix; -defaultLocale({ - thousands: ",", - grouping: [3], - currency: ["$", ""] -}); -function defaultLocale(definition) { - locale = formatLocale(definition); - format = locale.format; - formatPrefix = locale.formatPrefix; - return locale; -} -function precisionFixed(step) { - return Math.max(0, -exponent(Math.abs(step))); -} -function precisionPrefix(step, value) { - return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step))); -} -function precisionRound(step, max) { - step = Math.abs(step), max = Math.abs(max) - step; - return Math.max(0, exponent(max) - exponent(step)) + 1; -} -export {FormatSpecifier, format, defaultLocale as formatDefaultLocale, formatLocale, formatPrefix, formatSpecifier, precisionFixed, precisionPrefix, precisionRound}; -export default null; diff --git a/web/client/deps/d3/d3-geo.js b/web/client/deps/d3/d3-geo.js deleted file mode 100644 index 7cdcb91a..00000000 --- a/web/client/deps/d3/d3-geo.js +++ /dev/null @@ -1,2374 +0,0 @@ -import {Adder, merge, range as range$1} from "./d3-array.js"; -var epsilon = 1e-6; -var epsilon2 = 1e-12; -var pi = Math.PI; -var halfPi = pi / 2; -var quarterPi = pi / 4; -var tau = pi * 2; -var degrees = 180 / pi; -var radians = pi / 180; -var abs = Math.abs; -var atan = Math.atan; -var atan2 = Math.atan2; -var cos = Math.cos; -var ceil = Math.ceil; -var exp = Math.exp; -var hypot = Math.hypot; -var log = Math.log; -var pow = Math.pow; -var sin = Math.sin; -var sign = Math.sign || function(x) { - return x > 0 ? 1 : x < 0 ? -1 : 0; -}; -var sqrt = Math.sqrt; -var tan = Math.tan; -function acos(x) { - return x > 1 ? 0 : x < -1 ? pi : Math.acos(x); -} -function asin(x) { - return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x); -} -function haversin(x) { - return (x = sin(x / 2)) * x; -} -function noop() { -} -function streamGeometry(geometry, stream) { - if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) { - streamGeometryType[geometry.type](geometry, stream); - } -} -var streamObjectType = { - Feature: function(object2, stream) { - streamGeometry(object2.geometry, stream); - }, - FeatureCollection: function(object2, stream) { - var features = object2.features, i = -1, n = features.length; - while (++i < n) - streamGeometry(features[i].geometry, stream); - } -}; -var streamGeometryType = { - Sphere: function(object2, stream) { - stream.sphere(); - }, - Point: function(object2, stream) { - object2 = object2.coordinates; - stream.point(object2[0], object2[1], object2[2]); - }, - MultiPoint: function(object2, stream) { - var coordinates2 = object2.coordinates, i = -1, n = coordinates2.length; - while (++i < n) - object2 = coordinates2[i], stream.point(object2[0], object2[1], object2[2]); - }, - LineString: function(object2, stream) { - streamLine(object2.coordinates, stream, 0); - }, - MultiLineString: function(object2, stream) { - var coordinates2 = object2.coordinates, i = -1, n = coordinates2.length; - while (++i < n) - streamLine(coordinates2[i], stream, 0); - }, - Polygon: function(object2, stream) { - streamPolygon(object2.coordinates, stream); - }, - MultiPolygon: function(object2, stream) { - var coordinates2 = object2.coordinates, i = -1, n = coordinates2.length; - while (++i < n) - streamPolygon(coordinates2[i], stream); - }, - GeometryCollection: function(object2, stream) { - var geometries = object2.geometries, i = -1, n = geometries.length; - while (++i < n) - streamGeometry(geometries[i], stream); - } -}; -function streamLine(coordinates2, stream, closed) { - var i = -1, n = coordinates2.length - closed, coordinate; - stream.lineStart(); - while (++i < n) - coordinate = coordinates2[i], stream.point(coordinate[0], coordinate[1], coordinate[2]); - stream.lineEnd(); -} -function streamPolygon(coordinates2, stream) { - var i = -1, n = coordinates2.length; - stream.polygonStart(); - while (++i < n) - streamLine(coordinates2[i], stream, 1); - stream.polygonEnd(); -} -function geoStream(object2, stream) { - if (object2 && streamObjectType.hasOwnProperty(object2.type)) { - streamObjectType[object2.type](object2, stream); - } else { - streamGeometry(object2, stream); - } -} -var areaRingSum = new Adder(); -var areaSum = new Adder(), lambda00, phi00, lambda0, cosPhi0, sinPhi0; -var areaStream = { - point: noop, - lineStart: noop, - lineEnd: noop, - polygonStart: function() { - areaRingSum = new Adder(); - areaStream.lineStart = areaRingStart; - areaStream.lineEnd = areaRingEnd; - }, - polygonEnd: function() { - var areaRing = +areaRingSum; - areaSum.add(areaRing < 0 ? tau + areaRing : areaRing); - this.lineStart = this.lineEnd = this.point = noop; - }, - sphere: function() { - areaSum.add(tau); - } -}; -function areaRingStart() { - areaStream.point = areaPointFirst; -} -function areaRingEnd() { - areaPoint(lambda00, phi00); -} -function areaPointFirst(lambda, phi) { - areaStream.point = areaPoint; - lambda00 = lambda, phi00 = phi; - lambda *= radians, phi *= radians; - lambda0 = lambda, cosPhi0 = cos(phi = phi / 2 + quarterPi), sinPhi0 = sin(phi); -} -function areaPoint(lambda, phi) { - lambda *= radians, phi *= radians; - phi = phi / 2 + quarterPi; - var dLambda = lambda - lambda0, sdLambda = dLambda >= 0 ? 1 : -1, adLambda = sdLambda * dLambda, cosPhi = cos(phi), sinPhi = sin(phi), k = sinPhi0 * sinPhi, u = cosPhi0 * cosPhi + k * cos(adLambda), v = k * sdLambda * sin(adLambda); - areaRingSum.add(atan2(v, u)); - lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi; -} -function area(object2) { - areaSum = new Adder(); - geoStream(object2, areaStream); - return areaSum * 2; -} -function spherical(cartesian2) { - return [atan2(cartesian2[1], cartesian2[0]), asin(cartesian2[2])]; -} -function cartesian(spherical2) { - var lambda = spherical2[0], phi = spherical2[1], cosPhi = cos(phi); - return [cosPhi * cos(lambda), cosPhi * sin(lambda), sin(phi)]; -} -function cartesianDot(a, b) { - return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; -} -function cartesianCross(a, b) { - return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]]; -} -function cartesianAddInPlace(a, b) { - a[0] += b[0], a[1] += b[1], a[2] += b[2]; -} -function cartesianScale(vector, k) { - return [vector[0] * k, vector[1] * k, vector[2] * k]; -} -function cartesianNormalizeInPlace(d) { - var l = sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]); - d[0] /= l, d[1] /= l, d[2] /= l; -} -var lambda0$1, phi0, lambda1, phi1, lambda2, lambda00$1, phi00$1, p0, deltaSum, ranges, range; -var boundsStream = { - point: boundsPoint, - lineStart: boundsLineStart, - lineEnd: boundsLineEnd, - polygonStart: function() { - boundsStream.point = boundsRingPoint; - boundsStream.lineStart = boundsRingStart; - boundsStream.lineEnd = boundsRingEnd; - deltaSum = new Adder(); - areaStream.polygonStart(); - }, - polygonEnd: function() { - areaStream.polygonEnd(); - boundsStream.point = boundsPoint; - boundsStream.lineStart = boundsLineStart; - boundsStream.lineEnd = boundsLineEnd; - if (areaRingSum < 0) - lambda0$1 = -(lambda1 = 180), phi0 = -(phi1 = 90); - else if (deltaSum > epsilon) - phi1 = 90; - else if (deltaSum < -epsilon) - phi0 = -90; - range[0] = lambda0$1, range[1] = lambda1; - }, - sphere: function() { - lambda0$1 = -(lambda1 = 180), phi0 = -(phi1 = 90); - } -}; -function boundsPoint(lambda, phi) { - ranges.push(range = [lambda0$1 = lambda, lambda1 = lambda]); - if (phi < phi0) - phi0 = phi; - if (phi > phi1) - phi1 = phi; -} -function linePoint(lambda, phi) { - var p = cartesian([lambda * radians, phi * radians]); - if (p0) { - var normal = cartesianCross(p0, p), equatorial = [normal[1], -normal[0], 0], inflection = cartesianCross(equatorial, normal); - cartesianNormalizeInPlace(inflection); - inflection = spherical(inflection); - var delta = lambda - lambda2, sign2 = delta > 0 ? 1 : -1, lambdai = inflection[0] * degrees * sign2, phii, antimeridian = abs(delta) > 180; - if (antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) { - phii = inflection[1] * degrees; - if (phii > phi1) - phi1 = phii; - } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) { - phii = -inflection[1] * degrees; - if (phii < phi0) - phi0 = phii; - } else { - if (phi < phi0) - phi0 = phi; - if (phi > phi1) - phi1 = phi; - } - if (antimeridian) { - if (lambda < lambda2) { - if (angle(lambda0$1, lambda) > angle(lambda0$1, lambda1)) - lambda1 = lambda; - } else { - if (angle(lambda, lambda1) > angle(lambda0$1, lambda1)) - lambda0$1 = lambda; - } - } else { - if (lambda1 >= lambda0$1) { - if (lambda < lambda0$1) - lambda0$1 = lambda; - if (lambda > lambda1) - lambda1 = lambda; - } else { - if (lambda > lambda2) { - if (angle(lambda0$1, lambda) > angle(lambda0$1, lambda1)) - lambda1 = lambda; - } else { - if (angle(lambda, lambda1) > angle(lambda0$1, lambda1)) - lambda0$1 = lambda; - } - } - } - } else { - ranges.push(range = [lambda0$1 = lambda, lambda1 = lambda]); - } - if (phi < phi0) - phi0 = phi; - if (phi > phi1) - phi1 = phi; - p0 = p, lambda2 = lambda; -} -function boundsLineStart() { - boundsStream.point = linePoint; -} -function boundsLineEnd() { - range[0] = lambda0$1, range[1] = lambda1; - boundsStream.point = boundsPoint; - p0 = null; -} -function boundsRingPoint(lambda, phi) { - if (p0) { - var delta = lambda - lambda2; - deltaSum.add(abs(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta); - } else { - lambda00$1 = lambda, phi00$1 = phi; - } - areaStream.point(lambda, phi); - linePoint(lambda, phi); -} -function boundsRingStart() { - areaStream.lineStart(); -} -function boundsRingEnd() { - boundsRingPoint(lambda00$1, phi00$1); - areaStream.lineEnd(); - if (abs(deltaSum) > epsilon) - lambda0$1 = -(lambda1 = 180); - range[0] = lambda0$1, range[1] = lambda1; - p0 = null; -} -function angle(lambda02, lambda12) { - return (lambda12 -= lambda02) < 0 ? lambda12 + 360 : lambda12; -} -function rangeCompare(a, b) { - return a[0] - b[0]; -} -function rangeContains(range2, x) { - return range2[0] <= range2[1] ? range2[0] <= x && x <= range2[1] : x < range2[0] || range2[1] < x; -} -function bounds(feature) { - var i, n, a, b, merged, deltaMax, delta; - phi1 = lambda1 = -(lambda0$1 = phi0 = Infinity); - ranges = []; - geoStream(feature, boundsStream); - if (n = ranges.length) { - ranges.sort(rangeCompare); - for (i = 1, a = ranges[0], merged = [a]; i < n; ++i) { - b = ranges[i]; - if (rangeContains(a, b[0]) || rangeContains(a, b[1])) { - if (angle(a[0], b[1]) > angle(a[0], a[1])) - a[1] = b[1]; - if (angle(b[0], a[1]) > angle(a[0], a[1])) - a[0] = b[0]; - } else { - merged.push(a = b); - } - } - for (deltaMax = -Infinity, n = merged.length - 1, i = 0, a = merged[n]; i <= n; a = b, ++i) { - b = merged[i]; - if ((delta = angle(a[1], b[0])) > deltaMax) - deltaMax = delta, lambda0$1 = b[0], lambda1 = a[1]; - } - } - ranges = range = null; - return lambda0$1 === Infinity || phi0 === Infinity ? [[NaN, NaN], [NaN, NaN]] : [[lambda0$1, phi0], [lambda1, phi1]]; -} -var W0, W1, X0, Y0, Z0, X1, Y1, Z1, X2, Y2, Z2, lambda00$2, phi00$2, x0, y0, z0; -var centroidStream = { - sphere: noop, - point: centroidPoint, - lineStart: centroidLineStart, - lineEnd: centroidLineEnd, - polygonStart: function() { - centroidStream.lineStart = centroidRingStart; - centroidStream.lineEnd = centroidRingEnd; - }, - polygonEnd: function() { - centroidStream.lineStart = centroidLineStart; - centroidStream.lineEnd = centroidLineEnd; - } -}; -function centroidPoint(lambda, phi) { - lambda *= radians, phi *= radians; - var cosPhi = cos(phi); - centroidPointCartesian(cosPhi * cos(lambda), cosPhi * sin(lambda), sin(phi)); -} -function centroidPointCartesian(x, y, z) { - ++W0; - X0 += (x - X0) / W0; - Y0 += (y - Y0) / W0; - Z0 += (z - Z0) / W0; -} -function centroidLineStart() { - centroidStream.point = centroidLinePointFirst; -} -function centroidLinePointFirst(lambda, phi) { - lambda *= radians, phi *= radians; - var cosPhi = cos(phi); - x0 = cosPhi * cos(lambda); - y0 = cosPhi * sin(lambda); - z0 = sin(phi); - centroidStream.point = centroidLinePoint; - centroidPointCartesian(x0, y0, z0); -} -function centroidLinePoint(lambda, phi) { - lambda *= radians, phi *= radians; - var cosPhi = cos(phi), x = cosPhi * cos(lambda), y = cosPhi * sin(lambda), z = sin(phi), w = atan2(sqrt((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z); - W1 += w; - X1 += w * (x0 + (x0 = x)); - Y1 += w * (y0 + (y0 = y)); - Z1 += w * (z0 + (z0 = z)); - centroidPointCartesian(x0, y0, z0); -} -function centroidLineEnd() { - centroidStream.point = centroidPoint; -} -function centroidRingStart() { - centroidStream.point = centroidRingPointFirst; -} -function centroidRingEnd() { - centroidRingPoint(lambda00$2, phi00$2); - centroidStream.point = centroidPoint; -} -function centroidRingPointFirst(lambda, phi) { - lambda00$2 = lambda, phi00$2 = phi; - lambda *= radians, phi *= radians; - centroidStream.point = centroidRingPoint; - var cosPhi = cos(phi); - x0 = cosPhi * cos(lambda); - y0 = cosPhi * sin(lambda); - z0 = sin(phi); - centroidPointCartesian(x0, y0, z0); -} -function centroidRingPoint(lambda, phi) { - lambda *= radians, phi *= radians; - var cosPhi = cos(phi), x = cosPhi * cos(lambda), y = cosPhi * sin(lambda), z = sin(phi), cx = y0 * z - z0 * y, cy = z0 * x - x0 * z, cz = x0 * y - y0 * x, m = hypot(cx, cy, cz), w = asin(m), v = m && -w / m; - X2.add(v * cx); - Y2.add(v * cy); - Z2.add(v * cz); - W1 += w; - X1 += w * (x0 + (x0 = x)); - Y1 += w * (y0 + (y0 = y)); - Z1 += w * (z0 + (z0 = z)); - centroidPointCartesian(x0, y0, z0); -} -function centroid(object2) { - W0 = W1 = X0 = Y0 = Z0 = X1 = Y1 = Z1 = 0; - X2 = new Adder(); - Y2 = new Adder(); - Z2 = new Adder(); - geoStream(object2, centroidStream); - var x = +X2, y = +Y2, z = +Z2, m = hypot(x, y, z); - if (m < epsilon2) { - x = X1, y = Y1, z = Z1; - if (W1 < epsilon) - x = X0, y = Y0, z = Z0; - m = hypot(x, y, z); - if (m < epsilon2) - return [NaN, NaN]; - } - return [atan2(y, x) * degrees, asin(z / m) * degrees]; -} -function constant(x) { - return function() { - return x; - }; -} -function compose(a, b) { - function compose2(x, y) { - return x = a(x, y), b(x[0], x[1]); - } - if (a.invert && b.invert) - compose2.invert = function(x, y) { - return x = b.invert(x, y), x && a.invert(x[0], x[1]); - }; - return compose2; -} -function rotationIdentity(lambda, phi) { - return [abs(lambda) > pi ? lambda + Math.round(-lambda / tau) * tau : lambda, phi]; -} -rotationIdentity.invert = rotationIdentity; -function rotateRadians(deltaLambda, deltaPhi, deltaGamma) { - return (deltaLambda %= tau) ? deltaPhi || deltaGamma ? compose(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) : rotationLambda(deltaLambda) : deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) : rotationIdentity; -} -function forwardRotationLambda(deltaLambda) { - return function(lambda, phi) { - return lambda += deltaLambda, [lambda > pi ? lambda - tau : lambda < -pi ? lambda + tau : lambda, phi]; - }; -} -function rotationLambda(deltaLambda) { - var rotation2 = forwardRotationLambda(deltaLambda); - rotation2.invert = forwardRotationLambda(-deltaLambda); - return rotation2; -} -function rotationPhiGamma(deltaPhi, deltaGamma) { - var cosDeltaPhi = cos(deltaPhi), sinDeltaPhi = sin(deltaPhi), cosDeltaGamma = cos(deltaGamma), sinDeltaGamma = sin(deltaGamma); - function rotation2(lambda, phi) { - var cosPhi = cos(phi), x = cos(lambda) * cosPhi, y = sin(lambda) * cosPhi, z = sin(phi), k = z * cosDeltaPhi + x * sinDeltaPhi; - return [ - atan2(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi), - asin(k * cosDeltaGamma + y * sinDeltaGamma) - ]; - } - rotation2.invert = function(lambda, phi) { - var cosPhi = cos(phi), x = cos(lambda) * cosPhi, y = sin(lambda) * cosPhi, z = sin(phi), k = z * cosDeltaGamma - y * sinDeltaGamma; - return [ - atan2(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi), - asin(k * cosDeltaPhi - x * sinDeltaPhi) - ]; - }; - return rotation2; -} -function rotation(rotate) { - rotate = rotateRadians(rotate[0] * radians, rotate[1] * radians, rotate.length > 2 ? rotate[2] * radians : 0); - function forward(coordinates2) { - coordinates2 = rotate(coordinates2[0] * radians, coordinates2[1] * radians); - return coordinates2[0] *= degrees, coordinates2[1] *= degrees, coordinates2; - } - forward.invert = function(coordinates2) { - coordinates2 = rotate.invert(coordinates2[0] * radians, coordinates2[1] * radians); - return coordinates2[0] *= degrees, coordinates2[1] *= degrees, coordinates2; - }; - return forward; -} -function circleStream(stream, radius, delta, direction, t0, t1) { - if (!delta) - return; - var cosRadius = cos(radius), sinRadius = sin(radius), step = direction * delta; - if (t0 == null) { - t0 = radius + direction * tau; - t1 = radius - step / 2; - } else { - t0 = circleRadius(cosRadius, t0); - t1 = circleRadius(cosRadius, t1); - if (direction > 0 ? t0 < t1 : t0 > t1) - t0 += direction * tau; - } - for (var point, t = t0; direction > 0 ? t > t1 : t < t1; t -= step) { - point = spherical([cosRadius, -sinRadius * cos(t), -sinRadius * sin(t)]); - stream.point(point[0], point[1]); - } -} -function circleRadius(cosRadius, point) { - point = cartesian(point), point[0] -= cosRadius; - cartesianNormalizeInPlace(point); - var radius = acos(-point[1]); - return ((-point[2] < 0 ? -radius : radius) + tau - epsilon) % tau; -} -function circle() { - var center = constant([0, 0]), radius = constant(90), precision = constant(6), ring, rotate, stream = {point}; - function point(x, y) { - ring.push(x = rotate(x, y)); - x[0] *= degrees, x[1] *= degrees; - } - function circle2() { - var c = center.apply(this, arguments), r = radius.apply(this, arguments) * radians, p = precision.apply(this, arguments) * radians; - ring = []; - rotate = rotateRadians(-c[0] * radians, -c[1] * radians, 0).invert; - circleStream(stream, r, p, 1); - c = {type: "Polygon", coordinates: [ring]}; - ring = rotate = null; - return c; - } - circle2.center = function(_) { - return arguments.length ? (center = typeof _ === "function" ? _ : constant([+_[0], +_[1]]), circle2) : center; - }; - circle2.radius = function(_) { - return arguments.length ? (radius = typeof _ === "function" ? _ : constant(+_), circle2) : radius; - }; - circle2.precision = function(_) { - return arguments.length ? (precision = typeof _ === "function" ? _ : constant(+_), circle2) : precision; - }; - return circle2; -} -function clipBuffer() { - var lines = [], line; - return { - point: function(x, y, m) { - line.push([x, y, m]); - }, - lineStart: function() { - lines.push(line = []); - }, - lineEnd: noop, - rejoin: function() { - if (lines.length > 1) - lines.push(lines.pop().concat(lines.shift())); - }, - result: function() { - var result = lines; - lines = []; - line = null; - return result; - } - }; -} -function pointEqual(a, b) { - return abs(a[0] - b[0]) < epsilon && abs(a[1] - b[1]) < epsilon; -} -function Intersection(point, points, other, entry) { - this.x = point; - this.z = points; - this.o = other; - this.e = entry; - this.v = false; - this.n = this.p = null; -} -function clipRejoin(segments, compareIntersection2, startInside, interpolate2, stream) { - var subject = [], clip2 = [], i, n; - segments.forEach(function(segment) { - if ((n2 = segment.length - 1) <= 0) - return; - var n2, p02 = segment[0], p1 = segment[n2], x; - if (pointEqual(p02, p1)) { - if (!p02[2] && !p1[2]) { - stream.lineStart(); - for (i = 0; i < n2; ++i) - stream.point((p02 = segment[i])[0], p02[1]); - stream.lineEnd(); - return; - } - p1[0] += 2 * epsilon; - } - subject.push(x = new Intersection(p02, segment, null, true)); - clip2.push(x.o = new Intersection(p02, null, x, false)); - subject.push(x = new Intersection(p1, segment, null, false)); - clip2.push(x.o = new Intersection(p1, null, x, true)); - }); - if (!subject.length) - return; - clip2.sort(compareIntersection2); - link(subject); - link(clip2); - for (i = 0, n = clip2.length; i < n; ++i) { - clip2[i].e = startInside = !startInside; - } - var start = subject[0], points, point; - while (1) { - var current = start, isSubject = true; - while (current.v) - if ((current = current.n) === start) - return; - points = current.z; - stream.lineStart(); - do { - current.v = current.o.v = true; - if (current.e) { - if (isSubject) { - for (i = 0, n = points.length; i < n; ++i) - stream.point((point = points[i])[0], point[1]); - } else { - interpolate2(current.x, current.n.x, 1, stream); - } - current = current.n; - } else { - if (isSubject) { - points = current.p.z; - for (i = points.length - 1; i >= 0; --i) - stream.point((point = points[i])[0], point[1]); - } else { - interpolate2(current.x, current.p.x, -1, stream); - } - current = current.p; - } - current = current.o; - points = current.z; - isSubject = !isSubject; - } while (!current.v); - stream.lineEnd(); - } -} -function link(array) { - if (!(n = array.length)) - return; - var n, i = 0, a = array[0], b; - while (++i < n) { - a.n = b = array[i]; - b.p = a; - a = b; - } - a.n = b = array[0]; - b.p = a; -} -function longitude(point) { - return abs(point[0]) <= pi ? point[0] : sign(point[0]) * ((abs(point[0]) + pi) % tau - pi); -} -function polygonContains(polygon, point) { - var lambda = longitude(point), phi = point[1], sinPhi = sin(phi), normal = [sin(lambda), -cos(lambda), 0], angle2 = 0, winding = 0; - var sum = new Adder(); - if (sinPhi === 1) - phi = halfPi + epsilon; - else if (sinPhi === -1) - phi = -halfPi - epsilon; - for (var i = 0, n = polygon.length; i < n; ++i) { - if (!(m = (ring = polygon[i]).length)) - continue; - var ring, m, point0 = ring[m - 1], lambda02 = longitude(point0), phi02 = point0[1] / 2 + quarterPi, sinPhi02 = sin(phi02), cosPhi02 = cos(phi02); - for (var j = 0; j < m; ++j, lambda02 = lambda12, sinPhi02 = sinPhi1, cosPhi02 = cosPhi1, point0 = point1) { - var point1 = ring[j], lambda12 = longitude(point1), phi12 = point1[1] / 2 + quarterPi, sinPhi1 = sin(phi12), cosPhi1 = cos(phi12), delta = lambda12 - lambda02, sign2 = delta >= 0 ? 1 : -1, absDelta = sign2 * delta, antimeridian = absDelta > pi, k = sinPhi02 * sinPhi1; - sum.add(atan2(k * sign2 * sin(absDelta), cosPhi02 * cosPhi1 + k * cos(absDelta))); - angle2 += antimeridian ? delta + sign2 * tau : delta; - if (antimeridian ^ lambda02 >= lambda ^ lambda12 >= lambda) { - var arc = cartesianCross(cartesian(point0), cartesian(point1)); - cartesianNormalizeInPlace(arc); - var intersection = cartesianCross(normal, arc); - cartesianNormalizeInPlace(intersection); - var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin(intersection[2]); - if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) { - winding += antimeridian ^ delta >= 0 ? 1 : -1; - } - } - } - } - return (angle2 < -epsilon || angle2 < epsilon && sum < -epsilon2) ^ winding & 1; -} -function clip(pointVisible, clipLine2, interpolate2, start) { - return function(sink) { - var line = clipLine2(sink), ringBuffer = clipBuffer(), ringSink = clipLine2(ringBuffer), polygonStarted = false, polygon, segments, ring; - var clip2 = { - point, - lineStart, - lineEnd, - polygonStart: function() { - clip2.point = pointRing; - clip2.lineStart = ringStart; - clip2.lineEnd = ringEnd; - segments = []; - polygon = []; - }, - polygonEnd: function() { - clip2.point = point; - clip2.lineStart = lineStart; - clip2.lineEnd = lineEnd; - segments = merge(segments); - var startInside = polygonContains(polygon, start); - if (segments.length) { - if (!polygonStarted) - sink.polygonStart(), polygonStarted = true; - clipRejoin(segments, compareIntersection, startInside, interpolate2, sink); - } else if (startInside) { - if (!polygonStarted) - sink.polygonStart(), polygonStarted = true; - sink.lineStart(); - interpolate2(null, null, 1, sink); - sink.lineEnd(); - } - if (polygonStarted) - sink.polygonEnd(), polygonStarted = false; - segments = polygon = null; - }, - sphere: function() { - sink.polygonStart(); - sink.lineStart(); - interpolate2(null, null, 1, sink); - sink.lineEnd(); - sink.polygonEnd(); - } - }; - function point(lambda, phi) { - if (pointVisible(lambda, phi)) - sink.point(lambda, phi); - } - function pointLine(lambda, phi) { - line.point(lambda, phi); - } - function lineStart() { - clip2.point = pointLine; - line.lineStart(); - } - function lineEnd() { - clip2.point = point; - line.lineEnd(); - } - function pointRing(lambda, phi) { - ring.push([lambda, phi]); - ringSink.point(lambda, phi); - } - function ringStart() { - ringSink.lineStart(); - ring = []; - } - function ringEnd() { - pointRing(ring[0][0], ring[0][1]); - ringSink.lineEnd(); - var clean = ringSink.clean(), ringSegments = ringBuffer.result(), i, n = ringSegments.length, m, segment, point2; - ring.pop(); - polygon.push(ring); - ring = null; - if (!n) - return; - if (clean & 1) { - segment = ringSegments[0]; - if ((m = segment.length - 1) > 0) { - if (!polygonStarted) - sink.polygonStart(), polygonStarted = true; - sink.lineStart(); - for (i = 0; i < m; ++i) - sink.point((point2 = segment[i])[0], point2[1]); - sink.lineEnd(); - } - return; - } - if (n > 1 && clean & 2) - ringSegments.push(ringSegments.pop().concat(ringSegments.shift())); - segments.push(ringSegments.filter(validSegment)); - } - return clip2; - }; -} -function validSegment(segment) { - return segment.length > 1; -} -function compareIntersection(a, b) { - return ((a = a.x)[0] < 0 ? a[1] - halfPi - epsilon : halfPi - a[1]) - ((b = b.x)[0] < 0 ? b[1] - halfPi - epsilon : halfPi - b[1]); -} -var clipAntimeridian = clip(function() { - return true; -}, clipAntimeridianLine, clipAntimeridianInterpolate, [-pi, -halfPi]); -function clipAntimeridianLine(stream) { - var lambda02 = NaN, phi02 = NaN, sign0 = NaN, clean; - return { - lineStart: function() { - stream.lineStart(); - clean = 1; - }, - point: function(lambda12, phi12) { - var sign1 = lambda12 > 0 ? pi : -pi, delta = abs(lambda12 - lambda02); - if (abs(delta - pi) < epsilon) { - stream.point(lambda02, phi02 = (phi02 + phi12) / 2 > 0 ? halfPi : -halfPi); - stream.point(sign0, phi02); - stream.lineEnd(); - stream.lineStart(); - stream.point(sign1, phi02); - stream.point(lambda12, phi02); - clean = 0; - } else if (sign0 !== sign1 && delta >= pi) { - if (abs(lambda02 - sign0) < epsilon) - lambda02 -= sign0 * epsilon; - if (abs(lambda12 - sign1) < epsilon) - lambda12 -= sign1 * epsilon; - phi02 = clipAntimeridianIntersect(lambda02, phi02, lambda12, phi12); - stream.point(sign0, phi02); - stream.lineEnd(); - stream.lineStart(); - stream.point(sign1, phi02); - clean = 0; - } - stream.point(lambda02 = lambda12, phi02 = phi12); - sign0 = sign1; - }, - lineEnd: function() { - stream.lineEnd(); - lambda02 = phi02 = NaN; - }, - clean: function() { - return 2 - clean; - } - }; -} -function clipAntimeridianIntersect(lambda02, phi02, lambda12, phi12) { - var cosPhi02, cosPhi1, sinLambda0Lambda1 = sin(lambda02 - lambda12); - return abs(sinLambda0Lambda1) > epsilon ? atan((sin(phi02) * (cosPhi1 = cos(phi12)) * sin(lambda12) - sin(phi12) * (cosPhi02 = cos(phi02)) * sin(lambda02)) / (cosPhi02 * cosPhi1 * sinLambda0Lambda1)) : (phi02 + phi12) / 2; -} -function clipAntimeridianInterpolate(from, to, direction, stream) { - var phi; - if (from == null) { - phi = direction * halfPi; - stream.point(-pi, phi); - stream.point(0, phi); - stream.point(pi, phi); - stream.point(pi, 0); - stream.point(pi, -phi); - stream.point(0, -phi); - stream.point(-pi, -phi); - stream.point(-pi, 0); - stream.point(-pi, phi); - } else if (abs(from[0] - to[0]) > epsilon) { - var lambda = from[0] < to[0] ? pi : -pi; - phi = direction * lambda / 2; - stream.point(-lambda, phi); - stream.point(0, phi); - stream.point(lambda, phi); - } else { - stream.point(to[0], to[1]); - } -} -function clipCircle(radius) { - var cr = cos(radius), delta = 6 * radians, smallRadius = cr > 0, notHemisphere = abs(cr) > epsilon; - function interpolate2(from, to, direction, stream) { - circleStream(stream, radius, delta, direction, from, to); - } - function visible(lambda, phi) { - return cos(lambda) * cos(phi) > cr; - } - function clipLine2(stream) { - var point0, c0, v0, v00, clean; - return { - lineStart: function() { - v00 = v0 = false; - clean = 1; - }, - point: function(lambda, phi) { - var point1 = [lambda, phi], point2, v = visible(lambda, phi), c = smallRadius ? v ? 0 : code(lambda, phi) : v ? code(lambda + (lambda < 0 ? pi : -pi), phi) : 0; - if (!point0 && (v00 = v0 = v)) - stream.lineStart(); - if (v !== v0) { - point2 = intersect(point0, point1); - if (!point2 || pointEqual(point0, point2) || pointEqual(point1, point2)) - point1[2] = 1; - } - if (v !== v0) { - clean = 0; - if (v) { - stream.lineStart(); - point2 = intersect(point1, point0); - stream.point(point2[0], point2[1]); - } else { - point2 = intersect(point0, point1); - stream.point(point2[0], point2[1], 2); - stream.lineEnd(); - } - point0 = point2; - } else if (notHemisphere && point0 && smallRadius ^ v) { - var t; - if (!(c & c0) && (t = intersect(point1, point0, true))) { - clean = 0; - if (smallRadius) { - stream.lineStart(); - stream.point(t[0][0], t[0][1]); - stream.point(t[1][0], t[1][1]); - stream.lineEnd(); - } else { - stream.point(t[1][0], t[1][1]); - stream.lineEnd(); - stream.lineStart(); - stream.point(t[0][0], t[0][1], 3); - } - } - } - if (v && (!point0 || !pointEqual(point0, point1))) { - stream.point(point1[0], point1[1]); - } - point0 = point1, v0 = v, c0 = c; - }, - lineEnd: function() { - if (v0) - stream.lineEnd(); - point0 = null; - }, - clean: function() { - return clean | (v00 && v0) << 1; - } - }; - } - function intersect(a, b, two) { - var pa = cartesian(a), pb = cartesian(b); - var n1 = [1, 0, 0], n2 = cartesianCross(pa, pb), n2n2 = cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2; - if (!determinant) - return !two && a; - var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = cartesianCross(n1, n2), A = cartesianScale(n1, c1), B = cartesianScale(n2, c2); - cartesianAddInPlace(A, B); - var u = n1xn2, w = cartesianDot(A, u), uu = cartesianDot(u, u), t2 = w * w - uu * (cartesianDot(A, A) - 1); - if (t2 < 0) - return; - var t = sqrt(t2), q = cartesianScale(u, (-w - t) / uu); - cartesianAddInPlace(q, A); - q = spherical(q); - if (!two) - return q; - var lambda02 = a[0], lambda12 = b[0], phi02 = a[1], phi12 = b[1], z; - if (lambda12 < lambda02) - z = lambda02, lambda02 = lambda12, lambda12 = z; - var delta2 = lambda12 - lambda02, polar = abs(delta2 - pi) < epsilon, meridian = polar || delta2 < epsilon; - if (!polar && phi12 < phi02) - z = phi02, phi02 = phi12, phi12 = z; - if (meridian ? polar ? phi02 + phi12 > 0 ^ q[1] < (abs(q[0] - lambda02) < epsilon ? phi02 : phi12) : phi02 <= q[1] && q[1] <= phi12 : delta2 > pi ^ (lambda02 <= q[0] && q[0] <= lambda12)) { - var q1 = cartesianScale(u, (-w + t) / uu); - cartesianAddInPlace(q1, A); - return [q, spherical(q1)]; - } - } - function code(lambda, phi) { - var r = smallRadius ? radius : pi - radius, code2 = 0; - if (lambda < -r) - code2 |= 1; - else if (lambda > r) - code2 |= 2; - if (phi < -r) - code2 |= 4; - else if (phi > r) - code2 |= 8; - return code2; - } - return clip(visible, clipLine2, interpolate2, smallRadius ? [0, -radius] : [-pi, radius - pi]); -} -function clipLine(a, b, x02, y02, x12, y12) { - var ax = a[0], ay = a[1], bx = b[0], by = b[1], t0 = 0, t1 = 1, dx = bx - ax, dy = by - ay, r; - r = x02 - ax; - if (!dx && r > 0) - return; - r /= dx; - if (dx < 0) { - if (r < t0) - return; - if (r < t1) - t1 = r; - } else if (dx > 0) { - if (r > t1) - return; - if (r > t0) - t0 = r; - } - r = x12 - ax; - if (!dx && r < 0) - return; - r /= dx; - if (dx < 0) { - if (r > t1) - return; - if (r > t0) - t0 = r; - } else if (dx > 0) { - if (r < t0) - return; - if (r < t1) - t1 = r; - } - r = y02 - ay; - if (!dy && r > 0) - return; - r /= dy; - if (dy < 0) { - if (r < t0) - return; - if (r < t1) - t1 = r; - } else if (dy > 0) { - if (r > t1) - return; - if (r > t0) - t0 = r; - } - r = y12 - ay; - if (!dy && r < 0) - return; - r /= dy; - if (dy < 0) { - if (r > t1) - return; - if (r > t0) - t0 = r; - } else if (dy > 0) { - if (r < t0) - return; - if (r < t1) - t1 = r; - } - if (t0 > 0) - a[0] = ax + t0 * dx, a[1] = ay + t0 * dy; - if (t1 < 1) - b[0] = ax + t1 * dx, b[1] = ay + t1 * dy; - return true; -} -var clipMax = 1e9, clipMin = -clipMax; -function clipRectangle(x02, y02, x12, y12) { - function visible(x, y) { - return x02 <= x && x <= x12 && y02 <= y && y <= y12; - } - function interpolate2(from, to, direction, stream) { - var a = 0, a1 = 0; - if (from == null || (a = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoint(from, to) < 0 ^ direction > 0) { - do - stream.point(a === 0 || a === 3 ? x02 : x12, a > 1 ? y12 : y02); - while ((a = (a + direction + 4) % 4) !== a1); - } else { - stream.point(to[0], to[1]); - } - } - function corner(p, direction) { - return abs(p[0] - x02) < epsilon ? direction > 0 ? 0 : 3 : abs(p[0] - x12) < epsilon ? direction > 0 ? 2 : 1 : abs(p[1] - y02) < epsilon ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2; - } - function compareIntersection2(a, b) { - return comparePoint(a.x, b.x); - } - function comparePoint(a, b) { - var ca = corner(a, 1), cb = corner(b, 1); - return ca !== cb ? ca - cb : ca === 0 ? b[1] - a[1] : ca === 1 ? a[0] - b[0] : ca === 2 ? a[1] - b[1] : b[0] - a[0]; - } - return function(stream) { - var activeStream = stream, bufferStream = clipBuffer(), segments, polygon, ring, x__, y__, v__, x_, y_, v_, first, clean; - var clipStream = { - point, - lineStart, - lineEnd, - polygonStart, - polygonEnd - }; - function point(x, y) { - if (visible(x, y)) - activeStream.point(x, y); - } - function polygonInside() { - var winding = 0; - for (var i = 0, n = polygon.length; i < n; ++i) { - for (var ring2 = polygon[i], j = 1, m = ring2.length, point2 = ring2[0], a0, a1, b0 = point2[0], b1 = point2[1]; j < m; ++j) { - a0 = b0, a1 = b1, point2 = ring2[j], b0 = point2[0], b1 = point2[1]; - if (a1 <= y12) { - if (b1 > y12 && (b0 - a0) * (y12 - a1) > (b1 - a1) * (x02 - a0)) - ++winding; - } else { - if (b1 <= y12 && (b0 - a0) * (y12 - a1) < (b1 - a1) * (x02 - a0)) - --winding; - } - } - } - return winding; - } - function polygonStart() { - activeStream = bufferStream, segments = [], polygon = [], clean = true; - } - function polygonEnd() { - var startInside = polygonInside(), cleanInside = clean && startInside, visible2 = (segments = merge(segments)).length; - if (cleanInside || visible2) { - stream.polygonStart(); - if (cleanInside) { - stream.lineStart(); - interpolate2(null, null, 1, stream); - stream.lineEnd(); - } - if (visible2) { - clipRejoin(segments, compareIntersection2, startInside, interpolate2, stream); - } - stream.polygonEnd(); - } - activeStream = stream, segments = polygon = ring = null; - } - function lineStart() { - clipStream.point = linePoint2; - if (polygon) - polygon.push(ring = []); - first = true; - v_ = false; - x_ = y_ = NaN; - } - function lineEnd() { - if (segments) { - linePoint2(x__, y__); - if (v__ && v_) - bufferStream.rejoin(); - segments.push(bufferStream.result()); - } - clipStream.point = point; - if (v_) - activeStream.lineEnd(); - } - function linePoint2(x, y) { - var v = visible(x, y); - if (polygon) - ring.push([x, y]); - if (first) { - x__ = x, y__ = y, v__ = v; - first = false; - if (v) { - activeStream.lineStart(); - activeStream.point(x, y); - } - } else { - if (v && v_) - activeStream.point(x, y); - else { - var a = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))], b = [x = Math.max(clipMin, Math.min(clipMax, x)), y = Math.max(clipMin, Math.min(clipMax, y))]; - if (clipLine(a, b, x02, y02, x12, y12)) { - if (!v_) { - activeStream.lineStart(); - activeStream.point(a[0], a[1]); - } - activeStream.point(b[0], b[1]); - if (!v) - activeStream.lineEnd(); - clean = false; - } else if (v) { - activeStream.lineStart(); - activeStream.point(x, y); - clean = false; - } - } - } - x_ = x, y_ = y, v_ = v; - } - return clipStream; - }; -} -function extent() { - var x02 = 0, y02 = 0, x12 = 960, y12 = 500, cache, cacheStream, clip2; - return clip2 = { - stream: function(stream) { - return cache && cacheStream === stream ? cache : cache = clipRectangle(x02, y02, x12, y12)(cacheStream = stream); - }, - extent: function(_) { - return arguments.length ? (x02 = +_[0][0], y02 = +_[0][1], x12 = +_[1][0], y12 = +_[1][1], cache = cacheStream = null, clip2) : [[x02, y02], [x12, y12]]; - } - }; -} -var lengthSum, lambda0$2, sinPhi0$1, cosPhi0$1; -var lengthStream = { - sphere: noop, - point: noop, - lineStart: lengthLineStart, - lineEnd: noop, - polygonStart: noop, - polygonEnd: noop -}; -function lengthLineStart() { - lengthStream.point = lengthPointFirst; - lengthStream.lineEnd = lengthLineEnd; -} -function lengthLineEnd() { - lengthStream.point = lengthStream.lineEnd = noop; -} -function lengthPointFirst(lambda, phi) { - lambda *= radians, phi *= radians; - lambda0$2 = lambda, sinPhi0$1 = sin(phi), cosPhi0$1 = cos(phi); - lengthStream.point = lengthPoint; -} -function lengthPoint(lambda, phi) { - lambda *= radians, phi *= radians; - var sinPhi = sin(phi), cosPhi = cos(phi), delta = abs(lambda - lambda0$2), cosDelta = cos(delta), sinDelta = sin(delta), x = cosPhi * sinDelta, y = cosPhi0$1 * sinPhi - sinPhi0$1 * cosPhi * cosDelta, z = sinPhi0$1 * sinPhi + cosPhi0$1 * cosPhi * cosDelta; - lengthSum.add(atan2(sqrt(x * x + y * y), z)); - lambda0$2 = lambda, sinPhi0$1 = sinPhi, cosPhi0$1 = cosPhi; -} -function length(object2) { - lengthSum = new Adder(); - geoStream(object2, lengthStream); - return +lengthSum; -} -var coordinates = [null, null], object = {type: "LineString", coordinates}; -function distance(a, b) { - coordinates[0] = a; - coordinates[1] = b; - return length(object); -} -var containsObjectType = { - Feature: function(object2, point) { - return containsGeometry(object2.geometry, point); - }, - FeatureCollection: function(object2, point) { - var features = object2.features, i = -1, n = features.length; - while (++i < n) - if (containsGeometry(features[i].geometry, point)) - return true; - return false; - } -}; -var containsGeometryType = { - Sphere: function() { - return true; - }, - Point: function(object2, point) { - return containsPoint(object2.coordinates, point); - }, - MultiPoint: function(object2, point) { - var coordinates2 = object2.coordinates, i = -1, n = coordinates2.length; - while (++i < n) - if (containsPoint(coordinates2[i], point)) - return true; - return false; - }, - LineString: function(object2, point) { - return containsLine(object2.coordinates, point); - }, - MultiLineString: function(object2, point) { - var coordinates2 = object2.coordinates, i = -1, n = coordinates2.length; - while (++i < n) - if (containsLine(coordinates2[i], point)) - return true; - return false; - }, - Polygon: function(object2, point) { - return containsPolygon(object2.coordinates, point); - }, - MultiPolygon: function(object2, point) { - var coordinates2 = object2.coordinates, i = -1, n = coordinates2.length; - while (++i < n) - if (containsPolygon(coordinates2[i], point)) - return true; - return false; - }, - GeometryCollection: function(object2, point) { - var geometries = object2.geometries, i = -1, n = geometries.length; - while (++i < n) - if (containsGeometry(geometries[i], point)) - return true; - return false; - } -}; -function containsGeometry(geometry, point) { - return geometry && containsGeometryType.hasOwnProperty(geometry.type) ? containsGeometryType[geometry.type](geometry, point) : false; -} -function containsPoint(coordinates2, point) { - return distance(coordinates2, point) === 0; -} -function containsLine(coordinates2, point) { - var ao, bo, ab; - for (var i = 0, n = coordinates2.length; i < n; i++) { - bo = distance(coordinates2[i], point); - if (bo === 0) - return true; - if (i > 0) { - ab = distance(coordinates2[i], coordinates2[i - 1]); - if (ab > 0 && ao <= ab && bo <= ab && (ao + bo - ab) * (1 - Math.pow((ao - bo) / ab, 2)) < epsilon2 * ab) - return true; - } - ao = bo; - } - return false; -} -function containsPolygon(coordinates2, point) { - return !!polygonContains(coordinates2.map(ringRadians), pointRadians(point)); -} -function ringRadians(ring) { - return ring = ring.map(pointRadians), ring.pop(), ring; -} -function pointRadians(point) { - return [point[0] * radians, point[1] * radians]; -} -function contains(object2, point) { - return (object2 && containsObjectType.hasOwnProperty(object2.type) ? containsObjectType[object2.type] : containsGeometry)(object2, point); -} -function graticuleX(y02, y12, dy) { - var y = range$1(y02, y12 - epsilon, dy).concat(y12); - return function(x) { - return y.map(function(y2) { - return [x, y2]; - }); - }; -} -function graticuleY(x02, x12, dx) { - var x = range$1(x02, x12 - epsilon, dx).concat(x12); - return function(y) { - return x.map(function(x2) { - return [x2, y]; - }); - }; -} -function graticule() { - var x12, x02, X12, X02, y12, y02, Y12, Y02, dx = 10, dy = dx, DX = 90, DY = 360, x, y, X, Y, precision = 2.5; - function graticule2() { - return {type: "MultiLineString", coordinates: lines()}; - } - function lines() { - return range$1(ceil(X02 / DX) * DX, X12, DX).map(X).concat(range$1(ceil(Y02 / DY) * DY, Y12, DY).map(Y)).concat(range$1(ceil(x02 / dx) * dx, x12, dx).filter(function(x2) { - return abs(x2 % DX) > epsilon; - }).map(x)).concat(range$1(ceil(y02 / dy) * dy, y12, dy).filter(function(y2) { - return abs(y2 % DY) > epsilon; - }).map(y)); - } - graticule2.lines = function() { - return lines().map(function(coordinates2) { - return {type: "LineString", coordinates: coordinates2}; - }); - }; - graticule2.outline = function() { - return { - type: "Polygon", - coordinates: [ - X(X02).concat(Y(Y12).slice(1), X(X12).reverse().slice(1), Y(Y02).reverse().slice(1)) - ] - }; - }; - graticule2.extent = function(_) { - if (!arguments.length) - return graticule2.extentMinor(); - return graticule2.extentMajor(_).extentMinor(_); - }; - graticule2.extentMajor = function(_) { - if (!arguments.length) - return [[X02, Y02], [X12, Y12]]; - X02 = +_[0][0], X12 = +_[1][0]; - Y02 = +_[0][1], Y12 = +_[1][1]; - if (X02 > X12) - _ = X02, X02 = X12, X12 = _; - if (Y02 > Y12) - _ = Y02, Y02 = Y12, Y12 = _; - return graticule2.precision(precision); - }; - graticule2.extentMinor = function(_) { - if (!arguments.length) - return [[x02, y02], [x12, y12]]; - x02 = +_[0][0], x12 = +_[1][0]; - y02 = +_[0][1], y12 = +_[1][1]; - if (x02 > x12) - _ = x02, x02 = x12, x12 = _; - if (y02 > y12) - _ = y02, y02 = y12, y12 = _; - return graticule2.precision(precision); - }; - graticule2.step = function(_) { - if (!arguments.length) - return graticule2.stepMinor(); - return graticule2.stepMajor(_).stepMinor(_); - }; - graticule2.stepMajor = function(_) { - if (!arguments.length) - return [DX, DY]; - DX = +_[0], DY = +_[1]; - return graticule2; - }; - graticule2.stepMinor = function(_) { - if (!arguments.length) - return [dx, dy]; - dx = +_[0], dy = +_[1]; - return graticule2; - }; - graticule2.precision = function(_) { - if (!arguments.length) - return precision; - precision = +_; - x = graticuleX(y02, y12, 90); - y = graticuleY(x02, x12, precision); - X = graticuleX(Y02, Y12, 90); - Y = graticuleY(X02, X12, precision); - return graticule2; - }; - return graticule2.extentMajor([[-180, -90 + epsilon], [180, 90 - epsilon]]).extentMinor([[-180, -80 - epsilon], [180, 80 + epsilon]]); -} -function graticule10() { - return graticule()(); -} -function interpolate(a, b) { - var x02 = a[0] * radians, y02 = a[1] * radians, x12 = b[0] * radians, y12 = b[1] * radians, cy0 = cos(y02), sy0 = sin(y02), cy1 = cos(y12), sy1 = sin(y12), kx0 = cy0 * cos(x02), ky0 = cy0 * sin(x02), kx1 = cy1 * cos(x12), ky1 = cy1 * sin(x12), d = 2 * asin(sqrt(haversin(y12 - y02) + cy0 * cy1 * haversin(x12 - x02))), k = sin(d); - var interpolate2 = d ? function(t) { - var B = sin(t *= d) / k, A = sin(d - t) / k, x = A * kx0 + B * kx1, y = A * ky0 + B * ky1, z = A * sy0 + B * sy1; - return [ - atan2(y, x) * degrees, - atan2(z, sqrt(x * x + y * y)) * degrees - ]; - } : function() { - return [x02 * degrees, y02 * degrees]; - }; - interpolate2.distance = d; - return interpolate2; -} -var identity = (x) => x; -var areaSum$1 = new Adder(), areaRingSum$1 = new Adder(), x00, y00, x0$1, y0$1; -var areaStream$1 = { - point: noop, - lineStart: noop, - lineEnd: noop, - polygonStart: function() { - areaStream$1.lineStart = areaRingStart$1; - areaStream$1.lineEnd = areaRingEnd$1; - }, - polygonEnd: function() { - areaStream$1.lineStart = areaStream$1.lineEnd = areaStream$1.point = noop; - areaSum$1.add(abs(areaRingSum$1)); - areaRingSum$1 = new Adder(); - }, - result: function() { - var area2 = areaSum$1 / 2; - areaSum$1 = new Adder(); - return area2; - } -}; -function areaRingStart$1() { - areaStream$1.point = areaPointFirst$1; -} -function areaPointFirst$1(x, y) { - areaStream$1.point = areaPoint$1; - x00 = x0$1 = x, y00 = y0$1 = y; -} -function areaPoint$1(x, y) { - areaRingSum$1.add(y0$1 * x - x0$1 * y); - x0$1 = x, y0$1 = y; -} -function areaRingEnd$1() { - areaPoint$1(x00, y00); -} -var x0$2 = Infinity, y0$2 = x0$2, x1 = -x0$2, y1 = x1; -var boundsStream$1 = { - point: boundsPoint$1, - lineStart: noop, - lineEnd: noop, - polygonStart: noop, - polygonEnd: noop, - result: function() { - var bounds2 = [[x0$2, y0$2], [x1, y1]]; - x1 = y1 = -(y0$2 = x0$2 = Infinity); - return bounds2; - } -}; -function boundsPoint$1(x, y) { - if (x < x0$2) - x0$2 = x; - if (x > x1) - x1 = x; - if (y < y0$2) - y0$2 = y; - if (y > y1) - y1 = y; -} -var X0$1 = 0, Y0$1 = 0, Z0$1 = 0, X1$1 = 0, Y1$1 = 0, Z1$1 = 0, X2$1 = 0, Y2$1 = 0, Z2$1 = 0, x00$1, y00$1, x0$3, y0$3; -var centroidStream$1 = { - point: centroidPoint$1, - lineStart: centroidLineStart$1, - lineEnd: centroidLineEnd$1, - polygonStart: function() { - centroidStream$1.lineStart = centroidRingStart$1; - centroidStream$1.lineEnd = centroidRingEnd$1; - }, - polygonEnd: function() { - centroidStream$1.point = centroidPoint$1; - centroidStream$1.lineStart = centroidLineStart$1; - centroidStream$1.lineEnd = centroidLineEnd$1; - }, - result: function() { - var centroid2 = Z2$1 ? [X2$1 / Z2$1, Y2$1 / Z2$1] : Z1$1 ? [X1$1 / Z1$1, Y1$1 / Z1$1] : Z0$1 ? [X0$1 / Z0$1, Y0$1 / Z0$1] : [NaN, NaN]; - X0$1 = Y0$1 = Z0$1 = X1$1 = Y1$1 = Z1$1 = X2$1 = Y2$1 = Z2$1 = 0; - return centroid2; - } -}; -function centroidPoint$1(x, y) { - X0$1 += x; - Y0$1 += y; - ++Z0$1; -} -function centroidLineStart$1() { - centroidStream$1.point = centroidPointFirstLine; -} -function centroidPointFirstLine(x, y) { - centroidStream$1.point = centroidPointLine; - centroidPoint$1(x0$3 = x, y0$3 = y); -} -function centroidPointLine(x, y) { - var dx = x - x0$3, dy = y - y0$3, z = sqrt(dx * dx + dy * dy); - X1$1 += z * (x0$3 + x) / 2; - Y1$1 += z * (y0$3 + y) / 2; - Z1$1 += z; - centroidPoint$1(x0$3 = x, y0$3 = y); -} -function centroidLineEnd$1() { - centroidStream$1.point = centroidPoint$1; -} -function centroidRingStart$1() { - centroidStream$1.point = centroidPointFirstRing; -} -function centroidRingEnd$1() { - centroidPointRing(x00$1, y00$1); -} -function centroidPointFirstRing(x, y) { - centroidStream$1.point = centroidPointRing; - centroidPoint$1(x00$1 = x0$3 = x, y00$1 = y0$3 = y); -} -function centroidPointRing(x, y) { - var dx = x - x0$3, dy = y - y0$3, z = sqrt(dx * dx + dy * dy); - X1$1 += z * (x0$3 + x) / 2; - Y1$1 += z * (y0$3 + y) / 2; - Z1$1 += z; - z = y0$3 * x - x0$3 * y; - X2$1 += z * (x0$3 + x); - Y2$1 += z * (y0$3 + y); - Z2$1 += z * 3; - centroidPoint$1(x0$3 = x, y0$3 = y); -} -function PathContext(context) { - this._context = context; -} -PathContext.prototype = { - _radius: 4.5, - pointRadius: function(_) { - return this._radius = _, this; - }, - polygonStart: function() { - this._line = 0; - }, - polygonEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._point = 0; - }, - lineEnd: function() { - if (this._line === 0) - this._context.closePath(); - this._point = NaN; - }, - point: function(x, y) { - switch (this._point) { - case 0: { - this._context.moveTo(x, y); - this._point = 1; - break; - } - case 1: { - this._context.lineTo(x, y); - break; - } - default: { - this._context.moveTo(x + this._radius, y); - this._context.arc(x, y, this._radius, 0, tau); - break; - } - } - }, - result: noop -}; -var lengthSum$1 = new Adder(), lengthRing, x00$2, y00$2, x0$4, y0$4; -var lengthStream$1 = { - point: noop, - lineStart: function() { - lengthStream$1.point = lengthPointFirst$1; - }, - lineEnd: function() { - if (lengthRing) - lengthPoint$1(x00$2, y00$2); - lengthStream$1.point = noop; - }, - polygonStart: function() { - lengthRing = true; - }, - polygonEnd: function() { - lengthRing = null; - }, - result: function() { - var length2 = +lengthSum$1; - lengthSum$1 = new Adder(); - return length2; - } -}; -function lengthPointFirst$1(x, y) { - lengthStream$1.point = lengthPoint$1; - x00$2 = x0$4 = x, y00$2 = y0$4 = y; -} -function lengthPoint$1(x, y) { - x0$4 -= x, y0$4 -= y; - lengthSum$1.add(sqrt(x0$4 * x0$4 + y0$4 * y0$4)); - x0$4 = x, y0$4 = y; -} -function PathString() { - this._string = []; -} -PathString.prototype = { - _radius: 4.5, - _circle: circle$1(4.5), - pointRadius: function(_) { - if ((_ = +_) !== this._radius) - this._radius = _, this._circle = null; - return this; - }, - polygonStart: function() { - this._line = 0; - }, - polygonEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._point = 0; - }, - lineEnd: function() { - if (this._line === 0) - this._string.push("Z"); - this._point = NaN; - }, - point: function(x, y) { - switch (this._point) { - case 0: { - this._string.push("M", x, ",", y); - this._point = 1; - break; - } - case 1: { - this._string.push("L", x, ",", y); - break; - } - default: { - if (this._circle == null) - this._circle = circle$1(this._radius); - this._string.push("M", x, ",", y, this._circle); - break; - } - } - }, - result: function() { - if (this._string.length) { - var result = this._string.join(""); - this._string = []; - return result; - } else { - return null; - } - } -}; -function circle$1(radius) { - return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius + "z"; -} -function index(projection2, context) { - var pointRadius = 4.5, projectionStream, contextStream; - function path(object2) { - if (object2) { - if (typeof pointRadius === "function") - contextStream.pointRadius(+pointRadius.apply(this, arguments)); - geoStream(object2, projectionStream(contextStream)); - } - return contextStream.result(); - } - path.area = function(object2) { - geoStream(object2, projectionStream(areaStream$1)); - return areaStream$1.result(); - }; - path.measure = function(object2) { - geoStream(object2, projectionStream(lengthStream$1)); - return lengthStream$1.result(); - }; - path.bounds = function(object2) { - geoStream(object2, projectionStream(boundsStream$1)); - return boundsStream$1.result(); - }; - path.centroid = function(object2) { - geoStream(object2, projectionStream(centroidStream$1)); - return centroidStream$1.result(); - }; - path.projection = function(_) { - return arguments.length ? (projectionStream = _ == null ? (projection2 = null, identity) : (projection2 = _).stream, path) : projection2; - }; - path.context = function(_) { - if (!arguments.length) - return context; - contextStream = _ == null ? (context = null, new PathString()) : new PathContext(context = _); - if (typeof pointRadius !== "function") - contextStream.pointRadius(pointRadius); - return path; - }; - path.pointRadius = function(_) { - if (!arguments.length) - return pointRadius; - pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_); - return path; - }; - return path.projection(projection2).context(context); -} -function transform(methods) { - return { - stream: transformer(methods) - }; -} -function transformer(methods) { - return function(stream) { - var s = new TransformStream(); - for (var key in methods) - s[key] = methods[key]; - s.stream = stream; - return s; - }; -} -function TransformStream() { -} -TransformStream.prototype = { - constructor: TransformStream, - point: function(x, y) { - this.stream.point(x, y); - }, - sphere: function() { - this.stream.sphere(); - }, - lineStart: function() { - this.stream.lineStart(); - }, - lineEnd: function() { - this.stream.lineEnd(); - }, - polygonStart: function() { - this.stream.polygonStart(); - }, - polygonEnd: function() { - this.stream.polygonEnd(); - } -}; -function fit(projection2, fitBounds, object2) { - var clip2 = projection2.clipExtent && projection2.clipExtent(); - projection2.scale(150).translate([0, 0]); - if (clip2 != null) - projection2.clipExtent(null); - geoStream(object2, projection2.stream(boundsStream$1)); - fitBounds(boundsStream$1.result()); - if (clip2 != null) - projection2.clipExtent(clip2); - return projection2; -} -function fitExtent(projection2, extent2, object2) { - return fit(projection2, function(b) { - var w = extent2[1][0] - extent2[0][0], h = extent2[1][1] - extent2[0][1], k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])), x = +extent2[0][0] + (w - k * (b[1][0] + b[0][0])) / 2, y = +extent2[0][1] + (h - k * (b[1][1] + b[0][1])) / 2; - projection2.scale(150 * k).translate([x, y]); - }, object2); -} -function fitSize(projection2, size, object2) { - return fitExtent(projection2, [[0, 0], size], object2); -} -function fitWidth(projection2, width, object2) { - return fit(projection2, function(b) { - var w = +width, k = w / (b[1][0] - b[0][0]), x = (w - k * (b[1][0] + b[0][0])) / 2, y = -k * b[0][1]; - projection2.scale(150 * k).translate([x, y]); - }, object2); -} -function fitHeight(projection2, height, object2) { - return fit(projection2, function(b) { - var h = +height, k = h / (b[1][1] - b[0][1]), x = -k * b[0][0], y = (h - k * (b[1][1] + b[0][1])) / 2; - projection2.scale(150 * k).translate([x, y]); - }, object2); -} -var maxDepth = 16, cosMinDistance = cos(30 * radians); -function resample(project, delta2) { - return +delta2 ? resample$1(project, delta2) : resampleNone(project); -} -function resampleNone(project) { - return transformer({ - point: function(x, y) { - x = project(x, y); - this.stream.point(x[0], x[1]); - } - }); -} -function resample$1(project, delta2) { - function resampleLineTo(x02, y02, lambda02, a0, b0, c0, x12, y12, lambda12, a1, b1, c1, depth, stream) { - var dx = x12 - x02, dy = y12 - y02, d2 = dx * dx + dy * dy; - if (d2 > 4 * delta2 && depth--) { - var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = sqrt(a * a + b * b + c * c), phi2 = asin(c /= m), lambda22 = abs(abs(c) - 1) < epsilon || abs(lambda02 - lambda12) < epsilon ? (lambda02 + lambda12) / 2 : atan2(b, a), p = project(lambda22, phi2), x2 = p[0], y2 = p[1], dx2 = x2 - x02, dy2 = y2 - y02, dz = dy * dx2 - dx * dy2; - if (dz * dz / d2 > delta2 || abs((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) { - resampleLineTo(x02, y02, lambda02, a0, b0, c0, x2, y2, lambda22, a /= m, b /= m, c, depth, stream); - stream.point(x2, y2); - resampleLineTo(x2, y2, lambda22, a, b, c, x12, y12, lambda12, a1, b1, c1, depth, stream); - } - } - } - return function(stream) { - var lambda002, x002, y002, a00, b00, c00, lambda02, x02, y02, a0, b0, c0; - var resampleStream = { - point, - lineStart, - lineEnd, - polygonStart: function() { - stream.polygonStart(); - resampleStream.lineStart = ringStart; - }, - polygonEnd: function() { - stream.polygonEnd(); - resampleStream.lineStart = lineStart; - } - }; - function point(x, y) { - x = project(x, y); - stream.point(x[0], x[1]); - } - function lineStart() { - x02 = NaN; - resampleStream.point = linePoint2; - stream.lineStart(); - } - function linePoint2(lambda, phi) { - var c = cartesian([lambda, phi]), p = project(lambda, phi); - resampleLineTo(x02, y02, lambda02, a0, b0, c0, x02 = p[0], y02 = p[1], lambda02 = lambda, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream); - stream.point(x02, y02); - } - function lineEnd() { - resampleStream.point = point; - stream.lineEnd(); - } - function ringStart() { - lineStart(); - resampleStream.point = ringPoint; - resampleStream.lineEnd = ringEnd; - } - function ringPoint(lambda, phi) { - linePoint2(lambda002 = lambda, phi), x002 = x02, y002 = y02, a00 = a0, b00 = b0, c00 = c0; - resampleStream.point = linePoint2; - } - function ringEnd() { - resampleLineTo(x02, y02, lambda02, a0, b0, c0, x002, y002, lambda002, a00, b00, c00, maxDepth, stream); - resampleStream.lineEnd = lineEnd; - lineEnd(); - } - return resampleStream; - }; -} -var transformRadians = transformer({ - point: function(x, y) { - this.stream.point(x * radians, y * radians); - } -}); -function transformRotate(rotate) { - return transformer({ - point: function(x, y) { - var r = rotate(x, y); - return this.stream.point(r[0], r[1]); - } - }); -} -function scaleTranslate(k, dx, dy, sx, sy) { - function transform2(x, y) { - x *= sx; - y *= sy; - return [dx + k * x, dy - k * y]; - } - transform2.invert = function(x, y) { - return [(x - dx) / k * sx, (dy - y) / k * sy]; - }; - return transform2; -} -function scaleTranslateRotate(k, dx, dy, sx, sy, alpha) { - if (!alpha) - return scaleTranslate(k, dx, dy, sx, sy); - var cosAlpha = cos(alpha), sinAlpha = sin(alpha), a = cosAlpha * k, b = sinAlpha * k, ai = cosAlpha / k, bi = sinAlpha / k, ci = (sinAlpha * dy - cosAlpha * dx) / k, fi = (sinAlpha * dx + cosAlpha * dy) / k; - function transform2(x, y) { - x *= sx; - y *= sy; - return [a * x - b * y + dx, dy - b * x - a * y]; - } - transform2.invert = function(x, y) { - return [sx * (ai * x - bi * y + ci), sy * (fi - bi * x - ai * y)]; - }; - return transform2; -} -function projection(project) { - return projectionMutator(function() { - return project; - })(); -} -function projectionMutator(projectAt) { - var project, k = 150, x = 480, y = 250, lambda = 0, phi = 0, deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate, alpha = 0, sx = 1, sy = 1, theta = null, preclip = clipAntimeridian, x02 = null, y02, x12, y12, postclip = identity, delta2 = 0.5, projectResample, projectTransform, projectRotateTransform, cache, cacheStream; - function projection2(point) { - return projectRotateTransform(point[0] * radians, point[1] * radians); - } - function invert(point) { - point = projectRotateTransform.invert(point[0], point[1]); - return point && [point[0] * degrees, point[1] * degrees]; - } - projection2.stream = function(stream) { - return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream))))); - }; - projection2.preclip = function(_) { - return arguments.length ? (preclip = _, theta = void 0, reset()) : preclip; - }; - projection2.postclip = function(_) { - return arguments.length ? (postclip = _, x02 = y02 = x12 = y12 = null, reset()) : postclip; - }; - projection2.clipAngle = function(_) { - return arguments.length ? (preclip = +_ ? clipCircle(theta = _ * radians) : (theta = null, clipAntimeridian), reset()) : theta * degrees; - }; - projection2.clipExtent = function(_) { - return arguments.length ? (postclip = _ == null ? (x02 = y02 = x12 = y12 = null, identity) : clipRectangle(x02 = +_[0][0], y02 = +_[0][1], x12 = +_[1][0], y12 = +_[1][1]), reset()) : x02 == null ? null : [[x02, y02], [x12, y12]]; - }; - projection2.scale = function(_) { - return arguments.length ? (k = +_, recenter()) : k; - }; - projection2.translate = function(_) { - return arguments.length ? (x = +_[0], y = +_[1], recenter()) : [x, y]; - }; - projection2.center = function(_) { - return arguments.length ? (lambda = _[0] % 360 * radians, phi = _[1] % 360 * radians, recenter()) : [lambda * degrees, phi * degrees]; - }; - projection2.rotate = function(_) { - return arguments.length ? (deltaLambda = _[0] % 360 * radians, deltaPhi = _[1] % 360 * radians, deltaGamma = _.length > 2 ? _[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees, deltaPhi * degrees, deltaGamma * degrees]; - }; - projection2.angle = function(_) { - return arguments.length ? (alpha = _ % 360 * radians, recenter()) : alpha * degrees; - }; - projection2.reflectX = function(_) { - return arguments.length ? (sx = _ ? -1 : 1, recenter()) : sx < 0; - }; - projection2.reflectY = function(_) { - return arguments.length ? (sy = _ ? -1 : 1, recenter()) : sy < 0; - }; - projection2.precision = function(_) { - return arguments.length ? (projectResample = resample(projectTransform, delta2 = _ * _), reset()) : sqrt(delta2); - }; - projection2.fitExtent = function(extent2, object2) { - return fitExtent(projection2, extent2, object2); - }; - projection2.fitSize = function(size, object2) { - return fitSize(projection2, size, object2); - }; - projection2.fitWidth = function(width, object2) { - return fitWidth(projection2, width, object2); - }; - projection2.fitHeight = function(height, object2) { - return fitHeight(projection2, height, object2); - }; - function recenter() { - var center = scaleTranslateRotate(k, 0, 0, sx, sy, alpha).apply(null, project(lambda, phi)), transform2 = scaleTranslateRotate(k, x - center[0], y - center[1], sx, sy, alpha); - rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma); - projectTransform = compose(project, transform2); - projectRotateTransform = compose(rotate, projectTransform); - projectResample = resample(projectTransform, delta2); - return reset(); - } - function reset() { - cache = cacheStream = null; - return projection2; - } - return function() { - project = projectAt.apply(this, arguments); - projection2.invert = project.invert && invert; - return recenter(); - }; -} -function conicProjection(projectAt) { - var phi02 = 0, phi12 = pi / 3, m = projectionMutator(projectAt), p = m(phi02, phi12); - p.parallels = function(_) { - return arguments.length ? m(phi02 = _[0] * radians, phi12 = _[1] * radians) : [phi02 * degrees, phi12 * degrees]; - }; - return p; -} -function cylindricalEqualAreaRaw(phi02) { - var cosPhi02 = cos(phi02); - function forward(lambda, phi) { - return [lambda * cosPhi02, sin(phi) / cosPhi02]; - } - forward.invert = function(x, y) { - return [x / cosPhi02, asin(y * cosPhi02)]; - }; - return forward; -} -function conicEqualAreaRaw(y02, y12) { - var sy0 = sin(y02), n = (sy0 + sin(y12)) / 2; - if (abs(n) < epsilon) - return cylindricalEqualAreaRaw(y02); - var c = 1 + sy0 * (2 * n - sy0), r0 = sqrt(c) / n; - function project(x, y) { - var r = sqrt(c - 2 * n * sin(y)) / n; - return [r * sin(x *= n), r0 - r * cos(x)]; - } - project.invert = function(x, y) { - var r0y = r0 - y, l = atan2(x, abs(r0y)) * sign(r0y); - if (r0y * n < 0) - l -= pi * sign(x) * sign(r0y); - return [l / n, asin((c - (x * x + r0y * r0y) * n * n) / (2 * n))]; - }; - return project; -} -function conicEqualArea() { - return conicProjection(conicEqualAreaRaw).scale(155.424).center([0, 33.6442]); -} -function albers() { - return conicEqualArea().parallels([29.5, 45.5]).scale(1070).translate([480, 250]).rotate([96, 0]).center([-0.6, 38.7]); -} -function multiplex(streams) { - var n = streams.length; - return { - point: function(x, y) { - var i = -1; - while (++i < n) - streams[i].point(x, y); - }, - sphere: function() { - var i = -1; - while (++i < n) - streams[i].sphere(); - }, - lineStart: function() { - var i = -1; - while (++i < n) - streams[i].lineStart(); - }, - lineEnd: function() { - var i = -1; - while (++i < n) - streams[i].lineEnd(); - }, - polygonStart: function() { - var i = -1; - while (++i < n) - streams[i].polygonStart(); - }, - polygonEnd: function() { - var i = -1; - while (++i < n) - streams[i].polygonEnd(); - } - }; -} -function albersUsa() { - var cache, cacheStream, lower48 = albers(), lower48Point, alaska = conicEqualArea().rotate([154, 0]).center([-2, 58.5]).parallels([55, 65]), alaskaPoint, hawaii = conicEqualArea().rotate([157, 0]).center([-3, 19.9]).parallels([8, 18]), hawaiiPoint, point, pointStream = {point: function(x, y) { - point = [x, y]; - }}; - function albersUsa2(coordinates2) { - var x = coordinates2[0], y = coordinates2[1]; - return point = null, (lower48Point.point(x, y), point) || (alaskaPoint.point(x, y), point) || (hawaiiPoint.point(x, y), point); - } - albersUsa2.invert = function(coordinates2) { - var k = lower48.scale(), t = lower48.translate(), x = (coordinates2[0] - t[0]) / k, y = (coordinates2[1] - t[1]) / k; - return (y >= 0.12 && y < 0.234 && x >= -0.425 && x < -0.214 ? alaska : y >= 0.166 && y < 0.234 && x >= -0.214 && x < -0.115 ? hawaii : lower48).invert(coordinates2); - }; - albersUsa2.stream = function(stream) { - return cache && cacheStream === stream ? cache : cache = multiplex([lower48.stream(cacheStream = stream), alaska.stream(stream), hawaii.stream(stream)]); - }; - albersUsa2.precision = function(_) { - if (!arguments.length) - return lower48.precision(); - lower48.precision(_), alaska.precision(_), hawaii.precision(_); - return reset(); - }; - albersUsa2.scale = function(_) { - if (!arguments.length) - return lower48.scale(); - lower48.scale(_), alaska.scale(_ * 0.35), hawaii.scale(_); - return albersUsa2.translate(lower48.translate()); - }; - albersUsa2.translate = function(_) { - if (!arguments.length) - return lower48.translate(); - var k = lower48.scale(), x = +_[0], y = +_[1]; - lower48Point = lower48.translate(_).clipExtent([[x - 0.455 * k, y - 0.238 * k], [x + 0.455 * k, y + 0.238 * k]]).stream(pointStream); - alaskaPoint = alaska.translate([x - 0.307 * k, y + 0.201 * k]).clipExtent([[x - 0.425 * k + epsilon, y + 0.12 * k + epsilon], [x - 0.214 * k - epsilon, y + 0.234 * k - epsilon]]).stream(pointStream); - hawaiiPoint = hawaii.translate([x - 0.205 * k, y + 0.212 * k]).clipExtent([[x - 0.214 * k + epsilon, y + 0.166 * k + epsilon], [x - 0.115 * k - epsilon, y + 0.234 * k - epsilon]]).stream(pointStream); - return reset(); - }; - albersUsa2.fitExtent = function(extent2, object2) { - return fitExtent(albersUsa2, extent2, object2); - }; - albersUsa2.fitSize = function(size, object2) { - return fitSize(albersUsa2, size, object2); - }; - albersUsa2.fitWidth = function(width, object2) { - return fitWidth(albersUsa2, width, object2); - }; - albersUsa2.fitHeight = function(height, object2) { - return fitHeight(albersUsa2, height, object2); - }; - function reset() { - cache = cacheStream = null; - return albersUsa2; - } - return albersUsa2.scale(1070); -} -function azimuthalRaw(scale) { - return function(x, y) { - var cx = cos(x), cy = cos(y), k = scale(cx * cy); - if (k === Infinity) - return [2, 0]; - return [ - k * cy * sin(x), - k * sin(y) - ]; - }; -} -function azimuthalInvert(angle2) { - return function(x, y) { - var z = sqrt(x * x + y * y), c = angle2(z), sc = sin(c), cc = cos(c); - return [ - atan2(x * sc, z * cc), - asin(z && y * sc / z) - ]; - }; -} -var azimuthalEqualAreaRaw = azimuthalRaw(function(cxcy) { - return sqrt(2 / (1 + cxcy)); -}); -azimuthalEqualAreaRaw.invert = azimuthalInvert(function(z) { - return 2 * asin(z / 2); -}); -function azimuthalEqualArea() { - return projection(azimuthalEqualAreaRaw).scale(124.75).clipAngle(180 - 1e-3); -} -var azimuthalEquidistantRaw = azimuthalRaw(function(c) { - return (c = acos(c)) && c / sin(c); -}); -azimuthalEquidistantRaw.invert = azimuthalInvert(function(z) { - return z; -}); -function azimuthalEquidistant() { - return projection(azimuthalEquidistantRaw).scale(79.4188).clipAngle(180 - 1e-3); -} -function mercatorRaw(lambda, phi) { - return [lambda, log(tan((halfPi + phi) / 2))]; -} -mercatorRaw.invert = function(x, y) { - return [x, 2 * atan(exp(y)) - halfPi]; -}; -function mercator() { - return mercatorProjection(mercatorRaw).scale(961 / tau); -} -function mercatorProjection(project) { - var m = projection(project), center = m.center, scale = m.scale, translate = m.translate, clipExtent = m.clipExtent, x02 = null, y02, x12, y12; - m.scale = function(_) { - return arguments.length ? (scale(_), reclip()) : scale(); - }; - m.translate = function(_) { - return arguments.length ? (translate(_), reclip()) : translate(); - }; - m.center = function(_) { - return arguments.length ? (center(_), reclip()) : center(); - }; - m.clipExtent = function(_) { - return arguments.length ? (_ == null ? x02 = y02 = x12 = y12 = null : (x02 = +_[0][0], y02 = +_[0][1], x12 = +_[1][0], y12 = +_[1][1]), reclip()) : x02 == null ? null : [[x02, y02], [x12, y12]]; - }; - function reclip() { - var k = pi * scale(), t = m(rotation(m.rotate()).invert([0, 0])); - return clipExtent(x02 == null ? [[t[0] - k, t[1] - k], [t[0] + k, t[1] + k]] : project === mercatorRaw ? [[Math.max(t[0] - k, x02), y02], [Math.min(t[0] + k, x12), y12]] : [[x02, Math.max(t[1] - k, y02)], [x12, Math.min(t[1] + k, y12)]]); - } - return reclip(); -} -function tany(y) { - return tan((halfPi + y) / 2); -} -function conicConformalRaw(y02, y12) { - var cy0 = cos(y02), n = y02 === y12 ? sin(y02) : log(cy0 / cos(y12)) / log(tany(y12) / tany(y02)), f = cy0 * pow(tany(y02), n) / n; - if (!n) - return mercatorRaw; - function project(x, y) { - if (f > 0) { - if (y < -halfPi + epsilon) - y = -halfPi + epsilon; - } else { - if (y > halfPi - epsilon) - y = halfPi - epsilon; - } - var r = f / pow(tany(y), n); - return [r * sin(n * x), f - r * cos(n * x)]; - } - project.invert = function(x, y) { - var fy = f - y, r = sign(n) * sqrt(x * x + fy * fy), l = atan2(x, abs(fy)) * sign(fy); - if (fy * n < 0) - l -= pi * sign(x) * sign(fy); - return [l / n, 2 * atan(pow(f / r, 1 / n)) - halfPi]; - }; - return project; -} -function conicConformal() { - return conicProjection(conicConformalRaw).scale(109.5).parallels([30, 30]); -} -function equirectangularRaw(lambda, phi) { - return [lambda, phi]; -} -equirectangularRaw.invert = equirectangularRaw; -function equirectangular() { - return projection(equirectangularRaw).scale(152.63); -} -function conicEquidistantRaw(y02, y12) { - var cy0 = cos(y02), n = y02 === y12 ? sin(y02) : (cy0 - cos(y12)) / (y12 - y02), g = cy0 / n + y02; - if (abs(n) < epsilon) - return equirectangularRaw; - function project(x, y) { - var gy = g - y, nx = n * x; - return [gy * sin(nx), g - gy * cos(nx)]; - } - project.invert = function(x, y) { - var gy = g - y, l = atan2(x, abs(gy)) * sign(gy); - if (gy * n < 0) - l -= pi * sign(x) * sign(gy); - return [l / n, g - sign(n) * sqrt(x * x + gy * gy)]; - }; - return project; -} -function conicEquidistant() { - return conicProjection(conicEquidistantRaw).scale(131.154).center([0, 13.9389]); -} -var A1 = 1.340264, A2 = -0.081106, A3 = 893e-6, A4 = 3796e-6, M = sqrt(3) / 2, iterations = 12; -function equalEarthRaw(lambda, phi) { - var l = asin(M * sin(phi)), l2 = l * l, l6 = l2 * l2 * l2; - return [ - lambda * cos(l) / (M * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2))), - l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - ]; -} -equalEarthRaw.invert = function(x, y) { - var l = y, l2 = l * l, l6 = l2 * l2 * l2; - for (var i = 0, delta, fy, fpy; i < iterations; ++i) { - fy = l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - y; - fpy = A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2); - l -= delta = fy / fpy, l2 = l * l, l6 = l2 * l2 * l2; - if (abs(delta) < epsilon2) - break; - } - return [ - M * x * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2)) / cos(l), - asin(sin(l) / M) - ]; -}; -function equalEarth() { - return projection(equalEarthRaw).scale(177.158); -} -function gnomonicRaw(x, y) { - var cy = cos(y), k = cos(x) * cy; - return [cy * sin(x) / k, sin(y) / k]; -} -gnomonicRaw.invert = azimuthalInvert(atan); -function gnomonic() { - return projection(gnomonicRaw).scale(144.049).clipAngle(60); -} -function identity$1() { - var k = 1, tx = 0, ty = 0, sx = 1, sy = 1, alpha = 0, ca, sa, x02 = null, y02, x12, y12, kx = 1, ky = 1, transform2 = transformer({ - point: function(x, y) { - var p = projection2([x, y]); - this.stream.point(p[0], p[1]); - } - }), postclip = identity, cache, cacheStream; - function reset() { - kx = k * sx; - ky = k * sy; - cache = cacheStream = null; - return projection2; - } - function projection2(p) { - var x = p[0] * kx, y = p[1] * ky; - if (alpha) { - var t = y * ca - x * sa; - x = x * ca + y * sa; - y = t; - } - return [x + tx, y + ty]; - } - projection2.invert = function(p) { - var x = p[0] - tx, y = p[1] - ty; - if (alpha) { - var t = y * ca + x * sa; - x = x * ca - y * sa; - y = t; - } - return [x / kx, y / ky]; - }; - projection2.stream = function(stream) { - return cache && cacheStream === stream ? cache : cache = transform2(postclip(cacheStream = stream)); - }; - projection2.postclip = function(_) { - return arguments.length ? (postclip = _, x02 = y02 = x12 = y12 = null, reset()) : postclip; - }; - projection2.clipExtent = function(_) { - return arguments.length ? (postclip = _ == null ? (x02 = y02 = x12 = y12 = null, identity) : clipRectangle(x02 = +_[0][0], y02 = +_[0][1], x12 = +_[1][0], y12 = +_[1][1]), reset()) : x02 == null ? null : [[x02, y02], [x12, y12]]; - }; - projection2.scale = function(_) { - return arguments.length ? (k = +_, reset()) : k; - }; - projection2.translate = function(_) { - return arguments.length ? (tx = +_[0], ty = +_[1], reset()) : [tx, ty]; - }; - projection2.angle = function(_) { - return arguments.length ? (alpha = _ % 360 * radians, sa = sin(alpha), ca = cos(alpha), reset()) : alpha * degrees; - }; - projection2.reflectX = function(_) { - return arguments.length ? (sx = _ ? -1 : 1, reset()) : sx < 0; - }; - projection2.reflectY = function(_) { - return arguments.length ? (sy = _ ? -1 : 1, reset()) : sy < 0; - }; - projection2.fitExtent = function(extent2, object2) { - return fitExtent(projection2, extent2, object2); - }; - projection2.fitSize = function(size, object2) { - return fitSize(projection2, size, object2); - }; - projection2.fitWidth = function(width, object2) { - return fitWidth(projection2, width, object2); - }; - projection2.fitHeight = function(height, object2) { - return fitHeight(projection2, height, object2); - }; - return projection2; -} -function naturalEarth1Raw(lambda, phi) { - var phi2 = phi * phi, phi4 = phi2 * phi2; - return [ - lambda * (0.8707 - 0.131979 * phi2 + phi4 * (-0.013791 + phi4 * (3971e-6 * phi2 - 1529e-6 * phi4))), - phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 5916e-6 * phi4))) - ]; -} -naturalEarth1Raw.invert = function(x, y) { - var phi = y, i = 25, delta; - do { - var phi2 = phi * phi, phi4 = phi2 * phi2; - phi -= delta = (phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 5916e-6 * phi4))) - y) / (1.007226 + phi2 * (0.015085 * 3 + phi4 * (-0.044475 * 7 + 0.028874 * 9 * phi2 - 5916e-6 * 11 * phi4))); - } while (abs(delta) > epsilon && --i > 0); - return [ - x / (0.8707 + (phi2 = phi * phi) * (-0.131979 + phi2 * (-0.013791 + phi2 * phi2 * phi2 * (3971e-6 - 1529e-6 * phi2)))), - phi - ]; -}; -function naturalEarth1() { - return projection(naturalEarth1Raw).scale(175.295); -} -function orthographicRaw(x, y) { - return [cos(y) * sin(x), sin(y)]; -} -orthographicRaw.invert = azimuthalInvert(asin); -function orthographic() { - return projection(orthographicRaw).scale(249.5).clipAngle(90 + epsilon); -} -function stereographicRaw(x, y) { - var cy = cos(y), k = 1 + cos(x) * cy; - return [cy * sin(x) / k, sin(y) / k]; -} -stereographicRaw.invert = azimuthalInvert(function(z) { - return 2 * atan(z); -}); -function stereographic() { - return projection(stereographicRaw).scale(250).clipAngle(142); -} -function transverseMercatorRaw(lambda, phi) { - return [log(tan((halfPi + phi) / 2)), -lambda]; -} -transverseMercatorRaw.invert = function(x, y) { - return [-y, 2 * atan(exp(x)) - halfPi]; -}; -function transverseMercator() { - var m = mercatorProjection(transverseMercatorRaw), center = m.center, rotate = m.rotate; - m.center = function(_) { - return arguments.length ? center([-_[1], _[0]]) : (_ = center(), [_[1], -_[0]]); - }; - m.rotate = function(_) { - return arguments.length ? rotate([_[0], _[1], _.length > 2 ? _[2] + 90 : 90]) : (_ = rotate(), [_[0], _[1], _[2] - 90]); - }; - return rotate([0, 0, 90]).scale(159.155); -} -export {albers as geoAlbers, albersUsa as geoAlbersUsa, area as geoArea, azimuthalEqualArea as geoAzimuthalEqualArea, azimuthalEqualAreaRaw as geoAzimuthalEqualAreaRaw, azimuthalEquidistant as geoAzimuthalEquidistant, azimuthalEquidistantRaw as geoAzimuthalEquidistantRaw, bounds as geoBounds, centroid as geoCentroid, circle as geoCircle, clipAntimeridian as geoClipAntimeridian, clipCircle as geoClipCircle, extent as geoClipExtent, clipRectangle as geoClipRectangle, conicConformal as geoConicConformal, conicConformalRaw as geoConicConformalRaw, conicEqualArea as geoConicEqualArea, conicEqualAreaRaw as geoConicEqualAreaRaw, conicEquidistant as geoConicEquidistant, conicEquidistantRaw as geoConicEquidistantRaw, contains as geoContains, distance as geoDistance, equalEarth as geoEqualEarth, equalEarthRaw as geoEqualEarthRaw, equirectangular as geoEquirectangular, equirectangularRaw as geoEquirectangularRaw, gnomonic as geoGnomonic, gnomonicRaw as geoGnomonicRaw, graticule as geoGraticule, graticule10 as geoGraticule10, identity$1 as geoIdentity, interpolate as geoInterpolate, length as geoLength, mercator as geoMercator, mercatorRaw as geoMercatorRaw, naturalEarth1 as geoNaturalEarth1, naturalEarth1Raw as geoNaturalEarth1Raw, orthographic as geoOrthographic, orthographicRaw as geoOrthographicRaw, index as geoPath, projection as geoProjection, projectionMutator as geoProjectionMutator, rotation as geoRotation, stereographic as geoStereographic, stereographicRaw as geoStereographicRaw, geoStream, transform as geoTransform, transverseMercator as geoTransverseMercator, transverseMercatorRaw as geoTransverseMercatorRaw}; -export default null; diff --git a/web/client/deps/d3/d3-hierarchy.js b/web/client/deps/d3/d3-hierarchy.js deleted file mode 100644 index 744ffd3b..00000000 --- a/web/client/deps/d3/d3-hierarchy.js +++ /dev/null @@ -1,1025 +0,0 @@ -function defaultSeparation(a2, b) { - return a2.parent === b.parent ? 1 : 2; -} -function meanX(children) { - return children.reduce(meanXReduce, 0) / children.length; -} -function meanXReduce(x, c2) { - return x + c2.x; -} -function maxY(children) { - return 1 + children.reduce(maxYReduce, 0); -} -function maxYReduce(y, c2) { - return Math.max(y, c2.y); -} -function leafLeft(node) { - var children; - while (children = node.children) - node = children[0]; - return node; -} -function leafRight(node) { - var children; - while (children = node.children) - node = children[children.length - 1]; - return node; -} -function cluster() { - var separation = defaultSeparation, dx = 1, dy = 1, nodeSize = false; - function cluster2(root) { - var previousNode, x = 0; - root.eachAfter(function(node) { - var children = node.children; - if (children) { - node.x = meanX(children); - node.y = maxY(children); - } else { - node.x = previousNode ? x += separation(node, previousNode) : 0; - node.y = 0; - previousNode = node; - } - }); - var left = leafLeft(root), right = leafRight(root), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2; - return root.eachAfter(nodeSize ? function(node) { - node.x = (node.x - root.x) * dx; - node.y = (root.y - node.y) * dy; - } : function(node) { - node.x = (node.x - x0) / (x1 - x0) * dx; - node.y = (1 - (root.y ? node.y / root.y : 1)) * dy; - }); - } - cluster2.separation = function(x) { - return arguments.length ? (separation = x, cluster2) : separation; - }; - cluster2.size = function(x) { - return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], cluster2) : nodeSize ? null : [dx, dy]; - }; - cluster2.nodeSize = function(x) { - return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], cluster2) : nodeSize ? [dx, dy] : null; - }; - return cluster2; -} -function count(node) { - var sum = 0, children = node.children, i = children && children.length; - if (!i) - sum = 1; - else - while (--i >= 0) - sum += children[i].value; - node.value = sum; -} -function node_count() { - return this.eachAfter(count); -} -function node_each(callback, that) { - let index2 = -1; - for (const node of this) { - callback.call(that, node, ++index2, this); - } - return this; -} -function node_eachBefore(callback, that) { - var node = this, nodes = [node], children, i, index2 = -1; - while (node = nodes.pop()) { - callback.call(that, node, ++index2, this); - if (children = node.children) { - for (i = children.length - 1; i >= 0; --i) { - nodes.push(children[i]); - } - } - } - return this; -} -function node_eachAfter(callback, that) { - var node = this, nodes = [node], next = [], children, i, n, index2 = -1; - while (node = nodes.pop()) { - next.push(node); - if (children = node.children) { - for (i = 0, n = children.length; i < n; ++i) { - nodes.push(children[i]); - } - } - } - while (node = next.pop()) { - callback.call(that, node, ++index2, this); - } - return this; -} -function node_find(callback, that) { - let index2 = -1; - for (const node of this) { - if (callback.call(that, node, ++index2, this)) { - return node; - } - } -} -function node_sum(value) { - return this.eachAfter(function(node) { - var sum = +value(node.data) || 0, children = node.children, i = children && children.length; - while (--i >= 0) - sum += children[i].value; - node.value = sum; - }); -} -function node_sort(compare) { - return this.eachBefore(function(node) { - if (node.children) { - node.children.sort(compare); - } - }); -} -function node_path(end) { - var start = this, ancestor = leastCommonAncestor(start, end), nodes = [start]; - while (start !== ancestor) { - start = start.parent; - nodes.push(start); - } - var k = nodes.length; - while (end !== ancestor) { - nodes.splice(k, 0, end); - end = end.parent; - } - return nodes; -} -function leastCommonAncestor(a2, b) { - if (a2 === b) - return a2; - var aNodes = a2.ancestors(), bNodes = b.ancestors(), c2 = null; - a2 = aNodes.pop(); - b = bNodes.pop(); - while (a2 === b) { - c2 = a2; - a2 = aNodes.pop(); - b = bNodes.pop(); - } - return c2; -} -function node_ancestors() { - var node = this, nodes = [node]; - while (node = node.parent) { - nodes.push(node); - } - return nodes; -} -function node_descendants() { - return Array.from(this); -} -function node_leaves() { - var leaves = []; - this.eachBefore(function(node) { - if (!node.children) { - leaves.push(node); - } - }); - return leaves; -} -function node_links() { - var root = this, links = []; - root.each(function(node) { - if (node !== root) { - links.push({source: node.parent, target: node}); - } - }); - return links; -} -function* node_iterator() { - var node = this, current, next = [node], children, i, n; - do { - current = next.reverse(), next = []; - while (node = current.pop()) { - yield node; - if (children = node.children) { - for (i = 0, n = children.length; i < n; ++i) { - next.push(children[i]); - } - } - } - } while (next.length); -} -function hierarchy(data, children) { - if (data instanceof Map) { - data = [void 0, data]; - if (children === void 0) - children = mapChildren; - } else if (children === void 0) { - children = objectChildren; - } - var root = new Node(data), node, nodes = [root], child, childs, i, n; - while (node = nodes.pop()) { - if ((childs = children(node.data)) && (n = (childs = Array.from(childs)).length)) { - node.children = childs; - for (i = n - 1; i >= 0; --i) { - nodes.push(child = childs[i] = new Node(childs[i])); - child.parent = node; - child.depth = node.depth + 1; - } - } - } - return root.eachBefore(computeHeight); -} -function node_copy() { - return hierarchy(this).eachBefore(copyData); -} -function objectChildren(d) { - return d.children; -} -function mapChildren(d) { - return Array.isArray(d) ? d[1] : null; -} -function copyData(node) { - if (node.data.value !== void 0) - node.value = node.data.value; - node.data = node.data.data; -} -function computeHeight(node) { - var height = 0; - do - node.height = height; - while ((node = node.parent) && node.height < ++height); -} -function Node(data) { - this.data = data; - this.depth = this.height = 0; - this.parent = null; -} -Node.prototype = hierarchy.prototype = { - constructor: Node, - count: node_count, - each: node_each, - eachAfter: node_eachAfter, - eachBefore: node_eachBefore, - find: node_find, - sum: node_sum, - sort: node_sort, - path: node_path, - ancestors: node_ancestors, - descendants: node_descendants, - leaves: node_leaves, - links: node_links, - copy: node_copy, - [Symbol.iterator]: node_iterator -}; -function optional(f) { - return f == null ? null : required(f); -} -function required(f) { - if (typeof f !== "function") - throw new Error(); - return f; -} -function constantZero() { - return 0; -} -function constant(x) { - return function() { - return x; - }; -} -const a = 1664525; -const c = 1013904223; -const m = 4294967296; -function lcg() { - let s = 1; - return () => (s = (a * s + c) % m) / m; -} -function array(x) { - return typeof x === "object" && "length" in x ? x : Array.from(x); -} -function shuffle(array2, random) { - let m2 = array2.length, t, i; - while (m2) { - i = random() * m2-- | 0; - t = array2[m2]; - array2[m2] = array2[i]; - array2[i] = t; - } - return array2; -} -function enclose(circles) { - return packEncloseRandom(circles, lcg()); -} -function packEncloseRandom(circles, random) { - var i = 0, n = (circles = shuffle(Array.from(circles), random)).length, B = [], p, e; - while (i < n) { - p = circles[i]; - if (e && enclosesWeak(e, p)) - ++i; - else - e = encloseBasis(B = extendBasis(B, p)), i = 0; - } - return e; -} -function extendBasis(B, p) { - var i, j; - if (enclosesWeakAll(p, B)) - return [p]; - for (i = 0; i < B.length; ++i) { - if (enclosesNot(p, B[i]) && enclosesWeakAll(encloseBasis2(B[i], p), B)) { - return [B[i], p]; - } - } - for (i = 0; i < B.length - 1; ++i) { - for (j = i + 1; j < B.length; ++j) { - if (enclosesNot(encloseBasis2(B[i], B[j]), p) && enclosesNot(encloseBasis2(B[i], p), B[j]) && enclosesNot(encloseBasis2(B[j], p), B[i]) && enclosesWeakAll(encloseBasis3(B[i], B[j], p), B)) { - return [B[i], B[j], p]; - } - } - } - throw new Error(); -} -function enclosesNot(a2, b) { - var dr = a2.r - b.r, dx = b.x - a2.x, dy = b.y - a2.y; - return dr < 0 || dr * dr < dx * dx + dy * dy; -} -function enclosesWeak(a2, b) { - var dr = a2.r - b.r + Math.max(a2.r, b.r, 1) * 1e-9, dx = b.x - a2.x, dy = b.y - a2.y; - return dr > 0 && dr * dr > dx * dx + dy * dy; -} -function enclosesWeakAll(a2, B) { - for (var i = 0; i < B.length; ++i) { - if (!enclosesWeak(a2, B[i])) { - return false; - } - } - return true; -} -function encloseBasis(B) { - switch (B.length) { - case 1: - return encloseBasis1(B[0]); - case 2: - return encloseBasis2(B[0], B[1]); - case 3: - return encloseBasis3(B[0], B[1], B[2]); - } -} -function encloseBasis1(a2) { - return { - x: a2.x, - y: a2.y, - r: a2.r - }; -} -function encloseBasis2(a2, b) { - var x1 = a2.x, y1 = a2.y, r1 = a2.r, x2 = b.x, y2 = b.y, r2 = b.r, x21 = x2 - x1, y21 = y2 - y1, r21 = r2 - r1, l = Math.sqrt(x21 * x21 + y21 * y21); - return { - x: (x1 + x2 + x21 / l * r21) / 2, - y: (y1 + y2 + y21 / l * r21) / 2, - r: (l + r1 + r2) / 2 - }; -} -function encloseBasis3(a2, b, c2) { - var x1 = a2.x, y1 = a2.y, r1 = a2.r, x2 = b.x, y2 = b.y, r2 = b.r, x3 = c2.x, y3 = c2.y, r3 = c2.r, a22 = x1 - x2, a3 = x1 - x3, b2 = y1 - y2, b3 = y1 - y3, c22 = r2 - r1, c3 = r3 - r1, d1 = x1 * x1 + y1 * y1 - r1 * r1, d2 = d1 - x2 * x2 - y2 * y2 + r2 * r2, d3 = d1 - x3 * x3 - y3 * y3 + r3 * r3, ab = a3 * b2 - a22 * b3, xa = (b2 * d3 - b3 * d2) / (ab * 2) - x1, xb = (b3 * c22 - b2 * c3) / ab, ya = (a3 * d2 - a22 * d3) / (ab * 2) - y1, yb = (a22 * c3 - a3 * c22) / ab, A = xb * xb + yb * yb - 1, B = 2 * (r1 + xa * xb + ya * yb), C = xa * xa + ya * ya - r1 * r1, r = -(Math.abs(A) > 1e-6 ? (B + Math.sqrt(B * B - 4 * A * C)) / (2 * A) : C / B); - return { - x: x1 + xa + xb * r, - y: y1 + ya + yb * r, - r - }; -} -function place(b, a2, c2) { - var dx = b.x - a2.x, x, a22, dy = b.y - a2.y, y, b2, d2 = dx * dx + dy * dy; - if (d2) { - a22 = a2.r + c2.r, a22 *= a22; - b2 = b.r + c2.r, b2 *= b2; - if (a22 > b2) { - x = (d2 + b2 - a22) / (2 * d2); - y = Math.sqrt(Math.max(0, b2 / d2 - x * x)); - c2.x = b.x - x * dx - y * dy; - c2.y = b.y - x * dy + y * dx; - } else { - x = (d2 + a22 - b2) / (2 * d2); - y = Math.sqrt(Math.max(0, a22 / d2 - x * x)); - c2.x = a2.x + x * dx - y * dy; - c2.y = a2.y + x * dy + y * dx; - } - } else { - c2.x = a2.x + c2.r; - c2.y = a2.y; - } -} -function intersects(a2, b) { - var dr = a2.r + b.r - 1e-6, dx = b.x - a2.x, dy = b.y - a2.y; - return dr > 0 && dr * dr > dx * dx + dy * dy; -} -function score(node) { - var a2 = node._, b = node.next._, ab = a2.r + b.r, dx = (a2.x * b.r + b.x * a2.r) / ab, dy = (a2.y * b.r + b.y * a2.r) / ab; - return dx * dx + dy * dy; -} -function Node$1(circle) { - this._ = circle; - this.next = null; - this.previous = null; -} -function packSiblingsRandom(circles, random) { - if (!(n = (circles = array(circles)).length)) - return 0; - var a2, b, c2, n, aa, ca, i, j, k, sj, sk; - a2 = circles[0], a2.x = 0, a2.y = 0; - if (!(n > 1)) - return a2.r; - b = circles[1], a2.x = -b.r, b.x = a2.r, b.y = 0; - if (!(n > 2)) - return a2.r + b.r; - place(b, a2, c2 = circles[2]); - a2 = new Node$1(a2), b = new Node$1(b), c2 = new Node$1(c2); - a2.next = c2.previous = b; - b.next = a2.previous = c2; - c2.next = b.previous = a2; - pack: - for (i = 3; i < n; ++i) { - place(a2._, b._, c2 = circles[i]), c2 = new Node$1(c2); - j = b.next, k = a2.previous, sj = b._.r, sk = a2._.r; - do { - if (sj <= sk) { - if (intersects(j._, c2._)) { - b = j, a2.next = b, b.previous = a2, --i; - continue pack; - } - sj += j._.r, j = j.next; - } else { - if (intersects(k._, c2._)) { - a2 = k, a2.next = b, b.previous = a2, --i; - continue pack; - } - sk += k._.r, k = k.previous; - } - } while (j !== k.next); - c2.previous = a2, c2.next = b, a2.next = b.previous = b = c2; - aa = score(a2); - while ((c2 = c2.next) !== b) { - if ((ca = score(c2)) < aa) { - a2 = c2, aa = ca; - } - } - b = a2.next; - } - a2 = [b._], c2 = b; - while ((c2 = c2.next) !== b) - a2.push(c2._); - c2 = packEncloseRandom(a2, random); - for (i = 0; i < n; ++i) - a2 = circles[i], a2.x -= c2.x, a2.y -= c2.y; - return c2.r; -} -function siblings(circles) { - packSiblingsRandom(circles, lcg()); - return circles; -} -function defaultRadius(d) { - return Math.sqrt(d.value); -} -function index() { - var radius = null, dx = 1, dy = 1, padding = constantZero; - function pack(root) { - const random = lcg(); - root.x = dx / 2, root.y = dy / 2; - if (radius) { - root.eachBefore(radiusLeaf(radius)).eachAfter(packChildrenRandom(padding, 0.5, random)).eachBefore(translateChild(1)); - } else { - root.eachBefore(radiusLeaf(defaultRadius)).eachAfter(packChildrenRandom(constantZero, 1, random)).eachAfter(packChildrenRandom(padding, root.r / Math.min(dx, dy), random)).eachBefore(translateChild(Math.min(dx, dy) / (2 * root.r))); - } - return root; - } - pack.radius = function(x) { - return arguments.length ? (radius = optional(x), pack) : radius; - }; - pack.size = function(x) { - return arguments.length ? (dx = +x[0], dy = +x[1], pack) : [dx, dy]; - }; - pack.padding = function(x) { - return arguments.length ? (padding = typeof x === "function" ? x : constant(+x), pack) : padding; - }; - return pack; -} -function radiusLeaf(radius) { - return function(node) { - if (!node.children) { - node.r = Math.max(0, +radius(node) || 0); - } - }; -} -function packChildrenRandom(padding, k, random) { - return function(node) { - if (children = node.children) { - var children, i, n = children.length, r = padding(node) * k || 0, e; - if (r) - for (i = 0; i < n; ++i) - children[i].r += r; - e = packSiblingsRandom(children, random); - if (r) - for (i = 0; i < n; ++i) - children[i].r -= r; - node.r = e + r; - } - }; -} -function translateChild(k) { - return function(node) { - var parent = node.parent; - node.r *= k; - if (parent) { - node.x = parent.x + k * node.x; - node.y = parent.y + k * node.y; - } - }; -} -function roundNode(node) { - node.x0 = Math.round(node.x0); - node.y0 = Math.round(node.y0); - node.x1 = Math.round(node.x1); - node.y1 = Math.round(node.y1); -} -function treemapDice(parent, x0, y0, x1, y1) { - var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (x1 - x0) / parent.value; - while (++i < n) { - node = nodes[i], node.y0 = y0, node.y1 = y1; - node.x0 = x0, node.x1 = x0 += node.value * k; - } -} -function partition() { - var dx = 1, dy = 1, padding = 0, round = false; - function partition2(root) { - var n = root.height + 1; - root.x0 = root.y0 = padding; - root.x1 = dx; - root.y1 = dy / n; - root.eachBefore(positionNode(dy, n)); - if (round) - root.eachBefore(roundNode); - return root; - } - function positionNode(dy2, n) { - return function(node) { - if (node.children) { - treemapDice(node, node.x0, dy2 * (node.depth + 1) / n, node.x1, dy2 * (node.depth + 2) / n); - } - var x0 = node.x0, y0 = node.y0, x1 = node.x1 - padding, y1 = node.y1 - padding; - if (x1 < x0) - x0 = x1 = (x0 + x1) / 2; - if (y1 < y0) - y0 = y1 = (y0 + y1) / 2; - node.x0 = x0; - node.y0 = y0; - node.x1 = x1; - node.y1 = y1; - }; - } - partition2.round = function(x) { - return arguments.length ? (round = !!x, partition2) : round; - }; - partition2.size = function(x) { - return arguments.length ? (dx = +x[0], dy = +x[1], partition2) : [dx, dy]; - }; - partition2.padding = function(x) { - return arguments.length ? (padding = +x, partition2) : padding; - }; - return partition2; -} -var preroot = {depth: -1}, ambiguous = {}, imputed = {}; -function defaultId(d) { - return d.id; -} -function defaultParentId(d) { - return d.parentId; -} -function stratify() { - var id = defaultId, parentId = defaultParentId, path; - function stratify2(data) { - var nodes = Array.from(data), currentId = id, currentParentId = parentId, n, d, i, root, parent, node, nodeId, nodeKey, nodeByKey = new Map(); - if (path != null) { - const I = nodes.map((d2, i2) => normalize(path(d2, i2, data))); - const P = I.map(parentof); - const S = new Set(I).add(""); - for (const i2 of P) { - if (!S.has(i2)) { - S.add(i2); - I.push(i2); - P.push(parentof(i2)); - nodes.push(imputed); - } - } - currentId = (_, i2) => I[i2]; - currentParentId = (_, i2) => P[i2]; - } - for (i = 0, n = nodes.length; i < n; ++i) { - d = nodes[i], node = nodes[i] = new Node(d); - if ((nodeId = currentId(d, i, data)) != null && (nodeId += "")) { - nodeKey = node.id = nodeId; - nodeByKey.set(nodeKey, nodeByKey.has(nodeKey) ? ambiguous : node); - } - if ((nodeId = currentParentId(d, i, data)) != null && (nodeId += "")) { - node.parent = nodeId; - } - } - for (i = 0; i < n; ++i) { - node = nodes[i]; - if (nodeId = node.parent) { - parent = nodeByKey.get(nodeId); - if (!parent) - throw new Error("missing: " + nodeId); - if (parent === ambiguous) - throw new Error("ambiguous: " + nodeId); - if (parent.children) - parent.children.push(node); - else - parent.children = [node]; - node.parent = parent; - } else { - if (root) - throw new Error("multiple roots"); - root = node; - } - } - if (!root) - throw new Error("no root"); - if (path != null) { - while (root.data === imputed && root.children.length === 1) { - root = root.children[0], --n; - } - for (let i2 = nodes.length - 1; i2 >= 0; --i2) { - node = nodes[i2]; - if (node.data !== imputed) - break; - node.data = null; - } - } - root.parent = preroot; - root.eachBefore(function(node2) { - node2.depth = node2.parent.depth + 1; - --n; - }).eachBefore(computeHeight); - root.parent = null; - if (n > 0) - throw new Error("cycle"); - return root; - } - stratify2.id = function(x) { - return arguments.length ? (id = optional(x), stratify2) : id; - }; - stratify2.parentId = function(x) { - return arguments.length ? (parentId = optional(x), stratify2) : parentId; - }; - stratify2.path = function(x) { - return arguments.length ? (path = optional(x), stratify2) : path; - }; - return stratify2; -} -function normalize(path) { - path = `${path}`; - let i = path.length; - if (slash(path, i - 1) && !slash(path, i - 2)) - path = path.slice(0, -1); - return path[0] === "/" ? path : `/${path}`; -} -function parentof(path) { - let i = path.length; - if (i < 2) - return ""; - while (--i > 1) - if (slash(path, i)) - break; - return path.slice(0, i); -} -function slash(path, i) { - if (path[i] === "/") { - let k = 0; - while (i > 0 && path[--i] === "\\") - ++k; - if ((k & 1) === 0) - return true; - } - return false; -} -function defaultSeparation$1(a2, b) { - return a2.parent === b.parent ? 1 : 2; -} -function nextLeft(v) { - var children = v.children; - return children ? children[0] : v.t; -} -function nextRight(v) { - var children = v.children; - return children ? children[children.length - 1] : v.t; -} -function moveSubtree(wm, wp, shift) { - var change = shift / (wp.i - wm.i); - wp.c -= change; - wp.s += shift; - wm.c += change; - wp.z += shift; - wp.m += shift; -} -function executeShifts(v) { - var shift = 0, change = 0, children = v.children, i = children.length, w; - while (--i >= 0) { - w = children[i]; - w.z += shift; - w.m += shift; - shift += w.s + (change += w.c); - } -} -function nextAncestor(vim, v, ancestor) { - return vim.a.parent === v.parent ? vim.a : ancestor; -} -function TreeNode(node, i) { - this._ = node; - this.parent = null; - this.children = null; - this.A = null; - this.a = this; - this.z = 0; - this.m = 0; - this.c = 0; - this.s = 0; - this.t = null; - this.i = i; -} -TreeNode.prototype = Object.create(Node.prototype); -function treeRoot(root) { - var tree2 = new TreeNode(root, 0), node, nodes = [tree2], child, children, i, n; - while (node = nodes.pop()) { - if (children = node._.children) { - node.children = new Array(n = children.length); - for (i = n - 1; i >= 0; --i) { - nodes.push(child = node.children[i] = new TreeNode(children[i], i)); - child.parent = node; - } - } - } - (tree2.parent = new TreeNode(null, 0)).children = [tree2]; - return tree2; -} -function tree() { - var separation = defaultSeparation$1, dx = 1, dy = 1, nodeSize = null; - function tree2(root) { - var t = treeRoot(root); - t.eachAfter(firstWalk), t.parent.m = -t.z; - t.eachBefore(secondWalk); - if (nodeSize) - root.eachBefore(sizeNode); - else { - var left = root, right = root, bottom = root; - root.eachBefore(function(node) { - if (node.x < left.x) - left = node; - if (node.x > right.x) - right = node; - if (node.depth > bottom.depth) - bottom = node; - }); - var s = left === right ? 1 : separation(left, right) / 2, tx = s - left.x, kx = dx / (right.x + s + tx), ky = dy / (bottom.depth || 1); - root.eachBefore(function(node) { - node.x = (node.x + tx) * kx; - node.y = node.depth * ky; - }); - } - return root; - } - function firstWalk(v) { - var children = v.children, siblings2 = v.parent.children, w = v.i ? siblings2[v.i - 1] : null; - if (children) { - executeShifts(v); - var midpoint = (children[0].z + children[children.length - 1].z) / 2; - if (w) { - v.z = w.z + separation(v._, w._); - v.m = v.z - midpoint; - } else { - v.z = midpoint; - } - } else if (w) { - v.z = w.z + separation(v._, w._); - } - v.parent.A = apportion(v, w, v.parent.A || siblings2[0]); - } - function secondWalk(v) { - v._.x = v.z + v.parent.m; - v.m += v.parent.m; - } - function apportion(v, w, ancestor) { - if (w) { - var vip = v, vop = v, vim = w, vom = vip.parent.children[0], sip = vip.m, sop = vop.m, sim = vim.m, som = vom.m, shift; - while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) { - vom = nextLeft(vom); - vop = nextRight(vop); - vop.a = v; - shift = vim.z + sim - vip.z - sip + separation(vim._, vip._); - if (shift > 0) { - moveSubtree(nextAncestor(vim, v, ancestor), v, shift); - sip += shift; - sop += shift; - } - sim += vim.m; - sip += vip.m; - som += vom.m; - sop += vop.m; - } - if (vim && !nextRight(vop)) { - vop.t = vim; - vop.m += sim - sop; - } - if (vip && !nextLeft(vom)) { - vom.t = vip; - vom.m += sip - som; - ancestor = v; - } - } - return ancestor; - } - function sizeNode(node) { - node.x *= dx; - node.y = node.depth * dy; - } - tree2.separation = function(x) { - return arguments.length ? (separation = x, tree2) : separation; - }; - tree2.size = function(x) { - return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree2) : nodeSize ? null : [dx, dy]; - }; - tree2.nodeSize = function(x) { - return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree2) : nodeSize ? [dx, dy] : null; - }; - return tree2; -} -function treemapSlice(parent, x0, y0, x1, y1) { - var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (y1 - y0) / parent.value; - while (++i < n) { - node = nodes[i], node.x0 = x0, node.x1 = x1; - node.y0 = y0, node.y1 = y0 += node.value * k; - } -} -var phi = (1 + Math.sqrt(5)) / 2; -function squarifyRatio(ratio, parent, x0, y0, x1, y1) { - var rows = [], nodes = parent.children, row, nodeValue, i0 = 0, i1 = 0, n = nodes.length, dx, dy, value = parent.value, sumValue, minValue, maxValue, newRatio, minRatio, alpha, beta; - while (i0 < n) { - dx = x1 - x0, dy = y1 - y0; - do - sumValue = nodes[i1++].value; - while (!sumValue && i1 < n); - minValue = maxValue = sumValue; - alpha = Math.max(dy / dx, dx / dy) / (value * ratio); - beta = sumValue * sumValue * alpha; - minRatio = Math.max(maxValue / beta, beta / minValue); - for (; i1 < n; ++i1) { - sumValue += nodeValue = nodes[i1].value; - if (nodeValue < minValue) - minValue = nodeValue; - if (nodeValue > maxValue) - maxValue = nodeValue; - beta = sumValue * sumValue * alpha; - newRatio = Math.max(maxValue / beta, beta / minValue); - if (newRatio > minRatio) { - sumValue -= nodeValue; - break; - } - minRatio = newRatio; - } - rows.push(row = {value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1)}); - if (row.dice) - treemapDice(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1); - else - treemapSlice(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1); - value -= sumValue, i0 = i1; - } - return rows; -} -var squarify = function custom(ratio) { - function squarify2(parent, x0, y0, x1, y1) { - squarifyRatio(ratio, parent, x0, y0, x1, y1); - } - squarify2.ratio = function(x) { - return custom((x = +x) > 1 ? x : 1); - }; - return squarify2; -}(phi); -function index$1() { - var tile = squarify, round = false, dx = 1, dy = 1, paddingStack = [0], paddingInner = constantZero, paddingTop = constantZero, paddingRight = constantZero, paddingBottom = constantZero, paddingLeft = constantZero; - function treemap(root) { - root.x0 = root.y0 = 0; - root.x1 = dx; - root.y1 = dy; - root.eachBefore(positionNode); - paddingStack = [0]; - if (round) - root.eachBefore(roundNode); - return root; - } - function positionNode(node) { - var p = paddingStack[node.depth], x0 = node.x0 + p, y0 = node.y0 + p, x1 = node.x1 - p, y1 = node.y1 - p; - if (x1 < x0) - x0 = x1 = (x0 + x1) / 2; - if (y1 < y0) - y0 = y1 = (y0 + y1) / 2; - node.x0 = x0; - node.y0 = y0; - node.x1 = x1; - node.y1 = y1; - if (node.children) { - p = paddingStack[node.depth + 1] = paddingInner(node) / 2; - x0 += paddingLeft(node) - p; - y0 += paddingTop(node) - p; - x1 -= paddingRight(node) - p; - y1 -= paddingBottom(node) - p; - if (x1 < x0) - x0 = x1 = (x0 + x1) / 2; - if (y1 < y0) - y0 = y1 = (y0 + y1) / 2; - tile(node, x0, y0, x1, y1); - } - } - treemap.round = function(x) { - return arguments.length ? (round = !!x, treemap) : round; - }; - treemap.size = function(x) { - return arguments.length ? (dx = +x[0], dy = +x[1], treemap) : [dx, dy]; - }; - treemap.tile = function(x) { - return arguments.length ? (tile = required(x), treemap) : tile; - }; - treemap.padding = function(x) { - return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner(); - }; - treemap.paddingInner = function(x) { - return arguments.length ? (paddingInner = typeof x === "function" ? x : constant(+x), treemap) : paddingInner; - }; - treemap.paddingOuter = function(x) { - return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop(); - }; - treemap.paddingTop = function(x) { - return arguments.length ? (paddingTop = typeof x === "function" ? x : constant(+x), treemap) : paddingTop; - }; - treemap.paddingRight = function(x) { - return arguments.length ? (paddingRight = typeof x === "function" ? x : constant(+x), treemap) : paddingRight; - }; - treemap.paddingBottom = function(x) { - return arguments.length ? (paddingBottom = typeof x === "function" ? x : constant(+x), treemap) : paddingBottom; - }; - treemap.paddingLeft = function(x) { - return arguments.length ? (paddingLeft = typeof x === "function" ? x : constant(+x), treemap) : paddingLeft; - }; - return treemap; -} -function binary(parent, x0, y0, x1, y1) { - var nodes = parent.children, i, n = nodes.length, sum, sums = new Array(n + 1); - for (sums[0] = sum = i = 0; i < n; ++i) { - sums[i + 1] = sum += nodes[i].value; - } - partition2(0, n, parent.value, x0, y0, x1, y1); - function partition2(i2, j, value, x02, y02, x12, y12) { - if (i2 >= j - 1) { - var node = nodes[i2]; - node.x0 = x02, node.y0 = y02; - node.x1 = x12, node.y1 = y12; - return; - } - var valueOffset = sums[i2], valueTarget = value / 2 + valueOffset, k = i2 + 1, hi = j - 1; - while (k < hi) { - var mid = k + hi >>> 1; - if (sums[mid] < valueTarget) - k = mid + 1; - else - hi = mid; - } - if (valueTarget - sums[k - 1] < sums[k] - valueTarget && i2 + 1 < k) - --k; - var valueLeft = sums[k] - valueOffset, valueRight = value - valueLeft; - if (x12 - x02 > y12 - y02) { - var xk = value ? (x02 * valueRight + x12 * valueLeft) / value : x12; - partition2(i2, k, valueLeft, x02, y02, xk, y12); - partition2(k, j, valueRight, xk, y02, x12, y12); - } else { - var yk = value ? (y02 * valueRight + y12 * valueLeft) / value : y12; - partition2(i2, k, valueLeft, x02, y02, x12, yk); - partition2(k, j, valueRight, x02, yk, x12, y12); - } - } -} -function sliceDice(parent, x0, y0, x1, y1) { - (parent.depth & 1 ? treemapSlice : treemapDice)(parent, x0, y0, x1, y1); -} -var resquarify = function custom2(ratio) { - function resquarify2(parent, x0, y0, x1, y1) { - if ((rows = parent._squarify) && rows.ratio === ratio) { - var rows, row, nodes, i, j = -1, n, m2 = rows.length, value = parent.value; - while (++j < m2) { - row = rows[j], nodes = row.children; - for (i = row.value = 0, n = nodes.length; i < n; ++i) - row.value += nodes[i].value; - if (row.dice) - treemapDice(row, x0, y0, x1, value ? y0 += (y1 - y0) * row.value / value : y1); - else - treemapSlice(row, x0, y0, value ? x0 += (x1 - x0) * row.value / value : x1, y1); - value -= row.value; - } - } else { - parent._squarify = rows = squarifyRatio(ratio, parent, x0, y0, x1, y1); - rows.ratio = ratio; - } - } - resquarify2.ratio = function(x) { - return custom2((x = +x) > 1 ? x : 1); - }; - return resquarify2; -}(phi); -export {Node, cluster, hierarchy, index as pack, enclose as packEnclose, siblings as packSiblings, partition, stratify, tree, index$1 as treemap, binary as treemapBinary, treemapDice, resquarify as treemapResquarify, treemapSlice, sliceDice as treemapSliceDice, squarify as treemapSquarify}; -export default null; diff --git a/web/client/deps/d3/d3-interpolate.js b/web/client/deps/d3/d3-interpolate.js deleted file mode 100644 index 24dc9e12..00000000 --- a/web/client/deps/d3/d3-interpolate.js +++ /dev/null @@ -1,426 +0,0 @@ -import {rgb as rgb$1, color, hsl as hsl$2, lab as lab$1, hcl as hcl$2, cubehelix as cubehelix$2} from "./d3-color.js"; -function basis(t1, v0, v1, v2, v3) { - var t2 = t1 * t1, t3 = t2 * t1; - return ((1 - 3 * t1 + 3 * t2 - t3) * v0 + (4 - 6 * t2 + 3 * t3) * v1 + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2 + t3 * v3) / 6; -} -function basis$1(values) { - var n = values.length - 1; - return function(t) { - var i = t <= 0 ? t = 0 : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n), v1 = values[i], v2 = values[i + 1], v0 = i > 0 ? values[i - 1] : 2 * v1 - v2, v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1; - return basis((t - i / n) * n, v0, v1, v2, v3); - }; -} -function basisClosed(values) { - var n = values.length; - return function(t) { - var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n), v0 = values[(i + n - 1) % n], v1 = values[i % n], v2 = values[(i + 1) % n], v3 = values[(i + 2) % n]; - return basis((t - i / n) * n, v0, v1, v2, v3); - }; -} -var constant = (x) => () => x; -function linear(a, d) { - return function(t) { - return a + t * d; - }; -} -function exponential(a, b, y) { - return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) { - return Math.pow(a + t * b, y); - }; -} -function hue(a, b) { - var d = b - a; - return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant(isNaN(a) ? b : a); -} -function gamma(y) { - return (y = +y) === 1 ? nogamma : function(a, b) { - return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a); - }; -} -function nogamma(a, b) { - var d = b - a; - return d ? linear(a, d) : constant(isNaN(a) ? b : a); -} -var rgb = function rgbGamma(y) { - var color2 = gamma(y); - function rgb2(start, end) { - var r = color2((start = rgb$1(start)).r, (end = rgb$1(end)).r), g = color2(start.g, end.g), b = color2(start.b, end.b), opacity = nogamma(start.opacity, end.opacity); - return function(t) { - start.r = r(t); - start.g = g(t); - start.b = b(t); - start.opacity = opacity(t); - return start + ""; - }; - } - rgb2.gamma = rgbGamma; - return rgb2; -}(1); -function rgbSpline(spline) { - return function(colors) { - var n = colors.length, r = new Array(n), g = new Array(n), b = new Array(n), i, color2; - for (i = 0; i < n; ++i) { - color2 = rgb$1(colors[i]); - r[i] = color2.r || 0; - g[i] = color2.g || 0; - b[i] = color2.b || 0; - } - r = spline(r); - g = spline(g); - b = spline(b); - color2.opacity = 1; - return function(t) { - color2.r = r(t); - color2.g = g(t); - color2.b = b(t); - return color2 + ""; - }; - }; -} -var rgbBasis = rgbSpline(basis$1); -var rgbBasisClosed = rgbSpline(basisClosed); -function numberArray(a, b) { - if (!b) - b = []; - var n = a ? Math.min(b.length, a.length) : 0, c = b.slice(), i; - return function(t) { - for (i = 0; i < n; ++i) - c[i] = a[i] * (1 - t) + b[i] * t; - return c; - }; -} -function isNumberArray(x) { - return ArrayBuffer.isView(x) && !(x instanceof DataView); -} -function array(a, b) { - return (isNumberArray(b) ? numberArray : genericArray)(a, b); -} -function genericArray(a, b) { - var nb = b ? b.length : 0, na = a ? Math.min(nb, a.length) : 0, x = new Array(na), c = new Array(nb), i; - for (i = 0; i < na; ++i) - x[i] = value(a[i], b[i]); - for (; i < nb; ++i) - c[i] = b[i]; - return function(t) { - for (i = 0; i < na; ++i) - c[i] = x[i](t); - return c; - }; -} -function date(a, b) { - var d = new Date(); - return a = +a, b = +b, function(t) { - return d.setTime(a * (1 - t) + b * t), d; - }; -} -function number(a, b) { - return a = +a, b = +b, function(t) { - return a * (1 - t) + b * t; - }; -} -function object(a, b) { - var i = {}, c = {}, k; - if (a === null || typeof a !== "object") - a = {}; - if (b === null || typeof b !== "object") - b = {}; - for (k in b) { - if (k in a) { - i[k] = value(a[k], b[k]); - } else { - c[k] = b[k]; - } - } - return function(t) { - for (k in i) - c[k] = i[k](t); - return c; - }; -} -var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, reB = new RegExp(reA.source, "g"); -function zero(b) { - return function() { - return b; - }; -} -function one(b) { - return function(t) { - return b(t) + ""; - }; -} -function string(a, b) { - var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i = -1, s = [], q = []; - a = a + "", b = b + ""; - while ((am = reA.exec(a)) && (bm = reB.exec(b))) { - if ((bs = bm.index) > bi) { - bs = b.slice(bi, bs); - if (s[i]) - s[i] += bs; - else - s[++i] = bs; - } - if ((am = am[0]) === (bm = bm[0])) { - if (s[i]) - s[i] += bm; - else - s[++i] = bm; - } else { - s[++i] = null; - q.push({i, x: number(am, bm)}); - } - bi = reB.lastIndex; - } - if (bi < b.length) { - bs = b.slice(bi); - if (s[i]) - s[i] += bs; - else - s[++i] = bs; - } - return s.length < 2 ? q[0] ? one(q[0].x) : zero(b) : (b = q.length, function(t) { - for (var i2 = 0, o; i2 < b; ++i2) - s[(o = q[i2]).i] = o.x(t); - return s.join(""); - }); -} -function value(a, b) { - var t = typeof b, c; - return b == null || t === "boolean" ? constant(b) : (t === "number" ? number : t === "string" ? (c = color(b)) ? (b = c, rgb) : string : b instanceof color ? rgb : b instanceof Date ? date : isNumberArray(b) ? numberArray : Array.isArray(b) ? genericArray : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object : number)(a, b); -} -function discrete(range) { - var n = range.length; - return function(t) { - return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))]; - }; -} -function hue$1(a, b) { - var i = hue(+a, +b); - return function(t) { - var x = i(t); - return x - 360 * Math.floor(x / 360); - }; -} -function round(a, b) { - return a = +a, b = +b, function(t) { - return Math.round(a * (1 - t) + b * t); - }; -} -var degrees = 180 / Math.PI; -var identity = { - translateX: 0, - translateY: 0, - rotate: 0, - skewX: 0, - scaleX: 1, - scaleY: 1 -}; -function decompose(a, b, c, d, e, f) { - var scaleX, scaleY, skewX; - if (scaleX = Math.sqrt(a * a + b * b)) - a /= scaleX, b /= scaleX; - if (skewX = a * c + b * d) - c -= a * skewX, d -= b * skewX; - if (scaleY = Math.sqrt(c * c + d * d)) - c /= scaleY, d /= scaleY, skewX /= scaleY; - if (a * d < b * c) - a = -a, b = -b, skewX = -skewX, scaleX = -scaleX; - return { - translateX: e, - translateY: f, - rotate: Math.atan2(b, a) * degrees, - skewX: Math.atan(skewX) * degrees, - scaleX, - scaleY - }; -} -var svgNode; -function parseCss(value2) { - const m = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value2 + ""); - return m.isIdentity ? identity : decompose(m.a, m.b, m.c, m.d, m.e, m.f); -} -function parseSvg(value2) { - if (value2 == null) - return identity; - if (!svgNode) - svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g"); - svgNode.setAttribute("transform", value2); - if (!(value2 = svgNode.transform.baseVal.consolidate())) - return identity; - value2 = value2.matrix; - return decompose(value2.a, value2.b, value2.c, value2.d, value2.e, value2.f); -} -function interpolateTransform(parse, pxComma, pxParen, degParen) { - function pop(s) { - return s.length ? s.pop() + " " : ""; - } - function translate(xa, ya, xb, yb, s, q) { - if (xa !== xb || ya !== yb) { - var i = s.push("translate(", null, pxComma, null, pxParen); - q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)}); - } else if (xb || yb) { - s.push("translate(" + xb + pxComma + yb + pxParen); - } - } - function rotate(a, b, s, q) { - if (a !== b) { - if (a - b > 180) - b += 360; - else if (b - a > 180) - a += 360; - q.push({i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: number(a, b)}); - } else if (b) { - s.push(pop(s) + "rotate(" + b + degParen); - } - } - function skewX(a, b, s, q) { - if (a !== b) { - q.push({i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: number(a, b)}); - } else if (b) { - s.push(pop(s) + "skewX(" + b + degParen); - } - } - function scale(xa, ya, xb, yb, s, q) { - if (xa !== xb || ya !== yb) { - var i = s.push(pop(s) + "scale(", null, ",", null, ")"); - q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)}); - } else if (xb !== 1 || yb !== 1) { - s.push(pop(s) + "scale(" + xb + "," + yb + ")"); - } - } - return function(a, b) { - var s = [], q = []; - a = parse(a), b = parse(b); - translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q); - rotate(a.rotate, b.rotate, s, q); - skewX(a.skewX, b.skewX, s, q); - scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q); - a = b = null; - return function(t) { - var i = -1, n = q.length, o; - while (++i < n) - s[(o = q[i]).i] = o.x(t); - return s.join(""); - }; - }; -} -var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)"); -var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")"); -var epsilon2 = 1e-12; -function cosh(x) { - return ((x = Math.exp(x)) + 1 / x) / 2; -} -function sinh(x) { - return ((x = Math.exp(x)) - 1 / x) / 2; -} -function tanh(x) { - return ((x = Math.exp(2 * x)) - 1) / (x + 1); -} -var zoom = function zoomRho(rho, rho2, rho4) { - function zoom2(p0, p1) { - var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i, S; - if (d2 < epsilon2) { - S = Math.log(w1 / w0) / rho; - i = function(t) { - return [ - ux0 + t * dx, - uy0 + t * dy, - w0 * Math.exp(rho * t * S) - ]; - }; - } else { - var d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1); - S = (r1 - r0) / rho; - i = function(t) { - var s = t * S, coshr0 = cosh(r0), u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0)); - return [ - ux0 + u * dx, - uy0 + u * dy, - w0 * coshr0 / cosh(rho * s + r0) - ]; - }; - } - i.duration = S * 1e3 * rho / Math.SQRT2; - return i; - } - zoom2.rho = function(_) { - var _1 = Math.max(1e-3, +_), _2 = _1 * _1, _4 = _2 * _2; - return zoomRho(_1, _2, _4); - }; - return zoom2; -}(Math.SQRT2, 2, 4); -function hsl(hue2) { - return function(start, end) { - var h = hue2((start = hsl$2(start)).h, (end = hsl$2(end)).h), s = nogamma(start.s, end.s), l = nogamma(start.l, end.l), opacity = nogamma(start.opacity, end.opacity); - return function(t) { - start.h = h(t); - start.s = s(t); - start.l = l(t); - start.opacity = opacity(t); - return start + ""; - }; - }; -} -var hsl$1 = hsl(hue); -var hslLong = hsl(nogamma); -function lab(start, end) { - var l = nogamma((start = lab$1(start)).l, (end = lab$1(end)).l), a = nogamma(start.a, end.a), b = nogamma(start.b, end.b), opacity = nogamma(start.opacity, end.opacity); - return function(t) { - start.l = l(t); - start.a = a(t); - start.b = b(t); - start.opacity = opacity(t); - return start + ""; - }; -} -function hcl(hue2) { - return function(start, end) { - var h = hue2((start = hcl$2(start)).h, (end = hcl$2(end)).h), c = nogamma(start.c, end.c), l = nogamma(start.l, end.l), opacity = nogamma(start.opacity, end.opacity); - return function(t) { - start.h = h(t); - start.c = c(t); - start.l = l(t); - start.opacity = opacity(t); - return start + ""; - }; - }; -} -var hcl$1 = hcl(hue); -var hclLong = hcl(nogamma); -function cubehelix(hue2) { - return function cubehelixGamma(y) { - y = +y; - function cubehelix2(start, end) { - var h = hue2((start = cubehelix$2(start)).h, (end = cubehelix$2(end)).h), s = nogamma(start.s, end.s), l = nogamma(start.l, end.l), opacity = nogamma(start.opacity, end.opacity); - return function(t) { - start.h = h(t); - start.s = s(t); - start.l = l(Math.pow(t, y)); - start.opacity = opacity(t); - return start + ""; - }; - } - cubehelix2.gamma = cubehelixGamma; - return cubehelix2; - }(1); -} -var cubehelix$1 = cubehelix(hue); -var cubehelixLong = cubehelix(nogamma); -function piecewise(interpolate, values) { - if (values === void 0) - values = interpolate, interpolate = value; - var i = 0, n = values.length - 1, v = values[0], I = new Array(n < 0 ? 0 : n); - while (i < n) - I[i] = interpolate(v, v = values[++i]); - return function(t) { - var i2 = Math.max(0, Math.min(n - 1, Math.floor(t *= n))); - return I[i2](t - i2); - }; -} -function quantize(interpolator, n) { - var samples = new Array(n); - for (var i = 0; i < n; ++i) - samples[i] = interpolator(i / (n - 1)); - return samples; -} -export {value as interpolate, array as interpolateArray, basis$1 as interpolateBasis, basisClosed as interpolateBasisClosed, cubehelix$1 as interpolateCubehelix, cubehelixLong as interpolateCubehelixLong, date as interpolateDate, discrete as interpolateDiscrete, hcl$1 as interpolateHcl, hclLong as interpolateHclLong, hsl$1 as interpolateHsl, hslLong as interpolateHslLong, hue$1 as interpolateHue, lab as interpolateLab, number as interpolateNumber, numberArray as interpolateNumberArray, object as interpolateObject, rgb as interpolateRgb, rgbBasis as interpolateRgbBasis, rgbBasisClosed as interpolateRgbBasisClosed, round as interpolateRound, string as interpolateString, interpolateTransformCss, interpolateTransformSvg, zoom as interpolateZoom, piecewise, quantize}; -export default null; diff --git a/web/client/deps/d3/d3-path.js b/web/client/deps/d3/d3-path.js deleted file mode 100644 index 72874068..00000000 --- a/web/client/deps/d3/d3-path.js +++ /dev/null @@ -1,76 +0,0 @@ -const pi = Math.PI, tau = 2 * pi, epsilon = 1e-6, tauEpsilon = tau - epsilon; -function Path() { - this._x0 = this._y0 = this._x1 = this._y1 = null; - this._ = ""; -} -function path() { - return new Path(); -} -Path.prototype = path.prototype = { - constructor: Path, - moveTo: function(x, y) { - this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y); - }, - closePath: function() { - if (this._x1 !== null) { - this._x1 = this._x0, this._y1 = this._y0; - this._ += "Z"; - } - }, - lineTo: function(x, y) { - this._ += "L" + (this._x1 = +x) + "," + (this._y1 = +y); - }, - quadraticCurveTo: function(x1, y1, x, y) { - this._ += "Q" + +x1 + "," + +y1 + "," + (this._x1 = +x) + "," + (this._y1 = +y); - }, - bezierCurveTo: function(x1, y1, x2, y2, x, y) { - this._ += "C" + +x1 + "," + +y1 + "," + +x2 + "," + +y2 + "," + (this._x1 = +x) + "," + (this._y1 = +y); - }, - arcTo: function(x1, y1, x2, y2, r) { - x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r; - var x0 = this._x1, y0 = this._y1, x21 = x2 - x1, y21 = y2 - y1, x01 = x0 - x1, y01 = y0 - y1, l01_2 = x01 * x01 + y01 * y01; - if (r < 0) - throw new Error("negative radius: " + r); - if (this._x1 === null) { - this._ += "M" + (this._x1 = x1) + "," + (this._y1 = y1); - } else if (!(l01_2 > epsilon)) - ; - else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) { - this._ += "L" + (this._x1 = x1) + "," + (this._y1 = y1); - } else { - var x20 = x2 - x0, y20 = y2 - y0, l21_2 = x21 * x21 + y21 * y21, l20_2 = x20 * x20 + y20 * y20, l21 = Math.sqrt(l21_2), l01 = Math.sqrt(l01_2), l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), t01 = l / l01, t21 = l / l21; - if (Math.abs(t01 - 1) > epsilon) { - this._ += "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01); - } - this._ += "A" + r + "," + r + ",0,0," + +(y01 * x20 > x01 * y20) + "," + (this._x1 = x1 + t21 * x21) + "," + (this._y1 = y1 + t21 * y21); - } - }, - arc: function(x, y, r, a0, a1, ccw) { - x = +x, y = +y, r = +r, ccw = !!ccw; - var dx = r * Math.cos(a0), dy = r * Math.sin(a0), x0 = x + dx, y0 = y + dy, cw = 1 ^ ccw, da = ccw ? a0 - a1 : a1 - a0; - if (r < 0) - throw new Error("negative radius: " + r); - if (this._x1 === null) { - this._ += "M" + x0 + "," + y0; - } else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) { - this._ += "L" + x0 + "," + y0; - } - if (!r) - return; - if (da < 0) - da = da % tau + tau; - if (da > tauEpsilon) { - this._ += "A" + r + "," + r + ",0,1," + cw + "," + (x - dx) + "," + (y - dy) + "A" + r + "," + r + ",0,1," + cw + "," + (this._x1 = x0) + "," + (this._y1 = y0); - } else if (da > epsilon) { - this._ += "A" + r + "," + r + ",0," + +(da >= pi) + "," + cw + "," + (this._x1 = x + r * Math.cos(a1)) + "," + (this._y1 = y + r * Math.sin(a1)); - } - }, - rect: function(x, y, w, h) { - this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y) + "h" + +w + "v" + +h + "h" + -w + "Z"; - }, - toString: function() { - return this._; - } -}; -export {path}; -export default null; diff --git a/web/client/deps/d3/d3-polygon.js b/web/client/deps/d3/d3-polygon.js deleted file mode 100644 index 5bf284b7..00000000 --- a/web/client/deps/d3/d3-polygon.js +++ /dev/null @@ -1,79 +0,0 @@ -function area(polygon) { - var i = -1, n = polygon.length, a, b = polygon[n - 1], area2 = 0; - while (++i < n) { - a = b; - b = polygon[i]; - area2 += a[1] * b[0] - a[0] * b[1]; - } - return area2 / 2; -} -function centroid(polygon) { - var i = -1, n = polygon.length, x = 0, y = 0, a, b = polygon[n - 1], c, k = 0; - while (++i < n) { - a = b; - b = polygon[i]; - k += c = a[0] * b[1] - b[0] * a[1]; - x += (a[0] + b[0]) * c; - y += (a[1] + b[1]) * c; - } - return k *= 3, [x / k, y / k]; -} -function cross(a, b, c) { - return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]); -} -function lexicographicOrder(a, b) { - return a[0] - b[0] || a[1] - b[1]; -} -function computeUpperHullIndexes(points) { - const n = points.length, indexes = [0, 1]; - let size = 2, i; - for (i = 2; i < n; ++i) { - while (size > 1 && cross(points[indexes[size - 2]], points[indexes[size - 1]], points[i]) <= 0) - --size; - indexes[size++] = i; - } - return indexes.slice(0, size); -} -function hull(points) { - if ((n = points.length) < 3) - return null; - var i, n, sortedPoints = new Array(n), flippedPoints = new Array(n); - for (i = 0; i < n; ++i) - sortedPoints[i] = [+points[i][0], +points[i][1], i]; - sortedPoints.sort(lexicographicOrder); - for (i = 0; i < n; ++i) - flippedPoints[i] = [sortedPoints[i][0], -sortedPoints[i][1]]; - var upperIndexes = computeUpperHullIndexes(sortedPoints), lowerIndexes = computeUpperHullIndexes(flippedPoints); - var skipLeft = lowerIndexes[0] === upperIndexes[0], skipRight = lowerIndexes[lowerIndexes.length - 1] === upperIndexes[upperIndexes.length - 1], hull2 = []; - for (i = upperIndexes.length - 1; i >= 0; --i) - hull2.push(points[sortedPoints[upperIndexes[i]][2]]); - for (i = +skipLeft; i < lowerIndexes.length - skipRight; ++i) - hull2.push(points[sortedPoints[lowerIndexes[i]][2]]); - return hull2; -} -function contains(polygon, point) { - var n = polygon.length, p = polygon[n - 1], x = point[0], y = point[1], x0 = p[0], y0 = p[1], x1, y1, inside = false; - for (var i = 0; i < n; ++i) { - p = polygon[i], x1 = p[0], y1 = p[1]; - if (y1 > y !== y0 > y && x < (x0 - x1) * (y - y1) / (y0 - y1) + x1) - inside = !inside; - x0 = x1, y0 = y1; - } - return inside; -} -function length(polygon) { - var i = -1, n = polygon.length, b = polygon[n - 1], xa, ya, xb = b[0], yb = b[1], perimeter = 0; - while (++i < n) { - xa = xb; - ya = yb; - b = polygon[i]; - xb = b[0]; - yb = b[1]; - xa -= xb; - ya -= yb; - perimeter += Math.hypot(xa, ya); - } - return perimeter; -} -export {area as polygonArea, centroid as polygonCentroid, contains as polygonContains, hull as polygonHull, length as polygonLength}; -export default null; diff --git a/web/client/deps/d3/d3-quadtree.js b/web/client/deps/d3/d3-quadtree.js deleted file mode 100644 index 80e70304..00000000 --- a/web/client/deps/d3/d3-quadtree.js +++ /dev/null @@ -1,322 +0,0 @@ -function tree_add(d) { - const x = +this._x.call(null, d), y = +this._y.call(null, d); - return add(this.cover(x, y), x, y, d); -} -function add(tree, x, y, d) { - if (isNaN(x) || isNaN(y)) - return tree; - var parent, node = tree._root, leaf = {data: d}, x0 = tree._x0, y0 = tree._y0, x1 = tree._x1, y1 = tree._y1, xm, ym, xp, yp, right, bottom, i, j; - if (!node) - return tree._root = leaf, tree; - while (node.length) { - if (right = x >= (xm = (x0 + x1) / 2)) - x0 = xm; - else - x1 = xm; - if (bottom = y >= (ym = (y0 + y1) / 2)) - y0 = ym; - else - y1 = ym; - if (parent = node, !(node = node[i = bottom << 1 | right])) - return parent[i] = leaf, tree; - } - xp = +tree._x.call(null, node.data); - yp = +tree._y.call(null, node.data); - if (x === xp && y === yp) - return leaf.next = node, parent ? parent[i] = leaf : tree._root = leaf, tree; - do { - parent = parent ? parent[i] = new Array(4) : tree._root = new Array(4); - if (right = x >= (xm = (x0 + x1) / 2)) - x0 = xm; - else - x1 = xm; - if (bottom = y >= (ym = (y0 + y1) / 2)) - y0 = ym; - else - y1 = ym; - } while ((i = bottom << 1 | right) === (j = (yp >= ym) << 1 | xp >= xm)); - return parent[j] = node, parent[i] = leaf, tree; -} -function addAll(data) { - var d, i, n = data.length, x, y, xz = new Array(n), yz = new Array(n), x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity; - for (i = 0; i < n; ++i) { - if (isNaN(x = +this._x.call(null, d = data[i])) || isNaN(y = +this._y.call(null, d))) - continue; - xz[i] = x; - yz[i] = y; - if (x < x0) - x0 = x; - if (x > x1) - x1 = x; - if (y < y0) - y0 = y; - if (y > y1) - y1 = y; - } - if (x0 > x1 || y0 > y1) - return this; - this.cover(x0, y0).cover(x1, y1); - for (i = 0; i < n; ++i) { - add(this, xz[i], yz[i], data[i]); - } - return this; -} -function tree_cover(x, y) { - if (isNaN(x = +x) || isNaN(y = +y)) - return this; - var x0 = this._x0, y0 = this._y0, x1 = this._x1, y1 = this._y1; - if (isNaN(x0)) { - x1 = (x0 = Math.floor(x)) + 1; - y1 = (y0 = Math.floor(y)) + 1; - } else { - var z = x1 - x0 || 1, node = this._root, parent, i; - while (x0 > x || x >= x1 || y0 > y || y >= y1) { - i = (y < y0) << 1 | x < x0; - parent = new Array(4), parent[i] = node, node = parent, z *= 2; - switch (i) { - case 0: - x1 = x0 + z, y1 = y0 + z; - break; - case 1: - x0 = x1 - z, y1 = y0 + z; - break; - case 2: - x1 = x0 + z, y0 = y1 - z; - break; - case 3: - x0 = x1 - z, y0 = y1 - z; - break; - } - } - if (this._root && this._root.length) - this._root = node; - } - this._x0 = x0; - this._y0 = y0; - this._x1 = x1; - this._y1 = y1; - return this; -} -function tree_data() { - var data = []; - this.visit(function(node) { - if (!node.length) - do - data.push(node.data); - while (node = node.next); - }); - return data; -} -function tree_extent(_) { - return arguments.length ? this.cover(+_[0][0], +_[0][1]).cover(+_[1][0], +_[1][1]) : isNaN(this._x0) ? void 0 : [[this._x0, this._y0], [this._x1, this._y1]]; -} -function Quad(node, x0, y0, x1, y1) { - this.node = node; - this.x0 = x0; - this.y0 = y0; - this.x1 = x1; - this.y1 = y1; -} -function tree_find(x, y, radius) { - var data, x0 = this._x0, y0 = this._y0, x1, y1, x2, y2, x3 = this._x1, y3 = this._y1, quads = [], node = this._root, q, i; - if (node) - quads.push(new Quad(node, x0, y0, x3, y3)); - if (radius == null) - radius = Infinity; - else { - x0 = x - radius, y0 = y - radius; - x3 = x + radius, y3 = y + radius; - radius *= radius; - } - while (q = quads.pop()) { - if (!(node = q.node) || (x1 = q.x0) > x3 || (y1 = q.y0) > y3 || (x2 = q.x1) < x0 || (y2 = q.y1) < y0) - continue; - if (node.length) { - var xm = (x1 + x2) / 2, ym = (y1 + y2) / 2; - quads.push(new Quad(node[3], xm, ym, x2, y2), new Quad(node[2], x1, ym, xm, y2), new Quad(node[1], xm, y1, x2, ym), new Quad(node[0], x1, y1, xm, ym)); - if (i = (y >= ym) << 1 | x >= xm) { - q = quads[quads.length - 1]; - quads[quads.length - 1] = quads[quads.length - 1 - i]; - quads[quads.length - 1 - i] = q; - } - } else { - var dx = x - +this._x.call(null, node.data), dy = y - +this._y.call(null, node.data), d2 = dx * dx + dy * dy; - if (d2 < radius) { - var d = Math.sqrt(radius = d2); - x0 = x - d, y0 = y - d; - x3 = x + d, y3 = y + d; - data = node.data; - } - } - } - return data; -} -function tree_remove(d) { - if (isNaN(x = +this._x.call(null, d)) || isNaN(y = +this._y.call(null, d))) - return this; - var parent, node = this._root, retainer, previous, next, x0 = this._x0, y0 = this._y0, x1 = this._x1, y1 = this._y1, x, y, xm, ym, right, bottom, i, j; - if (!node) - return this; - if (node.length) - while (true) { - if (right = x >= (xm = (x0 + x1) / 2)) - x0 = xm; - else - x1 = xm; - if (bottom = y >= (ym = (y0 + y1) / 2)) - y0 = ym; - else - y1 = ym; - if (!(parent = node, node = node[i = bottom << 1 | right])) - return this; - if (!node.length) - break; - if (parent[i + 1 & 3] || parent[i + 2 & 3] || parent[i + 3 & 3]) - retainer = parent, j = i; - } - while (node.data !== d) - if (!(previous = node, node = node.next)) - return this; - if (next = node.next) - delete node.next; - if (previous) - return next ? previous.next = next : delete previous.next, this; - if (!parent) - return this._root = next, this; - next ? parent[i] = next : delete parent[i]; - if ((node = parent[0] || parent[1] || parent[2] || parent[3]) && node === (parent[3] || parent[2] || parent[1] || parent[0]) && !node.length) { - if (retainer) - retainer[j] = node; - else - this._root = node; - } - return this; -} -function removeAll(data) { - for (var i = 0, n = data.length; i < n; ++i) - this.remove(data[i]); - return this; -} -function tree_root() { - return this._root; -} -function tree_size() { - var size = 0; - this.visit(function(node) { - if (!node.length) - do - ++size; - while (node = node.next); - }); - return size; -} -function tree_visit(callback) { - var quads = [], q, node = this._root, child, x0, y0, x1, y1; - if (node) - quads.push(new Quad(node, this._x0, this._y0, this._x1, this._y1)); - while (q = quads.pop()) { - if (!callback(node = q.node, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1) && node.length) { - var xm = (x0 + x1) / 2, ym = (y0 + y1) / 2; - if (child = node[3]) - quads.push(new Quad(child, xm, ym, x1, y1)); - if (child = node[2]) - quads.push(new Quad(child, x0, ym, xm, y1)); - if (child = node[1]) - quads.push(new Quad(child, xm, y0, x1, ym)); - if (child = node[0]) - quads.push(new Quad(child, x0, y0, xm, ym)); - } - } - return this; -} -function tree_visitAfter(callback) { - var quads = [], next = [], q; - if (this._root) - quads.push(new Quad(this._root, this._x0, this._y0, this._x1, this._y1)); - while (q = quads.pop()) { - var node = q.node; - if (node.length) { - var child, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1, xm = (x0 + x1) / 2, ym = (y0 + y1) / 2; - if (child = node[0]) - quads.push(new Quad(child, x0, y0, xm, ym)); - if (child = node[1]) - quads.push(new Quad(child, xm, y0, x1, ym)); - if (child = node[2]) - quads.push(new Quad(child, x0, ym, xm, y1)); - if (child = node[3]) - quads.push(new Quad(child, xm, ym, x1, y1)); - } - next.push(q); - } - while (q = next.pop()) { - callback(q.node, q.x0, q.y0, q.x1, q.y1); - } - return this; -} -function defaultX(d) { - return d[0]; -} -function tree_x(_) { - return arguments.length ? (this._x = _, this) : this._x; -} -function defaultY(d) { - return d[1]; -} -function tree_y(_) { - return arguments.length ? (this._y = _, this) : this._y; -} -function quadtree(nodes, x, y) { - var tree = new Quadtree(x == null ? defaultX : x, y == null ? defaultY : y, NaN, NaN, NaN, NaN); - return nodes == null ? tree : tree.addAll(nodes); -} -function Quadtree(x, y, x0, y0, x1, y1) { - this._x = x; - this._y = y; - this._x0 = x0; - this._y0 = y0; - this._x1 = x1; - this._y1 = y1; - this._root = void 0; -} -function leaf_copy(leaf) { - var copy = {data: leaf.data}, next = copy; - while (leaf = leaf.next) - next = next.next = {data: leaf.data}; - return copy; -} -var treeProto = quadtree.prototype = Quadtree.prototype; -treeProto.copy = function() { - var copy = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1), node = this._root, nodes, child; - if (!node) - return copy; - if (!node.length) - return copy._root = leaf_copy(node), copy; - nodes = [{source: node, target: copy._root = new Array(4)}]; - while (node = nodes.pop()) { - for (var i = 0; i < 4; ++i) { - if (child = node.source[i]) { - if (child.length) - nodes.push({source: child, target: node.target[i] = new Array(4)}); - else - node.target[i] = leaf_copy(child); - } - } - } - return copy; -}; -treeProto.add = tree_add; -treeProto.addAll = addAll; -treeProto.cover = tree_cover; -treeProto.data = tree_data; -treeProto.extent = tree_extent; -treeProto.find = tree_find; -treeProto.remove = tree_remove; -treeProto.removeAll = removeAll; -treeProto.root = tree_root; -treeProto.size = tree_size; -treeProto.visit = tree_visit; -treeProto.visitAfter = tree_visitAfter; -treeProto.x = tree_x; -treeProto.y = tree_y; -export {quadtree}; -export default null; diff --git a/web/client/deps/d3/d3-random.js b/web/client/deps/d3/d3-random.js deleted file mode 100644 index 72b9d2fe..00000000 --- a/web/client/deps/d3/d3-random.js +++ /dev/null @@ -1,272 +0,0 @@ -var defaultSource = Math.random; -var uniform = function sourceRandomUniform(source) { - function randomUniform(min, max) { - min = min == null ? 0 : +min; - max = max == null ? 1 : +max; - if (arguments.length === 1) - max = min, min = 0; - else - max -= min; - return function() { - return source() * max + min; - }; - } - randomUniform.source = sourceRandomUniform; - return randomUniform; -}(defaultSource); -var int = function sourceRandomInt(source) { - function randomInt(min, max) { - if (arguments.length < 2) - max = min, min = 0; - min = Math.floor(min); - max = Math.floor(max) - min; - return function() { - return Math.floor(source() * max + min); - }; - } - randomInt.source = sourceRandomInt; - return randomInt; -}(defaultSource); -var normal = function sourceRandomNormal(source) { - function randomNormal(mu, sigma) { - var x, r; - mu = mu == null ? 0 : +mu; - sigma = sigma == null ? 1 : +sigma; - return function() { - var y; - if (x != null) - y = x, x = null; - else - do { - x = source() * 2 - 1; - y = source() * 2 - 1; - r = x * x + y * y; - } while (!r || r > 1); - return mu + sigma * y * Math.sqrt(-2 * Math.log(r) / r); - }; - } - randomNormal.source = sourceRandomNormal; - return randomNormal; -}(defaultSource); -var logNormal = function sourceRandomLogNormal(source) { - var N = normal.source(source); - function randomLogNormal() { - var randomNormal = N.apply(this, arguments); - return function() { - return Math.exp(randomNormal()); - }; - } - randomLogNormal.source = sourceRandomLogNormal; - return randomLogNormal; -}(defaultSource); -var irwinHall = function sourceRandomIrwinHall(source) { - function randomIrwinHall(n) { - if ((n = +n) <= 0) - return () => 0; - return function() { - for (var sum = 0, i = n; i > 1; --i) - sum += source(); - return sum + i * source(); - }; - } - randomIrwinHall.source = sourceRandomIrwinHall; - return randomIrwinHall; -}(defaultSource); -var bates = function sourceRandomBates(source) { - var I = irwinHall.source(source); - function randomBates(n) { - if ((n = +n) === 0) - return source; - var randomIrwinHall = I(n); - return function() { - return randomIrwinHall() / n; - }; - } - randomBates.source = sourceRandomBates; - return randomBates; -}(defaultSource); -var exponential = function sourceRandomExponential(source) { - function randomExponential(lambda) { - return function() { - return -Math.log1p(-source()) / lambda; - }; - } - randomExponential.source = sourceRandomExponential; - return randomExponential; -}(defaultSource); -var pareto = function sourceRandomPareto(source) { - function randomPareto(alpha) { - if ((alpha = +alpha) < 0) - throw new RangeError("invalid alpha"); - alpha = 1 / -alpha; - return function() { - return Math.pow(1 - source(), alpha); - }; - } - randomPareto.source = sourceRandomPareto; - return randomPareto; -}(defaultSource); -var bernoulli = function sourceRandomBernoulli(source) { - function randomBernoulli(p) { - if ((p = +p) < 0 || p > 1) - throw new RangeError("invalid p"); - return function() { - return Math.floor(source() + p); - }; - } - randomBernoulli.source = sourceRandomBernoulli; - return randomBernoulli; -}(defaultSource); -var geometric = function sourceRandomGeometric(source) { - function randomGeometric(p) { - if ((p = +p) < 0 || p > 1) - throw new RangeError("invalid p"); - if (p === 0) - return () => Infinity; - if (p === 1) - return () => 1; - p = Math.log1p(-p); - return function() { - return 1 + Math.floor(Math.log1p(-source()) / p); - }; - } - randomGeometric.source = sourceRandomGeometric; - return randomGeometric; -}(defaultSource); -var gamma = function sourceRandomGamma(source) { - var randomNormal = normal.source(source)(); - function randomGamma(k, theta) { - if ((k = +k) < 0) - throw new RangeError("invalid k"); - if (k === 0) - return () => 0; - theta = theta == null ? 1 : +theta; - if (k === 1) - return () => -Math.log1p(-source()) * theta; - var d = (k < 1 ? k + 1 : k) - 1 / 3, c = 1 / (3 * Math.sqrt(d)), multiplier = k < 1 ? () => Math.pow(source(), 1 / k) : () => 1; - return function() { - do { - do { - var x = randomNormal(), v = 1 + c * x; - } while (v <= 0); - v *= v * v; - var u = 1 - source(); - } while (u >= 1 - 0.0331 * x * x * x * x && Math.log(u) >= 0.5 * x * x + d * (1 - v + Math.log(v))); - return d * v * multiplier() * theta; - }; - } - randomGamma.source = sourceRandomGamma; - return randomGamma; -}(defaultSource); -var beta = function sourceRandomBeta(source) { - var G = gamma.source(source); - function randomBeta(alpha, beta2) { - var X = G(alpha), Y = G(beta2); - return function() { - var x = X(); - return x === 0 ? 0 : x / (x + Y()); - }; - } - randomBeta.source = sourceRandomBeta; - return randomBeta; -}(defaultSource); -var binomial = function sourceRandomBinomial(source) { - var G = geometric.source(source), B = beta.source(source); - function randomBinomial(n, p) { - n = +n; - if ((p = +p) >= 1) - return () => n; - if (p <= 0) - return () => 0; - return function() { - var acc = 0, nn = n, pp = p; - while (nn * pp > 16 && nn * (1 - pp) > 16) { - var i = Math.floor((nn + 1) * pp), y = B(i, nn - i + 1)(); - if (y <= pp) { - acc += i; - nn -= i; - pp = (pp - y) / (1 - y); - } else { - nn = i - 1; - pp /= y; - } - } - var sign = pp < 0.5, pFinal = sign ? pp : 1 - pp, g = G(pFinal); - for (var s = g(), k = 0; s <= nn; ++k) - s += g(); - return acc + (sign ? k : nn - k); - }; - } - randomBinomial.source = sourceRandomBinomial; - return randomBinomial; -}(defaultSource); -var weibull = function sourceRandomWeibull(source) { - function randomWeibull(k, a, b) { - var outerFunc; - if ((k = +k) === 0) { - outerFunc = (x) => -Math.log(x); - } else { - k = 1 / k; - outerFunc = (x) => Math.pow(x, k); - } - a = a == null ? 0 : +a; - b = b == null ? 1 : +b; - return function() { - return a + b * outerFunc(-Math.log1p(-source())); - }; - } - randomWeibull.source = sourceRandomWeibull; - return randomWeibull; -}(defaultSource); -var cauchy = function sourceRandomCauchy(source) { - function randomCauchy(a, b) { - a = a == null ? 0 : +a; - b = b == null ? 1 : +b; - return function() { - return a + b * Math.tan(Math.PI * source()); - }; - } - randomCauchy.source = sourceRandomCauchy; - return randomCauchy; -}(defaultSource); -var logistic = function sourceRandomLogistic(source) { - function randomLogistic(a, b) { - a = a == null ? 0 : +a; - b = b == null ? 1 : +b; - return function() { - var u = source(); - return a + b * Math.log(u / (1 - u)); - }; - } - randomLogistic.source = sourceRandomLogistic; - return randomLogistic; -}(defaultSource); -var poisson = function sourceRandomPoisson(source) { - var G = gamma.source(source), B = binomial.source(source); - function randomPoisson(lambda) { - return function() { - var acc = 0, l = lambda; - while (l > 16) { - var n = Math.floor(0.875 * l), t = G(n)(); - if (t > l) - return acc + B(n - 1, l / t)(); - acc += n; - l -= t; - } - for (var s = -Math.log1p(-source()), k = 0; s <= l; ++k) - s -= Math.log1p(-source()); - return acc + k; - }; - } - randomPoisson.source = sourceRandomPoisson; - return randomPoisson; -}(defaultSource); -const mul = 1664525; -const inc = 1013904223; -const eps = 1 / 4294967296; -function lcg(seed = Math.random()) { - let state = (0 <= seed && seed < 1 ? seed / eps : Math.abs(seed)) | 0; - return () => (state = mul * state + inc | 0, eps * (state >>> 0)); -} -export {bates as randomBates, bernoulli as randomBernoulli, beta as randomBeta, binomial as randomBinomial, cauchy as randomCauchy, exponential as randomExponential, gamma as randomGamma, geometric as randomGeometric, int as randomInt, irwinHall as randomIrwinHall, lcg as randomLcg, logNormal as randomLogNormal, logistic as randomLogistic, normal as randomNormal, pareto as randomPareto, poisson as randomPoisson, uniform as randomUniform, weibull as randomWeibull}; -export default null; diff --git a/web/client/deps/d3/d3-scale-chromatic.js b/web/client/deps/d3/d3-scale-chromatic.js deleted file mode 100644 index 9c4fdc52..00000000 --- a/web/client/deps/d3/d3-scale-chromatic.js +++ /dev/null @@ -1,115 +0,0 @@ -import {interpolateRgbBasis, interpolateCubehelixLong} from "./d3-interpolate.js"; -import {cubehelix as cubehelix$1, rgb} from "./d3-color.js"; -function colors(specifier) { - var n = specifier.length / 6 | 0, colors2 = new Array(n), i = 0; - while (i < n) - colors2[i] = "#" + specifier.slice(i * 6, ++i * 6); - return colors2; -} -var category10 = colors("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"); -var Accent = colors("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"); -var Dark2 = colors("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"); -var Paired = colors("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"); -var Pastel1 = colors("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"); -var Pastel2 = colors("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"); -var Set1 = colors("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"); -var Set2 = colors("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"); -var Set3 = colors("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"); -var Tableau10 = colors("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab"); -var ramp = (scheme2) => interpolateRgbBasis(scheme2[scheme2.length - 1]); -var scheme = new Array(3).concat("d8b365f5f5f55ab4ac", "a6611adfc27d80cdc1018571", "a6611adfc27df5f5f580cdc1018571", "8c510ad8b365f6e8c3c7eae55ab4ac01665e", "8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e", "8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e", "8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e", "5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30", "5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(colors); -var BrBG = ramp(scheme); -var scheme$1 = new Array(3).concat("af8dc3f7f7f77fbf7b", "7b3294c2a5cfa6dba0008837", "7b3294c2a5cff7f7f7a6dba0008837", "762a83af8dc3e7d4e8d9f0d37fbf7b1b7837", "762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837", "762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837", "762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837", "40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b", "40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(colors); -var PRGn = ramp(scheme$1); -var scheme$2 = new Array(3).concat("e9a3c9f7f7f7a1d76a", "d01c8bf1b6dab8e1864dac26", "d01c8bf1b6daf7f7f7b8e1864dac26", "c51b7de9a3c9fde0efe6f5d0a1d76a4d9221", "c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221", "c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221", "c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221", "8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419", "8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(colors); -var PiYG = ramp(scheme$2); -var scheme$3 = new Array(3).concat("998ec3f7f7f7f1a340", "5e3c99b2abd2fdb863e66101", "5e3c99b2abd2f7f7f7fdb863e66101", "542788998ec3d8daebfee0b6f1a340b35806", "542788998ec3d8daebf7f7f7fee0b6f1a340b35806", "5427888073acb2abd2d8daebfee0b6fdb863e08214b35806", "5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806", "2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08", "2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(colors); -var PuOr = ramp(scheme$3); -var scheme$4 = new Array(3).concat("ef8a62f7f7f767a9cf", "ca0020f4a58292c5de0571b0", "ca0020f4a582f7f7f792c5de0571b0", "b2182bef8a62fddbc7d1e5f067a9cf2166ac", "b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac", "b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac", "b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac", "67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061", "67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(colors); -var RdBu = ramp(scheme$4); -var scheme$5 = new Array(3).concat("ef8a62ffffff999999", "ca0020f4a582bababa404040", "ca0020f4a582ffffffbababa404040", "b2182bef8a62fddbc7e0e0e09999994d4d4d", "b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d", "b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d", "b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d", "67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a", "67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(colors); -var RdGy = ramp(scheme$5); -var scheme$6 = new Array(3).concat("fc8d59ffffbf91bfdb", "d7191cfdae61abd9e92c7bb6", "d7191cfdae61ffffbfabd9e92c7bb6", "d73027fc8d59fee090e0f3f891bfdb4575b4", "d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4", "d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4", "d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4", "a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695", "a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(colors); -var RdYlBu = ramp(scheme$6); -var scheme$7 = new Array(3).concat("fc8d59ffffbf91cf60", "d7191cfdae61a6d96a1a9641", "d7191cfdae61ffffbfa6d96a1a9641", "d73027fc8d59fee08bd9ef8b91cf601a9850", "d73027fc8d59fee08bffffbfd9ef8b91cf601a9850", "d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850", "d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850", "a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837", "a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(colors); -var RdYlGn = ramp(scheme$7); -var scheme$8 = new Array(3).concat("fc8d59ffffbf99d594", "d7191cfdae61abdda42b83ba", "d7191cfdae61ffffbfabdda42b83ba", "d53e4ffc8d59fee08be6f59899d5943288bd", "d53e4ffc8d59fee08bffffbfe6f59899d5943288bd", "d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd", "d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd", "9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2", "9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(colors); -var Spectral = ramp(scheme$8); -var scheme$9 = new Array(3).concat("e5f5f999d8c92ca25f", "edf8fbb2e2e266c2a4238b45", "edf8fbb2e2e266c2a42ca25f006d2c", "edf8fbccece699d8c966c2a42ca25f006d2c", "edf8fbccece699d8c966c2a441ae76238b45005824", "f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824", "f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(colors); -var BuGn = ramp(scheme$9); -var scheme$a = new Array(3).concat("e0ecf49ebcda8856a7", "edf8fbb3cde38c96c688419d", "edf8fbb3cde38c96c68856a7810f7c", "edf8fbbfd3e69ebcda8c96c68856a7810f7c", "edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b", "f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b", "f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(colors); -var BuPu = ramp(scheme$a); -var scheme$b = new Array(3).concat("e0f3dba8ddb543a2ca", "f0f9e8bae4bc7bccc42b8cbe", "f0f9e8bae4bc7bccc443a2ca0868ac", "f0f9e8ccebc5a8ddb57bccc443a2ca0868ac", "f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e", "f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e", "f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(colors); -var GnBu = ramp(scheme$b); -var scheme$c = new Array(3).concat("fee8c8fdbb84e34a33", "fef0d9fdcc8afc8d59d7301f", "fef0d9fdcc8afc8d59e34a33b30000", "fef0d9fdd49efdbb84fc8d59e34a33b30000", "fef0d9fdd49efdbb84fc8d59ef6548d7301f990000", "fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000", "fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(colors); -var OrRd = ramp(scheme$c); -var scheme$d = new Array(3).concat("ece2f0a6bddb1c9099", "f6eff7bdc9e167a9cf02818a", "f6eff7bdc9e167a9cf1c9099016c59", "f6eff7d0d1e6a6bddb67a9cf1c9099016c59", "f6eff7d0d1e6a6bddb67a9cf3690c002818a016450", "fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450", "fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(colors); -var PuBuGn = ramp(scheme$d); -var scheme$e = new Array(3).concat("ece7f2a6bddb2b8cbe", "f1eef6bdc9e174a9cf0570b0", "f1eef6bdc9e174a9cf2b8cbe045a8d", "f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d", "f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b", "fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b", "fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(colors); -var PuBu = ramp(scheme$e); -var scheme$f = new Array(3).concat("e7e1efc994c7dd1c77", "f1eef6d7b5d8df65b0ce1256", "f1eef6d7b5d8df65b0dd1c77980043", "f1eef6d4b9dac994c7df65b0dd1c77980043", "f1eef6d4b9dac994c7df65b0e7298ace125691003f", "f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f", "f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(colors); -var PuRd = ramp(scheme$f); -var scheme$g = new Array(3).concat("fde0ddfa9fb5c51b8a", "feebe2fbb4b9f768a1ae017e", "feebe2fbb4b9f768a1c51b8a7a0177", "feebe2fcc5c0fa9fb5f768a1c51b8a7a0177", "feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177", "fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177", "fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(colors); -var RdPu = ramp(scheme$g); -var scheme$h = new Array(3).concat("edf8b17fcdbb2c7fb8", "ffffcca1dab441b6c4225ea8", "ffffcca1dab441b6c42c7fb8253494", "ffffccc7e9b47fcdbb41b6c42c7fb8253494", "ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84", "ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84", "ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(colors); -var YlGnBu = ramp(scheme$h); -var scheme$i = new Array(3).concat("f7fcb9addd8e31a354", "ffffccc2e69978c679238443", "ffffccc2e69978c67931a354006837", "ffffccd9f0a3addd8e78c67931a354006837", "ffffccd9f0a3addd8e78c67941ab5d238443005a32", "ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32", "ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(colors); -var YlGn = ramp(scheme$i); -var scheme$j = new Array(3).concat("fff7bcfec44fd95f0e", "ffffd4fed98efe9929cc4c02", "ffffd4fed98efe9929d95f0e993404", "ffffd4fee391fec44ffe9929d95f0e993404", "ffffd4fee391fec44ffe9929ec7014cc4c028c2d04", "ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04", "ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(colors); -var YlOrBr = ramp(scheme$j); -var scheme$k = new Array(3).concat("ffeda0feb24cf03b20", "ffffb2fecc5cfd8d3ce31a1c", "ffffb2fecc5cfd8d3cf03b20bd0026", "ffffb2fed976feb24cfd8d3cf03b20bd0026", "ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026", "ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026", "ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(colors); -var YlOrRd = ramp(scheme$k); -var scheme$l = new Array(3).concat("deebf79ecae13182bd", "eff3ffbdd7e76baed62171b5", "eff3ffbdd7e76baed63182bd08519c", "eff3ffc6dbef9ecae16baed63182bd08519c", "eff3ffc6dbef9ecae16baed64292c62171b5084594", "f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594", "f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(colors); -var Blues = ramp(scheme$l); -var scheme$m = new Array(3).concat("e5f5e0a1d99b31a354", "edf8e9bae4b374c476238b45", "edf8e9bae4b374c47631a354006d2c", "edf8e9c7e9c0a1d99b74c47631a354006d2c", "edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32", "f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32", "f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(colors); -var Greens = ramp(scheme$m); -var scheme$n = new Array(3).concat("f0f0f0bdbdbd636363", "f7f7f7cccccc969696525252", "f7f7f7cccccc969696636363252525", "f7f7f7d9d9d9bdbdbd969696636363252525", "f7f7f7d9d9d9bdbdbd969696737373525252252525", "fffffff0f0f0d9d9d9bdbdbd969696737373525252252525", "fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(colors); -var Greys = ramp(scheme$n); -var scheme$o = new Array(3).concat("efedf5bcbddc756bb1", "f2f0f7cbc9e29e9ac86a51a3", "f2f0f7cbc9e29e9ac8756bb154278f", "f2f0f7dadaebbcbddc9e9ac8756bb154278f", "f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486", "fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486", "fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(colors); -var Purples = ramp(scheme$o); -var scheme$p = new Array(3).concat("fee0d2fc9272de2d26", "fee5d9fcae91fb6a4acb181d", "fee5d9fcae91fb6a4ade2d26a50f15", "fee5d9fcbba1fc9272fb6a4ade2d26a50f15", "fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d", "fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d", "fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(colors); -var Reds = ramp(scheme$p); -var scheme$q = new Array(3).concat("fee6cefdae6be6550d", "feeddefdbe85fd8d3cd94701", "feeddefdbe85fd8d3ce6550da63603", "feeddefdd0a2fdae6bfd8d3ce6550da63603", "feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04", "fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04", "fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(colors); -var Oranges = ramp(scheme$q); -function cividis(t) { - t = Math.max(0, Math.min(1, t)); - return "rgb(" + Math.max(0, Math.min(255, Math.round(-4.54 - t * (35.34 - t * (2381.73 - t * (6402.7 - t * (7024.72 - t * 2710.57))))))) + ", " + Math.max(0, Math.min(255, Math.round(32.49 + t * (170.73 + t * (52.82 - t * (131.46 - t * (176.58 - t * 67.37))))))) + ", " + Math.max(0, Math.min(255, Math.round(81.24 + t * (442.36 - t * (2482.43 - t * (6167.24 - t * (6614.94 - t * 2475.67))))))) + ")"; -} -var cubehelix = interpolateCubehelixLong(cubehelix$1(300, 0.5, 0), cubehelix$1(-240, 0.5, 1)); -var warm = interpolateCubehelixLong(cubehelix$1(-100, 0.75, 0.35), cubehelix$1(80, 1.5, 0.8)); -var cool = interpolateCubehelixLong(cubehelix$1(260, 0.75, 0.35), cubehelix$1(80, 1.5, 0.8)); -var c = cubehelix$1(); -function rainbow(t) { - if (t < 0 || t > 1) - t -= Math.floor(t); - var ts = Math.abs(t - 0.5); - c.h = 360 * t - 100; - c.s = 1.5 - 1.5 * ts; - c.l = 0.8 - 0.9 * ts; - return c + ""; -} -var c$1 = rgb(), pi_1_3 = Math.PI / 3, pi_2_3 = Math.PI * 2 / 3; -function sinebow(t) { - var x; - t = (0.5 - t) * Math.PI; - c$1.r = 255 * (x = Math.sin(t)) * x; - c$1.g = 255 * (x = Math.sin(t + pi_1_3)) * x; - c$1.b = 255 * (x = Math.sin(t + pi_2_3)) * x; - return c$1 + ""; -} -function turbo(t) { - t = Math.max(0, Math.min(1, t)); - return "rgb(" + Math.max(0, Math.min(255, Math.round(34.61 + t * (1172.33 - t * (10793.56 - t * (33300.12 - t * (38394.49 - t * 14825.05))))))) + ", " + Math.max(0, Math.min(255, Math.round(23.31 + t * (557.33 + t * (1225.33 - t * (3574.96 - t * (1073.77 + t * 707.56))))))) + ", " + Math.max(0, Math.min(255, Math.round(27.2 + t * (3211.1 - t * (15327.97 - t * (27814 - t * (22569.18 - t * 6838.66))))))) + ")"; -} -function ramp$1(range) { - var n = range.length; - return function(t) { - return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))]; - }; -} -var viridis = ramp$1(colors("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")); -var magma = ramp$1(colors("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")); -var inferno = ramp$1(colors("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")); -var plasma = ramp$1(colors("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921")); -export {Blues as interpolateBlues, BrBG as interpolateBrBG, BuGn as interpolateBuGn, BuPu as interpolateBuPu, cividis as interpolateCividis, cool as interpolateCool, cubehelix as interpolateCubehelixDefault, GnBu as interpolateGnBu, Greens as interpolateGreens, Greys as interpolateGreys, inferno as interpolateInferno, magma as interpolateMagma, OrRd as interpolateOrRd, Oranges as interpolateOranges, PRGn as interpolatePRGn, PiYG as interpolatePiYG, plasma as interpolatePlasma, PuBu as interpolatePuBu, PuBuGn as interpolatePuBuGn, PuOr as interpolatePuOr, PuRd as interpolatePuRd, Purples as interpolatePurples, rainbow as interpolateRainbow, RdBu as interpolateRdBu, RdGy as interpolateRdGy, RdPu as interpolateRdPu, RdYlBu as interpolateRdYlBu, RdYlGn as interpolateRdYlGn, Reds as interpolateReds, sinebow as interpolateSinebow, Spectral as interpolateSpectral, turbo as interpolateTurbo, viridis as interpolateViridis, warm as interpolateWarm, YlGn as interpolateYlGn, YlGnBu as interpolateYlGnBu, YlOrBr as interpolateYlOrBr, YlOrRd as interpolateYlOrRd, Accent as schemeAccent, scheme$l as schemeBlues, scheme as schemeBrBG, scheme$9 as schemeBuGn, scheme$a as schemeBuPu, category10 as schemeCategory10, Dark2 as schemeDark2, scheme$b as schemeGnBu, scheme$m as schemeGreens, scheme$n as schemeGreys, scheme$c as schemeOrRd, scheme$q as schemeOranges, scheme$1 as schemePRGn, Paired as schemePaired, Pastel1 as schemePastel1, Pastel2 as schemePastel2, scheme$2 as schemePiYG, scheme$e as schemePuBu, scheme$d as schemePuBuGn, scheme$3 as schemePuOr, scheme$f as schemePuRd, scheme$o as schemePurples, scheme$4 as schemeRdBu, scheme$5 as schemeRdGy, scheme$g as schemeRdPu, scheme$6 as schemeRdYlBu, scheme$7 as schemeRdYlGn, scheme$p as schemeReds, Set1 as schemeSet1, Set2 as schemeSet2, Set3 as schemeSet3, scheme$8 as schemeSpectral, Tableau10 as schemeTableau10, scheme$i as schemeYlGn, scheme$h as schemeYlGnBu, scheme$j as schemeYlOrBr, scheme$k as schemeYlOrRd}; -export default null; diff --git a/web/client/deps/d3/d3-scale.js b/web/client/deps/d3/d3-scale.js deleted file mode 100644 index b4392c73..00000000 --- a/web/client/deps/d3/d3-scale.js +++ /dev/null @@ -1,863 +0,0 @@ -import {InternMap, range, bisect, tickStep, ticks, tickIncrement, ascending, quantileSorted, quantile as quantile$1} from "./d3-array.js"; -import {interpolate, interpolateNumber, interpolateRound, piecewise} from "./d3-interpolate.js"; -import {formatSpecifier, precisionFixed, precisionRound, precisionPrefix, formatPrefix, format} from "./d3-format.js"; -import {timeSecond, timeMinute, timeHour, timeDay, timeWeek, timeMonth, timeYear, timeTickInterval, timeTicks, utcSecond, utcMinute, utcHour, utcDay, utcWeek, utcMonth, utcYear, utcTickInterval, utcTicks} from "./d3-time.js"; -import {timeFormat, utcFormat} from "./d3-time-format.js"; -function initRange(domain, range2) { - switch (arguments.length) { - case 0: - break; - case 1: - this.range(domain); - break; - default: - this.range(range2).domain(domain); - break; - } - return this; -} -function initInterpolator(domain, interpolator) { - switch (arguments.length) { - case 0: - break; - case 1: { - if (typeof domain === "function") - this.interpolator(domain); - else - this.range(domain); - break; - } - default: { - this.domain(domain); - if (typeof interpolator === "function") - this.interpolator(interpolator); - else - this.range(interpolator); - break; - } - } - return this; -} -const implicit = Symbol("implicit"); -function ordinal() { - var index = new InternMap(), domain = [], range2 = [], unknown = implicit; - function scale(d) { - let i = index.get(d); - if (i === void 0) { - if (unknown !== implicit) - return unknown; - index.set(d, i = domain.push(d) - 1); - } - return range2[i % range2.length]; - } - scale.domain = function(_) { - if (!arguments.length) - return domain.slice(); - domain = [], index = new InternMap(); - for (const value of _) { - if (index.has(value)) - continue; - index.set(value, domain.push(value) - 1); - } - return scale; - }; - scale.range = function(_) { - return arguments.length ? (range2 = Array.from(_), scale) : range2.slice(); - }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - scale.copy = function() { - return ordinal(domain, range2).unknown(unknown); - }; - initRange.apply(scale, arguments); - return scale; -} -function band() { - var scale = ordinal().unknown(void 0), domain = scale.domain, ordinalRange = scale.range, r0 = 0, r1 = 1, step, bandwidth, round = false, paddingInner = 0, paddingOuter = 0, align = 0.5; - delete scale.unknown; - function rescale() { - var n = domain().length, reverse = r1 < r0, start = reverse ? r1 : r0, stop = reverse ? r0 : r1; - step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2); - if (round) - step = Math.floor(step); - start += (stop - start - step * (n - paddingInner)) * align; - bandwidth = step * (1 - paddingInner); - if (round) - start = Math.round(start), bandwidth = Math.round(bandwidth); - var values = range(n).map(function(i) { - return start + step * i; - }); - return ordinalRange(reverse ? values.reverse() : values); - } - scale.domain = function(_) { - return arguments.length ? (domain(_), rescale()) : domain(); - }; - scale.range = function(_) { - return arguments.length ? ([r0, r1] = _, r0 = +r0, r1 = +r1, rescale()) : [r0, r1]; - }; - scale.rangeRound = function(_) { - return [r0, r1] = _, r0 = +r0, r1 = +r1, round = true, rescale(); - }; - scale.bandwidth = function() { - return bandwidth; - }; - scale.step = function() { - return step; - }; - scale.round = function(_) { - return arguments.length ? (round = !!_, rescale()) : round; - }; - scale.padding = function(_) { - return arguments.length ? (paddingInner = Math.min(1, paddingOuter = +_), rescale()) : paddingInner; - }; - scale.paddingInner = function(_) { - return arguments.length ? (paddingInner = Math.min(1, _), rescale()) : paddingInner; - }; - scale.paddingOuter = function(_) { - return arguments.length ? (paddingOuter = +_, rescale()) : paddingOuter; - }; - scale.align = function(_) { - return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align; - }; - scale.copy = function() { - return band(domain(), [r0, r1]).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align); - }; - return initRange.apply(rescale(), arguments); -} -function pointish(scale) { - var copy2 = scale.copy; - scale.padding = scale.paddingOuter; - delete scale.paddingInner; - delete scale.paddingOuter; - scale.copy = function() { - return pointish(copy2()); - }; - return scale; -} -function point() { - return pointish(band.apply(null, arguments).paddingInner(1)); -} -function constants(x) { - return function() { - return x; - }; -} -function number(x) { - return +x; -} -var unit = [0, 1]; -function identity(x) { - return x; -} -function normalize(a, b) { - return (b -= a = +a) ? function(x) { - return (x - a) / b; - } : constants(isNaN(b) ? NaN : 0.5); -} -function clamper(a, b) { - var t; - if (a > b) - t = a, a = b, b = t; - return function(x) { - return Math.max(a, Math.min(b, x)); - }; -} -function bimap(domain, range2, interpolate2) { - var d0 = domain[0], d1 = domain[1], r0 = range2[0], r1 = range2[1]; - if (d1 < d0) - d0 = normalize(d1, d0), r0 = interpolate2(r1, r0); - else - d0 = normalize(d0, d1), r0 = interpolate2(r0, r1); - return function(x) { - return r0(d0(x)); - }; -} -function polymap(domain, range2, interpolate2) { - var j = Math.min(domain.length, range2.length) - 1, d = new Array(j), r = new Array(j), i = -1; - if (domain[j] < domain[0]) { - domain = domain.slice().reverse(); - range2 = range2.slice().reverse(); - } - while (++i < j) { - d[i] = normalize(domain[i], domain[i + 1]); - r[i] = interpolate2(range2[i], range2[i + 1]); - } - return function(x) { - var i2 = bisect(domain, x, 1, j) - 1; - return r[i2](d[i2](x)); - }; -} -function copy(source, target) { - return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown()); -} -function transformer() { - var domain = unit, range2 = unit, interpolate$1 = interpolate, transform, untransform, unknown, clamp = identity, piecewise2, output, input; - function rescale() { - var n = Math.min(domain.length, range2.length); - if (clamp !== identity) - clamp = clamper(domain[0], domain[n - 1]); - piecewise2 = n > 2 ? polymap : bimap; - output = input = null; - return scale; - } - function scale(x) { - return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise2(domain.map(transform), range2, interpolate$1)))(transform(clamp(x))); - } - scale.invert = function(y) { - return clamp(untransform((input || (input = piecewise2(range2, domain.map(transform), interpolateNumber)))(y))); - }; - scale.domain = function(_) { - return arguments.length ? (domain = Array.from(_, number), rescale()) : domain.slice(); - }; - scale.range = function(_) { - return arguments.length ? (range2 = Array.from(_), rescale()) : range2.slice(); - }; - scale.rangeRound = function(_) { - return range2 = Array.from(_), interpolate$1 = interpolateRound, rescale(); - }; - scale.clamp = function(_) { - return arguments.length ? (clamp = _ ? true : identity, rescale()) : clamp !== identity; - }; - scale.interpolate = function(_) { - return arguments.length ? (interpolate$1 = _, rescale()) : interpolate$1; - }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - return function(t, u) { - transform = t, untransform = u; - return rescale(); - }; -} -function continuous() { - return transformer()(identity, identity); -} -function tickFormat(start, stop, count, specifier) { - var step = tickStep(start, stop, count), precision; - specifier = formatSpecifier(specifier == null ? ",f" : specifier); - switch (specifier.type) { - case "s": { - var value = Math.max(Math.abs(start), Math.abs(stop)); - if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) - specifier.precision = precision; - return formatPrefix(specifier, value); - } - case "": - case "e": - case "g": - case "p": - case "r": { - if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) - specifier.precision = precision - (specifier.type === "e"); - break; - } - case "f": - case "%": { - if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) - specifier.precision = precision - (specifier.type === "%") * 2; - break; - } - } - return format(specifier); -} -function linearish(scale) { - var domain = scale.domain; - scale.ticks = function(count) { - var d = domain(); - return ticks(d[0], d[d.length - 1], count == null ? 10 : count); - }; - scale.tickFormat = function(count, specifier) { - var d = domain(); - return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier); - }; - scale.nice = function(count) { - if (count == null) - count = 10; - var d = domain(); - var i0 = 0; - var i1 = d.length - 1; - var start = d[i0]; - var stop = d[i1]; - var prestep; - var step; - var maxIter = 10; - if (stop < start) { - step = start, start = stop, stop = step; - step = i0, i0 = i1, i1 = step; - } - while (maxIter-- > 0) { - step = tickIncrement(start, stop, count); - if (step === prestep) { - d[i0] = start; - d[i1] = stop; - return domain(d); - } else if (step > 0) { - start = Math.floor(start / step) * step; - stop = Math.ceil(stop / step) * step; - } else if (step < 0) { - start = Math.ceil(start * step) / step; - stop = Math.floor(stop * step) / step; - } else { - break; - } - prestep = step; - } - return scale; - }; - return scale; -} -function linear() { - var scale = continuous(); - scale.copy = function() { - return copy(scale, linear()); - }; - initRange.apply(scale, arguments); - return linearish(scale); -} -function identity$1(domain) { - var unknown; - function scale(x) { - return x == null || isNaN(x = +x) ? unknown : x; - } - scale.invert = scale; - scale.domain = scale.range = function(_) { - return arguments.length ? (domain = Array.from(_, number), scale) : domain.slice(); - }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - scale.copy = function() { - return identity$1(domain).unknown(unknown); - }; - domain = arguments.length ? Array.from(domain, number) : [0, 1]; - return linearish(scale); -} -function nice(domain, interval) { - domain = domain.slice(); - var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], t; - if (x1 < x0) { - t = i0, i0 = i1, i1 = t; - t = x0, x0 = x1, x1 = t; - } - domain[i0] = interval.floor(x0); - domain[i1] = interval.ceil(x1); - return domain; -} -function transformLog(x) { - return Math.log(x); -} -function transformExp(x) { - return Math.exp(x); -} -function transformLogn(x) { - return -Math.log(-x); -} -function transformExpn(x) { - return -Math.exp(-x); -} -function pow10(x) { - return isFinite(x) ? +("1e" + x) : x < 0 ? 0 : x; -} -function powp(base) { - return base === 10 ? pow10 : base === Math.E ? Math.exp : (x) => Math.pow(base, x); -} -function logp(base) { - return base === Math.E ? Math.log : base === 10 && Math.log10 || base === 2 && Math.log2 || (base = Math.log(base), (x) => Math.log(x) / base); -} -function reflect(f) { - return (x, k) => -f(-x, k); -} -function loggish(transform) { - const scale = transform(transformLog, transformExp); - const domain = scale.domain; - let base = 10; - let logs; - let pows; - function rescale() { - logs = logp(base), pows = powp(base); - if (domain()[0] < 0) { - logs = reflect(logs), pows = reflect(pows); - transform(transformLogn, transformExpn); - } else { - transform(transformLog, transformExp); - } - return scale; - } - scale.base = function(_) { - return arguments.length ? (base = +_, rescale()) : base; - }; - scale.domain = function(_) { - return arguments.length ? (domain(_), rescale()) : domain(); - }; - scale.ticks = (count) => { - const d = domain(); - let u = d[0]; - let v = d[d.length - 1]; - const r = v < u; - if (r) - [u, v] = [v, u]; - let i = logs(u); - let j = logs(v); - let k; - let t; - const n = count == null ? 10 : +count; - let z = []; - if (!(base % 1) && j - i < n) { - i = Math.floor(i), j = Math.ceil(j); - if (u > 0) - for (; i <= j; ++i) { - for (k = 1; k < base; ++k) { - t = i < 0 ? k / pows(-i) : k * pows(i); - if (t < u) - continue; - if (t > v) - break; - z.push(t); - } - } - else - for (; i <= j; ++i) { - for (k = base - 1; k >= 1; --k) { - t = i > 0 ? k / pows(-i) : k * pows(i); - if (t < u) - continue; - if (t > v) - break; - z.push(t); - } - } - if (z.length * 2 < n) - z = ticks(u, v, n); - } else { - z = ticks(i, j, Math.min(j - i, n)).map(pows); - } - return r ? z.reverse() : z; - }; - scale.tickFormat = (count, specifier) => { - if (count == null) - count = 10; - if (specifier == null) - specifier = base === 10 ? "s" : ","; - if (typeof specifier !== "function") { - if (!(base % 1) && (specifier = formatSpecifier(specifier)).precision == null) - specifier.trim = true; - specifier = format(specifier); - } - if (count === Infinity) - return specifier; - const k = Math.max(1, base * count / scale.ticks().length); - return (d) => { - let i = d / pows(Math.round(logs(d))); - if (i * base < base - 0.5) - i *= base; - return i <= k ? specifier(d) : ""; - }; - }; - scale.nice = () => { - return domain(nice(domain(), { - floor: (x) => pows(Math.floor(logs(x))), - ceil: (x) => pows(Math.ceil(logs(x))) - })); - }; - return scale; -} -function log() { - const scale = loggish(transformer()).domain([1, 10]); - scale.copy = () => copy(scale, log()).base(scale.base()); - initRange.apply(scale, arguments); - return scale; -} -function transformSymlog(c) { - return function(x) { - return Math.sign(x) * Math.log1p(Math.abs(x / c)); - }; -} -function transformSymexp(c) { - return function(x) { - return Math.sign(x) * Math.expm1(Math.abs(x)) * c; - }; -} -function symlogish(transform) { - var c = 1, scale = transform(transformSymlog(c), transformSymexp(c)); - scale.constant = function(_) { - return arguments.length ? transform(transformSymlog(c = +_), transformSymexp(c)) : c; - }; - return linearish(scale); -} -function symlog() { - var scale = symlogish(transformer()); - scale.copy = function() { - return copy(scale, symlog()).constant(scale.constant()); - }; - return initRange.apply(scale, arguments); -} -function transformPow(exponent) { - return function(x) { - return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent); - }; -} -function transformSqrt(x) { - return x < 0 ? -Math.sqrt(-x) : Math.sqrt(x); -} -function transformSquare(x) { - return x < 0 ? -x * x : x * x; -} -function powish(transform) { - var scale = transform(identity, identity), exponent = 1; - function rescale() { - return exponent === 1 ? transform(identity, identity) : exponent === 0.5 ? transform(transformSqrt, transformSquare) : transform(transformPow(exponent), transformPow(1 / exponent)); - } - scale.exponent = function(_) { - return arguments.length ? (exponent = +_, rescale()) : exponent; - }; - return linearish(scale); -} -function pow() { - var scale = powish(transformer()); - scale.copy = function() { - return copy(scale, pow()).exponent(scale.exponent()); - }; - initRange.apply(scale, arguments); - return scale; -} -function sqrt() { - return pow.apply(null, arguments).exponent(0.5); -} -function square(x) { - return Math.sign(x) * x * x; -} -function unsquare(x) { - return Math.sign(x) * Math.sqrt(Math.abs(x)); -} -function radial() { - var squared = continuous(), range2 = [0, 1], round = false, unknown; - function scale(x) { - var y = unsquare(squared(x)); - return isNaN(y) ? unknown : round ? Math.round(y) : y; - } - scale.invert = function(y) { - return squared.invert(square(y)); - }; - scale.domain = function(_) { - return arguments.length ? (squared.domain(_), scale) : squared.domain(); - }; - scale.range = function(_) { - return arguments.length ? (squared.range((range2 = Array.from(_, number)).map(square)), scale) : range2.slice(); - }; - scale.rangeRound = function(_) { - return scale.range(_).round(true); - }; - scale.round = function(_) { - return arguments.length ? (round = !!_, scale) : round; - }; - scale.clamp = function(_) { - return arguments.length ? (squared.clamp(_), scale) : squared.clamp(); - }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - scale.copy = function() { - return radial(squared.domain(), range2).round(round).clamp(squared.clamp()).unknown(unknown); - }; - initRange.apply(scale, arguments); - return linearish(scale); -} -function quantile() { - var domain = [], range2 = [], thresholds = [], unknown; - function rescale() { - var i = 0, n = Math.max(1, range2.length); - thresholds = new Array(n - 1); - while (++i < n) - thresholds[i - 1] = quantileSorted(domain, i / n); - return scale; - } - function scale(x) { - return x == null || isNaN(x = +x) ? unknown : range2[bisect(thresholds, x)]; - } - scale.invertExtent = function(y) { - var i = range2.indexOf(y); - return i < 0 ? [NaN, NaN] : [ - i > 0 ? thresholds[i - 1] : domain[0], - i < thresholds.length ? thresholds[i] : domain[domain.length - 1] - ]; - }; - scale.domain = function(_) { - if (!arguments.length) - return domain.slice(); - domain = []; - for (let d of _) - if (d != null && !isNaN(d = +d)) - domain.push(d); - domain.sort(ascending); - return rescale(); - }; - scale.range = function(_) { - return arguments.length ? (range2 = Array.from(_), rescale()) : range2.slice(); - }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - scale.quantiles = function() { - return thresholds.slice(); - }; - scale.copy = function() { - return quantile().domain(domain).range(range2).unknown(unknown); - }; - return initRange.apply(scale, arguments); -} -function quantize() { - var x0 = 0, x1 = 1, n = 1, domain = [0.5], range2 = [0, 1], unknown; - function scale(x) { - return x != null && x <= x ? range2[bisect(domain, x, 0, n)] : unknown; - } - function rescale() { - var i = -1; - domain = new Array(n); - while (++i < n) - domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1); - return scale; - } - scale.domain = function(_) { - return arguments.length ? ([x0, x1] = _, x0 = +x0, x1 = +x1, rescale()) : [x0, x1]; - }; - scale.range = function(_) { - return arguments.length ? (n = (range2 = Array.from(_)).length - 1, rescale()) : range2.slice(); - }; - scale.invertExtent = function(y) { - var i = range2.indexOf(y); - return i < 0 ? [NaN, NaN] : i < 1 ? [x0, domain[0]] : i >= n ? [domain[n - 1], x1] : [domain[i - 1], domain[i]]; - }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : scale; - }; - scale.thresholds = function() { - return domain.slice(); - }; - scale.copy = function() { - return quantize().domain([x0, x1]).range(range2).unknown(unknown); - }; - return initRange.apply(linearish(scale), arguments); -} -function threshold() { - var domain = [0.5], range2 = [0, 1], unknown, n = 1; - function scale(x) { - return x != null && x <= x ? range2[bisect(domain, x, 0, n)] : unknown; - } - scale.domain = function(_) { - return arguments.length ? (domain = Array.from(_), n = Math.min(domain.length, range2.length - 1), scale) : domain.slice(); - }; - scale.range = function(_) { - return arguments.length ? (range2 = Array.from(_), n = Math.min(domain.length, range2.length - 1), scale) : range2.slice(); - }; - scale.invertExtent = function(y) { - var i = range2.indexOf(y); - return [domain[i - 1], domain[i]]; - }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - scale.copy = function() { - return threshold().domain(domain).range(range2).unknown(unknown); - }; - return initRange.apply(scale, arguments); -} -function date(t) { - return new Date(t); -} -function number$1(t) { - return t instanceof Date ? +t : +new Date(+t); -} -function calendar(ticks2, tickInterval, year, month, week, day, hour, minute, second, format2) { - var scale = continuous(), invert = scale.invert, domain = scale.domain; - var formatMillisecond = format2(".%L"), formatSecond = format2(":%S"), formatMinute = format2("%I:%M"), formatHour = format2("%I %p"), formatDay = format2("%a %d"), formatWeek = format2("%b %d"), formatMonth = format2("%B"), formatYear = format2("%Y"); - function tickFormat2(date2) { - return (second(date2) < date2 ? formatMillisecond : minute(date2) < date2 ? formatSecond : hour(date2) < date2 ? formatMinute : day(date2) < date2 ? formatHour : month(date2) < date2 ? week(date2) < date2 ? formatDay : formatWeek : year(date2) < date2 ? formatMonth : formatYear)(date2); - } - scale.invert = function(y) { - return new Date(invert(y)); - }; - scale.domain = function(_) { - return arguments.length ? domain(Array.from(_, number$1)) : domain().map(date); - }; - scale.ticks = function(interval) { - var d = domain(); - return ticks2(d[0], d[d.length - 1], interval == null ? 10 : interval); - }; - scale.tickFormat = function(count, specifier) { - return specifier == null ? tickFormat2 : format2(specifier); - }; - scale.nice = function(interval) { - var d = domain(); - if (!interval || typeof interval.range !== "function") - interval = tickInterval(d[0], d[d.length - 1], interval == null ? 10 : interval); - return interval ? domain(nice(d, interval)) : scale; - }; - scale.copy = function() { - return copy(scale, calendar(ticks2, tickInterval, year, month, week, day, hour, minute, second, format2)); - }; - return scale; -} -function time() { - return initRange.apply(calendar(timeTicks, timeTickInterval, timeYear, timeMonth, timeWeek, timeDay, timeHour, timeMinute, timeSecond, timeFormat).domain([new Date(2e3, 0, 1), new Date(2e3, 0, 2)]), arguments); -} -function utcTime() { - return initRange.apply(calendar(utcTicks, utcTickInterval, utcYear, utcMonth, utcWeek, utcDay, utcHour, utcMinute, utcSecond, utcFormat).domain([Date.UTC(2e3, 0, 1), Date.UTC(2e3, 0, 2)]), arguments); -} -function transformer$1() { - var x0 = 0, x1 = 1, t0, t1, k10, transform, interpolator = identity, clamp = false, unknown; - function scale(x) { - return x == null || isNaN(x = +x) ? unknown : interpolator(k10 === 0 ? 0.5 : (x = (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x)); - } - scale.domain = function(_) { - return arguments.length ? ([x0, x1] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0), scale) : [x0, x1]; - }; - scale.clamp = function(_) { - return arguments.length ? (clamp = !!_, scale) : clamp; - }; - scale.interpolator = function(_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - function range2(interpolate2) { - return function(_) { - var r0, r1; - return arguments.length ? ([r0, r1] = _, interpolator = interpolate2(r0, r1), scale) : [interpolator(0), interpolator(1)]; - }; - } - scale.range = range2(interpolate); - scale.rangeRound = range2(interpolateRound); - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - return function(t) { - transform = t, t0 = t(x0), t1 = t(x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0); - return scale; - }; -} -function copy$1(source, target) { - return target.domain(source.domain()).interpolator(source.interpolator()).clamp(source.clamp()).unknown(source.unknown()); -} -function sequential() { - var scale = linearish(transformer$1()(identity)); - scale.copy = function() { - return copy$1(scale, sequential()); - }; - return initInterpolator.apply(scale, arguments); -} -function sequentialLog() { - var scale = loggish(transformer$1()).domain([1, 10]); - scale.copy = function() { - return copy$1(scale, sequentialLog()).base(scale.base()); - }; - return initInterpolator.apply(scale, arguments); -} -function sequentialSymlog() { - var scale = symlogish(transformer$1()); - scale.copy = function() { - return copy$1(scale, sequentialSymlog()).constant(scale.constant()); - }; - return initInterpolator.apply(scale, arguments); -} -function sequentialPow() { - var scale = powish(transformer$1()); - scale.copy = function() { - return copy$1(scale, sequentialPow()).exponent(scale.exponent()); - }; - return initInterpolator.apply(scale, arguments); -} -function sequentialSqrt() { - return sequentialPow.apply(null, arguments).exponent(0.5); -} -function sequentialQuantile() { - var domain = [], interpolator = identity; - function scale(x) { - if (x != null && !isNaN(x = +x)) - return interpolator((bisect(domain, x, 1) - 1) / (domain.length - 1)); - } - scale.domain = function(_) { - if (!arguments.length) - return domain.slice(); - domain = []; - for (let d of _) - if (d != null && !isNaN(d = +d)) - domain.push(d); - domain.sort(ascending); - return scale; - }; - scale.interpolator = function(_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - scale.range = function() { - return domain.map((d, i) => interpolator(i / (domain.length - 1))); - }; - scale.quantiles = function(n) { - return Array.from({length: n + 1}, (_, i) => quantile$1(domain, i / n)); - }; - scale.copy = function() { - return sequentialQuantile(interpolator).domain(domain); - }; - return initInterpolator.apply(scale, arguments); -} -function transformer$2() { - var x0 = 0, x1 = 0.5, x2 = 1, s = 1, t0, t1, t2, k10, k21, interpolator = identity, transform, clamp = false, unknown; - function scale(x) { - return isNaN(x = +x) ? unknown : (x = 0.5 + ((x = +transform(x)) - t1) * (s * x < s * t1 ? k10 : k21), interpolator(clamp ? Math.max(0, Math.min(1, x)) : x)); - } - scale.domain = function(_) { - return arguments.length ? ([x0, x1, x2] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), t2 = transform(x2 = +x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1, scale) : [x0, x1, x2]; - }; - scale.clamp = function(_) { - return arguments.length ? (clamp = !!_, scale) : clamp; - }; - scale.interpolator = function(_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - function range2(interpolate2) { - return function(_) { - var r0, r1, r2; - return arguments.length ? ([r0, r1, r2] = _, interpolator = piecewise(interpolate2, [r0, r1, r2]), scale) : [interpolator(0), interpolator(0.5), interpolator(1)]; - }; - } - scale.range = range2(interpolate); - scale.rangeRound = range2(interpolateRound); - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - return function(t) { - transform = t, t0 = t(x0), t1 = t(x1), t2 = t(x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1; - return scale; - }; -} -function diverging() { - var scale = linearish(transformer$2()(identity)); - scale.copy = function() { - return copy$1(scale, diverging()); - }; - return initInterpolator.apply(scale, arguments); -} -function divergingLog() { - var scale = loggish(transformer$2()).domain([0.1, 1, 10]); - scale.copy = function() { - return copy$1(scale, divergingLog()).base(scale.base()); - }; - return initInterpolator.apply(scale, arguments); -} -function divergingSymlog() { - var scale = symlogish(transformer$2()); - scale.copy = function() { - return copy$1(scale, divergingSymlog()).constant(scale.constant()); - }; - return initInterpolator.apply(scale, arguments); -} -function divergingPow() { - var scale = powish(transformer$2()); - scale.copy = function() { - return copy$1(scale, divergingPow()).exponent(scale.exponent()); - }; - return initInterpolator.apply(scale, arguments); -} -function divergingSqrt() { - return divergingPow.apply(null, arguments).exponent(0.5); -} -export {band as scaleBand, diverging as scaleDiverging, divergingLog as scaleDivergingLog, divergingPow as scaleDivergingPow, divergingSqrt as scaleDivergingSqrt, divergingSymlog as scaleDivergingSymlog, identity$1 as scaleIdentity, implicit as scaleImplicit, linear as scaleLinear, log as scaleLog, ordinal as scaleOrdinal, point as scalePoint, pow as scalePow, quantile as scaleQuantile, quantize as scaleQuantize, radial as scaleRadial, sequential as scaleSequential, sequentialLog as scaleSequentialLog, sequentialPow as scaleSequentialPow, sequentialQuantile as scaleSequentialQuantile, sequentialSqrt as scaleSequentialSqrt, sequentialSymlog as scaleSequentialSymlog, sqrt as scaleSqrt, symlog as scaleSymlog, threshold as scaleThreshold, time as scaleTime, utcTime as scaleUtc, tickFormat}; -export default null; diff --git a/web/client/deps/d3/d3-selection.js b/web/client/deps/d3/d3-selection.js deleted file mode 100644 index d88a749d..00000000 --- a/web/client/deps/d3/d3-selection.js +++ /dev/null @@ -1,809 +0,0 @@ -var xhtml = "http://www.w3.org/1999/xhtml"; -var namespaces = { - svg: "http://www.w3.org/2000/svg", - xhtml, - xlink: "http://www.w3.org/1999/xlink", - xml: "http://www.w3.org/XML/1998/namespace", - xmlns: "http://www.w3.org/2000/xmlns/" -}; -function namespace(name) { - var prefix = name += "", i = prefix.indexOf(":"); - if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns") - name = name.slice(i + 1); - return namespaces.hasOwnProperty(prefix) ? {space: namespaces[prefix], local: name} : name; -} -function creatorInherit(name) { - return function() { - var document2 = this.ownerDocument, uri = this.namespaceURI; - return uri === xhtml && document2.documentElement.namespaceURI === xhtml ? document2.createElement(name) : document2.createElementNS(uri, name); - }; -} -function creatorFixed(fullname) { - return function() { - return this.ownerDocument.createElementNS(fullname.space, fullname.local); - }; -} -function creator(name) { - var fullname = namespace(name); - return (fullname.local ? creatorFixed : creatorInherit)(fullname); -} -function none() { -} -function selector(selector2) { - return selector2 == null ? none : function() { - return this.querySelector(selector2); - }; -} -function selection_select(select2) { - if (typeof select2 !== "function") - select2 = selector(select2); - for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) { - for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) { - if ((node = group[i]) && (subnode = select2.call(node, node.__data__, i, group))) { - if ("__data__" in node) - subnode.__data__ = node.__data__; - subgroup[i] = subnode; - } - } - } - return new Selection(subgroups, this._parents); -} -function array(x) { - return x == null ? [] : Array.isArray(x) ? x : Array.from(x); -} -function empty() { - return []; -} -function selectorAll(selector2) { - return selector2 == null ? empty : function() { - return this.querySelectorAll(selector2); - }; -} -function arrayAll(select2) { - return function() { - return array(select2.apply(this, arguments)); - }; -} -function selection_selectAll(select2) { - if (typeof select2 === "function") - select2 = arrayAll(select2); - else - select2 = selectorAll(select2); - for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) { - for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) { - if (node = group[i]) { - subgroups.push(select2.call(node, node.__data__, i, group)); - parents.push(node); - } - } - } - return new Selection(subgroups, parents); -} -function matcher(selector2) { - return function() { - return this.matches(selector2); - }; -} -function childMatcher(selector2) { - return function(node) { - return node.matches(selector2); - }; -} -var find = Array.prototype.find; -function childFind(match) { - return function() { - return find.call(this.children, match); - }; -} -function childFirst() { - return this.firstElementChild; -} -function selection_selectChild(match) { - return this.select(match == null ? childFirst : childFind(typeof match === "function" ? match : childMatcher(match))); -} -var filter = Array.prototype.filter; -function children() { - return Array.from(this.children); -} -function childrenFilter(match) { - return function() { - return filter.call(this.children, match); - }; -} -function selection_selectChildren(match) { - return this.selectAll(match == null ? children : childrenFilter(typeof match === "function" ? match : childMatcher(match))); -} -function selection_filter(match) { - if (typeof match !== "function") - match = matcher(match); - for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) { - for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) { - if ((node = group[i]) && match.call(node, node.__data__, i, group)) { - subgroup.push(node); - } - } - } - return new Selection(subgroups, this._parents); -} -function sparse(update) { - return new Array(update.length); -} -function selection_enter() { - return new Selection(this._enter || this._groups.map(sparse), this._parents); -} -function EnterNode(parent, datum2) { - this.ownerDocument = parent.ownerDocument; - this.namespaceURI = parent.namespaceURI; - this._next = null; - this._parent = parent; - this.__data__ = datum2; -} -EnterNode.prototype = { - constructor: EnterNode, - appendChild: function(child) { - return this._parent.insertBefore(child, this._next); - }, - insertBefore: function(child, next) { - return this._parent.insertBefore(child, next); - }, - querySelector: function(selector2) { - return this._parent.querySelector(selector2); - }, - querySelectorAll: function(selector2) { - return this._parent.querySelectorAll(selector2); - } -}; -function constant(x) { - return function() { - return x; - }; -} -function bindIndex(parent, group, enter, update, exit, data) { - var i = 0, node, groupLength = group.length, dataLength = data.length; - for (; i < dataLength; ++i) { - if (node = group[i]) { - node.__data__ = data[i]; - update[i] = node; - } else { - enter[i] = new EnterNode(parent, data[i]); - } - } - for (; i < groupLength; ++i) { - if (node = group[i]) { - exit[i] = node; - } - } -} -function bindKey(parent, group, enter, update, exit, data, key) { - var i, node, nodeByKeyValue = new Map(), groupLength = group.length, dataLength = data.length, keyValues = new Array(groupLength), keyValue; - for (i = 0; i < groupLength; ++i) { - if (node = group[i]) { - keyValues[i] = keyValue = key.call(node, node.__data__, i, group) + ""; - if (nodeByKeyValue.has(keyValue)) { - exit[i] = node; - } else { - nodeByKeyValue.set(keyValue, node); - } - } - } - for (i = 0; i < dataLength; ++i) { - keyValue = key.call(parent, data[i], i, data) + ""; - if (node = nodeByKeyValue.get(keyValue)) { - update[i] = node; - node.__data__ = data[i]; - nodeByKeyValue.delete(keyValue); - } else { - enter[i] = new EnterNode(parent, data[i]); - } - } - for (i = 0; i < groupLength; ++i) { - if ((node = group[i]) && nodeByKeyValue.get(keyValues[i]) === node) { - exit[i] = node; - } - } -} -function datum(node) { - return node.__data__; -} -function selection_data(value, key) { - if (!arguments.length) - return Array.from(this, datum); - var bind = key ? bindKey : bindIndex, parents = this._parents, groups = this._groups; - if (typeof value !== "function") - value = constant(value); - for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) { - var parent = parents[j], group = groups[j], groupLength = group.length, data = arraylike(value.call(parent, parent && parent.__data__, j, parents)), dataLength = data.length, enterGroup = enter[j] = new Array(dataLength), updateGroup = update[j] = new Array(dataLength), exitGroup = exit[j] = new Array(groupLength); - bind(parent, group, enterGroup, updateGroup, exitGroup, data, key); - for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) { - if (previous = enterGroup[i0]) { - if (i0 >= i1) - i1 = i0 + 1; - while (!(next = updateGroup[i1]) && ++i1 < dataLength) - ; - previous._next = next || null; - } - } - } - update = new Selection(update, parents); - update._enter = enter; - update._exit = exit; - return update; -} -function arraylike(data) { - return typeof data === "object" && "length" in data ? data : Array.from(data); -} -function selection_exit() { - return new Selection(this._exit || this._groups.map(sparse), this._parents); -} -function selection_join(onenter, onupdate, onexit) { - var enter = this.enter(), update = this, exit = this.exit(); - if (typeof onenter === "function") { - enter = onenter(enter); - if (enter) - enter = enter.selection(); - } else { - enter = enter.append(onenter + ""); - } - if (onupdate != null) { - update = onupdate(update); - if (update) - update = update.selection(); - } - if (onexit == null) - exit.remove(); - else - onexit(exit); - return enter && update ? enter.merge(update).order() : update; -} -function selection_merge(context) { - var selection2 = context.selection ? context.selection() : context; - for (var groups0 = this._groups, groups1 = selection2._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) { - for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) { - if (node = group0[i] || group1[i]) { - merge[i] = node; - } - } - } - for (; j < m0; ++j) { - merges[j] = groups0[j]; - } - return new Selection(merges, this._parents); -} -function selection_order() { - for (var groups = this._groups, j = -1, m = groups.length; ++j < m; ) { - for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0; ) { - if (node = group[i]) { - if (next && node.compareDocumentPosition(next) ^ 4) - next.parentNode.insertBefore(node, next); - next = node; - } - } - } - return this; -} -function selection_sort(compare) { - if (!compare) - compare = ascending; - function compareNode(a, b) { - return a && b ? compare(a.__data__, b.__data__) : !a - !b; - } - for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) { - for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) { - if (node = group[i]) { - sortgroup[i] = node; - } - } - sortgroup.sort(compareNode); - } - return new Selection(sortgroups, this._parents).order(); -} -function ascending(a, b) { - return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; -} -function selection_call() { - var callback = arguments[0]; - arguments[0] = this; - callback.apply(null, arguments); - return this; -} -function selection_nodes() { - return Array.from(this); -} -function selection_node() { - for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) { - for (var group = groups[j], i = 0, n = group.length; i < n; ++i) { - var node = group[i]; - if (node) - return node; - } - } - return null; -} -function selection_size() { - let size = 0; - for (const node of this) - ++size; - return size; -} -function selection_empty() { - return !this.node(); -} -function selection_each(callback) { - for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) { - for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) { - if (node = group[i]) - callback.call(node, node.__data__, i, group); - } - } - return this; -} -function attrRemove(name) { - return function() { - this.removeAttribute(name); - }; -} -function attrRemoveNS(fullname) { - return function() { - this.removeAttributeNS(fullname.space, fullname.local); - }; -} -function attrConstant(name, value) { - return function() { - this.setAttribute(name, value); - }; -} -function attrConstantNS(fullname, value) { - return function() { - this.setAttributeNS(fullname.space, fullname.local, value); - }; -} -function attrFunction(name, value) { - return function() { - var v = value.apply(this, arguments); - if (v == null) - this.removeAttribute(name); - else - this.setAttribute(name, v); - }; -} -function attrFunctionNS(fullname, value) { - return function() { - var v = value.apply(this, arguments); - if (v == null) - this.removeAttributeNS(fullname.space, fullname.local); - else - this.setAttributeNS(fullname.space, fullname.local, v); - }; -} -function selection_attr(name, value) { - var fullname = namespace(name); - if (arguments.length < 2) { - var node = this.node(); - return fullname.local ? node.getAttributeNS(fullname.space, fullname.local) : node.getAttribute(fullname); - } - return this.each((value == null ? fullname.local ? attrRemoveNS : attrRemove : typeof value === "function" ? fullname.local ? attrFunctionNS : attrFunction : fullname.local ? attrConstantNS : attrConstant)(fullname, value)); -} -function defaultView(node) { - return node.ownerDocument && node.ownerDocument.defaultView || node.document && node || node.defaultView; -} -function styleRemove(name) { - return function() { - this.style.removeProperty(name); - }; -} -function styleConstant(name, value, priority) { - return function() { - this.style.setProperty(name, value, priority); - }; -} -function styleFunction(name, value, priority) { - return function() { - var v = value.apply(this, arguments); - if (v == null) - this.style.removeProperty(name); - else - this.style.setProperty(name, v, priority); - }; -} -function selection_style(name, value, priority) { - return arguments.length > 1 ? this.each((value == null ? styleRemove : typeof value === "function" ? styleFunction : styleConstant)(name, value, priority == null ? "" : priority)) : styleValue(this.node(), name); -} -function styleValue(node, name) { - return node.style.getPropertyValue(name) || defaultView(node).getComputedStyle(node, null).getPropertyValue(name); -} -function propertyRemove(name) { - return function() { - delete this[name]; - }; -} -function propertyConstant(name, value) { - return function() { - this[name] = value; - }; -} -function propertyFunction(name, value) { - return function() { - var v = value.apply(this, arguments); - if (v == null) - delete this[name]; - else - this[name] = v; - }; -} -function selection_property(name, value) { - return arguments.length > 1 ? this.each((value == null ? propertyRemove : typeof value === "function" ? propertyFunction : propertyConstant)(name, value)) : this.node()[name]; -} -function classArray(string) { - return string.trim().split(/^|\s+/); -} -function classList(node) { - return node.classList || new ClassList(node); -} -function ClassList(node) { - this._node = node; - this._names = classArray(node.getAttribute("class") || ""); -} -ClassList.prototype = { - add: function(name) { - var i = this._names.indexOf(name); - if (i < 0) { - this._names.push(name); - this._node.setAttribute("class", this._names.join(" ")); - } - }, - remove: function(name) { - var i = this._names.indexOf(name); - if (i >= 0) { - this._names.splice(i, 1); - this._node.setAttribute("class", this._names.join(" ")); - } - }, - contains: function(name) { - return this._names.indexOf(name) >= 0; - } -}; -function classedAdd(node, names) { - var list = classList(node), i = -1, n = names.length; - while (++i < n) - list.add(names[i]); -} -function classedRemove(node, names) { - var list = classList(node), i = -1, n = names.length; - while (++i < n) - list.remove(names[i]); -} -function classedTrue(names) { - return function() { - classedAdd(this, names); - }; -} -function classedFalse(names) { - return function() { - classedRemove(this, names); - }; -} -function classedFunction(names, value) { - return function() { - (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names); - }; -} -function selection_classed(name, value) { - var names = classArray(name + ""); - if (arguments.length < 2) { - var list = classList(this.node()), i = -1, n = names.length; - while (++i < n) - if (!list.contains(names[i])) - return false; - return true; - } - return this.each((typeof value === "function" ? classedFunction : value ? classedTrue : classedFalse)(names, value)); -} -function textRemove() { - this.textContent = ""; -} -function textConstant(value) { - return function() { - this.textContent = value; - }; -} -function textFunction(value) { - return function() { - var v = value.apply(this, arguments); - this.textContent = v == null ? "" : v; - }; -} -function selection_text(value) { - return arguments.length ? this.each(value == null ? textRemove : (typeof value === "function" ? textFunction : textConstant)(value)) : this.node().textContent; -} -function htmlRemove() { - this.innerHTML = ""; -} -function htmlConstant(value) { - return function() { - this.innerHTML = value; - }; -} -function htmlFunction(value) { - return function() { - var v = value.apply(this, arguments); - this.innerHTML = v == null ? "" : v; - }; -} -function selection_html(value) { - return arguments.length ? this.each(value == null ? htmlRemove : (typeof value === "function" ? htmlFunction : htmlConstant)(value)) : this.node().innerHTML; -} -function raise() { - if (this.nextSibling) - this.parentNode.appendChild(this); -} -function selection_raise() { - return this.each(raise); -} -function lower() { - if (this.previousSibling) - this.parentNode.insertBefore(this, this.parentNode.firstChild); -} -function selection_lower() { - return this.each(lower); -} -function selection_append(name) { - var create2 = typeof name === "function" ? name : creator(name); - return this.select(function() { - return this.appendChild(create2.apply(this, arguments)); - }); -} -function constantNull() { - return null; -} -function selection_insert(name, before) { - var create2 = typeof name === "function" ? name : creator(name), select2 = before == null ? constantNull : typeof before === "function" ? before : selector(before); - return this.select(function() { - return this.insertBefore(create2.apply(this, arguments), select2.apply(this, arguments) || null); - }); -} -function remove() { - var parent = this.parentNode; - if (parent) - parent.removeChild(this); -} -function selection_remove() { - return this.each(remove); -} -function selection_cloneShallow() { - var clone = this.cloneNode(false), parent = this.parentNode; - return parent ? parent.insertBefore(clone, this.nextSibling) : clone; -} -function selection_cloneDeep() { - var clone = this.cloneNode(true), parent = this.parentNode; - return parent ? parent.insertBefore(clone, this.nextSibling) : clone; -} -function selection_clone(deep) { - return this.select(deep ? selection_cloneDeep : selection_cloneShallow); -} -function selection_datum(value) { - return arguments.length ? this.property("__data__", value) : this.node().__data__; -} -function contextListener(listener) { - return function(event) { - listener.call(this, event, this.__data__); - }; -} -function parseTypenames(typenames) { - return typenames.trim().split(/^|\s+/).map(function(t) { - var name = "", i = t.indexOf("."); - if (i >= 0) - name = t.slice(i + 1), t = t.slice(0, i); - return {type: t, name}; - }); -} -function onRemove(typename) { - return function() { - var on = this.__on; - if (!on) - return; - for (var j = 0, i = -1, m = on.length, o; j < m; ++j) { - if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) { - this.removeEventListener(o.type, o.listener, o.options); - } else { - on[++i] = o; - } - } - if (++i) - on.length = i; - else - delete this.__on; - }; -} -function onAdd(typename, value, options) { - return function() { - var on = this.__on, o, listener = contextListener(value); - if (on) - for (var j = 0, m = on.length; j < m; ++j) { - if ((o = on[j]).type === typename.type && o.name === typename.name) { - this.removeEventListener(o.type, o.listener, o.options); - this.addEventListener(o.type, o.listener = listener, o.options = options); - o.value = value; - return; - } - } - this.addEventListener(typename.type, listener, options); - o = {type: typename.type, name: typename.name, value, listener, options}; - if (!on) - this.__on = [o]; - else - on.push(o); - }; -} -function selection_on(typename, value, options) { - var typenames = parseTypenames(typename + ""), i, n = typenames.length, t; - if (arguments.length < 2) { - var on = this.node().__on; - if (on) - for (var j = 0, m = on.length, o; j < m; ++j) { - for (i = 0, o = on[j]; i < n; ++i) { - if ((t = typenames[i]).type === o.type && t.name === o.name) { - return o.value; - } - } - } - return; - } - on = value ? onAdd : onRemove; - for (i = 0; i < n; ++i) - this.each(on(typenames[i], value, options)); - return this; -} -function dispatchEvent(node, type, params) { - var window = defaultView(node), event = window.CustomEvent; - if (typeof event === "function") { - event = new event(type, params); - } else { - event = window.document.createEvent("Event"); - if (params) - event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail; - else - event.initEvent(type, false, false); - } - node.dispatchEvent(event); -} -function dispatchConstant(type, params) { - return function() { - return dispatchEvent(this, type, params); - }; -} -function dispatchFunction(type, params) { - return function() { - return dispatchEvent(this, type, params.apply(this, arguments)); - }; -} -function selection_dispatch(type, params) { - return this.each((typeof params === "function" ? dispatchFunction : dispatchConstant)(type, params)); -} -function* selection_iterator() { - for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) { - for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) { - if (node = group[i]) - yield node; - } - } -} -var root = [null]; -function Selection(groups, parents) { - this._groups = groups; - this._parents = parents; -} -function selection() { - return new Selection([[document.documentElement]], root); -} -function selection_selection() { - return this; -} -Selection.prototype = selection.prototype = { - constructor: Selection, - select: selection_select, - selectAll: selection_selectAll, - selectChild: selection_selectChild, - selectChildren: selection_selectChildren, - filter: selection_filter, - data: selection_data, - enter: selection_enter, - exit: selection_exit, - join: selection_join, - merge: selection_merge, - selection: selection_selection, - order: selection_order, - sort: selection_sort, - call: selection_call, - nodes: selection_nodes, - node: selection_node, - size: selection_size, - empty: selection_empty, - each: selection_each, - attr: selection_attr, - style: selection_style, - property: selection_property, - classed: selection_classed, - text: selection_text, - html: selection_html, - raise: selection_raise, - lower: selection_lower, - append: selection_append, - insert: selection_insert, - remove: selection_remove, - clone: selection_clone, - datum: selection_datum, - on: selection_on, - dispatch: selection_dispatch, - [Symbol.iterator]: selection_iterator -}; -function select(selector2) { - return typeof selector2 === "string" ? new Selection([[document.querySelector(selector2)]], [document.documentElement]) : new Selection([[selector2]], root); -} -function create(name) { - return select(creator(name).call(document.documentElement)); -} -var nextId = 0; -function local() { - return new Local(); -} -function Local() { - this._ = "@" + (++nextId).toString(36); -} -Local.prototype = local.prototype = { - constructor: Local, - get: function(node) { - var id = this._; - while (!(id in node)) - if (!(node = node.parentNode)) - return; - return node[id]; - }, - set: function(node, value) { - return node[this._] = value; - }, - remove: function(node) { - return this._ in node && delete node[this._]; - }, - toString: function() { - return this._; - } -}; -function sourceEvent(event) { - let sourceEvent2; - while (sourceEvent2 = event.sourceEvent) - event = sourceEvent2; - return event; -} -function pointer(event, node) { - event = sourceEvent(event); - if (node === void 0) - node = event.currentTarget; - if (node) { - var svg = node.ownerSVGElement || node; - if (svg.createSVGPoint) { - var point = svg.createSVGPoint(); - point.x = event.clientX, point.y = event.clientY; - point = point.matrixTransform(node.getScreenCTM().inverse()); - return [point.x, point.y]; - } - if (node.getBoundingClientRect) { - var rect = node.getBoundingClientRect(); - return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop]; - } - } - return [event.pageX, event.pageY]; -} -function pointers(events, node) { - if (events.target) { - events = sourceEvent(events); - if (node === void 0) - node = events.currentTarget; - events = events.touches || [events]; - } - return Array.from(events, (event) => pointer(event, node)); -} -function selectAll(selector2) { - return typeof selector2 === "string" ? new Selection([document.querySelectorAll(selector2)], [document.documentElement]) : new Selection([array(selector2)], root); -} -export {create, creator, local, matcher, namespace, namespaces, pointer, pointers, select, selectAll, selection, selector, selectorAll, styleValue as style, defaultView as window}; -export default null; diff --git a/web/client/deps/d3/d3-shape.js b/web/client/deps/d3/d3-shape.js deleted file mode 100644 index da052c82..00000000 --- a/web/client/deps/d3/d3-shape.js +++ /dev/null @@ -1,1742 +0,0 @@ -import {path} from "./d3-path.js"; -function constant(x2) { - return function constant2() { - return x2; - }; -} -const abs = Math.abs; -const atan2 = Math.atan2; -const cos = Math.cos; -const max = Math.max; -const min = Math.min; -const sin = Math.sin; -const sqrt = Math.sqrt; -const epsilon = 1e-12; -const pi = Math.PI; -const halfPi = pi / 2; -const tau = 2 * pi; -function acos(x2) { - return x2 > 1 ? 0 : x2 < -1 ? pi : Math.acos(x2); -} -function asin(x2) { - return x2 >= 1 ? halfPi : x2 <= -1 ? -halfPi : Math.asin(x2); -} -function arcInnerRadius(d) { - return d.innerRadius; -} -function arcOuterRadius(d) { - return d.outerRadius; -} -function arcStartAngle(d) { - return d.startAngle; -} -function arcEndAngle(d) { - return d.endAngle; -} -function arcPadAngle(d) { - return d && d.padAngle; -} -function intersect(x0, y0, x1, y1, x2, y2, x3, y3) { - var x10 = x1 - x0, y10 = y1 - y0, x32 = x3 - x2, y32 = y3 - y2, t = y32 * x10 - x32 * y10; - if (t * t < epsilon) - return; - t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t; - return [x0 + t * x10, y0 + t * y10]; -} -function cornerTangents(x0, y0, x1, y1, r1, rc, cw) { - var x01 = x0 - x1, y01 = y0 - y1, lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x11 = x0 + ox, y11 = y0 + oy, x10 = x1 + ox, y10 = y1 + oy, x00 = (x11 + x10) / 2, y00 = (y11 + y10) / 2, dx = x10 - x11, dy = y10 - y11, d2 = dx * dx + dy * dy, r = r1 - rc, D = x11 * y10 - x10 * y11, d = (dy < 0 ? -1 : 1) * sqrt(max(0, r * r * d2 - D * D)), cx0 = (D * dy - dx * d) / d2, cy0 = (-D * dx - dy * d) / d2, cx1 = (D * dy + dx * d) / d2, cy1 = (-D * dx + dy * d) / d2, dx0 = cx0 - x00, dy0 = cy0 - y00, dx1 = cx1 - x00, dy1 = cy1 - y00; - if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) - cx0 = cx1, cy0 = cy1; - return { - cx: cx0, - cy: cy0, - x01: -ox, - y01: -oy, - x11: cx0 * (r1 / r - 1), - y11: cy0 * (r1 / r - 1) - }; -} -function arc() { - var innerRadius = arcInnerRadius, outerRadius = arcOuterRadius, cornerRadius = constant(0), padRadius = null, startAngle = arcStartAngle, endAngle = arcEndAngle, padAngle = arcPadAngle, context = null; - function arc2() { - var buffer, r, r0 = +innerRadius.apply(this, arguments), r1 = +outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) - halfPi, a1 = endAngle.apply(this, arguments) - halfPi, da = abs(a1 - a0), cw = a1 > a0; - if (!context) - context = buffer = path(); - if (r1 < r0) - r = r1, r1 = r0, r0 = r; - if (!(r1 > epsilon)) - context.moveTo(0, 0); - else if (da > tau - epsilon) { - context.moveTo(r1 * cos(a0), r1 * sin(a0)); - context.arc(0, 0, r1, a0, a1, !cw); - if (r0 > epsilon) { - context.moveTo(r0 * cos(a1), r0 * sin(a1)); - context.arc(0, 0, r0, a1, a0, cw); - } - } else { - var a01 = a0, a11 = a1, a00 = a0, a10 = a1, da0 = da, da1 = da, ap = padAngle.apply(this, arguments) / 2, rp = ap > epsilon && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)), rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), rc0 = rc, rc1 = rc, t0, t1; - if (rp > epsilon) { - var p0 = asin(rp / r0 * sin(ap)), p1 = asin(rp / r1 * sin(ap)); - if ((da0 -= p0 * 2) > epsilon) - p0 *= cw ? 1 : -1, a00 += p0, a10 -= p0; - else - da0 = 0, a00 = a10 = (a0 + a1) / 2; - if ((da1 -= p1 * 2) > epsilon) - p1 *= cw ? 1 : -1, a01 += p1, a11 -= p1; - else - da1 = 0, a01 = a11 = (a0 + a1) / 2; - } - var x01 = r1 * cos(a01), y01 = r1 * sin(a01), x10 = r0 * cos(a10), y10 = r0 * sin(a10); - if (rc > epsilon) { - var x11 = r1 * cos(a11), y11 = r1 * sin(a11), x00 = r0 * cos(a00), y00 = r0 * sin(a00), oc; - if (da < pi && (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10))) { - var ax = x01 - oc[0], ay = y01 - oc[1], bx = x11 - oc[0], by = y11 - oc[1], kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2), lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]); - rc0 = min(rc, (r0 - lc) / (kc - 1)); - rc1 = min(rc, (r1 - lc) / (kc + 1)); - } - } - if (!(da1 > epsilon)) - context.moveTo(x01, y01); - else if (rc1 > epsilon) { - t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw); - t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw); - context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01); - if (rc1 < rc) - context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw); - else { - context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw); - context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw); - context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw); - } - } else - context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw); - if (!(r0 > epsilon) || !(da0 > epsilon)) - context.lineTo(x10, y10); - else if (rc0 > epsilon) { - t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw); - t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw); - context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01); - if (rc0 < rc) - context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw); - else { - context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw); - context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw); - context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw); - } - } else - context.arc(0, 0, r0, a10, a00, cw); - } - context.closePath(); - if (buffer) - return context = null, buffer + "" || null; - } - arc2.centroid = function() { - var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a2 = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2; - return [cos(a2) * r, sin(a2) * r]; - }; - arc2.innerRadius = function(_) { - return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant(+_), arc2) : innerRadius; - }; - arc2.outerRadius = function(_) { - return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant(+_), arc2) : outerRadius; - }; - arc2.cornerRadius = function(_) { - return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant(+_), arc2) : cornerRadius; - }; - arc2.padRadius = function(_) { - return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant(+_), arc2) : padRadius; - }; - arc2.startAngle = function(_) { - return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), arc2) : startAngle; - }; - arc2.endAngle = function(_) { - return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), arc2) : endAngle; - }; - arc2.padAngle = function(_) { - return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), arc2) : padAngle; - }; - arc2.context = function(_) { - return arguments.length ? (context = _ == null ? null : _, arc2) : context; - }; - return arc2; -} -var slice = Array.prototype.slice; -function array(x2) { - return typeof x2 === "object" && "length" in x2 ? x2 : Array.from(x2); -} -function Linear(context) { - this._context = context; -} -Linear.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._point = 0; - }, - lineEnd: function() { - if (this._line || this._line !== 0 && this._point === 1) - this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x2, y2) { - x2 = +x2, y2 = +y2; - switch (this._point) { - case 0: - this._point = 1; - this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); - break; - case 1: - this._point = 2; - default: - this._context.lineTo(x2, y2); - break; - } - } -}; -function curveLinear(context) { - return new Linear(context); -} -function x(p) { - return p[0]; -} -function y(p) { - return p[1]; -} -function line(x$12, y$1) { - var defined = constant(true), context = null, curve = curveLinear, output = null; - x$12 = typeof x$12 === "function" ? x$12 : x$12 === void 0 ? x : constant(x$12); - y$1 = typeof y$1 === "function" ? y$1 : y$1 === void 0 ? y : constant(y$1); - function line2(data) { - var i, n = (data = array(data)).length, d, defined0 = false, buffer; - if (context == null) - output = curve(buffer = path()); - for (i = 0; i <= n; ++i) { - if (!(i < n && defined(d = data[i], i, data)) === defined0) { - if (defined0 = !defined0) - output.lineStart(); - else - output.lineEnd(); - } - if (defined0) - output.point(+x$12(d, i, data), +y$1(d, i, data)); - } - if (buffer) - return output = null, buffer + "" || null; - } - line2.x = function(_) { - return arguments.length ? (x$12 = typeof _ === "function" ? _ : constant(+_), line2) : x$12; - }; - line2.y = function(_) { - return arguments.length ? (y$1 = typeof _ === "function" ? _ : constant(+_), line2) : y$1; - }; - line2.defined = function(_) { - return arguments.length ? (defined = typeof _ === "function" ? _ : constant(!!_), line2) : defined; - }; - line2.curve = function(_) { - return arguments.length ? (curve = _, context != null && (output = curve(context)), line2) : curve; - }; - line2.context = function(_) { - return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line2) : context; - }; - return line2; -} -function area(x0, y0, y1) { - var x1 = null, defined = constant(true), context = null, curve = curveLinear, output = null; - x0 = typeof x0 === "function" ? x0 : x0 === void 0 ? x : constant(+x0); - y0 = typeof y0 === "function" ? y0 : y0 === void 0 ? constant(0) : constant(+y0); - y1 = typeof y1 === "function" ? y1 : y1 === void 0 ? y : constant(+y1); - function area2(data) { - var i, j, k2, n = (data = array(data)).length, d, defined0 = false, buffer, x0z = new Array(n), y0z = new Array(n); - if (context == null) - output = curve(buffer = path()); - for (i = 0; i <= n; ++i) { - if (!(i < n && defined(d = data[i], i, data)) === defined0) { - if (defined0 = !defined0) { - j = i; - output.areaStart(); - output.lineStart(); - } else { - output.lineEnd(); - output.lineStart(); - for (k2 = i - 1; k2 >= j; --k2) { - output.point(x0z[k2], y0z[k2]); - } - output.lineEnd(); - output.areaEnd(); - } - } - if (defined0) { - x0z[i] = +x0(d, i, data), y0z[i] = +y0(d, i, data); - output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : y0z[i]); - } - } - if (buffer) - return output = null, buffer + "" || null; - } - function arealine() { - return line().defined(defined).curve(curve).context(context); - } - area2.x = function(_) { - return arguments.length ? (x0 = typeof _ === "function" ? _ : constant(+_), x1 = null, area2) : x0; - }; - area2.x0 = function(_) { - return arguments.length ? (x0 = typeof _ === "function" ? _ : constant(+_), area2) : x0; - }; - area2.x1 = function(_) { - return arguments.length ? (x1 = _ == null ? null : typeof _ === "function" ? _ : constant(+_), area2) : x1; - }; - area2.y = function(_) { - return arguments.length ? (y0 = typeof _ === "function" ? _ : constant(+_), y1 = null, area2) : y0; - }; - area2.y0 = function(_) { - return arguments.length ? (y0 = typeof _ === "function" ? _ : constant(+_), area2) : y0; - }; - area2.y1 = function(_) { - return arguments.length ? (y1 = _ == null ? null : typeof _ === "function" ? _ : constant(+_), area2) : y1; - }; - area2.lineX0 = area2.lineY0 = function() { - return arealine().x(x0).y(y0); - }; - area2.lineY1 = function() { - return arealine().x(x0).y(y1); - }; - area2.lineX1 = function() { - return arealine().x(x1).y(y0); - }; - area2.defined = function(_) { - return arguments.length ? (defined = typeof _ === "function" ? _ : constant(!!_), area2) : defined; - }; - area2.curve = function(_) { - return arguments.length ? (curve = _, context != null && (output = curve(context)), area2) : curve; - }; - area2.context = function(_) { - return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area2) : context; - }; - return area2; -} -function descending(a2, b) { - return b < a2 ? -1 : b > a2 ? 1 : b >= a2 ? 0 : NaN; -} -function identity(d) { - return d; -} -function pie() { - var value = identity, sortValues = descending, sort = null, startAngle = constant(0), endAngle = constant(tau), padAngle = constant(0); - function pie2(data) { - var i, n = (data = array(data)).length, j, k2, sum2 = 0, index = new Array(n), arcs = new Array(n), a0 = +startAngle.apply(this, arguments), da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)), a1, p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)), pa = p * (da < 0 ? -1 : 1), v; - for (i = 0; i < n; ++i) { - if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) { - sum2 += v; - } - } - if (sortValues != null) - index.sort(function(i2, j2) { - return sortValues(arcs[i2], arcs[j2]); - }); - else if (sort != null) - index.sort(function(i2, j2) { - return sort(data[i2], data[j2]); - }); - for (i = 0, k2 = sum2 ? (da - n * pa) / sum2 : 0; i < n; ++i, a0 = a1) { - j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k2 : 0) + pa, arcs[j] = { - data: data[j], - index: i, - value: v, - startAngle: a0, - endAngle: a1, - padAngle: p - }; - } - return arcs; - } - pie2.value = function(_) { - return arguments.length ? (value = typeof _ === "function" ? _ : constant(+_), pie2) : value; - }; - pie2.sortValues = function(_) { - return arguments.length ? (sortValues = _, sort = null, pie2) : sortValues; - }; - pie2.sort = function(_) { - return arguments.length ? (sort = _, sortValues = null, pie2) : sort; - }; - pie2.startAngle = function(_) { - return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), pie2) : startAngle; - }; - pie2.endAngle = function(_) { - return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), pie2) : endAngle; - }; - pie2.padAngle = function(_) { - return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), pie2) : padAngle; - }; - return pie2; -} -var curveRadialLinear = curveRadial(curveLinear); -function Radial(curve) { - this._curve = curve; -} -Radial.prototype = { - areaStart: function() { - this._curve.areaStart(); - }, - areaEnd: function() { - this._curve.areaEnd(); - }, - lineStart: function() { - this._curve.lineStart(); - }, - lineEnd: function() { - this._curve.lineEnd(); - }, - point: function(a2, r) { - this._curve.point(r * Math.sin(a2), r * -Math.cos(a2)); - } -}; -function curveRadial(curve) { - function radial(context) { - return new Radial(curve(context)); - } - radial._curve = curve; - return radial; -} -function lineRadial(l) { - var c2 = l.curve; - l.angle = l.x, delete l.x; - l.radius = l.y, delete l.y; - l.curve = function(_) { - return arguments.length ? c2(curveRadial(_)) : c2()._curve; - }; - return l; -} -function lineRadial$1() { - return lineRadial(line().curve(curveRadialLinear)); -} -function areaRadial() { - var a2 = area().curve(curveRadialLinear), c2 = a2.curve, x0 = a2.lineX0, x1 = a2.lineX1, y0 = a2.lineY0, y1 = a2.lineY1; - a2.angle = a2.x, delete a2.x; - a2.startAngle = a2.x0, delete a2.x0; - a2.endAngle = a2.x1, delete a2.x1; - a2.radius = a2.y, delete a2.y; - a2.innerRadius = a2.y0, delete a2.y0; - a2.outerRadius = a2.y1, delete a2.y1; - a2.lineStartAngle = function() { - return lineRadial(x0()); - }, delete a2.lineX0; - a2.lineEndAngle = function() { - return lineRadial(x1()); - }, delete a2.lineX1; - a2.lineInnerRadius = function() { - return lineRadial(y0()); - }, delete a2.lineY0; - a2.lineOuterRadius = function() { - return lineRadial(y1()); - }, delete a2.lineY1; - a2.curve = function(_) { - return arguments.length ? c2(curveRadial(_)) : c2()._curve; - }; - return a2; -} -function pointRadial(x2, y2) { - return [(y2 = +y2) * Math.cos(x2 -= Math.PI / 2), y2 * Math.sin(x2)]; -} -class Bump { - constructor(context, x2) { - this._context = context; - this._x = x2; - } - areaStart() { - this._line = 0; - } - areaEnd() { - this._line = NaN; - } - lineStart() { - this._point = 0; - } - lineEnd() { - if (this._line || this._line !== 0 && this._point === 1) - this._context.closePath(); - this._line = 1 - this._line; - } - point(x2, y2) { - x2 = +x2, y2 = +y2; - switch (this._point) { - case 0: { - this._point = 1; - if (this._line) - this._context.lineTo(x2, y2); - else - this._context.moveTo(x2, y2); - break; - } - case 1: - this._point = 2; - default: { - if (this._x) - this._context.bezierCurveTo(this._x0 = (this._x0 + x2) / 2, this._y0, this._x0, y2, x2, y2); - else - this._context.bezierCurveTo(this._x0, this._y0 = (this._y0 + y2) / 2, x2, this._y0, x2, y2); - break; - } - } - this._x0 = x2, this._y0 = y2; - } -} -class BumpRadial { - constructor(context) { - this._context = context; - } - lineStart() { - this._point = 0; - } - lineEnd() { - } - point(x2, y2) { - x2 = +x2, y2 = +y2; - if (this._point++ === 0) { - this._x0 = x2, this._y0 = y2; - } else { - const p0 = pointRadial(this._x0, this._y0); - const p1 = pointRadial(this._x0, this._y0 = (this._y0 + y2) / 2); - const p2 = pointRadial(x2, this._y0); - const p3 = pointRadial(x2, y2); - this._context.moveTo(...p0); - this._context.bezierCurveTo(...p1, ...p2, ...p3); - } - } -} -function bumpX(context) { - return new Bump(context, true); -} -function bumpY(context) { - return new Bump(context, false); -} -function bumpRadial(context) { - return new BumpRadial(context); -} -function linkSource(d) { - return d.source; -} -function linkTarget(d) { - return d.target; -} -function link(curve) { - let source = linkSource; - let target = linkTarget; - let x$12 = x; - let y$1 = y; - let context = null; - let output = null; - function link2() { - let buffer; - const argv = slice.call(arguments); - const s2 = source.apply(this, argv); - const t = target.apply(this, argv); - if (context == null) - output = curve(buffer = path()); - output.lineStart(); - argv[0] = s2, output.point(+x$12.apply(this, argv), +y$1.apply(this, argv)); - argv[0] = t, output.point(+x$12.apply(this, argv), +y$1.apply(this, argv)); - output.lineEnd(); - if (buffer) - return output = null, buffer + "" || null; - } - link2.source = function(_) { - return arguments.length ? (source = _, link2) : source; - }; - link2.target = function(_) { - return arguments.length ? (target = _, link2) : target; - }; - link2.x = function(_) { - return arguments.length ? (x$12 = typeof _ === "function" ? _ : constant(+_), link2) : x$12; - }; - link2.y = function(_) { - return arguments.length ? (y$1 = typeof _ === "function" ? _ : constant(+_), link2) : y$1; - }; - link2.context = function(_) { - return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), link2) : context; - }; - return link2; -} -function linkHorizontal() { - return link(bumpX); -} -function linkVertical() { - return link(bumpY); -} -function linkRadial() { - const l = link(bumpRadial); - l.angle = l.x, delete l.x; - l.radius = l.y, delete l.y; - return l; -} -const sqrt3 = sqrt(3); -var asterisk = { - draw(context, size) { - const r = sqrt(size + min(size / 28, 0.75)) * 0.59436; - const t = r / 2; - const u = t * sqrt3; - context.moveTo(0, r); - context.lineTo(0, -r); - context.moveTo(-u, -t); - context.lineTo(u, t); - context.moveTo(-u, t); - context.lineTo(u, -t); - } -}; -var circle = { - draw(context, size) { - const r = sqrt(size / pi); - context.moveTo(r, 0); - context.arc(0, 0, r, 0, tau); - } -}; -var cross = { - draw(context, size) { - const r = sqrt(size / 5) / 2; - context.moveTo(-3 * r, -r); - context.lineTo(-r, -r); - context.lineTo(-r, -3 * r); - context.lineTo(r, -3 * r); - context.lineTo(r, -r); - context.lineTo(3 * r, -r); - context.lineTo(3 * r, r); - context.lineTo(r, r); - context.lineTo(r, 3 * r); - context.lineTo(-r, 3 * r); - context.lineTo(-r, r); - context.lineTo(-3 * r, r); - context.closePath(); - } -}; -const tan30 = sqrt(1 / 3); -const tan30_2 = tan30 * 2; -var diamond = { - draw(context, size) { - const y2 = sqrt(size / tan30_2); - const x2 = y2 * tan30; - context.moveTo(0, -y2); - context.lineTo(x2, 0); - context.lineTo(0, y2); - context.lineTo(-x2, 0); - context.closePath(); - } -}; -var diamond2 = { - draw(context, size) { - const r = sqrt(size) * 0.62625; - context.moveTo(0, -r); - context.lineTo(r, 0); - context.lineTo(0, r); - context.lineTo(-r, 0); - context.closePath(); - } -}; -var plus = { - draw(context, size) { - const r = sqrt(size - min(size / 7, 2)) * 0.87559; - context.moveTo(-r, 0); - context.lineTo(r, 0); - context.moveTo(0, r); - context.lineTo(0, -r); - } -}; -var square = { - draw(context, size) { - const w = sqrt(size); - const x2 = -w / 2; - context.rect(x2, x2, w, w); - } -}; -var square2 = { - draw(context, size) { - const r = sqrt(size) * 0.4431; - context.moveTo(r, r); - context.lineTo(r, -r); - context.lineTo(-r, -r); - context.lineTo(-r, r); - context.closePath(); - } -}; -const ka = 0.8908130915292852; -const kr = sin(pi / 10) / sin(7 * pi / 10); -const kx = sin(tau / 10) * kr; -const ky = -cos(tau / 10) * kr; -var star = { - draw(context, size) { - const r = sqrt(size * ka); - const x2 = kx * r; - const y2 = ky * r; - context.moveTo(0, -r); - context.lineTo(x2, y2); - for (let i = 1; i < 5; ++i) { - const a2 = tau * i / 5; - const c2 = cos(a2); - const s2 = sin(a2); - context.lineTo(s2 * r, -c2 * r); - context.lineTo(c2 * x2 - s2 * y2, s2 * x2 + c2 * y2); - } - context.closePath(); - } -}; -const sqrt3$1 = sqrt(3); -var triangle = { - draw(context, size) { - const y2 = -sqrt(size / (sqrt3$1 * 3)); - context.moveTo(0, y2 * 2); - context.lineTo(-sqrt3$1 * y2, -y2); - context.lineTo(sqrt3$1 * y2, -y2); - context.closePath(); - } -}; -const sqrt3$2 = sqrt(3); -var triangle2 = { - draw(context, size) { - const s2 = sqrt(size) * 0.6824; - const t = s2 / 2; - const u = s2 * sqrt3$2 / 2; - context.moveTo(0, -s2); - context.lineTo(u, t); - context.lineTo(-u, t); - context.closePath(); - } -}; -const c = -0.5; -const s = sqrt(3) / 2; -const k = 1 / sqrt(12); -const a = (k / 2 + 1) * 3; -var wye = { - draw(context, size) { - const r = sqrt(size / a); - const x0 = r / 2, y0 = r * k; - const x1 = x0, y1 = r * k + r; - const x2 = -x1, y2 = y1; - context.moveTo(x0, y0); - context.lineTo(x1, y1); - context.lineTo(x2, y2); - context.lineTo(c * x0 - s * y0, s * x0 + c * y0); - context.lineTo(c * x1 - s * y1, s * x1 + c * y1); - context.lineTo(c * x2 - s * y2, s * x2 + c * y2); - context.lineTo(c * x0 + s * y0, c * y0 - s * x0); - context.lineTo(c * x1 + s * y1, c * y1 - s * x1); - context.lineTo(c * x2 + s * y2, c * y2 - s * x2); - context.closePath(); - } -}; -var x$1 = { - draw(context, size) { - const r = sqrt(size - min(size / 6, 1.7)) * 0.6189; - context.moveTo(-r, -r); - context.lineTo(r, r); - context.moveTo(-r, r); - context.lineTo(r, -r); - } -}; -const symbolsFill = [ - circle, - cross, - diamond, - square, - star, - triangle, - wye -]; -const symbolsStroke = [ - circle, - plus, - x$1, - triangle2, - asterisk, - square2, - diamond2 -]; -function Symbol(type, size) { - let context = null; - type = typeof type === "function" ? type : constant(type || circle); - size = typeof size === "function" ? size : constant(size === void 0 ? 64 : +size); - function symbol() { - let buffer; - if (!context) - context = buffer = path(); - type.apply(this, arguments).draw(context, +size.apply(this, arguments)); - if (buffer) - return context = null, buffer + "" || null; - } - symbol.type = function(_) { - return arguments.length ? (type = typeof _ === "function" ? _ : constant(_), symbol) : type; - }; - symbol.size = function(_) { - return arguments.length ? (size = typeof _ === "function" ? _ : constant(+_), symbol) : size; - }; - symbol.context = function(_) { - return arguments.length ? (context = _ == null ? null : _, symbol) : context; - }; - return symbol; -} -function noop() { -} -function point(that, x2, y2) { - that._context.bezierCurveTo((2 * that._x0 + that._x1) / 3, (2 * that._y0 + that._y1) / 3, (that._x0 + 2 * that._x1) / 3, (that._y0 + 2 * that._y1) / 3, (that._x0 + 4 * that._x1 + x2) / 6, (that._y0 + 4 * that._y1 + y2) / 6); -} -function Basis(context) { - this._context = context; -} -Basis.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = this._y0 = this._y1 = NaN; - this._point = 0; - }, - lineEnd: function() { - switch (this._point) { - case 3: - point(this, this._x1, this._y1); - case 2: - this._context.lineTo(this._x1, this._y1); - break; - } - if (this._line || this._line !== 0 && this._point === 1) - this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x2, y2) { - x2 = +x2, y2 = +y2; - switch (this._point) { - case 0: - this._point = 1; - this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); - break; - case 1: - this._point = 2; - break; - case 2: - this._point = 3; - this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); - default: - point(this, x2, y2); - break; - } - this._x0 = this._x1, this._x1 = x2; - this._y0 = this._y1, this._y1 = y2; - } -}; -function basis(context) { - return new Basis(context); -} -function BasisClosed(context) { - this._context = context; -} -BasisClosed.prototype = { - areaStart: noop, - areaEnd: noop, - lineStart: function() { - this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN; - this._point = 0; - }, - lineEnd: function() { - switch (this._point) { - case 1: { - this._context.moveTo(this._x2, this._y2); - this._context.closePath(); - break; - } - case 2: { - this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3); - this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3); - this._context.closePath(); - break; - } - case 3: { - this.point(this._x2, this._y2); - this.point(this._x3, this._y3); - this.point(this._x4, this._y4); - break; - } - } - }, - point: function(x2, y2) { - x2 = +x2, y2 = +y2; - switch (this._point) { - case 0: - this._point = 1; - this._x2 = x2, this._y2 = y2; - break; - case 1: - this._point = 2; - this._x3 = x2, this._y3 = y2; - break; - case 2: - this._point = 3; - this._x4 = x2, this._y4 = y2; - this._context.moveTo((this._x0 + 4 * this._x1 + x2) / 6, (this._y0 + 4 * this._y1 + y2) / 6); - break; - default: - point(this, x2, y2); - break; - } - this._x0 = this._x1, this._x1 = x2; - this._y0 = this._y1, this._y1 = y2; - } -}; -function basisClosed(context) { - return new BasisClosed(context); -} -function BasisOpen(context) { - this._context = context; -} -BasisOpen.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = this._y0 = this._y1 = NaN; - this._point = 0; - }, - lineEnd: function() { - if (this._line || this._line !== 0 && this._point === 3) - this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x2, y2) { - x2 = +x2, y2 = +y2; - switch (this._point) { - case 0: - this._point = 1; - break; - case 1: - this._point = 2; - break; - case 2: - this._point = 3; - var x0 = (this._x0 + 4 * this._x1 + x2) / 6, y0 = (this._y0 + 4 * this._y1 + y2) / 6; - this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0); - break; - case 3: - this._point = 4; - default: - point(this, x2, y2); - break; - } - this._x0 = this._x1, this._x1 = x2; - this._y0 = this._y1, this._y1 = y2; - } -}; -function basisOpen(context) { - return new BasisOpen(context); -} -function Bundle(context, beta) { - this._basis = new Basis(context); - this._beta = beta; -} -Bundle.prototype = { - lineStart: function() { - this._x = []; - this._y = []; - this._basis.lineStart(); - }, - lineEnd: function() { - var x2 = this._x, y2 = this._y, j = x2.length - 1; - if (j > 0) { - var x0 = x2[0], y0 = y2[0], dx = x2[j] - x0, dy = y2[j] - y0, i = -1, t; - while (++i <= j) { - t = i / j; - this._basis.point(this._beta * x2[i] + (1 - this._beta) * (x0 + t * dx), this._beta * y2[i] + (1 - this._beta) * (y0 + t * dy)); - } - } - this._x = this._y = null; - this._basis.lineEnd(); - }, - point: function(x2, y2) { - this._x.push(+x2); - this._y.push(+y2); - } -}; -var bundle = function custom(beta) { - function bundle2(context) { - return beta === 1 ? new Basis(context) : new Bundle(context, beta); - } - bundle2.beta = function(beta2) { - return custom(+beta2); - }; - return bundle2; -}(0.85); -function point$1(that, x2, y2) { - that._context.bezierCurveTo(that._x1 + that._k * (that._x2 - that._x0), that._y1 + that._k * (that._y2 - that._y0), that._x2 + that._k * (that._x1 - x2), that._y2 + that._k * (that._y1 - y2), that._x2, that._y2); -} -function Cardinal(context, tension) { - this._context = context; - this._k = (1 - tension) / 6; -} -Cardinal.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; - this._point = 0; - }, - lineEnd: function() { - switch (this._point) { - case 2: - this._context.lineTo(this._x2, this._y2); - break; - case 3: - point$1(this, this._x1, this._y1); - break; - } - if (this._line || this._line !== 0 && this._point === 1) - this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x2, y2) { - x2 = +x2, y2 = +y2; - switch (this._point) { - case 0: - this._point = 1; - this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); - break; - case 1: - this._point = 2; - this._x1 = x2, this._y1 = y2; - break; - case 2: - this._point = 3; - default: - point$1(this, x2, y2); - break; - } - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; - } -}; -var cardinal = function custom2(tension) { - function cardinal2(context) { - return new Cardinal(context, tension); - } - cardinal2.tension = function(tension2) { - return custom2(+tension2); - }; - return cardinal2; -}(0); -function CardinalClosed(context, tension) { - this._context = context; - this._k = (1 - tension) / 6; -} -CardinalClosed.prototype = { - areaStart: noop, - areaEnd: noop, - lineStart: function() { - this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; - this._point = 0; - }, - lineEnd: function() { - switch (this._point) { - case 1: { - this._context.moveTo(this._x3, this._y3); - this._context.closePath(); - break; - } - case 2: { - this._context.lineTo(this._x3, this._y3); - this._context.closePath(); - break; - } - case 3: { - this.point(this._x3, this._y3); - this.point(this._x4, this._y4); - this.point(this._x5, this._y5); - break; - } - } - }, - point: function(x2, y2) { - x2 = +x2, y2 = +y2; - switch (this._point) { - case 0: - this._point = 1; - this._x3 = x2, this._y3 = y2; - break; - case 1: - this._point = 2; - this._context.moveTo(this._x4 = x2, this._y4 = y2); - break; - case 2: - this._point = 3; - this._x5 = x2, this._y5 = y2; - break; - default: - point$1(this, x2, y2); - break; - } - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; - } -}; -var cardinalClosed = function custom3(tension) { - function cardinal2(context) { - return new CardinalClosed(context, tension); - } - cardinal2.tension = function(tension2) { - return custom3(+tension2); - }; - return cardinal2; -}(0); -function CardinalOpen(context, tension) { - this._context = context; - this._k = (1 - tension) / 6; -} -CardinalOpen.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; - this._point = 0; - }, - lineEnd: function() { - if (this._line || this._line !== 0 && this._point === 3) - this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x2, y2) { - x2 = +x2, y2 = +y2; - switch (this._point) { - case 0: - this._point = 1; - break; - case 1: - this._point = 2; - break; - case 2: - this._point = 3; - this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); - break; - case 3: - this._point = 4; - default: - point$1(this, x2, y2); - break; - } - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; - } -}; -var cardinalOpen = function custom4(tension) { - function cardinal2(context) { - return new CardinalOpen(context, tension); - } - cardinal2.tension = function(tension2) { - return custom4(+tension2); - }; - return cardinal2; -}(0); -function point$2(that, x2, y2) { - var x1 = that._x1, y1 = that._y1, x22 = that._x2, y22 = that._y2; - if (that._l01_a > epsilon) { - var a2 = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a, n = 3 * that._l01_a * (that._l01_a + that._l12_a); - x1 = (x1 * a2 - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n; - y1 = (y1 * a2 - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n; - } - if (that._l23_a > epsilon) { - var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a, m = 3 * that._l23_a * (that._l23_a + that._l12_a); - x22 = (x22 * b + that._x1 * that._l23_2a - x2 * that._l12_2a) / m; - y22 = (y22 * b + that._y1 * that._l23_2a - y2 * that._l12_2a) / m; - } - that._context.bezierCurveTo(x1, y1, x22, y22, that._x2, that._y2); -} -function CatmullRom(context, alpha) { - this._context = context; - this._alpha = alpha; -} -CatmullRom.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; - this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; - }, - lineEnd: function() { - switch (this._point) { - case 2: - this._context.lineTo(this._x2, this._y2); - break; - case 3: - this.point(this._x2, this._y2); - break; - } - if (this._line || this._line !== 0 && this._point === 1) - this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x2, y2) { - x2 = +x2, y2 = +y2; - if (this._point) { - var x23 = this._x2 - x2, y23 = this._y2 - y2; - this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); - } - switch (this._point) { - case 0: - this._point = 1; - this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); - break; - case 1: - this._point = 2; - break; - case 2: - this._point = 3; - default: - point$2(this, x2, y2); - break; - } - this._l01_a = this._l12_a, this._l12_a = this._l23_a; - this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; - } -}; -var catmullRom = function custom5(alpha) { - function catmullRom2(context) { - return alpha ? new CatmullRom(context, alpha) : new Cardinal(context, 0); - } - catmullRom2.alpha = function(alpha2) { - return custom5(+alpha2); - }; - return catmullRom2; -}(0.5); -function CatmullRomClosed(context, alpha) { - this._context = context; - this._alpha = alpha; -} -CatmullRomClosed.prototype = { - areaStart: noop, - areaEnd: noop, - lineStart: function() { - this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; - this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; - }, - lineEnd: function() { - switch (this._point) { - case 1: { - this._context.moveTo(this._x3, this._y3); - this._context.closePath(); - break; - } - case 2: { - this._context.lineTo(this._x3, this._y3); - this._context.closePath(); - break; - } - case 3: { - this.point(this._x3, this._y3); - this.point(this._x4, this._y4); - this.point(this._x5, this._y5); - break; - } - } - }, - point: function(x2, y2) { - x2 = +x2, y2 = +y2; - if (this._point) { - var x23 = this._x2 - x2, y23 = this._y2 - y2; - this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); - } - switch (this._point) { - case 0: - this._point = 1; - this._x3 = x2, this._y3 = y2; - break; - case 1: - this._point = 2; - this._context.moveTo(this._x4 = x2, this._y4 = y2); - break; - case 2: - this._point = 3; - this._x5 = x2, this._y5 = y2; - break; - default: - point$2(this, x2, y2); - break; - } - this._l01_a = this._l12_a, this._l12_a = this._l23_a; - this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; - } -}; -var catmullRomClosed = function custom6(alpha) { - function catmullRom2(context) { - return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClosed(context, 0); - } - catmullRom2.alpha = function(alpha2) { - return custom6(+alpha2); - }; - return catmullRom2; -}(0.5); -function CatmullRomOpen(context, alpha) { - this._context = context; - this._alpha = alpha; -} -CatmullRomOpen.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; - this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; - }, - lineEnd: function() { - if (this._line || this._line !== 0 && this._point === 3) - this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x2, y2) { - x2 = +x2, y2 = +y2; - if (this._point) { - var x23 = this._x2 - x2, y23 = this._y2 - y2; - this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); - } - switch (this._point) { - case 0: - this._point = 1; - break; - case 1: - this._point = 2; - break; - case 2: - this._point = 3; - this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); - break; - case 3: - this._point = 4; - default: - point$2(this, x2, y2); - break; - } - this._l01_a = this._l12_a, this._l12_a = this._l23_a; - this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; - } -}; -var catmullRomOpen = function custom7(alpha) { - function catmullRom2(context) { - return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(context, 0); - } - catmullRom2.alpha = function(alpha2) { - return custom7(+alpha2); - }; - return catmullRom2; -}(0.5); -function LinearClosed(context) { - this._context = context; -} -LinearClosed.prototype = { - areaStart: noop, - areaEnd: noop, - lineStart: function() { - this._point = 0; - }, - lineEnd: function() { - if (this._point) - this._context.closePath(); - }, - point: function(x2, y2) { - x2 = +x2, y2 = +y2; - if (this._point) - this._context.lineTo(x2, y2); - else - this._point = 1, this._context.moveTo(x2, y2); - } -}; -function linearClosed(context) { - return new LinearClosed(context); -} -function sign(x2) { - return x2 < 0 ? -1 : 1; -} -function slope3(that, x2, y2) { - var h0 = that._x1 - that._x0, h1 = x2 - that._x1, s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0), s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0), p = (s0 * h1 + s1 * h0) / (h0 + h1); - return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0; -} -function slope2(that, t) { - var h = that._x1 - that._x0; - return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t; -} -function point$3(that, t0, t1) { - var x0 = that._x0, y0 = that._y0, x1 = that._x1, y1 = that._y1, dx = (x1 - x0) / 3; - that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1); -} -function MonotoneX(context) { - this._context = context; -} -MonotoneX.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN; - this._point = 0; - }, - lineEnd: function() { - switch (this._point) { - case 2: - this._context.lineTo(this._x1, this._y1); - break; - case 3: - point$3(this, this._t0, slope2(this, this._t0)); - break; - } - if (this._line || this._line !== 0 && this._point === 1) - this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x2, y2) { - var t1 = NaN; - x2 = +x2, y2 = +y2; - if (x2 === this._x1 && y2 === this._y1) - return; - switch (this._point) { - case 0: - this._point = 1; - this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); - break; - case 1: - this._point = 2; - break; - case 2: - this._point = 3; - point$3(this, slope2(this, t1 = slope3(this, x2, y2)), t1); - break; - default: - point$3(this, this._t0, t1 = slope3(this, x2, y2)); - break; - } - this._x0 = this._x1, this._x1 = x2; - this._y0 = this._y1, this._y1 = y2; - this._t0 = t1; - } -}; -function MonotoneY(context) { - this._context = new ReflectContext(context); -} -(MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x2, y2) { - MonotoneX.prototype.point.call(this, y2, x2); -}; -function ReflectContext(context) { - this._context = context; -} -ReflectContext.prototype = { - moveTo: function(x2, y2) { - this._context.moveTo(y2, x2); - }, - closePath: function() { - this._context.closePath(); - }, - lineTo: function(x2, y2) { - this._context.lineTo(y2, x2); - }, - bezierCurveTo: function(x1, y1, x2, y2, x3, y3) { - this._context.bezierCurveTo(y1, x1, y2, x2, y3, x3); - } -}; -function monotoneX(context) { - return new MonotoneX(context); -} -function monotoneY(context) { - return new MonotoneY(context); -} -function Natural(context) { - this._context = context; -} -Natural.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x = []; - this._y = []; - }, - lineEnd: function() { - var x2 = this._x, y2 = this._y, n = x2.length; - if (n) { - this._line ? this._context.lineTo(x2[0], y2[0]) : this._context.moveTo(x2[0], y2[0]); - if (n === 2) { - this._context.lineTo(x2[1], y2[1]); - } else { - var px = controlPoints(x2), py = controlPoints(y2); - for (var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1) { - this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x2[i1], y2[i1]); - } - } - } - if (this._line || this._line !== 0 && n === 1) - this._context.closePath(); - this._line = 1 - this._line; - this._x = this._y = null; - }, - point: function(x2, y2) { - this._x.push(+x2); - this._y.push(+y2); - } -}; -function controlPoints(x2) { - var i, n = x2.length - 1, m, a2 = new Array(n), b = new Array(n), r = new Array(n); - a2[0] = 0, b[0] = 2, r[0] = x2[0] + 2 * x2[1]; - for (i = 1; i < n - 1; ++i) - a2[i] = 1, b[i] = 4, r[i] = 4 * x2[i] + 2 * x2[i + 1]; - a2[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x2[n - 1] + x2[n]; - for (i = 1; i < n; ++i) - m = a2[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1]; - a2[n - 1] = r[n - 1] / b[n - 1]; - for (i = n - 2; i >= 0; --i) - a2[i] = (r[i] - a2[i + 1]) / b[i]; - b[n - 1] = (x2[n] + a2[n - 1]) / 2; - for (i = 0; i < n - 1; ++i) - b[i] = 2 * x2[i + 1] - a2[i + 1]; - return [a2, b]; -} -function natural(context) { - return new Natural(context); -} -function Step(context, t) { - this._context = context; - this._t = t; -} -Step.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x = this._y = NaN; - this._point = 0; - }, - lineEnd: function() { - if (0 < this._t && this._t < 1 && this._point === 2) - this._context.lineTo(this._x, this._y); - if (this._line || this._line !== 0 && this._point === 1) - this._context.closePath(); - if (this._line >= 0) - this._t = 1 - this._t, this._line = 1 - this._line; - }, - point: function(x2, y2) { - x2 = +x2, y2 = +y2; - switch (this._point) { - case 0: - this._point = 1; - this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); - break; - case 1: - this._point = 2; - default: { - if (this._t <= 0) { - this._context.lineTo(this._x, y2); - this._context.lineTo(x2, y2); - } else { - var x1 = this._x * (1 - this._t) + x2 * this._t; - this._context.lineTo(x1, this._y); - this._context.lineTo(x1, y2); - } - break; - } - } - this._x = x2, this._y = y2; - } -}; -function step(context) { - return new Step(context, 0.5); -} -function stepBefore(context) { - return new Step(context, 0); -} -function stepAfter(context) { - return new Step(context, 1); -} -function none(series, order) { - if (!((n = series.length) > 1)) - return; - for (var i = 1, j, s0, s1 = series[order[0]], n, m = s1.length; i < n; ++i) { - s0 = s1, s1 = series[order[i]]; - for (j = 0; j < m; ++j) { - s1[j][1] += s1[j][0] = isNaN(s0[j][1]) ? s0[j][0] : s0[j][1]; - } - } -} -function none$1(series) { - var n = series.length, o = new Array(n); - while (--n >= 0) - o[n] = n; - return o; -} -function stackValue(d, key) { - return d[key]; -} -function stackSeries(key) { - const series = []; - series.key = key; - return series; -} -function stack() { - var keys = constant([]), order = none$1, offset = none, value = stackValue; - function stack2(data) { - var sz = Array.from(keys.apply(this, arguments), stackSeries), i, n = sz.length, j = -1, oz; - for (const d of data) { - for (i = 0, ++j; i < n; ++i) { - (sz[i][j] = [0, +value(d, sz[i].key, j, data)]).data = d; - } - } - for (i = 0, oz = array(order(sz)); i < n; ++i) { - sz[oz[i]].index = i; - } - offset(sz, oz); - return sz; - } - stack2.keys = function(_) { - return arguments.length ? (keys = typeof _ === "function" ? _ : constant(Array.from(_)), stack2) : keys; - }; - stack2.value = function(_) { - return arguments.length ? (value = typeof _ === "function" ? _ : constant(+_), stack2) : value; - }; - stack2.order = function(_) { - return arguments.length ? (order = _ == null ? none$1 : typeof _ === "function" ? _ : constant(Array.from(_)), stack2) : order; - }; - stack2.offset = function(_) { - return arguments.length ? (offset = _ == null ? none : _, stack2) : offset; - }; - return stack2; -} -function expand(series, order) { - if (!((n = series.length) > 0)) - return; - for (var i, n, j = 0, m = series[0].length, y2; j < m; ++j) { - for (y2 = i = 0; i < n; ++i) - y2 += series[i][j][1] || 0; - if (y2) - for (i = 0; i < n; ++i) - series[i][j][1] /= y2; - } - none(series, order); -} -function diverging(series, order) { - if (!((n = series.length) > 0)) - return; - for (var i, j = 0, d, dy, yp, yn, n, m = series[order[0]].length; j < m; ++j) { - for (yp = yn = 0, i = 0; i < n; ++i) { - if ((dy = (d = series[order[i]][j])[1] - d[0]) > 0) { - d[0] = yp, d[1] = yp += dy; - } else if (dy < 0) { - d[1] = yn, d[0] = yn += dy; - } else { - d[0] = 0, d[1] = dy; - } - } - } -} -function silhouette(series, order) { - if (!((n = series.length) > 0)) - return; - for (var j = 0, s0 = series[order[0]], n, m = s0.length; j < m; ++j) { - for (var i = 0, y2 = 0; i < n; ++i) - y2 += series[i][j][1] || 0; - s0[j][1] += s0[j][0] = -y2 / 2; - } - none(series, order); -} -function wiggle(series, order) { - if (!((n = series.length) > 0) || !((m = (s0 = series[order[0]]).length) > 0)) - return; - for (var y2 = 0, j = 1, s0, m, n; j < m; ++j) { - for (var i = 0, s1 = 0, s2 = 0; i < n; ++i) { - var si = series[order[i]], sij0 = si[j][1] || 0, sij1 = si[j - 1][1] || 0, s3 = (sij0 - sij1) / 2; - for (var k2 = 0; k2 < i; ++k2) { - var sk = series[order[k2]], skj0 = sk[j][1] || 0, skj1 = sk[j - 1][1] || 0; - s3 += skj0 - skj1; - } - s1 += sij0, s2 += s3 * sij0; - } - s0[j - 1][1] += s0[j - 1][0] = y2; - if (s1) - y2 -= s2 / s1; - } - s0[j - 1][1] += s0[j - 1][0] = y2; - none(series, order); -} -function appearance(series) { - var peaks = series.map(peak); - return none$1(series).sort(function(a2, b) { - return peaks[a2] - peaks[b]; - }); -} -function peak(series) { - var i = -1, j = 0, n = series.length, vi, vj = -Infinity; - while (++i < n) - if ((vi = +series[i][1]) > vj) - vj = vi, j = i; - return j; -} -function ascending(series) { - var sums = series.map(sum); - return none$1(series).sort(function(a2, b) { - return sums[a2] - sums[b]; - }); -} -function sum(series) { - var s2 = 0, i = -1, n = series.length, v; - while (++i < n) - if (v = +series[i][1]) - s2 += v; - return s2; -} -function descending$1(series) { - return ascending(series).reverse(); -} -function insideOut(series) { - var n = series.length, i, j, sums = series.map(sum), order = appearance(series), top = 0, bottom = 0, tops = [], bottoms = []; - for (i = 0; i < n; ++i) { - j = order[i]; - if (top < bottom) { - top += sums[j]; - tops.push(j); - } else { - bottom += sums[j]; - bottoms.push(j); - } - } - return bottoms.reverse().concat(tops); -} -function reverse(series) { - return none$1(series).reverse(); -} -export {arc, area, areaRadial, basis as curveBasis, basisClosed as curveBasisClosed, basisOpen as curveBasisOpen, bumpX as curveBumpX, bumpY as curveBumpY, bundle as curveBundle, cardinal as curveCardinal, cardinalClosed as curveCardinalClosed, cardinalOpen as curveCardinalOpen, catmullRom as curveCatmullRom, catmullRomClosed as curveCatmullRomClosed, catmullRomOpen as curveCatmullRomOpen, curveLinear, linearClosed as curveLinearClosed, monotoneX as curveMonotoneX, monotoneY as curveMonotoneY, natural as curveNatural, step as curveStep, stepAfter as curveStepAfter, stepBefore as curveStepBefore, line, lineRadial$1 as lineRadial, link, linkHorizontal, linkRadial, linkVertical, pie, pointRadial, areaRadial as radialArea, lineRadial$1 as radialLine, stack, diverging as stackOffsetDiverging, expand as stackOffsetExpand, none as stackOffsetNone, silhouette as stackOffsetSilhouette, wiggle as stackOffsetWiggle, appearance as stackOrderAppearance, ascending as stackOrderAscending, descending$1 as stackOrderDescending, insideOut as stackOrderInsideOut, none$1 as stackOrderNone, reverse as stackOrderReverse, Symbol as symbol, asterisk as symbolAsterisk, circle as symbolCircle, cross as symbolCross, diamond as symbolDiamond, diamond2 as symbolDiamond2, plus as symbolPlus, square as symbolSquare, square2 as symbolSquare2, star as symbolStar, triangle as symbolTriangle, triangle2 as symbolTriangle2, wye as symbolWye, x$1 as symbolX, symbolsFill as symbols, symbolsFill, symbolsStroke}; -export default null; diff --git a/web/client/deps/d3/d3-time-format.js b/web/client/deps/d3/d3-time-format.js deleted file mode 100644 index 496b370d..00000000 --- a/web/client/deps/d3/d3-time-format.js +++ /dev/null @@ -1,587 +0,0 @@ -import {utcMonday, utcDay, timeMonday, timeDay, utcYear, utcSunday, utcThursday, timeYear, timeSunday, timeThursday} from "./d3-time.js"; -function localDate(d) { - if (0 <= d.y && d.y < 100) { - var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L); - date.setFullYear(d.y); - return date; - } - return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L); -} -function utcDate(d) { - if (0 <= d.y && d.y < 100) { - var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L)); - date.setUTCFullYear(d.y); - return date; - } - return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L)); -} -function newDate(y, m, d) { - return {y, m, d, H: 0, M: 0, S: 0, L: 0}; -} -function formatLocale(locale2) { - var locale_dateTime = locale2.dateTime, locale_date = locale2.date, locale_time = locale2.time, locale_periods = locale2.periods, locale_weekdays = locale2.days, locale_shortWeekdays = locale2.shortDays, locale_months = locale2.months, locale_shortMonths = locale2.shortMonths; - var periodRe = formatRe(locale_periods), periodLookup = formatLookup(locale_periods), weekdayRe = formatRe(locale_weekdays), weekdayLookup = formatLookup(locale_weekdays), shortWeekdayRe = formatRe(locale_shortWeekdays), shortWeekdayLookup = formatLookup(locale_shortWeekdays), monthRe = formatRe(locale_months), monthLookup = formatLookup(locale_months), shortMonthRe = formatRe(locale_shortMonths), shortMonthLookup = formatLookup(locale_shortMonths); - var formats = { - a: formatShortWeekday, - A: formatWeekday, - b: formatShortMonth, - B: formatMonth, - c: null, - d: formatDayOfMonth, - e: formatDayOfMonth, - f: formatMicroseconds, - g: formatYearISO, - G: formatFullYearISO, - H: formatHour24, - I: formatHour12, - j: formatDayOfYear, - L: formatMilliseconds, - m: formatMonthNumber, - M: formatMinutes, - p: formatPeriod, - q: formatQuarter, - Q: formatUnixTimestamp, - s: formatUnixTimestampSeconds, - S: formatSeconds, - u: formatWeekdayNumberMonday, - U: formatWeekNumberSunday, - V: formatWeekNumberISO, - w: formatWeekdayNumberSunday, - W: formatWeekNumberMonday, - x: null, - X: null, - y: formatYear, - Y: formatFullYear, - Z: formatZone, - "%": formatLiteralPercent - }; - var utcFormats = { - a: formatUTCShortWeekday, - A: formatUTCWeekday, - b: formatUTCShortMonth, - B: formatUTCMonth, - c: null, - d: formatUTCDayOfMonth, - e: formatUTCDayOfMonth, - f: formatUTCMicroseconds, - g: formatUTCYearISO, - G: formatUTCFullYearISO, - H: formatUTCHour24, - I: formatUTCHour12, - j: formatUTCDayOfYear, - L: formatUTCMilliseconds, - m: formatUTCMonthNumber, - M: formatUTCMinutes, - p: formatUTCPeriod, - q: formatUTCQuarter, - Q: formatUnixTimestamp, - s: formatUnixTimestampSeconds, - S: formatUTCSeconds, - u: formatUTCWeekdayNumberMonday, - U: formatUTCWeekNumberSunday, - V: formatUTCWeekNumberISO, - w: formatUTCWeekdayNumberSunday, - W: formatUTCWeekNumberMonday, - x: null, - X: null, - y: formatUTCYear, - Y: formatUTCFullYear, - Z: formatUTCZone, - "%": formatLiteralPercent - }; - var parses = { - a: parseShortWeekday, - A: parseWeekday, - b: parseShortMonth, - B: parseMonth, - c: parseLocaleDateTime, - d: parseDayOfMonth, - e: parseDayOfMonth, - f: parseMicroseconds, - g: parseYear, - G: parseFullYear, - H: parseHour24, - I: parseHour24, - j: parseDayOfYear, - L: parseMilliseconds, - m: parseMonthNumber, - M: parseMinutes, - p: parsePeriod, - q: parseQuarter, - Q: parseUnixTimestamp, - s: parseUnixTimestampSeconds, - S: parseSeconds, - u: parseWeekdayNumberMonday, - U: parseWeekNumberSunday, - V: parseWeekNumberISO, - w: parseWeekdayNumberSunday, - W: parseWeekNumberMonday, - x: parseLocaleDate, - X: parseLocaleTime, - y: parseYear, - Y: parseFullYear, - Z: parseZone, - "%": parseLiteralPercent - }; - formats.x = newFormat(locale_date, formats); - formats.X = newFormat(locale_time, formats); - formats.c = newFormat(locale_dateTime, formats); - utcFormats.x = newFormat(locale_date, utcFormats); - utcFormats.X = newFormat(locale_time, utcFormats); - utcFormats.c = newFormat(locale_dateTime, utcFormats); - function newFormat(specifier, formats2) { - return function(date) { - var string = [], i = -1, j = 0, n = specifier.length, c, pad2, format; - if (!(date instanceof Date)) - date = new Date(+date); - while (++i < n) { - if (specifier.charCodeAt(i) === 37) { - string.push(specifier.slice(j, i)); - if ((pad2 = pads[c = specifier.charAt(++i)]) != null) - c = specifier.charAt(++i); - else - pad2 = c === "e" ? " " : "0"; - if (format = formats2[c]) - c = format(date, pad2); - string.push(c); - j = i + 1; - } - } - string.push(specifier.slice(j, i)); - return string.join(""); - }; - } - function newParse(specifier, Z) { - return function(string) { - var d = newDate(1900, void 0, 1), i = parseSpecifier(d, specifier, string += "", 0), week, day; - if (i != string.length) - return null; - if ("Q" in d) - return new Date(d.Q); - if ("s" in d) - return new Date(d.s * 1e3 + ("L" in d ? d.L : 0)); - if (Z && !("Z" in d)) - d.Z = 0; - if ("p" in d) - d.H = d.H % 12 + d.p * 12; - if (d.m === void 0) - d.m = "q" in d ? d.q : 0; - if ("V" in d) { - if (d.V < 1 || d.V > 53) - return null; - if (!("w" in d)) - d.w = 1; - if ("Z" in d) { - week = utcDate(newDate(d.y, 0, 1)), day = week.getUTCDay(); - week = day > 4 || day === 0 ? utcMonday.ceil(week) : utcMonday(week); - week = utcDay.offset(week, (d.V - 1) * 7); - d.y = week.getUTCFullYear(); - d.m = week.getUTCMonth(); - d.d = week.getUTCDate() + (d.w + 6) % 7; - } else { - week = localDate(newDate(d.y, 0, 1)), day = week.getDay(); - week = day > 4 || day === 0 ? timeMonday.ceil(week) : timeMonday(week); - week = timeDay.offset(week, (d.V - 1) * 7); - d.y = week.getFullYear(); - d.m = week.getMonth(); - d.d = week.getDate() + (d.w + 6) % 7; - } - } else if ("W" in d || "U" in d) { - if (!("w" in d)) - d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0; - day = "Z" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay(); - d.m = 0; - d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7; - } - if ("Z" in d) { - d.H += d.Z / 100 | 0; - d.M += d.Z % 100; - return utcDate(d); - } - return localDate(d); - }; - } - function parseSpecifier(d, specifier, string, j) { - var i = 0, n = specifier.length, m = string.length, c, parse; - while (i < n) { - if (j >= m) - return -1; - c = specifier.charCodeAt(i++); - if (c === 37) { - c = specifier.charAt(i++); - parse = parses[c in pads ? specifier.charAt(i++) : c]; - if (!parse || (j = parse(d, string, j)) < 0) - return -1; - } else if (c != string.charCodeAt(j++)) { - return -1; - } - } - return j; - } - function parsePeriod(d, string, i) { - var n = periodRe.exec(string.slice(i)); - return n ? (d.p = periodLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; - } - function parseShortWeekday(d, string, i) { - var n = shortWeekdayRe.exec(string.slice(i)); - return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; - } - function parseWeekday(d, string, i) { - var n = weekdayRe.exec(string.slice(i)); - return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; - } - function parseShortMonth(d, string, i) { - var n = shortMonthRe.exec(string.slice(i)); - return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; - } - function parseMonth(d, string, i) { - var n = monthRe.exec(string.slice(i)); - return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; - } - function parseLocaleDateTime(d, string, i) { - return parseSpecifier(d, locale_dateTime, string, i); - } - function parseLocaleDate(d, string, i) { - return parseSpecifier(d, locale_date, string, i); - } - function parseLocaleTime(d, string, i) { - return parseSpecifier(d, locale_time, string, i); - } - function formatShortWeekday(d) { - return locale_shortWeekdays[d.getDay()]; - } - function formatWeekday(d) { - return locale_weekdays[d.getDay()]; - } - function formatShortMonth(d) { - return locale_shortMonths[d.getMonth()]; - } - function formatMonth(d) { - return locale_months[d.getMonth()]; - } - function formatPeriod(d) { - return locale_periods[+(d.getHours() >= 12)]; - } - function formatQuarter(d) { - return 1 + ~~(d.getMonth() / 3); - } - function formatUTCShortWeekday(d) { - return locale_shortWeekdays[d.getUTCDay()]; - } - function formatUTCWeekday(d) { - return locale_weekdays[d.getUTCDay()]; - } - function formatUTCShortMonth(d) { - return locale_shortMonths[d.getUTCMonth()]; - } - function formatUTCMonth(d) { - return locale_months[d.getUTCMonth()]; - } - function formatUTCPeriod(d) { - return locale_periods[+(d.getUTCHours() >= 12)]; - } - function formatUTCQuarter(d) { - return 1 + ~~(d.getUTCMonth() / 3); - } - return { - format: function(specifier) { - var f = newFormat(specifier += "", formats); - f.toString = function() { - return specifier; - }; - return f; - }, - parse: function(specifier) { - var p = newParse(specifier += "", false); - p.toString = function() { - return specifier; - }; - return p; - }, - utcFormat: function(specifier) { - var f = newFormat(specifier += "", utcFormats); - f.toString = function() { - return specifier; - }; - return f; - }, - utcParse: function(specifier) { - var p = newParse(specifier += "", true); - p.toString = function() { - return specifier; - }; - return p; - } - }; -} -var pads = {"-": "", _: " ", "0": "0"}, numberRe = /^\s*\d+/, percentRe = /^%/, requoteRe = /[\\^$*+?|[\]().{}]/g; -function pad(value, fill, width) { - var sign = value < 0 ? "-" : "", string = (sign ? -value : value) + "", length = string.length; - return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string); -} -function requote(s) { - return s.replace(requoteRe, "\\$&"); -} -function formatRe(names) { - return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i"); -} -function formatLookup(names) { - return new Map(names.map((name, i) => [name.toLowerCase(), i])); -} -function parseWeekdayNumberSunday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 1)); - return n ? (d.w = +n[0], i + n[0].length) : -1; -} -function parseWeekdayNumberMonday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 1)); - return n ? (d.u = +n[0], i + n[0].length) : -1; -} -function parseWeekNumberSunday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.U = +n[0], i + n[0].length) : -1; -} -function parseWeekNumberISO(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.V = +n[0], i + n[0].length) : -1; -} -function parseWeekNumberMonday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.W = +n[0], i + n[0].length) : -1; -} -function parseFullYear(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 4)); - return n ? (d.y = +n[0], i + n[0].length) : -1; -} -function parseYear(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2e3), i + n[0].length) : -1; -} -function parseZone(d, string, i) { - var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6)); - return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1; -} -function parseQuarter(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 1)); - return n ? (d.q = n[0] * 3 - 3, i + n[0].length) : -1; -} -function parseMonthNumber(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.m = n[0] - 1, i + n[0].length) : -1; -} -function parseDayOfMonth(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.d = +n[0], i + n[0].length) : -1; -} -function parseDayOfYear(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 3)); - return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1; -} -function parseHour24(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.H = +n[0], i + n[0].length) : -1; -} -function parseMinutes(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.M = +n[0], i + n[0].length) : -1; -} -function parseSeconds(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.S = +n[0], i + n[0].length) : -1; -} -function parseMilliseconds(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 3)); - return n ? (d.L = +n[0], i + n[0].length) : -1; -} -function parseMicroseconds(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 6)); - return n ? (d.L = Math.floor(n[0] / 1e3), i + n[0].length) : -1; -} -function parseLiteralPercent(d, string, i) { - var n = percentRe.exec(string.slice(i, i + 1)); - return n ? i + n[0].length : -1; -} -function parseUnixTimestamp(d, string, i) { - var n = numberRe.exec(string.slice(i)); - return n ? (d.Q = +n[0], i + n[0].length) : -1; -} -function parseUnixTimestampSeconds(d, string, i) { - var n = numberRe.exec(string.slice(i)); - return n ? (d.s = +n[0], i + n[0].length) : -1; -} -function formatDayOfMonth(d, p) { - return pad(d.getDate(), p, 2); -} -function formatHour24(d, p) { - return pad(d.getHours(), p, 2); -} -function formatHour12(d, p) { - return pad(d.getHours() % 12 || 12, p, 2); -} -function formatDayOfYear(d, p) { - return pad(1 + timeDay.count(timeYear(d), d), p, 3); -} -function formatMilliseconds(d, p) { - return pad(d.getMilliseconds(), p, 3); -} -function formatMicroseconds(d, p) { - return formatMilliseconds(d, p) + "000"; -} -function formatMonthNumber(d, p) { - return pad(d.getMonth() + 1, p, 2); -} -function formatMinutes(d, p) { - return pad(d.getMinutes(), p, 2); -} -function formatSeconds(d, p) { - return pad(d.getSeconds(), p, 2); -} -function formatWeekdayNumberMonday(d) { - var day = d.getDay(); - return day === 0 ? 7 : day; -} -function formatWeekNumberSunday(d, p) { - return pad(timeSunday.count(timeYear(d) - 1, d), p, 2); -} -function dISO(d) { - var day = d.getDay(); - return day >= 4 || day === 0 ? timeThursday(d) : timeThursday.ceil(d); -} -function formatWeekNumberISO(d, p) { - d = dISO(d); - return pad(timeThursday.count(timeYear(d), d) + (timeYear(d).getDay() === 4), p, 2); -} -function formatWeekdayNumberSunday(d) { - return d.getDay(); -} -function formatWeekNumberMonday(d, p) { - return pad(timeMonday.count(timeYear(d) - 1, d), p, 2); -} -function formatYear(d, p) { - return pad(d.getFullYear() % 100, p, 2); -} -function formatYearISO(d, p) { - d = dISO(d); - return pad(d.getFullYear() % 100, p, 2); -} -function formatFullYear(d, p) { - return pad(d.getFullYear() % 1e4, p, 4); -} -function formatFullYearISO(d, p) { - var day = d.getDay(); - d = day >= 4 || day === 0 ? timeThursday(d) : timeThursday.ceil(d); - return pad(d.getFullYear() % 1e4, p, 4); -} -function formatZone(d) { - var z = d.getTimezoneOffset(); - return (z > 0 ? "-" : (z *= -1, "+")) + pad(z / 60 | 0, "0", 2) + pad(z % 60, "0", 2); -} -function formatUTCDayOfMonth(d, p) { - return pad(d.getUTCDate(), p, 2); -} -function formatUTCHour24(d, p) { - return pad(d.getUTCHours(), p, 2); -} -function formatUTCHour12(d, p) { - return pad(d.getUTCHours() % 12 || 12, p, 2); -} -function formatUTCDayOfYear(d, p) { - return pad(1 + utcDay.count(utcYear(d), d), p, 3); -} -function formatUTCMilliseconds(d, p) { - return pad(d.getUTCMilliseconds(), p, 3); -} -function formatUTCMicroseconds(d, p) { - return formatUTCMilliseconds(d, p) + "000"; -} -function formatUTCMonthNumber(d, p) { - return pad(d.getUTCMonth() + 1, p, 2); -} -function formatUTCMinutes(d, p) { - return pad(d.getUTCMinutes(), p, 2); -} -function formatUTCSeconds(d, p) { - return pad(d.getUTCSeconds(), p, 2); -} -function formatUTCWeekdayNumberMonday(d) { - var dow = d.getUTCDay(); - return dow === 0 ? 7 : dow; -} -function formatUTCWeekNumberSunday(d, p) { - return pad(utcSunday.count(utcYear(d) - 1, d), p, 2); -} -function UTCdISO(d) { - var day = d.getUTCDay(); - return day >= 4 || day === 0 ? utcThursday(d) : utcThursday.ceil(d); -} -function formatUTCWeekNumberISO(d, p) { - d = UTCdISO(d); - return pad(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() === 4), p, 2); -} -function formatUTCWeekdayNumberSunday(d) { - return d.getUTCDay(); -} -function formatUTCWeekNumberMonday(d, p) { - return pad(utcMonday.count(utcYear(d) - 1, d), p, 2); -} -function formatUTCYear(d, p) { - return pad(d.getUTCFullYear() % 100, p, 2); -} -function formatUTCYearISO(d, p) { - d = UTCdISO(d); - return pad(d.getUTCFullYear() % 100, p, 2); -} -function formatUTCFullYear(d, p) { - return pad(d.getUTCFullYear() % 1e4, p, 4); -} -function formatUTCFullYearISO(d, p) { - var day = d.getUTCDay(); - d = day >= 4 || day === 0 ? utcThursday(d) : utcThursday.ceil(d); - return pad(d.getUTCFullYear() % 1e4, p, 4); -} -function formatUTCZone() { - return "+0000"; -} -function formatLiteralPercent() { - return "%"; -} -function formatUnixTimestamp(d) { - return +d; -} -function formatUnixTimestampSeconds(d) { - return Math.floor(+d / 1e3); -} -var locale; -var timeFormat; -var timeParse; -var utcFormat; -var utcParse; -defaultLocale({ - dateTime: "%x, %X", - date: "%-m/%-d/%Y", - time: "%-I:%M:%S %p", - periods: ["AM", "PM"], - days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], - shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], - months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], - shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] -}); -function defaultLocale(definition) { - locale = formatLocale(definition); - timeFormat = locale.format; - timeParse = locale.parse; - utcFormat = locale.utcFormat; - utcParse = locale.utcParse; - return locale; -} -var isoSpecifier = "%Y-%m-%dT%H:%M:%S.%LZ"; -function formatIsoNative(date) { - return date.toISOString(); -} -var formatIso = Date.prototype.toISOString ? formatIsoNative : utcFormat(isoSpecifier); -function parseIsoNative(string) { - var date = new Date(string); - return isNaN(date) ? null : date; -} -var parseIso = +new Date("2000-01-01T00:00:00.000Z") ? parseIsoNative : utcParse(isoSpecifier); -export {formatIso as isoFormat, parseIso as isoParse, timeFormat, defaultLocale as timeFormatDefaultLocale, formatLocale as timeFormatLocale, timeParse, utcFormat, utcParse}; -export default null; diff --git a/web/client/deps/d3/d3-time.js b/web/client/deps/d3/d3-time.js deleted file mode 100644 index ae6bd604..00000000 --- a/web/client/deps/d3/d3-time.js +++ /dev/null @@ -1,312 +0,0 @@ -import {bisector, tickStep} from "./d3-array.js"; -var t0 = new Date(), t1 = new Date(); -function newInterval(floori, offseti, count, field) { - function interval(date) { - return floori(date = arguments.length === 0 ? new Date() : new Date(+date)), date; - } - interval.floor = function(date) { - return floori(date = new Date(+date)), date; - }; - interval.ceil = function(date) { - return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date; - }; - interval.round = function(date) { - var d0 = interval(date), d1 = interval.ceil(date); - return date - d0 < d1 - date ? d0 : d1; - }; - interval.offset = function(date, step) { - return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date; - }; - interval.range = function(start, stop, step) { - var range = [], previous; - start = interval.ceil(start); - step = step == null ? 1 : Math.floor(step); - if (!(start < stop) || !(step > 0)) - return range; - do - range.push(previous = new Date(+start)), offseti(start, step), floori(start); - while (previous < start && start < stop); - return range; - }; - interval.filter = function(test) { - return newInterval(function(date) { - if (date >= date) - while (floori(date), !test(date)) - date.setTime(date - 1); - }, function(date, step) { - if (date >= date) { - if (step < 0) - while (++step <= 0) { - while (offseti(date, -1), !test(date)) { - } - } - else - while (--step >= 0) { - while (offseti(date, 1), !test(date)) { - } - } - } - }); - }; - if (count) { - interval.count = function(start, end) { - t0.setTime(+start), t1.setTime(+end); - floori(t0), floori(t1); - return Math.floor(count(t0, t1)); - }; - interval.every = function(step) { - step = Math.floor(step); - return !isFinite(step) || !(step > 0) ? null : !(step > 1) ? interval : interval.filter(field ? function(d) { - return field(d) % step === 0; - } : function(d) { - return interval.count(0, d) % step === 0; - }); - }; - } - return interval; -} -var millisecond = newInterval(function() { -}, function(date, step) { - date.setTime(+date + step); -}, function(start, end) { - return end - start; -}); -millisecond.every = function(k) { - k = Math.floor(k); - if (!isFinite(k) || !(k > 0)) - return null; - if (!(k > 1)) - return millisecond; - return newInterval(function(date) { - date.setTime(Math.floor(date / k) * k); - }, function(date, step) { - date.setTime(+date + step * k); - }, function(start, end) { - return (end - start) / k; - }); -}; -var milliseconds = millisecond.range; -const durationSecond = 1e3; -const durationMinute = durationSecond * 60; -const durationHour = durationMinute * 60; -const durationDay = durationHour * 24; -const durationWeek = durationDay * 7; -const durationMonth = durationDay * 30; -const durationYear = durationDay * 365; -var second = newInterval(function(date) { - date.setTime(date - date.getMilliseconds()); -}, function(date, step) { - date.setTime(+date + step * durationSecond); -}, function(start, end) { - return (end - start) / durationSecond; -}, function(date) { - return date.getUTCSeconds(); -}); -var seconds = second.range; -var minute = newInterval(function(date) { - date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond); -}, function(date, step) { - date.setTime(+date + step * durationMinute); -}, function(start, end) { - return (end - start) / durationMinute; -}, function(date) { - return date.getMinutes(); -}); -var minutes = minute.range; -var hour = newInterval(function(date) { - date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond - date.getMinutes() * durationMinute); -}, function(date, step) { - date.setTime(+date + step * durationHour); -}, function(start, end) { - return (end - start) / durationHour; -}, function(date) { - return date.getHours(); -}); -var hours = hour.range; -var day = newInterval((date) => date.setHours(0, 0, 0, 0), (date, step) => date.setDate(date.getDate() + step), (start, end) => (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay, (date) => date.getDate() - 1); -var days = day.range; -function weekday(i) { - return newInterval(function(date) { - date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7); - date.setHours(0, 0, 0, 0); - }, function(date, step) { - date.setDate(date.getDate() + step * 7); - }, function(start, end) { - return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek; - }); -} -var sunday = weekday(0); -var monday = weekday(1); -var tuesday = weekday(2); -var wednesday = weekday(3); -var thursday = weekday(4); -var friday = weekday(5); -var saturday = weekday(6); -var sundays = sunday.range; -var mondays = monday.range; -var tuesdays = tuesday.range; -var wednesdays = wednesday.range; -var thursdays = thursday.range; -var fridays = friday.range; -var saturdays = saturday.range; -var month = newInterval(function(date) { - date.setDate(1); - date.setHours(0, 0, 0, 0); -}, function(date, step) { - date.setMonth(date.getMonth() + step); -}, function(start, end) { - return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12; -}, function(date) { - return date.getMonth(); -}); -var months = month.range; -var year = newInterval(function(date) { - date.setMonth(0, 1); - date.setHours(0, 0, 0, 0); -}, function(date, step) { - date.setFullYear(date.getFullYear() + step); -}, function(start, end) { - return end.getFullYear() - start.getFullYear(); -}, function(date) { - return date.getFullYear(); -}); -year.every = function(k) { - return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) { - date.setFullYear(Math.floor(date.getFullYear() / k) * k); - date.setMonth(0, 1); - date.setHours(0, 0, 0, 0); - }, function(date, step) { - date.setFullYear(date.getFullYear() + step * k); - }); -}; -var years = year.range; -var utcMinute = newInterval(function(date) { - date.setUTCSeconds(0, 0); -}, function(date, step) { - date.setTime(+date + step * durationMinute); -}, function(start, end) { - return (end - start) / durationMinute; -}, function(date) { - return date.getUTCMinutes(); -}); -var utcMinutes = utcMinute.range; -var utcHour = newInterval(function(date) { - date.setUTCMinutes(0, 0, 0); -}, function(date, step) { - date.setTime(+date + step * durationHour); -}, function(start, end) { - return (end - start) / durationHour; -}, function(date) { - return date.getUTCHours(); -}); -var utcHours = utcHour.range; -var utcDay = newInterval(function(date) { - date.setUTCHours(0, 0, 0, 0); -}, function(date, step) { - date.setUTCDate(date.getUTCDate() + step); -}, function(start, end) { - return (end - start) / durationDay; -}, function(date) { - return date.getUTCDate() - 1; -}); -var utcDays = utcDay.range; -function utcWeekday(i) { - return newInterval(function(date) { - date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7); - date.setUTCHours(0, 0, 0, 0); - }, function(date, step) { - date.setUTCDate(date.getUTCDate() + step * 7); - }, function(start, end) { - return (end - start) / durationWeek; - }); -} -var utcSunday = utcWeekday(0); -var utcMonday = utcWeekday(1); -var utcTuesday = utcWeekday(2); -var utcWednesday = utcWeekday(3); -var utcThursday = utcWeekday(4); -var utcFriday = utcWeekday(5); -var utcSaturday = utcWeekday(6); -var utcSundays = utcSunday.range; -var utcMondays = utcMonday.range; -var utcTuesdays = utcTuesday.range; -var utcWednesdays = utcWednesday.range; -var utcThursdays = utcThursday.range; -var utcFridays = utcFriday.range; -var utcSaturdays = utcSaturday.range; -var utcMonth = newInterval(function(date) { - date.setUTCDate(1); - date.setUTCHours(0, 0, 0, 0); -}, function(date, step) { - date.setUTCMonth(date.getUTCMonth() + step); -}, function(start, end) { - return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12; -}, function(date) { - return date.getUTCMonth(); -}); -var utcMonths = utcMonth.range; -var utcYear = newInterval(function(date) { - date.setUTCMonth(0, 1); - date.setUTCHours(0, 0, 0, 0); -}, function(date, step) { - date.setUTCFullYear(date.getUTCFullYear() + step); -}, function(start, end) { - return end.getUTCFullYear() - start.getUTCFullYear(); -}, function(date) { - return date.getUTCFullYear(); -}); -utcYear.every = function(k) { - return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) { - date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k); - date.setUTCMonth(0, 1); - date.setUTCHours(0, 0, 0, 0); - }, function(date, step) { - date.setUTCFullYear(date.getUTCFullYear() + step * k); - }); -}; -var utcYears = utcYear.range; -function ticker(year2, month2, week, day2, hour2, minute2) { - const tickIntervals = [ - [second, 1, durationSecond], - [second, 5, 5 * durationSecond], - [second, 15, 15 * durationSecond], - [second, 30, 30 * durationSecond], - [minute2, 1, durationMinute], - [minute2, 5, 5 * durationMinute], - [minute2, 15, 15 * durationMinute], - [minute2, 30, 30 * durationMinute], - [hour2, 1, durationHour], - [hour2, 3, 3 * durationHour], - [hour2, 6, 6 * durationHour], - [hour2, 12, 12 * durationHour], - [day2, 1, durationDay], - [day2, 2, 2 * durationDay], - [week, 1, durationWeek], - [month2, 1, durationMonth], - [month2, 3, 3 * durationMonth], - [year2, 1, durationYear] - ]; - function ticks(start, stop, count) { - const reverse = stop < start; - if (reverse) - [start, stop] = [stop, start]; - const interval = count && typeof count.range === "function" ? count : tickInterval(start, stop, count); - const ticks2 = interval ? interval.range(start, +stop + 1) : []; - return reverse ? ticks2.reverse() : ticks2; - } - function tickInterval(start, stop, count) { - const target = Math.abs(stop - start) / count; - const i = bisector(([, , step2]) => step2).right(tickIntervals, target); - if (i === tickIntervals.length) - return year2.every(tickStep(start / durationYear, stop / durationYear, count)); - if (i === 0) - return millisecond.every(Math.max(tickStep(start, stop, count), 1)); - const [t, step] = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i]; - return t.every(step); - } - return [ticks, tickInterval]; -} -const [utcTicks, utcTickInterval] = ticker(utcYear, utcMonth, utcSunday, utcDay, utcHour, utcMinute); -const [timeTicks, timeTickInterval] = ticker(year, month, sunday, day, hour, minute); -export {day as timeDay, days as timeDays, friday as timeFriday, fridays as timeFridays, hour as timeHour, hours as timeHours, newInterval as timeInterval, millisecond as timeMillisecond, milliseconds as timeMilliseconds, minute as timeMinute, minutes as timeMinutes, monday as timeMonday, mondays as timeMondays, month as timeMonth, months as timeMonths, saturday as timeSaturday, saturdays as timeSaturdays, second as timeSecond, seconds as timeSeconds, sunday as timeSunday, sundays as timeSundays, thursday as timeThursday, thursdays as timeThursdays, timeTickInterval, timeTicks, tuesday as timeTuesday, tuesdays as timeTuesdays, wednesday as timeWednesday, wednesdays as timeWednesdays, sunday as timeWeek, sundays as timeWeeks, year as timeYear, years as timeYears, utcDay, utcDays, utcFriday, utcFridays, utcHour, utcHours, millisecond as utcMillisecond, milliseconds as utcMilliseconds, utcMinute, utcMinutes, utcMonday, utcMondays, utcMonth, utcMonths, utcSaturday, utcSaturdays, second as utcSecond, seconds as utcSeconds, utcSunday, utcSundays, utcThursday, utcThursdays, utcTickInterval, utcTicks, utcTuesday, utcTuesdays, utcWednesday, utcWednesdays, utcSunday as utcWeek, utcSundays as utcWeeks, utcYear, utcYears}; -export default null; diff --git a/web/client/deps/d3/d3-timer.js b/web/client/deps/d3/d3-timer.js deleted file mode 100644 index cb1d2422..00000000 --- a/web/client/deps/d3/d3-timer.js +++ /dev/null @@ -1,128 +0,0 @@ -var frame = 0, timeout = 0, interval = 0, pokeDelay = 1e3, taskHead, taskTail, clockLast = 0, clockNow = 0, clockSkew = 0, clock = typeof performance === "object" && performance.now ? performance : Date, setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { - setTimeout(f, 17); -}; -function now() { - return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew); -} -function clearNow() { - clockNow = 0; -} -function Timer() { - this._call = this._time = this._next = null; -} -Timer.prototype = timer.prototype = { - constructor: Timer, - restart: function(callback, delay, time) { - if (typeof callback !== "function") - throw new TypeError("callback is not a function"); - time = (time == null ? now() : +time) + (delay == null ? 0 : +delay); - if (!this._next && taskTail !== this) { - if (taskTail) - taskTail._next = this; - else - taskHead = this; - taskTail = this; - } - this._call = callback; - this._time = time; - sleep(); - }, - stop: function() { - if (this._call) { - this._call = null; - this._time = Infinity; - sleep(); - } - } -}; -function timer(callback, delay, time) { - var t = new Timer(); - t.restart(callback, delay, time); - return t; -} -function timerFlush() { - now(); - ++frame; - var t = taskHead, e; - while (t) { - if ((e = clockNow - t._time) >= 0) - t._call.call(void 0, e); - t = t._next; - } - --frame; -} -function wake() { - clockNow = (clockLast = clock.now()) + clockSkew; - frame = timeout = 0; - try { - timerFlush(); - } finally { - frame = 0; - nap(); - clockNow = 0; - } -} -function poke() { - var now2 = clock.now(), delay = now2 - clockLast; - if (delay > pokeDelay) - clockSkew -= delay, clockLast = now2; -} -function nap() { - var t0, t1 = taskHead, t2, time = Infinity; - while (t1) { - if (t1._call) { - if (time > t1._time) - time = t1._time; - t0 = t1, t1 = t1._next; - } else { - t2 = t1._next, t1._next = null; - t1 = t0 ? t0._next = t2 : taskHead = t2; - } - } - taskTail = t0; - sleep(time); -} -function sleep(time) { - if (frame) - return; - if (timeout) - timeout = clearTimeout(timeout); - var delay = time - clockNow; - if (delay > 24) { - if (time < Infinity) - timeout = setTimeout(wake, time - clock.now() - clockSkew); - if (interval) - interval = clearInterval(interval); - } else { - if (!interval) - clockLast = clock.now(), interval = setInterval(poke, pokeDelay); - frame = 1, setFrame(wake); - } -} -function timeout$1(callback, delay, time) { - var t = new Timer(); - delay = delay == null ? 0 : +delay; - t.restart((elapsed) => { - t.stop(); - callback(elapsed + delay); - }, delay, time); - return t; -} -function interval$1(callback, delay, time) { - var t = new Timer(), total = delay; - if (delay == null) - return t.restart(callback, delay, time), t; - t._restart = t.restart; - t.restart = function(callback2, delay2, time2) { - delay2 = +delay2, time2 = time2 == null ? now() : +time2; - t._restart(function tick(elapsed) { - elapsed += total; - t._restart(tick, total += delay2, time2); - callback2(elapsed); - }, delay2, time2); - }; - t.restart(callback, delay, time); - return t; -} -export {interval$1 as interval, now, timeout$1 as timeout, timer, timerFlush}; -export default null; diff --git a/web/client/deps/d3/d3-transition.js b/web/client/deps/d3/d3-transition.js deleted file mode 100644 index 65e9045e..00000000 --- a/web/client/deps/d3/d3-transition.js +++ /dev/null @@ -1,697 +0,0 @@ -import {namespace, matcher, selector, selectorAll, selection, style} from "./d3-selection.js"; -import {dispatch} from "./d3-dispatch.js"; -import {timer, timeout, now} from "./d3-timer.js"; -import {interpolateNumber, interpolateRgb, interpolateString, interpolateTransformSvg, interpolateTransformCss} from "./d3-interpolate.js"; -import {color} from "./d3-color.js"; -import {easeCubicInOut} from "./d3-ease.js"; -var emptyOn = dispatch("start", "end", "cancel", "interrupt"); -var emptyTween = []; -var CREATED = 0; -var SCHEDULED = 1; -var STARTING = 2; -var STARTED = 3; -var RUNNING = 4; -var ENDING = 5; -var ENDED = 6; -function schedule(node, name, id2, index, group, timing) { - var schedules = node.__transition; - if (!schedules) - node.__transition = {}; - else if (id2 in schedules) - return; - create(node, id2, { - name, - index, - group, - on: emptyOn, - tween: emptyTween, - time: timing.time, - delay: timing.delay, - duration: timing.duration, - ease: timing.ease, - timer: null, - state: CREATED - }); -} -function init(node, id2) { - var schedule2 = get(node, id2); - if (schedule2.state > CREATED) - throw new Error("too late; already scheduled"); - return schedule2; -} -function set(node, id2) { - var schedule2 = get(node, id2); - if (schedule2.state > STARTED) - throw new Error("too late; already running"); - return schedule2; -} -function get(node, id2) { - var schedule2 = node.__transition; - if (!schedule2 || !(schedule2 = schedule2[id2])) - throw new Error("transition not found"); - return schedule2; -} -function create(node, id2, self) { - var schedules = node.__transition, tween; - schedules[id2] = self; - self.timer = timer(schedule2, 0, self.time); - function schedule2(elapsed) { - self.state = SCHEDULED; - self.timer.restart(start2, self.delay, self.time); - if (self.delay <= elapsed) - start2(elapsed - self.delay); - } - function start2(elapsed) { - var i, j, n, o; - if (self.state !== SCHEDULED) - return stop(); - for (i in schedules) { - o = schedules[i]; - if (o.name !== self.name) - continue; - if (o.state === STARTED) - return timeout(start2); - if (o.state === RUNNING) { - o.state = ENDED; - o.timer.stop(); - o.on.call("interrupt", node, node.__data__, o.index, o.group); - delete schedules[i]; - } else if (+i < id2) { - o.state = ENDED; - o.timer.stop(); - o.on.call("cancel", node, node.__data__, o.index, o.group); - delete schedules[i]; - } - } - timeout(function() { - if (self.state === STARTED) { - self.state = RUNNING; - self.timer.restart(tick, self.delay, self.time); - tick(elapsed); - } - }); - self.state = STARTING; - self.on.call("start", node, node.__data__, self.index, self.group); - if (self.state !== STARTING) - return; - self.state = STARTED; - tween = new Array(n = self.tween.length); - for (i = 0, j = -1; i < n; ++i) { - if (o = self.tween[i].value.call(node, node.__data__, self.index, self.group)) { - tween[++j] = o; - } - } - tween.length = j + 1; - } - function tick(elapsed) { - var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.timer.restart(stop), self.state = ENDING, 1), i = -1, n = tween.length; - while (++i < n) { - tween[i].call(node, t); - } - if (self.state === ENDING) { - self.on.call("end", node, node.__data__, self.index, self.group); - stop(); - } - } - function stop() { - self.state = ENDED; - self.timer.stop(); - delete schedules[id2]; - for (var i in schedules) - return; - delete node.__transition; - } -} -function interrupt(node, name) { - var schedules = node.__transition, schedule2, active2, empty = true, i; - if (!schedules) - return; - name = name == null ? null : name + ""; - for (i in schedules) { - if ((schedule2 = schedules[i]).name !== name) { - empty = false; - continue; - } - active2 = schedule2.state > STARTING && schedule2.state < ENDING; - schedule2.state = ENDED; - schedule2.timer.stop(); - schedule2.on.call(active2 ? "interrupt" : "cancel", node, node.__data__, schedule2.index, schedule2.group); - delete schedules[i]; - } - if (empty) - delete node.__transition; -} -function selection_interrupt(name) { - return this.each(function() { - interrupt(this, name); - }); -} -function tweenRemove(id2, name) { - var tween0, tween1; - return function() { - var schedule2 = set(this, id2), tween = schedule2.tween; - if (tween !== tween0) { - tween1 = tween0 = tween; - for (var i = 0, n = tween1.length; i < n; ++i) { - if (tween1[i].name === name) { - tween1 = tween1.slice(); - tween1.splice(i, 1); - break; - } - } - } - schedule2.tween = tween1; - }; -} -function tweenFunction(id2, name, value) { - var tween0, tween1; - if (typeof value !== "function") - throw new Error(); - return function() { - var schedule2 = set(this, id2), tween = schedule2.tween; - if (tween !== tween0) { - tween1 = (tween0 = tween).slice(); - for (var t = {name, value}, i = 0, n = tween1.length; i < n; ++i) { - if (tween1[i].name === name) { - tween1[i] = t; - break; - } - } - if (i === n) - tween1.push(t); - } - schedule2.tween = tween1; - }; -} -function transition_tween(name, value) { - var id2 = this._id; - name += ""; - if (arguments.length < 2) { - var tween = get(this.node(), id2).tween; - for (var i = 0, n = tween.length, t; i < n; ++i) { - if ((t = tween[i]).name === name) { - return t.value; - } - } - return null; - } - return this.each((value == null ? tweenRemove : tweenFunction)(id2, name, value)); -} -function tweenValue(transition2, name, value) { - var id2 = transition2._id; - transition2.each(function() { - var schedule2 = set(this, id2); - (schedule2.value || (schedule2.value = {}))[name] = value.apply(this, arguments); - }); - return function(node) { - return get(node, id2).value[name]; - }; -} -function interpolate(a, b) { - var c; - return (typeof b === "number" ? interpolateNumber : b instanceof color ? interpolateRgb : (c = color(b)) ? (b = c, interpolateRgb) : interpolateString)(a, b); -} -function attrRemove(name) { - return function() { - this.removeAttribute(name); - }; -} -function attrRemoveNS(fullname) { - return function() { - this.removeAttributeNS(fullname.space, fullname.local); - }; -} -function attrConstant(name, interpolate2, value1) { - var string00, string1 = value1 + "", interpolate0; - return function() { - var string0 = this.getAttribute(name); - return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate2(string00 = string0, value1); - }; -} -function attrConstantNS(fullname, interpolate2, value1) { - var string00, string1 = value1 + "", interpolate0; - return function() { - var string0 = this.getAttributeNS(fullname.space, fullname.local); - return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate2(string00 = string0, value1); - }; -} -function attrFunction(name, interpolate2, value) { - var string00, string10, interpolate0; - return function() { - var string0, value1 = value(this), string1; - if (value1 == null) - return void this.removeAttribute(name); - string0 = this.getAttribute(name); - string1 = value1 + ""; - return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate2(string00 = string0, value1)); - }; -} -function attrFunctionNS(fullname, interpolate2, value) { - var string00, string10, interpolate0; - return function() { - var string0, value1 = value(this), string1; - if (value1 == null) - return void this.removeAttributeNS(fullname.space, fullname.local); - string0 = this.getAttributeNS(fullname.space, fullname.local); - string1 = value1 + ""; - return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate2(string00 = string0, value1)); - }; -} -function transition_attr(name, value) { - var fullname = namespace(name), i = fullname === "transform" ? interpolateTransformSvg : interpolate; - return this.attrTween(name, typeof value === "function" ? (fullname.local ? attrFunctionNS : attrFunction)(fullname, i, tweenValue(this, "attr." + name, value)) : value == null ? (fullname.local ? attrRemoveNS : attrRemove)(fullname) : (fullname.local ? attrConstantNS : attrConstant)(fullname, i, value)); -} -function attrInterpolate(name, i) { - return function(t) { - this.setAttribute(name, i.call(this, t)); - }; -} -function attrInterpolateNS(fullname, i) { - return function(t) { - this.setAttributeNS(fullname.space, fullname.local, i.call(this, t)); - }; -} -function attrTweenNS(fullname, value) { - var t0, i0; - function tween() { - var i = value.apply(this, arguments); - if (i !== i0) - t0 = (i0 = i) && attrInterpolateNS(fullname, i); - return t0; - } - tween._value = value; - return tween; -} -function attrTween(name, value) { - var t0, i0; - function tween() { - var i = value.apply(this, arguments); - if (i !== i0) - t0 = (i0 = i) && attrInterpolate(name, i); - return t0; - } - tween._value = value; - return tween; -} -function transition_attrTween(name, value) { - var key = "attr." + name; - if (arguments.length < 2) - return (key = this.tween(key)) && key._value; - if (value == null) - return this.tween(key, null); - if (typeof value !== "function") - throw new Error(); - var fullname = namespace(name); - return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value)); -} -function delayFunction(id2, value) { - return function() { - init(this, id2).delay = +value.apply(this, arguments); - }; -} -function delayConstant(id2, value) { - return value = +value, function() { - init(this, id2).delay = value; - }; -} -function transition_delay(value) { - var id2 = this._id; - return arguments.length ? this.each((typeof value === "function" ? delayFunction : delayConstant)(id2, value)) : get(this.node(), id2).delay; -} -function durationFunction(id2, value) { - return function() { - set(this, id2).duration = +value.apply(this, arguments); - }; -} -function durationConstant(id2, value) { - return value = +value, function() { - set(this, id2).duration = value; - }; -} -function transition_duration(value) { - var id2 = this._id; - return arguments.length ? this.each((typeof value === "function" ? durationFunction : durationConstant)(id2, value)) : get(this.node(), id2).duration; -} -function easeConstant(id2, value) { - if (typeof value !== "function") - throw new Error(); - return function() { - set(this, id2).ease = value; - }; -} -function transition_ease(value) { - var id2 = this._id; - return arguments.length ? this.each(easeConstant(id2, value)) : get(this.node(), id2).ease; -} -function easeVarying(id2, value) { - return function() { - var v = value.apply(this, arguments); - if (typeof v !== "function") - throw new Error(); - set(this, id2).ease = v; - }; -} -function transition_easeVarying(value) { - if (typeof value !== "function") - throw new Error(); - return this.each(easeVarying(this._id, value)); -} -function transition_filter(match) { - if (typeof match !== "function") - match = matcher(match); - for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) { - for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) { - if ((node = group[i]) && match.call(node, node.__data__, i, group)) { - subgroup.push(node); - } - } - } - return new Transition(subgroups, this._parents, this._name, this._id); -} -function transition_merge(transition2) { - if (transition2._id !== this._id) - throw new Error(); - for (var groups0 = this._groups, groups1 = transition2._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) { - for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) { - if (node = group0[i] || group1[i]) { - merge[i] = node; - } - } - } - for (; j < m0; ++j) { - merges[j] = groups0[j]; - } - return new Transition(merges, this._parents, this._name, this._id); -} -function start(name) { - return (name + "").trim().split(/^|\s+/).every(function(t) { - var i = t.indexOf("."); - if (i >= 0) - t = t.slice(0, i); - return !t || t === "start"; - }); -} -function onFunction(id2, name, listener) { - var on0, on1, sit = start(name) ? init : set; - return function() { - var schedule2 = sit(this, id2), on = schedule2.on; - if (on !== on0) - (on1 = (on0 = on).copy()).on(name, listener); - schedule2.on = on1; - }; -} -function transition_on(name, listener) { - var id2 = this._id; - return arguments.length < 2 ? get(this.node(), id2).on.on(name) : this.each(onFunction(id2, name, listener)); -} -function removeFunction(id2) { - return function() { - var parent = this.parentNode; - for (var i in this.__transition) - if (+i !== id2) - return; - if (parent) - parent.removeChild(this); - }; -} -function transition_remove() { - return this.on("end.remove", removeFunction(this._id)); -} -function transition_select(select) { - var name = this._name, id2 = this._id; - if (typeof select !== "function") - select = selector(select); - for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) { - for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) { - if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) { - if ("__data__" in node) - subnode.__data__ = node.__data__; - subgroup[i] = subnode; - schedule(subgroup[i], name, id2, i, subgroup, get(node, id2)); - } - } - } - return new Transition(subgroups, this._parents, name, id2); -} -function transition_selectAll(select) { - var name = this._name, id2 = this._id; - if (typeof select !== "function") - select = selectorAll(select); - for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) { - for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) { - if (node = group[i]) { - for (var children = select.call(node, node.__data__, i, group), child, inherit2 = get(node, id2), k = 0, l = children.length; k < l; ++k) { - if (child = children[k]) { - schedule(child, name, id2, k, children, inherit2); - } - } - subgroups.push(children); - parents.push(node); - } - } - } - return new Transition(subgroups, parents, name, id2); -} -var Selection = selection.prototype.constructor; -function transition_selection() { - return new Selection(this._groups, this._parents); -} -function styleNull(name, interpolate2) { - var string00, string10, interpolate0; - return function() { - var string0 = style(this, name), string1 = (this.style.removeProperty(name), style(this, name)); - return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : interpolate0 = interpolate2(string00 = string0, string10 = string1); - }; -} -function styleRemove(name) { - return function() { - this.style.removeProperty(name); - }; -} -function styleConstant(name, interpolate2, value1) { - var string00, string1 = value1 + "", interpolate0; - return function() { - var string0 = style(this, name); - return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate2(string00 = string0, value1); - }; -} -function styleFunction(name, interpolate2, value) { - var string00, string10, interpolate0; - return function() { - var string0 = style(this, name), value1 = value(this), string1 = value1 + ""; - if (value1 == null) - string1 = value1 = (this.style.removeProperty(name), style(this, name)); - return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate2(string00 = string0, value1)); - }; -} -function styleMaybeRemove(id2, name) { - var on0, on1, listener0, key = "style." + name, event = "end." + key, remove; - return function() { - var schedule2 = set(this, id2), on = schedule2.on, listener = schedule2.value[key] == null ? remove || (remove = styleRemove(name)) : void 0; - if (on !== on0 || listener0 !== listener) - (on1 = (on0 = on).copy()).on(event, listener0 = listener); - schedule2.on = on1; - }; -} -function transition_style(name, value, priority) { - var i = (name += "") === "transform" ? interpolateTransformCss : interpolate; - return value == null ? this.styleTween(name, styleNull(name, i)).on("end.style." + name, styleRemove(name)) : typeof value === "function" ? this.styleTween(name, styleFunction(name, i, tweenValue(this, "style." + name, value))).each(styleMaybeRemove(this._id, name)) : this.styleTween(name, styleConstant(name, i, value), priority).on("end.style." + name, null); -} -function styleInterpolate(name, i, priority) { - return function(t) { - this.style.setProperty(name, i.call(this, t), priority); - }; -} -function styleTween(name, value, priority) { - var t, i0; - function tween() { - var i = value.apply(this, arguments); - if (i !== i0) - t = (i0 = i) && styleInterpolate(name, i, priority); - return t; - } - tween._value = value; - return tween; -} -function transition_styleTween(name, value, priority) { - var key = "style." + (name += ""); - if (arguments.length < 2) - return (key = this.tween(key)) && key._value; - if (value == null) - return this.tween(key, null); - if (typeof value !== "function") - throw new Error(); - return this.tween(key, styleTween(name, value, priority == null ? "" : priority)); -} -function textConstant(value) { - return function() { - this.textContent = value; - }; -} -function textFunction(value) { - return function() { - var value1 = value(this); - this.textContent = value1 == null ? "" : value1; - }; -} -function transition_text(value) { - return this.tween("text", typeof value === "function" ? textFunction(tweenValue(this, "text", value)) : textConstant(value == null ? "" : value + "")); -} -function textInterpolate(i) { - return function(t) { - this.textContent = i.call(this, t); - }; -} -function textTween(value) { - var t0, i0; - function tween() { - var i = value.apply(this, arguments); - if (i !== i0) - t0 = (i0 = i) && textInterpolate(i); - return t0; - } - tween._value = value; - return tween; -} -function transition_textTween(value) { - var key = "text"; - if (arguments.length < 1) - return (key = this.tween(key)) && key._value; - if (value == null) - return this.tween(key, null); - if (typeof value !== "function") - throw new Error(); - return this.tween(key, textTween(value)); -} -function transition_transition() { - var name = this._name, id0 = this._id, id1 = newId(); - for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) { - for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) { - if (node = group[i]) { - var inherit2 = get(node, id0); - schedule(node, name, id1, i, group, { - time: inherit2.time + inherit2.delay + inherit2.duration, - delay: 0, - duration: inherit2.duration, - ease: inherit2.ease - }); - } - } - } - return new Transition(groups, this._parents, name, id1); -} -function transition_end() { - var on0, on1, that = this, id2 = that._id, size = that.size(); - return new Promise(function(resolve, reject) { - var cancel = {value: reject}, end = {value: function() { - if (--size === 0) - resolve(); - }}; - that.each(function() { - var schedule2 = set(this, id2), on = schedule2.on; - if (on !== on0) { - on1 = (on0 = on).copy(); - on1._.cancel.push(cancel); - on1._.interrupt.push(cancel); - on1._.end.push(end); - } - schedule2.on = on1; - }); - if (size === 0) - resolve(); - }); -} -var id = 0; -function Transition(groups, parents, name, id2) { - this._groups = groups; - this._parents = parents; - this._name = name; - this._id = id2; -} -function transition(name) { - return selection().transition(name); -} -function newId() { - return ++id; -} -var selection_prototype = selection.prototype; -Transition.prototype = transition.prototype = { - constructor: Transition, - select: transition_select, - selectAll: transition_selectAll, - selectChild: selection_prototype.selectChild, - selectChildren: selection_prototype.selectChildren, - filter: transition_filter, - merge: transition_merge, - selection: transition_selection, - transition: transition_transition, - call: selection_prototype.call, - nodes: selection_prototype.nodes, - node: selection_prototype.node, - size: selection_prototype.size, - empty: selection_prototype.empty, - each: selection_prototype.each, - on: transition_on, - attr: transition_attr, - attrTween: transition_attrTween, - style: transition_style, - styleTween: transition_styleTween, - text: transition_text, - textTween: transition_textTween, - remove: transition_remove, - tween: transition_tween, - delay: transition_delay, - duration: transition_duration, - ease: transition_ease, - easeVarying: transition_easeVarying, - end: transition_end, - [Symbol.iterator]: selection_prototype[Symbol.iterator] -}; -var defaultTiming = { - time: null, - delay: 0, - duration: 250, - ease: easeCubicInOut -}; -function inherit(node, id2) { - var timing; - while (!(timing = node.__transition) || !(timing = timing[id2])) { - if (!(node = node.parentNode)) { - throw new Error(`transition ${id2} not found`); - } - } - return timing; -} -function selection_transition(name) { - var id2, timing; - if (name instanceof Transition) { - id2 = name._id, name = name._name; - } else { - id2 = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + ""; - } - for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) { - for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) { - if (node = group[i]) { - schedule(node, name, id2, i, group, timing || inherit(node, id2)); - } - } - } - return new Transition(groups, this._parents, name, id2); -} -selection.prototype.interrupt = selection_interrupt; -selection.prototype.transition = selection_transition; -var root = [null]; -function active(node, name) { - var schedules = node.__transition, schedule2, i; - if (schedules) { - name = name == null ? null : name + ""; - for (i in schedules) { - if ((schedule2 = schedules[i]).state > SCHEDULED && schedule2.name === name) { - return new Transition([[node]], root, name, +i); - } - } - } - return null; -} -export {active, interrupt, transition}; -export default null; diff --git a/web/client/deps/d3/d3-zoom.js b/web/client/deps/d3/d3-zoom.js deleted file mode 100644 index 5c35d80d..00000000 --- a/web/client/deps/d3/d3-zoom.js +++ /dev/null @@ -1,405 +0,0 @@ -import {dispatch} from "./d3-dispatch.js"; -import {dragDisable, dragEnable} from "./d3-drag.js"; -import {interpolateZoom} from "./d3-interpolate.js"; -import {select, pointer} from "./d3-selection.js"; -import {interrupt} from "./d3-transition.js"; -var constant = (x) => () => x; -function ZoomEvent(type, { - sourceEvent, - target, - transform: transform2, - dispatch: dispatch2 -}) { - Object.defineProperties(this, { - type: {value: type, enumerable: true, configurable: true}, - sourceEvent: {value: sourceEvent, enumerable: true, configurable: true}, - target: {value: target, enumerable: true, configurable: true}, - transform: {value: transform2, enumerable: true, configurable: true}, - _: {value: dispatch2} - }); -} -function Transform(k, x, y) { - this.k = k; - this.x = x; - this.y = y; -} -Transform.prototype = { - constructor: Transform, - scale: function(k) { - return k === 1 ? this : new Transform(this.k * k, this.x, this.y); - }, - translate: function(x, y) { - return x === 0 & y === 0 ? this : new Transform(this.k, this.x + this.k * x, this.y + this.k * y); - }, - apply: function(point) { - return [point[0] * this.k + this.x, point[1] * this.k + this.y]; - }, - applyX: function(x) { - return x * this.k + this.x; - }, - applyY: function(y) { - return y * this.k + this.y; - }, - invert: function(location) { - return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k]; - }, - invertX: function(x) { - return (x - this.x) / this.k; - }, - invertY: function(y) { - return (y - this.y) / this.k; - }, - rescaleX: function(x) { - return x.copy().domain(x.range().map(this.invertX, this).map(x.invert, x)); - }, - rescaleY: function(y) { - return y.copy().domain(y.range().map(this.invertY, this).map(y.invert, y)); - }, - toString: function() { - return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")"; - } -}; -var identity = new Transform(1, 0, 0); -transform.prototype = Transform.prototype; -function transform(node) { - while (!node.__zoom) - if (!(node = node.parentNode)) - return identity; - return node.__zoom; -} -function nopropagation(event) { - event.stopImmediatePropagation(); -} -function noevent(event) { - event.preventDefault(); - event.stopImmediatePropagation(); -} -function defaultFilter(event) { - return (!event.ctrlKey || event.type === "wheel") && !event.button; -} -function defaultExtent() { - var e = this; - if (e instanceof SVGElement) { - e = e.ownerSVGElement || e; - if (e.hasAttribute("viewBox")) { - e = e.viewBox.baseVal; - return [[e.x, e.y], [e.x + e.width, e.y + e.height]]; - } - return [[0, 0], [e.width.baseVal.value, e.height.baseVal.value]]; - } - return [[0, 0], [e.clientWidth, e.clientHeight]]; -} -function defaultTransform() { - return this.__zoom || identity; -} -function defaultWheelDelta(event) { - return -event.deltaY * (event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 2e-3) * (event.ctrlKey ? 10 : 1); -} -function defaultTouchable() { - return navigator.maxTouchPoints || "ontouchstart" in this; -} -function defaultConstrain(transform2, extent, translateExtent) { - var dx0 = transform2.invertX(extent[0][0]) - translateExtent[0][0], dx1 = transform2.invertX(extent[1][0]) - translateExtent[1][0], dy0 = transform2.invertY(extent[0][1]) - translateExtent[0][1], dy1 = transform2.invertY(extent[1][1]) - translateExtent[1][1]; - return transform2.translate(dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1), dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)); -} -function zoom() { - var filter = defaultFilter, extent = defaultExtent, constrain = defaultConstrain, wheelDelta = defaultWheelDelta, touchable = defaultTouchable, scaleExtent = [0, Infinity], translateExtent = [[-Infinity, -Infinity], [Infinity, Infinity]], duration = 250, interpolate = interpolateZoom, listeners = dispatch("start", "zoom", "end"), touchstarting, touchfirst, touchending, touchDelay = 500, wheelDelay = 150, clickDistance2 = 0, tapDistance = 10; - function zoom2(selection) { - selection.property("__zoom", defaultTransform).on("wheel.zoom", wheeled, {passive: false}).on("mousedown.zoom", mousedowned).on("dblclick.zoom", dblclicked).filter(touchable).on("touchstart.zoom", touchstarted).on("touchmove.zoom", touchmoved).on("touchend.zoom touchcancel.zoom", touchended).style("-webkit-tap-highlight-color", "rgba(0,0,0,0)"); - } - zoom2.transform = function(collection, transform2, point, event) { - var selection = collection.selection ? collection.selection() : collection; - selection.property("__zoom", defaultTransform); - if (collection !== selection) { - schedule(collection, transform2, point, event); - } else { - selection.interrupt().each(function() { - gesture(this, arguments).event(event).start().zoom(null, typeof transform2 === "function" ? transform2.apply(this, arguments) : transform2).end(); - }); - } - }; - zoom2.scaleBy = function(selection, k, p, event) { - zoom2.scaleTo(selection, function() { - var k0 = this.__zoom.k, k1 = typeof k === "function" ? k.apply(this, arguments) : k; - return k0 * k1; - }, p, event); - }; - zoom2.scaleTo = function(selection, k, p, event) { - zoom2.transform(selection, function() { - var e = extent.apply(this, arguments), t0 = this.__zoom, p0 = p == null ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p, p1 = t0.invert(p0), k1 = typeof k === "function" ? k.apply(this, arguments) : k; - return constrain(translate(scale(t0, k1), p0, p1), e, translateExtent); - }, p, event); - }; - zoom2.translateBy = function(selection, x, y, event) { - zoom2.transform(selection, function() { - return constrain(this.__zoom.translate(typeof x === "function" ? x.apply(this, arguments) : x, typeof y === "function" ? y.apply(this, arguments) : y), extent.apply(this, arguments), translateExtent); - }, null, event); - }; - zoom2.translateTo = function(selection, x, y, p, event) { - zoom2.transform(selection, function() { - var e = extent.apply(this, arguments), t = this.__zoom, p0 = p == null ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p; - return constrain(identity.translate(p0[0], p0[1]).scale(t.k).translate(typeof x === "function" ? -x.apply(this, arguments) : -x, typeof y === "function" ? -y.apply(this, arguments) : -y), e, translateExtent); - }, p, event); - }; - function scale(transform2, k) { - k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k)); - return k === transform2.k ? transform2 : new Transform(k, transform2.x, transform2.y); - } - function translate(transform2, p0, p1) { - var x = p0[0] - p1[0] * transform2.k, y = p0[1] - p1[1] * transform2.k; - return x === transform2.x && y === transform2.y ? transform2 : new Transform(transform2.k, x, y); - } - function centroid(extent2) { - return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2]; - } - function schedule(transition, transform2, point, event) { - transition.on("start.zoom", function() { - gesture(this, arguments).event(event).start(); - }).on("interrupt.zoom end.zoom", function() { - gesture(this, arguments).event(event).end(); - }).tween("zoom", function() { - var that = this, args = arguments, g = gesture(that, args).event(event), e = extent.apply(that, args), p = point == null ? centroid(e) : typeof point === "function" ? point.apply(that, args) : point, w = Math.max(e[1][0] - e[0][0], e[1][1] - e[0][1]), a = that.__zoom, b = typeof transform2 === "function" ? transform2.apply(that, args) : transform2, i = interpolate(a.invert(p).concat(w / a.k), b.invert(p).concat(w / b.k)); - return function(t) { - if (t === 1) - t = b; - else { - var l = i(t), k = w / l[2]; - t = new Transform(k, p[0] - l[0] * k, p[1] - l[1] * k); - } - g.zoom(null, t); - }; - }); - } - function gesture(that, args, clean) { - return !clean && that.__zooming || new Gesture(that, args); - } - function Gesture(that, args) { - this.that = that; - this.args = args; - this.active = 0; - this.sourceEvent = null; - this.extent = extent.apply(that, args); - this.taps = 0; - } - Gesture.prototype = { - event: function(event) { - if (event) - this.sourceEvent = event; - return this; - }, - start: function() { - if (++this.active === 1) { - this.that.__zooming = this; - this.emit("start"); - } - return this; - }, - zoom: function(key, transform2) { - if (this.mouse && key !== "mouse") - this.mouse[1] = transform2.invert(this.mouse[0]); - if (this.touch0 && key !== "touch") - this.touch0[1] = transform2.invert(this.touch0[0]); - if (this.touch1 && key !== "touch") - this.touch1[1] = transform2.invert(this.touch1[0]); - this.that.__zoom = transform2; - this.emit("zoom"); - return this; - }, - end: function() { - if (--this.active === 0) { - delete this.that.__zooming; - this.emit("end"); - } - return this; - }, - emit: function(type) { - var d = select(this.that).datum(); - listeners.call(type, this.that, new ZoomEvent(type, { - sourceEvent: this.sourceEvent, - target: zoom2, - type, - transform: this.that.__zoom, - dispatch: listeners - }), d); - } - }; - function wheeled(event, ...args) { - if (!filter.apply(this, arguments)) - return; - var g = gesture(this, args).event(event), t = this.__zoom, k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t.k * Math.pow(2, wheelDelta.apply(this, arguments)))), p = pointer(event); - if (g.wheel) { - if (g.mouse[0][0] !== p[0] || g.mouse[0][1] !== p[1]) { - g.mouse[1] = t.invert(g.mouse[0] = p); - } - clearTimeout(g.wheel); - } else if (t.k === k) - return; - else { - g.mouse = [p, t.invert(p)]; - interrupt(this); - g.start(); - } - noevent(event); - g.wheel = setTimeout(wheelidled, wheelDelay); - g.zoom("mouse", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]), g.extent, translateExtent)); - function wheelidled() { - g.wheel = null; - g.end(); - } - } - function mousedowned(event, ...args) { - if (touchending || !filter.apply(this, arguments)) - return; - var currentTarget = event.currentTarget, g = gesture(this, args, true).event(event), v = select(event.view).on("mousemove.zoom", mousemoved, true).on("mouseup.zoom", mouseupped, true), p = pointer(event, currentTarget), x0 = event.clientX, y0 = event.clientY; - dragDisable(event.view); - nopropagation(event); - g.mouse = [p, this.__zoom.invert(p)]; - interrupt(this); - g.start(); - function mousemoved(event2) { - noevent(event2); - if (!g.moved) { - var dx = event2.clientX - x0, dy = event2.clientY - y0; - g.moved = dx * dx + dy * dy > clickDistance2; - } - g.event(event2).zoom("mouse", constrain(translate(g.that.__zoom, g.mouse[0] = pointer(event2, currentTarget), g.mouse[1]), g.extent, translateExtent)); - } - function mouseupped(event2) { - v.on("mousemove.zoom mouseup.zoom", null); - dragEnable(event2.view, g.moved); - noevent(event2); - g.event(event2).end(); - } - } - function dblclicked(event, ...args) { - if (!filter.apply(this, arguments)) - return; - var t0 = this.__zoom, p0 = pointer(event.changedTouches ? event.changedTouches[0] : event, this), p1 = t0.invert(p0), k1 = t0.k * (event.shiftKey ? 0.5 : 2), t1 = constrain(translate(scale(t0, k1), p0, p1), extent.apply(this, args), translateExtent); - noevent(event); - if (duration > 0) - select(this).transition().duration(duration).call(schedule, t1, p0, event); - else - select(this).call(zoom2.transform, t1, p0, event); - } - function touchstarted(event, ...args) { - if (!filter.apply(this, arguments)) - return; - var touches = event.touches, n = touches.length, g = gesture(this, args, event.changedTouches.length === n).event(event), started, i, t, p; - nopropagation(event); - for (i = 0; i < n; ++i) { - t = touches[i], p = pointer(t, this); - p = [p, this.__zoom.invert(p), t.identifier]; - if (!g.touch0) - g.touch0 = p, started = true, g.taps = 1 + !!touchstarting; - else if (!g.touch1 && g.touch0[2] !== p[2]) - g.touch1 = p, g.taps = 0; - } - if (touchstarting) - touchstarting = clearTimeout(touchstarting); - if (started) { - if (g.taps < 2) - touchfirst = p[0], touchstarting = setTimeout(function() { - touchstarting = null; - }, touchDelay); - interrupt(this); - g.start(); - } - } - function touchmoved(event, ...args) { - if (!this.__zooming) - return; - var g = gesture(this, args).event(event), touches = event.changedTouches, n = touches.length, i, t, p, l; - noevent(event); - for (i = 0; i < n; ++i) { - t = touches[i], p = pointer(t, this); - if (g.touch0 && g.touch0[2] === t.identifier) - g.touch0[0] = p; - else if (g.touch1 && g.touch1[2] === t.identifier) - g.touch1[0] = p; - } - t = g.that.__zoom; - if (g.touch1) { - var p0 = g.touch0[0], l0 = g.touch0[1], p1 = g.touch1[0], l1 = g.touch1[1], dp = (dp = p1[0] - p0[0]) * dp + (dp = p1[1] - p0[1]) * dp, dl = (dl = l1[0] - l0[0]) * dl + (dl = l1[1] - l0[1]) * dl; - t = scale(t, Math.sqrt(dp / dl)); - p = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2]; - l = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2]; - } else if (g.touch0) - p = g.touch0[0], l = g.touch0[1]; - else - return; - g.zoom("touch", constrain(translate(t, p, l), g.extent, translateExtent)); - } - function touchended(event, ...args) { - if (!this.__zooming) - return; - var g = gesture(this, args).event(event), touches = event.changedTouches, n = touches.length, i, t; - nopropagation(event); - if (touchending) - clearTimeout(touchending); - touchending = setTimeout(function() { - touchending = null; - }, touchDelay); - for (i = 0; i < n; ++i) { - t = touches[i]; - if (g.touch0 && g.touch0[2] === t.identifier) - delete g.touch0; - else if (g.touch1 && g.touch1[2] === t.identifier) - delete g.touch1; - } - if (g.touch1 && !g.touch0) - g.touch0 = g.touch1, delete g.touch1; - if (g.touch0) - g.touch0[1] = this.__zoom.invert(g.touch0[0]); - else { - g.end(); - if (g.taps === 2) { - t = pointer(t, this); - if (Math.hypot(touchfirst[0] - t[0], touchfirst[1] - t[1]) < tapDistance) { - var p = select(this).on("dblclick.zoom"); - if (p) - p.apply(this, arguments); - } - } - } - } - zoom2.wheelDelta = function(_) { - return arguments.length ? (wheelDelta = typeof _ === "function" ? _ : constant(+_), zoom2) : wheelDelta; - }; - zoom2.filter = function(_) { - return arguments.length ? (filter = typeof _ === "function" ? _ : constant(!!_), zoom2) : filter; - }; - zoom2.touchable = function(_) { - return arguments.length ? (touchable = typeof _ === "function" ? _ : constant(!!_), zoom2) : touchable; - }; - zoom2.extent = function(_) { - return arguments.length ? (extent = typeof _ === "function" ? _ : constant([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), zoom2) : extent; - }; - zoom2.scaleExtent = function(_) { - return arguments.length ? (scaleExtent[0] = +_[0], scaleExtent[1] = +_[1], zoom2) : [scaleExtent[0], scaleExtent[1]]; - }; - zoom2.translateExtent = function(_) { - return arguments.length ? (translateExtent[0][0] = +_[0][0], translateExtent[1][0] = +_[1][0], translateExtent[0][1] = +_[0][1], translateExtent[1][1] = +_[1][1], zoom2) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]]; - }; - zoom2.constrain = function(_) { - return arguments.length ? (constrain = _, zoom2) : constrain; - }; - zoom2.duration = function(_) { - return arguments.length ? (duration = +_, zoom2) : duration; - }; - zoom2.interpolate = function(_) { - return arguments.length ? (interpolate = _, zoom2) : interpolate; - }; - zoom2.on = function() { - var value = listeners.on.apply(listeners, arguments); - return value === listeners ? zoom2 : value; - }; - zoom2.clickDistance = function(_) { - return arguments.length ? (clickDistance2 = (_ = +_) * _, zoom2) : Math.sqrt(clickDistance2); - }; - zoom2.tapDistance = function(_) { - return arguments.length ? (tapDistance = +_, zoom2) : tapDistance; - }; - return zoom2; -} -export {Transform as ZoomTransform, zoom, identity as zoomIdentity, transform as zoomTransform}; -export default null; diff --git a/web/client/deps/d3/d3.js b/web/client/deps/d3/d3.js deleted file mode 100644 index 74f74b38..00000000 --- a/web/client/deps/d3/d3.js +++ /dev/null @@ -1,31 +0,0 @@ -export * from "./d3-array.js"; -export * from "./d3-axis.js"; -export * from "./d3-brush.js"; -export * from "./d3-chord.js"; -export * from "./d3-color.js"; -export * from "./d3-contour.js"; -export * from "./d3-delaunay.js"; -export * from "./d3-dispatch.js"; -export * from "./d3-drag.js"; -export * from "./d3-dsv.js"; -export * from "./d3-ease.js"; -export * from "./d3-fetch.js"; -export * from "./d3-force.js"; -export * from "./d3-format.js"; -export * from "./d3-geo.js"; -export * from "./d3-hierarchy.js"; -export * from "./d3-interpolate.js"; -export * from "./d3-path.js"; -export * from "./d3-polygon.js"; -export * from "./d3-quadtree.js"; -export * from "./d3-random.js"; -export * from "./d3-scale.js"; -export * from "./d3-scale-chromatic.js"; -export * from "./d3-selection.js"; -export * from "./d3-shape.js"; -export * from "./d3-time.js"; -export * from "./d3-time-format.js"; -export * from "./d3-timer.js"; -export * from "./d3-transition.js"; -export * from "./d3-zoom.js"; -export default null; diff --git a/web/client/deps/d3/delaunator.js b/web/client/deps/d3/delaunator.js deleted file mode 100644 index 66cdacce..00000000 --- a/web/client/deps/d3/delaunator.js +++ /dev/null @@ -1,375 +0,0 @@ -import {orient2d} from "./robust-predicates.js"; -const EPSILON = Math.pow(2, -52); -const EDGE_STACK = new Uint32Array(512); -class Delaunator { - static from(points, getX = defaultGetX, getY = defaultGetY) { - const n = points.length; - const coords = new Float64Array(n * 2); - for (let i = 0; i < n; i++) { - const p = points[i]; - coords[2 * i] = getX(p); - coords[2 * i + 1] = getY(p); - } - return new Delaunator(coords); - } - constructor(coords) { - const n = coords.length >> 1; - if (n > 0 && typeof coords[0] !== "number") - throw new Error("Expected coords to contain numbers."); - this.coords = coords; - const maxTriangles = Math.max(2 * n - 5, 0); - this._triangles = new Uint32Array(maxTriangles * 3); - this._halfedges = new Int32Array(maxTriangles * 3); - this._hashSize = Math.ceil(Math.sqrt(n)); - this._hullPrev = new Uint32Array(n); - this._hullNext = new Uint32Array(n); - this._hullTri = new Uint32Array(n); - this._hullHash = new Int32Array(this._hashSize).fill(-1); - this._ids = new Uint32Array(n); - this._dists = new Float64Array(n); - this.update(); - } - update() { - const {coords, _hullPrev: hullPrev, _hullNext: hullNext, _hullTri: hullTri, _hullHash: hullHash} = this; - const n = coords.length >> 1; - let minX = Infinity; - let minY = Infinity; - let maxX = -Infinity; - let maxY = -Infinity; - for (let i = 0; i < n; i++) { - const x = coords[2 * i]; - const y = coords[2 * i + 1]; - if (x < minX) - minX = x; - if (y < minY) - minY = y; - if (x > maxX) - maxX = x; - if (y > maxY) - maxY = y; - this._ids[i] = i; - } - const cx = (minX + maxX) / 2; - const cy = (minY + maxY) / 2; - let minDist = Infinity; - let i0, i1, i2; - for (let i = 0; i < n; i++) { - const d = dist(cx, cy, coords[2 * i], coords[2 * i + 1]); - if (d < minDist) { - i0 = i; - minDist = d; - } - } - const i0x = coords[2 * i0]; - const i0y = coords[2 * i0 + 1]; - minDist = Infinity; - for (let i = 0; i < n; i++) { - if (i === i0) - continue; - const d = dist(i0x, i0y, coords[2 * i], coords[2 * i + 1]); - if (d < minDist && d > 0) { - i1 = i; - minDist = d; - } - } - let i1x = coords[2 * i1]; - let i1y = coords[2 * i1 + 1]; - let minRadius = Infinity; - for (let i = 0; i < n; i++) { - if (i === i0 || i === i1) - continue; - const r = circumradius(i0x, i0y, i1x, i1y, coords[2 * i], coords[2 * i + 1]); - if (r < minRadius) { - i2 = i; - minRadius = r; - } - } - let i2x = coords[2 * i2]; - let i2y = coords[2 * i2 + 1]; - if (minRadius === Infinity) { - for (let i = 0; i < n; i++) { - this._dists[i] = coords[2 * i] - coords[0] || coords[2 * i + 1] - coords[1]; - } - quicksort(this._ids, this._dists, 0, n - 1); - const hull = new Uint32Array(n); - let j = 0; - for (let i = 0, d0 = -Infinity; i < n; i++) { - const id = this._ids[i]; - if (this._dists[id] > d0) { - hull[j++] = id; - d0 = this._dists[id]; - } - } - this.hull = hull.subarray(0, j); - this.triangles = new Uint32Array(0); - this.halfedges = new Uint32Array(0); - return; - } - if (orient2d(i0x, i0y, i1x, i1y, i2x, i2y) < 0) { - const i = i1; - const x = i1x; - const y = i1y; - i1 = i2; - i1x = i2x; - i1y = i2y; - i2 = i; - i2x = x; - i2y = y; - } - const center = circumcenter(i0x, i0y, i1x, i1y, i2x, i2y); - this._cx = center.x; - this._cy = center.y; - for (let i = 0; i < n; i++) { - this._dists[i] = dist(coords[2 * i], coords[2 * i + 1], center.x, center.y); - } - quicksort(this._ids, this._dists, 0, n - 1); - this._hullStart = i0; - let hullSize = 3; - hullNext[i0] = hullPrev[i2] = i1; - hullNext[i1] = hullPrev[i0] = i2; - hullNext[i2] = hullPrev[i1] = i0; - hullTri[i0] = 0; - hullTri[i1] = 1; - hullTri[i2] = 2; - hullHash.fill(-1); - hullHash[this._hashKey(i0x, i0y)] = i0; - hullHash[this._hashKey(i1x, i1y)] = i1; - hullHash[this._hashKey(i2x, i2y)] = i2; - this.trianglesLen = 0; - this._addTriangle(i0, i1, i2, -1, -1, -1); - for (let k = 0, xp, yp; k < this._ids.length; k++) { - const i = this._ids[k]; - const x = coords[2 * i]; - const y = coords[2 * i + 1]; - if (k > 0 && Math.abs(x - xp) <= EPSILON && Math.abs(y - yp) <= EPSILON) - continue; - xp = x; - yp = y; - if (i === i0 || i === i1 || i === i2) - continue; - let start = 0; - for (let j = 0, key = this._hashKey(x, y); j < this._hashSize; j++) { - start = hullHash[(key + j) % this._hashSize]; - if (start !== -1 && start !== hullNext[start]) - break; - } - start = hullPrev[start]; - let e = start, q; - while (q = hullNext[e], orient2d(x, y, coords[2 * e], coords[2 * e + 1], coords[2 * q], coords[2 * q + 1]) >= 0) { - e = q; - if (e === start) { - e = -1; - break; - } - } - if (e === -1) - continue; - let t = this._addTriangle(e, i, hullNext[e], -1, -1, hullTri[e]); - hullTri[i] = this._legalize(t + 2); - hullTri[e] = t; - hullSize++; - let n2 = hullNext[e]; - while (q = hullNext[n2], orient2d(x, y, coords[2 * n2], coords[2 * n2 + 1], coords[2 * q], coords[2 * q + 1]) < 0) { - t = this._addTriangle(n2, i, q, hullTri[i], -1, hullTri[n2]); - hullTri[i] = this._legalize(t + 2); - hullNext[n2] = n2; - hullSize--; - n2 = q; - } - if (e === start) { - while (q = hullPrev[e], orient2d(x, y, coords[2 * q], coords[2 * q + 1], coords[2 * e], coords[2 * e + 1]) < 0) { - t = this._addTriangle(q, i, e, -1, hullTri[e], hullTri[q]); - this._legalize(t + 2); - hullTri[q] = t; - hullNext[e] = e; - hullSize--; - e = q; - } - } - this._hullStart = hullPrev[i] = e; - hullNext[e] = hullPrev[n2] = i; - hullNext[i] = n2; - hullHash[this._hashKey(x, y)] = i; - hullHash[this._hashKey(coords[2 * e], coords[2 * e + 1])] = e; - } - this.hull = new Uint32Array(hullSize); - for (let i = 0, e = this._hullStart; i < hullSize; i++) { - this.hull[i] = e; - e = hullNext[e]; - } - this.triangles = this._triangles.subarray(0, this.trianglesLen); - this.halfedges = this._halfedges.subarray(0, this.trianglesLen); - } - _hashKey(x, y) { - return Math.floor(pseudoAngle(x - this._cx, y - this._cy) * this._hashSize) % this._hashSize; - } - _legalize(a) { - const {_triangles: triangles, _halfedges: halfedges, coords} = this; - let i = 0; - let ar = 0; - while (true) { - const b = halfedges[a]; - const a0 = a - a % 3; - ar = a0 + (a + 2) % 3; - if (b === -1) { - if (i === 0) - break; - a = EDGE_STACK[--i]; - continue; - } - const b0 = b - b % 3; - const al = a0 + (a + 1) % 3; - const bl = b0 + (b + 2) % 3; - const p0 = triangles[ar]; - const pr = triangles[a]; - const pl = triangles[al]; - const p1 = triangles[bl]; - const illegal = inCircle(coords[2 * p0], coords[2 * p0 + 1], coords[2 * pr], coords[2 * pr + 1], coords[2 * pl], coords[2 * pl + 1], coords[2 * p1], coords[2 * p1 + 1]); - if (illegal) { - triangles[a] = p1; - triangles[b] = p0; - const hbl = halfedges[bl]; - if (hbl === -1) { - let e = this._hullStart; - do { - if (this._hullTri[e] === bl) { - this._hullTri[e] = a; - break; - } - e = this._hullPrev[e]; - } while (e !== this._hullStart); - } - this._link(a, hbl); - this._link(b, halfedges[ar]); - this._link(ar, bl); - const br = b0 + (b + 1) % 3; - if (i < EDGE_STACK.length) { - EDGE_STACK[i++] = br; - } - } else { - if (i === 0) - break; - a = EDGE_STACK[--i]; - } - } - return ar; - } - _link(a, b) { - this._halfedges[a] = b; - if (b !== -1) - this._halfedges[b] = a; - } - _addTriangle(i0, i1, i2, a, b, c) { - const t = this.trianglesLen; - this._triangles[t] = i0; - this._triangles[t + 1] = i1; - this._triangles[t + 2] = i2; - this._link(t, a); - this._link(t + 1, b); - this._link(t + 2, c); - this.trianglesLen += 3; - return t; - } -} -function pseudoAngle(dx, dy) { - const p = dx / (Math.abs(dx) + Math.abs(dy)); - return (dy > 0 ? 3 - p : 1 + p) / 4; -} -function dist(ax, ay, bx, by) { - const dx = ax - bx; - const dy = ay - by; - return dx * dx + dy * dy; -} -function inCircle(ax, ay, bx, by, cx, cy, px, py) { - const dx = ax - px; - const dy = ay - py; - const ex = bx - px; - const ey = by - py; - const fx = cx - px; - const fy = cy - py; - const ap = dx * dx + dy * dy; - const bp = ex * ex + ey * ey; - const cp = fx * fx + fy * fy; - return dx * (ey * cp - bp * fy) - dy * (ex * cp - bp * fx) + ap * (ex * fy - ey * fx) < 0; -} -function circumradius(ax, ay, bx, by, cx, cy) { - const dx = bx - ax; - const dy = by - ay; - const ex = cx - ax; - const ey = cy - ay; - const bl = dx * dx + dy * dy; - const cl = ex * ex + ey * ey; - const d = 0.5 / (dx * ey - dy * ex); - const x = (ey * bl - dy * cl) * d; - const y = (dx * cl - ex * bl) * d; - return x * x + y * y; -} -function circumcenter(ax, ay, bx, by, cx, cy) { - const dx = bx - ax; - const dy = by - ay; - const ex = cx - ax; - const ey = cy - ay; - const bl = dx * dx + dy * dy; - const cl = ex * ex + ey * ey; - const d = 0.5 / (dx * ey - dy * ex); - const x = ax + (ey * bl - dy * cl) * d; - const y = ay + (dx * cl - ex * bl) * d; - return {x, y}; -} -function quicksort(ids, dists, left, right) { - if (right - left <= 20) { - for (let i = left + 1; i <= right; i++) { - const temp = ids[i]; - const tempDist = dists[temp]; - let j = i - 1; - while (j >= left && dists[ids[j]] > tempDist) - ids[j + 1] = ids[j--]; - ids[j + 1] = temp; - } - } else { - const median = left + right >> 1; - let i = left + 1; - let j = right; - swap(ids, median, i); - if (dists[ids[left]] > dists[ids[right]]) - swap(ids, left, right); - if (dists[ids[i]] > dists[ids[right]]) - swap(ids, i, right); - if (dists[ids[left]] > dists[ids[i]]) - swap(ids, left, i); - const temp = ids[i]; - const tempDist = dists[temp]; - while (true) { - do - i++; - while (dists[ids[i]] < tempDist); - do - j--; - while (dists[ids[j]] > tempDist); - if (j < i) - break; - swap(ids, i, j); - } - ids[left + 1] = ids[j]; - ids[j] = temp; - if (right - i + 1 >= j - left) { - quicksort(ids, dists, i, right); - quicksort(ids, dists, left, j - 1); - } else { - quicksort(ids, dists, left, j - 1); - quicksort(ids, dists, i, right); - } - } -} -function swap(arr, i, j) { - const tmp = arr[i]; - arr[i] = arr[j]; - arr[j] = tmp; -} -function defaultGetX(p) { - return p[0]; -} -function defaultGetY(p) { - return p[1]; -} -export default Delaunator; diff --git a/web/client/deps/d3/internmap.js b/web/client/deps/d3/internmap.js deleted file mode 100644 index 2cdfe4e2..00000000 --- a/web/client/deps/d3/internmap.js +++ /dev/null @@ -1,63 +0,0 @@ -class InternMap extends Map { - constructor(entries, key = keyof) { - super(); - Object.defineProperties(this, {_intern: {value: new Map()}, _key: {value: key}}); - if (entries != null) - for (const [key2, value] of entries) - this.set(key2, value); - } - get(key) { - return super.get(intern_get(this, key)); - } - has(key) { - return super.has(intern_get(this, key)); - } - set(key, value) { - return super.set(intern_set(this, key), value); - } - delete(key) { - return super.delete(intern_delete(this, key)); - } -} -class InternSet extends Set { - constructor(values, key = keyof) { - super(); - Object.defineProperties(this, {_intern: {value: new Map()}, _key: {value: key}}); - if (values != null) - for (const value of values) - this.add(value); - } - has(value) { - return super.has(intern_get(this, value)); - } - add(value) { - return super.add(intern_set(this, value)); - } - delete(value) { - return super.delete(intern_delete(this, value)); - } -} -function intern_get({_intern, _key}, value) { - const key = _key(value); - return _intern.has(key) ? _intern.get(key) : value; -} -function intern_set({_intern, _key}, value) { - const key = _key(value); - if (_intern.has(key)) - return _intern.get(key); - _intern.set(key, value); - return value; -} -function intern_delete({_intern, _key}, value) { - const key = _key(value); - if (_intern.has(key)) { - value = _intern.get(key); - _intern.delete(key); - } - return value; -} -function keyof(value) { - return value !== null && typeof value === "object" ? value.valueOf() : value; -} -export {InternMap, InternSet}; -export default null; diff --git a/web/client/deps/d3/robust-predicates.js b/web/client/deps/d3/robust-predicates.js deleted file mode 100644 index 34d1f36c..00000000 --- a/web/client/deps/d3/robust-predicates.js +++ /dev/null @@ -1,2071 +0,0 @@ -const epsilon = 11102230246251565e-32; -const splitter = 134217729; -const resulterrbound = (3 + 8 * epsilon) * epsilon; -function sum(elen, e, flen, f, h) { - let Q, Qnew, hh, bvirt; - let enow = e[0]; - let fnow = f[0]; - let eindex = 0; - let findex = 0; - if (fnow > enow === fnow > -enow) { - Q = enow; - enow = e[++eindex]; - } else { - Q = fnow; - fnow = f[++findex]; - } - let hindex = 0; - if (eindex < elen && findex < flen) { - if (fnow > enow === fnow > -enow) { - Qnew = enow + Q; - hh = Q - (Qnew - enow); - enow = e[++eindex]; - } else { - Qnew = fnow + Q; - hh = Q - (Qnew - fnow); - fnow = f[++findex]; - } - Q = Qnew; - if (hh !== 0) { - h[hindex++] = hh; - } - while (eindex < elen && findex < flen) { - if (fnow > enow === fnow > -enow) { - Qnew = Q + enow; - bvirt = Qnew - Q; - hh = Q - (Qnew - bvirt) + (enow - bvirt); - enow = e[++eindex]; - } else { - Qnew = Q + fnow; - bvirt = Qnew - Q; - hh = Q - (Qnew - bvirt) + (fnow - bvirt); - fnow = f[++findex]; - } - Q = Qnew; - if (hh !== 0) { - h[hindex++] = hh; - } - } - } - while (eindex < elen) { - Qnew = Q + enow; - bvirt = Qnew - Q; - hh = Q - (Qnew - bvirt) + (enow - bvirt); - enow = e[++eindex]; - Q = Qnew; - if (hh !== 0) { - h[hindex++] = hh; - } - } - while (findex < flen) { - Qnew = Q + fnow; - bvirt = Qnew - Q; - hh = Q - (Qnew - bvirt) + (fnow - bvirt); - fnow = f[++findex]; - Q = Qnew; - if (hh !== 0) { - h[hindex++] = hh; - } - } - if (Q !== 0 || hindex === 0) { - h[hindex++] = Q; - } - return hindex; -} -function sum_three(alen, a, blen, b, clen, c, tmp, out) { - return sum(sum(alen, a, blen, b, tmp), tmp, clen, c, out); -} -function scale(elen, e, b, h) { - let Q, sum2, hh, product1, product0; - let bvirt, c, ahi, alo, bhi, blo; - c = splitter * b; - bhi = c - (c - b); - blo = b - bhi; - let enow = e[0]; - Q = enow * b; - c = splitter * enow; - ahi = c - (c - enow); - alo = enow - ahi; - hh = alo * blo - (Q - ahi * bhi - alo * bhi - ahi * blo); - let hindex = 0; - if (hh !== 0) { - h[hindex++] = hh; - } - for (let i = 1; i < elen; i++) { - enow = e[i]; - product1 = enow * b; - c = splitter * enow; - ahi = c - (c - enow); - alo = enow - ahi; - product0 = alo * blo - (product1 - ahi * bhi - alo * bhi - ahi * blo); - sum2 = Q + product0; - bvirt = sum2 - Q; - hh = Q - (sum2 - bvirt) + (product0 - bvirt); - if (hh !== 0) { - h[hindex++] = hh; - } - Q = product1 + sum2; - hh = sum2 - (Q - product1); - if (hh !== 0) { - h[hindex++] = hh; - } - } - if (Q !== 0 || hindex === 0) { - h[hindex++] = Q; - } - return hindex; -} -function negate(elen, e) { - for (let i = 0; i < elen; i++) - e[i] = -e[i]; - return elen; -} -function estimate(elen, e) { - let Q = e[0]; - for (let i = 1; i < elen; i++) - Q += e[i]; - return Q; -} -function vec(n) { - return new Float64Array(n); -} -const ccwerrboundA = (3 + 16 * epsilon) * epsilon; -const ccwerrboundB = (2 + 12 * epsilon) * epsilon; -const ccwerrboundC = (9 + 64 * epsilon) * epsilon * epsilon; -const B = vec(4); -const C1 = vec(8); -const C2 = vec(12); -const D = vec(16); -const u = vec(4); -function orient2dadapt(ax, ay, bx, by, cx, cy, detsum) { - let acxtail, acytail, bcxtail, bcytail; - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3; - const acx = ax - cx; - const bcx = bx - cx; - const acy = ay - cy; - const bcy = by - cy; - s1 = acx * bcy; - c = splitter * acx; - ahi = c - (c - acx); - alo = acx - ahi; - c = splitter * bcy; - bhi = c - (c - bcy); - blo = bcy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = acy * bcx; - c = splitter * acy; - ahi = c - (c - acy); - alo = acy - ahi; - c = splitter * bcx; - bhi = c - (c - bcx); - blo = bcx - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - B[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - B[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - B[2] = _j - (u3 - bvirt) + (_i - bvirt); - B[3] = u3; - let det = estimate(4, B); - let errbound = ccwerrboundB * detsum; - if (det >= errbound || -det >= errbound) { - return det; - } - bvirt = ax - acx; - acxtail = ax - (acx + bvirt) + (bvirt - cx); - bvirt = bx - bcx; - bcxtail = bx - (bcx + bvirt) + (bvirt - cx); - bvirt = ay - acy; - acytail = ay - (acy + bvirt) + (bvirt - cy); - bvirt = by - bcy; - bcytail = by - (bcy + bvirt) + (bvirt - cy); - if (acxtail === 0 && acytail === 0 && bcxtail === 0 && bcytail === 0) { - return det; - } - errbound = ccwerrboundC * detsum + resulterrbound * Math.abs(det); - det += acx * bcytail + bcy * acxtail - (acy * bcxtail + bcx * acytail); - if (det >= errbound || -det >= errbound) - return det; - s1 = acxtail * bcy; - c = splitter * acxtail; - ahi = c - (c - acxtail); - alo = acxtail - ahi; - c = splitter * bcy; - bhi = c - (c - bcy); - blo = bcy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = acytail * bcx; - c = splitter * acytail; - ahi = c - (c - acytail); - alo = acytail - ahi; - c = splitter * bcx; - bhi = c - (c - bcx); - blo = bcx - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - u[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - u[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - u[2] = _j - (u3 - bvirt) + (_i - bvirt); - u[3] = u3; - const C1len = sum(4, B, 4, u, C1); - s1 = acx * bcytail; - c = splitter * acx; - ahi = c - (c - acx); - alo = acx - ahi; - c = splitter * bcytail; - bhi = c - (c - bcytail); - blo = bcytail - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = acy * bcxtail; - c = splitter * acy; - ahi = c - (c - acy); - alo = acy - ahi; - c = splitter * bcxtail; - bhi = c - (c - bcxtail); - blo = bcxtail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - u[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - u[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - u[2] = _j - (u3 - bvirt) + (_i - bvirt); - u[3] = u3; - const C2len = sum(C1len, C1, 4, u, C2); - s1 = acxtail * bcytail; - c = splitter * acxtail; - ahi = c - (c - acxtail); - alo = acxtail - ahi; - c = splitter * bcytail; - bhi = c - (c - bcytail); - blo = bcytail - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = acytail * bcxtail; - c = splitter * acytail; - ahi = c - (c - acytail); - alo = acytail - ahi; - c = splitter * bcxtail; - bhi = c - (c - bcxtail); - blo = bcxtail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - u[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - u[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - u[2] = _j - (u3 - bvirt) + (_i - bvirt); - u[3] = u3; - const Dlen = sum(C2len, C2, 4, u, D); - return D[Dlen - 1]; -} -function orient2d(ax, ay, bx, by, cx, cy) { - const detleft = (ay - cy) * (bx - cx); - const detright = (ax - cx) * (by - cy); - const det = detleft - detright; - if (detleft === 0 || detright === 0 || detleft > 0 !== detright > 0) - return det; - const detsum = Math.abs(detleft + detright); - if (Math.abs(det) >= ccwerrboundA * detsum) - return det; - return -orient2dadapt(ax, ay, bx, by, cx, cy, detsum); -} -function orient2dfast(ax, ay, bx, by, cx, cy) { - return (ay - cy) * (bx - cx) - (ax - cx) * (by - cy); -} -const o3derrboundA = (7 + 56 * epsilon) * epsilon; -const o3derrboundB = (3 + 28 * epsilon) * epsilon; -const o3derrboundC = (26 + 288 * epsilon) * epsilon * epsilon; -const bc = vec(4); -const ca = vec(4); -const ab = vec(4); -const at_b = vec(4); -const at_c = vec(4); -const bt_c = vec(4); -const bt_a = vec(4); -const ct_a = vec(4); -const ct_b = vec(4); -const bct = vec(8); -const cat = vec(8); -const abt = vec(8); -const u$1 = vec(4); -const _8 = vec(8); -const _8b = vec(8); -const _16 = vec(8); -const _12 = vec(12); -let fin = vec(192); -let fin2 = vec(192); -function finadd(finlen, alen, a) { - finlen = sum(finlen, fin, alen, a, fin2); - const tmp = fin; - fin = fin2; - fin2 = tmp; - return finlen; -} -function tailinit(xtail, ytail, ax, ay, bx, by, a, b) { - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3, negate2; - if (xtail === 0) { - if (ytail === 0) { - a[0] = 0; - b[0] = 0; - return 1; - } else { - negate2 = -ytail; - s1 = negate2 * ax; - c = splitter * negate2; - ahi = c - (c - negate2); - alo = negate2 - ahi; - c = splitter * ax; - bhi = c - (c - ax); - blo = ax - bhi; - a[0] = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - a[1] = s1; - s1 = ytail * bx; - c = splitter * ytail; - ahi = c - (c - ytail); - alo = ytail - ahi; - c = splitter * bx; - bhi = c - (c - bx); - blo = bx - bhi; - b[0] = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - b[1] = s1; - return 2; - } - } else { - if (ytail === 0) { - s1 = xtail * ay; - c = splitter * xtail; - ahi = c - (c - xtail); - alo = xtail - ahi; - c = splitter * ay; - bhi = c - (c - ay); - blo = ay - bhi; - a[0] = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - a[1] = s1; - negate2 = -xtail; - s1 = negate2 * by; - c = splitter * negate2; - ahi = c - (c - negate2); - alo = negate2 - ahi; - c = splitter * by; - bhi = c - (c - by); - blo = by - bhi; - b[0] = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - b[1] = s1; - return 2; - } else { - s1 = xtail * ay; - c = splitter * xtail; - ahi = c - (c - xtail); - alo = xtail - ahi; - c = splitter * ay; - bhi = c - (c - ay); - blo = ay - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = ytail * ax; - c = splitter * ytail; - ahi = c - (c - ytail); - alo = ytail - ahi; - c = splitter * ax; - bhi = c - (c - ax); - blo = ax - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - a[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - a[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - a[2] = _j - (u3 - bvirt) + (_i - bvirt); - a[3] = u3; - s1 = ytail * bx; - c = splitter * ytail; - ahi = c - (c - ytail); - alo = ytail - ahi; - c = splitter * bx; - bhi = c - (c - bx); - blo = bx - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = xtail * by; - c = splitter * xtail; - ahi = c - (c - xtail); - alo = xtail - ahi; - c = splitter * by; - bhi = c - (c - by); - blo = by - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - b[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - b[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - b[2] = _j - (u3 - bvirt) + (_i - bvirt); - b[3] = u3; - return 4; - } - } -} -function tailadd(finlen, a, b, k, z) { - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _k, _0, s1, s0, u3; - s1 = a * b; - c = splitter * a; - ahi = c - (c - a); - alo = a - ahi; - c = splitter * b; - bhi = c - (c - b); - blo = b - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - c = splitter * k; - bhi = c - (c - k); - blo = k - bhi; - _i = s0 * k; - c = splitter * s0; - ahi = c - (c - s0); - alo = s0 - ahi; - u$1[0] = alo * blo - (_i - ahi * bhi - alo * bhi - ahi * blo); - _j = s1 * k; - c = splitter * s1; - ahi = c - (c - s1); - alo = s1 - ahi; - _0 = alo * blo - (_j - ahi * bhi - alo * bhi - ahi * blo); - _k = _i + _0; - bvirt = _k - _i; - u$1[1] = _i - (_k - bvirt) + (_0 - bvirt); - u3 = _j + _k; - u$1[2] = _k - (u3 - _j); - u$1[3] = u3; - finlen = finadd(finlen, 4, u$1); - if (z !== 0) { - c = splitter * z; - bhi = c - (c - z); - blo = z - bhi; - _i = s0 * z; - c = splitter * s0; - ahi = c - (c - s0); - alo = s0 - ahi; - u$1[0] = alo * blo - (_i - ahi * bhi - alo * bhi - ahi * blo); - _j = s1 * z; - c = splitter * s1; - ahi = c - (c - s1); - alo = s1 - ahi; - _0 = alo * blo - (_j - ahi * bhi - alo * bhi - ahi * blo); - _k = _i + _0; - bvirt = _k - _i; - u$1[1] = _i - (_k - bvirt) + (_0 - bvirt); - u3 = _j + _k; - u$1[2] = _k - (u3 - _j); - u$1[3] = u3; - finlen = finadd(finlen, 4, u$1); - } - return finlen; -} -function orient3dadapt(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, permanent) { - let finlen; - let adxtail, bdxtail, cdxtail; - let adytail, bdytail, cdytail; - let adztail, bdztail, cdztail; - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3; - const adx = ax - dx; - const bdx = bx - dx; - const cdx = cx - dx; - const ady = ay - dy; - const bdy = by - dy; - const cdy = cy - dy; - const adz = az - dz; - const bdz = bz - dz; - const cdz = cz - dz; - s1 = bdx * cdy; - c = splitter * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - c = splitter * cdy; - bhi = c - (c - cdy); - blo = cdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cdx * bdy; - c = splitter * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - c = splitter * bdy; - bhi = c - (c - bdy); - blo = bdy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bc[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bc[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - bc[2] = _j - (u3 - bvirt) + (_i - bvirt); - bc[3] = u3; - s1 = cdx * ady; - c = splitter * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - c = splitter * ady; - bhi = c - (c - ady); - blo = ady - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = adx * cdy; - c = splitter * adx; - ahi = c - (c - adx); - alo = adx - ahi; - c = splitter * cdy; - bhi = c - (c - cdy); - blo = cdy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ca[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ca[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ca[2] = _j - (u3 - bvirt) + (_i - bvirt); - ca[3] = u3; - s1 = adx * bdy; - c = splitter * adx; - ahi = c - (c - adx); - alo = adx - ahi; - c = splitter * bdy; - bhi = c - (c - bdy); - blo = bdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bdx * ady; - c = splitter * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - c = splitter * ady; - bhi = c - (c - ady); - blo = ady - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ab[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ab[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ab[2] = _j - (u3 - bvirt) + (_i - bvirt); - ab[3] = u3; - finlen = sum(sum(scale(4, bc, adz, _8), _8, scale(4, ca, bdz, _8b), _8b, _16), _16, scale(4, ab, cdz, _8), _8, fin); - let det = estimate(finlen, fin); - let errbound = o3derrboundB * permanent; - if (det >= errbound || -det >= errbound) { - return det; - } - bvirt = ax - adx; - adxtail = ax - (adx + bvirt) + (bvirt - dx); - bvirt = bx - bdx; - bdxtail = bx - (bdx + bvirt) + (bvirt - dx); - bvirt = cx - cdx; - cdxtail = cx - (cdx + bvirt) + (bvirt - dx); - bvirt = ay - ady; - adytail = ay - (ady + bvirt) + (bvirt - dy); - bvirt = by - bdy; - bdytail = by - (bdy + bvirt) + (bvirt - dy); - bvirt = cy - cdy; - cdytail = cy - (cdy + bvirt) + (bvirt - dy); - bvirt = az - adz; - adztail = az - (adz + bvirt) + (bvirt - dz); - bvirt = bz - bdz; - bdztail = bz - (bdz + bvirt) + (bvirt - dz); - bvirt = cz - cdz; - cdztail = cz - (cdz + bvirt) + (bvirt - dz); - if (adxtail === 0 && bdxtail === 0 && cdxtail === 0 && adytail === 0 && bdytail === 0 && cdytail === 0 && adztail === 0 && bdztail === 0 && cdztail === 0) { - return det; - } - errbound = o3derrboundC * permanent + resulterrbound * Math.abs(det); - det += adz * (bdx * cdytail + cdy * bdxtail - (bdy * cdxtail + cdx * bdytail)) + adztail * (bdx * cdy - bdy * cdx) + bdz * (cdx * adytail + ady * cdxtail - (cdy * adxtail + adx * cdytail)) + bdztail * (cdx * ady - cdy * adx) + cdz * (adx * bdytail + bdy * adxtail - (ady * bdxtail + bdx * adytail)) + cdztail * (adx * bdy - ady * bdx); - if (det >= errbound || -det >= errbound) { - return det; - } - const at_len = tailinit(adxtail, adytail, bdx, bdy, cdx, cdy, at_b, at_c); - const bt_len = tailinit(bdxtail, bdytail, cdx, cdy, adx, ady, bt_c, bt_a); - const ct_len = tailinit(cdxtail, cdytail, adx, ady, bdx, bdy, ct_a, ct_b); - const bctlen = sum(bt_len, bt_c, ct_len, ct_b, bct); - finlen = finadd(finlen, scale(bctlen, bct, adz, _16), _16); - const catlen = sum(ct_len, ct_a, at_len, at_c, cat); - finlen = finadd(finlen, scale(catlen, cat, bdz, _16), _16); - const abtlen = sum(at_len, at_b, bt_len, bt_a, abt); - finlen = finadd(finlen, scale(abtlen, abt, cdz, _16), _16); - if (adztail !== 0) { - finlen = finadd(finlen, scale(4, bc, adztail, _12), _12); - finlen = finadd(finlen, scale(bctlen, bct, adztail, _16), _16); - } - if (bdztail !== 0) { - finlen = finadd(finlen, scale(4, ca, bdztail, _12), _12); - finlen = finadd(finlen, scale(catlen, cat, bdztail, _16), _16); - } - if (cdztail !== 0) { - finlen = finadd(finlen, scale(4, ab, cdztail, _12), _12); - finlen = finadd(finlen, scale(abtlen, abt, cdztail, _16), _16); - } - if (adxtail !== 0) { - if (bdytail !== 0) { - finlen = tailadd(finlen, adxtail, bdytail, cdz, cdztail); - } - if (cdytail !== 0) { - finlen = tailadd(finlen, -adxtail, cdytail, bdz, bdztail); - } - } - if (bdxtail !== 0) { - if (cdytail !== 0) { - finlen = tailadd(finlen, bdxtail, cdytail, adz, adztail); - } - if (adytail !== 0) { - finlen = tailadd(finlen, -bdxtail, adytail, cdz, cdztail); - } - } - if (cdxtail !== 0) { - if (adytail !== 0) { - finlen = tailadd(finlen, cdxtail, adytail, bdz, bdztail); - } - if (bdytail !== 0) { - finlen = tailadd(finlen, -cdxtail, bdytail, adz, adztail); - } - } - return fin[finlen - 1]; -} -function orient3d(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz) { - const adx = ax - dx; - const bdx = bx - dx; - const cdx = cx - dx; - const ady = ay - dy; - const bdy = by - dy; - const cdy = cy - dy; - const adz = az - dz; - const bdz = bz - dz; - const cdz = cz - dz; - const bdxcdy = bdx * cdy; - const cdxbdy = cdx * bdy; - const cdxady = cdx * ady; - const adxcdy = adx * cdy; - const adxbdy = adx * bdy; - const bdxady = bdx * ady; - const det = adz * (bdxcdy - cdxbdy) + bdz * (cdxady - adxcdy) + cdz * (adxbdy - bdxady); - const permanent = (Math.abs(bdxcdy) + Math.abs(cdxbdy)) * Math.abs(adz) + (Math.abs(cdxady) + Math.abs(adxcdy)) * Math.abs(bdz) + (Math.abs(adxbdy) + Math.abs(bdxady)) * Math.abs(cdz); - const errbound = o3derrboundA * permanent; - if (det > errbound || -det > errbound) { - return det; - } - return orient3dadapt(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, permanent); -} -function orient3dfast(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz) { - const adx = ax - dx; - const bdx = bx - dx; - const cdx = cx - dx; - const ady = ay - dy; - const bdy = by - dy; - const cdy = cy - dy; - const adz = az - dz; - const bdz = bz - dz; - const cdz = cz - dz; - return adx * (bdy * cdz - bdz * cdy) + bdx * (cdy * adz - cdz * ady) + cdx * (ady * bdz - adz * bdy); -} -const iccerrboundA = (10 + 96 * epsilon) * epsilon; -const iccerrboundB = (4 + 48 * epsilon) * epsilon; -const iccerrboundC = (44 + 576 * epsilon) * epsilon * epsilon; -const bc$1 = vec(4); -const ca$1 = vec(4); -const ab$1 = vec(4); -const aa = vec(4); -const bb = vec(4); -const cc = vec(4); -const u$2 = vec(4); -const v = vec(4); -const axtbc = vec(8); -const aytbc = vec(8); -const bxtca = vec(8); -const bytca = vec(8); -const cxtab = vec(8); -const cytab = vec(8); -const abt$1 = vec(8); -const bct$1 = vec(8); -const cat$1 = vec(8); -const abtt = vec(4); -const bctt = vec(4); -const catt = vec(4); -const _8$1 = vec(8); -const _16$1 = vec(16); -const _16b = vec(16); -const _16c = vec(16); -const _32 = vec(32); -const _32b = vec(32); -const _48 = vec(48); -const _64 = vec(64); -let fin$1 = vec(1152); -let fin2$1 = vec(1152); -function finadd$1(finlen, a, alen) { - finlen = sum(finlen, fin$1, a, alen, fin2$1); - const tmp = fin$1; - fin$1 = fin2$1; - fin2$1 = tmp; - return finlen; -} -function incircleadapt(ax, ay, bx, by, cx, cy, dx, dy, permanent) { - let finlen; - let adxtail, bdxtail, cdxtail, adytail, bdytail, cdytail; - let axtbclen, aytbclen, bxtcalen, bytcalen, cxtablen, cytablen; - let abtlen, bctlen, catlen; - let abttlen, bcttlen, cattlen; - let n1, n0; - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3; - const adx = ax - dx; - const bdx = bx - dx; - const cdx = cx - dx; - const ady = ay - dy; - const bdy = by - dy; - const cdy = cy - dy; - s1 = bdx * cdy; - c = splitter * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - c = splitter * cdy; - bhi = c - (c - cdy); - blo = cdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cdx * bdy; - c = splitter * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - c = splitter * bdy; - bhi = c - (c - bdy); - blo = bdy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bc$1[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bc$1[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - bc$1[2] = _j - (u3 - bvirt) + (_i - bvirt); - bc$1[3] = u3; - s1 = cdx * ady; - c = splitter * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - c = splitter * ady; - bhi = c - (c - ady); - blo = ady - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = adx * cdy; - c = splitter * adx; - ahi = c - (c - adx); - alo = adx - ahi; - c = splitter * cdy; - bhi = c - (c - cdy); - blo = cdy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ca$1[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ca$1[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ca$1[2] = _j - (u3 - bvirt) + (_i - bvirt); - ca$1[3] = u3; - s1 = adx * bdy; - c = splitter * adx; - ahi = c - (c - adx); - alo = adx - ahi; - c = splitter * bdy; - bhi = c - (c - bdy); - blo = bdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bdx * ady; - c = splitter * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - c = splitter * ady; - bhi = c - (c - ady); - blo = ady - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ab$1[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ab$1[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ab$1[2] = _j - (u3 - bvirt) + (_i - bvirt); - ab$1[3] = u3; - finlen = sum(sum(sum(scale(scale(4, bc$1, adx, _8$1), _8$1, adx, _16$1), _16$1, scale(scale(4, bc$1, ady, _8$1), _8$1, ady, _16b), _16b, _32), _32, sum(scale(scale(4, ca$1, bdx, _8$1), _8$1, bdx, _16$1), _16$1, scale(scale(4, ca$1, bdy, _8$1), _8$1, bdy, _16b), _16b, _32b), _32b, _64), _64, sum(scale(scale(4, ab$1, cdx, _8$1), _8$1, cdx, _16$1), _16$1, scale(scale(4, ab$1, cdy, _8$1), _8$1, cdy, _16b), _16b, _32), _32, fin$1); - let det = estimate(finlen, fin$1); - let errbound = iccerrboundB * permanent; - if (det >= errbound || -det >= errbound) { - return det; - } - bvirt = ax - adx; - adxtail = ax - (adx + bvirt) + (bvirt - dx); - bvirt = ay - ady; - adytail = ay - (ady + bvirt) + (bvirt - dy); - bvirt = bx - bdx; - bdxtail = bx - (bdx + bvirt) + (bvirt - dx); - bvirt = by - bdy; - bdytail = by - (bdy + bvirt) + (bvirt - dy); - bvirt = cx - cdx; - cdxtail = cx - (cdx + bvirt) + (bvirt - dx); - bvirt = cy - cdy; - cdytail = cy - (cdy + bvirt) + (bvirt - dy); - if (adxtail === 0 && bdxtail === 0 && cdxtail === 0 && adytail === 0 && bdytail === 0 && cdytail === 0) { - return det; - } - errbound = iccerrboundC * permanent + resulterrbound * Math.abs(det); - det += (adx * adx + ady * ady) * (bdx * cdytail + cdy * bdxtail - (bdy * cdxtail + cdx * bdytail)) + 2 * (adx * adxtail + ady * adytail) * (bdx * cdy - bdy * cdx) + ((bdx * bdx + bdy * bdy) * (cdx * adytail + ady * cdxtail - (cdy * adxtail + adx * cdytail)) + 2 * (bdx * bdxtail + bdy * bdytail) * (cdx * ady - cdy * adx)) + ((cdx * cdx + cdy * cdy) * (adx * bdytail + bdy * adxtail - (ady * bdxtail + bdx * adytail)) + 2 * (cdx * cdxtail + cdy * cdytail) * (adx * bdy - ady * bdx)); - if (det >= errbound || -det >= errbound) { - return det; - } - if (bdxtail !== 0 || bdytail !== 0 || cdxtail !== 0 || cdytail !== 0) { - s1 = adx * adx; - c = splitter * adx; - ahi = c - (c - adx); - alo = adx - ahi; - s0 = alo * alo - (s1 - ahi * ahi - (ahi + ahi) * alo); - t1 = ady * ady; - c = splitter * ady; - ahi = c - (c - ady); - alo = ady - ahi; - t0 = alo * alo - (t1 - ahi * ahi - (ahi + ahi) * alo); - _i = s0 + t0; - bvirt = _i - s0; - aa[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - aa[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - aa[2] = _j - (u3 - bvirt) + (_i - bvirt); - aa[3] = u3; - } - if (cdxtail !== 0 || cdytail !== 0 || adxtail !== 0 || adytail !== 0) { - s1 = bdx * bdx; - c = splitter * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - s0 = alo * alo - (s1 - ahi * ahi - (ahi + ahi) * alo); - t1 = bdy * bdy; - c = splitter * bdy; - ahi = c - (c - bdy); - alo = bdy - ahi; - t0 = alo * alo - (t1 - ahi * ahi - (ahi + ahi) * alo); - _i = s0 + t0; - bvirt = _i - s0; - bb[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - bb[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - bb[2] = _j - (u3 - bvirt) + (_i - bvirt); - bb[3] = u3; - } - if (adxtail !== 0 || adytail !== 0 || bdxtail !== 0 || bdytail !== 0) { - s1 = cdx * cdx; - c = splitter * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - s0 = alo * alo - (s1 - ahi * ahi - (ahi + ahi) * alo); - t1 = cdy * cdy; - c = splitter * cdy; - ahi = c - (c - cdy); - alo = cdy - ahi; - t0 = alo * alo - (t1 - ahi * ahi - (ahi + ahi) * alo); - _i = s0 + t0; - bvirt = _i - s0; - cc[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - cc[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - cc[2] = _j - (u3 - bvirt) + (_i - bvirt); - cc[3] = u3; - } - if (adxtail !== 0) { - axtbclen = scale(4, bc$1, adxtail, axtbc); - finlen = finadd$1(finlen, sum_three(scale(axtbclen, axtbc, 2 * adx, _16$1), _16$1, scale(scale(4, cc, adxtail, _8$1), _8$1, bdy, _16b), _16b, scale(scale(4, bb, adxtail, _8$1), _8$1, -cdy, _16c), _16c, _32, _48), _48); - } - if (adytail !== 0) { - aytbclen = scale(4, bc$1, adytail, aytbc); - finlen = finadd$1(finlen, sum_three(scale(aytbclen, aytbc, 2 * ady, _16$1), _16$1, scale(scale(4, bb, adytail, _8$1), _8$1, cdx, _16b), _16b, scale(scale(4, cc, adytail, _8$1), _8$1, -bdx, _16c), _16c, _32, _48), _48); - } - if (bdxtail !== 0) { - bxtcalen = scale(4, ca$1, bdxtail, bxtca); - finlen = finadd$1(finlen, sum_three(scale(bxtcalen, bxtca, 2 * bdx, _16$1), _16$1, scale(scale(4, aa, bdxtail, _8$1), _8$1, cdy, _16b), _16b, scale(scale(4, cc, bdxtail, _8$1), _8$1, -ady, _16c), _16c, _32, _48), _48); - } - if (bdytail !== 0) { - bytcalen = scale(4, ca$1, bdytail, bytca); - finlen = finadd$1(finlen, sum_three(scale(bytcalen, bytca, 2 * bdy, _16$1), _16$1, scale(scale(4, cc, bdytail, _8$1), _8$1, adx, _16b), _16b, scale(scale(4, aa, bdytail, _8$1), _8$1, -cdx, _16c), _16c, _32, _48), _48); - } - if (cdxtail !== 0) { - cxtablen = scale(4, ab$1, cdxtail, cxtab); - finlen = finadd$1(finlen, sum_three(scale(cxtablen, cxtab, 2 * cdx, _16$1), _16$1, scale(scale(4, bb, cdxtail, _8$1), _8$1, ady, _16b), _16b, scale(scale(4, aa, cdxtail, _8$1), _8$1, -bdy, _16c), _16c, _32, _48), _48); - } - if (cdytail !== 0) { - cytablen = scale(4, ab$1, cdytail, cytab); - finlen = finadd$1(finlen, sum_three(scale(cytablen, cytab, 2 * cdy, _16$1), _16$1, scale(scale(4, aa, cdytail, _8$1), _8$1, bdx, _16b), _16b, scale(scale(4, bb, cdytail, _8$1), _8$1, -adx, _16c), _16c, _32, _48), _48); - } - if (adxtail !== 0 || adytail !== 0) { - if (bdxtail !== 0 || bdytail !== 0 || cdxtail !== 0 || cdytail !== 0) { - s1 = bdxtail * cdy; - c = splitter * bdxtail; - ahi = c - (c - bdxtail); - alo = bdxtail - ahi; - c = splitter * cdy; - bhi = c - (c - cdy); - blo = cdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bdx * cdytail; - c = splitter * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - c = splitter * cdytail; - bhi = c - (c - cdytail); - blo = cdytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 + t0; - bvirt = _i - s0; - u$2[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - u$2[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - u$2[2] = _j - (u3 - bvirt) + (_i - bvirt); - u$2[3] = u3; - s1 = cdxtail * -bdy; - c = splitter * cdxtail; - ahi = c - (c - cdxtail); - alo = cdxtail - ahi; - c = splitter * -bdy; - bhi = c - (c - -bdy); - blo = -bdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cdx * -bdytail; - c = splitter * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - c = splitter * -bdytail; - bhi = c - (c - -bdytail); - blo = -bdytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 + t0; - bvirt = _i - s0; - v[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - v[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - v[2] = _j - (u3 - bvirt) + (_i - bvirt); - v[3] = u3; - bctlen = sum(4, u$2, 4, v, bct$1); - s1 = bdxtail * cdytail; - c = splitter * bdxtail; - ahi = c - (c - bdxtail); - alo = bdxtail - ahi; - c = splitter * cdytail; - bhi = c - (c - cdytail); - blo = cdytail - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cdxtail * bdytail; - c = splitter * cdxtail; - ahi = c - (c - cdxtail); - alo = cdxtail - ahi; - c = splitter * bdytail; - bhi = c - (c - bdytail); - blo = bdytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bctt[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bctt[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - bctt[2] = _j - (u3 - bvirt) + (_i - bvirt); - bctt[3] = u3; - bcttlen = 4; - } else { - bct$1[0] = 0; - bctlen = 1; - bctt[0] = 0; - bcttlen = 1; - } - if (adxtail !== 0) { - const len = scale(bctlen, bct$1, adxtail, _16c); - finlen = finadd$1(finlen, sum(scale(axtbclen, axtbc, adxtail, _16$1), _16$1, scale(len, _16c, 2 * adx, _32), _32, _48), _48); - const len2 = scale(bcttlen, bctt, adxtail, _8$1); - finlen = finadd$1(finlen, sum_three(scale(len2, _8$1, 2 * adx, _16$1), _16$1, scale(len2, _8$1, adxtail, _16b), _16b, scale(len, _16c, adxtail, _32), _32, _32b, _64), _64); - if (bdytail !== 0) { - finlen = finadd$1(finlen, scale(scale(4, cc, adxtail, _8$1), _8$1, bdytail, _16$1), _16$1); - } - if (cdytail !== 0) { - finlen = finadd$1(finlen, scale(scale(4, bb, -adxtail, _8$1), _8$1, cdytail, _16$1), _16$1); - } - } - if (adytail !== 0) { - const len = scale(bctlen, bct$1, adytail, _16c); - finlen = finadd$1(finlen, sum(scale(aytbclen, aytbc, adytail, _16$1), _16$1, scale(len, _16c, 2 * ady, _32), _32, _48), _48); - const len2 = scale(bcttlen, bctt, adytail, _8$1); - finlen = finadd$1(finlen, sum_three(scale(len2, _8$1, 2 * ady, _16$1), _16$1, scale(len2, _8$1, adytail, _16b), _16b, scale(len, _16c, adytail, _32), _32, _32b, _64), _64); - } - } - if (bdxtail !== 0 || bdytail !== 0) { - if (cdxtail !== 0 || cdytail !== 0 || adxtail !== 0 || adytail !== 0) { - s1 = cdxtail * ady; - c = splitter * cdxtail; - ahi = c - (c - cdxtail); - alo = cdxtail - ahi; - c = splitter * ady; - bhi = c - (c - ady); - blo = ady - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cdx * adytail; - c = splitter * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - c = splitter * adytail; - bhi = c - (c - adytail); - blo = adytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 + t0; - bvirt = _i - s0; - u$2[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - u$2[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - u$2[2] = _j - (u3 - bvirt) + (_i - bvirt); - u$2[3] = u3; - n1 = -cdy; - n0 = -cdytail; - s1 = adxtail * n1; - c = splitter * adxtail; - ahi = c - (c - adxtail); - alo = adxtail - ahi; - c = splitter * n1; - bhi = c - (c - n1); - blo = n1 - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = adx * n0; - c = splitter * adx; - ahi = c - (c - adx); - alo = adx - ahi; - c = splitter * n0; - bhi = c - (c - n0); - blo = n0 - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 + t0; - bvirt = _i - s0; - v[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - v[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - v[2] = _j - (u3 - bvirt) + (_i - bvirt); - v[3] = u3; - catlen = sum(4, u$2, 4, v, cat$1); - s1 = cdxtail * adytail; - c = splitter * cdxtail; - ahi = c - (c - cdxtail); - alo = cdxtail - ahi; - c = splitter * adytail; - bhi = c - (c - adytail); - blo = adytail - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = adxtail * cdytail; - c = splitter * adxtail; - ahi = c - (c - adxtail); - alo = adxtail - ahi; - c = splitter * cdytail; - bhi = c - (c - cdytail); - blo = cdytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - catt[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - catt[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - catt[2] = _j - (u3 - bvirt) + (_i - bvirt); - catt[3] = u3; - cattlen = 4; - } else { - cat$1[0] = 0; - catlen = 1; - catt[0] = 0; - cattlen = 1; - } - if (bdxtail !== 0) { - const len = scale(catlen, cat$1, bdxtail, _16c); - finlen = finadd$1(finlen, sum(scale(bxtcalen, bxtca, bdxtail, _16$1), _16$1, scale(len, _16c, 2 * bdx, _32), _32, _48), _48); - const len2 = scale(cattlen, catt, bdxtail, _8$1); - finlen = finadd$1(finlen, sum_three(scale(len2, _8$1, 2 * bdx, _16$1), _16$1, scale(len2, _8$1, bdxtail, _16b), _16b, scale(len, _16c, bdxtail, _32), _32, _32b, _64), _64); - if (cdytail !== 0) { - finlen = finadd$1(finlen, scale(scale(4, aa, bdxtail, _8$1), _8$1, cdytail, _16$1), _16$1); - } - if (adytail !== 0) { - finlen = finadd$1(finlen, scale(scale(4, cc, -bdxtail, _8$1), _8$1, adytail, _16$1), _16$1); - } - } - if (bdytail !== 0) { - const len = scale(catlen, cat$1, bdytail, _16c); - finlen = finadd$1(finlen, sum(scale(bytcalen, bytca, bdytail, _16$1), _16$1, scale(len, _16c, 2 * bdy, _32), _32, _48), _48); - const len2 = scale(cattlen, catt, bdytail, _8$1); - finlen = finadd$1(finlen, sum_three(scale(len2, _8$1, 2 * bdy, _16$1), _16$1, scale(len2, _8$1, bdytail, _16b), _16b, scale(len, _16c, bdytail, _32), _32, _32b, _64), _64); - } - } - if (cdxtail !== 0 || cdytail !== 0) { - if (adxtail !== 0 || adytail !== 0 || bdxtail !== 0 || bdytail !== 0) { - s1 = adxtail * bdy; - c = splitter * adxtail; - ahi = c - (c - adxtail); - alo = adxtail - ahi; - c = splitter * bdy; - bhi = c - (c - bdy); - blo = bdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = adx * bdytail; - c = splitter * adx; - ahi = c - (c - adx); - alo = adx - ahi; - c = splitter * bdytail; - bhi = c - (c - bdytail); - blo = bdytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 + t0; - bvirt = _i - s0; - u$2[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - u$2[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - u$2[2] = _j - (u3 - bvirt) + (_i - bvirt); - u$2[3] = u3; - n1 = -ady; - n0 = -adytail; - s1 = bdxtail * n1; - c = splitter * bdxtail; - ahi = c - (c - bdxtail); - alo = bdxtail - ahi; - c = splitter * n1; - bhi = c - (c - n1); - blo = n1 - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bdx * n0; - c = splitter * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - c = splitter * n0; - bhi = c - (c - n0); - blo = n0 - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 + t0; - bvirt = _i - s0; - v[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - v[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - v[2] = _j - (u3 - bvirt) + (_i - bvirt); - v[3] = u3; - abtlen = sum(4, u$2, 4, v, abt$1); - s1 = adxtail * bdytail; - c = splitter * adxtail; - ahi = c - (c - adxtail); - alo = adxtail - ahi; - c = splitter * bdytail; - bhi = c - (c - bdytail); - blo = bdytail - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bdxtail * adytail; - c = splitter * bdxtail; - ahi = c - (c - bdxtail); - alo = bdxtail - ahi; - c = splitter * adytail; - bhi = c - (c - adytail); - blo = adytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - abtt[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - abtt[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - abtt[2] = _j - (u3 - bvirt) + (_i - bvirt); - abtt[3] = u3; - abttlen = 4; - } else { - abt$1[0] = 0; - abtlen = 1; - abtt[0] = 0; - abttlen = 1; - } - if (cdxtail !== 0) { - const len = scale(abtlen, abt$1, cdxtail, _16c); - finlen = finadd$1(finlen, sum(scale(cxtablen, cxtab, cdxtail, _16$1), _16$1, scale(len, _16c, 2 * cdx, _32), _32, _48), _48); - const len2 = scale(abttlen, abtt, cdxtail, _8$1); - finlen = finadd$1(finlen, sum_three(scale(len2, _8$1, 2 * cdx, _16$1), _16$1, scale(len2, _8$1, cdxtail, _16b), _16b, scale(len, _16c, cdxtail, _32), _32, _32b, _64), _64); - if (adytail !== 0) { - finlen = finadd$1(finlen, scale(scale(4, bb, cdxtail, _8$1), _8$1, adytail, _16$1), _16$1); - } - if (bdytail !== 0) { - finlen = finadd$1(finlen, scale(scale(4, aa, -cdxtail, _8$1), _8$1, bdytail, _16$1), _16$1); - } - } - if (cdytail !== 0) { - const len = scale(abtlen, abt$1, cdytail, _16c); - finlen = finadd$1(finlen, sum(scale(cytablen, cytab, cdytail, _16$1), _16$1, scale(len, _16c, 2 * cdy, _32), _32, _48), _48); - const len2 = scale(abttlen, abtt, cdytail, _8$1); - finlen = finadd$1(finlen, sum_three(scale(len2, _8$1, 2 * cdy, _16$1), _16$1, scale(len2, _8$1, cdytail, _16b), _16b, scale(len, _16c, cdytail, _32), _32, _32b, _64), _64); - } - } - return fin$1[finlen - 1]; -} -function incircle(ax, ay, bx, by, cx, cy, dx, dy) { - const adx = ax - dx; - const bdx = bx - dx; - const cdx = cx - dx; - const ady = ay - dy; - const bdy = by - dy; - const cdy = cy - dy; - const bdxcdy = bdx * cdy; - const cdxbdy = cdx * bdy; - const alift = adx * adx + ady * ady; - const cdxady = cdx * ady; - const adxcdy = adx * cdy; - const blift = bdx * bdx + bdy * bdy; - const adxbdy = adx * bdy; - const bdxady = bdx * ady; - const clift = cdx * cdx + cdy * cdy; - const det = alift * (bdxcdy - cdxbdy) + blift * (cdxady - adxcdy) + clift * (adxbdy - bdxady); - const permanent = (Math.abs(bdxcdy) + Math.abs(cdxbdy)) * alift + (Math.abs(cdxady) + Math.abs(adxcdy)) * blift + (Math.abs(adxbdy) + Math.abs(bdxady)) * clift; - const errbound = iccerrboundA * permanent; - if (det > errbound || -det > errbound) { - return det; - } - return incircleadapt(ax, ay, bx, by, cx, cy, dx, dy, permanent); -} -function incirclefast(ax, ay, bx, by, cx, cy, dx, dy) { - const adx = ax - dx; - const ady = ay - dy; - const bdx = bx - dx; - const bdy = by - dy; - const cdx = cx - dx; - const cdy = cy - dy; - const abdet2 = adx * bdy - bdx * ady; - const bcdet = bdx * cdy - cdx * bdy; - const cadet = cdx * ady - adx * cdy; - const alift = adx * adx + ady * ady; - const blift = bdx * bdx + bdy * bdy; - const clift = cdx * cdx + cdy * cdy; - return alift * bcdet + blift * cadet + clift * abdet2; -} -const isperrboundA = (16 + 224 * epsilon) * epsilon; -const isperrboundB = (5 + 72 * epsilon) * epsilon; -const isperrboundC = (71 + 1408 * epsilon) * epsilon * epsilon; -const ab$2 = vec(4); -const bc$2 = vec(4); -const cd = vec(4); -const de = vec(4); -const ea = vec(4); -const ac = vec(4); -const bd = vec(4); -const ce = vec(4); -const da = vec(4); -const eb = vec(4); -const abc = vec(24); -const bcd = vec(24); -const cde = vec(24); -const dea = vec(24); -const eab = vec(24); -const abd = vec(24); -const bce = vec(24); -const cda = vec(24); -const deb = vec(24); -const eac = vec(24); -const adet = vec(1152); -const bdet = vec(1152); -const cdet = vec(1152); -const ddet = vec(1152); -const edet = vec(1152); -const abdet = vec(2304); -const cddet = vec(2304); -const cdedet = vec(3456); -const deter = vec(5760); -const _8$2 = vec(8); -const _8b$1 = vec(8); -const _8c = vec(8); -const _16$2 = vec(16); -const _24 = vec(24); -const _48$1 = vec(48); -const _48b = vec(48); -const _96 = vec(96); -const _192 = vec(192); -const _384x = vec(384); -const _384y = vec(384); -const _384z = vec(384); -const _768 = vec(768); -function sum_three_scale(a, b, c, az, bz, cz, out) { - return sum_three(scale(4, a, az, _8$2), _8$2, scale(4, b, bz, _8b$1), _8b$1, scale(4, c, cz, _8c), _8c, _16$2, out); -} -function liftexact(alen, a, blen, b, clen, c, dlen, d, x, y, z, out) { - const len = sum(sum(alen, a, blen, b, _48$1), _48$1, negate(sum(clen, c, dlen, d, _48b), _48b), _48b, _96); - return sum_three(scale(scale(len, _96, x, _192), _192, x, _384x), _384x, scale(scale(len, _96, y, _192), _192, y, _384y), _384y, scale(scale(len, _96, z, _192), _192, z, _384z), _384z, _768, out); -} -function insphereexact(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez) { - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3; - s1 = ax * by; - c = splitter * ax; - ahi = c - (c - ax); - alo = ax - ahi; - c = splitter * by; - bhi = c - (c - by); - blo = by - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bx * ay; - c = splitter * bx; - ahi = c - (c - bx); - alo = bx - ahi; - c = splitter * ay; - bhi = c - (c - ay); - blo = ay - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ab$2[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ab$2[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ab$2[2] = _j - (u3 - bvirt) + (_i - bvirt); - ab$2[3] = u3; - s1 = bx * cy; - c = splitter * bx; - ahi = c - (c - bx); - alo = bx - ahi; - c = splitter * cy; - bhi = c - (c - cy); - blo = cy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cx * by; - c = splitter * cx; - ahi = c - (c - cx); - alo = cx - ahi; - c = splitter * by; - bhi = c - (c - by); - blo = by - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bc$2[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bc$2[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - bc$2[2] = _j - (u3 - bvirt) + (_i - bvirt); - bc$2[3] = u3; - s1 = cx * dy; - c = splitter * cx; - ahi = c - (c - cx); - alo = cx - ahi; - c = splitter * dy; - bhi = c - (c - dy); - blo = dy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = dx * cy; - c = splitter * dx; - ahi = c - (c - dx); - alo = dx - ahi; - c = splitter * cy; - bhi = c - (c - cy); - blo = cy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - cd[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - cd[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - cd[2] = _j - (u3 - bvirt) + (_i - bvirt); - cd[3] = u3; - s1 = dx * ey; - c = splitter * dx; - ahi = c - (c - dx); - alo = dx - ahi; - c = splitter * ey; - bhi = c - (c - ey); - blo = ey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = ex * dy; - c = splitter * ex; - ahi = c - (c - ex); - alo = ex - ahi; - c = splitter * dy; - bhi = c - (c - dy); - blo = dy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - de[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - de[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - de[2] = _j - (u3 - bvirt) + (_i - bvirt); - de[3] = u3; - s1 = ex * ay; - c = splitter * ex; - ahi = c - (c - ex); - alo = ex - ahi; - c = splitter * ay; - bhi = c - (c - ay); - blo = ay - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = ax * ey; - c = splitter * ax; - ahi = c - (c - ax); - alo = ax - ahi; - c = splitter * ey; - bhi = c - (c - ey); - blo = ey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ea[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ea[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ea[2] = _j - (u3 - bvirt) + (_i - bvirt); - ea[3] = u3; - s1 = ax * cy; - c = splitter * ax; - ahi = c - (c - ax); - alo = ax - ahi; - c = splitter * cy; - bhi = c - (c - cy); - blo = cy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cx * ay; - c = splitter * cx; - ahi = c - (c - cx); - alo = cx - ahi; - c = splitter * ay; - bhi = c - (c - ay); - blo = ay - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ac[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ac[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ac[2] = _j - (u3 - bvirt) + (_i - bvirt); - ac[3] = u3; - s1 = bx * dy; - c = splitter * bx; - ahi = c - (c - bx); - alo = bx - ahi; - c = splitter * dy; - bhi = c - (c - dy); - blo = dy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = dx * by; - c = splitter * dx; - ahi = c - (c - dx); - alo = dx - ahi; - c = splitter * by; - bhi = c - (c - by); - blo = by - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bd[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bd[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - bd[2] = _j - (u3 - bvirt) + (_i - bvirt); - bd[3] = u3; - s1 = cx * ey; - c = splitter * cx; - ahi = c - (c - cx); - alo = cx - ahi; - c = splitter * ey; - bhi = c - (c - ey); - blo = ey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = ex * cy; - c = splitter * ex; - ahi = c - (c - ex); - alo = ex - ahi; - c = splitter * cy; - bhi = c - (c - cy); - blo = cy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ce[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ce[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ce[2] = _j - (u3 - bvirt) + (_i - bvirt); - ce[3] = u3; - s1 = dx * ay; - c = splitter * dx; - ahi = c - (c - dx); - alo = dx - ahi; - c = splitter * ay; - bhi = c - (c - ay); - blo = ay - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = ax * dy; - c = splitter * ax; - ahi = c - (c - ax); - alo = ax - ahi; - c = splitter * dy; - bhi = c - (c - dy); - blo = dy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - da[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - da[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - da[2] = _j - (u3 - bvirt) + (_i - bvirt); - da[3] = u3; - s1 = ex * by; - c = splitter * ex; - ahi = c - (c - ex); - alo = ex - ahi; - c = splitter * by; - bhi = c - (c - by); - blo = by - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bx * ey; - c = splitter * bx; - ahi = c - (c - bx); - alo = bx - ahi; - c = splitter * ey; - bhi = c - (c - ey); - blo = ey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - eb[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - eb[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - eb[2] = _j - (u3 - bvirt) + (_i - bvirt); - eb[3] = u3; - const abclen = sum_three_scale(ab$2, bc$2, ac, cz, az, -bz, abc); - const bcdlen = sum_three_scale(bc$2, cd, bd, dz, bz, -cz, bcd); - const cdelen = sum_three_scale(cd, de, ce, ez, cz, -dz, cde); - const dealen = sum_three_scale(de, ea, da, az, dz, -ez, dea); - const eablen = sum_three_scale(ea, ab$2, eb, bz, ez, -az, eab); - const abdlen = sum_three_scale(ab$2, bd, da, dz, az, bz, abd); - const bcelen = sum_three_scale(bc$2, ce, eb, ez, bz, cz, bce); - const cdalen = sum_three_scale(cd, da, ac, az, cz, dz, cda); - const deblen = sum_three_scale(de, eb, bd, bz, dz, ez, deb); - const eaclen = sum_three_scale(ea, ac, ce, cz, ez, az, eac); - const deterlen = sum_three(liftexact(cdelen, cde, bcelen, bce, deblen, deb, bcdlen, bcd, ax, ay, az, adet), adet, liftexact(dealen, dea, cdalen, cda, eaclen, eac, cdelen, cde, bx, by, bz, bdet), bdet, sum_three(liftexact(eablen, eab, deblen, deb, abdlen, abd, dealen, dea, cx, cy, cz, cdet), cdet, liftexact(abclen, abc, eaclen, eac, bcelen, bce, eablen, eab, dx, dy, dz, ddet), ddet, liftexact(bcdlen, bcd, abdlen, abd, cdalen, cda, abclen, abc, ex, ey, ez, edet), edet, cddet, cdedet), cdedet, abdet, deter); - return deter[deterlen - 1]; -} -const xdet = vec(96); -const ydet = vec(96); -const zdet = vec(96); -const fin$2 = vec(1152); -function liftadapt(a, b, c, az, bz, cz, x, y, z, out) { - const len = sum_three_scale(a, b, c, az, bz, cz, _24); - return sum_three(scale(scale(len, _24, x, _48$1), _48$1, x, xdet), xdet, scale(scale(len, _24, y, _48$1), _48$1, y, ydet), ydet, scale(scale(len, _24, z, _48$1), _48$1, z, zdet), zdet, _192, out); -} -function insphereadapt(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez, permanent) { - let ab3, bc3, cd3, da3, ac3, bd3; - let aextail, bextail, cextail, dextail; - let aeytail, beytail, ceytail, deytail; - let aeztail, beztail, ceztail, deztail; - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0; - const aex = ax - ex; - const bex = bx - ex; - const cex = cx - ex; - const dex = dx - ex; - const aey = ay - ey; - const bey = by - ey; - const cey = cy - ey; - const dey = dy - ey; - const aez = az - ez; - const bez = bz - ez; - const cez = cz - ez; - const dez = dz - ez; - s1 = aex * bey; - c = splitter * aex; - ahi = c - (c - aex); - alo = aex - ahi; - c = splitter * bey; - bhi = c - (c - bey); - blo = bey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bex * aey; - c = splitter * bex; - ahi = c - (c - bex); - alo = bex - ahi; - c = splitter * aey; - bhi = c - (c - aey); - blo = aey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ab$2[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ab$2[1] = _0 - (_i + bvirt) + (bvirt - t1); - ab3 = _j + _i; - bvirt = ab3 - _j; - ab$2[2] = _j - (ab3 - bvirt) + (_i - bvirt); - ab$2[3] = ab3; - s1 = bex * cey; - c = splitter * bex; - ahi = c - (c - bex); - alo = bex - ahi; - c = splitter * cey; - bhi = c - (c - cey); - blo = cey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cex * bey; - c = splitter * cex; - ahi = c - (c - cex); - alo = cex - ahi; - c = splitter * bey; - bhi = c - (c - bey); - blo = bey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bc$2[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bc$2[1] = _0 - (_i + bvirt) + (bvirt - t1); - bc3 = _j + _i; - bvirt = bc3 - _j; - bc$2[2] = _j - (bc3 - bvirt) + (_i - bvirt); - bc$2[3] = bc3; - s1 = cex * dey; - c = splitter * cex; - ahi = c - (c - cex); - alo = cex - ahi; - c = splitter * dey; - bhi = c - (c - dey); - blo = dey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = dex * cey; - c = splitter * dex; - ahi = c - (c - dex); - alo = dex - ahi; - c = splitter * cey; - bhi = c - (c - cey); - blo = cey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - cd[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - cd[1] = _0 - (_i + bvirt) + (bvirt - t1); - cd3 = _j + _i; - bvirt = cd3 - _j; - cd[2] = _j - (cd3 - bvirt) + (_i - bvirt); - cd[3] = cd3; - s1 = dex * aey; - c = splitter * dex; - ahi = c - (c - dex); - alo = dex - ahi; - c = splitter * aey; - bhi = c - (c - aey); - blo = aey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = aex * dey; - c = splitter * aex; - ahi = c - (c - aex); - alo = aex - ahi; - c = splitter * dey; - bhi = c - (c - dey); - blo = dey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - da[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - da[1] = _0 - (_i + bvirt) + (bvirt - t1); - da3 = _j + _i; - bvirt = da3 - _j; - da[2] = _j - (da3 - bvirt) + (_i - bvirt); - da[3] = da3; - s1 = aex * cey; - c = splitter * aex; - ahi = c - (c - aex); - alo = aex - ahi; - c = splitter * cey; - bhi = c - (c - cey); - blo = cey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cex * aey; - c = splitter * cex; - ahi = c - (c - cex); - alo = cex - ahi; - c = splitter * aey; - bhi = c - (c - aey); - blo = aey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ac[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ac[1] = _0 - (_i + bvirt) + (bvirt - t1); - ac3 = _j + _i; - bvirt = ac3 - _j; - ac[2] = _j - (ac3 - bvirt) + (_i - bvirt); - ac[3] = ac3; - s1 = bex * dey; - c = splitter * bex; - ahi = c - (c - bex); - alo = bex - ahi; - c = splitter * dey; - bhi = c - (c - dey); - blo = dey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = dex * bey; - c = splitter * dex; - ahi = c - (c - dex); - alo = dex - ahi; - c = splitter * bey; - bhi = c - (c - bey); - blo = bey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bd[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bd[1] = _0 - (_i + bvirt) + (bvirt - t1); - bd3 = _j + _i; - bvirt = bd3 - _j; - bd[2] = _j - (bd3 - bvirt) + (_i - bvirt); - bd[3] = bd3; - const finlen = sum(sum(negate(liftadapt(bc$2, cd, bd, dez, bez, -cez, aex, aey, aez, adet), adet), adet, liftadapt(cd, da, ac, aez, cez, dez, bex, bey, bez, bdet), bdet, abdet), abdet, sum(negate(liftadapt(da, ab$2, bd, bez, dez, aez, cex, cey, cez, cdet), cdet), cdet, liftadapt(ab$2, bc$2, ac, cez, aez, -bez, dex, dey, dez, ddet), ddet, cddet), cddet, fin$2); - let det = estimate(finlen, fin$2); - let errbound = isperrboundB * permanent; - if (det >= errbound || -det >= errbound) { - return det; - } - bvirt = ax - aex; - aextail = ax - (aex + bvirt) + (bvirt - ex); - bvirt = ay - aey; - aeytail = ay - (aey + bvirt) + (bvirt - ey); - bvirt = az - aez; - aeztail = az - (aez + bvirt) + (bvirt - ez); - bvirt = bx - bex; - bextail = bx - (bex + bvirt) + (bvirt - ex); - bvirt = by - bey; - beytail = by - (bey + bvirt) + (bvirt - ey); - bvirt = bz - bez; - beztail = bz - (bez + bvirt) + (bvirt - ez); - bvirt = cx - cex; - cextail = cx - (cex + bvirt) + (bvirt - ex); - bvirt = cy - cey; - ceytail = cy - (cey + bvirt) + (bvirt - ey); - bvirt = cz - cez; - ceztail = cz - (cez + bvirt) + (bvirt - ez); - bvirt = dx - dex; - dextail = dx - (dex + bvirt) + (bvirt - ex); - bvirt = dy - dey; - deytail = dy - (dey + bvirt) + (bvirt - ey); - bvirt = dz - dez; - deztail = dz - (dez + bvirt) + (bvirt - ez); - if (aextail === 0 && aeytail === 0 && aeztail === 0 && bextail === 0 && beytail === 0 && beztail === 0 && cextail === 0 && ceytail === 0 && ceztail === 0 && dextail === 0 && deytail === 0 && deztail === 0) { - return det; - } - errbound = isperrboundC * permanent + resulterrbound * Math.abs(det); - const abeps = aex * beytail + bey * aextail - (aey * bextail + bex * aeytail); - const bceps = bex * ceytail + cey * bextail - (bey * cextail + cex * beytail); - const cdeps = cex * deytail + dey * cextail - (cey * dextail + dex * ceytail); - const daeps = dex * aeytail + aey * dextail - (dey * aextail + aex * deytail); - const aceps = aex * ceytail + cey * aextail - (aey * cextail + cex * aeytail); - const bdeps = bex * deytail + dey * bextail - (bey * dextail + dex * beytail); - det += (bex * bex + bey * bey + bez * bez) * (cez * daeps + dez * aceps + aez * cdeps + (ceztail * da3 + deztail * ac3 + aeztail * cd3)) + (dex * dex + dey * dey + dez * dez) * (aez * bceps - bez * aceps + cez * abeps + (aeztail * bc3 - beztail * ac3 + ceztail * ab3)) - ((aex * aex + aey * aey + aez * aez) * (bez * cdeps - cez * bdeps + dez * bceps + (beztail * cd3 - ceztail * bd3 + deztail * bc3)) + (cex * cex + cey * cey + cez * cez) * (dez * abeps + aez * bdeps + bez * daeps + (deztail * ab3 + aeztail * bd3 + beztail * da3))) + 2 * ((bex * bextail + bey * beytail + bez * beztail) * (cez * da3 + dez * ac3 + aez * cd3) + (dex * dextail + dey * deytail + dez * deztail) * (aez * bc3 - bez * ac3 + cez * ab3) - ((aex * aextail + aey * aeytail + aez * aeztail) * (bez * cd3 - cez * bd3 + dez * bc3) + (cex * cextail + cey * ceytail + cez * ceztail) * (dez * ab3 + aez * bd3 + bez * da3))); - if (det >= errbound || -det >= errbound) { - return det; - } - return insphereexact(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez); -} -function insphere(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez) { - const aex = ax - ex; - const bex = bx - ex; - const cex = cx - ex; - const dex = dx - ex; - const aey = ay - ey; - const bey = by - ey; - const cey = cy - ey; - const dey = dy - ey; - const aez = az - ez; - const bez = bz - ez; - const cez = cz - ez; - const dez = dz - ez; - const aexbey = aex * bey; - const bexaey = bex * aey; - const ab2 = aexbey - bexaey; - const bexcey = bex * cey; - const cexbey = cex * bey; - const bc2 = bexcey - cexbey; - const cexdey = cex * dey; - const dexcey = dex * cey; - const cd2 = cexdey - dexcey; - const dexaey = dex * aey; - const aexdey = aex * dey; - const da2 = dexaey - aexdey; - const aexcey = aex * cey; - const cexaey = cex * aey; - const ac2 = aexcey - cexaey; - const bexdey = bex * dey; - const dexbey = dex * bey; - const bd2 = bexdey - dexbey; - const abc2 = aez * bc2 - bez * ac2 + cez * ab2; - const bcd2 = bez * cd2 - cez * bd2 + dez * bc2; - const cda2 = cez * da2 + dez * ac2 + aez * cd2; - const dab = dez * ab2 + aez * bd2 + bez * da2; - const alift = aex * aex + aey * aey + aez * aez; - const blift = bex * bex + bey * bey + bez * bez; - const clift = cex * cex + cey * cey + cez * cez; - const dlift = dex * dex + dey * dey + dez * dez; - const det = clift * dab - dlift * abc2 + (alift * bcd2 - blift * cda2); - const aezplus = Math.abs(aez); - const bezplus = Math.abs(bez); - const cezplus = Math.abs(cez); - const dezplus = Math.abs(dez); - const aexbeyplus = Math.abs(aexbey); - const bexaeyplus = Math.abs(bexaey); - const bexceyplus = Math.abs(bexcey); - const cexbeyplus = Math.abs(cexbey); - const cexdeyplus = Math.abs(cexdey); - const dexceyplus = Math.abs(dexcey); - const dexaeyplus = Math.abs(dexaey); - const aexdeyplus = Math.abs(aexdey); - const aexceyplus = Math.abs(aexcey); - const cexaeyplus = Math.abs(cexaey); - const bexdeyplus = Math.abs(bexdey); - const dexbeyplus = Math.abs(dexbey); - const permanent = ((cexdeyplus + dexceyplus) * bezplus + (dexbeyplus + bexdeyplus) * cezplus + (bexceyplus + cexbeyplus) * dezplus) * alift + ((dexaeyplus + aexdeyplus) * cezplus + (aexceyplus + cexaeyplus) * dezplus + (cexdeyplus + dexceyplus) * aezplus) * blift + ((aexbeyplus + bexaeyplus) * dezplus + (bexdeyplus + dexbeyplus) * aezplus + (dexaeyplus + aexdeyplus) * bezplus) * clift + ((bexceyplus + cexbeyplus) * aezplus + (cexaeyplus + aexceyplus) * bezplus + (aexbeyplus + bexaeyplus) * cezplus) * dlift; - const errbound = isperrboundA * permanent; - if (det > errbound || -det > errbound) { - return det; - } - return -insphereadapt(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez, permanent); -} -function inspherefast(pax, pay, paz, pbx, pby, pbz, pcx, pcy, pcz, pdx, pdy, pdz, pex, pey, pez) { - const aex = pax - pex; - const bex = pbx - pex; - const cex = pcx - pex; - const dex = pdx - pex; - const aey = pay - pey; - const bey = pby - pey; - const cey = pcy - pey; - const dey = pdy - pey; - const aez = paz - pez; - const bez = pbz - pez; - const cez = pcz - pez; - const dez = pdz - pez; - const ab2 = aex * bey - bex * aey; - const bc2 = bex * cey - cex * bey; - const cd2 = cex * dey - dex * cey; - const da2 = dex * aey - aex * dey; - const ac2 = aex * cey - cex * aey; - const bd2 = bex * dey - dex * bey; - const abc2 = aez * bc2 - bez * ac2 + cez * ab2; - const bcd2 = bez * cd2 - cez * bd2 + dez * bc2; - const cda2 = cez * da2 + dez * ac2 + aez * cd2; - const dab = dez * ab2 + aez * bd2 + bez * da2; - const alift = aex * aex + aey * aey + aez * aez; - const blift = bex * bex + bey * bey + bez * bez; - const clift = cex * cex + cey * cey + cez * cez; - const dlift = dex * dex + dey * dey + dez * dez; - return clift * dab - dlift * abc2 + (alift * bcd2 - blift * cda2); -} -export {incircle, incirclefast, insphere, inspherefast, orient2d, orient2dfast, orient3d, orient3dfast}; -export default null; diff --git a/web/client/index.html b/web/client/index.html index 687d3bfe..63a7eca7 100644 --- a/web/client/index.html +++ b/web/client/index.html @@ -1,333 +1,12 @@ - - - SORO-S - - - - - - - - - - - - - - - - - - - + + + + SORO-S + + +
+ + + \ No newline at end of file diff --git a/web/client/model/InfrastructureManager.js b/web/client/model/InfrastructureManager.js deleted file mode 100644 index e9aee883..00000000 --- a/web/client/model/InfrastructureManager.js +++ /dev/null @@ -1,65 +0,0 @@ -import { getInfrastructureComponents } from "../utl/goldenLayoutHelper.js"; - -function loadInfrastructureFromIDBFS(filePath) { - console.log("This is to be removed"); -} - -export class InfrastructureManager { - _current = undefined; - - constructor() { - } - - updateInfrastructureComponents() { - for (const infrastructureComponent of getInfrastructureComponents()) { - infrastructureComponent.changeInfrastructure(this._current); - } - } - - get() { - return this._current; - } - - load(infrastructureFilename) { - console.log("Switching to infrastructure to", infrastructureFilename); - this._current = infrastructureFilename; - this.updateInfrastructureComponents(); - } - - unload() { - this._current = undefined; - this.updateInfrastructureComponents(); - } - - addInfrastructureComponent() { - window.goldenLayout.addComponent('InfrastructureComponent', { - getCurrentInfrastructure: () => { - return this._current - } - }, 'Infrastructure') - } - - highlightSignalStationRoute(signalStationRouteID) { - for (const infrastructureComponent of getInfrastructureComponents()) { - infrastructureComponent.highlightSignalStationRoute(signalStationRouteID); - } - } - - deHighlightSignalStationRoute(signalStationRouteID) { - for (const infrastructureComponent of getInfrastructureComponents()) { - infrastructureComponent.deHighlightSignalStationRoute(signalStationRouteID); - } - } - - highlightStationRoute(stationRouteID) { - for (const infrastructureComponent of getInfrastructureComponents()) { - infrastructureComponent.highlightStationRoute(stationRouteID); - } - } - - deHighlightStationRoute(stationRouteID) { - for (const infrastructureComponent of getInfrastructureComponents()) { - infrastructureComponent.deHighlightStationRoute(stationRouteID); - } - } -} \ No newline at end of file diff --git a/web/client/model/TimetableManager.js b/web/client/model/TimetableManager.js deleted file mode 100644 index ec375af2..00000000 --- a/web/client/model/TimetableManager.js +++ /dev/null @@ -1,101 +0,0 @@ -// import { -// exists, -// saveToPersistent, -// saveFileToIDBFS, -// timetableFileExists -// } from "../utl/IDBFSHelper.js"; -import { - getComponents, - getTimetableComponents -} from "../utl/goldenLayoutHelper.js"; - -// import { Module } from "../soro-client.js"; - -function loadTimetableFromIDBFS(filePath, currentInfrastructure) { - /* Loading from cache is very slow atm, so disabled - const cachePath = new Module.FilesystemPath('/idbfs/cache/' + infrastructureFilename); - if (exists(cachePath.string())) { - this._current = new Module.Infrastructure(cachePath, true); - } else { - */ - - const timetableOpts = new Module.TimetableOptions(); - timetableOpts.timetable_path = new Module.FilesystemPath(filePath); - - try { - return new Module.Timetable(timetableOpts, currentInfrastructure); - } catch (e) { - console.error(e); - } - - /* try { - this._current.save(cachePath); - saveToPersistent(); - } catch (e) { - console.error("Could not write serialized cache, maybe compiled without SERIALIZE?"); - console.error(e); - } -} - */ -} - -export class TimetableManager { - constructor() { - } - - updateTimetableComponents() { - for (const timetableComponent of getTimetableComponents()) { - timetableComponent.changeTimetable(this._current); - } - } - - notifyComponents() { - console.log("components", getComponents()); - for (const component of getComponents()) { - component.changeTimetable && component.changeTimetable(this._current); - } - } - - get() { - return this._current; - } - - load(timetableFilename, currentInfrastructure) { - if (!currentInfrastructure) { - console.error("Tried loading a timetable with the currentInfrastructure undefined!"); - return; - } - - let timetablePath = timetableFileExists(timetableFilename) - - if (timetablePath) { - console.log("Reading", timetablePath, "from IDBFS."); - this._current = loadTimetableFromIDBFS(timetablePath, currentInfrastructure) - this.updateTimetableComponents(); - } else { - console.log("Fetching", timetableFilename, "from server."); - fetch(window.origin + '/timetable/' + timetableFilename) - .then(response => response.arrayBuffer()) - .then(buf => saveFileToIDBFS(timetableFilename, buf)) - .then(filePath => this._current = loadTimetableFromIDBFS(filePath, currentInfrastructure)) - .then(_ => this.updateTimetableComponents()) - .catch(e => console.error(e)); - } - - - this.updateTimetableComponents(); - this.notifyComponents(); - } - - unload() { - this._current = undefined; - this.updateTimetableComponents(); - this.notifyComponents(); - } - - addTimetableComponent() { - window.goldenLayout.addComponent('TimetableComponent', {}, 'Timetable') - } - - _current = undefined; -} \ No newline at end of file diff --git a/web/client/package-lock.json b/web/client/package-lock.json new file mode 100644 index 00000000..5726dc1d --- /dev/null +++ b/web/client/package-lock.json @@ -0,0 +1,8068 @@ +{ + "name": "soro-s-web-client", + "version": "0.1.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "soro-s-web-client", + "version": "0.1.0", + "license": "MIT", + "dependencies": { + "d3": "^7.6.1", + "golden-layout": "^2.6.0", + "maplibre-gl": "^2.4.0", + "vue": "^3.2.45", + "vuex": "^4.1.0" + }, + "devDependencies": { + "@typescript-eslint/parser": "^5.45.1", + "@vitejs/plugin-vue": "^3.2.0", + "@vue/eslint-config-typescript": "^11.0.2", + "eslint": "^8.29.0", + "eslint-plugin-vue": "^9.8.0", + "stylelint": "^14.16.1", + "stylelint-config-recommended-vue": "^1.4.0", + "stylelint-config-standard-scss": "^6.1.0", + "typescript": "^4.9.3", + "vite": "^3.2.4", + "vite-tsconfig-paths": "4.0.3", + "vue-tsc": "^1.0.9" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", + "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", + "dev": true, + "dependencies": { + "@babel/highlight": "^7.18.6" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", + "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", + "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.18.6", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/highlight/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "node_modules/@babel/highlight/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@babel/highlight/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/parser": { + "version": "7.20.3", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.20.3.tgz", + "integrity": "sha512-OP/s5a94frIPXwjzEcv5S/tpQfc6XhxYUnmWpgdqMWGgYCuErA3SzozaRAMQgSZWKeTJxht9aWAkUY+0UzvOFg==", + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@csstools/selector-specificity": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@csstools/selector-specificity/-/selector-specificity-2.0.2.tgz", + "integrity": "sha512-IkpVW/ehM1hWKln4fCA3NzJU8KwD+kIOvPZA4cqxoJHtE21CCzjyp+Kxbu0i5I4tBNOlXPL9mjwnWlL0VEG4Fg==", + "dev": true, + "engines": { + "node": "^12 || ^14 || >=16" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + }, + "peerDependencies": { + "postcss": "^8.2", + "postcss-selector-parser": "^6.0.10" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.15.15.tgz", + "integrity": "sha512-JJjZjJi2eBL01QJuWjfCdZxcIgot+VoK6Fq7eKF9w4YHm9hwl7nhBR1o2Wnt/WcANk5l9SkpvrldW1PLuXxcbw==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.15.15.tgz", + "integrity": "sha512-lhz6UNPMDXUhtXSulw8XlFAtSYO26WmHQnCi2Lg2p+/TMiJKNLtZCYUxV4wG6rZMzXmr8InGpNwk+DLT2Hm0PA==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.3.tgz", + "integrity": "sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.4.0", + "globals": "^13.15.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@eslint/eslintrc/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.11.7", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.7.tgz", + "integrity": "sha512-kBbPWzN8oVMLb0hOUYXhmxggL/1cJE6ydvjDIGi9EnAGUyA7cLVKQg+d/Dsm+KZwx2czGHrCmMVLiyg8s5JPKw==", + "dev": true, + "dependencies": { + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/config-array/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@humanwhocodes/config-array/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true + }, + "node_modules/@mapbox/geojson-rewind": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@mapbox/geojson-rewind/-/geojson-rewind-0.5.2.tgz", + "integrity": "sha512-tJaT+RbYGJYStt7wI3cq4Nl4SXxG8W7JDG5DMJu97V25RnbNg3QtQtf+KD+VLjNpWKYsRvXDNmNrBgEETr1ifA==", + "dependencies": { + "get-stream": "^6.0.1", + "minimist": "^1.2.6" + }, + "bin": { + "geojson-rewind": "geojson-rewind" + } + }, + "node_modules/@mapbox/jsonlint-lines-primitives": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@mapbox/jsonlint-lines-primitives/-/jsonlint-lines-primitives-2.0.2.tgz", + "integrity": "sha512-rY0o9A5ECsTQRVhv7tL/OyDpGAoUB4tTvLiW1DSzQGq4bvTPhNw1VpSNjDJc5GFZ2XuyOtSWSVN05qOtcD71qQ==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/@mapbox/mapbox-gl-supported": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@mapbox/mapbox-gl-supported/-/mapbox-gl-supported-2.0.1.tgz", + "integrity": "sha512-HP6XvfNIzfoMVfyGjBckjiAOQK9WfX0ywdLubuPMPv+Vqf5fj0uCbgBQYpiqcWZT6cbyyRnTSXDheT1ugvF6UQ==" + }, + "node_modules/@mapbox/point-geometry": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@mapbox/point-geometry/-/point-geometry-0.1.0.tgz", + "integrity": "sha512-6j56HdLTwWGO0fJPlrZtdU/B13q8Uwmo18Ck2GnGgN9PCFyKTZ3UbXeEdRFh18i9XQ92eH2VdtpJHpBD3aripQ==" + }, + "node_modules/@mapbox/tiny-sdf": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@mapbox/tiny-sdf/-/tiny-sdf-2.0.5.tgz", + "integrity": "sha512-OhXt2lS//WpLdkqrzo/KwB7SRD8AiNTFFzuo9n14IBupzIMa67yGItcK7I2W9D8Ghpa4T04Sw9FWsKCJG50Bxw==" + }, + "node_modules/@mapbox/unitbezier": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@mapbox/unitbezier/-/unitbezier-0.0.1.tgz", + "integrity": "sha512-nMkuDXFv60aBr9soUG5q+GvZYL+2KZHVvsqFCzqnkGEf46U2fvmytHaEVc1/YZbiLn8X+eR3QzX1+dwDO1lxlw==" + }, + "node_modules/@mapbox/vector-tile": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@mapbox/vector-tile/-/vector-tile-1.3.1.tgz", + "integrity": "sha512-MCEddb8u44/xfQ3oD+Srl/tNcQoqTw3goGk2oLsrFxOTc3dUp+kAnby3PvAeeBYSMSjSPD1nd1AJA6W49WnoUw==", + "dependencies": { + "@mapbox/point-geometry": "~0.1.0" + } + }, + "node_modules/@mapbox/whoots-js": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@mapbox/whoots-js/-/whoots-js-3.1.0.tgz", + "integrity": "sha512-Es6WcD0nO5l+2BOQS4uLfNPYQaNDfbot3X1XUoloz+x0mPDS3eeORZJl06HXjwBG1fOGwCRnzK88LMdxKRrd6Q==", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@types/geojson": { + "version": "7946.0.10", + "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.10.tgz", + "integrity": "sha512-Nmh0K3iWQJzniTuPRcJn5hxXkfB1T1pgB89SBig5PlJQU5yocazeu4jATJlaA0GYFKWMqDdvYemoSnF2pXgLVA==" + }, + "node_modules/@types/json-schema": { + "version": "7.0.11", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", + "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "dev": true + }, + "node_modules/@types/mapbox__point-geometry": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@types/mapbox__point-geometry/-/mapbox__point-geometry-0.1.2.tgz", + "integrity": "sha512-D0lgCq+3VWV85ey1MZVkE8ZveyuvW5VAfuahVTQRpXFQTxw03SuIf1/K4UQ87MMIXVKzpFjXFiFMZzLj2kU+iA==" + }, + "node_modules/@types/mapbox__vector-tile": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@types/mapbox__vector-tile/-/mapbox__vector-tile-1.3.0.tgz", + "integrity": "sha512-kDwVreQO5V4c8yAxzZVQLE5tyWF+IPToAanloQaSnwfXmIcJ7cyOrv8z4Ft4y7PsLYmhWXmON8MBV8RX0Rgr8g==", + "dependencies": { + "@types/geojson": "*", + "@types/mapbox__point-geometry": "*", + "@types/pbf": "*" + } + }, + "node_modules/@types/minimist": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.2.tgz", + "integrity": "sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==", + "dev": true + }, + "node_modules/@types/normalize-package-data": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz", + "integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==", + "dev": true + }, + "node_modules/@types/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==", + "dev": true + }, + "node_modules/@types/pbf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/pbf/-/pbf-3.0.2.tgz", + "integrity": "sha512-EDrLIPaPXOZqDjrkzxxbX7UlJSeQVgah3i0aA4pOSzmK9zq3BIh7/MZIQxED7slJByvKM4Gc6Hypyu2lJzh3SQ==" + }, + "node_modules/@types/semver": { + "version": "7.3.13", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", + "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", + "dev": true + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "5.45.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.45.1.tgz", + "integrity": "sha512-cOizjPlKEh0bXdFrBLTrI/J6B/QMlhwE9auOov53tgB+qMukH6/h8YAK/qw+QJGct/PTbdh2lytGyipxCcEtAw==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "5.45.1", + "@typescript-eslint/type-utils": "5.45.1", + "@typescript-eslint/utils": "5.45.1", + "debug": "^4.3.4", + "ignore": "^5.2.0", + "natural-compare-lite": "^1.4.0", + "regexpp": "^3.2.0", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^5.0.0", + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "5.45.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.45.1.tgz", + "integrity": "sha512-JQ3Ep8bEOXu16q0ztsatp/iQfDCtvap7sp/DKo7DWltUquj5AfCOpX2zSzJ8YkAVnrQNqQ5R62PBz2UtrfmCkA==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "5.45.1", + "@typescript-eslint/types": "5.45.1", + "@typescript-eslint/typescript-estree": "5.45.1", + "debug": "^4.3.4" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "5.45.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.45.1.tgz", + "integrity": "sha512-D6fCileR6Iai7E35Eb4Kp+k0iW7F1wxXYrOhX/3dywsOJpJAQ20Fwgcf+P/TDtvQ7zcsWsrJaglaQWDhOMsspQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.45.1", + "@typescript-eslint/visitor-keys": "5.45.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "5.45.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.45.1.tgz", + "integrity": "sha512-aosxFa+0CoYgYEl3aptLe1svP910DJq68nwEJzyQcrtRhC4BN0tJAvZGAe+D0tzjJmFXe+h4leSsiZhwBa2vrA==", + "dev": true, + "dependencies": { + "@typescript-eslint/typescript-estree": "5.45.1", + "@typescript-eslint/utils": "5.45.1", + "debug": "^4.3.4", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "*" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/types": { + "version": "5.45.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.45.1.tgz", + "integrity": "sha512-HEW3U0E5dLjUT+nk7b4lLbOherS1U4ap+b9pfu2oGsW3oPu7genRaY9dDv3nMczC1rbnRY2W/D7SN05wYoGImg==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "5.45.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.45.1.tgz", + "integrity": "sha512-76NZpmpCzWVrrb0XmYEpbwOz/FENBi+5W7ipVXAsG3OoFrQKJMiaqsBMbvGRyLtPotGqUfcY7Ur8j0dksDJDng==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.45.1", + "@typescript-eslint/visitor-keys": "5.45.1", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "5.45.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.45.1.tgz", + "integrity": "sha512-rlbC5VZz68+yjAzQBc4I7KDYVzWG2X/OrqoZrMahYq3u8FFtmQYc+9rovo/7wlJH5kugJ+jQXV5pJMnofGmPRw==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.9", + "@types/semver": "^7.3.12", + "@typescript-eslint/scope-manager": "5.45.1", + "@typescript-eslint/types": "5.45.1", + "@typescript-eslint/typescript-estree": "5.45.1", + "eslint-scope": "^5.1.1", + "eslint-utils": "^3.0.0", + "semver": "^7.3.7" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "5.45.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.45.1.tgz", + "integrity": "sha512-cy9ln+6rmthYWjH9fmx+5FU/JDpjQb586++x2FZlveq7GdGuLLW9a2Jcst2TGekH82bXpfmRNSwP9tyEs6RjvQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.45.1", + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@vitejs/plugin-vue": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-3.2.0.tgz", + "integrity": "sha512-E0tnaL4fr+qkdCNxJ+Xd0yM31UwMkQje76fsDVBBUCoGOUPexu2VDUYHL8P4CwV+zMvWw6nlRw19OnRKmYAJpw==", + "dev": true, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "peerDependencies": { + "vite": "^3.0.0", + "vue": "^3.2.25" + } + }, + "node_modules/@volar/language-core": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-1.0.9.tgz", + "integrity": "sha512-5Fty3slLet6svXiJw2YxhYeo6c7wFdtILrql5bZymYLM+HbiZtJbryW1YnUEKAP7MO9Mbeh+TNH4Z0HFxHgIqw==", + "dev": true, + "dependencies": { + "@volar/source-map": "1.0.9", + "@vue/reactivity": "^3.2.40", + "muggle-string": "^0.1.0" + } + }, + "node_modules/@volar/source-map": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-1.0.9.tgz", + "integrity": "sha512-fazB/vy5ZEJ3yKx4fabJyGNI3CBkdLkfEIRVu6+1P3VixK0Mn+eqyUIkLBrzGYaeFM3GybhCLCvsVdNz0Fu/CQ==", + "dev": true, + "dependencies": { + "muggle-string": "^0.1.0" + } + }, + "node_modules/@volar/typescript": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@volar/typescript/-/typescript-1.0.9.tgz", + "integrity": "sha512-dVziu+ShQUWuMukM6bvK2v2O446/gG6l1XkTh2vfkccw1IzjfbiP1TWQoNo1ipTfZOtu5YJGYAx+o5HNrGXWfQ==", + "dev": true, + "dependencies": { + "@volar/language-core": "1.0.9" + } + }, + "node_modules/@volar/vue-language-core": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@volar/vue-language-core/-/vue-language-core-1.0.9.tgz", + "integrity": "sha512-tofNoR8ShPFenHT1YVMuvoXtXWwoQE+fiXVqSmW0dSKZqEDjWQ3YeXSd0a6aqyKaIbvR7kWWGp34WbpQlwf9Ww==", + "dev": true, + "dependencies": { + "@volar/language-core": "1.0.9", + "@volar/source-map": "1.0.9", + "@vue/compiler-dom": "^3.2.40", + "@vue/compiler-sfc": "^3.2.40", + "@vue/reactivity": "^3.2.40", + "@vue/shared": "^3.2.40", + "minimatch": "^5.1.0", + "vue-template-compiler": "^2.7.10" + } + }, + "node_modules/@volar/vue-typescript": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@volar/vue-typescript/-/vue-typescript-1.0.9.tgz", + "integrity": "sha512-ZLe4y9YNbviACa7uAMCilzxA76gbbSlKfjspXBzk6fCobd8QCIig+VyDYcjANIlm2HhgSCX8jYTzhCKlegh4mw==", + "dev": true, + "dependencies": { + "@volar/typescript": "1.0.9", + "@volar/vue-language-core": "1.0.9" + } + }, + "node_modules/@vue/compiler-core": { + "version": "3.2.45", + "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.2.45.tgz", + "integrity": "sha512-rcMj7H+PYe5wBV3iYeUgbCglC+pbpN8hBLTJvRiK2eKQiWqu+fG9F+8sW99JdL4LQi7Re178UOxn09puSXvn4A==", + "dependencies": { + "@babel/parser": "^7.16.4", + "@vue/shared": "3.2.45", + "estree-walker": "^2.0.2", + "source-map": "^0.6.1" + } + }, + "node_modules/@vue/compiler-dom": { + "version": "3.2.45", + "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.2.45.tgz", + "integrity": "sha512-tyYeUEuKqqZO137WrZkpwfPCdiiIeXYCcJ8L4gWz9vqaxzIQRccTSwSWZ/Axx5YR2z+LvpUbmPNXxuBU45lyRw==", + "dependencies": { + "@vue/compiler-core": "3.2.45", + "@vue/shared": "3.2.45" + } + }, + "node_modules/@vue/compiler-sfc": { + "version": "3.2.45", + "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.2.45.tgz", + "integrity": "sha512-1jXDuWah1ggsnSAOGsec8cFjT/K6TMZ0sPL3o3d84Ft2AYZi2jWJgRMjw4iaK0rBfA89L5gw427H4n1RZQBu6Q==", + "dependencies": { + "@babel/parser": "^7.16.4", + "@vue/compiler-core": "3.2.45", + "@vue/compiler-dom": "3.2.45", + "@vue/compiler-ssr": "3.2.45", + "@vue/reactivity-transform": "3.2.45", + "@vue/shared": "3.2.45", + "estree-walker": "^2.0.2", + "magic-string": "^0.25.7", + "postcss": "^8.1.10", + "source-map": "^0.6.1" + } + }, + "node_modules/@vue/compiler-ssr": { + "version": "3.2.45", + "resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.2.45.tgz", + "integrity": "sha512-6BRaggEGqhWht3lt24CrIbQSRD5O07MTmd+LjAn5fJj568+R9eUD2F7wMQJjX859seSlrYog7sUtrZSd7feqrQ==", + "dependencies": { + "@vue/compiler-dom": "3.2.45", + "@vue/shared": "3.2.45" + } + }, + "node_modules/@vue/devtools-api": { + "version": "6.4.5", + "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.4.5.tgz", + "integrity": "sha512-JD5fcdIuFxU4fQyXUu3w2KpAJHzTVdN+p4iOX2lMWSHMOoQdMAcpFLZzm9Z/2nmsoZ1a96QEhZ26e50xLBsgOQ==" + }, + "node_modules/@vue/eslint-config-typescript": { + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/@vue/eslint-config-typescript/-/eslint-config-typescript-11.0.2.tgz", + "integrity": "sha512-EiKud1NqlWmSapBFkeSrE994qpKx7/27uCGnhdqzllYDpQZroyX/O6bwjEpeuyKamvLbsGdO6PMR2faIf+zFnw==", + "dev": true, + "dependencies": { + "@typescript-eslint/eslint-plugin": "^5.0.0", + "@typescript-eslint/parser": "^5.0.0", + "vue-eslint-parser": "^9.0.0" + }, + "engines": { + "node": "^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.2.0 || ^7.0.0 || ^8.0.0", + "eslint-plugin-vue": "^9.0.0", + "typescript": "*" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@vue/reactivity": { + "version": "3.2.45", + "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.2.45.tgz", + "integrity": "sha512-PRvhCcQcyEVohW0P8iQ7HDcIOXRjZfAsOds3N99X/Dzewy8TVhTCT4uXpAHfoKjVTJRA0O0K+6QNkDIZAxNi3A==", + "dependencies": { + "@vue/shared": "3.2.45" + } + }, + "node_modules/@vue/reactivity-transform": { + "version": "3.2.45", + "resolved": "https://registry.npmjs.org/@vue/reactivity-transform/-/reactivity-transform-3.2.45.tgz", + "integrity": "sha512-BHVmzYAvM7vcU5WmuYqXpwaBHjsS8T63jlKGWVtHxAHIoMIlmaMyurUSEs1Zcg46M4AYT5MtB1U274/2aNzjJQ==", + "dependencies": { + "@babel/parser": "^7.16.4", + "@vue/compiler-core": "3.2.45", + "@vue/shared": "3.2.45", + "estree-walker": "^2.0.2", + "magic-string": "^0.25.7" + } + }, + "node_modules/@vue/runtime-core": { + "version": "3.2.45", + "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.2.45.tgz", + "integrity": "sha512-gzJiTA3f74cgARptqzYswmoQx0fIA+gGYBfokYVhF8YSXjWTUA2SngRzZRku2HbGbjzB6LBYSbKGIaK8IW+s0A==", + "dependencies": { + "@vue/reactivity": "3.2.45", + "@vue/shared": "3.2.45" + } + }, + "node_modules/@vue/runtime-dom": { + "version": "3.2.45", + "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.2.45.tgz", + "integrity": "sha512-cy88YpfP5Ue2bDBbj75Cb4bIEZUMM/mAkDMfqDTpUYVgTf/kuQ2VQ8LebuZ8k6EudgH8pYhsGWHlY0lcxlvTwA==", + "dependencies": { + "@vue/runtime-core": "3.2.45", + "@vue/shared": "3.2.45", + "csstype": "^2.6.8" + } + }, + "node_modules/@vue/server-renderer": { + "version": "3.2.45", + "resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.2.45.tgz", + "integrity": "sha512-ebiMq7q24WBU1D6uhPK//2OTR1iRIyxjF5iVq/1a5I1SDMDyDu4Ts6fJaMnjrvD3MqnaiFkKQj+LKAgz5WIK3g==", + "dependencies": { + "@vue/compiler-ssr": "3.2.45", + "@vue/shared": "3.2.45" + }, + "peerDependencies": { + "vue": "3.2.45" + } + }, + "node_modules/@vue/shared": { + "version": "3.2.45", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.2.45.tgz", + "integrity": "sha512-Ewzq5Yhimg7pSztDV+RH1UDKBzmtqieXQlpTVm2AwraoRL/Rks96mvd8Vgi7Lj+h+TH8dv7mXD3FRZR3TUvbSg==" + }, + "node_modules/acorn": { + "version": "8.8.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", + "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/astral-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", + "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", + "dev": true + }, + "node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase-keys": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.2.tgz", + "integrity": "sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==", + "dev": true, + "dependencies": { + "camelcase": "^5.3.1", + "map-obj": "^4.0.0", + "quick-lru": "^4.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/colord": { + "version": "2.9.3", + "resolved": "https://registry.npmjs.org/colord/-/colord-2.9.3.tgz", + "integrity": "sha512-jeC1axXpnb0/2nn/Y1LPuLdgXBLH7aDcHu4KEKfqw3CUhX7ZpfBSlPKyqXE6btIgEzfWtrX3/tyBCaCvXvMkOw==", + "dev": true + }, + "node_modules/commander": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", + "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "engines": { + "node": ">= 10" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "node_modules/cosmiconfig": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.1.0.tgz", + "integrity": "sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==", + "dev": true, + "dependencies": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.2.1", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.10.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/cross-spawn/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/css-functions-list": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/css-functions-list/-/css-functions-list-3.1.0.tgz", + "integrity": "sha512-/9lCvYZaUbBGvYUgYGFJ4dcYiyqdhSjG7IPVluoV8A1ILjkF7ilmhp1OGUz8n+nmBcu0RNrQAzgD8B6FJbrt2w==", + "dev": true, + "engines": { + "node": ">=12.22" + } + }, + "node_modules/csscolorparser": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/csscolorparser/-/csscolorparser-1.0.3.tgz", + "integrity": "sha512-umPSgYwZkdFoUrH5hIq5kf0wPSXiro51nPw0j2K/c83KflkPSTBGMz6NJvMB+07VlL0y7VPo6QJcDjcgKTTm3w==" + }, + "node_modules/cssesc": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", + "dev": true, + "bin": { + "cssesc": "bin/cssesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/csstype": { + "version": "2.6.21", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.21.tgz", + "integrity": "sha512-Z1PhmomIfypOpoMjRQB70jfvy/wxT50qW08YXO5lMIJkrdq4yOTR+AW7FqutScmB9NkLwxo+jU+kZLbofZZq/w==" + }, + "node_modules/d3": { + "version": "7.6.1", + "resolved": "https://registry.npmjs.org/d3/-/d3-7.6.1.tgz", + "integrity": "sha512-txMTdIHFbcpLx+8a0IFhZsbp+PfBBPt8yfbmukZTQFroKuFqIwqswF0qE5JXWefylaAVpSXFoKm3yP+jpNLFLw==", + "dependencies": { + "d3-array": "3", + "d3-axis": "3", + "d3-brush": "3", + "d3-chord": "3", + "d3-color": "3", + "d3-contour": "4", + "d3-delaunay": "6", + "d3-dispatch": "3", + "d3-drag": "3", + "d3-dsv": "3", + "d3-ease": "3", + "d3-fetch": "3", + "d3-force": "3", + "d3-format": "3", + "d3-geo": "3", + "d3-hierarchy": "3", + "d3-interpolate": "3", + "d3-path": "3", + "d3-polygon": "3", + "d3-quadtree": "3", + "d3-random": "3", + "d3-scale": "4", + "d3-scale-chromatic": "3", + "d3-selection": "3", + "d3-shape": "3", + "d3-time": "3", + "d3-time-format": "4", + "d3-timer": "3", + "d3-transition": "3", + "d3-zoom": "3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-array": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.2.0.tgz", + "integrity": "sha512-3yXFQo0oG3QCxbF06rMPFyGRMGJNS7NvsV1+2joOjbBE+9xvWQ8+GcMJAjRCzw06zQ3/arXeJgbPYcjUCuC+3g==", + "dependencies": { + "internmap": "1 - 2" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-axis": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-axis/-/d3-axis-3.0.0.tgz", + "integrity": "sha512-IH5tgjV4jE/GhHkRV0HiVYPDtvfjHQlQfJHs0usq7M30XcSBvOotpmH1IgkcXsO/5gEQZD43B//fc7SRT5S+xw==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-brush": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-brush/-/d3-brush-3.0.0.tgz", + "integrity": "sha512-ALnjWlVYkXsVIGlOsuWH1+3udkYFI48Ljihfnh8FZPF2QS9o+PzGLBslO0PjzVoHLZ2KCVgAM8NVkXPJB2aNnQ==", + "dependencies": { + "d3-dispatch": "1 - 3", + "d3-drag": "2 - 3", + "d3-interpolate": "1 - 3", + "d3-selection": "3", + "d3-transition": "3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-chord": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-chord/-/d3-chord-3.0.1.tgz", + "integrity": "sha512-VE5S6TNa+j8msksl7HwjxMHDM2yNK3XCkusIlpX5kwauBfXuyLAtNg9jCp/iHH61tgI4sb6R/EIMWCqEIdjT/g==", + "dependencies": { + "d3-path": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-color": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz", + "integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-contour": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/d3-contour/-/d3-contour-4.0.0.tgz", + "integrity": "sha512-7aQo0QHUTu/Ko3cP9YK9yUTxtoDEiDGwnBHyLxG5M4vqlBkO/uixMRele3nfsfj6UXOcuReVpVXzAboGraYIJw==", + "dependencies": { + "d3-array": "^3.2.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-delaunay": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/d3-delaunay/-/d3-delaunay-6.0.2.tgz", + "integrity": "sha512-IMLNldruDQScrcfT+MWnazhHbDJhcRJyOEBAJfwQnHle1RPh6WDuLvxNArUju2VSMSUuKlY5BGHRJ2cYyoFLQQ==", + "dependencies": { + "delaunator": "5" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-dispatch": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-dispatch/-/d3-dispatch-3.0.1.tgz", + "integrity": "sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-drag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-drag/-/d3-drag-3.0.0.tgz", + "integrity": "sha512-pWbUJLdETVA8lQNJecMxoXfH6x+mO2UQo8rSmZ+QqxcbyA3hfeprFgIT//HW2nlHChWeIIMwS2Fq+gEARkhTkg==", + "dependencies": { + "d3-dispatch": "1 - 3", + "d3-selection": "3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-dsv": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-dsv/-/d3-dsv-3.0.1.tgz", + "integrity": "sha512-UG6OvdI5afDIFP9w4G0mNq50dSOsXHJaRE8arAS5o9ApWnIElp8GZw1Dun8vP8OyHOZ/QJUKUJwxiiCCnUwm+Q==", + "dependencies": { + "commander": "7", + "iconv-lite": "0.6", + "rw": "1" + }, + "bin": { + "csv2json": "bin/dsv2json.js", + "csv2tsv": "bin/dsv2dsv.js", + "dsv2dsv": "bin/dsv2dsv.js", + "dsv2json": "bin/dsv2json.js", + "json2csv": "bin/json2dsv.js", + "json2dsv": "bin/json2dsv.js", + "json2tsv": "bin/json2dsv.js", + "tsv2csv": "bin/dsv2dsv.js", + "tsv2json": "bin/dsv2json.js" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-ease": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-3.0.1.tgz", + "integrity": "sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-fetch": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-fetch/-/d3-fetch-3.0.1.tgz", + "integrity": "sha512-kpkQIM20n3oLVBKGg6oHrUchHM3xODkTzjMoj7aWQFq5QEM+R6E4WkzT5+tojDY7yjez8KgCBRoj4aEr99Fdqw==", + "dependencies": { + "d3-dsv": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-force": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-force/-/d3-force-3.0.0.tgz", + "integrity": "sha512-zxV/SsA+U4yte8051P4ECydjD/S+qeYtnaIyAs9tgHCqfguma/aAQDjo85A9Z6EKhBirHRJHXIgJUlffT4wdLg==", + "dependencies": { + "d3-dispatch": "1 - 3", + "d3-quadtree": "1 - 3", + "d3-timer": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-format": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.0.tgz", + "integrity": "sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-geo": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-geo/-/d3-geo-3.0.1.tgz", + "integrity": "sha512-Wt23xBych5tSy9IYAM1FR2rWIBFWa52B/oF/GYe5zbdHrg08FU8+BuI6X4PvTwPDdqdAdq04fuWJpELtsaEjeA==", + "dependencies": { + "d3-array": "2.5.0 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-hierarchy": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/d3-hierarchy/-/d3-hierarchy-3.1.2.tgz", + "integrity": "sha512-FX/9frcub54beBdugHjDCdikxThEqjnR93Qt7PvQTOHxyiNCAlvMrHhclk3cD5VeAaq9fxmfRp+CnWw9rEMBuA==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-interpolate": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz", + "integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==", + "dependencies": { + "d3-color": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-path": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-3.0.1.tgz", + "integrity": "sha512-gq6gZom9AFZby0YLduxT1qmrp4xpBA1YZr19OI717WIdKE2OM5ETq5qrHLb301IgxhLwcuxvGZVLeeWc/k1I6w==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-polygon": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-polygon/-/d3-polygon-3.0.1.tgz", + "integrity": "sha512-3vbA7vXYwfe1SYhED++fPUQlWSYTTGmFmQiany/gdbiWgU/iEyQzyymwL9SkJjFFuCS4902BSzewVGsHHmHtXg==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-quadtree": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-quadtree/-/d3-quadtree-3.0.1.tgz", + "integrity": "sha512-04xDrxQTDTCFwP5H6hRhsRcb9xxv2RzkcsygFzmkSIOJy3PeRJP7sNk3VRIbKXcog561P9oU0/rVH6vDROAgUw==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-random": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-random/-/d3-random-3.0.1.tgz", + "integrity": "sha512-FXMe9GfxTxqd5D6jFsQ+DJ8BJS4E/fT5mqqdjovykEB2oFbTMDVdg1MGFxfQW+FBOGoB++k8swBrgwSHT1cUXQ==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-scale": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz", + "integrity": "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==", + "dependencies": { + "d3-array": "2.10.0 - 3", + "d3-format": "1 - 3", + "d3-interpolate": "1.2.0 - 3", + "d3-time": "2.1.1 - 3", + "d3-time-format": "2 - 4" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-scale-chromatic": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-scale-chromatic/-/d3-scale-chromatic-3.0.0.tgz", + "integrity": "sha512-Lx9thtxAKrO2Pq6OO2Ua474opeziKr279P/TKZsMAhYyNDD3EnCffdbgeSYN5O7m2ByQsxtuP2CSDczNUIZ22g==", + "dependencies": { + "d3-color": "1 - 3", + "d3-interpolate": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-selection": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-3.0.0.tgz", + "integrity": "sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-shape": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-3.1.0.tgz", + "integrity": "sha512-tGDh1Muf8kWjEDT/LswZJ8WF85yDZLvVJpYU9Nq+8+yW1Z5enxrmXOhTArlkaElU+CTn0OTVNli+/i+HP45QEQ==", + "dependencies": { + "d3-path": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-time": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.0.0.tgz", + "integrity": "sha512-zmV3lRnlaLI08y9IMRXSDshQb5Nj77smnfpnd2LrBa/2K281Jijactokeak14QacHs/kKq0AQ121nidNYlarbQ==", + "dependencies": { + "d3-array": "2 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-time-format": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-4.1.0.tgz", + "integrity": "sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==", + "dependencies": { + "d3-time": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-timer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-3.0.1.tgz", + "integrity": "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-transition": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-transition/-/d3-transition-3.0.1.tgz", + "integrity": "sha512-ApKvfjsSR6tg06xrL434C0WydLr7JewBB3V+/39RMHsaXTOG0zmt/OAXeng5M5LBm0ojmxJrpomQVZ1aPvBL4w==", + "dependencies": { + "d3-color": "1 - 3", + "d3-dispatch": "1 - 3", + "d3-ease": "1 - 3", + "d3-interpolate": "1 - 3", + "d3-timer": "1 - 3" + }, + "engines": { + "node": ">=12" + }, + "peerDependencies": { + "d3-selection": "2 - 3" + } + }, + "node_modules/d3-zoom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-zoom/-/d3-zoom-3.0.0.tgz", + "integrity": "sha512-b8AmV3kfQaqWAuacbPuNbL6vahnOJflOhexLzMMNLga62+/nh0JzvJ0aO/5a5MVgUFGS7Hu1P9P03o3fJkDCyw==", + "dependencies": { + "d3-dispatch": "1 - 3", + "d3-drag": "2 - 3", + "d3-interpolate": "1 - 3", + "d3-selection": "2 - 3", + "d3-transition": "2 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/de-indent": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/de-indent/-/de-indent-1.0.2.tgz", + "integrity": "sha512-e/1zu3xH5MQryN2zdVaF0OrdNLUbvWxzMbi+iNA6Bky7l1RoP8a2fIbRocyHclXt/arDrrR6lL3TqFD9pMQTsg==", + "dev": true + }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decamelize-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.1.tgz", + "integrity": "sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==", + "dev": true, + "dependencies": { + "decamelize": "^1.1.0", + "map-obj": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/decamelize-keys/node_modules/map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, + "node_modules/delaunator": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/delaunator/-/delaunator-5.0.0.tgz", + "integrity": "sha512-AyLvtyJdbv/U1GkiS6gUUzclRoAY4Gs75qkMygJJhU75LW4DNuSF2RMzpxs9jw9Oz1BobHjTdkG3zdP55VxAqw==", + "dependencies": { + "robust-predicates": "^3.0.0" + } + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/dom-serializer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", + "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", + "dev": true, + "peer": true, + "dependencies": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.2", + "entities": "^4.2.0" + }, + "funding": { + "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" + } + }, + "node_modules/domelementtype": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", + "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "peer": true + }, + "node_modules/domhandler": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", + "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", + "dev": true, + "peer": true, + "dependencies": { + "domelementtype": "^2.3.0" + }, + "engines": { + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" + } + }, + "node_modules/domutils": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.0.1.tgz", + "integrity": "sha512-z08c1l761iKhDFtfXO04C7kTdPBLi41zwOZl00WS8b5eiaebNpY00HKbztwBq+e3vyqWNwWF3mP9YLUeqIrF+Q==", + "dev": true, + "peer": true, + "dependencies": { + "dom-serializer": "^2.0.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.1" + }, + "funding": { + "url": "https://github.com/fb55/domutils?sponsor=1" + } + }, + "node_modules/earcut": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/earcut/-/earcut-2.2.4.tgz", + "integrity": "sha512-/pjZsA1b4RPHbeWZQn66SWS8nZZWLQQ23oE3Eam7aroEFGEvwKAsJfZ9ytiEMycfzXWpca4FA9QIOehf7PocBQ==" + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/entities": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.4.0.tgz", + "integrity": "sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA==", + "dev": true, + "peer": true, + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/esbuild": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.15.15.tgz", + "integrity": "sha512-TEw/lwK4Zzld9x3FedV6jy8onOUHqcEX3ADFk4k+gzPUwrxn8nWV62tH0udo8jOtjFodlEfc4ypsqX3e+WWO6w==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/android-arm": "0.15.15", + "@esbuild/linux-loong64": "0.15.15", + "esbuild-android-64": "0.15.15", + "esbuild-android-arm64": "0.15.15", + "esbuild-darwin-64": "0.15.15", + "esbuild-darwin-arm64": "0.15.15", + "esbuild-freebsd-64": "0.15.15", + "esbuild-freebsd-arm64": "0.15.15", + "esbuild-linux-32": "0.15.15", + "esbuild-linux-64": "0.15.15", + "esbuild-linux-arm": "0.15.15", + "esbuild-linux-arm64": "0.15.15", + "esbuild-linux-mips64le": "0.15.15", + "esbuild-linux-ppc64le": "0.15.15", + "esbuild-linux-riscv64": "0.15.15", + "esbuild-linux-s390x": "0.15.15", + "esbuild-netbsd-64": "0.15.15", + "esbuild-openbsd-64": "0.15.15", + "esbuild-sunos-64": "0.15.15", + "esbuild-windows-32": "0.15.15", + "esbuild-windows-64": "0.15.15", + "esbuild-windows-arm64": "0.15.15" + } + }, + "node_modules/esbuild-android-64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.15.15.tgz", + "integrity": "sha512-F+WjjQxO+JQOva3tJWNdVjouFMLK6R6i5gjDvgUthLYJnIZJsp1HlF523k73hELY20WPyEO8xcz7aaYBVkeg5Q==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-android-arm64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.15.15.tgz", + "integrity": "sha512-attlyhD6Y22jNyQ0fIIQ7mnPvDWKw7k6FKnsXlBvQE6s3z6s6cuEHcSgoirquQc7TmZgVCK5fD/2uxmRN+ZpcQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-darwin-64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.15.15.tgz", + "integrity": "sha512-ohZtF8W1SHJ4JWldsPVdk8st0r9ExbAOSrBOh5L+Mq47i696GVwv1ab/KlmbUoikSTNoXEhDzVpxUR/WIO19FQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-darwin-arm64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.15.15.tgz", + "integrity": "sha512-P8jOZ5zshCNIuGn+9KehKs/cq5uIniC+BeCykvdVhx/rBXSxmtj3CUIKZz4sDCuESMbitK54drf/2QX9QHG5Ag==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-freebsd-64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.15.15.tgz", + "integrity": "sha512-KkTg+AmDXz1IvA9S1gt8dE24C8Thx0X5oM0KGF322DuP+P3evwTL9YyusHAWNsh4qLsR80nvBr/EIYs29VSwuA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-freebsd-arm64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.15.15.tgz", + "integrity": "sha512-FUcML0DRsuyqCMfAC+HoeAqvWxMeq0qXvclZZ/lt2kLU6XBnDA5uKTLUd379WYEyVD4KKFctqWd9tTuk8C/96g==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-32": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.15.15.tgz", + "integrity": "sha512-q28Qn5pZgHNqug02aTkzw5sW9OklSo96b5nm17Mq0pDXrdTBcQ+M6Q9A1B+dalFeynunwh/pvfrNucjzwDXj+Q==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.15.15.tgz", + "integrity": "sha512-217KPmWMirkf8liO+fj2qrPwbIbhNTGNVtvqI1TnOWJgcMjUWvd677Gq3fTzXEjilkx2yWypVnTswM2KbXgoAg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-arm": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.15.15.tgz", + "integrity": "sha512-RYVW9o2yN8yM7SB1yaWr378CwrjvGCyGybX3SdzPHpikUHkME2AP55Ma20uNwkNyY2eSYFX9D55kDrfQmQBR4w==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-arm64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.15.15.tgz", + "integrity": "sha512-/ltmNFs0FivZkYsTzAsXIfLQX38lFnwJTWCJts0IbCqWZQe+jjj0vYBNbI0kmXLb3y5NljiM5USVAO1NVkdh2g==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-mips64le": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.15.15.tgz", + "integrity": "sha512-PksEPb321/28GFFxtvL33yVPfnMZihxkEv5zME2zapXGp7fA1X2jYeiTUK+9tJ/EGgcNWuwvtawPxJG7Mmn86A==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-ppc64le": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.15.15.tgz", + "integrity": "sha512-ek8gJBEIhcpGI327eAZigBOHl58QqrJrYYIZBWQCnH3UnXoeWMrMZLeeZL8BI2XMBhP+sQ6ERctD5X+ajL/AIA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-riscv64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.15.15.tgz", + "integrity": "sha512-H5ilTZb33/GnUBrZMNJtBk7/OXzDHDXjIzoLXHSutwwsLxSNaLxzAaMoDGDd/keZoS+GDBqNVxdCkpuiRW4OSw==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-s390x": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.15.15.tgz", + "integrity": "sha512-jKaLUg78mua3rrtrkpv4Or2dNTJU7bgHN4bEjT4OX4GR7nLBSA9dfJezQouTxMmIW7opwEC5/iR9mpC18utnxQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-netbsd-64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.15.15.tgz", + "integrity": "sha512-aOvmF/UkjFuW6F36HbIlImJTTx45KUCHJndtKo+KdP8Dhq3mgLRKW9+6Ircpm8bX/RcS3zZMMmaBLkvGY06Gvw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-openbsd-64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.15.15.tgz", + "integrity": "sha512-HFFX+WYedx1w2yJ1VyR1Dfo8zyYGQZf1cA69bLdrHzu9svj6KH6ZLK0k3A1/LFPhcEY9idSOhsB2UyU0tHPxgQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-sunos-64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.15.15.tgz", + "integrity": "sha512-jOPBudffG4HN8yJXcK9rib/ZTFoTA5pvIKbRrt3IKAGMq1EpBi4xoVoSRrq/0d4OgZLaQbmkHp8RO9eZIn5atA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-32": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.15.15.tgz", + "integrity": "sha512-MDkJ3QkjnCetKF0fKxCyYNBnOq6dmidcwstBVeMtXSgGYTy8XSwBeIE4+HuKiSsG6I/mXEb++px3IGSmTN0XiA==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.15.15.tgz", + "integrity": "sha512-xaAUIB2qllE888SsMU3j9nrqyLbkqqkpQyWVkfwSil6BBPgcPk3zOFitTTncEKCLTQy3XV9RuH7PDj3aJDljWA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-arm64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.15.15.tgz", + "integrity": "sha512-ttuoCYCIJAFx4UUKKWYnFdrVpoXa3+3WWkXVI6s09U+YjhnyM5h96ewTq/WgQj9LFSIlABQvadHSOQyAVjW5xQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "8.29.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.29.0.tgz", + "integrity": "sha512-isQ4EEiyUjZFbEKvEGJKKGBwXtvXX+zJbkVKCgTuB9t/+jUBcy8avhkEwWJecI15BkRkOYmvIM5ynbhRjEkoeg==", + "dev": true, + "dependencies": { + "@eslint/eslintrc": "^1.3.3", + "@humanwhocodes/config-array": "^0.11.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.1.1", + "eslint-utils": "^3.0.0", + "eslint-visitor-keys": "^3.3.0", + "espree": "^9.4.0", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.15.0", + "grapheme-splitter": "^1.0.4", + "ignore": "^5.2.0", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-sdsl": "^4.1.4", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "regexpp": "^3.2.0", + "strip-ansi": "^6.0.1", + "strip-json-comments": "^3.1.0", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-plugin-vue": { + "version": "9.8.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-vue/-/eslint-plugin-vue-9.8.0.tgz", + "integrity": "sha512-E/AXwcTzunyzM83C2QqDHxepMzvI2y6x+mmeYHbVDQlKFqmKYvRrhaVixEeeG27uI44p9oKDFiyCRw4XxgtfHA==", + "dev": true, + "dependencies": { + "eslint-utils": "^3.0.0", + "natural-compare": "^1.4.0", + "nth-check": "^2.0.1", + "postcss-selector-parser": "^6.0.9", + "semver": "^7.3.5", + "vue-eslint-parser": "^9.0.1", + "xml-name-validator": "^4.0.0" + }, + "engines": { + "node": "^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.2.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/eslint-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^2.0.0" + }, + "engines": { + "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=5" + } + }, + "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/eslint/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/eslint/node_modules/eslint-scope": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", + "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/eslint/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/eslint/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/espree": { + "version": "9.4.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.1.tgz", + "integrity": "sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==", + "dev": true, + "dependencies": { + "acorn": "^8.8.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "dev": true, + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esquery/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==" + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "node_modules/fast-glob": { + "version": "3.2.12", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", + "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, + "node_modules/fastest-levenshtein": { + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", + "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", + "dev": true, + "engines": { + "node": ">= 4.9.1" + } + }, + "node_modules/fastq": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "dependencies": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flatted": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", + "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", + "dev": true + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "node_modules/geojson-vt": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/geojson-vt/-/geojson-vt-3.2.1.tgz", + "integrity": "sha512-EvGQQi/zPrDA6zr6BnJD/YhwAkBP8nnJ9emh3EnHQKVMfg/MRVtPbMYdgVy/IaEmn4UfagD2a6fafPDL5hbtwg==" + }, + "node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/gl-matrix": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/gl-matrix/-/gl-matrix-3.4.3.tgz", + "integrity": "sha512-wcCp8vu8FT22BnvKVPjXa/ICBWRq/zjFfdofZy1WSpQZpphblv12/bOQLBC1rMM7SGOFS9ltVmKOHil5+Ml7gA==" + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/glob/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/glob/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/global-modules": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-2.0.0.tgz", + "integrity": "sha512-NGbfmJBp9x8IxyJSd1P+otYK8vonoJactOogrVfFRIAEY1ukil8RSKDz2Yo7wh1oihl51l/r6W4epkeKJHqL8A==", + "dev": true, + "dependencies": { + "global-prefix": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/global-prefix": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-3.0.0.tgz", + "integrity": "sha512-awConJSVCHVGND6x3tmMaKcQvwXLhjdkmomy2W+Goaui8YPgYgXJZewhg3fWC+DlfqqQuWg8AwqjGTD2nAPVWg==", + "dependencies": { + "ini": "^1.3.5", + "kind-of": "^6.0.2", + "which": "^1.3.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/globals": { + "version": "13.18.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.18.0.tgz", + "integrity": "sha512-/mR4KI8Ps2spmoc0Ulu9L7agOF0du1CZNQ3dke8yItYlyKNmGrkONemBbd6V8UTc1Wgcqn21t3WYB7dbRmh6/A==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globjoin": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/globjoin/-/globjoin-0.1.4.tgz", + "integrity": "sha512-xYfnw62CKG8nLkZBfWbhWwDw02CHty86jfPcc2cr3ZfeuK9ysoVPPEUxf21bAD/rWAgk52SuBrLJlefNy8mvFg==", + "dev": true + }, + "node_modules/globrex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz", + "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==", + "dev": true + }, + "node_modules/golden-layout": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/golden-layout/-/golden-layout-2.6.0.tgz", + "integrity": "sha512-sIVQCiRWOymHbVD1Aw/T9/ijbPYAVGBlgGYd1N9MRKfcyBNSpjr87Vg9nSHm+RCT8ELrvK8IJYJV0QRJuVUkCQ==" + }, + "node_modules/grapheme-splitter": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", + "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", + "dev": true + }, + "node_modules/hard-rejection": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", + "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true, + "bin": { + "he": "bin/he" + } + }, + "node_modules/hosted-git-info": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", + "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/html-tags": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/html-tags/-/html-tags-3.2.0.tgz", + "integrity": "sha512-vy7ClnArOZwCnqZgvv+ddgHgJiAFXe3Ge9ML5/mBctVJoUoYPCdxVucOywjDARn6CVoh3dRSFdPHy2sX80L0Wg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/htmlparser2": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.1.tgz", + "integrity": "sha512-4lVbmc1diZC7GUJQtRQ5yBAeUCL1exyMwmForWkRLnwyzWBFxN633SALPMGYaWZvKe9j1pRZJpauvmxENSp/EA==", + "dev": true, + "funding": [ + "https://github.com/fb55/htmlparser2?sponsor=1", + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "peer": true, + "dependencies": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.2", + "domutils": "^3.0.1", + "entities": "^4.3.0" + } + }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/ignore": { + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-lazy": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-4.0.0.tgz", + "integrity": "sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" + }, + "node_modules/internmap": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz", + "integrity": "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==", + "engines": { + "node": ">=12" + } + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true + }, + "node_modules/is-core-module": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", + "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-plain-object": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", + "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "node_modules/js-sdsl": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.2.0.tgz", + "integrity": "sha512-dyBIzQBDkCqCu+0upx25Y2jGdbTGxE9fshMsCdK0ViOongpV+n5tXRcZY9v7CaVQ79AGS9KA1KHtojxiM7aXSQ==", + "dev": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/js-sdsl" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true + }, + "node_modules/kdbush": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/kdbush/-/kdbush-3.0.0.tgz", + "integrity": "sha512-hRkd6/XW4HTsA9vjVpY9tuXJYLSlelnkTmVFu4M9/7MIYQtFcHpbugAU7UbOfjOiVSVYl2fqgBuJ32JUmRo5Ew==" + }, + "node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/known-css-properties": { + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.26.0.tgz", + "integrity": "sha512-5FZRzrZzNTBruuurWpvZnvP9pum+fe0HcK8z/ooo+U+Hmp4vtbyp1/QDsqmufirXy4egGzbaH/y2uCZf+6W5Kg==", + "dev": true + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "node_modules/lodash.truncate": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", + "integrity": "sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==", + "dev": true + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/magic-string": { + "version": "0.25.9", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", + "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", + "dependencies": { + "sourcemap-codec": "^1.4.8" + } + }, + "node_modules/map-obj": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz", + "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/maplibre-gl": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-2.4.0.tgz", + "integrity": "sha512-csNFylzntPmHWidczfgCZpvbTSmhaWvLRj9e1ezUDBEPizGgshgm3ea1T5TCNEEBq0roauu7BPuRZjA3wO4KqA==", + "hasInstallScript": true, + "dependencies": { + "@mapbox/geojson-rewind": "^0.5.2", + "@mapbox/jsonlint-lines-primitives": "^2.0.2", + "@mapbox/mapbox-gl-supported": "^2.0.1", + "@mapbox/point-geometry": "^0.1.0", + "@mapbox/tiny-sdf": "^2.0.5", + "@mapbox/unitbezier": "^0.0.1", + "@mapbox/vector-tile": "^1.3.1", + "@mapbox/whoots-js": "^3.1.0", + "@types/geojson": "^7946.0.10", + "@types/mapbox__point-geometry": "^0.1.2", + "@types/mapbox__vector-tile": "^1.3.0", + "@types/pbf": "^3.0.2", + "csscolorparser": "~1.0.3", + "earcut": "^2.2.4", + "geojson-vt": "^3.2.1", + "gl-matrix": "^3.4.3", + "global-prefix": "^3.0.0", + "murmurhash-js": "^1.0.0", + "pbf": "^3.2.1", + "potpack": "^1.0.2", + "quickselect": "^2.0.0", + "supercluster": "^7.1.5", + "tinyqueue": "^2.0.3", + "vt-pbf": "^3.1.3" + } + }, + "node_modules/mathml-tag-names": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/mathml-tag-names/-/mathml-tag-names-2.1.3.tgz", + "integrity": "sha512-APMBEanjybaPzUrfqU0IMU5I0AswKMH7k8OTLs0vvV4KZpExkTkY87nR/zpbuTPj+gARop7aGUbl11pnDfW6xg==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/meow": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-9.0.0.tgz", + "integrity": "sha512-+obSblOQmRhcyBt62furQqRAQpNyWXo8BuQ5bN7dG8wmwQ+vwHKp/rCFD4CrTP8CsDQD1sjoZ94K417XEUk8IQ==", + "dev": true, + "dependencies": { + "@types/minimist": "^1.2.0", + "camelcase-keys": "^6.2.2", + "decamelize": "^1.2.0", + "decamelize-keys": "^1.1.0", + "hard-rejection": "^2.1.0", + "minimist-options": "4.1.0", + "normalize-package-data": "^3.0.0", + "read-pkg-up": "^7.0.1", + "redent": "^3.0.0", + "trim-newlines": "^3.0.0", + "type-fest": "^0.18.0", + "yargs-parser": "^20.2.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/meow/node_modules/type-fest": { + "version": "0.18.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz", + "integrity": "sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/min-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", + "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/minimatch": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz", + "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/minimist": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", + "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/minimist-options": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz", + "integrity": "sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==", + "dev": true, + "dependencies": { + "arrify": "^1.0.1", + "is-plain-obj": "^1.1.0", + "kind-of": "^6.0.3" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/muggle-string": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/muggle-string/-/muggle-string-0.1.0.tgz", + "integrity": "sha512-Tr1knR3d2mKvvWthlk7202rywKbiOm4rVFLsfAaSIhJ6dt9o47W4S+JMtWhd/PW9Wrdew2/S2fSvhz3E2gkfEg==", + "dev": true + }, + "node_modules/murmurhash-js": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/murmurhash-js/-/murmurhash-js-1.0.0.tgz", + "integrity": "sha512-TvmkNhkv8yct0SVBSy+o8wYzXjE4Zz3PCesbfs8HiCXXdcTuocApFv11UWlNFWKYsP2okqrhb7JNlSm9InBhIw==" + }, + "node_modules/nanoid": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", + "integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, + "node_modules/natural-compare-lite": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", + "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", + "dev": true + }, + "node_modules/normalize-package-data": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz", + "integrity": "sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA==", + "dev": true, + "dependencies": { + "hosted-git-info": "^4.0.1", + "is-core-module": "^2.5.0", + "semver": "^7.3.4", + "validate-npm-package-license": "^3.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/nth-check": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", + "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", + "dev": true, + "dependencies": { + "boolbase": "^1.0.0" + }, + "funding": { + "url": "https://github.com/fb55/nth-check?sponsor=1" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/pbf": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/pbf/-/pbf-3.2.1.tgz", + "integrity": "sha512-ClrV7pNOn7rtmoQVF4TS1vyU0WhYRnP92fzbfF75jAIwpnzdJXf8iTd4CMEqO4yUenH6NDqLiwjqlh6QgZzgLQ==", + "dependencies": { + "ieee754": "^1.1.12", + "resolve-protobuf-schema": "^2.1.0" + }, + "bin": { + "pbf": "bin/pbf" + } + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.4.19", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.19.tgz", + "integrity": "sha512-h+pbPsyhlYj6N2ozBmHhHrs9DzGmbaarbLvWipMRO7RLS+v4onj26MPFXA5OBYFxyqYhUJK456SwDcY9H2/zsA==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + } + ], + "dependencies": { + "nanoid": "^3.3.4", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/postcss-html": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/postcss-html/-/postcss-html-1.5.0.tgz", + "integrity": "sha512-kCMRWJRHKicpA166kc2lAVUGxDZL324bkj/pVOb6RhjB0Z5Krl7mN0AsVkBhVIRZZirY0lyQXG38HCVaoKVNoA==", + "dev": true, + "peer": true, + "dependencies": { + "htmlparser2": "^8.0.0", + "js-tokens": "^8.0.0", + "postcss": "^8.4.0", + "postcss-safe-parser": "^6.0.0" + }, + "engines": { + "node": "^12 || >=14" + } + }, + "node_modules/postcss-html/node_modules/js-tokens": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-8.0.0.tgz", + "integrity": "sha512-PC7MzqInq9OqKyTXfIvQNcjMkODJYC8A17kAaQgeW79yfhqTWSOfjHYQ2mDDcwJ96Iibtwkfh0C7R/OvqPlgVA==", + "dev": true, + "peer": true + }, + "node_modules/postcss-media-query-parser": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/postcss-media-query-parser/-/postcss-media-query-parser-0.2.3.tgz", + "integrity": "sha512-3sOlxmbKcSHMjlUXQZKQ06jOswE7oVkXPxmZdoB1r5l0q6gTFTQSHxNxOrCccElbW7dxNytifNEo8qidX2Vsig==", + "dev": true + }, + "node_modules/postcss-resolve-nested-selector": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/postcss-resolve-nested-selector/-/postcss-resolve-nested-selector-0.1.1.tgz", + "integrity": "sha512-HvExULSwLqHLgUy1rl3ANIqCsvMS0WHss2UOsXhXnQaZ9VCc2oBvIpXrl00IUFT5ZDITME0o6oiXeiHr2SAIfw==", + "dev": true + }, + "node_modules/postcss-safe-parser": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-safe-parser/-/postcss-safe-parser-6.0.0.tgz", + "integrity": "sha512-FARHN8pwH+WiS2OPCxJI8FuRJpTVnn6ZNFiqAM2aeW2LwTHWWmWgIyKC6cUo0L8aeKiF/14MNvnpls6R2PBeMQ==", + "dev": true, + "engines": { + "node": ">=12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + "peerDependencies": { + "postcss": "^8.3.3" + } + }, + "node_modules/postcss-scss": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/postcss-scss/-/postcss-scss-4.0.6.tgz", + "integrity": "sha512-rLDPhJY4z/i4nVFZ27j9GqLxj1pwxE80eAzUNRMXtcpipFYIeowerzBgG3yJhMtObGEXidtIgbUpQ3eLDsf5OQ==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss-scss" + } + ], + "engines": { + "node": ">=12.0" + }, + "peerDependencies": { + "postcss": "^8.4.19" + } + }, + "node_modules/postcss-selector-parser": { + "version": "6.0.11", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.11.tgz", + "integrity": "sha512-zbARubNdogI9j7WY4nQJBiNqQf3sLS3wCP4WfOidu+p28LofJqDH1tcXypGrcmMHhDk2t9wGhCsYe/+szLTy1g==", + "dev": true, + "dependencies": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/postcss-value-parser": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", + "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", + "dev": true + }, + "node_modules/potpack": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/potpack/-/potpack-1.0.2.tgz", + "integrity": "sha512-choctRBIV9EMT9WGAZHn3V7t0Z2pMQyl0EZE6pFc/6ml3ssw7Dlf/oAOvFwjm1HVsqfQN8GfeFyJ+d8tRzqueQ==" + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/protocol-buffers-schema": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/protocol-buffers-schema/-/protocol-buffers-schema-3.6.0.tgz", + "integrity": "sha512-TdDRD+/QNdrCGCE7v8340QyuXd4kIWIgapsE2+n/SaGiSSbomYl4TjHlvIoCWRpE7wFt02EpB35VVA2ImcBVqw==" + }, + "node_modules/punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/quick-lru": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz", + "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/quickselect": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/quickselect/-/quickselect-2.0.0.tgz", + "integrity": "sha512-RKJ22hX8mHe3Y6wH/N3wCM6BWtjaxIyyUIkpHOvfFnxdI4yD4tBXEBKSbriGujF6jnSVkJrffuo6vxACiSSxIw==" + }, + "node_modules/read-pkg": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", + "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", + "dev": true, + "dependencies": { + "@types/normalize-package-data": "^2.4.0", + "normalize-package-data": "^2.5.0", + "parse-json": "^5.0.0", + "type-fest": "^0.6.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/read-pkg-up": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", + "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", + "dev": true, + "dependencies": { + "find-up": "^4.1.0", + "read-pkg": "^5.2.0", + "type-fest": "^0.8.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-pkg-up/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/read-pkg-up/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/read-pkg-up/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-pkg-up/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/read-pkg-up/node_modules/type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/read-pkg/node_modules/hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "dev": true + }, + "node_modules/read-pkg/node_modules/normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "dependencies": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "node_modules/read-pkg/node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/read-pkg/node_modules/type-fest": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", + "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/redent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", + "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==", + "dev": true, + "dependencies": { + "indent-string": "^4.0.0", + "strip-indent": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/regexpp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve": { + "version": "1.22.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", + "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", + "dev": true, + "dependencies": { + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/resolve-protobuf-schema": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/resolve-protobuf-schema/-/resolve-protobuf-schema-2.1.0.tgz", + "integrity": "sha512-kI5ffTiZWmJaS/huM8wZfEMer1eRd7oJQhDuxeCLe3t7N7mX3z94CN0xPxBQxFYQTSNz9T0i+v6inKqSdK8xrQ==", + "dependencies": { + "protocol-buffers-schema": "^3.3.1" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/robust-predicates": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/robust-predicates/-/robust-predicates-3.0.1.tgz", + "integrity": "sha512-ndEIpszUHiG4HtDsQLeIuMvRsDnn8c8rYStabochtUeCvfuvNptb5TUbVD68LRAILPX7p9nqQGh4xJgn3EHS/g==" + }, + "node_modules/rollup": { + "version": "2.79.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz", + "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==", + "dev": true, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=10.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/rw": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/rw/-/rw-1.3.3.tgz", + "integrity": "sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ==" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/semver": { + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/slice-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", + "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-js": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sourcemap-codec": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", + "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==" + }, + "node_modules/spdx-correct": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", + "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", + "dev": true, + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-exceptions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", + "dev": true + }, + "node_modules/spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.12", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.12.tgz", + "integrity": "sha512-rr+VVSXtRhO4OHbXUiAF7xW3Bo9DuuF6C5jH+q/x15j2jniycgKbxU09Hr0WqlSLUs4i4ltHGXqTe7VHclYWyA==", + "dev": true + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-indent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", + "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", + "dev": true, + "dependencies": { + "min-indent": "^1.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/style-search": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/style-search/-/style-search-0.1.0.tgz", + "integrity": "sha512-Dj1Okke1C3uKKwQcetra4jSuk0DqbzbYtXipzFlFMZtowbF1x7BKJwB9AayVMyFARvU8EDrZdcax4At/452cAg==", + "dev": true + }, + "node_modules/stylelint": { + "version": "14.16.1", + "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-14.16.1.tgz", + "integrity": "sha512-ErlzR/T3hhbV+a925/gbfc3f3Fep9/bnspMiJPorfGEmcBbXdS+oo6LrVtoUZ/w9fqD6o6k7PtUlCOsCRdjX/A==", + "dev": true, + "dependencies": { + "@csstools/selector-specificity": "^2.0.2", + "balanced-match": "^2.0.0", + "colord": "^2.9.3", + "cosmiconfig": "^7.1.0", + "css-functions-list": "^3.1.0", + "debug": "^4.3.4", + "fast-glob": "^3.2.12", + "fastest-levenshtein": "^1.0.16", + "file-entry-cache": "^6.0.1", + "global-modules": "^2.0.0", + "globby": "^11.1.0", + "globjoin": "^0.1.4", + "html-tags": "^3.2.0", + "ignore": "^5.2.1", + "import-lazy": "^4.0.0", + "imurmurhash": "^0.1.4", + "is-plain-object": "^5.0.0", + "known-css-properties": "^0.26.0", + "mathml-tag-names": "^2.1.3", + "meow": "^9.0.0", + "micromatch": "^4.0.5", + "normalize-path": "^3.0.0", + "picocolors": "^1.0.0", + "postcss": "^8.4.19", + "postcss-media-query-parser": "^0.2.3", + "postcss-resolve-nested-selector": "^0.1.1", + "postcss-safe-parser": "^6.0.0", + "postcss-selector-parser": "^6.0.11", + "postcss-value-parser": "^4.2.0", + "resolve-from": "^5.0.0", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1", + "style-search": "^0.1.0", + "supports-hyperlinks": "^2.3.0", + "svg-tags": "^1.0.0", + "table": "^6.8.1", + "v8-compile-cache": "^2.3.0", + "write-file-atomic": "^4.0.2" + }, + "bin": { + "stylelint": "bin/stylelint.js" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/stylelint" + } + }, + "node_modules/stylelint-config-html": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/stylelint-config-html/-/stylelint-config-html-1.1.0.tgz", + "integrity": "sha512-IZv4IVESjKLumUGi+HWeb7skgO6/g4VMuAYrJdlqQFndgbj6WJAXPhaysvBiXefX79upBdQVumgYcdd17gCpjQ==", + "dev": true, + "engines": { + "node": "^12 || >=14" + }, + "funding": { + "url": "https://github.com/sponsors/ota-meshi" + }, + "peerDependencies": { + "postcss-html": "^1.0.0", + "stylelint": ">=14.0.0" + } + }, + "node_modules/stylelint-config-recommended": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/stylelint-config-recommended/-/stylelint-config-recommended-9.0.0.tgz", + "integrity": "sha512-9YQSrJq4NvvRuTbzDsWX3rrFOzOlYBmZP+o513BJN/yfEmGSr0AxdvrWs0P/ilSpVV/wisamAHu5XSk8Rcf4CQ==", + "dev": true, + "peerDependencies": { + "stylelint": "^14.10.0" + } + }, + "node_modules/stylelint-config-recommended-scss": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/stylelint-config-recommended-scss/-/stylelint-config-recommended-scss-8.0.0.tgz", + "integrity": "sha512-BxjxEzRaZoQb7Iinc3p92GS6zRdRAkIuEu2ZFLTxJK2e1AIcCb5B5MXY9KOXdGTnYFZ+KKx6R4Fv9zU6CtMYPQ==", + "dev": true, + "dependencies": { + "postcss-scss": "^4.0.2", + "stylelint-config-recommended": "^9.0.0", + "stylelint-scss": "^4.0.0" + }, + "peerDependencies": { + "postcss": "^8.3.3", + "stylelint": "^14.10.0" + }, + "peerDependenciesMeta": { + "postcss": { + "optional": true + } + } + }, + "node_modules/stylelint-config-recommended-vue": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/stylelint-config-recommended-vue/-/stylelint-config-recommended-vue-1.4.0.tgz", + "integrity": "sha512-DVJqyX2KvMCn9U0+keL12r7xlsH26K4Vg8NrIZuq5MoF7g82DpMp326Om4E0Q+Il1o+bTHuUyejf2XAI0iD04Q==", + "dev": true, + "dependencies": { + "semver": "^7.3.5", + "stylelint-config-html": ">=1.0.0", + "stylelint-config-recommended": ">=6.0.0" + }, + "engines": { + "node": "^12 || >=14" + }, + "funding": { + "url": "https://github.com/sponsors/ota-meshi" + }, + "peerDependencies": { + "postcss-html": "^1.0.0", + "stylelint": ">=14.0.0" + } + }, + "node_modules/stylelint-config-standard": { + "version": "29.0.0", + "resolved": "https://registry.npmjs.org/stylelint-config-standard/-/stylelint-config-standard-29.0.0.tgz", + "integrity": "sha512-uy8tZLbfq6ZrXy4JKu3W+7lYLgRQBxYTUUB88vPgQ+ZzAxdrvcaSUW9hOMNLYBnwH+9Kkj19M2DHdZ4gKwI7tg==", + "dev": true, + "dependencies": { + "stylelint-config-recommended": "^9.0.0" + }, + "peerDependencies": { + "stylelint": "^14.14.0" + } + }, + "node_modules/stylelint-config-standard-scss": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/stylelint-config-standard-scss/-/stylelint-config-standard-scss-6.1.0.tgz", + "integrity": "sha512-iZ2B5kQT2G3rUzx+437cEpdcnFOQkwnwqXuY8Z0QUwIHQVE8mnYChGAquyKFUKZRZ0pRnrciARlPaR1RBtPb0Q==", + "dev": true, + "dependencies": { + "stylelint-config-recommended-scss": "^8.0.0", + "stylelint-config-standard": "^29.0.0" + }, + "peerDependencies": { + "postcss": "^8.3.3", + "stylelint": "^14.14.0" + }, + "peerDependenciesMeta": { + "postcss": { + "optional": true + } + } + }, + "node_modules/stylelint-scss": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/stylelint-scss/-/stylelint-scss-4.3.0.tgz", + "integrity": "sha512-GvSaKCA3tipzZHoz+nNO7S02ZqOsdBzMiCx9poSmLlb3tdJlGddEX/8QzCOD8O7GQan9bjsvLMsO5xiw6IhhIQ==", + "dev": true, + "dependencies": { + "lodash": "^4.17.21", + "postcss-media-query-parser": "^0.2.3", + "postcss-resolve-nested-selector": "^0.1.1", + "postcss-selector-parser": "^6.0.6", + "postcss-value-parser": "^4.1.0" + }, + "peerDependencies": { + "stylelint": "^14.5.1" + } + }, + "node_modules/stylelint/node_modules/balanced-match": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-2.0.0.tgz", + "integrity": "sha512-1ugUSr8BHXRnK23KfuYS+gVMC3LB8QGH9W1iGtDPsNWoQbgtXSExkBu2aDR4epiGWZOjZsj6lDl/N/AqqTC3UA==", + "dev": true + }, + "node_modules/stylelint/node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/supercluster": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/supercluster/-/supercluster-7.1.5.tgz", + "integrity": "sha512-EulshI3pGUM66o6ZdH3ReiFcvHpM3vAigyK+vcxdjpJyEbIIrtbmBdY23mGgnI24uXiGFvrGq9Gkum/8U7vJWg==", + "dependencies": { + "kdbush": "^3.0.0" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-hyperlinks": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-2.3.0.tgz", + "integrity": "sha512-RpsAZlpWcDwOPQA22aCH4J0t7L8JmAvsCxfOSEwm7cQs3LshN36QaTkwd70DnBOXDWGssw2eUoc8CaRWT0XunA==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0", + "supports-color": "^7.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/svg-tags": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/svg-tags/-/svg-tags-1.0.0.tgz", + "integrity": "sha512-ovssysQTa+luh7A5Weu3Rta6FJlFBBbInjOh722LIt6klpU2/HtdUbszju/G4devcvk8PGt7FCLv5wftu3THUA==", + "dev": true + }, + "node_modules/table": { + "version": "6.8.1", + "resolved": "https://registry.npmjs.org/table/-/table-6.8.1.tgz", + "integrity": "sha512-Y4X9zqrCftUhMeH2EptSSERdVKt/nEdijTOacGD/97EKjhQ/Qs8RTlEGABSJNNN8lac9kheH+af7yAkEWlgneA==", + "dev": true, + "dependencies": { + "ajv": "^8.0.1", + "lodash.truncate": "^4.4.2", + "slice-ansi": "^4.0.0", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/table/node_modules/ajv": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/table/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true + }, + "node_modules/tinyqueue": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/tinyqueue/-/tinyqueue-2.0.3.tgz", + "integrity": "sha512-ppJZNDuKGgxzkHihX8v9v9G5f+18gzaTfrukGrq6ueg0lmH4nqVnA2IPG0AEH3jKEk2GRJCUhDoqpoiw3PHLBA==" + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/trim-newlines": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz", + "integrity": "sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/tsconfck": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/tsconfck/-/tsconfck-2.0.1.tgz", + "integrity": "sha512-/ipap2eecmVBmBlsQLBRbUmUNFwNJV/z2E+X0FPtHNjPwroMZQ7m39RMaCywlCulBheYXgMdUlWDd9rzxwMA0Q==", + "dev": true, + "bin": { + "tsconfck": "bin/tsconfck.js" + }, + "engines": { + "node": "^14.13.1 || ^16 || >=18", + "pnpm": "^7.0.1" + }, + "peerDependencies": { + "typescript": "^4.3.5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, + "node_modules/tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "dependencies": { + "tslib": "^1.8.1" + }, + "engines": { + "node": ">= 6" + }, + "peerDependencies": { + "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" + } + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typescript": { + "version": "4.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.3.tgz", + "integrity": "sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true + }, + "node_modules/v8-compile-cache": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", + "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", + "dev": true + }, + "node_modules/validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "node_modules/vite": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/vite/-/vite-3.2.4.tgz", + "integrity": "sha512-Z2X6SRAffOUYTa+sLy3NQ7nlHFU100xwanq1WDwqaiFiCe+25zdxP1TfCS5ojPV2oDDcXudHIoPnI1Z/66B7Yw==", + "dev": true, + "dependencies": { + "esbuild": "^0.15.9", + "postcss": "^8.4.18", + "resolve": "^1.22.1", + "rollup": "^2.79.1" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + }, + "peerDependencies": { + "@types/node": ">= 14", + "less": "*", + "sass": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } + } + }, + "node_modules/vite-tsconfig-paths": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/vite-tsconfig-paths/-/vite-tsconfig-paths-4.0.3.tgz", + "integrity": "sha512-gRO2Q/tOkV+9kMht5tz90+IaEKvW2zCnvwJV3tp2ruPNZOTM5rF+yXorJT4ggmAMYEaJ3nyXjx5P5jY5FwiZ+A==", + "dev": true, + "dependencies": { + "debug": "^4.1.1", + "globrex": "^0.1.2", + "tsconfck": "^2.0.1" + }, + "peerDependencies": { + "vite": ">2.0.0-0" + } + }, + "node_modules/vt-pbf": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/vt-pbf/-/vt-pbf-3.1.3.tgz", + "integrity": "sha512-2LzDFzt0mZKZ9IpVF2r69G9bXaP2Q2sArJCmcCgvfTdCCZzSyz4aCLoQyUilu37Ll56tCblIZrXFIjNUpGIlmA==", + "dependencies": { + "@mapbox/point-geometry": "0.1.0", + "@mapbox/vector-tile": "^1.3.1", + "pbf": "^3.2.1" + } + }, + "node_modules/vue": { + "version": "3.2.45", + "resolved": "https://registry.npmjs.org/vue/-/vue-3.2.45.tgz", + "integrity": "sha512-9Nx/Mg2b2xWlXykmCwiTUCWHbWIj53bnkizBxKai1g61f2Xit700A1ljowpTIM11e3uipOeiPcSqnmBg6gyiaA==", + "dependencies": { + "@vue/compiler-dom": "3.2.45", + "@vue/compiler-sfc": "3.2.45", + "@vue/runtime-dom": "3.2.45", + "@vue/server-renderer": "3.2.45", + "@vue/shared": "3.2.45" + } + }, + "node_modules/vue-eslint-parser": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-9.1.0.tgz", + "integrity": "sha512-NGn/iQy8/Wb7RrRa4aRkokyCZfOUWk19OP5HP6JEozQFX5AoS/t+Z0ZN7FY4LlmWc4FNI922V7cvX28zctN8dQ==", + "dev": true, + "dependencies": { + "debug": "^4.3.4", + "eslint-scope": "^7.1.1", + "eslint-visitor-keys": "^3.3.0", + "espree": "^9.3.1", + "esquery": "^1.4.0", + "lodash": "^4.17.21", + "semver": "^7.3.6" + }, + "engines": { + "node": "^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=6.0.0" + } + }, + "node_modules/vue-eslint-parser/node_modules/eslint-scope": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", + "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/vue-eslint-parser/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/vue-template-compiler": { + "version": "2.7.14", + "resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.7.14.tgz", + "integrity": "sha512-zyA5Y3ArvVG0NacJDkkzJuPQDF8RFeRlzV2vLeSnhSpieO6LK2OVbdLPi5MPPs09Ii+gMO8nY4S3iKQxBxDmWQ==", + "dev": true, + "dependencies": { + "de-indent": "^1.0.2", + "he": "^1.2.0" + } + }, + "node_modules/vue-tsc": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/vue-tsc/-/vue-tsc-1.0.9.tgz", + "integrity": "sha512-vRmHD1K6DmBymNhoHjQy/aYKTRQNLGOu2/ESasChG9Vy113K6CdP0NlhR0bzgFJfv2eFB9Ez/9L5kIciUajBxQ==", + "dev": true, + "dependencies": { + "@volar/vue-language-core": "1.0.9", + "@volar/vue-typescript": "1.0.9" + }, + "bin": { + "vue-tsc": "bin/vue-tsc.js" + }, + "peerDependencies": { + "typescript": "*" + } + }, + "node_modules/vuex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/vuex/-/vuex-4.1.0.tgz", + "integrity": "sha512-hmV6UerDrPcgbSy9ORAtNXDr9M4wlNP4pEFKye4ujJF8oqgFFuxDCdOLS3eNoRTtq5O3hoBDh9Doj1bQMYHRbQ==", + "dependencies": { + "@vue/devtools-api": "^6.0.0-beta.11" + }, + "peerDependencies": { + "vue": "^3.2.0" + } + }, + "node_modules/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "node_modules/word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + }, + "node_modules/write-file-atomic": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", + "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", + "dev": true, + "dependencies": { + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.7" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/xml-name-validator": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-4.0.0.tgz", + "integrity": "sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, + "node_modules/yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", + "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", + "dev": true, + "requires": { + "@babel/highlight": "^7.18.6" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", + "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", + "dev": true + }, + "@babel/highlight": { + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", + "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.18.6", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "@babel/parser": { + "version": "7.20.3", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.20.3.tgz", + "integrity": "sha512-OP/s5a94frIPXwjzEcv5S/tpQfc6XhxYUnmWpgdqMWGgYCuErA3SzozaRAMQgSZWKeTJxht9aWAkUY+0UzvOFg==" + }, + "@csstools/selector-specificity": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@csstools/selector-specificity/-/selector-specificity-2.0.2.tgz", + "integrity": "sha512-IkpVW/ehM1hWKln4fCA3NzJU8KwD+kIOvPZA4cqxoJHtE21CCzjyp+Kxbu0i5I4tBNOlXPL9mjwnWlL0VEG4Fg==", + "dev": true, + "requires": {} + }, + "@esbuild/android-arm": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.15.15.tgz", + "integrity": "sha512-JJjZjJi2eBL01QJuWjfCdZxcIgot+VoK6Fq7eKF9w4YHm9hwl7nhBR1o2Wnt/WcANk5l9SkpvrldW1PLuXxcbw==", + "dev": true, + "optional": true + }, + "@esbuild/linux-loong64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.15.15.tgz", + "integrity": "sha512-lhz6UNPMDXUhtXSulw8XlFAtSYO26WmHQnCi2Lg2p+/TMiJKNLtZCYUxV4wG6rZMzXmr8InGpNwk+DLT2Hm0PA==", + "dev": true, + "optional": true + }, + "@eslint/eslintrc": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.3.tgz", + "integrity": "sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==", + "dev": true, + "requires": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.4.0", + "globals": "^13.15.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "dependencies": { + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, + "@humanwhocodes/config-array": { + "version": "0.11.7", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.7.tgz", + "integrity": "sha512-kBbPWzN8oVMLb0hOUYXhmxggL/1cJE6ydvjDIGi9EnAGUyA7cLVKQg+d/Dsm+KZwx2czGHrCmMVLiyg8s5JPKw==", + "dev": true, + "requires": { + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.5" + }, + "dependencies": { + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, + "@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true + }, + "@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true + }, + "@mapbox/geojson-rewind": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@mapbox/geojson-rewind/-/geojson-rewind-0.5.2.tgz", + "integrity": "sha512-tJaT+RbYGJYStt7wI3cq4Nl4SXxG8W7JDG5DMJu97V25RnbNg3QtQtf+KD+VLjNpWKYsRvXDNmNrBgEETr1ifA==", + "requires": { + "get-stream": "^6.0.1", + "minimist": "^1.2.6" + } + }, + "@mapbox/jsonlint-lines-primitives": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@mapbox/jsonlint-lines-primitives/-/jsonlint-lines-primitives-2.0.2.tgz", + "integrity": "sha512-rY0o9A5ECsTQRVhv7tL/OyDpGAoUB4tTvLiW1DSzQGq4bvTPhNw1VpSNjDJc5GFZ2XuyOtSWSVN05qOtcD71qQ==" + }, + "@mapbox/mapbox-gl-supported": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@mapbox/mapbox-gl-supported/-/mapbox-gl-supported-2.0.1.tgz", + "integrity": "sha512-HP6XvfNIzfoMVfyGjBckjiAOQK9WfX0ywdLubuPMPv+Vqf5fj0uCbgBQYpiqcWZT6cbyyRnTSXDheT1ugvF6UQ==" + }, + "@mapbox/point-geometry": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@mapbox/point-geometry/-/point-geometry-0.1.0.tgz", + "integrity": "sha512-6j56HdLTwWGO0fJPlrZtdU/B13q8Uwmo18Ck2GnGgN9PCFyKTZ3UbXeEdRFh18i9XQ92eH2VdtpJHpBD3aripQ==" + }, + "@mapbox/tiny-sdf": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@mapbox/tiny-sdf/-/tiny-sdf-2.0.5.tgz", + "integrity": "sha512-OhXt2lS//WpLdkqrzo/KwB7SRD8AiNTFFzuo9n14IBupzIMa67yGItcK7I2W9D8Ghpa4T04Sw9FWsKCJG50Bxw==" + }, + "@mapbox/unitbezier": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@mapbox/unitbezier/-/unitbezier-0.0.1.tgz", + "integrity": "sha512-nMkuDXFv60aBr9soUG5q+GvZYL+2KZHVvsqFCzqnkGEf46U2fvmytHaEVc1/YZbiLn8X+eR3QzX1+dwDO1lxlw==" + }, + "@mapbox/vector-tile": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@mapbox/vector-tile/-/vector-tile-1.3.1.tgz", + "integrity": "sha512-MCEddb8u44/xfQ3oD+Srl/tNcQoqTw3goGk2oLsrFxOTc3dUp+kAnby3PvAeeBYSMSjSPD1nd1AJA6W49WnoUw==", + "requires": { + "@mapbox/point-geometry": "~0.1.0" + } + }, + "@mapbox/whoots-js": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@mapbox/whoots-js/-/whoots-js-3.1.0.tgz", + "integrity": "sha512-Es6WcD0nO5l+2BOQS4uLfNPYQaNDfbot3X1XUoloz+x0mPDS3eeORZJl06HXjwBG1fOGwCRnzK88LMdxKRrd6Q==" + }, + "@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true + }, + "@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "requires": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + } + }, + "@types/geojson": { + "version": "7946.0.10", + "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.10.tgz", + "integrity": "sha512-Nmh0K3iWQJzniTuPRcJn5hxXkfB1T1pgB89SBig5PlJQU5yocazeu4jATJlaA0GYFKWMqDdvYemoSnF2pXgLVA==" + }, + "@types/json-schema": { + "version": "7.0.11", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", + "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "dev": true + }, + "@types/mapbox__point-geometry": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@types/mapbox__point-geometry/-/mapbox__point-geometry-0.1.2.tgz", + "integrity": "sha512-D0lgCq+3VWV85ey1MZVkE8ZveyuvW5VAfuahVTQRpXFQTxw03SuIf1/K4UQ87MMIXVKzpFjXFiFMZzLj2kU+iA==" + }, + "@types/mapbox__vector-tile": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@types/mapbox__vector-tile/-/mapbox__vector-tile-1.3.0.tgz", + "integrity": "sha512-kDwVreQO5V4c8yAxzZVQLE5tyWF+IPToAanloQaSnwfXmIcJ7cyOrv8z4Ft4y7PsLYmhWXmON8MBV8RX0Rgr8g==", + "requires": { + "@types/geojson": "*", + "@types/mapbox__point-geometry": "*", + "@types/pbf": "*" + } + }, + "@types/minimist": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.2.tgz", + "integrity": "sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==", + "dev": true + }, + "@types/normalize-package-data": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz", + "integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==", + "dev": true + }, + "@types/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==", + "dev": true + }, + "@types/pbf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/pbf/-/pbf-3.0.2.tgz", + "integrity": "sha512-EDrLIPaPXOZqDjrkzxxbX7UlJSeQVgah3i0aA4pOSzmK9zq3BIh7/MZIQxED7slJByvKM4Gc6Hypyu2lJzh3SQ==" + }, + "@types/semver": { + "version": "7.3.13", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", + "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", + "dev": true + }, + "@typescript-eslint/eslint-plugin": { + "version": "5.45.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.45.1.tgz", + "integrity": "sha512-cOizjPlKEh0bXdFrBLTrI/J6B/QMlhwE9auOov53tgB+qMukH6/h8YAK/qw+QJGct/PTbdh2lytGyipxCcEtAw==", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "5.45.1", + "@typescript-eslint/type-utils": "5.45.1", + "@typescript-eslint/utils": "5.45.1", + "debug": "^4.3.4", + "ignore": "^5.2.0", + "natural-compare-lite": "^1.4.0", + "regexpp": "^3.2.0", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + } + }, + "@typescript-eslint/parser": { + "version": "5.45.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.45.1.tgz", + "integrity": "sha512-JQ3Ep8bEOXu16q0ztsatp/iQfDCtvap7sp/DKo7DWltUquj5AfCOpX2zSzJ8YkAVnrQNqQ5R62PBz2UtrfmCkA==", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "5.45.1", + "@typescript-eslint/types": "5.45.1", + "@typescript-eslint/typescript-estree": "5.45.1", + "debug": "^4.3.4" + } + }, + "@typescript-eslint/scope-manager": { + "version": "5.45.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.45.1.tgz", + "integrity": "sha512-D6fCileR6Iai7E35Eb4Kp+k0iW7F1wxXYrOhX/3dywsOJpJAQ20Fwgcf+P/TDtvQ7zcsWsrJaglaQWDhOMsspQ==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.45.1", + "@typescript-eslint/visitor-keys": "5.45.1" + } + }, + "@typescript-eslint/type-utils": { + "version": "5.45.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.45.1.tgz", + "integrity": "sha512-aosxFa+0CoYgYEl3aptLe1svP910DJq68nwEJzyQcrtRhC4BN0tJAvZGAe+D0tzjJmFXe+h4leSsiZhwBa2vrA==", + "dev": true, + "requires": { + "@typescript-eslint/typescript-estree": "5.45.1", + "@typescript-eslint/utils": "5.45.1", + "debug": "^4.3.4", + "tsutils": "^3.21.0" + } + }, + "@typescript-eslint/types": { + "version": "5.45.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.45.1.tgz", + "integrity": "sha512-HEW3U0E5dLjUT+nk7b4lLbOherS1U4ap+b9pfu2oGsW3oPu7genRaY9dDv3nMczC1rbnRY2W/D7SN05wYoGImg==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "5.45.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.45.1.tgz", + "integrity": "sha512-76NZpmpCzWVrrb0XmYEpbwOz/FENBi+5W7ipVXAsG3OoFrQKJMiaqsBMbvGRyLtPotGqUfcY7Ur8j0dksDJDng==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.45.1", + "@typescript-eslint/visitor-keys": "5.45.1", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + } + }, + "@typescript-eslint/utils": { + "version": "5.45.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.45.1.tgz", + "integrity": "sha512-rlbC5VZz68+yjAzQBc4I7KDYVzWG2X/OrqoZrMahYq3u8FFtmQYc+9rovo/7wlJH5kugJ+jQXV5pJMnofGmPRw==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.9", + "@types/semver": "^7.3.12", + "@typescript-eslint/scope-manager": "5.45.1", + "@typescript-eslint/types": "5.45.1", + "@typescript-eslint/typescript-estree": "5.45.1", + "eslint-scope": "^5.1.1", + "eslint-utils": "^3.0.0", + "semver": "^7.3.7" + } + }, + "@typescript-eslint/visitor-keys": { + "version": "5.45.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.45.1.tgz", + "integrity": "sha512-cy9ln+6rmthYWjH9fmx+5FU/JDpjQb586++x2FZlveq7GdGuLLW9a2Jcst2TGekH82bXpfmRNSwP9tyEs6RjvQ==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.45.1", + "eslint-visitor-keys": "^3.3.0" + } + }, + "@vitejs/plugin-vue": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-3.2.0.tgz", + "integrity": "sha512-E0tnaL4fr+qkdCNxJ+Xd0yM31UwMkQje76fsDVBBUCoGOUPexu2VDUYHL8P4CwV+zMvWw6nlRw19OnRKmYAJpw==", + "dev": true, + "requires": {} + }, + "@volar/language-core": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-1.0.9.tgz", + "integrity": "sha512-5Fty3slLet6svXiJw2YxhYeo6c7wFdtILrql5bZymYLM+HbiZtJbryW1YnUEKAP7MO9Mbeh+TNH4Z0HFxHgIqw==", + "dev": true, + "requires": { + "@volar/source-map": "1.0.9", + "@vue/reactivity": "^3.2.40", + "muggle-string": "^0.1.0" + } + }, + "@volar/source-map": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-1.0.9.tgz", + "integrity": "sha512-fazB/vy5ZEJ3yKx4fabJyGNI3CBkdLkfEIRVu6+1P3VixK0Mn+eqyUIkLBrzGYaeFM3GybhCLCvsVdNz0Fu/CQ==", + "dev": true, + "requires": { + "muggle-string": "^0.1.0" + } + }, + "@volar/typescript": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@volar/typescript/-/typescript-1.0.9.tgz", + "integrity": "sha512-dVziu+ShQUWuMukM6bvK2v2O446/gG6l1XkTh2vfkccw1IzjfbiP1TWQoNo1ipTfZOtu5YJGYAx+o5HNrGXWfQ==", + "dev": true, + "requires": { + "@volar/language-core": "1.0.9" + } + }, + "@volar/vue-language-core": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@volar/vue-language-core/-/vue-language-core-1.0.9.tgz", + "integrity": "sha512-tofNoR8ShPFenHT1YVMuvoXtXWwoQE+fiXVqSmW0dSKZqEDjWQ3YeXSd0a6aqyKaIbvR7kWWGp34WbpQlwf9Ww==", + "dev": true, + "requires": { + "@volar/language-core": "1.0.9", + "@volar/source-map": "1.0.9", + "@vue/compiler-dom": "^3.2.40", + "@vue/compiler-sfc": "^3.2.40", + "@vue/reactivity": "^3.2.40", + "@vue/shared": "^3.2.40", + "minimatch": "^5.1.0", + "vue-template-compiler": "^2.7.10" + } + }, + "@volar/vue-typescript": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@volar/vue-typescript/-/vue-typescript-1.0.9.tgz", + "integrity": "sha512-ZLe4y9YNbviACa7uAMCilzxA76gbbSlKfjspXBzk6fCobd8QCIig+VyDYcjANIlm2HhgSCX8jYTzhCKlegh4mw==", + "dev": true, + "requires": { + "@volar/typescript": "1.0.9", + "@volar/vue-language-core": "1.0.9" + } + }, + "@vue/compiler-core": { + "version": "3.2.45", + "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.2.45.tgz", + "integrity": "sha512-rcMj7H+PYe5wBV3iYeUgbCglC+pbpN8hBLTJvRiK2eKQiWqu+fG9F+8sW99JdL4LQi7Re178UOxn09puSXvn4A==", + "requires": { + "@babel/parser": "^7.16.4", + "@vue/shared": "3.2.45", + "estree-walker": "^2.0.2", + "source-map": "^0.6.1" + } + }, + "@vue/compiler-dom": { + "version": "3.2.45", + "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.2.45.tgz", + "integrity": "sha512-tyYeUEuKqqZO137WrZkpwfPCdiiIeXYCcJ8L4gWz9vqaxzIQRccTSwSWZ/Axx5YR2z+LvpUbmPNXxuBU45lyRw==", + "requires": { + "@vue/compiler-core": "3.2.45", + "@vue/shared": "3.2.45" + } + }, + "@vue/compiler-sfc": { + "version": "3.2.45", + "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.2.45.tgz", + "integrity": "sha512-1jXDuWah1ggsnSAOGsec8cFjT/K6TMZ0sPL3o3d84Ft2AYZi2jWJgRMjw4iaK0rBfA89L5gw427H4n1RZQBu6Q==", + "requires": { + "@babel/parser": "^7.16.4", + "@vue/compiler-core": "3.2.45", + "@vue/compiler-dom": "3.2.45", + "@vue/compiler-ssr": "3.2.45", + "@vue/reactivity-transform": "3.2.45", + "@vue/shared": "3.2.45", + "estree-walker": "^2.0.2", + "magic-string": "^0.25.7", + "postcss": "^8.1.10", + "source-map": "^0.6.1" + } + }, + "@vue/compiler-ssr": { + "version": "3.2.45", + "resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.2.45.tgz", + "integrity": "sha512-6BRaggEGqhWht3lt24CrIbQSRD5O07MTmd+LjAn5fJj568+R9eUD2F7wMQJjX859seSlrYog7sUtrZSd7feqrQ==", + "requires": { + "@vue/compiler-dom": "3.2.45", + "@vue/shared": "3.2.45" + } + }, + "@vue/devtools-api": { + "version": "6.4.5", + "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.4.5.tgz", + "integrity": "sha512-JD5fcdIuFxU4fQyXUu3w2KpAJHzTVdN+p4iOX2lMWSHMOoQdMAcpFLZzm9Z/2nmsoZ1a96QEhZ26e50xLBsgOQ==" + }, + "@vue/eslint-config-typescript": { + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/@vue/eslint-config-typescript/-/eslint-config-typescript-11.0.2.tgz", + "integrity": "sha512-EiKud1NqlWmSapBFkeSrE994qpKx7/27uCGnhdqzllYDpQZroyX/O6bwjEpeuyKamvLbsGdO6PMR2faIf+zFnw==", + "dev": true, + "requires": { + "@typescript-eslint/eslint-plugin": "^5.0.0", + "@typescript-eslint/parser": "^5.0.0", + "vue-eslint-parser": "^9.0.0" + } + }, + "@vue/reactivity": { + "version": "3.2.45", + "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.2.45.tgz", + "integrity": "sha512-PRvhCcQcyEVohW0P8iQ7HDcIOXRjZfAsOds3N99X/Dzewy8TVhTCT4uXpAHfoKjVTJRA0O0K+6QNkDIZAxNi3A==", + "requires": { + "@vue/shared": "3.2.45" + } + }, + "@vue/reactivity-transform": { + "version": "3.2.45", + "resolved": "https://registry.npmjs.org/@vue/reactivity-transform/-/reactivity-transform-3.2.45.tgz", + "integrity": "sha512-BHVmzYAvM7vcU5WmuYqXpwaBHjsS8T63jlKGWVtHxAHIoMIlmaMyurUSEs1Zcg46M4AYT5MtB1U274/2aNzjJQ==", + "requires": { + "@babel/parser": "^7.16.4", + "@vue/compiler-core": "3.2.45", + "@vue/shared": "3.2.45", + "estree-walker": "^2.0.2", + "magic-string": "^0.25.7" + } + }, + "@vue/runtime-core": { + "version": "3.2.45", + "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.2.45.tgz", + "integrity": "sha512-gzJiTA3f74cgARptqzYswmoQx0fIA+gGYBfokYVhF8YSXjWTUA2SngRzZRku2HbGbjzB6LBYSbKGIaK8IW+s0A==", + "requires": { + "@vue/reactivity": "3.2.45", + "@vue/shared": "3.2.45" + } + }, + "@vue/runtime-dom": { + "version": "3.2.45", + "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.2.45.tgz", + "integrity": "sha512-cy88YpfP5Ue2bDBbj75Cb4bIEZUMM/mAkDMfqDTpUYVgTf/kuQ2VQ8LebuZ8k6EudgH8pYhsGWHlY0lcxlvTwA==", + "requires": { + "@vue/runtime-core": "3.2.45", + "@vue/shared": "3.2.45", + "csstype": "^2.6.8" + } + }, + "@vue/server-renderer": { + "version": "3.2.45", + "resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.2.45.tgz", + "integrity": "sha512-ebiMq7q24WBU1D6uhPK//2OTR1iRIyxjF5iVq/1a5I1SDMDyDu4Ts6fJaMnjrvD3MqnaiFkKQj+LKAgz5WIK3g==", + "requires": { + "@vue/compiler-ssr": "3.2.45", + "@vue/shared": "3.2.45" + } + }, + "@vue/shared": { + "version": "3.2.45", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.2.45.tgz", + "integrity": "sha512-Ewzq5Yhimg7pSztDV+RH1UDKBzmtqieXQlpTVm2AwraoRL/Rks96mvd8Vgi7Lj+h+TH8dv7mXD3FRZR3TUvbSg==" + }, + "acorn": { + "version": "8.8.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", + "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==", + "dev": true + }, + "acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "requires": {} + }, + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + }, + "arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==", + "dev": true + }, + "astral-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", + "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", + "dev": true + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", + "dev": true + }, + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true + }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + }, + "camelcase-keys": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.2.tgz", + "integrity": "sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==", + "dev": true, + "requires": { + "camelcase": "^5.3.1", + "map-obj": "^4.0.0", + "quick-lru": "^4.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "colord": { + "version": "2.9.3", + "resolved": "https://registry.npmjs.org/colord/-/colord-2.9.3.tgz", + "integrity": "sha512-jeC1axXpnb0/2nn/Y1LPuLdgXBLH7aDcHu4KEKfqw3CUhX7ZpfBSlPKyqXE6btIgEzfWtrX3/tyBCaCvXvMkOw==", + "dev": true + }, + "commander": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", + "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "cosmiconfig": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.1.0.tgz", + "integrity": "sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==", + "dev": true, + "requires": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.2.1", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.10.0" + } + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "dependencies": { + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, + "css-functions-list": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/css-functions-list/-/css-functions-list-3.1.0.tgz", + "integrity": "sha512-/9lCvYZaUbBGvYUgYGFJ4dcYiyqdhSjG7IPVluoV8A1ILjkF7ilmhp1OGUz8n+nmBcu0RNrQAzgD8B6FJbrt2w==", + "dev": true + }, + "csscolorparser": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/csscolorparser/-/csscolorparser-1.0.3.tgz", + "integrity": "sha512-umPSgYwZkdFoUrH5hIq5kf0wPSXiro51nPw0j2K/c83KflkPSTBGMz6NJvMB+07VlL0y7VPo6QJcDjcgKTTm3w==" + }, + "cssesc": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", + "dev": true + }, + "csstype": { + "version": "2.6.21", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.21.tgz", + "integrity": "sha512-Z1PhmomIfypOpoMjRQB70jfvy/wxT50qW08YXO5lMIJkrdq4yOTR+AW7FqutScmB9NkLwxo+jU+kZLbofZZq/w==" + }, + "d3": { + "version": "7.6.1", + "resolved": "https://registry.npmjs.org/d3/-/d3-7.6.1.tgz", + "integrity": "sha512-txMTdIHFbcpLx+8a0IFhZsbp+PfBBPt8yfbmukZTQFroKuFqIwqswF0qE5JXWefylaAVpSXFoKm3yP+jpNLFLw==", + "requires": { + "d3-array": "3", + "d3-axis": "3", + "d3-brush": "3", + "d3-chord": "3", + "d3-color": "3", + "d3-contour": "4", + "d3-delaunay": "6", + "d3-dispatch": "3", + "d3-drag": "3", + "d3-dsv": "3", + "d3-ease": "3", + "d3-fetch": "3", + "d3-force": "3", + "d3-format": "3", + "d3-geo": "3", + "d3-hierarchy": "3", + "d3-interpolate": "3", + "d3-path": "3", + "d3-polygon": "3", + "d3-quadtree": "3", + "d3-random": "3", + "d3-scale": "4", + "d3-scale-chromatic": "3", + "d3-selection": "3", + "d3-shape": "3", + "d3-time": "3", + "d3-time-format": "4", + "d3-timer": "3", + "d3-transition": "3", + "d3-zoom": "3" + } + }, + "d3-array": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.2.0.tgz", + "integrity": "sha512-3yXFQo0oG3QCxbF06rMPFyGRMGJNS7NvsV1+2joOjbBE+9xvWQ8+GcMJAjRCzw06zQ3/arXeJgbPYcjUCuC+3g==", + "requires": { + "internmap": "1 - 2" + } + }, + "d3-axis": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-axis/-/d3-axis-3.0.0.tgz", + "integrity": "sha512-IH5tgjV4jE/GhHkRV0HiVYPDtvfjHQlQfJHs0usq7M30XcSBvOotpmH1IgkcXsO/5gEQZD43B//fc7SRT5S+xw==" + }, + "d3-brush": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-brush/-/d3-brush-3.0.0.tgz", + "integrity": "sha512-ALnjWlVYkXsVIGlOsuWH1+3udkYFI48Ljihfnh8FZPF2QS9o+PzGLBslO0PjzVoHLZ2KCVgAM8NVkXPJB2aNnQ==", + "requires": { + "d3-dispatch": "1 - 3", + "d3-drag": "2 - 3", + "d3-interpolate": "1 - 3", + "d3-selection": "3", + "d3-transition": "3" + } + }, + "d3-chord": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-chord/-/d3-chord-3.0.1.tgz", + "integrity": "sha512-VE5S6TNa+j8msksl7HwjxMHDM2yNK3XCkusIlpX5kwauBfXuyLAtNg9jCp/iHH61tgI4sb6R/EIMWCqEIdjT/g==", + "requires": { + "d3-path": "1 - 3" + } + }, + "d3-color": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz", + "integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==" + }, + "d3-contour": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/d3-contour/-/d3-contour-4.0.0.tgz", + "integrity": "sha512-7aQo0QHUTu/Ko3cP9YK9yUTxtoDEiDGwnBHyLxG5M4vqlBkO/uixMRele3nfsfj6UXOcuReVpVXzAboGraYIJw==", + "requires": { + "d3-array": "^3.2.0" + } + }, + "d3-delaunay": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/d3-delaunay/-/d3-delaunay-6.0.2.tgz", + "integrity": "sha512-IMLNldruDQScrcfT+MWnazhHbDJhcRJyOEBAJfwQnHle1RPh6WDuLvxNArUju2VSMSUuKlY5BGHRJ2cYyoFLQQ==", + "requires": { + "delaunator": "5" + } + }, + "d3-dispatch": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-dispatch/-/d3-dispatch-3.0.1.tgz", + "integrity": "sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg==" + }, + "d3-drag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-drag/-/d3-drag-3.0.0.tgz", + "integrity": "sha512-pWbUJLdETVA8lQNJecMxoXfH6x+mO2UQo8rSmZ+QqxcbyA3hfeprFgIT//HW2nlHChWeIIMwS2Fq+gEARkhTkg==", + "requires": { + "d3-dispatch": "1 - 3", + "d3-selection": "3" + } + }, + "d3-dsv": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-dsv/-/d3-dsv-3.0.1.tgz", + "integrity": "sha512-UG6OvdI5afDIFP9w4G0mNq50dSOsXHJaRE8arAS5o9ApWnIElp8GZw1Dun8vP8OyHOZ/QJUKUJwxiiCCnUwm+Q==", + "requires": { + "commander": "7", + "iconv-lite": "0.6", + "rw": "1" + } + }, + "d3-ease": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-3.0.1.tgz", + "integrity": "sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==" + }, + "d3-fetch": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-fetch/-/d3-fetch-3.0.1.tgz", + "integrity": "sha512-kpkQIM20n3oLVBKGg6oHrUchHM3xODkTzjMoj7aWQFq5QEM+R6E4WkzT5+tojDY7yjez8KgCBRoj4aEr99Fdqw==", + "requires": { + "d3-dsv": "1 - 3" + } + }, + "d3-force": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-force/-/d3-force-3.0.0.tgz", + "integrity": "sha512-zxV/SsA+U4yte8051P4ECydjD/S+qeYtnaIyAs9tgHCqfguma/aAQDjo85A9Z6EKhBirHRJHXIgJUlffT4wdLg==", + "requires": { + "d3-dispatch": "1 - 3", + "d3-quadtree": "1 - 3", + "d3-timer": "1 - 3" + } + }, + "d3-format": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.0.tgz", + "integrity": "sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA==" + }, + "d3-geo": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-geo/-/d3-geo-3.0.1.tgz", + "integrity": "sha512-Wt23xBych5tSy9IYAM1FR2rWIBFWa52B/oF/GYe5zbdHrg08FU8+BuI6X4PvTwPDdqdAdq04fuWJpELtsaEjeA==", + "requires": { + "d3-array": "2.5.0 - 3" + } + }, + "d3-hierarchy": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/d3-hierarchy/-/d3-hierarchy-3.1.2.tgz", + "integrity": "sha512-FX/9frcub54beBdugHjDCdikxThEqjnR93Qt7PvQTOHxyiNCAlvMrHhclk3cD5VeAaq9fxmfRp+CnWw9rEMBuA==" + }, + "d3-interpolate": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz", + "integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==", + "requires": { + "d3-color": "1 - 3" + } + }, + "d3-path": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-3.0.1.tgz", + "integrity": "sha512-gq6gZom9AFZby0YLduxT1qmrp4xpBA1YZr19OI717WIdKE2OM5ETq5qrHLb301IgxhLwcuxvGZVLeeWc/k1I6w==" + }, + "d3-polygon": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-polygon/-/d3-polygon-3.0.1.tgz", + "integrity": "sha512-3vbA7vXYwfe1SYhED++fPUQlWSYTTGmFmQiany/gdbiWgU/iEyQzyymwL9SkJjFFuCS4902BSzewVGsHHmHtXg==" + }, + "d3-quadtree": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-quadtree/-/d3-quadtree-3.0.1.tgz", + "integrity": "sha512-04xDrxQTDTCFwP5H6hRhsRcb9xxv2RzkcsygFzmkSIOJy3PeRJP7sNk3VRIbKXcog561P9oU0/rVH6vDROAgUw==" + }, + "d3-random": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-random/-/d3-random-3.0.1.tgz", + "integrity": "sha512-FXMe9GfxTxqd5D6jFsQ+DJ8BJS4E/fT5mqqdjovykEB2oFbTMDVdg1MGFxfQW+FBOGoB++k8swBrgwSHT1cUXQ==" + }, + "d3-scale": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz", + "integrity": "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==", + "requires": { + "d3-array": "2.10.0 - 3", + "d3-format": "1 - 3", + "d3-interpolate": "1.2.0 - 3", + "d3-time": "2.1.1 - 3", + "d3-time-format": "2 - 4" + } + }, + "d3-scale-chromatic": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-scale-chromatic/-/d3-scale-chromatic-3.0.0.tgz", + "integrity": "sha512-Lx9thtxAKrO2Pq6OO2Ua474opeziKr279P/TKZsMAhYyNDD3EnCffdbgeSYN5O7m2ByQsxtuP2CSDczNUIZ22g==", + "requires": { + "d3-color": "1 - 3", + "d3-interpolate": "1 - 3" + } + }, + "d3-selection": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-3.0.0.tgz", + "integrity": "sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==" + }, + "d3-shape": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-3.1.0.tgz", + "integrity": "sha512-tGDh1Muf8kWjEDT/LswZJ8WF85yDZLvVJpYU9Nq+8+yW1Z5enxrmXOhTArlkaElU+CTn0OTVNli+/i+HP45QEQ==", + "requires": { + "d3-path": "1 - 3" + } + }, + "d3-time": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.0.0.tgz", + "integrity": "sha512-zmV3lRnlaLI08y9IMRXSDshQb5Nj77smnfpnd2LrBa/2K281Jijactokeak14QacHs/kKq0AQ121nidNYlarbQ==", + "requires": { + "d3-array": "2 - 3" + } + }, + "d3-time-format": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-4.1.0.tgz", + "integrity": "sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==", + "requires": { + "d3-time": "1 - 3" + } + }, + "d3-timer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-3.0.1.tgz", + "integrity": "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==" + }, + "d3-transition": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-transition/-/d3-transition-3.0.1.tgz", + "integrity": "sha512-ApKvfjsSR6tg06xrL434C0WydLr7JewBB3V+/39RMHsaXTOG0zmt/OAXeng5M5LBm0ojmxJrpomQVZ1aPvBL4w==", + "requires": { + "d3-color": "1 - 3", + "d3-dispatch": "1 - 3", + "d3-ease": "1 - 3", + "d3-interpolate": "1 - 3", + "d3-timer": "1 - 3" + } + }, + "d3-zoom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-zoom/-/d3-zoom-3.0.0.tgz", + "integrity": "sha512-b8AmV3kfQaqWAuacbPuNbL6vahnOJflOhexLzMMNLga62+/nh0JzvJ0aO/5a5MVgUFGS7Hu1P9P03o3fJkDCyw==", + "requires": { + "d3-dispatch": "1 - 3", + "d3-drag": "2 - 3", + "d3-interpolate": "1 - 3", + "d3-selection": "2 - 3", + "d3-transition": "2 - 3" + } + }, + "de-indent": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/de-indent/-/de-indent-1.0.2.tgz", + "integrity": "sha512-e/1zu3xH5MQryN2zdVaF0OrdNLUbvWxzMbi+iNA6Bky7l1RoP8a2fIbRocyHclXt/arDrrR6lL3TqFD9pMQTsg==", + "dev": true + }, + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", + "dev": true + }, + "decamelize-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.1.tgz", + "integrity": "sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==", + "dev": true, + "requires": { + "decamelize": "^1.1.0", + "map-obj": "^1.0.0" + }, + "dependencies": { + "map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg==", + "dev": true + } + } + }, + "deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, + "delaunator": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/delaunator/-/delaunator-5.0.0.tgz", + "integrity": "sha512-AyLvtyJdbv/U1GkiS6gUUzclRoAY4Gs75qkMygJJhU75LW4DNuSF2RMzpxs9jw9Oz1BobHjTdkG3zdP55VxAqw==", + "requires": { + "robust-predicates": "^3.0.0" + } + }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "requires": { + "path-type": "^4.0.0" + } + }, + "doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, + "dom-serializer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", + "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", + "dev": true, + "peer": true, + "requires": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.2", + "entities": "^4.2.0" + } + }, + "domelementtype": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", + "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", + "dev": true, + "peer": true + }, + "domhandler": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", + "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", + "dev": true, + "peer": true, + "requires": { + "domelementtype": "^2.3.0" + } + }, + "domutils": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.0.1.tgz", + "integrity": "sha512-z08c1l761iKhDFtfXO04C7kTdPBLi41zwOZl00WS8b5eiaebNpY00HKbztwBq+e3vyqWNwWF3mP9YLUeqIrF+Q==", + "dev": true, + "peer": true, + "requires": { + "dom-serializer": "^2.0.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.1" + } + }, + "earcut": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/earcut/-/earcut-2.2.4.tgz", + "integrity": "sha512-/pjZsA1b4RPHbeWZQn66SWS8nZZWLQQ23oE3Eam7aroEFGEvwKAsJfZ9ytiEMycfzXWpca4FA9QIOehf7PocBQ==" + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "entities": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.4.0.tgz", + "integrity": "sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA==", + "dev": true, + "peer": true + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "esbuild": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.15.15.tgz", + "integrity": "sha512-TEw/lwK4Zzld9x3FedV6jy8onOUHqcEX3ADFk4k+gzPUwrxn8nWV62tH0udo8jOtjFodlEfc4ypsqX3e+WWO6w==", + "dev": true, + "requires": { + "@esbuild/android-arm": "0.15.15", + "@esbuild/linux-loong64": "0.15.15", + "esbuild-android-64": "0.15.15", + "esbuild-android-arm64": "0.15.15", + "esbuild-darwin-64": "0.15.15", + "esbuild-darwin-arm64": "0.15.15", + "esbuild-freebsd-64": "0.15.15", + "esbuild-freebsd-arm64": "0.15.15", + "esbuild-linux-32": "0.15.15", + "esbuild-linux-64": "0.15.15", + "esbuild-linux-arm": "0.15.15", + "esbuild-linux-arm64": "0.15.15", + "esbuild-linux-mips64le": "0.15.15", + "esbuild-linux-ppc64le": "0.15.15", + "esbuild-linux-riscv64": "0.15.15", + "esbuild-linux-s390x": "0.15.15", + "esbuild-netbsd-64": "0.15.15", + "esbuild-openbsd-64": "0.15.15", + "esbuild-sunos-64": "0.15.15", + "esbuild-windows-32": "0.15.15", + "esbuild-windows-64": "0.15.15", + "esbuild-windows-arm64": "0.15.15" + } + }, + "esbuild-android-64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.15.15.tgz", + "integrity": "sha512-F+WjjQxO+JQOva3tJWNdVjouFMLK6R6i5gjDvgUthLYJnIZJsp1HlF523k73hELY20WPyEO8xcz7aaYBVkeg5Q==", + "dev": true, + "optional": true + }, + "esbuild-android-arm64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.15.15.tgz", + "integrity": "sha512-attlyhD6Y22jNyQ0fIIQ7mnPvDWKw7k6FKnsXlBvQE6s3z6s6cuEHcSgoirquQc7TmZgVCK5fD/2uxmRN+ZpcQ==", + "dev": true, + "optional": true + }, + "esbuild-darwin-64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.15.15.tgz", + "integrity": "sha512-ohZtF8W1SHJ4JWldsPVdk8st0r9ExbAOSrBOh5L+Mq47i696GVwv1ab/KlmbUoikSTNoXEhDzVpxUR/WIO19FQ==", + "dev": true, + "optional": true + }, + "esbuild-darwin-arm64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.15.15.tgz", + "integrity": "sha512-P8jOZ5zshCNIuGn+9KehKs/cq5uIniC+BeCykvdVhx/rBXSxmtj3CUIKZz4sDCuESMbitK54drf/2QX9QHG5Ag==", + "dev": true, + "optional": true + }, + "esbuild-freebsd-64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.15.15.tgz", + "integrity": "sha512-KkTg+AmDXz1IvA9S1gt8dE24C8Thx0X5oM0KGF322DuP+P3evwTL9YyusHAWNsh4qLsR80nvBr/EIYs29VSwuA==", + "dev": true, + "optional": true + }, + "esbuild-freebsd-arm64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.15.15.tgz", + "integrity": "sha512-FUcML0DRsuyqCMfAC+HoeAqvWxMeq0qXvclZZ/lt2kLU6XBnDA5uKTLUd379WYEyVD4KKFctqWd9tTuk8C/96g==", + "dev": true, + "optional": true + }, + "esbuild-linux-32": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.15.15.tgz", + "integrity": "sha512-q28Qn5pZgHNqug02aTkzw5sW9OklSo96b5nm17Mq0pDXrdTBcQ+M6Q9A1B+dalFeynunwh/pvfrNucjzwDXj+Q==", + "dev": true, + "optional": true + }, + "esbuild-linux-64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.15.15.tgz", + "integrity": "sha512-217KPmWMirkf8liO+fj2qrPwbIbhNTGNVtvqI1TnOWJgcMjUWvd677Gq3fTzXEjilkx2yWypVnTswM2KbXgoAg==", + "dev": true, + "optional": true + }, + "esbuild-linux-arm": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.15.15.tgz", + "integrity": "sha512-RYVW9o2yN8yM7SB1yaWr378CwrjvGCyGybX3SdzPHpikUHkME2AP55Ma20uNwkNyY2eSYFX9D55kDrfQmQBR4w==", + "dev": true, + "optional": true + }, + "esbuild-linux-arm64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.15.15.tgz", + "integrity": "sha512-/ltmNFs0FivZkYsTzAsXIfLQX38lFnwJTWCJts0IbCqWZQe+jjj0vYBNbI0kmXLb3y5NljiM5USVAO1NVkdh2g==", + "dev": true, + "optional": true + }, + "esbuild-linux-mips64le": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.15.15.tgz", + "integrity": "sha512-PksEPb321/28GFFxtvL33yVPfnMZihxkEv5zME2zapXGp7fA1X2jYeiTUK+9tJ/EGgcNWuwvtawPxJG7Mmn86A==", + "dev": true, + "optional": true + }, + "esbuild-linux-ppc64le": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.15.15.tgz", + "integrity": "sha512-ek8gJBEIhcpGI327eAZigBOHl58QqrJrYYIZBWQCnH3UnXoeWMrMZLeeZL8BI2XMBhP+sQ6ERctD5X+ajL/AIA==", + "dev": true, + "optional": true + }, + "esbuild-linux-riscv64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.15.15.tgz", + "integrity": "sha512-H5ilTZb33/GnUBrZMNJtBk7/OXzDHDXjIzoLXHSutwwsLxSNaLxzAaMoDGDd/keZoS+GDBqNVxdCkpuiRW4OSw==", + "dev": true, + "optional": true + }, + "esbuild-linux-s390x": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.15.15.tgz", + "integrity": "sha512-jKaLUg78mua3rrtrkpv4Or2dNTJU7bgHN4bEjT4OX4GR7nLBSA9dfJezQouTxMmIW7opwEC5/iR9mpC18utnxQ==", + "dev": true, + "optional": true + }, + "esbuild-netbsd-64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.15.15.tgz", + "integrity": "sha512-aOvmF/UkjFuW6F36HbIlImJTTx45KUCHJndtKo+KdP8Dhq3mgLRKW9+6Ircpm8bX/RcS3zZMMmaBLkvGY06Gvw==", + "dev": true, + "optional": true + }, + "esbuild-openbsd-64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.15.15.tgz", + "integrity": "sha512-HFFX+WYedx1w2yJ1VyR1Dfo8zyYGQZf1cA69bLdrHzu9svj6KH6ZLK0k3A1/LFPhcEY9idSOhsB2UyU0tHPxgQ==", + "dev": true, + "optional": true + }, + "esbuild-sunos-64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.15.15.tgz", + "integrity": "sha512-jOPBudffG4HN8yJXcK9rib/ZTFoTA5pvIKbRrt3IKAGMq1EpBi4xoVoSRrq/0d4OgZLaQbmkHp8RO9eZIn5atA==", + "dev": true, + "optional": true + }, + "esbuild-windows-32": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.15.15.tgz", + "integrity": "sha512-MDkJ3QkjnCetKF0fKxCyYNBnOq6dmidcwstBVeMtXSgGYTy8XSwBeIE4+HuKiSsG6I/mXEb++px3IGSmTN0XiA==", + "dev": true, + "optional": true + }, + "esbuild-windows-64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.15.15.tgz", + "integrity": "sha512-xaAUIB2qllE888SsMU3j9nrqyLbkqqkpQyWVkfwSil6BBPgcPk3zOFitTTncEKCLTQy3XV9RuH7PDj3aJDljWA==", + "dev": true, + "optional": true + }, + "esbuild-windows-arm64": { + "version": "0.15.15", + "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.15.15.tgz", + "integrity": "sha512-ttuoCYCIJAFx4UUKKWYnFdrVpoXa3+3WWkXVI6s09U+YjhnyM5h96ewTq/WgQj9LFSIlABQvadHSOQyAVjW5xQ==", + "dev": true, + "optional": true + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, + "eslint": { + "version": "8.29.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.29.0.tgz", + "integrity": "sha512-isQ4EEiyUjZFbEKvEGJKKGBwXtvXX+zJbkVKCgTuB9t/+jUBcy8avhkEwWJecI15BkRkOYmvIM5ynbhRjEkoeg==", + "dev": true, + "requires": { + "@eslint/eslintrc": "^1.3.3", + "@humanwhocodes/config-array": "^0.11.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.1.1", + "eslint-utils": "^3.0.0", + "eslint-visitor-keys": "^3.3.0", + "espree": "^9.4.0", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.15.0", + "grapheme-splitter": "^1.0.4", + "ignore": "^5.2.0", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-sdsl": "^4.1.4", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "regexpp": "^3.2.0", + "strip-ansi": "^6.0.1", + "strip-json-comments": "^3.1.0", + "text-table": "^0.2.0" + }, + "dependencies": { + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "eslint-scope": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", + "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + } + }, + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, + "eslint-plugin-vue": { + "version": "9.8.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-vue/-/eslint-plugin-vue-9.8.0.tgz", + "integrity": "sha512-E/AXwcTzunyzM83C2QqDHxepMzvI2y6x+mmeYHbVDQlKFqmKYvRrhaVixEeeG27uI44p9oKDFiyCRw4XxgtfHA==", + "dev": true, + "requires": { + "eslint-utils": "^3.0.0", + "natural-compare": "^1.4.0", + "nth-check": "^2.0.1", + "postcss-selector-parser": "^6.0.9", + "semver": "^7.3.5", + "vue-eslint-parser": "^9.0.1", + "xml-name-validator": "^4.0.0" + } + }, + "eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + } + }, + "eslint-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^2.0.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true + } + } + }, + "eslint-visitor-keys": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", + "dev": true + }, + "espree": { + "version": "9.4.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.1.tgz", + "integrity": "sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==", + "dev": true, + "requires": { + "acorn": "^8.8.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.3.0" + } + }, + "esquery": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "dev": true, + "requires": { + "estraverse": "^5.1.0" + }, + "dependencies": { + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + } + } + }, + "esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "requires": { + "estraverse": "^5.2.0" + }, + "dependencies": { + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + } + } + }, + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true + }, + "estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==" + }, + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "fast-glob": { + "version": "3.2.12", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", + "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "dependencies": { + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + } + } + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, + "fastest-levenshtein": { + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", + "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", + "dev": true + }, + "fastq": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "dev": true, + "requires": { + "reusify": "^1.0.4" + } + }, + "file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "requires": { + "flat-cache": "^3.0.4" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "requires": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + } + }, + "flatted": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", + "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", + "dev": true + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "optional": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "geojson-vt": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/geojson-vt/-/geojson-vt-3.2.1.tgz", + "integrity": "sha512-EvGQQi/zPrDA6zr6BnJD/YhwAkBP8nnJ9emh3EnHQKVMfg/MRVtPbMYdgVy/IaEmn4UfagD2a6fafPDL5hbtwg==" + }, + "get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==" + }, + "gl-matrix": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/gl-matrix/-/gl-matrix-3.4.3.tgz", + "integrity": "sha512-wcCp8vu8FT22BnvKVPjXa/ICBWRq/zjFfdofZy1WSpQZpphblv12/bOQLBC1rMM7SGOFS9ltVmKOHil5+Ml7gA==" + }, + "glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "dependencies": { + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, + "glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "requires": { + "is-glob": "^4.0.3" + } + }, + "global-modules": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-2.0.0.tgz", + "integrity": "sha512-NGbfmJBp9x8IxyJSd1P+otYK8vonoJactOogrVfFRIAEY1ukil8RSKDz2Yo7wh1oihl51l/r6W4epkeKJHqL8A==", + "dev": true, + "requires": { + "global-prefix": "^3.0.0" + } + }, + "global-prefix": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-3.0.0.tgz", + "integrity": "sha512-awConJSVCHVGND6x3tmMaKcQvwXLhjdkmomy2W+Goaui8YPgYgXJZewhg3fWC+DlfqqQuWg8AwqjGTD2nAPVWg==", + "requires": { + "ini": "^1.3.5", + "kind-of": "^6.0.2", + "which": "^1.3.1" + } + }, + "globals": { + "version": "13.18.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.18.0.tgz", + "integrity": "sha512-/mR4KI8Ps2spmoc0Ulu9L7agOF0du1CZNQ3dke8yItYlyKNmGrkONemBbd6V8UTc1Wgcqn21t3WYB7dbRmh6/A==", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + } + }, + "globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "requires": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + } + }, + "globjoin": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/globjoin/-/globjoin-0.1.4.tgz", + "integrity": "sha512-xYfnw62CKG8nLkZBfWbhWwDw02CHty86jfPcc2cr3ZfeuK9ysoVPPEUxf21bAD/rWAgk52SuBrLJlefNy8mvFg==", + "dev": true + }, + "globrex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz", + "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==", + "dev": true + }, + "golden-layout": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/golden-layout/-/golden-layout-2.6.0.tgz", + "integrity": "sha512-sIVQCiRWOymHbVD1Aw/T9/ijbPYAVGBlgGYd1N9MRKfcyBNSpjr87Vg9nSHm+RCT8ELrvK8IJYJV0QRJuVUkCQ==" + }, + "grapheme-splitter": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", + "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", + "dev": true + }, + "hard-rejection": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", + "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==", + "dev": true + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true + }, + "hosted-git-info": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", + "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "html-tags": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/html-tags/-/html-tags-3.2.0.tgz", + "integrity": "sha512-vy7ClnArOZwCnqZgvv+ddgHgJiAFXe3Ge9ML5/mBctVJoUoYPCdxVucOywjDARn6CVoh3dRSFdPHy2sX80L0Wg==", + "dev": true + }, + "htmlparser2": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.1.tgz", + "integrity": "sha512-4lVbmc1diZC7GUJQtRQ5yBAeUCL1exyMwmForWkRLnwyzWBFxN633SALPMGYaWZvKe9j1pRZJpauvmxENSp/EA==", + "dev": true, + "peer": true, + "requires": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.2", + "domutils": "^3.0.1", + "entities": "^4.3.0" + } + }, + "iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + } + }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" + }, + "ignore": { + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", + "dev": true + }, + "import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "import-lazy": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-4.0.0.tgz", + "integrity": "sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw==", + "dev": true + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true + }, + "indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" + }, + "internmap": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz", + "integrity": "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==" + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true + }, + "is-core-module": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", + "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true + }, + "is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==", + "dev": true + }, + "is-plain-object": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", + "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "js-sdsl": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.2.0.tgz", + "integrity": "sha512-dyBIzQBDkCqCu+0upx25Y2jGdbTGxE9fshMsCdK0ViOongpV+n5tXRcZY9v7CaVQ79AGS9KA1KHtojxiM7aXSQ==", + "dev": true + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "requires": { + "argparse": "^2.0.1" + } + }, + "json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true + }, + "kdbush": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/kdbush/-/kdbush-3.0.0.tgz", + "integrity": "sha512-hRkd6/XW4HTsA9vjVpY9tuXJYLSlelnkTmVFu4M9/7MIYQtFcHpbugAU7UbOfjOiVSVYl2fqgBuJ32JUmRo5Ew==" + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" + }, + "known-css-properties": { + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.26.0.tgz", + "integrity": "sha512-5FZRzrZzNTBruuurWpvZnvP9pum+fe0HcK8z/ooo+U+Hmp4vtbyp1/QDsqmufirXy4egGzbaH/y2uCZf+6W5Kg==", + "dev": true + }, + "levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } + }, + "lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "requires": { + "p-locate": "^5.0.0" + } + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, + "lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "lodash.truncate": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", + "integrity": "sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==", + "dev": true + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "magic-string": { + "version": "0.25.9", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", + "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", + "requires": { + "sourcemap-codec": "^1.4.8" + } + }, + "map-obj": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz", + "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==", + "dev": true + }, + "maplibre-gl": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-2.4.0.tgz", + "integrity": "sha512-csNFylzntPmHWidczfgCZpvbTSmhaWvLRj9e1ezUDBEPizGgshgm3ea1T5TCNEEBq0roauu7BPuRZjA3wO4KqA==", + "requires": { + "@mapbox/geojson-rewind": "^0.5.2", + "@mapbox/jsonlint-lines-primitives": "^2.0.2", + "@mapbox/mapbox-gl-supported": "^2.0.1", + "@mapbox/point-geometry": "^0.1.0", + "@mapbox/tiny-sdf": "^2.0.5", + "@mapbox/unitbezier": "^0.0.1", + "@mapbox/vector-tile": "^1.3.1", + "@mapbox/whoots-js": "^3.1.0", + "@types/geojson": "^7946.0.10", + "@types/mapbox__point-geometry": "^0.1.2", + "@types/mapbox__vector-tile": "^1.3.0", + "@types/pbf": "^3.0.2", + "csscolorparser": "~1.0.3", + "earcut": "^2.2.4", + "geojson-vt": "^3.2.1", + "gl-matrix": "^3.4.3", + "global-prefix": "^3.0.0", + "murmurhash-js": "^1.0.0", + "pbf": "^3.2.1", + "potpack": "^1.0.2", + "quickselect": "^2.0.0", + "supercluster": "^7.1.5", + "tinyqueue": "^2.0.3", + "vt-pbf": "^3.1.3" + } + }, + "mathml-tag-names": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/mathml-tag-names/-/mathml-tag-names-2.1.3.tgz", + "integrity": "sha512-APMBEanjybaPzUrfqU0IMU5I0AswKMH7k8OTLs0vvV4KZpExkTkY87nR/zpbuTPj+gARop7aGUbl11pnDfW6xg==", + "dev": true + }, + "meow": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-9.0.0.tgz", + "integrity": "sha512-+obSblOQmRhcyBt62furQqRAQpNyWXo8BuQ5bN7dG8wmwQ+vwHKp/rCFD4CrTP8CsDQD1sjoZ94K417XEUk8IQ==", + "dev": true, + "requires": { + "@types/minimist": "^1.2.0", + "camelcase-keys": "^6.2.2", + "decamelize": "^1.2.0", + "decamelize-keys": "^1.1.0", + "hard-rejection": "^2.1.0", + "minimist-options": "4.1.0", + "normalize-package-data": "^3.0.0", + "read-pkg-up": "^7.0.1", + "redent": "^3.0.0", + "trim-newlines": "^3.0.0", + "type-fest": "^0.18.0", + "yargs-parser": "^20.2.3" + }, + "dependencies": { + "type-fest": { + "version": "0.18.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz", + "integrity": "sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==", + "dev": true + } + } + }, + "merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true + }, + "micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "requires": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + } + }, + "min-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", + "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", + "dev": true + }, + "minimatch": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz", + "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" + } + }, + "minimist": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", + "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==" + }, + "minimist-options": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz", + "integrity": "sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==", + "dev": true, + "requires": { + "arrify": "^1.0.1", + "is-plain-obj": "^1.1.0", + "kind-of": "^6.0.3" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "muggle-string": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/muggle-string/-/muggle-string-0.1.0.tgz", + "integrity": "sha512-Tr1knR3d2mKvvWthlk7202rywKbiOm4rVFLsfAaSIhJ6dt9o47W4S+JMtWhd/PW9Wrdew2/S2fSvhz3E2gkfEg==", + "dev": true + }, + "murmurhash-js": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/murmurhash-js/-/murmurhash-js-1.0.0.tgz", + "integrity": "sha512-TvmkNhkv8yct0SVBSy+o8wYzXjE4Zz3PCesbfs8HiCXXdcTuocApFv11UWlNFWKYsP2okqrhb7JNlSm9InBhIw==" + }, + "nanoid": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", + "integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==" + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, + "natural-compare-lite": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", + "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", + "dev": true + }, + "normalize-package-data": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz", + "integrity": "sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA==", + "dev": true, + "requires": { + "hosted-git-info": "^4.0.1", + "is-core-module": "^2.5.0", + "semver": "^7.3.4", + "validate-npm-package-license": "^3.0.1" + } + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, + "nth-check": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", + "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", + "dev": true, + "requires": { + "boolbase": "^1.0.0" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "requires": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + } + }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, + "parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + } + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + }, + "pbf": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/pbf/-/pbf-3.2.1.tgz", + "integrity": "sha512-ClrV7pNOn7rtmoQVF4TS1vyU0WhYRnP92fzbfF75jAIwpnzdJXf8iTd4CMEqO4yUenH6NDqLiwjqlh6QgZzgLQ==", + "requires": { + "ieee754": "^1.1.12", + "resolve-protobuf-schema": "^2.1.0" + } + }, + "picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" + }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true + }, + "postcss": { + "version": "8.4.19", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.19.tgz", + "integrity": "sha512-h+pbPsyhlYj6N2ozBmHhHrs9DzGmbaarbLvWipMRO7RLS+v4onj26MPFXA5OBYFxyqYhUJK456SwDcY9H2/zsA==", + "requires": { + "nanoid": "^3.3.4", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + } + }, + "postcss-html": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/postcss-html/-/postcss-html-1.5.0.tgz", + "integrity": "sha512-kCMRWJRHKicpA166kc2lAVUGxDZL324bkj/pVOb6RhjB0Z5Krl7mN0AsVkBhVIRZZirY0lyQXG38HCVaoKVNoA==", + "dev": true, + "peer": true, + "requires": { + "htmlparser2": "^8.0.0", + "js-tokens": "^8.0.0", + "postcss": "^8.4.0", + "postcss-safe-parser": "^6.0.0" + }, + "dependencies": { + "js-tokens": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-8.0.0.tgz", + "integrity": "sha512-PC7MzqInq9OqKyTXfIvQNcjMkODJYC8A17kAaQgeW79yfhqTWSOfjHYQ2mDDcwJ96Iibtwkfh0C7R/OvqPlgVA==", + "dev": true, + "peer": true + } + } + }, + "postcss-media-query-parser": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/postcss-media-query-parser/-/postcss-media-query-parser-0.2.3.tgz", + "integrity": "sha512-3sOlxmbKcSHMjlUXQZKQ06jOswE7oVkXPxmZdoB1r5l0q6gTFTQSHxNxOrCccElbW7dxNytifNEo8qidX2Vsig==", + "dev": true + }, + "postcss-resolve-nested-selector": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/postcss-resolve-nested-selector/-/postcss-resolve-nested-selector-0.1.1.tgz", + "integrity": "sha512-HvExULSwLqHLgUy1rl3ANIqCsvMS0WHss2UOsXhXnQaZ9VCc2oBvIpXrl00IUFT5ZDITME0o6oiXeiHr2SAIfw==", + "dev": true + }, + "postcss-safe-parser": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-safe-parser/-/postcss-safe-parser-6.0.0.tgz", + "integrity": "sha512-FARHN8pwH+WiS2OPCxJI8FuRJpTVnn6ZNFiqAM2aeW2LwTHWWmWgIyKC6cUo0L8aeKiF/14MNvnpls6R2PBeMQ==", + "dev": true, + "requires": {} + }, + "postcss-scss": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/postcss-scss/-/postcss-scss-4.0.6.tgz", + "integrity": "sha512-rLDPhJY4z/i4nVFZ27j9GqLxj1pwxE80eAzUNRMXtcpipFYIeowerzBgG3yJhMtObGEXidtIgbUpQ3eLDsf5OQ==", + "dev": true, + "requires": {} + }, + "postcss-selector-parser": { + "version": "6.0.11", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.11.tgz", + "integrity": "sha512-zbARubNdogI9j7WY4nQJBiNqQf3sLS3wCP4WfOidu+p28LofJqDH1tcXypGrcmMHhDk2t9wGhCsYe/+szLTy1g==", + "dev": true, + "requires": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + } + }, + "postcss-value-parser": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", + "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", + "dev": true + }, + "potpack": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/potpack/-/potpack-1.0.2.tgz", + "integrity": "sha512-choctRBIV9EMT9WGAZHn3V7t0Z2pMQyl0EZE6pFc/6ml3ssw7Dlf/oAOvFwjm1HVsqfQN8GfeFyJ+d8tRzqueQ==" + }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true + }, + "protocol-buffers-schema": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/protocol-buffers-schema/-/protocol-buffers-schema-3.6.0.tgz", + "integrity": "sha512-TdDRD+/QNdrCGCE7v8340QyuXd4kIWIgapsE2+n/SaGiSSbomYl4TjHlvIoCWRpE7wFt02EpB35VVA2ImcBVqw==" + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true + }, + "quick-lru": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz", + "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==", + "dev": true + }, + "quickselect": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/quickselect/-/quickselect-2.0.0.tgz", + "integrity": "sha512-RKJ22hX8mHe3Y6wH/N3wCM6BWtjaxIyyUIkpHOvfFnxdI4yD4tBXEBKSbriGujF6jnSVkJrffuo6vxACiSSxIw==" + }, + "read-pkg": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", + "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", + "dev": true, + "requires": { + "@types/normalize-package-data": "^2.4.0", + "normalize-package-data": "^2.5.0", + "parse-json": "^5.0.0", + "type-fest": "^0.6.0" + }, + "dependencies": { + "hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "dev": true + }, + "normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "type-fest": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", + "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", + "dev": true + } + } + }, + "read-pkg-up": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", + "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", + "dev": true, + "requires": { + "find-up": "^4.1.0", + "read-pkg": "^5.2.0", + "type-fest": "^0.8.1" + }, + "dependencies": { + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true + } + } + }, + "redent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", + "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==", + "dev": true, + "requires": { + "indent-string": "^4.0.0", + "strip-indent": "^3.0.0" + } + }, + "regexpp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "dev": true + }, + "require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true + }, + "resolve": { + "version": "1.22.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", + "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", + "dev": true, + "requires": { + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + }, + "resolve-protobuf-schema": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/resolve-protobuf-schema/-/resolve-protobuf-schema-2.1.0.tgz", + "integrity": "sha512-kI5ffTiZWmJaS/huM8wZfEMer1eRd7oJQhDuxeCLe3t7N7mX3z94CN0xPxBQxFYQTSNz9T0i+v6inKqSdK8xrQ==", + "requires": { + "protocol-buffers-schema": "^3.3.1" + } + }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "robust-predicates": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/robust-predicates/-/robust-predicates-3.0.1.tgz", + "integrity": "sha512-ndEIpszUHiG4HtDsQLeIuMvRsDnn8c8rYStabochtUeCvfuvNptb5TUbVD68LRAILPX7p9nqQGh4xJgn3EHS/g==" + }, + "rollup": { + "version": "2.79.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz", + "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==", + "dev": true, + "requires": { + "fsevents": "~2.3.2" + } + }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "requires": { + "queue-microtask": "^1.2.2" + } + }, + "rw": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/rw/-/rw-1.3.3.tgz", + "integrity": "sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "semver": { + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, + "slice-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", + "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + }, + "source-map-js": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==" + }, + "sourcemap-codec": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", + "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==" + }, + "spdx-correct": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", + "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.12", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.12.tgz", + "integrity": "sha512-rr+VVSXtRhO4OHbXUiAF7xW3Bo9DuuF6C5jH+q/x15j2jniycgKbxU09Hr0WqlSLUs4i4ltHGXqTe7VHclYWyA==", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "strip-indent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", + "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", + "dev": true, + "requires": { + "min-indent": "^1.0.0" + } + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true + }, + "style-search": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/style-search/-/style-search-0.1.0.tgz", + "integrity": "sha512-Dj1Okke1C3uKKwQcetra4jSuk0DqbzbYtXipzFlFMZtowbF1x7BKJwB9AayVMyFARvU8EDrZdcax4At/452cAg==", + "dev": true + }, + "stylelint": { + "version": "14.16.1", + "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-14.16.1.tgz", + "integrity": "sha512-ErlzR/T3hhbV+a925/gbfc3f3Fep9/bnspMiJPorfGEmcBbXdS+oo6LrVtoUZ/w9fqD6o6k7PtUlCOsCRdjX/A==", + "dev": true, + "requires": { + "@csstools/selector-specificity": "^2.0.2", + "balanced-match": "^2.0.0", + "colord": "^2.9.3", + "cosmiconfig": "^7.1.0", + "css-functions-list": "^3.1.0", + "debug": "^4.3.4", + "fast-glob": "^3.2.12", + "fastest-levenshtein": "^1.0.16", + "file-entry-cache": "^6.0.1", + "global-modules": "^2.0.0", + "globby": "^11.1.0", + "globjoin": "^0.1.4", + "html-tags": "^3.2.0", + "ignore": "^5.2.1", + "import-lazy": "^4.0.0", + "imurmurhash": "^0.1.4", + "is-plain-object": "^5.0.0", + "known-css-properties": "^0.26.0", + "mathml-tag-names": "^2.1.3", + "meow": "^9.0.0", + "micromatch": "^4.0.5", + "normalize-path": "^3.0.0", + "picocolors": "^1.0.0", + "postcss": "^8.4.19", + "postcss-media-query-parser": "^0.2.3", + "postcss-resolve-nested-selector": "^0.1.1", + "postcss-safe-parser": "^6.0.0", + "postcss-selector-parser": "^6.0.11", + "postcss-value-parser": "^4.2.0", + "resolve-from": "^5.0.0", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1", + "style-search": "^0.1.0", + "supports-hyperlinks": "^2.3.0", + "svg-tags": "^1.0.0", + "table": "^6.8.1", + "v8-compile-cache": "^2.3.0", + "write-file-atomic": "^4.0.2" + }, + "dependencies": { + "balanced-match": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-2.0.0.tgz", + "integrity": "sha512-1ugUSr8BHXRnK23KfuYS+gVMC3LB8QGH9W1iGtDPsNWoQbgtXSExkBu2aDR4epiGWZOjZsj6lDl/N/AqqTC3UA==", + "dev": true + }, + "resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true + } + } + }, + "stylelint-config-html": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/stylelint-config-html/-/stylelint-config-html-1.1.0.tgz", + "integrity": "sha512-IZv4IVESjKLumUGi+HWeb7skgO6/g4VMuAYrJdlqQFndgbj6WJAXPhaysvBiXefX79upBdQVumgYcdd17gCpjQ==", + "dev": true, + "requires": {} + }, + "stylelint-config-recommended": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/stylelint-config-recommended/-/stylelint-config-recommended-9.0.0.tgz", + "integrity": "sha512-9YQSrJq4NvvRuTbzDsWX3rrFOzOlYBmZP+o513BJN/yfEmGSr0AxdvrWs0P/ilSpVV/wisamAHu5XSk8Rcf4CQ==", + "dev": true, + "requires": {} + }, + "stylelint-config-recommended-scss": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/stylelint-config-recommended-scss/-/stylelint-config-recommended-scss-8.0.0.tgz", + "integrity": "sha512-BxjxEzRaZoQb7Iinc3p92GS6zRdRAkIuEu2ZFLTxJK2e1AIcCb5B5MXY9KOXdGTnYFZ+KKx6R4Fv9zU6CtMYPQ==", + "dev": true, + "requires": { + "postcss-scss": "^4.0.2", + "stylelint-config-recommended": "^9.0.0", + "stylelint-scss": "^4.0.0" + } + }, + "stylelint-config-recommended-vue": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/stylelint-config-recommended-vue/-/stylelint-config-recommended-vue-1.4.0.tgz", + "integrity": "sha512-DVJqyX2KvMCn9U0+keL12r7xlsH26K4Vg8NrIZuq5MoF7g82DpMp326Om4E0Q+Il1o+bTHuUyejf2XAI0iD04Q==", + "dev": true, + "requires": { + "semver": "^7.3.5", + "stylelint-config-html": ">=1.0.0", + "stylelint-config-recommended": ">=6.0.0" + } + }, + "stylelint-config-standard": { + "version": "29.0.0", + "resolved": "https://registry.npmjs.org/stylelint-config-standard/-/stylelint-config-standard-29.0.0.tgz", + "integrity": "sha512-uy8tZLbfq6ZrXy4JKu3W+7lYLgRQBxYTUUB88vPgQ+ZzAxdrvcaSUW9hOMNLYBnwH+9Kkj19M2DHdZ4gKwI7tg==", + "dev": true, + "requires": { + "stylelint-config-recommended": "^9.0.0" + } + }, + "stylelint-config-standard-scss": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/stylelint-config-standard-scss/-/stylelint-config-standard-scss-6.1.0.tgz", + "integrity": "sha512-iZ2B5kQT2G3rUzx+437cEpdcnFOQkwnwqXuY8Z0QUwIHQVE8mnYChGAquyKFUKZRZ0pRnrciARlPaR1RBtPb0Q==", + "dev": true, + "requires": { + "stylelint-config-recommended-scss": "^8.0.0", + "stylelint-config-standard": "^29.0.0" + } + }, + "stylelint-scss": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/stylelint-scss/-/stylelint-scss-4.3.0.tgz", + "integrity": "sha512-GvSaKCA3tipzZHoz+nNO7S02ZqOsdBzMiCx9poSmLlb3tdJlGddEX/8QzCOD8O7GQan9bjsvLMsO5xiw6IhhIQ==", + "dev": true, + "requires": { + "lodash": "^4.17.21", + "postcss-media-query-parser": "^0.2.3", + "postcss-resolve-nested-selector": "^0.1.1", + "postcss-selector-parser": "^6.0.6", + "postcss-value-parser": "^4.1.0" + } + }, + "supercluster": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/supercluster/-/supercluster-7.1.5.tgz", + "integrity": "sha512-EulshI3pGUM66o6ZdH3ReiFcvHpM3vAigyK+vcxdjpJyEbIIrtbmBdY23mGgnI24uXiGFvrGq9Gkum/8U7vJWg==", + "requires": { + "kdbush": "^3.0.0" + } + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "supports-hyperlinks": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-2.3.0.tgz", + "integrity": "sha512-RpsAZlpWcDwOPQA22aCH4J0t7L8JmAvsCxfOSEwm7cQs3LshN36QaTkwd70DnBOXDWGssw2eUoc8CaRWT0XunA==", + "dev": true, + "requires": { + "has-flag": "^4.0.0", + "supports-color": "^7.0.0" + } + }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true + }, + "svg-tags": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/svg-tags/-/svg-tags-1.0.0.tgz", + "integrity": "sha512-ovssysQTa+luh7A5Weu3Rta6FJlFBBbInjOh722LIt6klpU2/HtdUbszju/G4devcvk8PGt7FCLv5wftu3THUA==", + "dev": true + }, + "table": { + "version": "6.8.1", + "resolved": "https://registry.npmjs.org/table/-/table-6.8.1.tgz", + "integrity": "sha512-Y4X9zqrCftUhMeH2EptSSERdVKt/nEdijTOacGD/97EKjhQ/Qs8RTlEGABSJNNN8lac9kheH+af7yAkEWlgneA==", + "dev": true, + "requires": { + "ajv": "^8.0.1", + "lodash.truncate": "^4.4.2", + "slice-ansi": "^4.0.0", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1" + }, + "dependencies": { + "ajv": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + } + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true + }, + "tinyqueue": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/tinyqueue/-/tinyqueue-2.0.3.tgz", + "integrity": "sha512-ppJZNDuKGgxzkHihX8v9v9G5f+18gzaTfrukGrq6ueg0lmH4nqVnA2IPG0AEH3jKEk2GRJCUhDoqpoiw3PHLBA==" + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "trim-newlines": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz", + "integrity": "sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==", + "dev": true + }, + "tsconfck": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/tsconfck/-/tsconfck-2.0.1.tgz", + "integrity": "sha512-/ipap2eecmVBmBlsQLBRbUmUNFwNJV/z2E+X0FPtHNjPwroMZQ7m39RMaCywlCulBheYXgMdUlWDd9rzxwMA0Q==", + "dev": true, + "requires": {} + }, + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, + "tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + }, + "type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1" + } + }, + "type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true + }, + "typescript": { + "version": "4.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.3.tgz", + "integrity": "sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA==", + "dev": true + }, + "uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true + }, + "v8-compile-cache": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", + "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", + "dev": true + }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "vite": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/vite/-/vite-3.2.4.tgz", + "integrity": "sha512-Z2X6SRAffOUYTa+sLy3NQ7nlHFU100xwanq1WDwqaiFiCe+25zdxP1TfCS5ojPV2oDDcXudHIoPnI1Z/66B7Yw==", + "dev": true, + "requires": { + "esbuild": "^0.15.9", + "fsevents": "~2.3.2", + "postcss": "^8.4.18", + "resolve": "^1.22.1", + "rollup": "^2.79.1" + } + }, + "vite-tsconfig-paths": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/vite-tsconfig-paths/-/vite-tsconfig-paths-4.0.3.tgz", + "integrity": "sha512-gRO2Q/tOkV+9kMht5tz90+IaEKvW2zCnvwJV3tp2ruPNZOTM5rF+yXorJT4ggmAMYEaJ3nyXjx5P5jY5FwiZ+A==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "globrex": "^0.1.2", + "tsconfck": "^2.0.1" + } + }, + "vt-pbf": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/vt-pbf/-/vt-pbf-3.1.3.tgz", + "integrity": "sha512-2LzDFzt0mZKZ9IpVF2r69G9bXaP2Q2sArJCmcCgvfTdCCZzSyz4aCLoQyUilu37Ll56tCblIZrXFIjNUpGIlmA==", + "requires": { + "@mapbox/point-geometry": "0.1.0", + "@mapbox/vector-tile": "^1.3.1", + "pbf": "^3.2.1" + } + }, + "vue": { + "version": "3.2.45", + "resolved": "https://registry.npmjs.org/vue/-/vue-3.2.45.tgz", + "integrity": "sha512-9Nx/Mg2b2xWlXykmCwiTUCWHbWIj53bnkizBxKai1g61f2Xit700A1ljowpTIM11e3uipOeiPcSqnmBg6gyiaA==", + "requires": { + "@vue/compiler-dom": "3.2.45", + "@vue/compiler-sfc": "3.2.45", + "@vue/runtime-dom": "3.2.45", + "@vue/server-renderer": "3.2.45", + "@vue/shared": "3.2.45" + } + }, + "vue-eslint-parser": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-9.1.0.tgz", + "integrity": "sha512-NGn/iQy8/Wb7RrRa4aRkokyCZfOUWk19OP5HP6JEozQFX5AoS/t+Z0ZN7FY4LlmWc4FNI922V7cvX28zctN8dQ==", + "dev": true, + "requires": { + "debug": "^4.3.4", + "eslint-scope": "^7.1.1", + "eslint-visitor-keys": "^3.3.0", + "espree": "^9.3.1", + "esquery": "^1.4.0", + "lodash": "^4.17.21", + "semver": "^7.3.6" + }, + "dependencies": { + "eslint-scope": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", + "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + } + }, + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + } + } + }, + "vue-template-compiler": { + "version": "2.7.14", + "resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.7.14.tgz", + "integrity": "sha512-zyA5Y3ArvVG0NacJDkkzJuPQDF8RFeRlzV2vLeSnhSpieO6LK2OVbdLPi5MPPs09Ii+gMO8nY4S3iKQxBxDmWQ==", + "dev": true, + "requires": { + "de-indent": "^1.0.2", + "he": "^1.2.0" + } + }, + "vue-tsc": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/vue-tsc/-/vue-tsc-1.0.9.tgz", + "integrity": "sha512-vRmHD1K6DmBymNhoHjQy/aYKTRQNLGOu2/ESasChG9Vy113K6CdP0NlhR0bzgFJfv2eFB9Ez/9L5kIciUajBxQ==", + "dev": true, + "requires": { + "@volar/vue-language-core": "1.0.9", + "@volar/vue-typescript": "1.0.9" + } + }, + "vuex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/vuex/-/vuex-4.1.0.tgz", + "integrity": "sha512-hmV6UerDrPcgbSy9ORAtNXDr9M4wlNP4pEFKye4ujJF8oqgFFuxDCdOLS3eNoRTtq5O3hoBDh9Doj1bQMYHRbQ==", + "requires": { + "@vue/devtools-api": "^6.0.0-beta.11" + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "requires": { + "isexe": "^2.0.0" + } + }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + }, + "write-file-atomic": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", + "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", + "dev": true, + "requires": { + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.7" + } + }, + "xml-name-validator": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-4.0.0.tgz", + "integrity": "sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==", + "dev": true + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "dev": true + }, + "yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "dev": true + }, + "yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true + } + } +} diff --git a/web/client/package.json b/web/client/package.json new file mode 100644 index 00000000..cb4883a7 --- /dev/null +++ b/web/client/package.json @@ -0,0 +1,38 @@ +{ + "name": "soro-s-web-client", + "version": "0.1.0", + "description": "Web client for the soro-s project of the MOTIS project group at TU Darmstadt", + "type": "module", + "author": "motis-project", + "license": "MIT", + "dependencies": { + "d3": "^7.6.1", + "golden-layout": "^2.6.0", + "maplibre-gl": "^2.4.0", + "vue": "^3.2.45", + "vuex": "^4.1.0" + }, + "devDependencies": { + "@vue/eslint-config-typescript": "^11.0.2", + "@typescript-eslint/parser": "^5.45.1", + "@vitejs/plugin-vue": "^3.2.0", + "vite-tsconfig-paths": "4.0.3", + "eslint": "^8.29.0", + "eslint-plugin-vue": "^9.8.0", + "stylelint": "^14.16.1", + "stylelint-config-recommended-vue": "^1.4.0", + "stylelint-config-standard-scss": "^6.1.0", + "typescript": "^4.9.3", + "vite": "^3.2.4", + "vue-tsc": "^1.0.9" + }, + "scripts": { + "dev": "vite", + "build": "vue-tsc && vite build", + "preview": "vite preview", + "lint:eslint": "npx eslint ./src", + "lint:eslint:fix": "npx eslint --fix ./src", + "lint:stylelint": "npx stylelint ./src", + "lint:stylelint:fix": "npx stylelint ./src --fix" + } +} diff --git a/web/client/src/App.vue b/web/client/src/App.vue new file mode 100644 index 00000000..fb9bbe77 --- /dev/null +++ b/web/client/src/App.vue @@ -0,0 +1,95 @@ + + + + + + + diff --git a/web/client/src/components/disruption-detail.vue b/web/client/src/components/disruption-detail.vue new file mode 100644 index 00000000..9ba6d4d9 --- /dev/null +++ b/web/client/src/components/disruption-detail.vue @@ -0,0 +1,86 @@ + + + + + \ No newline at end of file diff --git a/web/client/src/components/golden-layout-components/InfrastructureComponent.vue b/web/client/src/components/golden-layout-components/InfrastructureComponent.vue new file mode 100644 index 00000000..36aaffc6 --- /dev/null +++ b/web/client/src/components/golden-layout-components/InfrastructureComponent.vue @@ -0,0 +1,40 @@ + + + + + diff --git a/web/client/src/components/golden-layout-components/OrderingGraphComponent.vue b/web/client/src/components/golden-layout-components/OrderingGraphComponent.vue new file mode 100644 index 00000000..91f8f1a8 --- /dev/null +++ b/web/client/src/components/golden-layout-components/OrderingGraphComponent.vue @@ -0,0 +1,17 @@ + + + + + diff --git a/web/client/src/components/golden-layout-components/SimulationComponent.vue b/web/client/src/components/golden-layout-components/SimulationComponent.vue new file mode 100644 index 00000000..7c853604 --- /dev/null +++ b/web/client/src/components/golden-layout-components/SimulationComponent.vue @@ -0,0 +1,119 @@ + + + + + + + + + \ No newline at end of file diff --git a/web/client/src/components/soro-collapsible.vue b/web/client/src/components/soro-collapsible.vue new file mode 100644 index 00000000..89fa32e5 --- /dev/null +++ b/web/client/src/components/soro-collapsible.vue @@ -0,0 +1,108 @@ + + + + + \ No newline at end of file diff --git a/web/client/src/components/soro-overlay.vue b/web/client/src/components/soro-overlay.vue new file mode 100644 index 00000000..a394a5da --- /dev/null +++ b/web/client/src/components/soro-overlay.vue @@ -0,0 +1,315 @@ + + + + + + + \ No newline at end of file diff --git a/web/client/src/components/soro-select.vue b/web/client/src/components/soro-select.vue new file mode 100644 index 00000000..a534680e --- /dev/null +++ b/web/client/src/components/soro-select.vue @@ -0,0 +1,68 @@ + + + \ No newline at end of file diff --git a/web/client/src/components/station-detail.vue b/web/client/src/components/station-detail.vue new file mode 100644 index 00000000..c4905500 --- /dev/null +++ b/web/client/src/components/station-detail.vue @@ -0,0 +1,187 @@ + + + + + + + \ No newline at end of file diff --git a/web/client/src/golden-layout/golden-layout-adapter.vue b/web/client/src/golden-layout/golden-layout-adapter.vue new file mode 100644 index 00000000..a93f6201 --- /dev/null +++ b/web/client/src/golden-layout/golden-layout-adapter.vue @@ -0,0 +1,255 @@ + + + diff --git a/web/client/src/golden-layout/golden-layout-component.vue b/web/client/src/golden-layout/golden-layout-component.vue new file mode 100644 index 00000000..2f17ee5a --- /dev/null +++ b/web/client/src/golden-layout/golden-layout-component.vue @@ -0,0 +1,57 @@ + + + diff --git a/web/client/src/golden-layout/golden-layout-constants.ts b/web/client/src/golden-layout/golden-layout-constants.ts new file mode 100644 index 00000000..cb444221 --- /dev/null +++ b/web/client/src/golden-layout/golden-layout-constants.ts @@ -0,0 +1,20 @@ +export enum ComponentTechnicalName { + INFRASTRUCTURE, + SIMULATION, + TIMETABLE, + ORDERING_GRAPH, +} + +export const GLComponentNames = { + [ComponentTechnicalName.INFRASTRUCTURE]: 'InfrastructureComponent', + [ComponentTechnicalName.SIMULATION]: 'SimulationComponent', + [ComponentTechnicalName.TIMETABLE]: 'TimetableComponent', + [ComponentTechnicalName.ORDERING_GRAPH]: 'OrderingGraphComponent', +}; + +export const GLComponentTitles = { + [ComponentTechnicalName.INFRASTRUCTURE]: 'Infrastructure', + [ComponentTechnicalName.SIMULATION]: 'Simulation', + [ComponentTechnicalName.TIMETABLE]: 'Timetable', + [ComponentTechnicalName.ORDERING_GRAPH]: 'Ordering Graph', +}; \ No newline at end of file diff --git a/web/client/src/main.ts b/web/client/src/main.ts new file mode 100644 index 00000000..550cd403 --- /dev/null +++ b/web/client/src/main.ts @@ -0,0 +1,16 @@ +import { createApp } from 'vue'; +import './style.ts'; +import App from './App.vue'; +import { InfrastructureStore, InfrastructureNamespace } from '@/stores/infrastructure-store'; +import { TimetableStore, TimetableNamespace } from '@/stores/timetable-store'; +import { createStore } from 'vuex'; + +const store = createStore({ + modules: { + [InfrastructureNamespace]: InfrastructureStore, + [TimetableNamespace]: TimetableStore, + } +}); +const app = createApp(App); +app.use(store); +app.mount('#app'); diff --git a/web/client/src/stores/infrastructure-store.ts b/web/client/src/stores/infrastructure-store.ts new file mode 100644 index 00000000..172c0dfe --- /dev/null +++ b/web/client/src/stores/infrastructure-store.ts @@ -0,0 +1,62 @@ +import { Module } from 'vuex'; + +type InfrastructureState = { + infrastructures: string[], + currentInfrastructure?: string, + highlightedSignalStationRouteID?: string, + highlightedStationRouteID?: string, +} + +type InfrastructureFetchResponse = { dirs: string[] } + +export const InfrastructureNamespace = 'infrastructure'; + +export const InfrastructureStore: Module = { + namespaced: true, + + state() { + return { + infrastructures: [], + currentInfrastructure: undefined, + highlightedSignalStationRouteID: undefined, + highlightedStationRouteID: undefined, + }; + }, + + mutations: { + setInfrastructures(state, infrastructures) { + state.infrastructures = infrastructures; + }, + + setCurrentInfrastructure(state, currentInfrastructure) { + state.currentInfrastructure = currentInfrastructure; + }, + + setHighlightedSignalStationRouteID(state, highlightedSignalStationRouteID) { + state.highlightedSignalStationRouteID = highlightedSignalStationRouteID; + }, + + setHighlightedStationRouteID(state, highlightedStationRouteID) { + state.highlightedStationRouteID = highlightedStationRouteID; + }, + }, + + actions: { + initialLoad({ commit }) { + fetch(window.origin + '/infrastructure/') + .then(response => response.json()) + .then((dir: InfrastructureFetchResponse) => { + commit('setInfrastructures', dir.dirs.filter((option: string) => option !== '.' && option !== '..')); + }); + }, + + load({ commit }, infrastructureFilename) { + console.log('Switching to infrastructure to', infrastructureFilename); + commit('setCurrentInfrastructure', infrastructureFilename); + }, + + unload({ commit }) { + commit('setCurrentInfrastructure', null); + }, + }, +}; \ No newline at end of file diff --git a/web/client/src/stores/timetable-store.ts b/web/client/src/stores/timetable-store.ts new file mode 100644 index 00000000..26a6f62a --- /dev/null +++ b/web/client/src/stores/timetable-store.ts @@ -0,0 +1,103 @@ +// @ts-nocheck as this store was (and is) unfinished + +// import { +// exists, +// saveToPersistent, +// saveFileToIDBFS, +// timetableFileExists +// } from "../utl/IDBFSHelper.js"; +import { InfrastructureNamespace } from '@/stores/infrastructure-store'; +import type { Module } from 'vuex'; + +// import { Module } from "../soro-client.js"; + +function loadTimetableFromIDBFS(filePath, currentInfrastructure) { + /* Loading from cache is very slow atm, so disabled + const cachePath = new Module.FilesystemPath('/idbfs/cache/' + infrastructureFilename); + if (exists(cachePath.string())) { + this._current = new Module.Infrastructure(cachePath, true); + } else { + */ + + const timetableOpts = new Module.TimetableOptions(); + timetableOpts.timetable_path = new Module.FilesystemPath(filePath); + + try { + return new Module.Timetable(timetableOpts, currentInfrastructure); + } catch (e) { + console.error(e); + } + + /* try { + this._current.save(cachePath); + saveToPersistent(); + } catch (e) { + console.error("Could not write serialized cache, maybe compiled without SERIALIZE?"); + console.error(e); + } + } + */ +} + +type TimetableState = { + timetables: string[], + currentTimetable?: string, +} + +export const TimetableNamespace = 'timetable'; + +export const TimetableStore: Module = { + namespaced: true, + + state() { + return { + timetables: [], + currentTimetable: undefined, + }; + }, + + mutations: { + setTimetables(state, timetables) { + state.timetables = timetables; + }, + + setCurrentTimetable(state, currentTimetable) { + state.currentTimetable = currentTimetable; + }, + }, + + actions: { + initialLoad({ commit }) { + fetch(window.origin + '/timetable/') + .then(response => response.json()) + .then(dir => { + commit('setTimetables', dir.dirs); + }); + }, + + load({ rootState }, timetableFilename) { + const currentInfrastructure = rootState[`${InfrastructureNamespace}/currentInfrastructure`]; + if (!currentInfrastructure) { + console.error('Tried loading a timetable with the currentInfrastructure undefined!'); + return; + } + + const timetablePath = timetableFileExists(timetableFilename); + if (timetablePath) { + console.log('Reading', timetablePath, 'from IDBFS.'); + this._current = loadTimetableFromIDBFS(timetablePath, currentInfrastructure); + } else { + console.log('Fetching', timetableFilename, 'from server.'); + fetch(window.origin + '/timetable/' + timetableFilename) + .then(response => response.arrayBuffer()) + .then(buf => saveFileToIDBFS(timetableFilename, buf)) + .then(filePath => this._current = loadTimetableFromIDBFS(filePath, currentInfrastructure)) + .catch(e => console.error(e)); + } + }, + + unload({ commit }) { + commit('setCurrentTimetable', null); + }, + }, +}; \ No newline at end of file diff --git a/web/client/src/style.ts b/web/client/src/style.ts new file mode 100644 index 00000000..9c00c658 --- /dev/null +++ b/web/client/src/style.ts @@ -0,0 +1,6 @@ +import '../deps/GoldenLayout/css/goldenlayout-base.css'; +import '../deps/GoldenLayout/css/themes/goldenlayout-mdl-theme.css'; +import './style/matter.css'; +import './style/material-select.css'; +import './style/material-icons.css'; +import './style/style.css'; \ No newline at end of file diff --git a/web/client/style/material-icons.css b/web/client/src/style/material-icons.css similarity index 97% rename from web/client/style/material-icons.css rename to web/client/src/style/material-icons.css index c1d4278c..ceb3c02c 100644 --- a/web/client/style/material-icons.css +++ b/web/client/src/style/material-icons.css @@ -1,3 +1,5 @@ +/* stylelint-disable */ + @font-face { font-family: 'Material Icons'; font-style: normal; diff --git a/web/client/style/material-select.css b/web/client/src/style/material-select.css similarity index 99% rename from web/client/style/material-select.css rename to web/client/src/style/material-select.css index a9599761..80c3a7d9 100644 --- a/web/client/style/material-select.css +++ b/web/client/src/style/material-select.css @@ -1,3 +1,4 @@ +/* stylelint-disable */ :root { --select-width: 350px; } diff --git a/web/client/style/matter.css b/web/client/src/style/matter.css similarity index 99% rename from web/client/style/matter.css rename to web/client/src/style/matter.css index 4fc22590..ca8a302a 100644 --- a/web/client/style/matter.css +++ b/web/client/src/style/matter.css @@ -1,3 +1,4 @@ +/* stylelint-disable */ /* Matter 0.2.2 */ /* Components */ diff --git a/web/client/src/style/style.css b/web/client/src/style/style.css new file mode 100644 index 00000000..a188a679 --- /dev/null +++ b/web/client/src/style/style.css @@ -0,0 +1,36 @@ +#app { + height: 100%; + font-family: Avenir, Helvetica, Arial, sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +html { + height: 100%; +} + +body { + height: 100%; + margin: 0; + overflow: hidden; +} + +:root { + --overlay-width: 450px; + --overlay-padding-left: 20px; + --overlay-padding-top: 50px; + --border-radius: 3px; + --border-width: 2px; + --main-font-family: "Roboto", "Helvetica", "Arial", sans-serif; + --text-color: rgb(0 0 0 / 87%); + --secondary-text-color: rgb(0 0 0 / 54%); + --hint-text-color: rgb(0 0 0 / 38%); + --border-color: rgb(0 0 0 / 12%); + --icon-color: rgb(0 0 0 / 38%); + --highlight-color: rgb(33 150 243); + --background-color: #e0e0e0; + --overlay-color: #f5f5f5; + --element-color: #fafafa; + --dialog-color: #fff; + --data-select-width: 250px; +} diff --git a/web/client/utl/IDBFSHelper.js b/web/client/src/util/IDBFSHelper.js similarity index 99% rename from web/client/utl/IDBFSHelper.js rename to web/client/src/util/IDBFSHelper.js index 86e07d8e..2d002b5d 100644 --- a/web/client/utl/IDBFSHelper.js +++ b/web/client/src/util/IDBFSHelper.js @@ -143,4 +143,3 @@ // // saveToPersistent(); // } - diff --git a/web/client/src/util/Tooltip.js b/web/client/src/util/Tooltip.js new file mode 100644 index 00000000..ee8d1b84 --- /dev/null +++ b/web/client/src/util/Tooltip.js @@ -0,0 +1,115 @@ +/* eslint-disable */ +import { select } from 'd3'; + +function makeIntoPermanent(mouseTooltip) { + // on rightclick dismiss permanent tooltip + const rightclick = event => { + event.preventDefault(); + mouseTooltip.remove(); + }; + + // make the permanent tooltip draggable + const mousedown = event => { + event.preventDefault(); + + // when the mouse is released stop dragging the element + document.onmouseup = () => { + document.onmouseup = undefined; + document.onmousemove = undefined; + }; + + // update the position on mouse movement + let deltaX = 0, deltaY = 0, tmpX = event.clientX, tmpY = event.clientY; + document.onmousemove = event => { + event.preventDefault(); + + deltaX = tmpX - event.clientX; + deltaY = tmpY - event.clientY; + tmpX = event.clientX; + tmpY = event.clientY; + + mouseTooltip + .style('left', (mouseTooltip.node().offsetLeft - deltaX) + 'px') + .style('top', (mouseTooltip.node().offsetTop - deltaY) + 'px'); + }; + }; + + mouseTooltip + .on('mouseout', undefined) // make tooltip permanent + .on('contextmenu', rightclick) + .on('mousedown', mousedown); +} + +class Tooltip { + constructor(tooltipDiv) { + this._mouse_tooltip = select(tooltipDiv).style('position', 'absolute'); + } + + setHTMLContent(content) { + this._mouse_tooltip.html(content); + } + + show(x, y) { + this._mouse_tooltip.style('display', 'inline') + .style('left', x + 'px') + .style('top', y + 'px'); + } + + hide() { + this._mouse_tooltip.style('display', 'none'); + } + + select(selectString) { + return this._mouse_tooltip.select(selectString); + } + + _mouse_tooltip = undefined; +} + +export class ClickTooltip extends Tooltip { + constructor(tooltipDiv) { + super(tooltipDiv); + } + + click(event, getX, getY) { + super.show(getX(event), getY(event)); + + const permanentTooltip = this._mouse_tooltip.clone(true); + makeIntoPermanent(permanentTooltip); + super.hide(); + } +} + +export class HoverTooltip extends Tooltip { + constructor(tooltipDiv) { + super(tooltipDiv); + } + + mouseover(X, Y) { + // super.show(event.layerX + 10, event.layerY + 10); + super.show(X, Y); + + // const simNode = event.target.__data__; + // + // this._mouse_tooltip.select('#tooltipID').text('ID: ' + simNode.ID); + // this._mouse_tooltip.select('#tooltipSSRID').text('SSR ID: ' + simNode.SSRID); + + select(e.target).style('stroke', 'black'); + } + + mousemove(event, getX, getY) { + super.show(getX(event), getY(event)); + // super.show(event.layerX + 10, event.layerY + 10); + } + + mouseout(event) { + this.hide(); + + // event.target.style.stroke = 'none'; + } + + click() { + const permanentTooltip = this._mouse_tooltip.clone(true); + makeIntoPermanent(permanentTooltip); + } +} \ No newline at end of file diff --git a/web/client/src/util/iterate.js b/web/client/src/util/iterate.js new file mode 100644 index 00000000..2c02ce5c --- /dev/null +++ b/web/client/src/util/iterate.js @@ -0,0 +1,33 @@ +export function* iterate(emscriptenList) { + for (let i = 0; i < emscriptenList.size(); i++) { + yield emscriptenList.get(i); + } +} + +function* iterateDist1D(dist1D) { + const timeGranularity = 6; + for (let i = 0; i < dist1D.dpd.size(); i++) { + yield [dist1D.first.t + i * timeGranularity, 0, dist1D.dpd.get(i)]; + } +} + +function* iterateDist2D(dist2D) { + const granularity = dist2D.get_granularity(); + const timeGranularity = granularity.first.t; + const speedGranularity = granularity.second.km_h; + + for (let i = 0; i < dist2D.dpd.size(); i++) { + const innerDPD = dist2D.dpd.get(i); + for (let j = 0; j < innerDPD.dpd.size(); j++) { + yield [dist2D.first.t + i * timeGranularity, innerDPD.first.km_h + j * speedGranularity, innerDPD.dpd.get(j)]; + } + } +} + +export function* iterateDist(dist) { + if (dist.constructor.name === 'TimeSpeedDPD') { + yield* iterateDist2D(dist); + } else { + yield* iterateDist1D(dist); + } +} \ No newline at end of file diff --git a/web/client/src/vite-env.d.ts b/web/client/src/vite-env.d.ts new file mode 100644 index 00000000..02ab5edb --- /dev/null +++ b/web/client/src/vite-env.d.ts @@ -0,0 +1,6 @@ +/* eslint-disable */ +declare module '*.vue' { + import type { DefineComponent } from 'vue'; + const component: DefineComponent<{}, {}, any>; + export default component; +} diff --git a/web/client/style/collapsible.css b/web/client/style/collapsible.css deleted file mode 100644 index 753ccf1b..00000000 --- a/web/client/style/collapsible.css +++ /dev/null @@ -1,83 +0,0 @@ -input[type=checkbox].hidden { - opacity: 0; -} - -.wrap-collapsible { - display: inline; - margin: 1.2em 0; - width: 100%; -} - -.collapsible-toggle { - display: flex; - flex-direction: row; - max-height: 50%; - font-weight: 550; - font-family: var(--main-font-family); - font-size: 16px; - text-align: left; - box-shadow: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23); - - padding: 1em; - - margin: 1em; - margin-bottom: 0; - - color: var(--text-color); - background: var(--dialog-color); - - cursor: pointer; - - border-radius: var(--border-radius); - transition: all 2.25s ease-out; -} - -.collapsible-toggle::after { - font-family: 'Material Icons'; - content: '\e5cc'; - - vertical-align: middle; - horiz-align: center; - padding-left: calc(100% - 8.5em); -} - -.collapsible-toggle:hover { - background-color: var(--element-color); -} - -.collapsible-content { - position: absolute; - width: calc(100% - 3.6em); - max-height: 0; - - margin: 1em; - margin-top: 0; - overflow-y: auto; - overflow-x: hidden; - box-shadow: 0 20px 10px rgba(0, 0, 0, 0.19), 0 8px 6px rgba(0, 0, 0, 0.23); -} - -.content-inner { - display: flex; - flex-direction: column; - width: 95%; - background: var(--dialog-color); - border-bottom: 1px solid var(--dialog-color); - - border-bottom-left-radius: var(--border-radius); - border-bottom-right-radius: var(--border-radius); - padding: 1em -} - -.collapsible-toggle:checked + .collapsible-toggle + .collapsible-content { - max-height: 65%; -} - -.collapsible-toggle:checked + .collapsible-toggle::after { - content: '\e5ce'; -} - -.collapsible-toggle:checked + .collapsible-toggle { - border-bottom-right-radius: 0; - border-bottom-left-radius: 0; -} \ No newline at end of file diff --git a/web/client/style/style.css b/web/client/style/style.css deleted file mode 100644 index 4d43ceeb..00000000 --- a/web/client/style/style.css +++ /dev/null @@ -1,251 +0,0 @@ -:root { - --overlay-width: 450px; - --overlay-padding-left: 20px; - --overlay-padding-top: 50px; - - --border-radius: 3px; - --border-width: 2px; - - --main-font-family: "Roboto", "Helvetica", "Arial", sans-serif; - - --text-color: rgba(0, 0, 0, 0.87); - --secondary-text-color: rgba(0, 0, 0, 0.54); - --hint-text-color: rgba(0, 0, 0, 0.38); - - --border-color: rgba(0, 0, 0, 0.12); - --icon-color: rgba(0, 0, 0, 0.38); - - --highlight-color: rgb(33, 150, 243); - - --background-color: #e0e0e0; - --overlay-color: #f5f5f5; - --element-color: #fafafa; - --dialog-color: #ffffff; - - --data-select-width: 250px; -} - -.overlay-container { - display: flex; - align-items: flex-start; - justify-content: center; - height: 100%; - padding-left: var(--overlay-padding-left); - padding-top: var(--overlay-padding-top); - padding-bottom: 20px; - position: absolute; - top: 0; - left: 0; - transition: all .4s ease; - pointer-events: none; -} - -.overlay-container.hidden { - left: calc(0px - calc(var(--overlay-width) + var(--overlay-padding-left))); -} - -.overlay { - z-index: 10; - background-color: var(--overlay-color); - box-shadow: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23); - border-radius: 3px; - border-top-right-radius: 0; - transition: all .4s ease; - width: var(--overlay-width); - flex: 0 0 auto; - order: 1; - height: 95%; - position: relative; -} - -.overlay-container.hidden .overlay { - box-shadow: unset; -} - -.overlay-content { - display: flex; - flex-direction: column; - height: 100%; - pointer-events: auto; - position: relative; -} - -.overlay-tabs { - z-index: 10; - order: 2; - pointer-events: auto; - display: flex; - flex-direction: column; -} - -.overlay-toggle-button { - box-shadow: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23); - border-bottom-left-radius: 0; - border-top-left-radius: 0; -} - -.sub-overlay { - position: absolute; - top: 0; - left: 0; - padding: 0.8em; - width: calc(100% - 1.6em); - height: calc(100% - 1.6em); - transition: all .2s ease; - pointer-events: auto; - z-index: 20; - - border-radius: var(--border-radius); -} - -.sub-overlay.hidden { - left: calc(0px - calc(var(--overlay-width) + var(--overlay-padding-left))); -} - -.sub-overlay-content { - width: 100%; - height: 100%; - display: flex; - flex-direction: column; - - border-radius: inherit; - background: var(--overlay-color); - box-shadow: 0 6px 6px rgba(0, 0, 0, 0.23), 0 -2px 6px rgba(0, 0, 0, 0.23); -} - -.sub-overlay-close { - position: absolute; - top: 18px; - right: 18px; - cursor: pointer; - color: var(--icon-color); -} - -.sub-overlay-close i { - cursor: pointer; -} - -.window-controls { - display: flex; - flex-direction: column; - flex-wrap: wrap; - width: 94%; - justify-content: space-around; - padding: 3%; - margin-top: 0.5em; - margin-bottom: 0.5em; -} - -.window-button { - width: 50%; - margin-top: 0.2em; - margin-bottom: 0.2em; -} - -.data-selects { - display: flex; - flex-direction: column; - flex-wrap: wrap; - width: 94%; - justify-content: space-around; - padding: 3%; - margin-top: 0.5em; - margin-bottom: 0.5em; -} - -.data-select { - margin-top: 2.2em; - margin-bottom: 2.2em; -} - -/* ============= Station Detail ============= */ - -.sub-overlay-tab-button { - width: 30px; - height: 40px; - margin-top: 10px; - background: var(--dialog-color); - color: var(--secondary-text-color); - box-shadow: 3px 3px 2px rgba(0, 0, 0, 0.2); - cursor: pointer; - display: flex; - align-items: center; - justify-content: center; - opacity: 1; - transition: all 0.2s ease; -} - -.sub-overlay-tab-button.enabled { - color: white; - background: var(--highlight-color); -} - -.station-detail { - margin-top: 10px; - - background: transparent; - color: #777; - width: 100%; - height: 100%; - box-shadow: 3px 3px 2px rgba(0, 0, 0, 0.2); - cursor: pointer; - display: flex; - align-items: center; - justify-content: center; - opacity: 1; - transition: all 0.2s ease; - flex-direction: column; - visibility: visible; -} - -.station-detail.hidden { - left: calc(0px - calc(var(--overlay-width) + var(--overlay-padding-left))); -} - -.station-detail-name { - font-family: var(--main-font-family); - font-weight: bold; - font-size: 20px; - justify-content: center; - align-items: center; - color: var(--text-color); - flex-direction: column; -} - -.station-detail-routes { - display: flex; - flex-direction: column; - width: 100%; - height: 90%; -} - -.station-detail-route { - width: calc(100% - 1em); - background: var(--dialog-color); - border: 0.4em solid var(--dialog-color); -} - -.station-detail-route:nth-child(even) { - background: var(--overlay-color); - border: 0.4em solid var(--overlay-color); - border-right: 0; -} - -.station-detail-signal-routes { - display: flex; - flex-direction: column; - width: 100%; - height: 90%; -} - -.station-detail-signal-route { - width: calc(100% - 1em); - background: var(--dialog-color); - border: 0.4em solid var(--dialog-color); -} - -.station-detail-signal-route:nth-child(even) { - background: var(--overlay-color); - border: 0.4em solid var(--overlay-color); - border-right: 0; -} diff --git a/web/client/tsconfig.json b/web/client/tsconfig.json new file mode 100644 index 00000000..a17d321c --- /dev/null +++ b/web/client/tsconfig.json @@ -0,0 +1,30 @@ +{ + "compilerOptions": { + "target": "ESNext", + "useDefineForClassFields": true, + "module": "ESNext", + "moduleResolution": "Node", + "strict": true, + "jsx": "preserve", + "resolveJsonModule": true, + "isolatedModules": true, + "esModuleInterop": true, + "lib": ["ESNext", "DOM"], + "skipLibCheck": true, + "noEmit": true, + "allowJs": true, + "baseUrl": ".", + "paths": { + "@/*": ["src/*"] + } + }, + "include": [ + "src/**/*.ts", + "src/**/*.d.ts", + "src/**/*.tsx", + "src/**/*.vue", + "src/**/*.js", + "./*.js" + ], + "references": [{ "path": "./tsconfig.node.json" }] +} diff --git a/web/client/tsconfig.node.json b/web/client/tsconfig.node.json new file mode 100644 index 00000000..9d31e2ae --- /dev/null +++ b/web/client/tsconfig.node.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "composite": true, + "module": "ESNext", + "moduleResolution": "Node", + "allowSyntheticDefaultImports": true + }, + "include": ["vite.config.ts"] +} diff --git a/web/client/utl/Tooltip.js b/web/client/utl/Tooltip.js deleted file mode 100644 index 105229fa..00000000 --- a/web/client/utl/Tooltip.js +++ /dev/null @@ -1,115 +0,0 @@ -import { select } from "../deps/d3/d3-selection.js"; - -function makeIntoPermanent(mouseTooltip) { - // on rightclick dismiss permanent tooltip - const rightclick = event => { - event.preventDefault(); - mouseTooltip.remove(); - } - - // make the permanent tooltip draggable - const mousedown = event => { - event.preventDefault(); - - // when the mouse is released stop dragging the element - document.onmouseup = () => { - document.onmouseup = undefined; - document.onmousemove = undefined; - } - - // update the position on mouse movement - let deltaX = 0, deltaY = 0, tmpX = event.clientX, tmpY = event.clientY; - document.onmousemove = event => { - event.preventDefault(); - - deltaX = tmpX - event.clientX; - deltaY = tmpY - event.clientY; - tmpX = event.clientX; - tmpY = event.clientY; - - mouseTooltip - .style('left', (mouseTooltip.node().offsetLeft - deltaX) + 'px') - .style('top', (mouseTooltip.node().offsetTop - deltaY) + 'px'); - } - } - - mouseTooltip - .on('mouseout', undefined) // make tooltip permanent - .on('contextmenu', rightclick) - .on('mousedown', mousedown); -} - -class Tooltip { - constructor(rootElement, tooltipDiv) { - this._mouse_tooltip = select(rootElement.querySelector('#' + tooltipDiv)) - .style('position', 'absolute'); - } - - setHTMLContent(content) { - this._mouse_tooltip.html(content); - } - - show(x, y) { - this._mouse_tooltip.style('display', 'inline') - .style('left', x + 'px') - .style('top', y + 'px') - } - - hide() { - this._mouse_tooltip.style('display', 'none'); - } - - select(selectString) { - return this._mouse_tooltip.select(selectString); - } - - _mouse_tooltip = undefined; -} - -export class ClickTooltip extends Tooltip { - constructor(rootElement, tooltipDiv) { - super(rootElement, tooltipDiv); - } - - click(event, getX, getY) { - super.show(getX(event), getY(event)); - - let permanentTooltip = this._mouse_tooltip.clone(true); - makeIntoPermanent(permanentTooltip); - super.hide(); - } -} - -export class HoverTooltip extends Tooltip { - constructor(rootElement, tooltipDiv) { - super(rootElement, tooltipDiv); - } - - mouseover(X, Y) { - // super.show(event.layerX + 10, event.layerY + 10); - super.show(X, Y); - - // const simNode = event.target.__data__; - // - // this._mouse_tooltip.select('#tooltipID').text('ID: ' + simNode.ID); - // this._mouse_tooltip.select('#tooltipSSRID').text('SSR ID: ' + simNode.SSRID); - - d3.select(e.target).style('stroke', 'black'); - } - - mousemove(event, getX, getY) { - super.show(getX(event), getY(event)); - // super.show(event.layerX + 10, event.layerY + 10); - } - - mouseout(event) { - this.hide(); - - // event.target.style.stroke = 'none'; - } - - click() { - let permanentTooltip = this._mouse_tooltip.clone(true); - makeIntoPermanent(permanentTooltip); - } -} \ No newline at end of file diff --git a/web/client/utl/getFileContents.js b/web/client/utl/getFileContents.js deleted file mode 100644 index aa197ccc..00000000 --- a/web/client/utl/getFileContents.js +++ /dev/null @@ -1,18 +0,0 @@ -export async function getFileContents(filename) { - let headers = new Headers(); - headers.append('pragma', 'no-cache'); - headers.append('cache-control', 'no-cache'); - - const settings = { - headers: headers - }; - - return fetch(filename, settings) - .then((resp) => { - return resp.text() - }) - .then((data) => { - return data - }); -} - diff --git a/web/client/utl/goldenLayoutHelper.js b/web/client/utl/goldenLayoutHelper.js deleted file mode 100644 index 1f720c36..00000000 --- a/web/client/utl/goldenLayoutHelper.js +++ /dev/null @@ -1,46 +0,0 @@ -function getComponentsFilter(filter_fun) { - return window.goldenLayout.getAllContentItems().filter(filter_fun).map(i => { - return i.component; - }); -} - -export function getComponents() { - return window.goldenLayout.getAllContentItems() - .filter(c => { - return c.isComponent && c.componentType !== 'ControlComponent'; - }) - .map(i => { - return i.component; - }); -} - -export function getInfrastructureComponents() { - return getComponentsFilter(c => { - return c.isComponent && c.componentType === 'InfrastructureComponent'; - }); -} - -export function getTimetableComponents() { - return getComponentsFilter(c => { - return c.isComponent && c.componentType === 'TimetableComponent'; - }); -} - -export function getSimulationComponent() { - return getComponentsFilter(c => { - return c.isComponent && c.componentType === 'SimulationComponent'; - }); -} - -export function getOrderingGraphComponent() { - return getComponentsFilter(c => { - return c.isComponent && c.componentType === 'OrderingGraphComponent'; - }); -} - -export function getControlComponent() { - return getComponentsFilter(c => { - return c.isComponent && c.componentType === 'ControlComponent'; - })[0]; -} - diff --git a/web/client/utl/iterate.js b/web/client/utl/iterate.js deleted file mode 100644 index 08f18552..00000000 --- a/web/client/utl/iterate.js +++ /dev/null @@ -1,33 +0,0 @@ -export function* iterate(emscriptenList) { - for (let i = 0; i < emscriptenList.size(); i++) { - yield emscriptenList.get(i); - } -} - -function* iterateDist1D(dist1D) { - const timeGranularity = 6; - for (let i = 0; i < dist1D.dpd.size(); i++) { - yield [dist1D.first.t + i * timeGranularity, 0, dist1D.dpd.get(i)]; - } -} - -function* iterateDist2D(dist2D) { - const granularity = dist2D.get_granularity(); - const timeGranularity = granularity.first.t; - const speedGranularity = granularity.second.km_h; - - for (let i = 0; i < dist2D.dpd.size(); i++) { - const innerDPD = dist2D.dpd.get(i); - for (let j = 0; j < innerDPD.dpd.size(); j++) { - yield [dist2D.first.t + i * timeGranularity, innerDPD.first.km_h + j * speedGranularity, innerDPD.dpd.get(j)]; - } - } -} - -export function* iterateDist(dist) { - if (dist.constructor.name === 'TimeSpeedDPD') { - yield* iterateDist2D(dist); - } else { - yield* iterateDist1D(dist); - } -} \ No newline at end of file diff --git a/web/client/vite.config.ts b/web/client/vite.config.ts new file mode 100644 index 00000000..c76e939f --- /dev/null +++ b/web/client/vite.config.ts @@ -0,0 +1,23 @@ +import { defineConfig } from 'vite'; +import vue from '@vitejs/plugin-vue'; +import tsconfigPaths from 'vite-tsconfig-paths'; + +const relayServer = 'http://0.0.0.0:8080'; +const relayLocations = [ + '/infrastructure', + '/timetable', + '/font', + '/icons', + '/interlocking_route_simple', + '/small', +]; + +const proxy = {}; +relayLocations.forEach((location) => proxy[location] = { + target: relayServer, + changeOrigin: true, +}); +export default defineConfig({ + plugins: [vue(), tsconfigPaths()], + server: { proxy }, +});