@webquark/core 1.1.0-dev.7 → 1.1.0-dev.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -138
- package/dist/browser/components/index.d.ts +1 -0
- package/dist/browser/components/index.js +1 -0
- package/dist/browser/components/q-accordion.d.ts +1 -0
- package/dist/browser/components/q-accordion.js +1 -0
- package/dist/browser/components/q-alert.d.ts +1 -0
- package/dist/browser/components/q-alert.js +1 -0
- package/dist/browser/components/q-avatar.d.ts +1 -0
- package/dist/browser/components/q-avatar.js +1 -0
- package/dist/browser/components/q-banner.d.ts +1 -0
- package/dist/browser/components/q-banner.js +1 -0
- package/dist/browser/components/q-button.d.ts +1 -0
- package/dist/browser/components/q-button.js +1 -0
- package/dist/browser/components/q-card.d.ts +1 -0
- package/dist/browser/components/q-card.js +1 -0
- package/dist/browser/components/q-carousel.d.ts +1 -0
- package/dist/browser/components/q-carousel.js +1 -0
- package/dist/browser/components/q-chip.d.ts +1 -0
- package/dist/browser/components/q-chip.js +1 -0
- package/dist/browser/components/q-conversation-bubble.d.ts +1 -0
- package/dist/browser/components/q-conversation-bubble.js +1 -0
- package/dist/browser/components/q-data-table.d.ts +1 -0
- package/dist/browser/components/q-data-table.js +1 -0
- package/dist/browser/components/q-dialog.d.ts +1 -0
- package/dist/browser/components/q-dialog.js +1 -0
- package/dist/browser/components/q-dropdown.d.ts +1 -0
- package/dist/browser/components/q-dropdown.js +1 -0
- package/dist/browser/components/q-form.d.ts +1 -0
- package/dist/browser/components/q-form.js +1 -0
- package/dist/browser/components/q-grid.d.ts +1 -0
- package/dist/browser/components/q-grid.js +1 -0
- package/dist/browser/components/q-icon.d.ts +1 -0
- package/dist/browser/components/q-icon.js +1 -0
- package/dist/browser/components/q-image-comparison.d.ts +1 -0
- package/dist/browser/components/q-image-comparison.js +1 -0
- package/dist/browser/components/q-inline.d.ts +1 -0
- package/dist/browser/components/q-inline.js +1 -0
- package/dist/browser/components/q-input.d.ts +1 -0
- package/dist/browser/components/q-input.js +1 -0
- package/dist/browser/components/q-link.d.ts +1 -0
- package/dist/browser/components/q-link.js +1 -0
- package/dist/browser/components/q-map.d.ts +1 -0
- package/dist/browser/components/q-map.js +1 -0
- package/dist/browser/components/q-media.d.ts +1 -0
- package/dist/browser/components/q-media.js +1 -0
- package/dist/browser/components/q-navbar.d.ts +1 -0
- package/dist/browser/components/q-navbar.js +1 -0
- package/dist/browser/components/q-pagination.d.ts +1 -0
- package/dist/browser/components/q-pagination.js +1 -0
- package/dist/browser/components/q-panel.d.ts +1 -0
- package/dist/browser/components/q-panel.js +1 -0
- package/dist/browser/components/q-progress.d.ts +1 -0
- package/dist/browser/components/q-progress.js +1 -0
- package/dist/browser/components/q-quantity-selector.d.ts +1 -0
- package/dist/browser/components/q-quantity-selector.js +1 -0
- package/dist/browser/components/q-radio-group.d.ts +1 -0
- package/dist/browser/components/q-radio-group.js +1 -0
- package/dist/browser/components/q-reel.d.ts +1 -0
- package/dist/browser/components/q-reel.js +1 -0
- package/dist/browser/components/q-scrollable.d.ts +1 -0
- package/dist/browser/components/q-scrollable.js +1 -0
- package/dist/browser/components/q-section.d.ts +1 -0
- package/dist/browser/components/q-section.js +1 -0
- package/dist/browser/components/q-sidepanel.d.ts +1 -0
- package/dist/browser/components/q-sidepanel.js +1 -0
- package/dist/browser/components/q-stack.d.ts +1 -0
- package/dist/browser/components/q-stack.js +1 -0
- package/dist/browser/components/q-step-diagram-item.d.ts +1 -0
- package/dist/browser/components/q-step-diagram-item.js +1 -0
- package/dist/browser/components/q-step-diagram.d.ts +1 -0
- package/dist/browser/components/q-step-diagram.js +1 -0
- package/dist/browser/components/q-syntax-box.d.ts +1 -0
- package/dist/browser/components/q-syntax-box.js +1 -0
- package/dist/browser/components/q-tabs.d.ts +1 -0
- package/dist/browser/components/q-tabs.js +1 -0
- package/dist/browser/components/q-textarea.d.ts +1 -0
- package/dist/browser/components/q-textarea.js +1 -0
- package/dist/browser/components/q-thumbnail.d.ts +1 -0
- package/dist/browser/components/q-thumbnail.js +1 -0
- package/dist/browser/components/q-toast.d.ts +1 -0
- package/dist/browser/components/q-toast.js +1 -0
- package/dist/browser/components/q-toggle.d.ts +1 -0
- package/dist/browser/components/q-toggle.js +1 -0
- package/dist/browser/components/q-toolbar.d.ts +1 -0
- package/dist/browser/components/q-toolbar.js +1 -0
- package/dist/browser/components/q-tooltip.d.ts +1 -0
- package/dist/browser/components/q-tooltip.js +1 -0
- package/dist/browser/index.cjs +1 -0
- package/dist/browser/index.d.ts +1 -0
- package/dist/browser/index.js +1 -0
- package/dist/browser/loader/index.cjs +1 -0
- package/dist/browser/loader/index.d.ts +1 -0
- package/dist/browser/loader/index.js +1 -0
- package/dist/{webquark → browser}/webquark.css +1 -1
- package/dist/playground/assets/comparison-after.svg +1 -0
- package/dist/playground/assets/comparison-before.svg +1 -0
- package/dist/playground/assets/icons/check-preview.png +0 -0
- package/dist/playground/assets/icons/spinner.svg +1 -1
- package/dist/playground/build/index.esm.js +1 -1
- package/dist/{webquark/p-781d3459.entry.js → playground/build/p-023f8437.entry.js} +1 -1
- package/dist/playground/build/{p-ca240b8b.entry.js → p-030ecde3.entry.js} +1 -1
- package/dist/playground/build/p-04c8cb9e.entry.js +1 -0
- package/dist/{webquark/p-81f64d6f.entry.js → playground/build/p-059daa8a.entry.js} +1 -1
- package/dist/playground/build/{p-964d27e0.entry.js → p-09cca7b9.entry.js} +1 -1
- package/dist/playground/build/p-0aa74ad6.entry.js +1 -0
- package/dist/playground/build/p-0ae43d6c.entry.js +1 -0
- package/dist/playground/build/p-0c3aac3f.entry.js +1 -0
- package/dist/playground/build/p-144ef339.entry.js +1 -0
- package/dist/playground/build/p-296fbdb1.entry.js +1 -0
- package/dist/playground/build/p-36118d90.entry.js +1 -0
- package/dist/{webquark/p-82810ead.entry.js → playground/build/p-3bc4629c.entry.js} +1 -1
- package/dist/playground/build/{p-25c3b776.entry.js → p-48fb5228.entry.js} +1 -1
- package/dist/playground/build/{p-b4dfadea.entry.js → p-4d61b70d.entry.js} +1 -1
- package/dist/playground/build/p-5f232b44.entry.js +13 -0
- package/dist/playground/build/{p-b9e83fa3.entry.js → p-64096386.entry.js} +1 -1
- package/dist/{webquark/p-e6603d17.entry.js → playground/build/p-6bfffa79.entry.js} +1 -1
- package/dist/{webquark/p-fed7219c.entry.js → playground/build/p-6e28cfe2.entry.js} +1 -1
- package/dist/playground/build/{p-e1c8a9aa.entry.js → p-70d9ffde.entry.js} +1 -1
- package/dist/playground/build/p-888e46a8.entry.js +1 -0
- package/dist/{webquark/p-d0c55860.entry.js → playground/build/p-8ece2c62.entry.js} +1 -1
- package/dist/playground/build/p-90b0858c.entry.js +1 -0
- package/dist/playground/build/p-91fff6b6.entry.js +1 -0
- package/dist/playground/build/p-923dac41.entry.js +1 -0
- package/dist/playground/build/p-97a89cae.entry.js +1 -0
- package/dist/playground/build/{p-362c5608.entry.js → p-99d785ca.entry.js} +1 -1
- package/dist/{webquark/p-5453eac7.entry.js → playground/build/p-9e78b796.entry.js} +1 -1
- package/dist/playground/build/{p-b08d0ed8.entry.js → p-9ff7e5a4.entry.js} +1 -1
- package/dist/{components/p-CyPFM3XV.js → playground/build/p-B4Mg1xEw.js} +1 -1
- package/dist/playground/build/p-B5ElFlHv.js +3 -0
- package/dist/playground/build/p-BOdNg0jc.js +1 -0
- package/dist/playground/build/p-BcL0NVv0.js +1 -0
- package/dist/playground/build/p-CGml_DQ8.js +1 -0
- package/dist/playground/build/p-C_RztzNv.js +5 -0
- package/dist/playground/build/p-CoIMrUb3.js +1 -0
- package/dist/playground/build/p-CpI3m4_T.js +1 -0
- package/dist/{components/p-g9vOVxQ4.js → playground/build/p-DKrPmn2y.js} +2 -2
- package/dist/playground/build/p-DWO-pleQ.js +1 -0
- package/dist/{components/p-COMoSatC.js → playground/build/p-Dhsn99q4.js} +1 -1
- package/dist/playground/build/p-DstNl_WY.js +1 -0
- package/dist/playground/build/p-SzKf4WZF.js +1 -0
- package/dist/playground/build/p-c523ec6f.entry.js +1 -0
- package/dist/playground/build/p-c923c9c0.js +1 -0
- package/dist/playground/build/p-d0253d64.entry.js +1 -0
- package/dist/playground/build/p-d0fbd2b1.entry.js +1 -0
- package/dist/playground/build/{p-9b4271ea.entry.js → p-dd115868.entry.js} +1 -1
- package/dist/playground/build/p-e0bb74ae.css +1 -0
- package/dist/{webquark/p-5eeb922e.entry.js → playground/build/p-f1bac94c.entry.js} +1 -1
- package/dist/playground/build/{p-17011e71.entry.js → p-f4f97e74.entry.js} +1 -1
- package/dist/playground/build/p-f63b7214.entry.js +1 -0
- package/dist/{webquark/p-9227780b.entry.js → playground/build/p-f98f9439.entry.js} +1 -1
- package/dist/playground/build/{p-ae4e5ec4.entry.js → p-f9ad63ff.entry.js} +1 -1
- package/dist/playground/build/p-fe200f68.entry.js +1 -0
- package/dist/playground/build/p-fe8c634a.entry.js +13 -0
- package/dist/playground/build/{p-151a555e.entry.js → p-fec6fe0a.entry.js} +1 -1
- package/dist/playground/build/webquark.css +1 -1
- package/dist/playground/build/webquark.esm.js +1 -1
- package/dist/playground/index.html +1 -29
- package/dist/playground/playground/components.manifest.json +1 -0
- package/dist/playground/playground/specs/q-carousel.sandbox.json +15 -0
- package/dist/playground/playground/specs/q-data-table.sandbox.json +24 -0
- package/dist/playground/playground/specs/q-icon.sandbox.json +17 -1
- package/dist/playground/playground/specs/q-image-comparison.sandbox.json +24 -0
- package/dist/playground/playground/specs/q-syntax-box.sandbox.json +68 -24
- package/dist/playground/playground.js +26 -9
- package/dist/playground/views/tooling/adoption/CHANGELOG.md +13 -0
- package/dist/playground/views/tooling/adoption/README.md +47 -0
- package/dist/playground/views/tooling/adoption/changelog.config.ts +12 -0
- package/dist/playground/views/tooling/adoption/docs/changelog/unreleased/README.md +3 -0
- package/dist/playground/views/tooling/adoption/docs/changelog/unreleased/images/release-panel.svg +7 -0
- package/dist/playground/views/tooling/adoption/docs/changelog/unreleased/visuals.json +16 -0
- package/dist/playground/views/tooling/adoption/docs/changelog/v0.1.0/README.md +3 -0
- package/dist/playground/views/tooling/adoption/generate.ts +13 -0
- package/dist/playground/views/tooling/adoption/package.json +10 -0
- package/dist/playground/views/tooling/adoption/serve.ts +24 -0
- package/dist/playground/views/tooling/adoption/viewer.html +16 -0
- package/dist/playground/views/tooling/adoption/viewer.js +54 -0
- package/dist/playground/views/tooling/sample-feed.json +13 -0
- package/dist/playground/views/tooling/sample-notes.md +14 -0
- package/dist/playground/views/tooling/tooling.html +69 -0
- package/dist/tooling/changelog/index.d.ts +1 -0
- package/dist/tooling/changelog/index.js +1 -0
- package/package.json +54 -163
- package/scripts/package.json +1 -0
- package/scripts/webquark-serve.js +12 -8
- package/scripts/wq-changelog.js +4 -0
- package/scripts/wq-switch/README.md +133 -109
- package/scripts/wq-switch/dist/index.js +773 -138
- package/scripts/wq-switch/dist/setup.js +636 -90
- package/dist/cjs/Leaflet.GoogleMutant-i4bYl6qy.js +0 -768
- package/dist/cjs/action.props-B87W5tRu.js +0 -35
- package/dist/cjs/chevron-up-Dysp_9UJ.js +0 -30
- package/dist/cjs/collection-identity-CV5HLD9Z.js +0 -141
- package/dist/cjs/data-table-cell-BAv6IIYx.js +0 -46
- package/dist/cjs/dom-Dk77oFF6.js +0 -247
- package/dist/cjs/field-CbUc_AWx.js +0 -14
- package/dist/cjs/form-control-validity-D1ukC0_e.js +0 -49
- package/dist/cjs/index-D_tObBJa.js +0 -1870
- package/dist/cjs/index.cjs.js +0 -29
- package/dist/cjs/leaflet-maplibre-gl-BJKExsns.js +0 -1031
- package/dist/cjs/leaflet-src-mrRg-Srs.js +0 -14551
- package/dist/cjs/loader.cjs.js +0 -12
- package/dist/cjs/map.types-DNrz8rJh.js +0 -24
- package/dist/cjs/q-accordion.cjs.entry.js +0 -18
- package/dist/cjs/q-alert.cjs.entry.js +0 -52
- package/dist/cjs/q-avatar.cjs.entry.js +0 -101
- package/dist/cjs/q-banner.cjs.entry.js +0 -19
- package/dist/cjs/q-button_2.cjs.entry.js +0 -375
- package/dist/cjs/q-card.cjs.entry.js +0 -88
- package/dist/cjs/q-carousel.cjs.entry.js +0 -331
- package/dist/cjs/q-chip.cjs.entry.js +0 -124
- package/dist/cjs/q-conversation-bubble.cjs.entry.js +0 -70
- package/dist/cjs/q-data-table.cjs.entry.js +0 -549
- package/dist/cjs/q-dialog.cjs.entry.js +0 -271
- package/dist/cjs/q-dropdown.cjs.entry.js +0 -646
- package/dist/cjs/q-form.cjs.entry.js +0 -515
- package/dist/cjs/q-grid.cjs.entry.js +0 -24
- package/dist/cjs/q-icon.cjs.entry.js +0 -385
- package/dist/cjs/q-inline.cjs.entry.js +0 -22
- package/dist/cjs/q-input_2.cjs.entry.js +0 -370
- package/dist/cjs/q-link.cjs.entry.js +0 -80
- package/dist/cjs/q-map.cjs.entry.js +0 -3412
- package/dist/cjs/q-media.cjs.entry.js +0 -21
- package/dist/cjs/q-navbar.cjs.entry.js +0 -415
- package/dist/cjs/q-pagination.cjs.entry.js +0 -68
- package/dist/cjs/q-panel.cjs.entry.js +0 -76
- package/dist/cjs/q-quantity-selector.cjs.entry.js +0 -204
- package/dist/cjs/q-radio-group.cjs.entry.js +0 -224
- package/dist/cjs/q-reel.cjs.entry.js +0 -170
- package/dist/cjs/q-scrollable.cjs.entry.js +0 -449
- package/dist/cjs/q-section.cjs.entry.js +0 -20
- package/dist/cjs/q-sidepanel.cjs.entry.js +0 -673
- package/dist/cjs/q-stack.cjs.entry.js +0 -20
- package/dist/cjs/q-step-diagram-item.cjs.entry.js +0 -45
- package/dist/cjs/q-step-diagram.cjs.entry.js +0 -56
- package/dist/cjs/q-syntax-box.cjs.entry.js +0 -665
- package/dist/cjs/q-tabs.cjs.entry.js +0 -155
- package/dist/cjs/q-textarea.cjs.entry.js +0 -250
- package/dist/cjs/q-thumbnail.cjs.entry.js +0 -51
- package/dist/cjs/q-toast.cjs.entry.js +0 -400
- package/dist/cjs/q-toggle.cjs.entry.js +0 -187
- package/dist/cjs/q-toolbar.cjs.entry.js +0 -33
- package/dist/cjs/registry-BhkCNgxt.js +0 -179
- package/dist/cjs/toast-controller-CIXagxbV.js +0 -111
- package/dist/cjs/tokens-DDfS79n9.js +0 -948
- package/dist/cjs/utils-DGQOjEwT.js +0 -33
- package/dist/cjs/webquark.cjs.js +0 -24
- package/dist/collection/assets/icons/braces.svg +0 -14
- package/dist/collection/assets/icons/check.svg +0 -1
- package/dist/collection/assets/icons/chevron-down.svg +0 -1
- package/dist/collection/assets/icons/chevron-left.svg +0 -1
- package/dist/collection/assets/icons/chevron-right.svg +0 -1
- package/dist/collection/assets/icons/chevron-up.svg +0 -1
- package/dist/collection/assets/icons/copy.svg +0 -4
- package/dist/collection/assets/icons/eye-off.svg +0 -1
- package/dist/collection/assets/icons/eye.svg +0 -1
- package/dist/collection/assets/icons/minus.svg +0 -1
- package/dist/collection/assets/icons/play.svg +0 -1
- package/dist/collection/assets/icons/plus.svg +0 -1
- package/dist/collection/assets/icons/search.svg +0 -1
- package/dist/collection/assets/icons/spinner.svg +0 -1
- package/dist/collection/assets/icons/trash-2.svg +0 -1
- package/dist/collection/assets/icons/x.svg +0 -1
- package/dist/collection/collection-manifest.json +0 -55
- package/dist/collection/components/actions/action.props.js +0 -130
- package/dist/collection/components/actions/button/button.css +0 -242
- package/dist/collection/components/actions/button/button.js +0 -512
- package/dist/collection/components/actions/button/button.types.js +0 -1
- package/dist/collection/components/actions/button/button.utils.js +0 -9
- package/dist/collection/components/actions/button/button.utils.unit.test.js +0 -44
- package/dist/collection/components/actions/link/link.css +0 -102
- package/dist/collection/components/actions/link/link.js +0 -316
- package/dist/collection/components/actions/link/link.types.js +0 -1
- package/dist/collection/components/communication/alert/alert.css +0 -118
- package/dist/collection/components/communication/alert/alert.js +0 -208
- package/dist/collection/components/communication/alert/alert.types.js +0 -1
- package/dist/collection/components/communication/conversation-bubble/conversation-bubble.css +0 -154
- package/dist/collection/components/communication/conversation-bubble/conversation-bubble.js +0 -207
- package/dist/collection/components/communication/conversation-bubble/conversation-bubble.types.js +0 -1
- package/dist/collection/components/communication/toast/internals/icons.js +0 -25
- package/dist/collection/components/communication/toast/internals/queue.js +0 -64
- package/dist/collection/components/communication/toast/internals/timers.js +0 -75
- package/dist/collection/components/communication/toast/test/toast.cmp.test.js +0 -38
- package/dist/collection/components/communication/toast/test/toast.unit.test.js +0 -104
- package/dist/collection/components/communication/toast/toast-controller.js +0 -105
- package/dist/collection/components/communication/toast/toast.css +0 -141
- package/dist/collection/components/communication/toast/toast.js +0 -556
- package/dist/collection/components/communication/toast/toast.types.js +0 -1
- package/dist/collection/components/content/banner/banner.css +0 -1
- package/dist/collection/components/content/banner/banner.js +0 -84
- package/dist/collection/components/content/banner/banner.types.js +0 -1
- package/dist/collection/components/content/card/card.css +0 -105
- package/dist/collection/components/content/card/card.js +0 -308
- package/dist/collection/components/content/card/card.types.js +0 -1
- package/dist/collection/components/content/card/card.utils.js +0 -15
- package/dist/collection/components/content/carousel/carousel.css +0 -168
- package/dist/collection/components/content/carousel/carousel.js +0 -465
- package/dist/collection/components/content/carousel/carousel.types.js +0 -1
- package/dist/collection/components/content/carousel/carousel.utils.js +0 -1
- package/dist/collection/components/content/carousel/internals/metrics.js +0 -59
- package/dist/collection/components/data-display/accordion/accordion.css +0 -1
- package/dist/collection/components/data-display/accordion/accordion.js +0 -54
- package/dist/collection/components/data-display/accordion/accordion.types.js +0 -1
- package/dist/collection/components/data-display/chip/chip.css +0 -219
- package/dist/collection/components/data-display/chip/chip.js +0 -381
- package/dist/collection/components/data-display/chip/chip.types.js +0 -1
- package/dist/collection/components/data-display/data-table/data-table-cell.js +0 -40
- package/dist/collection/components/data-display/data-table/data-table.css +0 -356
- package/dist/collection/components/data-display/data-table/data-table.js +0 -748
- package/dist/collection/components/data-display/data-table/data-table.types.js +0 -1
- package/dist/collection/components/data-display/data-table/internals/data-access.js +0 -43
- package/dist/collection/components/data-display/data-table/internals/render-row-actions.js +0 -22
- package/dist/collection/components/data-display/data-table/internals/render-sort-indicator.js +0 -5
- package/dist/collection/components/data-display/data-table/internals/render-table-body.js +0 -47
- package/dist/collection/components/data-display/data-table/internals/render-table-head.js +0 -42
- package/dist/collection/components/data-display/data-table/internals/render-toolbar.js +0 -6
- package/dist/collection/components/data-display/data-table/internals/row-events.js +0 -27
- package/dist/collection/components/data-display/data-table/internals/selection.js +0 -31
- package/dist/collection/components/data-display/data-table/internals/sort.js +0 -57
- package/dist/collection/components/data-display/data-table/internals/table-model.js +0 -84
- package/dist/collection/components/data-display/map/internals/base-layer.js +0 -140
- package/dist/collection/components/data-display/map/internals/bounds.js +0 -66
- package/dist/collection/components/data-display/map/internals/buffered-tile-layer.js +0 -128
- package/dist/collection/components/data-display/map/internals/cluster-collision.js +0 -73
- package/dist/collection/components/data-display/map/internals/google-maps.js +0 -117
- package/dist/collection/components/data-display/map/internals/google-mutant.js +0 -51
- package/dist/collection/components/data-display/map/internals/maplibre.js +0 -50
- package/dist/collection/components/data-display/map/internals/marker-cluster-index.js +0 -136
- package/dist/collection/components/data-display/map/internals/marker-controller.js +0 -425
- package/dist/collection/components/data-display/map/internals/marker-presentation.js +0 -217
- package/dist/collection/components/data-display/map/internals/marker-visibility.js +0 -158
- package/dist/collection/components/data-display/map/internals/markers.js +0 -176
- package/dist/collection/components/data-display/map/internals/tile-layer-readiness.js +0 -67
- package/dist/collection/components/data-display/map/internals/tile-preload-buffer.js +0 -8
- package/dist/collection/components/data-display/map/internals/vector-padding.js +0 -8
- package/dist/collection/components/data-display/map/map.css +0 -711
- package/dist/collection/components/data-display/map/map.js +0 -1514
- package/dist/collection/components/data-display/map/map.types.js +0 -12
- package/dist/collection/components/data-display/map/test/map.cmp.test.js +0 -774
- package/dist/collection/components/data-display/pagination/pagination.css +0 -81
- package/dist/collection/components/data-display/pagination/pagination.js +0 -240
- package/dist/collection/components/data-display/pagination/test/pagination.cmp.test.js +0 -57
- package/dist/collection/components/data-display/syntax-box/internals/clipboard.js +0 -9
- package/dist/collection/components/data-display/syntax-box/internals/editor-key-action.js +0 -14
- package/dist/collection/components/data-display/syntax-box/internals/value-sync.js +0 -27
- package/dist/collection/components/data-display/syntax-box/syntax-box.css +0 -202
- package/dist/collection/components/data-display/syntax-box/syntax-box.js +0 -623
- package/dist/collection/components/data-display/syntax-box/syntax-box.types.js +0 -1
- package/dist/collection/components/data-display/syntax-box/syntax-box.utils.js +0 -1
- package/dist/collection/components/indicators/progress/progress.css +0 -223
- package/dist/collection/components/indicators/progress/progress.js +0 -275
- package/dist/collection/components/indicators/progress/progress.types.js +0 -1
- package/dist/collection/components/indicators/step-diagram/step-diagram.css +0 -21
- package/dist/collection/components/indicators/step-diagram/step-diagram.js +0 -143
- package/dist/collection/components/indicators/step-diagram/step-diagram.types.js +0 -1
- package/dist/collection/components/indicators/step-diagram-item/step-diagram-item.css +0 -252
- package/dist/collection/components/indicators/step-diagram-item/step-diagram-item.js +0 -185
- package/dist/collection/components/indicators/step-diagram-item/step-diagram-item.types.js +0 -1
- package/dist/collection/components/indicators/step-diagram-item/step-diagram-item.utils.js +0 -3
- package/dist/collection/components/inputs/dropdown/dropdown.css +0 -387
- package/dist/collection/components/inputs/dropdown/dropdown.js +0 -1182
- package/dist/collection/components/inputs/dropdown/dropdown.types.js +0 -1
- package/dist/collection/components/inputs/dropdown/internals/options.js +0 -30
- package/dist/collection/components/inputs/dropdown/internals/position.js +0 -35
- package/dist/collection/components/inputs/dropdown/test/dropdown.cmp.test.js +0 -62
- package/dist/collection/components/inputs/form/form.css +0 -85
- package/dist/collection/components/inputs/form/form.js +0 -705
- package/dist/collection/components/inputs/form/form.types.js +0 -1
- package/dist/collection/components/inputs/form/internals/controls.js +0 -79
- package/dist/collection/components/inputs/form/internals/enter-behavior.js +0 -36
- package/dist/collection/components/inputs/form/internals/values.js +0 -176
- package/dist/collection/components/inputs/form/test/form.cmp.test.js +0 -157
- package/dist/collection/components/inputs/input/input.css +0 -293
- package/dist/collection/components/inputs/input/input.js +0 -836
- package/dist/collection/components/inputs/input/input.types.js +0 -1
- package/dist/collection/components/inputs/input/input.utils.js +0 -3
- package/dist/collection/components/inputs/quantity-selector/internals/number-value.js +0 -64
- package/dist/collection/components/inputs/quantity-selector/quantity-selector.css +0 -171
- package/dist/collection/components/inputs/quantity-selector/quantity-selector.js +0 -390
- package/dist/collection/components/inputs/quantity-selector/quantity-selector.types.js +0 -1
- package/dist/collection/components/inputs/radio-group/radio-group.css +0 -224
- package/dist/collection/components/inputs/radio-group/radio-group.js +0 -626
- package/dist/collection/components/inputs/radio-group/radio-group.types.js +0 -1
- package/dist/collection/components/inputs/radio-group/radio-group.utils.js +0 -18
- package/dist/collection/components/inputs/textarea/textarea.css +0 -172
- package/dist/collection/components/inputs/textarea/textarea.js +0 -747
- package/dist/collection/components/inputs/textarea/textarea.types.js +0 -1
- package/dist/collection/components/inputs/toggle/toggle.css +0 -252
- package/dist/collection/components/inputs/toggle/toggle.js +0 -563
- package/dist/collection/components/inputs/toggle/toggle.types.js +0 -1
- package/dist/collection/components/inputs/toggle/toggle.utils.js +0 -3
- package/dist/collection/components/layout/grid/grid.css +0 -11
- package/dist/collection/components/layout/grid/grid.js +0 -152
- package/dist/collection/components/layout/inline/inline.css +0 -4
- package/dist/collection/components/layout/inline/inline.js +0 -118
- package/dist/collection/components/layout/navbar/navbar.css +0 -584
- package/dist/collection/components/layout/navbar/navbar.js +0 -848
- package/dist/collection/components/layout/navbar/navbar.types.js +0 -1
- package/dist/collection/components/layout/navbar/navbar.utils.js +0 -13
- package/dist/collection/components/layout/navbar/test/navbar.cmp.test.js +0 -369
- package/dist/collection/components/layout/panel/panel.css +0 -114
- package/dist/collection/components/layout/panel/panel.js +0 -394
- package/dist/collection/components/layout/panel/panel.types.js +0 -1
- package/dist/collection/components/layout/scrollable/internals/metrics.js +0 -61
- package/dist/collection/components/layout/scrollable/internals/native-scrollbar.js +0 -41
- package/dist/collection/components/layout/scrollable/scrollable.css +0 -123
- package/dist/collection/components/layout/scrollable/scrollable.js +0 -565
- package/dist/collection/components/layout/scrollable/scrollable.types.js +0 -1
- package/dist/collection/components/layout/section/section.css +0 -1
- package/dist/collection/components/layout/section/section.js +0 -98
- package/dist/collection/components/layout/section/section.types.js +0 -1
- package/dist/collection/components/layout/sidepanel/internals/drawer.js +0 -60
- package/dist/collection/components/layout/sidepanel/internals/groups.js +0 -56
- package/dist/collection/components/layout/sidepanel/internals/nav-items.js +0 -30
- package/dist/collection/components/layout/sidepanel/sidepanel.css +0 -904
- package/dist/collection/components/layout/sidepanel/sidepanel.js +0 -912
- package/dist/collection/components/layout/sidepanel/sidepanel.types.js +0 -1
- package/dist/collection/components/layout/sidepanel/sidepanel.utils.js +0 -17
- package/dist/collection/components/layout/stack/stack.css +0 -4
- package/dist/collection/components/layout/stack/stack.js +0 -76
- package/dist/collection/components/layout/tabs/tabs.css +0 -248
- package/dist/collection/components/layout/tabs/tabs.js +0 -322
- package/dist/collection/components/layout/tabs/tabs.types.js +0 -1
- package/dist/collection/components/layout/tabs/tabs.utils.js +0 -31
- package/dist/collection/components/layout/tabs/test/tabs.cmp.test.js +0 -165
- package/dist/collection/components/layout/toolbar/toolbar.css +0 -168
- package/dist/collection/components/layout/toolbar/toolbar.js +0 -251
- package/dist/collection/components/layout/toolbar/toolbar.types.js +0 -1
- package/dist/collection/components/media/avatar/avatar.css +0 -71
- package/dist/collection/components/media/avatar/avatar.js +0 -302
- package/dist/collection/components/media/avatar/avatar.types.js +0 -1
- package/dist/collection/components/media/icon/icon.css +0 -42
- package/dist/collection/components/media/icon/icon.js +0 -510
- package/dist/collection/components/media/icon/icon.types.js +0 -1
- package/dist/collection/components/media/icon/internals/constants.js +0 -3
- package/dist/collection/components/media/icon/internals/fetch-icon.js +0 -18
- package/dist/collection/components/media/icon/internals/registry.js +0 -171
- package/dist/collection/components/media/icon/internals/registry.unit.test.js +0 -42
- package/dist/collection/components/media/icon/internals/render-definition.js +0 -24
- package/dist/collection/components/media/icon/internals/sanitize-svg.js +0 -63
- package/dist/collection/components/media/icon/internals/size.js +0 -12
- package/dist/collection/components/media/icon/internals/url.js +0 -48
- package/dist/collection/components/media/media/media.css +0 -1
- package/dist/collection/components/media/media/media.js +0 -125
- package/dist/collection/components/media/media/media.types.js +0 -1
- package/dist/collection/components/media/reel/reel.css +0 -193
- package/dist/collection/components/media/reel/reel.js +0 -279
- package/dist/collection/components/media/reel/reel.types.js +0 -1
- package/dist/collection/components/media/thumbnail/thumbnail.css +0 -111
- package/dist/collection/components/media/thumbnail/thumbnail.js +0 -184
- package/dist/collection/components/media/thumbnail/thumbnail.types.js +0 -1
- package/dist/collection/components/overlays/dialog/dialog.css +0 -264
- package/dist/collection/components/overlays/dialog/dialog.js +0 -743
- package/dist/collection/components/overlays/dialog/dialog.types.js +0 -1
- package/dist/collection/components/overlays/dialog/internals/backdrop.js +0 -9
- package/dist/collection/components/overlays/dialog/internals/lifecycle.js +0 -53
- package/dist/collection/components/overlays/tooltip/internals/aria.js +0 -27
- package/dist/collection/components/overlays/tooltip/internals/positioning.js +0 -69
- package/dist/collection/components/overlays/tooltip/internals/scroll-listeners.js +0 -18
- package/dist/collection/components/overlays/tooltip/tooltip.css +0 -65
- package/dist/collection/components/overlays/tooltip/tooltip.js +0 -190
- package/dist/collection/components/overlays/tooltip/tooltip.types.js +0 -1
- package/dist/collection/components/shared/field.js +0 -8
- package/dist/collection/components/shared/test/orientation.cmp.test.js +0 -36
- package/dist/collection/index.js +0 -15
- package/dist/collection/playground/components/playground-code-preview/playground-code-preview.js +0 -48
- package/dist/collection/playground/components/playground-event-log/playground-event-log.js +0 -63
- package/dist/collection/playground/components/playground-header/playground-header.js +0 -65
- package/dist/collection/playground/components/playground-sidebar/playground-sidebar.js +0 -112
- package/dist/collection/playground/components/properties-panel/properties-panel.js +0 -146
- package/dist/collection/playground/components/properties-panel/property-row.js +0 -31
- package/dist/collection/playground/components/properties-panel/slot-row.js +0 -27
- package/dist/collection/playground/components/sandbox-viewport/sandbox-panel.js +0 -338
- package/dist/collection/playground/components/sandbox-viewport/sandbox-viewport.js +0 -159
- package/dist/collection/playground/components/sandbox-viewport/variant-card.js +0 -86
- package/dist/collection/playground/components/sandbox-viewport/viewport-tabs.js +0 -39
- package/dist/collection/playground/components/theme-designer/theme-designer.js +0 -69
- package/dist/collection/playground/components/theme-designer/token-row.js +0 -89
- package/dist/collection/playground/components/theme-designer/token-section.js +0 -19
- package/dist/collection/playground/dom-factory.js +0 -76
- package/dist/collection/playground/events.js +0 -37
- package/dist/collection/playground/logo.svg +0 -8
- package/dist/collection/playground/playground.bundled.js +0 -3856
- package/dist/collection/playground/playground.js +0 -10
- package/dist/collection/playground/state.js +0 -158
- package/dist/collection/playground/utils/color.js +0 -26
- package/dist/collection/playground/utils/dom.js +0 -38
- package/dist/collection/playground/utils/index.js +0 -2
- package/dist/collection/playground/views/q-button-view/q-button-view.js +0 -6
- package/dist/collection/playground/views/q-input-view/q-input-view.js +0 -6
- package/dist/collection/theme/test/foundation.cmp.test.js +0 -347
- package/dist/collection/theme/test/presets.cmp.test.js +0 -129
- package/dist/collection/theme/tokens.js +0 -951
- package/dist/collection/utils/collection-identity.js +0 -136
- package/dist/collection/utils/collection-identity.unit.test.js +0 -107
- package/dist/collection/utils/dom.js +0 -236
- package/dist/collection/utils/form-control-validity.js +0 -44
- package/dist/collection/utils/formatter.js +0 -177
- package/dist/collection/utils/formatter.unit.test.js +0 -53
- package/dist/collection/utils/math.js +0 -19
- package/dist/collection/utils/syntax.js +0 -110
- package/dist/collection/utils/utils.js +0 -28
- package/dist/collection/utils/utils.unit.test.js +0 -16
- package/dist/components/index.d.ts +0 -35
- package/dist/components/index.js +0 -1
- package/dist/components/p-2_cpBb8_.js +0 -1
- package/dist/components/p-BIIQL66b.js +0 -1
- package/dist/components/p-BJiYCN3i.js +0 -1
- package/dist/components/p-BeFSyZjp.js +0 -1
- package/dist/components/p-BfZVatS6.js +0 -1
- package/dist/components/p-Bj2RJb2E.js +0 -1
- package/dist/components/p-BvBRW3dl.js +0 -1
- package/dist/components/p-ByfrUWx1.js +0 -1
- package/dist/components/p-CFuqfXuv.js +0 -9
- package/dist/components/p-CGZPmEUB.js +0 -1
- package/dist/components/p-Cn_ChUpc.js +0 -1
- package/dist/components/p-CtUn83Rs.js +0 -1
- package/dist/components/p-CuJIyOwp.js +0 -1
- package/dist/components/p-DQhiqYeq.js +0 -1
- package/dist/components/p-DYMWBqU1.js +0 -5
- package/dist/components/p-DmqVhVoj.js +0 -1
- package/dist/components/p-DuX-9GOi.js +0 -1
- package/dist/components/p-DwnH6_NQ.js +0 -1
- package/dist/components/p-WJHaLJS_.js +0 -1
- package/dist/components/p-_X1v1o3K.js +0 -1
- package/dist/components/q-accordion.d.ts +0 -11
- package/dist/components/q-accordion.js +0 -1
- package/dist/components/q-alert.d.ts +0 -11
- package/dist/components/q-alert.js +0 -1
- package/dist/components/q-avatar.d.ts +0 -11
- package/dist/components/q-avatar.js +0 -1
- package/dist/components/q-banner.d.ts +0 -11
- package/dist/components/q-banner.js +0 -1
- package/dist/components/q-button.d.ts +0 -11
- package/dist/components/q-button.js +0 -1
- package/dist/components/q-card.d.ts +0 -11
- package/dist/components/q-card.js +0 -1
- package/dist/components/q-carousel.d.ts +0 -11
- package/dist/components/q-carousel.js +0 -1
- package/dist/components/q-chip.d.ts +0 -11
- package/dist/components/q-chip.js +0 -1
- package/dist/components/q-conversation-bubble.d.ts +0 -11
- package/dist/components/q-conversation-bubble.js +0 -1
- package/dist/components/q-data-table.d.ts +0 -11
- package/dist/components/q-data-table.js +0 -1
- package/dist/components/q-dialog.d.ts +0 -11
- package/dist/components/q-dialog.js +0 -1
- package/dist/components/q-dropdown.d.ts +0 -11
- package/dist/components/q-dropdown.js +0 -1
- package/dist/components/q-form.d.ts +0 -11
- package/dist/components/q-form.js +0 -1
- package/dist/components/q-grid.d.ts +0 -11
- package/dist/components/q-grid.js +0 -1
- package/dist/components/q-icon.d.ts +0 -11
- package/dist/components/q-icon.js +0 -1
- package/dist/components/q-inline.d.ts +0 -11
- package/dist/components/q-inline.js +0 -1
- package/dist/components/q-input.d.ts +0 -11
- package/dist/components/q-input.js +0 -1
- package/dist/components/q-link.d.ts +0 -11
- package/dist/components/q-link.js +0 -1
- package/dist/components/q-map.d.ts +0 -11
- package/dist/components/q-map.js +0 -1
- package/dist/components/q-media.d.ts +0 -11
- package/dist/components/q-media.js +0 -1
- package/dist/components/q-navbar.d.ts +0 -11
- package/dist/components/q-navbar.js +0 -1
- package/dist/components/q-pagination.d.ts +0 -11
- package/dist/components/q-pagination.js +0 -1
- package/dist/components/q-panel.d.ts +0 -11
- package/dist/components/q-panel.js +0 -1
- package/dist/components/q-progress.d.ts +0 -11
- package/dist/components/q-progress.js +0 -1
- package/dist/components/q-quantity-selector.d.ts +0 -11
- package/dist/components/q-quantity-selector.js +0 -1
- package/dist/components/q-radio-group.d.ts +0 -11
- package/dist/components/q-radio-group.js +0 -1
- package/dist/components/q-reel.d.ts +0 -11
- package/dist/components/q-reel.js +0 -1
- package/dist/components/q-scrollable.d.ts +0 -11
- package/dist/components/q-scrollable.js +0 -1
- package/dist/components/q-section.d.ts +0 -11
- package/dist/components/q-section.js +0 -1
- package/dist/components/q-sidepanel.d.ts +0 -11
- package/dist/components/q-sidepanel.js +0 -13
- package/dist/components/q-stack.d.ts +0 -11
- package/dist/components/q-stack.js +0 -1
- package/dist/components/q-step-diagram-item.d.ts +0 -11
- package/dist/components/q-step-diagram-item.js +0 -1
- package/dist/components/q-step-diagram.d.ts +0 -11
- package/dist/components/q-step-diagram.js +0 -1
- package/dist/components/q-syntax-box.d.ts +0 -11
- package/dist/components/q-syntax-box.js +0 -13
- package/dist/components/q-tabs.d.ts +0 -11
- package/dist/components/q-tabs.js +0 -1
- package/dist/components/q-textarea.d.ts +0 -11
- package/dist/components/q-textarea.js +0 -1
- package/dist/components/q-thumbnail.d.ts +0 -11
- package/dist/components/q-thumbnail.js +0 -1
- package/dist/components/q-toast.d.ts +0 -11
- package/dist/components/q-toast.js +0 -1
- package/dist/components/q-toggle.d.ts +0 -11
- package/dist/components/q-toggle.js +0 -1
- package/dist/components/q-toolbar.d.ts +0 -11
- package/dist/components/q-toolbar.js +0 -1
- package/dist/components/q-tooltip.d.ts +0 -11
- package/dist/components/q-tooltip.js +0 -1
- package/dist/esm/Leaflet.GoogleMutant-MpxOb4Jm.js +0 -766
- package/dist/esm/action.props-BypnAgOy.js +0 -32
- package/dist/esm/chevron-up-g9vOVxQ4.js +0 -27
- package/dist/esm/collection-identity-CGZPmEUB.js +0 -138
- package/dist/esm/data-table-cell-DmqVhVoj.js +0 -42
- package/dist/esm/dom-ByfrUWx1.js +0 -238
- package/dist/esm/field-dFy4PXKT.js +0 -11
- package/dist/esm/form-control-validity-Bj2RJb2E.js +0 -46
- package/dist/esm/index-tSny_c7b.js +0 -1859
- package/dist/esm/index.js +0 -6
- package/dist/esm/leaflet-maplibre-gl-BVDAAs7w.js +0 -1026
- package/dist/esm/leaflet-src-DYMWBqU1.js +0 -14547
- package/dist/esm/loader.js +0 -10
- package/dist/esm/map.types-WJHaLJS_.js +0 -14
- package/dist/esm/q-accordion.entry.js +0 -16
- package/dist/esm/q-alert.entry.js +0 -50
- package/dist/esm/q-avatar.entry.js +0 -99
- package/dist/esm/q-banner.entry.js +0 -17
- package/dist/esm/q-button_2.entry.js +0 -372
- package/dist/esm/q-card.entry.js +0 -86
- package/dist/esm/q-carousel.entry.js +0 -329
- package/dist/esm/q-chip.entry.js +0 -122
- package/dist/esm/q-conversation-bubble.entry.js +0 -68
- package/dist/esm/q-data-table.entry.js +0 -547
- package/dist/esm/q-dialog.entry.js +0 -269
- package/dist/esm/q-dropdown.entry.js +0 -644
- package/dist/esm/q-form.entry.js +0 -513
- package/dist/esm/q-grid.entry.js +0 -22
- package/dist/esm/q-icon.entry.js +0 -383
- package/dist/esm/q-inline.entry.js +0 -20
- package/dist/esm/q-input_2.entry.js +0 -367
- package/dist/esm/q-link.entry.js +0 -78
- package/dist/esm/q-map.entry.js +0 -3410
- package/dist/esm/q-media.entry.js +0 -19
- package/dist/esm/q-navbar.entry.js +0 -413
- package/dist/esm/q-pagination.entry.js +0 -66
- package/dist/esm/q-panel.entry.js +0 -74
- package/dist/esm/q-quantity-selector.entry.js +0 -202
- package/dist/esm/q-radio-group.entry.js +0 -222
- package/dist/esm/q-reel.entry.js +0 -168
- package/dist/esm/q-scrollable.entry.js +0 -447
- package/dist/esm/q-section.entry.js +0 -18
- package/dist/esm/q-sidepanel.entry.js +0 -671
- package/dist/esm/q-stack.entry.js +0 -18
- package/dist/esm/q-step-diagram-item.entry.js +0 -43
- package/dist/esm/q-step-diagram.entry.js +0 -54
- package/dist/esm/q-syntax-box.entry.js +0 -663
- package/dist/esm/q-tabs.entry.js +0 -153
- package/dist/esm/q-textarea.entry.js +0 -248
- package/dist/esm/q-thumbnail.entry.js +0 -49
- package/dist/esm/q-toast.entry.js +0 -398
- package/dist/esm/q-toggle.entry.js +0 -185
- package/dist/esm/q-toolbar.entry.js +0 -31
- package/dist/esm/registry-BvBRW3dl.js +0 -173
- package/dist/esm/toast-controller-BIIQL66b.js +0 -107
- package/dist/esm/tokens-CyPFM3XV.js +0 -944
- package/dist/esm/utils-BJiYCN3i.js +0 -30
- package/dist/esm/webquark.js +0 -20
- package/dist/index.cjs.js +0 -1
- package/dist/index.js +0 -1
- package/dist/loader/cdn.js +0 -1
- package/dist/loader/index.cjs.js +0 -1
- package/dist/loader/index.d.ts +0 -24
- package/dist/loader/index.es2017.js +0 -1
- package/dist/loader/index.js +0 -2
- package/dist/playground/build/p-04799ed0.entry.js +0 -1
- package/dist/playground/build/p-0610d5b2.entry.js +0 -1
- package/dist/playground/build/p-160cb4e4.entry.js +0 -1
- package/dist/playground/build/p-1cf51c80.entry.js +0 -1
- package/dist/playground/build/p-3d674223.entry.js +0 -1
- package/dist/playground/build/p-4fff116c.entry.js +0 -1
- package/dist/playground/build/p-5453eac7.entry.js +0 -1
- package/dist/playground/build/p-5eeb922e.entry.js +0 -1
- package/dist/playground/build/p-675d0d03.entry.js +0 -13
- package/dist/playground/build/p-70c4f92f.entry.js +0 -1
- package/dist/playground/build/p-72dc1231.entry.js +0 -1
- package/dist/playground/build/p-736b1c8c.entry.js +0 -1
- package/dist/playground/build/p-781d3459.entry.js +0 -1
- package/dist/playground/build/p-81f64d6f.entry.js +0 -1
- package/dist/playground/build/p-82810ead.entry.js +0 -1
- package/dist/playground/build/p-9227780b.entry.js +0 -1
- package/dist/playground/build/p-96922229.entry.js +0 -1
- package/dist/playground/build/p-BLvl8YLq.js +0 -1
- package/dist/playground/build/p-BvBRW3dl.js +0 -1
- package/dist/playground/build/p-CFuqfXuv.js +0 -9
- package/dist/playground/build/p-CGcC-mvi.js +0 -1
- package/dist/playground/build/p-CyPFM3XV.js +0 -1
- package/dist/playground/build/p-DmqVhVoj.js +0 -1
- package/dist/playground/build/p-WJHaLJS_.js +0 -1
- package/dist/playground/build/p-b7ac65c6.entry.js +0 -1
- package/dist/playground/build/p-bba3c7b4.entry.js +0 -1
- package/dist/playground/build/p-bf47c46a.entry.js +0 -13
- package/dist/playground/build/p-c448b4ce.entry.js +0 -1
- package/dist/playground/build/p-cb5ebd01.entry.js +0 -1
- package/dist/playground/build/p-d0c55860.entry.js +0 -1
- package/dist/playground/build/p-e6603d17.entry.js +0 -1
- package/dist/playground/build/p-e762a4b7.entry.js +0 -1
- package/dist/playground/build/p-fb76473e.entry.js +0 -1
- package/dist/playground/build/p-fed7219c.entry.js +0 -1
- package/dist/playground/build/p-g9vOVxQ4.js +0 -13
- package/dist/playground/build/p-tSny_c7b.js +0 -3
- package/dist/types/components/actions/action.props.d.ts +0 -19
- package/dist/types/components/actions/button/button.d.ts +0 -61
- package/dist/types/components/actions/button/button.types.d.ts +0 -6
- package/dist/types/components/actions/button/button.utils.d.ts +0 -8
- package/dist/types/components/actions/button/button.utils.unit.test.d.ts +0 -1
- package/dist/types/components/actions/link/link.d.ts +0 -43
- package/dist/types/components/actions/link/link.types.d.ts +0 -3
- package/dist/types/components/communication/alert/alert.d.ts +0 -32
- package/dist/types/components/communication/alert/alert.types.d.ts +0 -2
- package/dist/types/components/communication/conversation-bubble/conversation-bubble.d.ts +0 -38
- package/dist/types/components/communication/conversation-bubble/conversation-bubble.types.d.ts +0 -1
- package/dist/types/components/communication/toast/internals/icons.d.ts +0 -2
- package/dist/types/components/communication/toast/internals/queue.d.ts +0 -19
- package/dist/types/components/communication/toast/internals/timers.d.ts +0 -12
- package/dist/types/components/communication/toast/test/toast.cmp.test.d.ts +0 -2
- package/dist/types/components/communication/toast/test/toast.unit.test.d.ts +0 -1
- package/dist/types/components/communication/toast/toast-controller.d.ts +0 -9
- package/dist/types/components/communication/toast/toast.d.ts +0 -44
- package/dist/types/components/communication/toast/toast.types.d.ts +0 -30
- package/dist/types/components/content/banner/banner.d.ts +0 -12
- package/dist/types/components/content/banner/banner.types.d.ts +0 -2
- package/dist/types/components/content/card/card.d.ts +0 -35
- package/dist/types/components/content/card/card.types.d.ts +0 -1
- package/dist/types/components/content/card/card.utils.d.ts +0 -5
- package/dist/types/components/content/carousel/carousel.d.ts +0 -56
- package/dist/types/components/content/carousel/carousel.types.d.ts +0 -5
- package/dist/types/components/content/carousel/carousel.utils.d.ts +0 -1
- package/dist/types/components/content/carousel/internals/metrics.d.ts +0 -23
- package/dist/types/components/data-display/accordion/accordion.d.ts +0 -9
- package/dist/types/components/data-display/accordion/accordion.types.d.ts +0 -1
- package/dist/types/components/data-display/chip/chip.d.ts +0 -55
- package/dist/types/components/data-display/chip/chip.types.d.ts +0 -13
- package/dist/types/components/data-display/data-table/data-table-cell.d.ts +0 -5
- package/dist/types/components/data-display/data-table/data-table.d.ts +0 -78
- package/dist/types/components/data-display/data-table/data-table.types.d.ts +0 -53
- package/dist/types/components/data-display/data-table/internals/data-access.d.ts +0 -9
- package/dist/types/components/data-display/data-table/internals/render-row-actions.d.ts +0 -9
- package/dist/types/components/data-display/data-table/internals/render-sort-indicator.d.ts +0 -5
- package/dist/types/components/data-display/data-table/internals/render-table-body.d.ts +0 -12
- package/dist/types/components/data-display/data-table/internals/render-table-head.d.ts +0 -8
- package/dist/types/components/data-display/data-table/internals/render-toolbar.d.ts +0 -9
- package/dist/types/components/data-display/data-table/internals/row-events.d.ts +0 -1
- package/dist/types/components/data-display/data-table/internals/selection.d.ts +0 -10
- package/dist/types/components/data-display/data-table/internals/sort.d.ts +0 -3
- package/dist/types/components/data-display/data-table/internals/table-model.d.ts +0 -52
- package/dist/types/components/data-display/map/internals/base-layer.d.ts +0 -63
- package/dist/types/components/data-display/map/internals/bounds.d.ts +0 -23
- package/dist/types/components/data-display/map/internals/buffered-tile-layer.d.ts +0 -10
- package/dist/types/components/data-display/map/internals/cluster-collision.d.ts +0 -15
- package/dist/types/components/data-display/map/internals/google-maps.d.ts +0 -9
- package/dist/types/components/data-display/map/internals/google-mutant-module.d.ts +0 -11
- package/dist/types/components/data-display/map/internals/google-mutant.d.ts +0 -18
- package/dist/types/components/data-display/map/internals/maplibre.d.ts +0 -14
- package/dist/types/components/data-display/map/internals/marker-cluster-index.d.ts +0 -36
- package/dist/types/components/data-display/map/internals/marker-controller.d.ts +0 -57
- package/dist/types/components/data-display/map/internals/marker-presentation.d.ts +0 -8
- package/dist/types/components/data-display/map/internals/marker-visibility.d.ts +0 -10
- package/dist/types/components/data-display/map/internals/markers.d.ts +0 -4
- package/dist/types/components/data-display/map/internals/tile-layer-readiness.d.ts +0 -11
- package/dist/types/components/data-display/map/internals/tile-preload-buffer.d.ts +0 -4
- package/dist/types/components/data-display/map/internals/vector-padding.d.ts +0 -4
- package/dist/types/components/data-display/map/map.d.ts +0 -171
- package/dist/types/components/data-display/map/map.types.d.ts +0 -122
- package/dist/types/components/data-display/map/test/map.cmp.test.d.ts +0 -1
- package/dist/types/components/data-display/pagination/pagination.d.ts +0 -33
- package/dist/types/components/data-display/pagination/test/pagination.cmp.test.d.ts +0 -2
- package/dist/types/components/data-display/syntax-box/internals/clipboard.d.ts +0 -2
- package/dist/types/components/data-display/syntax-box/internals/editor-key-action.d.ts +0 -12
- package/dist/types/components/data-display/syntax-box/internals/value-sync.d.ts +0 -18
- package/dist/types/components/data-display/syntax-box/syntax-box.d.ts +0 -66
- package/dist/types/components/data-display/syntax-box/syntax-box.types.d.ts +0 -2
- package/dist/types/components/data-display/syntax-box/syntax-box.utils.d.ts +0 -1
- package/dist/types/components/indicators/progress/progress.d.ts +0 -30
- package/dist/types/components/indicators/progress/progress.types.d.ts +0 -3
- package/dist/types/components/indicators/step-diagram/step-diagram.d.ts +0 -19
- package/dist/types/components/indicators/step-diagram/step-diagram.types.d.ts +0 -3
- package/dist/types/components/indicators/step-diagram-item/step-diagram-item.d.ts +0 -26
- package/dist/types/components/indicators/step-diagram-item/step-diagram-item.types.d.ts +0 -5
- package/dist/types/components/indicators/step-diagram-item/step-diagram-item.utils.d.ts +0 -1
- package/dist/types/components/inputs/dropdown/dropdown.d.ts +0 -103
- package/dist/types/components/inputs/dropdown/dropdown.types.d.ts +0 -9
- package/dist/types/components/inputs/dropdown/internals/options.d.ts +0 -6
- package/dist/types/components/inputs/dropdown/internals/position.d.ts +0 -26
- package/dist/types/components/inputs/dropdown/test/dropdown.cmp.test.d.ts +0 -1
- package/dist/types/components/inputs/form/form.d.ts +0 -75
- package/dist/types/components/inputs/form/form.types.d.ts +0 -38
- package/dist/types/components/inputs/form/internals/controls.d.ts +0 -5
- package/dist/types/components/inputs/form/internals/enter-behavior.d.ts +0 -2
- package/dist/types/components/inputs/form/internals/values.d.ts +0 -5
- package/dist/types/components/inputs/form/test/form.cmp.test.d.ts +0 -4
- package/dist/types/components/inputs/input/input.d.ts +0 -83
- package/dist/types/components/inputs/input/input.types.d.ts +0 -3
- package/dist/types/components/inputs/input/input.utils.d.ts +0 -1
- package/dist/types/components/inputs/quantity-selector/internals/number-value.d.ts +0 -13
- package/dist/types/components/inputs/quantity-selector/quantity-selector.d.ts +0 -37
- package/dist/types/components/inputs/quantity-selector/quantity-selector.types.d.ts +0 -3
- package/dist/types/components/inputs/radio-group/radio-group.d.ts +0 -66
- package/dist/types/components/inputs/radio-group/radio-group.types.d.ts +0 -12
- package/dist/types/components/inputs/radio-group/radio-group.utils.d.ts +0 -2
- package/dist/types/components/inputs/textarea/textarea.d.ts +0 -74
- package/dist/types/components/inputs/textarea/textarea.types.d.ts +0 -1
- package/dist/types/components/inputs/toggle/toggle.d.ts +0 -62
- package/dist/types/components/inputs/toggle/toggle.types.d.ts +0 -3
- package/dist/types/components/inputs/toggle/toggle.utils.d.ts +0 -1
- package/dist/types/components/layout/grid/grid.d.ts +0 -13
- package/dist/types/components/layout/inline/inline.d.ts +0 -12
- package/dist/types/components/layout/navbar/navbar.d.ts +0 -94
- package/dist/types/components/layout/navbar/navbar.types.d.ts +0 -33
- package/dist/types/components/layout/navbar/navbar.utils.d.ts +0 -2
- package/dist/types/components/layout/navbar/test/navbar.cmp.test.d.ts +0 -1
- package/dist/types/components/layout/panel/panel.d.ts +0 -41
- package/dist/types/components/layout/panel/panel.types.d.ts +0 -3
- package/dist/types/components/layout/scrollable/internals/metrics.d.ts +0 -26
- package/dist/types/components/layout/scrollable/internals/native-scrollbar.d.ts +0 -4
- package/dist/types/components/layout/scrollable/scrollable.d.ts +0 -67
- package/dist/types/components/layout/scrollable/scrollable.types.d.ts +0 -6
- package/dist/types/components/layout/section/section.d.ts +0 -13
- package/dist/types/components/layout/section/section.types.d.ts +0 -1
- package/dist/types/components/layout/sidepanel/internals/drawer.d.ts +0 -2
- package/dist/types/components/layout/sidepanel/internals/groups.d.ts +0 -7
- package/dist/types/components/layout/sidepanel/internals/nav-items.d.ts +0 -2
- package/dist/types/components/layout/sidepanel/sidepanel.d.ts +0 -101
- package/dist/types/components/layout/sidepanel/sidepanel.types.d.ts +0 -43
- package/dist/types/components/layout/sidepanel/sidepanel.utils.d.ts +0 -2
- package/dist/types/components/layout/stack/stack.d.ts +0 -10
- package/dist/types/components/layout/tabs/tabs.d.ts +0 -29
- package/dist/types/components/layout/tabs/tabs.types.d.ts +0 -14
- package/dist/types/components/layout/tabs/tabs.utils.d.ts +0 -4
- package/dist/types/components/layout/tabs/test/tabs.cmp.test.d.ts +0 -1
- package/dist/types/components/layout/toolbar/toolbar.d.ts +0 -27
- package/dist/types/components/layout/toolbar/toolbar.types.d.ts +0 -1
- package/dist/types/components/media/avatar/avatar.d.ts +0 -37
- package/dist/types/components/media/avatar/avatar.types.d.ts +0 -2
- package/dist/types/components/media/icon/icon.d.ts +0 -48
- package/dist/types/components/media/icon/icon.types.d.ts +0 -30
- package/dist/types/components/media/icon/internals/constants.d.ts +0 -3
- package/dist/types/components/media/icon/internals/fetch-icon.d.ts +0 -1
- package/dist/types/components/media/icon/internals/registry.d.ts +0 -11
- package/dist/types/components/media/icon/internals/registry.unit.test.d.ts +0 -1
- package/dist/types/components/media/icon/internals/render-definition.d.ts +0 -2
- package/dist/types/components/media/icon/internals/sanitize-svg.d.ts +0 -2
- package/dist/types/components/media/icon/internals/size.d.ts +0 -2
- package/dist/types/components/media/icon/internals/url.d.ts +0 -11
- package/dist/types/components/media/media/media.d.ts +0 -13
- package/dist/types/components/media/media/media.types.d.ts +0 -2
- package/dist/types/components/media/reel/reel.d.ts +0 -34
- package/dist/types/components/media/reel/reel.types.d.ts +0 -3
- package/dist/types/components/media/thumbnail/thumbnail.d.ts +0 -21
- package/dist/types/components/media/thumbnail/thumbnail.types.d.ts +0 -7
- package/dist/types/components/overlays/dialog/dialog.d.ts +0 -83
- package/dist/types/components/overlays/dialog/dialog.types.d.ts +0 -1
- package/dist/types/components/overlays/dialog/internals/backdrop.d.ts +0 -2
- package/dist/types/components/overlays/dialog/internals/lifecycle.d.ts +0 -21
- package/dist/types/components/overlays/tooltip/internals/aria.d.ts +0 -13
- package/dist/types/components/overlays/tooltip/internals/positioning.d.ts +0 -7
- package/dist/types/components/overlays/tooltip/internals/scroll-listeners.d.ts +0 -2
- package/dist/types/components/overlays/tooltip/tooltip.d.ts +0 -28
- package/dist/types/components/overlays/tooltip/tooltip.types.d.ts +0 -1
- package/dist/types/components/shared/field.d.ts +0 -3
- package/dist/types/components/shared/test/orientation.cmp.test.d.ts +0 -1
- package/dist/types/components.d.ts +0 -5634
- package/dist/types/declarations.d.ts +0 -14
- package/dist/types/index.d.ts +0 -28
- package/dist/types/playground/components/playground-code-preview/playground-code-preview.d.ts +0 -9
- package/dist/types/playground/components/playground-event-log/playground-event-log.d.ts +0 -11
- package/dist/types/playground/components/playground-header/playground-header.d.ts +0 -10
- package/dist/types/playground/components/playground-sidebar/playground-sidebar.d.ts +0 -13
- package/dist/types/playground/components/properties-panel/properties-panel.d.ts +0 -15
- package/dist/types/playground/components/properties-panel/property-row.d.ts +0 -6
- package/dist/types/playground/components/properties-panel/slot-row.d.ts +0 -7
- package/dist/types/playground/components/sandbox-viewport/sandbox-panel.d.ts +0 -15
- package/dist/types/playground/components/sandbox-viewport/sandbox-viewport.d.ts +0 -14
- package/dist/types/playground/components/sandbox-viewport/variant-card.d.ts +0 -7
- package/dist/types/playground/components/sandbox-viewport/viewport-tabs.d.ts +0 -5
- package/dist/types/playground/components/theme-designer/theme-designer.d.ts +0 -15
- package/dist/types/playground/components/theme-designer/token-row.d.ts +0 -14
- package/dist/types/playground/components/theme-designer/token-section.d.ts +0 -7
- package/dist/types/playground/dom-factory.d.ts +0 -12
- package/dist/types/playground/events.d.ts +0 -24
- package/dist/types/playground/playground.d.ts +0 -7
- package/dist/types/playground/state.d.ts +0 -44
- package/dist/types/playground/utils/color.d.ts +0 -8
- package/dist/types/playground/utils/dom.d.ts +0 -15
- package/dist/types/playground/utils/index.d.ts +0 -2
- package/dist/types/stencil-public-runtime.d.ts +0 -1879
- package/dist/types/theme/test/assets.d.ts +0 -4
- package/dist/types/theme/test/foundation.cmp.test.d.ts +0 -16
- package/dist/types/theme/test/presets.cmp.test.d.ts +0 -7
- package/dist/types/theme/tokens.d.ts +0 -141
- package/dist/types/utils/collection-identity.d.ts +0 -55
- package/dist/types/utils/collection-identity.unit.test.d.ts +0 -1
- package/dist/types/utils/dom.d.ts +0 -68
- package/dist/types/utils/form-control-validity.d.ts +0 -14
- package/dist/types/utils/formatter.d.ts +0 -24
- package/dist/types/utils/formatter.unit.test.d.ts +0 -1
- package/dist/types/utils/math.d.ts +0 -10
- package/dist/types/utils/syntax.d.ts +0 -9
- package/dist/types/utils/utils.d.ts +0 -11
- package/dist/types/utils/utils.unit.test.d.ts +0 -1
- package/dist/webquark/index.esm.js +0 -1
- package/dist/webquark/native-content.css +0 -24
- package/dist/webquark/p-04799ed0.entry.js +0 -1
- package/dist/webquark/p-0610d5b2.entry.js +0 -1
- package/dist/webquark/p-151a555e.entry.js +0 -1
- package/dist/webquark/p-160cb4e4.entry.js +0 -1
- package/dist/webquark/p-17011e71.entry.js +0 -1
- package/dist/webquark/p-1cf51c80.entry.js +0 -1
- package/dist/webquark/p-25c3b776.entry.js +0 -1
- package/dist/webquark/p-362c5608.entry.js +0 -1
- package/dist/webquark/p-3d674223.entry.js +0 -1
- package/dist/webquark/p-4fff116c.entry.js +0 -1
- package/dist/webquark/p-675d0d03.entry.js +0 -13
- package/dist/webquark/p-70c4f92f.entry.js +0 -1
- package/dist/webquark/p-72dc1231.entry.js +0 -1
- package/dist/webquark/p-736b1c8c.entry.js +0 -1
- package/dist/webquark/p-964d27e0.entry.js +0 -1
- package/dist/webquark/p-96922229.entry.js +0 -1
- package/dist/webquark/p-9b4271ea.entry.js +0 -1
- package/dist/webquark/p-BIIQL66b.js +0 -1
- package/dist/webquark/p-BJiYCN3i.js +0 -1
- package/dist/webquark/p-BLvl8YLq.js +0 -1
- package/dist/webquark/p-Bj2RJb2E.js +0 -1
- package/dist/webquark/p-BvBRW3dl.js +0 -1
- package/dist/webquark/p-ByfrUWx1.js +0 -1
- package/dist/webquark/p-CFuqfXuv.js +0 -9
- package/dist/webquark/p-CGZPmEUB.js +0 -1
- package/dist/webquark/p-CGcC-mvi.js +0 -1
- package/dist/webquark/p-CyPFM3XV.js +0 -1
- package/dist/webquark/p-DYMWBqU1.js +0 -5
- package/dist/webquark/p-DmqVhVoj.js +0 -1
- package/dist/webquark/p-DuX-9GOi.js +0 -1
- package/dist/webquark/p-WJHaLJS_.js +0 -1
- package/dist/webquark/p-ae4e5ec4.entry.js +0 -1
- package/dist/webquark/p-b08d0ed8.entry.js +0 -1
- package/dist/webquark/p-b4dfadea.entry.js +0 -1
- package/dist/webquark/p-b7ac65c6.entry.js +0 -1
- package/dist/webquark/p-b9e83fa3.entry.js +0 -1
- package/dist/webquark/p-bba3c7b4.entry.js +0 -1
- package/dist/webquark/p-bf47c46a.entry.js +0 -13
- package/dist/webquark/p-c448b4ce.entry.js +0 -1
- package/dist/webquark/p-ca240b8b.entry.js +0 -1
- package/dist/webquark/p-cb5ebd01.entry.js +0 -1
- package/dist/webquark/p-e1c8a9aa.entry.js +0 -1
- package/dist/webquark/p-e762a4b7.entry.js +0 -1
- package/dist/webquark/p-fb76473e.entry.js +0 -1
- package/dist/webquark/p-g9vOVxQ4.js +0 -13
- package/dist/webquark/p-tSny_c7b.js +0 -3
- package/dist/webquark/webquark.esm.js +0 -1
- /package/dist/{collection → browser}/native-content.css +0 -0
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{a as t,L as e}from"./p-DYMWBqU1.js";
|
|
2
|
-
/**
|
|
3
|
-
* MapLibre GL JS
|
|
4
|
-
* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.10.0/LICENSE.txt
|
|
5
|
-
*/var i=Object.create,r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,o=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,l=(t,e)=>()=>(e||(t((e={exports:{}}).exports,e),t=null),e.exports),h=(t,e,i,o)=>{if(e&&"object"==typeof e||"function"==typeof e)for(var l,h=s(e),u=0,c=h.length;u<c;u++)!a.call(t,l=h[u])&&l!==i&&r(t,l,{get:(t=>e[t]).bind(null,l),enumerable:!(o=n(e,l))||o.enumerable});return t};function u(t,e){this.x=t,this.y=e}let c,f;function p(){return c??=typeof OffscreenCanvas<"u"&&!!new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap,c}function d(){if(null==f&&(f=!1,p())){let t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let e=0;e<25;e++){let i=4*e;t.fillStyle=`rgb(${i},${i+1},${i+2})`,t.fillRect(e%5,Math.floor(e/5),1,1)}let e=t.getImageData(0,0,5,5).data;for(let t=0;t<100;t++)if(t%4!=3&&e[t]!==t){f=!0;break}}}return f||!1}u.prototype={clone(){return new u(this.x,this.y)},add(t){return this.clone()._add(t)},sub(t){return this.clone()._sub(t)},multByPoint(t){return this.clone()._multByPoint(t)},divByPoint(t){return this.clone()._divByPoint(t)},mult(t){return this.clone()._mult(t)},div(t){return this.clone()._div(t)},rotate(t){return this.clone()._rotate(t)},rotateAround(t,e){return this.clone()._rotateAround(t,e)},matMult(t){return this.clone()._matMult(t)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(t){return this.x===t.x&&this.y===t.y},dist(t){return Math.sqrt(this.distSqr(t))},distSqr(t){let e=t.x-this.x,i=t.y-this.y;return e*e+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith(t){return this.angleWithSep(t.x,t.y)},angleWithSep(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult(t){let 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(t){return this.x+=t.x,this.y+=t.y,this},_sub(t){return this.x-=t.x,this.y-=t.y,this},_mult(t){return this.x*=t,this.y*=t,this},_div(t){return this.x/=t,this.y/=t,this},_multByPoint(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint(t){return this.x/=t.x,this.y/=t.y,this},_unit(){return this._div(this.mag()),this},_perp(){let t=this.y;return this.y=this.x,this.x=-t,this},_rotate(t){let e=Math.cos(t),i=Math.sin(t),r=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=r,this},_rotateAround(t,e){let i=Math.cos(t),r=Math.sin(t),n=e.y+r*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-r*(this.y-e.y),this.y=n,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:u},u.convert=function(t){if(t instanceof u)return t;if(Array.isArray(t))return new u(+t[0],+t[1]);if(void 0!==t.x&&void 0!==t.y)return new u(+t.x,+t.y);throw Error("Expected [x, y] or {x, y} point format")};var m=typeof Float32Array<"u"?Float32Array:Array;function _(){var t=new m(9);return m!=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}function g(){var t=new m(16);return m!=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}function y(t){var e=new m(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}function v(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 w(t,e){var i=e[0],r=e[1],n=e[2],s=e[3],o=e[4],a=e[5],l=e[6],h=e[7],u=e[8],c=e[9],f=e[10],p=e[11],d=e[12],m=e[13],_=e[14],g=e[15],y=i*a-r*o,v=i*l-n*o,w=i*h-s*o,b=r*l-n*a,x=r*h-s*a,D=n*h-s*l,M=u*m-c*d,E=u*_-f*d,A=u*g-p*d,F=c*_-f*m,z=c*g-p*m,S=f*g-p*_,C=y*S-v*z+w*F+b*A-x*E+D*M;return C?(t[0]=(a*S-l*z+h*F)*(C=1/C),t[1]=(n*z-r*S-s*F)*C,t[2]=(m*D-_*x+g*b)*C,t[3]=(f*x-c*D-p*b)*C,t[4]=(l*A-o*S-h*E)*C,t[5]=(i*S-n*A+s*E)*C,t[6]=(_*w-d*D-g*v)*C,t[7]=(u*D-f*w+p*v)*C,t[8]=(o*z-a*A+h*M)*C,t[9]=(r*A-i*z-s*M)*C,t[10]=(d*x-m*w+g*y)*C,t[11]=(c*w-u*x-p*y)*C,t[12]=(a*E-o*F-l*M)*C,t[13]=(i*F-r*E+n*M)*C,t[14]=(m*v-d*b-_*y)*C,t[15]=(u*b-c*v+f*y)*C,t):null}function b(t,e,i){var r=e[0],n=e[1],s=e[2],o=e[3],a=e[4],l=e[5],h=e[6],u=e[7],c=e[8],f=e[9],p=e[10],d=e[11],m=e[12],_=e[13],g=e[14],y=e[15],v=i[0],w=i[1],b=i[2],x=i[3];return t[0]=v*r+w*a+b*c+x*m,t[1]=v*n+w*l+b*f+x*_,t[2]=v*s+w*h+b*p+x*g,t[3]=v*o+w*u+b*d+x*y,t[4]=(v=i[4])*r+(w=i[5])*a+(b=i[6])*c+(x=i[7])*m,t[5]=v*n+w*l+b*f+x*_,t[6]=v*s+w*h+b*p+x*g,t[7]=v*o+w*u+b*d+x*y,t[8]=(v=i[8])*r+(w=i[9])*a+(b=i[10])*c+(x=i[11])*m,t[9]=v*n+w*l+b*f+x*_,t[10]=v*s+w*h+b*p+x*g,t[11]=v*o+w*u+b*d+x*y,t[12]=(v=i[12])*r+(w=i[13])*a+(b=i[14])*c+(x=i[15])*m,t[13]=v*n+w*l+b*f+x*_,t[14]=v*s+w*h+b*p+x*g,t[15]=v*o+w*u+b*d+x*y,t}function x(t,e,i){var r,n,s,o,a,l,h,u,c,f,p,d,m=i[0],_=i[1],g=i[2];return e===t?(t[12]=e[0]*m+e[4]*_+e[8]*g+e[12],t[13]=e[1]*m+e[5]*_+e[9]*g+e[13],t[14]=e[2]*m+e[6]*_+e[10]*g+e[14],t[15]=e[3]*m+e[7]*_+e[11]*g+e[15]):(n=e[1],s=e[2],o=e[3],a=e[4],l=e[5],h=e[6],u=e[7],c=e[8],f=e[9],p=e[10],d=e[11],t[0]=r=e[0],t[1]=n,t[2]=s,t[3]=o,t[4]=a,t[5]=l,t[6]=h,t[7]=u,t[8]=c,t[9]=f,t[10]=p,t[11]=d,t[12]=r*m+a*_+c*g+e[12],t[13]=n*m+l*_+f*g+e[13],t[14]=s*m+h*_+p*g+e[14],t[15]=o*m+u*_+d*g+e[15]),t}function D(t,e,i){var r=i[0],n=i[1],s=i[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*s,t[9]=e[9]*s,t[10]=e[10]*s,t[11]=e[11]*s,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function M(t,e,i){var r=Math.sin(i),n=Math.cos(i),s=e[4],o=e[5],a=e[6],l=e[7],h=e[8],u=e[9],c=e[10],f=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=s*n+h*r,t[5]=o*n+u*r,t[6]=a*n+c*r,t[7]=l*n+f*r,t[8]=h*n-s*r,t[9]=u*n-o*r,t[10]=c*n-a*r,t[11]=f*n-l*r,t}function E(t,e,i){var r=Math.sin(i),n=Math.cos(i),s=e[0],o=e[1],a=e[2],l=e[3],h=e[8],u=e[9],c=e[10],f=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*n-h*r,t[1]=o*n-u*r,t[2]=a*n-c*r,t[3]=l*n-f*r,t[8]=s*r+h*n,t[9]=o*r+u*n,t[10]=a*r+c*n,t[11]=l*r+f*n,t}function A(t,e,i){var r=Math.sin(i),n=Math.cos(i),s=e[0],o=e[1],a=e[2],l=e[3],h=e[4],u=e[5],c=e[6],f=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*n+h*r,t[1]=o*n+u*r,t[2]=a*n+c*r,t[3]=l*n+f*r,t[4]=h*n-s*r,t[5]=u*n-o*r,t[6]=c*n-a*r,t[7]=f*n-l*r,t}var F=function(t,e,i,r,n){var s=1/Math.tan(e/2);if(t[0]=s/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=n&&n!==1/0){var o=1/(r-n);t[10]=(n+r)*o,t[14]=2*n*r*o}else t[10]=-1,t[14]=-2*r;return t},z=function(t,e,i,r,n,s,o){var a=1/(e-i),l=1/(r-n),h=1/(s-o);return t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*h,t[11]=0,t[12]=(e+i)*a,t[13]=(n+r)*l,t[14]=(o+s)*h,t[15]=1,t};function S(){var t=new m(3);return m!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function C(t){var e=new m(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function T(t){var e=t[0],i=t[1],r=t[2];return Math.sqrt(e*e+i*i+r*r)}function P(t,e,i){var r=new m(3);return r[0]=t,r[1]=e,r[2]=i,r}function I(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t}function k(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t}function $(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t}function j(t,e,i,r){return t[0]=e[0]+i[0]*r,t[1]=e[1]+i[1]*r,t[2]=e[2]+i[2]*r,t}function R(t,e){var i=e[0],r=e[1],n=e[2],s=i*i+r*r+n*n;return s>0&&(s=1/Math.sqrt(s)),t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t}function O(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function B(t,e,i){var r=e[0],n=e[1],s=e[2],o=i[0],a=i[1],l=i[2];return t[0]=n*l-s*a,t[1]=s*o-r*l,t[2]=r*a-n*o,t}function L(t,e,i){var r=i[0],n=i[1],s=i[2],o=i[3],a=e[0],l=e[1],h=e[2],u=n*h-s*l,c=s*a-r*h,f=r*l-n*a;return t[0]=a+o*(u+=u)+n*(f+=f)-s*(c+=c),t[1]=l+o*c+s*u-r*f,t[2]=h+o*f+r*c-n*u,t}function U(t,e,i,r){var n=[],s=[];return n[0]=e[0]-i[0],n[1]=e[1]-i[1],n[2]=e[2]-i[2],s[0]=n[0],s[1]=n[1]*Math.cos(r)-n[2]*Math.sin(r),s[2]=n[1]*Math.sin(r)+n[2]*Math.cos(r),t[0]=s[0]+i[0],t[1]=s[1]+i[1],t[2]=s[2]+i[2],t}function N(t,e,i,r){var n=[],s=[];return n[0]=e[0]-i[0],n[1]=e[1]-i[1],n[2]=e[2]-i[2],s[0]=n[2]*Math.sin(r)+n[0]*Math.cos(r),s[1]=n[1],s[2]=n[2]*Math.cos(r)-n[0]*Math.sin(r),t[0]=s[0]+i[0],t[1]=s[1]+i[1],t[2]=s[2]+i[2],t}function G(t,e,i,r){var n=[],s=[];return n[0]=e[0]-i[0],n[1]=e[1]-i[1],n[2]=e[2]-i[2],s[0]=n[0]*Math.cos(r)-n[1]*Math.sin(r),s[1]=n[0]*Math.sin(r)+n[1]*Math.cos(r),s[2]=n[2],t[0]=s[0]+i[0],t[1]=s[1]+i[1],t[2]=s[2]+i[2],t}var q=k,V=T;function Z(t,e,i){var r=e[0],n=e[1],s=e[2],o=e[3];return t[0]=i[0]*r+i[4]*n+i[8]*s+i[12]*o,t[1]=i[1]*r+i[5]*n+i[9]*s+i[13]*o,t[2]=i[2]*r+i[6]*n+i[10]*s+i[14]*o,t[3]=i[3]*r+i[7]*n+i[11]*s+i[15]*o,t}S();function W(){var t=new m(4);return m!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function H(t,e,i,r){var n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"zyx",s=Math.PI/360;e*=s,r*=s,i*=s;var o=Math.sin(e),a=Math.cos(e),l=Math.sin(i),h=Math.cos(i),u=Math.sin(r),c=Math.cos(r);switch(n){case"xyz":t[0]=o*h*c+a*l*u,t[1]=a*l*c-o*h*u,t[2]=a*h*u+o*l*c,t[3]=a*h*c-o*l*u;break;case"xzy":t[0]=o*h*c-a*l*u,t[1]=a*l*c-o*h*u,t[2]=a*h*u+o*l*c,t[3]=a*h*c+o*l*u;break;case"yxz":t[0]=o*h*c+a*l*u,t[1]=a*l*c-o*h*u,t[2]=a*h*u-o*l*c,t[3]=a*h*c+o*l*u;break;case"yzx":t[0]=o*h*c+a*l*u,t[1]=a*l*c+o*h*u,t[2]=a*h*u-o*l*c,t[3]=a*h*c-o*l*u;break;case"zxy":t[0]=o*h*c-a*l*u,t[1]=a*l*c+o*h*u,t[2]=a*h*u+o*l*c,t[3]=a*h*c-o*l*u;break;case"zyx":t[0]=o*h*c-a*l*u,t[1]=a*l*c+o*h*u,t[2]=a*h*u-o*l*c,t[3]=a*h*c+o*l*u;break;default:throw Error("Unknown angle order "+n)}return t}!function(){var t=new m(4);m!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0)}();var Y=function(t,e,i,r){var n=new m(4);return n[0]=t,n[1]=e,n[2]=i,n[3]=r,n};function X(){var t=new m(2);return m!=Float32Array&&(t[0]=0,t[1]=0),t}function J(t,e){var i=new m(2);return i[0]=t,i[1]=e,i}function K(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t}function Q(t){var e=t[0],i=t[1];return Math.sqrt(e*e+i*i)}function tt(t){return t[0]=0,t[1]=0,t}S(),P(1,0,0),P(0,1,0),W(),W(),_();var et=function(t){var e=t[0],i=t[1];return e*e+i*i};X();const it=8192;function rt(t,e,i){return e*(it/(t.tileSize*2**(i-t.tileID.overscaledZ)))}function nt(t){return t instanceof Error?t:Error("string"==typeof t?t:String(t))}function st(){return new Float64Array(4)}function ot(){return new Float64Array(3)}function at(){return new Float64Array(16)}function lt(){let t=new Float64Array(16);return v(t),t}function ht(){let t=new Float32Array(16);return v(t),t}function ut(t,e,i,r,n=!1){if(!i[0]&&!i[1])return[0,0];let s=n?"map"===r?-t.bearingInRadians:0:"viewport"===r?t.bearingInRadians:0;if(s){let t=Math.sin(s),e=Math.cos(s);i=[i[0]*e-i[1]*t,i[0]*t+i[1]*e]}return[n?i[0]:rt(e,i[0],t.zoom),n?i[1]:rt(e,i[1],t.zoom)]}function ct(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]}function ft(t,e,i){let r=function(t){var e=t[3],i=t[4],r=t[5],n=t[6],s=t[7],o=t[8];return t[0]*(o*i-r*s)+t[1]*(-o*e+r*n)+t[2]*(s*e-i*n)}([t[0],t[1],t[2],e[0],e[1],e[2],i[0],i[1],i[2]]);if(0===r)return null;let n=B([],[e[0],e[1],e[2]],[i[0],i[1],i[2]]),s=B([],[i[0],i[1],i[2]],[t[0],t[1],t[2]]),o=B([],[t[0],t[1],t[2]],[e[0],e[1],e[2]]),a=$([],n,-t[3]);return I(a,a,$([],s,-e[3])),I(a,a,$([],o,-i[3])),$(a,a,1/r),a}function pt(t,e,i){let r=e[0]*i[0]+e[1]*i[1]+e[2]*i[2];return 0===r?null:(-(t[0]*i[0]+t[1]*i[1]+t[2]*i[2])-i[3])/r}function dt(t,e,i,r){let n=Math.sqrt(t*t+e*e),s=Math.sqrt(i*i+r*r);t/=n,e/=n,i/=s,r/=s;let o=Math.acos(t*i+e*r);return-e*i+t*r>0?o:-o}function mt(t,e){let i=gt(t,360),r=gt(e,360),n=r-i,s=r>i?n-360:n+360;return Math.abs(n)<Math.abs(s)?n:s}function _t(t,e){let i=gt(t,2*Math.PI),r=gt(e,2*Math.PI);return Math.min(Math.abs(i-r),Math.abs(i-r+2*Math.PI),Math.abs(i-r-2*Math.PI))}function gt(t,e){return(t%e+e)%e}function yt(t,e,i,r,n){return vt(r,n,Dt((t-e)/(i-e),0,1))}function vt(t,e,i){return t*(1-i)+e*i}function wt(t){let e=1/0,i=1/0,r=-1/0,n=-1/0;for(let s of t)e=Math.min(e,s.x),i=Math.min(i,s.y),r=Math.max(r,s.x),n=Math.max(n,s.y);return[e,i,r,n]}function bt(t,e,i,r){return function(t,e,i,r){let n=3*t,s=3*(i-t)-n,o=1-n-s,a=3*e,l=3*(r-e)-a,h=1-a-l;return function(t,e=1e-6){if(t<=0)return 0;if(t>=1)return 1;let i=t;for(let r=0;r<8;r++){let r=((o*i+s)*i+n)*i-t;if(Math.abs(r)<e)return((h*i+l)*i+a)*i;let u=(3*o*i+2*s)*i+n;if(Math.abs(u)<1e-6)break;i-=r/u}let r=0,u=1;i=t;for(let a=0;a<20;a++){let a=((o*i+s)*i+n)*i;if(Math.abs(a-t)<e)break;t>a?r=i:u=i,i=.5*(r+u)}return((h*i+l)*i+a)*i}}(t,e,i,r)}const xt=bt(.25,.1,.25,1);function Dt(t,e,i){return Math.min(i,Math.max(e,t))}function Mt(t,e,i){let r=i-e,n=((t-e)%r+r)%r+e;return n===e?i:n}function Et(t,...e){for(let i of e)for(let e in i)t[e]=i[e];return t}function At(t,e){let i={};for(let r of e)r in t&&(i[r]=t[r]);return i}let Ft=1;function zt(){return Ft++}function St(t){return 2**t}function Ct(t){return Math.log(t)/Math.LN2}function Tt(t,e,i){if(e<=0)return t;let r=1/e;return void 0===i||Math.abs(i)<1e-10?Math.round(t*r)/r:(i>0?Math.ceil(t*r-1e-9):Math.floor(t*r+1e-10))/r}function Pt(t,e){let i={};for(let r in t)i[r]=e.call(this,t[r],r,t);return i}function It(t,e){let i={};for(let r in t)e.call(this,t[r],r,t)&&(i[r]=t[r]);return i}function kt(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!kt(t[i],e[i]))return!1;return!0}if("object"==typeof t&&t&&null!==e){if("object"!=typeof e||Object.keys(t).length!==Object.keys(e).length)return!1;for(let i in t)if(!kt(t[i],e[i]))return!1;return!0}return t===e}function $t(t){return Array.isArray(t)?t.map($t):"object"==typeof t&&t?Pt(t,$t):t}const jt={};function Rt(t){jt[t]||(typeof console<"u"&&console.warn(t),jt[t]=!0)}function Ot(t,e,i){return(i.y-t.y)*(e.x-t.x)>(e.y-t.y)*(i.x-t.x)}function Bt(t,e,i,r){let n=e.y-t.y,s=e.x-t.x,o=r.y-i.y,a=r.x-i.x,l=o*s-a*n;if(0===l)return null;let h=(a*(t.y-i.y)-o*(t.x-i.x))/l;return new u(t.x+h*s,t.y+h*n)}function Lt(t){return typeof WorkerGlobalScope<"u"&&void 0!==t&&t instanceof WorkerGlobalScope}let Ut=null;function Nt(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap}function Gt(t,e,i,r){return t.addEventListener(e,i,r),{unsubscribe:()=>{t.removeEventListener(e,i,r)}}}function qt(t){return t*Math.PI/180}function Vt(t){return t/Math.PI*180}function Zt(t,e){return t.roll==e.roll&&t.pitch==e.pitch&&t.bearing==e.bearing}function Wt(t,e,i){let r=J(e.x-i.x,e.y-i.y),n=J(t.x-i.x,t.y-i.y);return Vt(Math.atan2(r[0]*n[1]-r[1]*n[0],function(t,e){return t[0]*e[0]+t[1]*e[1]}(r,n)))}function Ht(t,e,i){let r=new Float64Array(4);return H(r,t,e-90,i),r}const Yt=85.051129,Xt={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},Jt={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0};function Kt(t,e){return Xt[e]&&"touches"in t}function Qt(t,e){if(!Jt[e])return!1;let i=t,r=(i?.target)?.ownerDocument?.defaultView||window;return i instanceof r.MouseEvent||i instanceof r.WheelEvent}function te(t){return Xt[t]||Jt[t]}const ee="AbortError";var ie=class extends Error{constructor(t=ee){super(t instanceof Error?t.message:t),this.name=ee,t instanceof Error&&t.stack&&(this.stack=t.stack)}};function re(t){return t instanceof Error&&"AbortError"===t.name}function ne(t){if(t.aborted)throw new ie(t.reason)}const se={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{}};function oe(t){return se.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))]}const ae="global-dispatcher";var le=class extends Error{constructor(t,e,i,r){super(`AJAXError: ${e} (${t}): ${i}`),this.status=t,this.statusText=e,this.url=i,this.body=r}};function he(){if(Lt(self))return self.worker?.referrer;if("blob:"===window.location.protocol)try{return window.parent.location.href}catch{}return window.location.href}const ue=async function(t,e){if(t.url.includes("://")&&!/^https?:|^file:/.test(t.url)){let i=oe(t.url);if(i){let r=await i(t,e);return r.data||"arrayBuffer"!==t.type?r:Et(r,{data:new ArrayBuffer(0)})}if(Lt(self)&&self.worker?.actor)return self.worker.actor.sendAsync({type:"GR",data:t,targetMapId:ae},e)}if(!(t=>t.startsWith("file:")||he()?.startsWith("file:")&&!/^\w+:/.test(t))(t.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,"signal"))return async function(t,e){let i,r,n=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:he(),referrerPolicy:t.referrerPolicy,signal:e.signal});"json"===t.type&&!n.headers.has("Accept")&&n.headers.set("Accept","application/json");try{i=await fetch(n)}catch(e){throw re(e)?e:new le(0,nt(e).message,t.url,new Blob)}if(!i.ok){let e=await i.blob();throw new le(i.status,i.statusText,t.url,e)}r="arrayBuffer"===t.type||"image"===t.type?i.arrayBuffer():"json"===t.type?i.json():i.text();let s=await r;return ne(e.signal),{data:s,cacheControl:i.headers.get("Cache-Control"),expires:i.headers.get("Expires"),etag:i.headers.get("ETag")}}(t,e);if(Lt(self)&&self.worker?.actor)return self.worker.actor.sendAsync({type:"GR",data:t,mustQueue:!0,targetMapId:ae},e)}return function(t,e){return new Promise(((i,r)=>{let n=new XMLHttpRequest;n.open(t.method||"GET",t.url,!0),("arrayBuffer"===t.type||"image"===t.type)&&(n.responseType="arraybuffer");for(let e in t.headers)n.setRequestHeader(e,t.headers[e]);"json"===t.type&&(n.responseType="text",t.headers?.Accept||n.setRequestHeader("Accept","application/json")),n.withCredentials="include"===t.credentials,n.onerror=()=>{r(Error(n.statusText))},n.onload=()=>{if(!e.signal.aborted)if((n.status>=200&&n.status<300||0===n.status)&&null!==n.response){let e=n.response;if("json"===t.type)try{e=JSON.parse(n.response)}catch(t){return void r(t)}i({data:e,cacheControl:n.getResponseHeader("Cache-Control"),expires:n.getResponseHeader("Expires"),etag:n.getResponseHeader("ETag")})}else{let e=new Blob([n.response],{type:n.getResponseHeader("Content-Type")});r(new le(n.status,n.statusText,t.url,e))}},e.signal.addEventListener("abort",(()=>{n.abort(),r(new ie(e.signal.reason))})),n.send(t.body)}))}(t,e)},ce=(t,e)=>ue(Et(t,{type:"json"}),e),fe=(t,e)=>ue(Et(t,{type:"arrayBuffer"}),e);function pe(t){if(!t||t.startsWith("data:image/"))return!0;if(t.startsWith("blob:")&&(t=t.slice(5)).startsWith("null"))return!1;if(t.indexOf("://")<=0)return!0;let e=new URL(t),i=window.location;return e.protocol===i.protocol&&e.host===i.host}function de(t,e,i){i[t]?.includes(e)||(i[t]||=[],i[t].push(e))}function me(t,e,i){if(i?.[t]){let r=i[t].indexOf(e);-1!==r&&i[t].splice(r,1)}}var _e=class{constructor(t,e={}){Et(this,e),this.type=t}},ge=class extends _e{constructor(t,e={}){super("error",Et({error:t},e))}},ye=class{on(t,e){return this._listeners||={},de(t,e,this._listeners),{unsubscribe:()=>{this.off(t,e)}}}off(t,e){return me(t,e,this._listeners),me(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners||={},de(t,e,this._oneTimeListeners),this):new Promise((e=>this.once(t,e)))}fire(t,e){let i="string"==typeof t?new _e(t,e||{}):t,r=i.type;if(this.listens(r)){i.target=this;let t=this._listeners?.[r]?.slice()??[];for(let e of t)e.call(this,i);let e=this._oneTimeListeners?.[r]?.slice()??[];for(let t of e)me(r,t,this._oneTimeListeners),t.call(this,i);let n=this._eventedParent;n&&(Et(i,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),n.fire(i))}else i instanceof ge&&console.error(i.error);return this}listens(t){return!!(this._listeners?.[t]?.length||this._oneTimeListeners?.[t]?.length||this._eventedParent?.listens(t))}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}},ve={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},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},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{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:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},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:{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:{},"color-relief":{},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_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-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",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-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",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"},"fill-extrusion-rounded-corner-distance":{type:"number",default:0,minimum:0,units:"meters","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"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","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-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",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},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","feature"]},"property-type":"data-driven"},"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:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"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:{},"viewport-glyph":{},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-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"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",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},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"},"symbol-height-offset":{type:"number",default:0,units:"meters",requires:[{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-height-anchor":{type:"enum",values:{ground:{},absolute:{}},default:"ground",requires:["symbol-height-offset"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",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}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","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-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","global-state"]},"property-type":"data-constant"},"fill-color":{type:"color",default:"#000000",transition:!0,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,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default: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-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","global-state"]},"property-type":"data-constant"},"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","feature"]},"property-type":"cross-faded-data-driven"},"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"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,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:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,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:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",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"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,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"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}};const we=ve,be=["type","source","source-layer","minzoom","maxzoom","filter","layout"];var xe=class{constructor(t,e,i,r,n="error"){this.message=(t?`${t}: `:"")+i,r&&(this.identifier=r),this.severity=n,null!=e&&e.__line__&&(this.line=e.__line__)}};const De={kind:"null"},Me={kind:"number"},Ee={kind:"string"},Ae={kind:"boolean"},Fe={kind:"color"},ze={kind:"projectionDefinition"},Se={kind:"object"},Ce={kind:"value"},Te={kind:"collator"},Pe={kind:"formatted"},Ie={kind:"padding"},ke={kind:"colorArray"},$e={kind:"numberArray"},je={kind:"resolvedImage"},Re={kind:"variableAnchorOffsetCollection"};function Oe(t,e){return{kind:"array",itemType:t,N:e}}function Be(t){if("array"===t.kind){let e=Be(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const Le=[De,Me,Ee,Ae,Fe,ze,Pe,Se,Oe(Ce),Ie,$e,ke,je,Re];function Ue(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!Ue(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(let t of Le)if(!Ue(t,e))return null}return`Expected ${Be(t)} but found ${Be(e)} instead.`}function Ne(t,e){return e.some((e=>e.kind===t.kind))}function Ge(t,e){return e.some((e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t))}function qe(t,e){return"array"===t.kind&&"array"===e.kind?t.itemType.kind===e.itemType.kind&&"number"==typeof t.N:t.kind===e.kind}const Ve=.96422,Ze=.82521,We=4/29,He=6/29,Ye=3*He*He,Xe=Math.PI/180,Je=180/Math.PI;function Ke(t){return(t%=360)<0&&(t+=360),t}function Qe([t,e,i,r]){let n,s,o=ei((.2225045*(t=ti(t))+.7168786*(e=ti(e))+.0606169*(i=ti(i)))/1);t===e&&e===i?n=s=o:(n=ei((.4360747*t+.3850649*e+.1430804*i)/Ve),s=ei((.0139322*t+.0971045*e+.7141733*i)/Ze));let a=116*o-16;return[a<0?0:a,500*(n-o),200*(o-s),r]}function ti(t){return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function ei(t){return t>.008856451679035631?t**(1/3):t/Ye+We}function ii([t,e,i,r]){let n=(t+16)/116,s=isNaN(e)?n:n+e/500,o=isNaN(i)?n:n-i/200;return n=1*ni(n),s=Ve*ni(s),o=Ze*ni(o),[ri(3.1338561*s-1.6168667*n-.4906146*o),ri(-.9787684*s+1.9161415*n+.033454*o),ri(.0719453*s-.2289914*n+1.4052427*o),r]}function ri(t){return(t=t<=.00304?12.92*t:1.055*t**(1/2.4)-.055)<0?0:t>1?1:t}function ni(t){return t>He?t*t*t:Ye*(t-We)}const si=Object.hasOwn||function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};function oi(t,e){return si(t,e)?t[e]:void 0}function ai(t){return parseInt(t.padEnd(2,t),16)/255}function li(t,e){return hi(e?t/100:t,0,1)}function hi(t,e,i){return Math.min(Math.max(e,t),i)}function ui(t){return!t.some(Number.isNaN)}const ci={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function fi(t,e,i){return t+i*(e-t)}function pi(t,e,i){return t.map(((t,r)=>fi(t,e[r],i)))}var di=class t{constructor(t,e,i,r=1,n=!0){this.r=t,this.g=e,this.b=i,this.a=r,n||(this.r*=r,this.g*=r,this.b*=r,r||this.overwriteGetter("rgb",[t,e,i,r]))}static{this.black=new t(0,0,0,1)}static{this.white=new t(1,1,1,1)}static{this.transparent=new t(0,0,0,0)}static{this.red=new t(1,0,0,1)}static parse(e){if(e instanceof t)return e;if("string"!=typeof e)return;let i=function(t){if("transparent"===(t=t.toLowerCase().trim()))return[0,0,0,0];let e=oi(ci,t);if(e){let[t,i,r]=e;return[t/255,i/255,r/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){let e=t.length<6?1:2,i=1;return[ai(t.slice(i,i+=e)),ai(t.slice(i,i+=e)),ai(t.slice(i,i+=e)),ai(t.slice(i,i+e)||"ff")]}if(t.startsWith("rgb")){let e=t.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(e){let[t,i,r,n,s,o,a,l,h,u,c,f]=e,p=[n||" ",a||" ",u].join("");if(" "===p||" /"===p||",,"===p||",,,"===p){let t=[r,o,h].join(""),e="%%%"===t?100:""===t?255:0;if(e){let t=[hi(+i/e,0,1),hi(+s/e,0,1),hi(+l/e,0,1),c?li(+c,f):1];if(ui(t))return t}}return}}let i=t.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(i){let[t,e,r,n,s,o,a,l,h]=i,u=[r||" ",s||" ",a].join("");if(" "===u||" /"===u||",,"===u||",,,"===u){let t=[+e,hi(+n,0,100),hi(+o,0,100),l?li(+l,h):1];if(ui(t))return function([t,e,i,r]){function n(r){let n=(r+t/30)%12,s=e*Math.min(i,1-i);return i-s*Math.max(-1,Math.min(n-3,9-n,1))}return t=Ke(t),e/=100,i/=100,[n(0),n(8),n(4),r]}(t)}}}(e);return i?new t(...i,!1):void 0}get rgb(){let{r:t,g:e,b:i,a:r}=this,n=r||1/0;return this.overwriteGetter("rgb",[t/n,e/n,i/n,r])}get hcl(){return this.overwriteGetter("hcl",function(t){let[e,i,r,n]=Qe(t),s=Math.sqrt(i*i+r*r);return[Math.round(1e4*s)?Ke(Math.atan2(r,i)*Je):NaN,s,e,n]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Qe(this.rgb))}overwriteGetter(t,e){return Object.defineProperty(this,t,{value:e}),e}toString(){let[t,e,i,r]=this.rgb;return`rgba(${[t,e,i].map((t=>Math.round(255*t))).join(",")},${r})`}static interpolate(e,i,r,n="rgb"){switch(n){case"rgb":{let[n,s,o,a]=pi(e.rgb,i.rgb,r);return new t(n,s,o,a,!1)}case"hcl":{let n,s,[o,a,l,h]=e.hcl,[u,c,f,p]=i.hcl;if(isNaN(o)||isNaN(u))isNaN(o)?isNaN(u)?n=NaN:(n=u,(1===l||0===l)&&(s=c)):(n=o,(1===f||0===f)&&(s=a));else{let t=u-o;u>o&&t>180?t-=360:u<o&&o-u>180&&(t+=360),n=o+r*t}let[d,m,_,g]=function([t,e,i,r]){return t=isNaN(t)?0:t*Xe,ii([i,Math.cos(t)*e,Math.sin(t)*e,r])}([n,s??fi(a,c,r),fi(l,f,r),fi(h,p,r)]);return new t(d,m,_,g,!1)}case"lab":{let[n,s,o,a]=ii(pi(e.lab,i.lab,r));return new t(n,s,o,a,!1)}}}};const mi=["bottom","center","top"];var _i=class{constructor(t,e,i,r,n,s){this.text=t,this.image=e,this.scale=i,this.fontStack=r,this.textColor=n,this.verticalAlign=s}},gi=class t{constructor(t){this.sections=t}static fromString(e){return new t([new _i(e,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||t.image&&0!==t.image.name.length))}static factory(e){return e instanceof t?e:t.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}},yi=class t{constructor(t){this.values=t.slice()}static parse(e){if(e instanceof t)return e;if("number"==typeof e)return new t([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(let t of e)if("number"!=typeof t)return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new t(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,i,r){return new t(pi(e.values,i.values,r))}},vi=class t{constructor(t){this.values=t.slice()}static parse(e){if(e instanceof t)return e;if("number"==typeof e)return new t([e]);if(Array.isArray(e)){for(let t of e)if("number"!=typeof t)return;return new t(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,i,r){return new t(pi(e.values,i.values,r))}},wi=class t{constructor(t){this.values=t.slice()}static parse(e){if(e instanceof t)return e;if("string"==typeof e){let i=di.parse(e);return i?new t([i]):void 0}if(!Array.isArray(e))return;let i=[];for(let t of e){if("string"!=typeof t)return;let e=di.parse(t);if(!e)return;i.push(e)}return new t(i)}toString(){return JSON.stringify(this.values)}static interpolate(e,i,r,n="rgb"){let s=[];if(e.values.length!=i.values.length)throw Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${i.values.length}), cannot interpolate.`);for(let t=0;t<e.values.length;t++)s.push(di.interpolate(e.values[t],i.values[t],r,n));return new t(s)}},bi=class extends Error{constructor(t,e){super(t),this.name="RuntimeError",this.path=e}toJSON(){return this.message}};const xi=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);var Di=class t{constructor(t){this.values=t.slice()}static parse(e){if(e instanceof t)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let t=0;t<e.length;t+=2){let i=e[t],r=e[t+1];if("string"!=typeof i||!xi.has(i)||!Array.isArray(r)||2!==r.length||"number"!=typeof r[0]||"number"!=typeof r[1])return}return new t(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,i,r,n){let s=e.values,o=i.values;if(s.length!==o.length)throw new bi(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${i.toString()}`,n);let a=[];for(let t=0;t<s.length;t+=2){if(s[t]!==o[t])throw new bi(`Cannot interpolate values containing mismatched anchors. from[${t}]: ${s[t]}, to[${t}]: ${o[t]}`,n);a.push(s[t]);let[e,i]=s[t+1],[l,h]=o[t+1];a.push([fi(e,l,r),fi(i,h,r)])}return new t(a)}},Mi=class t{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(e){return e?new t({name:e,available:!1}):null}},Ei=class t{constructor(t,e,i){this.from=t,this.to=e,this.transition=i}toString(){return this.from===this.to&&1===this.transition?this.from:JSON.stringify([this.from,this.to,this.transition])}static interpolate(e,i,r){return new t(e,i,r)}static parse(e){return e instanceof t?e:Array.isArray(e)&&3===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]&&"number"==typeof e[2]?new t(e[0],e[1],e[2]):"object"==typeof e&&"string"==typeof e.from&&"string"==typeof e.to&&"number"==typeof e.transition?new t(e.from,e.to,e.transition):"string"==typeof e?new t(e,e,1):void 0}},Ai=class{constructor(t,e,i){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}};function Fi(t,e,i,r){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:`Invalid rgba value [${[t,e,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof r?[t,e,i,r]:[t,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function zi(t){if(null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t||t instanceof Ei||t instanceof di||t instanceof Ai||t instanceof gi||t instanceof yi||t instanceof vi||t instanceof wi||t instanceof Di||t instanceof Mi)return!0;if(Array.isArray(t)){for(let e of t)if(!zi(e))return!1;return!0}if("object"==typeof t){for(let e in t)if(!zi(t[e]))return!1;return!0}return!1}function Si(t){if(null===t)return De;if("string"==typeof t)return Ee;if("boolean"==typeof t)return Ae;if("number"==typeof t)return Me;if(t instanceof di)return Fe;if(t instanceof Ei)return ze;if(t instanceof Ai)return Te;if(t instanceof gi)return Pe;if(t instanceof yi)return Ie;if(t instanceof vi)return $e;if(t instanceof wi)return ke;if(t instanceof Di)return Re;if(t instanceof Mi)return je;if(Array.isArray(t)){let e,i=t.length;for(let i of t){let t=Si(i);if(e){if(e===t)continue;e=Ce;break}e=t}return Oe(e||Ce,i)}return Se}function Ci(t){let e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof di||t instanceof Ei||t instanceof gi||t instanceof yi||t instanceof vi||t instanceof wi||t instanceof Di||t instanceof Mi?t.toString():JSON.stringify(t)}var Ti=class t{constructor(t,e){this.type=t,this.value=e}static parse(e,i){if(2!==e.length)return i.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!zi(e[1]))return i.error(`invalid value of type "${typeof e[1]}"`);let r=e[1],n=Si(r),s=i.expectedType;return"array"===n.kind&&0===n.N&&s&&"array"===s.kind&&("number"!=typeof s.N||0===s.N)&&(n=s),new t(n,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}};const Pi=["Unknown","Point","LineString","Polygon"];var Ii=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Pi[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let e=this._parseColorCache.get(t);return e||(e=di.parse(t),this._parseColorCache.set(t,e)),e}};function ki(t,e,i){let r,n,s=t.length-1,o=0,a=s,l=0;for(;o<=a;)if(l=Math.floor((o+a)/2),r=t[l],n=t[l+1],r<=e){if(l===s||e<n)return l;o=l+1}else{if(!(r>e))throw new bi("Input is not a number.",i);a=l-1}return 0}var $i=class t{constructor(t,e,i,r){this.type=t,this.input=e,this.key=r,this.labels=[],this.outputs=[];for(let[t,e]of i)this.labels.push(t),this.outputs.push(e)}static parse(e,i){if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");let r=i.parse(e[1],1,Me);if(!r)return null;let n=[],s=null;i.expectedType&&"value"!==i.expectedType.kind&&(s=i.expectedType);for(let t=1;t<e.length;t+=2){let r=1===t?-1/0:e[t],o=e[t+1],a=t,l=t+1;if("number"!=typeof r)return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',a);if(n.length&&n[n.length-1][0]>=r)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);let h=i.parse(o,l,s);if(!h)return null;s||=h.type,n.push([r,h])}return new t(s,r,n,i.key)}evaluate(t){let e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);let r=this.input.evaluate(t);if(r<=e[0])return i[0].evaluate(t);let n=e.length;return r>=e[n-1]?i[n-1].evaluate(t):i[ki(e,r,this.key)].evaluate(t)}eachChild(t){t(this.input);for(let e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}},ji=class t{constructor(t,e,i,r,n,s){this.type=t,this.operator=e,this.interpolation=i,this.input=r,this.key=s,this.labels=[],this.outputs=[];for(let[t,e]of n)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(t,e,i,r){let n=0;if("exponential"===t.name)n=Ri(e,t.base,i,r);else if("linear"===t.name)n=Ri(e,1,i,r);else if("cubic-bezier"===t.name){let s=t.controlPoints;n=function(t,e,i,r){let n=3*t,s=3*(i-t)-n,o=1-n-s,a=3*e,l=3*(r-e)-a,h=1-a-l;return function(t,e=1e-6){if(t<=0)return 0;if(t>=1)return 1;let i=t;for(let r=0;r<8;r++){let r=((o*i+s)*i+n)*i-t;if(Math.abs(r)<e)return((h*i+l)*i+a)*i;let u=(3*o*i+2*s)*i+n;if(Math.abs(u)<1e-6)break;i-=r/u}let r=0,u=1;i=t;for(let a=0;a<20;a++){let a=((o*i+s)*i+n)*i;if(Math.abs(a-t)<e)break;t>a?r=i:u=i,i=.5*(r+u)}return((h*i+l)*i+a)*i}}(s[0],s[1],s[2],s[3])(Ri(e,1,i,r))}return n}static parse(e,i){let[r,n,s,...o]=e;if(!Array.isArray(n)||0===n.length)return i.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){let t=n[1];if("number"!=typeof t)return i.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:t}}else{if("cubic-bezier"!==n[0])return i.error(`Unknown interpolation type ${String(n[0])}`,1,0);{let t=n.slice(1);if(4!==t.length||t.some((t=>"number"!=typeof t||t<0||t>1)))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:t}}}if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(s=i.parse(s,2,Me),!s)return null;let a=[],l=null;"interpolate-hcl"!==r&&"interpolate-lab"!==r||i.expectedType==ke?i.expectedType&&"value"!==i.expectedType.kind&&(l=i.expectedType):l=Fe;for(let t=0;t<o.length;t+=2){let e=o[t],r=o[t+1],n=t+3,s=t+4;if("number"!=typeof e)return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',n);if(a.length&&a[a.length-1][0]>=e)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',n);let h=i.parse(r,s,l);if(!h)return null;l||=h.type,a.push([e,h])}return qe(l,Me)||qe(l,ze)||qe(l,Fe)||qe(l,Ie)||qe(l,$e)||qe(l,ke)||qe(l,Re)||qe(l,Oe(Me))?new t(l,r,n,s,a,i.key):i.error(`Type ${Be(l)} is not interpolatable.`)}evaluate(e){let i=this.labels,r=this.outputs;if(1===i.length)return r[0].evaluate(e);let n=this.input.evaluate(e);if(n<=i[0])return r[0].evaluate(e);let s=i.length;if(n>=i[s-1])return r[s-1].evaluate(e);let o=ki(i,n,this.key),a=t.interpolationFactor(this.interpolation,n,i[o],i[o+1]),l=r[o].evaluate(e),h=r[o+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return fi(l,h,a);case"color":return di.interpolate(l,h,a);case"padding":return yi.interpolate(l,h,a);case"colorArray":return wi.interpolate(l,h,a);case"numberArray":return vi.interpolate(l,h,a);case"variableAnchorOffsetCollection":return Di.interpolate(l,h,a,this.key);case"array":return pi(l,h,a);case"projectionDefinition":return Ei.interpolate(l,h,a)}case"interpolate-hcl":switch(this.type.kind){case"color":return di.interpolate(l,h,a,"hcl");case"colorArray":return wi.interpolate(l,h,a,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return di.interpolate(l,h,a,"lab");case"colorArray":return wi.interpolate(l,h,a,"lab")}}}eachChild(t){t(this.input);for(let e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}};function Ri(t,e,i,r){let n=r-i,s=t-i;return 0===n?0:1===e?s/n:(e**+s-1)/(e**+n-1)}const Oi={color:di.interpolate,number:fi,padding:yi.interpolate,numberArray:vi.interpolate,colorArray:wi.interpolate,variableAnchorOffsetCollection:Di.interpolate,array:pi};var Bi=class t{constructor(t){this.type=Pe,this.sections=t}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let r=e[1];if(!Array.isArray(r)&&"object"==typeof r)return i.error("First argument must be an image or text section.");let n=[],s=!1;for(let t=1;t<=e.length-1;++t){let r=e[t];if(s&&"object"==typeof r&&!Array.isArray(r)){s=!1;let t=null;if(r["font-scale"]&&(t=i.parse(r["font-scale"],1,Me),!t))return null;let e=null;if(r["text-font"]&&(e=i.parse(r["text-font"],1,Oe(Ee)),!e))return null;let o=null;if(r["text-color"]&&(o=i.parse(r["text-color"],1,Fe),!o))return null;let a=null;if(r["vertical-align"]){if("string"==typeof r["vertical-align"]&&!mi.includes(r["vertical-align"]))return i.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${r["vertical-align"]}' instead.`);if(a=i.parse(r["vertical-align"],1,Ee),!a)return null}let l=n[n.length-1];l.scale=t,l.font=e,l.textColor=o,l.verticalAlign=a}else{let r=i.parse(e[t],1,Ce);if(!r)return null;let o=r.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");s=!0,n.push({content:r,scale:null,font:null,textColor:null,verticalAlign:null})}}return new t(n)}evaluate(t){return new gi(this.sections.map((e=>{let i=e.content.evaluate(t);return Si(i)===je?new _i("",i,null,null,null,e.verticalAlign?e.verticalAlign.evaluate(t):null):new _i(Ci(i),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null,e.verticalAlign?e.verticalAlign.evaluate(t):null)})))}eachChild(t){for(let e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor),e.verticalAlign&&t(e.verticalAlign)}outputDefined(){return!1}};function Li(t,e,i=0,r=t.length-1,n=Ni){for(;r>i;){if(r-i>600){let s=r-i+1,o=e-i+1,a=Math.log(s),l=.5*Math.exp(2*a/3),h=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1);Li(t,e,Math.max(i,Math.floor(e-o*l/s+h)),Math.min(r,Math.floor(e+(s-o)*l/s+h)),n)}let s=t[e],o=i,a=r;for(Ui(t,i,e),n(t[r],s)>0&&Ui(t,i,r);o<a;){for(Ui(t,o,a),o++,a--;n(t[o],s)<0;)o++;for(;n(t[a],s)>0;)a--}0===n(t[i],s)?Ui(t,i,a):(a++,Ui(t,a,r)),a<=e&&(i=a+1),e<=a&&(r=a-1)}}function Ui(t,e,i){let r=t[e];t[e]=t[i],t[i]=r}function Ni(t,e){return t<e?-1:+(t>e)}function Gi(t,e){if(t.length<=1)return[t];let i,r,n=[];for(let e of t){let t=Vi(e);0!==t&&(e.area=Math.abs(t),void 0===r&&(r=t<0),r===t<0?(i&&n.push(i),i=[e]):i.push(e))}if(i&&n.push(i),e>1)for(let t=0;t<n.length;t++)n[t].length<=e||(Li(n[t],e,1,n[t].length-1,qi),n[t]=n[t].slice(0,e));return n}function qi(t,e){return e.area-t.area}function Vi(t){let e=0;for(let i,r,n=0,s=t.length,o=s-1;n<s;o=n++)i=t[n],r=t[o],e+=(r.x-i.x)*(i.y+r.y);return e}const Zi={string:Ee,number:Me,boolean:Ae,object:Se};var Wi=class t{constructor(t,e,i){this.type=t,this.args=e,this.key=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let r,n=1,s=e[0];if("array"===s){let t,s;if(e.length>2){let r=e[1];if("string"!=typeof r||!(r in Zi)||"object"===r)return i.error('The item type argument of "array" must be one of string, number, boolean',1);t=Zi[r],n++}else t=Ce;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return i.error('The length argument to "array" must be a positive integer literal',2);s=e[2],n++}r=Oe(t,s)}else{if(!Zi[s])throw Error(`Types doesn't contain name = ${s}`);r=Zi[s]}let o=[];for(;n<e.length;n++){let t=i.parse(e[n],n,Ce);if(!t)return null;o.push(t)}return new t(r,o,i.key)}evaluate(t){for(let e=0;e<this.args.length;e++){let i=this.args[e].evaluate(t);if(!Ue(this.type,Si(i)))return i;if(e===this.args.length-1)throw new bi(`Expected value to be of type ${Be(this.type)}, but found ${Be(Si(i))} instead.`,this.key)}throw Error()}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}};const Hi={"to-boolean":Ae,"to-color":Fe,"to-number":Me,"to-string":Ee};var Yi=class t{constructor(t,e,i){this.type=t,this.args=e,this.key=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let r=e[0];if(!Hi[r])throw Error(`Can't parse ${r} as it is not part of the known types`);if(("to-boolean"===r||"to-string"===r)&&2!==e.length)return i.error("Expected one argument.");let n=Hi[r],s=[];for(let t=1;t<e.length;t++){let r=i.parse(e[t],t,Ce);if(!r)return null;s.push(r)}return new t(n,s,i.key)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let e,i;for(let r of this.args){if(e=r.evaluate(t),i=null,e instanceof di)return e;if("string"==typeof e){let i=t.parseColor(e);if(i)return i}else if(Array.isArray(e)&&(i=e.length<3||e.length>4?`Invalid rgba value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:Fi(e[0],e[1],e[2],e[3]),!i))return new di(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new bi(i||`Could not parse color from value '${"string"==typeof e?e:JSON.stringify(e)}'`,this.key)}case"padding":{let e;for(let i of this.args){e=i.evaluate(t);let r=yi.parse(e);if(r)return r}throw new bi(`Could not parse padding from value '${"string"==typeof e?e:JSON.stringify(e)}'`,this.key)}case"numberArray":{let e;for(let i of this.args){e=i.evaluate(t);let r=vi.parse(e);if(r)return r}throw new bi(`Could not parse numberArray from value '${"string"==typeof e?e:JSON.stringify(e)}'`,this.key)}case"colorArray":{let e;for(let i of this.args){e=i.evaluate(t);let r=wi.parse(e);if(r)return r}throw new bi(`Could not parse colorArray from value '${"string"==typeof e?e:JSON.stringify(e)}'`,this.key)}case"variableAnchorOffsetCollection":{let e;for(let i of this.args){e=i.evaluate(t);let r=Di.parse(e);if(r)return r}throw new bi(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof e?e:JSON.stringify(e)}'`,this.key)}case"number":{let e=null;for(let i of this.args){if(e=i.evaluate(t),null===e)return 0;let r=Number(e);if(!isNaN(r))return r}throw new bi(`Could not convert ${JSON.stringify(e)} to number.`,this.key)}case"formatted":return gi.fromString(Ci(this.args[0].evaluate(t)));case"resolvedImage":return Mi.fromString(Ci(this.args[0].evaluate(t)));case"projectionDefinition":{let e=this.args[0].evaluate(t);if(Ei.parse(e))return e;throw new bi(`Could not parse projectionDefinition from value '${"string"==typeof e?e:JSON.stringify(e)}'`,this.key)}default:return Ci(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}},Xi=class t{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(let e of this.bindings)t(e[1]);t(this.result)}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);let r=[];for(let t=1;t<e.length-1;t+=2){let n=e[t];if("string"!=typeof n)return i.error(`Expected string, but found ${typeof n} instead.`,t);if(/[^a-zA-Z0-9_]/.test(n))return i.error("Variable names must contain only alphanumeric characters or '_'.",t);let s=i.parse(e[t+1],t+1);if(!s)return null;r.push([n,s])}let n=i.parse(e[e.length-1],e.length-1,i.expectedType,r);return n?new t(r,n):null}outputDefined(){return this.result.outputDefined()}},Ji=class t{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(e,i){if(2!==e.length||"string"!=typeof e[1])return i.error("'var' expression requires exactly one string literal argument.");let r=e[1];return i.scope.has(r)?new t(r,i.scope.get(r)):i.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}},Ki=class t{constructor(t,e){this.type=t,this.args=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let r=null,n=i.expectedType;n&&"value"!==n.kind&&(r=n);let s=[];for(let t of e.slice(1)){let e=i.parse(t,1+s.length,r,void 0,{typeAnnotation:"omit"});if(!e)return null;r||=e.type,s.push(e)}if(!r)throw Error("No output type");return n&&s.some((t=>Ue(n,t.type)))?new t(Ce,s):new t(r,s)}evaluate(t){let e,i=null,r=0;for(let n of this.args)if(r++,i=n.evaluate(t),i&&i instanceof Mi&&!i.available&&(e||=i.name,i=null,r===this.args.length&&(i=e)),null!==i)break;return i}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}};function Qi(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function tr(t,e,i,r){return 0===r.compare(e,i)}function er(t,e,i){let r="=="!==t&&"!="!==t;return class n{constructor(t,e,i,r){this.lhs=t,this.rhs=e,this.key=i,this.collator=r,this.type=Ae,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");let i=t[0],s=e.parse(t[1],1,Ce);if(!s)return null;if(!Qi(i,s.type))return e.concat(1).error(`"${i}" comparisons are not supported for type '${Be(s.type)}'.`);let o=e.parse(t[2],2,Ce);if(!o)return null;if(!Qi(i,o.type))return e.concat(2).error(`"${i}" comparisons are not supported for type '${Be(o.type)}'.`);if(s.type.kind!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error(`Cannot compare types '${Be(s.type)}' and '${Be(o.type)}'.`);r&&("value"===s.type.kind&&"value"!==o.type.kind?s=new Wi(o.type,[s],e.key):"value"!==s.type.kind&&"value"===o.type.kind&&(o=new Wi(s.type,[o],e.key)));let a=null;if(4===t.length){if("string"!==s.type.kind&&"string"!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error("Cannot use collator to compare non-string types.");if(a=e.parse(t[3],3,Te),!a)return null}return new n(s,o,e.key,a)}evaluate(n){let s=this.lhs.evaluate(n),o=this.rhs.evaluate(n);if(r&&this.hasUntypedArgument){let e=Si(s),i=Si(o);if(e.kind!==i.kind||"string"!==e.kind&&"number"!==e.kind)throw new bi(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${i.kind}) instead.`,this.key)}if(this.collator&&!r&&this.hasUntypedArgument){let t=Si(s),i=Si(o);if("string"!==t.kind||"string"!==i.kind)return e(n,s,o)}return this.collator?i(n,s,o,this.collator.evaluate(n)):e(n,s,o)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}}}const ir=er("==",(function(t,e,i){return e===i}),tr),rr=er("!=",(function(t,e,i){return e!==i}),(function(t,e,i,r){return!tr(0,e,i,r)})),nr=er("<",(function(t,e,i){return e<i}),(function(t,e,i,r){return r.compare(e,i)<0})),sr=er(">",(function(t,e,i){return e>i}),(function(t,e,i,r){return r.compare(e,i)>0})),or=er("<=",(function(t,e,i){return e<=i}),(function(t,e,i,r){return r.compare(e,i)<=0})),ar=er(">=",(function(t,e,i){return e>=i}),(function(t,e,i,r){return r.compare(e,i)>=0}));var lr=class t{constructor(t,e,i){this.type=Te,this.locale=i,this.caseSensitive=t,this.diacriticSensitive=e}static parse(e,i){if(2!==e.length)return i.error("Expected one argument.");let r=e[1];if("object"!=typeof r||Array.isArray(r))return i.error("Collator options argument must be an object.");let n=i.parse(void 0!==r["case-sensitive"]&&r["case-sensitive"],1,Ae);if(!n)return null;let s=i.parse(void 0!==r["diacritic-sensitive"]&&r["diacritic-sensitive"],1,Ae);if(!s)return null;let o=null;return r.locale&&(o=i.parse(r.locale,1,Ee),!o)?null:new t(n,s,o)}evaluate(t){return new Ai(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}};const hr=8192;function ur(t,e){let i=function(t){return(180+t)/360}(t[0]),r=function(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}(t[1]),n=2**e.z;return[Math.round(i*n*hr),Math.round(r*n*hr)]}function cr(t,e){let i=2**e.z,r=(t[1]/hr+e.y)/i;return[fr((t[0]/hr+e.x)/i),pr(r)]}function fr(t){return 360*t-180}function pr(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}function dr(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function mr(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function _r(t,e,i){return e[1]>t[1]!=i[1]>t[1]&&t[0]<(i[0]-e[0])*(t[1]-e[1])/(i[1]-e[1])+e[0]}function gr(t,e,i){let r=t[0]-e[0],n=t[1]-e[1],s=t[0]-i[0],o=t[1]-i[1];return r*o-s*n==0&&r*s<=0&&n*o<=0}function yr(t,e,i,r){return 0!==function(t,e){return t[0]*e[1]-t[1]*e[0]}([r[0]-i[0],r[1]-i[1]],[e[0]-t[0],e[1]-t[1]])&&!(!Mr(t,e,i,r)||!Mr(i,r,t,e))}function vr(t,e,i){for(let r of i)for(let i=0;i<r.length-1;++i)if(yr(t,e,r[i],r[i+1]))return!0;return!1}function wr(t,e,i=!1){let r=!1;for(let n of e)for(let e=0;e<n.length-1;e++){if(gr(t,n[e],n[e+1]))return i;_r(t,n[e],n[e+1])&&(r=!r)}return r}function br(t,e){for(let i of e)if(wr(t,i))return!0;return!1}function xr(t,e){for(let i of t)if(!wr(i,e))return!1;for(let i=0;i<t.length-1;++i)if(vr(t[i],t[i+1],e))return!1;return!0}function Dr(t,e){for(let i of e)if(xr(t,i))return!0;return!1}function Mr(t,e,i,r){let n=r[0]-i[0],s=r[1]-i[1],o=(t[0]-i[0])*s-n*(t[1]-i[1]),a=(e[0]-i[0])*s-n*(e[1]-i[1]);return o>0&&a<0||o<0&&a>0}function Er(t,e,i){let r=[];for(let n=0;n<t.length;n++){let s=[];for(let r=0;r<t[n].length;r++){let o=ur(t[n][r],i);dr(e,o),s.push(o)}r.push(s)}return r}function Ar(t,e,i){let r=[];for(let n=0;n<t.length;n++){let s=Er(t[n],e,i);r.push(s)}return r}function Fr(t,e,i,r){if(t[0]<i[0]||t[0]>i[2]){let e=.5*r,n=t[0]-i[0]>e?-r:i[0]-t[0]>e?r:0;0===n&&(n=t[0]-i[2]>e?-r:i[2]-t[0]>e?r:0),t[0]+=n}dr(e,t)}function zr(t,e,i,r){let n=2**r.z*hr,s=[r.x*hr,r.y*hr],o=[];for(let r of t)for(let t of r){let r=[t.x+s[0],t.y+s[1]];Fr(r,e,i,n),o.push(r)}return o}function Sr(t,e,i,r){let n=2**r.z*hr,s=[r.x*hr,r.y*hr],o=[];for(let i of t){let t=[];for(let r of i){let i=[r.x+s[0],r.y+s[1]];dr(e,i),t.push(i)}o.push(t)}if(e[2]-e[0]<=n/2){!function(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}(e);for(let t of o)for(let r of t)Fr(r,e,i,n)}return o}var Cr=class t{constructor(t,e){this.type=Ae,this.geojson=t,this.geometries=e}static parse(e,i){if(2!==e.length)return i.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(zi(e[1])){let i=e[1];if("FeatureCollection"===i.type){let e=[];for(let t of i.features){let{type:i,coordinates:r}=t.geometry;"Polygon"===i&&e.push(r),"MultiPolygon"===i&&e.push(...r)}if(e.length)return new t(i,{type:"MultiPolygon",coordinates:e})}else if("Feature"===i.type){let e=i.geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new t(i,i.geometry)}else if("Polygon"===i.type||"MultiPolygon"===i.type)return new t(i,i)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){let i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if("Polygon"===e.type){let s=Er(e.coordinates,r,n),o=zr(t.geometry(),i,r,n);if(!mr(i,r))return!1;for(let t of o)if(!wr(t,s))return!1}if("MultiPolygon"===e.type){let s=Ar(e.coordinates,r,n),o=zr(t.geometry(),i,r,n);if(!mr(i,r))return!1;for(let t of o)if(!br(t,s))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){let i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if("Polygon"===e.type){let s=Er(e.coordinates,r,n),o=Sr(t.geometry(),i,r,n);if(!mr(i,r))return!1;for(let t of o)if(!xr(t,s))return!1}if("MultiPolygon"===e.type){let s=Ar(e.coordinates,r,n),o=Sr(t.geometry(),i,r,n);if(!mr(i,r))return!1;for(let t of o)if(!Dr(t,s))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},Tr=class{constructor(t=[],e=(t,e)=>t<e?-1:+(t>e)){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;let t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:e,compare:i}=this,r=e[t];for(;t>0;){let n=t-1>>1,s=e[n];if(i(r,s)>=0)break;e[t]=s,t=n}e[t]=r}_down(t){let{data:e,compare:i}=this,r=this.length>>1,n=e[t];for(;t<r;){let r=1+(t<<1),s=r+1;if(s<this.length&&i(e[s],e[r])<0&&(r=s),i(e[r],n)>=0)break;e[t]=e[r],t=r}e[t]=n}};const Pr=Math.PI/180;var Ir=class{constructor(t){let e=6378.137*Pr*1e3,i=Math.cos(t*Pr),r=1/(1-.0066943799901413165*(1-i*i)),n=Math.sqrt(r);this.kx=e*n*i,this.ky=e*n*r*.9933056200098587}distance(t,e){let i=this.wrap(t[0]-e[0])*this.kx,r=(t[1]-e[1])*this.ky;return Math.sqrt(i*i+r*r)}pointOnLine(t,e){let i,r,n,s,o=1/0;for(let a=0;a<t.length-1;a++){let l=t[a][0],h=t[a][1],u=this.wrap(t[a+1][0]-l)*this.kx,c=(t[a+1][1]-h)*this.ky,f=0;(0!==u||0!==c)&&(f=(this.wrap(e[0]-l)*this.kx*u+(e[1]-h)*this.ky*c)/(u*u+c*c),f>1?(l=t[a+1][0],h=t[a+1][1]):f>0&&(l+=u/this.kx*f,h+=c/this.ky*f)),u=this.wrap(e[0]-l)*this.kx,c=(e[1]-h)*this.ky;let p=u*u+c*c;p<o&&(o=p,i=l,r=h,n=a,s=f)}return{point:[i,r],index:n,t:Math.max(0,Math.min(1,s))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}};function kr(t,e){return e[0]-t[0]}function $r(t){return t[1]-t[0]+1}function jr(t,e){return t[1]>=t[0]&&t[1]<e}function Rr(t,e){if(t[0]>t[1])return[null,null];let i=$r(t);if(e){if(2===i)return[t,null];let e=Math.floor(i/2);return[[t[0],t[0]+e],[t[0]+e,t[1]]]}if(1===i)return[t,null];let r=Math.floor(i/2)-1;return[[t[0],t[0]+r],[t[0]+r+1,t[1]]]}function Or(t,e){if(!jr(e,t.length))return[1/0,1/0,-1/0,-1/0];let i=[1/0,1/0,-1/0,-1/0];for(let r=e[0];r<=e[1];++r)dr(i,t[r]);return i}function Br(t){let e=[1/0,1/0,-1/0,-1/0];for(let i of t)for(let t of i)dr(e,t);return e}function Lr(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function Ur(t,e,i){if(!Lr(t)||!Lr(e))return NaN;let r=0,n=0;return t[2]<e[0]&&(r=e[0]-t[2]),t[0]>e[2]&&(r=t[0]-e[2]),t[1]>e[3]&&(n=t[1]-e[3]),t[3]<e[1]&&(n=e[1]-t[3]),i.distance([0,0],[r,n])}function Nr(t,e,i){let r=i.pointOnLine(e,t);return i.distance(t,r.point)}function Gr(t,e,i,r,n){let s=Math.min(Nr(t,[i,r],n),Nr(e,[i,r],n)),o=Math.min(Nr(i,[t,e],n),Nr(r,[t,e],n));return Math.min(s,o)}function qr(t,e,i,r,n){if(!jr(e,t.length)||!jr(r,i.length))return 1/0;let s=1/0;for(let o=e[0];o<e[1];++o){let e=t[o],a=t[o+1];for(let t=r[0];t<r[1];++t){let r=i[t],o=i[t+1];if(yr(e,a,r,o))return 0;s=Math.min(s,Gr(e,a,r,o,n))}}return s}function Vr(t,e,i,r,n){if(!jr(e,t.length)||!jr(r,i.length))return NaN;let s=1/0;for(let o=e[0];o<=e[1];++o)for(let e=r[0];e<=r[1];++e)if(s=Math.min(s,n.distance(t[o],i[e])),0===s)return s;return s}function Zr(t,e,i){if(wr(t,e,!0))return 0;let r=1/0;for(let n of e){let e=n[0],s=n[n.length-1];if(e!==s&&(r=Math.min(r,Nr(t,[s,e],i)),0===r))return r;let o=i.pointOnLine(n,t);if(r=Math.min(r,i.distance(t,o.point)),0===r)return r}return r}function Wr(t,e,i,r){if(!jr(e,t.length))return NaN;for(let r=e[0];r<=e[1];++r)if(wr(t[r],i,!0))return 0;let n=1/0;for(let s=e[0];s<e[1];++s){let e=t[s],o=t[s+1];for(let t of i)for(let i=0,s=t.length,a=s-1;i<s;a=i++){let s=t[a],l=t[i];if(yr(e,o,s,l))return 0;n=Math.min(n,Gr(e,o,s,l,r))}}return n}function Hr(t,e){for(let i of t)for(let t of i)if(wr(t,e,!0))return!0;return!1}function Yr(t,e,i,r=1/0){let n=Br(t),s=Br(e);if(r!==1/0&&Ur(n,s,i)>=r)return r;if(mr(n,s)){if(Hr(t,e))return 0}else if(Hr(e,t))return 0;let o=1/0;for(let r of t)for(let t=0,n=r.length,s=n-1;t<n;s=t++){let n=r[s],a=r[t];for(let t of e)for(let e=0,r=t.length,s=r-1;e<r;s=e++){let r=t[s],l=t[e];if(yr(n,a,r,l))return 0;o=Math.min(o,Gr(n,a,r,l,i))}}return o}function Xr(t,e,i,r,n,s){if(!s)return;let o=Ur(Or(r,s),n,i);o<e&&t.push([o,s,[0,0]])}function Jr(t,e,i,r,n,s,o){if(!s||!o)return;let a=Ur(Or(r,s),Or(n,o),i);a<e&&t.push([a,s,o])}function Kr(t,e,i,r,n=1/0){let s=Math.min(r.distance(t[0],i[0][0]),n);if(0===s)return s;let o=new Tr([[0,[0,t.length-1],[0,0]]],kr),a=Br(i);for(;o.length>0;){let n=o.pop();if(n[0]>=s)continue;let l=n[1],h=e?50:100;if($r(l)<=h){if(!jr(l,t.length))return NaN;if(e){let e=Wr(t,l,i,r);if(isNaN(e)||0===e)return e;s=Math.min(s,e)}else for(let e=l[0];e<=l[1];++e){let n=Zr(t[e],i,r);if(s=Math.min(s,n),0===s)return 0}}else{let i=Rr(l,e);Xr(o,s,r,t,a,i[0]),Xr(o,s,r,t,a,i[1])}}return s}function Qr(t,e,i,r,n,s=1/0){let o=Math.min(s,n.distance(t[0],i[0]));if(0===o)return o;let a=new Tr([[0,[0,t.length-1],[0,i.length-1]]],kr);for(;a.length>0;){let s=a.pop();if(s[0]>=o)continue;let l=s[1],h=s[2],u=e?50:100,c=r?50:100;if($r(l)<=u&&$r(h)<=c){if(!jr(l,t.length)&&jr(h,i.length))return NaN;let s;if(e&&r)s=qr(t,l,i,h,n),o=Math.min(o,s);else if(e&&!r){let e=t.slice(l[0],l[1]+1);for(let t=h[0];t<=h[1];++t)if(s=Nr(i[t],e,n),o=Math.min(o,s),0===o)return o}else if(!e&&r){let e=i.slice(h[0],h[1]+1);for(let i=l[0];i<=l[1];++i)if(s=Nr(t[i],e,n),o=Math.min(o,s),0===o)return o}else s=Vr(t,l,i,h,n),o=Math.min(o,s)}else{let s=Rr(l,e),u=Rr(h,r);Jr(a,o,n,t,i,s[0],u[0]),Jr(a,o,n,t,i,s[0],u[1]),Jr(a,o,n,t,i,s[1],u[0]),Jr(a,o,n,t,i,s[1],u[1])}}return o}function tn(t){return"MultiPolygon"===t.type?t.coordinates.map((t=>({type:"Polygon",coordinates:t}))):"MultiLineString"===t.type?t.coordinates.map((t=>({type:"LineString",coordinates:t}))):"MultiPoint"===t.type?t.coordinates.map((t=>({type:"Point",coordinates:t}))):[t]}var en=class t{constructor(t,e){this.type=Me,this.geojson=t,this.geometries=e}static parse(e,i){if(2!==e.length)return i.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(zi(e[1])){let i=e[1];if("FeatureCollection"===i.type)return new t(i,i.features.map((t=>tn(t.geometry))).flat());if("Feature"===i.type)return new t(i,tn(i.geometry));if("type"in i&&"coordinates"in i)return new t(i,tn(i))}return i.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){let i=t.geometry(),r=i.flat().map((e=>cr([e.x,e.y],t.canonical)));if(0===i.length)return NaN;let n=new Ir(r[0][1]),s=1/0;for(let t of e){switch(t.type){case"Point":s=Math.min(s,Qr(r,!1,[t.coordinates],!1,n,s));break;case"LineString":s=Math.min(s,Qr(r,!1,t.coordinates,!0,n,s));break;case"Polygon":s=Math.min(s,Kr(r,!1,t.coordinates,n,s))}if(0===s)return s}return s}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){let i=t.geometry(),r=i.flat().map((e=>cr([e.x,e.y],t.canonical)));if(0===i.length)return NaN;let n=new Ir(r[0][1]),s=1/0;for(let t of e){switch(t.type){case"Point":s=Math.min(s,Qr(r,!0,[t.coordinates],!1,n,s));break;case"LineString":s=Math.min(s,Qr(r,!0,t.coordinates,!0,n,s));break;case"Polygon":s=Math.min(s,Kr(r,!0,t.coordinates,n,s))}if(0===s)return s}return s}(t,this.geometries);if("Polygon"===t.geometryType())return function(t,e){let i=t.geometry();if(0===i.length||0===i[0].length)return NaN;let r=Gi(i,0).map((e=>e.map((e=>e.map((e=>cr([e.x,e.y],t.canonical))))))),n=new Ir(r[0][0][0][1]),s=1/0;for(let t of e)for(let e of r){switch(t.type){case"Point":s=Math.min(s,Kr([t.coordinates],!1,e,n,s));break;case"LineString":s=Math.min(s,Kr(t.coordinates,!0,e,n,s));break;case"Polygon":s=Math.min(s,Yr(e,t.coordinates,n,s))}if(0===s)return s}return s}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},rn=class t{constructor(t){this.key=t,this.type=Ce}static parse(e,i){if(2!==e.length)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);let r=e[1];return null==r?i.error("Global state property must be defined."):"string"==typeof r?new t(r):i.error(`Global state property must be string, but found ${typeof e[1]} instead.`)}evaluate(t){let e=t.globals?.globalState;return e&&0!==Object.keys(e).length?oi(e,this.key)??null:null}eachChild(){}outputDefined(){return!1}};const nn={"==":ir,"!=":rr,">":sr,"<":nr,">=":ar,"<=":or,array:Wi,at:class t{constructor(t,e,i,r){this.type=t,this.index=e,this.input=i,this.key=r}static parse(e,i){if(3!==e.length)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let r=i.parse(e[1],1,Me),n=i.parse(e[2],2,Oe(i.expectedType||Ce));return r&&n?new t(n.type.itemType,r,n,i.key):null}evaluate(t){let e=this.index.evaluate(t),i=this.input.evaluate(t);if(e<0)throw new bi(`Array index out of bounds: ${e} < 0.`,this.key);if(e>=i.length)throw new bi(`Array index out of bounds: ${e} > ${i.length-1}.`,this.key);if(e!==Math.floor(e))throw new bi(`Array index must be an integer, but found ${e} instead.`,this.key);return i[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}},boolean:Wi,case:class t{constructor(t,e,i){this.type=t,this.branches=e,this.otherwise=i}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return i.error("Expected an odd number of arguments.");let r;i.expectedType&&"value"!==i.expectedType.kind&&(r=i.expectedType);let n=[];for(let t=1;t<e.length-1;t+=2){let s=i.parse(e[t],t,Ae);if(!s)return null;let o=i.parse(e[t+1],t+1,r);if(!o)return null;n.push([s,o]),r||=o.type}let s=i.parse(e[e.length-1],e.length-1,r);if(!s)return null;if(!r)throw Error("Can't infer output type");return new t(r,n,s)}evaluate(t){for(let[e,i]of this.branches)if(e.evaluate(t))return i.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(let[e,i]of this.branches)t(e),t(i);t(this.otherwise)}outputDefined(){return this.branches.every((([t,e])=>e.outputDefined()))&&this.otherwise.outputDefined()}},coalesce:Ki,collator:lr,format:Bi,image:class t{constructor(t){this.type=je,this.input=t}static parse(e,i){if(2!==e.length)return i.error("Expected two arguments.");let r=i.parse(e[1],1,Ee);return r?new t(r):i.error("No image name provided.")}evaluate(t){let e=this.input.evaluate(t),i=Mi.fromString(e);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(e)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}},in:class t{constructor(t,e,i){this.needle=t,this.haystack=e,this.key=i,this.type=Ae}static parse(e,i){if(3!==e.length)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let r=i.parse(e[1],1,Ce),n=i.parse(e[2],2,Ce);return r&&n?Ne(r.type,[Ae,Ee,Me,De,Ce])?new t(r,n,i.key):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${Be(r.type)} instead`):null}evaluate(t){let e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!i)return!1;if(!Ge(e,["boolean","string","number","null"]))throw new bi(`Expected first argument to be of type boolean, string, number or null, but found ${Be(Si(e))} instead.`,this.key);if(!Ge(i,["string","array"]))throw new bi(`Expected second argument to be of type array or string, but found ${Be(Si(i))} instead.`,this.key);return i.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}},"index-of":class t{constructor(t,e,i,r){this.needle=t,this.haystack=e,this.key=i,this.fromIndex=r,this.type=Me}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);let r=i.parse(e[1],1,Ce),n=i.parse(e[2],2,Ce);if(!r||!n)return null;if(!Ne(r.type,[Ae,Ee,Me,De,Ce]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${Be(r.type)} instead`);if(4===e.length){let s=i.parse(e[3],3,Me);return s?new t(r,n,i.key,s):null}return new t(r,n,i.key)}evaluate(t){let e,i=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!Ge(i,["boolean","string","number","null"]))throw new bi(`Expected first argument to be of type boolean, string, number or null, but found ${Be(Si(i))} instead.`,this.key);if(this.fromIndex&&(e=this.fromIndex.evaluate(t)),Ge(r,["string"])){let t=r.indexOf(i,e);return-1===t?-1:[...r.slice(0,t)].length}if(Ge(r,["array"]))return r.indexOf(i,e);throw new bi(`Expected second argument to be of type array or string, but found ${Be(Si(r))} instead.`,this.key)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}},interpolate:ji,"interpolate-hcl":ji,"interpolate-lab":ji,length:class t{constructor(t,e){this.input=t,this.key=e,this.type=Me}static parse(e,i){if(2!==e.length)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);let r=i.parse(e[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?i.error(`Expected argument of type string or array, but found ${Be(r.type)} instead.`):new t(r,i.key):null}evaluate(t){let e=this.input.evaluate(t);if("string"==typeof e)return[...e].length;if(Array.isArray(e))return e.length;throw new bi(`Expected value to be of type string or array, but found ${Be(Si(e))} instead.`,this.key)}eachChild(t){t(this.input)}outputDefined(){return!1}},let:Xi,literal:Ti,match:class t{constructor(t,e,i,r,n,s){this.inputType=t,this.type=e,this.input=i,this.cases=r,this.outputs=n,this.otherwise=s}static parse(e,i){if(e.length<5)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return i.error("Expected an even number of arguments.");let r,n;i.expectedType&&"value"!==i.expectedType.kind&&(n=i.expectedType);let s={},o=[];for(let t=2;t<e.length-1;t+=2){let a=e[t],l=e[t+1];Array.isArray(a)||(a=[a]);let h=i.concat(t);if(0===a.length)return h.error("Expected at least one branch label.");for(let t of a){if("number"!=typeof t&&"string"!=typeof t)return h.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>2**53-1)return h.error(`Branch labels must be integers no larger than ${2**53-1}.`);if("number"==typeof t&&Math.floor(t)!==t)return h.error("Numeric branch labels must be integer values.");if(r){if(h.checkSubtype(r,Si(t)))return null}else r=Si(t);if(void 0!==s[String(t)])return h.error("Branch labels must be unique.");s[String(t)]=o.length}let u=i.parse(l,t,n);if(!u)return null;n||=u.type,o.push(u)}let a=i.parse(e[1],1,Ce);if(!a)return null;let l=i.parse(e[e.length-1],e.length-1,n);return!l||"value"!==a.type.kind&&i.concat(1).checkSubtype(r,a.type)?null:new t(r,n,a,s,o,l)}evaluate(t){let e=this.input.evaluate(t);return(Si(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}},number:Wi,"number-format":class t{constructor(t,e,i,r,n,s){this.type=Ee,this.number=t,this.locale=e,this.currency=i,this.unit=r,this.minFractionDigits=n,this.maxFractionDigits=s}static parse(e,i){if(3!==e.length)return i.error("Expected two arguments.");let r=i.parse(e[1],1,Me);if(!r)return null;let n=e[2];if("object"!=typeof n||Array.isArray(n))return i.error("NumberFormat options argument must be an object.");let s=null;if(n.locale&&(s=i.parse(n.locale,1,Ee),!s))return null;let o=null;if(n.currency&&(o=i.parse(n.currency,1,Ee),!o))return null;let a=null;if(n.unit&&(a=i.parse(n.unit,1,Ee),!a))return null;if(o&&a)return i.error("NumberFormat options `currency` and `unit` are mutually exclusive");let l=null;if(n["min-fraction-digits"]&&(l=i.parse(n["min-fraction-digits"],1,Me),!l))return null;let h=null;return n["max-fraction-digits"]&&(h=i.parse(n["max-fraction-digits"],1,Me),!h)?null:new t(r,s,o,a,l,h)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.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))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}},object:Wi,semiliteral:class t{constructor(t){let e=null;for(let i of t){if(e){if(e===i.type)continue;e=Ce;break}e=i.type}this.type=Oe(e??Ce,t.length),this.arr=t}static parse(e,i){if(2!==e.length)return i.error(`'semiliteral' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!zi(e[1]))return i.error(`invalid value of type "${typeof e[1]}"`);let r=e[1],n=Si(r);if("array"===n.kind){let e=r,n=i.concat(1),s=[];for(let t=0;t<e.length;t++){let i=n.parse(e[t],t,Ce);if(!i)return null;s.push(i)}return new t(s)}return new Ti(n,r)}evaluate(t){return this.arr.map((e=>e.evaluate(t)))}eachChild(t){this.arr.forEach(t)}outputDefined(){return this.arr.every((t=>t.outputDefined()))}},slice:class t{constructor(t,e,i,r,n){this.type=t,this.input=e,this.beginIndex=i,this.key=r,this.endIndex=n}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);let r=i.parse(e[1],1,Ce),n=i.parse(e[2],2,Me);if(!r||!n)return null;if(!Ne(r.type,[Oe(Ce),Ee,Ce]))return i.error(`Expected first argument to be of type array or string, but found ${Be(r.type)} instead`);if(4===e.length){let s=i.parse(e[3],3,Me);return s?new t(r.type,r,n,i.key,s):null}return new t(r.type,r,n,i.key)}evaluate(t){let e,i=this.input.evaluate(t),r=this.beginIndex.evaluate(t);if(this.endIndex&&(e=this.endIndex.evaluate(t)),Ge(i,["string"]))return[...i].slice(r,e).join("");if(Ge(i,["array"]))return i.slice(r,e);throw new bi(`Expected first argument to be of type array or string, but found ${Be(Si(i))} instead.`,this.key)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}},step:$i,string:Wi,"to-boolean":Yi,"to-color":Yi,"to-number":Yi,"to-string":Yi,var:Ji,within:Cr,distance:en,"global-state":rn};var sn=class extends Error{constructor(t,e){super(e),this.message=e,this.key=t}},on=class t{constructor(t,e=[]){this.parent=t,this.bindings={};for(let[t,i]of e)this.bindings[t]=i}concat(e){return new t(this,e)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}},an=class t{constructor(t,e,i=[],r,n=new on,s=[]){this.registry=t,this.path=i,this.key=i.map((t=>`[${t}]`)).join(""),this.scope=n,this.errors=s,this.expectedType=r,this._isConstant=e}parse(t,e,i,r,n={}){return null==e?this._parse(t,n):this.concat(e,i,r)._parse(t,n)}_parse(t,e){(null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t)&&(t=["literal",t]);let i=this.key;function r(t,e,r){return"assert"===r?new Wi(e,[t],i):"coerce"===r?new Yi(e,[t],i):t}if(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", []].');let i=t[0];if("string"!=typeof i)return this.error(`Expression name must be a string, but found ${typeof i} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let n=this.registry[i];if(n){let i=n.parse(t,this);if(!i)return null;if(this.expectedType){let t=this.expectedType,n=i.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==n.kind){if("projectionDefinition"===t.kind&&["string","array","value"].includes(n.kind)||["color","formatted","resolvedImage"].includes(t.kind)&&["value","string"].includes(n.kind)||["padding","numberArray"].includes(t.kind)&&["value","number","array"].includes(n.kind)||"colorArray"===t.kind&&["value","string","array"].includes(n.kind)||"variableAnchorOffsetCollection"===t.kind&&["value","array"].includes(n.kind))i=r(i,t,e.typeAnnotation||"coerce");else if(this.checkSubtype(t,n))return null}else i=r(i,t,e.typeAnnotation||"assert")}if(!(i instanceof Ti)&&"resolvedImage"!==i.type.kind&&this._isConstant(i)){let e=new Ii;try{i=new Ti(i.type,i.evaluate(e))}catch(t){return this.error(t.message),null}}return i}return this.error(`Unknown expression "${i}". 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.`)}concat(e,i,r){let n="number"==typeof e?this.path.concat(e):this.path,s=r?this.scope.concat(r):this.scope;return new t(this.registry,this._isConstant,n,i||null,s,this.errors)}error(t,...e){let i=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new sn(i,t))}checkSubtype(t,e){let i=Ue(t,e);return i&&this.error(i),i}},ln=class t{constructor(t,e,i,r,n){this.name=t,this.type=e,this._evaluate=i,this.args=r,this.key=n}evaluate(t){return this._evaluate(t,this.args,this.key)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(e,i){let r=e[0],n=t.definitions[r];if(!n)return i.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);let s=Array.isArray(n)?n[0]:n.type,o=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,a=o.filter((([t])=>!Array.isArray(t)||t.length===e.length-1)),l=null;for(let[n,o]of a){l=new an(i.registry,pn,i.path,null,i.scope);let a=[],h=!1;for(let t=1;t<e.length;t++){let i=e[t],r=Array.isArray(n)?n[t-1]:n.type,s=l.parse(i,1+a.length,r);if(!s){h=!0;break}a.push(s)}if(!h){if(Array.isArray(n)&&n.length!==a.length){l.error(`Expected ${n.length} arguments, but found ${a.length} instead.`);continue}for(let t=0;t<a.length;t++){let e=Array.isArray(n)?n[t]:n.type,i=a[t];l.concat(t+1).checkSubtype(e,i.type)}if(0===l.errors.length)return new t(r,s,o,a,i.key)}}if(1===a.length)i.errors.push(...l.errors);else{let t=(a.length?a:o).map((([t])=>function(t){return Array.isArray(t)?`(${t.map(Be).join(", ")})`:`(${Be(t.type)}...)`}(t))).join(" | "),r=[];for(let t=1;t<e.length;t++){let n=i.parse(e[t],1+r.length);if(!n)return null;r.push(Be(n.type))}i.error(`Expected arguments of type ${t}, but found (${r.join(", ")}) instead.`)}return null}static register(e,i){t.definitions=i;for(let r in i)e[r]=t}};function hn(t,[e,i,r,n],s){e=e.evaluate(t),i=i.evaluate(t),r=r.evaluate(t);let o=n?n.evaluate(t):1,a=Fi(e,i,r,o);if(a)throw new bi(a,s);return new di(e/255,i/255,r/255,o,!1)}function un(t,e){return t in e&&void 0!==e[t]}function cn(t,e){let i=e[t];return void 0===i?null:i}function fn(t){return{type:t}}function pn(t){if(t instanceof Ji)return pn(t.boundExpression);if(t instanceof ln&&"error"===t.name||t instanceof lr||t instanceof Cr||t instanceof en||t instanceof rn)return!1;let e=t instanceof Yi||t instanceof Wi,i=!0;return t.eachChild((t=>{i&&=e?pn(t):t instanceof Ti})),!!i&&dn(t)&&_n(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function dn(t){if(t instanceof ln&&("get"===t.name&&1===t.args.length||"feature-state"===t.name||"has"===t.name&&1===t.args.length||"properties"===t.name||"geometry-type"===t.name||"id"===t.name||/^filter-/.test(t.name))||t instanceof Cr||t instanceof en)return!1;let e=!0;return t.eachChild((t=>{e&&!dn(t)&&(e=!1)})),e}function mn(t){if(t instanceof ln&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!mn(t)&&(e=!1)})),e}function _n(t,e){if(t instanceof ln&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild((t=>{i&&!_n(t,e)&&(i=!1)})),i}function gn(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function yn(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function vn(t){return!!t.expression&&t.expression.interpolated}ln.register(nn,{error:[{kind:"error"},[Ee],(t,[e],i)=>{throw new bi(e.evaluate(t),i)}],typeof:[Ee,[Ce],(t,[e])=>Be(Si(e.evaluate(t)))],"to-rgba":[Oe(Me,4),[Fe],(t,[e])=>{let[i,r,n,s]=e.evaluate(t).rgb;return[255*i,255*r,255*n,s]}],rgb:[Fe,[Me,Me,Me],hn],rgba:[Fe,[Me,Me,Me,Me],hn],has:{type:Ae,overloads:[[[Ee],(t,[e])=>un(e.evaluate(t),t.properties())],[[Ee,Se],(t,[e,i])=>un(e.evaluate(t),i.evaluate(t))]]},get:{type:Ce,overloads:[[[Ee],(t,[e])=>cn(e.evaluate(t),t.properties())],[[Ee,Se],(t,[e,i])=>cn(e.evaluate(t),i.evaluate(t))]]},"feature-state":[Ce,[Ee],(t,[e])=>cn(e.evaluate(t),t.featureState||{})],properties:[Se,[],t=>t.properties()],"geometry-type":[Ee,[],t=>t.geometryType()],id:[Ce,[],t=>t.id()],zoom:[Me,[],t=>t.globals.zoom],"heatmap-density":[Me,[],t=>t.globals.heatmapDensity||0],elevation:[Me,[],t=>t.globals.elevation||0],"line-progress":[Me,[],t=>t.globals.lineProgress||0],accumulated:[Ce,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[Me,fn(Me),(t,e)=>{let i=0;for(let r of e)i+=r.evaluate(t);return i}],"*":[Me,fn(Me),(t,e)=>{let i=1;for(let r of e)i*=r.evaluate(t);return i}],"-":{type:Me,overloads:[[[Me,Me],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[Me],(t,[e])=>-e.evaluate(t)]]},"/":[Me,[Me,Me],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[Me,[Me,Me],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[Me,[],()=>Math.LN2],pi:[Me,[],()=>Math.PI],e:[Me,[],()=>Math.E],"^":[Me,[Me,Me],(t,[e,i])=>e.evaluate(t)**+i.evaluate(t)],sqrt:[Me,[Me],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[Me,[Me],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[Me,[Me],(t,[e])=>Math.log(e.evaluate(t))],log2:[Me,[Me],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[Me,[Me],(t,[e])=>Math.sin(e.evaluate(t))],cos:[Me,[Me],(t,[e])=>Math.cos(e.evaluate(t))],tan:[Me,[Me],(t,[e])=>Math.tan(e.evaluate(t))],asin:[Me,[Me],(t,[e])=>Math.asin(e.evaluate(t))],acos:[Me,[Me],(t,[e])=>Math.acos(e.evaluate(t))],atan:[Me,[Me],(t,[e])=>Math.atan(e.evaluate(t))],min:[Me,fn(Me),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[Me,fn(Me),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[Me,[Me],(t,[e])=>Math.abs(e.evaluate(t))],round:[Me,[Me],(t,[e])=>{let i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[Me,[Me],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[Me,[Me],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[Ae,[Ee,Ce],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[Ae,[Ce],(t,[e])=>t.id()===e.value],"filter-type-==":[Ae,[Ee],(t,[e])=>t.geometryType()===e.value],"filter-<":[Ae,[Ee,Ce],(t,[e,i])=>{let r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r<n}],"filter-id-<":[Ae,[Ce],(t,[e])=>{let i=t.id(),r=e.value;return typeof i==typeof r&&i<r}],"filter->":[Ae,[Ee,Ce],(t,[e,i])=>{let r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r>n}],"filter-id->":[Ae,[Ce],(t,[e])=>{let i=t.id(),r=e.value;return typeof i==typeof r&&i>r}],"filter-<=":[Ae,[Ee,Ce],(t,[e,i])=>{let r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r<=n}],"filter-id-<=":[Ae,[Ce],(t,[e])=>{let i=t.id(),r=e.value;return typeof i==typeof r&&i<=r}],"filter->=":[Ae,[Ee,Ce],(t,[e,i])=>{let r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r>=n}],"filter-id->=":[Ae,[Ce],(t,[e])=>{let i=t.id(),r=e.value;return typeof i==typeof r&&i>=r}],"filter-has":[Ae,[Ce],(t,[e])=>{let i=e.value,r=t.properties();return i in r&&void 0!==r[i]}],"filter-has-id":[Ae,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[Ae,[Oe(Ee)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[Ae,[Oe(Ce)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[Ae,[Ee,Oe(Ce)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[Ae,[Ee,Oe(Ce)],(t,[e,i])=>function(t,e,i,r){for(;i<=r;){let n=i+r>>1;if(e[n]===t)return!0;e[n]>t?r=n-1:i=n+1}return!1}(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:Ae,overloads:[[[Ae,Ae],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[fn(Ae),(t,e)=>{for(let i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:Ae,overloads:[[[Ae,Ae],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[fn(Ae),(t,e)=>{for(let i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[Ae,[Ae],(t,[e])=>!e.evaluate(t)],"is-supported-script":[Ae,[Ee],(t,[e])=>{let i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[Ee,[Ee],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[Ee,[Ee],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[Ee,fn(Ce),(t,e)=>e.map((e=>Ci(e.evaluate(t)))).join("")],split:[Oe(Ee),[Ee,Ee],(t,[e,i])=>e.evaluate(t).split(i.evaluate(t))],join:[Ee,[Oe(Ee),Ee],(t,[e,i])=>e.evaluate(t).join(i.evaluate(t))],"resolved-locale":[Ee,[Te],(t,[e])=>e.evaluate(t).resolvedLocale()]});const wn=/^(.*)-transition$/;function bn(t,...e){for(let i of e)for(let e in i)t[e]=i[e];return t}function xn(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Dn(t){return"object"==typeof t&&!!t&&!Array.isArray(t)&&Si(t)===Se}function Mn(t){return t}function En(t,e){let i=t.stops&&"object"==typeof t.stops[0][0],r=i||!(i||void 0!==t.property),n=t.type||(vn(e)?"exponential":"interval"),s=function(t){switch(t.type){case"color":return di.parse;case"padding":return yi.parse;case"numberArray":return vi.parse;case"colorArray":return wi.parse;default:return null}}(e);if(s&&((t=bn({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],s(t[1])]))),t.default=s(t.default?t.default:e.default)),t.colorSpace&&!function(t){return"rgb"===t||"hcl"===t||"lab"===t}(t.colorSpace))throw Error(`Unknown color space: "${t.colorSpace}"`);let o,a,l=function(t){switch(t){case"exponential":return Sn;case"interval":return zn;case"categorical":return Fn;case"identity":return Cn;default:throw Error(`Unknown function type "${t}"`)}}(n);if("categorical"===n){o=Object.create(null);for(let e of t.stops)o[e[0]]=e[1];a=typeof t.stops[0][0]}if(i){let i={},r=[];for(let e=0;e<t.stops.length;e++){let n=t.stops[e],s=n[0].zoom;void 0===i[s]&&(i[s]={zoom:s,type:t.type,property:t.property,default:t.default,stops:[]},r.push(s)),i[s].stops.push([n[0].value,n[1]])}let n=[];for(let t of r)n.push([i[t].zoom,En(i[t],e)]);let s={name:"linear"};return{kind:"composite",interpolationType:s,interpolationFactor:ji.interpolationFactor.bind(void 0,s),zoomStops:n.map((t=>t[0])),evaluate:({zoom:i},r)=>Sn({stops:n,base:t.base},e,i).evaluate(i,r)}}if(r){let i="exponential"===n?{name:"exponential",base:void 0===t.base?1:t.base}:null;return{kind:"camera",interpolationType:i,interpolationFactor:ji.interpolationFactor.bind(void 0,i),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:i})=>l(t,e,i,o,a)}}return{kind:"source",evaluate(i,r){let n=r&&r.properties?r.properties[t.property]:void 0;return void 0===n?An(t.default,e.default):l(t,e,n,o,a)}}}function An(t,e,i){return void 0!==t?t:void 0!==e?e:void 0!==i?i:void 0}function Fn(t,e,i,r,n){return An(typeof i===n?r[i]:void 0,t.default,e.default)}function zn(t,e,i){if("number"!==xn(i))return An(t.default,e.default);let r=t.stops.length;if(1===r||i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[r-1][0])return t.stops[r-1][1];let n=ki(t.stops.map((t=>t[0])),i,"");return t.stops[n][1]}function Sn(t,e,i){let r=void 0===t.base?1:t.base;if("number"!==xn(i))return An(t.default,e.default);let n=t.stops.length;if(1===n||i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[n-1][0])return t.stops[n-1][1];let s=ki(t.stops.map((t=>t[0])),i,""),o=function(t,e,i,r){let n=r-i,s=t-i;return 0===n?0:1===e?s/n:(e**+s-1)/(e**+n-1)}(i,r,t.stops[s][0],t.stops[s+1][0]),a=t.stops[s][1],l=t.stops[s+1][1],h=Oi[e.type]||Mn;return"function"==typeof a.evaluate?{evaluate(...e){let i=a.evaluate.apply(void 0,e),r=l.evaluate.apply(void 0,e);if(void 0!==i&&void 0!==r)return h(i,r,o,t.colorSpace)}}:h(a,l,o,t.colorSpace)}function Cn(t,e,i){switch(e.type){case"color":i=di.parse(i);break;case"formatted":i=gi.fromString(i.toString());break;case"resolvedImage":i=Mi.fromString(i.toString());break;case"padding":i=yi.parse(i);break;case"colorArray":i=wi.parse(i);break;case"numberArray":i=vi.parse(i);break;default:xn(i)!==e.type&&("enum"!==e.type||!e.values[i])&&(i=void 0)}return An(i,t.default,e.default)}function Tn(t){return{result:"success",value:t}}function Pn(t){return{result:"error",value:t}}var In=class{constructor(t,e,i,r){this.expression=t,this._warningHistory={},this._evaluator=new Ii,this._defaultValue=i?qn(i):null,this._enumValues=i&&"enum"===i.type?i.values:null,this._globalState=r,this._rootKey=e}evaluateWithoutErrorHandling(t,e,i,r,n,s){return this._globalState&&(t=Vn(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=i,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=s,this.expression.evaluate(this._evaluator)}evaluate(t,e,i,r,n,s){this._globalState&&(t=Vn(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=i||null,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=s||null;try{let t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new bi(`Expected value to be one of ${Object.keys(this._enumValues).map((t=>JSON.stringify(t))).join(", ")}, but found ${JSON.stringify(t)} instead.`,"");return t}catch(t){let e=t instanceof bi?t.path:"",i=`${e}|${t.message}`;return this._warningHistory[i]||(this._warningHistory[i]=!0,typeof console<"u"&&console.warn(kn(this._rootKey,e,t.message,this._defaultValue))),this._defaultValue}}};function kn(t,e,i,r){return`${t}${e}: ${i}${null==r?"":` Falling back to ${String(r)}.`}`}function $n(t){if(!t)throw Error('rootKey must identify the location of the expression in the style JSON, e.g. "layers[3].paint.line-width".')}function jn(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in nn}function Rn(t,e,i,r){$n(e);let n=new an(nn,pn,[],i?function(t){let e={color:Fe,string:Ee,number:Me,enum:Ee,boolean:Ae,formatted:Pe,padding:Ie,numberArray:$e,colorArray:ke,projectionDefinition:ze,resolvedImage:je,variableAnchorOffsetCollection:Re};return"array"===t.type?Oe(e[t.value]||Ce,t.length):e[t.type]}(i):void 0),s=n.parse(t,void 0,void 0,void 0,i&&"string"===i.type?{typeAnnotation:"coerce"}:void 0);return s?Tn(new In(s,e,i,r)):Pn(n.errors)}var On=class{constructor(t,e,i){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!mn(e.expression),this.globalStateRefs=Gn(e.expression),this._globalState=i}evaluateWithoutErrorHandling(t,e,i,r,n,s){return this._globalState&&(t=Vn(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,i,r,n,s)}evaluate(t,e,i,r,n,s){return this._globalState&&(t=Vn(t,this._globalState)),this._styleExpression.evaluate(t,e,i,r,n,s)}},Bn=class{constructor(t,e,i,r,n){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent="camera"!==t&&!mn(e.expression),this.globalStateRefs=Gn(e.expression),this.interpolationType=r,this._globalState=n}evaluateWithoutErrorHandling(t,e,i,r,n,s){return this._globalState&&(t=Vn(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,i,r,n,s)}evaluate(t,e,i,r,n,s){return this._globalState&&(t=Vn(t,this._globalState)),this._styleExpression.evaluate(t,e,i,r,n,s)}interpolationFactor(t,e,i){return this.interpolationType?ji.interpolationFactor(this.interpolationType,t,e,i):0}};function Ln(t,e,i,r){let n=Rn(t,e,i,r);if("error"===n.result)return n;let s=n.value.expression,o=dn(s);if(!o&&!gn(i))return Pn([new sn("","data expressions not supported")]);let a=_n(s,["zoom"]);if(!a&&!yn(i))return Pn([new sn("","zoom expressions not supported")]);let l=Nn(s);return l||a?l instanceof sn?Pn([l]):l instanceof ji&&!vn(i)?Pn([new sn("",'"interpolate" expressions cannot be used with this property')]):Tn(l?new Bn(o?"camera":"composite",n.value,l.labels,l instanceof ji?l.interpolation:void 0,r):new On(o?"constant":"source",n.value,r)):Pn([new sn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}var Un=class t{constructor(t,e,i){this.isStateDependent=!1,this.globalStateRefs=new Set,this._globalState=null,$n(e),this._parameters=t,this._specification=i,this._rootKey=e,this._defaultValue=qn(i),this._warningHistory={};let r=En(this._parameters,this._specification);this.kind=r.kind,this.interpolationFactor=r.interpolationFactor,this.zoomStops=r.zoomStops,this.interpolationType=r.interpolationType,this._innerEvaluate=r.evaluate}evaluate(t,e){try{return this._innerEvaluate(t,e)}catch(t){let e=t instanceof Error?t.message:String(t),i=`|${e}`;return this._warningHistory[i]||(this._warningHistory[i]=!0,typeof console<"u"&&console.warn(kn(this._rootKey,"",e,this._defaultValue))),this._defaultValue}}static deserialize(e){return new t(e._parameters,e._rootKey,e._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification,_rootKey:t._rootKey}}};function Nn(t){let e=null;if(t instanceof Xi)e=Nn(t.result);else if(t instanceof Ki){for(let i of t.args)if(e=Nn(i),e)break}else(t instanceof $i||t instanceof ji)&&t.input instanceof ln&&"zoom"===t.input.name&&(e=t);return e instanceof sn||t.eachChild((t=>{let i=Nn(t);i instanceof sn?e=i:!e&&i?e=new sn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new sn("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function Gn(t,e=new Set){return t instanceof rn&&e.add(t.key),t.eachChild((t=>{Gn(t,e)})),e}function qn(t){if("color"===t.type&&Dn(t.default))return new di(0,0,0,0);switch(t.type){case"color":return di.parse(t.default)||null;case"padding":return yi.parse(t.default)||null;case"numberArray":return vi.parse(t.default)||null;case"colorArray":return wi.parse(t.default)||null;case"variableAnchorOffsetCollection":return Di.parse(t.default)||null;case"projectionDefinition":return Ei.parse(t.default)||null;default:return void 0===t.default?null:t.default}}function Vn(t,e){let{zoom:i,heatmapDensity:r,elevation:n,lineProgress:s,isSupportedScript:o,accumulated:a}=t??{};return{zoom:i,heatmapDensity:r,elevation:n,lineProgress:s,isSupportedScript:o,accumulated:a,globalState:e}}function Zn(t){if("boolean"==typeof t)return"neutral";if(!Array.isArray(t)||0===t.length)return"legacy";switch(t[0]){case"has":return t.length<2||"$id"===t[1]||"$type"===t[1]?"legacy":2===t.length?"neutral":"expression";case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]))?"expression":"legacy";case"!in":case"!has":case"none":return"legacy";case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2])?"expression":"legacy";case"any":case"all":return function(t){let e=!1;for(let i of t){let t=Zn(i);if("expression"===t)return"expression";"legacy"===t&&(e=!0)}return e?"legacy":"neutral"}(t.slice(1));default:return"expression"}}function Wn(t){return"legacy"!==Zn(t)}function Hn(t){return"$type"===t?["geometry-type"]:"$id"===t?["id"]:["get",t]}function Yn(t){if(("<"===t[0]||"<="===t[0]||">"===t[0]||">="===t[0])&&"$type"===t[1])return`"$type" cannot be use with operator "${t[0]}"`;let e=function(t){switch(t[0]){case"==":case"!=":case"<":case"<=":case">":case">=":return 3!==t.length||"string"!=typeof t[1]?null:[t[0],Hn(t[1]),t[2]];case"in":case"!in":{if(t.length<2||"string"!=typeof t[1])return null;let e=["in",Hn(t[1]),["literal",t.slice(2)]];return"!in"===t[0]?["!",e]:e}case"has":case"!has":{if(2!==t.length||"string"!=typeof t[1]||"$type"===t[1]||"$id"===t[1])return null;let e=["has",t[1]];return"!has"===t[0]?["!",e]:e}default:return null}}(t);return e?`Mixing deprecated filter syntax with expression syntax is not supported. Replace ${JSON.stringify(t)} with ${JSON.stringify(e)}.`:`Mixing deprecated filter syntax with expression syntax is not supported. Convert ${JSON.stringify(t)} to expression syntax.`}function Xn(t,e,i){let r=i[t];return Array.isArray(r)?Wn(r)?Jn(r,e.concat(t)):{path:e.concat(t),legacyFilter:r}:null}function Jn(t,e=[]){if(!Array.isArray(t)||t.length<1)return null;switch(t[0]){case"all":case"any":case"none":for(let i=1;i<t.length;i++){let r=Xn(i,e,t);if(r)return r}break;case"!":{let i=Xn(1,e,t);if(i)return i;break}case"case":for(let i=1;i<t.length-1;i+=2){let r=Xn(i,e,t);if(r)return r}}return null}const Kn={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Qn(t,e,i){if(null==t)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Wn(t)?function(t,e){let i=Jn(t);if(!i||typeof console>"u")return;let r=i.path.map((t=>`[${t}]`)).join("");console.warn(`${e}${r}: ${Yn(i.legacyFilter)}`)}(t,e):t=is(t);let r=Rn(t,e,Kn,i);if("error"===r.result)throw Error(r.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return{filter:(t,e,i)=>r.value.evaluate(t,e,{},i),needGeometry:es(t),getGlobalStateRefs:()=>Gn(r.value.expression)}}function ts(t,e){return t<e?-1:+(t>e)}function es(t){if(!Array.isArray(t))return!1;if("within"===t[0]||"distance"===t[0])return!0;for(let e=1;e<t.length;e++)if(es(t[e]))return!0;return!1}function is(t){if(!t)return!0;let e=t[0];return t.length<=1?"any"!==e:"=="===e?rs(t[1],t[2],"=="):"!="===e?os(rs(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?rs(t[1],t[2],e):"any"===e?function(t){return["any"].concat(t.map(is))}(t.slice(1)):"all"===e?["all"].concat(t.slice(1).map(is)):"none"===e?["all"].concat(t.slice(1).map(is).map(os)):"in"===e?ns(t[1],t.slice(2)):"!in"===e?os(ns(t[1],t.slice(2))):"has"===e?ss(t[1]):"!has"!==e||os(ss(t[1]))}function rs(t,e,i){switch(t){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,t,e]}}function ns(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((t=>typeof t!=typeof e[0]))?["filter-in-large",t,["literal",e.sort(ts)]]:["filter-in-small",t,["literal",e]]}}function ss(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function os(t){return["!",t]}function as(t){let e=t.value;return e?[new xe(t.key,e,"constants have been deprecated as of v8")]:[]}function ls(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function hs(t){if(Array.isArray(t))return t.map(hs);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){let e={};for(let i in t)e[i]=hs(t[i]);return e}return ls(t)}function us(t){let e=t.key,i=t.value,r=t.valueSpec||{},n=t.objectElementValidators||{},s=t.style,o=t.styleSpec,a=t.validateSpec,l=[],h=xn(i);if("object"!==h)return[new xe(e,i,`object expected, ${h} found`)];for(let t in i){let h,u=t.split(".")[0],c=oi(r,u)||r["*"];if(oi(n,u))h=n[u];else if(oi(r,u)){if(void 0===i[t])continue;h=a}else if(n["*"])h=n["*"];else{if(!r["*"]){l.push(new xe(e,i[t],`unknown property "${t}"`));continue}h=a}l=l.concat(h({key:(e&&`${e}.`)+t,value:i[t],valueSpec:c,style:s,styleSpec:o,object:i,objectKey:t,validateSpec:a},i))}for(let t in r)n[t]||r[t].required&&void 0===r[t].default&&void 0===i[t]&&l.push(new xe(e,i,`missing required property "${t}"`));return l}function cs(t){let e=t.value,i=t.valueSpec,r=t.style,n=t.styleSpec,s=t.key,o=t.arrayElementValidator||t.validateSpec;if("array"!==xn(e))return[new xe(s,e,`array expected, ${xn(e)} found`)];if(i.length&&e.length!==i.length)return[new xe(s,e,`array length ${i.length} expected, length ${e.length} found`)];let a={type:i.value,values:i.values};n.$version<7&&(a.function=i.function),"object"===xn(i.value)&&(a=i.value);let l=[];for(let i=0;i<e.length;i++)l=l.concat(o({array:e,arrayIndex:i,value:e[i],valueSpec:a,validateSpec:t.validateSpec,style:r,styleSpec:n,key:`${s}[${i}]`}));return l}function fs(t){let e=t.key,i=t.value,r=t.valueSpec,n=xn(i);return"number"===n&&i!=i&&(n="NaN"),"number"===n?"minimum"in r&&i<r.minimum?[new xe(e,i,`${i} is less than the minimum value ${r.minimum}`)]:"maximum"in r&&i>r.maximum?[new xe(e,i,`${i} is greater than the maximum value ${r.maximum}`)]:[]:[new xe(e,i,`number expected, ${n} found`)]}function ps(t){let e,i,r,n=t.valueSpec,s=ls(t.value.type),o={},a="categorical"!==s&&void 0===t.value.property,l=!a,h="array"===xn(t.value.stops)&&"array"===xn(t.value.stops[0])&&"object"===xn(t.value.stops[0][0]),u=us({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===s)return[new xe(t.key,t.value,'identity function may not have a "stops" property')];let e=[],i=t.value;return e=e.concat(cs({key:t.key,value:i,valueSpec:t.valueSpec,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:c})),"array"===xn(i)&&0===i.length&&e.push(new xe(t.key,i,"array must have at least one stop")),e},default:function(t){return t.validateSpec({key:t.key,value:t.value,valueSpec:n,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===s&&a&&u.push(new xe(t.key,t.value,'missing required property "property"')),"identity"!==s&&!t.value.stops&&u.push(new xe(t.key,t.value,'missing required property "stops"')),"exponential"===s&&t.valueSpec.expression&&!vn(t.valueSpec)&&u.push(new xe(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!gn(t.valueSpec)?u.push(new xe(t.key,t.value,"property functions not supported")):a&&!yn(t.valueSpec)&&u.push(new xe(t.key,t.value,"zoom functions not supported"))),("categorical"===s||h)&&void 0===t.value.property&&u.push(new xe(t.key,t.value,'"property" property is required')),u;function c(t){let e=[],s=t.value,a=t.key;if("array"!==xn(s))return[new xe(a,s,`array expected, ${xn(s)} found`)];if(2!==s.length)return[new xe(a,s,`array length 2 expected, length ${s.length} found`)];if(h){if("object"!==xn(s[0]))return[new xe(a,s,`object expected, ${xn(s[0])} found`)];if(void 0===s[0].zoom)return[new xe(a,s,"object stop key must have zoom")];if(void 0===s[0].value)return[new xe(a,s,"object stop key must have value")];if(r&&r>ls(s[0].zoom))return[new xe(a,s[0].zoom,"stop zoom values must appear in ascending order")];ls(s[0].zoom)!==r&&(r=ls(s[0].zoom),i=void 0,o={}),e=e.concat(us({key:`${a}[0]`,value:s[0],valueSpec:{zoom:{}},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:fs,value:f}}))}else e=e.concat(f({key:`${a}[0]`,value:s[0]},s));return jn(hs(s[1]))?e.concat([new xe(`${a}[1]`,s[1],"expressions are not allowed in function stops.")]):e.concat(t.validateSpec({key:`${a}[1]`,value:s[1],valueSpec:n,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec}))}function f(t,r){let a=xn(t.value),l=ls(t.value),h=null===t.value?r:t.value;if(e){if(a!==e)return[new xe(t.key,h,`${a} stop domain type must match previous stop domain type ${e}`)]}else e=a;if("number"!==a&&"string"!==a&&"boolean"!==a)return[new xe(t.key,h,"stop domain value must be a number, string, or boolean")];if("number"!==a&&"categorical"!==s){let e=`number expected, ${a} found`;return gn(n)&&void 0===s&&(e+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new xe(t.key,h,e)]}return"categorical"!==s||"number"!==a||isFinite(l)&&Math.floor(l)===l?"categorical"!==s&&"number"===a&&void 0!==i&&l<i?[new xe(t.key,h,"stop domain values must appear in ascending order")]:(i=l,"categorical"===s&&l in o?[new xe(t.key,h,"stop domain values must be unique")]:(o[l]=!0,[])):[new xe(t.key,h,`integer expected, found ${l}`)]}}function ds(t){let e=("property"===t.expressionContext?Ln:Rn)(hs(t.value),t.key,t.valueSpec);if("error"===e.result)return e.value.map((e=>new xe(`${t.key}${e.key}`,t.value,e.message)));let i=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!i.outputDefined())return[new xe(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!mn(i))return[new xe(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!mn(i))return[new xe(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!_n(i,["zoom","feature-state"]))return[new xe(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!dn(i))return[new xe(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ms(t){let e=t.key,i=t.value,r=xn(i);return"string"===r?di.parse(String(i))?[]:[new xe(e,i,`color expected, "${i}" found`)]:[new xe(e,i,`color expected, ${r} found`)]}function _s(t){let e=t.key,i=t.value,r=t.valueSpec,n=[];return Array.isArray(r.values)?-1===r.values.indexOf(ls(i))&&n.push(new xe(e,i,`expected one of [${r.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(r.values).indexOf(ls(i))&&n.push(new xe(e,i,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(i)} found`)),n}function gs(t,e){let i=t;for(let t of e)i=i[t];return i}function ys(t,e){let i=Jn(e);return i?[new xe(`${t.key}${i.path.map((t=>`[${t}]`)).join("")}`,gs(t.value,i.path),Yn(i.legacyFilter),null,"warning")]:[]}function vs(t){let e=hs(t.value);return Wn(e)?[...ys(t,e),...ds(bn({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}}))]:ws(t)}function ws(t){let e=t.value,i=t.key;if("array"!==xn(e))return[new xe(i,e,`array expected, ${xn(e)} found`)];let r,n=t.styleSpec,s=[];if(e.length<1)return[new xe(i,e,"filter array must have at least 1 element")];switch(s=s.concat(_s({key:`${i}[0]`,value:e[0],valueSpec:n.filter_operator})),ls(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===ls(e[1])&&s.push(new xe(i,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&s.push(new xe(i,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(r=xn(e[1]),"string"!==r&&s.push(new xe(`${i}[1]`,e[1],`string expected, ${r} found`)));for(let t=2;t<e.length;t++)r=xn(e[t]),"$type"===ls(e[1])?s=s.concat(_s({key:`${i}[${t}]`,value:e[t],valueSpec:n.geometry_type})):"string"!==r&&"number"!==r&&"boolean"!==r&&s.push(new xe(`${i}[${t}]`,e[t],`string, number, or boolean expected, ${r} found`));break;case"any":case"all":case"none":for(let r=1;r<e.length;r++)s=s.concat(ws({key:`${i}[${r}]`,value:e[r],styleSpec:t.styleSpec}));break;case"has":case"!has":r=xn(e[1]),2===e.length?"string"!==r&&s.push(new xe(`${i}[1]`,e[1],`string expected, ${r} found`)):s.push(new xe(i,e,`filter array for "${e[0]}" operator must have 2 elements`))}return s}function bs(t,e){let i=t.key,r=t.validateSpec,n=t.style,s=t.styleSpec,o=t.value,a=t.objectKey,l=s[`${e}_${t.layerType}`];if(!l)return[];let h=a.match(wn);if("paint"===e&&h&&l[h[1]]&&l[h[1]].transition)return r({key:i,value:o,valueSpec:s.transition,style:n,styleSpec:s});let u,c=t.valueSpec||l[a];if(!c)return[new xe(i,o,`unknown property "${a}"`)];if("string"===xn(o)&&gn(c)&&!c.tokens&&(u=/^{([^}]+)}$/.exec(o)))return[new xe(i,o,`"${a}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(u[1])} }\`.`)];let f=[];return"symbol"===t.layerType&&"text-font"===a&&Dn(hs(o))&&"identity"===ls(o.type)&&f.push(new xe(i,o,'"text-font" does not support identity functions')),f.concat(r({key:t.key,value:o,valueSpec:c,style:n,styleSpec:s,expressionContext:"property",propertyType:e,propertyKey:a}))}function xs(t){return bs(t,"paint")}function Ds(t){return bs(t,"layout")}function Ms(t){let e=[],i=t.value,r=t.key,n=t.style,s=t.styleSpec;if("object"!==xn(i))return[new xe(r,i,`object expected, ${xn(i)} found`)];!i.type&&!i.ref&&e.push(new xe(r,i,'either "type" or "ref" is required'));let o=ls(i.type),a=ls(i.ref);if(i.id){let s=ls(i.id);for(let o=0;o<t.arrayIndex;o++){let t=n.layers[o];ls(t.id)===s&&e.push(new xe(r,i.id,`duplicate layer id "${i.id}", previously used at line ${t.id.__line__}`))}}if("ref"in i){let t;["type","source","source-layer","filter","layout"].forEach((t=>{t in i&&e.push(new xe(r,i[t],`"${t}" is prohibited for ref layers`))})),n.layers.forEach((e=>{ls(e.id)===a&&(t=e)})),t?t.ref?e.push(new xe(r,i.ref,"ref cannot reference another ref layer")):o=ls(t.type):e.push(new xe(r,i.ref,`ref layer "${a}" not found`))}else if("background"!==o)if(i.source){let t=n.sources&&n.sources[i.source],s=t&&ls(t.type);t?"vector"===s&&"raster"===o?e.push(new xe(r,i.source,`layer "${i.id}" requires a raster source`)):"raster-dem"!==s&&"hillshade"===o||"raster-dem"!==s&&"color-relief"===o?e.push(new xe(r,i.source,`layer "${i.id}" requires a raster-dem source`)):"raster"===s&&"raster"!==o?e.push(new xe(r,i.source,`layer "${i.id}" requires a vector source`)):"vector"!==s||i["source-layer"]?"raster-dem"===s&&"hillshade"!==o&&"color-relief"!==o?e.push(new xe(r,i.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):"line"===o&&i.paint&&i.paint["line-gradient"]&&("geojson"!==s||!t.lineMetrics)&&e.push(new xe(r,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new xe(r,i,`layer "${i.id}" must specify a "source-layer"`)):e.push(new xe(r,i.source,`source "${i.source}" not found`))}else e.push(new xe(r,i,'missing required property "source"'));return"raster"===o&&i.paint?.resampling&&i.paint?.["raster-resampling"]&&e.push(new xe(r,i.paint,`layer "${i.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),e=e.concat(us({key:r,value:i,valueSpec:s.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":()=>[],type:()=>t.validateSpec({key:`${r}.type`,value:i.type,valueSpec:s.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:i,objectKey:"type"}),filter:vs,layout:t=>us({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>Ds(bn({layerType:o},t))}}),paint:t=>us({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>xs(bn({layerType:o},t))}})}})),e}function Es(t){let e=t.value,i=t.key,r=xn(e);return"string"===r?[]:[new xe(i,e,`string expected, ${r} found`)]}const As={promoteId:function({key:t,value:e}){if("string"===xn(e))return Es({key:t,value:e});{let i=[];for(let r in e)i.push(...Es({key:`${t}.${r}`,value:e[r]}));return i}}};function Fs(t){let e=t.value,i=t.key,r=t.styleSpec,n=t.style,s=t.validateSpec;if(!e.type)return[new xe(i,e,'"type" is required')];let o,a=ls(e.type);switch(a){case"vector":case"raster":return o=us({key:i,value:e,valueSpec:r[`source_${a.replace("-","_")}`],style:t.style,styleSpec:r,objectElementValidators:As,validateSpec:s}),o;case"raster-dem":return o=function(t){let e=t.sourceName??"",i=t.value,r=t.styleSpec,n=r.source_raster_dem,s=t.style,o=[],a=xn(i);if(void 0===i)return o;if("object"!==a)return o.push(new xe("source_raster_dem",i,`object expected, ${a} found`)),o;let l="custom"===ls(i.encoding),h=["redFactor","greenFactor","blueFactor","baseShift"],u=t.value.encoding?`"${t.value.encoding}"`:"Default";for(let a in i)!l&&h.includes(a)?o.push(new xe(a,i[a],`In "${e}": "${a}" is only valid when "encoding" is set to "custom". ${u} encoding found`)):n[a]?o=o.concat(t.validateSpec({key:a,value:i[a],valueSpec:n[a],validateSpec:t.validateSpec,style:s,styleSpec:r})):o.push(new xe(a,i[a],`unknown property "${a}"`));return o}({sourceName:i,value:e,style:t.style,styleSpec:r,validateSpec:s}),o;case"geojson":if(o=us({key:i,value:e,valueSpec:r.source_geojson,style:n,styleSpec:r,validateSpec:s,objectElementValidators:As}),e.cluster)for(let t in e.clusterProperties){let[r,n]=e.clusterProperties[t],s="string"==typeof r?[r,["accumulated"],["get",t]]:r;o.push(...ds({key:`${i}.${t}.map`,value:n,expressionContext:"cluster-map"})),o.push(...ds({key:`${i}.${t}.reduce`,value:s,expressionContext:"cluster-reduce"}))}return o;case"video":return us({key:i,value:e,valueSpec:r.source_video,style:n,validateSpec:s,styleSpec:r});case"image":return us({key:i,value:e,valueSpec:r.source_image,style:n,validateSpec:s,styleSpec:r});case"canvas":return[new xe(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return _s({key:`${i}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function zs(t){let e=t.value,i=t.styleSpec,r=i.light,n=t.style,s=[],o=xn(e);if(void 0===e)return s;if("object"!==o)return s=s.concat([new xe("light",e,`object expected, ${o} found`)]),s;for(let o in e){let a=o.match(wn);s=s.concat(a&&r[a[1]]&&r[a[1]].transition?t.validateSpec({key:o,value:e[o],valueSpec:i.transition,validateSpec:t.validateSpec,style:n,styleSpec:i}):r[o]?t.validateSpec({key:o,value:e[o],valueSpec:r[o],validateSpec:t.validateSpec,style:n,styleSpec:i}):[new xe(o,e[o],`unknown property "${o}"`)])}return s}function Ss(t){let e=t.value,i=t.styleSpec,r=i.sky,n=t.style,s=xn(e);if(void 0===e)return[];if("object"!==s)return[new xe("sky",e,`object expected, ${s} found`)];let o=[];for(let s in e){let a=s.match(wn);o=o.concat(a&&r[a[1]]&&r[a[1]].transition?t.validateSpec({key:s,value:e[s],valueSpec:i.transition,style:n,styleSpec:i}):r[s]?t.validateSpec({key:s,value:e[s],valueSpec:r[s],style:n,styleSpec:i}):[new xe(s,e[s],`unknown property "${s}"`)])}return o}function Cs(t){let e=t.value,i=t.styleSpec,r=i.terrain,n=t.style,s=[],o=xn(e);if(void 0===e)return s;if("object"!==o)return s=s.concat([new xe("terrain",e,`object expected, ${o} found`)]),s;for(let o in e)s=s.concat(r[o]?t.validateSpec({key:o,value:e[o],valueSpec:r[o],validateSpec:t.validateSpec,style:n,styleSpec:i}):[new xe(o,e[o],`unknown property "${o}"`)]);return s}function Ts(t){let e=[],i=t.value,r=t.key;if(Array.isArray(i)){let n=[],s=[];for(let o in i)i[o].id&&n.includes(i[o].id)&&e.push(new xe(r,i,`all the sprites' ids must be unique, but ${i[o].id} is duplicated`)),n.push(i[o].id),i[o].url&&s.includes(i[o].url)&&e.push(new xe(r,i,`all the sprites' URLs must be unique, but ${i[o].url} is duplicated`)),s.push(i[o].url),e=e.concat(us({key:`${r}[${o}]`,value:i[o],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:t.validateSpec}));return e}return Es({key:r,value:i})}function Ps(t){return!!t&&t.constructor===Object}function Is(t){return Ps(t.value)?[]:[new xe(t.key,t.value,`object expected, ${xn(t.value)} found`)]}const ks=1114111,$s=/^u\+(?:([0-9a-f]{1,6})(?:-([0-9a-f]{1,6}))?|([0-9a-f]{0,5}\?{1,6}))$/i;function js(t,e){if("string"!==xn(e))return[];let i=`${e}`,r=()=>[new xe(t,e,'invalid unicode range, expected a value such as "U+26", "U+0-10FFFF" or "U+4??"')],n=i.match($s);if(!n)return r();let[,s,o,a]=n;if(void 0!==a)return a.length>6?r():[];let l=parseInt(s,16),h=void 0===o?l:parseInt(o,16);return l>ks||h>ks?[new xe(t,e,"unicode range is out of bounds, the maximum code point is U+10FFFF")]:l>h?[new xe(t,e,`unicode range start must not be greater than its end, but ${i} is`)]:[]}function Rs(t){let e=t.key??"font-faces",i=t.value,r=t.validateSpec,n=t.styleSpec??ve,s=t.style;if(!Ps(i))return[new xe(e,i,`object expected, ${xn(i)} found`)];let o=[];for(let t in i){let a=i[t],l=xn(a);if("string"===l)o.push(...Es({key:`${e}.${t}`,value:a}));else if("array"===l){let i={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(let[l,h]of a.entries()){let a=`${e}.${t}[${l}]`;o.push(...us({key:a,value:h,valueSpec:i,styleSpec:n,style:s,validateSpec:r}));let u=Ps(h)?h["unicode-range"]:void 0;if("array"===xn(u))for(let[t,e]of u.entries())o.push(...js(`${a}.unicode-range[${t}]`,e))}}else o.push(new xe(`${e}.${t}`,a,`string or array expected, ${l} found`))}return o}const Os={"*":()=>[],array:cs,boolean:function(t){let e=t.value,i=t.key,r=xn(e);return"boolean"===r?[]:[new xe(i,e,`boolean expected, ${r} found`)]},number:fs,color:ms,constants:as,enum:_s,filter:vs,function:ps,layer:Ms,object:us,source:Fs,light:zs,sky:Ss,terrain:Cs,projection:function(t){let e=t.value,i=t.styleSpec,r=i.projection,n=t.style,s=xn(e);if(void 0===e)return[];if("object"!==s)return[new xe("projection",e,`object expected, ${s} found`)];let o=[];for(let s in e)o=o.concat(r[s]?t.validateSpec({key:s,value:e[s],valueSpec:r[s],style:n,styleSpec:i}):[new xe(s,e[s],`unknown property "${s}"`)]);return o},projectionDefinition:function(t){let e=t.key,i=t.value;i=i instanceof String?i.valueOf():i;let r=xn(i);return"array"!==r||function(t){return Array.isArray(t)&&3===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]&&"number"==typeof t[2]}(i)||function(t){return!!["interpolate","step","literal"].includes(t[0])}(i)?["array","string"].includes(r)?[]:[new xe(e,i,`projection expected, invalid type "${r}" found`)]:[new xe(e,i,`projection expected, invalid array ${JSON.stringify(i)} found`)]},string:Es,formatted:function(t){return 0===Es(t).length?[]:ds(t)},resolvedImage:function(t){return 0===Es(t).length?[]:ds(t)},padding:function(t){let e=t.key,i=t.value;if("array"===xn(i)){if(i.length<1||i.length>4)return[new xe(e,i,`padding requires 1 to 4 values; ${i.length} values found`)];let r={type:"number"},n=[];for(let s=0;s<i.length;s++)n=n.concat(t.validateSpec({key:`${e}[${s}]`,value:i[s],validateSpec:t.validateSpec,valueSpec:r}));return n}return fs({key:e,value:i,valueSpec:{}})},numberArray:function(t){let e=t.key,i=t.value;if("array"===xn(i)){let r={type:"number"};if(i.length<1)return[new xe(e,i,"array length at least 1 expected, length 0 found")];let n=[];for(let s=0;s<i.length;s++)n=n.concat(t.validateSpec({key:`${e}[${s}]`,value:i[s],validateSpec:t.validateSpec,valueSpec:r}));return n}return fs({key:e,value:i,valueSpec:{}})},colorArray:function(t){let e=t.key,i=t.value;if("array"===xn(i)){if(i.length<1)return[new xe(e,i,"array length at least 1 expected, length 0 found")];let t=[];for(let r=0;r<i.length;r++)t=t.concat(ms({key:`${e}[${r}]`,value:i[r]}));return t}return ms({key:e,value:i})},variableAnchorOffsetCollection:function(t){let e=t.key,i=t.value,r=xn(i),n=t.styleSpec;if("array"!==r||i.length<1||i.length%2!=0)return[new xe(e,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let s=[];for(let r=0;r<i.length;r+=2)s=s.concat(_s({key:`${e}[${r}]`,value:i[r],valueSpec:n.layout_symbol["text-anchor"]})),s=s.concat(cs({key:`${e}[${r+1}]`,value:i[r+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:n}));return s},sprite:Ts,state:Is,fontFaces:Rs};function Bs(t){let e=t.value,i=t.valueSpec,r=t.styleSpec;return t.validateSpec=Bs,i.expression&&Dn(ls(e))?ps(t):i.expression&&jn(hs(e))?ds(t):i.type&&Os[i.type]?Os[i.type](t):us(bn({},t,{valueSpec:i.type?r[i.type]:i}))}function Ls(t){let e=t.value,i=t.key,r=Es(t);return r.length||(-1===e.indexOf("{fontstack}")&&r.push(new xe(i,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&r.push(new xe(i,e,'"glyphs" url must include a "{range}" token'))),r}function Us(t,e=we){let i=[];return i=i.concat(Bs({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:Bs,objectElementValidators:{glyphs:Ls,"*":()=>[]}})),t.constants&&(i=i.concat(as({key:"constants",value:t.constants}))),Gs(i)}function Ns(t){return function(e){return t(Object.assign({},e,{validateSpec:Bs}))}}function Gs(t){return[].concat(t).sort(((t,e)=>t.line-e.line))}function qs(t){return function(...e){return Gs(t.apply(this,e))}}Us.source=qs(Ns(Fs)),Us.sprite=qs(Ns(Ts)),Us.glyphs=qs(Ns(Ls)),Us.fontFaces=qs(Ns(Rs)),Us.light=qs(Ns(zs)),Us.sky=qs(Ns(Ss)),Us.terrain=qs(Ns(Cs)),Us.state=qs(Ns(Is)),Us.layer=qs(Ns(Ms)),Us.filter=qs(Ns(vs)),Us.paintProperty=qs(Ns(xs)),Us.layoutProperty=qs(Ns(Ds));const Vs={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};var Zs=class{constructor(t,e,i){this._rootKey=e,this._globalState=i,this.setValue(t)}evaluate(){return this._literalValue??this._compiledValue.evaluate({})}setValue(t){if(null==t||"visible"===t||"none"===t)return this._literalValue="none"===t?"none":"visible",this._compiledValue=void 0,void(this._globalStateRefs=new Set);let e=Rn(t,this._rootKey,Vs,this._globalState);if("error"===e.result)throw this._literalValue="visible",this._compiledValue=void 0,Error(e.value.map((t=>`${t.key}: ${t.message}`)).join(", "));this._literalValue=void 0,this._compiledValue=e.value,this._globalStateRefs=Gn(e.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}};const Ws=Us,Hs=new Set(Object.keys(we).filter((t=>t.startsWith("source_"))).map((t=>t.slice(7).replaceAll("_","-"))));function Ys(t,e){let i=function(t){return Object.entries(t.sources??{}).filter((([,t])=>!Hs.has(t.type))).map((([t])=>`sources.${t}`))}(e);return Xs(t,Ws(e).filter((({message:t})=>!i.some((e=>t.startsWith(`${e}:`)||t.startsWith(`${e}.`))))))}function Xs(t,e){let i=!1;for(let r of e)"warning"!==r.severity?(t.fire(new ge(Error(r.message))),i=!0):Rt(r.message);return i}function Js(t,e,i,r){return!1!==r?.validate&&Xs(t,e({styleSpec:we,...i}))}var Ks=class t{constructor(t,e,i){let r=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;let n=new Int32Array(this.arrayBuffer);t=n[0],this.d=(e=n[1])+2*(i=n[2]);for(let t=0;t<this.d*this.d;t++){let e=n[3+t],i=n[3+t+1];r.push(e===i?null:n.subarray(e,i))}let s=n[3+r.length+1];this.keys=n.subarray(n[3+r.length],s),this.bboxes=n.subarray(s),this.insert=this._insertReadonly}else{this.d=e+2*i;for(let t=0;t<this.d*this.d;t++)r.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=i,this.scale=e/t,this.uid=0;let n=i/e*t;this.min=-n,this.max=t+n}insert(t,e,i,r,n){this._forEachCell(e,i,r,n,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)}_insertReadonly(){throw Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,e,i,r,n,s){this.cells[n].push(s)}query(t,e,i,r,n){let s=this.min,o=this.max;if(t<=s&&e<=s&&o<=i&&o<=r&&!n)return[...this.keys];{let s=[];return this._forEachCell(t,e,i,r,this._queryCell,s,{},n),s}}_queryCell(t,e,i,r,n,s,o,a){let l=this.cells[n];if(null!==l){let n=this.keys,h=this.bboxes;for(let u of l)if(void 0===o[u]){let l=4*u;(a?a(h[l+0],h[l+1],h[l+2],h[l+3]):t<=h[l+2]&&e<=h[l+3]&&i>=h[l+0]&&r>=h[l+1])?(o[u]=!0,s.push(n[u])):o[u]=!1}}}_forEachCell(t,e,i,r,n,s,o,a){let l=this._convertToCellCoord(t),h=this._convertToCellCoord(e),u=this._convertToCellCoord(i),c=this._convertToCellCoord(r);for(let f=l;f<=u;f++)for(let l=h;l<=c;l++){let h=this.d*l+f;if((!a||a(this._convertFromCellCoord(f),this._convertFromCellCoord(l),this._convertFromCellCoord(f+1),this._convertFromCellCoord(l+1)))&&n.call(this,t,e,i,r,h,s,o,a))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let t=this.cells,e=3+this.cells.length+1+1,i=0;for(let t of this.cells)i+=t.length;let r=new Int32Array(e+i+this.keys.length+this.bboxes.length);r[0]=this.extent,r[1]=this.n,r[2]=this.padding;let n=e;for(let e=0;e<t.length;e++){let i=t[e];r[3+e]=n,r.set(i,n),n+=i.length}return r[3+t.length]=n,r.set(this.keys,n),n+=this.keys.length,r[3+t.length+1]=n,r.set(this.bboxes,n),n+=this.bboxes.length,r.buffer}static serialize(t,e){let i=t.toArrayBuffer();return e&&e.push(i),{buffer:i}}static deserialize(e){return new t(e.buffer)}};const Qs={};function to(t,e,i={}){if(Qs[t])throw Error(`${t} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),Qs[t]={klass:e,omit:i.omit||[],shallow:i.shallow||[]}}to("Object",Object),to("Set",Set),to("TransferableGridIndex",Ks),to("Color",di),to("Error",Error),to("AJAXError",le),to("ResolvedImage",Mi),to("StylePropertyFunction",Un),to("StyleExpression",In,{omit:["_evaluator"]}),to("ZoomDependentExpression",Bn),to("ZoomConstantExpression",On),to("CompoundExpression",ln,{omit:["_evaluate"]});for(let t in nn)nn[t]._classRegistryKey||to(`Expression_${t}`,nn[t]);function eo(t){return t&&typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||"ArrayBuffer"===t.constructor?.name)}function io(t){return t.$name||t.constructor._classRegistryKey}function ro(t){return!function(t){if("object"!=typeof t||!t)return!1;let e=io(t);return e&&"Object"!==e}(t)&&(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||t instanceof Error||eo(t)||Nt(t)||ArrayBuffer.isView(t)||t instanceof ImageData)}function no(t,e){if(ro(t))return(eo(t)||Nt(t))&&e&&e.push(t),ArrayBuffer.isView(t)&&e&&e.push(t.buffer),t instanceof ImageData&&e&&e.push(t.data.buffer),t;if(Array.isArray(t)){let i=[];for(let r of t)i.push(no(r,e));return i}if("object"!=typeof t)throw Error("can't serialize object of type "+typeof t);let i=io(t);if(!i)throw Error(`can't serialize object of unregistered class ${t.constructor.name}`);if(!Qs[i])throw Error(`${i} is not registered.`);let{klass:r}=Qs[i],n=r.serialize?r.serialize(t,e):{};if(r.serialize){if(n===e?.[e.length-1])throw Error("statically serialized object won't survive transfer of $name property")}else{for(let r in t){if(!t.hasOwnProperty(r)||Qs[i].omit.includes(r))continue;let s=t[r];void 0!==s&&(n[r]=Qs[i].shallow.includes(r)?s:no(s,e))}t instanceof Error&&(n.message=t.message)}if(n.$name)throw Error("$name property is reserved for worker serialization logic.");return"Object"!==i&&(n.$name=i),n}function so(t){if(ro(t))return t;if(Array.isArray(t))return t.map(so);if("object"!=typeof t)throw Error("can't deserialize object of type "+typeof t);let e=io(t)||"Object";if(!Qs[e])throw Error(`can't deserialize unregistered class ${e}`);let{klass:i}=Qs[e];if(!i)throw Error(`can't deserialize unregistered class ${e}`);if(i.deserialize)return i.deserialize(t);let r=Object.create(i.prototype);for(let i of Object.keys(t)){if("$name"===i)continue;let n=t[i];r[i]=Qs[e].shallow.includes(i)?n:so(n)}return r}var oo=class{constructor(){this.first=!0}update(t,e){let i=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=i,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=i,!0):(this.lastFloorZoom>i?(this.lastIntegerZoom=i+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<i&&(this.lastIntegerZoom=i,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=i,!0))}},ao=class{constructor(t,e){this.zoom=t,e?(this.now=e.now||0,this.fadeDuration=e.fadeDuration||0,this.zoomHistory=e.zoomHistory||new oo,this.transition=e.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new oo,this.transition={})}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let t=this.zoom,e=t-Math.floor(t),i=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*i}:{fromScale:.5,toScale:1,t:1-(1-i)*e}}},lo=class{constructor(t,e,i,r){this.property=t,this.value=e,this.expression=function(t,e,i,r){if(Dn(t))return new Un(t,e,i);if(jn(t)){let n=Ln(t,e,i,r);if("error"===n.result)throw Error(n.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return n.value}{let e=t;return"color"===i.type&&"string"==typeof t?e=di.parse(t):"padding"!==i.type||"number"!=typeof t&&!Array.isArray(t)?"numberArray"!==i.type||"number"!=typeof t&&!Array.isArray(t)?"colorArray"!==i.type||"string"!=typeof t&&!Array.isArray(t)?"variableAnchorOffsetCollection"===i.type&&Array.isArray(t)?e=Di.parse(t):"projectionDefinition"===i.type&&"string"==typeof t&&(e=Ei.parse(t)):e=wi.parse(t):e=vi.parse(t):e=yi.parse(t),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>e}}}(void 0===e?t.specification.default:e,i,t.specification,r)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(t,e,i){return this.property.possiblyEvaluate(this,t,e,i)}},ho=class{constructor(t,e,i){this.property=t,this.value=new lo(t,void 0,e,i)}transitioned(t,e){return e.value===this.value?e:new co(this.property,this.value,e,Et({},t.transition,this.transition),t.now)}untransitioned(){return new co(this.property,this.value,null,{},0)}},uo=class{constructor(t,e,i){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues),this._globalState=i,this._rootKey=e}_propertyRootKey(t){return`${this._rootKey}.${String(t)}`}hasProperty(t){return t in this._properties.defaultTransitionablePropertyValues}getValue(t){return $t(this._values[t].value.value)}setValue(t,e){Object.hasOwn(this._values,t)||(this._values[t]=new ho(this._values[t].property,this._propertyRootKey(t),this._globalState)),this._values[t].value=new lo(this._values[t].property,null===e?void 0:$t(e),this._propertyRootKey(t),this._globalState)}setValues(t){for(let e in t){let i=t[e];e.endsWith("-transition")?this.setTransition(e.slice(0,-11),i):kt(this._values[e].value.value,i)||this.setValue(e,i)}}getTransition(t){return $t(this._values[t].transition)}setTransition(t,e){Object.hasOwn(this._values,t)||(this._values[t]=new ho(this._values[t].property,this._propertyRootKey(t),this._globalState)),this._values[t].transition=$t(e)||void 0}serialize(){let t={};for(let e of Object.keys(this._values)){let i=this.getValue(e);void 0!==i&&(t[e]=i);let r=this.getTransition(e);void 0!==r&&(t[`${e}-transition`]=r)}return t}transitioned(t,e){let i=new fo(this._properties);for(let r of Object.keys(this._values))i._values[r]=this._values[r].transitioned(t,e._values[r]);return i}untransitioned(){let t=new fo(this._properties);for(let e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}},co=class{constructor(t,e,i,r,n){this.property=t,this.value=e,this.begin=n+r.delay||0,this.end=this.begin+r.duration||0,t.specification.transition&&(r.delay||r.duration)&&(this.prior=i)}possiblyEvaluate(t,e,i){let r=t.now||0,n=this.value.possiblyEvaluate(t,e,i),s=this.prior;if(!s)return n;if(r>this.end||this.value.isDataDriven())return this.prior=null,n;if(r<this.begin)return s.possiblyEvaluate(t,e,i);{let o=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(s.possiblyEvaluate(t,e,i),n,function(t){if(t<=0)return 0;if(t>=1)return 1;let e=t*t,i=e*t;return 4*(t<.5?i:3*(t-e)+i-.75)}(o))}}},fo=class{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,i){let r=new _o(this._properties);for(let n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(t,e,i);return r}hasTransition(){for(let t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}},po=class{constructor(t,e,i){this._properties=t,this._values=Object.create(t.defaultPropertyValues),this._globalState=i,this._rootKey=e}_propertyRootKey(t){return`${this._rootKey}.${String(t)}`}hasValue(t){return void 0!==this._values[t].value}hasProperty(t){return t in this._properties.defaultPropertyValues}getValue(t){return $t(this._values[t].value)}setValue(t,e){this._values[t]=new lo(this._values[t].property,null===e?void 0:$t(e),this._propertyRootKey(t),this._globalState)}serialize(){let t={};for(let e of Object.keys(this._values)){let i=this.getValue(e);void 0!==i&&(t[e]=i)}return t}possiblyEvaluate(t,e,i){let r=new _o(this._properties);for(let n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(t,e,i);return r}},mo=class{constructor(t,e,i){this.property=t,this.value=e,this.parameters=i}isConstant(){return"constant"===this.value.kind}constantOr(t){return"constant"===this.value.kind?this.value.value:t}evaluate(t,e,i,r){return this.property.evaluate(this.value,this.parameters,t,e,i,r)}},_o=class{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}};function go(t){if(Array.isArray(t))return t.length;let e=t?.values;return Array.isArray(e)?e.length:void 0}function yo(t,e){let i=go(t),r=go(e);return void 0!==i&&void 0!==r&&i!==r}var vo=class{constructor(t,e){this.specification=t,this.name=e}possiblyEvaluate(t,e){if(t.isDataDriven())throw Error("Value should not be data driven");return t.expression.evaluate(e)}interpolate(t,e,i){if(yo(t,e))return Rt(`Property "${this.name}" is trying to interpolate arrays of different lengths. Rendering may 'jump'.`),e;let r=Oi[this.specification.type];return r?r(t,e,i):t}},wo=class{constructor(t,e,i){this.specification=t,this.name=e,this.overrides=i}possiblyEvaluate(t,e,i,r){return new mo(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},i,r)}:t.expression,e)}interpolate(t,e,i){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new mo(this,{kind:"constant",value:void 0},t.parameters);if(yo(t.value.value,e.value.value))return Rt(`Property "${this.name}" is trying to interpolate arrays of different lengths. Rendering may 'jump'.`),e;let r=Oi[this.specification.type];if(r){let n=r(t.value.value,e.value.value,i);return new mo(this,{kind:"constant",value:n},t.parameters)}return t}evaluate(t,e,i,r,n,s){return"constant"===t.kind?t.value:t.evaluate(e,i,r,n,s)}},bo=class extends wo{possiblyEvaluate(t,e,i,r){if(void 0===t.value)return new mo(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){let n=t.expression.evaluate(e,null,{},i,r),s="resolvedImage"===t.property.specification.type&&"string"!=typeof n?n.name:n,o=this._calculate(s,s,s,e);return new mo(this,{kind:"constant",value:o},e)}if("camera"===t.expression.kind){let i=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new mo(this,{kind:"constant",value:i},e)}return new mo(this,t.expression,e)}evaluate(t,e,i,r,n,s){if("source"===t.kind){let o=t.evaluate(e,i,r,n,s);return this._calculate(o,o,o,e)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},i,r),t.evaluate({zoom:Math.floor(e.zoom)},i,r),t.evaluate({zoom:Math.floor(e.zoom)+1},i,r),e):t.value}_calculate(t,e,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}}interpolate(t){return t}},xo=class{constructor(t,e){this.specification=t,this.name=e}possiblyEvaluate(t,e,i,r){if(void 0!==t.value){if("constant"===t.expression.kind){let n=t.expression.evaluate(e,null,{},i,r);return this._calculate(n,n,n,e)}return this._calculate(t.expression.evaluate(new ao(Math.floor(e.zoom-1),e)),t.expression.evaluate(new ao(Math.floor(e.zoom),e)),t.expression.evaluate(new ao(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}}interpolate(t){return t}},Do=class{constructor(t,e){this.specification=t,this.name=e}possiblyEvaluate(t,e,i,r){return!!t.expression.evaluate(e,null,{},i,r)}interpolate(){return!1}},Mo=class{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let e in t){let i=t[e];i.specification.overridable&&this.overridableProperties.push(e);let r=this.defaultPropertyValues[e]=new lo(i,void 0,i.name,void 0),n=this.defaultTransitionablePropertyValues[e]=new ho(i,i.name,void 0);this.defaultTransitioningPropertyValues[e]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=r.possiblyEvaluate({})}}};to("DataDrivenProperty",wo),to("DataConstantProperty",vo),to("CrossFadedDataDrivenProperty",bo),to("CrossFadedProperty",xo),to("ColorRampProperty",Do);const Eo=" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?",Ao=" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?";var Fo=class extends ye{constructor(t,e,i){if(super(),this.id=t.id,this.type=t.type,this._globalState=i,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=function(t,e,i){return new Zs(t,e,i)}(this.visibility,`layers[${this.id}].layout.visibility`,i),"custom"!==t.type&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,"background"!==t.type&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter,this._featureFilter=Qn(t.filter,`layers[${this.id}].filter`,i)),e.layout&&(this._unevaluatedLayout=new po(e.layout,`layers[${this.id}].layout`,i)),e.paint)){this._transitionablePaint=new uo(e.paint,`layers[${this.id}].paint`,i);for(let e in t.paint)this.setPaintProperty(e,t.paint[e],{validate:!1});for(let e in t.layout)this.setLayoutProperty(e,t.layout[e],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new _o(e.paint)}}setFilter(t){this.filter=t,this._featureFilter=Qn(t,`layers[${this.id}].filter`,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){if("visibility"===t)return this.visibility;if(this._transitionablePaint?.hasProperty(t))throw Error(t+Eo);if(!this._unevaluatedLayout)throw Error(`Cannot get layout property "${t}" on layer type "${this.type}" which has no layout properties.`);return this._unevaluatedLayout.getValue(t)}getLayoutAffectingGlobalStateRefs(){let t=new Set;for(let e of this._visibilityExpression.getGlobalStateRefs())t.add(e);if(this._unevaluatedLayout)for(let e in this._unevaluatedLayout._values){let i=this._unevaluatedLayout._values[e];for(let e of i.getGlobalStateRefs())t.add(e)}for(let e of this._featureFilter.getGlobalStateRefs())t.add(e);return t}getPaintAffectingGlobalStateRefs(){let t=new globalThis.Map;if(this._transitionablePaint)for(let e in this._transitionablePaint._values){let i=this._transitionablePaint._values[e].value;for(let r of i.getGlobalStateRefs()){let n=t.get(r)??[];n.push({name:e,value:i.value}),t.set(r,n)}}return t}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(t,e,i={}){if("visibility"===t)return this.visibility=e,this._visibilityExpression.setValue(e),void this.recalculateVisibility();this._transitionablePaint?.hasProperty(t)?this.fire(new ge(Error(t+Eo))):null!=e&&this._validate(Ws.layoutProperty,`layers.${this.id}.layout.${t}`,t,e,i)||this._unevaluatedLayout.setValue(t,e)}getPaintProperty(t){if(t.endsWith("-transition")){let e=t.slice(0,-11);if("visibility"===e||this._unevaluatedLayout?.hasProperty(e))throw Error(t+Ao);return this._transitionablePaint.getTransition(e)}if("visibility"===t||this._unevaluatedLayout?.hasProperty(t))throw Error(t+Ao);return this._transitionablePaint.getValue(t)}setPaintProperty(t,e,i={}){if("visibility"===t||this._unevaluatedLayout?.hasProperty(t))return this.fire(new ge(Error(t+Ao))),!1;if(null!=e&&this._validate(Ws.paintProperty,`layers.${this.id}.paint.${t}`,t,e,i))return!1;if(t.endsWith("-transition"))return this._transitionablePaint.setTransition(t.slice(0,-11),e||void 0),!1;{let i=this._transitionablePaint._values[t],r="cross-faded-data-driven"===i.property.specification["property-type"],n=i.value.isDataDriven(),s=i.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);let o=this._transitionablePaint._values[t].value;return o.isDataDriven()||n||r||this._handleOverridablePaintPropertyUpdate(t,s,o)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,i){return!1}isHidden(t=this.minzoom,e=!1){return!!(this.minzoom&&t<(e?Math.floor(this.minzoom):this.minzoom)||this.maxzoom&&t>=this.maxzoom)||"none"===this._evaluatedVisibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(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)}serialize(){let 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?.serialize(),paint:this._transitionablePaint?.serialize()};return this.visibility&&(t.layout||={},t.layout.visibility=this.visibility),It(t,((t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)))}_validate(t,e,i,r,n={}){return Js(this,t,{key:e,layerType:this.type,objectKey:i,value:r},n)}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let t in this.paint._values){let e=this.paint.get(t);if(e instanceof mo&&gn(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1}};let zo;var So={get paint(){return zo||=new Mo({"raster-opacity":new vo(we.paint_raster["raster-opacity"],"raster-opacity"),"raster-hue-rotate":new vo(we.paint_raster["raster-hue-rotate"],"raster-hue-rotate"),"raster-brightness-min":new vo(we.paint_raster["raster-brightness-min"],"raster-brightness-min"),"raster-brightness-max":new vo(we.paint_raster["raster-brightness-max"],"raster-brightness-max"),"raster-saturation":new vo(we.paint_raster["raster-saturation"],"raster-saturation"),"raster-contrast":new vo(we.paint_raster["raster-contrast"],"raster-contrast"),resampling:new vo(we.paint_raster.resampling,"resampling"),"raster-resampling":new vo(we.paint_raster["raster-resampling"],"raster-resampling"),"raster-fade-duration":new vo(we.paint_raster["raster-fade-duration"],"raster-fade-duration")})}};const Co=t=>"raster"===t.type;var To=class extends Fo{constructor(t,e){super(t,So,e)}};const Po={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};var Io=class{constructor(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}},ko=class{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){let e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw Error("_refreshViews() must be implemented by each concrete StructArray layout")}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}};function $o(t,e=1){let i=0,r=0;return{members:t.map((t=>{let n=function(t){return Po[t].BYTES_PER_ELEMENT}(t.type),s=i=jo(i,Math.max(e,n)),o=t.components||1;return r=Math.max(r,n),i+=n*o,{name:t.name,type:t.type,components:o,offset:s}})),size:jo(i,Math.max(r,e)),alignment:e}}function jo(t,e){return Math.ceil(t/e)*e}var Ro=class extends ko{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){let i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){let r=2*t;return this.int16[r+0]=e,this.int16[r+1]=i,t}};Ro.prototype.bytesPerElement=4,to("StructArrayLayout2i4",Ro);var Oo=class extends ko{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i){let r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){let n=3*t;return this.int16[n+0]=e,this.int16[n+1]=i,this.int16[n+2]=r,t}};Oo.prototype.bytesPerElement=6,to("StructArrayLayout3i6",Oo);var Bo=class extends ko{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r){let n=this.length;return this.resize(n+1),this.emplace(n,t,e,i,r)}emplace(t,e,i,r,n){let s=4*t;return this.int16[s+0]=e,this.int16[s+1]=i,this.int16[s+2]=r,this.int16[s+3]=n,t}};Bo.prototype.bytesPerElement=8,to("StructArrayLayout4i8",Bo);var Lo=class extends ko{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,s){let o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,r,n,s)}emplace(t,e,i,r,n,s,o){let a=6*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.int16[a+2]=r,this.int16[a+3]=n,this.int16[a+4]=s,this.int16[a+5]=o,t}};Lo.prototype.bytesPerElement=12,to("StructArrayLayout2i4i12",Lo);var Uo=class extends ko{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,s){let o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,r,n,s)}emplace(t,e,i,r,n,s,o){let a=4*t,l=8*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.uint8[l+4]=r,this.uint8[l+5]=n,this.uint8[l+6]=s,this.uint8[l+7]=o,t}};Uo.prototype.bytesPerElement=8,to("StructArrayLayout2i4ub8",Uo);var No=class extends ko{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){let i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){let r=2*t;return this.float32[r+0]=e,this.float32[r+1]=i,t}};No.prototype.bytesPerElement=8,to("StructArrayLayout2f8",No);var Go=class extends ko{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,s,o,a,l,h){let u=this.length;return this.resize(u+1),this.emplace(u,t,e,i,r,n,s,o,a,l,h)}emplace(t,e,i,r,n,s,o,a,l,h,u){let c=10*t;return this.uint16[c+0]=e,this.uint16[c+1]=i,this.uint16[c+2]=r,this.uint16[c+3]=n,this.uint16[c+4]=s,this.uint16[c+5]=o,this.uint16[c+6]=a,this.uint16[c+7]=l,this.uint16[c+8]=h,this.uint16[c+9]=u,t}};Go.prototype.bytesPerElement=20,to("StructArrayLayout10ui20",Go);var qo=class extends ko{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,s,o,a){let l=this.length;return this.resize(l+1),this.emplace(l,t,e,i,r,n,s,o,a)}emplace(t,e,i,r,n,s,o,a,l){let h=8*t;return this.uint16[h+0]=e,this.uint16[h+1]=i,this.uint16[h+2]=r,this.uint16[h+3]=n,this.uint16[h+4]=s,this.uint16[h+5]=o,this.uint16[h+6]=a,this.uint16[h+7]=l,t}};qo.prototype.bytesPerElement=16,to("StructArrayLayout8ui16",qo);var Vo=class extends ko{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,s,o,a,l,h,u,c,f){let p=this.length;return this.resize(p+1),this.emplace(p,t,e,i,r,n,s,o,a,l,h,u,c,f)}emplace(t,e,i,r,n,s,o,a,l,h,u,c,f,p){let d=14*t,m=7*t;return this.int16[d+0]=e,this.int16[d+1]=i,this.int16[d+2]=r,this.int16[d+3]=n,this.uint16[d+4]=s,this.uint16[d+5]=o,this.uint16[d+6]=a,this.uint16[d+7]=l,this.int16[d+8]=h,this.int16[d+9]=u,this.int16[d+10]=c,this.int16[d+11]=f,this.float32[m+6]=p,t}};Vo.prototype.bytesPerElement=28,to("StructArrayLayout4i4ui4i1f28",Vo);var Zo=class extends ko{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i){let r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){let n=3*t;return this.float32[n+0]=e,this.float32[n+1]=i,this.float32[n+2]=r,t}};Zo.prototype.bytesPerElement=12,to("StructArrayLayout3f12",Zo);var Wo=class extends ko{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){let e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}};Wo.prototype.bytesPerElement=4,to("StructArrayLayout1ul4",Wo);var Ho=class extends ko{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,s,o,a,l){let h=this.length;return this.resize(h+1),this.emplace(h,t,e,i,r,n,s,o,a,l)}emplace(t,e,i,r,n,s,o,a,l,h){let u=10*t,c=5*t;return this.int16[u+0]=e,this.int16[u+1]=i,this.int16[u+2]=r,this.int16[u+3]=n,this.int16[u+4]=s,this.int16[u+5]=o,this.uint32[c+3]=a,this.uint16[u+8]=l,this.uint16[u+9]=h,t}};Ho.prototype.bytesPerElement=20,to("StructArrayLayout6i1ul2ui20",Ho);var Yo=class extends ko{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,s){let o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,r,n,s)}emplace(t,e,i,r,n,s,o){let a=6*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.int16[a+2]=r,this.int16[a+3]=n,this.int16[a+4]=s,this.int16[a+5]=o,t}};Yo.prototype.bytesPerElement=12,to("StructArrayLayout2i2i2i12",Yo);var Xo=class extends ko{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,i,r,n)}emplace(t,e,i,r,n,s){let o=4*t,a=8*t;return this.float32[o+0]=e,this.float32[o+1]=i,this.float32[o+2]=r,this.int16[a+6]=n,this.int16[a+7]=s,t}};Xo.prototype.bytesPerElement=16,to("StructArrayLayout2f1f2i16",Xo);var Jo=class extends ko{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,s){let o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,r,n,s)}emplace(t,e,i,r,n,s,o){let a=16*t,l=4*t,h=8*t;return this.uint8[a+0]=e,this.uint8[a+1]=i,this.float32[l+1]=r,this.float32[l+2]=n,this.int16[h+6]=s,this.int16[h+7]=o,t}};Jo.prototype.bytesPerElement=16,to("StructArrayLayout2ub2f2i16",Jo);var Ko=class extends ko{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i){let r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){let n=3*t;return this.uint16[n+0]=e,this.uint16[n+1]=i,this.uint16[n+2]=r,t}};Ko.prototype.bytesPerElement=6,to("StructArrayLayout3ui6",Ko);var Qo=class extends ko{_refreshViews(){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)}emplaceBack(t,e,i,r,n,s,o,a,l,h,u,c,f,p,d,m,_,g){let y=this.length;return this.resize(y+1),this.emplace(y,t,e,i,r,n,s,o,a,l,h,u,c,f,p,d,m,_,g)}emplace(t,e,i,r,n,s,o,a,l,h,u,c,f,p,d,m,_,g,y){let v=26*t,w=13*t,b=52*t;return this.int16[v+0]=e,this.int16[v+1]=i,this.uint16[v+2]=r,this.uint16[v+3]=n,this.uint32[w+2]=s,this.uint32[w+3]=o,this.uint32[w+4]=a,this.uint16[v+10]=l,this.uint16[v+11]=h,this.uint16[v+12]=u,this.float32[w+7]=c,this.float32[w+8]=f,this.uint8[b+36]=p,this.uint8[b+37]=d,this.uint8[b+38]=m,this.uint32[w+10]=_,this.int16[v+22]=g,this.float32[w+12]=y,t}};Qo.prototype.bytesPerElement=52,to("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i1f52",Qo);var ta=class extends ko{_refreshViews(){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)}emplaceBack(t,e,i,r,n,s,o,a,l,h,u,c,f,p,d,m,_,g,y,v,w,b,x,D,M,E,A,F,z){let S=this.length;return this.resize(S+1),this.emplace(S,t,e,i,r,n,s,o,a,l,h,u,c,f,p,d,m,_,g,y,v,w,b,x,D,M,E,A,F,z)}emplace(t,e,i,r,n,s,o,a,l,h,u,c,f,p,d,m,_,g,y,v,w,b,x,D,M,E,A,F,z,S){let C=34*t,T=17*t;return this.int16[C+0]=e,this.int16[C+1]=i,this.int16[C+2]=r,this.int16[C+3]=n,this.int16[C+4]=s,this.int16[C+5]=o,this.int16[C+6]=a,this.int16[C+7]=l,this.uint16[C+8]=h,this.uint16[C+9]=u,this.uint16[C+10]=c,this.uint16[C+11]=f,this.uint16[C+12]=p,this.uint16[C+13]=d,this.uint16[C+14]=m,this.uint16[C+15]=_,this.uint16[C+16]=g,this.uint16[C+17]=y,this.uint16[C+18]=v,this.uint16[C+19]=w,this.uint16[C+20]=b,this.uint16[C+21]=x,this.uint16[C+22]=D,this.uint32[T+12]=M,this.float32[T+13]=E,this.float32[T+14]=A,this.uint16[C+30]=F,this.uint16[C+31]=z,this.float32[T+16]=S,t}};ta.prototype.bytesPerElement=68,to("StructArrayLayout8i15ui1ul2f2ui1f68",ta);var ea=class extends ko{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){let e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}};ea.prototype.bytesPerElement=4,to("StructArrayLayout1f4",ea);var ia=class extends ko{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i){let r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){let n=3*t;return this.uint16[6*t+0]=e,this.float32[n+1]=i,this.float32[n+2]=r,t}};ia.prototype.bytesPerElement=12,to("StructArrayLayout1ui2f12",ia);var ra=class extends ko{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i){let r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){let n=4*t;return this.uint32[2*t+0]=e,this.uint16[n+2]=i,this.uint16[n+3]=r,t}};ra.prototype.bytesPerElement=8,to("StructArrayLayout1ul2ui8",ra);var na=class extends ko{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){let i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){let r=2*t;return this.uint16[r+0]=e,this.uint16[r+1]=i,t}};na.prototype.bytesPerElement=4,to("StructArrayLayout2ui4",na);var sa=class extends ko{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){let e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}};sa.prototype.bytesPerElement=2,to("StructArrayLayout1ui2",sa);var oa=class extends ko{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,r){let n=this.length;return this.resize(n+1),this.emplace(n,t,e,i,r)}emplace(t,e,i,r,n){let s=4*t;return this.float32[s+0]=e,this.float32[s+1]=i,this.float32[s+2]=r,this.float32[s+3]=n,t}};oa.prototype.bytesPerElement=16,to("StructArrayLayout4f16",oa);var aa=class extends Io{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new u(this.anchorPointX,this.anchorPointY)}};aa.prototype.size=20;var la=class extends Ho{get(t){return new aa(this,t)}};to("CollisionBoxArray",la);var ha=class extends Io{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}get heightOffset(){return this._structArray.float32[this._pos4+12]}};ha.prototype.size=52;var ua=class extends Qo{get(t){return new ha(this,t)}};to("PlacedSymbolArray",ua);var ca=class extends Io{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}get heightOffset(){return this._structArray.float32[this._pos4+16]}};ca.prototype.size=68;var fa=class extends ta{get(t){return new ca(this,t)}};to("SymbolInstanceArray",fa);var pa=class extends ea{getoffsetX(t){return this.float32[1*t+0]}};to("GlyphOffsetArray",pa);var da=class extends Oo{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}};to("SymbolLineVertexArray",da);var ma=class extends Io{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}};ma.prototype.size=12;var _a=class extends ia{get(t){return new ma(this,t)}};to("TextAnchorOffsetArray",_a);var ga=class extends Io{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}};ga.prototype.size=8;var ya=class extends ra{get(t){return new ga(this,t)}};to("FeatureIndexArray",ya);var va=class extends Ro{},wa=class extends Oo{},ba=class extends Bo{},xa=class extends Ro{},Da=class extends Ro{},Ma=class extends Lo{},Ea=class extends Uo{},Aa=class extends No{},Fa=class extends Go{},za=class extends qo{},Sa=class extends Vo{},Ca=class extends Zo{},Ta=class extends Wo{},Pa=class extends Yo{},Ia=class extends Xo{},ka=class extends Jo{},$a=class extends Ko{},ja=class extends Ko{},Ra=class extends na{},Oa=class extends sa{};const Ba=$o([{name:"a_pos",components:2,type:"Int16"}],4).members;var La=class t{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(e,i,r,n){let s=this.segments[this.segments.length-1];return e>t.MAX_VERTEX_ARRAY_LENGTH&&Rt(`Max vertices per segment is ${t.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${t.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!s||s.vertexLength+e>t.MAX_VERTEX_ARRAY_LENGTH||s.sortKey!==n?this.createNewSegment(i,r,n):s}createNewSegment(t,e,i){let r={vertexOffset:t.length,primitiveOffset:e.length,vertexLength:0,primitiveLength:0,vaos:{}};return void 0!==i&&(r.sortKey=i),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(r),r}getOrCreateLatestSegment(t,e,i){return this.prepareSegment(0,t,e,i)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let t of this.segments)for(let e in t.vaos)t.vaos[e].destroy()}static simpleSegment(e,i,r,n){return new t([{vertexOffset:e,primitiveOffset:i,vertexLength:r,primitiveLength:n,vaos:{},sortKey:0}])}};function Ua(t,e){return 256*(t=Dt(Math.floor(t),0,255))+Dt(Math.floor(e),0,255)}La.MAX_VERTEX_ARRAY_LENGTH=65535,to("SegmentVector",La);const Na=$o([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]),Ga=$o([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var qa=l(((t,e)=>{void 0!==e&&(e.exports=function(t,e){for(var i,r,n=3&t.length,s=t.length-n,o=e,a=3432918353,l=461845907,h=0;h<s;)r=255&t.charCodeAt(h)|(255&t.charCodeAt(++h))<<8|(255&t.charCodeAt(++h))<<16|(255&t.charCodeAt(++h))<<24,++h,o=27492+(65535&(i=5*(65535&(o=(o^=r=(65535&(r=(r=(65535&r)*a+(((r>>>16)*a&65535)<<16)&4294967295)<<15|r>>>17))*l+(((r>>>16)*l&65535)<<16)&4294967295)<<13|o>>>19))+((5*(o>>>16)&65535)<<16)&4294967295))+((58964+(i>>>16)&65535)<<16);switch(r=0,n){case 3:r^=(255&t.charCodeAt(h+2))<<16;case 2:r^=(255&t.charCodeAt(h+1))<<8;case 1:o^=r=(65535&(r=(r=(65535&(r^=255&t.charCodeAt(h)))*a+(((r>>>16)*a&65535)<<16)&4294967295)<<15|r>>>17))*l+(((r>>>16)*l&65535)<<16)&4294967295}return o^=t.length,o=2246822507*(65535&(o^=o>>>16))+((2246822507*(o>>>16)&65535)<<16)&4294967295,o=3266489909*(65535&(o^=o>>>13))+((3266489909*(o>>>16)&65535)<<16)&4294967295,(o^=o>>>16)>>>0})})),Va=l(((t,e)=>{e.exports=function(t,e){for(var i,r=t.length,n=e^r,s=0;r>=4;)i=1540483477*(65535&(i=255&t.charCodeAt(s)|(255&t.charCodeAt(++s))<<8|(255&t.charCodeAt(++s))<<16|(255&t.charCodeAt(++s))<<24))+((1540483477*(i>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),r-=4,++s;switch(r){case 3:n^=(255&t.charCodeAt(s+2))<<16;case 2:n^=(255&t.charCodeAt(s+1))<<8;case 1:n=1540483477*(65535&(n^=255&t.charCodeAt(s)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}})),Za=((t,e,n)=>(n=null==t?{}:i(o(t)),h(r(n,"default",{value:t,enumerable:!0}),t)))(l(((t,e)=>{var i=qa(),r=Va();e.exports=i,e.exports.murmur3=i,e.exports.murmur2=r}))()),Wa=class t{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,i,r){this.ids.push(Ha(t)),this.positions.push(e,i,r)}getPositions(t){if(!this.indexed)throw Error("Trying to get index, but feature positions are not indexed");let e=Ha(t),i=0,r=this.ids.length-1;for(;i<r;){let t=i+r>>1;this.ids[t]>=e?r=t:i=t+1}let n=[];for(;this.ids[i]===e;)n.push({index:this.positions[3*i],start:this.positions[3*i+1],end:this.positions[3*i+2]}),i++;return n}static serialize(t,e){let i=new Float64Array(t.ids),r=new Uint32Array(t.positions);return Ya(i,r,0,i.length-1),e&&e.push(i.buffer,r.buffer),{ids:i,positions:r}}static deserialize(e){let i=new t;return i.ids=e.ids,i.positions=e.positions,i.indexed=!0,i}};function Ha(t){let e=+t;return!isNaN(e)&&e<=2**53-1?e:(0,Za.default)(String(t))}function Ya(t,e,i,r){for(;i<r;){let n=t[i+r>>1],s=i-1,o=r+1;for(;;){do{s++}while(t[s]<n);do{o--}while(t[o]>n);if(s>=o)break;Xa(t,s,o),Xa(e,3*s,3*o),Xa(e,3*s+1,3*o+1),Xa(e,3*s+2,3*o+2)}o-i<r-o?(Ya(t,e,i,o),i=o+1):(Ya(t,e,o+1,r),r=o)}}function Xa(t,e,i){let r=t[e];t[e]=t[i],t[i]=r}to("FeaturePositionMap",Wa);var Ja=class{constructor(t,e){this.gl=t.gl,this.location=e}},Ka=class extends Ja{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))}},Qa=class extends Ja{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}},tl=class extends Ja{constructor(t,e){super(t,e),this.current=[0,0]}set(t){(t[0]!==this.current[0]||t[1]!==this.current[1])&&(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]))}},el=class extends Ja{constructor(t,e){super(t,e),this.current=[0,0,0]}set(t){(t[0]!==this.current[0]||t[1]!==this.current[1]||t[2]!==this.current[2])&&(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]))}},il=class extends Ja{constructor(t,e){super(t,e),this.current=[0,0,0,0]}set(t){(t[0]!==this.current[0]||t[1]!==this.current[1]||t[2]!==this.current[2]||t[3]!==this.current[3])&&(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}},rl=class extends Ja{constructor(t,e){super(t,e),this.current=di.transparent}set(t){(t.r!==this.current.r||t.g!==this.current.g||t.b!==this.current.b||t.a!==this.current.a)&&(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}},nl=class extends Ja{constructor(t,e){super(t,e),this.current=[]}set(t){if(t!=this.current){this.current=t;let e=new Float32Array(4*t.length);for(let i=0;i<t.length;i++)e[4*i]=t[i].r,e[4*i+1]=t[i].g,e[4*i+2]=t[i].b,e[4*i+3]=t[i].a;this.gl.uniform4fv(this.location,e)}}},sl=class extends Ja{constructor(t,e){super(t,e),this.current=[]}set(t){if(t!=this.current){this.current=t;let e=new Float32Array(t);this.gl.uniform1fv(this.location,e)}}};const ol=new Float32Array(16);var al=class extends Ja{constructor(t,e){super(t,e),this.current=ol}set(t){if(t[12]!==this.current[12]||t[0]!==this.current[0])return this.current=t,void this.gl.uniformMatrix4fv(this.location,!1,t);for(let e=1;e<16;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}}};function ll(t){return[Ua(255*t.r,255*t.g),Ua(255*t.b,255*t.a)]}var hl=class{constructor(t,e,i){this.value=t,this.uniformNames=e.map((t=>`u_${t}`)),this.type=i}setUniform(t,e,i){t.set(i.constantOr(this.value))}getBinding(t,e,i){return"color"===this.type?new rl(t,e):new Qa(t,e)}},ul=class{constructor(t,e){this.uniformNames=e.map((t=>`u_${t}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr}setConstantDashPositions(t,e){this.dashTo=[0,t.y,t.height,t.width],this.dashFrom=[0,e.y,e.height,e.width]}setUniform(t,e,i,r){let n=null;"u_pattern_to"===r?n=this.patternTo:"u_pattern_from"===r?n=this.patternFrom:"u_dasharray_to"===r?n=this.dashTo:"u_dasharray_from"===r?n=this.dashFrom:"u_pixel_ratio_to"===r?n=this.pixelRatioTo:"u_pixel_ratio_from"===r&&(n=this.pixelRatioFrom),null!==n&&t.set(n)}getBinding(t,e,i){return i.startsWith("u_pattern")||i.startsWith("u_dasharray_")?new il(t,e):new Qa(t,e)}},cl=class{constructor(t,e,i,r){this.expression=t,this.type=i,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===i?2:1,offset:0}))),this.paintVertexArray=new r}populatePaintArray(t,e,i){let r=this.paintVertexArray.length,n=this.expression.evaluate(new ao(0,i),e,{},i.canonical,[],i.formattedSection);this.paintVertexArray.resize(t),this._setPaintValue(r,t,n)}updatePaintArray(t,e,i,r,n){let s=this.expression.evaluate(new ao(0,n),i,r);this._setPaintValue(t,e,s)}_setPaintValue(t,e,i){if("color"===this.type){let r=ll(i);for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,r[0],r[1])}else{for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,i);this.maxValue=Math.max(this.maxValue,Math.abs(i))}}upload(t){this.paintVertexArray?.arrayBuffer.byteLength&&(this.paintVertexBuffer?.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}},fl=class{constructor(t,e,i,r,n,s){this.expression=t,this.uniformNames=e.map((t=>`u_${t}_t`)),this.type=i,this.useIntegerZoom=r,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===i?4:2,offset:0}))),this.paintVertexArray=new s}populatePaintArray(t,e,i){let r=this.expression.evaluate(new ao(this.zoom,i),e,{},i.canonical,[],i.formattedSection),n=this.expression.evaluate(new ao(this.zoom+1,i),e,{},i.canonical,[],i.formattedSection),s=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(s,t,r,n)}updatePaintArray(t,e,i,r,n){let s=this.expression.evaluate(new ao(this.zoom,n),i,r),o=this.expression.evaluate(new ao(this.zoom+1,n),i,r);this._setPaintValue(t,e,s,o)}_setPaintValue(t,e,i,r){if("color"===this.type){let n=ll(i),s=ll(r);for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,n[0],n[1],s[0],s[1])}else{for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,i,r);this.maxValue=Math.max(this.maxValue,Math.abs(i),Math.abs(r))}}upload(t){this.paintVertexArray?.arrayBuffer.byteLength&&(this.paintVertexBuffer?.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,e){let i=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,r=Dt(this.expression.interpolationFactor(i,this.zoom,this.zoom+1),0,1);t.set(r)}getBinding(t,e,i){return new Qa(t,e)}},pl=class{constructor(t,e,i,r,n,s){this.expression=t,this.type=e,this.useIntegerZoom=i,this.zoom=r,this.layerId=s,this.zoomInPaintVertexArray=new n,this.zoomOutPaintVertexArray=new n}populatePaintArray(t,e,i){let r=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(r,t,this.getPositionIds(e),i)}updatePaintArray(t,e,i,r,n){this._setPaintValues(t,e,this.getPositionIds(i),n)}_setPaintValues(t,e,i,r){let n=this.getPositions(r);if(!n||!i)return;let s=n[i.min],o=n[i.mid],a=n[i.max];if(s&&o&&a)for(let i=t;i<e;i++)this.emplace(this.zoomInPaintVertexArray,i,s,o),this.emplace(this.zoomOutPaintVertexArray,i,a,o)}upload(t){if(this.zoomInPaintVertexArray?.arrayBuffer.byteLength&&this.zoomOutPaintVertexArray?.arrayBuffer.byteLength){let e=this.getVertexAttributes();this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,e,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,e,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},dl=class extends pl{getPositions(t){return t.imagePositions}getPositionIds(t){return t.patterns?.[this.layerId]}getVertexAttributes(){return Na.members}emplace(t,e,i,r){t.emplace(e,i.tlbr[0],i.tlbr[1],i.tlbr[2],i.tlbr[3],r.tlbr[0],r.tlbr[1],r.tlbr[2],r.tlbr[3],i.pixelRatio,r.pixelRatio)}},ml=class extends pl{getPositions(t){return t.dashPositions}getPositionIds(t){return t.dashes?.[this.layerId]}getVertexAttributes(){return Ga.members}emplace(t,e,i,r){t.emplace(e,0,i.y,i.height,i.width,0,r.y,r.height,r.width)}},_l=class{constructor(t,e,i){this.binders={},this._buffers=[];let r=[];for(let n in t.paint._values){if(!i(n))continue;let s=t.paint.get(n);if(!(s instanceof mo&&gn(s.property.specification)))continue;let o=yl(n,t.type),a=s.value,l=s.property.specification.type,h=s.property.useIntegerZoom,u=s.property.specification["property-type"],c="cross-faded"===u||"cross-faded-data-driven"===u;if("constant"===a.kind)this.binders[n]=c?new ul(a.value,o):new hl(a.value,o,l),r.push(`/u_${n}`);else if("source"===a.kind||c){let i=vl(n,l,"source");this.binders[n]=c?"line-dasharray"===n?new ml(a,l,h,e,i,t.id):new dl(a,l,h,e,i,t.id):new cl(a,o,l,i),r.push(`/a_${n}`)}else{let t=vl(n,l,"composite");this.binders[n]=new fl(a,o,l,h,e,t),r.push(`/z_${n}`)}}this.cacheKey=r.sort().join("")}getMaxValue(t){let e=this.binders[t];return e instanceof cl||e instanceof fl?e.maxValue:0}populatePaintArrays(t,e,i){for(let r in this.binders){let n=this.binders[r];(n instanceof cl||n instanceof fl||n instanceof pl)&&n.populatePaintArray(t,e,i)}}setConstantPatternPositions(t,e){for(let i in this.binders){let r=this.binders[i];r instanceof ul&&r.setConstantPatternPositions(t,e)}}setConstantDashPositions(t,e){for(let i in this.binders){let r=this.binders[i];r instanceof ul&&r.setConstantDashPositions(t,e)}}updatePaintArrays(t,e,i,r,n){let s=!1;for(let o of t){let t=e.getPositions(o.id);for(let e of t){let t=i.feature(e.index);for(let i in this.binders){let a=this.binders[i];(a instanceof cl||a instanceof fl||a instanceof pl)&&!0===a.expression.isStateDependent&&(a.expression=r.paint.get(i).value,a.updatePaintArray(e.start,e.end,t,o.state,n),s=!0)}}}return s}defines(){let t=[];for(let e in this.binders){let i=this.binders[e];(i instanceof hl||i instanceof ul)&&t.push(...i.uniformNames.map((t=>`#define HAS_UNIFORM_${t}`)))}return t}getBinderAttributes(){let t=[];for(let e in this.binders){let i=this.binders[e];if(i instanceof cl||i instanceof fl)for(let e of i.paintVertexAttributes)t.push(e.name);else if(i instanceof pl){let e=i.getVertexAttributes();for(let i of e)t.push(i.name)}}return t}getBinderUniforms(){let t=[];for(let e in this.binders){let i=this.binders[e];if(i instanceof hl||i instanceof ul||i instanceof fl)for(let e of i.uniformNames)t.push(e)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){let i=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof hl||n instanceof ul||n instanceof fl)for(let s of n.uniformNames)if(e[s]){let o=n.getBinding(t,e[s],s);i.push({name:s,property:r,binding:o})}}return i}setUniforms(t,e,i,r){for(let{name:t,property:n,binding:s}of e)this.binders[n].setUniform(s,r,i.get(n),t)}updatePaintBuffers(t){this._buffers=[];for(let e in this.binders){let i=this.binders[e];if(t&&i instanceof pl){let e=2===t.fromScale?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;e&&this._buffers.push(e)}else(i instanceof cl||i instanceof fl)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(t){for(let e in this.binders){let i=this.binders[e];(i instanceof cl||i instanceof fl||i instanceof pl)&&i.upload(t)}this.updatePaintBuffers()}destroy(){for(let t in this.binders){let e=this.binders[t];(e instanceof cl||e instanceof fl||e instanceof pl)&&e.destroy()}}},gl=class{constructor(t,e,i=()=>!0){this.programConfigurations={};for(let r of t)this.programConfigurations[r.id]=new _l(r,e,i);this.needsUpload=!1,this._featureMap=new Wa,this._bufferOffset=0}populatePaintArrays(t,e,i,r){for(let i in this.programConfigurations)this.programConfigurations[i].populatePaintArrays(t,e,r);void 0!==e.id&&this._featureMap.add(e.id,i,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,i,r){for(let n of i)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(t,this._featureMap,e,n,r)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(let e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(let t in this.programConfigurations)this.programConfigurations[t].destroy()}};function yl(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-dasharray":["dasharray_to","dasharray_from"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}function vl(t,e,i){let r={color:{source:No,composite:oa},number:{source:ea,composite:No}};return function(t){return{"line-pattern":{source:Fa,composite:Fa},"fill-pattern":{source:Fa,composite:Fa},"fill-extrusion-pattern":{source:Fa,composite:Fa},"line-dasharray":{source:za,composite:za}}[t]}(t)?.[i]||r[e][i]}to("ConstantBinder",hl),to("CrossFadedConstantBinder",ul),to("SourceExpressionBinder",cl),to("CrossFadedPatternBinder",dl),to("CrossFadedDasharrayBinder",ml),to("CompositeExpressionBinder",fl),to("ProgramConfiguration",_l,{omit:["_buffers"]}),to("ProgramConfigurationSet",gl);const wl=-16384;function bl(t){let e=it/t.extent,i=t.loadGeometry();for(let t of i)for(let i of t){let t=Math.round(i.x*e),r=Math.round(i.y*e);i.x=Dt(t,wl,16383),i.y=Dt(r,wl,16383),(t<i.x||t>i.x+1||r<i.y||r>i.y+1)&&Rt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return i}function xl(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?bl(t):[]}}const Dl=-32768;function Ml(t,e,i,r,n){t.emplaceBack(Dl+8*e+r,Dl+8*i+n)}var El=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new xa,this.indexArray=new ja,this.segments=new La,this.programConfigurations=new gl(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){let r=this.layers[0],n=[],s=null,o=!1,a="heatmap"===r.type;if("circle"===r.type){let t=r;s=t.layout.get("circle-sort-key"),o=!s.isConstant(),a||="map"===t.paint.get("circle-pitch-alignment")}let l=a?e.subdivisionGranularity.circle:1,h=new ao(this.zoom),u=this.layers[0]._featureFilter.needGeometry;for(let{feature:e,id:r,index:a,sourceLayerIndex:l}of t){let t=xl(e,u);if(!this.layers[0]._featureFilter.filter(h,t,i))continue;let c=o?s.evaluate(t,{},i):void 0,f={id:r,properties:e.properties,type:e.type,sourceLayerIndex:l,index:a,geometry:u?t.geometry:bl(e),patterns:{},sortKey:c};n.push(f)}o&&n.sort(((t,e)=>t.sortKey-e.sortKey));for(let r of n){let{geometry:n,index:s,sourceLayerIndex:o}=r,a=t[s].feature;this.addFeature(r,n,s,i,l),e.featureIndex.insert(a,n,s,o,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:i})}addFeatures(t){}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ba),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,i,r,n=1){let s;switch(n){case 1:s=[0,7];break;case 3:s=[0,2,5,7];break;case 5:s=[0,1,3,4,6,7];break;case 7:s=[0,1,2,3,4,5,6,7];break;default:throw Error(`Invalid circle bucket granularity: ${n}; valid values are 1, 3, 5, 7.`)}let o=s.length;for(let i of e)for(let e of i){let i=e.x,r=e.y;if(i<0||i>=8192||r<0||r>=8192)continue;let n=this.segments.prepareSegment(o*o,this.layoutVertexArray,this.indexArray,t.sortKey),a=n.vertexLength;for(let t=0;t<o;t++)for(let e=0;e<o;e++)Ml(this.layoutVertexArray,i,r,s[e],s[t]);for(let t=0;t<o-1;t++)for(let e=0;e<o-1;e++){let i=a+t*o+e,r=a+(t+1)*o+e;this.indexArray.emplaceBack(i,r+1,i+1),this.indexArray.emplaceBack(i,r,r+1)}n.vertexLength+=o*o,n.primitiveLength+=(o-1)*(o-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{imagePositions:{},canonical:r})}};function Al(t,e){for(let i of t)if($l(e,i))return!0;for(let i of e)if($l(t,i))return!0;return Cl(t,e)}function Fl(t,e,i){return!!$l(t,e)||Pl(e,t,i)}function zl(t,e){if(1===t.length)return kl(e,t[0]);for(let i of e)for(let e of i)if($l(t,e))return!0;for(let i of t)if(kl(e,i))return!0;for(let i of e)if(Cl(t,i))return!0;return!1}function Sl(t,e,i){if(t.length>1){if(Cl(t,e))return!0;for(let r of e)if(Pl(r,t,i))return!0}for(let r of t)if(Pl(r,e,i))return!0;return!1}function Cl(t,e){if(0===t.length||0===e.length)return!1;for(let i=0;i<t.length-1;i++){let r=t[i],n=t[i+1];for(let t=0;t<e.length-1;t++)if(Tl(r,n,e[t],e[t+1]))return!0}return!1}function Tl(t,e,i,r){return Ot(t,i,r)!==Ot(e,i,r)&&Ot(t,e,i)!==Ot(t,e,r)}function Pl(t,e,i){let r=i*i;if(1===e.length)return t.distSqr(e[0])<r;for(let i=1;i<e.length;i++)if(Il(t,e[i-1],e[i])<r)return!0;return!1}function Il(t,e,i){let r=e.distSqr(i);if(0===r)return t.distSqr(e);let n=((t.x-e.x)*(i.x-e.x)+(t.y-e.y)*(i.y-e.y))/r;return t.distSqr(n<0?e:n>1?i:i.sub(e)._mult(n)._add(e))}function kl(t,e){let i,r,n,s=!1;for(let o of t){i=o;for(let t=0,o=i.length-1;t<i.length;o=t++)r=i[t],n=i[o],r.y>e.y!=n.y>e.y&&e.x<(n.x-r.x)*(e.y-r.y)/(n.y-r.y)+r.x&&(s=!s)}return s}function $l(t,e){let i=!1;for(let r=0,n=t.length-1;r<t.length;n=r++){let s=t[r],o=t[n];s.y>e.y!=o.y>e.y&&e.x<(o.x-s.x)*(e.y-s.y)/(o.y-s.y)+s.x&&(i=!i)}return i}function jl(t,e,i,r,n){for(let s of t)if(e<=s.x&&i<=s.y&&r>=s.x&&n>=s.y)return!0;let s=[new u(e,i),new u(e,n),new u(r,n),new u(r,i)];if(t.length>2)for(let e of s)if($l(t,e))return!0;for(let e=0;e<t.length-1;e++)if(Rl(t[e],t[e+1],s))return!0;return!1}function Rl(t,e,i){let r=i[0],n=i[2];if(t.x<r.x&&e.x<r.x||t.x>n.x&&e.x>n.x||t.y<r.y&&e.y<r.y||t.y>n.y&&e.y>n.y)return!1;let s=Ot(t,e,i[0]);return s!==Ot(t,e,i[1])||s!==Ot(t,e,i[2])||s!==Ot(t,e,i[3])}function Ol(t,e,i){let r=e.paint.get(t).value;return"constant"===r.kind?r.value:i.programConfigurations.get(e.id).getMaxValue(t)}function Bl(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Ll(t,e,i,r,n){if(!e[0]&&!e[1])return t;let s=u.convert(e)._mult(n);"viewport"===i&&s._rotate(-r);let o=[];for(let e of t)o.push(e.sub(s));return o}function Ul(t){let e=[];for(let i=0;i<t.length;i++){let r=t[i],n=e.at(-1);(0===i||n&&!r.equals(n))&&e.push(r)}return e}function Nl({queryGeometry:t,size:e},i){return Fl(t,i,e)}function Gl({queryGeometry:t,size:e,transform:i,unwrappedTileID:r,getElevation:n},s){return Fl(t,s,e*(i.projectTileCoordinates(s.x,s.y,r,n?.(s.x,s.y)).signedDistanceFromCamera/i.cameraToCenterDistance))}function ql({queryGeometry:t,size:e,transform:i,unwrappedTileID:r,getElevation:n},s){let o=i.projectTileCoordinates(s.x,s.y,r,n?.(s.x,s.y)).signedDistanceFromCamera,a=e*(i.cameraToCenterDistance/o);return Fl(t,Wl(s,i,r,n),a)}function Vl({queryGeometry:t,size:e,transform:i,unwrappedTileID:r,getElevation:n},s){return Fl(t,Wl(s,i,r,n),e)}function Zl({queryGeometry:t,size:e,transform:i,unwrappedTileID:r,getElevation:n,pitchAlignment:s="map",pitchScale:o="map"},a){let l="map"===s?"map"===o?Nl:Gl:"map"===o?ql:Vl,h={queryGeometry:t,size:e,transform:i,unwrappedTileID:r,getElevation:n};for(let t of a)for(let e of t)if(l(h,e))return!0;return!1}function Wl(t,e,i,r){let n=e.projectTileCoordinates(t.x,t.y,i,r?.(t.x,t.y)).point;return new u((.5*n.x+.5)*e.width,(.5*-n.y+.5)*e.height)}let Hl,Yl;to("CircleBucket",El,{omit:["layers"]});var Xl={get paint(){return Yl||=new Mo({"circle-radius":new wo(we.paint_circle["circle-radius"],"circle-radius"),"circle-color":new wo(we.paint_circle["circle-color"],"circle-color"),"circle-blur":new wo(we.paint_circle["circle-blur"],"circle-blur"),"circle-opacity":new wo(we.paint_circle["circle-opacity"],"circle-opacity"),"circle-translate":new vo(we.paint_circle["circle-translate"],"circle-translate"),"circle-translate-anchor":new vo(we.paint_circle["circle-translate-anchor"],"circle-translate-anchor"),"circle-pitch-scale":new vo(we.paint_circle["circle-pitch-scale"],"circle-pitch-scale"),"circle-pitch-alignment":new vo(we.paint_circle["circle-pitch-alignment"],"circle-pitch-alignment"),"circle-stroke-width":new wo(we.paint_circle["circle-stroke-width"],"circle-stroke-width"),"circle-stroke-color":new wo(we.paint_circle["circle-stroke-color"],"circle-stroke-color"),"circle-stroke-opacity":new wo(we.paint_circle["circle-stroke-opacity"],"circle-stroke-opacity")})},get layout(){return Hl||=new Mo({"circle-sort-key":new wo(we.layout_circle["circle-sort-key"],"circle-sort-key")})}},Jl=class extends Fo{constructor(t,e){super(t,Xl,e)}createBucket(t){return new El(t)}queryRadius(t){let e=t;return Ol("circle-radius",this,e)+Ol("circle-stroke-width",this,e)+Bl(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:i,geometry:r,transform:n,pixelsToTileUnits:s,unwrappedTileID:o,getElevation:a}){let l,h,u=Ll(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-n.bearingInRadians,s),c=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i),f=this.paint.get("circle-pitch-scale"),p=this.paint.get("circle-pitch-alignment");return"map"===p?(l=u,h=c*s):(l=function(t,e,i,r){return t.map((t=>Wl(t,e,i,r)))}(u,n,o,a),h=c),Zl({queryGeometry:l,size:h,transform:n,unwrappedTileID:o,getElevation:a,pitchAlignment:p,pitchScale:f},r)}},Kl=class extends El{};let Ql;to("HeatmapBucket",Kl,{omit:["layers"]});var th={get paint(){return Ql||=new Mo({"heatmap-radius":new wo(we.paint_heatmap["heatmap-radius"],"heatmap-radius"),"heatmap-weight":new wo(we.paint_heatmap["heatmap-weight"],"heatmap-weight"),"heatmap-intensity":new vo(we.paint_heatmap["heatmap-intensity"],"heatmap-intensity"),"heatmap-color":new Do(we.paint_heatmap["heatmap-color"],"heatmap-color"),"heatmap-opacity":new vo(we.paint_heatmap["heatmap-opacity"],"heatmap-opacity")})}};function eh(t,{width:e,height:i},r,n){if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==e*i*r)throw RangeError(`mismatched image size. expected: ${n.length} but got: ${e*i*r}`)}else n=new Uint8Array(e*i*r);return t.width=e,t.height=i,t.data=n,t}function ih(t,{width:e,height:i},r){if(e===t.width&&i===t.height)return;let n=eh({},{width:e,height:i},r);rh(t,n,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,i)},r),t.width=e,t.height=i,t.data=n.data}function rh(t,e,i,r,n,s){if(0===n.width||0===n.height)return e;if(n.width>t.width||n.height>t.height||i.x>t.width-n.width||i.y>t.height-n.height)throw RangeError("out of range source coordinates for image copy");if(n.width>e.width||n.height>e.height||r.x>e.width-n.width||r.y>e.height-n.height)throw RangeError("out of range destination coordinates for image copy");let o=t.data,a=e.data;if(o===a)throw Error("srcData equals dstData, so image is already copied");for(let l=0;l<n.height;l++){let h=((i.y+l)*t.width+i.x)*s,u=((r.y+l)*e.width+r.x)*s;for(let t=0;t<n.width*s;t++)a[u+t]=o[h+t]}return e}var nh=class t{constructor(t,e){eh(this,t,1,e)}resize(t){ih(this,t,1)}clone(){return new t({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,i,r,n){rh(t,e,i,r,n,1)}},sh=class t{constructor(t,e){eh(this,t,4,e)}resize(t){ih(this,t,4)}replace(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new t({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,i,r,n){rh(t,e,i,r,n,4)}setPixel(t,e,i){let r=4*(t*this.width+e);this.data[r+0]=Math.round(255*i.r/i.a),this.data[r+1]=Math.round(255*i.g/i.a),this.data[r+2]=Math.round(255*i.b/i.a),this.data[r+3]=Math.round(255*i.a)}};function oh(t){let e=new Uint8Array(t.length);for(let i=0;i<t.length;i+=4){let r=t[i+3];e[i+0]=Math.round(t[i+0]*r/255),e[i+1]=Math.round(t[i+1]*r/255),e[i+2]=Math.round(t[i+2]*r/255),e[i+3]=r}return e}function ah(t){let e={},i=t.resolution||256,r=t.clips?t.clips.length:1,n=t.image||new sh({width:i,height:r});if(!function(t){return Math.log(t)/Math.LN2%1==0}(i))throw Error(`width is not a power of 2 - ${i}`);let s=(r,s,o)=>{e[t.evaluationKey]=o;let a=t.expression.evaluate(e);n.setPixel(r/4/i,s/4,a)};if(t.clips)for(let e=0,n=0;e<r;++e,n+=4*i)for(let r=0,o=0;r<i;r++,o+=4){let a=r/(i-1),{start:l,end:h}=t.clips[e];s(n,o,l*(1-a)+h*a)}else for(let t=0,e=0;t<i;t++,e+=4)s(0,e,t/(i-1));return n}to("AlphaImage",nh),to("RGBAImage",sh);const lh="big-fb";var hh=class extends Fo{createBucket(t){return new Kl(t)}constructor(t,e){super(t,th,e),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=ah({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has("big-fb")&&this.heatmapFbos.delete(lh)}queryRadius(t){return Ol("heatmap-radius",this,t)}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:i,geometry:r,transform:n,pixelsToTileUnits:s,unwrappedTileID:o,getElevation:a}){return Zl({queryGeometry:t,size:this.paint.get("heatmap-radius").evaluate(e,i)*s,transform:n,unwrappedTileID:o,getElevation:a},r)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&!this.isHidden()}};let uh;var ch={get paint(){return uh||=new Mo({"hillshade-illumination-direction":new vo(we.paint_hillshade["hillshade-illumination-direction"],"hillshade-illumination-direction"),"hillshade-illumination-altitude":new vo(we.paint_hillshade["hillshade-illumination-altitude"],"hillshade-illumination-altitude"),"hillshade-illumination-anchor":new vo(we.paint_hillshade["hillshade-illumination-anchor"],"hillshade-illumination-anchor"),"hillshade-exaggeration":new vo(we.paint_hillshade["hillshade-exaggeration"],"hillshade-exaggeration"),"hillshade-shadow-color":new vo(we.paint_hillshade["hillshade-shadow-color"],"hillshade-shadow-color"),"hillshade-highlight-color":new vo(we.paint_hillshade["hillshade-highlight-color"],"hillshade-highlight-color"),"hillshade-accent-color":new vo(we.paint_hillshade["hillshade-accent-color"],"hillshade-accent-color"),"hillshade-method":new vo(we.paint_hillshade["hillshade-method"],"hillshade-method"),resampling:new vo(we.paint_hillshade.resampling,"resampling")})}},fh=class extends Fo{constructor(t,e){super(t,ch,e),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let t=this.paint.get("hillshade-illumination-direction").values,e=this.paint.get("hillshade-illumination-altitude").values,i=this.paint.get("hillshade-highlight-color").values,r=this.paint.get("hillshade-shadow-color").values,n=Math.max(t.length,e.length,i.length,r.length);t=t.concat(Array(n-t.length).fill(t.at(-1))),e=e.concat(Array(n-e.length).fill(e.at(-1))),i=i.concat(Array(n-i.length).fill(i.at(-1))),r=r.concat(Array(n-r.length).fill(r.at(-1)));let s=e.map(qt);return{directionRadians:t.map(qt),altitudeRadians:s,shadowColor:r,highlightColor:i}}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&!this.isHidden()}};let ph;var dh={get paint(){return ph||=new Mo({"color-relief-opacity":new vo(we["paint_color-relief"]["color-relief-opacity"],"color-relief-opacity"),"color-relief-color":new Do(we["paint_color-relief"]["color-relief-color"],"color-relief-color"),resampling:new vo(we["paint_color-relief"].resampling,"resampling")})}};function mh(t){return"data"in t}var _h=class{constructor(t,e,i,r){this.context=t,this.format=i,this.texture=t.gl.createTexture(),this._ownedHandle=this.texture,this.update(e,r)}update(t,e,i){let{width:r,height:n}=t,s=(this.size?.[0]!==r||this.size[1]!==n)&&!i,{context:o}=this,{gl:a}=o;this.useMipmap=!!e?.useMipmap,s&&this.size&&this.format===a.RGBA&&(a.deleteTexture(this.texture),this.texture=a.createTexture(),this._ownedHandle=this.texture,this.magFilter=void 0,this.minFilter=void 0,this.wrap=void 0),a.bindTexture(a.TEXTURE_2D,this.texture),o.pixelStoreUnpackFlipY.set(!1),o.pixelStoreUnpack.set(1);let l=this.format===a.RGBA&&!1!==e?.premultiply;if(s)if(this.size=[r,n],this.format===a.RGBA&&r>0&&n>0){let e=this.useMipmap?Math.floor(Math.log2(Math.max(r,n)))+1:1;if(a.texStorage2D(a.TEXTURE_2D,e,a.RGBA8,r,n),mh(t)){o.pixelStoreUnpackPremultiplyAlpha.set(!1);let{data:e}=t;l&&e&&(e=oh(e)),e&&a.texSubImage2D(a.TEXTURE_2D,0,0,0,r,n,a.RGBA,a.UNSIGNED_BYTE,e)}else o.pixelStoreUnpackPremultiplyAlpha.set(l),a.texSubImage2D(a.TEXTURE_2D,0,0,0,a.RGBA,a.UNSIGNED_BYTE,t)}else mh(t)?(o.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(t,l,r,n,a)):(o.pixelStoreUnpackPremultiplyAlpha.set(l),this._uploadDomImage(t,a));else{let{x:e,y:s}=i||{x:0,y:0};mh(t)?(o.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(t,l,e,s,r,n,a)):(o.pixelStoreUnpackPremultiplyAlpha.set(l),this._updateDomImage(t,e,s,a))}this.useMipmap&&!(mh(t)&&null===t.data)&&a.generateMipmap(a.TEXTURE_2D),o.pixelStoreUnpackFlipY.setDefault(),o.pixelStoreUnpack.setDefault(),o.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(t,e){e.texImage2D(e.TEXTURE_2D,0,this.format,this.format,e.UNSIGNED_BYTE,t)}_uploadRawData(t,e,i,r,n){let{data:s}=t;e&&s&&(s=oh(s)),n.texImage2D(n.TEXTURE_2D,0,this.format,i,r,0,this.format,n.UNSIGNED_BYTE,s)}_updateDomImage(t,e,i,r){r.texSubImage2D(r.TEXTURE_2D,0,e,i,r.RGBA,r.UNSIGNED_BYTE,t)}_updateRawData(t,e,i,r,n,s,o){let{data:a}=t;e&&a&&(a=oh(a)),o.texSubImage2D(o.TEXTURE_2D,0,i,r,n,s,o.RGBA,o.UNSIGNED_BYTE,a)}bind(t,e,i){let{context:r}=this,{gl:n}=r;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),n.bindTexture(n.TEXTURE_2D,this.texture),(i===n.LINEAR_MIPMAP_NEAREST||i===n.LINEAR_MIPMAP_LINEAR)&&!this.useMipmap&&(i=n.LINEAR);let s=i||t;t!==this.magFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),this.magFilter=t),s!==this.minFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,s),this.minFilter=s),e!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,e),this.wrap=e)}generateMipmap(){if(!this.useMipmap)return;let{gl:t}=this.context;t.bindTexture(t.TEXTURE_2D,this.texture),t.generateMipmap(t.TEXTURE_2D)}destroy(){let{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}},gh=class t{static{this.byteViewCache=new WeakMap}constructor(e,i,r,n=1,s=1,o=1,a=0){if(this.uid=e,i.height!==i.width)throw RangeError("DEM tiles must be square");if(r&&!["mapbox","terrarium","custom"].includes(r))return void Rt(`"${r}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=i.height;let l=this.dim=i.height-4;switch(this.data=new Uint32Array(i.data.buffer),t.byteViewCache.set(this,new Uint8Array(this.data.buffer)),r){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=n,this.greenFactor=s,this.blueFactor=o,this.baseShift=a;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let t=-2;t<l+2;t++){let e=this._idx(0,Math.max(0,Math.min(l-1,t)));(t<0||t>=l)&&this.data.copyWithin(this._idx(0,t),e,e+l),this.data.fill(this.data[e],this._idx(-2,t),this._idx(0,t)),this.data.fill(this.data[e+l-1],this._idx(l,t),this._idx(l+1,t)+1)}let h=this._getByteView();this.min=2**53-1,this.max=-9007199254740991;for(let t=0;t<l;t++)for(let e=0;e<l;e++){let i=4*this._idx(t,e),r=this._unpackAtIndex(h,i);r>this.max&&(this.max=r),r<this.min&&(this.min=r)}}get(t,e){let i=this._getByteView(),r=4*this._idx(t,e);return this._unpackAtIndex(i,r)}sampleBilinear(t,e){let i=Math.floor(t),r=Math.floor(e);if(i<-1||i>=this.dim||r<-1||r>=this.dim)throw RangeError(`Out of range source coordinates for DEM data. x: ${t}, y: ${e}, dim: ${this.dim}`);let n=this._getByteView(),s=4*((r+2)*this.stride+i+2),o=4*this.stride,a=t-i,l=e-r;return this._unpackAtIndex(n,s)*(1-a)*(1-l)+this._unpackAtIndex(n,s+4)*a*(1-l)+this._unpackAtIndex(n,s+o)*(1-a)*l+this._unpackAtIndex(n,s+o+4)*a*l}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,e){if(t<-2||t>=this.dim+2||e<-2||e>=this.dim+2)throw RangeError(`Out of range source coordinates for DEM data. x: ${t}, y: ${e}, dim: ${this.dim}`);return(e+2)*this.stride+(t+2)}unpack(t,e,i){return t*this.redFactor+e*this.greenFactor+i*this.blueFactor-this.baseShift}pack(t){return yh(t,this.getUnpackVector())}getPixels(){return new sh({width:this.stride,height:this.stride},this._getByteView())}backfillBorder(t,e,i){if(this.dim!==t.dim)throw Error("dem dimension mismatch");let r=e*this.dim,n=e*this.dim+this.dim,s=i*this.dim,o=i*this.dim+this.dim;switch(e){case-1:r=n-2;break;case 1:n=r+2}switch(i){case-1:s=o-2;break;case 1:o=s+2}let a=-e*this.dim,l=-i*this.dim;for(let e=s;e<o;e++)for(let i=r;i<n;i++)this.data[this._idx(i,e)]=t.data[this._idx(i+a,e+l)]}_getByteView(){let e=t.byteViewCache.get(this);return e?.buffer!==this.data.buffer&&(e=new Uint8Array(this.data.buffer),t.byteViewCache.set(this,e)),e}_unpackAtIndex(t,e){return this.unpack(t[e],t[e+1],t[e+2])}};function yh(t,e){let i=e[0],r=e[1],n=e[2],s=e[3],o=Math.min(i,r,n),a=Math.round((t+s)/o);return{r:Math.floor(a*o/i)%256,g:Math.floor(a*o/r)%256,b:Math.floor(a*o/n)%256}}to("DEMData",gh);var vh=class extends Fo{constructor(t,e){super(t,dh,e)}_createColorRamp(t){let e={elevationStops:[],colorStops:[]},i=this._transitionablePaint._values["color-relief-color"].value.expression;if(i instanceof On&&i._styleExpression.expression instanceof ji){this.colorRampExpression=i;let t=i._styleExpression.expression;e.elevationStops=t.labels,e.colorStops=[];for(let i of e.elevationStops)e.colorStops.push(t.evaluate({globals:{elevation:i}}))}if(e.elevationStops.length<1&&(e.elevationStops=[0],e.colorStops=[di.transparent]),e.elevationStops.length<2&&(e.elevationStops.push(e.elevationStops[0]+1),e.colorStops.push(e.colorStops[0])),e.elevationStops.length<=t)return e;let r={elevationStops:[],colorStops:[]},n=(e.elevationStops.length-1)/(t-1);for(let t=0;t<e.elevationStops.length-.5;t+=n)r.elevationStops.push(e.elevationStops[Math.round(t)]),r.colorStops.push(e.colorStops[Math.round(t)]);return Rt(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${t}, provided: ${e.elevationStops.length}`),r}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(t,e,i){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let r=this._createColorRamp(e),n=new sh({width:r.colorStops.length,height:1}),s=new sh({width:r.colorStops.length,height:1});for(let t=0;t<r.elevationStops.length;t++){let e=yh(r.elevationStops[t],i);s.setPixel(0,t,new di(e.r/255,e.g/255,e.b/255,1)),n.setPixel(0,t,r.colorStops[t])}return this.colorRampTextures={elevationTexture:new _h(t,s,t.gl.RGBA),colorTexture:new _h(t,n,t.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}};const wh=$o([{name:"a_pos",components:2,type:"Int16"}],4).members;function bh(t,e,i){let r=i.patternDependencies,n=!1;for(let i of e){let e=i.paint.get(`${t}-pattern`);e.isConstant()||(n=!0);let s=e.constantOr(null);s&&(n=!0,r[s.to]=!0,r[s.from]=!0)}return n}function xh(t,e,i,r,n){let{zoom:s}=r,o=n.patternDependencies;for(let r of e){let e=r.paint.get(`${t}-pattern`).value;if("constant"!==e.kind){let t=e.evaluate({zoom:s-1},i,{},n.availableImages),a=e.evaluate({zoom:s},i,{},n.availableImages),l=e.evaluate({zoom:s+1},i,{},n.availableImages);t=t?.name?t.name:t,a=a?.name?a.name:a,l=l?.name?l.name:l,o[t]=!0,o[a]=!0,o[l]=!0,i.patterns[r.id]={min:t,mid:a,max:l}}}return i}const Dh=new Set;let Mh=!1;function Eh(t,e,i,r,n){let s=null;if(n===function(t,e,i,r){let n=0;for(let s=e,o=i-r;s<i;s+=r)n+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return n}(t,e,i,r)>0)for(let n=e;n<i;n+=r)s=su(n/r|0,t[n],t[n+1],s);else for(let n=i-r;n>=e;n-=r)s=su(n/r|0,t[n],t[n+1],s);return s&&tu(s,s.next)&&(ou(s),s=s.next),s}function Ah(t,e=t){let i,r=e===t,n=t;do{i=!1,n===n.next||0!==Dh.size&&Dh.has(n)||!tu(n,n.next)&&0!==Qh(n.prev,n,n.next)?(r||n!==e)&&(n=n.next,i=!r):((r||n===e)&&(e=n.prev),Mh=!0,ou(n),n=n.prev,i=!0)}while(i||n!==e);return e}function Fh(t,e,i,r,n){n&&function(t,e,i,r){let n=t,s=0;do{n.z=Yh(n.x,n.y,e,i,r),Gh[s++]=n,n=n.next}while(n!==t);!function(t){if(t<=32)for(let e=1;e<t;e++){let t=Gh[e],i=t.z,r=e-1;for(;r>=0&&Gh[r].z>i;)Gh[r+1]=Gh[r],r--;Gh[r+1]=t}else{Vh.length<t&&(Vh=new Uint32Array(t),Zh=new Uint32Array(t),qh=Array(t));for(let e=0;e<t;e++)Vh[e]=Gh[e].z;Hh(t,Gh,Vh,qh,Zh,0),Hh(t,qh,Zh,Gh,Vh,8),Hh(t,Gh,Vh,qh,Zh,16),Hh(t,qh,Zh,Gh,Vh,24)}}(s);let o=null;for(let t=0;t<s;t++){let e=Gh[t];e.prevZ=o,o&&(o.nextZ=e),o=e}o.nextZ=null}(t,i,r,n);let s=t,o=!1;for(;t.prev!==t.next;){let a=t.prev,l=t.next;if(Qh(a,t,l)<0&&(n?Sh(t,i,r,n):zh(t)))e.push(a.i,t.i,l.i),ou(t),t=l,s=l;else if((t=l)===s){if(Mh=!1,t=Ah(t),Mh){s=t;continue}if(!o){s=t=Ch(t,e),o=!0;continue}Th(t,e,i,r,n);break}}}function zh(t){let e=t.prev,i=t.next,r=e.x,n=t.x,s=i.x,o=e.y,a=t.y,l=i.y,h=Math.min(r,n,s),u=Math.min(o,a,l),c=Math.max(r,n,s),f=Math.max(o,a,l),p=i.next;for(;p!==e;){if(p.x>=h&&p.x<=c&&p.y>=u&&p.y<=f&&(r!==p.x||o!==p.y)&&Jh(r,o,n,a,s,l,p.x,p.y)&&Qh(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Sh(t,e,i,r){let n=t.prev,s=t.next,o=n.x,a=t.x,l=s.x,h=n.y,u=t.y,c=s.y,f=Math.min(o,a,l),p=Math.min(h,u,c),d=Math.max(o,a,l),m=Math.max(h,u,c),_=Yh(f,p,e,i,r),g=Yh(d,m,e,i,r),y=t.prevZ;for(;y&&y.z>=_;){if(y.x>=f&&y.x<=d&&y.y>=p&&y.y<=m&&y!==s&&(o!==y.x||h!==y.y)&&Jh(o,h,a,u,l,c,y.x,y.y)&&Qh(y.prev,y,y.next)>=0)return!1;y=y.prevZ}let v=t.nextZ;for(;v&&v.z<=g;){if(v.x>=f&&v.x<=d&&v.y>=p&&v.y<=m&&v!==s&&(o!==v.x||h!==v.y)&&Jh(o,h,a,u,l,c,v.x,v.y)&&Qh(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function Ch(t,e){let i=t,r=!1;do{let n=i.prev,s=i.next.next;eu(n,i,i.next,s,!1)&&ru(n,s)&&ru(s,n)&&(e.push(n.i,i.i,s.i),ou(i),ou(i.next),i=t=s,r=!0),i=i.next}while(i!==t);return r?Ah(i):i}function Th(t,e,i,r,n){let s=t;do{let t=s.next.next;for(;t!==s.prev;){if(s.i!==t.i&&Kh(s,t)){let o=nu(s,t);return s=Ah(s,s.next),o=Ah(o,o.next),Fh(s,e,i,r,n),void Fh(o,e,i,r,n)}t=t.next}s=s.next}while(s!==t)}let Ph=!1;function Ih(t,e){return t.x-e.x||t.y-e.y||(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}function kh(t,e){let i=function(t,e){let i,r=e,n=t.x,s=t.y,o=-1/0;if(tu(t,r))return r;for(let e=0,a=0;e<jh;e++,a+=4){if(s<$h[a+1]||s>$h[a+3]||$h[a]>n||$h[a+2]<=o)continue;let l=Lh(e);r=Uh(e);do{if(r.prev.next===r){if(tu(t,r.next))return r.next;if(s<=r.y&&s>=r.next.y&&r.next.y!==r.y){let t=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(t<=n&&t>o&&(o=t,i=r.x<r.next.x?r:r.next,t===n))return i}}r=r.next}while(r!==l)}if(!i)return null;let a=i.x,l=i.y,h=Math.min(s,l),u=Math.max(s,l),c=1/0;for(let e=0,f=0;e<jh;e++,f+=4){if($h[f+2]<a||$h[f]>n||$h[f+3]<h||$h[f+1]>u)continue;let p=Lh(e);r=Uh(e);do{if(r.prev.next===r&&n>=r.x&&r.x>=a&&n!==r.x&&Jh(s<l?n:o,s,a,l,s<l?o:n,s,r.x,r.y)){let e=Math.abs(s-r.y)/(n-r.x);(ru(r,t)||r.y===s&&r.next.y===s&&r.next.x>n)&&(e<c||e===c&&(r.x>i.x||r.x===i.x&&Nh(i,r)))&&(i=r,c=e)}r=r.next}while(r!==p)}return i}(t,e);if(!i)return e;let r=nu(i,t);return Bh(i,r.next.next),Ah(r,r.next),Ah(i,i.next)}let $h=new Float64Array,jh=0;const Rh=[],Oh=[];function Bh(t,e){let i=t;do{let t=jh++;Rh[t]=i;let r=1/0,n=1/0,s=-1/0,o=-1/0,a=0;do{let e=i.next;i.z=t,i.x<r&&(r=i.x),i.x>s&&(s=i.x),i.y<n&&(n=i.y),i.y>o&&(o=i.y),e.x<r&&(r=e.x),e.x>s&&(s=e.x),e.y<n&&(n=e.y),e.y>o&&(o=e.y),i=e}while(++a<16&&i!==e);Oh[t]=i;let l=4*t;$h[l]=r,$h[l+1]=n,$h[l+2]=s,$h[l+3]=o}while(i!==e)}function Lh(t){let e=Oh[t];for(;e.prev.next!==e;)e=e.next;return Oh[t]=e,e}function Uh(t){let e=Rh[t];for(;e.prev.next!==e;)e=e.next;return Rh[t]=e,e}function Nh(t,e){return Qh(t.prev,t,e.prev)<0&&Qh(e.next,t,t.next)<0}const Gh=[];let qh=[],Vh=new Uint32Array,Zh=new Uint32Array;const Wh=new Uint32Array(256);function Hh(t,e,i,r,n,s){Wh.fill(0);for(let e=0;e<t;e++)Wh[i[e]>>>s&255]++;let o=0;for(let t=0;t<256;t++){let e=Wh[t];Wh[t]=o,o+=e}for(let o=0;o<t;o++){let t=i[o],a=Wh[t>>>s&255]++;r[a]=e[o],n[a]=t}}function Yh(t,e,i,r,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Xh(t){let e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function Jh(t,e,i,r,n,s,o,a){return(n-o)*(e-a)>=(t-o)*(s-a)&&(t-o)*(r-a)>=(i-o)*(e-a)&&(i-o)*(s-a)>=(n-o)*(r-a)}function Kh(t,e){let i=tu(t,e)&&Qh(t.prev,t,t.next)>0&&Qh(e.prev,e,e.next)>0;return t.next.i!==e.i&&(i||ru(t,e)&&ru(e,t)&&(0!==Qh(t.prev,t,e.prev)||0!==Qh(t,e.prev,e)))&&!function(t,e){let i=Math.min(t.x,e.x),r=Math.max(t.x,e.x),n=Math.min(t.y,e.y),s=Math.max(t.y,e.y),o=t;do{let a=o.next;if(o.x>r&&a.x>r||o.x<i&&a.x<i||o.y>s&&a.y>s||o.y<n&&a.y<n)o=a;else{if(o.i!==t.i&&a.i!==t.i&&o.i!==e.i&&a.i!==e.i&&eu(o,a,t,e))return!0;o=a}}while(o!==t);return!1}(t,e)&&(i||function(t,e){let i=t,r=!1,n=(t.x+e.x)/2,s=(t.y+e.y)/2;do{let t=i.next;i.y>s!=t.y>s&&n<(t.x-i.x)*(s-i.y)/(t.y-i.y)+i.x&&(r=!r),i=t}while(i!==t);return r}(t,e))}function Qh(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function tu(t,e){return t.x===e.x&&t.y===e.y}function eu(t,e,i,r,n=!0){let s=Qh(t,e,i),o=Qh(t,e,r),a=Qh(i,r,t),l=Qh(i,r,e);return(s>0&&o<0||s<0&&o>0)&&(a>0&&l<0||a<0&&l>0)||!!n&&!!(0===s&&iu(t,i,e)||0===o&&iu(t,r,e)||0===a&&iu(i,t,r)||0===l&&iu(i,e,r))}function iu(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function ru(t,e){return Qh(t.prev,t,t.next)<0?Qh(t,e,t.next)>=0&&Qh(t,t.prev,e)>=0:Qh(t,e,t.prev)<0||Qh(t,t.next,e)<0}function nu(t,e){let i=au(t.i,t.x,t.y),r=au(e.i,e.x,e.y),n=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,s.next=r,r.prev=s,r}function su(t,e,i,r){let n=au(t,e,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function ou(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),Ph&&function(t,e){let i=4*t.z;e.x<$h[i]&&($h[i]=e.x),e.y<$h[i+1]&&($h[i+1]=e.y),e.x>$h[i+2]&&($h[i+2]=e.x),e.y>$h[i+3]&&($h[i+3]=e.y)}(t.prev,t.next)}function au(t,e,i){return{i:t,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null}}var lu=class{constructor(t,e){if(e>t)throw Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=e}getGranularityForZoomLevel(t){return Math.max(Math.floor(this._baseZoomGranularity/(1<<t)),this._minGranularity,1)}},hu=class t{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}static{this.noSubdivision=new t({fill:new lu(0,0),line:new lu(0,0),tile:new lu(0,0),stencil:new lu(0,0),circle:1})}};to("SubdivisionGranularityExpression",lu),to("SubdivisionGranularitySetting",hu);const uu=-32768,cu=32767;var fu=class{constructor(t,e){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=it/t,this._canonical=e}_getKey(t,e){return(t+=32768)<<16|e+32768}_vertexToIndex(t,e){if(t<-32768||e<-32768||t>32767||e>32767)throw Error("Vertex coordinates are out of signed 16 bit integer range.");let i=0|Math.round(t),r=0|Math.round(e),n=this._getKey(i,r),s=this._vertexDictionary.get(n);if(void 0!==s)return s;let o=this._vertexBuffer.length/2;return this._vertexDictionary.set(n,o),this._vertexBuffer.push(i,r),o}_subdivideTrianglesScanline(t,e){if(this._granularity<2)return function(t,e){let i=[];for(let r=0;r<e.length;r+=3){let n=e[r],s=e[r+1],o=e[r+2],a=t[2*n],l=t[2*n+1];(t[2*s]-a)*(t[2*o+1]-l)-(t[2*s+1]-l)*(t[2*o]-a)>0?(i.push(n),i.push(o),i.push(s)):(i.push(n),i.push(s),i.push(o))}return i}(this._vertexBuffer,function(t,e){let i=Array(t.length);for(let r=0;r<t.length;r++)i[r]=e[t[r]];return i}(t,e));let i=[],r=t.length;for(let n=0;n<r;n+=3){let r=[e[t[n+0]],e[t[n+1]],e[t[n+2]]],s=[this._vertexBuffer[2*r[0]+0],this._vertexBuffer[2*r[0]+1],this._vertexBuffer[2*r[1]+0],this._vertexBuffer[2*r[1]+1],this._vertexBuffer[2*r[2]+0],this._vertexBuffer[2*r[2]+1]],o=1/0,a=1/0,l=-1/0,h=-1/0;for(let t=0;t<3;t++){let e=s[2*t],i=s[2*t+1];o=Math.min(o,e),l=Math.max(l,e),a=Math.min(a,i),h=Math.max(h,i)}if(o===l||a===h)continue;let u=Math.floor(o/this._granularityCellSize),c=Math.ceil(l/this._granularityCellSize),f=Math.floor(a/this._granularityCellSize),p=Math.ceil(h/this._granularityCellSize);if(u!==c||f!==p)for(let t=f;t<p;t++){let e=this._scanlineGenerateVertexRingForCellRow(t,s,r);_u(this._vertexBuffer,e,i)}else i.push(...r)}return i}_scanlineGenerateVertexRingForCellRow(t,e,i){let r=t*this._granularityCellSize,n=r+this._granularityCellSize,s=[];for(let t=0;t<3;t++){let o=e[2*t],a=e[2*t+1],l=e[2*(t+1)%6],h=e[(2*(t+1)+1)%6],u=e[2*(t+2)%6],c=e[(2*(t+2)+1)%6],f=l-o,p=h-a,d=0===f,m=0===p,_=(r-a)/p,g=(n-a)/p,y=Math.min(_,g),v=Math.max(_,g);if(!m&&(y>=1||v<=0)||m&&(a<r||a>n)){h>=r&&h<=n&&s.push(i[(t+1)%3]);continue}!m&&y>0&&s.push(this._vertexToIndex(o+f*y,a+p*y));let w=o+f*Math.max(y,0),b=o+f*Math.min(v,1);d||this._generateIntraEdgeVertices(s,o,a,l,h,w,b),!m&&v<1&&s.push(this._vertexToIndex(o+f*v,a+p*v)),(m||h>=r&&h<=n)&&s.push(i[(t+1)%3]),!m&&(h<=r||h>=n)&&this._generateInterEdgeVertices(s,o,a,l,h,u,c,b,r,n)}return s}_generateIntraEdgeVertices(t,e,i,r,n,s,o){let a=r-e,l=n-i,h=0===l,u=h?Math.min(e,r):Math.min(s,o),c=h?Math.max(e,r):Math.max(s,o),f=Math.floor(u/this._granularityCellSize)+1,p=Math.ceil(c/this._granularityCellSize)-1;if(h?e<r:s<o)for(let r=f;r<=p;r++){let n=r*this._granularityCellSize;t.push(this._vertexToIndex(n,i+l*(n-e)/a))}else for(let r=p;r>=f;r--){let n=r*this._granularityCellSize;t.push(this._vertexToIndex(n,i+l*(n-e)/a))}}_generateInterEdgeVertices(t,e,i,r,n,s,o,a,l,h){let u=n-i,c=s-r,f=o-n,p=(l-n)/f,d=(h-n)/f,m=Math.min(p,d),_=Math.max(p,d),g=r+c*m,y=Math.floor(Math.min(g,a)/this._granularityCellSize)+1,v=Math.ceil(Math.max(g,a)/this._granularityCellSize)-1,w=a<g,b=0===f;if(b&&(o===l||o===h))return;if(b||m>=1||_<=0){let t=i-o,r=s+(e-s)*Math.min((l-o)/t,(h-o)/t);y=Math.floor(Math.min(r,a)/this._granularityCellSize)+1,v=Math.ceil(Math.max(r,a)/this._granularityCellSize)-1,w=a<r}let x=u>0?h:l;if(w)for(let e=y;e<=v;e++)t.push(this._vertexToIndex(e*this._granularityCellSize,x));else for(let e=v;e>=y;e--)t.push(this._vertexToIndex(e*this._granularityCellSize,x))}_generateOutline(t,e){let i=[],r=0;for(let n of t){let t=this._granularity<2?this._ringPathIndices(n,r,e):this._pointArrayToIndices(du(n,this._granularity,!0));r+=n.length;let s=[];for(let e=1;e<t.length;e++)s.push(t[e-1]),s.push(t[e]);i.push(s)}return i}_ringPathIndices(t,e,i){let r=i.slice(e,e+t.length);return r.length>=2&&mu(t)&&r.push(r[0]),r}_handlePoles(t){let e=!1,i=!1;this._canonical&&(0===this._canonical.y&&(e=!0),this._canonical.y===(1<<this._canonical.z)-1&&(i=!0)),(e||i)&&this._fillPoles(t,e,i)}_ensureNoPoleVertices(){let t=this._vertexBuffer;for(let e=0;e<t.length;e+=2){let i=t[e+1];-32768===i&&(t[e+1]=-32767),32767===i&&(t[e+1]=32766)}}_generatePoleQuad(t,e,i,r,n,s){r>n==(-32768===s)?(t.push(i),t.push(e),t.push(this._vertexToIndex(r,s)),t.push(this._vertexToIndex(n,s)),t.push(i),t.push(this._vertexToIndex(r,s))):(t.push(e),t.push(i),t.push(this._vertexToIndex(r,s)),t.push(i),t.push(this._vertexToIndex(n,s)),t.push(this._vertexToIndex(r,s)))}_fillPoles(t,e,i){let r=this._vertexBuffer,n=it,s=t.length;for(let o=2;o<s;o+=3){let s=t[o-2],a=t[o-1],l=t[o],h=r[2*s],u=r[2*s+1],c=r[2*a],f=r[2*a+1],p=r[2*l],d=r[2*l+1];e&&(0===u&&0===f&&this._generatePoleQuad(t,s,a,h,c,uu),0===f&&0===d&&this._generatePoleQuad(t,a,l,c,p,uu),0===d&&0===u&&this._generatePoleQuad(t,l,s,p,h,uu)),i&&(u===n&&f===n&&this._generatePoleQuad(t,s,a,h,c,cu),f===n&&d===n&&this._generatePoleQuad(t,a,l,c,p,cu),d===n&&u===n&&this._generatePoleQuad(t,l,s,p,h,cu))}}_initializeVertices(t){let e=[];for(let i=0;i<t.length;i+=2)e.push(this._vertexToIndex(t[i],t[i+1]));return e}subdividePolygonInternal(t,e){if(this._used)throw Error("Subdivision: multiple use not allowed.");this._used=!0;let i,{flattened:r,holeIndices:n}=function(t){let e=[],i=[];for(let r of t)if(0!==r.length){r!==t[0]&&e.push(i.length/2);for(let t of r)i.push(t.x),i.push(t.y)}return{flattened:i,holeIndices:e}}(t),s=this._initializeVertices(r);try{let t=function(t,e,i=2){let r=e&&e.length,n=r?e[0]*i:t.length;Dh.size&&Dh.clear();let s=Eh(t,0,n,i,!0),o=[];if(!s||s.next===s.prev)return o;let a=0,l=0,h=0;if(r&&(s=function(t,e,i,r){let n=[];for(let i=0,s=e.length;i<s;i++){let o=Eh(t,e[i]*r,i<s-1?e[i+1]*r:t.length,r,!1);o===o.next&&Dh.add(o),n.push(Xh(o))}n.sort(Ih),function(t,e){let i=Math.ceil((t+2*e)/16)+e+2;$h.length<4*i&&($h=new Float64Array(4*i)),jh=0}(t.length/r,e.length),Bh(i,i),Ph=!0;for(let t=0;t<n.length;t++)i=kh(n[t],i);return Ph=!1,Ah(i)}(t,e,s,i)),t.length>80*i){a=t[0],l=t[1];let e=a,r=l;for(let s=i;s<n;s+=i){let i=t[s],n=t[s+1];i<a&&(a=i),n<l&&(l=n),i>e&&(e=i),n>r&&(r=n)}h=Math.max(e-a,r-l),h=0===h?0:32767/h}return Fh(s,o,a,l,h),o}(r,n);i=this._subdivideTrianglesScanline(t,s)}catch(t){console.error(t)}let o=[];return e&&(o=this._generateOutline(t,s)),this._ensureNoPoleVertices(),this._handlePoles(i),this._granularity>=2&&0===this._canonical?.z&&(i=this._removeTrianglesOutsideTileX(i),o=o.map((t=>this._removeLinesOutsideTileX(t)))),{verticesFlattened:this._vertexBuffer,indicesTriangles:i,indicesLineList:o}}_vertexOutsideTileX(t){let e=this._vertexBuffer[2*t];return e<0||e>8192}_removeTrianglesOutsideTileX(t){let e=[];for(let i=0;i<t.length;i+=3)this._vertexOutsideTileX(t[i])||this._vertexOutsideTileX(t[i+1])||this._vertexOutsideTileX(t[i+2])||e.push(t[i],t[i+1],t[i+2]);return e}_removeLinesOutsideTileX(t){let e=[];for(let i=0;i<t.length;i+=2)this._vertexOutsideTileX(t[i])||this._vertexOutsideTileX(t[i+1])||e.push(t[i],t[i+1]);return e}_pointArrayToIndices(t){let e=[];for(let i of t)e.push(this._vertexToIndex(i.x,i.y));return e}};function pu(t,e,i,r=!0){return new fu(i,e).subdividePolygonInternal(t,r)}function du(t,e,i=!1){if(!t||t.length<1||t.length<2)return[];let r=i&&mu(t);if(e<2)return r?[...t,t[0]]:[...t];let n=Math.floor(it/e),s=[];s.push(new u(t[0].x,t[0].y));let o=t.length,a=r?o:o-1;for(let e=0;e<a;e++){let i=t[e],r=e<o-1?t[e+1]:t[0],a=i.x,l=i.y,h=r.x,c=r.y,f=a!==h,p=l!==c;if(!f&&!p)continue;let d=h-a,m=c-l,_=Math.abs(d),g=Math.abs(m),y=a,v=l;for(;;){let t=d>0?(Math.floor(y/n)+1)*n:(Math.ceil(y/n)-1)*n,e=m>0?(Math.floor(v/n)+1)*n:(Math.ceil(v/n)-1)*n,i=Math.abs(y-t),r=Math.abs(v-e),o=Math.abs(y-h),a=Math.abs(v-c),l=f?i/_:1/0,w=p?r/g:1/0;if((o<=i||!f)&&(a<=r||!p))break;if(l<w&&f||!p){y=t,v+=m*l;let e=new u(y,Math.round(v));(s[s.length-1].x!==e.x||s[s.length-1].y!==e.y)&&s.push(e)}else{y+=d*w,v=e;let t=new u(Math.round(y),v);(s[s.length-1].x!==t.x||s[s.length-1].y!==t.y)&&s.push(t)}}let w=new u(h,c);(s[s.length-1].x!==w.x||s[s.length-1].y!==w.y)&&s.push(w)}return s}function mu(t){return!t[0].equals(t[t.length-1])}function _u(t,e,i){if(0===e.length)throw Error("Subdivision vertex ring is empty.");let r=0,n=t[2*e[0]];for(let i=1;i<e.length;i++){let s=t[2*e[i]];s<n&&(n=s,r=i)}let s=e.length,o=r,a=(o+1)%s;for(;;){let r=o-1>=0?o-1:s-1,n=(a+1)%s,l=t[2*e[r]],h=t[2*e[r]+1],u=t[2*e[n]],c=t[2*e[n]+1],f=t[2*e[o]],p=t[2*e[o]+1],d=t[2*e[a]],m=t[2*e[a]+1],_=!1;if(l<u)_=!0;else if(l>u)_=!1;else{let t=m-p,e=-(d-f),i=p<m?1:-1;((l-f)*t+(h-p)*e)*i>((u-f)*t+(c-p)*e)*i&&(_=!0)}if(_){let t=e[r],n=e[o],l=e[a];t!==n&&t!==l&&n!==l&&i.push(l,n,t),o--,o<0&&(o=s-1)}else{let t=e[n],r=e[o],l=e[a];t!==r&&t!==l&&r!==l&&i.push(l,r,t),a++,a>=s&&(a=0)}if(r===n)break}}function gu(t,e,i,r,n,s,o,a,l){let h=n.length/2,u=o&&a&&l;if(h<La.MAX_VERTEX_ARRAY_LENGTH){let c,f,p=e.prepareSegment(h,i,r),d=p.vertexLength;for(let t=0;t<s.length;t+=3)r.emplaceBack(d+s[t],d+s[t+1],d+s[t+2]);p.vertexLength+=h,p.primitiveLength+=s.length/3,u&&(f=o.prepareSegment(h,i,a),c=f.vertexLength,f.vertexLength+=h);for(let e=0;e<n.length;e+=2)t(n[e],n[e+1]);if(u)for(let t of l){for(let e=1;e<t.length;e+=2)a.emplaceBack(c+t[e-1],c+t[e]);f.primitiveLength+=t.length/2}}else(function(t,e,i,r,n,s){let o=[];for(let t=0;t<r.length/2;t++)o.push(-1);let a={count:0},l=0,h=t.getOrCreateLatestSegment(e,i),u=h.vertexLength;for(let c=2;c<n.length;c+=3){let f=n[c-2],p=n[c-1],d=n[c],m=o[f]<l,_=o[p]<l,g=o[d]<l;h.vertexLength+(+!!m+ +!!_+ +!!g)>La.MAX_VERTEX_ARRAY_LENGTH&&(h=t.createNewSegment(e,i),l=a.count,m=!0,_=!0,g=!0,u=0);let y=yu(o,r,s,a,f,m,h),v=yu(o,r,s,a,p,_,h),w=yu(o,r,s,a,d,g,h);i.emplaceBack(u+y-l,u+v-l,u+w-l),h.primitiveLength++}})(e,i,r,n,s,t),u&&function(t,e,i,r,n,s){let o=[];for(let t=0;t<r.length/2;t++)o.push(-1);let a={count:0},l=0,h=t.getOrCreateLatestSegment(e,i),u=h.vertexLength;for(let c of n)for(let n=1;n<c.length;n+=2){let f=c[n-1],p=c[n],d=o[f]<l,m=o[p]<l;h.vertexLength+(+!!d+ +!!m)>La.MAX_VERTEX_ARRAY_LENGTH&&(h=t.createNewSegment(e,i),l=a.count,d=!0,m=!0,u=0);let _=yu(o,r,s,a,f,d,h),g=yu(o,r,s,a,p,m,h);i.emplaceBack(u+_-l,u+g-l),h.primitiveLength++}}(o,i,a,n,l,t),e.forceNewSegmentOnNextPrepare(),o?.forceNewSegmentOnNextPrepare()}function yu(t,e,i,r,n,s,o){if(s){let s=r.count;return i(e[2*n],e[2*n+1]),t[n]=r.count,r.count++,o.vertexLength++,s}return t[n]}var vu=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasDependencies=!1,this.sdfPatterns={},this.patternFeatures=[],this.layoutVertexArray=new Da,this.indexArray=new ja,this.indexArray2=new Ra,this.programConfigurations=new gl(t.layers,t.zoom),this.segments=new La,this.segments2=new La,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.hasDependencies=bh("fill",this.layers,e);let r=this.layers[0].layout.get("fill-sort-key"),n=!r.isConstant(),s=[],o=new ao(this.zoom),a=this.layers[0]._featureFilter.needGeometry;for(let{feature:l,id:h,index:u,sourceLayerIndex:c}of t){let t=xl(l,a);if(!this.layers[0]._featureFilter.filter(o,t,i))continue;let f=n?r.evaluate(t,{},i,e.availableImages):void 0,p={id:h,properties:l.properties,type:l.type,sourceLayerIndex:c,index:u,geometry:a?t.geometry:bl(l),patterns:{},sortKey:f};s.push(p)}n&&s.sort(((t,e)=>t.sortKey-e.sortKey));for(let r of s){let{geometry:n,index:s,sourceLayerIndex:o}=r;if(this.hasDependencies){let t=xh("fill",this.layers,r,{zoom:this.zoom},e);this.patternFeatures.push(t)}else this.addFeature(r,n,s,i,{},e.subdivisionGranularity);e.featureIndex.insert(t[s].feature,n,s,o,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:i})}addFeatures({options:t,canonical:e,patternPositions:i,patternMap:r}){this.detectSdfPatterns(r);for(let r of this.patternFeatures)this.addFeature(r,r.geometry,r.index,e,i,t.subdivisionGranularity)}detectSdfPatterns(t){for(let e of this.patternFeatures)for(let i in e.patterns){let r=e.patterns[i];this.recordSdfPattern(i,t[r.min]),this.recordSdfPattern(i,t[r.mid]),this.recordSdfPattern(i,t[r.max])}for(let e of this.layers){let i=e.paint.get("fill-pattern").constantOr(null);i&&(this.recordSdfPattern(e.id,t[i.from.toString()]),this.recordSdfPattern(e.id,t[i.to.toString()]))}}recordSdfPattern(t,e){if(!e)return;let i=!0===e.sdf,r=this.sdfPatterns[t];void 0===r?this.sdfPatterns[t]=i:r!==i&&Rt(`Style sheet warning: Cannot mix SDF and non-SDF fill patterns in layer "${t}"`)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,wh),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,e,i,r,n,s){for(let t of Gi(e,500)){let e=pu(t,r,s.fill.getGranularityForZoomLevel(r.z)),i=this.layoutVertexArray;gu(((t,e)=>{i.emplaceBack(t,e)}),this.segments,this.layoutVertexArray,this.indexArray,e.verticesFlattened,e.indicesTriangles,this.segments2,this.indexArray2,e.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{imagePositions:n,canonical:r})}};let wu,bu;to("FillBucket",vu,{omit:["layers","patternFeatures"]});var xu={get paint(){return bu||=new Mo({"fill-antialias":new vo(we.paint_fill["fill-antialias"],"fill-antialias"),"fill-opacity":new wo(we.paint_fill["fill-opacity"],"fill-opacity"),"fill-layer-opacity":new vo(we.paint_fill["fill-layer-opacity"],"fill-layer-opacity"),"fill-color":new wo(we.paint_fill["fill-color"],"fill-color"),"fill-outline-color":new wo(we.paint_fill["fill-outline-color"],"fill-outline-color"),"fill-translate":new vo(we.paint_fill["fill-translate"],"fill-translate"),"fill-translate-anchor":new vo(we.paint_fill["fill-translate-anchor"],"fill-translate-anchor"),"fill-pattern":new bo(we.paint_fill["fill-pattern"],"fill-pattern")})},get layout(){return wu||=new Mo({"fill-sort-key":new wo(we.layout_fill["fill-sort-key"],"fill-sort-key")})}},Du=class extends Fo{constructor(t,e){super(t,xu,e)}recalculate(t,e){super.recalculate(t,e);let i=this.paint._values["fill-outline-color"];"constant"===i.value.kind&&void 0===i.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new vu(t)}queryRadius(){return Bl(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:e,transform:i,pixelsToTileUnits:r}){return zl(Ll(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-i.bearingInRadians,r),e)}isTileClipped(){return!0}};const Mu=$o([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Eu=$o([{name:"a_centroid",components:2,type:"Int16"}],4),Au=Mu.members;var Fu=class t{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(t){return this.minX=Math.min(this.minX,t.x),this.minY=Math.min(this.minY,t.y),this.maxX=Math.max(this.maxX,t.x),this.maxY=Math.max(this.maxY,t.y),this}expandBy(t){return this.minX-=t,this.minY-=t,this.maxX+=t,this.maxY+=t,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(t){return this.expandBy(-t)}map(e){let i=new t;return i.extend(e(new u(this.minX,this.minY))),i.extend(e(new u(this.maxX,this.minY))),i.extend(e(new u(this.minX,this.maxY))),i.extend(e(new u(this.maxX,this.maxY))),i}static fromPoints(e){let i=new t;for(let t of e)i.extend(t);return i}contains(t){return t.x>=this.minX&&t.x<=this.maxX&&t.y>=this.minY&&t.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(t){return!this.empty()&&!t.empty()&&t.minX>=this.minX&&t.maxX<=this.maxX&&t.minY>=this.minY&&t.maxY<=this.maxY}intersects(t){return!this.empty()&&!t.empty()&&t.minX<=this.maxX&&t.maxX>=this.minX&&t.minY<=this.maxY&&t.maxY>=this.minY}};const zu=Fu.fromPoints([new u(0,0),new u(it,it)]);function Su(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}function Cu(t){return t.every((t=>t.x<0))||t.every((t=>t.x>8192))||t.every((t=>t.y<0))||t.every((t=>t.y>8192))}var Tu=class{constructor(t,e,i,r,n){for(this.properties=Object.create(null),this.extent=i,this.type=0,this.id=void 0,this._pbf=t,this._geometry=-1,this._keys=r,this._values=n;t.pos<e;){let e=t.readVarint();if(8===e)this.id=t.readVarint();else if(18===e){let e=t.readVarint()+t.pos;for(;t.pos<e;){let e=r[t.readVarint()],i=n[t.readVarint()];this.properties[e]=i}}else 24===e?this.type=t.readVarint():(34===e&&(this._geometry=t.pos),t.skip(e))}}loadGeometry(){if(this._geometry<0)throw Error("feature has no geometry");let t=this._pbf;t.pos=this._geometry;let e,i=t.readVarint()+t.pos,r=[],n=1,s=0,o=0,a=0;for(;t.pos<i;){if(s<=0){let e=t.readVarint();if(n=7&e,s=e>>3,0===s)continue}if(s--,1===n)o+=t.readSVarint(),a+=t.readSVarint(),e&&r.push(e),e=[new u(o,a)];else if(2===n)o+=t.readSVarint(),a+=t.readSVarint(),e&&e.push(new u(o,a));else{if(7!==n)throw Error(`unknown command ${n}`);e&&e.push(e[0].clone())}}return e&&r.push(e),r}bbox(){if(this._geometry<0)throw Error("feature has no geometry");let t=this._pbf;t.pos=this._geometry;let e=t.readVarint()+t.pos,i=1,r=0,n=0,s=0,o=1/0,a=-1/0,l=1/0,h=-1/0;for(;t.pos<e;){if(r<=0){let e=t.readVarint();if(i=7&e,r=e>>3,0===r)continue}if(r--,1===i||2===i)n+=t.readSVarint(),s+=t.readSVarint(),n<o&&(o=n),n>a&&(a=n),s<l&&(l=s),s>h&&(h=s);else if(7!==i)throw Error(`unknown command ${i}`)}return[o,l,a,h]}toGeoJSON(t,e,i){let r,n=this.extent*2**i,s=this.extent*t,o=this.extent*e,a=this.loadGeometry();function l(t){return[360*(t.x+s)/n-180,360/Math.PI*Math.atan(Math.exp((1-2*(t.y+o)/n)*Math.PI))-90]}function h(t){return t.map(l)}if(1===this.type){let t=[];for(let e of a)t.push(e[0]);let e=h(t);r=1===t.length?{type:"Point",coordinates:e[0]}:{type:"MultiPoint",coordinates:e}}else if(2===this.type){let t=a.map(h);r=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t}}else{if(3!==this.type)throw Error("unknown feature type");{let t=Pu(a),e=[];for(let i of t)e.push(i.map(h));r=1===e.length?{type:"Polygon",coordinates:e[0]}:{type:"MultiPolygon",coordinates:e}}}let u={type:"Feature",geometry:r,properties:this.properties};return null!=this.id&&(u.id=this.id),u}};function Pu(t){let e=t.length;if(e<=1)return[t];let i,r,n=[];for(let s=0;s<e;s++){let e=Iu(t[s]);0!==e&&(void 0===r&&(r=e<0),r===e<0?(i&&n.push(i),i=[t[s]]):i&&i.push(t[s]))}return i&&n.push(i),n}function Iu(t){let e=0;for(let i,r,n=0,s=t.length,o=s-1;n<s;o=n++)i=t[n],r=t[o],e+=(r.x-i.x)*(i.y+r.y);return e}Tu.types=["Unknown","Point","LineString","Polygon"];var ku=class{constructor(t,e){for(this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],void 0===e&&(e=t.length);t.pos<e;){let e=t.readVarint();10===e?this.name=t.readString():18===e?(this._features.push(t.pos),t.skip(e)):26===e?this._keys.push(t.readString()):34===e?this._values.push($u(t)):40===e?this.extent=t.readVarint():120===e?this.version=t.readVarint():t.skip(e)}this.length=this._features.length}feature(t){if(t<0||t>=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[t];let e=this._pbf.readVarint()+this._pbf.pos;return new Tu(this._pbf,e,this.extent,this._keys,this._values)}};function $u(t){let e=null,i=t.readVarint()+t.pos;for(;t.pos<i;){let i=t.readVarint();e=10===i?t.readString():21===i?t.readFloat():25===i?t.readDouble():32===i?t.readVarint(!0):40===i?t.readVarint():48===i?t.readSVarint():56===i?t.readBoolean():(t.skip(i),null)}if(null==e)throw Error("unknown feature value");return e}var ju=class{constructor(t,e=t.length){let i=Object.create(null);for(;t.pos<e;){let e=t.readVarint();if(26===e){let e=new ku(t,t.readVarint()+t.pos);e.length&&(i[e.name]=e)}else t.skip(e)}this.layers=i}};const Ru=6371008.8;var Ou=class t{constructor(t,e){if(isNaN(t)||isNaN(e))throw Error(`Invalid LngLat object: (${t}, ${e})`);if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new t(Mt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){let e=Math.PI/180,i=this.lat*e,r=t.lat*e,n=Math.sin(i)*Math.sin(r)+Math.cos(i)*Math.cos(r)*Math.cos((t.lng-this.lng)*e);return Ru*Math.acos(Math.min(n,1))}static convert(e){if(e instanceof t)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new t(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&e)return new t(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}};const Bu=2*Math.PI*Ru;function Lu(t){return Bu*Math.cos(t*Math.PI/180)}function Uu(t){return(180+t)/360}function Nu(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Gu(t,e){return t/Lu(e)}function qu(t){return 360*t-180}function Vu(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}function Zu(t,e){return t*Lu(Vu(e))}var Wu=class t{constructor(t,e,i=0){this.x=+t,this.y=+e,this.z=+i}static fromLngLat(e,i=0){let r=Ou.convert(e);return new t(Uu(r.lng),Nu(r.lat),Gu(i,r.lat))}toLngLat(){return new Ou(qu(this.x),Vu(this.y))}toAltitude(){return Zu(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Bu*function(t){return 1/Math.cos(t*Math.PI/180)}(Vu(this.y))}};const Hu=89.25;function Yu(t,e,i){let r=1/(1<<i.z);return new Wu(t/it*r+i.x*r,e/it*r+i.y*r)}function Xu(t,e){let i=Dt(e.lat,-85.051129,Yt);return new u(Uu(e.lng)*t,Nu(i)*t)}function Ju(t,e){return new Wu(e.x/t,e.y/t).toLngLat()}function Ku(t){return t.cameraToCenterDistance*Math.min(.85*Math.tan(qt(90-t.pitch)),Math.tan(qt(Hu-t.pitch)))}function Qu(t,e){let i=t.canonical,r=e/St(i.z),n=i.x+2**i.z*t.wrap,s=new Float64Array(16);return v(s),x(s,s,[n*r,i.y*r,0]),D(s,s,[r/it,r/it,1]),s}function tc(t,e,i,r,n){let s=Wu.fromLngLat(t,e),o=n*Gu(1,t.lat),{x:a,y:l,z:h}=ec(i,r);return new Wu(s.x+o*-a,s.y+o*-l,s.z+o*h)}function ec(t,e){let i=qt(t),r=qt(e),n=Math.cos(-i),s=Math.sin(i);return{x:s*Math.sin(r),y:-s*Math.cos(r),z:n}}function ic(t,e){return e<=0||!t||0===t.length?t:t.map((t=>function(t,e){if(!t||t.length<3)return t;let i=t[0].x===t[t.length-1].x&&t[0].y===t[t.length-1].y,r=i?t.length-1:t.length;if(r<3)return t;let n=[],s=Su(t[r-1],t[0]);for(let i=0;i<r;i++){let o=t[(i-1+r)%r],a=t[i],l=t[(i+1)%r],h=Su(a,l);s||h?n.push(a.clone()):rc(n,o,a,l,e),s=h}let o=function(t){let e=[];for(let i of t){let t=i.round(),r=e[e.length-1];(r?.x!==t.x||r?.y!==t.y)&&e.push(t)}for(;e.length>1&&e[0].x===e[e.length-1].x&&e[0].y===e[e.length-1].y;)e.pop();return e}(n);return o.length<3?t:(i&&o.push(o[0].clone()),o)}(t,e)))}function rc(t,e,i,r,n){let s=e.sub(i),o=r.sub(i),a=s.mag(),l=o.mag();if(a<1e-6||l<1e-6)return void t.push(i.clone());s._div(a),o._div(l);let h=s.x*o.x+s.y*o.y;if(Math.abs(h)>Math.cos(5*Math.PI/180))return void t.push(i.clone());let u=Math.min(n,.2*a,.2*l),c=i.add(s.mult(u)),f=i.add(o.mult(u)),p=Math.sqrt((1+h)/2),d=i.add(s.add(o)._unit()._mult(u/p)),m=c.sub(d).angleWith(f.sub(d)),_=Math.max(2,Math.ceil(Math.abs(m)/(Math.PI/6)-1e-6));for(let e=0;e<=_;e++)t.push(c.rotateAround(e/_*m,d))}const nc=8192;function sc(t,e,i,r,n,s,o,a){t.emplaceBack(e,i,2*Math.floor(r*nc)+o,n*nc*2,s*nc*2,Math.round(a))}var oc=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new Ma,this.centroidVertexArray=new va,this.indexArray=new ja,this.programConfigurations=new gl(t.layers,t.zoom),this.segments=new La,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.features=[],this.hasDependencies=bh("fill-extrusion",this.layers,e);let r=new ao(this.zoom),n=this.layers[0],s=n.layout.get("fill-extrusion-rounded-corner-distance"),o=s>0?function(t,e){let i=function(t,e,i){return Yu(4096,4096,i).toLngLat()}(0,0,e);return t*Wu.fromLngLat(i).meterInMercatorCoordinateUnits()*((1<<e.z)*it)}(s,i):0,a=n._featureFilter.needGeometry;for(let{feature:s,id:l,index:h,sourceLayerIndex:u}of t){let t=xl(s,a);if(!n._featureFilter.filter(r,t,i))continue;let c={id:l,sourceLayerIndex:u,index:h,geometry:ic(a?t.geometry:bl(s),o),properties:s.properties,type:s.type,patterns:{}};this.hasDependencies?this.features.push(xh("fill-extrusion",this.layers,c,{zoom:this.zoom},e)):this.addFeature(c,c.geometry,h,i,{},e.subdivisionGranularity),e.featureIndex.insert(s,c.geometry,h,u,this.index,!0)}}addFeatures({options:t,canonical:e,patternPositions:i}){for(let r of this.features){let{geometry:n}=r;this.addFeature(r,n,r.index,e,i,t.subdivisionGranularity)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:i})}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Au),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Eu.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,e,i,r,n,s){for(let i of Gi(e,500)){let e={x:0,y:0,sampleCount:0},n=this.layoutVertexArray.length;this.processPolygon(e,r,t,i,s);let o=this.layoutVertexArray.length-n,a=Math.floor(e.x/e.sampleCount),l=Math.floor(e.y/e.sampleCount);for(let t=0;t<o;t++)this.centroidVertexArray.emplaceBack(a,l)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{imagePositions:n,canonical:r})}processPolygon(t,e,i,r,n){if(r.length<1||Cu(r[0]))return;for(let e of r)0!==e.length&&ac(t,e);let s={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},o=n.fill.getGranularityForZoomLevel(e.z),a="Polygon"===Tu.types[i.type];for(let t of r){if(0===t.length||Cu(t))continue;let e=du(t,o,a);this._generateSideFaces(e,s)}if(!a)return;let l=pu(r,e,o,!1),h=this.layoutVertexArray;gu(((t,e)=>{sc(h,t,e,0,0,1,1,0)}),this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles)}_generateSideFaces(t,e){let i=0;for(let r=1;r<t.length;r++){let n=t[r],s=t[r-1];if(Su(n,s))continue;e.segment.vertexLength+4>La.MAX_VERTEX_ARRAY_LENGTH&&(e.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let o=n.sub(s)._perp()._unit(),a=s.dist(n);i+a>32768&&(i=0),sc(this.layoutVertexArray,n.x,n.y,o.x,o.y,0,0,i),sc(this.layoutVertexArray,n.x,n.y,o.x,o.y,0,1,i),i+=a,sc(this.layoutVertexArray,s.x,s.y,o.x,o.y,0,0,i),sc(this.layoutVertexArray,s.x,s.y,o.x,o.y,0,1,i);let l=e.segment.vertexLength;this.indexArray.emplaceBack(l,l+2,l+1),this.indexArray.emplaceBack(l+1,l+2,l+3),e.segment.vertexLength+=4,e.segment.primitiveLength+=2}}};function ac(t,e){for(let i=0;i<e.length;i++){let r=e[i];(i!==e.length-1||e[0].x!==r.x||e[0].y!==r.y)&&(t.x+=r.x,t.y+=r.y,t.sampleCount++)}}let lc,hc;to("FillExtrusionBucket",oc,{omit:["layers","features"]});var uc={get paint(){return hc||=new Mo({"fill-extrusion-opacity":new vo(we["paint_fill-extrusion"]["fill-extrusion-opacity"],"fill-extrusion-opacity"),"fill-extrusion-color":new wo(we["paint_fill-extrusion"]["fill-extrusion-color"],"fill-extrusion-color"),"fill-extrusion-translate":new vo(we["paint_fill-extrusion"]["fill-extrusion-translate"],"fill-extrusion-translate"),"fill-extrusion-translate-anchor":new vo(we["paint_fill-extrusion"]["fill-extrusion-translate-anchor"],"fill-extrusion-translate-anchor"),"fill-extrusion-pattern":new bo(we["paint_fill-extrusion"]["fill-extrusion-pattern"],"fill-extrusion-pattern"),"fill-extrusion-height":new wo(we["paint_fill-extrusion"]["fill-extrusion-height"],"fill-extrusion-height"),"fill-extrusion-base":new wo(we["paint_fill-extrusion"]["fill-extrusion-base"],"fill-extrusion-base"),"fill-extrusion-vertical-gradient":new vo(we["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"],"fill-extrusion-vertical-gradient")})},get layout(){return lc||=new Mo({"fill-extrusion-rounded-corner-distance":new vo(we["layout_fill-extrusion"]["fill-extrusion-rounded-corner-distance"],"fill-extrusion-rounded-corner-distance")})}},cc=class extends Fo{constructor(t,e){super(t,uc,e)}createBucket(t){return new oc(t)}queryRadius(){return Bl(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:i,geometry:r,transform:n,pixelsToTileUnits:s,pixelPosMatrix:o}){let a=Ll(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-n.bearingInRadians,s),l=this.paint.get("fill-extrusion-height").evaluate(e,i),h=this.paint.get("fill-extrusion-base").evaluate(e,i),u=mc(a,o,0),c=dc(r,h,l,o);return function(t,e,i){let r=1/0;zl(i,e)&&(r=pc(i,e[0]));for(let n=0;n<e.length;n++){let s=e[n],o=t[n];for(let t=0;t<s.length-1;t++){let e=s[t],n=[e,s[t+1],o[t+1],o[t],e];Al(i,n)&&(r=Math.min(r,pc(i,n)))}}return r!==1/0&&r}(c[0],c[1],u)}};function fc(t,e){return t.x*e.x+t.y*e.y}function pc(t,e){if(1===t.length){let i,r=0,n=e[r++];for(;!i||n.equals(i);)if(i=e[r++],!i)return 1/0;for(;r<e.length;r++){let s=e[r],o=t[0],a=i.sub(n),l=s.sub(n),h=o.sub(n),u=fc(a,a),c=fc(a,l),f=fc(l,l),p=fc(h,a),d=fc(h,l),m=u*f-c*c,_=(f*p-c*d)/m,g=(u*d-c*p)/m,y=n.z*(1-_-g)+i.z*_+s.z*g;if(isFinite(y))return y}return 1/0}{let t=1/0;for(let i of e)t=Math.min(t,i.z);return t}}function dc(t,e,i,r){let n=[],s=[],o=r[8]*e,a=r[9]*e,l=r[10]*e,h=r[11]*e,c=r[8]*i,f=r[9]*i,p=r[10]*i,d=r[11]*i;for(let e of t){let t=[],i=[];for(let n of e){let e=n.x,s=n.y,m=r[0]*e+r[4]*s+r[12],_=r[1]*e+r[5]*s+r[13],g=r[2]*e+r[6]*s+r[14],y=r[3]*e+r[7]*s+r[15],v=g+l,w=y+h,b=m+c,x=_+f,D=g+p,M=y+d,E=new u((m+o)/w,(_+a)/w);E.z=v/w,t.push(E);let A=new u(b/M,x/M);A.z=D/M,i.push(A)}n.push(t),s.push(i)}return[n,s]}function mc(t,e,i){let r=[];for(let n of t){let t=[n.x,n.y,i,1];Z(t,t,e),r.push(new u(t[0]/t[3],t[1]/t[3]))}return r}const _c=$o([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4).members,gc=$o([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]).members,yc=Math.cos(Math.PI/180*37.5);var vc=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={};for(let t of this.layers)this.gradients[t.id]={};this.layoutVertexArray=new Ea,this.layoutVertexArray2=new Aa,this.indexArray=new ja,this.programConfigurations=new gl(t.layers,t.zoom),this.segments=new La,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.hasDependencies=bh("line",this.layers,e)||this.hasLineDasharray(this.layers);let r=this.layers[0].layout.get("line-sort-key"),n=!r.isConstant(),s=[],o=new ao(this.zoom),a=this.layers[0]._featureFilter.needGeometry;for(let{feature:e,id:l,index:h,sourceLayerIndex:u}of t){let t=xl(e,a);if(!this.layers[0]._featureFilter.filter(o,t,i))continue;let c=n?r.evaluate(t,{},i):void 0,f={id:l,properties:e.properties,type:e.type,sourceLayerIndex:u,index:h,geometry:a?t.geometry:bl(e),patterns:{},dashes:{},sortKey:c};s.push(f)}n&&s.sort(((t,e)=>t.sortKey-e.sortKey));for(let r of s){let{geometry:n,index:s,sourceLayerIndex:o}=r;this.hasDependencies?(bh("line",this.layers,e)?xh("line",this.layers,r,{zoom:this.zoom},e):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,r,this.zoom,e),this.patternFeatures.push(r)):this.addFeature(r,n,s,i,{},{},e.subdivisionGranularity),e.featureIndex.insert(t[s].feature,n,s,o,this.index)}}update(t,e,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:i,dashPositions:r})}addFeatures({options:t,canonical:e,patternPositions:i,dashPositions:r}){for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,e,i,r,t.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,gc)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,_c),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.hasOwn(t.properties,"geojsonvt_clip_start")&&Object.hasOwn(t.properties,"geojsonvt_clip_end"))return{start:+t.properties.geojsonvt_clip_start,end:+t.properties.geojsonvt_clip_end}}addFeature(t,e,i,r,n,s,o){let a=this.layers[0].layout,l=a.get("line-join").evaluate(t,{}),h=a.get("line-cap").evaluate(t,{}),u=a.get("line-miter-limit").evaluate(t,{}),c=a.get("line-round-limit").evaluate(t,{});this.lineClips=this.lineFeatureClips(t);for(let i of e)this.addLine(i,t,l,h,u,c,r,o);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{imagePositions:n,dashPositions:s,canonical:r})}addLine(t,e,i,r,n,s,o,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,t=du(t,o?a.line.getGranularityForZoomLevel(o.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let e=0;e<t.length-1;e++)this.totalDistance+=t[e].dist(t[e+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let l="Polygon"===Tu.types[e.type],h=t.length;for(;h>=2&&t[h-1].equals(t[h-2]);)h--;let u=0;for(;u<h-1&&t[u].equals(t[u+1]);)u++;if(h-u<(l?3:2))return;"bevel"===i&&(n=1.05);let c,f,p,d,m,_=this.overscaling<=16?15*it/(512*this.overscaling):0,g=this.segments.prepareSegment(10*h,this.layoutVertexArray,this.indexArray);this.e1=this.e2=-1,l&&(c=t[h-2],m=t[u].sub(c)._unit()._perp());for(let e=u;e<h;e++){if(p=e===h-1?l?t[u+1]:void 0:t[e+1],p&&t[e].equals(p))continue;m&&(d=m),c&&(f=c),c=t[e],m=p?p.sub(c)._unit()._perp():d,d||=m;let o=d.add(m);(0!==o.x||0!==o.y)&&o._unit();let a=d.x*m.x+d.y*m.y,y=o.x*m.x+o.y*m.y,v=0===y?1/0:1/y,w=2*Math.sqrt(2-2*y),b=y<yc&&f&&p,x=d.x*m.y-d.y*m.x>0;if(b&&e>u){let t=c.dist(f);if(t>2*_){let e=c.sub(c.sub(f)._mult(_/t)._round());this.updateDistance(f,e),this.addCurrentVertex(e,d,0,0,g),f=e}}let D=f&&p,M=D?i:l?"butt":r;if(D&&"round"===M&&(v<s?M="miter":v<=2&&(M="fakeround")),"miter"===M&&v>n&&(M="bevel"),"bevel"===M&&(v>2&&(M="flipbevel"),v<n&&(M="miter")),f&&this.updateDistance(f,c),"miter"===M)o._mult(v),this.addCurrentVertex(c,o,0,0,g);else if("flipbevel"===M){if(v>100)o=m.mult(-1);else{let t=v*d.add(m).mag()/d.sub(m).mag();o._perp()._mult(t*(x?-1:1))}this.addCurrentVertex(c,o,0,0,g),this.addCurrentVertex(c,o.mult(-1),0,0,g)}else if("bevel"===M||"fakeround"===M){let t=-Math.sqrt(v*v-1),e=x?t:0,i=x?0:t;if(f&&this.addCurrentVertex(c,d,e,i,g),"fakeround"===M){let t=Math.round(180*w/Math.PI/20);for(let e=1;e<t;e++){let i=e/t;if(.5!==i){let t=i-.5;i+=i*t*(i-1)*((1.0904+a*(a*(3.55645-1.43519*a)-3.2452))*t*t+(.848013+a*(.215638*a-1.06021)))}let r=m.sub(d)._mult(i)._add(d)._unit()._mult(x?-1:1);this.addHalfVertex(c,r.x,r.y,!1,x,0,g)}}p&&this.addCurrentVertex(c,m,-e,-i,g)}else if("butt"===M)this.addCurrentVertex(c,o,0,0,g);else if("square"===M){let t=f?1:-1;this.addCurrentVertex(c,o,t,t,g)}else"round"===M&&(f&&(this.addCurrentVertex(c,d,0,0,g),this.addCurrentVertex(c,d,1,1,g,!0)),p&&(this.addCurrentVertex(c,m,-1,-1,g,!0),this.addCurrentVertex(c,m,0,0,g)));if(b&&e<h-1){let t=c.dist(p);if(t>2*_){let e=c.add(p.sub(c)._mult(_/t)._round());this.updateDistance(c,e),this.addCurrentVertex(e,m,0,0,g),c=e}}}}addCurrentVertex(t,e,i,r,n,s=!1){let o=e.y*r-e.x,a=-e.y-e.x*r;this.addHalfVertex(t,e.x+e.y*i,e.y-e.x*i,s,!1,i,n),this.addHalfVertex(t,o,a,s,!0,-r,n),this.distance>16384&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,i,r,n,s))}addHalfVertex({x:t,y:e},i,r,n,s,o,a){let l=.5*(this.lineClips?32767*this.scaledDistance:this.scaledDistance);this.layoutVertexArray.emplaceBack(+!!n+(t<<1),+!!s+(e<<1),Math.round(63*i)+128,Math.round(63*r)+128,1+(0===o?0:o<0?-1:1)|(63&l)<<2,l>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);let h=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,h,this.e2),a.primitiveLength++),s?this.e2=h:this.e1=h}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}hasLineDasharray(t){for(let e of t){let t=e.paint.get("line-dasharray");if(t&&!t.isConstant())return!0}return!1}addLineDashDependencies(t,e,i,r){for(let n of t){let t=n.paint.get("line-dasharray");if(!t||"constant"===t.value.kind)continue;let s="round"===n.layout.get("line-cap").evaluate(e,{}),o={dasharray:t.value.evaluate({zoom:i-1},e,{}),round:s},a={dasharray:t.value.evaluate({zoom:i},e,{}),round:s},l={dasharray:t.value.evaluate({zoom:i+1},e,{}),round:s},h=`${o.dasharray.join(",")},${o.round}`,u=`${a.dasharray.join(",")},${a.round}`,c=`${l.dasharray.join(",")},${l.round}`;r.dashDependencies[h]=o,r.dashDependencies[u]=a,r.dashDependencies[c]=l,e.dashes[n.id]={min:h,mid:u,max:c}}}};let wc,bc;to("LineBucket",vc,{omit:["layers","patternFeatures"]});var xc={get paint(){return bc||=new Mo({"line-opacity":new wo(we.paint_line["line-opacity"],"line-opacity"),"line-layer-opacity":new vo(we.paint_line["line-layer-opacity"],"line-layer-opacity"),"line-color":new wo(we.paint_line["line-color"],"line-color"),"line-translate":new vo(we.paint_line["line-translate"],"line-translate"),"line-translate-anchor":new vo(we.paint_line["line-translate-anchor"],"line-translate-anchor"),"line-width":new wo(we.paint_line["line-width"],"line-width"),"line-gap-width":new wo(we.paint_line["line-gap-width"],"line-gap-width"),"line-offset":new wo(we.paint_line["line-offset"],"line-offset"),"line-blur":new wo(we.paint_line["line-blur"],"line-blur"),"line-dasharray":new bo(we.paint_line["line-dasharray"],"line-dasharray"),"line-pattern":new bo(we.paint_line["line-pattern"],"line-pattern"),"line-gradient":new Do(we.paint_line["line-gradient"],"line-gradient")})},get layout(){return wc||=new Mo({"line-cap":new wo(we.layout_line["line-cap"],"line-cap"),"line-join":new wo(we.layout_line["line-join"],"line-join"),"line-miter-limit":new wo(we.layout_line["line-miter-limit"],"line-miter-limit"),"line-round-limit":new wo(we.layout_line["line-round-limit"],"line-round-limit"),"line-sort-key":new wo(we.layout_line["line-sort-key"],"line-sort-key")})}},Dc=class extends wo{possiblyEvaluate(t,e){return e=new ao(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,i,r){return e=Et({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,i,r)}};let Mc;var Ec=class extends Fo{constructor(t,e){super(t,xc,e),this.gradientVersion=0,Mc||(Mc=new Dc(xc.paint.properties["line-width"].specification,"line-floorwidth"),Mc.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if("line-gradient"===t){let t=this.gradientExpression();this.stepInterpolant=!!function(t){return void 0!==t._styleExpression}(t)&&t._styleExpression.expression instanceof $i,this.gradientVersion=(this.gradientVersion+1)%(2**53-1)}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=Mc.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new vc(t)}queryRadius(t){let e=t,i=Ac(Ol("line-width",this,e),Ol("line-gap-width",this,e)),r=Ol("line-offset",this,e);return i/2+Math.abs(r)+Bl(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:i,geometry:r,transform:n,pixelsToTileUnits:s}){let o=Ll(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-n.bearingInRadians,s),a=s/2*Ac(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),l=this.paint.get("line-offset").evaluate(e,i);return l&&(r=function(t,e){let i=[];for(let r of t){let t=Ul(r),n=[];for(let i=0;i<t.length;i++){let r=t[i],s=t[i-1],o=t[i+1],a=0===i?new u(0,0):r.sub(s)._unit()._perp(),l=i===t.length-1?new u(0,0):o.sub(r)._unit()._perp(),h=a._add(l)._unit(),c=h.x*l.x+h.y*l.y;0!==c&&h._mult(1/c),n.push(h._mult(e)._add(r))}i.push(n)}return i}(r,l*s)),function(t,e,i){for(let r of e){if(t.length>=3)for(let e of r)if($l(t,e))return!0;if(Sl(t,r,i))return!0}return!1}(o,r,a)}isTileClipped(){return!0}};function Ac(t,e){return e>0?e+2*t:t}const Fc=$o([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"},{name:"a_height_offset",components:1,type:"Float32"}],4),zc=$o([{name:"a_projected_pos",components:3,type:"Float32"}],4);$o([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Sc=$o([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);$o([{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"}]);const Cc=$o([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Tc=$o([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);$o([{name:"triangle",components:3,type:"Uint16"}]),$o([{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"},{type:"Float32",name:"heightOffset"}]),$o([{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",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"},{type:"Float32",name:"heightOffset"}]),$o([{type:"Float32",name:"offsetX"}]),$o([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),$o([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Pc=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(t){this.pluginStatus=t.pluginStatus,this.pluginURL=t.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(t){if(Pc.isParsed())throw Error("RTL text plugin already registered.");this.applyArabicShaping=t.applyArabicShaping,this.processBidirectionalText=t.processBidirectionalText,this.processStyledBidirectionalText=t.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return null!=this.applyArabicShaping&&null!=this.processBidirectionalText&&null!=this.processStyledBidirectionalText}getRTLTextPluginStatus(){return this.pluginStatus}async syncState(t,e){if(this.isParsed())return this.getState();if("loading"!==t.pluginStatus)return this.setState(t),t;let i=t.pluginURL,r=new Promise((t=>{this.loadScriptResolve=t})),n=new Promise((t=>setTimeout((()=>t()),this.TIMEOUT)));if(await e(i),await Promise.race([r,n]),this.isParsed()){let t={pluginStatus:"loaded",pluginURL:i};return this.setState(t),t}throw this.setState({pluginStatus:"error",pluginURL:""}),Error(`RTL Text Plugin failed to import scripts from ${i}`)}};function Ic(t){return/[\u02EA\u02EB\u2E80-\u2FDF\u2FF0-\u303F\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FD-\u30FF\u3105-\u312F\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(t))}function kc(t){return/[\u02EA\u02EB\u1100-\u11FF\u1401-\u167F\u18B0-\u18FF\u2065\u20DD-\u20E0\u20E2-\u20E4\u2B97\u2BF0-\u2BFF\u2E50\u2E51\u2E80-\u3007\u3012\u3013\u3020-\u302F\u3031-\u30FB\u30FD-\uA4CF\uA960-\uA97F\uAC00-\uD7FF\uF900-\uFAFF\uFE10-\uFE1F\uFE30-\uFE48\uFE50-\uFE57\uFE5F-\uFE62\uFE67-\uFE6F\uFF00-\uFF07\uFF0A-\uFF0C\uFF0E-\uFF19\uFF1F-\uFF3A\uFF3C\uFF3E\uFF40-\uFF5A\uFFE0-\uFFE2\uFFE4-\uFFE7\uFFF0-\uFFF8]|\uD802[\uDD80-\uDD9F]|\uD805[\uDD80-\uDDFF]|\uD806[\uDE00-\uDEBF]|[\uD80C-\uD810\uD81C-\uD822\uD83C\uD83D\uD840-\uD87E\uD880-\uD8BE][\uDC00-\uDFFF]|\uD811[\uDC00-\uDE7F]|\uD81B[\uDFE0-\uDFFF]|\uD823[\uDC00-\uDDFF]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFF]|\uD833[\uDEC0-\uDFCF]|\uD834[\uDC00-\uDDFF\uDEE0-\uDF7F]|\uD836[\uDC00-\uDEAF]|\uD83E[\uDD00-\uDEFF]|[\uD87F\uD8BF][\uDC00-\uDFFD]/gim.test(String.fromCodePoint(t))}function $c(t){return/[\u0E01-\u0E3A\u0E40-\u0E4E\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECE\u0EDC-\u0EDF\u0F00-\u0F47\u0F49-\u0F6C\u0F71-\u0F97\u0F99-\u0FBC\u0FBE-\u0FCC\u0FCE-\u0FD4\u0FD9\u0FDA\u1000-\u103F\u1050-\u108F\u109A-\u109F\u1780-\u17D3\u17D7\u17DC\u17DD\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19DE\u19DF\u1A20-\u1A5E\u1A60-\u1A7C\u1AA0-\u1AAD\u1B00-\u1B4C\u1B4E-\u1B7F\uA980-\uA9CD\uA9D0-\uA9D9\uA9DE-\uA9EF\uA9FA-\uA9FE\uAA60-\uAAC2\uAADB-\uAADF]|\uD805[\uDF00-\uDF1A\uDF1D-\uDF2B\uDF3A\uDF3B\uDF3F-\uDF46]/gim.test(String.fromCodePoint(t))}function jc(t,e){return/(?:[\u1039\u17D2\u1A60\u1BAB\u200D\uAAF6]|\uD802\uDE3F|\uD804[\uDD33\uDFD0]|\uD806[\uDD3E\uDE47\uDE99]|\uD807[\uDD45\uDD97\uDF42])$/.test(t)||/^\p{gc=Mc}/u.test(e)}const Rc={C:"18g,1;g2,3;4nb,1",D:"17k,1;5,1;1,1;1,5;4,d;1,7;1,2;z,2;8,g;i,12;1,2;9,1;1,1;1,2;14,3;2,1;28,9;3,f;2,4;1,1;2,3;2,6;7a,1;2,5;1,1;g,a;5,2;2,6;1,f",R:"17m,4;1,1;1,1;5,4;l,1;14,3;1,3;g,i;12,1;2,9;1,1;1,1;2,2;1,1;o,2;2x,3;f,2;4,1;1,2;3,2;6u,j;b,1;r,3;1,1;2,2;6,1",T:"174,b;1,1;1a,l;g,1;2t,7;2,6;2,2;1,4;bt,9;16,o;1,t;1clb,1"},Oc={1569:[65152,0,0,0],1570:[65153,65154,0,0],1571:[65155,65156,0,0],1572:[65157,65158,0,0],1573:[65159,65160,0,0],1574:[65161,65162,65163,65164],1575:[65165,65166,0,0],1576:[65167,65168,65169,65170],1577:[65171,65172,0,0],1578:[65173,65174,65175,65176],1579:[65177,65178,65179,65180],1580:[65181,65182,65183,65184],1581:[65185,65186,65187,65188],1582:[65189,65190,65191,65192],1583:[65193,65194,0,0],1584:[65195,65196,0,0],1585:[65197,65198,0,0],1586:[65199,65200,0,0],1587:[65201,65202,65203,65204],1588:[65205,65206,65207,65208],1589:[65209,65210,65211,65212],1590:[65213,65214,65215,65216],1591:[65217,65218,65219,65220],1592:[65221,65222,65223,65224],1593:[65225,65226,65227,65228],1594:[65229,65230,65231,65232],1601:[65233,65234,65235,65236],1602:[65237,65238,65239,65240],1603:[65241,65242,65243,65244],1604:[65245,65246,65247,65248],1605:[65249,65250,65251,65252],1606:[65253,65254,65255,65256],1607:[65257,65258,65259,65260],1608:[65261,65262,0,0],1609:[65263,65264,64488,64489],1610:[65265,65266,65267,65268],1611:[65136,0,0,65137],1612:[65138,0,0,0],1613:[65140,0,0,0],1614:[65142,0,0,65143],1615:[65144,0,0,65145],1616:[65146,0,0,65147],1617:[65148,0,0,65149],1618:[65150,0,0,65151],1649:[64336,64337,0,0],1655:[64477,0,0,0],1657:[64358,64359,64360,64361],1658:[64350,64351,64352,64353],1659:[64338,64339,64340,64341],1662:[64342,64343,64344,64345],1663:[64354,64355,64356,64357],1664:[64346,64347,64348,64349],1667:[64374,64375,64376,64377],1668:[64370,64371,64372,64373],1670:[64378,64379,64380,64381],1671:[64382,64383,64384,64385],1672:[64392,64393,0,0],1676:[64388,64389,0,0],1677:[64386,64387,0,0],1678:[64390,64391,0,0],1681:[64396,64397,0,0],1688:[64394,64395,0,0],1700:[64362,64363,64364,64365],1702:[64366,64367,64368,64369],1705:[64398,64399,64400,64401],1709:[64467,64468,64469,64470],1711:[64402,64403,64404,64405],1713:[64410,64411,64412,64413],1715:[64406,64407,64408,64409],1722:[64414,64415,0,0],1723:[64416,64417,64418,64419],1726:[64426,64427,64428,64429],1728:[64420,64421,0,0],1729:[64422,64423,64424,64425],1733:[64480,64481,0,0],1734:[64473,64474,0,0],1735:[64471,64472,0,0],1736:[64475,64476,0,0],1737:[64482,64483,0,0],1739:[64478,64479,0,0],1740:[64508,64509,64510,64511],1744:[64484,64485,64486,64487],1746:[64430,64431,0,0],1747:[64432,64433,0,0]},Bc={لآ:[65269,65270],لأ:[65271,65272],لإ:[65273,65274],لا:[65275,65276]},Lc=/[\u0600-\u06ff\u0750-\u077f\u0870-\u089f\u08a0-\u08ff\ufb50-\ufdff\ufe70-\ufeff]/;function Uc(t,e,i){let r=0;for(let n of t.split(";")){let[t,s]=n.split(",").map((t=>parseInt(t,36))),o=r+t;for(let t=o;t<o+s;t++)i.set(t,e);r=o+s}}const Nc=new Map;for(let[t,e]of Object.entries(Rc))Uc(e,t,Nc);function Gc(t){return Nc.get(t)??"U"}function qc(t){return"D"===t||"L"===t||"C"===t}function Vc(t){return"D"===t||"R"===t||"C"===t}function Zc(t,e,i){return"D"===t?e&&i?3:e?1:i?2:0:"R"===t?+!!e:"L"===t?i?2:0:null}function Wc(t){if(!Lc.test(t))return t;let e=function(t){return[...t].map((t=>{let e=t.codePointAt(0);return{codePoint:e,type:Gc(e),form:null}}))}(t);return function(t){let e=t.filter((t=>"T"!==t.type));for(let t=0;t<e.length;t++){let i=e[t],r=t>0&&qc(e[t-1].type),n=t+1<e.length&&Vc(e[t+1].type);i.form=Zc(i.type,r,n)}}(e),function(t){let e=!1;for(let i of t)"T"===i.type?i.form=e?3:0:e=2===i.form||3===i.form}(e),function(t){let e=[];for(let i=0;i<t.length;i++){let r=t[i];if(1604!==r.codePoint){e.push(r);continue}let n=i+1;for(;n<t.length&&"T"===t[n].type;)n++;let s=t[n],o=s&&Bc[String.fromCodePoint(1604,s.codePoint)];o?(e.push({codePoint:o[+!(3!==r.form&&1!==r.form)],type:"R",form:0}),e.push(...t.slice(i+1,n)),i=n):e.push(r)}return e}(e).map((t=>String.fromCodePoint(function(t){if(null===t.form)return t.codePoint;let e=Oc[t.codePoint];return e&&(e[t.form]||e[0])||t.codePoint}(t)))).join("")}function Hc(t,e,i){let r=e.layout.get("text-transform").evaluate(i,{});return"uppercase"===r?t=t.toLocaleUpperCase():"lowercase"===r&&(t=t.toLocaleLowerCase()),(Pc.applyArabicShaping??Wc)(t)}function Yc(t,e,i){for(let r of t.sections)r.text=Hc(r.text,e,i);return t}function Xc(t,e,i){let r=i?e.last.points:e.first.points,n=i?r[r.length-1]:r[0];return`${t}:${n.x}:${n.y}`}function Jc(t){let e=t.first.points,i=e.length;for(let e=t.first.next;e;e=e.next)i+=e.points.length-1;let r=Array(i);for(let t=0;t<e.length;t++)r[t]=e[t];let n=e.length;for(let e=t.first.next;e;e=e.next){let t=e.points;for(let e=1;e<t.length;e++)r[n++]=t[e]}return r}function Kc(t,e,i,r,n){let s=e[i];delete e[i],e[r]=s;let o=t[s];return o.last.next=n.first,o.last=n.last,s}function Qc(t,e,i,r,n){let s=e[r];delete e[r],e[i]=s;let o=t[s];return n.last.next=o.first,o.first=n.first,s}const tf=typeof Intl<"u"&&"Segmenter"in Intl;let ef,rf;function nf(t){if(!tf||!function(t){return/[\r\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0600-\u0605\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DD\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u070F\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0890\u0891\u0897-\u089F\u08CA-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D62\u0D63\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E33-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB3-\u0EBC\u0EC8-\u0ECE\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1037\u1039-\u103E\u1056-\u1059\u105E-\u1060\u1071-\u1074\u1082\u1084-\u1086\u108D\u109D\u1100-\u11FF\u135D-\u135F\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60\u1A62\u1A65-\u1A7C\u1A7F\u1AB0-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA960-\uA97C\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFF9E\uFF9F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDD69-\uDD6D\uDEAB\uDEAC\uDEFA-\uDEFF\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC82\uDCB0-\uDCBA\uDCBD\uDCC2\uDCCD\uDD00-\uDD02\uDD27-\uDD34\uDD45\uDD46\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDC2\uDDC3\uDDC9-\uDDCC\uDDCE\uDDCF\uDE2C-\uDE37\uDE3E\uDE41\uDEDF-\uDEEA\uDF00-\uDF03\uDF3B\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74\uDFB8-\uDFC0\uDFC2\uDFC5\uDFC7-\uDFCA\uDFCC-\uDFD2\uDFE1\uDFE2]|\uD805[\uDC35-\uDC46\uDC5E\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDEAB-\uDEB7\uDF1D-\uDF1F\uDF22-\uDF2B]|\uD806[\uDC2C-\uDC3A\uDD30-\uDD35\uDD37\uDD38\uDD3B-\uDD43\uDDD1-\uDDD7\uDDDA-\uDDE0\uDDE4\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE3E\uDE47\uDE51-\uDE5B\uDE84-\uDE99\uDF60-\uDF67]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD8A-\uDD8E\uDD90\uDD91\uDD93-\uDD97\uDEF3-\uDEF6\uDF00-\uDF03\uDF34-\uDF3A\uDF3E-\uDF42\uDF5A]|\uD80D[\uDC40\uDC47-\uDC55]|\uD818[\uDD1E-\uDD2F]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDD63\uDD67-\uDD6A\uDF4F\uDF51-\uDF87\uDF8F-\uDF92\uDFE4\uDFF0\uDFF1]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDC8F\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD839[\uDCEC-\uDCEF\uDDEE\uDDEF\uDEE3\uDEE6\uDEEE\uDEEF\uDEF5]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uD83C[\uDDE6-\uDDFF\uDFFB-\uDFFF]|\uDB40[\uDC20-\uDC7F\uDD00-\uDDEF]/.test(t)}(t))return[...t];ef??=new Intl.Segmenter(void 0,{granularity:"grapheme"});let e=[];for(let{segment:i}of ef.segment(t)){let t=e.length-1;t>=0&&jc(e[t],i)?e[t]+=i:e.push(i)}return e}function sf(t){let e=new Set;if(tf){rf??=new Intl.Segmenter(void 0,{granularity:"word"});for(let{index:i}of rf.segment(t))e.add(i);return e}let i=0;for(let r of t.split(/\b|(?=\p{Ideo})/u))e.add(i),i+=r.length;return e}function of(t){let e=t.codePointAt(0);return t.length>(e>65535?2:1)}function af(t){return/\s/u.test(String.fromCodePoint(t))}function lf(t){for(let e of t)if(kc(e.codePointAt(0)))return!0;return!1}function hf(t){for(let e of t)if(!uf(e.codePointAt(0)))return!1;return!0}function uf(t){return!function(t){return/[\u0600-\u0604\u0606-\u060B\u060D-\u061A\u061C-\u061E\u0620-\u063F\u0641-\u064A\u0656-\u066F\u0671-\u06DC\u06DE-\u070D\u070F-\u074A\u074D-\u077F\u07C0-\u07FA\u07FD-\u07FF\u0840-\u085B\u085E\u0860-\u086A\u0870-\u0891\u0897-\u08E1\u08E3-\u08FF\u1800\u1801\u1804\u1806-\u1819\u1820-\u1878\u1880-\u18AA\uA840-\uA877\uFB50-\uFD3D\uFD40-\uFDCF\uFDF0-\uFDFF\uFE70-\uFE74\uFE76-\uFEFC]|\uD802[\uDEC0-\uDEE6\uDEEB-\uDEF6\uDF80-\uDF91\uDF99-\uDF9C\uDFA9-\uDFAF]|\uD803[\uDD00-\uDD27\uDD30-\uDD39\uDE60-\uDE7E\uDEC2-\uDEC7\uDED0-\uDED8\uDEFA-\uDEFF\uDF30-\uDF59\uDF70-\uDF89\uDFB0-\uDFCB]|\uD805[\uDE60-\uDE6C]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9C-\uDC9F]|\uD83A[\uDD00-\uDD4B\uDD50-\uDD59\uDD5E\uDD5F]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB\uDEF0\uDEF1]/gim.test(String.fromCodePoint(t))}(t)}function cf(t){return!(kc(t)||function(t){return/[\xA7\xA9\xAE\xB1\xBC-\xBE\xD7\xF7\u2016\u2020\u2021\u2030\u2031\u203B\u203C\u2042\u2047-\u2049\u2051\u2100-\u218F\u221E\u2234\u2235\u2300-\u2307\u230C-\u231F\u2324-\u2328\u232B\u237D-\u239A\u23BE-\u23CD\u23CF\u23D1-\u23DB\u23E2-\u2422\u2424-\u24FF\u25A0-\u2619\u2620-\u2767\u2776-\u2793\u2B12-\u2B2F\u2B50-\u2B59\u2BB8-\u2BEB\u3000-\u303F\u30A0-\u30FF\uE000-\uF8FF\uFE30-\uFE6F\uFF00-\uFFEF\uFFFC\uFFFD]|[\uDB80-\uDBFF][\uDC00-\uDFFF]/gim.test(String.fromCodePoint(t))}(t))}function ff(t){return/\p{sc=Arab}/u.test(String.fromCodePoint(t))}function pf(t){return function(t){return/[\u0591-\u05C7\u05D0-\u05EA\u05EF-\u05F4\u0600-\u0604\u0606-\u060B\u060D-\u061A\u061C-\u061E\u0620-\u063F\u0641-\u064A\u0656-\u066F\u0671-\u06DC\u06DE-\u070D\u070F-\u074A\u074D-\u07B1\u07C0-\u07FA\u07FD-\u082D\u0830-\u083E\u0840-\u085B\u085E\u0860-\u086A\u0870-\u0891\u0897-\u08E1\u08E3-\u08FF\uFB1D-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFD3D\uFD40-\uFDCF\uFDF0-\uFDFF\uFE70-\uFE74\uFE76-\uFEFC]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC57-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD1F-\uDD39\uDD3F-\uDD59\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE38-\uDE3A\uDE3F-\uDE48\uDE50-\uDE58\uDE60-\uDE9F\uDEC0-\uDEE6\uDEEB-\uDEF6\uDF00-\uDF35\uDF39-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDF99-\uDF9C\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD27\uDD30-\uDD39\uDD40-\uDD65\uDD69-\uDD85\uDD8E\uDD8F\uDE60-\uDE7E\uDE80-\uDEA9\uDEAB-\uDEAD\uDEB0\uDEB1\uDEC2-\uDEC7\uDED0-\uDED8\uDEFA-\uDF27\uDF30-\uDF59\uDF70-\uDF89\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCD6\uDD00-\uDD4B\uDD50-\uDD59\uDD5E\uDD5F]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB\uDEF0\uDEF1]/gim.test(String.fromCodePoint(t))}(t)}function df(t){for(let e of t)if(pf(e.codePointAt(0)))return!0;return!1}const mf={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","⋯":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},_f={10:!0,13:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},gf={40:!0};function yf(t,e,i,r,n,s){if("fontStack"in e){let r=i[e.fontStack],s=r?.[t];if(s)return s.metrics.advance*e.scale+n;let o=0;for(let i of t){let t=r?.[i];t&&(o+=t.metrics.advance*e.scale+n)}return o}{let t=r[e.imageName];return t?t.displaySize[0]*e.scale*24/s+n:0}}function vf(t,e,i,r){let n=(t-e)**2;return r?t<e?n/2:2*n:n+Math.abs(i)*i}function wf(t){return/^\s+$/u.test(t)}function bf(t,e,i){let r=0;return(10===t||13===t)&&(r-=1e4),i&&(r+=150),(40===t||65288===t)&&(r+=50),(41===e||65289===e)&&(r+=50),r}function xf(t,e,i,r,n,s){let o=null,a=vf(e,i,n,s);for(let t of r){let r=vf(e-t.x,i,n,s)+t.badness;r<=a&&(o=t,a=r)}return{index:t,x:e,priorBreak:o,badness:a}}function Df(t){return t?Df(t.priorBreak).concat(t.index):[]}var Mf=class t{constructor(t="",e=[],i=[]){this.text=t,this.sections=e,this.sectionIndex=i,this.imageSectionID=null,this._graphemes=null}graphemes(){return this._graphemes??=nf(this.text),this._graphemes}static fromFeature(e,i){let r=new t;for(let t of e.sections)t.image?r.addImageSection(t):r.addTextSection(t,i);return r}length(){return this.graphemes().length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}verticalizePunctuation(){this.text=function(t){let e="",i={premature:!0,value:void 0},r=t[Symbol.iterator](),n=r.next(),s=t[Symbol.iterator]();s.next();let o=s.next();for(;!n.done;)!o.done&&cf(o.value.codePointAt(0))&&!mf[o.value]||!i.premature&&cf(i.value.codePointAt(0))&&!mf[i.value]||!mf[n.value]?e+=n.value:e+=mf[n.value],i={value:n.value,premature:!1},n=r.next(),o=s.next();return e}(this.text),this._graphemes=null}hasZeroWidthSpaces(){return this.text.includes("")}trim(){let t=this.graphemes(),e=0;for(;e<t.length&&wf(t[e]);)e++;let i=t.length;for(;i>e&&wf(t[i-1]);)i--;this.text=t.slice(e,i).join(""),this.sectionIndex=this.sectionIndex.slice(e,i),this._graphemes=null}substring(e,i){let r=this.graphemes().slice(e,i).join(""),n=this.sectionIndex.slice(e,i);return new t(r,this.sections,n)}toCodeUnitIndex(t){return this.graphemes().slice(0,t).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((t,e)=>Math.max(t,this.sections[e].scale)),0)}getMaxImageSize(t){let e=0,i=0;for(let r=0;r<this.length();r++){let n=this.getSection(r);if("imageName"in n){let r=t[n.imageName];if(!r)continue;let s=r.displaySize;e=Math.max(e,s[0]),i=Math.max(i,s[1])}}return{maxImageWidth:e,maxImageHeight:i}}_appendSection(t,e){let i=this.graphemes(),r=i.length>0?i[i.length-1]:"",n=nf(r+t);this.text+=t,this._graphemes=i.slice(0,r?-1:void 0).concat(n);let s=n.length-+!!r;for(let t=0;t<s;t++)this.sectionIndex.push(e)}addTextSection(t,e){this.sections.push({scale:t.scale||1,verticalAlign:t.verticalAlign||"bottom",fontStack:t.fontStack||e}),this._appendSection(t.text,this.sections.length-1)}addImageSection(t){let e=t.image?t.image.name:"";if(0===e.length)return void Rt("Can't add FormattedSection with an empty image.");let i=this.getNextImageSectionCharCode();i?(this.sections.push({scale:1,verticalAlign:t.verticalAlign||"bottom",imageName:e}),this._appendSection(String.fromCharCode(i),this.sections.length-1)):Rt("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(t,e,i,r,n){let s=[],o=this.determineAverageLineWidth(t,e,i,r,n),a=this.hasZeroWidthSpaces(),l=this.graphemes(),h=null,u=0,c=0;for(let e=0;e<l.length;e++){let f=l[e];if(e>0){let t=l[e-1].codePointAt(0),i=f.codePointAt(0),r=Ic(t),n=$c(t)&&$c(i);(_f[t]||r||"imageName"in this.getSection(e-1)||void 0!==l[e+1]&&gf[i]||n&&(h??=sf(this.text)).has(c))&&s.push(xf(e,u,o,s,bf(t,i,r&&a),!1))}af(f.codePointAt(0))||(u+=yf(f,this.getSection(e),i,r,t,n)),c+=f.length}return Df(xf(this.length(),u,o,s,0,!0))}determineAverageLineWidth(t,e,i,r,n){let s=0,o=0;for(let e of this.graphemes())s+=yf(e,this.getSection(o),i,r,t,n),o++;return s/Math.max(1,Math.ceil(s/e))}};const Ef=function(t){var e={R:"13k,1a,2,3,3,2+1j,ch+16,a+1,5+2,2+n,5,a,4,6+16,4+3,h+1b,4mo,179q,2+9,2+11,2i9+7y,2+68,4,3+4,5+13,4+3,2+4k,3+29,8+cf,1t+7z,w+17,3+3m,1t+3z,16o1+5r,8+30,8+mc,29+1r,29+4v,75+73",EN:"1c+9,3d+1,6,187+9,513,4+5,7+9,sf+j,175h+9,qw+q,161f+1d,4xt+a,25i+9",ES:"17,2,6dp+1,f+1,av,16vr,mx+1,4o,2",ET:"z+2,3h+3,b+1,ym,3e+1,2o,p4+1,8,6u,7c,g6,1wc,1n9+4,30+1b,2n,6d,qhx+1,h0m,a+1,49+2,63+1,4+1,6bb+3,12jj",AN:"16o+5,2j+9,2+1,35,ed,1ff2+9,87+u",CS:"18,2+1,b,2u,12k,55v,l,17v0,2,3,53,2+1,b",B:"a,3,f+2,2v,690",S:"9,2,k",WS:"c,k,4f4,1vk+a,u,1j,335",ON:"x+1,4+4,h+5,r+5,r+3,z,5+3,2+1,2+1,5,2+2,3+4,o,w,ci+1,8+d,3+d,6+8,2+g,39+1,9,6+1,2,33,b8,3+1,3c+1,7+1,5r,b,7h+3,sa+5,2,3i+6,jg+3,ur+9,2v,ij+1,9g+9,7+a,8m,4+1,49+x,14u,2+2,c+2,e+2,e+2,e+1,i+n,e+e,2+p,u+2,e+2,36+1,2+3,2+1,b,2+2,6+5,2,2,2,h+1,5+4,6+3,3+f,16+2,5+3l,3+81,1y+p,2+40,q+a,m+13,2r+ch,2+9e,75+hf,3+v,2+2w,6e+5,f+6,75+2a,1a+p,2+2g,d+5x,r+b,6+3,4+o,g,6+1,6+2,2k+1,4,2j,5h+z,1m+1,1e+f,t+2,1f+e,d+3,4o+3,2s+1,w,535+1r,h3l+1i,93+2,2s,b+1,3l+x,2v,4g+3,21+3,kz+1,g5v+1,5a,j+9,n+v,2,3,2+8,2+1,3+2,2,3,46+1,4+4,h+5,r+5,r+a,3h+2,4+6,b+4,78,1r+24,4+c,4,1hb,ey+6,103+j,16j+c,1ux+7,5+g,fsh,jdq+1t,4,57+2e,p1,1m,1m,1m,1m,4kt+1,7j+17,5+2r,d+e,3+e,2+e,2+10,m+4,w,1n+5,1q,4z+5,4b+rb,9+c,4+c,4+37,d+2g,8+b,l+b,5+1j,9+9,7+13,9+t,3+1,27+3c,2+29,2+3q,d+d,3+4,4+2,6+6,a+o,8+6,a+2,e+6,16+42,2+1i",BN:"0+8,6+d,2s+5,2+p,e,4m9,1kt+2,2b+5,5+5,17q9+v,7k,6p+8,6+1,119d+3,440+7,96s+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+75,6p+2rz,1ben+1,1ekf+1,1ekf+1",NSM:"lc+33,7o+6,7c+18,2,2+1,2+1,2,21+a,1d+k,h,2u+6,3+5,3+1,2+3,10,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,g+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+g,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,k1+w,2db+2,3y,2p+v,ff+3,30+1,n9x+3,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,r2,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+5,3+1,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2d+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,f0c+4,1o+6,t5,1s+3,2a,f5l+1,43t+2,i+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,gzhy+6n",AL:"16w,3,2,e+1b,z+2,2+2s,g+1,8+1,b+m,2+t,s+2i,c+e,4h+f,1d+1e,1bwe+dp,3+3z,x+c,2+1,35+3y,2rm+z,5+7,b+5,dt+l,c+u,17nl+27,1t+27,4x+6n,3+d",LRO:"6ct",RLO:"6cu",LRE:"6cq",RLE:"6cr",PDF:"6cs",LRI:"6ee",RLI:"6ef",FSI:"6eg",PDI:"6eh"},i={},r={};i.L=1,r[1]="L",Object.keys(e).forEach((function(t,e){i[t]=1<<e+1,r[i[t]]=t})),Object.freeze(i);var n=i.LRI|i.RLI|i.FSI,s=i.L|i.R|i.AL,o=i.B|i.S|i.WS|i.ON|i.FSI|i.LRI|i.RLI|i.PDI,a=i.BN|i.RLE|i.LRE|i.RLO|i.LRO|i.PDF,l=i.S|i.WS|i.B|n|i.PDI|a,h=null;function u(t){return function(){if(!h){h=new Map;var t=0;for(var r in e)if(e.hasOwnProperty(r))for(var n=e[r],s="",o=void 0,a=!1,l=0,u=0;u<=n.length+1;u+=1){var c=n[u];if(","!==c&&u!==n.length)"+"===c?(a=!0,l=t=l+parseInt(s,36),s=""):s+=c;else{a?o=t+parseInt(s,36):(l=t=l+parseInt(s,36),o=t),a=!1,s="",l=o;for(var f=t;f<o+1;f+=1)h.set(f,i[r])}}}}(),h.get(t.codePointAt(0))||i.L}var c,f,p,d="14>1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",m="6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye";function _(t,e){var i,r=0,n=new Map,s=e&&new Map;return t.split(",").forEach((function t(o){if(-1!==o.indexOf("+"))for(var a=+o;a--;)t(i);else{i=o;var l=o.split(">"),h=l[0],u=l[1];h=String.fromCodePoint(r+=parseInt(h,36)),u=String.fromCodePoint(r+=parseInt(u,36)),n.set(h,u),e&&s.set(u,h)}})),{map:n,reverseMap:s}}function g(){if(!c){var t=_(d,!0);c=t.map,f=t.reverseMap,p=_(m,!1).map}}function y(t){return g(),c.get(t)||null}function v(t){return g(),f.get(t)||null}function w(t){return g(),p.get(t)||null}var b,x=i.L,D=i.R,M=i.EN,E=i.ES,A=i.ET,F=i.AN,z=i.CS,S=i.B,C=i.S,T=i.ON,P=i.BN,I=i.NSM,k=i.AL,$=i.LRO,j=i.RLO,R=i.LRE,O=i.RLE,B=i.PDF,L=i.LRI,U=i.RLI,N=i.FSI,G=i.PDI;function q(t){return function(){if(!b){var t=_("14>1,j>2,t>2,u>2,1a>g,2v3>1,1>1,1ge>1,1wd>1,b>1,1j>1,f>1,ai>3,-2>3,+1,8>1k0,-1jq>1y7,-1y6>1hf,-1he>1h6,-1h5>1ha,-1h8>1qi,-1pu>1,6>3u,-3s>7,6>1,1>1,f>1,1>1,+2,3>1,1>1,+13,4>1,1>1,6>1eo,-1ee>1,3>1mg,-1me>1mk,-1mj>1mi,-1mg>1mi,-1md>1,1>1,+2,1>10k,-103>1,1>1,4>1,5>1,1>1,+10,3>1,1>8,-7>8,+1,-6>7,+1,a>1,1>1,u>1,u6>1,1>1,+5,26>1,1>1,2>1,2>2,8>1,7>1,4>1,1>1,+5,b8>1,1>1,+3,1>3,-2>1,2>1,1>1,+2,c>1,3>1,1>1,+2,h>1,3>1,a>1,1>1,2>1,3>1,1>1,d>1,f>1,3>1,1a>1,1>1,6>1,7>1,13>1,k>1,1>1,+19,4>1,1>1,+2,2>1,1>1,+18,m>1,a>1,1>1,lk>1,1>1,4>1,2>1,f>1,3>1,1>1,+3,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,6>1,4j>1,j>2,t>2,u>2,2>1,+1",!0),e=t.map;t.reverseMap.forEach((function(t,i){e.set(i,t)})),b=e}}(),b.get(t)||null}function V(t,e,i,r){var n=t.length;i=Math.max(0,null==i?0:+i),r=Math.min(n-1,null==r?n-1:+r);var s=[];return e.paragraphs.forEach((function(n){var o=Math.max(i,n.start),a=Math.min(r,n.end);if(o<a){for(var h=e.levels.slice(o,a+1),c=a;c>=o&&u(t[c])&l;c--)h[c]=n.level;for(var f=n.level,p=1/0,d=0;d<h.length;d++){var m=h[d];m>f&&(f=m),m<p&&(p=1|m)}for(var _=f;_>=p;_--)for(var g=0;g<h.length;g++)if(h[g]>=_){for(var y=g;g+1<h.length&&h[g+1]>=_;)g++;g>y&&s.push([y+o,g+o])}}})),s}function Z(t,e,i,r){for(var n=V(t,e,i,r),s=[],o=0;o<t.length;o++)s[o]=o;return n.forEach((function(t){for(var e=t[1],i=s.slice(t[0],e+1),r=i.length;r--;)s[e-r]=i[r]})),s}return t.closingToOpeningBracket=v,t.getBidiCharType=u,t.getBidiCharTypeName=function(t){return r[u(t)]},t.getCanonicalBracket=w,t.getEmbeddingLevels=function(t,e){for(var i=new Uint32Array(t.length),r=0;r<t.length;r++)i[r]=u(t[r]);var h=new Map;function c(t,e){var r=i[t];i[t]=e,h.set(r,h.get(r)-1),r&o&&h.set(o,h.get(o)-1),h.set(e,(h.get(e)||0)+1),e&o&&h.set(o,(h.get(o)||0)+1)}for(var f=new Uint8Array(t.length),p=new Map,d=[],m=null,_=0;_<t.length;_++)m||d.push(m={start:_,end:t.length-1,level:"rtl"===e?1:"ltr"===e?0:Be(_,!1)}),i[_]&S&&(m.end=_,m=null);for(var g=O|R|j|$|n|G|B|S,b=function(t){return t+(1&t?1:2)},q=function(t){return t+(1&t?2:1)},V=0;V<d.length;V++){var Z=[{_level:(m=d[V]).level,_override:0,_isolate:0}],W=void 0,H=0,Y=0,X=0;h.clear();for(var J=m.start;J<=m.end;J++){var K=i[J];if(W=Z[Z.length-1],h.set(K,(h.get(K)||0)+1),K&o&&h.set(o,(h.get(o)||0)+1),K&g)if(K&(O|R)){f[J]=W._level;var Q=(K===O?q:b)(W._level);Q<=125&&!H&&!Y?Z.push({_level:Q,_override:0,_isolate:0}):H||Y++}else if(K&(j|$)){f[J]=W._level;var tt=(K===j?q:b)(W._level);tt<=125&&!H&&!Y?Z.push({_level:tt,_override:K&j?D:x,_isolate:0}):H||Y++}else if(K&n){K&N&&(K=1===Be(J+1,!0)?U:L),f[J]=W._level,W._override&&c(J,W._override);var et=(K===U?q:b)(W._level);et<=125&&0===H&&0===Y?(X++,Z.push({_level:et,_override:0,_isolate:1,_isolInitIndex:J})):H++}else if(K&G){if(H>0)H--;else if(X>0){for(Y=0;!Z[Z.length-1]._isolate;)Z.pop();var it=Z[Z.length-1]._isolInitIndex;null!=it&&(p.set(it,J),p.set(J,it)),Z.pop(),X--}f[J]=(W=Z[Z.length-1])._level,W._override&&c(J,W._override)}else K&B?(0===H&&(Y>0?Y--:!W._isolate&&Z.length>1&&(Z.pop(),W=Z[Z.length-1])),f[J]=W._level):K&S&&(f[J]=m.level);else f[J]=W._level,W._override&&K!==P&&c(J,W._override)}for(var rt=[],nt=null,st=m.start;st<=m.end;st++){var ot=i[st];if(!(ot&a)){var at=f[st],lt=ot&n,ht=ot===G;nt&&at===nt._level?(nt._end=st,nt._endsWithIsolInit=lt):rt.push(nt={_start:st,_end:st,_level:at,_startsWithPDI:ht,_endsWithIsolInit:lt})}}for(var ut=[],ct=0;ct<rt.length;ct++){var ft=rt[ct];if(!ft._startsWithPDI||ft._startsWithPDI&&!p.has(ft._start)){for(var pt=[nt=ft],dt=void 0;nt&&nt._endsWithIsolInit&&null!=(dt=p.get(nt._end));)for(var mt=ct+1;mt<rt.length;mt++)if(rt[mt]._start===dt){pt.push(nt=rt[mt]);break}for(var _t=[],gt=0;gt<pt.length;gt++)for(var yt=pt[gt],vt=yt._start;vt<=yt._end;vt++)_t.push(vt);for(var wt=f[_t[0]],bt=m.level,xt=_t[0]-1;xt>=0;xt--)if(!(i[xt]&a)){bt=f[xt];break}var Dt=_t[_t.length-1],Mt=f[Dt],Et=m.level;if(!(i[Dt]&n))for(var At=Dt+1;At<=m.end;At++)if(!(i[At]&a)){Et=f[At];break}ut.push({_seqIndices:_t,_sosType:Math.max(bt,wt)%2?D:x,_eosType:Math.max(Et,Mt)%2?D:x})}}for(var Ft=0;Ft<ut.length;Ft++){var zt=ut[Ft],St=zt._seqIndices,Ct=zt._sosType,Tt=zt._eosType,Pt=1&f[St[0]]?D:x;if(h.get(I))for(var It=0;It<St.length;It++){var kt=St[It];if(i[kt]&I){for(var $t=Ct,jt=It-1;jt>=0;jt--)if(!(i[St[jt]]&a)){$t=i[St[jt]];break}c(kt,$t&(n|G)?T:$t)}}if(h.get(M))for(var Rt=0;Rt<St.length;Rt++){var Ot=St[Rt];if(i[Ot]&M)for(var Bt=Rt-1;Bt>=-1;Bt--){var Lt=-1===Bt?Ct:i[St[Bt]];if(Lt&s){Lt===k&&c(Ot,F);break}}}if(h.get(k))for(var Ut=0;Ut<St.length;Ut++){var Nt=St[Ut];i[Nt]&k&&c(Nt,D)}if(h.get(E)||h.get(z))for(var Gt=1;Gt<St.length-1;Gt++){var qt=St[Gt];if(i[qt]&(E|z)){for(var Vt=0,Zt=0,Wt=Gt-1;Wt>=0&&(Vt=i[St[Wt]])&a;Wt--);for(var Ht=Gt+1;Ht<St.length&&(Zt=i[St[Ht]])&a;Ht++);Vt===Zt&&(i[qt]===E?Vt===M:Vt&(M|F))&&c(qt,Vt)}}if(h.get(M))for(var Yt=0;Yt<St.length;Yt++)if(i[St[Yt]]&M){for(var Xt=Yt-1;Xt>=0&&i[St[Xt]]&(A|a);Xt--)c(St[Xt],M);for(Yt++;Yt<St.length&&i[St[Yt]]&(A|a|M);Yt++)i[St[Yt]]!==M&&c(St[Yt],M)}if(h.get(A)||h.get(E)||h.get(z))for(var Jt=0;Jt<St.length;Jt++){var Kt=St[Jt];if(i[Kt]&(A|E|z)){c(Kt,T);for(var Qt=Jt-1;Qt>=0&&i[St[Qt]]&a;Qt--)c(St[Qt],T);for(var te=Jt+1;te<St.length&&i[St[te]]&a;te++)c(St[te],T)}}if(h.get(M))for(var ee=0,ie=Ct;ee<St.length;ee++){var re=St[ee],ne=i[re];ne&M?ie===x&&c(re,x):ne&s&&(ie=ne)}if(h.get(o)){for(var se=D|M|F,oe=se|x,ae=[],le=[],he=0;he<St.length;he++)if(i[St[he]]&o){var ue=t[St[he]],ce=void 0;if(null!==y(ue)){if(!(le.length<63))break;le.push({char:ue,seqIndex:he})}else if(null!==(ce=v(ue)))for(var fe=le.length-1;fe>=0;fe--){var pe=le[fe].char;if(pe===ce||pe===v(w(ue))||y(w(pe))===ue){ae.push([le[fe].seqIndex,he]),le.length=fe;break}}}ae.sort((function(t,e){return t[0]-e[0]}));for(var de=0;de<ae.length;de++){for(var me=ae[de],_e=me[0],ge=me[1],ye=!1,ve=0,we=_e+1;we<ge;we++){var be=St[we];if(i[be]&oe){ye=!0;var xe=i[be]&se?D:x;if(xe===Pt){ve=xe;break}}}if(ye&&!ve){ve=Ct;for(var De=_e-1;De>=0;De--){var Me=St[De];if(i[Me]&oe){var Ee=i[Me]&se?D:x;ve=Ee===Pt?Pt:Ee;break}}}if(ve){if(i[St[_e]]=i[St[ge]]=ve,ve!==Pt)for(var Ae=_e+1;Ae<St.length;Ae++)if(!(i[St[Ae]]&a)){u(t[St[Ae]])&I&&(i[St[Ae]]=ve);break}if(ve!==Pt)for(var Fe=ge+1;Fe<St.length;Fe++)if(!(i[St[Fe]]&a)){u(t[St[Fe]])&I&&(i[St[Fe]]=ve);break}}}for(var ze=0;ze<St.length;ze++)if(i[St[ze]]&o){for(var Se=ze,Ce=ze,Te=Ct,Pe=ze-1;Pe>=0;Pe--){if(!(i[St[Pe]]&a)){Te=i[St[Pe]]&se?D:x;break}Se=Pe}for(var Ie=Tt,ke=ze+1;ke<St.length;ke++){if(!(i[St[ke]]&(o|a))){Ie=i[St[ke]]&se?D:x;break}Ce=ke}for(var $e=Se;$e<=Ce;$e++)i[St[$e]]=Te===Ie?Te:Pt;ze=Ce}}}for(var je=m.start;je<=m.end;je++){var Re=i[je];if(1&f[je]?Re&(x|M|F)&&f[je]++:Re&D?f[je]++:Re&(F|M)&&(f[je]+=2),Re&a&&(f[je]=0===je?m.level:f[je-1]),je===m.end||u(t[je])&(C|S))for(var Oe=je;Oe>=0&&u(t[Oe])&l;Oe--)f[Oe]=m.level}}return{levels:f,paragraphs:d};function Be(e,r){for(var s=e;s<t.length;s++){var o=i[s];if(o&(D|k))return 1;if(o&(S|x)||r&&o===G)return 0;if(o&n){var a=Le(s);s=-1===a?t.length:a}}return 0}function Le(e){for(var r=1,s=e+1;s<t.length;s++){var o=i[s];if(o&S)break;if(o&G){if(0==--r)return s}else o&n&&r++}return-1}},t.getMirroredCharacter=q,t.getMirroredCharactersMap=function(t,e,i,r){var n=t.length;i=Math.max(0,null==i?0:+i),r=Math.min(n-1,null==r?n-1:+r);for(var s=new Map,o=i;o<=r;o++)if(1&e[o]){var a=q(t[o]);null!==a&&s.set(o,a)}return s},t.getReorderSegments=V,t.getReorderedIndices=Z,t.getReorderedString=function(t,e,i,r){var n=Z(t,e,i,r),s=[].concat(t);return n.forEach((function(i,r){s[r]=(1&e.levels[i]?q(t[i]):null)||t[i]})),s.join("")},t.openingToClosingBracket=y,Object.defineProperty(t,"__esModule",{value:!0}),t}({}),Af=/[\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/,Ff=new Set(["WS","FSI","LRI","RLI","PDI"]),zf=new Set(["S","B"]);function Sf(t){return t.level%2==0?t.text:Ef.getMirroredCharacter(t.text)??t.text}function Cf(t,e){let{levels:i,paragraphs:r}=Ef.getEmbeddingLevels(t);return function(t,e){let i=e.filter((e=>e>0&&e<t.length)),r=[...new Set([0,...i,t.length])].sort(((t,e)=>t-e)),n=[];for(let t=0;t+1<r.length;t++)n.push([r[t],r[t+1]]);return n}(t,e.concat(r.map((t=>t.start)))).map((([e,n])=>function(t,e,i,r,n){let s=function(t,e,i,r){let n=[],s=i;for(let o of nf(t.slice(i,r)))n.push({index:s,text:o,level:e[s]}),s+=o.length;return n}(t,e,r,n);!function(t,e){let i=!0;for(let r=t.length-1;r>=0;r--){let n=Ef.getBidiCharTypeName(t[r].text[0]);zf.has(n)?(t[r].level=e,i=!0):i&&Ff.has(n)?t[r].level=e:i=!1}}(s,i);let o="",a=[];for(let t of function(t,e){let i=e,r=1/0;for(let{level:e}of t)e>i&&(i=e),(1|e)<r&&(r=1|e);let n=t.slice();for(let t=i;t>=r;t--)for(let e=0;e<n.length;e++){if(n[e].level<t)continue;let i=e;for(;i+1<n.length&&n[i+1].level>=t;)i++;for(let t=e,r=i;t<r;t++,r--)[n[t],n[r]]=[n[r],n[t]];e=i}return n}(s,i)){if(Af.test(t.text))continue;let e=Sf(t);o+=e,a.push(...Array(e.length).fill(t.index))}return{text:o,sourceIndices:a}}(t,i,function(t,e){return t.find((t=>e>=t.start&&e<=t.end))?.level??0}(r,e),e,n)))}const Tf=4294967296,Pf=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");var If=class{constructor(t){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.type=0,this._valueStart=-1,this.length=this.buf.length}readFields(t,e,i=this.length){let r;for(;r=this.nextField(i);)t(r,e,this);return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){let t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){let t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){let t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Tf;return this.pos+=8,t}readSFixed64(){let t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Tf;return this.pos+=8,t}readFloat(){let t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){let t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){let e=this.buf,i=e[this.pos++];if(i<128)return i;let r,n=127&i;return r=e[this.pos++],n|=(127&r)<<7,r<128||(r=e[this.pos++],n|=(127&r)<<14,r<128)||(r=e[this.pos++],n|=(127&r)<<21,r<128)?n:(r=e[this.pos],n|=(15&r)<<28,function(t,e,i){let r,n,s=i.buf;if(n=s[i.pos++],r=(112&n)>>4,n<128||(n=s[i.pos++],r|=(127&n)<<3,n<128)||(n=s[i.pos++],r|=(127&n)<<10,n<128)||(n=s[i.pos++],r|=(127&n)<<17,n<128)||(n=s[i.pos++],r|=(127&n)<<24,n<128)||(n=s[i.pos++],r|=(1&n)<<31,n<128))return function(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}(t,r,e);throw Error("Expected varint not more than 10 bytes")}(n,t,this))}readSVarint(){let t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return!!this.readVarint()}readString(){let t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Pf?Pf.decode(this.buf.subarray(e,t)):function(t,e,i){let r="",n=e;for(;n<i;){let e,s,o,a=t[n],l=null,h=a>239?4:a>223?3:a>191?2:1;if(n+h>i)break;1===h?a<128&&(l=a):2===h?(e=t[n+1],128==(192&e)&&(l=(31&a)<<6|63&e,l<=127&&(l=null))):3===h?(e=t[n+1],s=t[n+2],128==(192&e)&&128==(192&s)&&(l=(15&a)<<12|(63&e)<<6|63&s,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===h&&(e=t[n+1],s=t[n+2],o=t[n+3],128==(192&e)&&128==(192&s)&&128==(192&o)&&(l=(15&a)<<18|(63&e)<<12|(63&s)<<6|63&o,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,h=1):l>65535&&(l-=65536,r+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),r+=String.fromCharCode(l),n+=h}return r}(this.buf,e,t)}readBytes(){let t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){let i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readVarint(e));return t}readPackedSVarint(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFloat());return t}readPackedDouble(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed64());return t}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}nextField(t=this.length){if(this.pos===this._valueStart&&this.skip(this.type),this.pos>=t)return 0;let e=this.readVarint();return this.type=7&e,this._valueStart=this.pos,e>>>3}skip(t){let e=7&t;if(0===e)for(;this.buf[this.pos++]>127;);else if(2===e)this.pos=this.readVarint()+this.pos;else if(5===e)this.pos+=4;else{if(1!==e)throw Error(`Unimplemented type: ${e}`);this.pos+=8}}};function kf(t,e,i){1===t&&i.readMessage($f,e)}function $f(t,e,i){if(3===t){let{id:t,bitmap:r,width:n,height:s,left:o,top:a,advance:l}=i.readMessage(jf,{});e.push({id:t,bitmap:new nh({width:n+6,height:s+6},r),metrics:{width:n,height:s,left:o,top:a,advance:l}})}}function jf(t,e,i){1===t?e.id=i.readVarint():2===t?e.bitmap=i.readBytes():3===t?e.width=i.readVarint():4===t?e.height=i.readVarint():5===t?e.left=i.readSVarint():6===t?e.top=i.readSVarint():7===t&&(e.advance=i.readVarint())}function Rf(t){return"function"==typeof t?.renderWithWebGL}function Of(t){let{userImage:e}=t;return!(!e?.render||!e.render()||(Rf(e.data)||t.data.replace(new Uint8Array(e.data.buffer)),0))}function Bf(t){let e=0,i=0;for(let r of t)e+=r.w*r.h,i=Math.max(i,r.w);t.sort(((t,e)=>e.h-t.h));let r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}],n=0,s=0;for(let e of t)for(let t=r.length-1;t>=0;t--){let i=r[t];if(!(e.w>i.w||e.h>i.h)){if(e.x=i.x,e.y=i.y,s=Math.max(s,e.y+e.h),n=Math.max(n,e.x+e.w),e.w===i.w&&e.h===i.h){let e=r.pop();e&&t<r.length&&(r[t]=e)}else e.h===i.h?(i.x+=e.w,i.w-=e.w):e.w===i.w?(i.y+=e.h,i.h-=e.h):(r.push({x:i.x+e.w,y:i.y,w:i.w-e.w,h:e.h}),i.y+=e.h,i.h-=e.h);break}}return{w:n,h:s,fill:e/(n*s)||0}}var Lf=class{constructor(t,{pixelRatio:e,version:i,isWebGLImage:r=!1,stretchX:n,stretchY:s,content:o,textFitWidth:a,textFitHeight:l}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=n,this.stretchY=s,this.content=o,this.version=i,this.needsFirstWebGLRender=r,this.textFitWidth=a,this.textFitHeight=l}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}};to("ImagePosition",Lf),to("ImageAtlas",class{constructor(t,e){let i={},r={};this.haveRenderCallbacks=[],this.patchedUpdateVersion=-1;let n=[];this.addImages(t,i,n),this.addImages(e,r,n);let{w:s,h:o}=Bf(n),a=new sh({width:s||1,height:o||1});for(let e in t){let r=t[e];if(r.isWebGLImage)continue;let n=i[e].paddedRect;sh.copy(r.data,a,{x:0,y:0},{x:n.x+1,y:n.y+1},r.data)}for(let t in e){let i=e[t],n=r[t].paddedRect,s=n.x+1,o=n.y+1,l=i.data.width,h=i.data.height;sh.copy(i.data,a,{x:0,y:0},{x:s,y:o},i.data),sh.copy(i.data,a,{x:0,y:h-1},{x:s,y:o-1},{width:l,height:1}),sh.copy(i.data,a,{x:0,y:0},{x:s,y:o+h},{width:l,height:1}),sh.copy(i.data,a,{x:l-1,y:0},{x:s-1,y:o},{width:1,height:h}),sh.copy(i.data,a,{x:0,y:0},{x:s+l,y:o},{width:1,height:h})}this.image=a,this.iconPositions=i,this.patternPositions=r}addImages(t,e,i){for(let r in t){let n=t[r],s={x:0,y:0,w:n.data.width+2,h:n.data.height+2};i.push(s),e[r]=new Lf(s,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(r)}}patchUpdatedImages(t,e){if(t.dispatchRenderCallbacks(this.haveRenderCallbacks),this.patchedUpdateVersion!==t.updateVersion){this.patchedUpdateVersion=t.updateVersion;for(let i in this.iconPositions)this.patchUpdatedImage(this.iconPositions[i],t.getImage(i),e);for(let i in this.patternPositions)this.patchUpdatedImage(this.patternPositions[i],t.getImage(i),e)}}patchUpdatedImage(t,e,i){if(!t||!e||!t.needsFirstWebGLRender&&t.version===e.version)return;t.needsFirstWebGLRender=!1,t.version=e.version;let[r,n]=t.tl,s=e.userImage?.data;if(!Rf(s))return void i.update(e.data,void 0,{x:r,y:n});let{width:o,height:a}=e.data;i.context.setCustomLayerDefaults(),s.renderWithWebGL({gl:i.context.gl,texture:i.texture,x:r,y:n,width:o,height:a}),i.context.setDirty()}});var Uf=function(t){return t[t.none=0]="none",t[t.horizontal=1]="horizontal",t[t.vertical=2]="vertical",t[t.horizontalOnly=3]="horizontalOnly",t}(Uf||{});const Nf=/^\p{gc=M}$/u;function Gf(t,e,i){let r=new Mf(t.join(""),e,[]),n=0;for(let t of r.graphemes())r.sectionIndex.push(i[n]??0),n+=[...t].length;return r}function qf(t){let e=[],i=0;for(let r of t)e.push(i),i+=r.length;return e}function Vf(t,e,i){let r=[...t],n=qf(r),s=function(t){let e=[],i=0;for(;i<t.length;){if(!Nf.test(t[i])){e.push(i),i++;continue}let r=i;for(;r<t.length&&Nf.test(t[r]);)r++;let n=t[r];if(void 0!==n&&pf(n.codePointAt(0))){e.push(r);for(let t=r-1;t>=i;t--)e.push(t);i=r+1}else{for(let t=i;t<r;t++)e.push(t);i=r}}return e}(r);return Gf(s.map((t=>r[t])),e,s.map((t=>i[n[t]]??0)))}function Zf(t,e,i,r,n,s,o,a,l,h,u,c,f,p,d){let m=Mf.fromFeature(t,n);2===c&&m.verticalizePunctuation();let _=m.determineLineBreaks(h,s,e,r,p),g=df(m.text)?function(t,e){let i=e.map((e=>t.toCodeUnitIndex(e))),r=Pc.isParsed()?Pc:null;if(1===t.sections.length)return r?r.processBidirectionalText(t.toString(),i).map((e=>Vf(e,t.sections,[...e].map((()=>0))))):function(t,e){return Cf(t,e).map((t=>t.text))}(t.toString(),i).map((e=>Gf([...e],t.sections,[...e].map((()=>0)))));let n=function(t){let e=[],i=0;for(let r of t.graphemes())e.push(...Array(r.length).fill(t.sectionIndex[i])),i++;return e}(t);return r?r.processStyledBidirectionalText(t.text,n,i).map((([e,i])=>Vf(e,t.sections,i))):function(t,e,i){return Cf(t,i).map((t=>[t.text,t.sourceIndices.map((t=>e[t]??0))]))}(t.text,n,i).map((([e,i])=>{let r=[...e];return Gf(r,t.sections,qf(r).map((t=>i[t]??0)))}))}(m,_):function(t,e){let i=[],r=0;for(let n of e)i.push(t.substring(r,n)),r=n;return r<t.length()&&i.push(t.substring(r,t.length())),i}(m,_),y=[],v={positionedLines:y,text:m.toString(),top:u[1],bottom:u[1],left:u[0],right:u[0],writingMode:c,iconsInText:!1,verticalizable:!1};return function(t,e,i,r,n,s,o,a,l,h,u,c){let f=0,p=0,d=0,m=0,_="right"===a?1:"left"===a?0:.5,g=24/c,y=0;for(let o of n){o.trim();let n=o.getMaxScale(),a={positionedGlyphs:[],lineOffset:0};t.positionedLines[y]=a;let c=a.positionedGlyphs,v=0;if(!o.length()){p+=s,++y;continue}let w=Hf(r,o,g),b=2!==l||u?null:ep(o),x=o.graphemes();for(let s=0;s<x.length;s++){let a=o.getSection(s),d=x[s],m=d.codePointAt(0),_=b?b[s]:Xf(l,u,m),y="fontStack"in a&&of(d)&&!e[a.fontStack]?.[d]?[...d]:[d];for(let l of y){let u,d={glyph:l.codePointAt(0),grapheme:l,imageName:null,x:f,y:p+-17,vertical:_,scale:1,fontStack:"",sectionIndex:o.getSectionIndex(s),metrics:null,rect:null};if("fontStack"in a){if(u=ip(a,l,_,w,e,i),!u)continue;d.fontStack=a.fontStack}else{if(t.iconsInText=!0,a.scale*=g,u=rp(a,_,n,w,r),!u)continue;v=Math.max(v,u.imageOffset),d.imageName=a.imageName}let{rect:m,metrics:y,baselineOffset:b}=u;d.y+=b,d.scale=a.scale,d.metrics=y,d.rect=m,c.push(d),_?(t.verticalizable=!0,f+=("imageName"in a?y.advance:24)*a.scale+h):f+=y.advance*a.scale+h}}0!==c.length&&(d=Math.max(f-h,d),np(c,0,c.length-1,_)),f=0,a.lineOffset=Math.max(v,24*(n-1));let D=s*n+v;p+=D,m=Math.max(D,m),++y}let{horizontalAlign:v,verticalAlign:w}=Wf(o);(function(t,e,i,r,n,s,o,a,l){let h=(e-i)*n,u=0;u=s===o?-r*l*o+.5*o:-a*r- -17;for(let e of t)for(let t of e.positionedGlyphs)t.x+=h,t.y+=u})(t.positionedLines,_,v,w,d,m,s,p,n.length),t.top+=-w*p,t.bottom=t.top+p,t.left+=-v*d,t.right=t.left+d}(v,e,i,r,g,o,a,l,c,h,f,d),!function(t){for(let e of t)if(0!==e.positionedGlyphs.length)return!1;return!0}(y)&&v}function Wf(t){let e=.5,i=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function Hf(t,e,i){let r=24*e.getMaxScale(),{maxImageWidth:n,maxImageHeight:s}=e.getMaxImageSize(t),o=Math.max(r,s*i);return{verticalLineContentWidth:Math.max(r,n*i),horizontalLineContentHeight:o}}function Yf(t){switch(t){case"top":return 0;case"center":return.5;default:return 1}}function Xf(t,e,i){return!(1===t||!e&&!kc(i)||e&&(af(i)||ff(i)))}function Jf(t){return/\p{Nd}/u.test(String.fromCodePoint(t))}function Kf(t){return/\p{Lu}/u.test(String.fromCodePoint(t))}function Qf(t){let e=t.some(Jf)&&t.every((t=>Jf(t)||function(t){return/[\p{P}\p{S}]/u.test(String.fromCodePoint(t))}(t))),i=t.length<=3&&t.every((t=>Kf(t)||Jf(t)));return e||i}function tp(t){return(Jf(t)||Kf(t))&&!ff(t)}function ep(t){let e=t.graphemes().slice(),i=e.map((t=>t.codePointAt(0))),r=i.map(kc),n=e=>!r[e]&&!af(i[e])&&!("imageName"in t.getSection(e));for(let t=0;t<i.length;t++){if(!n(t))continue;let e=t;for(;e+1<i.length&&n(e+1);)e++;if(Qf(i.slice(t,e+1)))for(let n=t;n<=e;n++)r[n]=tp(i[n]);t=e}return function(t,e){let i=!1;for(let r=0;r<t.length;r++){if(e[r])continue;let n=mf[t[r]];n&&(0===r||e[r-1])&&(r===t.length-1||e[r+1])&&(t[r]=n,e[r]=!0,i=!0)}return i}(e,r)&&(t.text=e.join(""),t._graphemes=null),r}function ip(t,e,i,r,n,s){let o,a=s[t.fontStack]?.[e],l=function(t,e,i,r){if(t?.rect)return t;let n=e[i.fontStack]?.[r];return n?{rect:null,metrics:n.metrics}:null}(a,n,t,e);if(null===l)return null;if(i)o=r.verticalLineContentWidth-24*t.scale;else{let e=Yf(t.verticalAlign);o=(r.horizontalLineContentHeight-24*t.scale)*e}return{rect:l.rect,metrics:l.metrics,baselineOffset:o}}function rp(t,e,i,r,n){let s=n[t.imageName];if(!s)return null;let o,a=s.paddedRect,l=s.displaySize,h={width:l[0],height:l[1],left:1,top:-3,advance:e?l[1]:l[0]};if(e)o=r.verticalLineContentWidth-l[1]*t.scale;else{let e=Yf(t.verticalAlign);o=(r.horizontalLineContentHeight-l[1]*t.scale)*e}return{rect:a,metrics:h,baselineOffset:o,imageOffset:(e?l[0]:l[1])*t.scale-24*i}}function np(t,e,i,r){if(0===r)return;let n=t[i],s=(t[i].x+n.metrics.advance*n.scale)*r;for(let r=e;r<=i;r++)t[r].x-=s}function sp(t,e,i){let{horizontalAlign:r,verticalAlign:n}=Wf(i),s=e[0]-t.displaySize[0]*r,o=e[1]-t.displaySize[1]*n;return{image:t,top:o,bottom:o+t.displaySize[1],left:s,right:s+t.displaySize[0]}}function op(t){let e=t.left,i=t.top,r=t.right-e,n=t.bottom-i,s=t.image.textFitWidth??"stretchOrShrink",o=t.image.textFitHeight??"stretchOrShrink",a=(t.image.content[2]-t.image.content[0])/(t.image.content[3]-t.image.content[1]);if("proportional"===o){if("stretchOnly"===s&&r/n<a||"proportional"===s){let t=Math.ceil(n*a);e*=t/r,r=t}}else if("proportional"===s&&"stretchOnly"===o&&0!==a&&r/n>a){let t=Math.ceil(r/a);i*=t/n,n=t}return{x1:e,y1:i,x2:e+r,y2:i+n}}function ap(t,e,i,r,n,s){let o,a=t.image;if(a.content){let t=a.content,e=a.pixelRatio||1;o=[t[0]/e,t[1]/e,a.displaySize[0]-t[2]/e,a.displaySize[1]-t[3]/e]}let l,h,u,c,f=e.left*s,p=e.right*s;"width"===i||"both"===i?(c=n[0]+f-r[3],h=n[0]+p+r[1]):(c=n[0]+(f+p-a.displaySize[0])/2,h=c+a.displaySize[0]);let d=e.top*s,m=e.bottom*s;return"height"===i||"both"===i?(l=n[1]+d-r[0],u=n[1]+m+r[2]):(l=n[1]+(d+m-a.displaySize[1])/2,u=l+a.displaySize[1]),{image:a,top:l,right:h,bottom:u,left:c,collisionPadding:o}}function lp(t,e){let{expression:i}=e;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new ao(t+1))};if("source"===i.kind)return{kind:"source"};if("composite"===i.kind){let{minZoom:e,maxZoom:r}=function(t,e){let i=0;for(;i<t.length&&t[i]<=e;)i++;i=Math.max(0,i-1);let r=i;for(;r<t.length&&t[r]<e+1;)r++;return r=Math.min(t.length-1,r),{minZoom:t[i],maxZoom:t[r]}}(i.zoomStops,t);return{kind:"composite",minZoom:e,maxZoom:r,interpolationType:i.interpolationType}}{let e=function(t){return t.zoomStops.map((e=>t.evaluate(new ao(e===-1/0?t.zoomStops[1]-1:e))))}(i),r=i.evaluate(new ao(t+1));return{kind:"camera",zoomStops:i.zoomStops,sizes:e,layoutSize:r,interpolationType:i.interpolationType}}}function hp(t,{uSize:e,uSizeT:i},{lowerSize:r,upperSize:n}){return"source"===t.kind?r/128:"composite"===t.kind?Oi.number(r/128,n/128,i):e}function up(t,e){let i=0,r=0;return"constant"===t.kind?r=t.layoutSize:"camera"===t.kind?r=function({zoomStops:t,sizes:e,layoutSize:i,interpolationType:r},n){let s=t.length-1;for(;s>0&&t[s]>n;)s--;let o=Math.min(s+1,t.length-1),a=r?Dt(ji.interpolationFactor(r,n,t[s],t[o]),0,1):0;return Math.min(Oi.number(e[s],e[o],a),i)}(t,e):"composite"===t.kind&&(i=function({interpolationType:t,minZoom:e,maxZoom:i},r){return t?Dt(ji.interpolationFactor(t,r,e,i),0,1):0}(t,e)),{uSizeT:i,uSize:r}}var cp=class t extends u{constructor(t,e,i,r){super(t,e),this.angle=i,void 0!==r&&(this.segment=r)}clone(){return new t(this.x,this.y,this.angle,this.segment)}};function fp(t,e,i,r,n){if(void 0===e.segment||0===i)return!0;let s=e,o=e.segment+1,a=0;for(;a>-i/2;){if(o--,o<0)return!1;a-=t[o].dist(s),s=t[o]}a+=t[o].dist(t[o+1]),o++;let l=[],h=0;for(;a<i/2;){let e=t[o],i=t[o+1];if(!i)return!1;let s=t[o-1].angleTo(e)-e.angleTo(i);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:a,angleDelta:s}),h+=s;a-l[0].distance>r;)h-=l.shift().angleDelta;if(h>n)return!1;o++,a+=e.dist(i)}return!0}function pp(t){let e=0;for(let i=0;i<t.length-1;i++)e+=t[i].dist(t[i+1]);return e}function dp(t,e,i){return t?.6*e*i:0}function mp(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function _p(t,e,i,r,n,s){let o=dp(i,n,s),a=mp(i,r)*s,l=0,h=pp(t)/2;for(let i=0;i<t.length-1;i++){let r=t[i],n=t[i+1],s=r.dist(n);if(l+s>h){let u=(h-l)/s,c=new cp(Oi.number(r.x,n.x,u),Oi.number(r.y,n.y,u),n.angleTo(r),i);return c._round(),!o||fp(t,c,a,o,e)?c:void 0}l+=s}}function gp(t,e,i,r,n,s,o,a,l){let h=dp(r,s,o),u=mp(r,n),c=u*o,f=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-c<e/4&&(e=c+e/4),yp(t,f?e/2*a%e:(u/2+2*s)*o*a%e,e,h,i,c,f,!1,l)}function yp(t,e,i,r,n,s,o,a,l){let h=s/2,u=pp(t),c=0,f=e-i,p=[];for(let e=0;e<t.length-1;e++){let o=t[e],a=t[e+1],d=o.dist(a),m=a.angleTo(o);for(;f+i<c+d;){f+=i;let _=(f-c)/d,g=Oi.number(o.x,a.x,_),y=Oi.number(o.y,a.y,_);if(g>=0&&g<l&&y>=0&&y<l&&f-h>=0&&f+h<=u){let i=new cp(g,y,m,e);i._round(),(!r||fp(t,i,s,r,n))&&p.push(i)}}c+=d}return!a&&!p.length&&!o&&(p=yp(t,c/2,i,r,n,s,o,!0,l)),p}function vp(t,e,i,r,n){let s=[];for(let o of t){let t;for(let a=0;a<o.length-1;a++){let l=o[a],h=o[a+1];l.x<e&&h.x<e||(l.x<e?l=new u(e,l.y+(e-l.x)/(h.x-l.x)*(h.y-l.y))._round():h.x<e&&(h=new u(e,l.y+(e-l.x)/(h.x-l.x)*(h.y-l.y))._round()),!(l.y<i&&h.y<i)&&(l.y<i?l=new u(l.x+(i-l.y)/(h.y-l.y)*(h.x-l.x),i)._round():h.y<i&&(h=new u(l.x+(i-l.y)/(h.y-l.y)*(h.x-l.x),i)._round()),!(l.x>=r&&h.x>=r)&&(l.x>=r?l=new u(r,l.y+(r-l.x)/(h.x-l.x)*(h.y-l.y))._round():h.x>=r&&(h=new u(r,l.y+(r-l.x)/(h.x-l.x)*(h.y-l.y))._round()),!(l.y>=n&&h.y>=n)&&(l.y>=n?l=new u(l.x+(n-l.y)/(h.y-l.y)*(h.x-l.x),n)._round():h.y>=n&&(h=new u(l.x+(n-l.y)/(h.y-l.y)*(h.x-l.x),n)._round()),(!t||!l.equals(t[t.length-1]))&&(t=[l],s.push(t)),t.push(h)))))}}return s}function wp(t,e,i,r){let n=[],s=t.image,o=s.pixelRatio,a=s.paddedRect.w-2,l=s.paddedRect.h-2,h={x1:t.left,y1:t.top,x2:t.right,y2:t.bottom},c=s.stretchX||[[0,a]],f=s.stretchY||[[0,l]],p=(t,e)=>t+e[1]-e[0],d=c.reduce(p,0),m=f.reduce(p,0),_=a-d,g=l-m,y=0,v=d,w=0,b=m,x=0,D=_,M=0,E=g;if(s.content&&r){let e=s.content,i=e[2]-e[0],r=e[3]-e[1];(s.textFitWidth||s.textFitHeight)&&(h=op(t)),y=bp(c,0,e[0]),w=bp(f,0,e[1]),v=bp(c,e[0],e[2]),b=bp(f,e[1],e[3]),x=e[0]-y,M=e[1]-w,D=i-v,E=r-b}let A=h.x1,F=h.y1,z=h.x2-A,S=h.y2-F,C=(t,r,n,a)=>{let l=Dp(t.stretch-y,v,z,A),h=Mp(t.fixed-x,D,t.stretch,d),c=Dp(r.stretch-w,b,S,F),f=Mp(r.fixed-M,E,r.stretch,m),p=Dp(n.stretch-y,v,z,A),_=Mp(n.fixed-x,D,n.stretch,d),g=Dp(a.stretch-w,b,S,F),C=Mp(a.fixed-M,E,a.stretch,m),T=new u(l,c),P=new u(p,c),I=new u(p,g),k=new u(l,g),$=new u(h/o,f/o),j=new u(_/o,C/o),R=e*Math.PI/180;if(R){let t=Math.sin(R),e=Math.cos(R),i=[e,-t,t,e];T._matMult(i),P._matMult(i),k._matMult(i),I._matMult(i)}let O=t.stretch+t.fixed,B=r.stretch+r.fixed;return{tl:T,tr:P,bl:k,br:I,tex:{x:s.paddedRect.x+1+O,y:s.paddedRect.y+1+B,w:n.stretch+n.fixed-O,h:a.stretch+a.fixed-B},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:$,pixelOffsetBR:j,minFontScaleX:D/o/z,minFontScaleY:E/o/S,isSDF:i}};if(r&&(s.stretchX||s.stretchY)){let t=xp(c,_,d),e=xp(f,g,m);for(let i=0;i<t.length-1;i++){let r=t[i],s=t[i+1];for(let t=0;t<e.length-1;t++)n.push(C(r,e[t],s,e[t+1]))}}else n.push(C({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:a+1},{fixed:0,stretch:l+1}));return n}function bp(t,e,i){let r=0;for(let n of t)r+=Math.max(e,Math.min(i,n[1]))-Math.max(e,Math.min(i,n[0]));return r}function xp(t,e,i){let r=[{fixed:-1,stretch:0}];for(let[e,i]of t){let t=r[r.length-1];r.push({fixed:e-t.stretch,stretch:t.stretch}),r.push({fixed:e-t.stretch,stretch:t.stretch+(i-e)})}return r.push({fixed:e+1,stretch:i}),r}function Dp(t,e,i,r){return t/e*i+r}function Mp(t,e,i,r){return t-e*i/r}function Ep(t,e,i,r,n,s,o,a){let l=r.layout.get("text-rotate").evaluate(s,{})*Math.PI/180,h=[];for(let t of e.positionedLines)for(let r of t.positionedGlyphs){if(!r.rect)continue;let s=r.rect||{},c=4,f=!0,p=1,d=0,m=(n||a)&&r.vertical,_=r.metrics.advance*r.scale/2;if(a&&e.verticalizable&&(d=t.lineOffset/2-(r.imageName?-(24-r.metrics.width*r.scale)/2:24*(r.scale-1))),r.imageName){let t=o[r.imageName];f=t.sdf,p=t.pixelRatio,c=1/p}let g=n?[r.x+_,r.y]:[0,0],y=n?[0,0]:[r.x+_+i[0],r.y+i[1]-d],v=[0,0];m&&(v=y,y=[0,0]);let w=r.metrics.isDoubleResolution?2:1,b=(r.metrics.left-c)*r.scale-_+y[0],x=(-r.metrics.top-c)*r.scale+y[1],D=b+s.w/w*r.scale/p,M=x+s.h/w*r.scale/p,E=new u(b,x),A=new u(D,x),F=new u(b,M),z=new u(D,M);if(m){let t=new u(-_,_- -17),e=-Math.PI/2,i=12-_,n=new u(22-i,-(r.imageName?i:0)),s=new u(...v);E._rotateAround(e,t)._add(n)._add(s),A._rotateAround(e,t)._add(n)._add(s),F._rotateAround(e,t)._add(n)._add(s),z._rotateAround(e,t)._add(n)._add(s)}if(l){let t=Math.sin(l),e=Math.cos(l),i=[e,-t,t,e];E._matMult(i),A._matMult(i),F._matMult(i),z._matMult(i)}let S=new u(0,0),C=new u(0,0);h.push({tl:E,tr:A,bl:F,br:z,tex:s,writingMode:e.writingMode,glyphOffset:g,sectionIndex:r.sectionIndex,isSDF:f,pixelOffsetTL:S,pixelOffsetBR:C,minFontScaleX:0,minFontScaleY:0})}return h}to("Anchor",cp);var Ap=class{constructor(t,e,i,r,n,s,o,a,l,h){if(this.boxStartIndex=t.length,l){let t=s.top,e=s.bottom,i=s.collisionPadding;i&&(t-=i[1],e+=i[3]);let r=e-t;r>0&&(r=Math.max(10,r),this.circleDiameter=r)}else{let l=s.image?.content&&(s.image.textFitWidth||s.image.textFitHeight)?op(s):{x1:s.left,y1:s.top,x2:s.right,y2:s.bottom};l.y1=l.y1*o-a[0],l.y2=l.y2*o+a[2],l.x1=l.x1*o-a[3],l.x2=l.x2*o+a[1];let c=s.collisionPadding;if(c&&(l.x1-=c[0]*o,l.y1-=c[1]*o,l.x2+=c[2]*o,l.y2+=c[3]*o),h){let t=new u(l.x1,l.y1),e=new u(l.x2,l.y1),i=new u(l.x1,l.y2),r=new u(l.x2,l.y2),n=h*Math.PI/180;t._rotate(n),e._rotate(n),i._rotate(n),r._rotate(n),l.x1=Math.min(t.x,e.x,i.x,r.x),l.x2=Math.max(t.x,e.x,i.x,r.x),l.y1=Math.min(t.y,e.y,i.y,r.y),l.y2=Math.max(t.y,e.y,i.y,r.y)}t.emplaceBack(e.x,e.y,l.x1,l.y1,l.x2,l.y2,i,r,n)}this.boxEndIndex=t.length}},Fp=class{constructor(t=[],e=(t,e)=>t<e?-1:+(t>e)){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;let t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:e,compare:i}=this,r=e[t];for(;t>0;){let n=t-1>>1,s=e[n];if(i(r,s)>=0)break;e[t]=s,t=n}e[t]=r}_down(t){let{data:e,compare:i}=this,r=this.length>>1,n=e[t];for(;t<r;){let r=1+(t<<1),s=r+1;if(s<this.length&&i(e[s],e[r])<0&&(r=s),i(e[r],n)>=0)break;e[t]=e[r],t=r}e[t]=n}};function zp(t,e=1){let i=Fu.fromPoints(t[0]),r=Math.min(i.width(),i.height()),n=r/2,s=new Fp([],Sp),{minX:o,minY:a,maxX:l,maxY:h}=i;if(0===r)return new u(o,a);for(let e=o;e<l;e+=r)for(let i=a;i<h;i+=r)s.push(new Cp(e+n,i+n,n,t));let c=function(t){let e=0,i=0,r=0,n=t[0];for(let t=0,s=n.length,o=s-1;t<s;o=t++){let s=n[t],a=n[o],l=s.x*a.y-a.x*s.y;i+=(s.x+a.x)*l,r+=(s.y+a.y)*l,e+=3*l}return new Cp(i/e,r/e,0,t)}(t),f=c;for(;s.length;){let i=s.pop();(i.d>f.d||!f.d)&&(f=i),!(i.max-f.d<=e)&&(n=i.h/2,s.push(new Cp(i.p.x-n,i.p.y-n,n,t)),s.push(new Cp(i.p.x+n,i.p.y-n,n,t)),s.push(new Cp(i.p.x-n,i.p.y+n,n,t)),s.push(new Cp(i.p.x+n,i.p.y+n,n,t)))}return c.d>0&&f.d-c.d<=e?c.p:f.p}function Sp(t,e){return e.max-t.max}var Cp=class{constructor(t,e,i,r){this.p=new u(t,e),this.h=i,this.d=function(t,e){let i=!1,r=1/0;for(let n of e)for(let e=0,s=n.length,o=s-1;e<s;o=e++){let s=n[e],a=n[o];s.y>t.y!=a.y>t.y&&t.x<(a.x-s.x)*(t.y-s.y)/(a.y-s.y)+s.x&&(i=!i),r=Math.min(r,Il(t,s,a))}return(i?1:-1)*Math.sqrt(r)}(this.p,r),this.max=this.d+this.h*Math.SQRT2}};let Tp=function(t){return t[t.center=1]="center",t[t.left=2]="left",t[t.right=3]="right",t[t.top=4]="top",t[t.bottom=5]="bottom",t[t["top-left"]=6]="top-left",t[t["top-right"]=7]="top-right",t[t["bottom-left"]=8]="bottom-left",t[t["bottom-right"]=9]="bottom-right",t}({});const Pp=1/0;function Ip(t,e){return e[1]===Pp?function(t,e){let i=0,r=0;e<0&&(e=0);let n=e/Math.SQRT2;switch(t){case"top-right":case"top-left":r=n-7;break;case"bottom-right":case"bottom-left":r=7-n;break;case"bottom":r=7-e;break;case"top":r=e-7}switch(t){case"top-right":case"bottom-right":i=-n;break;case"top-left":case"bottom-left":i=n;break;case"left":i=e;break;case"right":i=-e}return[i,r]}(t,e[0]):function(t,e,i){let r=0,n=0;switch(e=Math.abs(e),i=Math.abs(i),t){case"top-right":case"top-left":case"top":n=i-7;break;case"bottom-right":case"bottom-left":case"bottom":n=7-i}switch(t){case"top-right":case"bottom-right":case"right":r=-e;break;case"top-left":case"bottom-left":case"left":r=e}return[r,n]}(t,e[0],e[1])}function kp(t,e,i){let r=t.layout,n=r.get("text-variable-anchor-offset")?.evaluate(e,{},i);if(n){let t=n.values,e=[];for(let i=0;i<t.length;i+=2){let r=e[i]=t[i],n=t[i+1].map((t=>24*t));r.startsWith("top")?n[1]-=7:r.startsWith("bottom")&&(n[1]+=7),e[i+1]=n}return new Di(e)}let s=r.get("text-variable-anchor");if(s){let n;n=void 0===t._unevaluatedLayout.getValue("text-radial-offset")?r.get("text-offset").evaluate(e,{},i).map((t=>24*t)):[24*r.get("text-radial-offset").evaluate(e,{},i),Pp];let o=[];for(let t of s)o.push(t,Ip(t,n));return new Di(o)}return null}function $p(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 jp(t,e,i,r,n,s,o,a,l,h,u,c){let f=s.textMaxSize.evaluate(e,{});void 0===f&&(f=o);let p,d=t.layers[0].layout,m=d.get("icon-offset").evaluate(e,{},u),_=Op(i.horizontal),g=o/24,y=t.tilePixelRatio*g,v=t.tilePixelRatio*f/24,w=t.tilePixelRatio*a,b=t.tilePixelRatio*d.get("symbol-spacing"),x=d.get("text-padding")*t.tilePixelRatio,D=function(t,e,i,r=1){let n=t.get("icon-padding").evaluate(e,{},i)?.values;return[n[0]*r,n[1]*r,n[2]*r,n[3]*r]}(d,e,u,t.tilePixelRatio),M=d.get("text-max-angle")/180*Math.PI,E="viewport"!==d.get("text-rotation-alignment")&&"point"!==d.get("symbol-placement"),A="map"===d.get("icon-rotation-alignment").constantOr("viewport")&&"point"!==d.get("symbol-placement"),F=d.get("symbol-placement"),z=b/2,S=d.get("icon-text-fit");r&&"none"!==S&&(t.allowVerticalPlacement&&i.vertical&&(p=ap(r,i.vertical,S,d.get("icon-text-fit-padding"),m,g)),_&&(r=ap(r,_,S,d.get("icon-text-fit-padding"),m,g)));let C=u?c.line.getGranularityForZoomLevel(u.z):1,T=(a,c)=>{c.x<0||c.x>=8192||c.y<0||c.y>=8192||function(t,e,i,r,n,s,o,a,l,h,u,c,f,p,d,m,_,g,y,v,w,b,x,D,M){let E=t.addToLineVertexArray(e,i),A=a.layout.get("symbol-height-offset").evaluate(w,{},D);A>t.maxHeightOffset&&(t.maxHeightOffset=A);let F,z,S,C,T=0,P=0,I=0,k=0,$=-1,j=-1,R={},O=(0,Za.default)("");if(t.allowVerticalPlacement&&r.vertical){let t=a.layout.get("text-rotate").evaluate(w,{},D)+90;S=new Ap(l,e,h,u,c,r.vertical,f,p,d,t),o&&(C=new Ap(l,e,h,u,c,o,_,g,d,t))}if(n){let i=a.layout.get("icon-rotate").evaluate(w,{}),r="none"!==a.layout.get("icon-text-fit"),s=wp(n,i,x,r),f=o?wp(o,i,x,r):void 0;z=new Ap(l,e,h,u,c,n,_,g,!1,i),T=4*s.length;let p=t.iconSizeData,d=null;"source"===p.kind?(d=[128*a.layout.get("icon-size").evaluate(w,{})],d[0]>32640&&Rt(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):"composite"===p.kind&&(d=[128*b.compositeIconSizes[0].evaluate(w,{},D),128*b.compositeIconSizes[1].evaluate(w,{},D)],(d[0]>32640||d[1]>32640)&&Rt(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),t.addSymbols(t.icon,s,d,v,y,w,0,e,E.lineStartIndex,E.lineLength,-1,D,A),$=t.icon.placedSymbolArray.length-1,f&&(P=4*f.length,t.addSymbols(t.icon,f,d,v,y,w,2,e,E.lineStartIndex,E.lineLength,-1,D,A),j=t.icon.placedSymbolArray.length-1)}let B=Object.keys(r.horizontal);for(let i of B){let n=r.horizontal[i];F||=(O=(0,Za.default)(n.text),new Ap(l,e,h,u,c,n,f,p,d,a.layout.get("text-rotate").evaluate(w,{},D)));let o=1===n.positionedLines.length;if(I+=Rp(t,e,n,s,a,d,w,m,A,E,r.vertical?1:3,o?B:[i],R,$,b,D),o)break}r.vertical&&(k+=Rp(t,e,r.vertical,s,a,d,w,m,A,E,2,["vertical"],R,j,b,D));let L=F?F.boxStartIndex:t.collisionBoxArray.length,U=F?F.boxEndIndex:t.collisionBoxArray.length,N=S?S.boxStartIndex:t.collisionBoxArray.length,G=S?S.boxEndIndex:t.collisionBoxArray.length,q=z?z.boxStartIndex:t.collisionBoxArray.length,V=z?z.boxEndIndex:t.collisionBoxArray.length,Z=C?C.boxStartIndex:t.collisionBoxArray.length,W=C?C.boxEndIndex:t.collisionBoxArray.length,H=-1,Y=(t,e)=>t?.circleDiameter?Math.max(t.circleDiameter,e):e;H=Y(F,H),H=Y(S,H),H=Y(z,H),H=Y(C,H);let X=+(H>-1);X&&(H*=M/24),t.glyphOffsetArray.length>=t.maxGlyphs&&Rt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==w.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,w.sortKey);let J=kp(a,w,D),[K,Q]=function(t,e){let i=t.length,r=e?.values;if(r?.length>0)for(let e=0;e<r.length;e+=2){let i=r[e+1];t.emplaceBack(Tp[r[e]],i[0],i[1])}return[i,t.length]}(t.textAnchorOffsets,J);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,$,j,O,L,U,N,G,q,V,Z,W,h,I,k,T,P,X,0,f,H,K,Q,A)}(t,c,a,i,r,n,p,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,y,[x,x,x,x],E,l,w,D,A,m,e,s,h,u,o)};if("line"===F)for(let n of vp(e.geometry,0,0,it,it)){let e=du(n,C),s=gp(e,b,M,i.vertical||_,r,24,v,t.overscaling,it);for(let i of s)(!_||!Bp(t,_.text,z,i))&&T(e,i)}else if("line-center"===F){for(let t of e.geometry)if(t.length>1){let e=du(t,C),n=_p(e,M,i.vertical||_,r,24,v);n&&T(e,n)}}else if("Polygon"===e.type)for(let t of Gi(e.geometry,0)){let e=zp(t,16);T(du(t[0],C,!0),new cp(e.x,e.y,0))}else if("LineString"===e.type)for(let t of e.geometry){let e=du(t,C);T(e,new cp(e[0].x,e[0].y,0))}else if("Point"===e.type)for(let t of e.geometry)for(let e of t)T([e],new cp(e.x,e.y,0))}function Rp(t,e,i,r,n,s,o,a,l,h,u,c,f,p,d,m){let _=Ep(0,i,a,n,s,o,r,t.allowVerticalPlacement),g=t.textSizeData,y=null;"source"===g.kind?(y=[128*n.layout.get("text-size").evaluate(o,{})],y[0]>32640&&Rt(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):"composite"===g.kind&&(y=[128*d.compositeTextSizes[0].evaluate(o,{},m),128*d.compositeTextSizes[1].evaluate(o,{},m)],(y[0]>32640||y[1]>32640)&&Rt(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),t.addSymbols(t.text,_,y,a,s,o,u,e,h.lineStartIndex,h.lineLength,p,m,l);for(let e of c)f[e]=t.text.placedSymbolArray.length-1;return 4*_.length}function Op(t){for(let e in t)return t[e];return null}function Bp(t,e,i,r){let n=t.compareText;if(e in n){let t=n[e];for(let e=t.length-1;e>=0;e--)if(r.dist(t[e])<i)return!0}else n[e]=[];return n[e].push(r),!1}function Lp(t,e,i){let r="never",n=t.get(e);return n?r=n:t.get(i)&&(r="always"),r}const Up=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Np(t,e,i,r,n,s,o,a,l,h,u,c,f,p){let d=a?Math.min(32640,Math.round(a[0])):0,m=a?Math.min(32640,Math.round(a[1])):0;t.emplaceBack(e,i,Math.round(32*r),Math.round(32*n),s,o,+!!l+(d<<1),m,16*h,16*u,256*c,256*f,p)}function Gp(t,e,i){t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i)}function qp(t){for(let e of t.sections)if(df(e.text))return!0;return!1}var Vp=class{constructor(t){this.layoutVertexArray=new Sa,this.indexArray=new ja,this.programConfigurations=t,this.segments=new La,this.dynamicLayoutVertexArray=new Ca,this.opacityVertexArray=new Ta,this.hasVisibleVertices=!1,this.placedSymbolArray=new ua}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(t,e,i,r){this.isEmpty()||(i&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Fc.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,zc.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Up,!0),this.opacityVertexBuffer.itemSize=1),(i||r)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}};to("SymbolBuffers",Vp);var Zp=class{constructor(t,e,i){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new i,this.segments=new La,this.collisionVertexArray=new ka}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Sc.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};to("CollisionBuffers",Zp);var Wp=class{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasDependencies=!0,this.hasRTLText=!1,this.maxHeightOffset=0,this.sortKeyRanges=[],this.collisionCircleArray=[],this.maxGlyphs=65535;let e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=lp(this.zoom,e["text-size"]),this.iconSizeData=lp(this.zoom,e["icon-size"]);let i=this.layers[0].layout,r=i.get("symbol-sort-key"),n=i.get("symbol-z-order");this.canOverlap="never"!==Lp(i,"text-overlap","text-allow-overlap")||"never"!==Lp(i,"icon-overlap","icon-allow-overlap")||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==n&&!r.isConstant(),this.sortFeaturesByY=("viewport-y"===n||"auto"===n&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===i.get("symbol-placement")&&(this.writingModes=i.get("text-writing-mode").map((t=>Uf[t]))),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=t.sourceID}createArrays(){this.text=new Vp(new gl(this.layers,this.zoom,(t=>t.startsWith("text")))),this.icon=new Vp(new gl(this.layers,this.zoom,(t=>t.startsWith("icon")))),this.glyphOffsetArray=new pa,this.lineVertexArray=new da,this.symbolInstances=new fa,this.textAnchorOffsets=new _a}calculateGlyphDependencies(t,e,i,r,n){let s=(r||this.allowVerticalPlacement)&&n,o=Mf.fromFeature(t,i),a=o.graphemes();for(let t=0;t<a.length;t++){let i=o.getSection(t);if("imageName"in i)continue;let r=e[i.fontStack]||={},n=a[t];of(n)&&(r[n]=!0);for(let t of n){if(r[t]=!0,!s)continue;let e=mf[t];e&&(r[e]=!0)}}}populate(t,e,i){let r=this.layers[0],n=r.layout,s=n.get("text-font"),o=n.get("text-field"),a=n.get("icon-image"),l=("constant"!==o.value.kind||o.value.value instanceof gi&&!o.value.value.isEmpty()||o.value.value.toString().length>0)&&("constant"!==s.value.kind||s.value.value.length>0),h="constant"!==a.value.kind||!!a.value.value||Object.keys(a.parameters).length>0,u=n.get("symbol-sort-key");if(this.features=[],!l&&!h)return;let c=e.iconDependencies,f=e.glyphDependencies,p=e.availableImages,d=new ao(this.zoom);for(let{feature:e,id:o,index:a,sourceLayerIndex:m}of t){let t,_,g=r._featureFilter.needGeometry,y=xl(e,g);if(!r._featureFilter.filter(d,y,i))continue;if(g||(y.geometry=bl(e)),l){let e=r.getValueAndResolveTokens("text-field",y,i,p),n=gi.factory(e);this.hasRTLText||=qp(n),t=Yc(n,r,y)}if(h){let t=r.getValueAndResolveTokens("icon-image",y,i,p);_=t instanceof Mi?t:Mi.fromString(t)}if(!t&&!_)continue;let v=this.sortFeaturesByKey?u.evaluate(y,{},i):void 0;if(this.features.push({id:o,text:t,icon:_,index:a,sourceLayerIndex:m,geometry:y.geometry,properties:e.properties,type:Tu.types[e.type],sortKey:v}),_&&(c[_.name]=!0),t){let e=s.evaluate(y,{},i).join(","),r="viewport"!==n.get("text-rotation-alignment")&&"point"!==n.get("symbol-placement");this.allowVerticalPlacement=this.writingModes?.includes(2);let o=lf(t.toString());this.calculateGlyphDependencies(t,f,e,r,o);for(let e of t.sections)e.image&&(c[e.image.name]=!0)}}"line"===n.get("symbol-placement")&&(this.features=function(t){let e={},i={},r=[];for(let n of t){let t=n.text?n.text.toString():null,s={points:n.geometry[0],next:null},o={feature:n,first:s,last:s};if(!t){r.push(o);continue}let a=Xc(t,o),l=Xc(t,o,!0);if(a in i&&l in e&&i[a]!==e[l]){let n=Qc(r,e,a,l,o),s=Kc(r,i,a,l,r[n]);delete e[a],delete i[l],i[Xc(t,r[s],!0)]=s,r[n].feature.geometry=null}else if(a in i)Kc(r,i,a,l,o);else if(l in e)Qc(r,e,a,l,o);else{let t=r.push(o)-1;e[a]=t,i[l]=t}}let n=[];for(let t of r){let e=t.feature;e.geometry&&(t.first.next&&(e.geometry[0]=Jc(t)),n.push(e))}return n}(this.features)),this.sortFeaturesByKey&&this.features.sort(((t,e)=>t.sortKey-e.sortKey))}update(t,e,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,{imagePositions:i}),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,{imagePositions:i}))}addFeatures({options:t,canonical:e,glyphMap:i,glyphPositions:r,iconMap:n,iconPositions:s,showCollisionBoxes:o}){!function(t){t.bucket.createArrays(),t.bucket.tilePixelRatio=it/(512*t.bucket.overscaling),t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;let e=t.bucket.layers[0],i=e.layout,r=e._unevaluatedLayout._values,n={layoutIconSize:r["icon-size"].possiblyEvaluate(new ao(t.bucket.zoom+1),t.canonical),layoutTextSize:r["text-size"].possiblyEvaluate(new ao(t.bucket.zoom+1),t.canonical),textMaxSize:r["text-size"].possiblyEvaluate(new ao(18))};if("composite"===t.bucket.textSizeData.kind){let{minZoom:e,maxZoom:i}=t.bucket.textSizeData;n.compositeTextSizes=[r["text-size"].possiblyEvaluate(new ao(e),t.canonical),r["text-size"].possiblyEvaluate(new ao(i),t.canonical)]}if("composite"===t.bucket.iconSizeData.kind){let{minZoom:e,maxZoom:i}=t.bucket.iconSizeData;n.compositeIconSizes=[r["icon-size"].possiblyEvaluate(new ao(e),t.canonical),r["icon-size"].possiblyEvaluate(new ao(i),t.canonical)]}let s=24*i.get("text-line-height"),o="viewport"!==i.get("text-rotation-alignment")&&"point"!==i.get("symbol-placement"),a=i.get("text-keep-upright"),l=i.get("text-size");for(let r of t.bucket.features){let h=i.get("text-font").evaluate(r,{},t.canonical).join(","),u=l.evaluate(r,{},t.canonical),c=n.layoutTextSize.evaluate(r,{},t.canonical),f=n.layoutIconSize.evaluate(r,{},t.canonical),p={horizontal:{},vertical:void 0},d=r.text,m=[0,0];if(d){let n=d.toString(),l=24*i.get("text-letter-spacing").evaluate(r,{},t.canonical),f=hf(n)?l:0,_=i.get("text-anchor").evaluate(r,{},t.canonical),g=kp(e,r,t.canonical);if(!g){let e=i.get("text-radial-offset").evaluate(r,{},t.canonical);m=e?Ip(_,[24*e,Pp]):i.get("text-offset").evaluate(r,{},t.canonical).map((t=>24*t))}let y=o?"center":i.get("text-justify").evaluate(r,{},t.canonical),v="point"===i.get("symbol-placement")?24*i.get("text-max-width").evaluate(r,{},t.canonical):1/0,w=()=>{t.bucket.allowVerticalPlacement&&lf(n)&&(p.vertical=Zf(d,t.glyphMap,t.glyphPositions,t.imagePositions,h,v,s,_,"left",f,m,2,!0,c,u))};if(!o&&g){let e=new Set;if("auto"===y)for(let t=0;t<g.values.length;t+=2)e.add($p(g.values[t]));else e.add(y);let i=!1;for(let r of e)if(!p.horizontal[r])if(i)p.horizontal[r]=p.horizontal[0];else{let e=Zf(d,t.glyphMap,t.glyphPositions,t.imagePositions,h,v,s,"center",r,f,m,1,!1,c,u);e&&(p.horizontal[r]=e,i=1===e.positionedLines.length)}w()}else{"auto"===y&&(y=$p(_));let e=Zf(d,t.glyphMap,t.glyphPositions,t.imagePositions,h,v,s,_,y,f,m,1,!1,c,u);e&&(p.horizontal[y]=e),w(),lf(n)&&o&&a&&(p.vertical=Zf(d,t.glyphMap,t.glyphPositions,t.imagePositions,h,v,s,_,y,f,m,2,!1,c,u))}}let _,g=!1;if(r.icon?.name){let e=t.imageMap[r.icon.name];e&&(_=sp(t.imagePositions[r.icon.name],i.get("icon-offset").evaluate(r,{},t.canonical),i.get("icon-anchor").evaluate(r,{},t.canonical)),g=!!e.sdf,void 0===t.bucket.sdfIcons?t.bucket.sdfIcons=g:t.bucket.sdfIcons!==g&&Rt("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),e.pixelRatio===t.bucket.pixelRatio?0!==i.get("icon-rotate").constantOr(1)&&(t.bucket.iconsNeedLinear=!0):t.bucket.iconsNeedLinear=!0)}let y=Op(p.horizontal)||p.vertical;t.bucket.iconsInText||=!!y&&y.iconsInText,(y||_)&&jp(t.bucket,r,p,_,t.imageMap,n,c,f,m,g,t.canonical,t.subdivisionGranularity)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()}({bucket:this,glyphMap:i,glyphPositions:r,imageMap:n,imagePositions:s,showCollisionBoxes:o,canonical:e,subdivisionGranularity:t.subdivisionGranularity})}isEmpty(){return 0===this.symbolInstances.length}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,e){let i=this.lineVertexArray.length;if(void 0!==t.segment){let i=t.dist(e[t.segment+1]),r=t.dist(e[t.segment]),n={};for(let r=t.segment+1;r<e.length;r++)n[r]={x:e[r].x,y:e[r].y,tileUnitDistanceFromAnchor:i},r<e.length-1&&(i+=e[r+1].dist(e[r]));for(let i=t.segment||0;i>=0;i--)n[i]={x:e[i].x,y:e[i].y,tileUnitDistanceFromAnchor:r},i>0&&(r+=e[i-1].dist(e[i]));for(let t=0;t<e.length;t++){let e=n[t];this.lineVertexArray.emplaceBack(e.x,e.y,e.tileUnitDistanceFromAnchor)}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(t,e,i,r,n,s,o,a,l,h,u,c,f){let p=t.indexArray,d=t.layoutVertexArray,m=t.segments.prepareSegment(4*e.length,d,p,this.canOverlap?s.sortKey:void 0),_=this.glyphOffsetArray.length,g=m.vertexLength,y=this.allowVerticalPlacement&&2===o?Math.PI/2:0,v=s.text&&s.text.sections;for(let r=0;r<e.length;r++){let{tl:n,tr:o,bl:l,br:h,tex:u,pixelOffsetTL:_,pixelOffsetBR:g,minFontScaleX:w,minFontScaleY:b,glyphOffset:x,isSDF:D,sectionIndex:M}=e[r],E=m.vertexLength,A=x[1];Np(d,a.x,a.y,n.x,A+n.y,u.x,u.y,i,D,_.x,_.y,w,b,f),Np(d,a.x,a.y,o.x,A+o.y,u.x+u.w,u.y,i,D,g.x,_.y,w,b,f),Np(d,a.x,a.y,l.x,A+l.y,u.x,u.y+u.h,i,D,_.x,g.y,w,b,f),Np(d,a.x,a.y,h.x,A+h.y,u.x+u.w,u.y+u.h,i,D,g.x,g.y,w,b,f),Gp(t.dynamicLayoutVertexArray,a,y),p.emplaceBack(E,E+2,E+1),p.emplaceBack(E+1,E+2,E+3),m.vertexLength+=4,m.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(x[0]),(r===e.length-1||M!==e[r+1].sectionIndex)&&t.programConfigurations.populatePaintArrays(d.length,s,s.index,{imagePositions:{},canonical:c,formattedSection:v?.[M]})}t.placedSymbolArray.emplaceBack(a.x,a.y,_,this.glyphOffsetArray.length-_,g,l,h,a.segment,i?i[0]:0,i?i[1]:0,r[0],r[1],o,0,!1,0,u,f)}_addCollisionDebugVertex(t,e,i,r,n,s){return e.emplaceBack(0,0),t.emplaceBack(i.x,i.y,r,n,Math.round(s.x),Math.round(s.y))}addCollisionDebugVertices(t,e,i,r,n,s,o){let a=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),l=a.vertexLength,h=n.layoutVertexArray,c=n.collisionVertexArray,f=o.anchorX,p=o.anchorY;this._addCollisionDebugVertex(h,c,s,f,p,new u(t,e)),this._addCollisionDebugVertex(h,c,s,f,p,new u(i,e)),this._addCollisionDebugVertex(h,c,s,f,p,new u(i,r)),this._addCollisionDebugVertex(h,c,s,f,p,new u(t,r)),a.vertexLength+=4;let d=n.indexArray;d.emplaceBack(l,l+1),d.emplaceBack(l+1,l+2),d.emplaceBack(l+2,l+3),d.emplaceBack(l+3,l),a.primitiveLength+=4}addDebugCollisionBoxes(t,e,i,r){for(let n=t;n<e;n++){let t=this.collisionBoxArray.get(n);this.addCollisionDebugVertices(t.x1,t.y1,t.x2,t.y2,r?this.textCollisionBox:this.iconCollisionBox,t.anchorPoint,i)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Zp(Pa,Cc.members,Ra),this.iconCollisionBox=new Zp(Pa,Cc.members,Ra);for(let t=0;t<this.symbolInstances.length;t++){let e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex,e.verticalTextBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e,!1),this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex,e.verticalIconBoxEndIndex,e,!1)}}_deserializeCollisionBoxesForSymbol(t,e,i,r,n,s,o,a,l){let h={};for(let r=e;r<i;r++){let e=t.get(r);h.textBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,anchorPointX:e.anchorPointX,anchorPointY:e.anchorPointY},h.textFeatureIndex=e.featureIndex;break}for(let e=r;e<n;e++){let i=t.get(e);h.verticalTextBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},h.verticalTextFeatureIndex=i.featureIndex;break}for(let e=s;e<o;e++){let i=t.get(e);h.iconBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},h.iconFeatureIndex=i.featureIndex;break}for(let e=a;e<l;e++){let i=t.get(e);h.verticalIconBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},h.verticalIconFeatureIndex=i.featureIndex;break}return h}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){let i=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,i.textBoxStartIndex,i.textBoxEndIndex,i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i.iconBoxStartIndex,i.iconBoxEndIndex,i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){let i=t.placedSymbolArray.get(e),r=i.vertexStartIndex+4*i.numGlyphs;for(let e=i.vertexStartIndex;e<r;e+=4)t.indexArray.emplaceBack(e,e+2,e+1),t.indexArray.emplaceBack(e+1,e+2,e+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;let e=Math.sin(t),i=Math.cos(t),r=[],n=[],s=[];for(let t=0;t<this.symbolInstances.length;++t){s.push(t);let o=this.symbolInstances.get(t);r.push(0|Math.round(e*o.anchorX+i*o.anchorY)),n.push(o.featureIndex)}return s.sort(((t,e)=>r[t]-r[e]||n[e]-n[t])),s}addToSortKeyRanges(t,e){let i=this.sortKeyRanges[this.sortKeyRanges.length-1];i?.sortKey===e?i.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||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(let t of this.symbolInstanceIndexes){let e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex);let i=[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex];for(let t=0;t<i.length;t++){let e=i[t];e>=0&&i.indexOf(e)===t&&this.addIndicesForPlacedSymbol(this.text,e)}e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};let Hp,Yp;to("SymbolBucket",Wp,{omit:["layers","collisionBoxArray","features","compareText"]});var Xp={get paint(){return Yp||=new Mo({"icon-opacity":new wo(we.paint_symbol["icon-opacity"],"icon-opacity"),"icon-color":new wo(we.paint_symbol["icon-color"],"icon-color"),"icon-halo-color":new wo(we.paint_symbol["icon-halo-color"],"icon-halo-color"),"icon-halo-width":new wo(we.paint_symbol["icon-halo-width"],"icon-halo-width"),"icon-halo-blur":new wo(we.paint_symbol["icon-halo-blur"],"icon-halo-blur"),"icon-translate":new vo(we.paint_symbol["icon-translate"],"icon-translate"),"icon-translate-anchor":new vo(we.paint_symbol["icon-translate-anchor"],"icon-translate-anchor"),"text-opacity":new wo(we.paint_symbol["text-opacity"],"text-opacity"),"text-color":new wo(we.paint_symbol["text-color"],"text-color",{runtimeType:Fe,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new wo(we.paint_symbol["text-halo-color"],"text-halo-color"),"text-halo-width":new wo(we.paint_symbol["text-halo-width"],"text-halo-width"),"text-halo-blur":new wo(we.paint_symbol["text-halo-blur"],"text-halo-blur"),"text-translate":new vo(we.paint_symbol["text-translate"],"text-translate"),"text-translate-anchor":new vo(we.paint_symbol["text-translate-anchor"],"text-translate-anchor")})},get layout(){return Hp||=new Mo({"symbol-placement":new vo(we.layout_symbol["symbol-placement"],"symbol-placement"),"symbol-spacing":new vo(we.layout_symbol["symbol-spacing"],"symbol-spacing"),"symbol-avoid-edges":new vo(we.layout_symbol["symbol-avoid-edges"],"symbol-avoid-edges"),"symbol-sort-key":new wo(we.layout_symbol["symbol-sort-key"],"symbol-sort-key"),"symbol-z-order":new vo(we.layout_symbol["symbol-z-order"],"symbol-z-order"),"icon-allow-overlap":new vo(we.layout_symbol["icon-allow-overlap"],"icon-allow-overlap"),"icon-overlap":new vo(we.layout_symbol["icon-overlap"],"icon-overlap"),"icon-ignore-placement":new vo(we.layout_symbol["icon-ignore-placement"],"icon-ignore-placement"),"icon-optional":new vo(we.layout_symbol["icon-optional"],"icon-optional"),"icon-rotation-alignment":new wo(we.layout_symbol["icon-rotation-alignment"],"icon-rotation-alignment"),"icon-size":new wo(we.layout_symbol["icon-size"],"icon-size"),"icon-text-fit":new vo(we.layout_symbol["icon-text-fit"],"icon-text-fit"),"icon-text-fit-padding":new vo(we.layout_symbol["icon-text-fit-padding"],"icon-text-fit-padding"),"icon-image":new wo(we.layout_symbol["icon-image"],"icon-image"),"icon-rotate":new wo(we.layout_symbol["icon-rotate"],"icon-rotate"),"icon-padding":new wo(we.layout_symbol["icon-padding"],"icon-padding"),"icon-keep-upright":new vo(we.layout_symbol["icon-keep-upright"],"icon-keep-upright"),"icon-offset":new wo(we.layout_symbol["icon-offset"],"icon-offset"),"icon-anchor":new wo(we.layout_symbol["icon-anchor"],"icon-anchor"),"icon-pitch-alignment":new vo(we.layout_symbol["icon-pitch-alignment"],"icon-pitch-alignment"),"text-pitch-alignment":new vo(we.layout_symbol["text-pitch-alignment"],"text-pitch-alignment"),"text-rotation-alignment":new vo(we.layout_symbol["text-rotation-alignment"],"text-rotation-alignment"),"text-field":new wo(we.layout_symbol["text-field"],"text-field"),"text-font":new wo(we.layout_symbol["text-font"],"text-font"),"text-size":new wo(we.layout_symbol["text-size"],"text-size"),"text-max-width":new wo(we.layout_symbol["text-max-width"],"text-max-width"),"text-line-height":new vo(we.layout_symbol["text-line-height"],"text-line-height"),"text-letter-spacing":new wo(we.layout_symbol["text-letter-spacing"],"text-letter-spacing"),"text-justify":new wo(we.layout_symbol["text-justify"],"text-justify"),"text-radial-offset":new wo(we.layout_symbol["text-radial-offset"],"text-radial-offset"),"text-variable-anchor":new vo(we.layout_symbol["text-variable-anchor"],"text-variable-anchor"),"text-variable-anchor-offset":new wo(we.layout_symbol["text-variable-anchor-offset"],"text-variable-anchor-offset"),"text-anchor":new wo(we.layout_symbol["text-anchor"],"text-anchor"),"text-max-angle":new vo(we.layout_symbol["text-max-angle"],"text-max-angle"),"text-writing-mode":new vo(we.layout_symbol["text-writing-mode"],"text-writing-mode"),"text-rotate":new wo(we.layout_symbol["text-rotate"],"text-rotate"),"text-padding":new vo(we.layout_symbol["text-padding"],"text-padding"),"text-keep-upright":new vo(we.layout_symbol["text-keep-upright"],"text-keep-upright"),"text-transform":new wo(we.layout_symbol["text-transform"],"text-transform"),"text-offset":new wo(we.layout_symbol["text-offset"],"text-offset"),"text-allow-overlap":new vo(we.layout_symbol["text-allow-overlap"],"text-allow-overlap"),"text-overlap":new vo(we.layout_symbol["text-overlap"],"text-overlap"),"text-ignore-placement":new vo(we.layout_symbol["text-ignore-placement"],"text-ignore-placement"),"text-optional":new vo(we.layout_symbol["text-optional"],"text-optional"),"symbol-height-offset":new wo(we.layout_symbol["symbol-height-offset"],"symbol-height-offset"),"symbol-height-anchor":new vo(we.layout_symbol["symbol-height-anchor"],"symbol-height-anchor")})}},Jp=class{constructor(t){if(void 0===t.property.overrides)throw Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:De,this.defaultValue=t}evaluate(t){if(t.formattedSection){let e=this.defaultValue.property.overrides;if(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}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}};to("FormatSectionOverride",Jp,{omit:["defaultValue"]});const Kp=t=>"symbol"===t.type;var Qp=class t extends Fo{constructor(t,e){super(t,Xp,e)}recalculate(t,e){super.recalculate(t,e);let i=this.layout.get("icon-rotation-alignment");if(("constant"!==i.value.kind||"auto"===i.value.value)&&(this.layout._values["icon-rotation-alignment"]=new mo(i.property,{kind:"constant",value:"point"===this.layout.get("symbol-placement")?"viewport":"map"},i.parameters)),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"===this.layout.get("symbol-placement")?"viewport":"map"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment").constantOr("viewport")),"point"===this.layout.get("symbol-placement")){let t=this.layout.get("text-writing-mode");if(t){let e=[];for(let i of t)e.includes(i)||e.push(i);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,e,i,r){let n=this.layout.get(t).evaluate(e,{},i,r),s=this._unevaluatedLayout._values[t];return s.isDataDriven()||jn(s.value)||!n?n:function(t,e){return e.replace(/{([^{}]+)}/g,((e,i)=>t&&i in t?String(t[i]):""))}(e.properties,n)}createBucket(t){return new Wp(t)}queryRadius(){return 0}queryIntersectsFeature(){throw Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of Xp.paint.overridableProperties){if(!t.hasPaintOverride(this.layout,e))continue;let i=this.paint.get(e),r=new In(new Jp(i),`layers[${this.id}].paint.${i.property.name}`,i.property.specification),n=null;n="constant"===i.value.kind||"source"===i.value.kind?new On("source",r):new Bn("composite",r,i.value.zoomStops),this.paint._values[e]=new mo(i.property,n,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,r){return!(!this.layout||i.isDataDriven()||r.isDataDriven())&&t.hasPaintOverride(this.layout,e)}static hasPaintOverride(t,e){let i=t.get("text-field"),r=Xp.paint.properties[e],n=!1,s=t=>{for(let e of t)if(r.overrides?.hasOverride(e))return void(n=!0)};if("constant"===i.value.kind&&i.value.value instanceof gi)s(i.value.value.sections);else if("source"===i.value.kind||"composite"===i.value.kind){let t=e=>{n||(e instanceof Ti&&Si(e.value)===Pe?s(e.value.sections):e instanceof Bi?s(e.sections):e.eachChild(t))},e=i.value;e._styleExpression&&t(e._styleExpression.expression)}return n}};let td;var ed={get paint(){return td||=new Mo({"background-color":new vo(we.paint_background["background-color"],"background-color"),"background-pattern":new xo(we.paint_background["background-pattern"],"background-pattern"),"background-opacity":new vo(we.paint_background["background-opacity"],"background-opacity")})}},id=class extends Fo{constructor(t,e){super(t,ed,e)}},rd=class extends Fo{constructor(t,e){super(t,{},e),this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)},this.implementation=t}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw Error("Custom layers cannot be serialized")}};function nd(t,e){if("custom"===t.type)return new rd(t,e);switch(t.type){case"background":return new id(t,e);case"circle":return new Jl(t,e);case"color-relief":return new vh(t,e);case"fill":return new Du(t,e);case"fill-extrusion":return new cc(t,e);case"heatmap":return new hh(t,e);case"hillshade":return new fh(t,e);case"line":return new Ec(t,e);case"raster":return new To(t,e);case"symbol":return new Qp(t,e)}}var sd=class{constructor(t){this._methodToThrottle=t,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){this._triggered||(this._triggered=!0,this._channel?.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}};const od={once:!0};var ad=class{constructor(t,e){this.target=t,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new sd((()=>this.process())),this.subscription=Gt(this.target,"message",(t=>this.receive(t)),!1),this.globalScope=Lt(self)?t:window}registerMessageHandler(t,e){this.messageHandlers[t]=e}unregisterMessageHandler(t){delete this.messageHandlers[t]}sendAsync(t,e){return new Promise(((i,r)=>{let n=Math.round(1e18*Math.random()).toString(36).substring(0,10),s=e?Gt(e.signal,"abort",(()=>{s?.unsubscribe(),delete this.resolveRejects[n];let i={id:n,type:"<cancel>",origin:location.origin,targetMapId:t.targetMapId,sourceMapId:this.mapId};this.target.postMessage(i),r(new ie(e.signal.reason))}),od):null;this.resolveRejects[n]={resolve:t=>{s?.unsubscribe(),i(t)},reject:t=>{s?.unsubscribe(),r(t)}};let o=[],a={...t,id:n,sourceMapId:this.mapId,origin:location.origin,data:no(t.data,o)};this.target.postMessage(a,{transfer:o})}))}receive(t){let e=t.data,i=e.id,r=["file://","resource://android","null"],n=[e.origin,location.origin],s=e.origin===location.origin,o=n.some((t=>r.includes(t)));if((s||o)&&(!e.targetMapId||this.mapId===e.targetMapId)){if("<cancel>"===e.type){delete this.tasks[i];let t=this.abortControllers[i];return delete this.abortControllers[i],void(t&&t.abort())}if(Lt(self)||e.mustQueue)return this.tasks[i]=e,this.taskQueue.push(i),void this.invoker.trigger();this.processTask(i,e)}}process(){if(0===this.taskQueue.length)return;let t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(t,e)}async processTask(t,e){if("<response>"===e.type){let i=this.resolveRejects[t];if(delete this.resolveRejects[t],!i)return;return void(e.error?i.reject(nt(so(e.error))):i.resolve(so(e.data)))}if(!this.messageHandlers[e.type])return void this.completeTask(t,null,null);let i=so(e.data),r=new AbortController;this.abortControllers[t]=r;try{let n=await this.messageHandlers[e.type](e.sourceMapId,i,r);this.completeTask(t,null,n)}catch(e){this.completeTask(t,nt(e))}}completeTask(t,e,i){let r=[];delete this.abortControllers[t];let n={id:t,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:e?no(e):null,data:no(i,r)};this.target.postMessage(n,{transfer:r})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};function ld(t,e){let{x:i,y:r}=Wu.fromLngLat(e);return!(t<0||t>25||r<0||r>=1||i<0||i>=1)}var hd=class{constructor(t,e,i){if(!function(t,e,i){return!(t<0||t>25||i<0||i>=2**t||e<0||e>=2**t)}(t,e,i))throw Error(`x=${e}, y=${i}, z=${t} outside of bounds. 0<=x<${2**t}, 0<=y<${2**t} 0<=z<=25 `);this.z=t,this.x=e,this.y=i,this.key=fd(0,t,t,e,i)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,i){let r=function(t,e,i){let r=dd(256*t,256*(e=2**i-e-1),i),n=dd(256*(t+1),256*(e+1),i);return`${r[0]},${r[1]},${n[0]},${n[1]}`}(this.x,this.y,this.z),n=function(t,e,i){let r="";for(let n=t;n>0;n--){let t=1<<n-1;r+=(e&t?1:0)+(i&t?2:0)}return r}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===i?2**this.z-this.y-1:this.y)).replace(/{ratio}/g,e>1?"@2x":"").replace(/{quadkey}/g,n).replace(/{bbox-epsg-3857}/g,r)}isChildOf(t){let e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){let e=2**this.z;return new u((t.x*e-this.x)*it,(t.y*e-this.y)*it)}toString(){return`${this.z}/${this.x}/${this.y}`}},ud=class{constructor(t,e){this.wrap=t,this.canonical=e,this.key=fd(t,e.z,e.z,e.x,e.y)}},cd=class t{constructor(t,e,i,r,n){if(this.terrainRttPosMatrix32f=null,t<i)throw Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${i}`);this.overscaledZ=t,this.wrap=e,this.canonical=new hd(i,+r,+n),this.key=fd(e,t,i,r,n)}clone(){return new t(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(e){if(e>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let i=this.canonical.z-e;return e>this.canonical.z?new t(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new t(e,this.wrap,e,this.canonical.x>>i,this.canonical.y>>i)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(t,e){if(t>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);let i=this.canonical.z-t;return t>this.canonical.z?fd(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):fd(this.wrap*+e,t,t,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(t){if(t.wrap!==this.wrap||this.overscaledZ-t.overscaledZ<=0)return!1;if(0===t.overscaledZ)return this.overscaledZ>0;let e=this.canonical.z-t.canonical.z;return!(e<0)&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e}children(e){if(this.overscaledZ>=e)return[new t(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let i=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return[new t(i,this.wrap,i,r,n),new t(i,this.wrap,i,r+1,n),new t(i,this.wrap,i,r,n+1),new t(i,this.wrap,i,r+1,n+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new t(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new t(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return 2**(this.overscaledZ-this.canonical.z)}toUnwrapped(){return new ud(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new Wu(t.x-this.wrap,t.y))}normalizeCoordinates(e,i,r=it){if(e>=0&&e<r&&i>=0&&i<r)return{tileID:this,x:e,y:i};let n=Math.floor(e/r),s=Math.floor(i/r),o=e-n*r,a=i-s*r,l=this.canonical.z,h=1<<l,u=this.canonical.y+s;if(u<0||u>=h)return null;let c=this.canonical.x+n,f=this.wrap;return c<0?(f-=Math.ceil(-c/h),c=(c%h+h)%h):c>=h&&(f+=Math.floor(c/h),c%=h),{tileID:new t(this.overscaledZ,f,l,c,u),x:o,y:a}}};function fd(t,e,i,r,n){(t*=2)<0&&(t=-1*t-1);let s=1<<i;return(s*s*t+s*n+r).toString(36)+i.toString(36)+e.toString(36)}const pd=6378137*Math.PI;function dd(t,e,i){let r=2*pd/256/2**i;return[t*r-pd,e*r-pd]}function md(t,e){let i=Math.abs(2*t.wrap)-+(t.wrap<0),r=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||r-i||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}to("CanonicalTileID",hd),to("OverscaledTileID",cd,{omit:["terrainRttPosMatrix32f"]});const _d="_geojsonTileLayer";var gd=class{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){let i=t[e];this._stringToNumber[i]=e,this._numberToString[e]=i}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}},yd=class{constructor(t,e,i,r,n){this.type="Feature",this._vectorTileFeature=t,this._x=i,this._y=r,this._z=e;for(let e in t.properties)"string"==typeof t.properties[e]&&t.properties[e].startsWith("__$json__:")&&(t.properties[e]=JSON.parse(t.properties[e].slice(10)));this.properties=t.properties,this.id=n}projectPoint(t,e,i,r){return[360*(t.x+e)/r-180,360/Math.PI*Math.atan(Math.exp((1-2*(t.y+i)/r)*Math.PI))-90]}projectLine(t,e,i,r){return t.map((t=>this.projectPoint(t,e,i,r)))}get geometry(){if(this._geometry)return this._geometry;let t=this._vectorTileFeature,e=t.extent*2**this._z,i=t.extent*this._x,r=t.extent*this._y,n=t.loadGeometry();switch(t.type){case 1:{let t=[];for(let e of n)t.push(e[0]);let s=this.projectLine(t,i,r,e);this._geometry=1===t.length?{type:"Point",coordinates:s[0]}:{type:"MultiPoint",coordinates:s};break}case 2:{let t=n.map((t=>this.projectLine(t,i,r,e)));this._geometry=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t};break}case 3:{let t=Pu(n),s=[];for(let n of t)s.push(n.map((t=>this.projectLine(t,i,r,e))));this._geometry=1===s.length?{type:"Polygon",coordinates:s[0]}:{type:"MultiPolygon",coordinates:s};break}default:throw Error(`unknown feature type: ${t.type}`)}return this._geometry}set geometry(t){this._geometry=t}toJSON(){let t={geometry:this.geometry};for(let e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&"_x"!==e&&"_y"!==e&&"_z"!==e&&(t[e]=this[e]);return t}},vd=class{constructor(t,e,i){this._name=t,this.dataBuffer=e,"number"==typeof i?this._size=i:(this.nullabilityBuffer=i,this._size=i.size())}getValue(t){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(t)?null:this.getValueFromBuffer(t)}has(t){return this.nullabilityBuffer?.get(t)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}},wd=class extends vd{},bd=class extends wd{getValueFromBuffer(t){return this.dataBuffer[t]}},xd=class extends wd{getValueFromBuffer(t){return this.dataBuffer[t]}},Dd=class extends vd{constructor(t,e,i,r){super(t,e,r),this.delta=i}},Md=class extends Dd{constructor(t,e,i,r,n){super(t,n?Int32Array.of(e):Uint32Array.of(e),i,r)}getValueFromBuffer(t){return this.dataBuffer[0]+t*this.delta}},Ed=class extends vd{constructor(t,e,i,r){super(t,r?Int32Array.of(e):Uint32Array.of(e),i)}getValueFromBuffer(t){return this.dataBuffer[0]}},Ad=class{constructor(t,e,i,r,n=4096){if(this._name=t,this._geometryVector=e,this._idVector=i,this._propertyVectors=r,this._extent=n,0===t.length)throw Error("Missing layer name")}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors??[]}getPropertyVector(t){return this.propertyVectorsMap||=new Map(this.propertyVectors.map((t=>[t.name,t]))),this.propertyVectorsMap.get(t)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){let t=[],e=this.geometryVector.getGeometries();for(let i=0;i<this.numFeatures;i++){let r;if(this.idVector){let t=this.idVector.getValue(i);null!==t&&(r=this.containsMaxSafeIntegerValues(this.idVector)?Number(t):t)}let n={coordinates:e[i],type:this.geometryVector.geometryType(i)},s={};for(let t of this.propertyVectors){if(!t)continue;let e=t.name,r=t.getValue(i);null!==r&&(s[e]=r)}t.push({id:r,geometry:n,properties:s})}return t}containsMaxSafeIntegerValues(t){return t instanceof bd||t instanceof Ed||t instanceof Md||t instanceof xd}};var Fd,zd,Sd=class{constructor(t){this.value=t}get(){return this.value}set(t){this.value=t}increment(){return this.value++}add(t){this.value+=t}};!function(t){t.NONE="NONE",t.DELTA="DELTA",t.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",t.RLE="RLE",t.MORTON="MORTON"}(Fd||={}),function(t){t.NONE="NONE",t.FAST_PFOR="FAST_PFOR",t.VARINT="VARINT"}(zd||={});const Cd=new Uint32Array(33);Cd[0]=0;for(let t=1;t<=32;t++)Cd[t]=32===t?4294967295:4294967295>>>32-t;const Td=Cd;function Pd(t,e){return t-t%e}function Id(t){return Pd(t+31,32)}function kd(t){let e=t>>>0;return((255&e)<<24|(65280&e)<<8|e>>>8&65280|e>>>24&255)>>>0}const $d=function(t){if(!Number.isFinite(t))return 65536;let e=Pd(Math.floor(t),256);return 0===e?256:e}(65536),jd=3*$d/256+$d|0;function Rd(){let t=new Uint8Array(jd);return{dataToBePacked:Array(33),dataPointers:new Int32Array(33),byteContainer:t,byteContainerI32:new Int32Array(t.buffer,t.byteOffset,t.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function Od(t,e,i,r,n){switch(n){case 1:!function(t,e,i,r){let n=r,s=e;for(let e=0;e<8;e++){let e=t[s++]>>>0;i[n++]=e>>>0&1,i[n++]=e>>>1&1,i[n++]=e>>>2&1,i[n++]=e>>>3&1,i[n++]=e>>>4&1,i[n++]=e>>>5&1,i[n++]=e>>>6&1,i[n++]=e>>>7&1,i[n++]=e>>>8&1,i[n++]=e>>>9&1,i[n++]=e>>>10&1,i[n++]=e>>>11&1,i[n++]=e>>>12&1,i[n++]=e>>>13&1,i[n++]=e>>>14&1,i[n++]=e>>>15&1,i[n++]=e>>>16&1,i[n++]=e>>>17&1,i[n++]=e>>>18&1,i[n++]=e>>>19&1,i[n++]=e>>>20&1,i[n++]=e>>>21&1,i[n++]=e>>>22&1,i[n++]=e>>>23&1,i[n++]=e>>>24&1,i[n++]=e>>>25&1,i[n++]=e>>>26&1,i[n++]=e>>>27&1,i[n++]=e>>>28&1,i[n++]=e>>>29&1,i[n++]=e>>>30&1,i[n++]=e>>>31&1}}(t,e,i,r);break;case 2:!function(t,e,i,r){let n=r,s=e;for(let e=0;e<8;e++){let e=t[s++]>>>0,r=t[s++]>>>0;i[n++]=e>>>0&3,i[n++]=e>>>2&3,i[n++]=e>>>4&3,i[n++]=e>>>6&3,i[n++]=e>>>8&3,i[n++]=e>>>10&3,i[n++]=e>>>12&3,i[n++]=e>>>14&3,i[n++]=e>>>16&3,i[n++]=e>>>18&3,i[n++]=e>>>20&3,i[n++]=e>>>22&3,i[n++]=e>>>24&3,i[n++]=e>>>26&3,i[n++]=e>>>28&3,i[n++]=e>>>30&3,i[n++]=r>>>0&3,i[n++]=r>>>2&3,i[n++]=r>>>4&3,i[n++]=r>>>6&3,i[n++]=r>>>8&3,i[n++]=r>>>10&3,i[n++]=r>>>12&3,i[n++]=r>>>14&3,i[n++]=r>>>16&3,i[n++]=r>>>18&3,i[n++]=r>>>20&3,i[n++]=r>>>22&3,i[n++]=r>>>24&3,i[n++]=r>>>26&3,i[n++]=r>>>28&3,i[n++]=r>>>30&3}}(t,e,i,r);break;case 3:!function(t,e,i,r){let n=r,s=e;for(let e=0;e<8;e++){let e=t[s++]>>>0,r=t[s++]>>>0,o=t[s++]>>>0;i[n++]=e>>>0&7,i[n++]=e>>>3&7,i[n++]=e>>>6&7,i[n++]=e>>>9&7,i[n++]=e>>>12&7,i[n++]=e>>>15&7,i[n++]=e>>>18&7,i[n++]=e>>>21&7,i[n++]=e>>>24&7,i[n++]=e>>>27&7,i[n++]=7&(e>>>30|(1&r)<<2),i[n++]=r>>>1&7,i[n++]=r>>>4&7,i[n++]=r>>>7&7,i[n++]=r>>>10&7,i[n++]=r>>>13&7,i[n++]=r>>>16&7,i[n++]=r>>>19&7,i[n++]=r>>>22&7,i[n++]=r>>>25&7,i[n++]=r>>>28&7,i[n++]=7&(r>>>31|(3&o)<<1),i[n++]=o>>>2&7,i[n++]=o>>>5&7,i[n++]=o>>>8&7,i[n++]=o>>>11&7,i[n++]=o>>>14&7,i[n++]=o>>>17&7,i[n++]=o>>>20&7,i[n++]=o>>>23&7,i[n++]=o>>>26&7,i[n++]=o>>>29&7}}(t,e,i,r);break;case 4:!function(t,e,i,r){let n=r,s=e;for(let e=0;e<8;e++){let e=t[s++]>>>0,r=t[s++]>>>0,o=t[s++]>>>0,a=t[s++]>>>0;i[n++]=e>>>0&15,i[n++]=e>>>4&15,i[n++]=e>>>8&15,i[n++]=e>>>12&15,i[n++]=e>>>16&15,i[n++]=e>>>20&15,i[n++]=e>>>24&15,i[n++]=e>>>28&15,i[n++]=r>>>0&15,i[n++]=r>>>4&15,i[n++]=r>>>8&15,i[n++]=r>>>12&15,i[n++]=r>>>16&15,i[n++]=r>>>20&15,i[n++]=r>>>24&15,i[n++]=r>>>28&15,i[n++]=o>>>0&15,i[n++]=o>>>4&15,i[n++]=o>>>8&15,i[n++]=o>>>12&15,i[n++]=o>>>16&15,i[n++]=o>>>20&15,i[n++]=o>>>24&15,i[n++]=o>>>28&15,i[n++]=a>>>0&15,i[n++]=a>>>4&15,i[n++]=a>>>8&15,i[n++]=a>>>12&15,i[n++]=a>>>16&15,i[n++]=a>>>20&15,i[n++]=a>>>24&15,i[n++]=a>>>28&15}}(t,e,i,r);break;case 5:!function(t,e,i,r){let n=r,s=e;for(let e=0;e<8;e++){let e=t[s++]>>>0,r=t[s++]>>>0,o=t[s++]>>>0,a=t[s++]>>>0,l=t[s++]>>>0;i[n++]=e>>>0&31,i[n++]=e>>>5&31,i[n++]=e>>>10&31,i[n++]=e>>>15&31,i[n++]=e>>>20&31,i[n++]=e>>>25&31,i[n++]=31&(e>>>30|(7&r)<<2),i[n++]=r>>>3&31,i[n++]=r>>>8&31,i[n++]=r>>>13&31,i[n++]=r>>>18&31,i[n++]=r>>>23&31,i[n++]=31&(r>>>28|(1&o)<<4),i[n++]=o>>>1&31,i[n++]=o>>>6&31,i[n++]=o>>>11&31,i[n++]=o>>>16&31,i[n++]=o>>>21&31,i[n++]=o>>>26&31,i[n++]=31&(o>>>31|(15&a)<<1),i[n++]=a>>>4&31,i[n++]=a>>>9&31,i[n++]=a>>>14&31,i[n++]=a>>>19&31,i[n++]=a>>>24&31,i[n++]=31&(a>>>29|(3&l)<<3),i[n++]=l>>>2&31,i[n++]=l>>>7&31,i[n++]=l>>>12&31,i[n++]=l>>>17&31,i[n++]=l>>>22&31,i[n++]=l>>>27&31}}(t,e,i,r);break;case 6:!function(t,e,i,r){let n=r,s=e;for(let e=0;e<8;e++){let e=t[s++]>>>0,r=t[s++]>>>0,o=t[s++]>>>0,a=t[s++]>>>0,l=t[s++]>>>0,h=t[s++]>>>0;i[n++]=e>>>0&63,i[n++]=e>>>6&63,i[n++]=e>>>12&63,i[n++]=e>>>18&63,i[n++]=e>>>24&63,i[n++]=63&(e>>>30|(15&r)<<2),i[n++]=r>>>4&63,i[n++]=r>>>10&63,i[n++]=r>>>16&63,i[n++]=r>>>22&63,i[n++]=63&(r>>>28|(3&o)<<4),i[n++]=o>>>2&63,i[n++]=o>>>8&63,i[n++]=o>>>14&63,i[n++]=o>>>20&63,i[n++]=o>>>26&63,i[n++]=a>>>0&63,i[n++]=a>>>6&63,i[n++]=a>>>12&63,i[n++]=a>>>18&63,i[n++]=a>>>24&63,i[n++]=63&(a>>>30|(15&l)<<2),i[n++]=l>>>4&63,i[n++]=l>>>10&63,i[n++]=l>>>16&63,i[n++]=l>>>22&63,i[n++]=63&(l>>>28|(3&h)<<4),i[n++]=h>>>2&63,i[n++]=h>>>8&63,i[n++]=h>>>14&63,i[n++]=h>>>20&63,i[n++]=h>>>26&63}}(t,e,i,r);break;case 7:!function(t,e,i,r){let n=r,s=e;for(let e=0;e<8;e++){let e=t[s++]>>>0,r=t[s++]>>>0,o=t[s++]>>>0,a=t[s++]>>>0,l=t[s++]>>>0,h=t[s++]>>>0,u=t[s++]>>>0;i[n++]=e>>>0&127,i[n++]=e>>>7&127,i[n++]=e>>>14&127,i[n++]=e>>>21&127,i[n++]=127&(e>>>28|(7&r)<<4),i[n++]=r>>>3&127,i[n++]=r>>>10&127,i[n++]=r>>>17&127,i[n++]=r>>>24&127,i[n++]=127&(r>>>31|(63&o)<<1),i[n++]=o>>>6&127,i[n++]=o>>>13&127,i[n++]=o>>>20&127,i[n++]=127&(o>>>27|(3&a)<<5),i[n++]=a>>>2&127,i[n++]=a>>>9&127,i[n++]=a>>>16&127,i[n++]=a>>>23&127,i[n++]=127&(a>>>30|(31&l)<<2),i[n++]=l>>>5&127,i[n++]=l>>>12&127,i[n++]=l>>>19&127,i[n++]=127&(l>>>26|(1&h)<<6),i[n++]=h>>>1&127,i[n++]=h>>>8&127,i[n++]=h>>>15&127,i[n++]=h>>>22&127,i[n++]=127&(h>>>29|(15&u)<<3),i[n++]=u>>>4&127,i[n++]=u>>>11&127,i[n++]=u>>>18&127,i[n++]=u>>>25&127}}(t,e,i,r);break;case 8:!function(t,e,i,r){let n=r,s=e;for(let e=0;e<8;e++){let e=t[s++]>>>0,r=t[s++]>>>0,o=t[s++]>>>0,a=t[s++]>>>0,l=t[s++]>>>0,h=t[s++]>>>0,u=t[s++]>>>0,c=t[s++]>>>0;i[n++]=e>>>0&255,i[n++]=e>>>8&255,i[n++]=e>>>16&255,i[n++]=e>>>24&255,i[n++]=r>>>0&255,i[n++]=r>>>8&255,i[n++]=r>>>16&255,i[n++]=r>>>24&255,i[n++]=o>>>0&255,i[n++]=o>>>8&255,i[n++]=o>>>16&255,i[n++]=o>>>24&255,i[n++]=a>>>0&255,i[n++]=a>>>8&255,i[n++]=a>>>16&255,i[n++]=a>>>24&255,i[n++]=l>>>0&255,i[n++]=l>>>8&255,i[n++]=l>>>16&255,i[n++]=l>>>24&255,i[n++]=h>>>0&255,i[n++]=h>>>8&255,i[n++]=h>>>16&255,i[n++]=h>>>24&255,i[n++]=u>>>0&255,i[n++]=u>>>8&255,i[n++]=u>>>16&255,i[n++]=u>>>24&255,i[n++]=c>>>0&255,i[n++]=c>>>8&255,i[n++]=c>>>16&255,i[n++]=c>>>24&255}}(t,e,i,r);break;case 16:!function(t,e,i,r){let n=r,s=e;for(let e=0;e<128;e++){let e=t[s++]>>>0;i[n++]=65535&e,i[n++]=e>>>16&65535}}(t,e,i,r);break;default:!function(t,e,i,r,n){let s=Td[n]>>>0,o=e,a=0,l=t[o]>>>0,h=r;for(let e=0;e<8;e++){for(let e=0;e<32;e++)if(a+n<=32)i[h+e]=l>>>a&s,a+=n,32===a&&(a=0,o++,31!==e&&(l=t[o]>>>0));else{let r=32-a,u=l>>>a;o++,l=t[o]>>>0;let c=n-r;i[h+e]=(u|(l&-1>>>32-c>>>0)<<r)&s,a=c}h+=32,a=0,e<7&&(l=t[o]>>>0)}}(t,e,i,r,n)}return e+(n<<3)|0}function Bd(t,e,i,r){if(i+2>e)throw Error(`FastPFOR decode: byteContainer underflow at block=${r} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${i}, byteSize=${e})`);let n=t[i++],s=t[i++];if(n>32)throw Error(`FastPFOR decode: invalid bitWidth=${n} at block=${r} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:n,exceptionCount:s,bytePosIn:i}}function Ld(t,e,i,r,n,s,o,a,l){let{maxBits:h,exceptionBitWidth:u,bytePosIn:c}=function(t,e,i,r,n,s){if(i+1>e)throw Error(`FastPFOR decode: exception header underflow at block=${s} (need 1 byte for maxBits, bytePos=${i}, byteSize=${e})`);let o=t[i++];if(o<r||o>32)throw Error(`FastPFOR decode: invalid maxBits=${o} at block=${s} (bitWidth=${r}, expected ${r}..32)`);let a=o-r|0;if(a<1||a>32)throw Error(`FastPFOR decode: invalid exceptionBitWidth=${a} at block=${s} (bitWidth=${r}, maxBits=${o})`);if(i+n>e)throw Error(`FastPFOR decode: exception positions underflow at block=${s} (need=${n}, have=${e-i})`);return{maxBits:o,exceptionBitWidth:a,bytePosIn:i}}(n,s,o,i,r,l);if(o=c,1===u){let s=1<<i;for(let i=0;i<r;i=i+1|0)t[n[o++]+e|0]|=s;return o}let f=a.dataToBePacked[u];if(!f)throw Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${u} (bitWidth=${i}, maxBits=${h}) at block ${l}`);let p=a.dataPointers,d=0|p[u],m=0|a.exceptionSizes[u];if(d+r>m)throw Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${u} (ptr=${d}, need ${r}, size=${m}) at block ${l}`);for(let s=0;s<r;s=s+1|0){let r=n[o++],s=0|f[d++];t[r+e|0]|=s<<i}return p[u]=d,o}function Ud(t,e,i,r,n,s){let o=0|i,a=0|t[o];if(a<=0||o+a>t.length-1)throw Error(`FastPFOR decode: invalid whereMeta=${a} at pageStart=${o} (expected > 0 and pageStart+whereMeta < encoded.length=${t.length})`);let l=o+1|0,h=o+a|0,u=t[h]>>>0,c=u+3>>>2,f=h+1,p=f+c;if(p>=t.length)throw Error(`FastPFOR decode: invalid byteSize=${u} (metaInts=${c}, pageStart=${o}, packedEnd=${h}, byteContainerStart=${f}) causes bitmapPos=${p} out of bounds (encoded.length=${t.length})`);let d=function(t,e,i,r){r.byteContainer.length<i&&(r.byteContainer=new Uint8Array(2*i),r.byteContainerI32=void 0);let n=r.byteContainer,s=i>>>2;if(3&n.byteOffset)for(let i=0;i<s;i=i+1|0){let r=0|t[e+i|0],s=i<<2;n[s]=255&r,n[s+1|0]=r>>>8&255,n[s+2|0]=r>>>16&255,n[s+3|0]=r>>>24&255}else{let i=r.byteContainerI32;(!i||i.buffer!==n.buffer||i.byteOffset!==n.byteOffset||i.length<s)&&(i=r.byteContainerI32=new Int32Array(n.buffer,n.byteOffset,n.byteLength>>>2)),i.set(t.subarray(e,e+s))}let o=3&i;if(o>0){let i=0|t[e+s|0],r=s<<2;for(let t=0;t<o;t=t+1|0)n[r+t|0]=i>>>(t<<3)&255}return n}(t,f,u,s),m=u,_=function(t,e,i){let r=0|t[e++],n=i.dataToBePacked;for(let s=2;s<=32;s=s+1|0){if(!(r>>>s-1&1))continue;if(e>=t.length)throw Error(`FastPFOR decode: truncated exception stream header (bitWidth=${s}, streamWordIndex=${e}, needWords=1, availableWords=${t.length-e}, encodedWords=${t.length})`);let o=t[e++]>>>0,a=Id(o),l=o*s+31>>>5;if(e+l>t.length)throw Error(`FastPFOR decode: truncated exception stream (bitWidth=${s}, size=${o}, streamWordIndex=${e}, needWords=${l}, availableWords=${t.length-e}, encodedWords=${t.length})`);let h=n[s];(!h||h.length<a)&&(h=n[s]=new Uint32Array(a));let u=0;for(;u<o;u=u+32|0)Nd(t,e,h,u,s),e=e+s|0;e=e-((u-o|0)*s>>>5)|0,i.exceptionSizes[s]=o}return e}(t,p,s);return s.dataPointers.fill(0),function(t,e,i,r,n,s,o,a,l,h){let u=0|i,c=0;for(let e=0;e<o;e=e+1|0){let i=Bd(a,l,c,e);c=i.bytePosIn;let r=i.bitWidth,o=i.exceptionCount,f=s+256*e|0;switch(r){case 0:n.fill(0,f,f+256);break;case 32:for(let e=0;e<256;e=e+1|0)n[f+e|0]=0|t[u+e|0];u=u+256|0;break;default:u=Od(t,u,n,f,r)}o>0&&(c=Ld(n,f,r,o,a,l,c,h,e))}if(u!==r)throw Error(`FastPFOR decode: packed region mismatch (pageStart=${e}, packedStart=${i}, consumedPackedEnd=${u}, expectedPackedEnd=${r}, packedWords=${r-i}, encoded.length=${t.length})`)}(t,o,l,h,e,0|r,n/256|0,d,m,s),_}function Nd(t,e,i,r,n){switch(n){case 2:return void function(t,e,i,r){let n=r,s=t[e]>>>0,o=t[e+1]>>>0;i[n++]=s>>>0&3,i[n++]=s>>>2&3,i[n++]=s>>>4&3,i[n++]=s>>>6&3,i[n++]=s>>>8&3,i[n++]=s>>>10&3,i[n++]=s>>>12&3,i[n++]=s>>>14&3,i[n++]=s>>>16&3,i[n++]=s>>>18&3,i[n++]=s>>>20&3,i[n++]=s>>>22&3,i[n++]=s>>>24&3,i[n++]=s>>>26&3,i[n++]=s>>>28&3,i[n++]=s>>>30&3,i[n++]=o>>>0&3,i[n++]=o>>>2&3,i[n++]=o>>>4&3,i[n++]=o>>>6&3,i[n++]=o>>>8&3,i[n++]=o>>>10&3,i[n++]=o>>>12&3,i[n++]=o>>>14&3,i[n++]=o>>>16&3,i[n++]=o>>>18&3,i[n++]=o>>>20&3,i[n++]=o>>>22&3,i[n++]=o>>>24&3,i[n++]=o>>>26&3,i[n++]=o>>>28&3,i[n]=o>>>30&3}(t,e,i,r);case 3:return void function(t,e,i,r){let n=r,s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0;i[n++]=s>>>0&7,i[n++]=s>>>3&7,i[n++]=s>>>6&7,i[n++]=s>>>9&7,i[n++]=s>>>12&7,i[n++]=s>>>15&7,i[n++]=s>>>18&7,i[n++]=s>>>21&7,i[n++]=s>>>24&7,i[n++]=s>>>27&7,i[n++]=7&(s>>>30|(1&o)<<2),i[n++]=o>>>1&7,i[n++]=o>>>4&7,i[n++]=o>>>7&7,i[n++]=o>>>10&7,i[n++]=o>>>13&7,i[n++]=o>>>16&7,i[n++]=o>>>19&7,i[n++]=o>>>22&7,i[n++]=o>>>25&7,i[n++]=o>>>28&7,i[n++]=7&(o>>>31|(3&a)<<1),i[n++]=a>>>2&7,i[n++]=a>>>5&7,i[n++]=a>>>8&7,i[n++]=a>>>11&7,i[n++]=a>>>14&7,i[n++]=a>>>17&7,i[n++]=a>>>20&7,i[n++]=a>>>23&7,i[n++]=a>>>26&7,i[n]=a>>>29&7}(t,e,i,r);case 4:return void function(t,e,i,r){let n=r,s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0,l=t[e+3]>>>0;i[n++]=s>>>0&15,i[n++]=s>>>4&15,i[n++]=s>>>8&15,i[n++]=s>>>12&15,i[n++]=s>>>16&15,i[n++]=s>>>20&15,i[n++]=s>>>24&15,i[n++]=s>>>28&15,i[n++]=o>>>0&15,i[n++]=o>>>4&15,i[n++]=o>>>8&15,i[n++]=o>>>12&15,i[n++]=o>>>16&15,i[n++]=o>>>20&15,i[n++]=o>>>24&15,i[n++]=o>>>28&15,i[n++]=a>>>0&15,i[n++]=a>>>4&15,i[n++]=a>>>8&15,i[n++]=a>>>12&15,i[n++]=a>>>16&15,i[n++]=a>>>20&15,i[n++]=a>>>24&15,i[n++]=a>>>28&15,i[n++]=l>>>0&15,i[n++]=l>>>4&15,i[n++]=l>>>8&15,i[n++]=l>>>12&15,i[n++]=l>>>16&15,i[n++]=l>>>20&15,i[n++]=l>>>24&15,i[n]=l>>>28&15}(t,e,i,r);case 5:return void function(t,e,i,r){let n=r,s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0,l=t[e+3]>>>0,h=t[e+4]>>>0;i[n++]=s>>>0&31,i[n++]=s>>>5&31,i[n++]=s>>>10&31,i[n++]=s>>>15&31,i[n++]=s>>>20&31,i[n++]=s>>>25&31,i[n++]=31&(s>>>30|(7&o)<<2),i[n++]=o>>>3&31,i[n++]=o>>>8&31,i[n++]=o>>>13&31,i[n++]=o>>>18&31,i[n++]=o>>>23&31,i[n++]=31&(o>>>28|(1&a)<<4),i[n++]=a>>>1&31,i[n++]=a>>>6&31,i[n++]=a>>>11&31,i[n++]=a>>>16&31,i[n++]=a>>>21&31,i[n++]=a>>>26&31,i[n++]=31&(a>>>31|(15&l)<<1),i[n++]=l>>>4&31,i[n++]=l>>>9&31,i[n++]=l>>>14&31,i[n++]=l>>>19&31,i[n++]=l>>>24&31,i[n++]=31&(l>>>29|(3&h)<<3),i[n++]=h>>>2&31,i[n++]=h>>>7&31,i[n++]=h>>>12&31,i[n++]=h>>>17&31,i[n++]=h>>>22&31,i[n]=h>>>27&31}(t,e,i,r);case 6:return void function(t,e,i,r){let n=r,s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0,l=t[e+3]>>>0,h=t[e+4]>>>0,u=t[e+5]>>>0;i[n++]=s>>>0&63,i[n++]=s>>>6&63,i[n++]=s>>>12&63,i[n++]=s>>>18&63,i[n++]=s>>>24&63,i[n++]=63&(s>>>30|(15&o)<<2),i[n++]=o>>>4&63,i[n++]=o>>>10&63,i[n++]=o>>>16&63,i[n++]=o>>>22&63,i[n++]=63&(o>>>28|(3&a)<<4),i[n++]=a>>>2&63,i[n++]=a>>>8&63,i[n++]=a>>>14&63,i[n++]=a>>>20&63,i[n++]=a>>>26&63,i[n++]=l>>>0&63,i[n++]=l>>>6&63,i[n++]=l>>>12&63,i[n++]=l>>>18&63,i[n++]=l>>>24&63,i[n++]=63&(l>>>30|(15&h)<<2),i[n++]=h>>>4&63,i[n++]=h>>>10&63,i[n++]=h>>>16&63,i[n++]=h>>>22&63,i[n++]=63&(h>>>28|(3&u)<<4),i[n++]=u>>>2&63,i[n++]=u>>>8&63,i[n++]=u>>>14&63,i[n++]=u>>>20&63,i[n]=u>>>26&63}(t,e,i,r);case 7:return void function(t,e,i,r){let n=r,s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0,l=t[e+3]>>>0,h=t[e+4]>>>0,u=t[e+5]>>>0,c=t[e+6]>>>0;i[n++]=s>>>0&127,i[n++]=s>>>7&127,i[n++]=s>>>14&127,i[n++]=s>>>21&127,i[n++]=127&(s>>>28|(7&o)<<4),i[n++]=o>>>3&127,i[n++]=o>>>10&127,i[n++]=o>>>17&127,i[n++]=o>>>24&127,i[n++]=127&(o>>>31|(63&a)<<1),i[n++]=a>>>6&127,i[n++]=a>>>13&127,i[n++]=a>>>20&127,i[n++]=127&(a>>>27|(3&l)<<5),i[n++]=l>>>2&127,i[n++]=l>>>9&127,i[n++]=l>>>16&127,i[n++]=l>>>23&127,i[n++]=127&(l>>>30|(31&h)<<2),i[n++]=h>>>5&127,i[n++]=h>>>12&127,i[n++]=h>>>19&127,i[n++]=127&(h>>>26|(1&u)<<6),i[n++]=u>>>1&127,i[n++]=u>>>8&127,i[n++]=u>>>15&127,i[n++]=u>>>22&127,i[n++]=127&(u>>>29|(15&c)<<3),i[n++]=c>>>4&127,i[n++]=c>>>11&127,i[n++]=c>>>18&127,i[n]=c>>>25&127}(t,e,i,r);case 8:return void function(t,e,i,r){let n=r,s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0,l=t[e+3]>>>0,h=t[e+4]>>>0,u=t[e+5]>>>0,c=t[e+6]>>>0,f=t[e+7]>>>0;i[n++]=s>>>0&255,i[n++]=s>>>8&255,i[n++]=s>>>16&255,i[n++]=s>>>24&255,i[n++]=o>>>0&255,i[n++]=o>>>8&255,i[n++]=o>>>16&255,i[n++]=o>>>24&255,i[n++]=a>>>0&255,i[n++]=a>>>8&255,i[n++]=a>>>16&255,i[n++]=a>>>24&255,i[n++]=l>>>0&255,i[n++]=l>>>8&255,i[n++]=l>>>16&255,i[n++]=l>>>24&255,i[n++]=h>>>0&255,i[n++]=h>>>8&255,i[n++]=h>>>16&255,i[n++]=h>>>24&255,i[n++]=u>>>0&255,i[n++]=u>>>8&255,i[n++]=u>>>16&255,i[n++]=u>>>24&255,i[n++]=c>>>0&255,i[n++]=c>>>8&255,i[n++]=c>>>16&255,i[n++]=c>>>24&255,i[n++]=f>>>0&255,i[n++]=f>>>8&255,i[n++]=f>>>16&255,i[n]=f>>>24&255}(t,e,i,r);case 9:return void function(t,e,i,r){let n=r,s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0,l=t[e+3]>>>0,h=t[e+4]>>>0,u=t[e+5]>>>0,c=t[e+6]>>>0,f=t[e+7]>>>0,p=t[e+8]>>>0;i[n++]=s>>>0&511,i[n++]=s>>>9&511,i[n++]=s>>>18&511,i[n++]=511&(s>>>27|(15&o)<<5),i[n++]=o>>>4&511,i[n++]=o>>>13&511,i[n++]=o>>>22&511,i[n++]=511&(o>>>31|(255&a)<<1),i[n++]=a>>>8&511,i[n++]=a>>>17&511,i[n++]=511&(a>>>26|(7&l)<<6),i[n++]=l>>>3&511,i[n++]=l>>>12&511,i[n++]=l>>>21&511,i[n++]=511&(l>>>30|(127&h)<<2),i[n++]=h>>>7&511,i[n++]=h>>>16&511,i[n++]=511&(h>>>25|(3&u)<<7),i[n++]=u>>>2&511,i[n++]=u>>>11&511,i[n++]=u>>>20&511,i[n++]=511&(u>>>29|(63&c)<<3),i[n++]=c>>>6&511,i[n++]=c>>>15&511,i[n++]=511&(c>>>24|(1&f)<<8),i[n++]=f>>>1&511,i[n++]=f>>>10&511,i[n++]=f>>>19&511,i[n++]=511&(f>>>28|(31&p)<<4),i[n++]=p>>>5&511,i[n++]=p>>>14&511,i[n]=p>>>23&511}(t,e,i,r);case 10:return void function(t,e,i,r){let n=r,s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0,l=t[e+3]>>>0,h=t[e+4]>>>0,u=t[e+5]>>>0,c=t[e+6]>>>0,f=t[e+7]>>>0,p=t[e+8]>>>0,d=t[e+9]>>>0;i[n++]=s>>>0&1023,i[n++]=s>>>10&1023,i[n++]=s>>>20&1023,i[n++]=1023&(s>>>30|(255&o)<<2),i[n++]=o>>>8&1023,i[n++]=o>>>18&1023,i[n++]=1023&(o>>>28|(63&a)<<4),i[n++]=a>>>6&1023,i[n++]=a>>>16&1023,i[n++]=1023&(a>>>26|(15&l)<<6),i[n++]=l>>>4&1023,i[n++]=l>>>14&1023,i[n++]=1023&(l>>>24|(3&h)<<8),i[n++]=h>>>2&1023,i[n++]=h>>>12&1023,i[n++]=h>>>22&1023,i[n++]=u>>>0&1023,i[n++]=u>>>10&1023,i[n++]=u>>>20&1023,i[n++]=1023&(u>>>30|(255&c)<<2),i[n++]=c>>>8&1023,i[n++]=c>>>18&1023,i[n++]=1023&(c>>>28|(63&f)<<4),i[n++]=f>>>6&1023,i[n++]=f>>>16&1023,i[n++]=1023&(f>>>26|(15&p)<<6),i[n++]=p>>>4&1023,i[n++]=p>>>14&1023,i[n++]=1023&(p>>>24|(3&d)<<8),i[n++]=d>>>2&1023,i[n++]=d>>>12&1023,i[n]=d>>>22&1023}(t,e,i,r);case 11:return void function(t,e,i,r){let n=r,s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0,l=t[e+3]>>>0,h=t[e+4]>>>0,u=t[e+5]>>>0,c=t[e+6]>>>0,f=t[e+7]>>>0,p=t[e+8]>>>0,d=t[e+9]>>>0,m=t[e+10]>>>0;i[n++]=s>>>0&2047,i[n++]=s>>>11&2047,i[n++]=2047&(s>>>22|(1&o)<<10),i[n++]=o>>>1&2047,i[n++]=o>>>12&2047,i[n++]=2047&(o>>>23|(3&a)<<9),i[n++]=a>>>2&2047,i[n++]=a>>>13&2047,i[n++]=2047&(a>>>24|(7&l)<<8),i[n++]=l>>>3&2047,i[n++]=l>>>14&2047,i[n++]=2047&(l>>>25|(15&h)<<7),i[n++]=h>>>4&2047,i[n++]=h>>>15&2047,i[n++]=2047&(h>>>26|(31&u)<<6),i[n++]=u>>>5&2047,i[n++]=u>>>16&2047,i[n++]=2047&(u>>>27|(63&c)<<5),i[n++]=c>>>6&2047,i[n++]=c>>>17&2047,i[n++]=2047&(c>>>28|(127&f)<<4),i[n++]=f>>>7&2047,i[n++]=f>>>18&2047,i[n++]=2047&(f>>>29|(255&p)<<3),i[n++]=p>>>8&2047,i[n++]=p>>>19&2047,i[n++]=2047&(p>>>30|(511&d)<<2),i[n++]=d>>>9&2047,i[n++]=d>>>20&2047,i[n++]=2047&(d>>>31|(1023&m)<<1),i[n++]=m>>>10&2047,i[n]=m>>>21&2047}(t,e,i,r);case 12:return void function(t,e,i,r){let n=r,s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0,l=t[e+3]>>>0,h=t[e+4]>>>0,u=t[e+5]>>>0,c=t[e+6]>>>0,f=t[e+7]>>>0,p=t[e+8]>>>0,d=t[e+9]>>>0,m=t[e+10]>>>0,_=t[e+11]>>>0;i[n++]=s>>>0&4095,i[n++]=s>>>12&4095,i[n++]=4095&(s>>>24|(15&o)<<8),i[n++]=o>>>4&4095,i[n++]=o>>>16&4095,i[n++]=4095&(o>>>28|(255&a)<<4),i[n++]=a>>>8&4095,i[n++]=a>>>20&4095,i[n++]=l>>>0&4095,i[n++]=l>>>12&4095,i[n++]=4095&(l>>>24|(15&h)<<8),i[n++]=h>>>4&4095,i[n++]=h>>>16&4095,i[n++]=4095&(h>>>28|(255&u)<<4),i[n++]=u>>>8&4095,i[n++]=u>>>20&4095,i[n++]=c>>>0&4095,i[n++]=c>>>12&4095,i[n++]=4095&(c>>>24|(15&f)<<8),i[n++]=f>>>4&4095,i[n++]=f>>>16&4095,i[n++]=4095&(f>>>28|(255&p)<<4),i[n++]=p>>>8&4095,i[n++]=p>>>20&4095,i[n++]=d>>>0&4095,i[n++]=d>>>12&4095,i[n++]=4095&(d>>>24|(15&m)<<8),i[n++]=m>>>4&4095,i[n++]=m>>>16&4095,i[n++]=4095&(m>>>28|(255&_)<<4),i[n++]=_>>>8&4095,i[n]=_>>>20&4095}(t,e,i,r);case 16:return void function(t,e,i,r){let n=r,s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0,l=t[e+3]>>>0,h=t[e+4]>>>0,u=t[e+5]>>>0,c=t[e+6]>>>0,f=t[e+7]>>>0,p=t[e+8]>>>0,d=t[e+9]>>>0,m=t[e+10]>>>0,_=t[e+11]>>>0,g=t[e+12]>>>0,y=t[e+13]>>>0,v=t[e+14]>>>0,w=t[e+15]>>>0;i[n++]=s>>>0&65535,i[n++]=s>>>16&65535,i[n++]=o>>>0&65535,i[n++]=o>>>16&65535,i[n++]=a>>>0&65535,i[n++]=a>>>16&65535,i[n++]=l>>>0&65535,i[n++]=l>>>16&65535,i[n++]=h>>>0&65535,i[n++]=h>>>16&65535,i[n++]=u>>>0&65535,i[n++]=u>>>16&65535,i[n++]=c>>>0&65535,i[n++]=c>>>16&65535,i[n++]=f>>>0&65535,i[n++]=f>>>16&65535,i[n++]=p>>>0&65535,i[n++]=p>>>16&65535,i[n++]=d>>>0&65535,i[n++]=d>>>16&65535,i[n++]=m>>>0&65535,i[n++]=m>>>16&65535,i[n++]=_>>>0&65535,i[n++]=_>>>16&65535,i[n++]=g>>>0&65535,i[n++]=g>>>16&65535,i[n++]=y>>>0&65535,i[n++]=y>>>16&65535,i[n++]=v>>>0&65535,i[n++]=v>>>16&65535,i[n++]=w>>>0&65535,i[n]=w>>>16&65535}(t,e,i,r);case 32:for(let n=0;n<32;n=n+1|0)i[r+n|0]=0|t[e+n|0];return}let s=Td[n]>>>0,o=e,a=0,l=t[o]>>>0;for(let e=0;e<32;e++)if(a+n<=32)i[r+e]=l>>>a&s,a+=n,32===a&&(a=0,o++,31!==e&&(l=t[o]>>>0));else{let h=32-a,u=l>>>a;o++,l=t[o]>>>0,i[r+e]=(u|(l&Td[n-h]>>>0)<<h)&s,a=n-h}}function Gd(t,e,i){let r=new Uint32Array(i),n=0,s=e.get();for(let e=0;e<r.length;e++){let e=t[s++],i=127&e;e<128||(e=t[s++],i|=(127&e)<<7,e<128||(e=t[s++],i|=(127&e)<<14,e<128||(e=t[s++],i|=(127&e)<<21,e<128||(e=t[s++],i|=(15&e)<<28)))),r[n++]=i}return e.set(s),r}function qd(t,e,i){let r=new BigUint64Array(i);for(let i=0;i<r.length;i++)r[i]=Vd(t,e);return r}function Vd(t,e){let i=0n,r=0,n=e.get();for(;n<t.length;){let e=t[n++];if(i|=BigInt(127&e)<<BigInt(r),!(128&e))break;if(r+=7,r>=64)throw Error("Varint too long")}return e.set(n),i}function Zd(t,e){let i,r;return r=t[e.get()],e.increment(),i=127&r,r<128||(r=t[e.get()],e.increment(),i|=(127&r)<<7,r<128)||(r=t[e.get()],e.increment(),i|=(127&r)<<14,r<128)||(r=t[e.get()],e.increment(),i|=(127&r)<<21,r<128)?i:(r=t[e.get()],i|=(15&r)<<28,function(t,e,i){let r,n;if(n=e[i.get()],i.increment(),r=(112&n)>>4,n<128||(n=e[i.get()],i.increment(),r|=(127&n)<<3,n<128)||(n=e[i.get()],i.increment(),r|=(127&n)<<10,n<128)||(n=e[i.get()],i.increment(),r|=(127&n)<<17,n<128)||(n=e[i.get()],i.increment(),r|=(127&n)<<24,n<128)||(n=e[i.get()],i.increment(),r|=(1&n)<<31,n<128))return 4294967296*r+(t>>>0);throw Error("Expected varint not more than 10 bytes")}(i,t,e))}function Wd(t,e,i,r){return function(t,e,i,r,n){let s=r.get();if(3&i)throw Error(`FastPFOR: invalid encodedByteLength=${i} at offset=${s} (encodedBytes.length=${t.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);let o=i>>>2,a=function(t,e){if(e<=t.encodedWords.length)return t.encodedWords;let i=new Uint32Array(Math.max(16,2*e));return t.encodedWords=i,i}(n,o);!function(t,e,i,r){if(e<0||i<0||e+i>t.length)throw RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${e}, byteLength=${i}, bytes.length=${t.length})`);let n=Math.floor(i/4),s=i%4!=0,o=s?n+1:n;if(r.length<o)throw RangeError(`decodeBigEndianInt32sInto: out.length=${r.length} < ${o}`);if(n>0){let i=t.byteOffset+e;if(3&i)for(let i=0;i<n;i++){let n=e+4*i;r[i]=t[n]<<24|t[n+1]<<16|t[n+2]<<8|t[n+3]}else{let e=new Uint32Array(t.buffer,i,n);for(let t=0;t<n;t++)r[t]=0|kd(e[t])}}if(s){let s=e+4*n,o=i-4*n,a=0;for(let e=0;e<o;e++)a|=t[s+e]<<24-8*e;r[n]=0|a}}(t,s,i,a);let l=function(t,e,i){let r=0,n=0,s=new Uint32Array(e),o=i??Rd();if(t.length>0){let e=0|t[r];if(r=r+1|0,255&e)throw Error(`FastPFOR decode: invalid alignedLength=${e} (expected multiple of 256)`);if(n+e>s.length)throw Error(`FastPFOR decode: output buffer too small (outPos=${n}, alignedLength=${e}, out.length=${s.length})`);r=function(t,e,i,r,n,s){let o=r+Pd(n,256),a=r,l=i;for(;a!==o;){let i=Math.min($d,o-a);l=Ud(t,e,l,a,i,s),a=a+i|0}return l}(t,s,r,n,e,o),n=n+e|0}return function(t,e,i,r,n,s){if(0===s)return e;let o=0,a=e,l=e+i,h=n,u=n,c=n+s,f=0,p=0;for(;a<l&&u<c;){let e=t[a]>>>o&255;if(o+=8,a+=o>>>5,o&=31,f|=(127&e)<<p,128&e)r[u++]=0|f,f=0,p=0;else if(p+=7,p>28)throw Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${p}, partial=${f}, decoded=${u-h}/${s}, inPos=${a}, inEnd=${l})`)}if(u!==c)throw Error(`FastPFOR VByte: truncated stream (decoded=${u-h}, expected=${s}, consumedWords=${a-e}/${i}, vbyteStart=${e}, vbyteEnd=${l})`)}(t,r,t.length-r|0,s,n,e-n|0),s}(a.subarray(0,o),e,n.decoderWorkspace);return r.add(i),l}(t,e,i,r,function(t=16){if(t<0)throw RangeError(`initialEncodedWordCapacity must be >= 0, got ${t}`);let e=Math.max(16,0|t);return{encodedWords:new Uint32Array(e),decoderWorkspace:Rd()}}(i>>>2))}function Hd(t){return t>>>1^-(1&t)}function Yd(t){return t>>1n^-(1n&t)}function Xd(t){return t%2==1?(t+1)/-2:t/2}function Jd(t,e,i){if(void 0===i){i=0;for(let r=0;r<e;r++)i+=t[r]}let r=new Uint32Array(i),n=0;for(let i=0;i<e;i++){let s=t[i];r.fill(t[i+e],n,n+s),n+=s}return r}function Kd(t,e,i){if(void 0===i){i=0;for(let r=0;r<e;r++)i+=Number(t[r])}let r=new BigUint64Array(i),n=0;for(let i=0;i<e;i++){let s=Number(t[i]);r.fill(t[i+e],n,n+s),n+=s}return r}function Qd(t,e,i){let r=new Float64Array(i),n=0;for(let i=0;i<e;i++){let s=t[i];r.fill(t[i+e],n,n+s),n+=s}return r}function tm(t){let e=new Int32Array(t.length);e[0]=Hd(t[0]);let i=t.length/4*4,r=1;if(i>=4)for(;r<i-4;r+=4){let i=t[r+1],n=t[r+2],s=t[r+3];e[r]=Hd(t[r])+e[r-1],e[r+1]=Hd(i)+e[r],e[r+2]=Hd(n)+e[r+1],e[r+3]=Hd(s)+e[r+2]}for(;r!==t.length;++r)e[r]=Hd(t[r])+e[r-1];return e}function em(t){let e=new BigInt64Array(t.length);e[0]=Yd(t[0]);let i=t.length/4*4,r=1;if(i>=4)for(;r<i-4;r+=4){let i=t[r+1],n=t[r+2],s=t[r+3];e[r]=Yd(t[r])+e[r-1],e[r+1]=Yd(i)+e[r],e[r+2]=Yd(n)+e[r+1],e[r+3]=Yd(s)+e[r+2]}for(;r!==e.length;++r)e[r]=Yd(t[r])+e[r-1];return e}function im(t){let e=t.length/4*4,i=1;if(e>=4)for(let r=t[0];i<e-4;i+=4)r=t[i]+=r,r=t[i+1]+=r,r=t[i+2]+=r,r=t[i+3]+=r;for(;i!==t.length;)t[i]+=t[i-1],++i}function rm(t){let e=new Uint32Array(t.length);e[0]=Hd(t[0])>>>0;for(let i=1;i<t.length;i++)e[i]=e[i-1]+Hd(t[i])>>>0;return e}function nm(t){let e=new BigUint64Array(t.length);e[0]=BigInt.asUintN(64,Yd(t[0]));for(let i=1;i<t.length;i++)e[i]=BigInt.asUintN(64,e[i-1]+Yd(t[i]));return e}var sm,om,am,lm;!function(t){t.PRESENT="PRESENT",t.DATA="DATA",t.OFFSET="OFFSET",t.LENGTH="LENGTH"}(sm||={}),function(t){t.NONE="NONE",t.SINGLE="SINGLE",t.SHARED="SHARED",t.VERTEX="VERTEX",t.MORTON="MORTON",t.FSST="FSST"}(om||={}),function(t){t.VERTEX="VERTEX",t.INDEX="INDEX",t.STRING="STRING",t.KEY="KEY"}(am||={}),function(t){t.VAR_BINARY="VAR_BINARY",t.GEOMETRIES="GEOMETRIES",t.PARTS="PARTS",t.RINGS="RINGS",t.TRIANGLES="TRIANGLES",t.SYMBOL="SYMBOL",t.DICTIONARY="DICTIONARY"}(lm||={});const hm=[sm.PRESENT,sm.DATA,sm.OFFSET,sm.LENGTH],um=[Fd.NONE,Fd.DELTA,Fd.COMPONENTWISE_DELTA,Fd.RLE,Fd.MORTON],cm=[zd.NONE,zd.FAST_PFOR,zd.VARINT],fm=[om.NONE,om.SINGLE,om.SHARED,om.VERTEX,om.MORTON,om.FSST],pm=[am.VERTEX,am.INDEX,am.STRING,am.KEY],dm=[lm.VAR_BINARY,lm.GEOMETRIES,lm.PARTS,lm.RINGS,lm.TRIANGLES,lm.SYMBOL,lm.DICTIONARY];function mm(t,e){let i=function(t,e){let i=t[e.get()],r=hm[i>>4],n={};switch(r){case sm.DATA:n={dictionaryType:fm[15&i]};break;case sm.OFFSET:n={offsetType:pm[15&i]};break;case sm.LENGTH:n={lengthType:dm[15&i]}}e.increment();let s=t[e.get()],o=um[s>>5],a=um[s>>2&7],l=cm[3&s];e.increment();let h=Gd(t,e,2),u=h[0];return{physicalStreamType:r,logicalStreamType:n,logicalLevelTechnique1:o,logicalLevelTechnique2:a,physicalLevelTechnique:l,numValues:u,byteLength:h[1],decompressedCount:u}}(t,e);return i.logicalLevelTechnique1===Fd.MORTON?function(t,e,i){let r=Gd(e,i,2);return{physicalStreamType:t.physicalStreamType,logicalStreamType:t.logicalStreamType,logicalLevelTechnique1:t.logicalLevelTechnique1,logicalLevelTechnique2:t.logicalLevelTechnique2,physicalLevelTechnique:t.physicalLevelTechnique,numValues:t.numValues,byteLength:t.byteLength,decompressedCount:t.decompressedCount,numBits:r[0],coordinateShift:r[1]}}(i,t,e):Fd.RLE!==i.logicalLevelTechnique1&&Fd.RLE!==i.logicalLevelTechnique2||zd.NONE===i.physicalLevelTechnique?i:function(t,e,i){let r=Gd(e,i,2);return{physicalStreamType:t.physicalStreamType,logicalStreamType:t.logicalStreamType,logicalLevelTechnique1:t.logicalLevelTechnique1,logicalLevelTechnique2:t.logicalLevelTechnique2,physicalLevelTechnique:t.physicalLevelTechnique,numValues:t.numValues,byteLength:t.byteLength,decompressedCount:r[1],runs:r[0],numRleValues:r[1]}}(i,t,e)}var _m;!function(t){t[t.FLAT=0]="FLAT",t[t.CONST=1]="CONST",t[t.SEQUENCE=2]="SEQUENCE",t[t.DICTIONARY=3]="DICTIONARY",t[t.FSST_DICTIONARY=4]="FSST_DICTIONARY"}(_m||={});var gm=class{constructor(t,e){this.values=t,this._size=e}get(t){let e=Math.floor(t/8);return 1==(this.values[e]>>t%8&1)}set(t,e){let i=Math.floor(t/8);this.values[i]=this.values[i]|+!!e<<t%8}getInt(t){let e=Math.floor(t/8);return this.values[e]>>t%8&1}size(){return this._size}getBuffer(){return this.values}};function ym(t,e,i){if(!e)return t;let r=e.size(),n=new(0,t.constructor)(r),s=0;for(let o=0;o<r;o++)n[o]=e.get(o)?t[s++]:i;return n}function vm(t,e,i,r,n){let s=function(t,e,i,r){let n=new Uint8Array(e),s=0,o=r.get()+i;for(;s<e&&!(r.get()>=o);){let i=t[r.increment()];if(i<=127){let o=i+3,a=t[r.increment()],l=Math.min(s+o,e);n.fill(a,s,l),s=l}else{let o=256-i;for(let i=0;i<o&&s<e;i++)n[s++]=t[r.increment()]}}return r.set(o),n}(t,Math.ceil(e/8),i,r);return n?function(t,e,i){if(!i)return t;let r=i.size(),n=new gm(t,e),s=new gm(new Uint8Array(Math.ceil(r/8)),r),o=0;for(let t=0;t<r;t++){let e=!!i.get(t)&&n.get(o++);s.set(t,e)}return s.getBuffer()}(s,e,n):s}function wm(t,e,i,r){let n=e.get(),s=n+i*Float32Array.BYTES_PER_ELEMENT,o=new Uint8Array(t.subarray(n,s)).buffer,a=new Float32Array(o);return e.set(s),r?ym(a,r,0):a}function bm(t,e,i,r){let n=e.get(),s=n+i*Float64Array.BYTES_PER_ELEMENT,o=new Uint8Array(t.subarray(n,s)).buffer,a=new Float64Array(o);return e.set(s),r?ym(a,r,0):a}const xm=new TextDecoder;function Dm(t,e,i){return i-e>=12?xm.decode(t.subarray(e,i)):function(t,e,i){let r="",n=e;for(;n<i;){let e,s,o,a=t[n],l=null,h=a>239?4:a>223?3:a>191?2:1;if(n+h>i)break;1===h?a<128&&(l=a):2===h?(e=t[n+1],128==(192&e)&&(l=(31&a)<<6|63&e,l<=127&&(l=null))):3===h?(e=t[n+1],s=t[n+2],128==(192&e)&&128==(192&s)&&(l=(15&a)<<12|(63&e)<<6|63&s,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===h&&(e=t[n+1],s=t[n+2],o=t[n+3],128==(192&e)&&128==(192&s)&&128==(192&o)&&(l=(15&a)<<18|(63&e)<<12|(63&s)<<6|63&o,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,h=1):l>65535&&(l-=65536,r+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),r+=String.fromCharCode(l),n+=h}return r}(t,e,i)}function Mm(t,e,i,r,n){return function(t,e,i,r){let n;switch(e.logicalLevelTechnique1){case Fd.DELTA:if(e.logicalLevelTechnique2===Fd.RLE){let i=e;if(!r)return function(t,e,i){let r=new Int32Array(i),n=0,s=0;for(let i=0;i<e;i++){let o=t[i],a=Hd(t[i+e]);for(let t=0;t<o;t++)s+=a,r[n++]=s}return r}(t,i.runs,i.numRleValues);n=tm(t=Jd(t,i.runs,i.numRleValues))}else n=tm(t);break;case Fd.RLE:n=function(t,e,i){if(void 0===i){i=0;for(let r=0;r<e;r++)i+=t[r]}let r=new Int32Array(i),n=0;for(let i=0;i<e;i++){let s=t[i],o=t[i+e];o=Hd(o),r.fill(o,n,n+s),n+=s}return r}(t,e.runs,e.numRleValues);break;case Fd.MORTON:im(t),n=new Int32Array(t);break;case Fd.COMPONENTWISE_DELTA:n=function(t){if(t.length<2)return new Int32Array(t);let e=new Int32Array(t.length);e[0]=Hd(t[0]),e[1]=Hd(t[1]);let i=t.length/4*4,r=2;if(i>=4)for(;r<i-4;r+=4){let i=t[r+1],n=t[r+2],s=t[r+3];e[r]=Hd(t[r])+e[r-2],e[r+1]=Hd(i)+e[r-1],e[r+2]=Hd(n)+e[r],e[r+3]=Hd(s)+e[r+1]}for(;r!==t.length;r+=2)e[r]=Hd(t[r])+e[r-2],e[r+1]=Hd(t[r+1])+e[r-1];return e}(t);break;case Fd.NONE:n=function(t){let e=new Int32Array(t.length);for(let i=0;i<t.length;i++)e[i]=Hd(t[i]);return e}(t);break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return r?ym(n,r,0):n}(Fm(t,e,i),i,0,n)}function Em(t,e,i,r,n){return function(t,e,i,r){let n;switch(e.logicalLevelTechnique1){case Fd.DELTA:n=rm(e.logicalLevelTechnique2===Fd.RLE?Jd(t,e.runs,e.numRleValues):t);break;case Fd.RLE:n=Jd(t,e.runs,e.numRleValues);break;case Fd.MORTON:im(t),n=t;break;case Fd.COMPONENTWISE_DELTA:n=function(t){if(t.length<2)return new Uint32Array(t);let e=new Uint32Array(t.length);e[0]=Hd(t[0])>>>0,e[1]=Hd(t[1])>>>0;for(let i=2;i<t.length;i+=2)e[i]=e[i-2]+Hd(t[i])>>>0,e[i+1]=e[i-1]+Hd(t[i+1])>>>0;return e}(t);break;case Fd.NONE:n=t;break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return r?ym(n,r,0):n}(Fm(t,e,i),i,0,n)}function Am(t,e,i){return function(t,e){if(e.logicalLevelTechnique1===Fd.DELTA&&e.logicalLevelTechnique2===Fd.NONE)return function(t){let e=new Int32Array(t.length+1);e[0]=0,e[1]=Hd(t[0]);let i=e[1];for(let r=2;r!==e.length;++r)i+=Hd(t[r-1]),e[r]=e[r-1]+i;return new Uint32Array(e)}(t);if(e.logicalLevelTechnique1===Fd.RLE&&e.logicalLevelTechnique2===Fd.NONE)return function(t,e,i){let r=new Uint32Array(i+1);r[0]=0;let n=1,s=r[0];for(let i=0;i<e;i++){let o=t[i],a=t[i+e];for(let t=n;t<n+o;t++)r[t]=a+s,s=r[t];n+=o}return r}(t,e.runs,e.numRleValues);if(e.logicalLevelTechnique1===Fd.NONE&&e.logicalLevelTechnique2===Fd.NONE){!function(t){let e=0;for(let i=0;i<t.length;i++)t[i]+=e,e=t[i]}(t);let i=new Uint32Array(e.numValues+1);return i[0]=0,i.set(t,1),i}if(e.logicalLevelTechnique1===Fd.DELTA&&e.logicalLevelTechnique2===Fd.RLE){let i=function(t,e,i){let r=new Int32Array(i+1);r[0]=0;let n=1,s=r[0];for(let i=0;i<e;i++){let o=t[i],a=t[i+e];a=Hd(a);for(let t=n;t<n+o;t++)r[t]=a+s,s=r[t];n+=o}return r}(t,e.runs,e.numRleValues);return im(i),new Uint32Array(i)}throw Error("Only delta encoding is supported for transforming length to offset streams yet.")}(Fm(t,e,i),i)}function Fm(t,e,i){let r=i.physicalLevelTechnique;switch(r){case zd.FAST_PFOR:return Wd(t,i.numValues,i.byteLength,e);case zd.VARINT:return Gd(t,e,i.numValues);case zd.NONE:return function(t,e,i){let r=e.get(),n=i*Uint32Array.BYTES_PER_ELEMENT,s=new DataView(t.buffer,t.byteOffset,t.byteLength),o=new Uint32Array(i);for(let t=0;t<i;t++)o[t]=s.getUint32(r+t*Uint32Array.BYTES_PER_ELEMENT,!0);return e.add(n),o}(t,e,i.numValues);default:throw Error(`Specified physicalLevelTechnique ${r} is not supported (yet).`)}}function zm(t,e,i){let r=i.physicalLevelTechnique;switch(r){case zd.VARINT:return qd(t,e,i.numValues);case zd.NONE:return function(t,e,i){let r=e.get(),n=i*BigUint64Array.BYTES_PER_ELEMENT,s=new DataView(t.buffer,t.byteOffset,t.byteLength),o=new BigUint64Array(i);for(let t=0;t<i;t++)o[t]=s.getBigUint64(r+t*BigUint64Array.BYTES_PER_ELEMENT,!0);return e.add(n),o}(t,e,i.numValues);default:throw Error(`Specified physicalLevelTechnique ${r} is not supported (yet).`)}}function Sm(t,e,i){let r=Fm(t,e,i);return 1===r.length?i.logicalLevelTechnique1===Fd.DELTA?Hd(r[0]):r[0]:function(t){return t[1]}(r)}function Cm(t,e,i){return function(t){if(2===t.length){let e=Hd(t[1]);return[e,e]}return[Hd(t[2]),Hd(t[3])]}(Fm(t,e,i))}function Tm(t,e,i){return function(t){if(2===t.length){let e=Yd(t[1]);return[e,e]}return[Yd(t[2]),Yd(t[3])]}(qd(t,e,i.numValues))}function Pm(t,e,i,r){return function(t,e,i){let r;switch(e.logicalLevelTechnique1){case Fd.DELTA:if(e.logicalLevelTechnique2===Fd.RLE){let n=e;if(!i)return function(t,e,i){let r=new BigInt64Array(i),n=0,s=0n;for(let i=0;i<e;i++){let o=Number(t[i]),a=Yd(t[i+e]);for(let t=0;t<o;t++)s+=a,r[n++]=s}return r}(t,n.runs,n.numRleValues);r=em(t=Kd(t,n.runs,n.numRleValues))}else r=em(t);break;case Fd.RLE:r=function(t,e,i){if(void 0===i){i=0;for(let r=0;r<e;r++)i+=Number(t[r])}let r=new BigInt64Array(i),n=0;for(let i=0;i<e;i++){let s=Number(t[i]),o=t[i+e];o=Yd(o),r.fill(o,n,n+s),n+=s}return r}(t,e.runs,e.numRleValues);break;case Fd.NONE:r=function(t){let e=new BigInt64Array(t.length);for(let i=0;i<t.length;i++)e[i]=Yd(t[i]);return e}(t);break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return i?ym(r,i,0n):r}(zm(t,e,i),i,r)}function Im(t,e,i,r){return $m(zm(t,e,i),i,r)}function km(t,e,i){let r=zm(t,e,i);return 1===r.length?i.logicalLevelTechnique1===Fd.DELTA?Yd(r[0]):r[0]:function(t){return t[1]}(r)}function $m(t,e,i){let r;switch(e.logicalLevelTechnique1){case Fd.DELTA:r=nm(e.logicalLevelTechnique2===Fd.RLE?Kd(t,e.runs,e.numRleValues):t);break;case Fd.RLE:r=Kd(t,e.runs,e.numRleValues);break;case Fd.NONE:r=t;break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return i?ym(r,i,0n):r}function jm(t,e,i,r,n="int32"){let s=t.logicalLevelTechnique1;if(s===Fd.RLE)return 1===t.runs?_m.CONST:_m.FLAT;if(s!==Fd.DELTA||t.logicalLevelTechnique2!==Fd.RLE)return 1===t.numValues?_m.CONST:_m.FLAT;let o=e instanceof gm?e.size():e;if(t.numRleValues!==o)return _m.FLAT;if(1===t.runs)return _m.SEQUENCE;if(2!==t.runs)return 1===t.numValues?_m.CONST:_m.FLAT;let a=r.get();if(t.physicalLevelTechnique===zd.VARINT)return function(t,e,i){let r=new Sd(e.get());if("int64"===i){let e=qd(t,r,4);return 2n===e[2]&&2n===e[3]}let n=Gd(t,r,4);return 2===n[2]&&2===n[3]}(i,r,n)?_m.SEQUENCE:1===t.numValues?_m.CONST:_m.FLAT;let l=r.get(),h=new Int32Array(i.buffer,i.byteOffset+l,4);return r.set(a),2===h[2]&&2===h[3]?_m.SEQUENCE:1===t.numValues?_m.CONST:_m.FLAT}var Rm,Om,Bm,Lm=class extends wd{getValueFromBuffer(t){return this.dataBuffer[t]}},Um=class extends Dd{constructor(t,e,i,r,n){super(t,n?BigInt64Array.of(e):BigUint64Array.of(e),i,r)}getValueFromBuffer(t){return this.dataBuffer[0]+BigInt(t)*this.delta}};function Nm(t,e,i){return{x:Gm(t,e)-i,y:Gm(t>>1,e)-i}}function Gm(t,e){let i=0;for(let r=0;r<e;r++)i|=(t&1<<2*r)>>r;return i}function qm(t,e,i,r,n,s,o){return t===Bm.MORTON?function(t,e,i,r,n,s){let o=Array(n?r+1:r);for(let n=0;n<r;n++){let r=Nm(t[e[i+n]],s.numBits,s.coordinateShift);o[n]=new u(r.x,r.y)}return n&&(o[o.length-1]=o[0]),o}(e,i,r,n,s,o):function(t,e,i,r,n){let s=Array(n?r+1:r);for(let n=0;n<2*r;n+=2){let r=2*e[i+n/2];s[n/2]=new u(t[r],t[r+1])}return n&&(s[s.length-1]=s[0]),s}(e,i,r,n,s)}function Vm(t,e,i,r){let n=Array(r?i+1:i);for(let r=0;r<2*i;r+=2)n[r/2]=new u(t[e+r],t[e+r+1]);return r&&(n[n.length-1]=n[0]),n}!function(t){t[t.POINT=0]="POINT",t[t.LINESTRING=1]="LINESTRING",t[t.POLYGON=2]="POLYGON",t[t.MULTIPOINT=3]="MULTIPOINT",t[t.MULTILINESTRING=4]="MULTILINESTRING",t[t.MULTIPOLYGON=5]="MULTIPOLYGON"}(Rm||={}),function(t){t[t.POINT=0]="POINT",t[t.LINESTRING=1]="LINESTRING",t[t.POLYGON=2]="POLYGON"}(Om||={}),function(t){t[t.MORTON=0]="MORTON",t[t.VEC_2=1]="VEC_2",t[t.VEC_3=2]="VEC_3"}(Bm||={});var Zm=class{constructor(t,e,i,r,n){this._vertexBufferType=t,this._topologyVector=e,this._vertexOffsets=i,this._vertexBuffer=r,this._mortonSettings=n}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(t){let e=this.vertexOffsets?2*this.vertexOffsets[t]:2*t;return[this.vertexBuffer[e],this.vertexBuffer[e+1]]}getVertex(t){if(this.vertexOffsets&&this.mortonSettings){let e=Nm(this.vertexBuffer[this.vertexOffsets[t]],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[e.x,e.y]}let e=this.vertexOffsets?2*this.vertexOffsets[t]:2*t;return[this.vertexBuffer[e],this.vertexBuffer[e+1]]}getGeometries(){return function(t){let e=Array(t.numGeometries),i=1,r=1,n=1,s=0,o=0,a=0,l=t.mortonSettings,h=t.topologyVector,c=h.geometryOffsets,f=h.partOffsets,p=h.ringOffsets,d=t.vertexOffsets,m=!d||0===d.length,_=t.containsPolygonGeometry(),g=t.vertexBuffer;for(let h=0;h<t.numGeometries;h++){let y=t.geometryType(h);switch(y){case Rm.POINT:{let h,_;if(m)h=g[o++],_=g[o++];else if(t.vertexBufferType===Bm.MORTON){let t=Nm(g[d[a++]],l.numBits,l.coordinateShift);h=t.x,_=t.y}else{let t=2*d[a++];h=g[t],_=g[t+1]}e[s++]=[[new u(h,_)]],c&&n++,f&&i++,p&&r++}break;case Rm.MULTIPOINT:{let h,f=c[n]-c[n-1];if(n++,m){h=Array(f);for(let t=0;t<f;t++){let e=g[o++],i=g[o++];h[t]=new u(e,i)}}else h=qm(t.vertexBufferType,g,d,a,f,!1,l),a+=f;e[s++]=h.map((t=>[t])),i+=f,r+=f}break;case Rm.LINESTRING:{let h,u;_?(h=p[r]-p[r-1],r++):h=f[i]-f[i-1],i++,m?(u=Vm(g,o,h,!1),o+=2*h):(u=qm(t.vertexBufferType,g,d,a,h,!1,l),a+=h),e[s++]=[u],c&&n++}break;case Rm.POLYGON:{let h=f[i]-f[i-1];i++;let u,_=Array(h-1),y=p[r]-p[r-1];if(r++,m){u=Vm(g,o,y,!0),o+=2*y;for(let t=0;t<_.length;t++)y=p[r]-p[r-1],r++,_[t]=Vm(g,o,y,!0),o+=2*y}else{u=qm(t.vertexBufferType,g,d,a,y,!0,l),a+=y;for(let e=0;e<_.length;e++)y=p[r]-p[r-1],r++,_[e]=qm(t.vertexBufferType,g,d,a,y,!0,l),a+=y}e[s++]=[u].concat(_),c&&n++}break;case Rm.MULTILINESTRING:{let h=c[n]-c[n-1];n++;let u=Array(h);for(let e=0;e<h;e++){let n;if(_?(n=p[r]-p[r-1],r++):n=f[i]-f[i-1],i++,m)u[e]=Vm(g,o,n,!1),o+=2*n;else{let i=qm(t.vertexBufferType,g,d,a,n,!1,l);u[e]=i,a+=n}}e[s++]=u}break;case Rm.MULTIPOLYGON:{let h=c[n]-c[n-1];n++;let u=Array(h);for(let e=0;e<h;e++){let n=f[i]-f[i-1];i++;let s,h=Array(n-1),c=p[r]-p[r-1];r++,m?(s=Vm(g,o,c,!0),o+=2*c):(s=qm(t.vertexBufferType,g,d,a,c,!0,l),a+=c);for(let e=0;e<h.length;e++){let i=p[r]-p[r-1];r++,m?(h[e]=Vm(g,o,i,!0),o+=2*i):(h[e]=qm(t.vertexBufferType,g,d,a,i,!0,l),a+=i)}u[e]=[s].concat(h)}e[s++]=u.flat()}break;default:throw Error(`The specified geometry type (${y}) is currently not supported.`)}}return e}(this)}get mortonSettings(){return this._mortonSettings}},Wm=class extends Zm{constructor(t,e,i,r,n,s,o){super(i,r,n,s,o),this._numGeometries=t,this._geometryType=e}geometryType(t){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===Rm.POLYGON||this._geometryType===Rm.MULTIPOLYGON}containsSingleGeometryType(){return!0}};function Hm(t,e,i,r){return new Ym(Bm.VEC_2,t,e,i,r)}var Ym=class extends Zm{constructor(t,e,i,r,n,s){super(t,i,r,n,s),this._geometryTypes=e}geometryType(t){return this._geometryTypes[t]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let t=0;t<this.numGeometries;t++)if(this.geometryType(t)===Rm.POLYGON||this.geometryType(t)===Rm.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}},Xm=class{constructor(t,e,i,r){this._triangleOffsets=t,this._indexBuffer=e,this._vertexBuffer=i,this._topologyVector=r}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw Error("Cannot convert GpuVector to coordinates without topology information");let t=new Uint32Array(this.numGeometries);for(let e=0;e<this.numGeometries;e++)t[e]=this.geometryType(e);return Hm(t,this._topologyVector,void 0,this._vertexBuffer).getGeometries()}[Symbol.iterator](){return null}};function Jm(t,e,i,r,n,s){return new Km(t,e,i,r,n,s)}var Km=class extends Xm{constructor(t,e,i,r,n,s){super(i,r,n,s),this._numGeometries=t,this._geometryType=e}geometryType(t){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}};function Qm(t,e,i,r,n){return new t_(t,e,i,r,n)}var t_=class extends Xm{constructor(t,e,i,r,n){super(e,i,r,n),this._geometryTypes=t}geometryType(t){return this._geometryTypes[t]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}};function e_(t,e,i,r){let n,s,o,a,l=mm(t,i);if(jm(l,r,t,i)===_m.CONST){let h,u,c,f,p=Sm(t,i,l);for(let r=0;r<e-1;r++){let e=mm(t,i);switch(e.physicalStreamType){case sm.LENGTH:switch(e.logicalStreamType.lengthType){case lm.GEOMETRIES:h=Am(t,i,e);break;case lm.PARTS:u=Am(t,i,e);break;case lm.RINGS:c=Am(t,i,e);break;case lm.TRIANGLES:f=Am(t,i,e)}break;case sm.OFFSET:switch(e.logicalStreamType.offsetType){case am.VERTEX:n=Em(t,i,e);break;case am.INDEX:a=Em(t,i,e)}break;case sm.DATA:om.VERTEX===e.logicalStreamType.dictionaryType?s=Mm(t,i,e):(o={numBits:e.numBits,coordinateShift:e.coordinateShift},s=Em(t,i,e))}}return a?void 0!==h||void 0!==u?Jm(r,p,f,a,s,{geometryOffsets:h,partOffsets:u,ringOffsets:c}):Jm(r,p,f,a,s):void 0===o?function(t,e,i,r,n){return new Wm(t,e,Bm.VEC_2,i,r,n)}(r,p,{geometryOffsets:h,partOffsets:u,ringOffsets:c},n,s):function(t,e,i,r,n,s){return new Wm(t,e,Bm.MORTON,i,r,n,s)}(r,p,{geometryOffsets:h,partOffsets:u,ringOffsets:c},n,s,o)}let h,u,c,f,p,d,m,_=Em(t,i,l);for(let r=0;r<e-1;r++){let e=mm(t,i);switch(e.physicalStreamType){case sm.LENGTH:switch(e.logicalStreamType.lengthType){case lm.GEOMETRIES:h=Em(t,i,e);break;case lm.PARTS:u=Em(t,i,e);break;case lm.RINGS:c=Em(t,i,e);break;case lm.TRIANGLES:f=Am(t,i,e)}break;case sm.OFFSET:switch(e.logicalStreamType.offsetType){case am.VERTEX:n=Em(t,i,e);break;case am.INDEX:a=Em(t,i,e)}break;case sm.DATA:om.VERTEX===e.logicalStreamType.dictionaryType?s=Mm(t,i,e):(o={numBits:e.numBits,coordinateShift:e.coordinateShift},s=Em(t,i,e))}}return h?(p=i_(_,h,2),u&&c?(d=r_(_,p,u,!1),m=function(t,e,i,r){let n=new Uint32Array(i[i.length-1]+1),s=0;n[0]=s;let o=1,a=1,l=0;for(let h=0;h<t.length;h++){let u=t[h],c=e[h+1]-e[h];if(0!==u&&3!==u)for(let t=0;t<c;t++){let t=i[o]-i[o-1];o++;for(let e=0;e<t;e++)s=n[a++]=s+r[l++]}else for(let t=0;t<c;t++)n[a++]=++s,o++}return n}(_,p,d,c)):u&&(d=function(t,e,i){let r=new Uint32Array(e[e.length-1]+1),n=0;r[0]=n;let s=1,o=0;for(let a=0;a<t.length;a++){let l=t[a],h=e[a+1]-e[a];if(4===l||1===l)for(let t=0;t<h;t++)n=r[s++]=n+i[o++];else for(let t=0;t<h;t++)r[s++]=++n}return r}(_,p,u))):u&&c?(d=i_(_,u,1),m=r_(_,d,c,!0)):u&&(d=i_(_,u,0)),a&&!d?Qm(_,f,a,s):a?Qm(_,f,a,s,{geometryOffsets:p,partOffsets:d,ringOffsets:m}):void 0===o?Hm(_,{geometryOffsets:p,partOffsets:d,ringOffsets:m},n,s):function(t,e,i,r,n){return new Ym(Bm.MORTON,t,e,i,r,n)}(_,{geometryOffsets:p,partOffsets:d,ringOffsets:m},n,s,o)}function i_(t,e,i){let r=new Uint32Array(t.length+1),n=0;r[0]=n;let s=0;for(let o=0;o<t.length;o++)n=r[o+1]=n+(t[o]>i?e[s++]:1);return r}function r_(t,e,i,r){let n=new Uint32Array(e[e.length-1]+1),s=0;n[0]=s;let o=1,a=0;for(let l=0;l<t.length;l++){let h=t[l],u=e[l+1]-e[l];if(5===h||2===h||r&&(4===h||1===h))for(let t=0;t<u;t++)s=n[o++]=s+i[a++];else for(let t=0;t<u;t++)n[o++]=++s}return n}var n_=class extends vd{constructor(t,e,i){super(t,e.getBuffer(),i),this.dataVector=e}getValueFromBuffer(t){return this.dataVector.get(t)}},s_=class extends wd{getValueFromBuffer(t){return this.dataBuffer[t]}},o_=class extends vd{constructor(t,e,i,r){super(t,r?BigInt64Array.of(e):BigUint64Array.of(e),i)}getValueFromBuffer(t){return this.dataBuffer[0]}},a_=class extends vd{constructor(t,e,i,r){super(t,i,r),this.offsetBuffer=e}},l_=class extends a_{constructor(t,e,i,r){super(t,e,i,r??e.length-1)}getValueFromBuffer(t){return Dm(this.dataBuffer,this.offsetBuffer[t],this.offsetBuffer[t+1])}},h_=class extends a_{constructor(t,e,i,r,n){super(t,i,r,n??e.length),this.indexBuffer=e,this.indexBuffer=e}getValueFromBuffer(t){let e=this.indexBuffer[t];return Dm(this.dataBuffer,this.offsetBuffer[e],this.offsetBuffer[e+1])}},u_=class extends a_{constructor(t,e,i,r,n,s,o,a){super(t,i,r,o??e.length),this.indexBuffer=e,this.symbolOffsetBuffer=n,this.symbolTableBuffer=s,this.sharedDictionaryCache=a}getValueFromBuffer(t){this.decodedDictionary??(this.decodedDictionary=this.sharedDictionaryCache?.decodedDictionary,this.decodedDictionary??(this.decodedDictionary=this.decodeDictionary(),this.sharedDictionaryCache&&(this.sharedDictionaryCache.decodedDictionary=this.decodedDictionary)));let e=this.indexBuffer[t];return Dm(this.decodedDictionary,this.offsetBuffer[e],this.offsetBuffer[e+1])}decodeDictionary(){return this.symbolLengthBuffer??=this.offsetToLengthBuffer(this.symbolOffsetBuffer),function(t,e,i){let r=new Uint32Array(e.length);for(let t=1;t<e.length;t++)r[t]=r[t-1]+e[t-1];let n=new Uint8Array(function(t,e){let i=0;for(let r=0;r<e.length;r++){let n=e[r];255===n?(i++,r++):i+=t[n]}return i}(e,i)),s=0;for(let o=0;o<i.length;o++){let a=i[o];if(255===a)o++,n[s++]=i[o];else{let i=e[a],o=r[a];for(;i-- >0;)n[s++]=t[o++]}}return n}(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer)}offsetToLengthBuffer(t){let e=new Uint32Array(t.length-1),i=t[0];for(let r=1;r<t.length;r++){let n=t[r];e[r-1]=n-i,i=n}return e}};function c_(t,e,i,r,n){let s,o,a,l,h,u,c,f=n;for(let t=0;t<r;t++){let t=mm(e,i);switch(t.physicalStreamType){case sm.PRESENT:{let r=new gm(vm(e,t.numValues,t.byteLength,i),t.numValues);f=n??r;break}case sm.OFFSET:o=Em(e,i,t,0,f);break;case sm.LENGTH:{let r=Am(e,i,t);lm.DICTIONARY===t.logicalStreamType.lengthType?s=r:lm.SYMBOL===t.logicalStreamType.lengthType?l=r:u=r;break}case sm.DATA:{let r=e.subarray(i.get(),i.get()+t.byteLength);i.add(t.byteLength);let n=t.logicalStreamType.dictionaryType;om.FSST===n?h=r:om.SINGLE===n||om.SHARED===n?a=r:om.NONE===n&&(c=r);break}}}return function(t,e,i,r,n,s,o){if(e){if(!(i&&r&&n&&s))throw Error(`Incomplete FSST dictionary string column "${t}"`);return new u_(t,i,r,n,s,e,o)}}(t,h,o,s,a,l,f)??function(t,e,i,r,n){if(e){if(!i||!r)throw Error(`Incomplete dictionary string column "${t}"`);return n?new h_(t,i,r,e,n):new h_(t,i,r,e)}}(t,a,o,s,f)??function(t,e,i,r,n){if(e&&i){if(r)return n?new h_(t,r,e,i,n):new h_(t,r,e,i);if(n&&n.size()!==e.length-1){let r=new Uint32Array(n.size()),s=0;for(let t=0;t<n.size();t++)r[t]=n.get(t)?s++:0;return new h_(t,r,e,i,n)}return n?new l_(t,e,i,n):new l_(t,e,i)}}(t,u,c,o,f)}var f_,p_,d_=class extends vd{constructor(t,e,i){super(t,new Uint8Array,i??e.length),this.values=e}getValueFromBuffer(t){return this.values[t]}};function m_(t,e,i,r,n){let s,{lengthStream:o,flattenedValues:a,presentStream:l,dictionary:h}=t,u=e*i,c=i;if(l){s=new gm(new Uint8Array(Math.ceil(i/8)),i),c=0;for(let t=0;t<i;t++)l.get(u+t)&&(s.set(t,!0),c++)}let f=r+c;if(f>o.length)throw Error("Merged map counts underflow while decoding child streams");let p=Array(i),d=r,m=n;for(let t=0;t<i;t++){if(l&&!l.get(u+t)){p[t]=null;continue}let e=m+o[d++];if(e>a.length)throw Error("Map value stream underflow while decoding feature payload");let i=__(a,m,e,h);p[t]=i.value,m=i.nextIndex}let _=0;for(let t=r;t<f;t++)_+=o[t];let g=n+_;if(m!==g)throw Error("Unused flattened map values remain after decode");return{value:p,nullabilityBuffer:s,countsEnd:f,valuesEnd:g}}function __(t,e,i,r){return i-e==1||t[e]===p_.START_LIST?y_(t,e,i,r):g_(t,e,i,r)}function g_(t,e,i,r){let n=Object.create(null),s=e;for(;s<i;){let e=w_(t[s++],r);if("string"!=typeof e)throw Error(`Map key dictionary index does not resolve to a string: ${e}`);let o=y_(t,s,i,r);n[e]=o.value,s=o.nextIndex}return{value:n,nextIndex:s}}function y_(t,e,i,r){if(e>=i)throw Error("Unexpected end of map value stream");let n=t[e];if(n===p_.FALSE)return{value:!1,nextIndex:e+1};if(n===p_.TRUE)return{value:!0,nextIndex:e+1};if(n===p_.START_MAP){let n=v_(t,e,i);return{value:g_(t,e+2,n,r).value,nextIndex:n}}if(n===p_.START_LIST){let n=v_(t,e,i),s=[],o=e+2;for(;o<n;){let e=y_(t,o,n,r);s.push(e.value),o=e.nextIndex}return{value:s,nextIndex:n}}return{value:w_(n,r),nextIndex:e+1}}function v_(t,e,i){if(e+1>=i)throw Error("Missing length for nested map/list payload");let r=t[e+1];if(r<2)throw Error(`Invalid nested payload length: ${r}`);let n=e+r;if(n>i)throw Error("Nested payload exceeds containing payload bounds");return n}function w_(t,e){let i=t-p_.COUNT;if(i<0||i>=e.length)throw Error(`Scalar dictionary index out of range: ${t}`);return e[i]}function b_(t,e){for(let i of e)t.push(i)}function x_(t,e,i,r,n){return"scalarType"===i.type?function(t,e,i,r,n,s){let o;if(0===t)return null;if(s.nullable){let t=mm(e,i),r=t.numValues,n=i.get(),s=vm(e,r,t.byteLength,i);i.set(n+t.byteLength),o=new gm(s,t.numValues)}let a=o??r;switch(n.physicalType){case 4:case 3:return function(t,e,i,r,n){let s=mm(t,e),o=jm(s,n,t,e),a=3===r.physicalType;if(o===_m.FLAT){let r=D_(n)?n:void 0,o=a?Mm(t,e,s,0,r):Em(t,e,s,0,r);return new bd(i.name,o,n)}if(o===_m.SEQUENCE){let r=Cm(t,e,s);return new Md(i.name,r[0],r[1],s.numRleValues,a)}let l=a?function(t,e,i){let r=Fm(t,e,i);return 1===r.length?Hd(r[0]):function(t){return Hd(t[1])}(r)}(t,e,s):Sm(t,e,s);return new Ed(i.name,l,n,a)}(e,i,s,n,a);case 9:return c_(s.name,e,i,s.nullable?t-1:t,o)??null;case 0:return function(t,e,i,r,n){let s=mm(t,e),o=s.numValues,a=e.get(),l=D_(n)?n:void 0,h=vm(t,o,s.byteLength,e,l);e.set(a+s.byteLength);let u=new gm(h,o);return new n_(i.name,u,n)}(e,i,s,0,a);case 6:case 5:return function(t,e,i,r,n){let s=mm(t,e),o=jm(s,r,t,e,"int64"),a=5===n.physicalType;if(o===_m.FLAT){let n=D_(r)?r:void 0,o=a?Pm(t,e,s,n):Im(t,e,s,n);return new Lm(i.name,o,r)}if(o===_m.SEQUENCE){let r=Tm(t,e,s);return new Um(i.name,r[0],r[1],s.numRleValues,a)}let l=a?function(t,e,i){let r=zm(t,e,i);return 1===r.length?Yd(r[0]):function(t){return Yd(t[1])}(r)}(t,e,s):km(t,e,s);return new o_(i.name,l,r,a)}(e,i,s,a,n);case 7:return function(t,e,i,r){let n=mm(t,e),s=D_(r)?r:void 0,o=wm(t,e,n.numValues,s);return new s_(i.name,o,r)}(e,i,s,a);case 8:return function(t,e,i,r){let n=mm(t,e),s=D_(r)?r:void 0,o=bm(t,e,n.numValues,s);return new xd(i.name,o,r)}(e,i,s,a);default:throw Error(`The specified data type for the field is currently not supported: ${n}`)}}(r,t,e,n,i.scalarType,i):2===i.complexType?.physicalType?function(t,e,i,r){let n=function(t){let e="complexType"===t.type?t.complexType.children:void 0;return e&&0!==e.length?e.map((e=>t.name+(e.name??""))):[t.name]}(i);if(0===r)return n.map((t=>new d_(t,[])));let s=function(t,e,i){let r=t[e.get()];e.add(1);let n=Em(t,e,mm(t,e)),s=i-1,o=[];r&f_.STRING&&(s-=function(t,e,i){let r=t[e.get()];e.add(1);let n=c_("",t,e,r);if(n)for(let t=0;t<n.size;t++)i.push(n.getValue(t));return r}(t,e,o)),s-=function(t,e,i,r){let n=0;return i&f_.INT32?(b_(r,Mm(t,e,mm(t,e))),n++):i&f_.INT64&&(b_(r,Pm(t,e,mm(t,e))),n++),i&f_.UINT32?(b_(r,Em(t,e,mm(t,e))),n++):i&f_.UINT64&&(b_(r,Im(t,e,mm(t,e))),n++),n}(t,e,r,o),s-=function(t,e,i,r){let n=0;return i&f_.FLOAT&&(b_(r,wm(t,e,mm(t,e).numValues)),n++),i&f_.DOUBLE&&(b_(r,bm(t,e,mm(t,e).numValues)),n++),n}(t,e,r,o);let a,l=0;if(r&f_.PRESENCE){let i=function(t,e){let i=mm(t,e);if(i.physicalStreamType!==sm.PRESENT)throw Error(`Expected PRESENT stream for map column but found: ${i.physicalStreamType}`);let r=i.numValues,n=e.get(),s=new gm(vm(t,r,i.byteLength,e),r);return e.set(n+i.byteLength),{value:s,count:r}}(t,e);a=i.value,l=i.count,s--}let h=new Uint32Array;if(s>0&&(h=Em(t,e,mm(t,e)),s--),0!==s)throw Error(`Unexpected number of remaining streams while decoding map column: ${s}`);return{lengthStream:n,dictionary:o,presentStream:a,presentCount:l,flattenedValues:h}}(t,e,r),o=(s.presentStream?s.presentCount:s.lengthStream.length)/n.length,a=[],l=0,h=0;for(let t=0;t<n.length;t++){let e=m_(s,t,o,l,h);a.push(new d_(n[t],e.value,e.nullabilityBuffer)),l=e.countsEnd,h=e.valuesEnd}return a}(t,e,i,r):0===r?null:function(t,e,i){let r,n,s,o,a=!1;for(;!a;){let i=mm(t,e);switch(i.physicalStreamType){case sm.LENGTH:lm.DICTIONARY===i.logicalStreamType.lengthType?r=Am(t,e,i):s=Am(t,e,i);break;case sm.DATA:om.SINGLE===i.logicalStreamType.dictionaryType||om.SHARED===i.logicalStreamType.dictionaryType?(n=t.subarray(e.get(),e.get()+i.byteLength),a=!0):o=t.subarray(e.get(),e.get()+i.byteLength),e.add(i.byteLength)}}if("complexType"!==i.type)throw Error(`Shared dictionary column ${i.name} must be a complex (struct) column.`);if(!r||!n)throw Error(`Incomplete shared dictionary for column "${i.name}"`);let l=i.complexType.children,h=[],u=o?{}:void 0,c=0;for(let a of l){let l=Gd(t,e,1)[0];if(0===l)continue;let f,p=a.name?`${i.name}${a.name}`:i.name;if("scalarField"!==a.type||9!==a.scalarField.physicalType)throw Error("Currently only scalar string fields are implemented for a struct.");if(l>1&&!a.nullable||1===l&&a.nullable)throw Error(`The number of streams for the child field ${a.name} does not match its nullability. nullibilty: ${a.nullable}, numStreams: ${l}`);if(a.nullable){let i=mm(t,e);f=new gm(vm(t,i.numValues,i.byteLength,e),i.numValues)}let d=Em(t,e,mm(t,e),0,f);if(o){if(!s)throw Error(`Incomplete shared FSST dictionary for column "${p}"`);h[c++]=new u_(p,d,r,n,s,o,f,u)}else h[c++]=new h_(p,d,r,n,f)}return h}(t,e,i)}function D_(t){return t instanceof gm}!function(t){t[t.STRING=1]="STRING",t[t.INT32=2]="INT32",t[t.UINT32=4]="UINT32",t[t.INT64=8]="INT64",t[t.UINT64=16]="UINT64",t[t.FLOAT=32]="FLOAT",t[t.DOUBLE=64]="DOUBLE",t[t.PRESENCE=128]="PRESENCE"}(f_||={}),function(t){t[t.FALSE=0]="FALSE",t[t.TRUE=1]="TRUE",t[t.START_MAP=2]="START_MAP",t[t.START_LIST=3]="START_LIST",t[t.COUNT=4]="COUNT"}(p_||={});function M_(t){switch(t){case 0:case 1:case 2:case 3:return{nullable:!!(1&t),columnScope:0,type:"scalarType",scalarType:{longID:!!(2&t),type:"logicalType",logicalType:0}};case 4:return{nullable:!1,columnScope:0,type:"complexType",complexType:{type:"physicalType",physicalType:0,children:[]}};case 30:return{nullable:!1,columnScope:0,type:"complexType",complexType:{type:"physicalType",physicalType:1,children:[]}};case 31:return{nullable:!0,columnScope:0,type:"complexType",complexType:{type:"physicalType",physicalType:2,children:[]}};default:return function(t){let e;switch(t){case 10:case 11:e=0;break;case 12:case 13:e=1;break;case 14:case 15:e=2;break;case 16:case 17:e=3;break;case 18:case 19:e=4;break;case 20:case 21:e=5;break;case 22:case 23:e=6;break;case 24:case 25:e=7;break;case 26:case 27:e=8;break;case 28:case 29:e=9;break;default:return null}return{nullable:!!(1&t),columnScope:0,type:"scalarType",scalarType:{longID:!1,type:"physicalType",physicalType:e}}}(t)}}function E_(t){return 30===t||31===t}function A_(t){if("scalarType"===t.type){let e=t.scalarType;if("physicalType"===e.type)switch(e.physicalType){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:default:return!1;case 9:return!0}if("logicalType"===e.type)return!1}else if("complexType"===t.type){let e=t.complexType;if("physicalType"===e.type)switch(e.physicalType){case 0:case 1:case 2:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",t),!1}function F_(t){return"scalarType"===t.type&&"logicalType"===t.scalarType?.type&&0===t.scalarType.logicalType}function z_(t){return"complexType"===t.type&&"physicalType"===t.complexType?.type&&0===t.complexType.physicalType}const S_=new TextDecoder,C_="0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT), 31(MAP)";function T_(t,e){let i=Gd(t,e,1)[0];if(0===i)return"";let r=e.get(),n=t.subarray(r,r+i);return e.add(i),S_.decode(n)}function P_(t,e){let i=Gd(t,e,1)[0]>>>0,r=i>=10?M_(i):null;if(!r)throw Error(`Unsupported field type code ${i}. Supported: 10-29(scalars), 30(STRUCT), 31(MAP)`);let n={...r,name:T_(t,e)};if("complexType"===n.type&&E_(i)){let i=n.complexType,r=Gd(t,e,1)[0]>>>0;i.children=Array(r);for(let n=0;n<r;n++)i.children[n]=P_(t,e)}return function(t){let e=t.name,i=t.nullable;return"scalarType"===t.type?{type:"scalarField",scalarField:t.scalarType,name:e,nullable:i}:{type:"complexField",complexField:t.complexType,name:e,nullable:i}}(n)}function I_(t,e){let i,r=Gd(t,e,1)[0]>>>0,n=M_(r);if(!n)throw Error(`Unsupported column type code ${r}. Supported: ${C_}`);if(function(t){return t>=10}(r))i=T_(t,e);else if(r<4)i="id";else{if(4!==r)throw Error(`Unsupported column type code ${r}. Supported: ${C_}`);i="geometry"}let s={...n,name:i};if("complexType"===s.type&&E_(r)){let i=Gd(t,e,1)[0]>>>0,r=s.complexType;r.children=Array(i);for(let n=0;n<i;n++)r.children[n]=P_(t,e)}return s}function k_(t,e){let i={featureTables:[]},r={};if(r.name=T_(t,e),0===r.name.length)throw Error("Missing layer name");let n=Gd(t,e,1)[0]>>>0,s=Gd(t,e,1)[0]>>>0;r.columns=Array(s);for(let i=0;i<s;i++)r.columns[i]=I_(t,e);return i.featureTables.push(r),[i,n]}function $_(t,e,i,r,n,s,o=!1){let a=e.scalarType?.longID?6:4,l="number"==typeof s?void 0:s,h=jm(n,s,t,i,6===a?"int64":"int32");if(4===a)switch(h){case _m.FLAT:return new bd(r,Em(t,i,n,0,l),s);case _m.SEQUENCE:{let e=Cm(t,i,n);return new Md(r,e[0],e[1],n.numRleValues,!1)}case _m.CONST:return new Ed(r,Sm(t,i,n),s,!1)}switch(h){case _m.FLAT:return o?new xd(r,function(t,e,i,r){let n=function(t,e,i){if(i.physicalLevelTechnique===zd.VARINT)return function(t,e){switch(e.logicalLevelTechnique1){case Fd.DELTA:return e.logicalLevelTechnique2===Fd.RLE&&(t=Qd(t,e.runs,e.numRleValues)),function(t){t[0]=Xd(t[0]);let e=t.length/4*4,i=1;if(e>=4)for(;i<e-4;i+=4){let e=t[i+1],r=t[i+2],n=t[i+3];t[i]=Xd(t[i])+t[i-1],t[i+1]=Xd(e)+t[i],t[i+2]=Xd(r)+t[i+1],t[i+3]=Xd(n)+t[i+2]}for(;i!==t.length;++i)t[i]=Xd(t[i])+t[i-1]}(t),t;case Fd.RLE:return function(t,e){return Qd(t,e.runs,e.numRleValues)}(t,e);case Fd.NONE:return t;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}}(function(t,e,i){let r=new Float64Array(i);for(let n=0;n<i;n++)r[n]=Zd(t,e);return r}(t,e,i.numValues),i);let r=$m(zm(t,e,i),i);return Float64Array.from(r,Number)}(t,e,i);return r?ym(n,r,0):n}(t,i,n,l),s):new Lm(r,Im(t,i,n,l),s);case _m.SEQUENCE:{let e=Tm(t,i,n);return new Um(r,e[0],e[1],n.numRleValues,!1)}case _m.CONST:return new o_(r,km(t,i,n),s,!1)}throw Error("Vector type not supported for id column.")}var j_=class{constructor(t,e){switch(this._featureData=t,this.properties=this._featureData.properties||{},this._featureData.geometry?.type){case Rm.POINT:case Rm.MULTIPOINT:this.type=1;break;case Rm.LINESTRING:case Rm.MULTILINESTRING:this.type=2;break;case Rm.POLYGON:case Rm.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=e,this.id=Number(this._featureData.id)}loadGeometry(){let t=[];for(let e of this._featureData.geometry.coordinates){let i=[];for(let t of e)i.push(new u(t.x,t.y));t.push(i)}return t}},R_=class{constructor(t){this.features=[],this.featureTable=t,this.name=t.name,this.extent=t.extent,this.version=2,this.features=t.getFeatures(),this.length=this.features.length}feature(t){return new j_(this.features[t],this.extent)}},O_=class{constructor(t){this.layers={};let e=function(t,e,i=!0){let r=new Sd(0),n=[];for(;r.get()<t.length;){let e=Gd(t,r,1)[0]>>>0,s=r.get()+e;if(s>t.length)throw Error(`Block overruns tile: ${s} > ${t.length}`);let o=Gd(t,r,1)[0]>>>0;if(1!==o&&2!==o){r.set(s);continue}let[a,l]=k_(t,r),h=a.featureTables[0],u=null,c=null,f=[],p=0;for(let e of h.columns){let n=e.name;if(F_(e)){let s=null;if(e.nullable){let e=mm(t,r),i=r.get(),n=vm(t,e.numValues,e.byteLength,r);r.set(i+e.byteLength),s=new gm(n,e.numValues)}let o=mm(t,r);p=s?s.size():o.decompressedCount,u=$_(t,e,r,n,o,s??p,i)}else if(z_(e)){let e=Gd(t,r,1)[0];if(0===p){let e=r.get();p=mm(t,r).decompressedCount,r.set(e)}c=e_(t,e,r,p)}else{let i=A_(e)?Gd(t,r,1)[0]:1;if(0===i)continue;let n=x_(t,r,e,i,p);if(n)if(Array.isArray(n))for(let t of n)f.push(t);else f.push(n)}}let d=new Ad(h.name,c,u,f,l);n.push(d),r.set(s)}return n}(new Uint8Array(t));this.layers=e.reduce(((t,e)=>({...t,[e.name]:new R_(e)})),{})}};function B_(t,e,i,r,n){return Pt(t,((t,s)=>{let o=e instanceof _o?e.get(s):null;return function(t){return"object"==typeof t&&!!t&&"evaluate"in t}(o)?o.evaluate(i,r,void 0,n):o}))}function L_(t,e){return e-t}to("FeatureIndex",class{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Ks(it,16,0),this.grid3D=new Ks(it,16,0),this.featureIndexArray=new ya,this.promoteId=e}insert(t,e,i,r,n,s){let o=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,r,n);let a=s?this.grid3D:this.grid;for(let t of e){let e=[1/0,1/0,-1/0,-1/0];for(let i of t)e[0]=Math.min(e[0],i.x),e[1]=Math.min(e[1],i.y),e[2]=Math.max(e[2],i.x),e[3]=Math.max(e[3],i.y);e[0]<8192&&e[1]<8192&&e[2]>=0&&e[3]>=0&&a.insert(o,e[0],e[1],e[2],e[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers="mlt"===this.encoding?new O_(this.rawTileData).layers:new ju(new If(this.rawTileData)).layers,this.sourceLayerCoder=new gd(this.vtLayers?Object.keys(this.vtLayers).sort():[_d])),this.vtLayers}query(t,e,i,r){this.loadVTLayers();let n=t.params,s=it/t.tileSize/t.scale,o=Qn(n.filter,"queryRenderedFeatures filter",n.globalState),a=t.queryGeometry,l=t.queryPadding*s,h=Fu.fromPoints(a),u=this.grid.query(h.minX-l,h.minY-l,h.maxX+l,h.maxY+l),c=Fu.fromPoints(t.cameraQueryGeometry).expandBy(l),f=this.grid3D.query(c.minX,c.minY,c.maxX,c.maxY,((e,i,r,n)=>jl(t.cameraQueryGeometry,e-l,i-l,r+l,n+l)));for(let t of f)u.push(t);u.sort(L_);let p,d={};for(let l of u){if(l===p)continue;p=l;let h=this.featureIndexArray.get(l),u=null;this.loadMatchingFeature(d,h.bucketIndex,h.sourceLayerIndex,h.featureIndex,o,n.layers,n.availableImages,e,i,r,((e,i,r)=>(u||=bl(e),i.queryIntersectsFeature({queryGeometry:a,feature:e,featureState:r,geometry:u,zoom:this.z,transform:t.transform,pixelsToTileUnits:s,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation}))))}return d}loadMatchingFeature(t,e,i,r,n,s,o,a,l,h,u){let c=this.bucketLayerIDs[e];if(s&&!c.some((t=>s.has(t))))return;let f=this.sourceLayerCoder.decode(i),p=this.vtLayers[f].feature(r);if(n.needGeometry){let t=xl(p,!0);if(!n.filter(new ao(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!n.filter(new ao(this.tileID.overscaledZ),p))return;let d=this.getId(p,f);for(let e of c){if(s&&!s.has(e))continue;let i=a[e];if(!i)continue;let n={};d&&h&&(n=h.getState(i.sourceLayer||"_geojsonTileLayer",d));let c=Et({},l[e]);c.paint=B_(c.paint,i.paint,p,n,o),c.layout=B_(c.layout,i.layout,p,n,o);let f=!u||u(p,i,n);if(!f)continue;let m=new yd(p,this.z,this.x,this.y,d);m.layer=c;let _=t[e];void 0===_&&(_=t[e]=[]),_.push({featureIndex:r,feature:m,intersectionZ:f})}}lookupSymbolFeatures(t,e,i,r,n,s,o,a){let l={};this.loadVTLayers();let h=Qn(n.filterSpec,"queryRenderedFeatures symbol filter",n.globalState);for(let n of t)this.loadMatchingFeature(l,i,r,n,h,s,o,a,e);return l}hasLayer(t){for(let e of this.bucketLayerIDs)for(let i of e)if(t===i)return!0;return!1}getId(t,e){let i=t.id;return this.promoteId&&(i=t.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[e]],"boolean"==typeof i&&(i=Number(i)),void 0===i&&t.properties?.cluster&&this.promoteId&&(i=Number(t.properties.cluster_id))),i}},{omit:["rawTileData","sourceLayerCoder"]});var U_=class{constructor(t,e){this.max=t,this.onRemove=e,this.reset()}reset(){for(let t in this.data)for(let e of this.data[t])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(t,e,i){let r=t.wrapped().key;void 0===this.data[r]&&(this.data[r]=[]);let n={value:e,timeout:void 0};if(void 0!==i&&(n.timeout=setTimeout((()=>{this.remove(t,n)}),i)),this.data[r].push(n),this.order.push(r),this.order.length>this.max){let t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){let 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}getByKey(t){let e=this.data[t];return e?e[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,e){if(!this.has(t))return this;let i=t.wrapped().key,r=void 0===e?0:this.data[i].indexOf(e),n=this.data[i][r];return this.data[i].splice(r,1),n.timeout&&clearTimeout(n.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(n.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){let t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(t){let e=[];for(let i in this.data)for(let r of this.data[i])t(r.value)||e.push(r);for(let t of e)this.remove(t.value.tileID,t)}};
|
|
6
|
-
/**
|
|
7
|
-
* MapLibre GL JS
|
|
8
|
-
* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.10.0/LICENSE.txt
|
|
9
|
-
*/function N_(){var t=new m(4);return m!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}let G_,q_,V_;const Z_={frame(t,e,i,r){let n=r||window,s=n.requestAnimationFrame((t=>{o(),e(t)})),{unsubscribe:o}=Gt(t.signal,"abort",(()=>{o(),n.cancelAnimationFrame(s),i(new ie(t.signal.reason))}),!1)},frameAsync(t,e){return new Promise(((i,r)=>{this.frame(t,i,r,e)}))},getImageData(t,e=0){return this.getImageCanvasContext(t).getImageData(-e,-e,t.width+2*e,t.height+2*e)},getImageCanvasContext(t){let e;if(p()&&!d())e=new OffscreenCanvas(t.width,t.height).getContext("2d",{willReadFrequently:!0});else{let i=window.document.createElement("canvas");i.width=t.width,i.height=t.height,e=i.getContext("2d",{willReadFrequently:!0})}if(!e)throw Error("failed to create canvas 2d context");return e.drawImage(t,0,0,t.width,t.height),e},resolveURL:t=>(G_||=document.createElement("a"),G_.href=t,G_.href),get hardwareConcurrency(){return typeof navigator<"u"&&navigator.hardwareConcurrency||4},get prefersReducedMotion(){return void 0===V_?!!matchMedia&&(q_??=matchMedia("(prefers-reduced-motion: reduce)"),q_.matches):V_},set prefersReducedMotion(t){V_=t}},W_=new class{constructor(){this._frozenAt=null}getCurrentTime(){return null===this._frozenAt?performance.now():this._frozenAt}setNow(t){this._frozenAt=t}restoreNow(){this._frozenAt=null}isFrozen(){return null!==this._frozenAt}};function H_(){return W_.getCurrentTime()}var Y_=class t{static{this.docStyle=typeof window<"u"&&window.document?.documentElement.style}static{this.selectProp=!t.docStyle||"userSelect"in t.docStyle?"userSelect":"webkitUserSelect"}static create(t,e,i){let r=window.document.createElement(t);return void 0!==e&&(r.className=e),i&&i.appendChild(r),r}static createNS(t,e){return window.document.createElementNS(t,e)}static disableDrag(){t.docStyle&&t.selectProp&&(t.userSelect=t.docStyle[t.selectProp],t.docStyle[t.selectProp]="none")}static enableDrag(){t.docStyle&&t.selectProp&&(t.docStyle[t.selectProp]=t.userSelect)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",t.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",t.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener("click",t.suppressClickInternal,!0)}),0)}static getScale(t){let e=t.getBoundingClientRect();return{x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}static getPoint(t,e,i){let r=e.boundingClientRect;return new u((i.clientX-r.left)/e.x-t.clientLeft,(i.clientY-r.top)/e.y-t.clientTop)}static mousePos(e,i){let r=t.getScale(e);return t.getPoint(e,r,i)}static touchPos(e,i){let r=[],n=t.getScale(e);for(let s of i)r.push(t.getPoint(e,n,s));return r}static sanitize(e){let i=(new DOMParser).parseFromString(e,"text/html").body||document.createElement("body"),r=i.querySelectorAll("script, iframe");for(let t of r)t.remove();return t.clean(i),i.innerHTML}static isPossiblyDangerous(t,e){let i=e.replace(/\s+/g,"").toLowerCase();if(["src","href","xlink:href"].includes(t)&&(i.includes("javascript:")||i.includes("data:"))||"srcdoc"===t||t.startsWith("on"))return!0}static clean(e){let i=e.children;for(let e of i)t.removeAttributes(e),t.clean(e)}static removeAttributes(e){for(let{name:i,value:r}of Array.from(e.attributes))t.isPossiblyDangerous(i,r)&&e.removeAttribute(i)}};let X_;(function(t){let e,i,r,n;t.resetRequestQueue=()=>{e=[],i=0,r=0,n={}},t.addThrottleControl=t=>{let e=r++;return n[e]=t,e},t.removeThrottleControl=t=>{delete n[t],a()},t.transformAndGetImage=async function(t,e,i,r,n=!0,s){let o=await t.transformRequest(e,i);return ne(r.signal),X_.getImage(o,r,n,s)},t.getImage=(t,i,r=!0,n)=>new Promise(((s,o)=>{t.headers||={},t.headers.accept="image/webp,*/*",Et(t,{type:"image"});let l={abortController:i,requestParameters:t,supportImageRefresh:r,imageBitmapOptions:n,state:"queued",onError:t=>{o(t)},onSuccess:t=>{s(t)}};e.push(l),a()}));let s=(t,e)=>"function"==typeof createImageBitmap?(async(t,e)=>{let i=new Blob([new Uint8Array(t)],{type:"image/png"});try{return createImageBitmap(i,e)}catch(t){throw Error(`Could not load image because of ${nt(t).message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})(t,e):(t=>new Promise(((e,i)=>{let r=new Image;r.onload=()=>{e(r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame((()=>r.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII="))},r.onerror=()=>i(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."));let n=new Blob([new Uint8Array(t)],{type:"image/png"});r.src=URL.createObjectURL(n)})))(t),o=async t=>{t.state="running";let{requestParameters:e,supportImageRefresh:r,imageBitmapOptions:n,onError:o,onSuccess:h,abortController:u}=t,c=!1===r&&!n&&!Lt(self)&&!oe(e.url)&&(!e.headers||Object.keys(e.headers).reduce(((t,e)=>t&&"accept"===e),!0));i++;let f=c?l(e,u):ue(e,u);try{let e=await f;delete t.abortController,t.state="completed",e.data instanceof HTMLImageElement||Nt(e.data)?h(e):h(e.data&&0!==e.data.byteLength?{data:await s(e.data,n),cacheControl:e.cacheControl,expires:e.expires}:{data:null,cacheControl:e.cacheControl,expires:e.expires})}catch(e){delete t.abortController,o(nt(e))}finally{i--,a()}},a=()=>{let t=(()=>{for(let t of Object.keys(n))if(n[t]())return!0;return!1})()?se.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:se.MAX_PARALLEL_IMAGE_REQUESTS;for(let r=i;r<t&&e.length>0;r++){let t=e.shift();t.abortController.signal.aborted?r--:o(t)}},l=(t,e)=>new Promise(((i,r)=>{let n=new Image,s=t.url,o=t.credentials;o&&"include"===o?n.crossOrigin="use-credentials":(o&&"same-origin"===o||!pe(s))&&(n.crossOrigin="anonymous"),e.signal.addEventListener("abort",(()=>{n.src="",r(new ie(e.signal.reason))})),n.fetchPriority="high",n.onload=()=>{n.onerror=n.onload=null,i({data:n})},n.onerror=()=>{n.onerror=n.onload=null,!e.signal.aborted&&r(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.src=s}))})(X_||={}),X_.resetRequestQueue();var J_=class{constructor(t){this._transformRequestFn=t??null}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}},K_=class extends _e{},Q_=class extends K_{},tg=class extends K_{constructor(t={}){super("style.load",t)}},eg=class extends K_{constructor(t,e={}){super(t,e),this.dataType="style"}},ig=class extends K_{constructor(t,e={}){super(t,e),this.dataType="source"}},rg=class extends K_{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,e,i,r={}){i=i instanceof MouseEvent?i:new MouseEvent(t,i);let n=Y_.mousePos(e.getCanvas(),i);super(t,Et({point:n,lngLat:e.unproject(n),originalEvent:i},r)),this._defaultPrevented=!1,this.target=e}},ng=class extends K_{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,e,i){let r="touchend"===t?i.changedTouches:i.touches,n=Y_.touchPos(e.getCanvasContainer(),r),s=n.map((t=>e.unproject(t))),o=n.reduce(((t,e,i,r)=>t.add(e.div(r.length))),new u(0,0));super(t,{points:n,point:o,lngLats:s,lngLat:e.unproject(o),originalEvent:i}),this._defaultPrevented=!1}},sg=class extends K_{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,e){super("wheel",{originalEvent:e}),this._defaultPrevented=!1}},og=class extends K_{},ag=class extends K_{constructor(t={}){super("terrain",t)}},lg=class extends K_{constructor(t={}){super("projectiontransition",t)}},hg=class extends K_{},ug=class extends K_{constructor(t={}){super("styleimagemissing",t)}};function cg(t,e){let i={};for(let e in t)"ref"!==e&&(i[e]=t[e]);return be.forEach((t=>{t in e&&(i[t]=e[t])})),i}function fg(t){t=t.slice();let e=Object.create(null);for(let i=0;i<t.length;i++)e[t[i].id]=t[i];for(let i=0;i<t.length;i++)"ref"in t[i]&&(t[i]=cg(t[i],e[t[i].ref]));return t}function pg(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!pg(t[i],e[i]))return!1;return!0}if("object"==typeof t&&t&&null!==e){if("object"!=typeof e||Object.keys(t).length!==Object.keys(e).length)return!1;for(let i in t)if(!pg(t[i],e[i]))return!1;return!0}return t===e}function dg(t,e){t.push(e)}function mg(t,e,i){dg(i,{command:"addSource",args:[t,e[t]]})}function _g(t,e,i){dg(e,{command:"removeSource",args:[t]}),i[t]=!0}function gg(t,e,i,r){_g(t,i,r),mg(t,e,i)}function yg(t,e,i){let r;for(r in t[i])if(Object.prototype.hasOwnProperty.call(t[i],r)&&"data"!==r&&!pg(t[i][r],e[i][r]))return!1;for(r in e[i])if(Object.prototype.hasOwnProperty.call(e[i],r)&&"data"!==r&&!pg(t[i][r],e[i][r]))return!1;return!0}function vg(t,e,i,r,n){dg(e,{command:n,args:[i,r,t[r]]})}function wg(t,e,i,r,n){t||={},e||={};for(let s in t)Object.prototype.hasOwnProperty.call(t,s)&&(pg(t[s],e[s])||vg(e,i,r,s,n));for(let s in e)Object.prototype.hasOwnProperty.call(e,s)&&!Object.prototype.hasOwnProperty.call(t,s)&&(pg(t[s],e[s])||vg(e,i,r,s,n))}function bg(t){return t.id}function xg(t,e){return t[e.id]=e,t}function Dg(t){let e=[];if("string"==typeof t)e.push({id:"default",url:t});else if(t&&t.length>0){let i=[];for(let{id:r,url:n}of t){let t=`${r}${n}`;i.includes(t)||(i.push(t),e.push({id:r,url:n}))}}return e}function Mg(t,e,i){try{let r=new URL(t);return r.pathname+=`${e}${i}`,r.toString()}catch{throw Error(`Invalid sprite URL "${t}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}var Eg=class extends ye{constructor(){super(),this.images={},this.updateVersion=0,this.loaded=!1,this.requestors=[],this.missingImageResolver=null,this._spriteImagesIds={},this._imagesIds=null,this._renderCallbacksDispatchedThisFrame={}}destroy(){for(let t of Object.keys(this.images))this.removeImage(t);this._spriteImagesIds={}}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(let{ids:t,promiseResolve:e}of this.requestors)e(this._getImagesForIds(t));this.requestors=[]}}getImage(t){let e=this.images[t];if(e&&!e.data&&e.spriteData){let t=e.spriteData;e.data=new sh({width:t.width,height:t.height},t.context.getImageData(t.x,t.y,t.width,t.height).data),e.spriteData=null}return e}addImage(t,e){if(this.images[t])throw Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,e)&&(this.images[t]=e,this._imagesIds=null,e.isWebGLImage&&this.updateImage(t,e,!1))}_validate(t,e){let i=!0,r=e.data||e.spriteData;return this._validateStretch(e.stretchX,r?.width)||(this.fire(new ge(Error(`Image "${t}" has invalid "stretchX" value`))),i=!1),this._validateStretch(e.stretchY,r?.height)||(this.fire(new ge(Error(`Image "${t}" has invalid "stretchY" value`))),i=!1),this._validateContent(e.content,e)||(this.fire(new ge(Error(`Image "${t}" has invalid "content" value`))),i=!1),i}_validateStretch(t,e){if(!t)return!0;let i=0;for(let r of t){if(r[0]<i||r[1]<r[0]||e<r[1])return!1;i=r[1]}return!0}_validateContent(t,e){if(!t)return!0;if(4!==t.length)return!1;let i=e.spriteData,r=i?.width||e.data.width,n=i?.height||e.data.height;return!(t[0]<0||r<t[0]||t[1]<0||n<t[1]||t[2]<0||r<t[2]||t[3]<0||n<t[3]||t[2]<t[0])&&t[3]>=t[1]}updateImage(t,e,i=!0){let r=this.images[t];if(i){let t=r.data||r.spriteData;if(t.width!==e.data.width||t.height!==e.data.height)throw Error(`size mismatch between old image (${t.width}x${t.height}) and new image (${e.data.width}x${e.data.height}).`)}e.version=(r.version??0)+1,this.images[t]=e,this.updateVersion++}removeImage(t){let e=this.images[t];e&&(delete this.images[t],this._imagesIds=null,e.userImage?.onRemove&&e.userImage.onRemove())}listImages(){return this._imagesIds??=Object.keys(this.images),this._imagesIds}_getSpriteImageId(t,e){return"default"===t?e:`${t}:${e}`}setSpriteImages(t,e){let i=this._spriteImagesIds[t]??[],r=[];for(let i in e){let n=this._getSpriteImageId(t,i);r.push(n),n in this.images?this.updateImage(n,e[i],!1):this.addImage(n,e[i])}let n=new Set(r),s=i.filter((t=>!n.has(t)));for(let t of s)this.removeImage(t);return this._spriteImagesIds[t]=r,{loaded:r,removed:s}}removeSpriteImages(t){let e=this._spriteImagesIds[t]??[];for(let t of e)this.removeImage(t);return delete this._spriteImagesIds[t],e}removeAllSpriteImages(){let t=Object.values(this._spriteImagesIds).flat();for(let e of t)this.removeImage(e);return this._spriteImagesIds={},t}setMissingImageResolver(t){this.missingImageResolver=t}getImages(t){return new Promise((e=>{let i=!0;if(!this.isLoaded())for(let e of t)this.images[e]||(i=!1);this.isLoaded()||i?e(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:e})}))}async _getImagesForIds(t){let e=new Set(t.filter((t=>!this.getImage(t)))),i=this.missingImageResolver;i&&await Promise.allSettled(Array.from(e,(t=>i(t))));let r={};for(let i of t){let t=this.getImage(i);t&&(e.delete(i),r[i]={data:t.data.clone(),pixelRatio:t.pixelRatio,sdf:t.sdf,version:t.version,stretchX:t.stretchX,stretchY:t.stretchY,content:t.content,textFitWidth:t.textFitWidth,textFitHeight:t.textFitHeight,hasRenderCallback:!!t.userImage?.render,isWebGLImage:t.isWebGLImage})}for(let t of e)this.fire(new ug({id:t})),Rt(`Image "${t}" could not be loaded. Please make sure you have added the image before it is needed with map.addImage(), resolved it with map.setMissingStyleImageResolver(), or included it in a "sprite" property in your style.`);return r}beginFrame(){this._renderCallbacksDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(let e of t){if(this._renderCallbacksDispatchedThisFrame[e])continue;this._renderCallbacksDispatchedThisFrame[e]=!0;let t=this.getImage(e);t||Rt(`Image with ID: "${e}" was not found`),Of(t)&&this.updateImage(e,t)}}cloneImages(){let t={};for(let e in this.images){let i=this.images[e];t[e]={...i,data:i.data?i.data.clone():null}}return t}},Ag=class{constructor(t){this._imageManager=t,this._entries={},this._image=new sh({width:1,height:1}),this._dirty=!0}destroy(){this._texture&&=(this._texture.destroy(),null),this._entries={},this._image=new sh({width:1,height:1}),this._dirty=!0}getPixelSize(){let{width:t,height:e}=this._image;return{width:t,height:e}}getPattern(t){let e=this._imageManager.getImage(t);if(!e)return null;let i=this._entries[t];if(i?.image!==e){let i={w:e.data.width+2,h:e.data.height+2,x:0,y:0};this._entries[t]={bin:i,position:new Lf(i,e),image:e}}else{if(i.position.version===e.version)return i.position;i.position.version=e.version}return this._update(),this._entries[t].position}bind(t){let e=t.gl;this._texture?this._dirty&&=(this._texture.update(this._image),!1):(this._texture=new _h(t,this._image,e.RGBA),this._dirty=!1),this._texture.bind(e.LINEAR,e.CLAMP_TO_EDGE)}_update(){for(let t in this._entries)this._imageManager.getImage(t)||delete this._entries[t];let t=[];for(let e in this._entries)t.push(this._entries[e].bin);let{w:e,h:i}=Bf(t),r=this._image;r.resize({width:e||1,height:i||1});for(let t in this._entries){let{bin:e}=this._entries[t],i=e.x+1,n=e.y+1,s=this._entries[t].image.data,o=s.width,a=s.height;sh.copy(s,r,{x:0,y:0},{x:i,y:n},{width:o,height:a}),sh.copy(s,r,{x:0,y:a-1},{x:i,y:n-1},{width:o,height:1}),sh.copy(s,r,{x:0,y:0},{x:i,y:n+a},{width:o,height:1}),sh.copy(s,r,{x:o-1,y:0},{x:i-1,y:n},{width:1,height:a}),sh.copy(s,r,{x:0,y:0},{x:i+o,y:n},{width:1,height:a})}this._dirty=!0}};const Fg=1114111,zg={start:0,end:Fg};let Sg=0;function Cg(t){let e=/^u\+([0-9a-f]*)(\?+)$/i.exec(t);if(e){let[,t,i]=e;return t.length+i.length>6?null:Tg(parseInt(`${t}${"0".repeat(i.length)}`,16),parseInt(`${t}${"f".repeat(i.length)}`,16))}let i=/^u\+([0-9a-f]{1,6})(?:-([0-9a-f]{1,6}))?$/i.exec(t);if(!i)return null;let r=parseInt(i[1],16);return Tg(r,void 0===i[2]?r:parseInt(i[2],16))}function Tg(t,e){return t>e||t>Fg?null:{start:t,end:Math.min(e,Fg)}}function Pg(t,e){return t.ranges.some((({start:t,end:i})=>e>=t&&e<=i))}var Ig=class{constructor(t){this.requestManager=t,this._faces={},this._registered=new Set}setFontFaces(t){this._unregisterAll(),this._faces={};for(let[e,i]of Object.entries(t??{})){let t=Array.isArray(i)?i:[i];this._faces[e]=t.map((t=>this._declareFontFace(e,t))).filter((t=>null!==t))}}hasFontFaces(){return Object.keys(this._faces).length>0}async getFontFamily(t,e){for(let i of t.split(","))for(let t of this._faces[i.trim()]??[])if(Pg(t,e)&&(t.loaded??=this._loadFontFace(t),await t.loaded))return t.family;return null}_declareFontFace(t,e){let i="string"==typeof e?{url:e}:e;if("string"!=typeof i?.url)return Rt(`Ignoring the font face declared for "${t}": it has no URL.`),null;let r="maplibre-gl-font-face-"+Sg++,n=i["unicode-range"];if(!n?.length)return{url:i.url,ranges:[zg],family:r};let s=[];for(let t of n){let e=Cg(t);e?s.push(e):Rt(`Ignoring the unicode range "${t}" of the font face at ${i.url}: it is not a valid range.`)}return s.length?{url:i.url,ranges:s,family:r}:null}async _loadFontFace(t){if(typeof FontFace>"u"||typeof document>"u"||!document.fonts)return Rt(`Ignoring the font face at ${t.url}: this environment has no CSS Font Loading API.`),!1;let e;try{return e=new FontFace(t.family,await this._downloadFontFile(t.url)),!!Object.values(this._faces).some((e=>e.includes(t)))&&(document.fonts.add(e),this._registered.add(e),await e.load(),!0)}catch(i){return e&&this._unregister(e),Rt(`Ignoring the font face at ${t.url}: ${nt(i).message}`),!1}}async _downloadFontFile(t){let e=await this.requestManager.transformRequest(t,"Glyphs"),i=await fe(e,new AbortController);if(!i?.data)throw Error(`the response was empty for the font file at ${t}`);return i.data}_unregister(t){document.fonts?.delete(t),this._registered.delete(t)}_unregisterAll(){for(let t of this._registered)document.fonts?.delete(t);this._registered.clear()}destroy(){this._unregisterAll(),this._faces={}}};const kg=1e20,$g=new Float64Array(256);for(let t=0;t<256;t++){let e=.5-(t/255)**(1/2.2);$g[t]=e*Math.abs(e)}$g[255]=-1e20;var jg=class{constructor({fontSize:t=24,buffer:e=3,radius:i=8,cutoff:r=.25,fontFamily:n="sans-serif",fontWeight:s="normal",fontStyle:o="normal",lang:a=null}={}){this.buffer=e,this.radius=i,this.cutoff=r,this.lang=a;let l=this.size=t+4*e,h=this._createCanvas(l),u=this.ctx=h.getContext("2d",{willReadFrequently:!0});u.font=`${o} ${s} ${t}px ${n}`,u.textBaseline="alphabetic",u.textAlign="left",u.fillStyle="black",this.gridOuter=new Float64Array(l*l),this.gridInner=new Float64Array(l*l),this.f=new Float64Array(l),this.z=new Float64Array(l+1),this.v=new Uint16Array(l)}_createCanvas(t){if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(t,t);let e=document.createElement("canvas");return e.width=e.height=t,e}draw(t){let{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:r,actualBoundingBoxLeft:n,actualBoundingBoxRight:s}=this.ctx.measureText(t),o=Math.ceil(i),a=Math.floor(-n),l=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(s)-a)),h=Math.max(0,Math.min(this.size-this.buffer,o+Math.ceil(r))),u=l+2*this.buffer,c=h+2*this.buffer,f=Math.max(u*c,0),p=new Uint8ClampedArray(f),d={data:p,width:u,height:c,glyphWidth:l,glyphHeight:h,glyphTop:o,glyphLeft:a,glyphAdvance:e};if(0===l||0===h)return d;let{ctx:m,buffer:_,gridInner:g,gridOuter:y}=this;this.lang&&(m.lang=this.lang),m.clearRect(_,_,l,h),m.fillText(t,_-a,_+o);let v=m.getImageData(_,_,l,h);y.fill(kg,0,f),g.fill(0,0,f);let w=3;for(let t=0;t<h;t++){let e=(t+_)*u+_;for(let t=0;t<l;t++,w+=4,e++){let t=v.data[w];if(0===t)continue;let i=$g[t];y[e]=Math.max(0,i),g[e]=Math.max(0,-i)}}Rg(y,0,0,u,c,u,this.f,this.v,this.z);let b=Math.min(_,1);Rg(g,_-b,_-b,l+2*b,h+2*b,u,this.f,this.v,this.z);let x=255/this.radius,D=255*(1-this.cutoff);for(let t=0;t<f;t++){let e=Math.sqrt(y[t])-Math.sqrt(g[t]);p[t]=Math.round(D-x*e)}return d}};function Rg(t,e,i,r,n,s,o,a,l){for(let h=e;h<e+r;h++)Og(t,i*s+h,s,n,o,a,l);for(let h=i;h<i+n;h++)Og(t,h*s+e,1,r,o,a,l)}function Og(t,e,i,r,n,s,o){s[0]=0,o[0]=-1e20,o[1]=kg,n[0]=t[e];for(let a=1,l=0,h=0;a<r;a++){n[a]=t[e+a*i];let r=a*a;do{let t=s[l];h=(n[a]-n[t]+r-t*t)/(a-t)/2}while(h<=o[l]&&--l>-1);l++,s[l]=a,o[l]=h,o[l+1]=kg}for(let a=0,l=0;a<r;a++){for(;o[l+1]<a;)l++;let r=s[l],h=a-r;t[e+a*i]=n[r]+h*h}}const Bg=we.layout_symbol["text-font"].default.join(","),Lg=(t,e)=>{let i=new jg(t);return i.buffer=e,i};var Ug=class{constructor(t,e,i,r=Lg){this.requestManager=t,this.localIdeographFontFamily=e,this.entries={},this.lang=i,this.fontFaceManager=new Ig(t),this.createRasterizer=r}setURL(t){this.url=t}setFontFaces(t){this.fontFaceManager.setFontFaces(t),this.entries={}}async getGlyphs(t){let e=[];for(let i in t)for(let r of t[i])e.push(this._getAndCacheGlyphsPromise(i,r));let i=await Promise.all(e),r={};for(let{stack:t,id:e,glyph:n}of i)r[t]||={},r[t][e]=n&&{id:n.id,bitmap:n.bitmap.clone(),metrics:n.metrics};return r}async _getAndCacheGlyphsPromise(t,e){this.entries[t]??={glyphs:{},requests:{},ranges:{}};let i=this.entries[t],r=i.glyphs[e];if(void 0!==r)return{stack:t,id:e,glyph:r};let n=e.codePointAt(0),s=this.fontFaceManager.hasFontFaces()?await this.fontFaceManager.getFontFamily(t,n):null;return s?(r=i.glyphs[e]=await this._drawGlyph(i,t,e,s),{stack:t,id:e,glyph:r}):!this.url||of(e)||this._charUsesLocalIdeographFontFamily(n)?(r=i.glyphs[e]=await this._drawGlyph(i,t,e),{stack:t,id:e,glyph:r}):await this._downloadAndCacheRangePromise(t,e)}async _downloadAndCacheRangePromise(t,e){let i=e.codePointAt(0),r=this.entries[t],n=Math.floor(i/256);if(r.ranges[n])return{stack:t,id:e,glyph:null};r.requests[n]||=this._loadGlyphRange(t,n);try{let s=await r.requests[n];for(let t in s)r.glyphs[String.fromCodePoint(+t)]=s[+t];return r.ranges[n]=!0,{stack:t,id:e,glyph:s[i]||null}}catch(s){let o=r.glyphs[e]=await this._drawGlyph(r,t,e);return this._warnOnMissingGlyphRange(o,n,i,nt(s)),{stack:t,id:e,glyph:o}}}async _loadGlyphRange(t,e){let i=256*e,r=i+255,n=await this.requestManager.transformRequest(this.url.replace("{fontstack}",t).replace("{range}",`${i}-${r}`),"Glyphs"),s=await fe(n,new AbortController);if(!s?.data)throw Error(`Could not load glyph range. range: ${e}, ${i}-${r}`);let o={};for(let t of function(t){return new If(t).readFields(kf,[])}(s.data))o[t.id]=t;return o}_warnOnMissingGlyphRange(t,e,i,r){let n=256*e;Rt(`Unable to load glyph range ${e}, ${n}-${n+255}. Rendering codepoint U+${i.toString(16).padStart(4,"0").toUpperCase()} locally instead. ${r}`)}_charUsesLocalIdeographFontFamily(t){return!!this.localIdeographFontFamily&&function(t){return/[\u02EA\u02EB\u1100-\u11FF\u2E80-\u2FDF\u3000-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(t))}(t)}async _drawGlyph(t,e,i,r){let n=(await this._getTinySDF(t,e,i,r)).draw(i),s=/^\p{gc=Cf}+$/u.test(i);return{id:i.codePointAt(0),bitmap:new nh({width:n.width||60,height:n.height||60},n.data),metrics:{width:s?0:n.glyphWidth/2||24,height:n.glyphHeight/2||24,left:n.glyphLeft/2+.5||0,top:n.glyphTop/2-27.5||-8,advance:s?0:n.glyphAdvance/2||24,isDoubleResolution:!0}}}_getTinySDF(t,e,i,r){let n=of(i);if(r){let e=n?"clusterTinySDFs":"fontFaceTinySDFs";return t[e]??={},t[e][r]||=this._createTinySDF(r,!1,n?3:1),t[e][r]}let s=e===Bg&&""!==this.localIdeographFontFamily&&this._charUsesLocalIdeographFontFamily(i.codePointAt(0)),o=s?this.localIdeographFontFamily:e;if(n)return t.clusterTinySDFs??={},t.clusterTinySDFs[o]||=this._createTinySDF(o,!0,3),t.clusterTinySDFs[o];let a=s?"ideographTinySDF":"tinySDF";return t[a]||=this._createTinySDF(o),t[a]}async _createTinySDF(t,e=!0,i=1){let r=t?t.split(","):[];r.push("sans-serif");let n=r.map((t=>/[-\w]+/.test(t)?t:`'${CSS.escape(t)}'`)).join(","),s=e?this._fontWeight(r[0]):void 0,o=e?this._fontStyle(r[0]):"normal";if(typeof document<"u"&&document.fonts?.load)try{await document.fonts.load(`${o} ${s||"normal"} 48px ${n}`)}catch(t){Rt(`Failed to load font "${n}": ${nt(t).message}`)}return this.createRasterizer({fontSize:48,buffer:Math.max(6,Math.ceil(48*(i-1)/4)),radius:16,cutoff:.25,fontFamily:n,fontWeight:s,fontStyle:o,lang:this.lang},6)}_fontStyle(t){return/italic/i.test(t)?"italic":/oblique/i.test(t)?"oblique":"normal"}_fontWeight(t){let e,i={thin:100,hairline:100,"extra light":200,"ultra light":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,"extra bold":800,"ultra bold":800,black:900,heavy:900,"extra black":950,"ultra black":950};for(let[r,n]of Object.entries(i))RegExp(`\\b${r}\\b`,"i").test(t)&&(e=`${n}`);return e}destroy(){for(let t in this.entries){let e=this.entries[t];e.tinySDF=null,e.ideographTinySDF=null,e.fontFaceTinySDFs={},e.glyphs={},e.requests={},e.ranges={}}this.entries={},this.fontFaceManager.destroy()}};let Ng;var Gg=class extends ye{constructor(t,e){super(),this._transitionable=new uo(Ng||=new Mo({anchor:new vo(we.light.anchor,"anchor"),position:new vo(we.light.position,"position"),color:new vo(we.light.color,"color"),intensity:new vo(we.light.intensity,"intensity")}),"light",e),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}getCartesianPosition(){return function([t,e,i]){return e+=90,e*=Math.PI/180,i*=Math.PI/180,[t*Math.cos(e)*Math.sin(i),t*Math.sin(e)*Math.sin(i),t*Math.cos(i)]}(this.properties.get("position"))}setLight(t,e={}){this._validate(Ws.light,t,e)||this._transitionable.setValues(t)}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,e,i){return Js(this,t,{value:e},i)}};let qg;var Vg=class extends ye{constructor(t,e){super(),this._transitionable=new uo(qg||=new Mo({"sky-color":new vo(we.sky["sky-color"],"sky-color"),"horizon-color":new vo(we.sky["horizon-color"],"horizon-color"),"fog-color":new vo(we.sky["fog-color"],"fog-color"),"fog-ground-blend":new vo(we.sky["fog-ground-blend"],"fog-ground-blend"),"horizon-fog-blend":new vo(we.sky["horizon-fog-blend"],"horizon-fog-blend"),"sky-horizon-blend":new vo(we.sky["sky-horizon-blend"],"sky-horizon-blend"),"atmosphere-blend":new vo(we.sky["atmosphere-blend"],"atmosphere-blend")}),"sky",e),this.setSky(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new ao(0))}setSky(t,e={}){this._validate(Ws.sky,t,e)||(t||={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0},this._transitionable.setValues(t))}getSky(){return this._transitionable.serialize()}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,e,i={}){return Js(this,t,{value:e},i)}calculateFogBlendOpacity(t){return t<60?0:t<70?(t-60)/10:1}},Zg=class{constructor(t,e){this.width=t,this.height=e,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,e){let i=t.join(",")+String(e);return this.dashEntry[i]||=this.addDash(t,e),this.dashEntry[i]}getDashRanges(t,e,i){let r=[],n=t.length%2==1?-t[t.length-1]*i:0,s=t[0]*i,o=!0;r.push({left:n,right:s,isDash:o,zeroLength:0===t[0]});let a=t[0];for(let e=1;e<t.length;e++){o=!o;let l=t[e];n=a*i,a+=l,s=a*i,r.push({left:n,right:s,isDash:o,zeroLength:0===l})}return r}addRoundDash(t,e,i){let r=e/2;for(let e=-i;e<=i;e++){let n=this.width*(this.nextRow+i+e),s=0,o=t[s];for(let a=0;a<this.width;a++){a/o.right>1&&(o=t[++s]);let l,h=Math.abs(a-o.left),u=Math.abs(a-o.right),c=Math.min(h,u),f=e/i*(r+1);if(o.isDash){let t=r-Math.abs(f);l=Math.sqrt(c*c+t*t)}else l=r-Math.sqrt(c*c+f*f);this.data[n+a]=Math.max(0,Math.min(255,l+128))}}}addRegularDash(t){for(let e=t.length-1;e>=0;--e){let i=t[e],r=t[e+1];i.zeroLength?t.splice(e,1):r?.isDash===i.isDash&&(r.left=i.left,t.splice(e,1))}let e=t[0],i=t[t.length-1];e.isDash===i.isDash&&(e.left=i.left-this.width,i.right=e.right+this.width);let r=this.width*this.nextRow,n=0,s=t[n];for(let e=0;e<this.width;e++){e/s.right>1&&(s=t[++n]);let i=Math.abs(e-s.left),o=Math.abs(e-s.right),a=Math.min(i,o);this.data[r+e]=Math.max(0,Math.min(255,(s.isDash?a:-a)+128))}}addDash(t,e){let i=e?7:0,r=2*i+1;if(this.nextRow+r>this.height)return Rt("LineAtlas out of space"),null;let n=0;for(let e of t)n+=e;if(0!==n){let r=this.width/n,s=this.getDashRanges(t,this.width,r);e?this.addRoundDash(s,r,i):this.addRegularDash(s)}let s={y:this.nextRow+i,height:2*i,width:n};return this.nextRow+=r,this.dirty=!0,s}bind(t){let e=t.gl;this.texture?(e.bindTexture(e.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,e.texSubImage2D(e.TEXTURE_2D,0,0,0,this.width,this.height,e.ALPHA,e.UNSIGNED_BYTE,this.data))):(this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.ALPHA,this.width,this.height,0,e.ALPHA,e.UNSIGNED_BYTE,this.data))}};function Wg(t,e){if(e)try{return new Worker(t,{type:"module"})}catch(t){console.warn("Module worker not supported, falling back to classic worker",t)}return new Worker(t)}async function Hg(){let t=function(){let t=import.meta.url;if(!/^https?:/.test(t))return"";let e=t.endsWith("-dev.mjs")?"maplibre-gl-worker-dev.mjs":"maplibre-gl-worker.mjs";return new URL(`./${e}`,t).href}(),e=!t?.endsWith(".cjs");if(!function(t){if(!t)return!1;let e=globalThis.location;if(!e)return!1;try{return new URL(t,e.href).origin!==e.origin}catch{return!1}}(t))return Wg(t,e);if(e){let i=function(t){let e=new Blob([`import ${JSON.stringify(new URL(t,import.meta.url).href)}`],{type:"text/javascript"});return URL.createObjectURL(e)}(t);try{return Wg(i,e)}finally{URL.revokeObjectURL(i)}}let i=await async function(t){let e=await fetch(t);if(!e.ok)throw Error(`Failed to fetch worker script (${e.status}): ${t}`);let i=await e.text(),r=new Blob([i],{type:"text/javascript"});return URL.createObjectURL(r)}(t);try{return Wg(i,e)}finally{URL.revokeObjectURL(i)}}var Yg=class t{constructor(){this.active={},this.workersPromise=null}async acquire(e){if(this.active[e]=!0,!this.workersPromise){let e=[];for(;e.length<t.workerCount;)e.push(Hg());this.workersPromise=Promise.all(e)}return(await this.workersPromise).slice()}release(t){if(delete this.active[t],0===this.numActive()&&this.workersPromise){let t=this.workersPromise;this.workersPromise=null,t.then((t=>{for(let e of t)e.terminate()}))}}isPreloaded(){return!!this.active.maplibre_preloaded_worker_pool}numActive(){return Object.keys(this.active).length}};const Xg=Math.floor(Z_.hardwareConcurrency/2);let Jg;function Kg(){return Jg||=new Yg,Jg}Yg.workerCount=function(t){if(null==Ut){let e=t.navigator?t.navigator.userAgent:null;Ut=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return Ut}(globalThis)?Math.max(Math.min(Xg,3),1):1;var Qg=class{constructor(t,e){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=e,this.removed=!1,this.actorsPromise=this.initActors(e)}async initActors(t){let e=await this.workerPool.acquire(t);if(this.removed)return[];if(this.actors=e.map(((e,i)=>{let r=new ad(e,t);return r.name=`Worker ${i}`,r})),!this.actors.length)throw Error("No actors found");return this.actors}async broadcast(t,e){let i=await this.actorsPromise;return Promise.all(i.map((i=>i.sendAsync({type:t,data:e}))))}async getActor(){let t=await this.actorsPromise;return this.currentActor=(this.currentActor+1)%t.length,t[this.currentActor]}async waitForInitComplete(){0===this.actors.length&&await this.actorsPromise}getReadyActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.removed=!0;for(let t of this.actors)t.remove();this.actors=[],t&&this.workerPool.release(this.id)}async registerMessageHandler(t,e){let i=await this.actorsPromise;for(let r of i)r.registerMessageHandler(t,e)}async unregisterMessageHandler(t){let e=await this.actorsPromise;for(let i of e)i.unregisterMessageHandler(t)}};let ty;function ey(t,e){let i=g();return x(i,i,[1,1,0]),D(i,i,[.5*t.width,.5*t.height,1]),t.calculatePosMatrix?b(i,i,t.calculatePosMatrix(e.toUnwrapped())):i}function iy(t,e,i,r,n,s,o){let a=function(t,e,i){if(t)for(let r of t){let t=e[r];if(t?.source===i&&"fill-extrusion"===t.type)return!0}else for(let t in e){let r=e[t];if(r.source===i&&"fill-extrusion"===r.type)return!0}return!1}(n?.layers??null,e,t.id),l=s.maxPitchScaleFactor(),h=t.tilesIn(r,l,a);h.sort(ry);let u=[];for(let r of h)u.push({wrappedTileID:r.tileID.wrapped().key,queryResults:r.tile.queryRenderedFeatures(e,i,t.getState(),r.queryGeometry,r.cameraQueryGeometry,r.scale,n,s,l,ey(s,r.tileID),o?(t,e)=>o(r.tileID,t,e):void 0)});return function(t,e){for(let i in t)for(let r of t[i])ny(r,e);return t}(function(t){let e={},i={};for(let{queryResults:r,wrappedTileID:n}of t){i[n]||={};let t=i[n];for(let i in r){let n=r[i];t[i]||={};let s=t[i];e[i]||=[];for(let t of n)s[t.featureIndex]||(s[t.featureIndex]=!0,e[i].push(t))}}return e}(u),t)}function ry(t,e){let i=t.tileID,r=e.tileID;return i.overscaledZ-r.overscaledZ||i.canonical.y-r.canonical.y||i.wrap-r.wrap||i.canonical.x-r.canonical.x}function ny(t,e){let i=t.feature,r=e.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=r}async function sy(t,e,i,r){let n=t;if(t.url?n=(await ce(await e.transformRequest(t.url,"Source"),i)).data:await Z_.frameAsync(i,r),!n)return null;let s=At(Et(n,t),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in n&&n.vector_layers&&(s.vectorLayerIds=n.vector_layers.map((t=>t.id))),s}var oy=class t{constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):Array.isArray(t)&&(4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof Ou?new Ou(t.lng,t.lat):Ou.convert(t),this}setSouthWest(t){return this._sw=t instanceof Ou?new Ou(t.lng,t.lat):Ou.convert(t),this}extend(e){let i,r,n=this._sw,s=this._ne;if(e instanceof Ou)i=e,r=e;else{if(!(e instanceof t))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(t.convert(e)):this.extend(Ou.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(Ou.convert(e)):this;if(i=e._sw,r=e._ne,!i||!r)return this}return n||s?(n.lng=Math.min(i.lng,n.lng),n.lat=Math.min(i.lat,n.lat),s.lng=Math.max(r.lng,s.lng),s.lat=Math.max(r.lat,s.lat)):(this._sw=new Ou(i.lng,i.lat),this._ne=new Ou(r.lng,r.lat)),this}getCenter(){return new Ou((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new Ou(this.getWest(),this.getNorth())}getSouthEast(){return new Ou(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){let{lng:e,lat:i}=Ou.convert(t),r=this._sw.lng<=e&&e<=this._ne.lng;return this._sw.lng>this._ne.lng&&(r=this._sw.lng>=e&&e>=this._ne.lng),this._sw.lat<=i&&i<=this._ne.lat&&r}intersects(e){if(!((e=t.convert(e)).getNorth()>=this.getSouth()&&e.getSouth()<=this.getNorth()))return!1;let i=Math.abs(this.getEast()-this.getWest()),r=Math.abs(e.getEast()-e.getWest());if(i>=360||r>=360)return!0;let n=Mt(this.getWest(),-180,180),s=Mt(this.getEast(),-180,180),o=Mt(e.getWest(),-180,180),a=Mt(e.getEast(),-180,180),l=n>s,h=o>a;return!(!l||!h)||(l?a>=n||o<=s:h?s>=o||n<=a:o<=s&&a>=n)}static convert(e){return e instanceof t||!e?e:new t(e)}static fromLngLat(e,i=0){let r=360*i/40075017,n=r/Math.cos(Math.PI/180*e.lat);return new t(new Ou(e.lng-n,e.lat-r),new Ou(e.lng+n,e.lat+r))}adjustAntiMeridian(){let e=new Ou(this._sw.lng,this._sw.lat),i=new Ou(this._ne.lng,this._ne.lat);return new t(e,e.lng>i.lng?new Ou(i.lng+360,i.lat):i)}},ay=class{constructor(t,e,i){this.bounds=oy.convert(this.validateBounds(t)),this.minzoom=e||0,this.maxzoom=i||24}validateBounds(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){let e=2**t.z,i=Math.floor(Uu(this.bounds.getWest())*e),r=Math.floor(Nu(this.bounds.getNorth())*e),n=Math.ceil(Uu(this.bounds.getEast())*e),s=Math.ceil(Nu(this.bounds.getSouth())*e);return t.x>=i&&t.x<n&&t.y>=r&&t.y<s}},ly=class extends ye{constructor(t,e,i,r){if(super(),this.id=t,this.dispatcher=i,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,Et(this,At(e,["url","scheme","tileSize","promoteId","encoding"])),this._options=Et({type:"vector"},e),this._collectResourceTiming=e.collectResourceTiming,512!==this.tileSize)throw Error("vector tile sources must have a tileSize of 512");this.setEventedParent(r)}async load(t=!1){this._loaded=!1,this.fire(new ig("dataloading")),this._tileJSONRequest=new AbortController;try{let e=await sy(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,e&&(Et(this,e),e.bounds&&(this.tileBounds=new ay(e.bounds,this.minzoom,this.maxzoom)),this.fire(new ig("data",{sourceDataType:"metadata"})),this.fire(new ig("data",{sourceDataType:"content",sourceDataChanged:t})))}catch(t){this._tileJSONRequest=null,this._loaded=!0,re(t)||this.fire(new ge(nt(t)))}}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.abort(),t(),this.load(!0)}setTiles(t){return this.setSourceProperty((()=>{this.tiles=t,this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}onRemove(){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null)}serialize(){return Et({},this._options)}async loadTile(t){let e=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i={request:await this.map._requestManager.transformRequest(e,"Tile"),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:await this._getOverzoomParameters(t),etag:t.etag};i.request.collectResourceTiming=this._collectResourceTiming,await this.dispatcher.waitForInitComplete();let r="RT";if(t.actor&&"expired"!==t.state){if("loading"===t.state)return new Promise(((e,i)=>{t.reloadPromise={resolve:e,reject:i}}))}else t.actor=this.dispatcher.getReadyActor(),r="LT";t.abortController=new AbortController;try{let e=await t.actor.sendAsync({type:r,data:i},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,e);let n={};return e?.etagUnmodified&&(n.unmodified=!0),n}catch(e){if(delete t.abortController,t.aborted||re(e))return;if(e&&404!==e.status)throw e;this._afterTileLoadWorkerResponse(t,null)}}async _getOverzoomParameters(t){if(t.tileID.canonical.z<=this.maxzoom||void 0===this.map._zoomLevelsToOverscale)return;let e=t.tileID.scaledTo(this.maxzoom).canonical,i=e.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:e,overzoomRequest:await this.map._requestManager.transformRequest(i,"Tile")}}_afterTileLoadWorkerResponse(t,e){if(e?.resourceTiming&&(t.resourceTiming=e.resourceTiming),e&&this.map._refreshExpiredTiles&&t.setExpiryData(e),t.etag=e?.etag,t.loadVectorData(e,this.map.painter),t.reloadPromise){let e=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(e.resolve).catch(e.reject)}}async abortTile(t){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&await t.actor.sendAsync({type:"AT",data:{uid:t.uid,type:this.type,source:this.id}})}async unloadTile(t){t.unloadVectorData(),t.actor&&await t.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}})}hasTransition(){return!1}},hy=class extends ye{constructor(t,e,i,r){super(),this.id=t,this.dispatcher=i,this.setEventedParent(r),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._premultiplyAlpha=!0,this._options=Et({type:"raster"},e),Et(this,At(e,["url","scheme","tileSize"]))}async load(t=!1){this._loaded=!1,this.fire(new ig("dataloading")),this._tileJSONRequest=new AbortController;try{let e=await sy(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,e&&(Et(this,e),e.bounds&&(this.tileBounds=new ay(e.bounds,this.minzoom,this.maxzoom)),this.fire(new ig("data",{sourceDataType:"metadata"})),this.fire(new ig("data",{sourceDataType:"content",sourceDataChanged:t})))}catch(t){this._tileJSONRequest=null,this._loaded=!0,re(t)||this.fire(new ge(nt(t)))}}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null)}setSourceProperty(t){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null),t(),this.load(!0)}setTiles(t){return this.setSourceProperty((()=>{this.tiles=t,this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}serialize(){return Et({},this._options)}setPremultiplyAlpha(t){return this._premultiplyAlpha===t||this.setSourceProperty((()=>{this._premultiplyAlpha=t})),this}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}async loadTile(t){let e=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i=this._premultiplyAlpha,r=i?void 0:{premultiplyAlpha:"none"};t.abortController=new AbortController;try{let n=await X_.transformAndGetImage(this.map._requestManager,e,"Tile",t.abortController,this.map._refreshExpiredTiles,r);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(n){this.map._refreshExpiredTiles&&(n.cacheControl||n.expires)&&t.setExpiryData({cacheControl:n.cacheControl,expires:n.expires});let e=this.map.painter.context,r=e.gl,s=n.data??new sh({width:1,height:1},new Uint8Array(4));t.texture=this.map.painter.getTileTexture(s.width),t.texture?t.texture.update(s,{useMipmap:!0,premultiply:i}):(t.texture=new _h(e,s,r.RGBA,{useMipmap:!0,premultiply:i}),t.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE,r.LINEAR_MIPMAP_NEAREST)),t.state="loaded"}}catch(e){if(delete t.abortController,t.aborted)t.state="unloaded";else if(e)throw t.state="errored",e}}async abortTile(t){t.abortController&&(t.abortController.abort(),delete t.abortController)}async unloadTile(t){t.texture&&this.map.painter.saveTileTexture(t.texture)}hasTransition(){return!1}},uy=class extends hy{constructor(t,e,i,r){super(t,e,i,r),this.type="raster-dem",this.maxzoom=22,this._options=Et({type:"raster-dem"},e),this.encoding=e.encoding||"mapbox",this.redFactor=e.redFactor,this.greenFactor=e.greenFactor,this.blueFactor=e.blueFactor,this.baseShift=e.baseShift}async loadTile(t){let e=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{let i=await X_.transformAndGetImage(this.map._requestManager,e,"Tile",t.abortController,this.map._refreshExpiredTiles,{colorSpaceConversion:"none"});if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(i){if(this.map._refreshExpiredTiles&&(i.cacheControl||i.expires)&&t.setExpiryData({cacheControl:i.cacheControl,expires:i.expires}),!i.data)return void(t.state="loaded");let e=i.data,r=Nt(e)&&p()?e:await this.readImageNow(e),n={type:this.type,uid:t.uid,source:this.id,rawImageData:r,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(t.actor&&"expired"!==t.state&&"reloading"!==t.state)return;await this.dispatcher.waitForInitComplete(),(!t.actor||"expired"===t.state)&&(t.actor=this.dispatcher.getReadyActor()),t.dem=await t.actor.sendAsync({type:"LDT",data:n}),t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.needsColorReliefPrepare=!0,t.state="loaded"}}catch(e){if(delete t.abortController,t.aborted)t.state="unloaded";else if(e)throw t.state="errored",e}}async readImageNow(t){if(typeof VideoFrame<"u"&&d()){let e=t.width+4,i=t.height+4;try{return new sh({width:e,height:i},await async function(t,e,i,r,n){if(typeof VideoFrame>"u")throw Error("VideoFrame not supported");let s=new VideoFrame(t,{timestamp:0});try{let o=s?.format;if(!o||!o.startsWith("BGR")&&!o.startsWith("RGB"))throw Error(`Unrecognized format ${o}`);let a=o.startsWith("BGR"),l=new Uint8ClampedArray(r*n*4);if(await s.copyTo(l,function(t,e,i,r,n){let s=4*Math.max(-e,0),o=(Math.max(0,i)-i)*r*4+s,a=4*r,l=Math.max(0,e),h=Math.max(0,i);return{rect:{x:l,y:h,width:Math.min(t.width,e+r)-l,height:Math.min(t.height,i+n)-h},layout:[{offset:o,stride:a}]}}(t,e,i,r,n)),a)for(let t=0;t<l.length;t+=4){let e=l[t];l[t]=l[t+2],l[t+2]=e}return l}finally{s.close()}}(t,-2,-2,e,i))}catch{}}return Z_.getImageData(t,2)}_getNeighboringTiles(t){let e=t.canonical,i=2**e.z,r=(e.x-1+i)%i,n=0===e.x?t.wrap-1:t.wrap,s=(e.x+1+i)%i,o=e.x+1===i?t.wrap+1:t.wrap,a={};return a[new cd(t.overscaledZ,n,e.z,r,e.y).key]={backfilled:!1},a[new cd(t.overscaledZ,o,e.z,s,e.y).key]={backfilled:!1},e.y>0&&(a[new cd(t.overscaledZ,n,e.z,r,e.y-1).key]={backfilled:!1},a[new cd(t.overscaledZ,t.wrap,e.z,e.x,e.y-1).key]={backfilled:!1},a[new cd(t.overscaledZ,o,e.z,s,e.y-1).key]={backfilled:!1}),e.y+1<i&&(a[new cd(t.overscaledZ,n,e.z,r,e.y+1).key]={backfilled:!1},a[new cd(t.overscaledZ,t.wrap,e.z,e.x,e.y+1).key]={backfilled:!1},a[new cd(t.overscaledZ,o,e.z,s,e.y+1).key]={backfilled:!1}),a}async unloadTile(t){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&await t.actor.sendAsync({type:"RDT",data:{type:this.type,uid:t.uid,source:this.id}})}};function cy(t,e){return e?t.properties[e]:t.id}function fy(t,e){let i={id:t.id};if(e.removeAllProperties&&(delete t.removeProperties,delete t.addOrUpdateProperties,delete e.removeProperties),e.removeProperties&&t.addOrUpdateProperties){let i=new Set(e.removeProperties);t.addOrUpdateProperties=t.addOrUpdateProperties.filter((t=>!i.has(t.key)))}return(t.removeAllProperties||e.removeAllProperties)&&(i.removeAllProperties=!0),(t.removeProperties||e.removeProperties)&&(i.removeProperties=[...t.removeProperties||[],...e.removeProperties||[]]),(t.addOrUpdateProperties||e.addOrUpdateProperties)&&(i.addOrUpdateProperties=[...t.addOrUpdateProperties||[],...e.addOrUpdateProperties||[]]),(t.newGeometry||e.newGeometry)&&(i.newGeometry=e.newGeometry||t.newGeometry),i}function py(t){if(!t)return{};let e={};return e.removeAll=t.removeAll,e.remove=new Set(t.remove||[]),e.add=new Map(t.add?.map((t=>[t.id,t]))),e.update=new Map(t.update?.map((t=>[t.id,t]))),e}function dy(t){return t&&0!==t.length?"number"==typeof t[0]?[t]:t.flatMap((t=>dy(t))):[]}function my(t){return"GeometryCollection"===t.type?t.geometries.flatMap((t=>my(t))):dy(t.coordinates)}function _y(t){let e,i=new oy;switch(t.type){case"FeatureCollection":e=t.features.flatMap((t=>my(t.geometry)));break;case"Feature":e=my(t.geometry);break;default:e=my(t)}if(0===e.length)return i;for(let t of e){let[e,r]=t;i.extend([e,r])}return i}var gy=class extends ye{constructor(t,e,i,r){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:e.data},this.actorPromise=i.getActor(),this.setEventedParent(r),this._data="string"==typeof e.data?{url:e.data}:{geojson:e.data},this._options=Et({},e),this._collectResourceTiming=e.collectResourceTiming,void 0!==e.maxzoom&&(this.maxzoom=e.maxzoom),e.type&&(this.type=e.type),e.attribution&&(this.attribution=e.attribution),this.promoteId=e.promoteId,void 0!==e.clusterMaxZoom&&this.maxzoom<=e.clusterMaxZoom&&Rt(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${e.clusterMaxZoom}".`),this.workerOptions=Et({source:this.id,geojsonVtOptions:{buffer:this._pixelsToTileUnits(void 0===e.buffer?128:e.buffer),tolerance:this._pixelsToTileUnits(void 0===e.tolerance?.375:e.tolerance),extent:it,maxZoom:this.maxzoom,lineMetrics:e.lineMetrics||!1,generateId:e.generateId||!1,promoteId:"string"==typeof e.promoteId?e.promoteId:void 0,cluster:e.cluster||!1,clusterOptions:{maxZoom:this._getClusterMaxZoom(e.clusterMaxZoom),minPoints:Math.max(2,e.clusterMinPoints||2),extent:it,radius:this._pixelsToTileUnits(e.clusterRadius||50),log:!1,generateId:e.generateId||!1}},clusterProperties:e.clusterProperties,filter:e.filter},e.workerOptions)}_hasPendingWorkerUpdate(){return void 0!==this._pendingWorkerUpdate.data||void 0!==this._pendingWorkerUpdate.diff||this._pendingWorkerUpdate.updateCluster}_pixelsToTileUnits(t){return t*(it/this.tileSize)}_tileUnitsToPixels(t){return t/(it/this.tileSize)}_getClusterMaxZoom(t){let e=t?Math.round(t):this.maxzoom-1;return Number.isInteger(t)||void 0===t||Rt(`Integer expected for option 'clusterMaxZoom': provided value "${t}" rounded to "${e}"`),e}async load(){await this._updateWorkerData()}onAdd(t){this.map=t,this.load()}setData(t){return this._data="string"==typeof t?{url:t}:{geojson:t},this._pendingWorkerUpdate={data:t},this._updateWorkerData()}updateData(t){return this._pendingWorkerUpdate.diff=function(t,e){if(!t)return e||{};if(!e)return t||{};let i=py(t),r=py(e);!function(t,e){e.removeAll&&(t.add.clear(),t.update.clear(),t.remove.clear(),e.remove.clear());for(let i of e.remove)t.add.delete(i),t.update.delete(i);for(let[i,r]of e.update){let n=t.update.get(i);n&&(e.update.set(i,fy(n,r)),t.update.delete(i))}}(i,r);let n={};if((i.removeAll||r.removeAll)&&(n.removeAll=!0),n.remove=new Set([...i.remove,...r.remove]),n.add=new Map([...i.add,...r.add]),n.update=new Map([...i.update,...r.update]),n.remove.size&&n.add.size)for(let t of n.add.keys())n.remove.delete(t);let s=function(t){let e={};return t.removeAll&&(e.removeAll=t.removeAll),t.remove&&(e.remove=Array.from(t.remove)),t.add&&(e.add=Array.from(t.add.values())),t.update&&(e.update=Array.from(t.update.values())),e}(n);return s}(this._pendingWorkerUpdate.diff,t),this._updateWorkerData()}async getData(){return this._data.url&&await this.once("data"),this._data.geojson?this._data.geojson:{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}}async getBounds(){return _y(await this.getData())}setClusterOptions(t){return this.workerOptions.geojsonVtOptions.cluster=t.cluster,void 0!==t.clusterRadius&&(this.workerOptions.geojsonVtOptions.clusterOptions.radius=this._pixelsToTileUnits(t.clusterRadius)),void 0!==t.clusterMaxZoom&&(this.workerOptions.geojsonVtOptions.clusterOptions.maxZoom=this._getClusterMaxZoom(t.clusterMaxZoom)),this._pendingWorkerUpdate.updateCluster=!0,this._updateWorkerData()}getClusterOptions(){let{cluster:t,clusterOptions:e}=this.workerOptions.geojsonVtOptions;return{cluster:t,clusterMaxZoom:e.maxZoom,clusterRadius:this._tileUnitsToPixels(e.radius)}}async getClusterExpansionZoom(t){return(await this.actorPromise).sendAsync({type:"GCEZ",data:{type:this.type,clusterId:t,source:this.id}})}async getClusterChildren(t){return(await this.actorPromise).sendAsync({type:"GCC",data:{type:this.type,clusterId:t,source:this.id}})}async getClusterLeaves(t,e,i){return(await this.actorPromise).sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:t,limit:e,offset:i}})}async _updateWorkerData(){if(this._isUpdatingWorker)return this._updatePromise;if(!this._hasPendingWorkerUpdate())return void Rt(`No pending worker updates for GeoJSONSource ${this.id}.`);let{data:t,diff:e,updateCluster:i}=this._pendingWorkerUpdate,r=this._getLoadGeoJSONParameters(t,e,i);void 0===t?e?this._pendingWorkerUpdate.diff=void 0:i&&(this._pendingWorkerUpdate.updateCluster=void 0):this._pendingWorkerUpdate.data=void 0,this._updatePromise=this._dispatchWorkerUpdate(r),await this._updatePromise}async _getLoadGeoJSONParameters(t,e,i){let r=Et({type:this.type,source:this.id},this.workerOptions);return"string"==typeof t?(r.request=await this.map._requestManager.transformRequest(Z_.resolveURL(t),"Source"),r.request.collectResourceTiming=this._collectResourceTiming,r):void 0!==t?(r.data=t,r):e?(r.dataDiff=e,r):i?(r.updateCluster=!0,r):void 0}async _dispatchWorkerUpdate(t){this._isUpdatingWorker=!0,this.fire(new ig("dataloading"));try{let e=await t,i=await(await this.actorPromise).sendAsync({type:"LD",data:e});if(this._isUpdatingWorker=!1,this._removed||i.abandoned)return void this.fire(new ig("dataabort"));i.data&&(this._data={geojson:i.data});let r=this._applyDiffToSource(e.dataDiff),n=this._getShouldReloadTileOptions(r),s={};this._applyResourceTiming(s,i),this.fire(new ig("data",{...s,sourceDataType:"metadata"})),this.fire(new ig("data",{...s,sourceDataType:"content",shouldReloadTileOptions:n}))}catch(t){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new ig("dataabort"));this.fire(new ge(nt(t)))}finally{this._hasPendingWorkerUpdate()&&await this._updateWorkerData()}}_applyResourceTiming(t,e){if(!this._collectResourceTiming)return;let i=e.resourceTiming?.[this.id];if(!i)return;let r=i.slice(0);r?.length&&Et(t,{resourceTiming:r})}_applyDiffToSource(t){if(!t)return;let e="string"==typeof this.promoteId?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){let t=function(t,e){let i=new Map;if(null==t||null==t.type)return i;if("Feature"===t.type){let r=cy(t,e);return null==r?void 0:(i.set(r,t),i)}if("FeatureCollection"===t.type){let r=new Set;for(let n of t.features){let t=cy(n,e);if(null==t||r.has(t))return;r.add(t),i.set(t,n)}return i}}(this._data.geojson,e);if(!t)throw Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:t}}if(!this._data.updateable)return;let i=function(t,e,i){let r=[];if(e.removeAll)t.clear();else if(e.remove)for(let i of e.remove){let e=t.get(i);e&&(r.push(e.geometry),t.delete(i))}if(e.add)for(let n of e.add){let e=cy(n,i);if(null==e)continue;let s=t.get(e);s&&r.push(s.geometry),r.push(n.geometry),t.set(e,n)}if(e.update)for(let i of e.update){let e=t.get(i.id);if(!e)continue;let n=!!i.newGeometry,s=i.removeAllProperties||i.removeProperties?.length>0||i.addOrUpdateProperties?.length>0;if(!n&&!s)continue;r.push(e.geometry);let o={...e};if(t.set(i.id,o),n&&(r.push(i.newGeometry),o.geometry=i.newGeometry),s){if(o.properties=i.removeAllProperties?{}:{...o.properties||{}},i.removeProperties)for(let t of i.removeProperties)delete o.properties[t];if(i.addOrUpdateProperties)for(let{key:t,value:e}of i.addOrUpdateProperties)o.properties[t]=e}}return r}(this._data.updateable,t,e);return t.removeAll||this._options.cluster?void 0:i}_getShouldReloadTileOptions(t){if(t)return{affectedBounds:t.filter(Boolean).map((t=>_y(t)))}}shouldReloadTile(t,{affectedBounds:e}){if("loading"===t.state)return!0;if("unloaded"===t.state)return!1;let{buffer:i,extent:r}=this.workerOptions.geojsonVtOptions,n=function({x:t,y:e,z:i},r=0){let n=qu((t-r)/2**i),s=Vu((e+1+r)/2**i),o=qu((t+1+r)/2**i),a=Vu((e-r)/2**i);return new oy([n,s],[o,a])}(t.tileID.canonical,i/r);for(let t of e)if(n.intersects(t))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}async loadTile(t){let e=t.actor?"RT":"LT";t.actor=await this.actorPromise;let i={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};t.abortController=new AbortController;try{let r=await(await this.actorPromise).sendAsync({type:e,data:i},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(r,this.map.painter,"RT"===e)}catch(e){if(delete t.abortController,t.aborted||re(e))return;throw e}}async abortTile(t){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0}async unloadTile(t){t.unloadVectorData(),await(await this.actorPromise).sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}})}onRemove(){this._removed=!0,this.actorPromise.then((t=>t.sendAsync({type:"RS",data:{type:this.type,source:this.id}})))}serialize(){return Et({},this._options,{type:this.type,data:this._data.updateable?{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}:this._data.url||this._data.geojson})}hasTransition(){return!1}};const yy=[0,0,1],vy=(t,e,i,r,n,s)=>({u_tl_parent:t,u_scale_parent:e,u_buffer_scale:1,u_image_warp:s,u_fade_t:i.mix,u_opacity:i.opacity*r.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:r.paint.get("raster-brightness-min"),u_brightness_high:r.paint.get("raster-brightness-max"),u_saturation_factor:xy(r.paint.get("raster-saturation")),u_contrast_factor:by(r.paint.get("raster-contrast")),u_spin_weights:wy(r.paint.get("raster-hue-rotate")),u_coords_top:[n[0].x,n[0].y,n[1].x,n[1].y],u_coords_bottom:[n[3].x,n[3].y,n[2].x,n[2].y]});function wy(t){t*=Math.PI/180;let 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]}function by(t){return t>0?1/(1-t):1+t}function xy(t){return t>0?1-1/(1.001-t):-t}var Dy=class{constructor(t,e,i){this.vertexBuffer=t,this.indexBuffer=e,this.segments=i}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}};const My=$o([{name:"a_pos",type:"Int16",components:2}]);function Ey(t,e){let i=function(t){let e=void 0===t.granularity?1:Math.max(t.granularity,1),i=e+(t.generateBorders?2:0),r=e+(t.extendToNorthPole||t.generateBorders?1:0)+(t.extendToSouthPole||t.generateBorders?1:0),n=i+1,s=r+1,o=t.generateBorders?-1:0,a=t.generateBorders||t.extendToNorthPole?-1:0,l=e+ +!!t.generateBorders,h=e+(t.generateBorders||t.extendToSouthPole?1:0),u=n*s,c=i*r*6,f=n*s>65536;if(f)throw Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");let p=f||!1,d=new Int16Array(2*u),m=0;for(let i=a;i<=h;i++)for(let r=o;r<=l;r++){let n=r/e*it;-1===r&&(n=-64),r===e+1&&(n=8256);let s=i/e*it;-1===i&&(s=t.extendToNorthPole?uu:-64),i===e+1&&(s=t.extendToSouthPole?cu:8256),d[m++]=n,d[m++]=s}let _=p?new Uint32Array(c):new Uint16Array(c),g=0;for(let t=0;t<r;t++)for(let e=0;e<i;e++){let i=e+1+t*n,r=e+(t+1)*n,s=e+1+(t+1)*n;_[g++]=e+t*n,_[g++]=r,_[g++]=i,_[g++]=i,_[g++]=r,_[g++]=s}return{vertices:d.buffer.slice(0),indices:_.buffer.slice(0),uses32bitIndices:p}}(e),r=va.deserialize({arrayBuffer:i.vertices,length:i.vertices.byteLength/2/2}),n=ja.deserialize({arrayBuffer:i.indices,length:i.indices.byteLength/2/3});return new Dy(t.createVertexBuffer(r,My.members),t.createIndexBuffer(n),La.simpleSegment(0,0,r.length,n.length))}var Ay=class extends ye{constructor(t,e,i,r){super(),this.imageWarp=yy,this.flippedWindingOrder=!1,this._warp="auto",this._imageDirty=!1,this._subdividedQuad=!1,this._subdividedMesh=null,this.id=t,this.dispatcher=i,this.coordinates=e.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(r),this.options=e}async load(t){if(void 0===this.options.url)return this._loaded=!0,void this._finishLoading();this._loaded=!1,this.fire(new ig("dataloading")),this.url=this.options.url,this._abortController=new AbortController;try{let e=await X_.transformAndGetImage(this.map._requestManager,this.url,"Image",this._abortController);this._abortController=null,this._loaded=!0,e?.data?(this._setImage(e.data),t&&(this.coordinates=t),this._finishLoading()):this.fire(new ge(Error(`Could not load image ${this.url}: the response is empty`)))}catch(t){if(re(t))return;this._abortController=null,this._loaded=!0,this.fire(new ge(nt(t)))}}loaded(){return this._loaded}updateImage(t){return this._abortController&&=(this._abortController.abort(),null),"image"in t?(this._loaded=!0,this._setImage(t.image),t.coordinates&&(this.coordinates=t.coordinates),this._finishLoading(),this):t.url?(this.options.url=t.url,this.load(t.coordinates),this):this}_setImage(t){this.image=t,this._imageDirty=!0}getMesh(t,e){return!this._subdividedQuad||e?null:(this._subdividedMesh??=Ey(t,{granularity:16}),this._subdividedMesh)}_disposeTexture(){this.texture?.destroy(),this.texture=null}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new ig("data",{sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._abortController&&=(this._abortController.abort(),null),this._disposeTexture(),this._subdividedMesh?.destroy(),this._subdividedMesh=null,this.image=null,this.tiles={}}setWarp(t){return this._warp===t||(this._warp=t,this.tileCoords&&this.setCoordinates(this.coordinates)),this}getWarp(){return this._warp}setCoordinates(t){this.coordinates=t;let e=t.map(Wu.fromLngLat);return this.tileID=function(t){let e=Fu.fromPoints(t),i=e.width(),r=e.height(),n=Math.max(0,Math.floor(-Math.log(Math.max(i,r))/Math.LN2)),s=2**n;return new hd(n,Math.floor((e.minX+e.maxX)/2*s),Math.floor((e.minY+e.maxY)/2*s))}(e),this.terrainTileRanges=this._getOverlappingTileRanges(e),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=e.map((t=>this.tileID.getTilePoint(t)._round())),this.imageWarp=function(t,e){if("flat"===e||Fy(t))return yy;let[i,r,n,s]=t,o=i.x-r.x+n.x-s.x,a=i.y-r.y+n.y-s.y,l=[r.x-n.x,r.y-n.y,s.x-n.x,s.y-n.y],[h,u,c,f]=l,p=function(t){return t[0]*t[3]-t[2]*t[1]}(l),d=(o*f-c*a)/p,m=(h*a-o*u)/p,_=[1,1+d,1+d+m,1+m],g=Math.max(..._)/Math.min(..._),y="perspective"===e?0:function(t){return Math.max(0,(1-4/t)/(1-4/512))}(g);return!(g>=1&&g<=512)||y>=1?yy:[d,m,y]}(this.tileCoords,this._warp),this._subdividedQuad=this.imageWarp[2]>0&&!Fy(this.tileCoords),this.flippedWindingOrder=function(t){return(t[1].x-t[0].x)*(t[2].y-t[0].y)-(t[1].y-t[0].y)*(t[2].x-t[0].x)<0}(this.tileCoords),this.fire(new ig("data",{sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;let t=this.map.painter.context,e=t.gl;this.texture?this._imageDirty&&(this.texture.update(this.image),this.texture.bind(e.LINEAR,e.CLAMP_TO_EDGE)):(this.texture=new _h(t,this.image,e.RGBA),this.texture.bind(e.LINEAR,e.CLAMP_TO_EDGE)),this._imageDirty=!1;let i=!1;for(let t in this.tiles){let e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,i=!0)}i&&this.fire(new ig("data",{sourceDataType:"idle",sourceId:this.id}))}async loadTile(t){this.tileID?.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"}serialize(){let t={type:"image",coordinates:this.coordinates};return void 0!==this.options.url&&(t.url=this.options.url),t}hasTransition(){return!1}_getOverlappingTileRanges(t){let{minX:e,minY:i,maxX:r,maxY:n}=Fu.fromPoints(t),s={};for(let t=0;t<=25;t++){let o=2**t,a=Math.floor(e*o),l=Math.floor(i*o),h=Math.floor(r*o),u=Math.floor(n*o),c=(a%o+o)%o,f=h%o,p=Math.floor(a/o),d=Math.floor(h/o);s[t]={minWrap:p,maxWrap:d,minTileXWrapped:c,maxTileXWrapped:f,minTileY:l,maxTileY:u}}return s}};function Fy(t){let[e,i,r,n]=t;return e.x+r.x===i.x+n.x&&e.y+r.y===i.y+n.y}var zy=class extends Ay{constructor(t,e,i,r){super(t,e,i,r),this._onPlayingHandler=()=>{this.map?.triggerRepaint()},this.roundZoom=!0,this.type="video",this.options=e}async load(){this._loaded=!1;let t=this.options;this.urls=[];for(let e of t.urls)this.urls.push((await this.map._requestManager.transformRequest(e,"Source")).url);try{let t=await(t=>{let e=window.document.createElement("video");return e.muted=!0,new Promise((i=>{e.onloadstart=()=>{i(e)};for(let i of t){let t=window.document.createElement("source");pe(i)||(e.crossOrigin="Anonymous"),t.src=i,e.appendChild(t)}}))})(this.urls);if(this._loaded=!0,!t)return;this.video=t,this.video.loop=!0,this.video.addEventListener("playing",this._onPlayingHandler),this.map&&this.video.play(),this._finishLoading()}catch(t){this.fire(new ge(nt(t)))}}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){let e=this.video.seekable;t<e.start(0)||t>e.end(0)?this.fire(new ge(new xe(`sources.${this.id}`,null,`Playback for this video can be set only between the ${e.start(0)} and ${e.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}onRemove(){super.onRemove(),this.video&&(this.video.removeEventListener("playing",this._onPlayingHandler),this.video.pause())}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;let t=this.map.painter.context,e=t.gl;this.texture?this.video.paused||(this.texture.bind(e.LINEAR,e.CLAMP_TO_EDGE),e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,this.video)):(this.texture=new _h(t,this.video,e.RGBA),this.texture.bind(e.LINEAR,e.CLAMP_TO_EDGE));let i=!1;for(let t in this.tiles){let e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,i=!0)}i&&this.fire(new ig("data",{sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},Sy=class extends Ay{constructor(t,e,i,r){super(t,e,i,r),e.coordinates?(!Array.isArray(e.coordinates)||4!==e.coordinates.length||e.coordinates.some((t=>!Array.isArray(t)||2!==t.length||t.some((t=>"number"!=typeof t)))))&&this.fire(new ge(new xe(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new ge(new xe(`sources.${t}`,null,'missing required property "coordinates"'))),e.animate&&"boolean"!=typeof e.animate&&this.fire(new ge(new xe(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),e.canvas?"string"!=typeof e.canvas&&!(e.canvas instanceof HTMLCanvasElement)&&this.fire(new ge(new xe(`sources.${t}`,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 ge(new xe(`sources.${t}`,null,'missing required property "canvas"'))),this.options=e,this.animate=void 0===e.animate||e.animate}async load(){this._loaded=!0,this.canvas||=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new ge(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(),!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this._playing=!1,super.onRemove()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||0===Object.keys(this.tiles).length)return;let e=this.map.painter.context,i=e.gl;this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new _h(e,this.canvas,i.RGBA,{premultiply:!0}),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let r=!1;for(let t in this.tiles){let e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,r=!0)}r&&this.fire(new ig("data",{sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",animate:this.animate,canvas:this.options.canvas,coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}};const Cy={},Ty="RTLPluginLoaded";var Py=class extends ye{constructor(...t){super(...t),this.status="unavailable",this.url=null,this.dispatcher=(ty||(ty=new Qg(Kg(),ae),ty.registerMessageHandler("GR",((t,e,i)=>ue(e,i)))),ty)}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch((t=>{throw this.status="error",t}))}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}async setRTLTextPlugin(t,e=!1){if(this.url)throw Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=Z_.resolveURL(t),!this.url)throw Error(`requested url ${t} is invalid`);if("unavailable"===this.status){if(!e)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if("requested"===this.status)return this._requestImport()}async _requestImport(){await this._syncState("loading"),this.status="loaded",this.fire(new _e(Ty))}lazyLoad(){"unavailable"===this.status?this.status="requested":"deferred"===this.status&&this._requestImport()}};let Iy=null;function ky(){return Iy||=new Py,Iy}var $y=class{constructor(t,e){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=t,this.uid=zt(),this.uses=0,this.tileSize=e,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rttObjects=[],this.rttFingerprint={},this.expiredRequestCount=0,this.state="loading",this.featureStateRevision=-1}isRenderable(t){return this.hasData()&&(!this.fadeEndTime||0!==this.fadingDirection||this.fadeOpacity>0)&&(t||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:t,fadingDirection:e,fadingParentID:i,fadeEndTime:r}){this.resetFadeLogic(),this.fadingRole=t,this.fadingDirection=e,this.fadingParentID=i,this.fadeEndTime=r}setSelfFadeLogic(t){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=t}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=H_(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}getRTT(t){return this.rttObjects[t]}acquireRTT(t,e,i){return this.rttObjects[e]=t.acquireRTT(i)}releaseRTT(t){if(0!==this.rttObjects.length){for(let e of this.rttObjects)e&&t.releaseRTT(e);this.rttObjects.length=0}}loadVectorData(t,e,i){if(!0!==t?.etagUnmodified)if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestEncoding=t.encoding,this.latestFeatureIndex.rawTileData=t.rawTileData,this.latestFeatureIndex.encoding=t.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(t,e){let i={};if(!e)return i;for(let r of t){let t=r.layerIds.map((t=>e.getLayer(t))).filter(Boolean);if(0!==t.length){r.layers=t,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map((e=>t.filter((t=>t.id===e))[0])));for(let e of t)i[e.id]=r}}return i}(t.buckets,e?.style),this.hasSymbolBuckets=!1;for(let t in this.buckets){let e=this.buckets[t];if(e instanceof Wp){if(this.hasSymbolBuckets=!0,!i)break;e.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let t in this.buckets){let e=this.buckets[t];if(e instanceof Wp&&e.hasRTLText){this.hasRTLText=!0,ky().lazyLoad();break}}this.queryPadding=0;for(let t in this.buckets){let i=this.buckets[t];this.queryPadding=Math.max(this.queryPadding,e.style.getLayer(t).queryRadius(i))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),this.dashPositions=t.dashPositions}else this.collisionBoxArray=new la;else this.state="loaded"}unloadVectorData(){for(let t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.imageAtlas=null,this.dashPositions=null,this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(let e in this.buckets){let i=this.buckets[e];i.uploadPending()&&i.upload(t)}let e=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new _h(t,this.imageAtlas.image,e.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&=(this.glyphAtlasTexture=new _h(t,this.glyphAtlasImage,e.ALPHA),null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,e,i,r,n,s,o,a,l,h,u){return this.latestFeatureIndex?.rawTileData?this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:n,scale:s,tileSize:this.tileSize,pixelPosMatrix:h,transform:a,params:o,queryPadding:this.queryPadding*l,getElevation:u},t,e,i):{}}querySourceFeatures(t,e){let i=this.latestFeatureIndex;if(!i?.rawTileData)return;let r=i.loadVTLayers(),n=e?.sourceLayer?e.sourceLayer:"",s=r._geojsonTileLayer||r[n];if(!s)return;let o=Qn(e?.filter,`querySourceFeatures[${n}].filter`,e?.globalState),{z:a,x:l,y:h}=this.tileID.canonical,u={z:a,x:l,y:h};for(let e=0;e<s.length;e++){let r=s.feature(e);if(o.needGeometry){let t=xl(r,!0);if(!o.filter(new ao(this.tileID.overscaledZ),t,this.tileID.canonical))continue}else if(!o.filter(new ao(this.tileID.overscaledZ),r))continue;let c=i.getId(r,n),f=new yd(r,a,l,h,c);f.tile=u,t.push(f)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){let e=this.expirationTime;if(t.cacheControl){let e=function(t){let e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((t,i,r,n)=>{let s=r||n;return e[i]=!s||s.toLowerCase(),""})),e["max-age"]){let t=parseInt(e["max-age"],10);isNaN(t)?delete e["max-age"]:e["max-age"]=t}return e}(t.cacheControl);e["max-age"]&&(this.expirationTime=Date.now()+1e3*e["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){let t=Date.now(),i=!1;if(this.expirationTime>t)i=!1;else if(e)if(this.expirationTime<e)i=!0;else{let r=this.expirationTime-e;r?this.expirationTime=t+Math.max(r,3e4):i=!0}else i=!0;i?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),2**31-1)}setFeatureState(t,e,i){if(!this.latestFeatureIndex?.rawTileData||0===Object.keys(t).length||this.featureStateRevision===i)return;this.featureStateRevision=i;let r=this.latestFeatureIndex.loadVTLayers();for(let i in this.buckets){if(!e.style.hasLayer(i))continue;let n=this.buckets[i],s=n.layers[0].sourceLayer||"_geojsonTileLayer",o=r[s],a=t[s];if(!o||!a||0===a.length)continue;n.update(a,o,this.imageAtlas?.patternPositions||{},this.dashPositions||{});let l=e?.style?.getLayer(i);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(n)))}}holdingForSymbolFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<H_()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(t){this.symbolFadeHoldUntil=H_()+t}setDependencies(t,e){let i={};for(let t of e)i[t]=!0;this.dependencies[t]=i}hasDependency(t,e){for(let i of t){let t=this.dependencies[i];if(t)for(let i of e)if(t[i])return!0}return!1}};function jy(t){let e=[];for(let i in t)e.push({id:i,state:t[i]});return e}var Ry=class{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(t,e,i){let r=String(e);if(this.stateChanges[t]||={},this.stateChanges[t][r]||={},Et(this.stateChanges[t][r],i),null===this.deletedStates[t]){this.deletedStates[t]={};for(let e in this.state[t])if(e===r){this.deletedStates[t][r]={};for(let n in this.state[t][e])void 0===i[n]&&(this.deletedStates[t][r][n]=null)}else this.deletedStates[t][e]=null}else if(null===this.deletedStates[t]?.[r]){this.deletedStates[t][r]={};for(let e in this.state[t][r])void 0===i[e]&&(this.deletedStates[t][r][e]=null)}else for(let e in i)null===this.deletedStates[t]?.[r]?.[e]&&delete this.deletedStates[t][r][e]}removeFeatureState(t,e,i){if(null===this.deletedStates[t])return;let r=String(e);if(this.deletedStates[t]||={},i&&void 0!==e)null!==this.deletedStates[t][r]&&(this.deletedStates[t][r]||={},this.deletedStates[t][r][i]=null);else if(void 0!==e)if(this.stateChanges[t]?.[r])for(i in this.deletedStates[t][r]={},this.stateChanges[t][r])this.deletedStates[t][r][i]=null;else this.deletedStates[t][r]=null;else this.deletedStates[t]=null}getState(t,e){let i=String(e),r=Et({},(this.state[t]||{})[i],(this.stateChanges[t]||{})[i]);if(null===this.deletedStates[t])return{};if(this.deletedStates[t]){let i=this.deletedStates[t][e];if(null===i)return{};for(let t in i)delete r[t]}return r}initializeTileState(t,e){let i={};for(let t in this.state)i[t]=jy(this.state[t]);t.setFeatureState(i,e,this.revision)}coalesceChanges(t,e){let i={};for(let t in this.stateChanges){this.state[t]||={},i[t]||={};for(let e in this.stateChanges[t])this.state[t][e]||={},Et(this.state[t][e],this.stateChanges[t][e]),i[t][e]=this.state[t][e]}for(let t in this.deletedStates)if(this.state[t]||={},i[t]||={},null===this.deletedStates[t])for(let e in this.state[t])this.state[t][e]={},i[t][e]={};else for(let e in this.deletedStates[t]){if(null===this.deletedStates[t][e])this.state[t][e]={};else for(let i of Object.keys(this.deletedStates[t][e]))delete this.state[t][e][i];i[t][e]=this.state[t][e]}if(this.stateChanges={},this.deletedStates={},0===Object.keys(i).length)return;this.revision++;let r={};for(let t in i)r[t]=jy(i[t]);t.setFeatureState(r,e,this.revision)}},Oy=class t{constructor(t,e){this.min=t,this.max=e,this.center=$([],I([],this.min,this.max),.5)}quadrant(e){let i=[e%2==0,e<2],r=C(this.min),n=C(this.max);for(let t=0;t<i.length;t++)r[t]=i[t]?this.min[t]:this.center[t],n[t]=i[t]?this.center[t]:this.max[t];return n[2]=this.max[2],new t(r,n)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersectsFrustum(t){let e=!0;for(let i of t.planes){let t=this.intersectsPlane(i);if(0===t)return 0;1===t&&(e=!1)}return e?2:t.aabb.min[0]>this.max[0]||t.aabb.min[1]>this.max[1]||t.aabb.min[2]>this.max[2]||t.aabb.max[0]<this.min[0]||t.aabb.max[1]<this.min[1]||t.aabb.max[2]<this.min[2]?0:1}intersectsPlane(t){let e=t[3],i=t[3];for(let r=0;r<3;r++)t[r]>0?(e+=t[r]*this.min[r],i+=t[r]*this.max[r]):(i+=t[r]*this.min[r],e+=t[r]*this.max[r]);return e>=0?2:i<0?0:1}},By=class t{constructor(t,e,i){this.points=t,this.planes=e,this.aabb=i}static fromInvProjectionMatrix(e,i=1,r=0,n,s){let o=s?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],a=2**r,l=[[-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((t=>function(t,e,i,r){let n=Z([],t,e),s=1/n[3]/i*r;return function(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t[3]=e[3]*i[3],t}(n,n,[s,s,1/n[3],s])}(t,e,i,a)));n&&function(t,e,i,r){let n=r?4:0,s=r?0:4,o=0,a=[],l=[];for(let e=0;e<4;e++){let i=q([],t[e+s],t[e+n]),r=T(i);$(i,i,1/r),a.push(r),l.push(i)}for(let e=0;e<4;e++){let r=pt(t[e+n],l[e],i);o=null!==r&&r>=0?Math.max(o,r):Math.max(o,a[e])}let h=function(t,e){let i=[0,0,0,0];return R(i,B([],q([],t[e[0]],t[e[1]]),q([],t[e[2]],t[e[1]]))),i[3]=-O(i,t[e[0]]),i}(t,e),u=function(t,e){let i=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t}([],t,1/V(t)),r=q([],e,$([],i,O(e,i))),n=V(r);if(n>0){let t=Math.sqrt(1-i[3]*i[3]);return ct(e,I([],$([],i,-i[3]),$([],r,t/n)))}return null}(i,h);if(null!==u){let t=u/O(l[0],h);o=Math.min(o,t)}for(let e=0;e<4;e++){let i=Math.min(o,a[e]);t[e+s]=[t[e+n][0]+l[e][0]*i,t[e+n][1]+l[e][1]*i,t[e+n][2]+l[e][2]*i,1]}}(l,o[0],n,s);let h=o.map((t=>{let e=R([],B([],q([],l[t[0]],l[t[1]]),q([],l[t[2]],l[t[1]]))),i=-O(e,l[t[1]]);return e.concat(i)})),u=[1/0,1/0,1/0],c=[-1/0,-1/0,-1/0];for(let t of l)for(let e=0;e<3;e++)u[e]=Math.min(u[e],t[e]),c[e]=Math.max(c[e],t[e]);return new t(l,h,new Oy(u,c))}};function Ly(t,e,i){let r=e.intersectsFrustum(t);if(!i||0===r)return r;let n=e.intersectsPlane(i);return 0===n?0:2===r&&2===n?2:1}function Uy(t,e,i){let r=0,n=(i-e)/10;for(let s=0;s<10;s++)r+=n*Math.cos(e+(s+.5)/10*(i-e))**+t;return r}function Ny(t,e){return function(i,r,n,s,o){let a=2*((t-1)/Ct(Math.cos(qt(Hu-o))/Math.cos(qt(Hu)))-1),l=Math.acos(n/s),h=2*Uy(a-1,0,qt(o/2)),u=Math.min(qt(Hu),l+qt(o/2)),c=Uy(a-1,Math.min(u,l-qt(o/2)),u),f=Math.atan(r/n),p=i;return p+=Ct(s/Math.hypot(r,n)/Math.max(.5,Math.cos(qt(o/2)))),p+=a*Ct(Math.cos(f))/2,p-=Ct(Math.max(1,c/h/e))/2,p}}const Gy=Ny(9.314,3);function qy(t,e){let i=(e.roundZoom?Math.round:Math.floor)(t.zoom+Ct(t.tileSize/e.tileSize));return Math.max(0,i)}function Vy(t,e){let i=t.getCameraFrustum(),r=t.getClippingPlane();if(r&&e.maxContentElevation>0){let n=Math.hypot(r[0],r[1],r[2]);if(n>0){let s=1+e.maxContentElevation/Ru,o=Dt(-r[3]/n,-1,1),a=Math.cos(Math.acos(o)+Math.acos(1/s));r=[r[0],r[1],r[2],-a*n],i=function(t,e,i){let r=t.planes[1],n=t.points.map((t=>{if(Math.abs(r[0]*t[0]+r[1]*t[1]+r[2]*t[2]+r[3])>1e-6)return t;let n=[t[0]-i[0],t[1]-i[1],t[2]-i[2]],s=r[0]*n[0]+r[1]*n[1]+r[2]*n[2];if(s>=-1e-9)return t;let o=e/-s;return[t[0]+n[0]*o,t[1]+n[1]*o,t[2]+n[2]*o,t[3]]})),s=t.planes.map(((t,i)=>1===i?[t[0],t[1],t[2],t[3]+e]:t)),o=[1/0,1/0,1/0],a=[-1/0,-1/0,-1/0];for(let t of n)for(let e=0;e<3;e++)o[e]=Math.min(o[e],t[e]),a[e]=Math.max(a[e],t[e]);return new By(n,s,new Oy(o,a))}(i,Math.sqrt(s*s-1),t.cameraPosition)}}let n=function(t){let e=Gu(1,t.center.lat)*t.worldSize;return tc(t.center,t.elevation,t.pitch,t.bearing,t.cameraToCenterDistance/e)}(t),s=Wu.fromLngLat(t.center,t.elevation),o=function(t,e){let i=Dt((15-(Hu-t.pitch-t.fov/2))/15,0,1),r=Math.max(500,e??0);return t.elevation+i*r}(t,e.maxContentElevation),a=t.getCoveringTilesDetailsProvider(),l=a.allowVariableZoom(t,e),h=qy(t,e),u=e.minzoom||0,c=void 0===e.maxzoom?t.maxZoom:e.maxzoom,f=Math.min(Math.max(0,h),c),p=2**f,d=[p*n.x,p*n.y,0],m=[p*s.x,p*s.y,0],_=Math.hypot(s.x-n.x,s.y-n.y),g=Math.abs(s.z-n.z),y=Math.hypot(_,g),v=t=>({zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}),w=[],b=[];if(t.renderWorldCopies&&a.allowWorldCopies())for(let t=1;t<=3;t++)w.push(v(-t)),w.push(v(t));for(w.push(v(0));w.length>0;){let p=w.pop(),_=p.x,v=p.y,x=p.fullyVisible,D={x:_,y:v,z:p.zoom},M=a.getTileBoundingVolume(D,p.wrap,o,e);if(!x){let t=Ly(i,M,r);if(0===t)continue;x=2===t}let E=a.distanceToTile2d(n.x,n.y,D,M),A=h;l&&(A=(e.calculateTileZoom||Gy)(t.zoom+Ct(t.tileSize/e.tileSize),E,g,y,t.fov)),A=(e.roundZoom?Math.round:Math.floor)(A),A=Math.max(0,A);let F=Math.min(A,c);if(p.wrap=a.getWrap(s,D,p.wrap),p.zoom>=F){if(p.zoom<u)continue;let t=f-p.zoom,i=d[0]-.5-(_<<t),r=d[1]-.5-(v<<t),n=e.reparseOverscaled?Math.max(p.zoom,A):p.zoom;b.push({tileID:new cd(p.zoom===c?n:p.zoom,p.wrap,p.zoom,_,v),distanceSq:et([m[0]-.5-_,m[1]-.5-v]),tileDistanceToCamera:Math.sqrt(i*i+r*r)})}else for(let t=0;t<4;t++)w.push({zoom:p.zoom+1,x:(_<<1)+t%2,y:(v<<1)+(t>>1),wrap:p.wrap,fullyVisible:x})}return b.sort(((t,e)=>t.distanceSq-e.distanceSq)).map((t=>t.tileID))}function Zy(t){return"raster"===t||"image"===t||"video"===t}function Wy(t,e,i,r,n,s,o){if(!e.hasData())return!1;let{tileID:a,fadingRole:l,fadingDirection:h,fadingParentID:u}=e;if(0===l&&1===h&&u)return i[u.key]=u,!0;let c=Math.max(a.overscaledZ-n,s);for(let n=a.overscaledZ-1;n>=c;n--){let s=a.scaledTo(n),l=t.getLoadedTile(s);if(l)return e.setCrossFadeLogic({fadingRole:0,fadingDirection:1,fadingParentID:l.tileID,fadeEndTime:r+o}),l.setCrossFadeLogic({fadingRole:1,fadingDirection:0,fadeEndTime:r+o}),i[s.key]=s,!0}return!1}function Hy(t,e,i,r,n,s){if(!e.hasData())return!1;let o=e.tileID.children(n),a=Yy(t,e,o,i,r,n,s);if(a)return!0;for(let l of o)Yy(t,e,l.children(n),i,r,n,s)&&(a=!0);return a}function Yy(t,e,i,r,n,s,o){if(i[0].overscaledZ>=s)return!1;let a=!1;for(let s of i){let i=t.getLoadedTile(s);if(!i)continue;let{fadingRole:l,fadingDirection:h,fadingParentID:u}=i;(0!==l||0!==h||!u)&&(i.setCrossFadeLogic({fadingRole:0,fadingDirection:0,fadingParentID:e.tileID,fadeEndTime:n+o}),e.setCrossFadeLogic({fadingRole:1,fadingDirection:1,fadeEndTime:n+o})),r[s.key]=s,a=!0}return a}function Xy(t,e,i,r){let n=t.tileID;return!!t.selfFading||!t.hasData()&&(!!e.has(n)&&(t.setSelfFadeLogic(i+r),!0))}function Jy(t,e){t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.needsColorReliefPrepare=!0;let i=e.tileID.canonical.x-t.tileID.canonical.x,r=e.tileID.canonical.y-t.tileID.canonical.y,n=2**t.tileID.canonical.z,s=e.tileID.key;(0!==i||0!==r)&&(Math.abs(r)>1||(Math.abs(i)>1&&(1===Math.abs(i+n)?i+=n:1===Math.abs(i-n)&&(i-=n)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,i,r),t.neighboringTiles?.[s]&&(t.neighboringTiles[s].backfilled=!0))))}var Ky=class{constructor(){this._tiles={}}handleWrapJump(t){let e={};for(let i in this._tiles){let r=this._tiles[i];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+t),e[r.tileID.key]=r}this._tiles=e}setFeatureState(t,e,i){for(let r in this._tiles)this._tiles[r].setFeatureState(t,e,i)}getAllTiles(){return Object.values(this._tiles)}getAllIds(t=!1){return t?Object.values(this._tiles).map((t=>t.tileID)).sort(md).map((t=>t.key)):Object.keys(this._tiles)}getTileById(t){return this._tiles[t]}setTile(t,e){this._tiles[t]=e}deleteTileById(t){delete this._tiles[t]}getLoadedTile(t){let e=this.getTileById(t.key);return e?.hasData()?e:null}isIdRenderable(t,e=!1){return this.getTileById(t)?.isRenderable(e)}getRenderableIds(t=0,e){let i=[];for(let t of this.getAllIds())this.isIdRenderable(t,e)&&i.push(this.getTileById(t));return e?i.sort(((e,i)=>{let r=e.tileID,n=i.tileID,s=new u(r.canonical.x,r.canonical.y)._rotate(-t),o=new u(n.canonical.x,n.canonical.y)._rotate(-t);return r.overscaledZ-n.overscaledZ||o.y-s.y||o.x-s.x})).map((t=>t.tileID.key)):i.map((t=>t.tileID)).sort(md).map((t=>t.key))}},Qy=class t extends ye{static{this.maxUnderzooming=10}static{this.maxOverzooming=3}constructor(t,e,i){super(),this._maxContentElevationSeen=0,this.id=t,this.dispatcher=i,this.on("data",(t=>{this._dataHandler(t)})),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=((t,e,i,r)=>{let n=new((t=>{switch(t){case"geojson":return gy;case"image":return Ay;case"raster":return hy;case"raster-dem":return uy;case"vector":return ly;case"video":return zy;case"canvas":return Sy}return Cy[t]})(e.type))(t,e,i,r);if(n.id!==t)throw Error(`Expected Source id to be ${t} instead of ${n.id}`);return n})(t,e,i,this),this._inViewTiles=new Ky,this._outOfViewCache=new U_(0,(t=>this._unloadTile(t))),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new Ry,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source?.onAdd&&this._source.onAdd(t)}onRemove(t){for(let t of this._inViewTiles.getAllTiles())t.unloadVectorData();this.clearTiles(),this._source?.onRemove&&this._source.onRemove(t),this._inViewTiles=new Ky}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(void 0===this.used&&void 0===this.usedForTerrain||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(let t of this._inViewTiles.getAllTiles())if("loaded"!==t.state&&"errored"!==t.state)return!1;return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;let t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}async _loadTile(t,e,i,r){try{let n=await this._source.loadTile(t);this._tileLoaded(t,e,i,r,n)}catch(e){t.state="errored",404===e.status?this.update(this.transform,this.terrain):this._source.fire(new ge(nt(e),{tile:t}))}}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new ig("dataabort",{tile:t,coord:t.tileID}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null);for(let e of this._inViewTiles.getAllTiles())e.upload(t),e.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(t){return this._inViewTiles.getRenderableIds(this.transform?.bearingInRadians,t)}hasRenderableParent(t){let e=t.overscaledZ-1;if(e>=this._source.minzoom){let i=this.getLoadedTile(t.scaledTo(e));if(i)return this._inViewTiles.isIdRenderable(i.tileID.key)}return!1}reload(t,e){if(this._paused)this._shouldReloadOnResume=!0;else{this._outOfViewCache.reset();for(let i of this._inViewTiles.getAllIds()){let r=this._inViewTiles.getTileById(i);(!e||this._source.shouldReloadTile(r,e))&&(t?this._reloadTile(i,"errored"===r.state?"loading":"expired"):"errored"!==r.state&&this._reloadTile(i,"reloading"))}}}async _reloadTile(t,e){let i=this._inViewTiles.getTileById(t);if(!i)return;let r=i.hasData();"loading"!==i.state&&(i.state=e),await this._loadTile(i,t,e,r)}_tileLoaded(t,e,i,r,n){r||(t.timeAdded=H_(),t.selfFading&&(t.fadeEndTime=t.timeAdded+this._rasterFadeDuration)),"expired"===i&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(e,t),!n?.unmodified&&("raster-dem"===this.getSource().type&&t.dem&&function(t,e){let i=e.getRenderableIds();for(let r of i){if(!t.neighboringTiles?.[r])continue;let i=e.getTileById(r);t.neighboringTiles[r].backfilled||Jy(t,i),!i.neighboringTiles?.[t.tileID.key]?.backfilled&&Jy(i,t)}}(t,this._inViewTiles),t.featureStateRevision=-1,this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new ig("data",{tile:t,coord:t.tileID})))}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._inViewTiles.getTileById(t)}_retainLoadedChildren(e,i){let r=this._getLoadedDescendents(i),n=new Set;for(let s of i){let i=r[s.key];if(!i?.length){n.add(s);continue}let o=s.overscaledZ+t.maxOverzooming,a=i.filter((t=>t.tileID.overscaledZ<=o));if(!a.length){n.add(s);continue}let l=Math.min(...a.map((t=>t.tileID.overscaledZ))),h=a.filter((t=>t.tileID.overscaledZ===l)).map((t=>t.tileID));for(let t of h)e[t.key]=t;this._areDescendentsComplete(h,l,s.overscaledZ)||n.add(s)}return n}_getLoadedDescendents(t){let e={};for(let i of this._inViewTiles.getAllTiles().filter((t=>t.hasData())))for(let r of t)i.tileID.isChildOf(r)&&(e[r.key]||=[],e[r.key].push(i));return e}_areDescendentsComplete(t,e,i){return 1===t.length&&t[0].isOverscaled()?t[0].overscaledZ===e:4**(e-i)===t.length}getLoadedTile(t){return this._inViewTiles.getLoadedTile(t)}updateCacheSize(t){let e=(Math.ceil(t.width/this._source.tileSize)+1)*(Math.ceil(t.height/this._source.tileSize)+1),i=Math.floor(e*(null===this._maxTileCacheZoomLevels?se.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),r="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,i):i;this._outOfViewCache.setMaxSize(r)}handleWrapJump(t){let e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);this._prevLng=t,e&&(this._inViewTiles.handleWrapJump(e),this._resetTileReloadTimers())}_updateMaxContentElevation(){let t=this._maxContentElevationSeen,e=this.map?.style?._layers;if(!e)return t;let i=this._inViewTiles.getAllTiles();for(let r in e){let n=e[r];if("symbol"===n.type&&n.source===this.id&&!n.isHidden(this.transform.zoom)&&n.layout){t=Math.max(t,n.layout.get("symbol-height-offset").constantOr(0));for(let e of i){let i=e.getBucket(n);i&&i.maxHeightOffset>t&&(t=i.maxHeightOffset)}}}return this._maxContentElevationSeen=t,t}update(t,e){if(!this._sourceLoaded||this._paused)return;let i;this.transform=t,this.terrain=e,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?i=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((t=>new cd(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y))):(i=Vy(t,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:"vector"===this._source.type&&void 0!==this.map._zoomLevelsToOverscale?Math.max(this._source.maxzoom,t.maxZoom-this.map._zoomLevelsToOverscale):this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:e,calculateTileZoom:this._source.calculateTileZoom,maxContentElevation:this._updateMaxContentElevation()}),this._source.hasTile&&(i=i.filter((t=>this._source.hasTile(t))))):i=[],this.usedForTerrain&&(i=this._addTerrainIdealTiles(i));let r=0===i.length&&!this._updated&&this._didEmitContent;this._updated=!0,r&&this.fire(new ig("data",{sourceDataType:"idle",sourceId:this.id}));let n=qy(t,this._source),s=this._updateRetainedTiles(i,n),o=Zy(this._source.type);o&&this._rasterFadeDuration>0&&!e&&function(t,e,i,r,n,s,o){let a=H_(),l=function(t){if(!t.length)return new Set;let e=Math.max(...t.map((t=>t.canonical.z))),i=1/0,r=-1/0,n=1/0,s=-1/0,o=[];for(let a of t){let{x:t,y:l,z:h}=a.canonical,u=2**(e-h),c=t*u,f=l*u;o.push({id:a,x:c,y:f}),c<i&&(i=c),c>r&&(r=c),f<n&&(n=f),f>s&&(s=f)}let a=new Set;for(let t of o)(t.x===i||t.x===r||t.y===n||t.y===s)&&a.add(t.id);return a}(e);for(let h of e){let e=t.getTileById(h.key);(0===e.fadingDirection||0===e.fadeOpacity)&&e.resetFadeLogic(),!Wy(t,e,i,a,r,n,o)&&(Hy(t,e,i,a,s,o)||Xy(e,l,a,o)||e.resetFadeLogic())}}(this._inViewTiles,i,s,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),o?this._cleanUpRasterTiles(s):this._cleanUpVectorTiles(s)}_cleanUpRasterTiles(t){for(let e of this._inViewTiles.getAllIds())t[e]||this._removeTile(e)}_cleanUpVectorTiles(t){for(let e of this._inViewTiles.getAllIds()){let i=this._inViewTiles.getTileById(e);t[e]?i.clearSymbolFadeHold():i.hasSymbolBuckets?i.holdingForSymbolFade()?i.symbolFadeFinished()&&this._removeTile(e):i.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(e)}}_addTerrainIdealTiles(t){let e=[];for(let i of t)if(i.canonical.z>this._source.minzoom){let t=i.scaledTo(i.canonical.z-1);e.push(t);let r=i.scaledTo(Math.max(this._source.minzoom,Math.min(i.canonical.z,5)));e.push(r)}return t.concat(e)}releaseSymbolFadeTiles(){for(let t of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(t).holdingForSymbolFade()&&this._removeTile(t)}_updateRetainedTiles(e,i){let r=new Set;for(let t of e)this._addTile(t).hasData()||r.add(t);let n=e.reduce(((t,e)=>(t[e.key]=e,t)),{}),s=this._retainLoadedChildren(n,r),o={},a=Math.max(i-t.maxUnderzooming,this._source.minzoom);for(let t of s){let e=this._inViewTiles.getTileById(t.key),i=e?.wasRequested();for(let r=t.overscaledZ-1;r>=a;--r){let s=t.scaledTo(r);if(o[s.key])break;if(o[s.key]=!0,e=this.getTile(s),!e&&i&&(e=this._addTile(s)),e){let t=e.hasData();if((t||!this.map?.cancelPendingTileRequestsWhileZooming||i)&&(n[s.key]=s),i=e.wasRequested(),t)break}}}return n}_addTile(t){let e=this._inViewTiles.getTileById(t.key);if(e)return e;e=this._outOfViewCache.getAndRemove(t),e&&(e.resetFadeLogic(),this._setTileReloadTimer(t.key,e),e.tileID=t,this._state.initializeTileState(e,this.map?this.map.painter:null));let i=e;return e||(e=new $y(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(e,t.key,e.state,!1)),e.uses++,this._inViewTiles.setTile(t.key,e),i||this._source.fire(new ig("dataloading",{tile:e,coord:e.tileID})),e}_setTileReloadTimer(t,e){this._clearTileReloadTimer(t);let i=e.getExpiryTimeout();i&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,"expired"),delete this._timers[t]}),i))}_clearTileReloadTimer(t){let e=this._timers[t];e&&(clearTimeout(e),delete this._timers[t])}_resetTileReloadTimers(){for(let t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(let t of this._inViewTiles.getAllIds()){let e=this._inViewTiles.getTileById(t);this._setTileReloadTimer(t,e)}}refreshTiles(t){for(let e of this._inViewTiles.getAllIds()){let i=this._inViewTiles.getTileById(e);(this._inViewTiles.isIdRenderable(e)||"errored"==i.state)&&t.some((t=>t.equals(i.tileID.canonical)))&&this._reloadTile(e,"expired")}}_removeTile(t){let e=this._inViewTiles.getTileById(t);e&&(e.uses--,this._inViewTiles.deleteTileById(t),this._clearTileReloadTimer(t),!(e.uses>0)&&(e.hasData()&&"reloading"!==e.state?this._outOfViewCache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))}_dataHandler(t){if("source"===t.dataType){if("metadata"===t.sourceDataType)return void(this._sourceLoaded=!0);"content"===t.sourceDataType&&this._sourceLoaded&&!this._paused&&(this.reload(t.sourceDataChanged,t.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}}resetMaxContentElevation(){this._maxContentElevationSeen=0}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1,this.resetMaxContentElevation();for(let t of this._inViewTiles.getAllIds())this._removeTile(t);this._outOfViewCache.reset()}tilesIn(t,e,i){let r=[],n=this.transform;if(!n)return r;let s=n.getCoveringTilesDetailsProvider().allowWorldCopies(),o=i?n.getCameraQueryGeometry(t):t,a=t=>n.screenPointToMercatorCoordinate(t,this.terrain),l=this.transformBbox(t,a,!s),h=this.transformBbox(o,a,!s),u=this.getIds(),c=Fu.fromPoints(h);for(let t of u){let i=this._inViewTiles.getTileById(t);if(i.holdingForSymbolFade())continue;let o=s?[i.tileID]:[i.tileID.unwrapTo(-1),i.tileID.unwrapTo(0)],a=2**(n.zoom-i.tileID.overscaledZ),u=e*i.queryPadding*it/i.tileSize/a;for(let t of o){let e=c.map((e=>t.getTilePoint(new Wu(e.x,e.y))));if(e.expandBy(u),e.intersects(zu)){let e=l.map((e=>t.getTilePoint(e))),n=h.map((e=>t.getTilePoint(e)));r.push({tile:i,tileID:s?t:t.unwrapTo(0),queryGeometry:e,cameraQueryGeometry:n,scale:a})}}}return r}transformBbox(t,e,i){let r=t.map(e);if(i){let i=Fu.fromPoints(t);i.shrinkBy(.001*Math.min(i.width(),i.height()));let n=i.map(e);Fu.fromPoints(r).covers(n)||(r=r.map((t=>t.x>.5?new Wu(t.x-1,t.y,t.z):t)))}return r}getVisibleCoordinates(t){let e=this.getRenderableIds(t).map((t=>this._inViewTiles.getTileById(t).tileID));return this.transform&&this.transform.populateCache(e),e}hasTransition(){return!!this._source.hasTransition()||Zy(this._source.type)&&function(t,e){if(e<=0)return!1;let i=H_();for(let e of t.getAllTiles())if(e.fadeEndTime>=i)return!0;return!1}(this._inViewTiles,this._rasterFadeDuration)}setRasterFadeDuration(t){this._rasterFadeDuration=t}setFeatureState(t,e,i){t||=_d,this._state.updateState(t,e,i)}removeFeatureState(t,e,i){t||=_d,this._state.removeFeatureState(t,e,i)}getFeatureState(t,e){return t||=_d,this._state.getState(t,e)}setDependencies(t,e,i){let r=this._inViewTiles.getTileById(t);r&&r.setDependencies(e,i)}reloadTilesForDependencies(t,e){for(let i of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(i).hasDependency(t,e)&&this._reloadTile(i,"reloading");this._outOfViewCache.filter((i=>!i.hasDependency(t,e)))}areTilesLoaded(){for(let t of this._inViewTiles.getAllTiles())if("loaded"!==t.state&&"errored"!==t.state)return!1;return!0}},tv=class{constructor(t,e){this.reset(t,e)}reset(t,e){this.points=t||[],this._distances=[0];for(let t=1;t<this.points.length;t++)this._distances[t]=this._distances[t-1]+this.points[t].dist(this.points[t-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(e||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(1===this.points.length)return this.points[0];t=Dt(t,0,1);let e=1,i=this._distances[e],r=t*this.paddedLength+this.padding;for(;i<r&&e<this._distances.length;)i=this._distances[++e];let n=e-1,s=this._distances[n],o=i-s,a=o>0?(r-s)/o:0;return this.points[n].mult(1-a).add(this.points[e].mult(a))}};function ev(t,e,i,r,n){return n?t?t(e,i)+r:0===r?void 0:r:r}function iv(t,e){let i=!0;return"always"===t||("never"===t||"never"===e)&&(i=!1),i}var rv=class{constructor(t,e,i){let r=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(t/i),this.yCellCount=Math.ceil(e/i);for(let t=0;t<this.xCellCount*this.yCellCount;t++)r.push([]),n.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=e,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/e,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,e,i,r,n){this._forEachCell(e,i,r,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)}insertCircle(t,e,i,r){this._forEachCell(e-r,i-r,e+r,i+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(i),this.circles.push(r)}_insertBoxCell(t,e,i,r,n,s){this.boxCells[n].push(s)}_insertCircleCell(t,e,i,r,n,s){this.circleCells[n].push(s)}_query(t,e,i,r,n,s,o){if(i<0||t>this.width||r<0||e>this.height)return[];let a=[];if(t<=0&&e<=0&&this.width<=i&&this.height<=r){if(n)return[{key:null,x1:t,y1:e,x2:i,y2:r}];for(let t=0;t<this.boxKeys.length;t++)a.push({key:this.boxKeys[t],x1:this.bboxes[4*t],y1:this.bboxes[4*t+1],x2:this.bboxes[4*t+2],y2:this.bboxes[4*t+3]});for(let t=0;t<this.circleKeys.length;t++){let e=this.circles[3*t],i=this.circles[3*t+1],r=this.circles[3*t+2];a.push({key:this.circleKeys[t],x1:e-r,y1:i-r,x2:e+r,y2:i+r})}}else this._forEachCell(t,e,i,r,this._queryCell,a,{hitTest:n,overlapMode:s,seenUids:{box:{},circle:{}}},o);return a}query(t,e,i,r){return this._query(t,e,i,r,!1,null)}hitTest(t,e,i,r,n,s){return this._query(t,e,i,r,!0,n,s).length>0}hitTestCircle(t,e,i,r,n){let s=t-i,o=t+i,a=e-i,l=e+i;if(o<0||s>this.width||l<0||a>this.height)return!1;let h=[];return this._forEachCell(s,a,o,l,this._queryCellCircle,h,{hitTest:!0,overlapMode:r,circle:{x:t,y:e,radius:i},seenUids:{box:{},circle:{}}},n),h.length>0}_queryCell(t,e,i,r,n,s,o,a){let{seenUids:l,hitTest:h,overlapMode:u}=o,c=this.boxCells[n],f=1e-6;if(null!==c){let n=this.bboxes;for(let o of c)if(!l.box[o]){l.box[o]=!0;let c=4*o,p=this.boxKeys[o];if(t<=n[c+2]+f&&e<=n[c+3]+f&&i>=n[c+0]-f&&r>=n[c+1]-f&&(!a||a(p))&&(!h||!iv(u,p.overlapMode))&&(s.push({key:p,x1:n[c],y1:n[c+1],x2:n[c+2],y2:n[c+3]}),h))return!0}}let p=this.circleCells[n];if(null!==p){let n=this.circles;for(let o of p)if(!l.circle[o]){l.circle[o]=!0;let c=3*o,f=this.circleKeys[o];if(this._circleAndRectCollide(n[c],n[c+1],n[c+2],t,e,i,r)&&(!a||a(f))&&(!h||!iv(u,f.overlapMode))){let t=n[c],e=n[c+1],i=n[c+2];if(s.push({key:f,x1:t-i,y1:e-i,x2:t+i,y2:e+i}),h)return!0}}}return!1}_queryCellCircle(t,e,i,r,n,s,o,a){let{circle:l,seenUids:h,overlapMode:u}=o,c=this.boxCells[n];if(null!==c){let t=this.bboxes;for(let e of c)if(!h.box[e]){h.box[e]=!0;let i=4*e,r=this.boxKeys[e];if(this._circleAndRectCollide(l.x,l.y,l.radius,t[i+0],t[i+1],t[i+2],t[i+3])&&(!a||a(r))&&!iv(u,r.overlapMode))return s.push(!0),!0}}let f=this.circleCells[n];if(null!==f){let t=this.circles;for(let e of f)if(!h.circle[e]){h.circle[e]=!0;let i=3*e,r=this.circleKeys[e];if(this._circlesCollide(t[i],t[i+1],t[i+2],l.x,l.y,l.radius)&&(!a||a(r))&&!iv(u,r.overlapMode))return s.push(!0),!0}}}_forEachCell(t,e,i,r,n,s,o,a){let l=this._convertToXCellCoord(t),h=this._convertToYCellCoord(e),u=this._convertToXCellCoord(i),c=this._convertToYCellCoord(r);for(let f=l;f<=u;f++)for(let l=h;l<=c;l++)if(n.call(this,t,e,i,r,this.xCellCount*l+f,s,o,a))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,e,i,r,n,s){let o=r-t,a=n-e,l=i+s;return l*l>o*o+a*a}_circleAndRectCollide(t,e,i,r,n,s,o){let a=(s-r)/2,l=Math.abs(t-(r+a));if(l>a+i)return!1;let h=(o-n)/2,u=Math.abs(e-(n+h));if(u>h+i)return!1;if(l<=a||u<=h)return!0;let c=l-a,f=u-h;return c*c+f*f<=i*i}};function nv(t,e){let i=1/(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]),r=1/(e[8]*e[8]+e[9]*e[9]+e[10]*e[10]),n=e[0]*i,s=e[4]*i,o=e[8]*r,a=e[1]*i,l=e[5]*i,h=e[9]*r,u=e[2]*i,c=e[6]*i,f=e[10]*r;t[0]=n,t[1]=s,t[2]=o,t[4]=a,t[5]=l,t[6]=h,t[8]=u,t[9]=c,t[10]=f;let p=e[12],d=e[13],m=e[14];return t[12]=-n*p-a*d-u*m,t[13]=-s*p-l*d-c*m,t[14]=-o*p-h*d-f*m,t[3]=0,t[7]=0,t[11]=0,t[15]=1,t}const sv=g();function ov(t,e,i){let r=g();if(!t){let{vecSouth:t,vecEast:i}=lv(e),n=N_();n[0]=i[0],n[1]=i[1],n[2]=t[0],n[3]=t[1],function(t,e){var i=e[0],r=e[1],n=e[2],s=e[3],o=i*s-n*r;o&&(t[0]=s*(o=1/o),t[1]=-r*o,t[2]=-n*o,t[3]=i*o)}(n,n),r[0]=n[0],r[1]=n[1],r[4]=n[2],r[5]=n[3]}return D(r,r,[1/i,1/i,1]),r}function av(t,e,i,r){if(t){let t=g();if(!e){let{vecSouth:e,vecEast:r}=lv(i);t[0]=r[0],t[1]=r[1],t[4]=e[0],t[5]=e[1]}return D(t,t,[r,r,1]),t}return i.pixelsToClipSpaceMatrix}function lv(t){let e=Math.cos(t.rollInRadians),i=Math.sin(t.rollInRadians),r=Math.cos(t.pitchInRadians),n=Math.cos(t.bearingInRadians),s=Math.sin(t.bearingInRadians),o=X();o[0]=-n*r*i-s*e,o[1]=-s*r*i+n*e;let a=Q(o);a<1e-9?tt(o):K(o,o,1/a);let l=X();l[0]=n*r*e-s*i,l[1]=s*r*e+n*i;let h=Q(l);return h<1e-9?tt(l):K(l,l,1/h),{vecEast:l,vecSouth:o}}function hv(t,e,i){return ev(t.getElevation,e,i,t.heightOffset??0,t.heightAnchorGround??!0)}function uv(t,e,i,r){let n;null==r?(n=[t,e,0,1],Fv(n,n,i)):(n=[t,e,r,1],Z(n,n,i));let s=n[3];return{point:new u(n[0]/s,n[1]/s),signedDistanceFromCamera:s,isOccluded:!1}}function cv(t,e){return.5+t/e*.5}function fv(t,e){return t.x>=-e[0]&&t.x<=e[0]&&t.y>=-e[1]&&t.y<=e[1]}function pv(t,e,i,r,n,s,o,a,l,h,c,f,p){let d=i?t.textSizeData:t.iconSizeData,m=up(d,e.transform.zoom),_=[256/e.width*2+1,256/e.height*2+1],g=i?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;g.clear();let y=t.lineVertexArray,v=i?t.text.placedSymbolArray:t.icon.placedSymbolArray,w=e.transform.width/e.transform.height,b=!1;for(let i=0;i<v.length;i++){let x=v.get(i);if(x.hidden||2===x.writingMode&&!b){Av(x.numGlyphs,g);continue}b=!1;let D=new u(x.anchorX,x.anchorY),M={getElevation:p,pitchedLabelPlaneMatrix:r,lineVertexArray:y,pitchWithMap:s,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:e.transform,tileAnchorPoint:D,unwrappedTileID:l,width:h,height:c,translation:f},E=bv(x.anchorX,x.anchorY,M);if(!fv(E.point,_)){Av(x.numGlyphs,g);continue}let A=cv(e.transform.cameraToCenterDistance,E.signedDistanceFromCamera),F=hp(d,m,x),z=s?F*e.transform.getPitchedTextCorrection(x.anchorX,x.anchorY,l)/A:F*A,S=_v({projectionContext:M,pitchedLabelPlaneMatrixInverse:n,symbol:x,fontSize:z,flip:!1,keepUpright:o,glyphOffsetArray:t.glyphOffsetArray,dynamicLayoutVertexArray:g,aspectRatio:w,rotateToLine:a});b=S.useVertical,(S.notEnoughRoom||b||S.needsFlipping&&_v({projectionContext:M,pitchedLabelPlaneMatrixInverse:n,symbol:x,fontSize:z,flip:!0,keepUpright:o,glyphOffsetArray:t.glyphOffsetArray,dynamicLayoutVertexArray:g,aspectRatio:w,rotateToLine:a}).notEnoughRoom)&&Av(x.numGlyphs,g)}i?t.text.dynamicLayoutVertexBuffer.updateData(g):t.icon.dynamicLayoutVertexBuffer.updateData(g)}function dv(t,e,i,r,n,s,o,a){let l=s.glyphStartIndex+s.numGlyphs,h=s.lineStartIndex,u=s.lineStartIndex+s.lineLength,c=e.getoffsetX(s.glyphStartIndex),f=e.getoffsetX(l-1),p=Mv(t*c,i,r,n,s.segment,h,u,a,o);if(!p)return null;let d=Mv(t*f,i,r,n,s.segment,h,u,a,o);return!d||a.projectionCache.anyProjectionOccluded?null:{first:p,last:d}}function mv(t,e,i,r){return 1===t&&Math.abs(i.y-e.y)>Math.abs(i.x-e.x)*r?{useVertical:!0}:(2===t?e.y<i.y:e.x>i.x)?{needsFlipping:!0}:null}function _v(t){let e,{projectionContext:i,pitchedLabelPlaneMatrixInverse:r,symbol:n,fontSize:s,flip:o,keepUpright:a,glyphOffsetArray:l,dynamicLayoutVertexArray:h,aspectRatio:c,rotateToLine:f}=t,p=s/24,d=n.lineOffsetX*p,m=n.lineOffsetY*p;if(n.numGlyphs>1){let t=n.glyphStartIndex+n.numGlyphs,s=n.lineStartIndex,h=n.lineStartIndex+n.lineLength,u=dv(p,l,d,m,o,n,f,i);if(!u)return{notEnoughRoom:!0};let _=wv(u.first.point.x,u.first.point.y,i,r),g=wv(u.last.point.x,u.last.point.y,i,r);if(a&&!o){let t=mv(n.writingMode,_,g,c);if(t)return t}e=[u.first];for(let r=n.glyphStartIndex+1;r<t-1;r++){let t=Mv(p*l.getoffsetX(r),d,m,o,n.segment,s,h,i,f);if(!t)return{notEnoughRoom:!0};e.push(t)}e.push(u.last)}else{if(a&&!o){let t=vv(i.tileAnchorPoint.x,i.tileAnchorPoint.y,i).point,e=n.lineStartIndex+n.segment+1,s=new u(i.lineVertexArray.getx(e),i.lineVertexArray.gety(e)),o=vv(s.x,s.y,i),a=o.signedDistanceFromCamera>0?o.point:gv(i.tileAnchorPoint,s,t,1,i),l=wv(t.x,t.y,i,r),h=wv(a.x,a.y,i,r),f=mv(n.writingMode,l,h,c);if(f)return f}let t=Mv(p*l.getoffsetX(n.glyphStartIndex),d,m,o,n.segment,n.lineStartIndex,n.lineStartIndex+n.lineLength,i,f);if(!t||i.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};e=[t]}for(let t of e)Gp(h,t.point,t.angle);return{}}function gv(t,e,i,r,n){let s=t.add(t.sub(e)._unit()),o=vv(s.x,s.y,n).point,a=i.sub(o);return i.add(a._mult(r/a.mag()))}function yv(t,e,i){let r=e.projectionCache;if(r.projections[t])return r.projections[t];let n=new u(e.lineVertexArray.getx(t),e.lineVertexArray.gety(t)),s=vv(n.x,n.y,e);if(s.signedDistanceFromCamera>0)return r.projections[t]=s.point,r.anyProjectionOccluded||=s.isOccluded,s.point;let o=t-i.direction;return gv(0===i.distanceFromAnchor?e.tileAnchorPoint:new u(e.lineVertexArray.getx(o),e.lineVertexArray.gety(o)),n,i.previousVertex,i.absOffsetX-i.distanceFromAnchor+1,e)}function vv(t,e,i){let r,n=t+i.translation[0],s=e+i.translation[1];return i.pitchWithMap?(r=uv(n,s,i.pitchedLabelPlaneMatrix,hv(i,n,s)),r.isOccluded=!1):(r=i.transform.projectTileCoordinates(n,s,i.unwrappedTileID,hv(i,n,s)),r.point.x=(.5*r.point.x+.5)*i.width,r.point.y=(.5*-r.point.y+.5)*i.height),r}function wv(t,e,i,r){if(i.pitchWithMap){let n=[t,e,0,1];Z(n,n,r);let s=n[0]/n[3],o=n[1]/n[3];return i.transform.projectTileCoordinates(s,o,i.unwrappedTileID,hv(i,s,o)).point}return{x:t/i.width*2-1,y:1-e/i.height*2}}function bv(t,e,i){return i.transform.projectTileCoordinates(t,e,i.unwrappedTileID,hv(i,t,e))}function xv(t,e,i){return t._unit()._perp()._mult(e*i)}function Dv(t,e,i,r,n,s,o,a,l){if(a.projectionCache.offsets[t])return a.projectionCache.offsets[t];let h=i.add(e);if(t+l.direction<r||t+l.direction>=n)return a.projectionCache.offsets[t]=h,h;let u=yv(t+l.direction,a,l),c=xv(u.sub(i),o,l.direction),f=i.add(c),p=u.add(c);return a.projectionCache.offsets[t]=Bt(s,h,f,p)||h,a.projectionCache.offsets[t]}function Mv(t,e,i,r,n,s,o,a,l){let h=r?t-e:t+e,u=h>0?1:-1,c=0;r&&(u*=-1,c=Math.PI),u<0&&(c+=Math.PI);let f,p=u>0?s+n:s+n+1;a.projectionCache.cachedAnchorPoint?f=a.projectionCache.cachedAnchorPoint:(f=vv(a.tileAnchorPoint.x,a.tileAnchorPoint.y,a).point,a.projectionCache.cachedAnchorPoint=f);let d,m,_,g=f,y=f,v=0,w=0,b=Math.abs(h),x=[];for(;v+w<=b;){if(p+=u,p<s||p>=o)return null;v+=w,y=g,m=d;let t={absOffsetX:b,direction:u,distanceFromAnchor:v,previousVertex:y};if(g=yv(p,a,t),0===i)x.push(y),_=g.sub(y);else{let e,r=g.sub(y);e=0===r.mag()?xv(yv(p+u,a,t).sub(g),i,u):xv(r,i,u),m||=y.add(e),d=Dv(p,e,g,s,o,m,i,a,t),x.push(m),_=d.sub(m)}w=_.mag()}let D=_._mult((b-v)/w)._add(m||y),M=c+Math.atan2(g.y-y.y,g.x-y.x);return x.push(D),{point:D,angle:l?M:0,path:x}}const Ev=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Av(t,e){for(let i=0;i<t;i++){let t=e.length;e.resize(t+4),e.float32.set(Ev,3*t)}}function Fv(t,e,i){let r=e[0],n=e[1];return t[0]=i[0]*r+i[4]*n+i[12],t[1]=i[1]*r+i[5]*n+i[13],t[3]=i[3]*r+i[7]*n+i[15],t}var zv=class{constructor(t,e=new rv(t.width+200,t.height+200,25),i=new rv(t.width+200,t.height+200,25)){this.transform=t,this.grid=e,this.ignoredGrid=i,this.pitchFactor=Math.cos(t.pitch*Math.PI/180)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+100,this.screenBottomBoundary=t.height+100,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,e,i,r,n,s,o,a,l,h,u,c,f=0,p=!0){let d,m=t.anchorPointX+a[0],_=t.anchorPointY+a[1],g=this.projectAndGetPerspectiveRatio(m,_,n,ev(h,m,_,f,p),c),y=i*g.perspectiveRatio;if(s||o)d=this._projectCollisionBox(t,y,r,n,s,o,a,g,h,u,c,f,p);else{let e=g.x+(u?u.x*y:0),i=g.y+(u?u.y*y:0);d={allPointsOccluded:!1,box:[e+t.x1*y,i+t.y1*y,e+t.x2*y,i+t.y2*y]}}let[v,w,b,x]=d.box,D=s?d.allPointsOccluded:g.isOccluded,M=D;return M||=g.perspectiveRatio<this.perspectiveRatioCutoff,M||=!this.isInsideGrid(v,w,b,x),M||"always"!==e&&this.grid.hitTest(v,w,b,x,e,l)?{box:[v,w,b,x],placeable:!1,offscreen:!1,occluded:D}:{box:[v,w,b,x],placeable:!0,offscreen:this.isOffscreen(v,w,b,x),occluded:D}}placeCollisionCircles(t,e,i,r,n,s,o,a,l,h,c,f,p,d){let m=[],_=new u(e.anchorX,e.anchorY),g=this.getPerspectiveRatio(_.x,_.y,s,d?.(_.x,_.y)),y=(l?n*this.transform.getPitchedTextCorrection(e.anchorX,e.anchorY,s)/g:n*g)/24,v={getElevation:d,pitchedLabelPlaneMatrix:o,lineVertexArray:i,pitchWithMap:l,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:_,unwrappedTileID:s,width:this.transform.width,height:this.transform.height,translation:p},w=dv(y,r,e.lineOffsetX*y,e.lineOffsetY*y,!1,e,!1,v),b=!1,x=!1,D=!0;if(w){let e=.5*c*g+f,i=new u(-100,-100),r=new u(this.screenRightBoundary,this.screenBottomBoundary),n=new tv,s=w.first,o=w.last,p=[];for(let t=s.path.length-1;t>=1;t--)p.push(s.path[t]);for(let t=1;t<o.path.length;t++)p.push(o.path[t]);let d=2.5*e;if(l){let t=this.projectPathToScreenSpace(p,v);p=t.some((t=>t.signedDistanceFromCamera<=0))?[]:t.map((t=>t.point))}let _=[];if(p.length>0){let t=p[0].clone(),e=p[0].clone();for(let i=1;i<p.length;i++)t.x=Math.min(t.x,p[i].x),t.y=Math.min(t.y,p[i].y),e.x=Math.max(e.x,p[i].x),e.y=Math.max(e.y,p[i].y);_=t.x>=i.x&&e.x<=r.x&&t.y>=i.y&&e.y<=r.y?[p]:e.x<i.x||t.x>r.x||e.y<i.y||t.y>r.y?[]:vp([p],i.x,i.y,r.x,r.y)}for(let i of _){n.reset(i,.25*e);let r=0;r=n.length<=.5*e?1:Math.ceil(n.paddedLength/d)+1;for(let i=0;i<r;i++){let s=i/Math.max(r-1,1),o=n.lerp(s),l=o.x+100,u=o.y+100;m.push(l,u,e,0);let c=l-e,f=u-e,p=l+e,d=u+e;if(D&&=this.isOffscreen(c,f,p,d),x||=this.isInsideGrid(c,f,p,d),"always"!==t&&this.grid.hitTestCircle(l,u,e,t,h)&&(b=!0,!a))return{circles:[],offscreen:!1,collisionDetected:b}}}}return{circles:!a&&b||!x||g<this.perspectiveRatioCutoff?[]:m,offscreen:D,collisionDetected:b}}projectPathToScreenSpace(t,e){return function(t){let e=0,i=0,r=0,n=0;for(let s=0;s<t.length;s++)t[s].isOccluded?(r=s+1,n=0):(n++,n>i&&(i=n,e=r));return t.slice(e,e+i)}(function(t,e){let i=sv;return function(t,e){let i=1/(e[0]*e[5]-e[1]*e[4]);t[0]=e[5]*i,t[1]=-e[1]*i,t[2]=0,t[3]=0,t[4]=-e[4]*i,t[5]=e[0]*i,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1/e[10],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1/e[15]}(i,e.pitchedLabelPlaneMatrix),t.map((t=>{let r=uv(t.x,t.y,i,hv(e,t.x,t.y)),n=e.transform.projectTileCoordinates(r.point.x,r.point.y,e.unwrappedTileID,hv(e,r.point.x,r.point.y));return n.point.x=(.5*n.point.x+.5)*e.width,n.point.y=(.5*-n.point.y+.5)*e.height,n}))}(t,e))}queryRenderedSymbols(t){if(0===t.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};let e=[],i=new Fu;for(let r of t){let t=new u(r.x+100,r.y+100);i.extend(t),e.push(t)}let{minX:r,minY:n,maxX:s,maxY:o}=i,a=this.grid.query(r,n,s,o).concat(this.ignoredGrid.query(r,n,s,o)),l={},h={};for(let t of a){let i=t.key;void 0===l[i.bucketInstanceId]&&(l[i.bucketInstanceId]={}),l[i.bucketInstanceId][i.featureIndex]||Al(e,[new u(t.x1,t.y1),new u(t.x2,t.y1),new u(t.x2,t.y2),new u(t.x1,t.y2)])&&(l[i.bucketInstanceId][i.featureIndex]=!0,void 0===h[i.bucketInstanceId]&&(h[i.bucketInstanceId]=[]),h[i.bucketInstanceId].push(i.featureIndex))}return h}insertCollisionBox(t,e,i,r,n,s){(i?this.ignoredGrid:this.grid).insert({bucketInstanceId:r,featureIndex:n,collisionGroupID:s,overlapMode:e},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,e,i,r,n,s){let o=i?this.ignoredGrid:this.grid,a={bucketInstanceId:r,featureIndex:n,collisionGroupID:s,overlapMode:e};for(let e=0;e<t.length;e+=4)o.insertCircle(a,t[e],t[e+1],t[e+2])}projectAndGetPerspectiveRatio(t,e,i,r,n){if(n){let i;null==r?(i=[t,e,0,1],Fv(i,i,n)):(i=[t,e,r,1],Z(i,i,n));let s=i[3];return{x:(i[0]/s+1)/2*this.transform.width+100,y:(-i[1]/s+1)/2*this.transform.height+100,perspectiveRatio:.5+this.transform.cameraToCenterDistance/s*.5,isOccluded:!1,signedDistanceFromCamera:s}}{let n=this.transform.projectTileCoordinates(t,e,i,r);return{x:(n.point.x+1)/2*this.transform.width+100,y:(1-n.point.y)/2*this.transform.height+100,perspectiveRatio:.5+this.transform.cameraToCenterDistance/n.signedDistanceFromCamera*.5,isOccluded:n.isOccluded,signedDistanceFromCamera:n.signedDistanceFromCamera}}}getPerspectiveRatio(t,e,i,r){let n=this.transform.projectTileCoordinates(t,e,i,r);return.5+this.transform.cameraToCenterDistance/n.signedDistanceFromCamera*.5}isOffscreen(t,e,i,r){return i<100||t>=this.screenRightBoundary||r<100||e>this.screenBottomBoundary}isInsideGrid(t,e,i,r){return i>=0&&t<this.gridRightBoundary&&r>=0&&e<this.gridBottomBoundary}getViewportMatrix(){let t=v([]);return x(t,t,[-100,-100,0]),t}_projectCollisionBox(t,e,i,r,n,s,o,a,l,h,c,f=0,p=!0){let d=1,m=0,_=0,g=1,y=t.anchorPointX+o[0],v=t.anchorPointY+o[1];if(s&&!n){let t=this.projectAndGetPerspectiveRatio(y+1,v,r,ev(l,y+1,v,f,p),c),e=t.x-a.x,i=Math.atan((t.y-a.y)/e)+(e<0?Math.PI:0),n=Math.sin(i),s=Math.cos(i);d=s,m=n,_=-n,g=s}else if(!s&&n){let t=lv(this.transform);d=t.vecEast[0],m=t.vecEast[1],_=t.vecSouth[0],g=t.vecSouth[1]}let w=a.x,b=a.y,x=e;n&&(w=y,b=v,x=2**-(this.transform.zoom-i.overscaledZ),x*=this.transform.getPitchedTextCorrection(y,v,r),!h)&&(x*=Dt(.5+a.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4)),h&&(w+=d*h.x*x+_*h.y*x,b+=m*h.x*x+g*h.y*x);let D=t.x1*x,M=t.x2*x,E=(D+M)/2,A=t.y1*x,F=t.y2*x,z=(A+F)/2,S=[{offsetX:D,offsetY:A},{offsetX:E,offsetY:A},{offsetX:M,offsetY:A},{offsetX:M,offsetY:z},{offsetX:M,offsetY:F},{offsetX:E,offsetY:F},{offsetX:D,offsetY:F},{offsetX:D,offsetY:z}],C=[];for(let{offsetX:t,offsetY:e}of S)C.push(new u(w+d*t+_*e,b+m*t+g*e));let T=!1;if(n){let t=C.map((t=>this.projectAndGetPerspectiveRatio(t.x,t.y,r,ev(l,t.x,t.y,f,p),c)));T=t.some((t=>!t.isOccluded)),C=t.map((t=>new u(t.x,t.y)))}else T=!0;return{box:wt(C),allPointsOccluded:!T}}},Sv=class{constructor(t,e,i,r){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):r&&i?1:0,this.placed=i}isHidden(){return 0===this.opacity&&!this.placed}},Cv=class{constructor(t,e,i,r,n){this.text=new Sv(t?t.text:null,e,i,n),this.icon=new Sv(t?t.icon:null,e,r,n)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}},Tv=class{constructor(t,e,i){this.text=t,this.icon=e,this.skipFade=i}},Pv=class{constructor(t,e,i,r,n){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=i,this.bucketIndex=r,this.tileID=n}},Iv=class{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){let e=++this.maxGroupID;this.collisionGroups[t]={ID:e,predicate:t=>t.collisionGroupID===e}}return this.collisionGroups[t]}};function kv(t,e,i,r,n){let{horizontalAlign:s,verticalAlign:o}=Wf(t);return new u(-(s-.5)*e+r[0]*n,-(o-.5)*i+r[1]*n)}var $v=class{constructor(t,e,i,r,n){this.transform=t.clone(),this.terrain=e,this.collisionIndex=new zv(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new Iv(r),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){let e=this.terrain;if(e)return(i,r)=>e.getElevation(t,i,r)}getBucketParts(t,e,i,r){let n=i.getBucket(e),s=i.latestFeatureIndex;if(!n||!s||e.id!==n.layerIds[0])return;let o=i.collisionBoxArray,a=n.layers[0].layout,l=n.layers[0].paint,h=2**(this.transform.zoom-i.tileID.overscaledZ),u=i.tileSize/it,c=i.tileID.toUnwrapped(),f="map"===a.get("text-rotation-alignment"),p=rt(i,1,this.transform.zoom),d=ut(this.collisionIndex.transform,i,l.get("text-translate"),l.get("text-translate-anchor")),m=ut(this.collisionIndex.transform,i,l.get("icon-translate"),l.get("icon-translate-anchor")),_=ov(f,this.transform,p);this.retainedQueryData[n.bucketInstanceId]=new Pv(n.bucketInstanceId,s,n.sourceLayerIndex,n.index,i.tileID);let g={bucket:n,layout:a,translationText:d,translationIcon:m,unwrappedTileID:c,pitchedLabelPlaneMatrix:_,scale:h,textPixelRatio:u,holdingForFade:i.holdingForSymbolFade(),collisionBoxArray:o,partiallyEvaluatedTextSize:up(n.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(n.sourceID)};if(r)for(let e of n.sortKeyRanges){let{sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:n}=e;t.push({sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:n,parameters:g})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:n.symbolInstances.length,parameters:g})}attemptAnchorPlacement(t,e,i,r,n,s,o,a,l,h,u,c,f,p,d,m,_,g,y,v,w,b){let x=Tp[t.textAnchor],D=[t.textOffset0,t.textOffset1],M=kv(x,i,r,D,n),E=this.collisionIndex.placeCollisionBox(e,c,a,l,h,o,s,m,u.predicate,y,M,v,w,b);if((!g||this.collisionIndex.placeCollisionBox(g,c,a,l,h,o,s,_,u.predicate,y,M,v,w,b).placeable)&&E.placeable){let t;if(this.prevPlacement?.variableOffsets[f.crossTileID]&&this.prevPlacement?.placements[f.crossTileID]?.text&&(t=this.prevPlacement.variableOffsets[f.crossTileID].anchor),0===f.crossTileID)throw Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[f.crossTileID]={textOffset:D,width:i,height:r,anchor:x,textBoxScale:n,prevAnchor:t},this.markUsedJustification(p,x,f,d),p.allowVerticalPlacement&&(this.markUsedOrientation(p,d,f),this.placedOrientations[f.crossTileID]=d),{shift:M,placedGlyphBoxes:E}}}placeLayerBucketPart(t,e,i){let{bucket:r,layout:n,translationText:s,translationIcon:o,unwrappedTileID:a,pitchedLabelPlaneMatrix:l,textPixelRatio:h,holdingForFade:u,collisionBoxArray:c,partiallyEvaluatedTextSize:f,collisionGroup:p}=t.parameters,d=n.get("text-optional"),m=n.get("icon-optional"),_=Lp(n,"text-overlap","text-allow-overlap"),g="always"===_,y=Lp(n,"icon-overlap","icon-allow-overlap"),v="always"===y,w="map"===n.get("text-rotation-alignment"),b="map"===n.get("text-pitch-alignment"),x="none"!==n.get("icon-text-fit"),D="viewport-y"===n.get("symbol-z-order"),M="ground"===n.get("symbol-height-anchor"),E=g&&(v||!r.hasIconData()||m),A=v&&(g||!r.hasTextData()||d);!r.collisionArrays&&c&&r.deserializeCollisionBoxes(c);let F=this.retainedQueryData[r.bucketInstanceId].tileID,z=this._getTerrainElevationFunc(F),S=this.transform.getFastPathSimpleProjectionMatrix(F),C=(t,c,v)=>{if(e[t.crossTileID])return;if(u)return void(this.placements[t.crossTileID]=new Tv(!1,!1,!1));let D=t.heightOffset,C=!1,T=!1,P=!0,I=null,k={box:null,placeable:!1,offscreen:null,occluded:!1},$={placeable:!1},j=null,R=null,O=null,B=0,L=0,U=0;c.textFeatureIndex?B=c.textFeatureIndex:t.useRuntimeCollisionCircles&&(B=t.featureIndex),c.verticalTextFeatureIndex&&(L=c.verticalTextFeatureIndex);let N=c.textBox;if(N){let e=e=>{let i=1;if(r.allowVerticalPlacement&&!e&&this.prevPlacement){let e=this.prevPlacement.placedOrientations[t.crossTileID];e&&(this.placedOrientations[t.crossTileID]=e,i=e,this.markUsedOrientation(r,i,t))}return i},n=(e,i)=>{if(r.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&c.verticalTextBox){for(let t of r.writingModes)if(2===t?(k=i(),$=k):k=e(),k?.placeable)break}else k=e()},l=t.textAnchorOffsetStartIndex,u=t.textAnchorOffsetEndIndex;if(u===l){let i=(e,i)=>{let n=this.collisionIndex.placeCollisionBox(e,_,h,F,a,b,w,s,p.predicate,z,void 0,S,D,M);return n?.placeable&&(this.markUsedOrientation(r,i,t),this.placedOrientations[t.crossTileID]=i),n};n((()=>i(N,1)),(()=>{let e=c.verticalTextBox;return r.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&e?i(e,2):{box:null,offscreen:null}})),e(k?.placeable)}else{let f=Tp[this.prevPlacement?.variableOffsets[t.crossTileID]?.anchor],d=(e,n,c)=>{let d=e.x2-e.x1,m=e.y2-e.y1,g=t.textBoxScale,v=x&&"never"===y?n:null,E=null,A="never"===_?1:2,T="never";f&&A++;for(let i=0;i<A;i++){for(let i=l;i<u;i++){let n=r.textAnchorOffsets.get(i);if(f&&n.textAnchor!==f)continue;let l=this.attemptAnchorPlacement(n,e,d,m,g,w,b,h,F,a,p,T,t,r,c,s,o,v,z,S,D,M);if(l&&(E=l.placedGlyphBoxes,E?.placeable))return C=!0,I=l.shift,E}f?f=null:T=_}return i&&!E&&(E={box:this.collisionIndex.placeCollisionBox(N,"always",h,F,a,b,w,s,p.predicate,z,void 0,S,D,M).box,offscreen:!1,placeable:!1,occluded:!1}),E};n((()=>d(N,c.iconBox,1)),(()=>{let e=c.verticalTextBox,i=k?.placeable;return r.allowVerticalPlacement&&!i&&t.numVerticalGlyphVertices>0&&e?d(e,c.verticalIconBox,2):{box:null,occluded:!0,offscreen:null}})),k&&(C=k.placeable,P=k.offscreen);let m=e(k?.placeable);if(!C&&this.prevPlacement){let e=this.prevPlacement.variableOffsets[t.crossTileID];e&&(this.variableOffsets[t.crossTileID]=e,this.markUsedJustification(r,e.anchor,t,m))}}}if(j=k,C=j?.placeable,P=j?.offscreen,t.useRuntimeCollisionCircles&&t.centerJustifiedTextSymbolIndex>=0){let e=r.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex),o=hp(r.textSizeData,f,e),h=n.get("text-padding");R=this.collisionIndex.placeCollisionCircles(_,e,r.lineVertexArray,r.glyphOffsetArray,o,a,l,i,b,p.predicate,t.collisionCircleDiameter,h,s,z),R.circles.length&&R.collisionDetected&&!i&&Rt("Collisions detected, but collision boxes are not shown"),C=g||R.circles.length>0&&!R.collisionDetected,P&&=R.offscreen}if(c.iconFeatureIndex&&(U=c.iconFeatureIndex),c.iconBox){let t=t=>this.collisionIndex.placeCollisionBox(t,y,h,F,a,b,w,o,p.predicate,z,x&&I?I:void 0,S,D,M);$&&$.placeable&&c.verticalIconBox?(O=t(c.verticalIconBox),T=O.placeable):(O=t(c.iconBox),T=O.placeable),P&&=O.offscreen}let G=d||0===t.numHorizontalGlyphVertices&&0===t.numVerticalGlyphVertices,q=m||0===t.numIconVertices;G||q?q?G||(T&&=C):C=T&&C:T=C=T&&C;let V=T&&O.placeable;if(C&&j.placeable&&this.collisionIndex.insertCollisionBox(j.box,_,n.get("text-ignore-placement"),r.bucketInstanceId,$&&$.placeable&&L?L:B,p.ID),V&&this.collisionIndex.insertCollisionBox(O.box,y,n.get("icon-ignore-placement"),r.bucketInstanceId,U,p.ID),R&&C&&this.collisionIndex.insertCollisionCircles(R.circles,_,n.get("text-ignore-placement"),r.bucketInstanceId,B,p.ID),i&&this.storeCollisionData(r.bucketInstanceId,v,c,j,O,R),0===t.crossTileID)throw Error("symbolInstance.crossTileID can't be 0");if(0===r.bucketInstanceId)throw Error("bucket.bucketInstanceId can't be 0");this.placements[t.crossTileID]=new Tv((C||E)&&!j?.occluded,(T||A)&&!O?.occluded,P||r.justReloaded),e[t.crossTileID]=!0};if(D){if(0!==t.symbolInstanceStart)throw Error("bucket.bucketInstanceId should be 0");let e=r.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let t=e.length-1;t>=0;--t){let i=e[t];C(r.symbolInstances.get(i),r.collisionArrays[i],i)}}else for(let e=t.symbolInstanceStart;e<t.symbolInstanceEnd;e++)C(r.symbolInstances.get(e),r.collisionArrays[e],e);r.justReloaded=!1}storeCollisionData(t,e,i,r,n,s){if(i.textBox||i.iconBox){let s,o;this.collisionBoxArrays.has(t)?s=this.collisionBoxArrays.get(t):(s=new Map,this.collisionBoxArrays.set(t,s)),s.has(e)?o=s.get(e):(o={text:null,icon:null},s.set(e,o)),i.textBox&&(o.text=r.box),i.iconBox&&(o.icon=n.box)}if(s){let e=this.collisionCircleArrays[t];void 0===e&&(e=this.collisionCircleArrays[t]=[]);for(let t=0;t<s.circles.length;t+=4)e.push(s.circles[t+0]-100),e.push(s.circles[t+1]-100),e.push(s.circles[t+2]),e.push(+!!s.collisionDetected)}}markUsedJustification(t,e,i,r){let n;n=2===r?i.verticalPlacedTextSymbolIndex:{left:i.leftJustifiedTextSymbolIndex,center:i.centerJustifiedTextSymbolIndex,right:i.rightJustifiedTextSymbolIndex}[$p(e)];let s=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex,i.verticalPlacedTextSymbolIndex];for(let e of s)e>=0&&(t.text.placedSymbolArray.get(e).crossTileID=n>=0&&e!==n?0:i.crossTileID)}markUsedOrientation(t,e,i){let r=1===e||3===e?e:0,n=2===e?e:0,s=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex];for(let e of s)t.text.placedSymbolArray.get(e).placedOrientation=r;i.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).placedOrientation=n)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;let e=this.prevPlacement,i=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;let r=e?e.symbolFadeChange(t):1,n=e?e.opacities:{},s=e?e.variableOffsets:{},o=e?e.placedOrientations:{};for(let t in this.placements){let e=this.placements[t],s=n[t];s?(this.opacities[t]=new Cv(s,r,e.text,e.icon),i||=e.text!==s.text.placed,i||=e.icon!==s.icon.placed):(this.opacities[t]=new Cv(null,r,e.text,e.icon,e.skipFade),i||=e.text||e.icon)}for(let t in n){let e=n[t];if(!this.opacities[t]){let n=new Cv(e,r,!1,!1);n.isHidden()||(this.opacities[t]=n,i||=e.text.placed,i||=e.icon.placed)}}for(let t in s)!this.variableOffsets[t]&&this.opacities[t]&&!this.opacities[t].isHidden()&&(this.variableOffsets[t]=s[t]);for(let t in o)!this.placedOrientations[t]&&this.opacities[t]&&!this.opacities[t].isHidden()&&(this.placedOrientations[t]=o[t]);if(e&&void 0===e.lastPlacementChangeTime)throw Error("Last placement time for previous placement is not defined");i?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t)}updateLayerOpacities(t,e){let i={};for(let r of e){let e=r.getBucket(t);e&&r.latestFeatureIndex&&t.id===e.layerIds[0]&&this.updateBucketOpacities(e,r.tileID,i,r.collisionBoxArray)}}updateBucketOpacities(t,e,i,r){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();let n=t.layers[0],s=n.layout,o=new Cv(null,0,!1,!1,!0),a=s.get("text-allow-overlap"),l=s.get("icon-allow-overlap"),h=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),c="map"===s.get("text-rotation-alignment"),f="map"===s.get("text-pitch-alignment"),p="none"!==s.get("icon-text-fit"),d=new Cv(null,0,a&&(l||!t.hasIconData()||s.get("icon-optional")),l&&(a||!t.hasTextData()||s.get("text-optional")),!0);!t.collisionArrays&&r&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(r);let m=(t,e,i)=>{for(let r=0;r<e/4;r++)t.opacityVertexArray.emplaceBack(i);t.hasVisibleVertices||=i!==Nv},_=this.collisionBoxArrays.get(t.bucketInstanceId);for(let e=0;e<t.symbolInstances.length;e++){let r=t.symbolInstances.get(e),{numHorizontalGlyphVertices:n,numVerticalGlyphVertices:s,crossTileID:a}=r,l=this.opacities[a];i[a]?l=o:l||(l=d,this.opacities[a]=l),i[a]=!0;let g=r.numIconVertices>0,y=this.placedOrientations[r.crossTileID],v=2===y,w=1===y||3===y;if(n>0||s>0){let e=Uv(l.text);m(t.text,n,v?Nv:e),m(t.text,s,w?Nv:e);let i=l.text.isHidden(),o=[r.rightJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.leftJustifiedTextSymbolIndex];for(let e of o)e>=0&&(t.text.placedSymbolArray.get(e).hidden=i||v?1:0);r.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).hidden=i||w?1:0);let a=this.variableOffsets[r.crossTileID];a&&this.markUsedJustification(t,a.anchor,r,y);let h=this.placedOrientations[r.crossTileID];h&&(this.markUsedJustification(t,"left",r,h),this.markUsedOrientation(t,h,r))}if(g){let e=Uv(l.icon),i=!(p&&r.verticalPlacedIconSymbolIndex&&v);r.placedIconSymbolIndex>=0&&(m(t.icon,r.numIconVertices,i?e:Nv),t.icon.placedSymbolArray.get(r.placedIconSymbolIndex).hidden=l.icon.isHidden()),r.verticalPlacedIconSymbolIndex>=0&&(m(t.icon,r.numVerticalIconVertices,i?Nv:e),t.icon.placedSymbolArray.get(r.verticalPlacedIconSymbolIndex).hidden=l.icon.isHidden())}let b=_?.has(e)?_.get(e):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){let i=t.collisionArrays[e];if(i){let e=new u(0,0);if(i.textBox||i.verticalTextBox){let r=!0;if(h){let t=this.variableOffsets[a];t?(e=kv(t.anchor,t.width,t.height,t.textOffset,t.textBoxScale),c&&e._rotate(f?-this.transform.bearingInRadians:this.transform.bearingInRadians)):r=!1}if(i.textBox||i.verticalTextBox){let n;i.textBox&&(n=v),i.verticalTextBox&&(n=w),jv(t.textCollisionBox.collisionVertexArray,l.text.placed,!r||n,b.text,e.x,e.y)}}if(i.iconBox||i.verticalIconBox){let r,n=!(w||!i.verticalIconBox);i.iconBox&&(r=n),i.verticalIconBox&&(r=!n),jv(t.iconCollisionBox.collisionVertexArray,l.icon.placed,r,b.icon,p?e.x:0,p?e.y:0)}}}}if(t.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);t.bucketInstanceId in this.collisionCircleArrays&&(t.collisionCircleArray=this.collisionCircleArrays[t.bucketInstanceId],delete this.collisionCircleArrays[t.bucketInstanceId])}symbolFadeChange(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,e){let i=this.zoomAtLastRecencyCheck===e?1-this.zoomAdjustment(e):1;return this.zoomAtLastRecencyCheck=e,this.commitTime+this.fadeDuration*i>t}setStale(){this.stale=!0}};function jv(t,e,i,r,n,s){(!r||0===r.length)&&(r=[0,0,0,0]);let o=r[0]-100,a=r[1]-100,l=r[2]-100,h=r[3]-100;t.emplaceBack(+!!e,+!!i,n||0,s||0,o,a),t.emplaceBack(+!!e,+!!i,n||0,s||0,l,a),t.emplaceBack(+!!e,+!!i,n||0,s||0,l,h),t.emplaceBack(+!!e,+!!i,n||0,s||0,o,h)}const Rv=2**25,Ov=2**24,Bv=2**17,Lv=65536;function Uv(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;let e=+!!t.placed,i=Math.floor(127*t.opacity);return i*Rv+e*Ov+i*Bv+e*Lv+512*i+256*e+2*i+e}const Nv=0;var Gv=class{constructor(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=[]}continuePlacement(t,e,i,r,n){let s=this._bucketParts;for(;this._currentTileIndex<t.length;)if(e.getBucketParts(s,r,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,n())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,s.sort(((t,e)=>t.sortKey-e.sortKey)));this._currentPartIndex<s.length;)if(e.placeLayerBucketPart(s[this._currentPartIndex],this._seenCrossTileIDs,i),this._currentPartIndex++,n())return!0;return!1}},qv=class{constructor(t,e,i,r,n,s,o,a){this.placement=new $v(t,e,s,o,a),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=n,this._done=!1}isDone(){return this._done}continuePlacement(t,e,i){let r=H_(),n=()=>!this._forceFullPlacement&&H_()-r>2;for(;this._currentPlacementIndex>=0;){let r=e[t[this._currentPlacementIndex]],s=this.placement.collisionIndex.transform.zoom;if(Kp(r)&&r.layout&&(!r.minzoom||r.minzoom<=s)&&(!r.maxzoom||r.maxzoom>s)){if(this._inProgressLayer||=new Gv(r),this._inProgressLayer.continuePlacement(i[r.source],this.placement,this._showCollisionBoxes,r,n))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}};const Vv=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],Zv=new Uint32Array(96);var Wv=class t{static from(e){if(!e||void 0===e.byteLength||e.buffer)throw Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");let[i,r]=new Uint8Array(e,0,2);if(219!==i)throw Error("Data does not appear to be in a KDBush format.");let n=r>>4;if(1!==n)throw Error(`Got v${n} data when expected v1.`);let s=Vv[15&r];if(!s)throw Error("Unrecognized array type.");let[o]=new Uint16Array(e,2,1),[a]=new Uint32Array(e,4,1);return new t(a,o,s,void 0,e)}constructor(t,e=64,i=Float64Array,r=ArrayBuffer,n){if(isNaN(t)||t<0)throw Error(`Unexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=i,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;let s=Vv.indexOf(this.ArrayType),o=2*t*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-a%8)%8;if(s<0)throw Error(`Unexpected typed array class: ${i}.`);if(n)this.data=n,this.ids=new this.IndexArrayType(n,8,t),this.coords=new i(n,8+a+l,2*t),this._pos=2*t,this._finished=!0;else{let n=this.data=new r(8+o+a+l);this.ids=new this.IndexArrayType(n,8,t),this.coords=new i(n,8+a+l,2*t),this._pos=0,this._finished=!1,new Uint8Array(n,0,2).set([219,16+s]),new Uint16Array(n,2,1)[0]=e,new Uint32Array(n,4,1)[0]=t}}add(t,e){let i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=t,this.coords[this._pos++]=e,i}finish(){let t=this._pos>>1;if(t!==this.numItems)throw Error(`Added ${t} items when expected ${this.numItems}.`);return Hv(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,i,r){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:n,coords:s,nodeSize:o}=this;Zv[0]=0,Zv[1]=n.length-1,Zv[2]=0;let a=3,l=[];for(;a>0;){let h=Zv[--a],u=Zv[--a],c=Zv[--a];if(u-c<=o){for(let o=c;o<=u;o++){let a=s[2*o],h=s[2*o+1];a>=t&&a<=i&&h>=e&&h<=r&&l.push(n[o])}continue}let f=c+u>>1,p=s[2*f],d=s[2*f+1];p>=t&&p<=i&&d>=e&&d<=r&&l.push(n[f]),(0===h?t<=p:e<=d)&&(Zv[a++]=c,Zv[a++]=f-1,Zv[a++]=1-h),(0===h?i>=p:r>=d)&&(Zv[a++]=f+1,Zv[a++]=u,Zv[a++]=1-h)}return l}within(t,e,i){let r=[];return this.withinInto(t,e,i,r),r}withinInto(t,e,i,r){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:n,coords:s,nodeSize:o}=this;Zv[0]=0,Zv[1]=n.length-1,Zv[2]=0;let a=3,l=0,h=i*i;for(;a>0;){let u=Zv[--a],c=Zv[--a],f=Zv[--a];if(c-f<=o){for(let i=f;i<=c;i++)Kv(s[2*i],s[2*i+1],t,e)<=h&&(r[l++]=n[i]);continue}let p=f+c>>1,d=s[2*p],m=s[2*p+1];Kv(d,m,t,e)<=h&&(r[l++]=n[p]),(0===u?t-i<=d:e-i<=m)&&(Zv[a++]=f,Zv[a++]=p-1,Zv[a++]=1-u),(0===u?t+i>=d:e+i>=m)&&(Zv[a++]=p+1,Zv[a++]=c,Zv[a++]=1-u)}return l}};function Hv(t,e,i,r,n,s){if(n-r<=i)return;let o=r+n>>1;Yv(t,e,o,r,n,s),Hv(t,e,i,r,o-1,1-s),Hv(t,e,i,o+1,n,1-s)}function Yv(t,e,i,r,n,s){for(;n>r;){if(n-r>600){let o=n-r+1,a=i-r+1,l=Math.log(o),h=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*h*(o-h)/o)*(a-o/2<0?-1:1);Yv(t,e,i,Math.max(r,Math.floor(i-a*h/o+u)),Math.min(n,Math.floor(i+(o-a)*h/o+u)),s)}let o=e[2*i+s],a=r,l=n;for(Xv(t,e,r,i),e[2*n+s]>o&&Xv(t,e,r,n);a<l;){for(Xv(t,e,a,l),a++,l--;e[2*a+s]<o;)a++;for(;e[2*l+s]>o;)l--}e[2*r+s]===o?Xv(t,e,r,l):(l++,Xv(t,e,l,n)),l<=i&&(r=l+1),i<=l&&(n=l-1)}}function Xv(t,e,i,r){Jv(t,i,r),Jv(e,2*i,2*r),Jv(e,2*i+1,2*r+1)}function Jv(t,e,i){let r=t[e];t[e]=t[i],t[i]=r}function Kv(t,e,i,r){let n=t-i,s=e-r;return n*n+s*s}const Qv=.03125;var tw=class{constructor(t,e,i){this.tileID=t,this.bucketInstanceId=i,this._symbolsByKey={};let r=new Map;for(let t=0;t<e.length;t++){let i=e.get(t),n=i.key,s=r.get(n);s?s.push(i):r.set(n,[i])}for(let[t,e]of r){let i={positions:e.map((t=>({x:Math.floor(t.anchorX*Qv),y:Math.floor(t.anchorY*Qv)}))),crossTileIDs:e.map((t=>t.crossTileID))};if(i.positions.length>128){let t=new Wv(i.positions.length,16,Uint16Array);for(let{x:e,y:r}of i.positions)t.add(e,r);t.finish(),delete i.positions,i.index=t}this._symbolsByKey[t]=i}}getScaledCoordinates(t,e){let{x:i,y:r,z:n}=this.tileID.canonical,{x:s,y:o,z:a}=e.canonical,l=Qv/2**(a-n),h=(o*it+t.anchorY)*l,u=r*it*Qv;return{x:Math.floor((s*it+t.anchorX)*l-i*it*Qv),y:Math.floor(h-u)}}findMatches(t,e,i){let r=this.tileID.canonical.z<e.canonical.z?1:2**(this.tileID.canonical.z-e.canonical.z);for(let n=0;n<t.length;n++){let s=t.get(n);if(s.crossTileID)continue;let o=this._symbolsByKey[s.key];if(!o)continue;let a=this.getScaledCoordinates(s,e);o.index?this.findMatchesForIndexedEntry(o,s,a,r,i):o.positions&&this.findMatchesForNonIndexedEntry(o,s,a,r,i)}}findMatchesForIndexedEntry(t,e,i,r,n){let s=t.index.range(i.x-r,i.y-r,i.x+r,i.y+r),o=1/0;for(let e of s)e<o&&!n[t.crossTileIDs[e]]&&(o=e);if(o!==1/0){let i=t.crossTileIDs[o];n[i]=!0,e.crossTileID=i}}findMatchesForNonIndexedEntry(t,e,i,r,n){for(let s=0;s<t.positions.length;s++){let o=t.positions[s],a=t.crossTileIDs[s];if(Math.abs(o.x-i.x)<=r&&Math.abs(o.y-i.y)<=r&&!n[a]){n[a]=!0,e.crossTileID=a;break}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:t})=>t))}},ew=class{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}},iw=class{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){let e=Math.round((t-this.lng)/360);if(0!==e)for(let t in this.indexes){let i=this.indexes[t],r={};for(let t in i){let n=i[t];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+e),r[n.tileID.key]=n}this.indexes[t]=r}this.lng=t}addBucket(t,e,i){if(this.indexes[t.overscaledZ]?.[t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===e.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let t=0;t<e.symbolInstances.length;t++)e.symbolInstances.get(t).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||={};let r=this.usedCrossTileIDs[t.overscaledZ];for(let i in this.indexes){let n=this.indexes[i];if(Number(i)>t.overscaledZ)for(let i in n){let s=n[i];s.tileID.isChildOf(t)&&s.findMatches(e.symbolInstances,t,r)}else{let s=n[t.scaledTo(Number(i)).key];s&&s.findMatches(e.symbolInstances,t,r)}}for(let t=0;t<e.symbolInstances.length;t++){let n=e.symbolInstances.get(t);n.crossTileID||(n.crossTileID=i.generate(),r[n.crossTileID]=!0)}return void 0===this.indexes[t.overscaledZ]&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new tw(t,e.symbolInstances,e.bucketInstanceId),!0}removeBucketCrossTileIDs(t,e){for(let i of e.getCrossTileIDsLists())for(let e of i)delete this.usedCrossTileIDs[t][e]}removeStaleBuckets(t){let e=!1;for(let i in this.indexes){let r=this.indexes[i];for(let n in r)t[r[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,r[n]),delete r[n],e=!0)}return e}},rw=class{constructor(){this.layerIndexes={},this.crossTileIDs=new ew,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,e,i){let r=this.layerIndexes[t.id];void 0===r&&(r=this.layerIndexes[t.id]=new iw);let n=!1,s={};r.handleWrapJump(i);for(let i of e){let e=i.getBucket(t);t.id===e?.layerIds[0]&&(e.bucketInstanceId||=(this.maxBucketInstanceId+=1,this.maxBucketInstanceId),r.addBucket(i.tileID,e,this.crossTileIDs)&&(n=!0),s[e.bucketInstanceId]=!0)}return r.removeStaleBuckets(s)&&(n=!0),n}pruneUnusedLayers(t){let e={};for(let i of t)e[i]=!0;for(let t in this.layerIndexes)e[t]||delete this.layerIndexes[t]}},nw="void main() {fragColor=vec4(1.0);}";const sw={prelude:ow("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nout highp vec4 fragColor;layout(std140) uniform ProjectionUBO {highp mat4 u_projection_matrix;highp mat4 u_projection_fallback_matrix;highp vec4 u_projection_tile_mercator_coords;highp vec4 u_projection_clipping_plane;highp float u_projection_transition;highp int u_projection_clip_antimeridian;};layout(std140) uniform FrameUBO {highp vec2 u_units_to_pixels;highp vec2 u_world_size;highp float u_camera_to_center_distance;highp float u_symbol_fade_change;highp float u_aspect_ratio;highp float u_device_pixel_ratio;highp vec2 u_viewport_size;highp vec2 u_pixel_extrude_scale;highp float u_pitch;};","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const uint packedOpacity) {return vec2(float(packedOpacity >> 1u)/127.0,float(packedOpacity & 1u));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c\n);}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform highp sampler2D u_depth;layout(std140) uniform TerrainUBO {highp mat4 u_terrain_matrix;highp vec4 u_terrain_unpack;highp float u_terrain_dim;highp float u_terrain_exaggeration;};\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(ivec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texelFetch(u_terrain,pos,0)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\n#ifdef GLOBE\nif ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}\n#endif\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.5;vec2 f=fract(coord);ivec2 c=ivec2(floor(coord));ivec2 hi=textureSize(u_terrain,0)-1;float tl=ele(clamp(c,ivec2(0),hi));float tr=ele(clamp(c+ivec2(1,0),ivec2(0),hi));float bl=ele(clamp(c+ivec2(0,1),ivec2(0),hi));float br=ele(clamp(c+ivec2(1,1),ivec2(0),hi));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}const float PI=3.141592653589793;\n#define PROJECTION_UBO\nlayout(std140) uniform ProjectionUBO {highp mat4 u_projection_matrix;highp mat4 u_projection_fallback_matrix;highp vec4 u_projection_tile_mercator_coords;highp vec4 u_projection_clipping_plane;highp float u_projection_transition;highp int u_projection_clip_antimeridian;};layout(std140) uniform FrameUBO {highp vec2 u_units_to_pixels;highp vec2 u_world_size;highp float u_camera_to_center_distance;highp float u_symbol_fade_change;highp float u_aspect_ratio;highp float u_device_pixel_ratio;highp vec2 u_viewport_size;highp vec2 u_pixel_extrude_scale;highp float u_pitch;};"),projectionMercator:ow("\nvoid clipAntimeridian() {}","float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:ow("in highp float v_projection_tile_x;void clipAntimeridian() {if (u_projection_clip_antimeridian !=0 && (v_projection_tile_x < 0.0 || v_projection_tile_x >=8192.0)) {discard;}}","#define GLOBE_RADIUS 6371008.8\n#ifndef PROJECTION_UBO\nuniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;\n#endif\nout highp float v_projection_tile_x;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos\n);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float t=exp(PI-(mercator_pos_y*PI*2.0));return (2.0*t)/(t*t+1.0);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY);if (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;float spherical_x=mercator_pos.x*PI*2.0+PI;float t=exp(PI-(mercator_pos.y*PI*2.0));float t2=t*t;float denom=t2+1.0;float sin_sy=(t2-1.0)/denom;float cos_sy=(2.0*t)/denom;vec3 pos=vec3(sin(spherical_x)*cos_sy,sin_sy,cos(spherical_x)*cos_sy\n);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {v_projection_tile_x=posInTile.x;vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {v_projection_tile_x=posInTile.x;vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}"),background:ow("uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","layout(location=0) in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:ow("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:ow("in vec3 v_data;flat in float v_visibility;\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define mediump float radius\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define highp vec4 stroke_color\n#pragma maplibre: define mediump float stroke_width\n#pragma maplibre: define lowp float stroke_opacity\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize mediump float radius\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize highp vec4 stroke_color\n#pragma maplibre: initialize mediump float stroke_width\n#pragma maplibre: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform vec2 u_translate;layout(location=0) in ivec2 a_pos;out vec3 v_data;flat out float v_visibility;\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define mediump float radius\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define highp vec4 stroke_color\n#pragma maplibre: define mediump float stroke_width\n#pragma maplibre: define lowp float stroke_opacity\nvoid main(void) {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize mediump float radius\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize highp vec4 stroke_color\n#pragma maplibre: initialize mediump float stroke_width\n#pragma maplibre: initialize lowp float stroke_opacity\nivec2 pos_raw=a_pos+32768;vec2 extrude=vec2(pos_raw & 7)/7.0*2.0-1.0;vec2 circle_center=vec2(pos_raw >> 3)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {\n#ifdef GLOBE\nvec3 center_vector=projectToSphere(circle_center);\n#endif\nfloat angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {\n#ifdef GLOBE\nvec4 projected_center=interpolateProjection(circle_center,center_vector,ele);\n#else\nvec4 projected_center=projectTileWithElevation(circle_center,ele);\n#endif\ncorner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}\n#ifdef GLOBE\nvec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);\n#else\ngl_Position=projectTileWithElevation(corner_position,ele);\n#endif\n} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),clippingMask:ow(nw,"layout(location=0) in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:ow("uniform highp float u_intensity;in vec2 v_extrude;\n#pragma maplibre: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma maplibre: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;layout(location=0) in ivec2 a_pos;out vec2 v_extrude;\n#pragma maplibre: define highp float weight\n#pragma maplibre: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma maplibre: initialize highp float weight\n#pragma maplibre: initialize mediump float radius\nivec2 pos_raw=a_pos+32768;vec2 unscaled_extrude=vec2(pos_raw & 7)/7.0*2.0-1.0;float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=vec2(pos_raw >> 3);\n#ifdef GLOBE\nvec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);\n#else\ngl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));\n#endif\n}"),heatmapTexture:ow("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world_size,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:ow("flat in float v_placed;flat in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","layout(location=0) in vec2 a_anchor_pos;layout(location=1) in vec2 a_placed;layout(location=2) in vec2 a_box_real;flat out float v_placed;flat out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:ow("flat in float v_radius;in vec2 v_extrude;flat in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;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);fragColor=color*alpha*opacity_t;}","layout(location=0) in vec2 a_pos;layout(location=1) in float a_radius;layout(location=2) in vec2 a_flags;flat out float v_radius;out vec2 v_extrude;flat out float v_collision;void main() {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;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),colorRelief:ow("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {vec4 data=texelFetch(u_elevation_stops,ivec2(stop,0),0)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else\n{l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_dimension;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=2.0/u_dimension;float scale=(u_dimension.x-4.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),debug:ow("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","layout(location=0) in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:ow(nw,"layout(location=0) in vec2 a_pos;void main() {\n#ifdef GLOBE\ngl_Position=projectTileFor3D(a_pos,0.0);\n#else\ngl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);\n#endif\n}"),fill:ow("#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize lowp float opacity\nfragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize lowp float opacity\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}"),fillOutline:ow("in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma maplibre: define highp vec4 outline_color\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize highp vec4 outline_color\n#pragma maplibre: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma maplibre: define highp vec4 outline_color\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize highp vec4 outline_color\n#pragma maplibre: initialize lowp float opacity\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world_size;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillOutlinePattern:ow("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;uniform bool u_sdf_pattern;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\nvoid main() {\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: 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=texture(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=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);if (u_sdf_pattern) {highp float sdf_edge=(256.0-64.0)/256.0;highp float sdf_gamma_a=max(fwidth(color1.a)*0.5,1.0/255.0/16.0);highp float sdf_gamma_b=max(fwidth(color2.a)*0.5,1.0/255.0/16.0);float sdf_alpha_a=smoothstep(sdf_edge-sdf_gamma_a,sdf_edge+sdf_gamma_a,color1.a);float sdf_alpha_b=smoothstep(sdf_edge-sdf_gamma_b,sdf_edge+sdf_gamma_b,color2.a);fragColor=mix(color*sdf_alpha_a,color*sdf_alpha_b,u_fade)*alpha*opacity;} else {fragColor=mix(color1,color2,u_fade)*alpha*opacity;}\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\n#pragma maplibre: define lowp float pixel_ratio_from\n#pragma maplibre: define lowp float pixel_ratio_to\nvoid main() {\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\n#pragma maplibre: initialize lowp float pixel_ratio_from\n#pragma maplibre: initialize lowp float pixel_ratio_to\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}vec2 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=projectTile(a_pos+u_fill_translate,a_pos);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_size;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillPattern:ow("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform bool u_sdf_pattern;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\nvoid main() {\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: 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=texture(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=texture(u_image,pos2);if (u_sdf_pattern) {highp float sdf_edge=(256.0-64.0)/256.0;highp float sdf_gamma_a=max(fwidth(color1.a)*0.5,1.0/255.0/16.0);highp float sdf_gamma_b=max(fwidth(color2.a)*0.5,1.0/255.0/16.0);float sdf_alpha_a=smoothstep(sdf_edge-sdf_gamma_a,sdf_edge+sdf_gamma_a,color1.a);float sdf_alpha_b=smoothstep(sdf_edge-sdf_gamma_b,sdf_edge+sdf_gamma_b,color2.a);fragColor=mix(color*sdf_alpha_a,color*sdf_alpha_b,u_fade)*opacity;} else {fragColor=mix(color1,color2,u_fade)*opacity;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\n#pragma maplibre: define lowp float pixel_ratio_from\n#pragma maplibre: define lowp float pixel_ratio_to\nvoid main() {\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\n#pragma maplibre: initialize lowp float pixel_ratio_from\n#pragma maplibre: initialize lowp float pixel_ratio_to\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}vec2 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=projectTile(a_pos+u_fill_translate,a_pos);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);}"),fillExtrusion:ow("in vec4 v_color;void main() {fragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;layout(location=1) in ivec4 a_normal_ed;\n#ifdef TERRAIN3D\nlayout(location=2) in vec2 a_centroid;\n#endif\nout vec4 v_color;\n#pragma maplibre: define highp float base\n#pragma maplibre: define highp float height\n#pragma maplibre: define highp vec4 color\nvoid main() {\n#pragma maplibre: initialize highp float base\n#pragma maplibre: initialize highp float height\n#pragma maplibre: initialize highp vec4 color\nvec3 normal=vec3(a_normal_ed.xyz);float gradient_base=max(0.0,base);float gradient_height=max(0.0,height);\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=float(a_normal_ed.x & 1);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nfloat 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;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);\n#ifdef GLOBE\nmat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);\n#endif\ndirectional=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+gradient_base)*pow(gradient_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;}"),fillExtrusionPattern:ow("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;\n#pragma maplibre: define lowp float base\n#pragma maplibre: define lowp float height\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\n#pragma maplibre: define lowp float pixel_ratio_from\n#pragma maplibre: define lowp float pixel_ratio_to\nvoid main() {\n#pragma maplibre: initialize lowp float base\n#pragma maplibre: initialize lowp float height\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\n#pragma maplibre: initialize lowp float pixel_ratio_from\n#pragma maplibre: 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=texture(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=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","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 vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;layout(location=0) in vec2 a_pos;layout(location=1) in ivec4 a_normal_ed;\n#ifdef TERRAIN3D\nlayout(location=2) in vec2 a_centroid;\n#endif\n#ifdef GLOBE\nout vec3 v_sphere_pos;\n#endif\nout vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;\n#pragma maplibre: define lowp float base\n#pragma maplibre: define lowp float height\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\n#pragma maplibre: define lowp float pixel_ratio_from\n#pragma maplibre: define lowp float pixel_ratio_to\nvoid main() {\n#pragma maplibre: initialize lowp float base\n#pragma maplibre: initialize lowp float height\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\n#pragma maplibre: initialize lowp float pixel_ratio_from\n#pragma maplibre: 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=vec3(a_normal_ed.xyz);float edgedistance=float(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;float gradient_base=max(0.0,base);float gradient_height=max(0.0,height);\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=float(a_normal_ed.x & 1);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nvec2 pos=a_normal_ed.x==1 && a_normal_ed.y==0 && a_normal_ed.z==16384\n? a_pos\n: vec2(edgedistance,elevation*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+gradient_base)*pow(gradient_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;}"),hillshadePrepare:ow("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(ivec2 texel) {vec4 data=texelFetch(u_image,texel,0)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {ivec2 pos=ivec2(gl_FragCoord.xy)+ivec2(1);float tileSize=u_dimension.x-4.0;float a=getElevation(pos+ivec2(-1,-1));float b=getElevation(pos+ivec2(0,-1));float c=getElevation(pos+ivec2(1,-1));float d=getElevation(pos+ivec2(-1,0));float e=getElevation(pos);float f=getElevation(pos+ivec2(1,0));float g=getElevation(pos+ivec2(-1,1));float h=getElevation(pos+ivec2(0,1));float i=getElevation(pos+ivec2(1,1));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))*tileSize/pow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;layout(location=0) in vec2 a_pos;layout(location=1) in vec2 a_texture_pos;out 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;}"),hillshade:ow("uniform sampler2D u_image;in highp vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];\n#define PI 3.141592653589793\n#define STANDARD 0\n#define COMBINED 1\n#define IGOR 2\n#define MULTIDIRECTIONAL 3\n#define BASIC 4\nfloat get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;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_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else\n{fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else\n{fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {highp vec2 size=vec2(textureSize(u_image,0));highp vec2 texturePos=(v_pos*(size-2.0)+1.0)/size;vec4 pixel=texture(u_image,texturePos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:ow("flat in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\nclipAntimeridian();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);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nlayout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;out vec2 v_normal;flat out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define mediump float gapwidth\n#pragma maplibre: define lowp float offset\n#pragma maplibre: define mediump float width\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump float gapwidth\n#pragma maplibre: initialize lowp float offset\n#pragma maplibre: initialize mediump float width\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);v_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*2.0;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),lineGradient:ow("uniform sampler2D u_image;flat in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\nclipAntimeridian();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);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nlayout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;layout(location=2) in float a_uv_x;layout(location=3) in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform float u_image_height;out vec2 v_normal;flat out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define mediump float gapwidth\n#pragma maplibre: define lowp float offset\n#pragma maplibre: define mediump float width\nvoid main() {\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump float gapwidth\n#pragma maplibre: initialize lowp float offset\n#pragma maplibre: initialize mediump float width\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);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=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),linePattern:ow("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;flat in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;flat in float v_width;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\n#pragma maplibre: define lowp float pixel_ratio_from\n#pragma maplibre: define lowp float pixel_ratio_to\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\n#pragma maplibre: initialize lowp float pixel_ratio_from\n#pragma maplibre: initialize lowp float pixel_ratio_to\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\nclipAntimeridian();vec2 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(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nlayout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;out vec2 v_normal;flat out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;flat out float v_width;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define lowp float offset\n#pragma maplibre: define mediump float gapwidth\n#pragma maplibre: define mediump float width\n#pragma maplibre: define lowp float floorwidth\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\n#pragma maplibre: define lowp float pixel_ratio_from\n#pragma maplibre: define lowp float pixel_ratio_to\nvoid main() {\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize lowp float offset\n#pragma maplibre: initialize mediump float gapwidth\n#pragma maplibre: initialize mediump float width\n#pragma maplibre: initialize lowp float floorwidth\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\n#pragma maplibre: initialize lowp float pixel_ratio_from\n#pragma maplibre: initialize lowp float pixel_ratio_to\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),lineSDF:ow("uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;in vec2 v_normal;flat in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define mediump float width\n#pragma maplibre: define lowp float floorwidth\n#pragma maplibre: define mediump vec4 dasharray_from\n#pragma maplibre: define mediump vec4 dasharray_to\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump float width\n#pragma maplibre: initialize lowp float floorwidth\n#pragma maplibre: initialize mediump vec4 dasharray_from\n#pragma maplibre: initialize mediump vec4 dasharray_to\nclipAntimeridian();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 sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nlayout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;flat out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define mediump float gapwidth\n#pragma maplibre: define lowp float offset\n#pragma maplibre: define mediump float width\n#pragma maplibre: define lowp float floorwidth\n#pragma maplibre: define mediump vec4 dasharray_from\n#pragma maplibre: define mediump vec4 dasharray_to\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump float gapwidth\n#pragma maplibre: initialize lowp float offset\n#pragma maplibre: initialize mediump float width\n#pragma maplibre: initialize lowp float floorwidth\n#pragma maplibre: initialize mediump vec4 dasharray_from\n#pragma maplibre: initialize mediump vec4 dasharray_to\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}"),lineGradientSDF:ow("uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;flat in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define mediump float width\n#pragma maplibre: define lowp float floorwidth\n#pragma maplibre: define mediump vec4 dasharray_from\n#pragma maplibre: define mediump vec4 dasharray_to\nvoid main() {\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump float width\n#pragma maplibre: initialize lowp float floorwidth\n#pragma maplibre: initialize mediump vec4 dasharray_from\n#pragma maplibre: initialize mediump vec4 dasharray_to\nclipAntimeridian();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);vec4 color=texture(u_image,v_uv);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nlayout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;layout(location=2) in float a_uv_x;layout(location=3) in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform float u_image_height;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;flat out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define mediump float gapwidth\n#pragma maplibre: define lowp float offset\n#pragma maplibre: define mediump float width\n#pragma maplibre: define lowp float floorwidth\n#pragma maplibre: define mediump vec4 dasharray_from\n#pragma maplibre: define mediump vec4 dasharray_to\nvoid main() {\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump float gapwidth\n#pragma maplibre: initialize lowp float offset\n#pragma maplibre: initialize mediump float width\n#pragma maplibre: initialize lowp float floorwidth\n#pragma maplibre: initialize mediump vec4 dasharray_from\n#pragma maplibre: initialize mediump vec4 dasharray_to\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;float texel_height=1.0/u_image_height;float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}"),layerOpacity:ow("uniform sampler2D u_image;uniform float u_opacity;in vec2 v_pos;void main() {fragColor=texture(u_image,v_pos)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(0.0);\n#endif\n}","layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos.x*2.0-1.0,1.0-a_pos.y*2.0,0.0,1.0);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),raster:ow("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec3 v_pos0;in vec3 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=texture(u_image0,v_pos0.xy/v_pos0.z);vec4 color1=texture(u_image1,v_pos1.xy/v_pos1.z);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);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec3 u_image_warp;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;layout(location=0) in vec2 a_pos;out vec3 v_pos0;out vec3 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 topLeft=u_coords_top.xy;vec2 topRight=u_coords_top.zw;vec2 bottomLeft=u_coords_bottom.xy;vec2 bottomRight=u_coords_bottom.zw;vec2 bilinearPos=mix(mix(topLeft,topRight,fractionalPos.x),mix(bottomLeft,bottomRight,fractionalPos.x),fractionalPos.y);float denominator=dot(u_image_warp.xy,fractionalPos)+1.0;vec2 acrossTop=topRight-topLeft+u_image_warp.x*topRight;vec2 downLeft=bottomLeft-topLeft+u_image_warp.y*bottomLeft;vec2 projectivePos=(acrossTop*fractionalPos.x+downLeft*fractionalPos.y+topLeft)/denominator;vec2 position=mix(projectivePos,bilinearPos,u_image_warp.z);gl_Position=projectTile(position,position);vec2 texturePos=((fractionalPos-0.5)/u_buffer_scale)+0.5;\n#ifdef GLOBE\nif (a_pos.y <-32767.5) {texturePos.y=0.0;}if (a_pos.y > 32766.5) {texturePos.y=1.0;}\n#endif\nfloat perspectiveRatio=mix(1.0/denominator,1.0,u_image_warp.z);v_pos0=vec3(texturePos*perspectiveRatio,perspectiveRatio);vec2 parentPos=(texturePos*u_scale_parent)+u_tl_parent;v_pos1=vec3(parentPos*perspectiveRatio,perspectiveRatio);}"),symbolIcon:ow("uniform sampler2D u_texture;in vec2 v_tex;flat in float v_total_opacity;void main() {fragColor=texture(u_texture,v_tex)*v_total_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec4 a_pixeloffset;layout(location=3) in vec3 a_projected_pos;layout(location=4) in uint a_fade_opacity;layout(location=5) in float a_height_offset;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 bool u_rotate_symbol;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;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec2 v_tex;flat out float v_total_opacity;\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_symbol_fade_change :-u_symbol_fade_change;float visibility=calculate_visibility(projectedPoint);v_total_opacity=opacity*max(0.0,min(visibility,fade_opacity[0]+fade_change));if (v_total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}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);if (!u_is_offset) {size*=perspective_ratio;}float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);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;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;}"),symbolSDF:ow("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform bool u_is_plain;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;\n#pragma maplibre: define highp vec4 fill_color\n#pragma maplibre: define highp vec4 halo_color\n#pragma maplibre: define lowp float halo_width\n#pragma maplibre: define lowp float halo_blur\nvoid main() {\n#pragma maplibre: initialize highp vec4 fill_color\n#pragma maplibre: initialize highp vec4 halo_color\n#pragma maplibre: initialize lowp float halo_width\n#pragma maplibre: 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 total_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out_text,color_alpha_out_halo;if (u_is_plain){highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);color_alpha_out_text=total_opacity*alpha*fill_color;}if (u_is_halo) {float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);float inner_edge_halo=inner_edge+gamma_halo*gamma_scale;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(inner_edge_halo-gamma_scaled_halo,inner_edge_halo+gamma_scaled_halo,dist);highp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha_halo= min(smoothstep(halo_edge-gamma_scaled_halo,halo_edge+gamma_scaled_halo,dist),1.0-alpha_halo);color_alpha_out_halo=total_opacity*alpha_halo*halo_color;}if (u_is_plain && u_is_halo) {fragColor=color_alpha_out_text+(1.-color_alpha_out_text.a)*color_alpha_out_halo;} else if (u_is_halo){fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out_text;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec4 a_pixeloffset;layout(location=3) in vec3 a_projected_pos;layout(location=4) in uint a_fade_opacity;layout(location=5) in float a_height_offset;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_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform bool u_rotate_symbol;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec2 v_data0;out vec3 v_data1;\n#pragma maplibre: define highp vec4 fill_color\n#pragma maplibre: define highp vec4 halo_color\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define lowp float halo_width\n#pragma maplibre: define lowp float halo_blur\nvoid main() {\n#pragma maplibre: initialize highp vec4 fill_color\n#pragma maplibre: initialize highp vec4 halo_color\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize lowp float halo_width\n#pragma maplibre: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);vec2 a_pxoffset=a_pixeloffset.xy/16.0;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_symbol_fade_change :-u_symbol_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}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);if (!u_is_offset) {size*=perspective_ratio;}float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);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;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,total_opacity);}"),symbolTextAndIcon:ow("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform bool u_is_text;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;in vec4 v_data0;in vec3 v_data1;flat in float v_is_sdf;\n#pragma maplibre: define highp vec4 fill_color\n#pragma maplibre: define highp vec4 halo_color\n#pragma maplibre: define lowp float halo_width\n#pragma maplibre: define lowp float halo_blur\nvoid main() {\n#pragma maplibre: initialize highp vec4 fill_color\n#pragma maplibre: initialize highp vec4 halo_color\n#pragma maplibre: initialize lowp float halo_width\n#pragma maplibre: initialize lowp float halo_blur\nfloat total_opacity=v_data1[2];if (v_is_sdf==ICON) {vec2 tex_icon=v_data0.zw;fragColor=texture(u_texture_icon,tex_icon)*total_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=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;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out,color_alpha_out_halo;if (u_is_text) {highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);color_alpha_out=fill_color*(alpha*total_opacity);}if (u_is_halo) {highp float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);lowp float buff_halo=(6.0-halo_width/fontScale)/SDF_PX;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(buff_halo-gamma_scaled_halo,buff_halo+gamma_scaled_halo,dist);color_alpha_out_halo=halo_color*(alpha_halo*total_opacity);}if (u_is_text && u_is_halo) {fragColor=color_alpha_out+(1.-color_alpha_out.a)*color_alpha_out_halo;} else if (u_is_halo) {fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec3 a_projected_pos;layout(location=3) in uint a_fade_opacity;layout(location=4) in float a_height_offset;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_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec4 v_data0;out vec3 v_data1;flat out float v_is_sdf;\n#pragma maplibre: define highp vec4 fill_color\n#pragma maplibre: define highp vec4 halo_color\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define lowp float halo_width\n#pragma maplibre: define lowp float halo_blur\nvoid main() {\n#pragma maplibre: initialize highp vec4 fill_color\n#pragma maplibre: initialize highp vec4 halo_color\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize lowp float halo_width\n#pragma maplibre: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);float is_sdf=float(a_data.z & 1u);float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_symbol_fade_change :-u_symbol_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}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);if (!u_is_offset) {size*=perspective_ratio;}float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);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;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec3(gamma_scale,size,total_opacity);v_is_sdf=is_sdf;}"),terrain:ow("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && u_fog_ground_blend_opacity > 0.0 && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","layout(location=0) in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:ow("in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}","layout(location=0) in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),atmosphere:ow("#ifdef GL_ES\nprecision highp float;\n#endif\nin vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758\n);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}","layout(location=0) in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:ow("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;in vec3 v_view_direction;const float ATMOSPHERE_HEIGHT_TO_GLOBE_RADIUS=100000.0/6371000.0;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;float opacity=1.0;if (u_sky_blend > 0.0) {vec3 ray=normalize(v_view_direction);float globe_distance=length(u_globe_position);float angle_to_globe_center=acos(clamp(dot(ray,u_globe_position)/globe_distance,-1.0,1.0));float horizon_angle=asin(min(u_globe_radius/globe_distance,1.0));blend=mix(blend,((angle_to_globe_center-horizon_angle)*u_camera_to_center_distance+1.0)*u_device_pixel_ratio,u_sky_blend);float closest_approach=max(dot(ray,u_globe_position),0.0);float lowest_altitude=sqrt(max(globe_distance*globe_distance-closest_approach*closest_approach,0.0))-u_globe_radius;float atmosphere_height=u_globe_radius*ATMOSPHERE_HEIGHT_TO_GLOBE_RADIUS;float inside_atmosphere=1.0-smoothstep(atmosphere_height,10.0*atmosphere_height,globe_distance-u_globe_radius);float through_atmosphere=1.0-smoothstep(0.0,atmosphere_height,lowest_altitude);opacity=inside_atmosphere*through_atmosphere*(1.0-u_atmosphere_blend);}if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor*=mix(1.0,opacity,u_sky_blend);}","layout(location=0) in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 v_view_direction;void main() {v_view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,1.0,1.0);}")};function ow(t,e){let i=/#pragma maplibre: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=e.match(/in ([\w]+) ([\w]+)/g),n=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),s=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=s?s.concat(n):n,a=r?r.length:0,l={};return t=t.replace(i,((t,e,i,r,n)=>(l[n]=!0,"define"===e?`\n#ifndef HAS_UNIFORM_u_${n}\nin ${i} ${r} ${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = u_${n};\n#endif\n`))),e=e.replace(i,((t,e,i,r,n)=>{let s="float"===r?"vec2":"vec4",o=n.match(/color/)?"color":s;return l[n]?"define"===e?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nlayout(location = ${a++}) in ${i} ${s} a_${n};\nout ${i} ${r} ${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"vec4"===o?`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = a_${n};\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = unpack_mix_${o}(a_${n}, u_${n}_t);\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:"define"===e?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nlayout(location = ${a++}) in ${i} ${s} a_${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"vec4"===o?`\n#ifndef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = a_${n};\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = unpack_mix_${o}(a_${n}, u_${n}_t);\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`})),{fragmentSource:t,vertexSource:e,staticAttributes:r,staticUniforms:o}}const aw="#define PROJECTION_MERCATOR",lw="mercator";var hw=class{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return lw}get shaderDefine(){return aw}get shaderPreludeCode(){return sw.projectionMercator}get vertexShaderPreludeCode(){return sw.projectionMercator.vertexSource}get subdivisionGranularity(){return hu.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}destroy(){}getMeshFromTileID(t,e,i,r,n){if(this._cachedMesh)return this._cachedMesh;let s=new va;s.emplaceBack(0,0),s.emplaceBack(it,0),s.emplaceBack(0,it),s.emplaceBack(it,it);let o=t.createVertexBuffer(s,My.members),a=La.simpleSegment(0,0,4,2),l=new ja;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3);let h=t.createIndexBuffer(l);return this._cachedMesh=new Dy(o,h,a),this._cachedMesh}recalculate(){}hasTransition(){return!1}},uw=class t{constructor(t=0,e=0,i=0,r=0){if(isNaN(t)||t<0||isNaN(e)||e<0||isNaN(i)||i<0||isNaN(r)||r<0)throw 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=r}interpolate(t,e,i){return null!=e.top&&null!=t.top&&(this.top=Oi.number(t.top,e.top,i)),null!=e.bottom&&null!=t.bottom&&(this.bottom=Oi.number(t.bottom,e.bottom,i)),null!=e.left&&null!=t.left&&(this.left=Oi.number(t.left,e.left,i)),null!=e.right&&null!=t.right&&(this.right=Oi.number(t.right,e.right,i)),this}getCenter(t,e){return new u(Dt((this.left+t-this.right)/2,0,t),Dt((this.top+e-this.bottom)/2,0,e))}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new t(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}};function cw(t,e){if(!t.renderWorldCopies||t.lngRange)return;let i=e.lng-t.center.lng;e.lng+=i>180?-360:i<-180?360:0}function fw(t){return Math.max(0,Math.floor(t))}var pw=class{constructor(t,e){this.applyConstrain=(t,e)=>null===this._constrainOverride?this._callbacks.defaultConstrain(t,e):this._constrainOverride(t,e),this._callbacks=t,this._tileSize=512,this._renderWorldCopies=void 0===e?.renderWorldCopies||!!e?.renderWorldCopies,this._minZoom=e?.minZoom||0,this._maxZoom=e?.maxZoom||22,this._minPitch=null==e?.minPitch?0:e?.minPitch,this._maxPitch=null==e?.maxPitch?60:e?.maxPitch,this._constrainOverride=e?.constrainOverride??null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new Ou(0,0),this._elevation=0,this._zoom=0,this._tileZoom=fw(this._zoom),this._scale=St(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new uw,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(t,e){this._constrainOverride=t.constrainOverride,this._latRange=t.latRange,this._lngRange=t.lngRange,this._width=t.width,this._height=t.height,this._center=t.center,this._elevation=t.elevation,this._minElevationForCurrentTile=t.minElevationForCurrentTile,this._zoom=t.zoom,this._tileZoom=fw(this._zoom),this._scale=St(this._zoom),this._bearingInRadians=t.bearingInRadians,this._fovInRadians=t.fovInRadians,this._pitchInRadians=t.pitchInRadians,this._rollInRadians=t.rollInRadians,this._unmodified=t.unmodified,this._edgeInsets=new uw(t.padding.top,t.padding.bottom,t.padding.left,t.padding.right),this._minZoom=t.minZoom,this._maxZoom=t.maxZoom,this._minPitch=t.minPitch,this._maxPitch=t.maxPitch,this._renderWorldCopies=t.renderWorldCopies,this._cameraToCenterDistance=t.cameraToCenterDistance,this._nearZ=t.nearZ,this._farZ=t.farZ,this._autoCalculateNearFarZ=t.autoCalculateNearFarZ,e&&this.constrainInternal(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(t){this._minElevationForCurrentTile=t}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(t){if(this._minZoom===t)return;this._minZoom=t;let e=this._unmodified;this.setZoom(this.applyConstrain(this._center,this.zoom).zoom),this._unmodified=e}get maxZoom(){return this._maxZoom}setMaxZoom(t){if(this._maxZoom===t)return;this._maxZoom=t;let e=this._unmodified;this.setZoom(this.applyConstrain(this._center,this.zoom).zoom),this._unmodified=e}get minPitch(){return this._minPitch}setMinPitch(t){if(this._minPitch===t)return;this._minPitch=t;let e=this._unmodified;this.setPitch(Math.max(this.pitch,t)),this._unmodified=e}get maxPitch(){return this._maxPitch}setMaxPitch(t){if(this._maxPitch===t)return;this._maxPitch=t;let e=this._unmodified;this.setPitch(Math.min(this.pitch,t)),this._unmodified=e}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t}get constrainOverride(){return this._constrainOverride}setConstrainOverride(t){void 0===t&&(t=null),this._constrainOverride!==t&&(this._constrainOverride=t,this.constrainInternal(),this._calcMatrices())}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new u(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(t){let e=Mt(t,-180,180)*Math.PI/180;this._bearingInRadians!==e&&(this._unmodified=!1,this._bearingInRadians=e,this._calcMatrices(),this._rotationMatrix=N_(),function(t,e,i){var r=e[0],n=e[1],s=e[2],o=e[3],a=Math.sin(i),l=Math.cos(i);t[0]=r*l+s*a,t[1]=n*l+o*a,t[2]=r*-a+s*l,t[3]=n*-a+o*l}(this._rotationMatrix,this._rotationMatrix,-this._bearingInRadians))}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(t){let e=Dt(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==e&&(this._unmodified=!1,this._pitchInRadians=e,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(t){let e=t/180*Math.PI;this._rollInRadians!==e&&(this._unmodified=!1,this._rollInRadians=e,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return Vt(this._fovInRadians)}setFov(t){t=Dt(t,.1,150),this.fov!==t&&(this._unmodified=!1,this._fovInRadians=qt(t),this._calcMatrices())}get zoom(){return this._zoom}setZoom(t){let e=this.applyConstrain(this._center,t).zoom;this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this._tileZoom=Math.max(0,Math.floor(e)),this._scale=St(e),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(t){(t.lat!==this._center.lat||t.lng!==this._center.lng)&&(this._unmodified=!1,this._center=t,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(t){t!==this._elevation&&(this._elevation=t,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(t,e){this._autoCalculateNearFarZ=!1,this._nearZ=t,this._farZ=e,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,e,i){this._unmodified=!1,this._edgeInsets.interpolate(t,e,i),this.constrainInternal(),this._calcMatrices()}resize(t,e,i=!0){this._width=t,this._height=e,i&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){return 2!==this._latRange?.length||2!==this._lngRange?.length?null:new oy([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]])}setMaxBounds(t){t?(this._lngRange=[t.getWest(),t.getEast()],this._latRange=[t.getSouth(),t.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-Yt,Yt])}getCameraQueryGeometry(t,e){if(1===e.length)return[e[0],t];{let{minX:i,minY:r,maxX:n,maxY:s}=Fu.fromPoints(e).extend(t);return[new u(i,r),new u(n,r),new u(n,s),new u(i,s),new u(i,r)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;let t=this._unmodified,{center:e,zoom:i}=this.applyConstrain(this.center,this.zoom);this.setCenter(e),this.setZoom(i),this._unmodified=t,this._constraining=!1}_calcMatrices(){if(this._pixelPerMeter=Gu(1,this.center.lat)*this.worldSize,!this._width||!this._height)return;this._pixelsToGLUnits=[2/this._width,-2/this._height];let t=v(new Float64Array(16));D(t,t,[this._width/2,-this._height/2,1]),x(t,t,[1,-1,0]),this._clipSpaceToPixelsMatrix=t,t=v(new Float64Array(16)),D(t,t,[1,-1,1]),x(t,t,[-1,-1,0]),D(t,t,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=t,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height,this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(t,e,i,r){let n,s,o=void 0===i?this.bearing:i,a=r=void 0===r?this.pitch:r,{distanceToCenter:l,clampedElevation:h}=this._distanceToCenterFromAltElevationPitch(e,this.elevation,a),{x:u,y:c}=ec(a,o),f=Wu.fromLngLat(t,e),p=Zu(1,f.y),d=0;do{if(d+=1,d>10)break;s=l/p,n=new Wu(f.x+u*s,f.y+c*s),p=1/n.meterInMercatorCoordinateUnits()}while(Math.abs(l-s*p)>1e-12);return{center:n.toLngLat(),elevation:h,zoom:Ct(this.height/2/Math.tan(this.fovInRadians/2)/s/this.tileSize)}}recalculateZoomAndCenter(t){if(this.elevation-t==0)return;let e=1/this.worldSize,i=Gu(1,this.center.lat)*this.worldSize,r=Wu.fromLngLat(this.center,this.elevation),n=r.x/e,s=r.y/e,o=r.z/e,a=this.pitch,l=this.bearing,{x:h,y:u,z:c}=ec(a,l),f=this.cameraToCenterDistance,p=n+f*-h,d=s+f*-u,m=o+f*c,{distanceToCenter:_,clampedElevation:g}=this._distanceToCenterFromAltElevationPitch(m/i,t,a),y=_*i,v=new Wu((p+h*y)*e,(d+u*y)*e,0).toLngLat(),w=Gu(1,v.lat),b=Ct(this.height/2/Math.tan(this.fovInRadians/2)/_/w/this.tileSize);this._elevation=g,this._center=v,this.setZoom(b)}_distanceToCenterFromAltElevationPitch(t,e,i){let r,n=-Math.cos(qt(i)),s=t-e,o=e;return n*s>=0||Math.abs(n)<.1?(r=1e4,o=t+r*n):r=-s/n,{distanceToCenter:r,clampedElevation:o}}getCameraPoint(){let t=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new u(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getMercatorTileCoordinates(t){if(!t)return[0,0,1,1];let e=t.canonical.z>=0?1<<t.canonical.z:2**t.canonical.z;return[t.canonical.x/e,t.canonical.y/e,1/e/it,1/e/it]}},dw=class{distanceToTile2d(t,e,i,r){let n=r,s=n.distanceX([t,e]),o=n.distanceY([t,e]);return Math.hypot(s,o)}getWrap(t,e,i){return i}getTileBoundingVolume(t,e,i,r){let n=Math.min(0,i),s=Math.max(0,i);if(r?.terrain){let i=new cd(t.z,e,t.z,t.x,t.y),o=r.terrain.getMinMaxElevation(i);n=o.minElevation??n,s=o.maxElevation??s}let o=1<<t.z;return new Oy([e+t.x/o,t.y/o,n],[e+(t.x+1)/o,(t.y+1)/o,s])}allowVariableZoom(t,e){let i=Dt(78.5-t.fov*(Math.abs(Math.cos(t.rollInRadians))*t.height+Math.abs(Math.sin(t.rollInRadians))*t.width)/t.height/2,0,60);return!!e.terrain||t.pitch>i}allowWorldCopies(){return!0}prepareNextFrame(){}};const mw=$o([{name:"a_pos3d",type:"Int16",components:3}]);var _w=class extends ye{constructor(t){super(),this._lastTilesetChange=H_(),this.tileManager=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=t._source.tileSize*2**this.deltaZoom,t.usedForTerrain=!0,t.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null,this.releaseAllRTT()}getSource(){return this.tileManager._source}update(t,e){this.tileManager.update(t,e),this._renderableTilesKeys=[];let i={},r=!1;for(let n of Vy(t,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:e,calculateTileZoom:this.tileManager._source.calculateTileZoom}))i[n.key]=!0,this._renderableTilesKeys.push(n.key),this._tiles[n.key]||(n.terrainRttPosMatrix32f=new Float32Array(16),z(n.terrainRttPosMatrix32f,0,it,it,0,0,1),this._tiles[n.key]=new $y(n,this.tileSize),this._lastTilesetChange=H_(),r=!0);for(let t in this._tiles)i[t]||(this._tiles[t].releaseRTT(this.tileManager.map.painter),delete this._tiles[t],r=!0);return r}releaseRTT(t){for(let e in this._tiles){let i=this._tiles[e];(i.tileID.equals(t)||i.tileID.isChildOf(t)||t.isChildOf(i.tileID))&&i.releaseRTT(this.tileManager.map.painter)}}releaseAllRTT(){for(let t in this._tiles)this._tiles[t].releaseRTT(this.tileManager.map.painter)}getRenderableTiles(){return this._renderableTilesKeys.map((t=>this.getTileByID(t)))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t,e){return e?this._getTerrainCoordsForTileRanges(t,e):this._getTerrainCoordsForRegularTile(t)}_getTerrainCoordsForRegularTile(t){let e={};for(let i of this._renderableTilesKeys){let r=this._tiles[i].tileID,n=t.clone(),s=at();if(r.canonical.equals(t.canonical))z(s,0,it,it,0,0,1);else if(r.canonical.isChildOf(t.canonical)){let e=r.canonical.z-t.canonical.z,i=r.canonical.x-(r.canonical.x>>e<<e),n=r.canonical.y-(r.canonical.y>>e<<e),o=it>>e;z(s,0,o,o,0,0,1),x(s,s,[-i*o,-n*o,0])}else{if(!t.canonical.isChildOf(r.canonical))continue;{let e=t.canonical.z-r.canonical.z,i=t.canonical.x-(t.canonical.x>>e<<e),n=t.canonical.y-(t.canonical.y>>e<<e),o=it>>e;z(s,0,it,it,0,0,1),x(s,s,[i*o,n*o,0]),D(s,s,[1/2**e,1/2**e,0])}}n.terrainRttPosMatrix32f=new Float32Array(s),e[i]=n}return e}_getTerrainCoordsForTileRanges(t,e){let i={};for(let r of this._renderableTilesKeys){let n=this._tiles[r].tileID;if(!this._isWithinTileRanges(n,e))continue;let s=t.clone(),o=at();if(n.canonical.z===t.canonical.z){let e=t.canonical.x-n.canonical.x+t.wrap*(1<<t.canonical.z),i=t.canonical.y-n.canonical.y;z(o,0,it,it,0,0,1),x(o,o,[e*it,i*it,0])}else if(n.canonical.z>t.canonical.z){let e=n.canonical.z-t.canonical.z,i=n.canonical.x-(n.canonical.x>>e<<e)+t.wrap*(1<<n.canonical.z),r=n.canonical.y-(n.canonical.y>>e<<e),s=t.canonical.x-(n.canonical.x>>e),a=t.canonical.y-(n.canonical.y>>e),l=it>>e;z(o,0,l,l,0,0,1),x(o,o,[-i*l+s*it,-r*l+a*it,0])}else{let e=t.canonical.z-n.canonical.z,i=t.canonical.x-(t.canonical.x>>e<<e)+t.wrap*(1<<t.canonical.z),r=t.canonical.y-(t.canonical.y>>e<<e),s=(t.canonical.x>>e)-n.canonical.x,a=(t.canonical.y>>e)-n.canonical.y,l=it<<e;z(o,0,l,l,0,0,1),x(o,o,[i*it+s*l,r*it+a*l,0])}s.terrainRttPosMatrix32f=new Float32Array(o),i[r]=s}return i}getSourceTile(t,e){let i=this.tileManager._source,r=t.overscaledZ-this.deltaZoom;if(r>i.maxzoom&&(r=i.maxzoom),r<i.minzoom)return;this._sourceTileCache[t.key]||=t.scaledTo(r).key;let n=this.findTileInCaches(this._sourceTileCache[t.key]);if(!n?.dem&&e)for(;r>=i.minzoom&&!n?.dem;)n=this.findTileInCaches(t.scaledTo(r--).key);return n}findTileInCaches(t){let e=this.tileManager.getTileByID(t);return e||(e=this.tileManager._outOfViewCache.getByKey(t),e)}anyTilesAfterTime(t=H_()){return this._lastTilesetChange>=t}_isWithinTileRanges(t,e){let i=e[t.canonical.z];return!!i&&(t.wrap>i.minWrap||t.wrap<i.maxWrap||t.canonical.x>=i.minTileXWrapped&&t.canonical.x<=i.maxTileXWrapped&&t.canonical.y>=i.minTileY&&t.canonical.y<=i.maxTileY)}};const gw=it*(1-1e-12);var yw=class{constructor(t,e,i,r="auto"){this._meshCache={},this.painter=t,this.tileManager=new _w(e),this.options=i,this.exaggeration="number"==typeof i.exaggeration?i.exaggeration:1,this._terrainSkirtLength=r,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache=new Map,this._elevationSamplerCache=new Map}destroy(){this._fbo&&=(this._fbo.destroy(),null),this._fboDepthTexture&&=(this._fboDepthTexture.destroy(),null),this._emptyDemTexture&&=(this._emptyDemTexture.destroy(),null),this._emptyDepthTexture&&=(this._emptyDepthTexture.destroy(),null);for(let t in this._meshCache)this._meshCache[t].destroy();this._meshCache={},this.tileManager.destruct()}getDEMElevation(t,e,i,r=it){let n=t.normalizeCoordinates(e,i,r);if(!n)return 0;let s=this.getElevationSampler(n.tileID);return s?s(n.x,n.y,r):0}getElevationForLngLatZoom(t,e){if(!ld(e,t.wrap()))return 0;let{tileID:i,mercatorX:r,mercatorY:n}=this._getOverscaledTileIDFromLngLatZoom(t,e);return this.getElevation(i,r%it,n%it,it)}getElevationForLngLat(t,e){let i=this.getCoverageIndex();if(i){let e=Wu.fromLngLat(t),r=ww(i,this.exaggeration,e.x,e.y);if(r.demLoaded)return r.elevation}let r=Vy(e,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this}),n=0;for(let t of r)t.canonical.z>n&&(n=Math.min(t.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(t,n)}getElevation(t,e,i,r=it){return this.getDEMElevation(t,e,i,r)*this.exaggeration}resetElevationCache(){this._elevationSamplerCache.clear(),this._coverageIndex=void 0}getCoverageIndex(){return void 0===this._coverageIndex&&(this._coverageIndex=this._buildCoverageIndex()),this._coverageIndex}_buildCoverageIndex(){let t=[],e=new Map,i=0,r=0;for(let n of this.tileManager.getRenderableTiles()){if(!n)continue;let{canonical:s,wrap:o}=n.tileID;t.includes(s.z)||t.push(s.z);let a=this.getElevationSampler(n.tileID);e.set(`${o}/${s.z}/${s.x}/${s.y}`,a);let{minElevation:l,maxElevation:h}=this.getMinMaxElevation(n.tileID);i=Math.min(i,l??0),r=Math.max(r,h??0)}return 0===e.size?null:(t.sort(((t,e)=>e-t)),{zooms:t,samplerPerTile:e,minElevation:i-10,maxElevation:r+10})}getElevationSampler(t){let e=t.key,i=this._elevationSamplerCache.get(e);if(i)return i;let r=this.tileManager.getSourceTile(t,!0),n=r?.dem;if(!r||!n)return null;let s=this._getDEMTileMatrix(t,r),o=s[0]*n.dim,a=s[5]*n.dim,l=s[12]*n.dim-.5,h=s[13]*n.dim-.5,u=(t,e,i)=>{let r=8192===i?1:it/i;return n.sampleBilinear(t*r*o+l,e*r*a+h)};return this._elevationSamplerCache.set(e,u),u}_getDEMTileMatrix(t,e){let i=`${e.tileID.key}/${t.key}`,r=this._demMatrixCache.get(i);if(r)return r;let n=t.canonical.z-e.tileID.canonical.z,s=t.canonical.x-(t.canonical.x>>n<<n),o=t.canonical.y-(t.canonical.y>>n<<n),a=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}(new Float64Array(16),[1/(it<<n),1/(it<<n),0]);return x(a,a,[s*it,o*it,0]),this._demMatrixCache.set(i,a),a}getTerrainData(t){if(!this._emptyDemTexture){let t=this.painter.context,e=new sh({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new _h(t,e,t.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new _h(t,new sh({width:1,height:1}),t.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=v([])}let e=this.tileManager.getSourceTile(t,!0);if(e?.dem&&(!e.demTexture||e.needsTerrainPrepare)){let t=this.painter.context;e.demTexture||=this.painter.getTileTexture(e.dem.stride),e.demTexture?e.demTexture.update(e.dem.getPixels(),{premultiply:!1}):e.demTexture=new _h(t,e.dem.getPixels(),t.gl.RGBA,{premultiply:!1}),e.demTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),e.needsTerrainPrepare=!1}let i=e?this._getDEMTileMatrix(t,e):this._emptyDemMatrix;return{u_depth:2,u_terrain:3,u_terrain_dim:e?.dem?.dim||1,u_terrain_matrix:i,u_terrain_unpack:e?.dem?.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(e?.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:e}}getFramebuffer(){let t=this.painter,e=t.width/devicePixelRatio,i=t.height/devicePixelRatio;return this._fbo&&(this._fbo.width!==e||this._fbo.height!==i)&&(this._fbo.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture),this._fboDepthTexture||(this._fboDepthTexture=new _h(t.context,{width:e,height:i,data:null},t.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(t.context.gl.NEAREST,t.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=t.context.createFramebuffer(e,i,!0,!1),this._fbo.depthAttachment.set(t.context.createRenderbuffer(t.context.gl.DEPTH_COMPONENT16,e,i))),this._fbo.colorAttachment.set(this._fboDepthTexture.texture),this._fbo}getTerrainMesh(t){let e=this.painter.style.projection?.transitionState>0,i=e&&0===t.canonical.y,r=e&&t.canonical.y===(1<<t.canonical.z)-1,n=`m_${i?"n":""}_${r?"s":""}`;if(this._meshCache[n])return this._meshCache[n];let s=this.painter.context,o=new wa,a=new ja,l=this.meshSize,h=it/l,u=l*l;for(let t=0;t<=l;t++)for(let e=0;e<=l;e++)o.emplaceBack(e*h,t*h,0);for(let t=0;t<u;t+=l+1)for(let e=0;e<l;e++)a.emplaceBack(e+t,l+e+t+1,l+e+t+2),a.emplaceBack(e+t,l+e+t+2,e+t+1);"none"!==this._terrainSkirtLength&&this._buildSkirts(o,a,l,h,i,r);let c=new Dy(s.createVertexBuffer(o,mw.members),s.createIndexBuffer(a),La.simpleSegment(0,0,o.length,a.length));return this._meshCache[n]=c,c}getSkirtLength(t){return 2*Math.PI*Ru/2**Math.max(t,0)/5}getMinTileElevationForLngLatZoom(t,e){if(!ld(e,t.wrap()))return 0;let{tileID:i}=this._getOverscaledTileIDFromLngLatZoom(t,e);return this.getMinMaxElevation(i).minElevation??0}getMinMaxElevation(t){let e=this.tileManager.getSourceTile(t,!0),i={minElevation:null,maxElevation:null};return e?.dem&&(i.minElevation=e.dem.min*this.exaggeration,i.maxElevation=e.dem.max*this.exaggeration),i}_getOverscaledTileIDFromLngLatZoom(t,e){let i=Wu.fromLngLat(t.wrap()),r=(1<<e)*it,n=i.x*r,s=i.y*r,o=Math.floor(n/it),a=Math.floor(s/it);return{tileID:new cd(e,0,e,o,a),mercatorX:n,mercatorY:s}}_buildSkirts(t,e,i,r,n,s){let o=t.length,a=o+(i+1),l=(i+1)*i,h=n?uu:0,u=+!n,c=s?cu:it,f=+!s;for(let e=0;e<=i;e++)t.emplaceBack(e*r,h,u);for(let e=0;e<=i;e++)t.emplaceBack(e*r,c,f);for(let t=0;t<i;t++)e.emplaceBack(l+t,a+t,a+t+1),e.emplaceBack(l+t,a+t+1,l+t+1),e.emplaceBack(0+t,o+t+1,o+t),e.emplaceBack(0+t,0+t+1,o+t+1);let p=t.length,d=p+2*(i+1);for(let e of[0,1])for(let n=0;n<=i;n++)for(let i of[0,1])t.emplaceBack(e*it,n*r,i);for(let t=0;t<2*i;t+=2)e.emplaceBack(p+t,p+t+1,p+t+3),e.emplaceBack(p+t,p+t+3,p+t+2),e.emplaceBack(d+t,d+t+3,d+t+1),e.emplaceBack(d+t,d+t+2,d+t+3)}};const vw={covered:!1,demLoaded:!1,elevation:0};function ww(t,e,i,r){if(r<0||r>=1)return vw;let n=Math.floor(i),s=i-n;for(let i of t.zooms){let o=1<<i,a=s*o,l=r*o,h=Math.floor(a),u=Math.floor(l),c=`${n}/${i}/${h}/${u}`;if(!t.samplerPerTile.has(c))continue;let f=t.samplerPerTile.get(c);return f?{covered:!0,demLoaded:!0,elevation:f(Math.min((a-h)*it,gw),Math.min((l-u)*it,gw),it)*e}:{covered:!0,demLoaded:!1,elevation:0}}return vw}function bw(t,e){return t.covered&&e<=t.elevation+1e-6}function xw(t,e,i,r,n){for(let s=0;s<40&&r-i>n;s++){let n=(i+r)/2;e(t,n)?r=n:i=n}return{lo:i,hi:r}}var Dw=class t{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,e,i){this._helper.interpolatePadding(t,e,i)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,e,i=!0){this._helper.resize(t,e,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,e){this._helper.overrideNearFarZ(t,e)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t){}constructor(t,e){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(t,e)=>{e=Dt(+e,this.minZoom,this.maxZoom);let i={center:new Ou(t.lng,t.lat),zoom:e},r=this._helper._lngRange;!this._helper._renderWorldCopies&&null===r&&(r=[-179.9999999999,180-1e-10]);let n=this.tileSize*St(i.zoom),s=0,o=n,a=0,l=n,h=0,c=0,{x:f,y:p}=this.size;if(this._helper._latRange){let t=this._helper._latRange;s=Nu(t[1])*n,o=Nu(t[0])*n,o-s<p&&(h=p/(o-s))}r&&(a=Mt(Uu(r[0])*n,0,n),l=Mt(Uu(r[1])*n,0,n),l<a&&(l+=n),l-a<f&&(c=f/(l-a)));let d,m,{x:_,y:g}=Xu(n,t),y=Math.max(c||0,h||0);if(y){let t=new u(c?(l+a)/2:_,h?(o+s)/2:g);return i.center=Ju(n,t).wrap(),i.zoom+=Ct(y),i}if(this._helper._latRange){let t=p/2;g-t<s&&(m=s+t),g+t>o&&(m=o-t)}if(r){let t=(a+l)/2,e=_;this._helper._renderWorldCopies&&(e=Mt(_,t-n/2,t+n/2));let i=f/2;e-i<a&&(d=a+i),e+i>l&&(d=l-i)}if(void 0!==d||void 0!==m){let t=new u(d??_,m??g);i.center=Ju(n,t).wrap()}return i},this.applyConstrain=(t,e)=>this._helper.applyConstrain(t,e),this._helper=e??new pw({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(t,e)=>this.defaultConstrain(t,e)},t),this._coveringTilesDetailsProvider=new dw}clone(){let e=new t;return e.apply(this,!1),e}apply(t,e){this._helper.apply(t,e)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(t){let e=[new ud(0,t)];if(this._helper._renderWorldCopies){let i=this.screenPointToMercatorCoordinate(new u(0,0)),r=this.screenPointToMercatorCoordinate(new u(this._helper._width,0)),n=this.screenPointToMercatorCoordinate(new u(this._helper._width,this._helper._height)),s=this.screenPointToMercatorCoordinate(new u(0,this._helper._height)),o=Math.floor(Math.min(i.x,r.x,n.x,s.x)),a=Math.floor(Math.max(i.x,r.x,n.x,s.x));for(let i=o-1;i<=a+1;i++)0!==i&&e.push(new ud(i,t))}return e}getCameraFrustum(){return By.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){let e=this.screenPointToLocation(this.centerPoint,t),i=t?t.getElevationForLngLat(e,this):0;this._helper.recalculateZoomAndCenter(i)}setLocationAtPoint(t,e,i=this.elevation){let r=this.screenPointToMercatorCoordinateAtZ(e,i-this.elevation),n=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,0),s=Wu.fromLngLat(t),o=new Wu(s.x-(r.x-n.x),s.y-(r.y-n.y));this.setCenter(o?.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(t,e){return e?this.coordinatePoint(Wu.fromLngLat(t),e.getElevationForLngLat(t,this),this._pixelMatrix3D):this.coordinatePoint(Wu.fromLngLat(t))}screenPointToLocation(t,e){return this.screenPointToMercatorCoordinate(t,e)?.toLngLat()}screenPointToLocationAtElevation(t,e){return this.screenPointToMercatorCoordinateAtZ(t,e-this.elevation)?.toLngLat()}screenPointToMercatorCoordinate(t,e){if(e){let i=this.screenTerrainPointToMercatorCoordinate(t,e);if(null!=i)return i}return this.screenPointToMercatorCoordinateAtZ(t)}screenTerrainPointToMercatorCoordinate(t,e){let i=e.getCoverageIndex();if(!i)return null;let{near:r,far:n}=this.getRaySegmentFromPixel(t),s=this.worldSize,o=n[0]-r[0],a=n[1]-r[1],l=n[2]-r[2],h={index:i,exaggeration:e.exaggeration,near:r,dx:o,dy:a,dz:l,worldSize:s},u=0,c=1;if(0===l){if(r[2]>i.maxElevation||r[2]<i.minElevation)return null}else{let t=(i.maxElevation-r[2])/l,e=(i.minElevation-r[2])/l;if(u=Math.max(u,Math.min(t,e)),c=Math.min(c,Math.max(t,e)),u>c)return null}let f=Math.hypot(o,a),p=Dt(Math.ceil(f*(c-u)/4),1,512),d=0,m=!Ew(h,0);for(let t=0;t<=p;t++){let e=u+(c-u)*t/p;if(m){if(Ew(h,e)){let{lo:t,hi:i}=xw(h,Ew,d,e,.001/f),n=Mw(h,t),u=Mw(h,i),c=r[2]+t*l-n.elevation,p=r[2]+i*l-u.elevation,m=n.covered&&c>p?Dt(t+c*(i-t)/(c-p),t,i):i;return new Wu((r[0]+m*o)/s,(r[1]+m*a)/s,Mw(h,m).elevation)}}else m=!Ew(h,e);d=e}return null}getRaySegmentFromPixel(t){let e=[t.x,t.y,0,1],i=[t.x,t.y,1,1];Z(e,e,this._pixelMatrixInverse),Z(i,i,this._pixelMatrixInverse);let r=e[3],n=i[3],s=this.elevation;return{near:[e[0]/r,e[1]/r,e[2]/r+s],far:[i[0]/n,i[1]/n,i[2]/n+s]}}screenPointToMercatorCoordinateAtZ(t,e){let i=e||0,{near:r,far:n}=this.getRaySegmentFromPixel(t),s=r[2]===n[2]?0:(i+this.elevation-r[2])/(n[2]-r[2]);return new Wu(Oi.number(r[0],n[0],s)/this.worldSize,Oi.number(r[1],n[1],s)/this.worldSize,i)}coordinatePoint(t,e=0,i=this._pixelMatrix){let r=this._coordinateClipPoint(t,e,i),n=r[3];return n>0?new u(r[0]/n,r[1]/n):this._offScreenPointBehindCamera(r[0],r[1],n)}_coordinateClipPoint(t,e,i){let r=[t.x*this.worldSize,t.y*this.worldSize,e,1];return Z(r,r,i)}_offScreenPointBehindCamera(t,e,i){let r=this.width/2,n=this.height/2,s=t-r*i,o=e-n*i;0===s&&0===o&&(o=1);let a=n+this.height,l=Math.min(0===s?1/0:(r+this.width)/Math.abs(s),0===o?1/0:a/Math.abs(o));return new u(r+s*l,n+o*l)}getBounds(){let t=Math.max(0,this._helper._height/2-Ku(this));return(new oy).extend(this.screenPointToLocation(new u(0,t))).extend(this.screenPointToLocation(new u(this._helper._width,t))).extend(this.screenPointToLocation(new u(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new u(0,this._helper._height)))}isPointOnMapSurface(t,e){return e?null!=this.screenTerrainPointToMercatorCoordinate(t,e):t.y>this.height/2-Ku(this)}calculatePosMatrix(t,e=!1,i=!1){let r=t.key??fd(t.wrap,t.canonical.z,t.canonical.z,t.canonical.x,t.canonical.y),n=e?this._alignedPosMatrixCache:this._posMatrixCache;if(n.has(r)){let t=n.get(r);return i?t.f32:t.f64}let s=Qu(t,this.worldSize);b(s,e?this._alignedProjMatrix:this._viewProjMatrix,s);let o={f64:s,f32:new Float32Array(s)};return n.set(r,o),i?o.f32:o.f64}calculateFogMatrix(t){let e=t.key,i=this._fogMatrixCacheF32;if(i.has(e))return i.get(e);let r=Qu(t,this.worldSize);return b(r,this._fogMatrix,r),i.set(e,new Float32Array(r)),i.get(e)}calculateCenterFromCameraLngLatAlt(t,e,i,r){return this._helper.calculateCenterFromCameraLngLatAlt(t,e,i,r)}calculateCameraOptionsFromTo(t,e,i,r){let n=Wu.fromLngLat(t,e),s=Wu.fromLngLat(i,r),o=s.x-n.x,a=s.y-n.y,l=s.z-n.z,h=Math.hypot(o,a,l);if(0===h)throw Error("Can't calculate camera options with same From and To");let u=Math.hypot(o,a),c=Ct(this.cameraToCenterDistance/h/this.tileSize),f=Vt(Math.atan2(o,-a)),p=Vt(Math.acos(u/h));return p=l<0?90-p:90+p,{center:s.toLngLat(),elevation:r,zoom:c,pitch:p,bearing:f}}_calculateNearFarZ(t,e,i){let r=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),n=t-r*this._helper._pixelPerMeter/Math.cos(e),s=r<0?n:t,o=Math.PI/2+this.pitchInRadians,a=qt(this.fov)*(Math.abs(Math.cos(qt(this.roll)))*this.height+Math.abs(Math.sin(qt(this.roll)))*this.width)/this.height*(.5+i.y/this.height),l=Math.sin(a)*s/Math.sin(Dt(Math.PI-o-a,.01,Math.PI-.01)),h=Ku(this),u=Math.atan(h/this._helper.cameraToCenterDistance),c=qt(.75),f=u>c?2*u*(.5+i.y/(2*h)):c,p=Math.sin(f)*s/Math.sin(Dt(Math.PI-o-f,.01,Math.PI-.01)),d=Math.min(l,p);this._helper._farZ=1.01*(Math.cos(Math.PI/2-e)*d+s),this._helper._nearZ=this._helper._height/50}_calcMatrices(t=this._helper.autoCalculateNearFarZ){let e,i=this.centerOffset,r=Xu(this.worldSize,this.center),n=r.x,s=r.y,o=qt(Math.min(this.pitch,Hu)),a=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(o));t&&this._calculateNearFarZ(a,o,i),e=new Float64Array(16),F(e,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),function(t,e){t[0]=1/e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1/e[5],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=0,t[11]=1/e[14],t[12]=0,t[13]=0,t[14]=-1,t[15]=e[10]/e[14]}(this._invProjMatrix,e),e[8]=2*-i.x/this._helper._width,e[9]=2*i.y/this._helper._height,this._projectionMatrix=y(e),D(e,e,[1,-1,1]),x(e,e,[0,0,-this._helper.cameraToCenterDistance]),A(e,e,-this.rollInRadians),M(e,e,this.pitchInRadians),A(e,e,-this.bearingInRadians),x(e,e,[-n,-s,0]),this._mercatorMatrix=D([],e,[this.worldSize,this.worldSize,this.worldSize]),D(e,e,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=b(new Float64Array(16),this.clipSpaceToPixelsMatrix,e),x(e,e,[0,0,-this.elevation]),this._viewProjMatrix=e,this._invViewProjMatrix=w([],e);let l=[0,0,-1,1];Z(l,l,this._invViewProjMatrix),this._cameraPosition=[l[0]/l[3],l[1]/l[3],l[2]/l[3]],this._fogMatrix=new Float64Array(16),F(this._fogMatrix,this.fovInRadians,this.width/this.height,a,this._helper._farZ),this._fogMatrix[8]=2*-i.x/this.width,this._fogMatrix[9]=2*i.y/this.height,D(this._fogMatrix,this._fogMatrix,[1,-1,1]),x(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),A(this._fogMatrix,this._fogMatrix,-this.rollInRadians),M(this._fogMatrix,this._fogMatrix,this.pitchInRadians),A(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),x(this._fogMatrix,this._fogMatrix,[-n,-s,0]),D(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),x(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=b(new Float64Array(16),this.clipSpaceToPixelsMatrix,e);let h=this._helper._width%2/2,u=this._helper._height%2/2,c=Math.cos(this.bearingInRadians),f=Math.sin(-this.bearingInRadians),p=n-Math.round(n)+c*h+f*u,d=s-Math.round(s)+c*u+f*h,m=new Float64Array(e);if(x(m,m,[p>.5?p-1:p,d>.5?d-1:d,0]),this._alignedProjMatrix=m,e=w(new Float64Array(16),this._pixelMatrix),!e)throw Error("failed to invert matrix");this._pixelMatrixInverse=e,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;let t=this.screenPointToMercatorCoordinate(new u(0,0)),e=[t.x*this.worldSize,t.y*this.worldSize,0,1];return Z(e,e,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this.cameraToCenterDistance/this.pixelsPerMeter+this.elevation}getCameraLngLat(){let t=Gu(1,this.center.lat)*this.worldSize;return tc(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/t).toLngLat()}getProjectionData(t){let e,{overscaledTileID:i,aligned:r,applyTerrainMatrix:n}=t,s=this._helper.getMercatorTileCoordinates(i),o=i?this.calculatePosMatrix(i,r,!0):null;return e=i?.terrainRttPosMatrix32f&&n?i.terrainRttPosMatrix32f:o||ht(),{mainMatrix:e,tileMercatorCoords:s,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:e,clipAntimeridian:!1}}isLocationOccluded(t,e,i){if(!e?.getCoverageIndex())return!1;let r=Wu.fromLngLat(t);i??=e.getElevationForLngLat(t,this);let n=this._coordinateClipPoint(r,i,this._pixelMatrix3D),s=n[3];if(s<=0||n[2]>s)return!0;let o=new u(n[0]/s,n[1]/s),a=this.screenTerrainPointToMercatorCoordinate(o,e);if(null==a)return!1;let l=this.getRaySegmentFromPixel(o),h=Aw(l,r.x*this.worldSize,r.y*this.worldSize,i);return Aw(l,a.x*this.worldSize,a.y*this.worldSize,a.z)<.99*h}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(t,e,i){return 1}transformLightDirection(t){return C(t)}getRayDirectionFromPixel(t){throw Error("Not implemented.")}projectTileCoordinates(t,e,i,r){let n,s=this.calculatePosMatrix(i);null==r?(n=[t,e,0,1],Fv(n,n,s)):(n=[t,e,r,1],Z(n,n,s));let o=n[3];return{point:new u(n[0]/o,n[1]/o),signedDistanceFromCamera:o,isOccluded:!1}}populateCache(t){for(let e of t)this.calculatePosMatrix(e)}getProjectionDataForCustomLayer(t=!0){let e=new cd(0,0,0,0,0),i=this.getProjectionData({overscaledTileID:e,applyGlobeMatrix:t}),r=Qu(e,this.worldSize);b(r,this._viewProjMatrix,r);let n=[it,it,this.worldSize/this._helper.pixelsPerMeter],s=at();return D(s,r,n),{...i,tileMercatorCoords:[0,0,1,1],fallbackMatrix:s,mainMatrix:s}}getFastPathSimpleProjectionMatrix(t){return this.calculatePosMatrix(t)}};function Mw(t,e){return ww(t.index,t.exaggeration,(t.near[0]+e*t.dx)/t.worldSize,(t.near[1]+e*t.dy)/t.worldSize)}function Ew(t,e){return bw(Mw(t,e),t.near[2]+e*t.dz)}function Aw({near:t,far:e},i,r,n){let s=e[0]-t[0],o=e[1]-t[1],a=e[2]-t[2];return((i-t[0])*s+(r-t[1])*o+(n-t[2])*a)/(s*s+o*o+a*a)}function Fw(){Rt("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function zw(t){if(t.useSlerp)if(t.k<1){let e=Ht(t.startEulerAngles.roll,t.startEulerAngles.pitch,t.startEulerAngles.bearing),i=Ht(t.endEulerAngles.roll,t.endEulerAngles.pitch,t.endEulerAngles.bearing),r=new Float64Array(4);!function(t,e,i,r){var n,s,o,a,l=e[0],h=e[1],u=e[2],c=e[3],f=i[0],p=i[1],d=i[2],m=i[3],_=l*f+h*p+u*d+c*m;_<0&&(_=-_,f=-f,p=-p,d=-d,m=-m),1-_>1e-6?(n=Math.acos(_),s=Math.sin(n),o=Math.sin((1-r)*n)/s,a=Math.sin(r*n)/s):(o=1-r,a=r),t[0]=o*l+a*f,t[1]=o*h+a*p,t[2]=o*u+a*d,t[3]=o*c+a*m}(r,e,i,t.k);let n=function(t){let e=new Float64Array(9);!function(t,e){var i=e[0],r=e[1],n=e[2],s=e[3],o=i+i,a=r+r,l=n+n,h=i*o,u=r*o,c=r*a,f=n*o,p=n*a,d=n*l,m=s*o,_=s*a,g=s*l;t[0]=1-c-d,t[3]=u-g,t[6]=f+_,t[1]=u+g,t[4]=1-h-d,t[7]=p-m,t[2]=f-_,t[5]=p+m,t[8]=1-h-c}(e,t);let i,r,n=Vt(-Math.asin(Dt(e[2],-1,1)));return Math.hypot(e[5],e[8])<.001?(i=0,r=-Vt(Math.atan2(e[3],e[4]))):(i=Vt(0===e[5]&&0===e[8]?0:Math.atan2(e[5],e[8])),r=Vt(0===e[1]&&0===e[0]?0:Math.atan2(e[1],e[0]))),{roll:i,pitch:n+90,bearing:r}}(r);t.tr.setRoll(n.roll),t.tr.setPitch(n.pitch),t.tr.setBearing(n.bearing)}else t.tr.setRoll(t.endEulerAngles.roll),t.tr.setPitch(t.endEulerAngles.pitch),t.tr.setBearing(t.endEulerAngles.bearing);else t.tr.setRoll(Oi.number(t.startEulerAngles.roll,t.endEulerAngles.roll,t.k)),t.tr.setPitch(Oi.number(t.startEulerAngles.pitch,t.endEulerAngles.pitch,t.k)),t.tr.setBearing(Oi.number(t.startEulerAngles.bearing,t.endEulerAngles.bearing,t.k))}function Sw(t,e,i,r,n){let s=n.padding,o=Xu(n.worldSize,i.getNorthWest()),a=Xu(n.worldSize,i.getNorthEast()),l=Xu(n.worldSize,i.getSouthEast()),h=Xu(n.worldSize,i.getSouthWest()),c=qt(-r),f=o.rotate(c),p=a.rotate(c),d=l.rotate(c),m=h.rotate(c),_=new u(Math.max(f.x,p.x,m.x,d.x),Math.max(f.y,p.y,m.y,d.y)),g=new u(Math.min(f.x,p.x,m.x,d.x),Math.min(f.y,p.y,m.y,d.y)),y=_.sub(g),v=(n.width-(s.left+s.right+e.left+e.right))/y.x,w=(n.height-(s.top+s.bottom+e.top+e.bottom))/y.y;if(w<0||v<0)return void Fw();let b=Math.min(Ct(n.scale*Math.min(v,w)),t.maxZoom),x=u.convert(t.offset),D=new u((e.left-e.right)/2,(e.top-e.bottom)/2).rotate(qt(r)),M=x.add(D).mult(n.scale/St(b));return{center:Ju(n.worldSize,o.add(l).div(2).sub(M)),zoom:b,bearing:r}}var Cw=class{get useGlobeControls(){return!1}handlePanInertia(t,e){let i=t.mag(),r=Math.abs(Ku(e));return{easingOffset:t.mult(Math.min(.75*r/i,1)),easingCenter:e.center}}handleMapControlsRollPitchBearingZoom(t,e){t.bearingDelta&&e.setBearing(e.bearing+t.bearingDelta),t.pitchDelta&&e.setPitch(e.pitch+t.pitchDelta),t.rollDelta&&e.setRoll(e.roll+t.rollDelta),t.zoomDelta&&e.setZoom(e.zoom+t.zoomDelta)}handleMapControlsPan(t,e,i){t.around.distSqr(e.centerPoint)<.01||e.setLocationAtPoint(i,t.around,t.aroundElevation)}cameraForBoxAndBearing(t,e,i,r,n){return Sw(t,e,i,r,n)}handleJumpToCenterZoom(t,e){t.zoom!==(void 0===e.zoom?t.zoom:+e.zoom)&&t.setZoom(+e.zoom),void 0!==e.center&&t.setCenter(Ou.convert(e.center))}handleEaseTo(t,e){let i=t.zoom,r=t.padding,n={roll:t.roll,pitch:t.pitch,bearing:t.bearing},s={roll:void 0===e.roll?t.roll:e.roll,pitch:void 0===e.pitch?t.pitch:e.pitch,bearing:void 0===e.bearing?t.bearing:e.bearing},o=void 0!==e.zoom,a=!t.isPaddingEqual(e.padding),l=!1,h=o?+e.zoom:t.zoom,u=t.centerPoint.add(e.offsetAsPoint),c=t.screenPointToLocation(u),{center:f,zoom:p}=t.applyConstrain(Ou.convert(e.center||c),h??i);cw(t,f);let d=Xu(t.worldSize,c),m=Xu(t.worldSize,f).sub(d),_=St(p-i);return l=p!==i,{easeFunc:o=>{if(l&&t.setZoom(Oi.number(i,p,o)),Zt(n,s)||zw({startEulerAngles:n,endEulerAngles:s,tr:t,k:o,useSlerp:n.roll!=s.roll}),a&&(t.interpolatePadding(r,e.padding,o),u=t.centerPoint.add(e.offsetAsPoint)),e.around)t.setLocationAtPoint(e.around,e.aroundPoint);else{let e=St(t.zoom-i),r=(p>i?Math.min(2,_):Math.max(.5,_))**(1-o),n=Ju(t.worldSize,d.add(m.mult(o*r)).mult(e));t.setLocationAtPoint(t.renderWorldCopies?n.wrap():n,u)}},isZooming:l,elevationCenter:f}}handleFlyTo(t,e){let i=void 0!==e.zoom,r=t.zoom,n=t.applyConstrain(Ou.convert(e.center||e.locationAtOffset),i?+e.zoom:r),s=n.center,o=n.zoom;cw(t,s);let a=t.worldSize,l=Xu(a,e.locationAtOffset),h=Xu(a,s).sub(l),u=h.mag(),c=St(o-r),f=Math.max(void 0===e.minZoom?t.minZoom:+e.minZoom,t.minZoom),p=Math.min(f,r,o),d=t.applyConstrain(s,p).zoom;return{easeFunc:(e,i,n,u)=>{t.setZoom(1===e?o:r+Ct(i));let c=1===e?s:Ju(a,l.add(h.mult(n)));t.setLocationAtPoint(t.renderWorldCopies?c.wrap():c,u)},scaleOfZoom:c,targetCenter:s,scaleOfMinZoom:St(d-r),pixelPathLength:u}}};let Tw;const Pw=new hu({fill:new lu(128,2),line:new lu(512,0),tile:new lu(128,32),stencil:new lu(128,1),circle:3});var Iw=class{constructor(){this._tileMeshCache={}}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return"globe"}get shaderDefine(){return"#define GLOBE"}get shaderPreludeCode(){return sw.projectionGlobe}get vertexShaderPreludeCode(){return sw.projectionMercator.vertexSource}get subdivisionGranularity(){return Pw}get useGlobeControls(){return!0}destroy(){}_getMeshKey(t){return`${t.granularity.toString(36)}_${t.generateBorders?"b":""}${t.extendToNorthPole?"n":""}${t.extendToSouthPole?"s":""}`}getMeshFromTileID(t,e,i,r,n){let s=("stencil"===n?Pw.stencil:Pw.tile).getGranularityForZoomLevel(e.z);return this._getMesh(t,{granularity:s,generateBorders:i,extendToNorthPole:0===e.y&&r,extendToSouthPole:e.y===(1<<e.z)-1&&r})}_getMesh(t,e){let i=this._getMeshKey(e);if(i in this._tileMeshCache)return this._tileMeshCache[i];let r=Ey(t,e);return this._tileMeshCache[i]=r,r}recalculate(t){}hasTransition(){return!1}},kw=class extends ye{constructor(t,e){super(),this._transitionable=new uo(Tw||=new Mo({type:new vo(we.projection.type,"type")}),"projection",e),this.setProjection(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new ao(0)),this._mercatorProjection=new hw,this._verticalPerspectiveProjection=new Iw}get transitionState(){let t=this.properties.get("type");if("string"==typeof t&&"mercator"===t)return 0;if("string"==typeof t&&"vertical-perspective"===t)return 1;if(t instanceof Ei){if(t.from===t.to)return"mercator"===t.from?0:1;if("vertical-perspective"===t.from&&"mercator"===t.to)return 1-t.transition;if("mercator"===t.from&&"vertical-perspective"===t.to)return t.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}getMeshFromTileID(t,e,i,r,n){return this.currentProjection.getMeshFromTileID(t,e,i,r,n)}setProjection(t){this._transitionable.setValue("type",t?.type||"mercator")}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}};function $w(t){let e=Ow(t.worldSize,t.center.lat);return 2*Math.PI*e}function jw(t,e,i,r,n){let s=1/(1<<n),o=e/it*s+r*s,a=gt((t/it*s+i*s)*Math.PI*2+Math.PI,2*Math.PI),l=2*Math.atan(Math.exp(Math.PI-o*Math.PI*2))-.5*Math.PI,h=Math.cos(l),u=new Float64Array(3);return u[0]=Math.sin(a)*h,u[1]=Math.sin(l),u[2]=Math.cos(a)*h,u}function Rw(t){return function(t,e){let i=Math.cos(e),r=new Float64Array(3);return r[0]=Math.sin(t)*i,r[1]=Math.sin(e),r[2]=Math.cos(t)*i,r}(t.lng*Math.PI/180,t.lat*Math.PI/180)}function Ow(t,e){return t/(2*Math.PI)/Math.cos(e*Math.PI/180)}function Bw(t){let e=Z(st(),[0,0,0,1],t.modelViewProjectionMatrix);return Z(e,e,t.inverseProjectionMatrix),[e[0]/e[3],e[1]/e[3],e[2]/e[3]]}function Lw(t){let e=Math.asin(t[1])/Math.PI*180,i=Math.sqrt(t[0]*t[0]+t[2]*t[2]);if(i>1e-6){let r=t[0]/i,n=Math.acos(t[2]/i),s=(r>0?n:-n)/Math.PI*180;return new Ou(Mt(s,-180,180),e)}return new Ou(0,e)}const Uw=.98*Math.PI;function Nw(t,e){let i=t.cameraPosition,r=T(i);if(r<=1)return t.screenPointToLocation(e);let n=ot();R(n,i);let s=t.getRayDirectionFromPixel(e),o=-O(s,n),a=ot();j(a,s,n,o);let l=T(a);if(l<1e-9)return t.screenPointToLocation(e);let h=Math.atan2(l,o),u=.9*Math.asin(1/r);if(h<u)return t.screenPointToLocation(e);let c=r*Math.sin(u),f=Math.asin(Dt(c,-1,1))-u,p=r*Math.cos(u)/Math.sqrt(Math.max(1-c*c,1e-12))-1,d=Uw-f,m=h-u,_=f+p*m*d/(d+p*m),g=ot();$(g,a,1/l);let y=ot();return $(y,n,Math.cos(Dt(_,0,Uw))),j(y,y,g,Math.sin(Dt(_,0,Uw))),R(y,y),Lw(y)}function Gw(t){return Math.cos(t*Math.PI/180)}function qw(t,e){let i=Gw(t);return Ct(Gw(e)/i)}function Vw(t){let e=.5*t,i=Math.sin(e),r=Math.cos(e);return Math.log(i+r)-Math.log(r-i)}function Zw(t,e,i,r){let n=t.lat+i*r;if(Math.abs(i)>1){let s=(Math.sign(t.lat+i)===Math.sign(t.lat)?Math.abs(t.lat):-Math.abs(t.lat))*Math.PI/180,o=Math.abs(t.lat+i)*Math.PI/180,a=Vw(s+r*(o-s)),l=Vw(s),h=Vw(o);return new Ou(t.lng+e*((a-l)/(h-l)),n)}return new Ou(t.lng+e*r,n)}function Ww(t,e,i=1){let r=O(t,e),n=i*i,s=ot(),o=ot();$(o,e,r),q(s,t,o);let a=n-O(s,s);if(a<0)return null;let l=O(t,t)-n,h=-r+(r<0?1:-1)*Math.sqrt(a),u=l/h,c=h;return{tMin:Math.min(u,c),tMax:Math.max(u,c)}}var Hw=class{constructor(t){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=t}swapBuffers(){if(!this._hadAnyChanges)return;let t=this._cachePrevious;this._cachePrevious=this._cache,this._cache=t,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(t,e,i,r){let n=`${t.z}_${t.x}_${t.y}_${r?.terrain?"t":""}_${Math.round(i)}`,s=this._cache.get(n);if(s)return s;let o=this._cachePrevious.get(n);if(o)return this._cache.set(n,o),o;let a=this._boundingVolumeFactory(t,e,i,r);return this._cache.set(n,a),this._hadAnyChanges=!0,a}},Yw=class t{constructor(t,e,i,r){this.min=i,this.max=r,this.points=t,this.planes=e}static fromAabb(e,i){let r=[];for(let t=0;t<8;t++)r.push([1&~t?e[0]:i[0],1==(t>>1&1)?i[1]:e[1],1==(t>>2&1)?i[2]:e[2]]);return new t(r,[[-1,0,0,i[0]],[1,0,0,-e[0]],[0,-1,0,i[1]],[0,1,0,-e[1]],[0,0,-1,i[2]],[0,0,1,-e[2]]],e,i)}static fromCenterSizeAngles(e,i,r){let n=H([],r[0],r[1],r[2]),s=L([],[i[0],0,0],n),o=L([],[0,i[1],0],n),a=L([],[0,0,i[2]],n),l=[...e],h=[...e];for(let t=0;t<8;t++)for(let i=0;i<3;i++){let r=e[i]+s[i]*(1&~t?-1:1)+o[i]*(1==(t>>1&1)?1:-1)+a[i]*(1==(t>>2&1)?1:-1);l[i]=Math.min(l[i],r),h[i]=Math.max(h[i],r)}let u=[];for(let t=0;t<8;t++){let i=[...e];I(i,i,$([],s,1&~t?-1:1)),I(i,i,$([],o,1==(t>>1&1)?1:-1)),I(i,i,$([],a,1==(t>>2&1)?1:-1)),u.push(i)}return new t(u,[[...s,-O(s,u[0])],[...o,-O(o,u[0])],[...a,-O(a,u[0])],[-s[0],-s[1],-s[2],-O(s,u[7])],[-o[0],-o[1],-o[2],-O(o,u[7])],[-a[0],-a[1],-a[2],-O(a,u[7])]],l,h)}intersectsFrustum(t){let e=!0,i=this.points.length,r=this.planes.length,n=t.planes.length,s=t.points.length;for(let r=0;r<n;r++){let n=t.planes[r],s=0;for(let t=0;t<i;t++){let e=this.points[t];n[0]*e[0]+n[1]*e[1]+n[2]*e[2]+n[3]>=0&&s++}if(0===s)return 0;s<i&&(e=!1)}if(e)return 2;for(let e=0;e<r;e++){let i=this.planes[e],r=0;for(let e=0;e<s;e++){let n=t.points[e];i[0]*n[0]+i[1]*n[1]+i[2]*n[2]+i[3]>=0&&r++}if(0===r)return 0}return 1}intersectsPlane(t){let e=this.points.length,i=0;for(let r=0;r<e;r++){let e=this.points[r];t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]>=0&&i++}return i===e?2:0===i?0:1}};function Xw(t,e,i){let r=t-e;return r<0?-r:Math.max(0,r-i)}function Jw(t,e,i,r,n){let s,o=t-i;return s=o<0?Math.min(-o,1+o-n):o>n?Math.min(Math.max(o-n,0),1-o):0,Math.max(s,Xw(e,r,n))}var Kw=class{constructor(){this._boundingVolumeCache=new Hw(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(t,e,i,r){let n=1<<i.z,s=1/n,o=i.x/n,a=i.y/n,l=2;return l=Math.min(l,Jw(t,e,o,a,s)),l=Math.min(l,Jw(t,e,o+.5,-a-s,s)),l=Math.min(l,Jw(t,e,o+.5,2-a-s,s)),l}getWrap(t,e,i){let r=1<<e.z,n=1/r,s=e.x/r,o=Xw(t.x,s,n),a=Xw(t.x,s-1,n),l=Xw(t.x,s+1,n),h=Math.min(o,a,l);return h===l?1:h===a?-1:0}allowVariableZoom(t,e){return qy(t,e)>4}allowWorldCopies(){return!1}getTileBoundingVolume(t,e,i,r){return this._boundingVolumeCache.getTileBoundingVolume(t,e,i,r)}_computeTileBoundingVolume(t,e,i,r){let n=Math.min(0,i),s=Math.max(0,i);if(r?.terrain){let i=new cd(t.z,e,t.z,t.x,t.y),o=r.terrain.getMinMaxElevation(i);n=o.minElevation??n,s=Math.max(o.maxElevation??s,s)}if(n/=Ru,s/=Ru,n+=1,s+=1,t.z<=0)return Yw.fromAabb([-s,-s,-s],[s,s,s]);if(1===t.z)return Yw.fromAabb([0===t.x?-s:0,0===t.y?0:-s,-s],[0===t.x?0:s,0===t.y?s:0,s]);{let e=[jw(0,0,t.x,t.y,t.z),jw(it,0,t.x,t.y,t.z),jw(it,it,t.x,t.y,t.z),jw(0,it,t.x,t.y,t.z)],i=[];for(let t of e)i.push($([],t,s));if(s!==n)for(let t of e)i.push($([],t,n));0===t.y&&i.push([0,1,0]),t.y===(1<<t.z)-1&&i.push([0,-1,0]);let r=[1,1,1],o=[-1,-1,-1];for(let t of i)for(let e=0;e<3;e++)r[e]=Math.min(r[e],t[e]),o[e]=Math.max(o[e],t[e]);let a=jw(it/2,it/2,t.x,t.y,t.z),l=B([],[0,1,0],a);R(l,l);let h=B([],a,l);R(h,h);let u=B([],e[2],e[1]);R(u,u);let c=B([],e[0],e[3]);R(c,c),i.push($([],a,s)),t.y>=(1<<t.z)/2&&i.push($([],jw(it/2,0,t.x,t.y,t.z),s)),t.y<(1<<t.z)/2&&i.push($([],jw(it/2,it,t.x,t.y,t.z),s));let f=Qw(a,i),p=Qw(h,i),d=[-a[0],-a[1],-a[2],f.max],m=[a[0],a[1],a[2],-f.min],_=[-h[0],-h[1],-h[2],p.max],g=[h[0],h[1],h[2],-p.min],y=[...u,0],v=[...c,0],w=[];return 0===t.y?w.push(ft(v,y,d),ft(v,y,m)):w.push(ft(_,y,d),ft(_,y,m),ft(_,v,d),ft(_,v,m)),t.y===(1<<t.z)-1?w.push(ft(v,y,d),ft(v,y,m)):w.push(ft(g,y,d),ft(g,y,m),ft(g,v,d),ft(g,v,m)),new Yw(w,[d,m,_,g,y,v],r,o)}}};function Qw(t,e){let i=1/0,r=-1/0;for(let n of e){let e=O(t,n);i=Math.min(i,e),r=Math.max(r,e)}return{min:i,max:r}}var tb=class t{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,e,i){this._helper.interpolatePadding(t,e,i)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,e){this._helper.resize(t,e)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,e){this._helper.overrideNearFarZ(t,e)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t){}constructor(t,e){this._cachedClippingPlane=st(),this._projectionMatrix=lt(),this._globeViewProjMatrix32f=ht(),this._globeViewProjMatrixF64=lt(),this._globeViewProjMatrixF64Inverted=lt(),this._globeProjMatrixInverted=lt(),this._cameraPosition=ot(),this.defaultConstrain=(t,e)=>{let i=Dt(t.lat,-Yt,Yt),r=Dt(+e,this.minZoom+qw(0,i),this.maxZoom);return{center:new Ou(t.lng,i),zoom:r}},this.applyConstrain=(t,e)=>this._helper.applyConstrain(t,e),this._helper=e??new pw({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(t,e)=>this.defaultConstrain(t,e)},t),this._coveringTilesDetailsProvider=new Kw}clone(){let e=new t;return e.apply(this,!1),e}apply(t,e){this._helper.apply(t,e)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixF64}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){let t=ot();return t[0]=this._cameraPosition[0],t[1]=this._cameraPosition[1],t[2]=this._cameraPosition[2],t}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(t){let{overscaledTileID:e,applyGlobeMatrix:i}=t,r=this._helper.getMercatorTileCoordinates(e);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:r,clippingPlane:this._cachedClippingPlane,projectionTransition:+!!i,fallbackMatrix:this._globeViewProjMatrix32f,clipAntimeridian:0===e?.canonical.z}}_computeClippingPlane(t){let e=this.pitchInRadians,i=this.cameraToCenterDistance/t,r=Math.sin(e)*i,n=Math.cos(e)*i+1,s=1/Math.sqrt(r*r+n*n)*1,o=-r,a=n,l=Math.sqrt(o*o+a*a);o/=l,a/=l;let h=[0,o,a];G(h,h,[0,0,0],-this.bearingInRadians),U(h,h,[0,0,0],-1*this.center.lat*Math.PI/180),N(h,h,[0,0,0],this.center.lng*Math.PI/180);let u=1/T(h);return $(h,h,u),[...h,-s*u]}isLocationOccluded(t,e,i){let r=e?.getCoverageIndex();i??=r?e.getElevationForLngLat(t,this):0;let n=rb(t,i);if(!this.isSurfacePointVisible(n))return!0;if(!r)return!1;let s=this._projectSurfacePointToScreen(n),o=this.cameraPosition,a=this.getRayDirectionFromPixel(s),l=nb(o,a,n);if(l<=0)return!0;let h=this.screenTerrainPointToMercatorCoordinate(s,e);return null!=h&&nb(o,a,rb(h.toLngLat(),h.z))<.99*l}transformLightDirection(t){let e=this._helper._center.lng*Math.PI/180,i=this._helper._center.lat*Math.PI/180,r=Math.cos(i),n=[Math.sin(e)*r,Math.sin(i),Math.cos(e)*r],s=[n[2],0,-n[0]],o=[0,0,0];B(o,s,n),R(s,s),R(o,o);let a=[0,0,0];return R(a,[s[0]*t[0]+o[0]*t[1]+n[0]*t[2],s[1]*t[0]+o[1]*t[1]+n[1]*t[2],s[2]*t[0]+o[2]*t[1]+n[2]*t[2]]),a}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(t,e,i){let r=Yu(t,e,i.canonical),n=function(t,e){return[gt(t*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-e*Math.PI*2))-.5*Math.PI]}(r.x,r.y);return this.getCircleRadiusCorrection()/Math.cos(n[1])}projectTileCoordinates(t,e,i,r){let n,s=i.canonical,o=jw(t,e,s.x,s.y,s.z),a=1+(r??0)/Ru,l=o[0]*a,h=o[1]*a,c=o[2]*a,f=[l,h,c,1];if(Z(f,f,this._globeViewProjMatrixF64),a<=1){let t=this._cachedClippingPlane;n=t[0]*o[0]+t[1]*o[1]+t[2]*o[2]+t[3]<0}else n=this._isLineOfSightBlocked(l,h,c);return{point:new u(f[0]/f[3],f[1]/f[3]),signedDistanceFromCamera:f[3],isOccluded:n}}_isLineOfSightBlocked(t,e,i){let r=this._cameraPosition,n=t-r[0],s=e-r[1],o=i-r[2],a=n*n+s*s+o*o;if(0===a)return!1;let l=Dt(-(r[0]*n+r[1]*s+r[2]*o)/a,0,1),h=r[0]+l*n,u=r[1]+l*s,c=r[2]+l*o;return h*h+u*u+c*c<1}_calcMatrices(t=this._helper.autoCalculateNearFarZ){let e=Ow(this.worldSize,this.center.lat),i=at();t&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*e),F(i,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);let r=this.centerOffset;i[8]=2*-r.x/this._helper._width,i[9]=2*r.y/this._helper._height,this._projectionMatrix=y(i),this._globeProjMatrixInverted=at(),w(this._globeProjMatrixInverted,i),x(i,i,[0,0,-this.cameraToCenterDistance]),A(i,i,this.rollInRadians),M(i,i,-this.pitchInRadians),A(i,i,this.bearingInRadians),x(i,i,[0,0,-e]);let n=ot();n[0]=e,n[1]=e,n[2]=e,M(i,i,this.center.lat*Math.PI/180),E(i,i,-this.center.lng*Math.PI/180),D(i,i,n),this._globeViewProjMatrixF64=i,this._globeViewProjMatrix32f=new Float32Array(i),this._globeViewProjMatrixF64Inverted=at(),w(this._globeViewProjMatrixF64Inverted,i);let s=ot();this._cameraPosition=ot(),this._cameraPosition[2]=this.cameraToCenterDistance/e,G(this._cameraPosition,this._cameraPosition,s,-this.rollInRadians),U(this._cameraPosition,this._cameraPosition,s,this.pitchInRadians),G(this._cameraPosition,this._cameraPosition,s,-this.bearingInRadians),I(this._cameraPosition,this._cameraPosition,[0,0,1]),U(this._cameraPosition,this._cameraPosition,s,-this.center.lat*Math.PI/180),N(this._cameraPosition,this._cameraPosition,s,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(e);let o=y(this._globeViewProjMatrixF64Inverted);D(o,o,[1,1,-1]),this._cachedFrustum=By.fromInvProjectionMatrix(o,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(t){Rt("calculateFogMatrix is not supported on globe projection.");let e=at();return v(e),e}getVisibleUnwrappedCoordinates(t){return[new ud(0,t)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){t?Rt("terrain is not fully supported on vertical perspective projection."):this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return(T(this._cameraPosition)-1)*Ru}getCameraLngLat(){let t=ot();return R(t,this._cameraPosition),Lw(t)}populateCache(t){}getBounds(){let t=.5*this.width,e=.5*this.height,i=[new u(0,0),new u(t,0),new u(this.width,0),new u(this.width,e),new u(this.width,this.height),new u(t,this.height),new u(0,this.height),new u(0,e)],r=[];for(let t of i)r.push(this.unprojectScreenPoint(t));let n=0,s=0,o=0,a=0,l=this.center;for(let t of r){let e=mt(l.lng,t.lng),i=mt(l.lat,t.lat);e<s&&(s=e),e>n&&(n=e),i<a&&(a=i),i>o&&(o=i)}let h=[l.lng+s,l.lat+a,l.lng+n,l.lat+o];return this.isSurfacePointOnScreen([0,1,0])&&(h[3]=90,h[0]=-180,h[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(h[1]=-90,h[0]=-180,h[2]=180),new oy(h)}calculateCenterFromCameraLngLatAlt(t,e,i,r){return this._helper.calculateCenterFromCameraLngLatAlt(t,e,i,r)}calculateCameraOptionsFromTo(t,e,i,r){let n=Ou.convert(i),s=Rw(Ou.convert(t));$(s,s,1+e/Ru);let o=Rw(n),a=$(ot(),o,1+r/Ru),l=k(ot(),s,o),h=T(l);if(h<1e-12||function(t,e){var i=e[0]-t[0],r=e[1]-t[1],n=e[2]-t[2];return Math.sqrt(i*i+r*r+n*n)}(s,a)<1e-12)throw Error("Can't calculate camera options with same From and To");let u=ot();N(l,l,u,-qt(n.lng)),U(l,l,u,qt(n.lat));let c=Vt(Math.acos(Dt(l[2]/h,-1,1))),f=Math.hypot(l[0],l[1])<1e-9*h?this.bearing:Vt(Math.atan2(-l[0],-l[1]));return{center:n,elevation:r,zoom:Ct(this.cameraToCenterDistance/h/Ow(this.tileSize,n.lat)),pitch:c,bearing:f}}setLocationAtPoint(t,e,i){let r=Rw(this.unprojectScreenPoint(e)),n=Rw(t),s=ot();!function(t){t[0]=0,t[1]=0,t[2]=0}(s);let o=ot();N(o,r,s,-this.center.lng*Math.PI/180),U(o,o,s,this.center.lat*Math.PI/180);let a=n[0]*n[0]+n[2]*n[2],l=o[0]*o[0];if(a<l)return;let h=Math.sqrt(a-l),u=-h,c=dt(n[0],n[2],o[0],h),f=dt(n[0],n[2],o[0],u),p=ot();N(p,n,s,-c);let d=dt(p[1],p[2],o[1],o[2]),m=ot();N(m,n,s,-f);let _,g,y=dt(m[1],m[2],o[1],o[2]),v=.5*Math.PI,w=d>=-v&&d<=v,b=y>=-v&&y<=v;if(w&&b){let t=this.center.lng*Math.PI/180,e=this.center.lat*Math.PI/180;_t(c,t)+_t(d,e)<_t(f,t)+_t(y,e)?(_=c,g=d):(_=f,g=y)}else if(w)_=c,g=d;else{if(!b)return;_=f,g=y}let x=_/Math.PI*180,D=g/Math.PI*180,M=this.center.lat;this.setCenter(new Ou(x,Dt(D,-90,90))),this.setZoom(this.zoom+qw(M,this.center.lat))}locationToScreenPoint(t,e){let i=Rw(t);return e&&$(i,i,1+e.getElevationForLngLatZoom(t,this._helper._tileZoom)/Ru),this._projectSurfacePointToScreen(i)}_projectSurfacePointToScreen(t){let e=st();return Z(e,[...t,1],this._globeViewProjMatrixF64),e[0]/=e[3],e[1]/=e[3],new u((.5*e[0]+.5)*this.width,(.5*-e[1]+.5)*this.height)}screenPointToMercatorCoordinate(t,e){if(e){let i=this.screenTerrainPointToMercatorCoordinate(t,e);if(i)return i}return Wu.fromLngLat(this.unprojectScreenPoint(t))}screenTerrainPointToMercatorCoordinate(t,e){let i=e.getCoverageIndex();if(!i)return null;let r=this.cameraPosition,n=this.getRayDirectionFromPixel(t),s=Ww(r,n,1+i.maxElevation/Ru);if(!s)return null;let o=Ww(r,n,1+i.minElevation/Ru),a=Math.max(s.tMin,0),l=o?o.tMin:s.tMax;if(l<=a)return null;let h={index:i,exaggeration:e.exaggeration,origin:r,direction:n},u=0;for(let t=0;t<=256;t++){let e=a+(l-a)*t/256;if(ib(h,e)){let{hi:t}=xw(h,ib,u,e,1e-12),{sample:i,mercator:r}=eb(h,t);return new Wu(r.x,r.y,i.elevation)}u=e}return null}screenPointToLocation(t,e){return this.screenPointToMercatorCoordinate(t,e)?.toLngLat()}screenPointToLocationAtElevation(t,e){return this.screenPointToLocation(t)}isPointOnMapSurface(t,e){return!!Ww(this._cameraPosition,this.getRayDirectionFromPixel(t))}getRayDirectionFromPixel(t){let e=st();e[0]=t.x/this.width*2-1,e[1]=-1*(t.y/this.height*2-1),e[2]=1,e[3]=1,Z(e,e,this._globeViewProjMatrixF64Inverted),e[0]/=e[3],e[1]/=e[3],e[2]/=e[3];let i=ot();i[0]=e[0]-this._cameraPosition[0],i[1]=e[1]-this._cameraPosition[1],i[2]=e[2]-this._cameraPosition[2];let r=ot();return R(r,i),r}isSurfacePointVisible(t){let e=this._cachedClippingPlane;return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]>=0}isSurfacePointOnScreen(t){if(!this.isSurfacePointVisible(t))return!1;let e=st();return Z(e,[...t,1],this._globeViewProjMatrixF64),e[0]/=e[3],e[1]/=e[3],e[2]/=e[3],e[0]>-1&&e[0]<1&&e[1]>-1&&e[1]<1&&e[2]>-1&&e[2]<1}unprojectScreenPoint(t){let e=this._cameraPosition,i=this.getRayDirectionFromPixel(t),r=Ww(e,i);if(r){let t=ot();I(t,e,[i[0]*r.tMin,i[1]*r.tMin,i[2]*r.tMin]);let n=ot();return R(n,t),Lw(n)}let n=this._cachedClippingPlane,s=n[0]*i[0]+n[1]*i[1]+n[2]*i[2],o=-ct(n,e)/s,a=ot();if(o>0)I(a,e,[i[0]*o,i[1]*o,i[2]*o]);else{let t=ot();I(t,e,[2*i[0],2*i[1],2*i[2]]);let r=ct(this._cachedClippingPlane,t);q(a,t,[this._cachedClippingPlane[0]*r,this._cachedClippingPlane[1]*r,this._cachedClippingPlane[2]*r])}let l=function(t){let e=ot();return e[0]=t[0]*-t[3],e[1]=t[1]*-t[3],e[2]=t[2]*-t[3],{center:e,radius:Math.sqrt(1-t[3]*t[3])}}(n);return Lw(function(t,e,i){let r=ot();q(r,i,t);let n=ot();return j(n,t,r,e/V(r)),n}(l.center,l.radius,a))}getProjectionDataForCustomLayer(t=!0){let e=this.getProjectionData({overscaledTileID:new cd(0,0,0,0,0),applyGlobeMatrix:t});return e.tileMercatorCoords=[0,0,1,1],e}getFastPathSimpleProjectionMatrix(t){}};function eb(t,e){let i=ot();j(i,t.origin,t.direction,e);let r=T(i),n=ot();$(n,i,1/r);let s=Lw(n),o=Wu.fromLngLat(s),a=new Wu(o.x,Dt(o.y,0,.999999999)),l=ww(t.index,t.exaggeration,a.x,a.y),h=Math.abs(s.lat)>85.051129?0:l.elevation;return{sample:{...l,elevation:h},radius:r,mercator:a}}function ib(t,e){let{sample:i,radius:r}=eb(t,e);return bw(i,(r-1)*Ru)}function rb(t,e){let i=Rw(t);return $(i,i,1+e/Ru)}function nb(t,e,i){return O(k(ot(),i,t),e)}var sb=class t{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,e,i){this._helper.interpolatePadding(t,e,i)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,e,i=!0){this._helper.resize(t,e,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,e){this._helper.overrideNearFarZ(t,e)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(t){this._globeness=t,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(t){this._globeness=1,this.defaultConstrain=(t,e)=>this.currentTransform.defaultConstrain(t,e),this.applyConstrain=(t,e)=>this._helper.applyConstrain(t,e),this._helper=new pw({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(t,e)=>this.defaultConstrain(t,e)},t),this._globeness=1,this._mercatorTransform=new Dw(void 0,this._helper),this._verticalPerspectiveTransform=new tb(void 0,this._helper)}clone(){let e=new t;return e._globeness=this._globeness,e.apply(this,!1),e}apply(t,e){this._helper.apply(t,e)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(t){let e=this._mercatorTransform.getProjectionData(t),i=this._verticalPerspectiveTransform.getProjectionData(t);return{mainMatrix:this.isGlobeRendering?i.mainMatrix:e.mainMatrix,clippingPlane:i.clippingPlane,tileMercatorCoords:i.tileMercatorCoords,projectionTransition:t.applyGlobeMatrix?this._globeness:0,fallbackMatrix:e.fallbackMatrix,clipAntimeridian:i.clipAntimeridian}}isLocationOccluded(t,e,i){return this.currentTransform.isLocationOccluded(t,e,i)}transformLightDirection(t){return this.currentTransform.transformLightDirection(t)}getPixelScale(){return vt(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return vt(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(t,e,i){return vt(this._mercatorTransform.getPitchedTextCorrection(t,e,i),this._verticalPerspectiveTransform.getPitchedTextCorrection(t,e,i),this._globeness)}projectTileCoordinates(t,e,i,r){return this.currentTransform.projectTileCoordinates(t,e,i,r)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform._calcMatrices(),this._mercatorTransform._calcMatrices(this.autoCalculateNearFarZ&&!this.isGlobeRendering))}calculateFogMatrix(t){return this.currentTransform.calculateFogMatrix(t)}getVisibleUnwrappedCoordinates(t){return this.currentTransform.getVisibleUnwrappedCoordinates(t)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(t){this.currentTransform.recalculateZoomAndCenter(t)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this.currentTransform.getCameraAltitude()}getCameraLngLat(){return this.currentTransform.getCameraLngLat()}populateCache(t){this._mercatorTransform.populateCache(t),this._verticalPerspectiveTransform.populateCache(t)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(t,e,i,r){return this._helper.calculateCenterFromCameraLngLatAlt(t,e,i,r)}calculateCameraOptionsFromTo(t,e,i,r){return this.currentTransform.calculateCameraOptionsFromTo(t,e,i,r)}setLocationAtPoint(t,e,i){this.currentTransform.setLocationAtPoint(t,e,i)}locationToScreenPoint(t,e){return this.currentTransform.locationToScreenPoint(t,e)}screenPointToMercatorCoordinate(t,e){return this.currentTransform.screenPointToMercatorCoordinate(t,e)}screenTerrainPointToMercatorCoordinate(t,e){return this.currentTransform.screenTerrainPointToMercatorCoordinate(t,e)}screenPointToLocation(t,e){return this.currentTransform.screenPointToLocation(t,e)}screenPointToLocationAtElevation(t,e){return this.currentTransform.screenPointToLocationAtElevation(t,e)}isPointOnMapSurface(t,e){return this.currentTransform.isPointOnMapSurface(t,e)}getRayDirectionFromPixel(t){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(t)}getProjectionDataForCustomLayer(t=!0){let e=this._mercatorTransform.getProjectionDataForCustomLayer(t);if(!this.isGlobeRendering)return e;let i=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(t);return i.fallbackMatrix=e.mainMatrix,i.projectionTransition=this._globeness,i}getFastPathSimpleProjectionMatrix(t){return this.currentTransform.getFastPathSimpleProjectionMatrix(t)}},ob=class t{get useGlobeControls(){return!0}handlePanInertia(t,e){let i=function(t,e){let i=t.rotate(e.bearingInRadians),r=e.zoom+qw(e.center.lat,0),n=vt(1/Gw(e.center.lat),1/Gw(Math.min(Math.abs(e.center.lat),60)),yt(r,7,3,0,1)),s=function(t,e){return 360/$w({worldSize:t,center:{lat:e}})}(e.worldSize,e.center.lat);return new Ou(e.center.lng-i.x*s*n,Dt(e.center.lat+i.y*s,-Yt,Yt))}(t,e);return Math.abs(i.lng-e.center.lng)>180&&(i.lng=e.center.lng+179.5*Math.sign(i.lng-e.center.lng)),{easingCenter:i,easingOffset:new u(0,0)}}handleMapControlsRollPitchBearingZoom(t,e){let i=t.around,r=e.screenPointToLocation(i);t.bearingDelta&&e.setBearing(e.bearing+t.bearingDelta),t.pitchDelta&&e.setPitch(e.pitch+t.pitchDelta),t.rollDelta&&e.setRoll(e.roll+t.rollDelta);let n=e.zoom;t.zoomDelta&&e.setZoom(e.zoom+t.zoomDelta);let s=e.zoom-n;if(0===s)return;let o=mt(e.center.lng,r.lng),a=o/(Math.abs(o/180)+1),l=mt(e.center.lat,r.lat),h=e.getRayDirectionFromPixel(i),u=e.cameraPosition,c=-1*O(u,h),f=ot();I(f,u,[h[0]*c,h[1]*c,h[2]*c]);let p=T(f),d=Math.exp(.5*-Math.max(p-1-.3,0)),m=yt(p,.95,.999,0,1),_=yt(Ow(e.worldSize,e.center.lat)/Math.min(e.width,e.height),.9,.5,1,.25),g=Math.min(d,vt(1,_,m)),y=(1-St(-s))*g,v=e.center.lat,w=e.zoom,b=new Ou(e.center.lng+a*y,Dt(e.center.lat+l*y,-Yt,Yt));e.setLocationAtPoint(r,i);let x=e.center,D=yt(Math.abs(o),45,85,0,1),M=Math.max(D,m)**.25,E=mt(x.lng,b.lng),A=mt(x.lat,b.lat);e.setCenter(new Ou(x.lng+E*M,x.lat+A*M).wrap()),e.setZoom(w+qw(v,e.center.lat))}handleMapControlsPan(t,e,i){t.panDelta&&function(t,e,i,r,n=!0){let s=Nw(t,i),o=e;if(r)o=Nw(t,i.sub(r));else if(!t.isPointOnMapSurface(i))return;let a=Rw(s),l=Rw(o),h=function(t,e){return H(st(),-t.lng,-t.lat,e)}(t.center,t.bearing),u=B(ot(),l,a),c=Math.sqrt(O(u,u)),f=Math.acos(Dt(O(l,a),-1,1))/2,p=Math.sin(f),d=c?Y(u[1]/c*p,-u[0]/c*p,u[2]/c*p,Math.cos(f)):Y(0,0,0,1),{lng:m,lat:_,bearing:g}=function(t){let e=t[0],i=t[1],r=t[2],n=t[3];return{lng:180*-Math.atan2(2*(n*e+i*r),1-2*(e*e+i*i))/Math.PI,lat:180*-Math.asin(Dt(2*(n*i-r*e),-1,1))/Math.PI,bearing:180*Math.atan2(2*(n*r+e*i),1-2*(i*i+r*r))/Math.PI}}(function(t,e,i){var r=e[0],n=e[1],s=e[2],o=e[3],a=i[0],l=i[1],h=i[2],u=i[3];return t[0]=r*u+o*a+n*h-s*l,t[1]=n*u+o*l+s*a-r*h,t[2]=s*u+o*h+r*l-n*a,t[3]=o*u-r*a-n*l-s*h,t}(st(),h,d)),y=t.center.lat,v=t.zoom,w=Dt(_,-90,90),b=n?function(t,e,i,r){let n=t.center.lng,s=t.center.lat,o=s>=0?90:-90,a=t.locationToScreenPoint(new Ou(0,o)),l=e.x-a.x,h=e.y-a.y,u=l*l+h*h,c=Dt(1-(Yt-Math.abs(s))/12,0,1),f=c*c*(3-2*c),p=gt(r-n+180,360)-180,d=0;return f>0&&i&&(d=(o>0?1:-1)*((l*i.y-h*i.x)/Math.max(u,400))*180/Math.PI),n+(1-f)*p+f*d}(t,i,r,m):m;t.setCenter(new Ou(Mt(b,-180,180),w)),n||t.setBearing(g),t.setZoom(v+qw(y,t.center.lat))}(e,i,e.isPointOnMapSurface(t.around)?t.around:e.centerPoint,t.panDelta)}cameraForBoxAndBearing(e,i,r,n,s){let o=Sw(e,i,r,n,s),a=i.left/s.width*2-1,l=(s.width-i.right)/s.width*2-1,h=i.top/s.height*-2+1,u=(s.height-i.bottom)/s.height*-2+1,c=mt(r.getWest(),r.getEast())<0,f=c?r.getEast():r.getWest(),p=c?r.getWest():r.getEast(),d=Math.max(r.getNorth(),r.getSouth()),m=Math.min(r.getNorth(),r.getSouth()),_=f+.5*mt(f,p),g=d+.5*mt(d,m),y=s.clone();y.setCenter(o.center),y.setBearing(o.bearing),y.setPitch(0),y.setRoll(0),y.setZoom(o.zoom);let v=y.modelViewProjectionMatrix,w=[Rw(r.getNorthWest()),Rw(r.getNorthEast()),Rw(r.getSouthWest()),Rw(r.getSouthEast()),Rw(new Ou(p,g)),Rw(new Ou(f,g)),Rw(new Ou(_,d)),Rw(new Ou(_,m))],b=Rw(o.center),x=1/0;for(let e of w)a<0&&(x=t.getLesserNonNegativeNonNull(x,t.solveVectorScale(e,b,v,"x",a))),l>0&&(x=t.getLesserNonNegativeNonNull(x,t.solveVectorScale(e,b,v,"x",l))),h>0&&(x=t.getLesserNonNegativeNonNull(x,t.solveVectorScale(e,b,v,"y",h))),u<0&&(x=t.getLesserNonNegativeNonNull(x,t.solveVectorScale(e,b,v,"y",u)));if(Number.isFinite(x)&&0!==x)return o.zoom=Math.min(y.zoom+Ct(x),e.maxZoom),o;Fw()}handleJumpToCenterZoom(t,e){let i=t.center.lat,r=t.applyConstrain(e.center?Ou.convert(e.center):t.center,t.zoom).center;t.setCenter(r.wrap());let n=void 0===e.zoom?t.zoom+qw(i,r.lat):+e.zoom;t.zoom!==n&&t.setZoom(n)}handleEaseTo(t,e){let i=t.zoom,r=t.center,n=t.padding,s={roll:t.roll,pitch:t.pitch,bearing:t.bearing},o={roll:void 0===e.roll?t.roll:e.roll,pitch:void 0===e.pitch?t.pitch:e.pitch,bearing:void 0===e.bearing?t.bearing:e.bearing},a=void 0!==e.zoom,l=!t.isPaddingEqual(e.padding),h=!1,c=e.center?Ou.convert(e.center):r,f=t.applyConstrain(c,i).center;cw(t,f);let p=t.clone();p.setCenter(f),p.setZoom(a?+e.zoom:i+qw(r.lat,c.lat)),p.setBearing(e.bearing);let d=new u(Dt(t.centerPoint.x+e.offsetAsPoint.x,0,t.width),Dt(t.centerPoint.y+e.offsetAsPoint.y,0,t.height));p.setLocationAtPoint(f,d);let m=(e.offset&&e.offsetAsPoint.mag())>0?p.center:f,_=a?+e.zoom:i+qw(r.lat,m.lat),g=i+qw(r.lat,0),y=_+qw(m.lat,0),v=mt(r.lng,m.lng),w=mt(r.lat,m.lat),b=St(y-g);return h=_!==i,{easeFunc:i=>{if(Zt(s,o)||zw({startEulerAngles:s,endEulerAngles:o,tr:t,k:i,useSlerp:s.roll!=o.roll}),l&&t.interpolatePadding(n,e.padding,i),e.around)Rt("Easing around a point is not supported under globe projection."),t.setLocationAtPoint(e.around,e.aroundPoint);else{let e=i*(y>g?Math.min(2,b):Math.max(.5,b))**(1-i),n=Zw(r,v,w,e);t.setCenter(n.wrap())}if(h){let e=Oi.number(g,y,i)+qw(0,t.center.lat);t.setZoom(e)}},isZooming:h,elevationCenter:m}}handleFlyTo(t,e){let i=void 0!==e.zoom,r=t.center,n=t.zoom,s=t.padding,o=!t.isPaddingEqual(e.padding),a=t.applyConstrain(Ou.convert(e.center||e.locationAtOffset),n).center,l=i?+e.zoom:t.zoom+qw(t.center.lat,a.lat),h=t.clone();h.setCenter(a),h.setZoom(l),h.setBearing(e.bearing);let c=new u(Dt(t.centerPoint.x+e.offsetAsPoint.x,0,t.width),Dt(t.centerPoint.y+e.offsetAsPoint.y,0,t.height));h.setLocationAtPoint(a,c);let f=h.center;cw(t,f);let p=function(t,e,i){let r=O(Rw(e),Rw(i)),n=Math.acos(r),s=$w(t);return n/(2*Math.PI)*s}(t,r,f),d=n+qw(r.lat,0),m=l+qw(f.lat,0),_=St(m-d),g=Math.max("number"==typeof e.minZoom?+e.minZoom:t.minZoom,t.minZoom)+qw(f.lat,0),y=Math.min(g,d,m)+qw(0,f.lat),v=St(t.applyConstrain(f,y).zoom+qw(f.lat,0)-d),w=mt(r.lng,f.lng),b=mt(r.lat,f.lat);return{easeFunc:(i,n,a)=>{let h=Zw(r,w,b,a);o&&t.interpolatePadding(s,e.padding,i);let u=1===i?f:h;t.setCenter(u.wrap());let c=d+Ct(n);t.setZoom(1===i?l:c+qw(0,u.lat))},scaleOfZoom:_,targetCenter:f,scaleOfMinZoom:v,pixelPathLength:p}}static solveVectorScale(t,e,i,r,n){let s="x"===r?[i[0],i[4],i[8],i[12]]:[i[1],i[5],i[9],i[13]],o=[i[3],i[7],i[11],i[15]],a=t[0]*s[0]+t[1]*s[1]+t[2]*s[2],l=t[0]*o[0]+t[1]*o[1]+t[2]*o[2],h=e[0]*s[0]+e[1]*s[1]+e[2]*s[2],u=e[0]*o[0]+e[1]*o[1]+e[2]*o[2];return h+n*l===a+n*u||o[3]*(a-h)+s[3]*(u-l)+a*u==h*l?null:(h+s[3]-n*u-n*o[3])/(h-a-n*u+n*l)}static getLesserNonNegativeNonNull(t,e){return null!==e&&e>=0&&e<t?e:t}},ab=class{constructor(t){this._globe=t,this._mercatorCameraHelper=new Cw,this._verticalPerspectiveCameraHelper=new ob}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(t,e){return this.currentHelper.handlePanInertia(t,e)}handleMapControlsRollPitchBearingZoom(t,e){this.currentHelper.handleMapControlsRollPitchBearingZoom(t,e)}handleMapControlsPan(t,e,i){this.currentHelper.handleMapControlsPan(t,e,i)}cameraForBoxAndBearing(t,e,i,r,n){return this.currentHelper.cameraForBoxAndBearing(t,e,i,r,n)}handleJumpToCenterZoom(t,e){this.currentHelper.handleJumpToCenterZoom(t,e)}handleEaseTo(t,e){return this.currentHelper.handleEaseTo(t,e)}handleFlyTo(t,e){return this.currentHelper.handleFlyTo(t,e)}};const lb=function(){let t={},e=we.$version;for(let i in we.$root){let r=we.$root[i];if(r.required){let n=null;n="version"===i?e:"array"===r.type?[]:{},null!=n&&(t[i]=n)}}return t}();var hb=class extends ye{constructor(t,e={}){super(),this._rtlPluginLoaded=()=>{for(let t in this.tileManagers){let e=this.tileManagers[t].getSource().type;("vector"===e||"geojson"===e)&&this.tileManagers[t].reload()}},this.map=t,this.dispatcher=new Qg(Kg(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",((t,e)=>this.getGlyphs(t,e))),this.dispatcher.registerMessageHandler("GI",((t,e)=>this.getImages(t,e))),this.dispatcher.registerMessageHandler("GDA",((t,e)=>this.getDashes(t,e))),this.imageManager=new Eg,this.imageManager.setEventedParent(this),this.imageManager.setMissingImageResolver(t._missingStyleImageResolver),this.patternAtlas=new Ag(this.imageManager);let i=t._container?.lang||typeof document<"u"&&document.documentElement?.lang||void 0;this.glyphManager=new Ug(t._requestManager,e.localIdeographFontFamily,i),this.lineAtlas=new Zg(256,512),this.crossTileSymbolIndex=new rw,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",he()),ky().on(Ty,this._rtlPluginLoaded),this.on("data",(t=>{if("source"!==t.dataType||"metadata"!==t.sourceDataType)return;let e=this.tileManagers[t.sourceId];if(!e)return;let i=e.getSource();if(i?.vectorLayerIds)for(let t in this._layers){let e=this._layers[t];e.source===i.id&&this._validateLayer(e)}}))}_setInitialValues(){this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new oo,this._imagesListDirty=!1,this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this._symbolPlacementTriggered=!1,this._placedProjectionTransition=void 0,this.crossTileSymbolIndex=new(this.crossTileSymbolIndex?.constructor||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(t,e){this._checkLoaded();let i=null===e?this.stylesheet.state?.[t]?.default??null:e;if(kt(i,this._globalState[t]))return this;this._globalState[t]=i,this._applyGlobalStateChanges([t])}getGlobalState(){return this._globalState}setGlobalState(t){this._checkLoaded();let e=[];for(let i in t)kt(this._globalState[i],t[i].default)||(e.push(i),this._globalState[i]=t[i].default);this._applyGlobalStateChanges(e)}_applyGlobalStateChanges(t){if(0===t.length)return;let e=new Set,i={};for(let r of t){i[r]=this._globalState[r];for(let t in this._layers){let i=this._layers[t],n=i.getLayoutAffectingGlobalStateRefs(),s=i.getPaintAffectingGlobalStateRefs(),o=i.getVisibilityAffectingGlobalStateRefs();if(n.has(r)&&e.add(i.source),s.has(r))for(let{name:t,value:e}of s.get(r))this._updatePaintProperty(i,t,e);o?.has(r)&&(i.recalculateVisibility(),this._updateLayer(i))}}this.dispatcher.broadcast("UGS",i);for(let t in this.tileManagers)e.has(t)&&(this._reloadSource(t),this._changed=!0)}async loadURL(t,e={},i){this.fire(new eg("dataloading")),e.validate="boolean"!=typeof e.validate||e.validate,this._loadStyleRequest=new AbortController;let r=this._loadStyleRequest;try{let n=await this.map._requestManager.transformRequest(t,"Style");ne(r.signal);let s=await ce(n,r);this._loadStyleRequest===r&&(this._loadStyleRequest=null),this._load(s.data,e,i)}catch(t){this._loadStyleRequest===r&&(this._loadStyleRequest=null),t&&!r.signal.aborted&&this.fire(new ge(nt(t)))}}loadJSON(t,e={},i){this.fire(new eg("dataloading")),this._frameRequest=new AbortController,Z_.frameAsync(this._frameRequest,this.map._ownerWindow).then((()=>{this._frameRequest=null,e.validate=!1!==e.validate,this._load(t,e,i)})).catch((()=>{}))}loadEmpty(){this.fire(new eg("dataloading")),this._load(lb,{validate:!1})}_load(t,e,i){let r=e.transformStyle?e.transformStyle(i,t):t;if(!e.validate||!Ys(this,r)){r={...r},this._loaded=!0,this.stylesheet=r;for(let t in r.sources)this.addSource(t,r.sources[t],{validate:!1});r.sprite?this._loadSprite(r.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(r.glyphs),this.glyphManager.setFontFaces(r["font-faces"]),this._createLayers(),this.light=new Gg(this.stylesheet.light??{},this._globalState),this._setProjectionInternal(this.stylesheet.projection?.type||"mercator"),this.sky=new Vg(this.stylesheet.sky,this._globalState),this.map.setTerrain(this.stylesheet.terrain??null,{validate:!1}),this.fire(new eg("data")),this.fire(new tg)}}_createLayers(){let t=fg(this.stylesheet.layers);this.setGlobalState(this.stylesheet.state??null),this.dispatcher.broadcast("SL",t),this._order=t.map((t=>t.id)),this._layers={},this._serializedLayers=null;for(let e of t){let t=nd(e,this._globalState);if(t.setEventedParent(this,{layer:{id:e.id}}),this._layers[e.id]=t,Co(t)&&this.tileManagers[t.source]){let i=e.paint?.["raster-fade-duration"]??t.paint.get("raster-fade-duration");this.tileManagers[t.source].setRasterFadeDuration(i)}}}async _loadSprite(t,e=!1,i){this.imageManager.setLoaded(!1);let r,n=new AbortController;this._spriteRequest=n;try{let i=await async function(t,e,i,r){let n=Dg(t),s=i>1?"@2x":"",o={},a={};for(let{id:t,url:i}of n){let n=await e.transformRequest(Mg(i,s,".json"),"SpriteJSON");o[t]=ce(n,r);let l=await e.transformRequest(Mg(i,s,".png"),"SpriteImage");a[t]=X_.getImage(l,r)}return await Promise.all([...Object.values(o),...Object.values(a)]),async function(t,e){let i={};for(let r in t){i[r]={};let n=(await e[r]).data;if(!n)throw Error(`Could not load sprite image for ${r}: the response is empty`);let s=Z_.getImageCanvasContext(n),o=(await t[r]).data;for(let t in o){let{width:e,height:n,x:a,y:l,sdf:h,pixelRatio:u,stretchX:c,stretchY:f,content:p,textFitWidth:d,textFitHeight:m}=o[t];i[r][t]={data:null,pixelRatio:u,sdf:h,stretchX:c,stretchY:f,content:p,textFitWidth:d,textFitHeight:m,spriteData:{width:e,height:n,x:a,y:l,context:s}}}}return i}(o,a)}(t,this.map._requestManager,this.map.getPixelRatio(),n);if(!i)return;for(let t in i){let{loaded:r,removed:n}=this.imageManager.setSpriteImages(t,i[t]);this._markImagesChanged(n),e&&this._markImagesChanged(r)}}catch(t){r=t,n.signal.aborted||this.fire(new ge(r))}finally{this._spriteRequest=null,this.imageManager.setLoaded(!0),e&&(this._changed=!0),this.dispatcher.broadcast("SI",this.imageManager.listImages()),this.fire(new eg("data")),i?.(r)}}_unloadSprite(){this._markImagesChanged(this.imageManager.removeAllSpriteImages()),this._imagesListDirty=!0,this._changed=!0,this.fire(new eg("data"))}_validateLayer(t){let e=this.tileManagers[t.source];if(!e)return;let i=t.sourceLayer;if(!i)return;let r=e.getSource();("geojson"===r.type||r.vectorLayerIds&&!r.vectorLayerIds.includes(i))&&this.fire(new ge(Error(`Source layer "${i}" does not exist on source "${r.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let t in this.tileManagers)if(!this.tileManagers[t].loaded())return!1;return this.imageManager.isLoaded()}_serializeByIds(t,e=!1){let i=this._serializedAllLayers();if(!t||0===t.length)return Object.values(e?$t(i):i);let r=[];for(let n of t)if(i[n]){let t=e?$t(i[n]):i[n];r.push(t)}return r}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};let e=Object.keys(this._layers);for(let i of e){let e=this._layers[i];"custom"!==e.type&&(t[i]=e.serialize())}return t}hasTransitions(){if(this.light?.hasTransition()||this.sky?.hasTransition()||this.projection?.hasTransition())return!0;for(let t in this.tileManagers)if(this.tileManagers[t].hasTransition())return!0;for(let t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw Error("Style is not done loading.")}update(t){if(!this._loaded)return;let e=this._changed;if(e){this._imagesListDirty&&=(this.dispatcher.broadcast("SI",this.imageManager.listImages()),!1);let e=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);(e.length||i.length)&&this._updateWorkerLayers(e,i);for(let t in this._updatedSources){let e=this._updatedSources[t];if("reload"===e)this._reloadSource(t);else{if("clear"!==e)throw Error(`Invalid action ${e}`);this._clearSource(t)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let e in this._updatedPaintProps)this._layers[e].updateTransitions(t);this._resetUpdates()}let i={};for(let t in this.tileManagers){let e=this.tileManagers[t];i[t]=e.used,e.used=!1}let r=this.imageManager.listImages();for(let e of this._order){let i=this._layers[e];i.recalculate(t,r),!i.isHidden(t.zoom)&&i.source&&(this.tileManagers[i.source].used=!0)}for(let t in i){let e=this.tileManagers[t];!!i[t]!=!!e.used&&e.fire(new ig("data",{sourceDataType:"visibility",sourceId:t}))}this.light.recalculate(t),this.sky.recalculate(t),this.projection.recalculate(t),this.z=t.zoom,e&&this.fire(new eg("data"))}_updateTilesForChangedImages(){let t=Object.keys(this._changedImages);if(t.length){for(let e in this.tileManagers)this.tileManagers[e].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,e){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t,!1),removedIds:e})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,e={}){this._checkLoaded();let i=this.serialize();if(t=e.transformStyle?e.transformStyle(i,t):t,(e.validate??1)&&Ys(this,t))return!1;(t=$t(t)).layers=fg(t.layers);let r=function(t,e){if(!t)return[{command:"setStyle",args:[e]}];let i=[];try{if(!pg(t.version,e.version))return[{command:"setStyle",args:[e]}];pg(t.center,e.center)||i.push({command:"setCenter",args:[e.center]}),pg(t.state,e.state)||i.push({command:"setGlobalState",args:[e.state]}),pg(t.centerAltitude,e.centerAltitude)||i.push({command:"setCenterAltitude",args:[e.centerAltitude]}),pg(t.zoom,e.zoom)||i.push({command:"setZoom",args:[e.zoom]}),pg(t.bearing,e.bearing)||i.push({command:"setBearing",args:[e.bearing]}),pg(t.pitch,e.pitch)||i.push({command:"setPitch",args:[e.pitch]}),pg(t.roll,e.roll)||i.push({command:"setRoll",args:[e.roll]}),pg(t.sprite,e.sprite)||i.push({command:"setSprite",args:[e.sprite]}),pg(t.glyphs,e.glyphs)||i.push({command:"setGlyphs",args:[e.glyphs]}),pg(t["font-faces"],e["font-faces"])||i.push({command:"setFontFaces",args:[e["font-faces"]]}),pg(t.transition,e.transition)||i.push({command:"setTransition",args:[e.transition]}),pg(t.light,e.light)||i.push({command:"setLight",args:[e.light]});let r=!pg(t.terrain,e.terrain);r&&!e.terrain&&i.push({command:"setTerrain",args:[void 0]}),pg(t.sky,e.sky)||i.push({command:"setSky",args:[e.sky]}),pg(t.projection,e.projection)||i.push({command:"setProjection",args:[e.projection]});let n={},s=[];!function(t,e,i,r){let n;for(n in t||={},e||={},t)Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(e,n)||_g(n,i,r));for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(Object.prototype.hasOwnProperty.call(t,n)?pg(t[n],e[n])||("geojson"===t[n].type&&"geojson"===e[n].type&&yg(t,e,n)?dg(i,{command:"setGeoJSONSourceData",args:[n,e[n].data]}):gg(n,e,i,r)):mg(n,e,i))}(t.sources,e.sources,s,n);let o=[];t.layers&&t.layers.forEach((t=>{"source"in t&&n[t.source]?i.push({command:"removeLayer",args:[t.id]}):o.push(t)})),i=i.concat(s),function(t,e,i){t||=[],e||=[];let r,n,s,o,a,l=t.map(bg),h=e.map(bg),u=t.reduce(xg,{}),c=e.reduce(xg,{}),f=l.slice(),p=Object.create(null);for(let t=0,e=0;t<l.length;t++)r=l[t],Object.prototype.hasOwnProperty.call(c,r)?e++:(dg(i,{command:"removeLayer",args:[r]}),f.splice(f.indexOf(r,e),1));for(let t=0,e=0;t<h.length;t++)r=h[h.length-1-t],f[f.length-1-t]!==r&&(Object.prototype.hasOwnProperty.call(u,r)?(dg(i,{command:"removeLayer",args:[r]}),f.splice(f.lastIndexOf(r,f.length-e),1)):e++,o=f[f.length-t],dg(i,{command:"addLayer",args:[c[r],o]}),f.splice(f.length-t,0,r),p[r]=!0);for(let t=0;t<h.length;t++)if(r=h[t],n=u[r],s=c[r],!p[r]&&!pg(n,s)){if(!pg(n.source,s.source)||!pg(n["source-layer"],s["source-layer"])||!pg(n.type,s.type)){dg(i,{command:"removeLayer",args:[r]}),o=f[f.lastIndexOf(r)+1],dg(i,{command:"addLayer",args:[s,o]});continue}for(a in wg(n.layout,s.layout,i,r,"setLayoutProperty"),wg(n.paint,s.paint,i,r,"setPaintProperty"),pg(n.filter,s.filter)||dg(i,{command:"setFilter",args:[r,s.filter]}),(!pg(n.minzoom,s.minzoom)||!pg(n.maxzoom,s.maxzoom))&&dg(i,{command:"setLayerZoomRange",args:[r,s.minzoom,s.maxzoom]}),n)Object.prototype.hasOwnProperty.call(n,a)&&"layout"!==a&&"paint"!==a&&"filter"!==a&&"metadata"!==a&&"minzoom"!==a&&"maxzoom"!==a&&(0===a.indexOf("paint.")?wg(n[a],s[a],i,r,"setPaintProperty"):pg(n[a],s[a])||dg(i,{command:"setLayerProperty",args:[r,a,s[a]]}));for(a in s)Object.prototype.hasOwnProperty.call(s,a)&&!Object.prototype.hasOwnProperty.call(n,a)&&"layout"!==a&&"paint"!==a&&"filter"!==a&&"metadata"!==a&&"minzoom"!==a&&"maxzoom"!==a&&(0===a.indexOf("paint.")?wg(n[a],s[a],i,r,"setPaintProperty"):pg(n[a],s[a])||dg(i,{command:"setLayerProperty",args:[r,a,s[a]]}))}}(o,e.layers,i),r&&e.terrain&&i.push({command:"setTerrain",args:[e.terrain]})}catch(t){console.warn("Unable to compute style diff:",t),i=[{command:"setStyle",args:[e]}]}return i}(i,t),n=this._getOperationsToPerform(r);if(n.unimplemented.length>0)throw Error(`Unimplemented: ${n.unimplemented.join(", ")}.`);if(0===n.operations.length)return!1;for(let t of n.operations)t();return this.stylesheet=t,this._serializedLayers=null,this.fire(new tg({style:this})),!0}_getOperationsToPerform(t){let e=[],i=[];for(let r of t)switch(r.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":{let[t,i]=r.args;e.push((()=>this.addLayer(t,i)));break}case"removeLayer":{let[t]=r.args;e.push((()=>this.removeLayer(t)));break}case"setPaintProperty":{let[t,i,n]=r.args;e.push((()=>this.setPaintProperty(t,i,n)));break}case"setLayoutProperty":{let[t,i,n]=r.args;e.push((()=>this.setLayoutProperty(t,i,n)));break}case"setFilter":{let[t,i]=r.args;e.push((()=>this.setFilter(t,i)));break}case"addSource":{let[t,i]=r.args;e.push((()=>this.addSource(t,i)));break}case"removeSource":{let[t]=r.args;e.push((()=>this.removeSource(t)));break}case"setLayerZoomRange":{let[t,i,n]=r.args;e.push((()=>this.setLayerZoomRange(t,i,n)));break}case"setLight":{let[t]=r.args;e.push((()=>this.setLight(t)));break}case"setGeoJSONSourceData":{let[t,i]=r.args;e.push((()=>this.setGeoJSONSourceData(t,i)));break}case"setGlyphs":{let[t]=r.args;e.push((()=>this.setGlyphs(t)));break}case"setFontFaces":{let[t]=r.args;e.push((()=>this.setFontFaces(t)));break}case"setSprite":{let[t]=r.args;e.push((()=>this.setSprite(t)));break}case"setTerrain":{let[t]=r.args;e.push((()=>this.map.setTerrain(t)));break}case"setSky":{let[t]=r.args;e.push((()=>this.setSky(t)));break}case"setProjection":{let[t]=r.args;e.push((()=>this.setProjection(t)));break}case"setGlobalState":{let[t]=r.args;e.push((()=>this.setGlobalState(t)));break}case"setTransition":e.push((()=>{}));break;default:i.push(r.command)}return{operations:e,unimplemented:i}}addImage(t,e){this.getImage(t)?this.fire(new ge(Error(`An image named "${t}" already exists.`))):(this.imageManager.addImage(t,e),this._afterImageUpdated(t))}updateImage(t,e){this.imageManager.updateImage(t,e)}getImage(t){return this.imageManager.getImage(t)}setMissingImageResolver(t){this.imageManager.setMissingImageResolver(t)}removeImage(t){this.getImage(t)?(this.imageManager.removeImage(t),this._afterImageUpdated(t)):this.fire(new ge(Error(`An image named "${t}" does not exist.`)))}_markImagesChanged(t){for(let e of t)this._changedImages[e]=!0}_afterImageUpdated(t){this._changedImages[t]=!0,this._imagesListDirty=!0,this._changed=!0,this.fire(new eg("data"))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,e,i={}){if(this._checkLoaded(),void 0!==this.tileManagers[t])throw Error(`Source "${t}" already exists.`);if(!e.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(e).join(", ")}.`);if(Hs.has(e.type)&&this._validate(Ws.source,`sources.${t}`,e,null,i))return;this.map?._collectResourceTiming&&(e.collectResourceTiming=!0);let r=this.tileManagers[t]=new Qy(t,e,this.dispatcher);r.style=this,r.setEventedParent(this,(()=>({isSourceLoaded:r.loaded(),source:r.serialize(),sourceId:t}))),r.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),void 0===this.tileManagers[t])throw Error(`There is no source with this ID=${t}`);for(let e in this._layers)if(this._layers[e].source===t)return this.fire(new ge(Error(`Source "${t}" cannot be removed while layer "${e}" is using it.`)));let e=this.tileManagers[t];delete this.tileManagers[t],delete this._updatedSources[t],e.fire(new ig("data",{sourceDataType:"metadata",sourceId:t})),e.setEventedParent(null),e.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,e){if(this._checkLoaded(),void 0===this.tileManagers[t])throw Error(`There is no source with this ID=${t}`);let i=this.tileManagers[t].getSource();if("geojson"!==i.type)throw Error(`geojsonSource.type is ${i.type}, which is !== 'geojson`);i.setData(e),this._changed=!0}getSource(t){return this.tileManagers[t]?.getSource()}addLayer(t,e,i={}){this._checkLoaded();let r,n=t.id;if(this.getLayer(n))return void this.fire(new ge(Error(`Layer "${n}" already exists on this map.`)));if("custom"===t.type){if(Xs(this,function(t){let e=[],i=t.id;return void 0===i&&e.push(new xe(`layers.${i}`,null,'missing required property "id"')),void 0===t.render&&e.push(new xe(`layers.${i}`,null,'missing required method "render"')),t.renderingMode&&"2d"!==t.renderingMode&&"3d"!==t.renderingMode&&e.push(new xe(`layers.${i}`,null,'property "renderingMode" must be either "2d" or "3d"')),e}(t)))return;r=nd(t,this._globalState)}else{if("source"in t&&"object"==typeof t.source&&(this.addSource(n,t.source),t=Et(t=$t(t),{source:n})),this._validate(Ws.layer,`layers.${n}`,t,{arrayIndex:-1},i))return;r=nd(t,this._globalState),this._validateLayer(r),r.setEventedParent(this,{layer:{id:n}})}let s=e?this._order.indexOf(e):this._order.length;if(e&&-1===s)this.fire(new ge(Error(`Cannot add layer "${n}" before non-existing layer "${e}".`)));else{if(this._order.splice(s,0,n),this._layerOrderChanged=!0,this._layers[n]=r,this._removedLayers[n]&&r.source&&"custom"!==r.type){let t=this._removedLayers[n];delete this._removedLayers[n],t.type===r.type?(this._updatedSources[r.source]="reload",this.tileManagers[r.source].pause()):this._updatedSources[r.source]="clear"}this._updateLayer(r),r.onAdd&&r.onAdd(this.map)}}moveLayer(t,e){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new ge(Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===e)return;if(e&&!this._order.includes(e))return void this.fire(new ge(Error(`Cannot move layer "${t}" before non-existing layer "${e}".`)));let i=this._order.indexOf(t);this._order.splice(i,1);let r=e?this._order.indexOf(e):this._order.length;this._order.splice(r,0,t),this._layerOrderChanged=!0}removeLayer(t){this._checkLoaded();let e=this._layers[t];if(!e)return void this.fire(new ge(Error(`Cannot remove non-existing layer "${t}".`)));e.setEventedParent(null);let i=this._order.indexOf(t);this._order.splice(i,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=e,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],"symbol"===e.type&&e.source&&this.tileManagers[e.source]?.resetMaxContentElevation(),e.onRemove&&e.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,e,i){this._checkLoaded();let r=this.getLayer(t);r?(r.minzoom!==e||r.maxzoom!==i)&&(null!=e&&(r.minzoom=e),null!=i&&(r.maxzoom=i),this._updateLayer(r)):this.fire(new ge(Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,e,i={}){this._checkLoaded();let r=this.getLayer(t);if(r){if(!kt(r.filter,e)){if(null==e)return r.setFilter(void 0),void this._updateLayer(r);this._validate(Ws.filter,`layers.${r.id}.filter`,e,null,i)||(r.setFilter($t(e)),this._updateLayer(r))}}else this.fire(new ge(Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return $t(this.getLayer(t).filter)}setLayoutProperty(t,e,i,r={}){this._checkLoaded();let n=this.getLayer(t);n?kt(n.getLayoutProperty(e),i)||(n.setLayoutProperty(e,i,r),this._updateLayer(n)):this.fire(new ge(Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,e){let i=this.getLayer(t);if(i)return i.getLayoutProperty(e);this.fire(new ge(Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,e,i,r={}){this._checkLoaded();let n=this.getLayer(t);n?kt(n.getPaintProperty(e),i)||this._updatePaintProperty(n,e,i,r):this.fire(new ge(Error(`Cannot style non-existing layer "${t}".`)))}_updatePaintProperty(t,e,i,r={}){t.setPaintProperty(e,i,r)&&this._updateLayer(t),Co(t)&&"raster-fade-duration"===e&&this.tileManagers[t.source].setRasterFadeDuration(i),this._changed=!0,this._updatedPaintProps[t.id]=!0,"symbol"===t.type&&this.triggerSymbolPlacement(),this._serializedLayers=null}getPaintProperty(t,e){return this.getLayer(t).getPaintProperty(e)}setFeatureState(t,e){this._checkLoaded();let i=t.source,r=t.sourceLayer,n=this.tileManagers[i];if(void 0===n)return void this.fire(new ge(Error(`The source '${i}' does not exist in the map's style.`)));let s=n.getSource().type;if("geojson"===s&&r)return void this.fire(new ge(Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===s&&!r)return void this.fire(new ge(Error("The sourceLayer parameter must be provided for vector source types.")));if(void 0===t.id)return void this.fire(new ge(Error("The feature id parameter must be provided.")));let o=["__proto__","constructor","prototype"];e&&Object.keys(e).some((t=>o.includes(t)))?this.fire(new ge(Error(`The feature state should not include one of the following keys: ${o}`))):n.setFeatureState(r,t.id,e)}removeFeatureState(t,e){this._checkLoaded();let i=t.source,r=this.tileManagers[i];if(void 0===r)return void this.fire(new ge(Error(`The source '${i}' does not exist in the map's style.`)));let n=r.getSource().type,s="vector"===n?t.sourceLayer:void 0;"vector"!==n||s?e&&"string"!=typeof t.id&&"number"!=typeof t.id?this.fire(new ge(Error("A feature id is required to remove its specific state property."))):r.removeFeatureState(s,t.id,e):this.fire(new ge(Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();let e=t.source,i=t.sourceLayer,r=this.tileManagers[e];if(void 0!==r){if("vector"!==r.getSource().type||i)return void 0===t.id&&this.fire(new ge(Error("The feature id parameter must be provided."))),r.getFeatureState(i,t.id);this.fire(new ge(Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new ge(Error(`The source '${e}' does not exist in the map's style.`)))}getTransition(){return Et({duration:300,delay:0},this.stylesheet?.transition)}serialize(){if(!this._loaded)return;let t=Pt(this.tileManagers,(t=>t.serialize())),e=this._serializeByIds(this._order,!0),i=this.map.getTerrain()||void 0,r=this.stylesheet;return It({version:r.version,name:r.name,metadata:r.metadata,light:r.light,sky:r.sky,center:r.center,zoom:r.zoom,bearing:r.bearing,pitch:r.pitch,sprite:r.sprite,glyphs:r.glyphs,"font-faces":r["font-faces"],transition:r.transition,projection:r.projection,state:r.state,sources:t,layers:e,terrain:i},(t=>void 0!==t))}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.tileManagers[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.tileManagers[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){let e=t=>"fill-extrusion"===this._layers[t].type,i={},r=[];for(let n=this._order.length-1;n>=0;n--){let s=this._order[n];if(e(s)){i[s]=n;for(let e of t){let t=e[s];if(t)for(let e of t)r.push(e)}}}r.sort(((t,e)=>e.intersectionZ-t.intersectionZ));let n=[];for(let s=this._order.length-1;s>=0;s--){let o=this._order[s];if(e(o))for(let t=r.length-1;t>=0;t--){let e=r[t].feature;if(i[e.layer.id]<s)break;n.push(e),r.pop()}else for(let e of t){let t=e[o];if(t)for(let e of t)n.push(e.feature)}}return n}queryRenderedFeatures(t,e,i){e?.filter&&this._validate(Ws.filter,"queryRenderedFeatures.filter",e.filter,null,e);let r={};if(e?.layers){if(!(Array.isArray(e.layers)||e.layers instanceof Set))return this.fire(new ge(Error("parameters.layers must be an Array or a Set of strings"))),[];for(let t of e.layers){let e=this._layers[t];if(!e)return this.fire(new ge(Error(`The layer '${t}' does not exist in the map's style and cannot be queried for features.`))),[];r[e.source]=!0}}let n=[];e.availableImages=this.imageManager.listImages();let s=this._serializedAllLayers(),o=e.layers instanceof Set?e.layers:Array.isArray(e.layers)?new Set(e.layers):null,a={...e,layers:o,globalState:this._globalState};for(let o in this.tileManagers)(!e.layers||r[o])&&n.push(iy(this.tileManagers[o],this._layers,s,t,a,i,this.map.terrain?(t,e,i)=>this.map.terrain.getElevation(t,e,i):void 0));return this.placement&&n.push(function(t,e,i,r,n,s,o){let a={},l=s.queryRenderedSymbols(r),h=[];for(let t of Object.keys(l).map(Number))h.push(o[t]);h.sort(ry);for(let i of h){let r=i.featureIndex.lookupSymbolFeatures(l[i.bucketInstanceId],e,i.bucketIndex,i.sourceLayerIndex,{filterSpec:n.filter,globalState:n.globalState},n.layers,n.availableImages,t);for(let t in r){a[t]||=[];let e=r[t];e.sort(((t,e)=>{let r=i.featureSortOrder;if(r){let i=r.indexOf(t.featureIndex);return r.indexOf(e.featureIndex)-i}return e.featureIndex-t.featureIndex}));for(let i of e)a[t].push(i)}}return function(t,e,i){for(let r in t)for(let n of t[r])ny(n,i[e[r].source]);return t}(a,t,i)}(this._layers,s,this.tileManagers,t,a,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(n)}querySourceFeatures(t,e){e?.filter&&this._validate(Ws.filter,"querySourceFeatures.filter",e.filter,null,e);let i=this.tileManagers[t];return i?function(t,e){let i=t.getRenderableIds().map((e=>t.getTileByID(e))),r=[],n={};for(let t of i){let i=t.tileID.canonical.key;n[i]||(n[i]=!0,t.querySourceFeatures(r,e))}return r}(i,e?{...e,globalState:this._globalState}:{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(t,e={}){this._checkLoaded();let i=this.light.getLight(),r=!1;for(let e in t)if(!kt(t[e],i[e])){r=!0;break}if(!r)return;let n={now:H_(),transition:Et({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,e),this.light.updateTransitions(n)}getProjection(){return this.stylesheet?.projection}setProjection(t){this._checkLoaded();let e=t??{type:"mercator"};if(this.stylesheet.projection=t,this.projection){if(this.projection.name===e.type)return;this.projection.destroy(),delete this.projection}this._setProjectionInternal(e.type)}getSky(){return this.stylesheet?.sky}setSky(t,e={}){this._checkLoaded();let i=this.getSky(),r=!1;if(!t&&!i)return;if(t&&!i)r=!0;else if(!t&&i)r=!0;else for(let e in t)if(!kt(t[e],i[e])){r=!0;break}if(!r)return;let n={now:H_(),transition:Et({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=t,this.sky.setSky(t,e),this.sky.updateTransitions(n)}_setProjectionInternal(t){let e=function(t,e,i){let r={constrainOverride:e};if(Array.isArray(t)){let e=new kw({type:t},i);return{projection:e,transform:new sb(r),cameraHelper:new ab(e)}}switch(t){case"mercator":return{projection:new hw,transform:new Dw(r),cameraHelper:new Cw};case"globe":{let t=new kw({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]},{});return{projection:t,transform:new sb(r),cameraHelper:new ab(t)}}case"vertical-perspective":return{projection:new Iw,transform:new tb(r),cameraHelper:new ob};default:return Rt(`Unknown projection name: ${t}. Falling back to mercator projection.`),{projection:new hw,transform:new Dw(r),cameraHelper:new Cw}}}(t,this.map._camera?.transform.constrainOverride,this._globalState);this.projection=e.projection,this.map.migrateProjection(e.transform,e.cameraHelper);for(let t in this.tileManagers)this.tileManagers[t].reload()}_validate(t,e,i,r,n={}){return!1!==n.validate&&Js(this,t,{key:e,style:this.serialize(),value:i,...r},n)}_remove(t=!0){this._frameRequest&&=(this._frameRequest.abort(),null),this._loadStyleRequest&&=(this._loadStyleRequest.abort(),null),this._spriteRequest&&=(this._spriteRequest.abort(),null),ky().off(Ty,this._rtlPluginLoaded);for(let t in this._layers)this._layers[t].setEventedParent(null);for(let t in this.tileManagers){let e=this.tileManagers[t];e.setEventedParent(null),e.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),t&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(t)}_clearSource(t){this.tileManagers[t].clearTiles()}_reloadSource(t){this.tileManagers[t].resume(),this.tileManagers[t].reload()}_updateSources(t){for(let e in this.tileManagers)this.tileManagers[e].update(t,this.map.terrain)}_generateCollisionBoxes(){for(let t in this.tileManagers)this._reloadSource(t)}triggerSymbolPlacement(){this._symbolPlacementTriggered=!0}_placementInputsChanged(t,e,i){let r=this.pauseablePlacement;return!r||this._symbolPlacementTriggered||this._placedProjectionTransition!==this.projection?.transitionState||r._showCollisionBoxes!==e||r.placement.collisionGroups.crossSourceCollisions!==i||r.placement.transform.renderWorldCopies!==t.renderWorldCopies||!function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]}(r.placement.transform.modelViewProjectionMatrix,t.modelViewProjectionMatrix)}_updatePlacement(t,e,i,r,n=!1){let s=!1,o=!1,a={};for(let e of this._order){let i=this._layers[e];if("symbol"!==i.type)continue;if(!a[i.source]){let t=this.tileManagers[i.source];a[i.source]=t.getRenderableIds(!0).map((e=>t.getTileByID(e))).sort(((t,e)=>e.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(e.tileID)?-1:1)))}let r=this.crossTileSymbolIndex.addLayer(i,a[i.source],t.center.lng);s||=r}this.crossTileSymbolIndex.pruneUnusedLayers(this._order),n||=this._layerOrderChanged||0===i;let l=s||this._placementInputsChanged(t,e,r),h=this.pauseablePlacement?.isDone()&&!this.placement.stillRecent(H_(),t.zoom);if((n||!this.pauseablePlacement||h&&(l||this.placement.stale))&&(this._symbolPlacementTriggered=!1,this._placedProjectionTransition=this.projection?.transitionState,this.pauseablePlacement=new qv(t,this.map.terrain,this._order,n,e,i,r,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?l&&this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,a),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(H_()),o=!0),s&&this.pauseablePlacement.placement.setStale()),o||s)for(let t of this._order){let e=this._layers[t];"symbol"===e.type&&this.placement.updateLayerOpacities(e,a[e.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(H_())}_releaseSymbolFadeTiles(){for(let t in this.tileManagers)this.tileManagers[t].releaseSymbolFadeTiles()}async getImages(t,e){let i=await this.imageManager.getImages(e.icons);this._updateTilesForChangedImages();let r=this.tileManagers[e.source];return r&&r.setDependencies(e.tileID.key,e.type,e.icons),i}async getGlyphs(t,e){let i=await this.glyphManager.getGlyphs(e.stacks),r=this.tileManagers[e.source];return r&&r.setDependencies(e.tileID.key,e.type,[""]),i}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,e={}){this._checkLoaded(),(!t||!this._validate(Ws.glyphs,"glyphs",t,null,e))&&(this._changed=!0,this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}getFontFaces(){return this.stylesheet["font-faces"]||null}setFontFaces(t){this._checkLoaded(),this._changed=!0,this._glyphsDidChange=!0,this.stylesheet["font-faces"]=t,this.glyphManager.setFontFaces(t)}async getDashes(t,e){let i={};for(let[t,r]of Object.entries(e.dashes))i[t]=this.lineAtlas.getDash(r.dasharray,r.round);return i}addSprite(t,e,i={},r){this._checkLoaded();let n=[{id:t,url:e}],s=[...Dg(this.stylesheet.sprite),...n];this._validate(Ws.sprite,"sprite",s,null,i)||(this.stylesheet.sprite=s,this._loadSprite(n,!0,r))}removeSprite(t){this._checkLoaded();let e=Dg(this.stylesheet.sprite);if(!e.find((e=>e.id===t)))return void this.fire(new ge(Error(`Sprite "${t}" doesn't exists on this map.`)));let i=this.imageManager.removeSpriteImages(t);this._markImagesChanged(i),e.splice(e.findIndex((e=>e.id===t)),1),this.stylesheet.sprite=e.length>0?e:void 0,this._imagesListDirty=!0,this._changed=!0,this.fire(new eg("data"))}getSprite(){return Dg(this.stylesheet.sprite)}setSprite(t,e={},i){this._checkLoaded(),(!t||!this._validate(Ws.sprite,"sprite",t,null,e))&&(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,i):(this._unloadSprite(),i&&i(null)))}destroy(){this._frameRequest&&=(this._frameRequest.abort(),null),this._loadStyleRequest&&=(this._loadStyleRequest.abort(),null),this._spriteRequest&&=(this._spriteRequest.abort(),null);for(let t in this.tileManagers){let e=this.tileManagers[t];e.setEventedParent(null),e.onRemove(this.map)}this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this.patternAtlas.destroy()),this.glyphManager&&this.glyphManager.destroy();for(let t in this._layers){let e=this._layers[t];e.setEventedParent(null),e.onRemove&&e.onRemove(this.map)}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler("GG"),this.dispatcher.unregisterMessageHandler("GI"),this.dispatcher.unregisterMessageHandler("GDA"),this.dispatcher.remove(!0),this._listeners={},this._oneTimeListeners={}}};const ub=$o([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);var cb=class{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,e,i,r,n,s,o,a,l){this.context=t;let h=this.boundPaintVertexBuffers.length!==r.length;for(let t=0;!h&&t<r.length;t++)this.boundPaintVertexBuffers[t]!==r[t]&&(h=!0);!this.vao||this.boundProgram!==e||this.boundLayoutVertexBuffer!==i||h||this.boundIndexBuffer!==n||this.boundVertexOffset!==s||this.boundDynamicVertexBuffer!==o||this.boundDynamicVertexBuffer2!==a||this.boundDynamicVertexBuffer3!==l?this.freshBind(e,i,r,n,s,o,a,l):t.bindVertexArray.set(this.vao)}freshBind(t,e,i,r,n,s,o,a){let l=t.numAttributes,h=this.context,u=h.gl;this.vao&&this.destroy(),this.vao=h.createVertexArray(),h.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=e,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=r,this.boundVertexOffset=n,this.boundDynamicVertexBuffer=s,this.boundDynamicVertexBuffer2=o,this.boundDynamicVertexBuffer3=a,e.enableAttributes(u,t);for(let e of i)e.enableAttributes(u,t);s&&s.enableAttributes(u,t),o&&o.enableAttributes(u,t),a&&a.enableAttributes(u,t),e.bind(),e.setVertexAttribPointers(u,t,n);for(let e of i)e.bind(),e.setVertexAttribPointers(u,t,n);s&&(s.bind(),s.setVertexAttribPointers(u,t,n)),r&&r.bind(),o&&(o.bind(),o.setVertexAttribPointers(u,t,n)),a&&(a.bind(),a.setVertexAttribPointers(u,t,n)),h.currentNumAttributes=l}destroy(){this.vao&&=(this.context.deleteVertexArray(this.vao),null)}};const fb=(t,e,i,r,n)=>({u_texture:0,u_ele_delta:t,u_fog_matrix:e,u_fog_color:i?i.properties.get("fog-color"):di.white,u_fog_ground_blend:i?i.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:n?0:i?i.calculateFogBlendOpacity(r):0,u_horizon_color:i?i.properties.get("horizon-color"):di.white,u_horizon_fog_blend:i?i.properties.get("horizon-fog-blend"):1,u_is_globe_mode:+!!n}),pb=t=>({u_ele_delta:t}),db={ProjectionUBO:0,TerrainUBO:1,FrameUBO:2},mb={float:[1,1],int:[1,1],vec2:[2,2],vec4:[4,4],mat4:[16,4]};function _b(t){let e={},i=0;for(let{name:r,type:n}of t){let[t,s]=mb[n];i=Math.ceil(i/s)*s,e[r]=i,i+=t}return{offsets:e,contentWords:i,sizeWords:4*Math.ceil(i/4)}}var gb=class{constructor(t,e,i){this.context=t,this.binding=e,this.contentWords=i.contentWords;let r=t.gl;this.buffer=r.createBuffer(),r.bindBuffer(r.UNIFORM_BUFFER,this.buffer),r.bufferData(r.UNIFORM_BUFFER,4*i.sizeWords,r.DYNAMIC_DRAW),r.bindBufferBase(r.UNIFORM_BUFFER,e,this.buffer),this.uploaded=new Float32Array(i.sizeWords),this.pending=new Float32Array(i.sizeWords),this.uploadedWords=new Uint32Array(this.uploaded.buffer),this.pendingWords=new Uint32Array(this.pending.buffer),this.hasData=!1,this.bindingDirty=!1}upload(){let t=this.context.gl,e=!this.hasData;if(!e){let t=this.pendingWords,i=this.uploadedWords;for(let r=0;r<this.contentWords;r++)if(t[r]!==i[r]){e=!0;break}}this.bind(),e&&(t.bindBufferBase(t.UNIFORM_BUFFER,this.binding,this.buffer),t.bufferSubData(t.UNIFORM_BUFFER,0,this.pending),this.uploaded.set(this.pending),this.hasData=!0)}bind(){if(!this.bindingDirty)return;let t=this.context.gl;t.bindBufferBase(t.UNIFORM_BUFFER,this.binding,this.buffer),this.bindingDirty=!1}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}};const yb=_b([{name:"u_projection_matrix",type:"mat4"},{name:"u_projection_fallback_matrix",type:"mat4"},{name:"u_projection_tile_mercator_coords",type:"vec4"},{name:"u_projection_clipping_plane",type:"vec4"},{name:"u_projection_transition",type:"float"},{name:"u_projection_clip_antimeridian",type:"int"}]),vb=yb.offsets,wb=_b([{name:"u_terrain_matrix",type:"mat4"},{name:"u_terrain_unpack",type:"vec4"},{name:"u_terrain_dim",type:"float"},{name:"u_terrain_exaggeration",type:"float"}]),bb=wb.offsets;function xb(t){let e=[];for(let i of t){if(null===i)continue;let t=i.split(" ");e.push(t.pop())}return e}var Db=class{constructor(t,e,i,r,n,s,o,a,l=[]){let h=t.gl;this.program=h.createProgram();let u=xb(e.staticAttributes),c=i?i.getBinderAttributes():[],f=u.concat(c),p=sw.prelude.staticUniforms?xb(sw.prelude.staticUniforms):[],d=e.staticUniforms?xb(e.staticUniforms):[],m=i?i.getBinderUniforms():[],_=p.concat(d).concat(m),g=[];for(let t of _)g.includes(t)||g.push(t);let y=i?i.defines():[];y.unshift("#version 300 es"),n&&y.push("#define OVERDRAW_INSPECTOR;"),s&&y.push("#define TERRAIN3D;"),a&&y.push(a),l&&y.push(...l);let v=y.concat(sw.prelude.fragmentSource,o.fragmentSource,e.fragmentSource).join("\n"),w=y.concat(sw.prelude.vertexSource,o.vertexSource,e.vertexSource).join("\n"),b=h.createShader(h.FRAGMENT_SHADER);if(h.isContextLost())return void(this.failedToCreate=!0);h.shaderSource(b,v),h.compileShader(b),h.attachShader(this.program,b);let x=h.createShader(h.VERTEX_SHADER);if(h.isContextLost())return void(this.failedToCreate=!0);h.shaderSource(x,w),h.compileShader(x),h.attachShader(this.program,x),this.attributes={};let D={};if(this.numAttributes=f.length,h.linkProgram(this.program),!h.getProgramParameter(this.program,h.LINK_STATUS)){if(h.isContextLost())return void(this.failedToCreate=!0);throw h.getShaderParameter(b,h.COMPILE_STATUS)?h.getShaderParameter(x,h.COMPILE_STATUS)?Error(`Program failed to link: ${h.getProgramInfoLog(this.program)}`):Error(`Could not compile vertex shader: ${h.getShaderInfoLog(x)}`):Error(`Could not compile fragment shader: ${h.getShaderInfoLog(b)}`)}!function(t,e){for(let[i,r]of Object.entries(db)){let n=t.getUniformBlockIndex(e,i);n!==t.INVALID_INDEX&&t.uniformBlockBinding(e,n,r)}}(h,this.program);let M=function(t,e){let i=new Set([t.INT,t.INT_VEC2,t.INT_VEC3,t.INT_VEC4,t.UNSIGNED_INT,t.UNSIGNED_INT_VEC2,t.UNSIGNED_INT_VEC3,t.UNSIGNED_INT_VEC4]),r=new Set,n=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let s=0;s<n;s++){let n=t.getActiveAttrib(e,s);n&&i.has(n.type)&&r.add(n.name)}return r}(h,this.program);for(let t of f){if(!t)continue;let e=h.getAttribLocation(this.program,t);e>=0&&(this.attributes[t]={location:e,isInteger:M.has(t)})}h.deleteShader(x),h.deleteShader(b);for(let t of g)if(t&&!D[t]){let e=h.getUniformLocation(this.program,t);e&&(D[t]=e)}this.fixedUniforms=r(t,D),this.terrainUniforms=((t,e)=>({u_depth:new Ka(t,e.u_depth),u_terrain:new Ka(t,e.u_terrain)}))(t,D),this.binderUniforms=i?i.getUniforms(t,D):[]}draw(t,e,i,r,n,s,o,a,l,h,u,c,f,p,d,m,_,g,y){let v=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.projectionUniformBuffer.bind(),t.terrainUniformBuffer.bind(),t.frameUniformBuffer.bind(),t.setDepthMode(i),t.setStencilMode(r),t.setColorMode(n),t.setCullFace(s),a){t.activeTexture.set(v.TEXTURE2),v.bindTexture(v.TEXTURE_2D,a.depthTexture),t.activeTexture.set(v.TEXTURE3),v.bindTexture(v.TEXTURE_2D,a.texture);for(let t in this.terrainUniforms)this.terrainUniforms[t].set(a[t]);!function(t,e){let i=t.pending;i.set(e.u_terrain_matrix,bb.u_terrain_matrix),i.set(e.u_terrain_unpack,bb.u_terrain_unpack),i[bb.u_terrain_dim]=e.u_terrain_dim,i[bb.u_terrain_exaggeration]=e.u_terrain_exaggeration,t.upload()}(t.terrainUniformBuffer,a)}if(l&&function(t,e){let i=t.pending;i.set(e.mainMatrix,vb.u_projection_matrix),i.set(e.fallbackMatrix,vb.u_projection_fallback_matrix),i.set(e.tileMercatorCoords,vb.u_projection_tile_mercator_coords),i.set(e.clippingPlane,vb.u_projection_clipping_plane),i[vb.u_projection_transition]=e.projectionTransition,t.pendingWords[vb.u_projection_clip_antimeridian]=+!!e.clipAntimeridian,t.upload()}(t.projectionUniformBuffer,l),o)for(let t in this.fixedUniforms)this.fixedUniforms[t].set(o[t]);m&&m.setUniforms(t,this.binderUniforms,p,{zoom:d});let w=0;switch(e){case v.LINES:w=2;break;case v.TRIANGLES:w=3;break;case v.LINE_STRIP:w=1}for(let i of f.get())i.vaos||={},i.vaos[h]||=new cb,i.vaos[h].bind(t,this,u,m?m.getPaintVertexBuffers():[],c,i.vertexOffset,_,g,y),v.drawElements(e,i.primitiveLength*w,v.UNSIGNED_SHORT,i.primitiveOffset*w*2)}};function Mb(t,e,i){let r=1/rt(i,1,e.transform.tileZoom),n=2**i.tileID.overscaledZ,s=i.tileSize*2**e.transform.tileZoom/n,o=s*(i.tileID.canonical.x+i.tileID.wrap*n),a=s*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[r,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[o>>16,a>>16],u_pixel_coord_lower:[65535&o,65535&a]}}const Eb=(t,e,i,r)=>{let n=t.style.light,s=n.getCartesianPosition(),o=_();"viewport"===n.properties.get("anchor")&&function(t,e){var i=Math.sin(e),r=Math.cos(e);t[0]=r,t[1]=i,t[2]=0,t[3]=-i,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1}(o,t.transform.bearingInRadians),function(t,e,i){var r=e[0],n=e[1],s=e[2];t[0]=r*i[0]+n*i[3]+s*i[6],t[1]=r*i[1]+n*i[4]+s*i[7],t[2]=r*i[2]+n*i[5]+s*i[8]}(s,s,o);let a=t.transform.transformLightDirection(s),l=n.properties.get("color");return{u_lightpos:s,u_lightpos_globe:a,u_lightintensity:n.properties.get("intensity"),u_lightcolor:[l.r,l.g,l.b],u_vertical_gradient:+e,u_opacity:i,u_fill_translate:r}},Ab=(t,e,i,r,n,s,o)=>Et(Eb(t,e,i,r),Mb(s,t,o),{u_height_factor:-(2**n.overscaledZ)/o.tileSize/8}),Fb=(t,e,i,r,n)=>Et(Mb(e,t,i),{u_fill_translate:r,u_sdf_pattern:+!!n}),zb=t=>({u_fill_translate:t}),Sb=t=>({u_fill_translate:t}),Cb=(t,e,i,r,n)=>Fb(t,e,i,r,n),Tb=(t,e,i,r,n)=>{let s,o,a=t.transform,l=0;if("map"===i.paint.get("circle-pitch-alignment")){let t=rt(e,1,a.zoom);s=!0,o=[t,t],l=t/(it*2**e.tileID.overscaledZ)*2*Math.PI*n}else s=!1,o=a.pixelsToGLUnits;return{u_scale_with_map:+("map"===i.paint.get("circle-pitch-scale")),u_pitch_with_map:+s,u_extrude_scale:o,u_globe_extrude_scale:l,u_translate:r}},Pb=(t,e=1)=>({u_color:t,u_overlay:0,u_overlay_scale:e}),Ib=(t,e,i,r)=>{let n=rt(t,1,e)/(it*2**t.tileID.overscaledZ)*2*Math.PI*r;return{u_extrude_scale:rt(t,1,e),u_intensity:i,u_globe_extrude_scale:n}},kb=(t,e,i,r)=>{let n=g();return z(n,0,t.width,t.height,0,0,1),{u_matrix:n,u_image:i,u_color_ramp:r,u_opacity:e.paint.get("heatmap-opacity")}},$b=(t,e,i)=>{let r,n=i.paint.get("hillshade-accent-color");switch(i.paint.get("hillshade-method")){case"basic":r=4;break;case"combined":r=1;break;case"igor":r=2;break;case"multidirectional":r=3;break;default:r=0}let s=i.getIlluminationProperties();for(let e=0;e<s.directionRadians.length;e++)"viewport"===i.paint.get("hillshade-illumination-anchor")&&(s.directionRadians[e]+=t.transform.bearingInRadians);return{u_image:0,u_latrange:Rb(0,e.tileID),u_exaggeration:i.paint.get("hillshade-exaggeration"),u_altitudes:s.altitudeRadians,u_azimuths:s.directionRadians,u_accent:n,u_method:r,u_highlights:s.highlightColor,u_shadows:s.shadowColor}},jb=(t,e)=>{let i=e.stride,r=g();return z(r,0,it,-it,0,0,1),x(r,r,[0,-it,0]),{u_matrix:r,u_image:1,u_dimension:[i,i],u_zoom:t.overscaledZ,u_unpack:e.getUnpackVector()}};function Rb(t,e){let i=2**e.canonical.z,r=e.canonical.y;return[new Wu(0,r/i).toLngLat().lat,new Wu(0,(r+1)/i).toLngLat().lat]}const Ob=(t,e,i=0)=>({u_image:0,u_unpack:e.getUnpackVector(),u_dimension:[e.stride,e.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:i,u_opacity:t.paint.get("color-relief-opacity")}),Bb=(t,e,i,r)=>{let n=t.transform;return{u_translation:Vb(t,e,i),u_ratio:r/rt(e,1,n.zoom)}},Lb=(t,e,i,r,n)=>Et(Bb(t,e,i,r),{u_image:0,u_image_height:n}),Ub=(t,e,i,r,n)=>{let s=t.transform,o=qb(e,s);return{u_translation:Vb(t,e,i),u_texsize:e.imageAtlasTexture.size,u_ratio:r/rt(e,1,s.zoom),u_image:0,u_scale:[o,n.fromScale,n.toScale],u_fade:n.t}},Nb=(t,e,i,r,n)=>{let s=qb(e,t.transform);return Et(Bb(t,e,i,r),{u_tileratio:s,u_crossfade_from:n.fromScale,u_crossfade_to:n.toScale,u_image:0,u_mix:n.t,u_lineatlas_width:t.lineAtlas.width,u_lineatlas_height:t.lineAtlas.height})},Gb=(t,e,i,r,n,s)=>{let o=qb(e,t.transform);return Et(Bb(t,e,i,r),{u_image:0,u_image_height:s,u_tileratio:o,u_crossfade_from:n.fromScale,u_crossfade_to:n.toScale,u_image_dash:1,u_mix:n.t,u_lineatlas_width:t.lineAtlas.width,u_lineatlas_height:t.lineAtlas.height})};function qb(t,e){return 1/rt(t,1,e.tileZoom)}function Vb(t,e,i){return ut(t.transform,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const Zb=(t,e,i,r,n,s,o,a,l,h,u,c,f,p,d)=>({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_rotate_symbol:+i,u_label_plane_matrix:a,u_coord_matrix:l,u_is_text:+u,u_pitch_with_map:+r,u_is_along_line:n,u_is_variable_anchor:s,u_texsize:c,u_texture:0,u_translation:h,u_pitched_scale:f,u_is_offset:p,u_height_anchor_ground:+d}),Wb=(t,e,i,r,n,s,o,a,l,h,u,c,f,p,d,m)=>{let _=o.transform;return Et(Zb(t,e,i,r,n,s,0,a,l,h,u,c,p,d,m),{u_gamma_scale:r?Math.cos(_.pitch*Math.PI/180)*_.cameraToCenterDistance:1,u_is_halo:+!!f,u_is_plain:1})},Hb=(t,e,i,r,n,s,o,a,l,h,u,c,f,p,d)=>Et(Wb(t,e,i,r,n,s,o,a,l,h,!0,u,!0,f,p,d),{u_texsize_icon:c,u_texture_icon:1}),Yb=(t,e)=>({u_opacity:t,u_color:e}),Xb=(t,e,i,r,n)=>Et(function(t,e,i,r){let n=i.patternAtlas.getPattern(t.from.toString()),s=i.patternAtlas.getPattern(t.to.toString()),{width:o,height:a}=i.patternAtlas.getPixelSize(),l=2**r.tileID.overscaledZ,h=r.tileSize*2**i.transform.tileZoom/l,u=h*(r.tileID.canonical.x+r.tileID.wrap*l),c=h*r.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:n.tl,u_pattern_br_a:n.br,u_pattern_tl_b:s.tl,u_pattern_br_b:s.br,u_texsize:[o,a],u_mix:e.t,u_pattern_size_a:n.displaySize,u_pattern_size_b:s.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/rt(r,1,i.transform.tileZoom),u_pixel_coord_upper:[u>>16,c>>16],u_pixel_coord_lower:[65535&u,65535&c]}}(i,n,e,r),{u_opacity:t}),Jb=()=>({}),Kb={fillExtrusion:(t,e)=>({u_lightpos:new el(t,e.u_lightpos),u_lightpos_globe:new el(t,e.u_lightpos_globe),u_lightintensity:new Qa(t,e.u_lightintensity),u_lightcolor:new el(t,e.u_lightcolor),u_vertical_gradient:new Qa(t,e.u_vertical_gradient),u_opacity:new Qa(t,e.u_opacity),u_fill_translate:new tl(t,e.u_fill_translate)}),fillExtrusionPattern:(t,e)=>({u_lightpos:new el(t,e.u_lightpos),u_lightpos_globe:new el(t,e.u_lightpos_globe),u_lightintensity:new Qa(t,e.u_lightintensity),u_lightcolor:new el(t,e.u_lightcolor),u_vertical_gradient:new Qa(t,e.u_vertical_gradient),u_height_factor:new Qa(t,e.u_height_factor),u_opacity:new Qa(t,e.u_opacity),u_fill_translate:new tl(t,e.u_fill_translate),u_image:new Ka(t,e.u_image),u_texsize:new tl(t,e.u_texsize),u_pixel_coord_upper:new tl(t,e.u_pixel_coord_upper),u_pixel_coord_lower:new tl(t,e.u_pixel_coord_lower),u_scale:new el(t,e.u_scale),u_fade:new Qa(t,e.u_fade)}),fill:(t,e)=>({u_fill_translate:new tl(t,e.u_fill_translate)}),fillPattern:(t,e)=>({u_image:new Ka(t,e.u_image),u_texsize:new tl(t,e.u_texsize),u_pixel_coord_upper:new tl(t,e.u_pixel_coord_upper),u_pixel_coord_lower:new tl(t,e.u_pixel_coord_lower),u_scale:new el(t,e.u_scale),u_fade:new Qa(t,e.u_fade),u_sdf_pattern:new Ka(t,e.u_sdf_pattern),u_fill_translate:new tl(t,e.u_fill_translate)}),fillOutline:(t,e)=>({u_fill_translate:new tl(t,e.u_fill_translate)}),fillOutlinePattern:(t,e)=>({u_image:new Ka(t,e.u_image),u_texsize:new tl(t,e.u_texsize),u_pixel_coord_upper:new tl(t,e.u_pixel_coord_upper),u_pixel_coord_lower:new tl(t,e.u_pixel_coord_lower),u_scale:new el(t,e.u_scale),u_fade:new Qa(t,e.u_fade),u_sdf_pattern:new Ka(t,e.u_sdf_pattern),u_fill_translate:new tl(t,e.u_fill_translate)}),circle:(t,e)=>({u_scale_with_map:new Ka(t,e.u_scale_with_map),u_pitch_with_map:new Ka(t,e.u_pitch_with_map),u_extrude_scale:new tl(t,e.u_extrude_scale),u_globe_extrude_scale:new Qa(t,e.u_globe_extrude_scale),u_translate:new tl(t,e.u_translate)}),collisionBox:Jb,collisionCircle:Jb,debug:(t,e)=>({u_color:new rl(t,e.u_color),u_overlay:new Ka(t,e.u_overlay),u_overlay_scale:new Qa(t,e.u_overlay_scale)}),depth:Jb,clippingMask:Jb,heatmap:(t,e)=>({u_extrude_scale:new Qa(t,e.u_extrude_scale),u_intensity:new Qa(t,e.u_intensity),u_globe_extrude_scale:new Qa(t,e.u_globe_extrude_scale)}),heatmapTexture:(t,e)=>({u_matrix:new al(t,e.u_matrix),u_image:new Ka(t,e.u_image),u_color_ramp:new Ka(t,e.u_color_ramp),u_opacity:new Qa(t,e.u_opacity)}),hillshade:(t,e)=>({u_image:new Ka(t,e.u_image),u_latrange:new tl(t,e.u_latrange),u_exaggeration:new Qa(t,e.u_exaggeration),u_altitudes:new sl(t,e.u_altitudes),u_azimuths:new sl(t,e.u_azimuths),u_accent:new rl(t,e.u_accent),u_method:new Ka(t,e.u_method),u_shadows:new nl(t,e.u_shadows),u_highlights:new nl(t,e.u_highlights)}),hillshadePrepare:(t,e)=>({u_matrix:new al(t,e.u_matrix),u_image:new Ka(t,e.u_image),u_dimension:new tl(t,e.u_dimension),u_zoom:new Qa(t,e.u_zoom),u_unpack:new il(t,e.u_unpack)}),colorRelief:(t,e)=>({u_image:new Ka(t,e.u_image),u_unpack:new il(t,e.u_unpack),u_dimension:new tl(t,e.u_dimension),u_elevation_stops:new Ka(t,e.u_elevation_stops),u_color_stops:new Ka(t,e.u_color_stops),u_color_ramp_size:new Ka(t,e.u_color_ramp_size),u_opacity:new Qa(t,e.u_opacity)}),line:(t,e)=>({u_translation:new tl(t,e.u_translation),u_ratio:new Qa(t,e.u_ratio)}),lineGradient:(t,e)=>({u_translation:new tl(t,e.u_translation),u_ratio:new Qa(t,e.u_ratio),u_image:new Ka(t,e.u_image),u_image_height:new Qa(t,e.u_image_height)}),linePattern:(t,e)=>({u_translation:new tl(t,e.u_translation),u_texsize:new tl(t,e.u_texsize),u_ratio:new Qa(t,e.u_ratio),u_image:new Ka(t,e.u_image),u_scale:new el(t,e.u_scale),u_fade:new Qa(t,e.u_fade)}),lineSDF:(t,e)=>({u_translation:new tl(t,e.u_translation),u_ratio:new Qa(t,e.u_ratio),u_image:new Ka(t,e.u_image),u_mix:new Qa(t,e.u_mix),u_tileratio:new Qa(t,e.u_tileratio),u_crossfade_from:new Qa(t,e.u_crossfade_from),u_crossfade_to:new Qa(t,e.u_crossfade_to),u_lineatlas_width:new Qa(t,e.u_lineatlas_width),u_lineatlas_height:new Qa(t,e.u_lineatlas_height)}),lineGradientSDF:(t,e)=>({u_translation:new tl(t,e.u_translation),u_ratio:new Qa(t,e.u_ratio),u_image:new Ka(t,e.u_image),u_image_height:new Qa(t,e.u_image_height),u_tileratio:new Qa(t,e.u_tileratio),u_crossfade_from:new Qa(t,e.u_crossfade_from),u_crossfade_to:new Qa(t,e.u_crossfade_to),u_image_dash:new Ka(t,e.u_image_dash),u_mix:new Qa(t,e.u_mix),u_lineatlas_width:new Qa(t,e.u_lineatlas_width),u_lineatlas_height:new Qa(t,e.u_lineatlas_height)}),layerOpacity:(t,e)=>({u_image:new Ka(t,e.u_image),u_opacity:new Qa(t,e.u_opacity)}),raster:(t,e)=>({u_tl_parent:new tl(t,e.u_tl_parent),u_scale_parent:new Qa(t,e.u_scale_parent),u_buffer_scale:new Qa(t,e.u_buffer_scale),u_image_warp:new el(t,e.u_image_warp),u_fade_t:new Qa(t,e.u_fade_t),u_opacity:new Qa(t,e.u_opacity),u_image0:new Ka(t,e.u_image0),u_image1:new Ka(t,e.u_image1),u_brightness_low:new Qa(t,e.u_brightness_low),u_brightness_high:new Qa(t,e.u_brightness_high),u_saturation_factor:new Qa(t,e.u_saturation_factor),u_contrast_factor:new Qa(t,e.u_contrast_factor),u_spin_weights:new el(t,e.u_spin_weights),u_coords_top:new il(t,e.u_coords_top),u_coords_bottom:new il(t,e.u_coords_bottom)}),symbolIcon:(t,e)=>({u_is_size_zoom_constant:new Ka(t,e.u_is_size_zoom_constant),u_is_size_feature_constant:new Ka(t,e.u_is_size_feature_constant),u_size_t:new Qa(t,e.u_size_t),u_size:new Qa(t,e.u_size),u_rotate_symbol:new Ka(t,e.u_rotate_symbol),u_label_plane_matrix:new al(t,e.u_label_plane_matrix),u_coord_matrix:new al(t,e.u_coord_matrix),u_is_text:new Ka(t,e.u_is_text),u_pitch_with_map:new Ka(t,e.u_pitch_with_map),u_is_along_line:new Ka(t,e.u_is_along_line),u_is_variable_anchor:new Ka(t,e.u_is_variable_anchor),u_texsize:new tl(t,e.u_texsize),u_texture:new Ka(t,e.u_texture),u_translation:new tl(t,e.u_translation),u_pitched_scale:new Qa(t,e.u_pitched_scale),u_is_offset:new Ka(t,e.u_is_offset),u_height_anchor_ground:new Ka(t,e.u_height_anchor_ground)}),symbolSDF:(t,e)=>({u_is_size_zoom_constant:new Ka(t,e.u_is_size_zoom_constant),u_is_size_feature_constant:new Ka(t,e.u_is_size_feature_constant),u_size_t:new Qa(t,e.u_size_t),u_size:new Qa(t,e.u_size),u_rotate_symbol:new Ka(t,e.u_rotate_symbol),u_label_plane_matrix:new al(t,e.u_label_plane_matrix),u_coord_matrix:new al(t,e.u_coord_matrix),u_is_text:new Ka(t,e.u_is_text),u_pitch_with_map:new Ka(t,e.u_pitch_with_map),u_is_along_line:new Ka(t,e.u_is_along_line),u_is_variable_anchor:new Ka(t,e.u_is_variable_anchor),u_texsize:new tl(t,e.u_texsize),u_texture:new Ka(t,e.u_texture),u_gamma_scale:new Qa(t,e.u_gamma_scale),u_is_halo:new Ka(t,e.u_is_halo),u_is_plain:new Ka(t,e.u_is_plain),u_translation:new tl(t,e.u_translation),u_pitched_scale:new Qa(t,e.u_pitched_scale),u_is_offset:new Ka(t,e.u_is_offset),u_height_anchor_ground:new Ka(t,e.u_height_anchor_ground)}),symbolTextAndIcon:(t,e)=>({u_is_size_zoom_constant:new Ka(t,e.u_is_size_zoom_constant),u_is_size_feature_constant:new Ka(t,e.u_is_size_feature_constant),u_size_t:new Qa(t,e.u_size_t),u_size:new Qa(t,e.u_size),u_rotate_symbol:new Ka(t,e.u_rotate_symbol),u_label_plane_matrix:new al(t,e.u_label_plane_matrix),u_coord_matrix:new al(t,e.u_coord_matrix),u_is_text:new Ka(t,e.u_is_text),u_pitch_with_map:new Ka(t,e.u_pitch_with_map),u_is_along_line:new Ka(t,e.u_is_along_line),u_is_variable_anchor:new Ka(t,e.u_is_variable_anchor),u_texsize:new tl(t,e.u_texsize),u_texsize_icon:new tl(t,e.u_texsize_icon),u_texture:new Ka(t,e.u_texture),u_texture_icon:new Ka(t,e.u_texture_icon),u_gamma_scale:new Qa(t,e.u_gamma_scale),u_is_halo:new Ka(t,e.u_is_halo),u_translation:new tl(t,e.u_translation),u_pitched_scale:new Qa(t,e.u_pitched_scale),u_is_offset:new Ka(t,e.u_is_offset),u_height_anchor_ground:new Ka(t,e.u_height_anchor_ground)}),background:(t,e)=>({u_opacity:new Qa(t,e.u_opacity),u_color:new rl(t,e.u_color)}),backgroundPattern:(t,e)=>({u_opacity:new Qa(t,e.u_opacity),u_image:new Ka(t,e.u_image),u_pattern_tl_a:new tl(t,e.u_pattern_tl_a),u_pattern_br_a:new tl(t,e.u_pattern_br_a),u_pattern_tl_b:new tl(t,e.u_pattern_tl_b),u_pattern_br_b:new tl(t,e.u_pattern_br_b),u_texsize:new tl(t,e.u_texsize),u_mix:new Qa(t,e.u_mix),u_pattern_size_a:new tl(t,e.u_pattern_size_a),u_pattern_size_b:new tl(t,e.u_pattern_size_b),u_scale_a:new Qa(t,e.u_scale_a),u_scale_b:new Qa(t,e.u_scale_b),u_pixel_coord_upper:new tl(t,e.u_pixel_coord_upper),u_pixel_coord_lower:new tl(t,e.u_pixel_coord_lower),u_tile_units_to_pixels:new Qa(t,e.u_tile_units_to_pixels)}),terrain:(t,e)=>({u_texture:new Ka(t,e.u_texture),u_ele_delta:new Qa(t,e.u_ele_delta),u_fog_matrix:new al(t,e.u_fog_matrix),u_fog_color:new rl(t,e.u_fog_color),u_fog_ground_blend:new Qa(t,e.u_fog_ground_blend),u_fog_ground_blend_opacity:new Qa(t,e.u_fog_ground_blend_opacity),u_horizon_color:new rl(t,e.u_horizon_color),u_horizon_fog_blend:new Qa(t,e.u_horizon_fog_blend),u_is_globe_mode:new Qa(t,e.u_is_globe_mode)}),terrainDepth:(t,e)=>({u_ele_delta:new Qa(t,e.u_ele_delta)}),atmosphere:(t,e)=>({u_sun_pos:new el(t,e.u_sun_pos),u_atmosphere_blend:new Qa(t,e.u_atmosphere_blend),u_globe_position:new el(t,e.u_globe_position),u_globe_radius:new Qa(t,e.u_globe_radius),u_inv_proj_matrix:new al(t,e.u_inv_proj_matrix)}),sky:(t,e)=>({u_sky_color:new rl(t,e.u_sky_color),u_horizon_color:new rl(t,e.u_horizon_color),u_horizon:new tl(t,e.u_horizon),u_horizon_normal:new tl(t,e.u_horizon_normal),u_sky_horizon_blend:new Qa(t,e.u_sky_horizon_blend),u_sky_blend:new Qa(t,e.u_sky_blend),u_inv_proj_matrix:new al(t,e.u_inv_proj_matrix),u_globe_position:new el(t,e.u_globe_position),u_globe_radius:new Qa(t,e.u_globe_radius),u_atmosphere_blend:new Qa(t,e.u_atmosphere_blend)})};var Qb=class{constructor(t,e,i){this.context=t;let r=t.gl;this.buffer=r.createBuffer(),this.dynamicDraw=!!i,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||e.freeBufferAfterUpload()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){let e=this.context.gl;if(!this.dynamicDraw)throw Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}};const tx={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};var ex=class{constructor(t,e,i,r){this.length=e.length,this.attributes=i,this.itemSize=e.bytesPerElement,this.dynamicDraw=r,this.context=t;let n=t.gl;this.buffer=n.createBuffer(),t.bindVertexBuffer.set(this.buffer),n.bufferData(n.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||e.freeBufferAfterUpload()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);let e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,e){for(let i of this.attributes){let r=e.attributes[i.name];void 0!==r&&t.enableVertexAttribArray(r.location)}}setVertexAttribPointers(t,e,i){for(let r of this.attributes){let n=e.attributes[r.name];if(void 0!==n){let e=r.offset+this.itemSize*(i||0);n.isInteger?t.vertexAttribIPointer(n.location,r.components,t[tx[r.type]],this.itemSize,e):t.vertexAttribPointer(n.location,r.components,t[tx[r.type]],!1,this.itemSize,e)}}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}},ix=class{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}},rx=class extends ix{getDefault(){return di.transparent}set(t){let e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}},nx=class extends ix{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}},sx=class extends ix{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}},ox=class extends ix{getDefault(){return[!0,!0,!0,!0]}set(t){let e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}},ax=class extends ix{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}},lx=class extends ix{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}},hx=class extends ix{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){let e=this.current;(t.func!==e.func||t.ref!==e.ref||t.mask!==e.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}},ux=class extends ix{getDefault(){let t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){let e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}},cx=class extends ix{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;t?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this.current=t,this.dirty=!1}},fx=class extends ix{getDefault(){return[0,1]}set(t){let e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}},px=class extends ix{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;t?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this.current=t,this.dirty=!1}},dx=class extends ix{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}},mx=class extends ix{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;t?e.enable(e.BLEND):e.disable(e.BLEND),this.current=t,this.dirty=!1}},_x=class extends ix{getDefault(){let t=this.gl;return[t.ONE,t.ZERO]}set(t){let e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}},gx=class extends ix{getDefault(){return di.transparent}set(t){let e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}},yx=class extends ix{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}},vx=class extends ix{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;t?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this.current=t,this.dirty=!1}},wx=class extends ix{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}},bx=class extends ix{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}},xx=class extends ix{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}},Dx=class extends ix{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}},Mx=class extends ix{getDefault(){let t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){let e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}},Ex=class extends ix{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,t),this.current=t,this.dirty=!1}},Ax=class extends ix{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.bindRenderbuffer(e.RENDERBUFFER,t),this.current=t,this.dirty=!1}},Fx=class extends ix{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.bindTexture(e.TEXTURE_2D,t),this.current=t,this.dirty=!1}},zx=class extends ix{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}},Sx=class extends ix{getDefault(){return null}set(t){let e=this.gl;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}},Cx=class extends ix{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.bindVertexArray(t),this.current=t,this.dirty=!1)}},Tx=class extends ix{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.pixelStorei(e.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}},Px=class extends ix{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}},Ix=class extends ix{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}},kx=class extends ix{constructor(t,e){super(t),this.context=t,this.parent=e}getDefault(){return null}},$x=class extends kx{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let e=this.gl;e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}},jx=class extends kx{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}},Rx=class extends kx{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}},Ox=class{constructor(t,e,i,r,n){this.context=t,this.width=e,this.height=i;let s=this.framebuffer=t.gl.createFramebuffer();if(this.colorAttachment=new $x(t,s),r)this.depthAttachment=n?new Rx(t,s):new jx(t,s);else if(n)throw Error("Stencil cannot be set without depth")}destroy(){let t=this.context.gl,e=this.colorAttachment.get();if(e&&t.deleteTexture(e),this.depthAttachment){let e=this.depthAttachment.get();e&&t.deleteRenderbuffer(e)}t.deleteFramebuffer(this.framebuffer)}};const Bx=_b([{name:"u_units_to_pixels",type:"vec2"},{name:"u_world_size",type:"vec2"},{name:"u_camera_to_center_distance",type:"float"},{name:"u_symbol_fade_change",type:"float"},{name:"u_aspect_ratio",type:"float"},{name:"u_device_pixel_ratio",type:"float"},{name:"u_viewport_size",type:"vec2"},{name:"u_pixel_extrude_scale",type:"vec2"},{name:"u_pitch",type:"float"}]),Lx=Bx.offsets;var Ux=class{constructor(t,e,i){this.blendFunction=t,this.blendColor=e,this.mask=i}};Ux.Replace=[1,0],Ux.disabled=new Ux(Ux.Replace,di.transparent,[!1,!1,!1,!1]),Ux.unblended=new Ux(Ux.Replace,di.transparent,[!0,!0,!0,!0]),Ux.alphaBlended=new Ux([1,771],di.transparent,[!0,!0,!0,!0]);var Nx=class{constructor(t){this.gl=t,this.clearColor=new rx(this),this.clearDepth=new nx(this),this.clearStencil=new sx(this),this.colorMask=new ox(this),this.depthMask=new ax(this),this.stencilMask=new lx(this),this.stencilFunc=new hx(this),this.stencilOp=new ux(this),this.stencilTest=new cx(this),this.depthRange=new fx(this),this.depthTest=new px(this),this.depthFunc=new dx(this),this.blend=new mx(this),this.blendFunc=new _x(this),this.blendColor=new gx(this),this.blendEquation=new yx(this),this.cullFace=new vx(this),this.cullFaceSide=new wx(this),this.frontFace=new bx(this),this.program=new xx(this),this.activeTexture=new Dx(this),this.viewport=new Mx(this),this.bindFramebuffer=new Ex(this),this.bindRenderbuffer=new Ax(this),this.bindTexture=new Fx(this),this.bindVertexBuffer=new zx(this),this.bindElementBuffer=new Sx(this),this.bindVertexArray=new Cx(this),this.pixelStoreUnpack=new Tx(this),this.pixelStoreUnpackPremultiplyAlpha=new Px(this),this.pixelStoreUnpackFlipY=new Ix(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),t.getExtension("EXT_color_buffer_half_float"),t.getExtension("EXT_color_buffer_float"),this.projectionUniformBuffer=function(t){return new gb(t,db.ProjectionUBO,yb)}(this),this.terrainUniformBuffer=function(t){return new gb(t,db.TerrainUBO,wb)}(this),this.frameUniformBuffer=function(t){return new gb(t,db.FrameUBO,Bx)}(this)}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0,this.projectionUniformBuffer.bindingDirty=!0,this.terrainUniformBuffer.bindingDirty=!0,this.frameUniformBuffer.bindingDirty=!0}setCustomLayerDefaults(){this.unbindVAO(),this.cullFace.setDefault(),this.activeTexture.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}createIndexBuffer(t,e){return new Qb(this,t,e)}createVertexBuffer(t,e,i){return new ex(this,t,e,i)}createRenderbuffer(t,e,i){let r=this.gl,n=r.createRenderbuffer();return this.bindRenderbuffer.set(n),r.renderbufferStorage(r.RENDERBUFFER,t,e,i),this.bindRenderbuffer.set(null),n}createFramebuffer(t,e,i,r){return new Ox(this,t,e,i,r)}clear({color:t,depth:e,stencil:i}){let r=this.gl,n=0;t&&(n|=r.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),void 0!==e&&(n|=r.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(e),this.depthMask.set(!0)),void 0!==i&&(n|=r.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),r.clear(n)}setCullFace(t){!1===t.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){kt(t.blendFunction,Ux.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){return this.gl.createVertexArray()}deleteVertexArray(t){this.gl.deleteVertexArray(t)}unbindVAO(){this.bindVertexArray.set(null)}},Gx=class{constructor(t,e,i){this.func=t,this.mask=e,this.range=i}};Gx.ReadOnly=!1,Gx.ReadWrite=!0,Gx.disabled=new Gx(519,Gx.ReadOnly,[0,1]);const qx=7680;var Vx=class{constructor(t,e,i,r,n,s){this.test=t,this.ref=e,this.mask=i,this.fail=r,this.depthFail=n,this.pass=s}};Vx.disabled=new Vx({func:519,mask:0},0,0,qx,qx,qx);const Zx=2305;var Wx=class{constructor(t,e,i){this.enable=t,this.mode=e,this.frontFace=i}};function Hx(t,e,i={}){return t.transform.getProjectionData({overscaledTileID:e,aligned:i.aligned,applyGlobeMatrix:!t.isRenderingToTexture,applyTerrainMatrix:i.applyTerrainMatrix??!0})}function Yx(t,e){return t.isRenderingToTexture?null:t.terrain?.getTerrainData(e)??null}let Xx;function Jx(t,e,i,r,n,s){let o=t.context,a=o.gl,l=t.useProgram("collisionBox"),h=[],u=0,c=0;for(let f of r){let r=e.getTile(f).getBucket(i);if(!r)continue;let p=n?r.textCollisionBox:r.iconCollisionBox,d=r.collisionCircleArray;d.length>0&&(h.push({circleArray:d,circleOffset:c,coord:f}),u+=d.length/4,c=u),p&&l.draw(o,a.LINES,Gx.disabled,Vx.disabled,t.colorModeForRenderPass(),Wx.disabled,null,Yx(s,f),Hx(s,f),i.id,p.layoutVertexBuffer,p.indexBuffer,p.segments,null,t.transform.zoom,null,null,p.collisionVertexBuffer)}if(!n||!h.length)return;let f=t.useProgram("collisionCircle"),p=new Ia;p.resize(4*u),p._trim();let d=0;for(let t of h)for(let e=0;e<t.circleArray.length/4;e++){let i=4*e,r=t.circleArray[i+0],n=t.circleArray[i+1],s=t.circleArray[i+2],o=t.circleArray[i+3];p.emplace(d++,r,n,s,o,0),p.emplace(d++,r,n,s,o,1),p.emplace(d++,r,n,s,o,2),p.emplace(d++,r,n,s,o,3)}(!Xx||Xx.length<2*u)&&(Xx=function(t){let e=2*t,i=new $a;i.resize(e),i._trim();for(let t=0;t<e;t++){let e=6*t;i.uint16[e+0]=4*t+0,i.uint16[e+1]=4*t+1,i.uint16[e+2]=4*t+2,i.uint16[e+3]=4*t+2,i.uint16[e+4]=4*t+3,i.uint16[e+5]=4*t+0}return i}(u));let m=o.createIndexBuffer(Xx,!0),_=o.createVertexBuffer(p,Tc.members,!0);for(let e of h)f.draw(o,a.TRIANGLES,Gx.disabled,Vx.disabled,t.colorModeForRenderPass(),Wx.disabled,null,Yx(s,e.coord),null,i.id,_,m,La.simpleSegment(0,2*e.circleOffset,e.circleArray.length,e.circleArray.length/2),null,t.transform.zoom,null,null,null);_.destroy(),m.destroy()}Wx.disabled=new Wx(!1,1029,Zx),Wx.backCCW=new Wx(!0,1029,Zx),Wx.frontCCW=new Wx(!0,1028,Zx);const Kx=v(new Float32Array(16));function Qx(t,e,i,r,n,s){let{horizontalAlign:o,verticalAlign:a}=Wf(t);return new u((-(o-.5)*e/n+r[0])*s,(-(a-.5)*i/n+r[1])*s)}function tD(t,e,i,r,n,s){let o=e.tileAnchorPoint.add(new u(e.translation[0],e.translation[1]));if(e.pitchWithMap){let t=r.mult(s);i||(t=t.rotate(-n));let a=o.add(t);return uv(a.x,a.y,e.pitchedLabelPlaneMatrix,hv(e,a.x,a.y)).point}if(i){let i=vv(e.tileAnchorPoint.x+1,e.tileAnchorPoint.y,e).point.sub(t),n=Math.atan(i.y/i.x)+(i.x<0?Math.PI:0);return t.add(r.rotate(n))}return t.add(r)}function eD(t,e,i,r,n,s,o,a,l,h,c,f,p){let d=t.text.placedSymbolArray,m=t.text.dynamicLayoutVertexArray,_=t.icon.dynamicLayoutVertexArray,g={};m.clear();for(let _=0;_<d.length;_++){let y=d.get(_),v=y.hidden||!y.crossTileID||t.allowVerticalPlacement&&!y.placedOrientation?null:r[y.crossTileID];if(v){let r=new u(y.anchorX,y.anchorY),d={getElevation:f,heightOffset:y.heightOffset,heightAnchorGround:p,width:n.width,height:n.height,pitchedLabelPlaneMatrix:s,pitchWithMap:i,transform:n,tileAnchorPoint:r,translation:h,unwrappedTileID:c},_=i?bv(r.x,r.y,d):vv(r.x,r.y,d),w=cv(n.cameraToCenterDistance,_.signedDistanceFromCamera),b=hp(t.textSizeData,a,y)*w/24;i&&(b*=t.tilePixelRatio/o);let{width:x,height:D,anchor:M,textOffset:E,textBoxScale:A}=v,F=Qx(M,x,D,E,A,b),z=n.getPitchedTextCorrection(r.x+h[0],r.y+h[1],c),S=tD(_.point,d,e,F,-n.bearingInRadians,z),C=t.allowVerticalPlacement&&2===y.placedOrientation?Math.PI/2:0;for(let t=0;t<y.numGlyphs;t++)Gp(m,S,C);l&&y.associatedIconIndex>=0&&(g[y.associatedIconIndex]={shiftedAnchor:S,angle:C})}else Av(y.numGlyphs,m)}if(l){_.clear();let e=t.icon.placedSymbolArray;for(let t=0;t<e.length;t++){let i=e.get(t);if(i.hidden)Av(i.numGlyphs,_);else{let e=g[t];if(e)for(let t=0;t<i.numGlyphs;t++)Gp(_,e.shiftedAnchor,e.angle);else Av(i.numGlyphs,_)}}t.icon.dynamicLayoutVertexBuffer.updateData(_)}t.text.dynamicLayoutVertexBuffer.updateData(m)}function iD(t,e,i){return i.iconsInText&&e?"symbolTextAndIcon":t?"symbolSDF":"symbolIcon"}function rD(t,e,i,r,n,s,o,a,l,h,u,c,f){let p=t.context,d=p.gl,m=t.transform,_="map"===a,y="map"===l,v="viewport"!==a&&"point"!==i.layout.get("symbol-placement"),w=_&&!y&&!v,b=!i.layout.get("symbol-sort-key").isConstant(),x=!1,D=t.getDepthModeForSublayer(0,Gx.ReadOnly),M=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),E=[],A=m.getCircleRadiusCorrection();for(let a of r){let r=e.getTile(a),l=r.getBucket(i);if(!l)continue;let u=n?l.text:l.icon;if(!u?.segments.get().length||!u.hasVisibleVertices)continue;let c,p,D,F,z=u.programConfigurations.get(i.id),S=n||l.sdfIcons,C=n?l.textSizeData:l.iconSizeData,T=y||0!==m.pitch,P=t.useProgram(iD(S,n,l),z),I=up(C,m.zoom),k=Yx(f,a),$=[0,0],j=null;if(n)p=r.glyphAtlasTexture,D=d.LINEAR,c=r.glyphAtlasTexture.size,l.iconsInText&&($=r.imageAtlasTexture.size,j=r.imageAtlasTexture,F=T||t.options.rotating||t.options.zooming||"composite"===C.kind||"camera"===C.kind?d.LINEAR:d.NEAREST);else{let e=1!==i.layout.get("icon-size").constantOr(0)||l.iconsNeedLinear;p=r.imageAtlasTexture,D=S||t.options.rotating||t.options.zooming||e||T?d.LINEAR:d.NEAREST,c=r.imageAtlasTexture.size}let R=rt(r,1,t.transform.zoom),O=ov(_,t.transform,R),B=av(y,_,t.transform,R),L=ut(m,r,s,o),U=Hx(f,a),N=M&&l.hasTextData(),G="none"!==i.layout.get("icon-text-fit")&&N&&l.hasIconData(),q=i._unevaluatedLayout.hasValue("icon-offset"),V="ground"===i.layout.get("symbol-height-anchor");if(v){let e=g();nv(e,O);let r=t.style.map.terrain?(e,i)=>t.style.map.terrain.getElevation(a,e,i):void 0;pv(l,t,n,O,e,y,h,"map"===i.layout.get("text-rotation-alignment"),a.toUnwrapped(),m.width,m.height,L,r)}let Z,W=n&&M||G,H=v||W?Kx:y?O:t.transform.clipSpaceToPixelsMatrix,Y=S&&0!==i.paint.get(n?"text-halo-width":"icon-halo-width").constantOr(1);Z=S?l.iconsInText?Hb(C.kind,I,w,y,v,W,t,H,B,L,c,$,A,q,V):Wb(C.kind,I,w,y,v,W,t,H,B,L,n,c,Y,A,q,V):Zb(C.kind,I,w,y,v,W,0,H,B,L,n,c,A,q,V);let X={program:P,buffers:u,uniformValues:Z,projectionData:U,atlasTexture:p,atlasTextureIcon:j,atlasInterpolation:D,atlasInterpolationIcon:F,isSDF:S,hasHalo:Y};if(b&&l.canOverlap){x=!0;let t=u.segments.get();for(let e of t)E.push({segments:new La([e]),sortKey:e.sortKey,state:X,terrainData:k})}else E.push({segments:u.segments,sortKey:0,state:X,terrainData:k})}x&&E.sort(((t,e)=>t.sortKey-e.sortKey));let F=i.paint.get(n?"text-halo-width":"icon-halo-width").constantOr(null)??1/0,z=24*i.layout.get("text-letter-spacing").constantOr(0)<0||F>1;for(let e of E){let r=e.state;p.activeTexture.set(d.TEXTURE0),r.atlasTexture.bind(r.atlasInterpolation,d.CLAMP_TO_EDGE),r.atlasTextureIcon&&(p.activeTexture.set(d.TEXTURE1),r.atlasTextureIcon&&r.atlasTextureIcon.bind(r.atlasInterpolationIcon,d.CLAMP_TO_EDGE));let n=r.isSDF&&r.hasHalo;if(n){let n=r.uniformValues;n.u_is_halo=1,z&&(n.u_is_plain=0,nD(r.buffers,e.segments,i,t,r.program,D,u,c,n,r.projectionData,e.terrainData),n.u_is_halo=0,n.u_is_plain=1)}nD(r.buffers,e.segments,i,t,r.program,D,u,c,r.uniformValues,r.projectionData,e.terrainData),n&&!z&&(r.uniformValues.u_is_halo=0)}}function nD(t,e,i,r,n,s,o,a,l,h,u){let c=r.context;n.draw(c,c.gl.TRIANGLES,s,o,a,Wx.backCCW,l,u,h,i.id,t.layoutVertexBuffer,t.indexBuffer,e,i.paint,r.transform.zoom,t.programConfigurations.get(i.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer)}function sD(t,e,i,r,n){let s=t.context,o=s.gl,a=Vx.disabled,l=new Ux([o.ONE,o.ONE],di.transparent,[!0,!0,!0,!0]),h=e.getBucket(i);if(!h)return;let u=r.key,c=i.heatmapFbos.get(u);c||(c=aD(s,e.tileSize,e.tileSize),i.heatmapFbos.set(u,c)),s.bindFramebuffer.set(c.framebuffer),s.viewport.set([0,0,e.tileSize,e.tileSize]),s.clear({color:di.transparent});let f=h.programConfigurations.get(i.id),p=t.useProgram("heatmap",f,!n.isRenderingGlobe),d=Hx(n,e.tileID),m=Yx(n,r);p.draw(s,o.TRIANGLES,Gx.disabled,a,l,Wx.disabled,Ib(e,t.transform.zoom,i.paint.get("heatmap-intensity"),1),m,d,i.id,h.layoutVertexBuffer,h.indexBuffer,h.segments,i.paint,t.transform.zoom,f)}function oD(t,e,i,r){let n=t.context,s=n.gl,o=t.transform;n.setColorMode(t.colorModeForRenderPass());let a=lD(n,e),l=i.key,h=e.heatmapFbos.get(l);if(!h)return;n.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,h.colorAttachment.get()),n.activeTexture.set(s.TEXTURE1),a.bind(s.LINEAR,s.CLAMP_TO_EDGE);let u=Hx(r,i,{applyTerrainMatrix:r.isRenderingGlobe});t.useProgram("heatmapTexture").draw(n,s.TRIANGLES,Gx.disabled,Vx.disabled,t.colorModeForRenderPass(),Wx.disabled,kb(t,e,0,1),null,u,e.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments,e.paint,o.zoom),h.destroy(),e.heatmapFbos.delete(l)}function aD(t,e,i){let r=t.gl,n=r.createTexture();r.bindTexture(r.TEXTURE_2D,n),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texStorage2D(r.TEXTURE_2D,1,r.RGBA16F,e,i);let s=t.createFramebuffer(e,i,!1,!1);return s.colorAttachment.set(n),s}function lD(t,e){return e.colorRampTexture||=new _h(t,e.colorRamp,t.gl.RGBA),e.colorRampTexture}function hD(t,e,i){let r=t.context,n=r.bindFramebuffer.get(),s=r.viewport.get(),[,,o,a]=s;return function(t,e,i){let r=t.context.gl;if(!t.layerOpacityFbo){let n=t.context.createFramebuffer(e,i,!0,!0),s=r.createTexture();return r.bindTexture(r.TEXTURE_2D,s),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,e,i,0,r.RGBA,r.UNSIGNED_BYTE,null),n.colorAttachment.set(s),n.depthAttachment.set(t.context.createRenderbuffer(r.DEPTH_STENCIL,e,i)),t.layerOpacityFbo=n,void t.context.bindFramebuffer.set(t.layerOpacityFbo.framebuffer)}if(t.layerOpacityFbo.width===e&&t.layerOpacityFbo.height===i)return void t.context.bindFramebuffer.set(t.layerOpacityFbo.framebuffer);let n=t.layerOpacityFbo;r.bindTexture(r.TEXTURE_2D,n.colorAttachment.get()),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,e,i,0,r.RGBA,r.UNSIGNED_BYTE,null),t.context.bindRenderbuffer.set(n.depthAttachment.get()),r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,e,i),t.context.bindRenderbuffer.set(null),n.width=e,n.height=i,t.context.bindFramebuffer.set(n.framebuffer)}(t,o,a),r.viewport.set([0,0,o,a]),r.clear({color:di.transparent,depth:1,stencil:0}),t.currentStencilSource=void 0,t.renderTileClippingMasks(e,i),{compositeTarget:n,compositeViewport:s}}function uD(t,e,i,r){let n=t.context,s=n.gl;n.bindFramebuffer.set(i.compositeTarget),n.viewport.set(i.compositeViewport),n.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,t.layerOpacityFbo.colorAttachment.get()),t.useProgram("layerOpacity").draw(n,s.TRIANGLES,Gx.disabled,Vx.disabled,t.colorModeForRenderPass(),Wx.disabled,(t=>({u_image:0,u_opacity:t}))(e),null,null,r.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,r.paint,t.transform.zoom),t.currentStencilSource=void 0}function cD(t,e,i,r,n,s,o,a){let l=256;if(n.stepInterpolant){let r=e.getSource().maxzoom,n=o.canonical.z===r?Math.ceil(1<<t.transform.maxZoom-o.canonical.z):1;l=Dt(function(t){return t<=1?1:2**Math.ceil(Math.log(t)/Math.LN2)}(s.maxLineLength/it*1024*n),256,i.maxTextureSize)}return a.gradient=ah({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:l,image:a.gradient||void 0,clips:s.lineClipsArray}),a.texture?a.texture.update(a.gradient):a.texture=new _h(i,a.gradient,r.RGBA),a.version=n.gradientVersion,a.texture}function fD(t,e,i,r,n){t.activeTexture.set(e.TEXTURE0),i.imageAtlasTexture.bind(e.LINEAR,e.CLAMP_TO_EDGE),r.updatePaintBuffers(n)}function pD(t,e,i,r,n,s){(n||t.lineAtlas.dirty)&&(e.activeTexture.set(i.TEXTURE0),t.lineAtlas.bind(e)),r.updatePaintBuffers(s)}function dD(t,e,i,r,n,s,o){let a=s.gradients[n.id],l=a.texture;n.gradientVersion!==a.version&&(l=cD(t,e,i,r,n,s,o,a)),i.activeTexture.set(r.TEXTURE0),l.bind(n.stepInterpolant?r.NEAREST:r.LINEAR,r.CLAMP_TO_EDGE)}function mD(t,e,i,r,n,s,o,a,l){let h=s.gradients[n.id],u=h.texture;n.gradientVersion!==h.version&&(u=cD(t,e,i,r,n,s,o,h)),i.activeTexture.set(r.TEXTURE0),u.bind(n.stepInterpolant?r.NEAREST:r.LINEAR,r.CLAMP_TO_EDGE),i.activeTexture.set(r.TEXTURE1),t.lineAtlas.bind(i),a.updatePaintBuffers(l)}function _D(t,e,i,r,n){let s,o=t.getDepthModeForSublayer(0,Gx.ReadOnly),a=t.colorModeForRenderPass(),l=i.paint.get("line-dasharray"),h=l.constantOr(1),u=i.paint.get("line-pattern"),c=u.constantOr(1),f=i.paint.get("line-gradient"),p=i.getCrossfadeParameters();s=c?"linePattern":h&&f?"lineGradientSDF":h?"lineSDF":f?"lineGradient":"line";let d=t.context,m=d.gl,_=t.transform,g=!0;for(let y of r){let r=e.getTile(y);if(c&&!r.patternsLoaded())continue;let v=r.getBucket(i);if(!v)continue;let w=v.programConfigurations.get(i.id),b=t.context.program.get(),x=t.useProgram(s,w),D=g||x.program!==b,M=Yx(n,y),E=u.constantOr(null),A=l?.constantOr(null);if(E&&r.imageAtlas){let t=r.imageAtlas,e=t.patternPositions[E.to.toString()],i=t.patternPositions[E.from.toString()];e&&i&&w.setConstantPatternPositions(e,i)}else if(A){let e="round"===i.layout.get("line-cap").constantOr(null),r=t.lineAtlas.getDash(A.to,e),n=t.lineAtlas.getDash(A.from,e);w.setConstantDashPositions(r,n)}let F,z=Hx(n,y),S=_.getPixelScale();c?(F=Ub(t,r,i,S,p),fD(d,m,r,w,p)):h&&f?(F=Gb(t,r,i,S,p,v.lineClipsArray.length),mD(t,e,d,m,i,v,y,w,p)):h?(F=Nb(t,r,i,S,p),pD(t,d,m,w,D,p)):f?(F=Lb(t,r,i,S,v.lineClipsArray.length),dD(t,e,d,m,i,v,y)):F=Bb(t,r,i,S);let C=t.stencilModeForClipping(y);x.draw(d,m.TRIANGLES,o,C,a,Wx.disabled,F,M,z,i.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,i.paint,t.transform.zoom,w,v.layoutVertexBuffer2),g=!1}}function gD(t,e,i,r,n){if(!i||!r?.imageAtlas)return;let s=r.imageAtlas.patternPositions,o=s[i.to.toString()],a=s[i.from.toString()];if(!o&&a&&(o=a),!a&&o&&(a=o),!o||!a){let t=n.getPaintProperty(e);o=s[t],a=s[t]}o&&a&&t.setConstantPatternPositions(o,a)}function yD(t,e,i,r,n){let s=t.colorModeForRenderPass();wD(t,e,i,r,t.getDepthModeForSublayer(1,Gx.ReadOnly),s,!1,n),vD(t,e,i,r,n)}function vD(t,e,i,r,n){if(!i.paint.get("fill-antialias"))return;let s=t.colorModeForRenderPass();wD(t,e,i,r,t.getDepthModeForSublayer(i.getPaintProperty("fill-outline-color")?2:0,Gx.ReadOnly),s,!0,n)}function wD(t,e,i,r,n,s,o,a){let l,h,u,c,f,p=t.context.gl,d="fill-pattern",m=i.paint.get(d),_=m?.constantOr(1),g=i.getCrossfadeParameters(),y=t.transform,v=i.paint.get("fill-translate"),w=i.paint.get("fill-translate-anchor");o?(h=_&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",l=p.LINES):(h=_?"fillPattern":"fill",l=p.TRIANGLES);let b=m.constantOr(null);for(let m of r){let r=e.getTile(m);if(_&&!r.patternsLoaded())continue;let x=r.getBucket(i);if(!x)continue;let D=x.sdfPatterns[i.id]??!1,M=x.programConfigurations.get(i.id),E=t.useProgram(h,M),A=Yx(a,m);_&&(t.context.activeTexture.set(p.TEXTURE0),r.imageAtlasTexture.bind(p.LINEAR,p.CLAMP_TO_EDGE),M.updatePaintBuffers(g)),gD(M,d,b,r,i);let F=Hx(a,m),z=ut(y,r,v,w);o?(c=x.indexBuffer2,f=x.segments2,u="fillOutlinePattern"===h&&_?Cb(t,g,r,z,D):Sb(z)):(c=x.indexBuffer,f=x.segments,u=_?Fb(t,g,r,z,D):zb(z));let S=t.stencilModeForClipping(m);E.draw(t.context,l,n,S,s,Wx.backCCW,u,A,F,i.id,x.layoutVertexBuffer,c,f,i.paint,t.transform.zoom,M)}}function bD(t,e,i,r,n,s,o,a){let l=t.context,h=l.gl,u="fill-extrusion-pattern",c=i.paint.get(u),f=c.constantOr(1),p=i.getCrossfadeParameters(),d=i.paint.get("fill-extrusion-opacity"),m=c.constantOr(null),_=t.transform;for(let c of r){let r=e.getTile(c),g=r.getBucket(i);if(!g)continue;let y=Yx(a,c),v=g.programConfigurations.get(i.id),w=t.useProgram(f?"fillExtrusionPattern":"fillExtrusion",v);f&&(t.context.activeTexture.set(h.TEXTURE0),r.imageAtlasTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE),v.updatePaintBuffers(p));let b=Hx(a,c);gD(v,u,m,r,i);let x=ut(_,r,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),D=i.paint.get("fill-extrusion-vertical-gradient"),M=f?Ab(t,D,d,x,c,p,r):Eb(t,D,d,x);w.draw(l,l.gl.TRIANGLES,n,s,o,Wx.backCCW,M,y,b,i.id,g.layoutVertexBuffer,g.indexBuffer,g.segments,i.paint,t.transform.zoom,v,t.style.map.terrain&&g.centroidVertexBuffer)}}function xD(t,e,i,r,n,s,o,a,l){let h=t.style.projection,u=t.context,c=u.gl,f=[`#define NUM_ILLUMINATION_SOURCES ${i.paint.get("hillshade-highlight-color").values.length}`],p=t.useProgram("hillshade",null,!1,f),d=!t.options.moving;for(let f of r){let r=e.getTile(f),m=r.fbo;if(!m)continue;let _=h.getMeshFromTileID(u,f.canonical,a,!0,"raster"),g=Yx(l,f);u.activeTexture.set(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,m.colorAttachment.get());let y=Hx(l,f,{aligned:d});p.draw(u,c.TRIANGLES,s,n[f.overscaledZ],o,Wx.backCCW,$b(t,r,i),g,y,i.id,_.vertexBuffer,_.indexBuffer,_.segments)}}let DD=0;function MD(t,e,i,r,n,s,o,a,l){let h=t.style.projection,u=t.context,c=u.gl,f=t.useProgram("colorRelief"),p=!t.options.moving,d="nearest"===i.paint.get("resampling")?c.NEAREST:c.LINEAR,m=!0,_=0;for(let g of r){let r=e.getTile(g),y=r.dem;if(!y?.data)continue;if(m){DD||=c.getParameter(c.MAX_TEXTURE_SIZE);let t=DD,{elevationTexture:e,colorTexture:r}=i.getColorRampTextures(u,t,y.getUnpackVector());u.activeTexture.set(c.TEXTURE1),e.bind(c.NEAREST,c.CLAMP_TO_EDGE),u.activeTexture.set(c.TEXTURE4),r.bind(c.LINEAR,c.CLAMP_TO_EDGE),m=!1,_=e.size[0]}let v=y.stride;u.activeTexture.set(c.TEXTURE0),(!r.demTexture||r.needsColorReliefPrepare)&&(u.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture||=t.getTileTexture(v)??new _h(u,{width:v,height:v,data:null},c.RGBA),r.demTexture.update(y.getPixels(),{premultiply:!1}),r.needsColorReliefPrepare=!1),r.demTexture.bind(d,c.CLAMP_TO_EDGE);let w=h.getMeshFromTileID(u,g.canonical,a,!0,"raster"),b=Yx(l,g),x=Hx(l,g,{aligned:p});f.draw(u,c.TRIANGLES,s,n[g.overscaledZ],o,Wx.backCCW,Ob(i,r.dem,_),b,x,i.id,w.vertexBuffer,w.indexBuffer,w.segments)}}const ED=[new u(0,0),new u(it,0),new u(it,it),new u(0,it)];function AD(t,e,i,r,n,s,o,a,l,h=!1,u,c=null){let f=r[r.length-1].overscaledZ,p=t.context,d=p.gl,m=t.useProgram("raster"),_=t.style.projection,g=t.colorModeForRenderPass(),y=!t.options.moving,v=i.paint.get("raster-opacity"),w="nearest"===i.paint.get("resampling")||"nearest"===i.paint.get("raster-resampling")?d.NEAREST:d.LINEAR,b=i.paint.get("raster-fade-duration"),x=!!t.style.map.terrain;for(let D of r){let r=t.getDepthModeForSublayer(D.overscaledZ-f,1===v?Gx.ReadWrite:Gx.ReadOnly,d.LESS),M=e.getTile(D);p.activeTexture.set(d.TEXTURE0),M.texture.bind(w,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),p.activeTexture.set(d.TEXTURE1);let{parentTile:E,parentScaleBy:A,parentTopLeft:F,fadeValues:z}=FD(M,e,b,x);M.fadeOpacity=z.tileOpacity,E?(E.fadeOpacity=z.parentTileOpacity,E.texture.bind(w,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST)):M.texture.bind(w,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),M.texture.useMipmap&&p.extTextureFilterAnisotropic&&t.transform.pitch>t.options.anisotropicFilterPitch&&d.texParameterf(d.TEXTURE_2D,p.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,p.extTextureFilterAnisotropicMax);let S=Yx(u,D),C=Hx(u,D,{aligned:y}),T=vy(F,A,z.fadeMix,i,a,l),P=c??_.getMeshFromTileID(p,D.canonical,s,o,"raster");m.draw(p,d.TRIANGLES,r,n?n[D.overscaledZ]:Vx.disabled,g,h?Wx.frontCCW:Wx.backCCW,T,S,C,i.id,P.vertexBuffer,P.indexBuffer,P.segments)}}function FD(t,e,i,r){let n={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(0===i||r)return n;if(t.fadingParentID){let r=e.getLoadedTile(t.fadingParentID);if(!r)return n;let s=2**(r.tileID.overscaledZ-t.tileID.overscaledZ);return{parentTile:r,parentScaleBy:s,parentTopLeft:[t.tileID.canonical.x*s%1,t.tileID.canonical.y*s%1],fadeValues:zD(t,r,i)}}return t.selfFading?{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:SD(t,i)}:n}function zD(t,e,i){let r=H_(),n=(r-e.timeAdded)/i,s=1===t.fadingDirection,o=Dt((r-t.timeAdded)/i,0,1),a=Dt(1-n,0,1),l=s?o:a;return{tileOpacity:l,parentTileOpacity:s?a:o,fadeMix:{opacity:1,mix:1-l}}}function SD(t,e){let i=Dt((H_()-t.timeAdded)/e,0,1);return{tileOpacity:i,fadeMix:{opacity:i,mix:0}}}const CD=new di(1,0,0,1),TD=new di(0,1,0,1),PD=new di(0,0,1,1),ID=new di(1,0,1,1),kD=new di(0,1,1,1);function $D(t,e,i,r){RD(t,0,e+i/2,t.transform.width,i,r)}function jD(t,e,i,r){RD(t,e-i/2,0,i,t.transform.height,r)}function RD(t,e,i,r,n,s){let o=t.context,a=o.gl;a.enable(a.SCISSOR_TEST),a.scissor(e*t.pixelRatio,i*t.pixelRatio,r*t.pixelRatio,n*t.pixelRatio),o.clear({color:s}),a.disable(a.SCISSOR_TEST)}function OD(t,e,i,r){let n=t.context,s=n.gl,o=t.useProgram("debug"),a=Gx.disabled,l=Vx.disabled,h=t.colorModeForRenderPass(),u="$debug",c=Yx(r,i);n.activeTexture.set(s.TEXTURE0);let f=e.getTileByID(i.key).latestRawTileData?.byteLength||0,p=Math.floor(f/1024),d=e.getTile(i).tileSize,m=512/Math.min(d,512)*(i.overscaledZ/t.transform.zoom)*.5,_=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(_+=` => ${i.overscaledZ}`),function(t,e){t.initDebugOverlayCanvas();let i=t.debugOverlayCanvas,r=t.context.gl,n=t.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,i.width,i.height),n.shadowColor="white",n.shadowBlur=2,n.lineWidth=1.5,n.strokeStyle="white",n.textBaseline="top",n.font="bold 36px Open Sans, sans-serif",n.fillText(e,5,5),n.strokeText(e,5,5),t.debugOverlayTexture.update(i),t.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}(t,`${_} ${p}kB`);let g=Hx(r,i);o.draw(n,s.TRIANGLES,a,l,Ux.alphaBlended,Wx.disabled,Pb(di.transparent,m),null,g,u,t.debugBuffer,t.quadTriangleIndexBuffer,t.debugSegments),o.draw(n,s.LINE_STRIP,a,l,h,Wx.disabled,Pb(di.red),c,g,u,t.debugBuffer,t.tileBorderIndexBuffer,t.debugSegments)}function BD(t,e){if(!e.mesh){let i=new va;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1);let r=new ja;r.emplaceBack(0,1,2),r.emplaceBack(0,2,3),e.mesh=new Dy(t.createVertexBuffer(i,My.members),t.createIndexBuffer(r),La.simpleSegment(0,0,i.length,r.length))}return e.mesh}const LD={symbol:function(t,e,i,r,n,s){if("translucent"!==s.currentPass)return;let o=Vx.disabled,a=t.colorModeForRenderPass();(i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(t,e,i,r,n,s,o,a,l){let h=e.transform,u=e.style.map.terrain,c="map"===n,f="map"===s;for(let n of t){let t=r.getTile(n),s=t.getBucket(i);if(!s?.text?.segments.get().length)continue;let p=up(s.textSizeData,h.zoom),d=rt(t,1,e.transform.zoom),m=ov(c,e.transform,d),_="none"!==i.layout.get("icon-text-fit")&&s.hasIconData();if(p){let e=u?(t,e)=>u.getElevation(n,t,e):void 0;eD(s,c,f,l,h,m,2**(h.zoom-t.tileID.overscaledZ),p,_,ut(h,t,o,a),n.toUnwrapped(),e,"ground"===i.layout.get("symbol-height-anchor"))}}}(r,t,i,e,i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),n),0!==i.paint.get("icon-opacity").constantOr(1)&&rD(t,e,i,r,!1,i.paint.get("icon-translate"),i.paint.get("icon-translate-anchor"),i.layout.get("icon-rotation-alignment").constantOr("viewport"),i.layout.get("icon-pitch-alignment"),i.layout.get("icon-keep-upright"),o,a,s),0!==i.paint.get("text-opacity").constantOr(1)&&rD(t,e,i,r,!0,i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.layout.get("text-keep-upright"),o,a,s),e.map.showCollisionBoxes&&(Jx(t,e,i,r,!0,s),Jx(t,e,i,r,!1,s))},circle:function(t,e,i,r,n){if("translucent"!==n.currentPass)return;let s=i.paint.get("circle-opacity"),o=i.paint.get("circle-stroke-width"),a=i.paint.get("circle-stroke-opacity"),l=!i.layout.get("circle-sort-key").isConstant();if(0===s.constantOr(1)&&(0===o.constantOr(1)||0===a.constantOr(1)))return;let h=t.context,u=h.gl,c=t.transform,f=t.getDepthModeForSublayer(0,Gx.ReadOnly),p=Vx.disabled,d=t.colorModeForRenderPass(),m=[],_=c.getCircleRadiusCorrection();for(let s of r){let r=e.getTile(s),o=r.getBucket(i);if(!o)continue;let a=ut(c,r,i.paint.get("circle-translate"),i.paint.get("circle-translate-anchor")),h=o.programConfigurations.get(i.id),u=t.useProgram("circle",h),f=o.layoutVertexBuffer,p=o.indexBuffer,d=Yx(n,s),g={programConfiguration:h,program:u,layoutVertexBuffer:f,indexBuffer:p,uniformValues:Tb(t,r,i,a,_),terrainData:d,projectionData:Hx(n,s)};if(l){let t=o.segments.get();for(let e of t)m.push({segments:new La([e]),sortKey:e.sortKey,state:g})}else m.push({segments:o.segments,sortKey:0,state:g})}l&&m.sort(((t,e)=>t.sortKey-e.sortKey));for(let e of m){let{programConfiguration:r,program:n,layoutVertexBuffer:s,indexBuffer:o,uniformValues:a,terrainData:l,projectionData:c}=e.state;n.draw(h,u.TRIANGLES,f,p,d,Wx.backCCW,a,l,c,i.id,s,o,e.segments,i.paint,t.transform.zoom,r)}},heatmap:function(t,e,i,r,n){if(0===i.paint.get("heatmap-opacity"))return;let s=t.context;if(t.style.map.terrain){for(let s of r){let r=e.getTile(s);e.hasRenderableParent(s)||("offscreen"===n.currentPass?sD(t,r,i,s,n):"translucent"===n.currentPass&&oD(t,i,s,n))}s.viewport.set([0,0,t.width,t.height])}else"offscreen"===n.currentPass?function(t,e,i,r,n){let s=t.context,o=s.gl,a=t.transform,l=Vx.disabled,h=new Ux([o.ONE,o.ONE],di.transparent,[!0,!0,!0,!0]);(function(t,e,i){let r=t.gl;t.activeTexture.set(r.TEXTURE1),t.viewport.set([0,0,e.width/4,e.height/4]);let n=i.heatmapFbos.get(lh);n?(r.bindTexture(r.TEXTURE_2D,n.colorAttachment.get()),t.bindFramebuffer.set(n.framebuffer)):(n=aD(t,e.width/4,e.height/4),i.heatmapFbos.set(lh,n))})(s,t,i),s.clear({color:di.transparent});for(let u of r){if(e.hasRenderableParent(u))continue;let r=e.getTile(u),c=r.getBucket(i);if(!c)continue;let f=c.programConfigurations.get(i.id),p=t.useProgram("heatmap",f),d=Hx(n,u,{applyTerrainMatrix:!1}),m=a.getCircleRadiusCorrection();p.draw(s,o.TRIANGLES,Gx.disabled,l,h,Wx.backCCW,Ib(r,a.zoom,i.paint.get("heatmap-intensity"),m),null,d,i.id,c.layoutVertexBuffer,c.indexBuffer,c.segments,i.paint,a.zoom,f)}s.viewport.set([0,0,t.width,t.height])}(t,e,i,r,n):"translucent"===n.currentPass&&function(t,e){let i=t.context,r=i.gl;i.setColorMode(t.colorModeForRenderPass());let n=e.heatmapFbos.get(lh);n&&(i.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,n.colorAttachment.get()),i.activeTexture.set(r.TEXTURE1),lD(i,e).bind(r.LINEAR,r.CLAMP_TO_EDGE),t.useProgram("heatmapTexture").draw(i,r.TRIANGLES,Gx.disabled,Vx.disabled,t.colorModeForRenderPass(),Wx.disabled,kb(t,e,0,1),null,null,e.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,e.paint,t.transform.zoom))}(t,i)},line:function(t,e,i,r,n){if("translucent"!==n.currentPass)return;let s=i.paint.get("line-opacity"),o=i.paint.get("line-width"),a=i.paint.get("line-layer-opacity");if(0!==s.constantOr(1)&&0!==o.constantOr(1)&&0!==a){if(a<1){let s=hD(t,i,r);return _D(t,e,i,r,n),void uD(t,a,s,i)}_D(t,e,i,r,n)}},fill:function(t,e,i,r,n){let s=i.paint.get("fill-color"),o=i.paint.get("fill-opacity"),a=i.paint.get("fill-layer-opacity");if(0===o.constantOr(1)||0===a)return;if(a<1){if("translucent"!==n.currentPass)return;let s=hD(t,i,r);return yD(t,e,i,r,n),void uD(t,a,s,i)}let l=i.paint.get("fill-pattern"),h=t.opaquePassEnabledForLayer()&&!l.constantOr(1)&&1===s.constantOr(di.transparent).a&&1===o.constantOr(0);if(h&&"opaque"===n.currentPass){let s=t.colorModeForRenderPass();wD(t,e,i,r,t.getDepthModeForSublayer(1,Gx.ReadWrite),s,!1,n)}else h&&"translucent"===n.currentPass?vD(t,e,i,r,n):"translucent"===n.currentPass&&yD(t,e,i,r,n)},fillExtrusion:function(t,e,i,r,n){let s=i.paint.get("fill-extrusion-opacity");if(0!==s&&"translucent"===n.currentPass){let o=new Gx(t.context.gl.LEQUAL,Gx.ReadWrite,n.depthRangeFor3D);if(1!==s||i.paint.get("fill-extrusion-pattern").constantOr(1))bD(t,e,i,r,o,Vx.disabled,Ux.disabled,n),bD(t,e,i,r,o,t.stencilModeFor3D(),t.colorModeForRenderPass(),n);else{let s=t.colorModeForRenderPass();bD(t,e,i,r,o,Vx.disabled,s,n)}}},hillshade:function(t,e,i,r,n){if("offscreen"!==n.currentPass&&"translucent"!==n.currentPass)return;let s=t.context,o=t.style.projection.useSubdivision,a=t.getDepthModeForSublayer(0,Gx.ReadOnly),l=t.colorModeForRenderPass();if("offscreen"===n.currentPass)(function(t,e,i,r,n,s,o){let a=t.context,l=a.gl,h="nearest"===r.paint.get("resampling")?l.NEAREST:l.LINEAR;for(let u of i){let i=e.getTile(u),c=i.dem;if(!c?.data||!i.needsHillshadePrepare)continue;let f=c.dim+2,p=c.stride,d=c.getPixels();if(a.activeTexture.set(l.TEXTURE1),a.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture||=t.getTileTexture(p),i.demTexture){let t=i.demTexture;t.update(d,{premultiply:!1}),t.bind(l.NEAREST,l.CLAMP_TO_EDGE)}else i.demTexture=new _h(a,d,l.RGBA,{premultiply:!1}),i.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);a.activeTexture.set(l.TEXTURE0);let m=i.fbo;if(!m){let t=new _h(a,{width:f,height:f,data:null},l.RGBA);t.bind(h,l.CLAMP_TO_EDGE),m=i.fbo=a.createFramebuffer(f,f,!0,!1),m.colorAttachment.set(t.texture)}a.bindFramebuffer.set(m.framebuffer),a.viewport.set([0,0,f,f]),t.useProgram("hillshadePrepare").draw(a,l.TRIANGLES,n,s,o,Wx.disabled,jb(i.tileID,c),null,null,r.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments),i.needsHillshadePrepare=!1}})(t,e,r,i,a,Vx.disabled,l),s.viewport.set([0,0,t.width,t.height]);else if("translucent"===n.currentPass)if(o){let[s,o,h]=t.stencilConfigForOverlapTwoPass(r);xD(t,e,i,h,s,a,l,!1,n),xD(t,e,i,h,o,a,l,!0,n)}else{let[s,o]=t.getStencilConfigForOverlapAndUpdateStencilID(r);xD(t,e,i,o,s,a,l,!1,n)}},colorRelief:function(t,e,i,r,n){if("translucent"!==n.currentPass||!r.length)return;let s=t.style.projection.useSubdivision,o=t.getDepthModeForSublayer(0,Gx.ReadOnly),a=t.colorModeForRenderPass();if(s){let[s,l,h]=t.stencilConfigForOverlapTwoPass(r);MD(t,e,i,h,s,o,a,!1,n),MD(t,e,i,h,l,o,a,!0,n)}else{let[s,l]=t.getStencilConfigForOverlapAndUpdateStencilID(r);MD(t,e,i,l,s,o,a,!1,n)}},raster:function(t,e,i,r,n){if("translucent"!==n.currentPass||0===i.paint.get("raster-opacity")||!r.length)return;let s=e.getSource(),o=t.style.projection.useSubdivision;if(s instanceof Ay)AD(t,e,i,r,null,!1,!1,s.tileCoords,s.imageWarp,s.flippedWindingOrder,n,s.getMesh(t.context,o));else if(o){let[s,o,a]=t.stencilConfigForOverlapTwoPass(r);AD(t,e,i,a,s,!1,!0,ED,yy,!1,n),AD(t,e,i,a,o,!0,!0,ED,yy,!1,n)}else{let[s,o]=t.getStencilConfigForOverlapAndUpdateStencilID(r);AD(t,e,i,o,s,!1,!0,ED,yy,!1,n)}},background:function(t,e,i,r,n){let s=i.paint.get("background-color"),o=i.paint.get("background-opacity");if(0===o)return;let a=t.context,l=a.gl,h=t.style.projection,u=t.transform,c=u.tileSize,f=i.paint.get("background-pattern");if(t.isPatternMissing(f))return;let p=!f&&1===s.a&&1===o&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(n.currentPass!==p)return;let d=Vx.disabled,m=t.getDepthModeForSublayer(0,"opaque"===p?Gx.ReadWrite:Gx.ReadOnly),_=t.colorModeForRenderPass(),g=t.useProgram(f?"backgroundPattern":"background"),y=r||Vy(u,{tileSize:c,terrain:t.style.map.terrain});f&&(a.activeTexture.set(l.TEXTURE0),t.patternAtlas.bind(t.context));let v=i.getCrossfadeParameters();for(let e of y){let r=Hx(n,e),u=f?Xb(o,t,f,{tileID:e,tileSize:c},v):Yb(o,s),p=Yx(n,e),y=h.getMeshFromTileID(a,e.canonical,!1,!0,"raster");g.draw(a,l.TRIANGLES,m,d,_,Wx.backCCW,u,p,r,i.id,y.vertexBuffer,y.indexBuffer,y.segments)}},sky:function(t,e){let i=t.context,r=i.gl,n=((t,e,i)=>{let r=Math.cos(e.rollInRadians),n=Math.sin(e.rollInRadians),s=Ku(e),o=e.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:t.properties.get("sky-color"),u_horizon_color:t.properties.get("horizon-color"),u_horizon:[(e.width/2-s*n)*i,(e.height/2+s*r)*i],u_horizon_normal:[-n,r],u_sky_horizon_blend:t.properties.get("sky-horizon-blend")*e.height/2*i,u_sky_blend:o,u_inv_proj_matrix:e.inverseProjectionMatrix,u_globe_position:Bw(e),u_globe_radius:Ow(e.worldSize,e.center.lat),u_atmosphere_blend:t.properties.get("atmosphere-blend")}})(e,t.transform,t.pixelRatio),s=new Gx(r.LEQUAL,Gx.ReadWrite,[0,1]),o=Vx.disabled,a=t.colorModeForRenderPass(),l=t.useProgram("sky"),h=BD(i,e);l.draw(i,r.TRIANGLES,s,o,a,Wx.disabled,n,null,void 0,"sky",h.vertexBuffer,h.indexBuffer,h.segments)},atmosphere:function(t,e,i){let r=t.context,n=r.gl,s=t.useProgram("atmosphere"),o=new Gx(n.LEQUAL,Gx.ReadOnly,[0,1]),a=t.transform,l=function(t,e){let i=t.getCartesianPosition();!function(t,e){t[0]=-e[0],t[1]=-e[1],t[2]=-e[2]}(i,i);let r=v(new Float64Array(16));return"map"===t.properties.get("anchor")&&(A(r,r,e.rollInRadians),M(r,r,-e.pitchInRadians),A(r,r,e.bearingInRadians),M(r,r,e.center.lat*Math.PI/180),E(r,r,-e.center.lng*Math.PI/180)),function(t,e,i){var r=e[0],n=e[1],s=e[2],o=i[3]*r+i[7]*n+i[11]*s+i[15];o||=1,t[0]=(i[0]*r+i[4]*n+i[8]*s+i[12])/o,t[1]=(i[1]*r+i[5]*n+i[9]*s+i[13])/o,t[2]=(i[2]*r+i[6]*n+i[10]*s+i[14])/o}(i,i,r),i}(i,t.transform),h=a.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),u=e.properties.get("atmosphere-blend")*h.projectionTransition;if(0===u)return;let c=Ow(a.worldSize,a.center.lat),f=((t,e,i,r,n)=>({u_sun_pos:t,u_atmosphere_blend:e,u_globe_position:i,u_globe_radius:r,u_inv_proj_matrix:n}))(l,u,Bw(a),c,a.inverseProjectionMatrix),p=BD(r,e);s.draw(r,n.TRIANGLES,o,Vx.disabled,Ux.alphaBlended,Wx.disabled,f,null,null,"atmosphere",p.vertexBuffer,p.indexBuffer,p.segments)},custom:function(t,e,i,r){let{isRenderingGlobe:n}=r,s=t.context,o=i.implementation,a=t.style.projection,l=t.transform,h=l.getProjectionDataForCustomLayer(n),u={farZ:l.farZ,nearZ:l.nearZ,fov:l.fov*Math.PI/180,modelViewProjectionMatrix:l.modelViewProjectionMatrix,projectionMatrix:l.projectionMatrix,shaderData:{variantName:a.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;\nuniform mat4 u_projection_matrix;\n${a.shaderPreludeCode.vertexSource}`,define:a.shaderDefine},defaultProjectionData:h,getProjectionData:t=>l.getProjectionData({overscaledTileID:new cd(t.tileID.canonical.z,t.tileID.wrap??0,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),aligned:t.aligned,applyGlobeMatrix:t.applyGlobeMatrix,applyTerrainMatrix:t.applyTerrainMatrix})},c=o.renderingMode?o.renderingMode:"2d";if("offscreen"===r.currentPass){let e=o.prerender;e&&(t.setCustomLayerDefaults(),s.setColorMode(t.colorModeForRenderPass()),e.call(o,s.gl,u),s.setDirty(),t.setBaseState())}else if("translucent"===r.currentPass){t.setCustomLayerDefaults(),s.setColorMode(t.colorModeForRenderPass()),s.setStencilMode(Vx.disabled);let e="3d"===c?t.getDepthModeFor3D():t.getDepthModeForSublayer(0,Gx.ReadOnly);s.setDepthMode(e),o.render(s.gl,u),s.setDirty(),t.setBaseState(),s.bindFramebuffer.set(null)}},debug:function(t,e,i,r){for(let n of i)OD(t,e,n,r)},debugPadding:function(t){let e=t.transform.padding;$D(t,t.transform.height-(e.top||0),3,CD),$D(t,e.bottom||0,3,TD),jD(t,e.left||0,3,PD),jD(t,t.transform.width-(e.right||0),3,ID);let i=t.transform.centerPoint;!function(t,e,i,r){RD(t,e-1,i-10,2,20,r),RD(t,e-10,i-1,20,2,r)}(t,i.x,t.transform.height-i.y,kD)},terrainDepth:function(t,e){let i=t.context,r=i.gl,n=t.transform,s=Ux.unblended,o=new Gx(r.LEQUAL,Gx.ReadWrite,[0,1]),a=e.tileManager.getRenderableTiles(),l=t.useProgram("terrainDepth");i.bindFramebuffer.set(e.getFramebuffer().framebuffer),i.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),i.clear({color:di.white,depth:1});for(let t of a){let a=e.getTerrainMesh(t.tileID),h=e.getTerrainData(t.tileID),u=n.getProjectionData({overscaledTileID:t.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),c=pb(e.getSkirtLength(n.zoom));l.draw(i,r.TRIANGLES,o,Vx.disabled,s,Wx.backCCW,c,h,u,"terrain",a.vertexBuffer,a.indexBuffer,a.segments)}i.bindFramebuffer.set(null),i.viewport.set([0,0,t.width,t.height])}};var UD=class t{constructor(t,e){this.drawFunctions=LD,this.context=new Nx(t),this.transform=e,this.layerOpacityFbo=null,this._tileTextures={},this._rttObjectRecyclePool=[],this._rttSharedFbo=null,this.terrainFacilitator={depthDirty:!0,matrix:v(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Qy.maxOverzooming+Qy.maxUnderzooming+1,this.depthEpsilon=1/65536,this.crossTileSymbolIndex=new rw}resize(t,e,i){if(this.width=Math.floor(t*i),this.height=Math.floor(e*i),this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let t of this.style._order)this.style._layers[t].resize()}setup(){let t=this.context,e=new va;e.emplaceBack(0,0),e.emplaceBack(it,0),e.emplaceBack(0,it),e.emplaceBack(it,it),this.tileExtentBuffer=t.createVertexBuffer(e,My.members),this.tileExtentSegments=La.simpleSegment(0,0,4,2);let i=new va;i.emplaceBack(0,0),i.emplaceBack(it,0),i.emplaceBack(0,it),i.emplaceBack(it,it),this.debugBuffer=t.createVertexBuffer(i,My.members),this.debugSegments=La.simpleSegment(0,0,4,5);let r=new ba;r.emplaceBack(0,0,0,0),r.emplaceBack(it,0,it,0),r.emplaceBack(0,it,0,it),r.emplaceBack(it,it,it,it),this.rasterBoundsBuffer=t.createVertexBuffer(r,ub.members),this.rasterBoundsSegments=La.simpleSegment(0,0,4,2);let n=new va;n.emplaceBack(0,0),n.emplaceBack(it,0),n.emplaceBack(0,it),n.emplaceBack(it,it),this.rasterBoundsBufferPosOnly=t.createVertexBuffer(n,My.members),this.rasterBoundsSegmentsPosOnly=La.simpleSegment(0,0,4,5);let s=new va;s.emplaceBack(0,0),s.emplaceBack(1,0),s.emplaceBack(0,1),s.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(s,My.members),this.viewportSegments=La.simpleSegment(0,0,4,2);let o=new Oa;o.emplaceBack(0),o.emplaceBack(1),o.emplaceBack(3),o.emplaceBack(2),o.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(o);let a=new ja;a.emplaceBack(1,0,2),a.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(a);let l=this.context.gl;this.stencilClearMode=new Vx({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO),this.tileExtentMesh=new Dy(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let t=this.context,e=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let i=g();z(i,0,this.width,this.height,0,0,1),D(i,i,[e.drawingBufferWidth,e.drawingBufferHeight,0]);let r={mainMatrix:i,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:i,clipAntimeridian:!1};this.useProgram("clippingMask",null,!0).draw(t,e.TRIANGLES,Gx.disabled,this.stencilClearMode,Ux.disabled,Wx.disabled,null,null,r,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}renderTileClippingMasks(t,e){if(this.currentStencilSource===t.source||!t.isTileClipped()||!e?.length)return;this.currentStencilSource=t.source,this.nextStencilID+e.length>256&&this.clearStencil();let i=this.context;i.setColorMode(Ux.disabled),i.setDepthMode(Gx.disabled);let r={};for(let t of e)r[t.key]=this.nextStencilID++;this.style.projection.useSubdivision&&this._renderTileMasks(r,e,!0),this._renderTileMasks(r,e,!1),this._tileClippingMaskIDs=r}_renderTileMasks(t,e,i){let r=this.context,n=r.gl,s=this.style.projection,o=this.renderContext,a=this.useProgram("clippingMask");for(let l of e){let e=t[l.key],h=Yx(o,l),u=s.getMeshFromTileID(this.context,l.canonical,i,!0,"stencil"),c=Hx(o,l);a.draw(r,n.TRIANGLES,Gx.disabled,new Vx({func:n.ALWAYS,mask:0},e,255,n.KEEP,n.KEEP,n.REPLACE),Ux.disabled,o.isRenderingToTexture?Wx.disabled:Wx.backCCW,null,h,c,"$clipping",u.vertexBuffer,u.indexBuffer,u.segments)}}_renderTilesDepthBuffer(){let t=this.context,e=t.gl,i=this.style.projection,r=this.transform,n=this.useProgram("depth"),s=this.getDepthModeFor3D(),o=Vy(r,{tileSize:r.tileSize});for(let r of o){let o=Yx(this.renderContext,r),a=i.getMeshFromTileID(this.context,r.canonical,!0,!0,"raster"),l=Hx(this.renderContext,r);n.draw(t,e.TRIANGLES,s,Vx.disabled,Ux.disabled,Wx.backCCW,null,o,l,"$clipping",a.vertexBuffer,a.indexBuffer,a.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let t=this.nextStencilID++,e=this.context.gl;return new Vx({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)}stencilModeForClipping(t){let e=this.context.gl;return new Vx({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(t){let e=this.context.gl,i=t.sort(((t,e)=>e.overscaledZ-t.overscaledZ)),r=i[i.length-1].overscaledZ,n=i[0].overscaledZ-r+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();let t={};for(let i=0;i<n;i++)t[i+r]=new Vx({func:e.GEQUAL,mask:255},i+this.nextStencilID,255,e.KEEP,e.KEEP,e.REPLACE);return this.nextStencilID+=n,[t,i]}return[{[r]:Vx.disabled},i]}stencilConfigForOverlapTwoPass(t){let e=this.context.gl,i=t.sort(((t,e)=>e.overscaledZ-t.overscaledZ)),r=i[i.length-1].overscaledZ,n=i[0].overscaledZ-r+1;if(this.clearStencil(),n>1){let t={},s={};for(let i=0;i<n;i++)t[i+r]=new Vx({func:e.GREATER,mask:255},n+1+i,255,e.KEEP,e.KEEP,e.REPLACE),s[i+r]=new Vx({func:e.GREATER,mask:255},1+i,255,e.KEEP,e.KEEP,e.REPLACE);return this.nextStencilID=2*n+1,[t,s,i]}return this.nextStencilID=3,[{[r]:new Vx({func:e.GREATER,mask:255},2,255,e.KEEP,e.KEEP,e.REPLACE)},{[r]:new Vx({func:e.GREATER,mask:255},1,255,e.KEEP,e.KEEP,e.REPLACE)},i]}colorModeForRenderPass(){let t=this.context.gl;if(this._showOverdrawInspector){let e=1/8;return new Ux([t.CONSTANT_COLOR,t.ONE],new di(e,e,e,0),[!0,!0,!0,!0])}return"opaque"===this.renderContext.currentPass?Ux.unblended:Ux.alphaBlended}getDepthModeForSublayer(t,e,i){if(!this.opaquePassEnabledForLayer())return Gx.disabled;let r=1-((1+this.renderContext.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new Gx(i||this.context.gl.LEQUAL,e,[r,r])}getDepthModeFor3D(){return new Gx(this.context.gl.LEQUAL,Gx.ReadWrite,this.renderContext.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.renderContext.currentLayer<this.renderContext.opaquePassCutoff}render(t,e){this.style=t,this.options=e;let i=this.renderContext=function(t,e,i){let r=e?.transitionState??0;return{currentPass:"offscreen",currentLayer:0,opaquePassCutoff:1/0,depthRangeFor3D:[0,1],isRenderingToTexture:!1,transform:t,terrain:i,projectionTransition:r,isRenderingGlobe:r>0}}(this.transform,t.projection,t.map.terrain??null);this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.patternAtlas=t.patternAtlas,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(H_()),function(t,e){let i=t.pending,{transform:r}=e,n=e.context.gl;i[Lx.u_units_to_pixels]=1/r.pixelsToGLUnits[0],i[Lx.u_units_to_pixels+1]=1/r.pixelsToGLUnits[1],i[Lx.u_world_size]=n.drawingBufferWidth,i[Lx.u_world_size+1]=n.drawingBufferHeight,i[Lx.u_camera_to_center_distance]=r.cameraToCenterDistance,i[Lx.u_symbol_fade_change]=e.options.fadeDuration?e.symbolFadeChange:1,i[Lx.u_aspect_ratio]=r.width/r.height,i[Lx.u_device_pixel_ratio]=e.pixelRatio,i[Lx.u_viewport_size]=r.width,i[Lx.u_viewport_size+1]=r.height,i[Lx.u_pixel_extrude_scale]=1/r.width,i[Lx.u_pixel_extrude_scale+1]=1/r.height,i[Lx.u_pitch]=r.pitch/360*2*Math.PI,t.upload()}(this.context.frameUniformBuffer,this),this.imageManager.beginFrame();let r=this.style._order,n=this.style.tileManagers,s={},o={},a={};for(let t in n){let e=n[t];e.used&&e.prepare(this.context),s[t]=e.getVisibleCoordinates(!1),o[t]=s[t].slice().reverse(),a[t]=e.getVisibleCoordinates(!0).reverse()}i.opaquePassCutoff=1/0;for(let t=0;t<r.length;t++)if(this.style._layers[r[t]].is3D()){i.opaquePassCutoff=t;break}this.maybeDrawDepth(),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),i.opaquePassCutoff=0),i.currentPass="offscreen";for(let t of r){let e=this.style._layers[t];if(!e.hasOffscreenPass()||e.isHidden(this.transform.zoom))continue;let r=o[e.source];("custom"===e.type||r.length)&&this.renderLayer(this,n[e.source],e,r,i)}if(this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:e.showOverdrawInspector?di.black:di.transparent,depth:1}),this.clearStencil(),this.style.sky&&this.drawFunctions.sky(this,this.style.sky),this._showOverdrawInspector=e.showOverdrawInspector,i.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(i.currentPass="opaque",i.currentLayer=r.length-1;i.currentLayer>=0;i.currentLayer--){let t=this.style._layers[r[i.currentLayer]];if(t.isHidden(this.transform.zoom))continue;let e=n[t.source],o=s[t.source];this.renderTileClippingMasks(t,o),this.renderLayer(this,e,t,o,i)}i.currentPass="translucent";let l=!1;for(i.currentLayer=0;i.currentLayer<r.length;i.currentLayer++){let t=this.style._layers[r[i.currentLayer]];if(t.isHidden(this.transform.zoom))continue;let e=n[t.source];if(this.renderToTexture?.renderLayer(t,i))continue;!this.opaquePassEnabledForLayer()&&!l&&(l=!0,i.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let h=("symbol"===t.type?a:o)[t.source];this.renderTileClippingMasks(t,s[t.source]),this.renderLayer(this,e,t,h,i)}if(i.isRenderingGlobe&&this.drawFunctions.atmosphere(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let t=function(t,e){let i=null,r=Object.values(t._layers).flatMap((i=>i.source&&!i.isHidden(e)?[t.tileManagers[i.source]]:[])),n=r.filter((t=>"vector"===t.getSource().type)),s=r.filter((t=>"vector"!==t.getSource().type)),o=t=>{(!i||i.getSource().maxzoom<t.getSource().maxzoom)&&(i=t)};for(let t of n)o(t);if(!i)for(let t of s)o(t);return i}(this.style,this.transform.zoom);t&&this.drawFunctions.debug(this,t,t.getVisibleCoordinates(),i)}this.options.showPadding&&this.drawFunctions.debugPadding(this),this.renderToTexture&&!this.options.moving&&this.clearRTTPool(),this.context.setDefault()}markTerrainDepthDirty(){this.terrainFacilitator.depthDirty=!0}maybeDrawDepth(){if(!this.style?.projection||!this.style.map?.terrain)return;let t=this.terrainFacilitator.matrix,e=this.transform.modelViewProjectionMatrix,i=this.terrainFacilitator.depthDirty;i||=!function(t,e){var i=t[0],r=t[1],n=t[2],s=t[3],o=t[4],a=t[5],l=t[6],h=t[7],u=t[8],c=t[9],f=t[10],p=t[11],d=t[12],m=t[13],_=t[14],g=t[15],y=e[0],v=e[1],w=e[2],b=e[3],x=e[4],D=e[5],M=e[6],E=e[7],A=e[8],F=e[9],z=e[10],S=e[11],C=e[12],T=e[13],P=e[14],I=e[15];return Math.abs(i-y)<=1e-6*Math.max(1,Math.abs(i),Math.abs(y))&&Math.abs(r-v)<=1e-6*Math.max(1,Math.abs(r),Math.abs(v))&&Math.abs(n-w)<=1e-6*Math.max(1,Math.abs(n),Math.abs(w))&&Math.abs(s-b)<=1e-6*Math.max(1,Math.abs(s),Math.abs(b))&&Math.abs(o-x)<=1e-6*Math.max(1,Math.abs(o),Math.abs(x))&&Math.abs(a-D)<=1e-6*Math.max(1,Math.abs(a),Math.abs(D))&&Math.abs(l-M)<=1e-6*Math.max(1,Math.abs(l),Math.abs(M))&&Math.abs(h-E)<=1e-6*Math.max(1,Math.abs(h),Math.abs(E))&&Math.abs(u-A)<=1e-6*Math.max(1,Math.abs(u),Math.abs(A))&&Math.abs(c-F)<=1e-6*Math.max(1,Math.abs(c),Math.abs(F))&&Math.abs(f-z)<=1e-6*Math.max(1,Math.abs(f),Math.abs(z))&&Math.abs(p-S)<=1e-6*Math.max(1,Math.abs(p),Math.abs(S))&&Math.abs(d-C)<=1e-6*Math.max(1,Math.abs(d),Math.abs(C))&&Math.abs(m-T)<=1e-6*Math.max(1,Math.abs(m),Math.abs(T))&&Math.abs(_-P)<=1e-6*Math.max(1,Math.abs(_),Math.abs(P))&&Math.abs(g-I)<=1e-6*Math.max(1,Math.abs(g),Math.abs(I))}(t,e),i||=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime),i&&(function(t,e){t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,e),this.terrainFacilitator.renderTime=H_(),this.terrainFacilitator.depthDirty=!1,this.drawFunctions.terrainDepth(this,this.style.map.terrain))}renderLayer(t,e,i,r,n){if(i.isHidden(this.transform.zoom)||"background"!==i.type&&"custom"!==i.type&&!(r||[]).length)return;this.id=i.id;let s=this.drawFunctions;Kp(i)?s.symbol(t,e,i,r,this.style.placement.variableOffsets,n):(t=>"circle"===t.type)(i)?s.circle(t,e,i,r,n):(t=>"heatmap"===t.type)(i)?s.heatmap(t,e,i,r,n):(t=>"line"===t.type)(i)?s.line(t,e,i,r,n):(t=>"fill"===t.type)(i)?s.fill(t,e,i,r,n):(t=>"fill-extrusion"===t.type)(i)?s.fillExtrusion(t,e,i,r,n):(t=>"hillshade"===t.type)(i)?s.hillshade(t,e,i,r,n):(t=>"color-relief"===t.type)(i)?s.colorRelief(t,e,i,r,n):Co(i)?s.raster(t,e,i,r,n):(t=>"background"===t.type)(i)?s.background(t,e,i,r,n):(t=>"custom"===t.type)(i)&&s.custom(t,e,i,n)}static{this.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50}saveTileTexture(e){let i=this._tileTextures[e.size[0]];i?i.length<t.MAX_TEXTURE_POOL_SIZE_PER_BUCKET?i.push(e):e.destroy():this._tileTextures[e.size[0]]=[e]}getTileTexture(t){let e=this._tileTextures[t];return e&&e.length>0?e.pop():null}acquireRTT(t){let e=this.context.gl,i=this._rttObjectRecyclePool.pop();if(i)return i.size!==t&&(i.texture.update({width:t,height:t,data:null},{premultiply:!1,useMipmap:!0}),i.texture.bind(e.LINEAR,e.CLAMP_TO_EDGE,e.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&e.texParameterf(e.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),i.size=t),i;let r=new _h(this.context,{width:t,height:t,data:null},e.RGBA,{premultiply:!1,useMipmap:!0});return r.bind(e.LINEAR,e.CLAMP_TO_EDGE,e.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&e.texParameterf(e.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),{texture:r,size:t}}bindRTT(t){let e=this.context.gl,i=t.size;if(!this._rttSharedFbo){let t=this.context.createFramebuffer(i,i,!0,!0),r=this.context.createRenderbuffer(e.DEPTH_STENCIL,i,i);t.depthAttachment.set(r),this._rttSharedFbo={fbo:t,depthRenderbuffer:r,size:i}}this._rttSharedFbo.size!==i&&(this.context.bindRenderbuffer.set(this._rttSharedFbo.depthRenderbuffer),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,i,i),this.context.bindRenderbuffer.set(null),this._rttSharedFbo.fbo.width=i,this._rttSharedFbo.fbo.height=i,this._rttSharedFbo.size=i),this._rttSharedFbo.fbo.colorAttachment.set(t.texture.texture),this.context.bindFramebuffer.set(this._rttSharedFbo.fbo.framebuffer)}releaseRTT(t){this._rttObjectRecyclePool.push(t)}clearRTTPool(){for(let t of this._rttObjectRecyclePool)t.texture.destroy();this._rttObjectRecyclePool.length=0}destroyRTTResources(){if(this.clearRTTPool(),!this._rttSharedFbo)return;this._rttSharedFbo.fbo.colorAttachment.set(null),this._rttSharedFbo.fbo.depthAttachment.set(null);let t=this.context.gl;t.deleteRenderbuffer(this._rttSharedFbo.depthRenderbuffer),t.deleteFramebuffer(this._rttSharedFbo.fbo.framebuffer),this._rttSharedFbo=null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;let e=this.patternAtlas.getPattern(t.from.toString()),i=this.patternAtlas.getPattern(t.to.toString());return!e||!i}useProgram(t,e,i=!1,r=[]){this.cache||={};let n=!!this.style.map.terrain,s=this.style.projection,o=i?sw.projectionMercator:s.shaderPreludeCode,a=i?aw:s.shaderDefine,l=t+(e?e.cacheKey:"")+`/${i?lw:s.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(n?"/terrain":"")+(r?`/${r.join("/")}`:"");return this.cache[l]||=new Db(this.context,sw[t],e,Kb[t],this._showOverdrawInspector,n,o,a,r),this.cache[l]}setCustomLayerDefaults(){this.context.setCustomLayerDefaults()}setBaseState(){let 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)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new _h(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){if(this._tileTextures){for(let t in this._tileTextures){let e=this._tileTextures[t];if(e)for(let t of e)t.destroy()}this._tileTextures={}}if(this.destroyRTTResources(),this.layerOpacityFbo?.destroy(),this.layerOpacityFbo=null,this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&this.tileExtentMesh.vertexBuffer?.destroy(),this.tileExtentMesh&&this.tileExtentMesh.indexBuffer?.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.context.projectionUniformBuffer.destroy(),this.context.terrainUniformBuffer.destroy(),this.context.frameUniformBuffer.destroy(),this.cache){for(let t in this.cache){let e=this.cache[t];e?.program&&this.context.gl.deleteProgram(e.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){let{drawingBufferWidth:t,drawingBufferHeight:e}=this.context.gl;return this.width!==t||this.height!==e}},ND=class extends Error{constructor(t,e){super("WebGL2 is required to display this map. We are sorry, but it seems that your browser does not support WebGL2, a technology for rendering 3D graphics on the web. Read more on https://wiki.openstreetmap.org/wiki/This_map_requires_WebGL"),this.name="GPUInitializationError",this.requestedAttributes=t,this.statusMessage=e?.statusMessage??null}};function GD(t,e){let i,r=!1,n=null,s=()=>{n=null,r&&=(t(...i),n=setTimeout(s,e),!1)};return(...t)=>(r=!0,i=t,n||s(),n)}var qD=class{constructor(t){this._getHashParams=()=>new URLSearchParams(window.location.hash.replace("#","")),this._getCurrentHash=()=>{let t=this._getHashParams();return this._hashName?(t.get(this._hashName)||"").split("/"):([...t.keys()][0]??"").split("/")},this._onHashChange=()=>{let t=this._getCurrentHash();if(!this._isValidHash(t))return!1;let 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},this._updateHashUnthrottled=()=>{let t=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,t)},this._removeHash=()=>{let t=this._getHashParams();if(this._hashName)t.delete(this._hashName);else{let e=Array.from(t.keys());e.length>0&&t.delete(e[0])}let e=decodeURIComponent(t.toString()).replace(/=&/g,"&").replace(/=$/g,""),i=window.location.href.replace(/(#.+)?$/,e?`#${e}`:"");i=i.replace("&&","&"),window.history.replaceState(window.history.state,null,i)},this._updateHash=GD(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(t){let e=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,r=10**Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),n=Math.round(e.lng*r)/r,s=Math.round(e.lat*r)/r,o=this._map.getBearing(),a=this._map.getPitch(),l="";if(l+=t?`/${n}/${s}/${i}`:`${i}/${s}/${n}`,(o||a)&&(l+="/"+Math.round(10*o)/10),a&&(l+=`/${Math.round(a)}`),this._hashName){let t=this._getHashParams();return t.set(this._hashName,l),`#${decodeURIComponent(t.toString()).replace(/=&/g,"&").replace(/=$/g,"")}`}return`#${l}`}_isValidHash(t){if(t.length<3||t.some((t=>isNaN(+t))))return!1;try{new Ou(+t[2],+t[1])}catch{return!1}let e=+t[0],i=+(t[3]||0),r=+(t[4]||0);return e>=this._map.getMinZoom()&&e<=this._map.getMaxZoom()&&i>=-180&&i<=180&&r>=this._map.getMinPitch()&&r<=this._map.getMaxPitch()}};const VD={linearity:.3,easing:bt(0,0,.3,1)},ZD=Et({deceleration:2500,maxSpeed:1400},VD),WD=Et({deceleration:20,maxSpeed:1400},VD),HD=Et({deceleration:1e3,maxSpeed:360},VD),YD=Et({deceleration:1e3,maxSpeed:90},VD),XD=Et({deceleration:1e3,maxSpeed:360},VD);var JD=class{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:H_(),settings:t})}_drainInertiaBuffer(){let t=this._inertiaBuffer,e=H_();for(;t.length>0&&e-t[0].time>160;)t.shift()}_getVelocityEntries(){let t=this._inertiaBuffer,e=H_()-60,i=Math.max(0,t.length-2);for(;i>0&&t[i-1].time>=e;)i--;return t.slice(i)}_onMoveEnd(t){this._drainInertiaBuffer();let e=this._getVelocityEntries();if(e.length<2)return void this.clear();let i={zoom:0,bearing:0,pitch:0,roll:0,pan:new u(0,0),pinchAround:void 0,around:void 0};for(let{settings:t}of e)t.around&&(i.around=t.around),t.pinchAround&&(i.pinchAround=t.pinchAround);for(let{settings:t}of e.slice(1))i.zoom+=t.zoomDelta||0,i.bearing+=t.bearingDelta||0,i.pitch+=t.pitchDelta||0,i.roll+=t.rollDelta||0,t.panDelta&&i.pan._add(t.panDelta);if(!(i.pan.mag()||i.zoom||i.bearing||i.pitch||i.roll))return void this.clear();let r=H_()-e[0].time,n={};if(i.pan.mag()){let e=QD(i.pan.mag(),r,Et({},ZD,t||{})),s=i.pan.mult(e.amount/i.pan.mag()),o=this._map._camera.cameraHelper.handlePanInertia(s,this._map._camera.transform);n.center=o.easingCenter,n.offset=o.easingOffset,KD(n,e)}if(i.zoom){let t=QD(i.zoom,r,WD);n.zoom=Tt(this._map.getZoom()+t.amount,this._map.getZoomSnap(),t.amount),KD(n,t)}if(i.bearing){let t=QD(i.bearing,r,HD);n.bearing=this._map.getBearing()+Dt(t.amount,-179,179),KD(n,t)}if(i.pitch){let t=QD(i.pitch,r,YD);n.pitch=this._map.getPitch()+t.amount,KD(n,t)}if(i.roll){let t=QD(i.roll,r,XD);n.roll=this._map.getRoll()+Dt(t.amount,-179,179),KD(n,t)}if(n.zoom||n.bearing){let t=void 0===i.pinchAround?i.around:i.pinchAround;n.around=t?this._map.unproject(t):this._map.getCenter()}return this.clear(),Et(n,{noMoveStart:!0})}};function KD(t,e){(!t.duration||t.duration<e.duration)&&(t.duration=e.duration,t.easing=e.easing)}function QD(t,e,i){let{maxSpeed:r,linearity:n,deceleration:s}=i,o=Dt(t*n/(e/1e3),-r,r),a=Math.abs(o)/(s*n);return{easing:i.easing,duration:1e3*a,amount:a/2*o}}var tM=class{constructor(t,e){this._map=t,this._clickTolerance=e.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new sg(this._map,t))}mousedown(t,e){return this._mousedownPos=e,this._firePreventable(new rg(t.type,this._map,t))}mouseup(t){this._map.fire(new rg(t.type,this._map,t))}click(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new rg(t.type,this._map,t))}dblclick(t){return this._firePreventable(new rg(t.type,this._map,t))}mouseover(t){this._map.fire(new rg(t.type,this._map,t))}mouseout(t){this._map.fire(new rg(t.type,this._map,t))}touchstart(t){return this._firePreventable(new ng(t.type,this._map,t))}touchmove(t){this._map.fire(new ng(t.type,this._map,t))}touchend(t){this._map.fire(new ng(t.type,this._map,t))}touchcancel(t){this._map.fire(new ng(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},eM=class{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new rg(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new rg("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new rg(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},iM=class{constructor(t,e,i){this._map=t,this._tr=i,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1,e.boxZoom&&"object"==typeof e.boxZoom&&(this._boxZoomEnd=e.boxZoom.boxZoomEnd)}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,e){this.isEnabled()&&t.shiftKey&&0===t.button&&(Y_.disableDrag(),this._startPos=this._lastPos=e,this._active=!0)}mousemoveWindow(t,e){if(!this._active)return;let i=e;if(this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)<this._clickTolerance)return;let r=this._startPos;this._lastPos=i,this._box||(this._box=Y_.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));let n=Math.min(r.x,i.x),s=Math.max(r.x,i.x),o=Math.min(r.y,i.y),a=Math.max(r.y,i.y);this._box.style.transform=`translate(${n}px,${o}px)`,this._box.style.width=s-n+"px",this._box.style.height=a-o+"px"}mouseupWindow(t,e){if(!this._active||0!==t.button)return;let i=this._startPos,r=e;if(this.reset(),Y_.suppressClick(),i.x!==r.x||i.y!==r.y)return this._map.fire(new og("boxzoomend",{originalEvent:t})),this._boxZoomEnd?void this._boxZoomEnd(this._map,i,r,t):{cameraAnimation:t=>t.fitScreenCoordinates(i,r,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&=(this._box.remove(),null),Y_.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,e){return this._map.fire(new og(t,{originalEvent:e}))}};function rM(t,e){if(t.length!==e.length)throw Error(`The number of touches and points are not equal - touches ${t.length}, points ${e.length}`);let i={};for(let r=0;r<t.length;r++)i[t[r].identifier]=e[r];return i}var nM=class{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,e,i){(this.centroid||i.length>this.numTouches)&&(this.aborted=!0),!this.aborted&&(void 0===this.startTime&&(this.startTime=t.timeStamp),i.length===this.numTouches&&(this.centroid=function(t){let e=new u(0,0);for(let i of t)e._add(i);return e.div(t.length)}(e),this.touches=rM(i,e)))}touchmove(t,e,i){if(this.aborted||!this.centroid)return;let r=rM(i,e);for(let t in this.touches){let e=r[t];(!e||e.dist(this.touches[t])>30)&&(this.aborted=!0)}}touchend(t,e,i){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){let t=!this.aborted&&this.centroid;if(this.reset(),t)return t}}},sM=class{constructor(t){this.singleTap=new nM(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,e,i){this.singleTap.touchstart(t,e,i)}touchmove(t,e,i){this.singleTap.touchmove(t,e,i)}touchend(t,e,i){let r=this.singleTap.touchend(t,e,i);if(r){let e=t.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(r)<30;if((!e||!i)&&this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}},oM=class{constructor(t,e){this._tr=e,this._zoomIn=new sM({numTouches:1,numTaps:2}),this._zoomOut=new sM({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,e,i){this._zoomIn.touchstart(t,e,i),this._zoomOut.touchstart(t,e,i)}touchmove(t,e,i){this._zoomIn.touchmove(t,e,i),this._zoomOut.touchmove(t,e,i)}touchend(t,e,i){let r=this._zoomIn.touchend(t,e,i),n=this._zoomOut.touchend(t,e,i),s=this._tr;return r?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:Tt(s.zoom+1,e.getZoomSnap()),around:s.unproject(r)},{originalEvent:t})}):n?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:Tt(s.zoom-1,e.getZoomSnap()),around:s.unproject(n)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},aM=class{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){let e=this._moveFunction(...t);if(e.bearingDelta||e.pitchDelta||e.rollDelta||e.around||e.panDelta)return this._active=!0,e}dragStart(t,e){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=Array.isArray(e)?e[0]:e,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,e){if(!this.isEnabled())return;let i=this._lastPoint;if(!i)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);let r=Array.isArray(e)?e[0]:e;return!this._moved&&r.dist(i)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=r,this._move(i,r))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&Y_.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}};const lM={0:1,2:2};var hM=class{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){this._eventButton=t.button}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!function(t,e){let i=lM[e];return void 0===t.buttons||(t.buttons&i)!==i}(t,this._eventButton)}isValidEndEvent(t){return t.button===this._eventButton}};const uM=t=>{t.mousedown=t.dragStart,t.mousemoveWindow=t.dragMove,t.mouseup=t.dragEnd,t.contextmenu=t=>{t.preventDefault()}};function cM({enable:t,clickTolerance:e,aroundCenter:i=!0,minPixelCenterThreshold:r=100,rotateSpeed:n=.8},s){return new aM({clickTolerance:e,move:(t,e)=>{let o=s();if(i&&Math.abs(o.y-t.y)>r)return{bearingDelta:Wt(new u(t.x,e.y),e,o)};let a=(e.x-t.x)*n;return i&&e.y<o.y&&(a=-a),{bearingDelta:a}},moveStateManager:new hM({checkCorrectEvent:t=>0===t.button&&t.ctrlKey||2===t.button&&!t.ctrlKey}),enable:t,assignEvents:uM})}var fM=class{constructor(t,e){this._clickTolerance=t.clickTolerance||1,this._map=e,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new u(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,e,i){return this._calculateTransform(t,e,i)}touchmove(t,e,i){if(this._active)return this._shouldBePrevented(i.length)?void this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t):(t.preventDefault(),this._calculateTransform(t,e,i))}touchend(t,e,i){this._calculateTransform(t,e,i),this._active&&this._shouldBePrevented(i.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,e,i){i.length>0&&(this._active=!0);let r=rM(i,e),n=new u(0,0),s=new u(0,0),o=0;for(let t in r){let e=r[t],i=this._touches[t];i&&(n._add(e),s._add(e.sub(i)),o++,r[t]=e)}if(this._touches=r,this._shouldBePrevented(o)||!s.mag())return;let a=s.div(o);return this._sum._add(a),this._sum.mag()<this._clickTolerance?void 0:{around:n.div(o),panDelta:a}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},pM=class{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,e,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([e[0],e[1]]))}touchmove(t,e,i){if(!this._firstTwoTouches)return;t.preventDefault();let[r,n]=this._firstTwoTouches,s=dM(i,e,r),o=dM(i,e,n);if(!s||!o)return;let a=this._aroundCenter?null:s.add(o).div(2);return this._move([s,o],a,t)}touchend(t,e,i){if(!this._firstTwoTouches)return;let[r,n]=this._firstTwoTouches,s=dM(i,e,r),o=dM(i,e,n);s&&o||(this._active&&Y_.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}};function dM(t,e,i){for(let r=0;r<t.length;r++)if(t[r].identifier===i)return e[r]}function mM(t,e){return Math.log(t/e)/Math.LN2}var _M=class extends pM{constructor(){super(),this._zoomRate=1,this._zoomThreshold=.1}setZoomRate(t){this._zoomRate=t??1}setZoomThreshold(t){this._zoomThreshold=t??.1}reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,e){let i=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(mM(this._distance,this._startDistance))<this._zoomThreshold))return this._active=!0,{zoomDelta:mM(this._distance,i)*this._zoomRate,pinchAround:e}}};function gM(t,e){return 180*t.angleWith(e)/Math.PI}var yM=class extends pM{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,e,i){let r=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:gM(this._vector,r),pinchAround:e}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());let e=25/(Math.PI*this._minDiameter)*360,i=gM(t,this._startVector);return Math.abs(i)<e}};function vM(t){return Math.abs(t.y)>Math.abs(t.x)}var wM=class extends pM{constructor(t){super(),this._currentTouchCount=0,this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,e,i){super.touchstart(t,e,i),this._currentTouchCount=i.length}_start(t){this._lastPoints=t,vM(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,e,i){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let r=t[0].sub(this._lastPoints[0]),n=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(r,n,i.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(r.y+n.y)/2*-.5}):void 0}gestureBeginsVertically(t,e,i){if(void 0!==this._valid)return this._valid;let r=t.mag()>=2,n=e.mag()>=2;if(!r&&!n)return;if(!r||!n)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;let s=t.y>0==e.y>0;return vM(t)&&vM(e)&&s}};const bM={panStep:100,bearingStep:15,pitchStep:10};var xM=class{constructor(t,e){this._tr=e;let i=bM;this._panStep=i.panStep,this._bearingStep=i.bearingStep,this._pitchStep=i.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let e=0,i=0,r=0,n=0,s=0;switch(t.keyCode){case 61:case 107:case 171:case 187:e=1;break;case 189:case 109:case 173:e=-1;break;case 37:t.shiftKey?i=-1:(t.preventDefault(),n=-1);break;case 39:t.shiftKey?i=1:(t.preventDefault(),n=1);break;case 38:t.shiftKey?r=1:(t.preventDefault(),s=-1);break;case 40:t.shiftKey?r=-1:(t.preventDefault(),s=1);break;default:return}return this._rotationDisabled&&(i=0,r=0),{cameraAnimation:o=>{let a=this._tr;o.easeTo({duration:300,easeId:"keyboardHandler",easing:DM,zoom:e?Tt(a.zoom+e*(t.shiftKey?2:1),o.getZoomSnap()):a.zoom,bearing:a.bearing+i*this._bearingStep,pitch:a.pitch+r*this._pitchStep,offset:[-n*this._panStep,-s*this._panStep],center:a.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}};function DM(t){return t*(2-t)}const MM=4.000244140625;var EM=class{constructor(t,e,i){this._onTimeout=t=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)},this._map=t,this._tr=i,this._triggerRenderFrame=e,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around)}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(t){return!!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let e=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY,i=H_(),r=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,0!==e&&e%MM==0?this._type="wheel":0!==e&&Math.abs(e)<4?this._type="trackpad":r>400?(this._type=null,this._lastValue=e,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(r*e)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,e+=this._lastValue)),t.shiftKey&&e&&(e/=4),this._type&&(this._lastWheelEvent=t,this._delta-=e,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._needsRerender=!1,this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let e=Y_.mousePos(this._map.getCanvas(),t),i=this._tr;this._aroundPoint=this._aroundCenter?i.transform.locationToScreenPoint(Ou.convert(i.center)):e,this._needsRerender||(this._needsRerender=!0,this._triggerRenderFrame())}renderFrame(){if(!this._needsRerender||(this._needsRerender=!1,!this.isActive()))return;let t=this._tr.transform;if("number"==typeof this._lastExpectedZoom){let e=t.zoom-this._lastExpectedZoom;"number"==typeof this._startZoom&&(this._startZoom+=e),"number"==typeof this._targetZoom&&(this._targetZoom+=e)}if(0!==this._delta){let e="wheel"===this._type&&Math.abs(this._delta)>MM?this._wheelZoomRate:this._defaultZoomRate,i=2/(1+Math.exp(-Math.abs(this._delta*e)));this._delta<0&&0!==i&&(i=1/i);let r="number"==typeof this._targetZoom?St(this._targetZoom):t.scale,n=t.applyConstrain(t.getCameraLngLat(),Ct(r*i)).zoom,s=this._map.getZoomSnap();if("wheel"===this._type&&s>0){let e=Tt(t.zoom,s);this._targetZoom=Tt(n,s,n-e)}else this._targetZoom=n;"wheel"===this._type&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let e,i="number"==typeof this._targetZoom?this._targetZoom:t.zoom,r=this._startZoom,n=this._easing,s=!1;if("wheel"===this._type&&r&&n){let t=H_()-this._lastWheelEventTime,o=Math.min((t+5)/200,1),a=n(o);e=Oi.number(r,i,a),o<1?this._needsRerender=!0:s=!0}else e=i,s=!0;return this._active=!0,s&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout}),200)),this._lastExpectedZoom=e,{noInertia:!0,needsRenderFrame:!s,zoomDelta:e-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let e=xt;if(this._prevEase){let t=this._prevEase,i=(H_()-t.start)/t.duration,r=t.easing(i+.01)-t.easing(i),n=.27/Math.sqrt(r*r+1e-4)*.01;e=bt(n,Math.sqrt(.0729-n*n),.25,1)}return this._prevEase={start:H_(),duration:t,easing:e},e}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}},AM=class{constructor(t,e){this._clickZoom=t,this._tapZoom=e}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}},FM=class{constructor(t,e){this._tr=e,this.reset()}reset(){this._active=!1}dblclick(t,e){return t.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:Tt(this._tr.zoom+(t.shiftKey?-1:1),i.getZoomSnap()),around:this._tr.unproject(e)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},zM=class{constructor(){this._tap=new sM({numTouches:1,numTaps:1}),this._zoomRate=1,this.reset()}setZoomRate(t){this._zoomRate=t??1}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,e,i){if(!this._swipePoint)if(this._tapTime){let r=e[0],n=t.timeStamp-this._tapTime<500,s=this._tapPoint.dist(r)<30;n&&s?i.length>0&&(this._swipePoint=r,this._swipeTouch=i[0].identifier):this.reset()}else this._tap.touchstart(t,e,i)}touchmove(t,e,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;let r=e[0],n=r.y-this._swipePoint.y;return this._swipePoint=r,t.preventDefault(),this._active=!0,{zoomDelta:n/128*this._zoomRate}}}else this._tap.touchmove(t,e,i)}touchend(t,e,i){if(this._tapTime)this._swipePoint&&0===i.length&&this.reset();else{let r=this._tap.touchend(t,e,i);r&&(this._tapTime=t.timeStamp,this._tapPoint=r)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},SM=class{constructor(t,e,i){this._el=t,this._mousePan=e,this._touchPan=i}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}},CM=class{constructor(t,e,i,r){this._pitchWithRotate=t.pitchWithRotate,this._rollEnabled=t.rollEnabled,this._mouseRotate=e,this._mousePitch=i,this._mouseRoll=r}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}},TM=class{constructor(t,e,i,r){this._el=t,this._touchZoom=e,this._touchRotate=i,this._tapDragZoom=r,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}setZoomRate(t){this._touchZoom.setZoomRate(t),this._tapDragZoom.setZoomRate(t)}setZoomThreshold(t){this._touchZoom.setZoomThreshold(t)}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}},PM=class{constructor(t,e){this._bypassKey=navigator.userAgent.includes("Mac")?"metaKey":"ctrlKey",this._map=t,this._options=e,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=Y_.create("div","maplibregl-cooperative-gesture-screen",t);let e=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");"metaKey"===this._bypassKey&&(e=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let i=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),r=document.createElement("div");r.className="maplibregl-desktop-message",r.textContent=e,this._container.appendChild(r);let n=document.createElement("div");n.className="maplibregl-mobile-message",n.textContent=i,this._container.appendChild(n),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(this._container.remove(),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(t){return t[this._bypassKey]}notifyGestureBlocked(t,e){this._enabled&&(this._map.fire(new K_("cooperativegestureprevented",{gestureType:t,originalEvent:e})),this._container.classList.add("maplibregl-show"),setTimeout((()=>{this._container.classList.remove("maplibregl-show")}),100))}},IM=class{constructor(t){this._camera=t}get transform(){return this._camera._requestedCameraState||this._camera.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.screenPointToLocation(u.convert(t),this._camera.terrain)}};const kM=t=>t.zoom||t.drag||t.roll||t.pitch||t.rotate;var $M=class extends _e{};function jM(t){return t.panDelta?.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta||t.rollDelta}var RM=class{get _ownerDocument(){return this._el?.ownerDocument||document}get _ownerWindow(){return this._el?.ownerDocument?.defaultView||window}constructor(t,e,i){this._terrainGestureAnchorElevation=null,this.handleWindowEvent=t=>{this.handleEvent(t,`${t.type}Window`)},this.handleEvent=(t,e)=>{if("blur"===t.type)return void this.stop(!0);this._updatingCamera=!0;let i="renderFrame"===t.type?void 0:t,r={needsRenderFrame:!1},n={},s={};for(let{handlerName:o,handler:a,allowed:l}of this._handlers){if(!a.isEnabled())continue;let h;if(this._blockedByActive(s,l,o))a.reset();else if(a[e||t.type]){if(Qt(t,e||t.type)){let i=Y_.mousePos(this._map.getCanvas(),t);h=a[e||t.type](t,i)}else if(Kt(t,e||t.type)){let i=this._getMapTouches(t.touches),r=Y_.touchPos(this._map.getCanvas(),i);h=a[e||t.type](t,r,i)}else te(e||t.type)||(h=a[e||t.type](t));this.mergeHandlerResult(r,n,h,o,i),h?.needsRenderFrame&&this._triggerRenderFrame()}(h||a.isActive())&&(s[o]=a)}let o={};for(let t in this._previousActiveHandlers)s[t]||(o[t]=i);this._previousActiveHandlers=s,(Object.keys(o).length||jM(r))&&(this._changes.push([r,n,o]),this._triggerRenderFrame()),(Object.keys(s).length||jM(r))&&this._camera.stop(!0),this._updatingCamera=!1;let{cameraAnimation:a}=r;a&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],a(this._map))},this._map=t,this._camera=e,this._transformProvider=new IM(this._camera),this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new JD(t),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);let 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],[this._ownerDocument,"mousemove",{capture:!0}],[this._ownerDocument,"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],[this._ownerWindow,"blur",void 0]];for(let[t,e,i]of this._listeners)t.addEventListener(e,t===this._ownerDocument?this.handleWindowEvent:this.handleEvent,i)}destroy(){for(let[t,e,i]of this._listeners)t.removeEventListener(e,t===this._ownerDocument?this.handleWindowEvent:this.handleEvent,i)}_addDefaultHandlers(t){let e=this._map,i=e.getCanvasContainer();this._add("mapEvent",new tM(e,t));let r=e.boxZoom=new iM(e,t,this._transformProvider);this._add("boxZoom",r),t.interactive&&t.boxZoom&&r.enable();let n=e.cooperativeGestures=new PM(e,t.cooperativeGestures);this._add("cooperativeGestures",n),t.cooperativeGestures&&n.enable();let s=new oM(e,this._transformProvider),o=new FM(e,this._transformProvider);e.doubleClickZoom=new AM(o,s),this._add("tapZoom",s),this._add("clickZoom",o),t.interactive&&t.doubleClickZoom&&e.doubleClickZoom.enable();let a=new zM;this._add("tapDragZoom",a);let l=e.touchPitch=new wM(e);this._add("touchPitch",l),t.interactive&&t.touchPitch&&e.touchPitch.enable(t.touchPitch);let h=()=>e.project(e.getCenter()),u=cM(t,h),c=function({enable:t,clickTolerance:e,pitchSpeed:i=-.5}){return new aM({clickTolerance:e,move:(t,e)=>({pitchDelta:(e.y-t.y)*i}),moveStateManager:new hM({checkCorrectEvent:t=>0===t.button&&t.ctrlKey||2===t.button}),enable:t,assignEvents:uM})}(t),f=function({enable:t,clickTolerance:e,rollDegreesPerPixelMoved:i=.3},r){return new aM({clickTolerance:e,move:(t,e)=>{let n=r(),s=(e.x-t.x)*i;return e.y<n.y&&(s=-s),{rollDelta:s}},moveStateManager:new hM({checkCorrectEvent:t=>2===t.button&&t.ctrlKey}),enable:t,assignEvents:uM})}(t,h);e.dragRotate=new CM(t,u,c,f),this._add("mouseRotate",u,["mousePitch"]),this._add("mousePitch",c,["mouseRotate","mouseRoll"]),this._add("mouseRoll",f,["mousePitch"]),t.interactive&&t.dragRotate&&e.dragRotate.enable();let p=function({enable:t,clickTolerance:e}){return new aM({clickTolerance:e,move:(t,e)=>({around:e,panDelta:e.sub(t)}),activateOnStart:!0,moveStateManager:new hM({checkCorrectEvent:t=>0===t.button&&!t.ctrlKey}),enable:t,assignEvents:uM})}(t),d=new fM(t,e);e.dragPan=new SM(i,p,d),this._add("mousePan",p),this._add("touchPan",d,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&e.dragPan.enable(t.dragPan);let m=new yM,_=new _M;e.touchZoomRotate=new TM(i,_,m,a),this._add("touchRotate",m,["touchPan","touchZoom"]),this._add("touchZoom",_,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&e.touchZoomRotate.enable(t.touchZoomRotate),this._add("blockableMapEvent",new eM(e));let g=e.scrollZoom=new EM(e,(()=>this._triggerRenderFrame()),this._transformProvider);this._add("scrollZoom",g,["mousePan"]),t.interactive&&t.scrollZoom&&e.scrollZoom.enable(t.scrollZoom);let y=e.keyboard=new xM(e,this._transformProvider);this._add("keyboard",y),t.interactive&&t.keyboard&&e.keyboard.enable()}_add(t,e,i){this._handlers.push({handlerName:t,handler:e,allowed:i}),this._handlersById[t]=e}stop(t){if(!this._updatingCamera){for(let{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(let{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!kM(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,e,i){for(let r in t)if(r!==i&&!e?.includes(r))return!0;return!1}_getMapTouches(t){let e=[];for(let i of t)this._el.contains(i.target)&&e.push(i);return e}mergeHandlerResult(t,e,i,r,n){if(!i)return;Et(t,i);let s={handlerName:r,originalEvent:i.originalEvent||n};void 0!==i.zoomDelta&&(e.zoom=s),void 0!==i.panDelta&&(e.drag=s),void 0!==i.rollDelta&&(e.roll=s),void 0!==i.pitchDelta&&(e.pitch=s),void 0!==i.bearingDelta&&(e.rotate=s)}_applyChanges(){let t={},e={},i={};for(let[r,n,s]of this._changes)r.panDelta&&(t.panDelta=(t.panDelta||new u(0,0))._add(r.panDelta)),r.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+r.zoomDelta),r.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+r.bearingDelta),r.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+r.pitchDelta),r.rollDelta&&(t.rollDelta=(t.rollDelta||0)+r.rollDelta),void 0!==r.around&&(t.around=r.around),void 0!==r.pinchAround&&(t.pinchAround=r.pinchAround),r.noInertia&&(t.noInertia=r.noInertia),Et(e,n),Et(i,s);this._updateMapTransform(t,e,i),this._changes=[]}_updateMapTransform(t,e,i){let r=this._map,n=this._camera.getTransformForUpdate(),s=r.terrain;if(!(jM(t)||s&&this._terrainMovement))return void this._fireEvents(e,i,!0);this._camera.stop(!0);let{panDelta:o,zoomDelta:a,bearingDelta:l,pitchDelta:h,rollDelta:u}=t,{around:c,aroundOnSurface:f}=this._resolveAround(t,s,n),p=s?this._terrainGestureElevation(s,c,f,n,e):void 0,d={panDelta:o,zoomDelta:a,rollDelta:u,pitchDelta:h,bearingDelta:l,around:c,aroundElevation:p};this._camera.cameraHelper.useGlobeControls&&!n.isPointOnMapSurface(c)&&(c=n.centerPoint);let m=this._computePreZoomAroundLoc(n,c,o,p);this._handleMapControls({terrain:s,tr:n,deltasForHelper:d,preZoomAroundLoc:m,combinedEventsInProgress:e,panDelta:o}),this._camera.applyUpdatedTransform(n),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(e,i,!0)}_resolveAround(t,e,i){let r=void 0===t.pinchAround?t.around:t.pinchAround;return r||=this._camera.transform.centerPoint,e&&!i.isPointOnMapSurface(r)?{around:i.centerPoint,aroundOnSurface:!1}:{around:r,aroundOnSurface:!0}}_terrainGestureElevation(t,e,i,r,n){if(!i)return;if(!this._terrainMovement&&(n.drag||n.zoom)){let i=r.screenTerrainPointToMercatorCoordinate(e,t);this._terrainGestureAnchorElevation=i?i.z:null}if(null===this._terrainGestureAnchorElevation)return;let s=this._terrainGestureAnchorElevation;return e.distSqr(r.centerPoint)<.01||s-r.elevation>=.9*(r.getCameraAltitude()-r.elevation)?void 0:s}_computePreZoomAroundLoc(t,e,i,r){if(e.distSqr(t.centerPoint)<.01)return t.center;let n=i?e.sub(i):e;return void 0===r?t.screenPointToLocation(n):t.screenPointToLocationAtElevation(n,r)}_handleMapControls({terrain:t,tr:e,deltasForHelper:i,preZoomAroundLoc:r,combinedEventsInProgress:n,panDelta:s}){let o=this._camera.cameraHelper;if(o.handleMapControlsRollPitchBearingZoom(i,e),t)return o.useGlobeControls?(!this._terrainMovement&&(n.drag||n.zoom)&&(this._terrainMovement=!0,this._camera.elevationFreeze=!0),void o.handleMapControlsPan(i,e,r)):this._terrainMovement||!n.drag&&!n.zoom?void(void 0===i.aroundElevation&&n.drag&&this._terrainMovement&&s?e.setCenter(e.screenPointToLocation(e.centerPoint.sub(s))):o.handleMapControlsPan(i,e,r)):(this._terrainMovement=!0,this._camera.elevationFreeze=!0,void o.handleMapControlsPan(i,e,r));o.handleMapControlsPan(i,e,r)}_fireEvents(t,e,i){let r=kM(this._eventsInProgress),n=kM(t),s={};for(let e in t){let{originalEvent:i}=t[e];this._eventsInProgress[e]||(s[`${e}start`]=i),this._eventsInProgress[e]=t[e]}!r&&n&&this._fireEvent("movestart",n.originalEvent);for(let t in s)this._fireEvent(t,s[t]);n&&this._fireEvent("move",n.originalEvent);for(let e in t){let{originalEvent:i}=t[e];this._fireEvent(e,i)}let o,a={};for(let t in this._eventsInProgress){let{handlerName:i,originalEvent:r}=this._eventsInProgress[t];this._handlersById[i].isActive()||(delete this._eventsInProgress[t],o=e[i]||r,a[`${t}end`]=o)}for(let t in a)this._fireEvent(t,a[t]);let l=kM(this._eventsInProgress),h=(r||n)&&!l;if(h&&this._terrainMovement){this._camera.elevationFreeze=!1,this._terrainMovement=!1,this._terrainGestureAnchorElevation=null;let t=this._camera.getTransformForUpdate();this._map.getCenterClampedToGround()&&t.recalculateZoomAndCenter(this._map.terrain),this._camera.applyUpdatedTransform(t)}if(i&&h){this._updatingCamera=!0;let t=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),e=t=>0!==t&&-this._bearingSnap<t&&t<this._bearingSnap;!t||!t.essential&&Z_.prefersReducedMotion?(this._map.fire(new Q_("moveend",{originalEvent:o})),e(this._map.getBearing())&&this._map.resetNorth()):(e(t.bearing||this._map.getBearing())&&(t.bearing=0),t.freezeElevation=!0,this._map.easeTo(t,{originalEvent:o})),this._updatingCamera=!1}}_fireEvent(t,e){this._map.fire(new Q_(t,e?{originalEvent:e}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((t=>{delete this._frameId,this.handleEvent(new $M("renderFrame",{timeStamp:t})),this._applyChanges()}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}},OM=class extends ye{constructor(t){super(),this._renderFrameCallback=()=>{let t=Math.min((H_()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this.transform=new Dw,this.cameraHelper=new Cw,void 0!==t.minZoom&&this.transform.setMinZoom(t.minZoom),void 0!==t.maxZoom&&this.transform.setMaxZoom(t.maxZoom),void 0!==t.minPitch&&this.transform.setMinPitch(t.minPitch),void 0!==t.maxPitch&&this.transform.setMaxPitch(t.maxPitch),void 0!==t.renderWorldCopies&&this.transform.setRenderWorldCopies(t.renderWorldCopies),null!==t.transformConstrain&&this.transform.setConstrainOverride(t.transformConstrain),this._moving=!1,this._zooming=!1,this._bearingSnap=t.bearingSnap,this._zoomSnap=t.zoomSnap,this._requestRenderFrame=t.requestRenderFrame,this._cancelRenderFrame=t.cancelRenderFrame,this.terrain=t.terrain,this._centerClampedToGround=t.centerClampedToGround??!0,this.transformCameraUpdate=t.transformCameraUpdate??null,this._stopHandlers=t.stopHandlers??(()=>{}),this.on("moveend",(()=>{delete this._requestedCameraState}))}migrateProjection(t,e){if(t.apply(this.transform,!0),this.transform=t,this.cameraHelper=e,this._requestedCameraState){let e=t.clone();e.apply(this._requestedCameraState,!0),this._requestedCameraState=e}}getCenter(){return new Ou(this.transform.center.lng,this.transform.center.lat)}setCenter(t,e){return this.jumpTo({center:t},e)}getCenterElevation(){return this.transform.elevation}setCenterElevation(t,e){return this.jumpTo({elevation:t},e),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(t){this._centerClampedToGround=t}panBy(t,e,i){return t=u.convert(t).mult(-1),this.panTo(this.transform.center,Et({offset:t},e),i)}panTo(t,e,i){return this.easeTo(Et({center:t},e),i)}getZoom(){return this.transform.zoom}setZoom(t,e){return this.jumpTo({zoom:t},e),this}zoomTo(t,e,i){return this.easeTo(Et({zoom:t},e),i)}zoomIn(t,e){return this.zoomTo(Tt(this.getZoom()+1,this._zoomSnap),t,e),this}zoomOut(t,e){return this.zoomTo(Tt(this.getZoom()-1,this._zoomSnap),t,e),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(t,e){return t!=this.transform.fov&&(this.transform.setFov(t),this.fire(new Q_("movestart",e)).fire(new Q_("move",e)).fire(new Q_("moveend",e))),this}getBearing(){return this.transform.bearing}setZoomSnap(t){return this._zoomSnap=t,this}getZoomSnap(){return this._zoomSnap}setBearing(t,e){return this.jumpTo({bearing:t},e),this}getPadding(){return this.transform.padding}setPadding(t,e){return this.jumpTo({padding:t},e),this}rotateTo(t,e,i){return this.easeTo(Et({bearing:t},e),i)}resetNorth(t,e){return this.rotateTo(0,Et({duration:1e3},t),e),this}resetNorthPitch(t,e){return this.easeTo(Et({bearing:0,pitch:0,roll:0,duration:1e3},t),e),this}snapToNorth(t,e){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,e):this}getPitch(){return this.transform.pitch}setPitch(t,e){return this.jumpTo({pitch:t},e),this}getRoll(){return this.transform.roll}setRoll(t,e){return this.jumpTo({roll:t},e),this}cameraForBounds(t,e){t=oy.convert(t).adjustAntiMeridian();let i=e?.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),i,e)}_cameraForBoxAndBearing(t,e,i,r){let n={top:0,bottom:0,right:0,left:0};if("number"==typeof(r=Et({padding:n,offset:[0,0],maxZoom:this.transform.maxZoom},r)).padding){let t=r.padding;r.padding={top:t,bottom:t,right:t,left:t}}let s=Et(n,r.padding);r.padding=s;let o=this.transform,a=new oy(t,e),l=this.cameraHelper.cameraForBoxAndBearing(r,s,a,i,o);return l&&this._zoomSnap&&(l.zoom=Tt(l.zoom,this._zoomSnap,-1)),l}fitBounds(t,e,i){return this._fitInternal(this.cameraForBounds(t,e),e,i)}fitScreenCoordinates(t,e,i,r,n){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(u.convert(t)),this.transform.screenPointToLocation(u.convert(e)),i,r),r,n)}_fitInternal(t,e,i){return t?(delete(e=Et(t,e)).padding,e.linear?this.easeTo(e,i):this.flyTo(e,i)):this}jumpTo(t,e){this.stop(),void 0!==t.zoom&&this._zoomSnap&&(t.zoom=Tt(t.zoom,this._zoomSnap));let i=this.getTransformForUpdate(),r=!1,n=!1,s=!1,o=i.zoom;this.terrain&&i.setElevation(this.terrain.getElevationForLngLat(t.center?Ou.convert(t.center):i.center,i)),this.cameraHelper.handleJumpToCenterZoom(i,t);let a=i.zoom!==o;return void 0!==t.elevation&&i.elevation!==+t.elevation&&i.setElevation(+t.elevation),void 0!==t.bearing&&i.bearing!==+t.bearing&&(r=!0,i.setBearing(+t.bearing)),void 0!==t.pitch&&i.pitch!==+t.pitch&&(n=!0,i.setPitch(+t.pitch)),void 0!==t.roll&&i.roll!==+t.roll&&(s=!0,i.setRoll(+t.roll)),null!=t.padding&&!i.isPaddingEqual(t.padding)&&i.setPadding(t.padding),this.applyUpdatedTransform(i),this.fire(new Q_("movestart",e)).fire(new Q_("move",e)),a&&this.fire(new Q_("zoomstart",e)).fire(new Q_("zoom",e)).fire(new Q_("zoomend",e)),r&&this.fire(new Q_("rotatestart",e)).fire(new Q_("rotate",e)).fire(new Q_("rotateend",e)),n&&this.fire(new Q_("pitchstart",e)).fire(new Q_("pitch",e)).fire(new Q_("pitchend",e)),s&&this.fire(new Q_("rollstart",e)).fire(new Q_("roll",e)).fire(new Q_("rollend",e)),this.fire(new Q_("moveend",e))}calculateCameraOptionsFromCameraLngLatAltRotation(t,e,i,r,n){let s=this.transform.calculateCenterFromCameraLngLatAlt(t,e,i,r);return{center:s.center,elevation:s.elevation,zoom:s.zoom,bearing:i,pitch:r,roll:n}}easeTo(t,e){this._stop(!1,t.easeId),void 0!==(t=Et({offset:[0,0],duration:500,easing:xt},t)).zoom&&this._zoomSnap&&(t.zoom=Tt(t.zoom,this._zoomSnap)),(!1===t.animate||!t.essential&&Z_.prefersReducedMotion)&&(t.duration=0);let i,r,n=this.getTransformForUpdate(),s=this.getBearing(),o=n.pitch,a=n.roll,l=void 0===t.bearing?s:this._normalizeBearing(t.bearing,s),h=void 0===t.pitch?o:+t.pitch,c=void 0===t.roll?a:this._normalizeBearing(t.roll,a),f=void 0===t.padding?n.padding:t.padding,p=u.convert(t.offset);t.around&&(i=Ou.convert(t.around),r=n.locationToScreenPoint(i));let d={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},m=this.cameraHelper.handleEaseTo(n,{bearing:l,pitch:h,roll:c,padding:f,around:i,aroundPoint:r,offsetAsPoint:p,offset:t.offset,zoom:t.zoom,center:t.center});return this._rotating||=s!==l,this._pitching||=h!==o,this._rolling||=c!==a,this._padding=!n.isPaddingEqual(f),this._zooming||=m.isZooming,this._easeId=t.easeId,this._prepareEase(e,t.noMoveStart,d),this.terrain&&this._prepareElevation(m.elevationCenter),this._ease((i=>{m.easeFunc(i),this.terrain&&!t.freezeElevation&&this._updateElevation(i),this.applyUpdatedTransform(n),this._fireMoveEvents(e)}),(i=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(e,i)}),t),this}_prepareEase(t,e,i={}){this._moving=!0,!e&&!i.moving&&this.fire(new Q_("movestart",t)),this._zooming&&!i.zooming&&this.fire(new Q_("zoomstart",t)),this._rotating&&!i.rotating&&this.fire(new Q_("rotatestart",t)),this._pitching&&!i.pitching&&this.fire(new Q_("pitchstart",t)),this._rolling&&!i.rolling&&this.fire(new Q_("rollstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLat(t,this.transform),this.elevationFreeze=!0}_updateElevation(t){(void 0===this._elevationStart||void 0===this._elevationCenter)&&this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let e=this.terrain.getElevationForLngLat(this._elevationCenter,this.transform);if(t<1&&e!==this._elevationTarget){let i=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(i-(e-(i*t+this._elevationStart))/(1-t)),this._elevationTarget=e}this.transform.setElevation(Oi.number(this._elevationStart,this._elevationTarget,t))}_finalizeElevation(){this.elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||=this.transform.clone(),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){if(!this.terrain&&t.elevation>=0&&t.pitch<=90)return{};let e=t.getCameraLngLat(),i=t.getCameraAltitude(),r=this.terrain?this.terrain.getElevationForLngLatZoom(e,t.zoom):0;if(i<r){let i=t.calculateCameraOptionsFromTo(e,r,t.center,t.elevation);return{pitch:i.pitch,zoom:i.zoom}}return{}}applyUpdatedTransform(t){let e=[];if(e.push((t=>this._elevateCameraIfInsideTerrain(t))),this.transformCameraUpdate&&e.push((t=>this.transformCameraUpdate(t))),!e.length)return;let i=t.clone();for(let t of e){let e=i.clone(),{center:r,zoom:n,roll:s,pitch:o,bearing:a,elevation:l}=t(e);r&&e.setCenter(r),void 0!==l&&e.setElevation(l),void 0!==n&&e.setZoom(n),void 0!==s&&e.setRoll(s),void 0!==o&&e.setPitch(o),void 0!==a&&e.setBearing(a),i.apply(e,!1)}this.transform.apply(i,!1)}_fireMoveEvents(t){this.fire(new Q_("move",t)),this._zooming&&this.fire(new Q_("zoom",t)),this._rotating&&this.fire(new Q_("rotate",t)),this._pitching&&this.fire(new Q_("pitch",t)),this._rolling&&this.fire(new Q_("roll",t))}_afterEase(t,e){if(this._easeId&&e&&this._easeId===e)return;delete this._easeId;let i=this._zooming,r=this._rotating,n=this._pitching,s=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,i&&this.fire(new Q_("zoomend",t)),r&&this.fire(new Q_("rotateend",t)),n&&this.fire(new Q_("pitchend",t)),s&&this.fire(new Q_("rollend",t)),this.fire(new Q_("moveend",t))}flyTo(t,e){if(!t.essential&&Z_.prefersReducedMotion){let i=At(t,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(i,e)}this.stop(),void 0!==(t=Et({offset:[0,0],speed:1.2,curve:1.42,easing:xt},t)).zoom&&this._zoomSnap&&(t.zoom=Tt(t.zoom,this._zoomSnap));let i=this.getTransformForUpdate(),r=i.bearing,n=i.pitch,s=i.roll,o=i.padding,a=void 0===t.bearing?r:this._normalizeBearing(t.bearing,r),l=void 0===t.pitch?n:+t.pitch,h=void 0===t.roll?s:this._normalizeBearing(t.roll,s),c=void 0===t.padding?i.padding:t.padding,f=u.convert(t.offset),p=i.centerPoint.add(f),d=i.screenPointToLocation(p),m=this.cameraHelper.handleFlyTo(i,{bearing:a,pitch:l,roll:h,padding:c,locationAtOffset:d,offsetAsPoint:f,center:t.center,minZoom:t.minZoom,zoom:t.zoom}),_=t.curve,g=Math.max(i.width,i.height),y=g/m.scaleOfZoom,v=m.pixelPathLength;_=Math.min(_,Math.sqrt(g/m.scaleOfMinZoom/v*2));let w=_*_;function b(t){let e=(y*y-g*g+(t?-1:1)*w*w*v*v)/(2*(t?y:g)*w*v);return Math.log(Math.sqrt(e*e+1)-e)}function x(t){return(Math.exp(t)-Math.exp(-t))/2}function D(t){return(Math.exp(t)+Math.exp(-t))/2}let M=b(!1),E=function(t){return D(M)/D(M+_*t)},A=function(t){return g*((D(M)*function(t){return x(t)/D(t)}(M+_*t)-x(M))/w)/v},F=(b(!0)-M)/_;if(Math.abs(v)<2e-6||!isFinite(F)){if(Math.abs(g-y)<1e-6)return this.easeTo(t,e);let i=y<g?-1:1;F=Math.abs(Math.log(y/g))/_,A=()=>0,E=t=>Math.exp(i*_*t)}return t.duration=void 0!==t.duration?+t.duration:1e3*F/(void 0===t.screenSpeed?+t.speed:+t.screenSpeed/_),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=r!==a,this._pitching=l!==n,this._rolling=h!==s,this._padding=!i.isPaddingEqual(c),this._prepareEase(e,!1),this.terrain&&this._prepareElevation(m.targetCenter),this._ease((u=>{let d=u*F,_=1/E(d),g=A(d);this._rotating&&i.setBearing(Oi.number(r,a,u)),this._pitching&&i.setPitch(Oi.number(n,l,u)),this._rolling&&i.setRoll(Oi.number(s,h,u)),this._padding&&(i.interpolatePadding(o,c,u),p=i.centerPoint.add(f)),m.easeFunc(u,_,g,p),this.terrain&&!t.freezeElevation&&this._updateElevation(u),this.applyUpdatedTransform(i),this._fireMoveEvents(e)}),(()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(e)}),t),this}isEasing(){return!!this._easeFrameId}stop(t){return this._stop(t)}_stop(t,e){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let t=this._onEaseEnd;delete this._onEaseEnd,t.call(this,e)}return t||this._stopHandlers(),this}_ease(t,e,i){!1===i.animate||0===i.duration?(t(1),e()):(this._easeStart=H_(),this._easeOptions=i,this._onEaseFrame=t,this._onEaseEnd=e,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,e){t=Mt(t,-180,180);let i=Math.abs(t-e);return Math.abs(t-360-e)<i&&(t-=360),Math.abs(t+360-e)<i&&(t+=360),t}isMoving(){return this._moving}isZooming(){return this._zooming}isRotating(){return this._rotating}};const BM={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};var LM=class{constructor(t=BM){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=t=>{t&&("terrain"===t.type||"style"===t.dataType||"source"===t.dataType&&("metadata"===t.sourceDataType||"visibility"===t.sourceDataType))&&this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._container.setAttribute("open",""):!this._container.classList.contains("maplibregl-compact")&&!this._container.classList.contains("maplibregl-attrib-empty")&&(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=Y_.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=Y_.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=Y_.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,e){let i=this._map._getUIString(`AttributionControl.${e}`);t.title=i,t.setAttribute("aria-label",i)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((t=>"string"==typeof t?t:""))):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){let t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id}let e=this._map.style.tileManagers;for(let i in e){let r=e[i];if(r.used||r.usedForTerrain){let e=r.getSource();e.attribution&&!t.includes(e.attribution)&&t.push(e.attribution)}}t=t.filter((t=>String(t).trim())),t.sort(((t,e)=>t.length-e.length)),t=t.filter(((e,i)=>{for(let r=i+1;r<t.length;r++)if(t[r].includes(e))return!1;return!0}));let i=t.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,t.length?(this._innerContainer.innerHTML=Y_.sanitize(i),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}},UM=class{constructor(t={}){this._updateCompact=()=>{let t=this._container.children;if(t.length){let e=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&e.classList.add("maplibregl-compact"):e.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options?.compact,this._container=Y_.create("div","maplibregl-ctrl");let e=Y_.create("a","maplibregl-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="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}},NM=class{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){let e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e}remove(t){let e=this._currentlyRunning,i=e?this._queue.concat(e):this._queue;for(let e of i)if(e.id===t)return void(e.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw Error("Attempting to run(), but is already running.");let e=this._currentlyRunning=this._queue;this._queue=[];let i,r=!1;for(let n of e)if(!n.cancelled){try{n.callback(t)}catch(t){r||(r=!0,i=t)}if(this._cleared)break}if(this._cleared=!1,this._currentlyRunning=!1,r)throw i}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}};const GM=["none","zoom","sourceTiles","visibleLayers","revision"];var qM=class{constructor(t,e,i,r){this._tileKeys=t.map((t=>t.key)).sort().join(),this._revision=e,this._zoom=i,this._visibleLayerIds=r}difference(t){return this._revision===t?._revision?this._visibleLayerIds===t._visibleLayerIds?this._tileKeys===t._tileKeys?this._zoom===t._zoom?"none":"zoom":"sourceTiles":"visibleLayers":"revision"}};const VM={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};var ZM=class{constructor(t,e){this.needsFollowUpFrame=!1,this.painter=t,this.terrain=e,this.rttSize=e.tileManager.tileSize*e.qualityFactor}getTexture(t){return t.getRTT(this._stacks.length-1).texture}prepareForRender(t,e){let i=e!==this._lastPrepareZoom;this._lastPrepareZoom=e,this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=t._order.filter((i=>!t._layers[i].isHidden(e)));let r=this._renderableLayerIds.join(),n=new Set;for(let e of this._renderableLayerIds){let i=t._layers[e],r=i.source;r&&VM[i.type]&&n.add(r)}this._coordsAscending={},this._rttFingerprints={};for(let i of n){let n=t.tileManagers[i];if(!n)continue;this._coordsAscending[i]={};let s=this._coordsAscending[i],o=n.getSource(),a=o instanceof Ay?o.terrainTileRanges:null;for(let t of n.getVisibleCoordinates()){let e=this.terrain.tileManager.getTerrainCoords(t,a);for(let t in e)s[t]||=[],s[t].push(e[t])}this._rttFingerprints[i]={};let l=this._rttFingerprints[i],h=n.getState().revision;for(let t in s)l[t]=new qM(s[t],h,e,r)}this.needsFollowUpFrame=!1;let s=i||this.painter.options.moving,o=!1;for(let t of this._renderableTiles){let e=this._textureDifference(t);"none"!==e&&("zoom"===e&&s||"visibleLayers"===e&&i?this.needsFollowUpFrame=!0:"zoom"===e||"sourceTiles"===e?(o?this.needsFollowUpFrame=!0:t.releaseRTT(this.painter),o=!0):t.releaseRTT(this.painter))}}_textureDifference(t){let e="none";for(let i in this._rttFingerprints){let r=this._rttFingerprints[i][t.tileID.key];if(!r)continue;let n=r.difference(t.rttFingerprint[i]);GM.indexOf(n)>GM.indexOf(e)&&(e=n)}return e}renderLayer(t,e){if(t.isHidden(this.painter.transform.zoom))return!1;let i=t.type,r=this.painter,n=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(VM[i]&&((!this._prevType||!VM[this._prevType])&&this._stacks.push([]),this._prevType=i,this._stacks[this._stacks.length-1].push(t.id),!n))return!0;if(VM[this._prevType]||VM[i]&&n){this._prevType=i;let t=this._stacks.length-1,n=this._stacks[t]||[];e.isRenderingToTexture=!0;for(let i of this._renderableTiles){if(this._rttTiles.push(i),i.getRTT(t))continue;let s=i.acquireRTT(r,t,this.rttSize);r.bindRTT(s),r.context.clear({color:di.transparent,stencil:0}),r.currentStencilSource=void 0;for(let t of n){let n=r.style._layers[t],s=n.source?this._coordsAscending[n.source][i.tileID.key]:[i.tileID];r.context.viewport.set([0,0,this.rttSize,this.rttSize]),r.renderTileClippingMasks(n,s),r.renderLayer(r,r.style.tileManagers[n.source],n,s,e),n.source&&(i.rttFingerprint[n.source]=this._rttFingerprints[n.source][i.tileID.key])}s.texture.generateMipmap()}return e.isRenderingToTexture=!1,function(t,e,i,r){let{isRenderingGlobe:n}=r,s=t.context,o=s.gl,a=t.transform,l=t.colorModeForRenderPass(),h=t.getDepthModeFor3D(),u=t.useProgram("terrain");s.bindFramebuffer.set(null),s.viewport.set([0,0,t.width,t.height]);for(let c of i){let i=e.getTerrainMesh(c.tileID),f=t.renderToTexture.getTexture(c),p=e.getTerrainData(c.tileID);s.activeTexture.set(o.TEXTURE0),f.bind(o.LINEAR,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_LINEAR);let d=e.getSkirtLength(a.zoom),m=a.calculateFogMatrix(c.tileID.toUnwrapped()),_=fb(d,m,t.style.sky,a.pitch,n),g=Hx(r,c.tileID,{applyTerrainMatrix:!1});u.draw(s,o.TRIANGLES,h,Vx.disabled,l,Wx.backCCW,_,p,g,"terrain",i.vertexBuffer,i.indexBuffer,i.segments)}}(this.painter,this.terrain,this._rttTiles,e),this._rttTiles=[],VM[i]}return!1}};const WM={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Drag to rotate map, click to reset north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},HM={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:BM,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:se.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,rotateSpeed:.8,pitchSpeed:-.5,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,terrainSkirtLength:"auto",zoomLevelsToOverscale:4,anisotropicFilterPitch:20};var YM=class extends ye{get _ownerWindow(){return this._container?.ownerDocument?.defaultView||window}constructor(t){super(),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new NM,this._controls=[],this._mapId=zt(),this._styleUrl=null,this._missingStyleImageResolver=null,this._lostContextStyle={style:null,images:null},this._contextLost=t=>{if(t.preventDefault(),this._frameRequest&&=(this._frameRequest.abort(),null),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),this.style){for(let t of Object.values(this.style._layers))if("custom"===t.type&&console.warn(`Custom layer with id '${t.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),t._listeners)for(let[e]of Object.entries(t._listeners))console.warn(`Custom layer with id '${t.id}' had event listeners for event '${e}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this.style.destroy(),this.style=null,this.fire(new hg("webglcontextlost",{originalEvent:t}))}else this.fire(new hg("webglcontextlost",{originalEvent:t}))},this._contextRestored=t=>{if(this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&this.style){this.style.imageManager.images=this._lostContextStyle.images;for(let t in this._lostContextStyle.images){let e=this._lostContextStyle.images[t];e.isWebGLImage&&this.style.imageManager.updateImage(t,e,!1)}}this._lostContextStyle={style:null,images:null};try{this._setupPainter()}catch(t){return void this.fire(new ge(t))}this.resize(),this._update(),this._resizeInternal(),this.fire(new hg("webglcontextrestored",{originalEvent:t}))},this._onMapScroll=t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()};let e={...HM,...t,canvasContextAttributes:{...HM.canvasContextAttributes,...t.canvasContextAttributes}};if(null!=e.minZoom&&null!=e.maxZoom&&e.minZoom>e.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(null!=e.minPitch&&null!=e.maxPitch&&e.minPitch>e.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(null!=e.minPitch&&e.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(null!=e.maxPitch&&e.maxPitch>180)throw Error("maxPitch must be less than or equal to 180");this._camera=new OM({minZoom:e.minZoom,maxZoom:e.maxZoom,minPitch:e.minPitch,maxPitch:e.maxPitch,bearingSnap:e.bearingSnap,zoomSnap:e.zoomSnap,renderWorldCopies:e.renderWorldCopies,centerClampedToGround:e.centerClampedToGround,terrain:this.terrain,transformConstrain:e.transformConstrain,requestRenderFrame:t=>this._requestRenderFrame(t),cancelRenderFrame:t=>this._cancelRenderFrame(t),transformCameraUpdate:e.transformCameraUpdate,stopHandlers:()=>this._handlers?.stop(!1)}),this._camera.setEventedParent(this),this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._maxTileCacheZoomLevels=e.maxTileCacheZoomLevels,this._canvasContextAttributes={...e.canvasContextAttributes},this._trackResize=!0===e.trackResize,this._terrainSkirtLength=e.terrainSkirtLength,this._refreshExpiredTiles=!0===e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=!0===e.crossSourceCollisions,this._collectResourceTiming=!0===e.collectResourceTiming,this._locale={...WM,...e.locale},this._clickTolerance=e.clickTolerance,this._overridePixelRatio=e.pixelRatio,this._maxCanvasSize=e.maxCanvasSize,this._zoomLevelsToOverscale=e.zoomLevelsToOverscale,this.cancelPendingTileRequestsWhileZooming=!0===e.cancelPendingTileRequestsWhileZooming,this.setAnisotropicFilterPitch(e.anisotropicFilterPitch),void 0!==e.reduceMotion&&(Z_.prefersReducedMotion=e.reduceMotion),this._requestManager=new J_(e.transformRequest),this._container=this._resolveContainer(e.container),e.maxBounds&&this.setMaxBounds(e.maxBounds),this._setupContainer();try{this._setupPainter()}catch(t){throw this._cleanupContainer(),t}this._imageQueueHandle=X_.addThrottleControl((()=>this.isMoving())),this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),this.on("terrain",(()=>{this.painter.markTerrainDepthDirty(),this._update(!0)})),this.once("idle",(()=>this._idleTriggered=!0)),this._handlers=new RM(this,this._camera,e),typeof window<"u"&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,!1),this._setupResizeObserver()),this._hash=e.hash?new qD("string"==typeof e.hash&&e.hash||void 0).addTo(this):void 0,this._hash?._onHashChange()||(this.jumpTo({center:e.center,elevation:e.elevation,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch,roll:e.roll}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,Et({},e.fitBoundsOptions,{duration:0}))));let i="string"==typeof e.style||"globe"!==e.style?.projection?.type;this.resize(null,i),this._localIdeographFontFamily=e.localIdeographFontFamily,this._validateStyle=e.validateStyle,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new LM("boolean"==typeof e.attributionControl?void 0:e.attributionControl)),e.maplibreLogo&&this.addControl(new UM,e.logoPosition),this.on("style.load",(()=>{if(i||this._resizeTransform(),this._camera.transform.unmodified){let t=At(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(t)}})),this.on("data",(t=>{this._update("style"===t.dataType),this.fire("style"===t.dataType?new eg("styledata",t):new ig("sourcedata",t))})),this.on("dataloading",(t=>{this.fire("style"===t.dataType?new eg("styledataloading",t):new ig("sourcedataloading",t))})),this.on("dataabort",(t=>{this.fire(new ig("sourcedataabort",t))}))}_getMapId(){return this._mapId}setGlobalStateProperty(t,e){return this.style.setGlobalStateProperty(t,e),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(t,e){if(void 0===e&&(e=t.getDefaultPosition?t.getDefaultPosition():"top-right"),!t?.onAdd)return this.fire(new ge(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let i=t.onAdd(this);this._controls.push(t);let r=this._controlPositions[e];return e.includes("bottom")?r.insertBefore(i,r.firstChild):r.appendChild(i),this}removeControl(t){if(!t?.onRemove)return this.fire(new ge(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let e=this._controls.indexOf(t);return e>-1&&this._controls.splice(e,1),t.onRemove(this),this}hasControl(t){return this._controls.includes(t)}coveringTiles(t){return Vy(this._camera.transform,t)}setTransformCameraUpdate(t){this._camera.transformCameraUpdate=t}getCenter(){return new Ou(this._camera.transform.center.lng,this._camera.transform.center.lat)}setCenter(t,e){return this._camera.setCenter(t,e),this}getCenterElevation(){return this._camera.transform.elevation}setCenterElevation(t,e){return this._camera.setCenterElevation(t,e),this}setCenterClampedToGround(t){this._camera.setCenterClampedToGround(t)}panBy(t,e,i){return this._camera.panBy(t,e,i),this}panTo(t,e,i){return this._camera.panTo(t,e,i),this}getZoom(){return this._camera.transform.zoom}setZoom(t,e){return this._camera.setZoom(t,e),this}zoomTo(t,e,i){return this._camera.zoomTo(t,e,i),this}zoomIn(t,e){return this._camera.zoomIn(t,e),this}zoomOut(t,e){return this._camera.zoomOut(t,e),this}getVerticalFieldOfView(){return this._camera.transform.fov}setVerticalFieldOfView(t,e){return this._camera.setVerticalFieldOfView(t,e),this}getBearing(){return this._camera.transform.bearing}setBearing(t,e){return this._camera.setBearing(t,e),this}getZoomSnap(){return this._camera.getZoomSnap()}setZoomSnap(t){return this._camera.setZoomSnap(t),this}getPadding(){return this._camera.transform.padding}setPadding(t,e){return this._camera.setPadding(t,e),this}rotateTo(t,e,i){return this._camera.rotateTo(t,e,i),this}resetNorth(t,e){return this._camera.resetNorth(t,e),this}resetNorthPitch(t,e){return this._camera.resetNorthPitch(t,e),this}snapToNorth(t,e){return this._camera.snapToNorth(t,e),this}getPitch(){return this._camera.transform.pitch}setPitch(t,e){return this._camera.setPitch(t,e),this}getRoll(){return this._camera.transform.roll}setRoll(t,e){return this._camera.setRoll(t,e),this}cameraForBounds(t,e){return this._camera.cameraForBounds(t,e)}fitBounds(t,e,i){return this._camera.fitBounds(t,e,i),this}fitScreenCoordinates(t,e,i,r,n){return this._camera.fitScreenCoordinates(t,e,i,r,n),this}jumpTo(t,e){return this._camera.jumpTo(t,e),this}calculateCameraOptionsFromCameraLngLatAltRotation(t,e,i,r,n){return this._camera.calculateCameraOptionsFromCameraLngLatAltRotation(t,e,i,r,n)}easeTo(t,e){return this._camera.easeTo(t,e),this}flyTo(t,e){return this._camera.flyTo(t,e),this}stop(){return this._camera.stop(),this}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLat(Ou.convert(t),this._camera.transform):null}getCenterClampedToGround(){return this._camera.getCenterClampedToGround()}calculateCameraOptionsFromTo(t,e,i,r){return null==r&&this.terrain&&(r=this.terrain.getElevationForLngLat(i,this._camera.transform)),this._camera.transform.calculateCameraOptionsFromTo(t,e,i,r??0)}resize(t,e=!0){if(null!==this._lostContextStyle.style)return this;this._resizeInternal(e);let i=!this._camera._moving;return i&&(this.stop(),this.fire(new Q_("movestart",t)).fire(new Q_("move",t))),this.fire(new K_("resize",t)),i&&this.fire(new Q_("moveend",t)),this}_resizeInternal(t=!0){let[e,i]=this._containerDimensions(),r=this._getClampedPixelRatio(e,i);if(this._resizeCanvas(e,i,r),this.painter.resize(e,i,r),this.painter.overLimit()){let t=this.painter.context.gl;this._maxCanvasSize=[t.drawingBufferWidth,t.drawingBufferHeight];let r=this._getClampedPixelRatio(e,i);this._resizeCanvas(e,i,r),this.painter.resize(e,i,r)}this._resizeTransform(t)}_resizeTransform(t=!0){let[e,i]=this._containerDimensions();this._camera.transform.resize(e,i,t),this._camera._requestedCameraState?.resize(e,i,t)}_getClampedPixelRatio(t,e){let{0:i,1:r}=this._maxCanvasSize,n=this.getPixelRatio(),s=t*n,o=e*n,a=Math.min(s>i?i/s:1,o>r?r/o:1);return a<1&&Rt("The canvas is larger than maxCanvasSize and is rendered at a lower pixel ratio to fit. Increase maxCanvasSize, within MAX_TEXTURE_SIZE, to render at full resolution."),a*n}getPixelRatio(){return this._overridePixelRatio??devicePixelRatio}setPixelRatio(t){this._overridePixelRatio=t,this.resize()}getBounds(){return this._camera.transform.getBounds()}getMaxBounds(){return this._camera.transform.getMaxBounds()}setMaxBounds(t){return this._camera.transform.setMaxBounds(oy.convert(t)),this._update()}setMinZoom(t){if(t??=-2,t>=-2&&t<=this._camera.transform.maxZoom){let e=this._camera.transform.zoom,i=this._camera.getTransformForUpdate();return i.setMinZoom(t),this._camera.applyUpdatedTransform(i),this._update(),e!==this._camera.transform.zoom&&this.fire(new Q_("zoomstart")).fire(new Q_("zoom")).fire(new Q_("zoomend")).fire(new Q_("movestart")).fire(new Q_("move")).fire(new Q_("moveend")),this}throw Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(t=!1){let e=this._camera.transform;return t?e.applyConstrain(e.center,e.minZoom).zoom:e.minZoom}setMaxZoom(t){if(t??=22,t>=this._camera.transform.minZoom){let e=this._camera.transform.zoom,i=this._camera.getTransformForUpdate();return i.setMaxZoom(t),this._camera.applyUpdatedTransform(i),this._update(),e!==this._camera.transform.zoom&&this.fire(new Q_("zoomstart")).fire(new Q_("zoom")).fire(new Q_("zoomend")).fire(new Q_("movestart")).fire(new Q_("move")).fire(new Q_("moveend")),this}throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this._camera.transform.maxZoom}setMinPitch(t){if(t??=0,t<0)throw Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this._camera.transform.maxPitch){let e=this._camera.transform.pitch,i=this._camera.getTransformForUpdate();return i.setMinPitch(t),this._camera.applyUpdatedTransform(i),this._update(),e!==this._camera.transform.pitch&&this.fire(new Q_("pitchstart")).fire(new Q_("pitch")).fire(new Q_("pitchend")).fire(new Q_("movestart")).fire(new Q_("move")).fire(new Q_("moveend")),this}throw Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this._camera.transform.minPitch}setMaxPitch(t){if(t??=60,t>180)throw Error("maxPitch must be less than or equal to 180");if(t>=this._camera.transform.minPitch){let e=this._camera.transform.pitch,i=this._camera.getTransformForUpdate();return i.setMaxPitch(t),this._camera.applyUpdatedTransform(i),this._update(),e!==this._camera.transform.pitch&&this.fire(new Q_("pitchstart")).fire(new Q_("pitch")).fire(new Q_("pitchend")).fire(new Q_("movestart")).fire(new Q_("move")).fire(new Q_("moveend")),this}throw Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this._camera.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(t){if(t??=20,t>180)throw Error("anisotropicFilterPitch must be less than or equal to 180");if(t<0)throw Error("anisotropicFilterPitch must be greater than or equal to 0");return this._anisotropicFilterPitch=t,this._update()}getRenderWorldCopies(){return this._camera.transform.renderWorldCopies}setRenderWorldCopies(t){return this._camera.transform.setRenderWorldCopies(t),this._update()}setTransformConstrain(t){return this._camera.transform.setConstrainOverride(t),this._update()}project(t){return this._camera.transform.locationToScreenPoint(Ou.convert(t),this.style&&this.terrain)}unproject(t){return this._camera.transform.screenPointToLocation(u.convert(t),this.terrain)}isMoving(){return this._camera.isMoving()||this._handlers?.isMoving()||!1}isZooming(){return this._camera.isZooming()||this._handlers?.isZooming()||!1}isRotating(){return this._camera.isRotating()||this._handlers?.isRotating()||!1}_createDelegatedListener(t,e,i){if("mouseenter"===t||"mouseover"===t){let r=!1;return{layers:e,listener:i,delegates:{mousemove:n=>{let s=e.filter((t=>this.getLayer(t))),o=0===s.length?[]:this.queryRenderedFeatures(n.point,{layers:s});o.length?r||(r=!0,i.call(this,new rg(t,this,n.originalEvent,{features:o}))):r=!1},mouseout:()=>{r=!1}}}}if("mouseleave"===t||"mouseout"===t){let r=!1;return{layers:e,listener:i,delegates:{mousemove:n=>{let s=e.filter((t=>this.getLayer(t)));(0===s.length?[]:this.queryRenderedFeatures(n.point,{layers:s})).length?r=!0:r&&(r=!1,i.call(this,new rg(t,this,n.originalEvent)))},mouseout:e=>{r&&(r=!1,i.call(this,new rg(t,this,e.originalEvent)))}}}}{let r=t=>{let r=e.filter((t=>this.getLayer(t))),n=0===r.length?[]:this.queryRenderedFeatures(t.point,{layers:r});n.length&&(t.features=n,i.call(this,t),delete t.features)};return{layers:e,listener:i,delegates:{[t]:r}}}}_saveDelegatedListener(t,e){this._delegatedListeners||={},this._delegatedListeners[t]||=[],this._delegatedListeners[t].push(e)}_removeDelegatedListener(t,e,i){if(!this._delegatedListeners?.[t])return;let r=this._delegatedListeners[t];for(let t=0;t<r.length;t++){let n=r[t];if(n.listener===i&&n.layers.length===e.length&&n.layers.every((t=>e.includes(t)))){for(let t in n.delegates)this.off(t,n.delegates[t]);return void r.splice(t,1)}}}on(t,e,i){if(void 0===i)return super.on(t,e);let r="string"==typeof e?[e]:e,n=this._createDelegatedListener(t,r,i);this._saveDelegatedListener(t,n);for(let t in n.delegates)this.on(t,n.delegates[t]);return{unsubscribe:()=>{this._removeDelegatedListener(t,r,i)}}}once(t,e,i){if(void 0===i)return super.once(t,e);let r="string"==typeof e?[e]:e,n=this._createDelegatedListener(t,r,i);for(let e in n.delegates){let s=n.delegates[e];n.delegates[e]=(...e)=>{this._removeDelegatedListener(t,r,i),s(...e)}}this._saveDelegatedListener(t,n);for(let t in n.delegates)this.once(t,n.delegates[t]);return this}off(t,e,i){return void 0===i?super.off(t,e):(this._removeDelegatedListener(t,"string"==typeof e?[e]:e,i),this)}queryRenderedFeatures(t,e){if(!this.style)return[];let i,r=t instanceof u||Array.isArray(t),n=r?t:[[0,0],[this._camera.transform.width,this._camera.transform.height]];if(e||=(r?{}:t)||{},n instanceof u||"number"==typeof n[0])i=[u.convert(n)];else{let t=u.convert(n[0]),e=u.convert(n[1]);i=[t,new u(e.x,t.y),e,new u(t.x,e.y),t]}return this.style.queryRenderedFeatures(i,e,this._camera.transform)}querySourceFeatures(t,e){return this.style.querySourceFeatures(t,e)}setStyle(t,e){return e=Et({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},e),this._styleUrl="string"==typeof t?t:null,!1!==e.diff&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&t?(this._diffStyle(t,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(t,e))}setTransformRequest(t){return this._requestManager.setTransformRequest(t),this}_getUIString(t){let e=this._locale[t];if(null==e)throw Error(`Missing UI string '${t}'`);return e}_updateStyle(t,e){if(this._diffStyleRequest?.abort(),this._diffStyleRequest=null,e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(t,e)));let i=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!t)),t?(this.style=new hb(this,e||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof t?this.style.loadURL(t,e,i):this.style.loadJSON(t,e,i),this):(this._frameRequest&&=(this._frameRequest.abort(),null),this.style?.projection?.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new hb(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}async _diffStyle(t,e){if(this._diffStyleRequest?.abort(),"string"==typeof t){let i=t;this._diffStyleRequest=new AbortController;let r=this._diffStyleRequest;try{let t=await this._requestManager.transformRequest(i,"Style");if(r.signal.aborted)return void(this._diffStyleRequest=null);let n=await ce(t,r);this._diffStyleRequest=null,this._updateDiff(n.data,e)}catch(t){this._diffStyleRequest=null,re(t)||this.fire(new ge(nt(t)))}}else"object"==typeof t&&(this._diffStyleRequest=null,this._updateDiff(t,e))}_updateDiff(t,e){try{this.style.setState(t,e)&&this._update(!0)}catch(i){Rt(`Unable to perform style diff: ${nt(i).message}. Rebuilding the style from scratch.`),this._updateStyle(t,e)}}getStyle(){if(this.style)return this.style.serialize()}getStyleUrl(){return this._styleUrl}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){if(this.style)return this.style.loaded();Rt("There is no style added to the map.")}addSource(t,e){return this._lazyInitEmptyStyle(),this.style.addSource(t,e),this._update(!0)}isSourceLoaded(t){let e=this.style?.tileManagers[t];if(void 0!==e)return e.loaded();this.fire(new ge(Error(`There is no tile manager with ID '${t}'`)))}setTerrain(t,e={}){if(this.style._checkLoaded(),t&&Js(this,Ws.terrain,{value:t},e))return this;if(this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),t){let e=this.style.tileManagers[t.source];if(!e)throw Error(`cannot load terrain, because there exists no source with ID: ${t.source}`);null===this.terrain&&e.reload();for(let e in this.style._layers){let i=this.style._layers[e];"hillshade"===i.type&&i.source===t.source&&Rt("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),"color-relief"===i.type&&i.source===t.source&&Rt("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain&&this.terrain.destroy(),this.terrain=new yw(this.painter,e,t,this._terrainSkirtLength),this.painter.renderToTexture=new ZM(this.painter,this.terrain),this._camera.terrain=this.terrain,this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform)),this._terrainDataCallback=e=>this._handleTerrainDataEvent(e,t.source),this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture=null,this.painter.destroyRTTResources(),this._camera.terrain=null,this._camera.transform.setMinElevationForCurrentTile(0),this.getCenterClampedToGround()&&this._camera.transform.setElevation(0);return this.style.triggerSymbolPlacement(),this.fire(new ag({terrain:t})),this}_handleTerrainDataEvent(t,e){if("style"===t.dataType)return void this.terrain.tileManager.releaseAllRTT();let i=t.sourceId===e;if(i&&(this.terrain.resetElevationCache(),this.style.triggerSymbolPlacement()),i&&t.tile&&this.painter.markTerrainDepthDirty(),i&&t.tile&&!this._camera.elevationFreeze&&(this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),this.getCenterClampedToGround()&&this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform))),t.tile){if("image"===t.source?.type)return void this.terrain.tileManager.releaseAllRTT();this.terrain.tileManager.releaseRTT(t.tile.tileID)}}getTerrain(){return this.terrain?.options??null}areTilesLoaded(){let t=this.style?.tileManagers;for(let e of Object.values(t))if(!e.areTilesLoaded())return!1;return!0}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style?.getSource(t)}setSourceTileLodParams(t,e,i){if(i){let r=this.getSource(i);if(!r)throw Error(`There is no source with ID "${i}", cannot set LOD parameters`);r.calculateTileZoom=Ny(Math.max(1,t),Math.max(1,e))}else for(let i in this.style.tileManagers)this.style.tileManagers[i].getSource().calculateTileZoom=Ny(Math.max(1,t),Math.max(1,e));return this._update(!0),this}refreshTiles(t,e){let i=this.style.tileManagers[t];if(!i)throw Error(`There is no tile manager with ID "${t}", cannot refresh tile`);void 0===e?i.reload(!0):i.refreshTiles(e.map((t=>new hd(t.z,t.x,t.y))))}addImage(t,e,i={}){this._lazyInitEmptyStyle();let r=this._createStyleImage(e,i);return r?(this.style.addImage(t,r),r.userImage?.onAdd&&r.userImage.onAdd(this,t),this):this}setMissingStyleImageResolver(t){return this._missingStyleImageResolver=t,this.style?.setMissingImageResolver(t),this}_createStyleImage(t,e={}){let{pixelRatio:i=1,sdf:r=!1,stretchX:n,stretchY:s,content:o,textFitWidth:a,textFitHeight:l}=e;if(t instanceof HTMLImageElement||Nt(t)){let{width:e,height:h,data:u}=Z_.getImageData(t);return{data:new sh({width:e,height:h},u),pixelRatio:i,stretchX:n,stretchY:s,content:o,textFitWidth:a,textFitHeight:l,sdf:r,version:0}}if(void 0===t.width||void 0===t.height)return this.fire(new ge(Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`"))),null;{let{width:e,height:h,data:u}=t,c=t,f=Rf(c.data);return{data:f?new sh({width:e,height:h}):new sh({width:e,height:h},new Uint8Array(u)),pixelRatio:i,stretchX:n,stretchY:s,content:o,textFitWidth:a,textFitHeight:l,sdf:r,version:0,isWebGLImage:f,userImage:c}}}updateImage(t,e){let i=this.style.getImage(t);if(!i)return this.fire(new ge(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let{width:r,height:n,data:s}=e instanceof HTMLImageElement||Nt(e)?Z_.getImageData(e):e;if(void 0===r||void 0===n)return this.fire(new ge(Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(r!==i.data.width||n!==i.data.height)return this.fire(new ge(Error("The width and height of the updated image must be that same as the previous version of the image")));if(i.isWebGLImage=Rf(s),i.isWebGLImage)i.userImage=e;else{let t=!(e instanceof HTMLImageElement||Nt(e));i.data.replace(s,t)}return this.style.updateImage(t,i),this}getImage(t){return this.style.getImage(t)}hasImage(t){return t?!!this.style.getImage(t):(this.fire(new ge(Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}async loadImage(t){let e=await X_.getImage(await this._requestManager.transformRequest(t,"Image"),new AbortController);if(!e.data)throw Error(`Could not load image ${t}: the response is empty`);return e}listImages(){return this.style?.listImages()??[]}addLayer(t,e){return this._lazyInitEmptyStyle(),this.style.addLayer(t,e),this._update(!0)}moveLayer(t,e){return this.style.moveLayer(t,e),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style?.getLayer(t)}getLayersOrder(){return this.style?.getLayersOrder()??[]}setLayerZoomRange(t,e,i){return this.style.setLayerZoomRange(t,e,i),this._update(!0)}setFilter(t,e,i={}){return this.style?.setFilter(t,e,i),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,e,i,r={}){return this.style?.setPaintProperty(t,e,i,r),this._update(!0)}getPaintProperty(t,e){return this.style.getPaintProperty(t,e)}setLayoutProperty(t,e,i,r={}){return this.style.setLayoutProperty(t,e,i,r),this._update(!0)}getLayoutProperty(t,e){return this.style.getLayoutProperty(t,e)}setGlyphs(t,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(t,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}setFontFaces(t){return this._lazyInitEmptyStyle(),this.style.setFontFaces(t),this._update(!0)}getFontFaces(){return this.style.getFontFaces()}addSprite(t,e,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(t,e,i,(t=>{t||this._update(!0)})),this}removeSprite(t){return this._lazyInitEmptyStyle(),this.style.removeSprite(t),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(t,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(t,e,(t=>{t||this._update(!0)})),this}setLight(t,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(t,e={}){return this._lazyInitEmptyStyle(),this.style.setSky(t,e),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(t,e){return this.style.setFeatureState(t,e),this._update()}removeFeatureState(t,e){return this.style.removeFeatureState(t,e),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,e=0;return this._container&&(t=this._container.clientWidth||400,e=this._container.clientHeight||300),[t,e]}_shouldHandleInitialResize(){if(!this._container?.clientWidth||!this._container.clientHeight)return!1;let[t,e]=this._containerDimensions();return t!==this._camera.transform.width||e!==this._camera.transform.height}_setupResizeObserver(){let t=!1,e=GD((t=>{this._trackResize&&!this._removed&&(this.resize(t),this.redraw())}),50),i=this._ownerWindow.ResizeObserver??ResizeObserver;this._resizeObserver=new i((i=>{!t&&(t=!0,!this._shouldHandleInitialResize())||e(i)})),this._resizeObserver.observe(this._container)}_resolveContainer(t){if("string"==typeof t){let e=document.getElementById(t);if(!e)throw Error(`Container '${t}' not found.`);return e}if(t instanceof HTMLElement||t&&"object"==typeof t&&1===t.nodeType)return t;throw Error("Invalid type: 'container' must be a String or HTMLElement.")}_setupContainer(){let t=this._containerDimensions(),e=this._getClampedPixelRatio(t[0],t[1]),i=this._container;i.classList.add("maplibregl-map");let r=this._canvasContainer=Y_.create("div","maplibregl-canvas-container",i);this._interactive&&r.classList.add("maplibregl-interactive"),this._canvas=Y_.create("canvas","maplibregl-canvas",r),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._resizeCanvas(t[0],t[1],e);let n=this._controlContainer=Y_.create("div","maplibregl-control-container",i),s=this._controlPositions={};for(let t of["top-left","top-right","bottom-left","bottom-right"])s[t]=Y_.create("div",`maplibregl-ctrl-${t} `,n);this._container.addEventListener("scroll",this._onMapScroll,!1)}_cleanupContainer(){this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map")}_resizeCanvas(t,e,i){this._canvas.width=Math.floor(i*t),this._canvas.height=Math.floor(i*e),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${e}px`}_setupPainter(){let t={...this._canvasContextAttributes,alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0},e=null;this._canvas.addEventListener("webglcontextcreationerror",(t=>{e=t}),{once:!0});let i=this._canvas.getContext("webgl2",t);if(!i)throw new ND(t,e);this.painter=new UD(i,this._camera.transform)}migrateProjection(t,e){this._camera.migrateProjection(t,e),this.painter.transform=t,this.fire(new lg({newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){return this.style?._loaded?(this._styleDirty||=t,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t)}_render(t){let e=this._idleTriggered?this._fadeDuration:0,i=this.style.projection?.transitionState>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(t),this._removed)return;let r=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let t=this._camera.transform.zoom,i=H_();this.style.zoomHistory.update(t,i);let n=new ao(t,{now:i,fadeDuration:e,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),s=n.crossFadingFactor();(1!==s||s!==this._crossFadingFactor)&&(r=!0,this._crossFadingFactor=s),this.style.update(n)}let n=this.style.projection?.transitionState>0!==i;this._camera.transform.setTransitionState(this.style.projection?.transitionState),this.style&&(this._sourcesDirty||n)&&(this._sourcesDirty=!1,this.style._updateSources(this._camera.transform)),this.terrain?(this.terrain.tileManager.update(this._camera.transform,this.terrain)&&this.terrain.resetElevationCache(),this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),!this._camera.elevationFreeze&&this.getCenterClampedToGround()&&this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform))):(this._camera.transform.setMinElevationForCurrentTile(0),this.getCenterClampedToGround()&&this._camera.transform.setElevation(0)),this._placementDirty=this.style?._updatePlacement(this._camera.transform,this.showCollisionBoxes,e,this._crossSourceCollisions,n),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:e,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new K_("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new K_("load"))),this.style&&(this.style.hasTransitions()||r)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let s=this._sourcesDirty||this._styleDirty||this._placementDirty||this.painter.renderToTexture?.needsFollowUpFrame;return s||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new K_("idle")),this._loaded&&!this._fullyLoaded&&!s&&(this._fullyLoaded=!0),this}redraw(){return this.style&&(this._frameRequest&&=(this._frameRequest.abort(),null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(let t of this._controls)t.onRemove(this);this._controls=[],this._frameRequest&&=(this._frameRequest.abort(),null),this._renderTaskQueue.clear(),this._diffStyleRequest?.abort(),this.painter.destroy(),this._handlers.destroy(),this.setStyle(null),typeof window<"u"&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,!1),X_.removeThrottleControl(this._imageQueueHandle),this._resizeObserver?.disconnect();let t=this.painter.context.gl.getExtension("WEBGL_lose_context");t?.loseContext&&t.loseContext(),this._cleanupContainer(),this._removed=!0,this.fire(new K_("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,Z_.frame(this._frameRequest,(t=>{this._frameRequest=null;try{this._render(t)}catch(t){if(!re(t))throw t}}),(()=>{}),this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())}get showPadding(){return!!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())}get repaint(){return!!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(t){this._vertices=t,this._update()}get version(){return"6.10.0"}getCameraTargetElevation(){return this._camera.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(t){return this._lazyInitEmptyStyle(),this.style.setProjection(t),this._update(!0)}},XM=t||e,JM=XM.Layer.extend({options:{updateInterval:32,padding:.1,interactive:!1,pane:"tilePane"},initialize:function(t){XM.setOptions(this,t),this._throttledUpdate=XM.Util.throttle(this._update,this.options.updateInterval,this)},onAdd:function(t){this._container||this._initContainer();var e=this.getPaneName();t.getPane(e).appendChild(this._container),this._initGL(),this._offset=this._map.containerPointToLayerPoint([0,0]),t.options.zoomAnimation&&XM.DomEvent.on(t._proxy,XM.DomUtil.TRANSITION_END,this._transitionEnd,this)},onRemove:function(t){this._map._proxy&&this._map.options.zoomAnimation&&XM.DomEvent.off(this._map._proxy,XM.DomUtil.TRANSITION_END,this._transitionEnd,this);var e=this.getPaneName();t.getPane(e).removeChild(this._container),this._glMap.remove(),this._glMap=null},getEvents:function(){return{move:this._throttledUpdate,zoomanim:this._animateZoom,zoom:this._pinchZoom,zoomstart:this._zoomStart,zoomend:this._zoomEnd,resize:this._resize}},getAttribution:function(){if(this.options.attributionControl)return this.options.attributionControl.customAttribution;var t=this._glMap;if(t&&!1!==this.options.attributionControl){var e=t.getStyle();if(e&&e.sources)return Object.keys(e.sources).map((function(e){var i=t.getSource(e);return i&&"string"==typeof i.attribution?i.attribution.trim():null})).filter(Boolean).join(", ")}return""},getMaplibreMap:function(){return this._glMap},getCanvas:function(){return this._glMap.getCanvas()},getSize:function(){return this._map.getSize().multiplyBy(1+2*this.options.padding)},getBounds:function(){var t=this.getSize().multiplyBy(.5),e=this._map.latLngToContainerPoint(this._map.getCenter());return XM.latLngBounds(this._map.containerPointToLatLng(e.subtract(t)),this._map.containerPointToLatLng(e.add(t)))},getContainer:function(){return this._container},getPaneName:function(){return this._map.getPane(this.options.pane)?this.options.pane:"tilePane"},_roundPoint:function(t){return{x:Math.round(t.x),y:Math.round(t.y)}},_initContainer:function(){var t=this._container=XM.DomUtil.create("div","leaflet-gl-layer");this._resizeContainer();var e=this._map.getSize().multiplyBy(this.options.padding),i=this._map.containerPointToLayerPoint([0,0]).subtract(e);XM.DomUtil.setPosition(t,this._roundPoint(i))},_resizeContainer:function(){var t=this.getSize();this._container.style.width=t.x+"px",this._container.style.height=t.y+"px"},_initGL:function(){var t=this._map.getCenter(),e=XM.extend({},this.options,{container:this._container,center:[t.lng,t.lat],zoom:this._map.getZoom()-1,attributionControl:!1});this._glMap=new YM(e);var i=this._map,r=this.getAttribution(),n=this.getAttribution.bind(this);if(this._glMap.on("load",(function(){i&&i.attributionControl&&(i.attributionControl.removeAttribution(r),i.attributionControl.addAttribution(n()))})),this._glMap.setTransformConstrain)this._glMap.setTransformConstrain((function(t,e){return{center:t,zoom:e}}));else{var s=this._glMap.transform,o=Object.getPrototypeOf(s),a=Object.getOwnPropertyDescriptor(o,"latRange");(!a||a.set||a.writable)&&(s.latRange=null);var l=Object.getOwnPropertyDescriptor(o,"maxValidLatitude");(!l||l.set||l.writable)&&(s.maxValidLatitude=1/0),s._helper&&s._helper._latRange&&(s._helper._latRange=[-1/0,1/0])}this._transformGL(this._glMap),this._glMap._actualCanvas=this._glMap._canvas.canvas?this._glMap._canvas.canvas:this._glMap._canvas;var h=this._glMap._actualCanvas;XM.DomUtil.addClass(h,"leaflet-image-layer"),XM.DomUtil.addClass(h,"leaflet-zoom-animated"),this.options.interactive&&XM.DomUtil.addClass(h,"leaflet-interactive"),this.options.className&&XM.DomUtil.addClass(h,this.options.className)},_update:function(){if(this._map&&(this._offset=this._map.containerPointToLayerPoint([0,0]),!this._zooming)){var t=this._container,e=this._glMap,i=this._map.getSize().multiplyBy(this.options.padding),r=this._map.containerPointToLayerPoint([0,0]).subtract(i);XM.DomUtil.setPosition(t,this._roundPoint(r)),this._transformGL(e)}},_transformGL:function(t){var e=this._map.getCenter();t.jumpTo({center:[e.lng,e.lat],zoom:this._map.getZoom()-1})},_pinchZoom:function(){this._glMap.jumpTo({zoom:this._map.getZoom()-1,center:this._map.getCenter()})},_animateZoom:function(t){var e=this._map.getZoomScale(t.zoom),i=this._map.getSize().multiplyBy(this.options.padding*e),r=this.getSize()._divideBy(2),n=this._map.project(t.center,t.zoom)._subtract(r)._add(this._map._getMapPanePos().add(i))._round(),s=this._map.project(this._map.getBounds().getNorthWest(),t.zoom)._subtract(n);XM.DomUtil.setTransform(this._glMap._actualCanvas,s.subtract(this._offset),e)},_zoomStart:function(){this._zooming=!0},_zoomEnd:function(){var t=this._map.getZoomScale(this._map.getZoom());XM.DomUtil.setTransform(this._glMap._actualCanvas,null,t),this._zooming=!1,this._update()},_transitionEnd:function(){XM.Util.requestAnimFrame((function(){var t=this._map.getZoom(),e=this._map.getCenter(),i=this._map.latLngToContainerPoint(this._map.getBounds().getNorthWest());this._resizeContainer(),XM.DomUtil.setTransform(this._glMap._actualCanvas,i,1),this._glMap.once("moveend",XM.Util.bind((function(){this._zoomEnd()}),this)),this._glMap.jumpTo({center:e,zoom:t-1})}),this)},_resize:function(t){this._transitionEnd(t)}}),KM=function(t){return new JM(t)};Object.isExtensible(XM)&&(XM.MaplibreGL=JM,XM.maplibreGL=KM);export{JM as MaplibreGL,KM as default,KM as maplibreGL}
|