diff --git a/.gitignore b/.gitignore index 8b9a85c..4a0333d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /data/overture_maps/* +/data/daylight/* /data/output/geojson/* /data/output/geoparquet/* /data/output/pmtiles/* @@ -14,6 +15,7 @@ lerna-debug.log* viewer/node_modules viewer/dist/overture.pmtiles +viewer/dist/daylight.pmtiles viewer/dist-ssr *.local diff --git a/README.md b/README.md index fe8a0d1..34f2609 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ Playing around with data from OvertureMaps. -- Download OvertureMaps data -- Extract data from OvertureMaps for a country and convert to geoparquet +- Download OvertureMaps and Daylight data +- Extract data from OvertureMaps and Daylight for a country and convert to geoparquet - Create PMTiles from extracted data - Notebook with some queries and a map to display some data @@ -70,7 +70,7 @@ In our test we don't want to do the whole world so we create some bounds, in thi The following script will create geoparquet files for all overture-maps themes with only data inside our given bounds, for pmtiles we don't need geoparquet but it's nice to have anyways. This can take some time, no fancy things are done such as spatial partitioning/indexing. ```sh -./scripts/convert/to_geoparquet.sh +./scripts/convert/overture/to_geoparquet.sh ``` ### Create GeoJSON @@ -78,7 +78,7 @@ The following script will create geoparquet files for all overture-maps themes w For the PMTiles creation we need GeoJSON files, the script `parquet_to_geojson.sh` creates geojson files for each theme from our geoparquet files which than can feeded into tippecanoe. Not every field is added to the GeoJSON feature properties at the moment. ```sh -./scripts/convert/parquet_to_geojson.sh +./scripts/convert/overture/parquet_to_geojson.sh ``` ### Create PMTiles @@ -86,7 +86,7 @@ For the PMTiles creation we need GeoJSON files, the script `parquet_to_geojson.s When we have the GeoJSON files we can create our PMTiles using tippecanoe and pmtiles. ```sh -./scripts/convert/geojson_to_pmtiles.sh +./scripts/convert/overture/geojson_to_pmtiles.sh ``` This will create mbtiles for each theme, merge them and convert to PMTiles. Directly creating pmtiles with tippecanoe resulted in a PMTiles V2 file which could not be converted to v3, therefore mbtiles are created and later converted into PMTiles using `pmtiles convert` diff --git a/data/images/pmtiles.jpg b/data/images/pmtiles.jpg index 71da24f..9d4065f 100644 Binary files a/data/images/pmtiles.jpg and b/data/images/pmtiles.jpg differ diff --git a/scripts/convert/daylight/geojson_to_pmtiles.sh b/scripts/convert/daylight/geojson_to_pmtiles.sh new file mode 100755 index 0000000..e554865 --- /dev/null +++ b/scripts/convert/daylight/geojson_to_pmtiles.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +INPUT_PATH="./data/output/geojson" +OUTPUT_PATH="./data/output/pmtiles" + +# When creating pmtiles with tippecanoe we get Version 2 of PMTiles +# converting using pmtiles convert gives us an error +# first create mbtiles using tippecanoe and convert mbtiles to pmtiles +# using pmtiles CLI, this results in PMTiles V3 + +############################# +## WATER +############################# +echo "Generating water.mbtiles" +tippecanoe -Z6 -z12 --projection=EPSG:4326 -o $OUTPUT_PATH/water.mbtiles -l water \ + --detect-shared-borders \ + --drop-smallest-as-needed \ + -j '{ "*": [ "any", [ "in", "class", "river", "ocean", "lake" ], [ "all", [ ">=", "$zoom", 9 ], [ "in", "class", "stream" ]], [ ">=", "$zoom", 12]] }' \ + $INPUT_PATH/water.geojson \ + --force + +############################# +## LAND +############################# +echo "Generating land.mbtiles" +tippecanoe -Z4 -z12 --projection=EPSG:4326 -o $OUTPUT_PATH/land.mbtiles -l land \ + --detect-shared-borders \ + --drop-smallest-as-needed \ + -j '{ "*": [ "any", [ "in", "class", "glacier" ], [ "all", [ ">=", "$zoom", 5 ], [ "in", "class", "forest", "sand" ]], [ "all", [ ">=", "$zoom", 7 ], [ "in", "class", "reef", "wetland" ]], [ "all", [ ">=", "$zoom", 9 ], [ "in", "class", "grass", "scrub" ]], [ ">=", "$zoom", 12]] }' \ + $INPUT_PATH/land.geojson \ + --force + +############################# +## LANDUSE +############################# +echo "Generating landuse.mbtiles" +tippecanoe -Z10 -z12 --projection=EPSG:4326 -o $OUTPUT_PATH/landuse.mbtiles -l landuse \ + --detect-shared-borders \ + --drop-smallest-as-needed \ + -j '{ "*": [ "any", [ "all", [ ">=", "$zoom", 10 ], [ "in", "class", "agriculture", "protected" ]], [ "all", [ ">=", "$zoom", 11 ], [ "in", "class", "park", "airport" ]], [ ">=", "$zoom", 12]] }' \ + $INPUT_PATH/landuse.geojson \ + --force + +############################# +## PLACENAME +############################# +echo "Generating placename.mbtiles" +tippecanoe -Z2 -z12 -B6 --projection=EPSG:4326 -o $OUTPUT_PATH/placename.mbtiles -l placename \ + -j '{ "*": [ "any", [ "in", "subclass", "megacity", "metropolis" ], [ "all", [ ">=", "$zoom", 3 ], [ "in", "subclass", "city", "municipality" ]], [ "all", [ ">=", "$zoom", 9 ], [ "in", "subclass", "town", "hamlet", "vilage" ]], [ ">=", "$zoom", 12]] }' \ + $INPUT_PATH/placename.geojson \ + --force + +# join all mbtiles into 1 big file +echo "merge tiles" +tile-join -pk -o $OUTPUT_PATH/daylight.mbtiles $OUTPUT_PATH/water.mbtiles $OUTPUT_PATH/land.mbtiles $OUTPUT_PATH/landuse.mbtiles $OUTPUT_PATH/placename.mbtiles --force + +# tippecanoe outputs pmtiles V2, we want v3 +echo "convert mbtiles to pmtiles" +pmtiles convert $OUTPUT_PATH/daylight.mbtiles $OUTPUT_PATH/daylight.pmtiles + +echo "Cleaning up intermediate files" +# remove mbtiles file +rm $OUTPUT_PATH/water.mbtiles +rm $OUTPUT_PATH/land.mbtiles +rm $OUTPUT_PATH/landuse.mbtiles +rm $OUTPUT_PATH/placename.mbtiles +rm $OUTPUT_PATH/daylight.mbtiles + +# copy pmtiles to the viewer +cp $OUTPUT_PATH/daylight.pmtiles ./viewer/dist/daylight.pmtiles + +echo "Finished!" \ No newline at end of file diff --git a/scripts/convert/daylight/parquet_to_geojson.sh b/scripts/convert/daylight/parquet_to_geojson.sh new file mode 100755 index 0000000..ca0c69b --- /dev/null +++ b/scripts/convert/daylight/parquet_to_geojson.sh @@ -0,0 +1,83 @@ +#!/bin/bash + +# Create GeoJSON files from our geoparquet files which we can than +# use to generate PMTiles. Currently not all metadata is written +# to the GeoJSON files. + +INPUT_PATH="./data/output/geoparquet" +OUTPUT_PATH="./data/output/geojson" + +############################# +## WATER +############################# +# Very nice strings can be found in names... +duckdb -c """ + LOAD spatial; + COPY ( + SELECT + class, + subclass, + COALESCE(replace(json_extract(replace(replace(names, '\\\\\\\\', ''), '\\\\\"', '''')::json, '$.local'), '\"', '')::varchar, '') as name, + --COALESCE(replace(json_extract(metadata::json,'\$.wikidata'), '\"', '')::varchar, '') as wikidata, + ST_GeomFromWkb(geometry) AS geometry + FROM read_parquet('$INPUT_PATH/water_geo.parquet') + ) + TO '$OUTPUT_PATH/water.geojson' + WITH (FORMAT GDAL, DRIVER 'GeoJSON'); +""" +duckdb -c "" + +############################# +## PLACENAME +############################# +# Very nice strings can be found in names... +duckdb -c """ + LOAD spatial; + COPY ( + SELECT + class, + subclass, + COALESCE(replace(json_extract(names::json,'\$.local'), '\"', '')::varchar, '') as name, + ST_GeomFromWkb(geometry) AS geometry + FROM read_parquet('$INPUT_PATH/placename_geo.parquet') + ) + TO '$OUTPUT_PATH/placename.geojson' + WITH (FORMAT GDAL, DRIVER 'GeoJSON'); +""" +duckdb -c "" + +############################# +## LANDUSE +############################# +duckdb -c """ + LOAD spatial; + COPY ( + SELECT + class, + subclass, + COALESCE(replace(json_extract(replace(replace(names, '\\\\\\\\', ''), '\\\\\"', '''')::json, '$.local'), '\"', '')::varchar, '') as name, + ST_GeomFromWkb(geometry) AS geometry + FROM read_parquet('$INPUT_PATH/landuse_geo.parquet') + ) + TO '$OUTPUT_PATH/landuse.geojson' + WITH (FORMAT GDAL, DRIVER 'GeoJSON'); +""" +duckdb -c "" + +############################# +## LAND +############################# +duckdb -c """ + LOAD spatial; + COPY ( + SELECT + class, + subclass, + COALESCE(replace(json_extract(replace(replace(names, '\\\\\\\\', ''), '\\\\\"', '''')::json, '$.local'), '\"', '')::varchar, '') as name, + ST_GeomFromWkb(geometry) AS geometry + FROM read_parquet('$INPUT_PATH/land_geo.parquet') + ) + TO '$OUTPUT_PATH/land.geojson' + WITH (FORMAT GDAL, DRIVER 'GeoJSON'); +""" +duckdb -c "" \ No newline at end of file diff --git a/scripts/convert/daylight/parquet_to_geoparquet.sh b/scripts/convert/daylight/parquet_to_geoparquet.sh new file mode 100755 index 0000000..9603967 --- /dev/null +++ b/scripts/convert/daylight/parquet_to_geoparquet.sh @@ -0,0 +1,114 @@ +#!/bin/bash + +# Extract data from overture-maps data based on bounds and convert to geoparquet using gpq +# The extracts can be used for example in QGIS or as input to create GeoJSON files. +# +# ToDo: spatial partitioning? + +DAYLIGHT_DATA_PATH="./data/daylight" +OUTPUT_PATH="./data/output/geoparquet" +COUNTRY_BOUNDS_FILE="./scripts/convert/country_bounds.parquet" + +############################# +## THEME: WATER +############################# + +duckdb -c """ + INSTALL spatial; + LOAD spatial; + COPY ( + SELECT + a.geometry_id, + a.class, + a.subclass, + a.metadata, + a.original_source_tags, + a.names, + a.quadkey, + ST_AsWKB(ST_GeomFromText(a.wkt)) as geometry, + a.theme + FROM read_parquet('$DAYLIGHT_DATA_PATH/theme=water/*', hive_partitioning=1) AS a, read_parquet('$COUNTRY_BOUNDS_FILE') AS b + WHERE ST_Intersects(ST_GeomFromText(a.wkt), ST_GeomFromWkb(b.geometry)) + ) + TO 'water.parquet' (FORMAT 'parquet'); +""" +gpq convert water.parquet $OUTPUT_PATH/water_geo.parquet --from=parquet --to=geoparquet +rm water.parquet + +############################# +## THEME: PLACENAME +############################# + +duckdb -c """ + INSTALL spatial; + LOAD spatial; + COPY ( + SELECT + a.geometry_id, + a.class, + a.subclass, + a.metadata, + a.original_source_tags, + a.names, + a.quadkey, + ST_AsWKB(ST_GeomFromText(a.wkt)) as geometry, + a.theme + FROM read_parquet('$DAYLIGHT_DATA_PATH/theme=placename/*', hive_partitioning=1) AS a, read_parquet('$COUNTRY_BOUNDS_FILE') AS b + WHERE ST_Intersects(ST_GeomFromText(a.wkt), ST_GeomFromWkb(b.geometry)) + ) + TO 'placename.parquet' (FORMAT 'parquet'); +""" +gpq convert placename.parquet $OUTPUT_PATH/placename_geo.parquet --from=parquet --to=geoparquet +rm placename.parquet + +############################# +## THEME: LANDUSE +############################# + +duckdb -c """ + INSTALL spatial; + LOAD spatial; + COPY ( + SELECT + a.geometry_id, + a.class, + a.subclass, + a.metadata, + a.original_source_tags, + a.names, + a.quadkey, + ST_AsWKB(ST_GeomFromText(a.wkt)) as geometry, + a.theme + FROM read_parquet('$DAYLIGHT_DATA_PATH/theme=landuse/*', hive_partitioning=1) AS a, read_parquet('$COUNTRY_BOUNDS_FILE') AS b + WHERE ST_Intersects(ST_GeomFromText(a.wkt), ST_GeomFromWkb(b.geometry)) + ) + TO 'landuse.parquet' (FORMAT 'parquet'); +""" +gpq convert landuse.parquet $OUTPUT_PATH/landuse_geo.parquet --from=parquet --to=geoparquet +rm landuse.parquet + +############################# +## THEME: LAND +############################# + +duckdb -c """ + INSTALL spatial; + LOAD spatial; + COPY ( + SELECT + a.geometry_id, + a.class, + a.subclass, + a.metadata, + a.original_source_tags, + a.names, + a.quadkey, + ST_AsWKB(ST_GeomFromText(a.wkt)) as geometry, + a.theme + FROM read_parquet('$DAYLIGHT_DATA_PATH/theme=land/*', hive_partitioning=1) AS a, read_parquet('$COUNTRY_BOUNDS_FILE') AS b + WHERE ST_Intersects(ST_GeomFromText(a.wkt), ST_GeomFromWkb(b.geometry)) + ) + TO 'land.parquet' (FORMAT 'parquet'); +""" +gpq convert land.parquet $OUTPUT_PATH/land_geo.parquet --from=parquet --to=geoparquet +rm land.parquet \ No newline at end of file diff --git a/scripts/convert/geojson_to_pmtiles.sh b/scripts/convert/overture/geojson_to_pmtiles.sh similarity index 68% rename from scripts/convert/geojson_to_pmtiles.sh rename to scripts/convert/overture/geojson_to_pmtiles.sh index c687079..3f9327f 100755 --- a/scripts/convert/geojson_to_pmtiles.sh +++ b/scripts/convert/overture/geojson_to_pmtiles.sh @@ -12,13 +12,19 @@ OUTPUT_PATH="./data/output/pmtiles" ## ADMINS ############################# echo "Generating admins.mbtiles" -tippecanoe -zg -z20 --projection=EPSG:4326 -o $OUTPUT_PATH/admins.mbtiles -l admins --drop-densest-as-needed $INPUT_PATH/admins.geojson --force +tippecanoe -Z0 -z16 --projection=EPSG:4326 -o $OUTPUT_PATH/admins.mbtiles -l admins \ + --detect-shared-borders \ + --drop-smallest-as-needed \ + $INPUT_PATH/admins.geojson --force ############################# ## BUILDINGS ############################# echo "Generating buildings.mbtiles" -tippecanoe -Z13 -z20 --projection=EPSG:4326 -o $OUTPUT_PATH/buildings.mbtiles -l buildings --drop-densest-as-needed $INPUT_PATH/buildings.geojson --force +tippecanoe -Z13 -z16 --projection=EPSG:4326 -o $OUTPUT_PATH/buildings.mbtiles -l buildings \ + --detect-shared-borders \ + --drop-smallest-as-needed \ + $INPUT_PATH/buildings.geojson --force ############################# ## ROADS @@ -33,13 +39,16 @@ tippecanoe -Z13 -z20 --projection=EPSG:4326 -o $OUTPUT_PATH/buildings.mbtiles -l # 3) [ ">=", "$zoom", 15]] # If zoom is greater than or equals to 15 return true = render everything after and at zoom 15 echo "Generating roads.mbtiles" -tippecanoe -Z5 -z20 -o $OUTPUT_PATH/roads.mbtiles --coalesce-smallest-as-needed -j '{ "*": [ "any", [ "in", "class", "motorway" ], [ "all", [ ">=", "$zoom", 9 ], [ "in", "class", "primary", "secondary" ]], [ "all", [ ">=", "$zoom", 11 ], [ "in", "class", "tertiary", "residential", "livingStreet" ]], [ ">=", "$zoom", 12]] }' -l roads $INPUT_PATH/roads.geojson --force +tippecanoe -Z5 -z16 -o $OUTPUT_PATH/roads.mbtiles -l roads \ + --detect-shared-borders \ + --drop-smallest-as-needed \ + --coalesce-smallest-as-needed -j '{ "*": [ "any", [ "in", "class", "motorway" ], [ "all", [ ">=", "$zoom", 9 ], [ "in", "class", "primary", "secondary" ]], [ "all", [ ">=", "$zoom", 11 ], [ "in", "class", "tertiary", "residential", "livingStreet" ]], [ ">=", "$zoom", 12]] }' -l roads $INPUT_PATH/roads.geojson --force ############################# ## PLACES ############################# echo "Generating places.mbtiles" -tippecanoe -Z14 -z20 --projection=EPSG:4326 -o $OUTPUT_PATH/places.mbtiles -l places $INPUT_PATH/places.geojson --force +tippecanoe -Z14 -z16 -B16 --projection=EPSG:4326 -o $OUTPUT_PATH/places.mbtiles -l places $INPUT_PATH/places.geojson --force # join all mbtiles into 1 big file diff --git a/scripts/convert/parquet_to_geojson.sh b/scripts/convert/overture/parquet_to_geojson.sh similarity index 100% rename from scripts/convert/parquet_to_geojson.sh rename to scripts/convert/overture/parquet_to_geojson.sh diff --git a/scripts/convert/parquet_to_geoparquet.sh b/scripts/convert/overture/parquet_to_geoparquet.sh similarity index 100% rename from scripts/convert/parquet_to_geoparquet.sh rename to scripts/convert/overture/parquet_to_geoparquet.sh diff --git a/scripts/download_daylight_data.sh b/scripts/download_daylight_data.sh new file mode 100755 index 0000000..da8c53d --- /dev/null +++ b/scripts/download_daylight_data.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# Set the local directory path +local_directory="./data/daylight" + +# Create the local directory if it doesn't exist +if [ ! -d "$local_directory" ]; then + mkdir -p "$local_directory" + echo "Created directory: $local_directory" +fi + +# Download using AWS CLI and S3 +source_bucket_water="s3://daylight-openstreetmap/earth/release=v1.29/theme=water" +source_bucket_placename="s3://daylight-openstreetmap/earth/release=v1.29/theme=placename" +source_bucket_land="s3://daylight-openstreetmap/earth/release=v1.29/theme=land" +source_bucket_landuse="s3://daylight-openstreetmap/earth/release=v1.29/theme=landuse" + +aws s3 cp --region us-west-2 --no-sign-request --recursive "$source_bucket_water" "$local_directory/theme=water" +aws s3 cp --region us-west-2 --no-sign-request --recursive "$source_bucket_placename" "$local_directory/theme=placename" +aws s3 cp --region us-west-2 --no-sign-request --recursive "$source_bucket_land" "$local_directory/theme=land" +aws s3 cp --region us-west-2 --no-sign-request --recursive "$source_bucket_landuse" "$local_directory/theme=landuse" + +# Check if the download was successful +if [ $? -eq 0 ]; then + echo "Download completed successfully." +else + echo "Download failed. Please check the source S3 bucket and try again." + exit 1 +fi diff --git a/viewer/dist/assets/index-3ef18ac3.css b/viewer/dist/assets/index-3ef18ac3.css new file mode 100644 index 0000000..4c08b26 --- /dev/null +++ b/viewer/dist/assets/index-3ef18ac3.css @@ -0,0 +1 @@ +html,body{height:100%;padding:0;margin:0;background-color:#292929;font-family:Arial,sans-serif}#map{z-index:0;height:100%}#info{position:absolute;top:1rem;left:1rem;color:#d3d3d3;z-index:1;padding:.75rem;border-radius:.5rem;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(6px);box-shadow:inset 0 0 0 200px #ffffff1a}#info .header{font-size:2.25rem;font-weight:600;line-height:2rem;color:#bdbdbd;text-shadow:2px 4px 1px #373737}#info .description{margin-top:.25rem;font-size:1rem;color:#bdbdbd;font-family:Courier New,Courier,monospace}#info a{color:inherit}.controls{margin-top:2rem;font-size:.75rem;font-family:Courier New,Courier,monospace}.slider{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:100%;height:15px;background:#d3d3d3;outline:none;opacity:.7;-webkit-transition:.2s;transition:opacity .2s}.slider:hover{opacity:1}.slider::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:25px;height:13px;background:#4bbbba;cursor:pointer}.slider::-moz-range-thumb{width:25px;height:15px;background:#04aa6d;cursor:pointer}.maplibregl-popup-content h1{font-size:1rem;line-height:.1rem}.maplibregl-popup-content td{padding-right:1.25rem}.maplibregl-map{-webkit-tap-highlight-color:rgb(0 0 0/0);font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative}.maplibregl-canvas{left:0;position:absolute;top:0}.maplibregl-map:fullscreen{height:100%;width:100%}.maplibregl-ctrl-group button.maplibregl-ctrl-compass{touch-action:none}.maplibregl-canvas-container.maplibregl-interactive,.maplibregl-ctrl-group button.maplibregl-ctrl-compass{cursor:grab;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:grabbing}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.maplibregl-ctrl-top-left{left:0;top:0}.maplibregl-ctrl-top-right{right:0;top:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{bottom:0;right:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{float:left;margin:10px 0 0 10px}.maplibregl-ctrl-top-right .maplibregl-ctrl{float:right;margin:10px 10px 0 0}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{float:left;margin:0 0 10px 10px}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{float:right;margin:0 10px 10px 0}.maplibregl-ctrl-group{background:#fff;border-radius:4px}.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px #0000001a}@media (-ms-high-contrast:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.maplibregl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;padding:0;width:29px}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (-ms-high-contrast:active){.maplibregl-ctrl-icon{background-color:transparent}.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl button:disabled{cursor:not-allowed}.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}.maplibregl-ctrl button:not(:disabled):hover{background-color:#0000000d}.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.maplibregl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.maplibregl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.maplibregl-ctrl-group button:focus:only-child{border-radius:inherit}.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E")}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E")}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8h-8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8h-8z'/%3E%3C/svg%3E")}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8h-8z'/%3E%3Cpath fill='%23999' d='m10.5 16 4 8 4-8h-8z'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8h-8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8h-8z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%23333' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%2333b5e5' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23aaa' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1 9-9z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{animation:maplibregl-spin 2s linear infinite}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23999' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1 9-9z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23666' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1 9-9z'/%3E%3C/svg%3E")}}@keyframes maplibregl-spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.255 1.255 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.255 1.255 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5.11 5.11 0 0 1 .314-.787l.009-.016a4.623 4.623 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.548 4.548 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4.314.319.566.676.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.416 2.416 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.448 2.448 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675c.211.2.381.43.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.76 4.76 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.407 3.407 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.255 1.255 0 0 1 .689 1.004 4.73 4.73 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528 0 .343-.02.694-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.815 5.815 0 0 1-.548-2.512c0-.286.017-.567.053-.843a1.255 1.255 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.778 4.778 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.47 4.47 0 0 1-1.935-.424 1.252 1.252 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.402 2.402 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.703 4.703 0 0 1-1.782 1.884 4.767 4.767 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.47 4.47 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a4.983 4.983 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.255 1.255 0 0 1-1.115.676h-.098a1.255 1.255 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15c.329-.237.574-.499.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267c-.088-.22-.264-.438-.526-.658l-.032-.028a3.16 3.16 0 0 0-.668-.428l-.27-.12a3.293 3.293 0 0 0-1.235-.23c-.757 0-1.415.163-1.974.493a3.36 3.36 0 0 0-1.3 1.382c-.297.593-.444 1.284-.444 2.074 0 .8.17 1.503.51 2.107a3.795 3.795 0 0 0 1.382 1.381 3.883 3.883 0 0 0 1.893.477c.53 0 1.015-.11 1.455-.33zm-2.789-5.38c-.384.45-.575 1.038-.575 1.762 0 .735.186 1.332.559 1.794.384.45.933.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.17 2.17 0 0 0 .468-.29l.178-.161a2.163 2.163 0 0 0 .397-.561c.163-.333.244-.717.244-1.15v-.115c0-.472-.098-.894-.296-1.267l-.043-.077a2.211 2.211 0 0 0-.633-.709l-.13-.086-.047-.028a2.099 2.099 0 0 0-1.073-.285c-.702 0-1.244.231-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.958.958 0 0 0-.353-.389.851.851 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.626 2.626 0 0 0 .331.423c.213.22.464.402.755.548l.173.074c.433.17.93.255 1.49.255.68 0 1.295-.165 1.844-.493a3.447 3.447 0 0 0 1.316-1.4c.329-.603.493-1.299.493-2.089 0-1.273-.33-2.243-.988-2.913-.658-.68-1.52-1.02-2.584-1.02-.598 0-1.124.115-1.575.347a2.807 2.807 0 0 0-.415.262l-.199.166a3.35 3.35 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138c.137.193.297.36.48.5l.155.11.053.034c.34.197.713.297 1.119.297.714 0 1.262-.225 1.645-.675.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.29 0-.569.053-.835.16a2.366 2.366 0 0 0-.284.136 1.99 1.99 0 0 0-.363.254 2.237 2.237 0 0 0-.46.569l-.082.162a2.56 2.56 0 0 0-.213 1.072v.115c0 .471.098.894.296 1.267l.135.211zm.964-.818a1.11 1.11 0 0 0 .367.385.937.937 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a.995.995 0 0 0-.503.135l-.012.007a.859.859 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.43 1.43 0 0 0 .14.66zm15.7-6.222c.232-.23.346-.516.346-.856a1.053 1.053 0 0 0-.345-.79 1.175 1.175 0 0 0-.84-.329c-.34 0-.625.11-.855.33a1.053 1.053 0 0 0-.346.79c0 .34.115.625.346.855.23.23.516.346.856.346.34 0 .62-.115.839-.346zm4.337 9.314.033-1.332c.128.269.324.518.59.747l.098.081a3.727 3.727 0 0 0 .316.224l.223.122a3.21 3.21 0 0 0 1.44.322 3.785 3.785 0 0 0 1.875-.477 3.52 3.52 0 0 0 1.382-1.366c.352-.593.526-1.29.526-2.09 0-.79-.147-1.48-.444-2.073a3.235 3.235 0 0 0-1.283-1.399c-.549-.34-1.195-.51-1.942-.51a3.476 3.476 0 0 0-1.527.344l-.086.043-.165.09a3.412 3.412 0 0 0-.33.214c-.288.21-.507.446-.656.707a1.893 1.893 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.482 2.482 0 0 0 .566.7c.078.065.159.125.245.18l.144.08a2.105 2.105 0 0 0 .975.232c.713 0 1.262-.225 1.645-.675.384-.46.576-1.053.576-1.778 0-.734-.192-1.327-.576-1.777-.373-.46-.921-.692-1.645-.692a2.18 2.18 0 0 0-1.015.235c-.147.075-.285.17-.415.282l-.15.142a2.086 2.086 0 0 0-.42.594c-.149.32-.223.685-.223 1.1v.115c0 .47.097.89.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.868.868 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.13 1.13 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013c.23-.087.472-.134.724-.14l.069-.002c.329 0 .542.033.642.099l.247-1.794c-.13-.066-.37-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2.086 2.086 0 0 0-.411.148 2.18 2.18 0 0 0-.4.249 2.482 2.482 0 0 0-.485.499 2.659 2.659 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884c0-.364.053-.678.159-.943a1.49 1.49 0 0 1 .466-.636 2.52 2.52 0 0 1 .399-.253 2.19 2.19 0 0 1 .224-.099zm9.784 2.656.05-.922c0-1.162-.285-2.062-.856-2.698-.559-.647-1.42-.97-2.584-.97-.746 0-1.415.163-2.007.493a3.462 3.462 0 0 0-1.4 1.382c-.329.604-.493 1.306-.493 2.106 0 .714.143 1.371.428 1.975.285.593.73 1.07 1.332 1.432.604.351 1.355.526 2.255.526.649 0 1.204-.062 1.668-.185l.044-.012.135-.04c.409-.122.736-.263.984-.421l-.542-1.267c-.2.108-.415.199-.642.274l-.297.087c-.34.088-.773.131-1.3.131-.636 0-1.135-.147-1.497-.444a1.573 1.573 0 0 1-.192-.193c-.244-.294-.415-.705-.512-1.234l-.004-.021h5.43zm-5.427-1.256-.003.022h3.752v-.138c-.007-.485-.104-.857-.288-1.118a1.056 1.056 0 0 0-.156-.176c-.307-.285-.746-.428-1.316-.428-.657 0-1.155.202-1.494.604-.253.3-.417.712-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81c-.68 0-1.311-.16-1.893-.478a3.795 3.795 0 0 1-1.381-1.382c-.34-.604-.51-1.306-.51-2.106 0-.79.147-1.482.444-2.074a3.364 3.364 0 0 1 1.3-1.382c.559-.33 1.217-.494 1.974-.494a3.293 3.293 0 0 1 1.234.231 3.341 3.341 0 0 1 .97.575c.264.22.44.439.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332c-.186.395-.526.746-1.02 1.053a3.167 3.167 0 0 1-1.662.444zm.296-1.482c.626 0 1.152-.214 1.58-.642.428-.44.642-1.01.642-1.711v-.115c0-.472-.098-.894-.296-1.267a2.211 2.211 0 0 0-.807-.872 2.098 2.098 0 0 0-1.119-.313c-.702 0-1.245.231-1.629.692-.384.45-.575 1.037-.575 1.76 0 .736.186 1.333.559 1.795.384.45.933.675 1.645.675zm6.521-6.237h1.711v1.4c.604-1.065 1.547-1.597 2.83-1.597 1.064 0 1.926.34 2.584 1.02.659.67.988 1.641.988 2.914 0 .79-.164 1.487-.493 2.09a3.456 3.456 0 0 1-1.316 1.399 3.51 3.51 0 0 1-1.844.493c-.636 0-1.19-.11-1.662-.329a2.665 2.665 0 0 1-1.086-.97l.017 5.134h-1.728V9.242zm4.048 6.22c.714 0 1.262-.224 1.645-.674.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.395 0-.768.098-1.12.296-.34.187-.613.46-.822.823-.197.351-.296.763-.296 1.234v.115c0 .472.098.894.296 1.267.209.362.483.647.823.855.34.197.713.297 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.159 1.159 0 0 1-.856-.346 1.165 1.165 0 0 1-.346-.856 1.053 1.053 0 0 1 .346-.79c.23-.219.516-.329.856-.329.329 0 .609.11.839.33a1.053 1.053 0 0 1 .345.79 1.159 1.159 0 0 1-.345.855c-.22.23-.5.346-.84.346zm7.875 9.133a3.167 3.167 0 0 1-1.662-.444c-.482-.307-.817-.658-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283c.186-.438.548-.812 1.086-1.119a3.486 3.486 0 0 1 1.778-.477c.746 0 1.393.17 1.942.51a3.235 3.235 0 0 1 1.283 1.4c.297.592.444 1.282.444 2.072 0 .8-.175 1.498-.526 2.09a3.52 3.52 0 0 1-1.382 1.366 3.785 3.785 0 0 1-1.876.477zm-.296-1.481c.713 0 1.26-.225 1.645-.675.384-.46.577-1.053.577-1.778 0-.734-.193-1.327-.577-1.776-.373-.46-.921-.692-1.645-.692a2.115 2.115 0 0 0-1.58.659c-.428.428-.642.992-.642 1.694v.115c0 .473.098.895.296 1.267a2.385 2.385 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481c.176-.505.46-.91.856-1.217a2.14 2.14 0 0 1 1.349-.46c.351 0 .593.032.724.098l-.247 1.794c-.099-.066-.313-.099-.642-.099-.516 0-.988.164-1.416.494-.417.329-.626.855-.626 1.58v3.883h-1.777V9.242zm9.534 7.718c-.9 0-1.651-.175-2.255-.526-.603-.362-1.047-.84-1.332-1.432a4.567 4.567 0 0 1-.428-1.975c0-.8.164-1.502.493-2.106a3.462 3.462 0 0 1 1.4-1.382c.592-.33 1.262-.494 2.007-.494 1.163 0 2.024.324 2.584.97.57.637.856 1.537.856 2.7 0 .296-.017.603-.05.92h-5.43c.12.67.356 1.153.708 1.45.362.296.86.443 1.497.443.526 0 .96-.044 1.3-.131a4.123 4.123 0 0 0 .938-.362l.542 1.267c-.274.175-.647.329-1.119.46-.472.132-1.042.197-1.711.197zm1.596-4.558c.01-.68-.137-1.158-.444-1.432-.307-.285-.746-.428-1.316-.428-1.152 0-1.815.62-1.991 1.86h3.752z'/%3E%3Cg fill-rule='evenodd' stroke-width='1.036'%3E%3Cpath fill='%23000' fill-opacity='.4' d='m8.166 16.146-.002.002a1.54 1.54 0 0 1-2.009 0l-.002-.002-.043-.034-.002-.002-.199-.162H4.377a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659H8.411l-.202.164zm-1.121-.905a.29.29 0 0 0 .113.023.286.286 0 0 0 .189-.07l.077-.063c.634-.508 4.672-3.743 4.672-7.575 0-2.55-2.215-4.625-4.938-4.625S2.221 5.006 2.221 7.556c0 3.225 2.86 6.027 4.144 7.137h.004l.04.038.484.4.077.063a.628.628 0 0 0 .074.047zm-2.52-.548a16.898 16.898 0 0 1-1.183-1.315C2.187 11.942.967 9.897.967 7.555c0-3.319 2.855-5.88 6.192-5.88 3.338 0 6.193 2.561 6.193 5.881 0 2.34-1.22 4.387-2.376 5.822a16.898 16.898 0 0 1-1.182 1.315h.15a1.912 1.912 0 0 1 1.914 1.914v1.84a1.912 1.912 0 0 1-1.914 1.914H4.377a1.912 1.912 0 0 1-1.914-1.914v-1.84a1.912 1.912 0 0 1 1.914-1.914zm3.82-6.935c0 .692-.55 1.222-1.187 1.222s-1.185-.529-1.185-1.222.548-1.222 1.185-1.222c.638 0 1.186.529 1.186 1.222zm-1.186 2.477c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477zm2.048 7.71H5.114v-.838h4.093z'/%3E%3Cpath fill='%23e1e3e9' d='M2.222 7.555c0-2.55 2.214-4.625 4.937-4.625 2.723 0 4.938 2.075 4.938 4.625 0 3.832-4.038 7.068-4.672 7.575l-.077.063a.286.286 0 0 1-.189.07.286.286 0 0 1-.188-.07l-.077-.063c-.634-.507-4.672-3.743-4.672-7.575zm4.937 2.68c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477z'/%3E%3Cpath fill='%23fff' d='M4.377 15.948a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659zm4.83 1.16H5.114v.838h4.093z'/%3E%3C/g%3E%3C/svg%3E");background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (-ms-high-contrast:active){a.maplibregl-ctrl-logo{background-color:transparent;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.255 1.255 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.255 1.255 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5.11 5.11 0 0 1 .314-.787l.009-.016a4.623 4.623 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.548 4.548 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4.314.319.566.676.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.416 2.416 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.448 2.448 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675c.211.2.381.43.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.76 4.76 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.407 3.407 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.255 1.255 0 0 1 .689 1.004 4.73 4.73 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528 0 .343-.02.694-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.815 5.815 0 0 1-.548-2.512c0-.286.017-.567.053-.843a1.255 1.255 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.778 4.778 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.47 4.47 0 0 1-1.935-.424 1.252 1.252 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.402 2.402 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.703 4.703 0 0 1-1.782 1.884 4.767 4.767 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.47 4.47 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a4.983 4.983 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.255 1.255 0 0 1-1.115.676h-.098a1.255 1.255 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15c.329-.237.574-.499.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267c-.088-.22-.264-.438-.526-.658l-.032-.028a3.16 3.16 0 0 0-.668-.428l-.27-.12a3.293 3.293 0 0 0-1.235-.23c-.757 0-1.415.163-1.974.493a3.36 3.36 0 0 0-1.3 1.382c-.297.593-.444 1.284-.444 2.074 0 .8.17 1.503.51 2.107a3.795 3.795 0 0 0 1.382 1.381 3.883 3.883 0 0 0 1.893.477c.53 0 1.015-.11 1.455-.33zm-2.789-5.38c-.384.45-.575 1.038-.575 1.762 0 .735.186 1.332.559 1.794.384.45.933.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.17 2.17 0 0 0 .468-.29l.178-.161a2.163 2.163 0 0 0 .397-.561c.163-.333.244-.717.244-1.15v-.115c0-.472-.098-.894-.296-1.267l-.043-.077a2.211 2.211 0 0 0-.633-.709l-.13-.086-.047-.028a2.099 2.099 0 0 0-1.073-.285c-.702 0-1.244.231-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.958.958 0 0 0-.353-.389.851.851 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.626 2.626 0 0 0 .331.423c.213.22.464.402.755.548l.173.074c.433.17.93.255 1.49.255.68 0 1.295-.165 1.844-.493a3.447 3.447 0 0 0 1.316-1.4c.329-.603.493-1.299.493-2.089 0-1.273-.33-2.243-.988-2.913-.658-.68-1.52-1.02-2.584-1.02-.598 0-1.124.115-1.575.347a2.807 2.807 0 0 0-.415.262l-.199.166a3.35 3.35 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138c.137.193.297.36.48.5l.155.11.053.034c.34.197.713.297 1.119.297.714 0 1.262-.225 1.645-.675.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.29 0-.569.053-.835.16a2.366 2.366 0 0 0-.284.136 1.99 1.99 0 0 0-.363.254 2.237 2.237 0 0 0-.46.569l-.082.162a2.56 2.56 0 0 0-.213 1.072v.115c0 .471.098.894.296 1.267l.135.211zm.964-.818a1.11 1.11 0 0 0 .367.385.937.937 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a.995.995 0 0 0-.503.135l-.012.007a.859.859 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.43 1.43 0 0 0 .14.66zm15.7-6.222c.232-.23.346-.516.346-.856a1.053 1.053 0 0 0-.345-.79 1.175 1.175 0 0 0-.84-.329c-.34 0-.625.11-.855.33a1.053 1.053 0 0 0-.346.79c0 .34.115.625.346.855.23.23.516.346.856.346.34 0 .62-.115.839-.346zm4.337 9.314.033-1.332c.128.269.324.518.59.747l.098.081a3.727 3.727 0 0 0 .316.224l.223.122a3.21 3.21 0 0 0 1.44.322 3.785 3.785 0 0 0 1.875-.477 3.52 3.52 0 0 0 1.382-1.366c.352-.593.526-1.29.526-2.09 0-.79-.147-1.48-.444-2.073a3.235 3.235 0 0 0-1.283-1.399c-.549-.34-1.195-.51-1.942-.51a3.476 3.476 0 0 0-1.527.344l-.086.043-.165.09a3.412 3.412 0 0 0-.33.214c-.288.21-.507.446-.656.707a1.893 1.893 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.482 2.482 0 0 0 .566.7c.078.065.159.125.245.18l.144.08a2.105 2.105 0 0 0 .975.232c.713 0 1.262-.225 1.645-.675.384-.46.576-1.053.576-1.778 0-.734-.192-1.327-.576-1.777-.373-.46-.921-.692-1.645-.692a2.18 2.18 0 0 0-1.015.235c-.147.075-.285.17-.415.282l-.15.142a2.086 2.086 0 0 0-.42.594c-.149.32-.223.685-.223 1.1v.115c0 .47.097.89.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.868.868 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.13 1.13 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013c.23-.087.472-.134.724-.14l.069-.002c.329 0 .542.033.642.099l.247-1.794c-.13-.066-.37-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2.086 2.086 0 0 0-.411.148 2.18 2.18 0 0 0-.4.249 2.482 2.482 0 0 0-.485.499 2.659 2.659 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884c0-.364.053-.678.159-.943a1.49 1.49 0 0 1 .466-.636 2.52 2.52 0 0 1 .399-.253 2.19 2.19 0 0 1 .224-.099zm9.784 2.656.05-.922c0-1.162-.285-2.062-.856-2.698-.559-.647-1.42-.97-2.584-.97-.746 0-1.415.163-2.007.493a3.462 3.462 0 0 0-1.4 1.382c-.329.604-.493 1.306-.493 2.106 0 .714.143 1.371.428 1.975.285.593.73 1.07 1.332 1.432.604.351 1.355.526 2.255.526.649 0 1.204-.062 1.668-.185l.044-.012.135-.04c.409-.122.736-.263.984-.421l-.542-1.267c-.2.108-.415.199-.642.274l-.297.087c-.34.088-.773.131-1.3.131-.636 0-1.135-.147-1.497-.444a1.573 1.573 0 0 1-.192-.193c-.244-.294-.415-.705-.512-1.234l-.004-.021h5.43zm-5.427-1.256-.003.022h3.752v-.138c-.007-.485-.104-.857-.288-1.118a1.056 1.056 0 0 0-.156-.176c-.307-.285-.746-.428-1.316-.428-.657 0-1.155.202-1.494.604-.253.3-.417.712-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81c-.68 0-1.311-.16-1.893-.478a3.795 3.795 0 0 1-1.381-1.382c-.34-.604-.51-1.306-.51-2.106 0-.79.147-1.482.444-2.074a3.364 3.364 0 0 1 1.3-1.382c.559-.33 1.217-.494 1.974-.494a3.293 3.293 0 0 1 1.234.231 3.341 3.341 0 0 1 .97.575c.264.22.44.439.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332c-.186.395-.526.746-1.02 1.053a3.167 3.167 0 0 1-1.662.444zm.296-1.482c.626 0 1.152-.214 1.58-.642.428-.44.642-1.01.642-1.711v-.115c0-.472-.098-.894-.296-1.267a2.211 2.211 0 0 0-.807-.872 2.098 2.098 0 0 0-1.119-.313c-.702 0-1.245.231-1.629.692-.384.45-.575 1.037-.575 1.76 0 .736.186 1.333.559 1.795.384.45.933.675 1.645.675zm6.521-6.237h1.711v1.4c.604-1.065 1.547-1.597 2.83-1.597 1.064 0 1.926.34 2.584 1.02.659.67.988 1.641.988 2.914 0 .79-.164 1.487-.493 2.09a3.456 3.456 0 0 1-1.316 1.399 3.51 3.51 0 0 1-1.844.493c-.636 0-1.19-.11-1.662-.329a2.665 2.665 0 0 1-1.086-.97l.017 5.134h-1.728V9.242zm4.048 6.22c.714 0 1.262-.224 1.645-.674.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.395 0-.768.098-1.12.296-.34.187-.613.46-.822.823-.197.351-.296.763-.296 1.234v.115c0 .472.098.894.296 1.267.209.362.483.647.823.855.34.197.713.297 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.159 1.159 0 0 1-.856-.346 1.165 1.165 0 0 1-.346-.856 1.053 1.053 0 0 1 .346-.79c.23-.219.516-.329.856-.329.329 0 .609.11.839.33a1.053 1.053 0 0 1 .345.79 1.159 1.159 0 0 1-.345.855c-.22.23-.5.346-.84.346zm7.875 9.133a3.167 3.167 0 0 1-1.662-.444c-.482-.307-.817-.658-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283c.186-.438.548-.812 1.086-1.119a3.486 3.486 0 0 1 1.778-.477c.746 0 1.393.17 1.942.51a3.235 3.235 0 0 1 1.283 1.4c.297.592.444 1.282.444 2.072 0 .8-.175 1.498-.526 2.09a3.52 3.52 0 0 1-1.382 1.366 3.785 3.785 0 0 1-1.876.477zm-.296-1.481c.713 0 1.26-.225 1.645-.675.384-.46.577-1.053.577-1.778 0-.734-.193-1.327-.577-1.776-.373-.46-.921-.692-1.645-.692a2.115 2.115 0 0 0-1.58.659c-.428.428-.642.992-.642 1.694v.115c0 .473.098.895.296 1.267a2.385 2.385 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481c.176-.505.46-.91.856-1.217a2.14 2.14 0 0 1 1.349-.46c.351 0 .593.032.724.098l-.247 1.794c-.099-.066-.313-.099-.642-.099-.516 0-.988.164-1.416.494-.417.329-.626.855-.626 1.58v3.883h-1.777V9.242zm9.534 7.718c-.9 0-1.651-.175-2.255-.526-.603-.362-1.047-.84-1.332-1.432a4.567 4.567 0 0 1-.428-1.975c0-.8.164-1.502.493-2.106a3.462 3.462 0 0 1 1.4-1.382c.592-.33 1.262-.494 2.007-.494 1.163 0 2.024.324 2.584.97.57.637.856 1.537.856 2.7 0 .296-.017.603-.05.92h-5.43c.12.67.356 1.153.708 1.45.362.296.86.443 1.497.443.526 0 .96-.044 1.3-.131a4.123 4.123 0 0 0 .938-.362l.542 1.267c-.274.175-.647.329-1.119.46-.472.132-1.042.197-1.711.197zm1.596-4.558c.01-.68-.137-1.158-.444-1.432-.307-.285-.746-.428-1.316-.428-1.152 0-1.815.62-1.991 1.86h3.752z'/%3E%3Cg fill-rule='evenodd' stroke-width='1.036'%3E%3Cpath fill='%23000' fill-opacity='.4' d='m8.166 16.146-.002.002a1.54 1.54 0 0 1-2.009 0l-.002-.002-.043-.034-.002-.002-.199-.162H4.377a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659H8.411l-.202.164zm-1.121-.905a.29.29 0 0 0 .113.023.286.286 0 0 0 .189-.07l.077-.063c.634-.508 4.672-3.743 4.672-7.575 0-2.55-2.215-4.625-4.938-4.625S2.221 5.006 2.221 7.556c0 3.225 2.86 6.027 4.144 7.137h.004l.04.038.484.4.077.063a.628.628 0 0 0 .074.047zm-2.52-.548a16.898 16.898 0 0 1-1.183-1.315C2.187 11.942.967 9.897.967 7.555c0-3.319 2.855-5.88 6.192-5.88 3.338 0 6.193 2.561 6.193 5.881 0 2.34-1.22 4.387-2.376 5.822a16.898 16.898 0 0 1-1.182 1.315h.15a1.912 1.912 0 0 1 1.914 1.914v1.84a1.912 1.912 0 0 1-1.914 1.914H4.377a1.912 1.912 0 0 1-1.914-1.914v-1.84a1.912 1.912 0 0 1 1.914-1.914zm3.82-6.935c0 .692-.55 1.222-1.187 1.222s-1.185-.529-1.185-1.222.548-1.222 1.185-1.222c.638 0 1.186.529 1.186 1.222zm-1.186 2.477c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477zm2.048 7.71H5.114v-.838h4.093z'/%3E%3Cpath fill='%23e1e3e9' d='M2.222 7.555c0-2.55 2.214-4.625 4.937-4.625 2.723 0 4.938 2.075 4.938 4.625 0 3.832-4.038 7.068-4.672 7.575l-.077.063a.286.286 0 0 1-.189.07.286.286 0 0 1-.188-.07l-.077-.063c-.634-.507-4.672-3.743-4.672-7.575zm4.937 2.68c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477z'/%3E%3Cpath fill='%23fff' d='M4.377 15.948a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659zm4.83 1.16H5.114v.838h4.093z'/%3E%3C/g%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.255 1.255 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.255 1.255 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5.11 5.11 0 0 1 .314-.787l.009-.016a4.623 4.623 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.548 4.548 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4.314.319.566.676.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.416 2.416 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.448 2.448 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675c.211.2.381.43.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.76 4.76 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.407 3.407 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.255 1.255 0 0 1 .689 1.004 4.73 4.73 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528 0 .343-.02.694-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.815 5.815 0 0 1-.548-2.512c0-.286.017-.567.053-.843a1.255 1.255 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.778 4.778 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.47 4.47 0 0 1-1.935-.424 1.252 1.252 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.402 2.402 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.703 4.703 0 0 1-1.782 1.884 4.767 4.767 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.47 4.47 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a4.983 4.983 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.255 1.255 0 0 1-1.115.676h-.098a1.255 1.255 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15c.329-.237.574-.499.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267c-.088-.22-.264-.438-.526-.658l-.032-.028a3.16 3.16 0 0 0-.668-.428l-.27-.12a3.293 3.293 0 0 0-1.235-.23c-.757 0-1.415.163-1.974.493a3.36 3.36 0 0 0-1.3 1.382c-.297.593-.444 1.284-.444 2.074 0 .8.17 1.503.51 2.107a3.795 3.795 0 0 0 1.382 1.381 3.883 3.883 0 0 0 1.893.477c.53 0 1.015-.11 1.455-.33zm-2.789-5.38c-.384.45-.575 1.038-.575 1.762 0 .735.186 1.332.559 1.794.384.45.933.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.17 2.17 0 0 0 .468-.29l.178-.161a2.163 2.163 0 0 0 .397-.561c.163-.333.244-.717.244-1.15v-.115c0-.472-.098-.894-.296-1.267l-.043-.077a2.211 2.211 0 0 0-.633-.709l-.13-.086-.047-.028a2.099 2.099 0 0 0-1.073-.285c-.702 0-1.244.231-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.958.958 0 0 0-.353-.389.851.851 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.626 2.626 0 0 0 .331.423c.213.22.464.402.755.548l.173.074c.433.17.93.255 1.49.255.68 0 1.295-.165 1.844-.493a3.447 3.447 0 0 0 1.316-1.4c.329-.603.493-1.299.493-2.089 0-1.273-.33-2.243-.988-2.913-.658-.68-1.52-1.02-2.584-1.02-.598 0-1.124.115-1.575.347a2.807 2.807 0 0 0-.415.262l-.199.166a3.35 3.35 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138c.137.193.297.36.48.5l.155.11.053.034c.34.197.713.297 1.119.297.714 0 1.262-.225 1.645-.675.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.29 0-.569.053-.835.16a2.366 2.366 0 0 0-.284.136 1.99 1.99 0 0 0-.363.254 2.237 2.237 0 0 0-.46.569l-.082.162a2.56 2.56 0 0 0-.213 1.072v.115c0 .471.098.894.296 1.267l.135.211zm.964-.818a1.11 1.11 0 0 0 .367.385.937.937 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a.995.995 0 0 0-.503.135l-.012.007a.859.859 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.43 1.43 0 0 0 .14.66zm15.7-6.222c.232-.23.346-.516.346-.856a1.053 1.053 0 0 0-.345-.79 1.175 1.175 0 0 0-.84-.329c-.34 0-.625.11-.855.33a1.053 1.053 0 0 0-.346.79c0 .34.115.625.346.855.23.23.516.346.856.346.34 0 .62-.115.839-.346zm4.337 9.314.033-1.332c.128.269.324.518.59.747l.098.081a3.727 3.727 0 0 0 .316.224l.223.122a3.21 3.21 0 0 0 1.44.322 3.785 3.785 0 0 0 1.875-.477 3.52 3.52 0 0 0 1.382-1.366c.352-.593.526-1.29.526-2.09 0-.79-.147-1.48-.444-2.073a3.235 3.235 0 0 0-1.283-1.399c-.549-.34-1.195-.51-1.942-.51a3.476 3.476 0 0 0-1.527.344l-.086.043-.165.09a3.412 3.412 0 0 0-.33.214c-.288.21-.507.446-.656.707a1.893 1.893 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.482 2.482 0 0 0 .566.7c.078.065.159.125.245.18l.144.08a2.105 2.105 0 0 0 .975.232c.713 0 1.262-.225 1.645-.675.384-.46.576-1.053.576-1.778 0-.734-.192-1.327-.576-1.777-.373-.46-.921-.692-1.645-.692a2.18 2.18 0 0 0-1.015.235c-.147.075-.285.17-.415.282l-.15.142a2.086 2.086 0 0 0-.42.594c-.149.32-.223.685-.223 1.1v.115c0 .47.097.89.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.868.868 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.13 1.13 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013c.23-.087.472-.134.724-.14l.069-.002c.329 0 .542.033.642.099l.247-1.794c-.13-.066-.37-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2.086 2.086 0 0 0-.411.148 2.18 2.18 0 0 0-.4.249 2.482 2.482 0 0 0-.485.499 2.659 2.659 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884c0-.364.053-.678.159-.943a1.49 1.49 0 0 1 .466-.636 2.52 2.52 0 0 1 .399-.253 2.19 2.19 0 0 1 .224-.099zm9.784 2.656.05-.922c0-1.162-.285-2.062-.856-2.698-.559-.647-1.42-.97-2.584-.97-.746 0-1.415.163-2.007.493a3.462 3.462 0 0 0-1.4 1.382c-.329.604-.493 1.306-.493 2.106 0 .714.143 1.371.428 1.975.285.593.73 1.07 1.332 1.432.604.351 1.355.526 2.255.526.649 0 1.204-.062 1.668-.185l.044-.012.135-.04c.409-.122.736-.263.984-.421l-.542-1.267c-.2.108-.415.199-.642.274l-.297.087c-.34.088-.773.131-1.3.131-.636 0-1.135-.147-1.497-.444a1.573 1.573 0 0 1-.192-.193c-.244-.294-.415-.705-.512-1.234l-.004-.021h5.43zm-5.427-1.256-.003.022h3.752v-.138c-.007-.485-.104-.857-.288-1.118a1.056 1.056 0 0 0-.156-.176c-.307-.285-.746-.428-1.316-.428-.657 0-1.155.202-1.494.604-.253.3-.417.712-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81c-.68 0-1.311-.16-1.893-.478a3.795 3.795 0 0 1-1.381-1.382c-.34-.604-.51-1.306-.51-2.106 0-.79.147-1.482.444-2.074a3.364 3.364 0 0 1 1.3-1.382c.559-.33 1.217-.494 1.974-.494a3.293 3.293 0 0 1 1.234.231 3.341 3.341 0 0 1 .97.575c.264.22.44.439.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332c-.186.395-.526.746-1.02 1.053a3.167 3.167 0 0 1-1.662.444zm.296-1.482c.626 0 1.152-.214 1.58-.642.428-.44.642-1.01.642-1.711v-.115c0-.472-.098-.894-.296-1.267a2.211 2.211 0 0 0-.807-.872 2.098 2.098 0 0 0-1.119-.313c-.702 0-1.245.231-1.629.692-.384.45-.575 1.037-.575 1.76 0 .736.186 1.333.559 1.795.384.45.933.675 1.645.675zm6.521-6.237h1.711v1.4c.604-1.065 1.547-1.597 2.83-1.597 1.064 0 1.926.34 2.584 1.02.659.67.988 1.641.988 2.914 0 .79-.164 1.487-.493 2.09a3.456 3.456 0 0 1-1.316 1.399 3.51 3.51 0 0 1-1.844.493c-.636 0-1.19-.11-1.662-.329a2.665 2.665 0 0 1-1.086-.97l.017 5.134h-1.728V9.242zm4.048 6.22c.714 0 1.262-.224 1.645-.674.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.395 0-.768.098-1.12.296-.34.187-.613.46-.822.823-.197.351-.296.763-.296 1.234v.115c0 .472.098.894.296 1.267.209.362.483.647.823.855.34.197.713.297 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.159 1.159 0 0 1-.856-.346 1.165 1.165 0 0 1-.346-.856 1.053 1.053 0 0 1 .346-.79c.23-.219.516-.329.856-.329.329 0 .609.11.839.33a1.053 1.053 0 0 1 .345.79 1.159 1.159 0 0 1-.345.855c-.22.23-.5.346-.84.346zm7.875 9.133a3.167 3.167 0 0 1-1.662-.444c-.482-.307-.817-.658-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283c.186-.438.548-.812 1.086-1.119a3.486 3.486 0 0 1 1.778-.477c.746 0 1.393.17 1.942.51a3.235 3.235 0 0 1 1.283 1.4c.297.592.444 1.282.444 2.072 0 .8-.175 1.498-.526 2.09a3.52 3.52 0 0 1-1.382 1.366 3.785 3.785 0 0 1-1.876.477zm-.296-1.481c.713 0 1.26-.225 1.645-.675.384-.46.577-1.053.577-1.778 0-.734-.193-1.327-.577-1.776-.373-.46-.921-.692-1.645-.692a2.115 2.115 0 0 0-1.58.659c-.428.428-.642.992-.642 1.694v.115c0 .473.098.895.296 1.267a2.385 2.385 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481c.176-.505.46-.91.856-1.217a2.14 2.14 0 0 1 1.349-.46c.351 0 .593.032.724.098l-.247 1.794c-.099-.066-.313-.099-.642-.099-.516 0-.988.164-1.416.494-.417.329-.626.855-.626 1.58v3.883h-1.777V9.242zm9.534 7.718c-.9 0-1.651-.175-2.255-.526-.603-.362-1.047-.84-1.332-1.432a4.567 4.567 0 0 1-.428-1.975c0-.8.164-1.502.493-2.106a3.462 3.462 0 0 1 1.4-1.382c.592-.33 1.262-.494 2.007-.494 1.163 0 2.024.324 2.584.97.57.637.856 1.537.856 2.7 0 .296-.017.603-.05.92h-5.43c.12.67.356 1.153.708 1.45.362.296.86.443 1.497.443.526 0 .96-.044 1.3-.131a4.123 4.123 0 0 0 .938-.362l.542 1.267c-.274.175-.647.329-1.119.46-.472.132-1.042.197-1.711.197zm1.596-4.558c.01-.68-.137-1.158-.444-1.432-.307-.285-.746-.428-1.316-.428-1.152 0-1.815.62-1.991 1.86h3.752z'/%3E%3Cg fill-rule='evenodd' stroke-width='1.036'%3E%3Cpath fill='%23000' fill-opacity='.4' d='m8.166 16.146-.002.002a1.54 1.54 0 0 1-2.009 0l-.002-.002-.043-.034-.002-.002-.199-.162H4.377a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659H8.411l-.202.164zm-1.121-.905a.29.29 0 0 0 .113.023.286.286 0 0 0 .189-.07l.077-.063c.634-.508 4.672-3.743 4.672-7.575 0-2.55-2.215-4.625-4.938-4.625S2.221 5.006 2.221 7.556c0 3.225 2.86 6.027 4.144 7.137h.004l.04.038.484.4.077.063a.628.628 0 0 0 .074.047zm-2.52-.548a16.898 16.898 0 0 1-1.183-1.315C2.187 11.942.967 9.897.967 7.555c0-3.319 2.855-5.88 6.192-5.88 3.338 0 6.193 2.561 6.193 5.881 0 2.34-1.22 4.387-2.376 5.822a16.898 16.898 0 0 1-1.182 1.315h.15a1.912 1.912 0 0 1 1.914 1.914v1.84a1.912 1.912 0 0 1-1.914 1.914H4.377a1.912 1.912 0 0 1-1.914-1.914v-1.84a1.912 1.912 0 0 1 1.914-1.914zm3.82-6.935c0 .692-.55 1.222-1.187 1.222s-1.185-.529-1.185-1.222.548-1.222 1.185-1.222c.638 0 1.186.529 1.186 1.222zm-1.186 2.477c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477zm2.048 7.71H5.114v-.838h4.093z'/%3E%3Cpath fill='%23e1e3e9' d='M2.222 7.555c0-2.55 2.214-4.625 4.937-4.625 2.723 0 4.938 2.075 4.938 4.625 0 3.832-4.038 7.068-4.672 7.575l-.077.063a.286.286 0 0 1-.189.07.286.286 0 0 1-.188-.07l-.077-.063c-.634-.507-4.672-3.743-4.672-7.575zm4.937 2.68c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477z'/%3E%3Cpath fill='%23fff' d='M4.377 15.948a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659zm4.83 1.16H5.114v.838h4.093z'/%3E%3C/g%3E%3C/svg%3E")}}.maplibregl-ctrl.maplibregl-ctrl-attrib{background-color:#ffffff80;margin:0;padding:0 5px}@media screen{.maplibregl-ctrl-attrib.maplibregl-compact{background-color:#fff;border-radius:12px;box-sizing:content-box;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.maplibregl-ctrl-attrib-button{background-color:#ffffff80;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E");border:0;border-radius:12px;box-sizing:border-box;cursor:pointer;display:none;height:24px;outline:none;position:absolute;right:0;top:0;width:24px}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button{-webkit-appearance:none;-moz-appearance:none;appearance:none;list-style:none}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker{display:none}.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button{left:0}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner{display:block}.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button{background-color:#0000000d}.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{right:0;top:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{left:0;top:0}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (-ms-high-contrast:active){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%23fff' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}@media screen and (-ms-high-contrast:black-on-white){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}.maplibregl-ctrl-attrib a{color:#000000bf;text-decoration:none}.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.maplibregl-attrib-empty{display:none}.maplibregl-ctrl-scale{background-color:#ffffffbf;border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px}.maplibregl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.maplibregl-popup-anchor-top,.maplibregl-popup-anchor-top-left,.maplibregl-popup-anchor-top-right{flex-direction:column}.maplibregl-popup-anchor-bottom,.maplibregl-popup-anchor-bottom-left,.maplibregl-popup-anchor-bottom-right{flex-direction:column-reverse}.maplibregl-popup-anchor-left{flex-direction:row}.maplibregl-popup-anchor-right{flex-direction:row-reverse}.maplibregl-popup-tip{border:10px solid transparent;height:0;width:0;z-index:1}.maplibregl-popup-anchor-top .maplibregl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.maplibregl-popup-anchor-left .maplibregl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.maplibregl-popup-anchor-right .maplibregl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}.maplibregl-popup-close-button{background-color:transparent;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.maplibregl-popup-close-button:hover{background-color:#0000000d}.maplibregl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px #0000001a;padding:15px 10px;pointer-events:auto;position:relative}.maplibregl-popup-anchor-top-left .maplibregl-popup-content{border-top-left-radius:0}.maplibregl-popup-anchor-top-right .maplibregl-popup-content{border-top-right-radius:0}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-content{border-bottom-left-radius:0}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-content{border-bottom-right-radius:0}.maplibregl-popup-track-pointer{display:none}.maplibregl-popup-track-pointer *{pointer-events:none;-webkit-user-select:none;user-select:none}.maplibregl-map:hover .maplibregl-popup-track-pointer{display:flex}.maplibregl-map:active .maplibregl-popup-track-pointer{display:none}.maplibregl-marker{left:0;position:absolute;top:0;will-change:transform}.maplibregl-user-location-dot,.maplibregl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.maplibregl-user-location-dot:before{animation:maplibregl-user-location-dot-pulse 2s infinite;content:"";position:absolute}.maplibregl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px #00000059;box-sizing:border-box;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px}@keyframes maplibregl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.maplibregl-user-location-dot-stale{background-color:#aaa}.maplibregl-user-location-dot-stale:after{display:none}.maplibregl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.maplibregl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}.maplibregl-cooperative-gesture-screen{align-items:center;background:rgba(0,0,0,.4);color:#fff;display:flex;font-size:1.4em;top:0;right:0;bottom:0;left:0;justify-content:center;line-height:1.2;opacity:0;padding:1rem;pointer-events:none;position:absolute;transition:opacity 1s ease 1s;z-index:99999}.maplibregl-cooperative-gesture-screen.maplibregl-show{opacity:1;transition:opacity .05s}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:none}@media (hover:none),(width <= 480px){.maplibregl-cooperative-gesture-screen .maplibregl-desktop-message{display:none}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:block}}.maplibregl-pseudo-fullscreen{height:100%!important;left:0!important;position:fixed!important;top:0!important;width:100%!important;z-index:99999} diff --git a/viewer/dist/assets/index-4314267e.js b/viewer/dist/assets/index-768b1273.js similarity index 93% rename from viewer/dist/assets/index-4314267e.js rename to viewer/dist/assets/index-768b1273.js index dbd3d05..00ad20c 100644 --- a/viewer/dist/assets/index-4314267e.js +++ b/viewer/dist/assets/index-768b1273.js @@ -1,5 +1,5 @@ -(function(){const Z=document.createElement("link").relList;if(Z&&Z.supports&&Z.supports("modulepreload"))return;for(const ee of document.querySelectorAll('link[rel="modulepreload"]'))Y(ee);new MutationObserver(ee=>{for(const ge of ee)if(ge.type==="childList")for(const Me of ge.addedNodes)Me.tagName==="LINK"&&Me.rel==="modulepreload"&&Y(Me)}).observe(document,{childList:!0,subtree:!0});function X(ee){const ge={};return ee.integrity&&(ge.integrity=ee.integrity),ee.referrerPolicy&&(ge.referrerPolicy=ee.referrerPolicy),ee.crossOrigin==="use-credentials"?ge.credentials="include":ee.crossOrigin==="anonymous"?ge.credentials="omit":ge.credentials="same-origin",ge}function Y(ee){if(ee.ep)return;ee.ep=!0;const ge=X(ee);fetch(ee.href,ge)}})();var Bp=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Rp(R){return R&&R.__esModule&&Object.prototype.hasOwnProperty.call(R,"default")?R.default:R}var Au={exports:{}};(function(R,Z){(function(X,Y){R.exports=Y()})(Bp,function(){var X,Y,ee;function ge(c,Oe){if(!X)X=Oe;else if(!Y)Y=Oe;else{var re="var sharedChunk = {}; ("+X+")(sharedChunk); ("+Y+")(sharedChunk);",De={};X(De),ee=Oe(De),typeof window<"u"&&(ee.workerUrl=window.URL.createObjectURL(new Blob([re],{type:"text/javascript"})))}}ge(["exports"],function(c){function Oe(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var re=De;function De(i,e){this.x=i,this.y=e}De.prototype={clone:function(){return new De(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,e){return this.clone()._rotateAround(i,e)},matMult:function(i){return this.clone()._matMult(i)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var e=i.x-this.x,r=i.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var e=Math.cos(i),r=Math.sin(i),s=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=s,this},_rotateAround:function(i,e){var r=Math.cos(i),s=Math.sin(i),o=e.y+s*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-s*(this.y-e.y),this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},De.convert=function(i){return i instanceof De?i:Array.isArray(i)?new De(i[0],i[1]):i};var me=Oe(re),dt=Ct;function Ct(i,e,r,s){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(s-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=s}Ct.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,s=0;s<8;s++){var o=this.sampleCurveX(r)-i;if(Math.abs(o)o?p=r:f=r,r=.5*(f-p)+p;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};var Yt=Oe(dt);function ai(i,e,r,s){const o=new Yt(i,e,r,s);return function(u){return o.solve(u)}}const jt=ai(.25,.1,.25,1);function vt(i,e,r){return Math.min(r,Math.max(e,i))}function Mt(i,e,r){const s=r-e,o=((i-e)%s+s)%s+e;return o===e?r:o}function Jt(i,...e){for(const r of e)for(const s in r)i[s]=r[s];return i}let Yr=1;function er(i,e,r){const s={};for(const o in i)s[o]=e.call(r||this,i[o],o,i);return s}function Jr(i,e,r){const s={};for(const o in i)e.call(r||this,i[o],o,i)&&(s[o]=i[o]);return s}function wi(i){return Array.isArray(i)?i.map(wi):typeof i=="object"&&i?er(i,wi):i}const di={};function Qt(i){di[i]||(typeof console<"u"&&console.warn(i),di[i]=!0)}function Je(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function Qr(i){let e=0;for(let r,s,o=0,u=i.length,p=u-1;ocancelAnimationFrame(e)}},getImageData(i,e=0){return this.getImageCanvasContext(i).getImageData(-e,-e,i.width+2*e,i.height+2*e)},getImageCanvasContext(i){const e=window.document.createElement("canvas"),r=e.getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("failed to create canvas 2d context");return e.width=i.width,e.height=i.height,r.drawImage(i,0,0,i.width,i.height),r},resolveURL:i=>(Lr||(Lr=document.createElement("a")),Lr.href=i,Lr.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(ei==null&&(ei=matchMedia("(prefers-reduced-motion: reduce)")),ei.matches)}},Ln={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};class cr extends Error{constructor(e,r,s,o){super(`AJAXError: ${r} (${e}): ${s}`),this.status=e,this.statusText=r,this.url=s,this.body=o}}const li=Pi()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href,Si=i=>Ln.REGISTERED_PROTOCOLS[i.substring(0,i.indexOf("://"))];function mt(i,e){const r=new AbortController,s=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,cache:i.cache,referrer:li(),signal:r.signal});let o=!1,u=!1;return i.type==="json"&&s.headers.set("Accept","application/json"),u||fetch(s).then(p=>p.ok?(f=>{(i.type==="arrayBuffer"||i.type==="image"?f.arrayBuffer():i.type==="json"?f.json():f.text()).then(_=>{u||(o=!0,e(null,_,f.headers.get("Cache-Control"),f.headers.get("Expires")))}).catch(_=>{u||e(new Error(_.message))})})(p):p.blob().then(f=>e(new cr(p.status,p.statusText,i.url,f)))).catch(p=>{p.code!==20&&e(new Error(p.message))}),{cancel:()=>{u=!0,o||r.abort()}}}const hr=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if(Pi()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e);if(!Pi())return(Si(i.url)||mt)(i,e)}if(!(/^file:/.test(r=i.url)||/^file:/.test(li())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return mt(i,e);if(Pi()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e,void 0,!0)}var r;return function(s,o){const u=new XMLHttpRequest;u.open(s.method||"GET",s.url,!0),s.type!=="arrayBuffer"&&s.type!=="image"||(u.responseType="arraybuffer");for(const p in s.headers)u.setRequestHeader(p,s.headers[p]);return s.type==="json"&&(u.responseType="text",u.setRequestHeader("Accept","application/json")),u.withCredentials=s.credentials==="include",u.onerror=()=>{o(new Error(u.statusText))},u.onload=()=>{if((u.status>=200&&u.status<300||u.status===0)&&u.response!==null){let p=u.response;if(s.type==="json")try{p=JSON.parse(u.response)}catch(f){return o(f)}o(null,p,u.getResponseHeader("Cache-Control"),u.getResponseHeader("Expires"))}else{const p=new Blob([u.response],{type:u.getResponseHeader("Content-Type")});o(new cr(u.status,u.statusText,s.url,p))}},u.send(s.body),{cancel:()=>u.abort()}}(i,e)},Br=function(i,e){return hr(Jt(i,{type:"arrayBuffer"}),e)};function ur(i){if(!i||i.indexOf("://")<=0||i.indexOf("data:image/")===0||i.indexOf("blob:")===0)return!0;const e=new URL(i),r=window.location;return e.protocol===r.protocol&&e.host===r.host}function Rr(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function dr(i,e,r){if(r&&r[i]){const s=r[i].indexOf(e);s!==-1&&r[i].splice(s,1)}}class Ii{constructor(e,r={}){Jt(this,r),this.type=e}}class Ni extends Ii{constructor(e,r={}){super("error",Jt({error:e},r))}}class pr{on(e,r){return this._listeners=this._listeners||{},Rr(e,r,this._listeners),this}off(e,r){return dr(e,r,this._listeners),dr(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},Rr(e,r,this._oneTimeListeners),this):new Promise(s=>this.once(e,s))}fire(e,r){typeof e=="string"&&(e=new Ii(e,r||{}));const s=e.type;if(this.listens(s)){e.target=this;const o=this._listeners&&this._listeners[s]?this._listeners[s].slice():[];for(const f of o)f.call(this,e);const u=this._oneTimeListeners&&this._oneTimeListeners[s]?this._oneTimeListeners[s].slice():[];for(const f of u)dr(s,f,this._oneTimeListeners),f.call(this,e);const p=this._eventedParent;p&&(Jt(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),p.fire(e))}else e instanceof Ni&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,r){return this._eventedParent=e,this._eventedParentData=r,this}}var le={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"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"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"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"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const Fr=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Bn(i,e){const r={};for(const s in i)s!=="ref"&&(r[s]=i[s]);return Fr.forEach(s=>{s in e&&(r[s]=e[s])}),r}function gt(i,e){if(Array.isArray(i)){if(!Array.isArray(e)||i.length!==e.length)return!1;for(let r=0;r`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const rs=[tn,Te,Ke,Ye,pi,Er,Ur,ci(Ge),rn,tr,nn];function Sr(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Sr(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const r of rs)if(!Sr(r,e))return null}}return`Expected ${bt(i)} but found ${bt(e)} instead.`}function O(i,e){return e.some(r=>r.kind===i.kind)}function S(i,e){return e.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}function A(i,e){return i.kind==="array"&&e.kind==="array"?i.itemType.kind===e.itemType.kind&&typeof i.N=="number":i.kind===e.kind}const z=.96422,V=.82521,q=4/29,J=6/29,G=3*J*J,j=J*J*J,te=Math.PI/180,ue=180/Math.PI;function de(i){return(i%=360)<0&&(i+=360),i}function pe([i,e,r,s]){let o,u;const p=He((.2225045*(i=Ze(i))+.7168786*(e=Ze(e))+.0606169*(r=Ze(r)))/1);i===e&&e===r?o=u=p:(o=He((.4360747*i+.3850649*e+.1430804*r)/z),u=He((.0139322*i+.0971045*e+.7141733*r)/V));const f=116*p-16;return[f<0?0:f,500*(o-p),200*(p-u),s]}function Ze(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function He(i){return i>j?Math.pow(i,1/3):i/G+q}function Le([i,e,r,s]){let o=(i+16)/116,u=isNaN(e)?o:o+e/500,p=isNaN(r)?o:o-r/200;return o=1*We(o),u=z*We(u),p=V*We(p),[Ve(3.1338561*u-1.6168667*o-.4906146*p),Ve(-.9787684*u+1.9161415*o+.033454*p),Ve(.0719453*u-.2289914*o+1.4052427*p),s]}function Ve(i){return(i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055)<0?0:i>1?1:i}function We(i){return i>J?i*i*i:G*(i-q)}function ot(i){return parseInt(i.padEnd(2,i),16)/255}function _t(i,e){return rt(e?i/100:i,0,1)}function rt(i,e,r){return Math.min(Math.max(e,i),r)}function at(i){return!i.some(Number.isNaN)}const ki={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]};class Xe{constructor(e,r,s,o=1,u=!0){this.r=e,this.g=r,this.b=s,this.a=o,u||(this.r*=o,this.g*=o,this.b*=o,o||this.overwriteGetter("rgb",[e,r,s,o]))}static parse(e){if(e instanceof Xe)return e;if(typeof e!="string")return;const r=function(s){if((s=s.toLowerCase().trim())==="transparent")return[0,0,0,0];const o=ki[s];if(o){const[p,f,_]=o;return[p/255,f/255,_/255,1]}if(s.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(s)){const p=s.length<6?1:2;let f=1;return[ot(s.slice(f,f+=p)),ot(s.slice(f,f+=p)),ot(s.slice(f,f+=p)),ot(s.slice(f,f+p)||"ff")]}if(s.startsWith("rgb")){const p=s.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(p){const[f,_,x,w,E,I,M,P,B,U,$,Q]=p,W=[w||" ",M||" ",U].join("");if(W===" "||W===" /"||W===",,"||W===",,,"){const ie=[x,I,B].join(""),se=ie==="%%%"?100:ie===""?255:0;if(se){const he=[rt(+_/se,0,1),rt(+E/se,0,1),rt(+P/se,0,1),$?_t(+$,Q):1];if(at(he))return he}}return}}const u=s.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(u){const[p,f,_,x,w,E,I,M,P]=u,B=[_||" ",w||" ",I].join("");if(B===" "||B===" /"||B===",,"||B===",,,"){const U=[+f,rt(+x,0,100),rt(+E,0,100),M?_t(+M,P):1];if(at(U))return function([$,Q,W,ie]){function se(he){const Ce=(he+$/30)%12,Re=Q*Math.min(W,1-W);return W-Re*Math.max(-1,Math.min(Ce-3,9-Ce,1))}return $=de($),Q/=100,W/=100,[se(0),se(8),se(4),ie]}(U)}}}(e);return r?new Xe(...r,!1):void 0}get rgb(){const{r:e,g:r,b:s,a:o}=this,u=o||1/0;return this.overwriteGetter("rgb",[e/u,r/u,s/u,o])}get hcl(){return this.overwriteGetter("hcl",function(e){const[r,s,o,u]=pe(e),p=Math.sqrt(s*s+o*o);return[Math.round(1e4*p)?de(Math.atan2(o,s)*ue):NaN,p,r,u]}(this.rgb))}get lab(){return this.overwriteGetter("lab",pe(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){const[e,r,s,o]=this.rgb;return`rgba(${[e,r,s].map(u=>Math.round(255*u)).join(",")},${o})`}}Xe.black=new Xe(0,0,0,1),Xe.white=new Xe(1,1,1,1),Xe.transparent=new Xe(0,0,0,0),Xe.red=new Xe(1,0,0,1);class Gt{constructor(e,r,s){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=s,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class hi{constructor(e,r,s,o,u){this.text=e,this.image=r,this.scale=s,this.fontStack=o,this.textColor=u}}class Ot{constructor(e){this.sections=e}static fromString(e){return new Ot([new hi(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof Ot?e:Ot.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class $i{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof $i)return e;if(typeof e=="number")return new $i([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const r of e)if(typeof r!="number")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 $i(e)}}toString(){return JSON.stringify(this.values)}}const Ml=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class fi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof fi)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let r=0;r=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[i,e,r,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[i,e,r,s]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Os(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof Xe||i instanceof Gt||i instanceof Ot||i instanceof $i||i instanceof fi||i instanceof ir)return!0;if(Array.isArray(i)){for(const e of i)if(!Os(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!Os(i[e]))return!1;return!0}return!1}function Ut(i){if(i===null)return tn;if(typeof i=="string")return Ke;if(typeof i=="boolean")return Ye;if(typeof i=="number")return Te;if(i instanceof Xe)return pi;if(i instanceof Gt)return Tr;if(i instanceof Ot)return Er;if(i instanceof $i)return rn;if(i instanceof fi)return nn;if(i instanceof ir)return tr;if(Array.isArray(i)){const e=i.length;let r;for(const s of i){const o=Ut(s);if(r){if(r===o)continue;r=Ge;break}r=o}return ci(r||Ge,e)}return Ur}function sn(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof Xe||i instanceof Ot||i instanceof $i||i instanceof fi||i instanceof ir?i.toString():JSON.stringify(i)}class gn{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Os(e[1]))return r.error("invalid value");const s=e[1];let o=Ut(s);const u=r.expectedType;return o.kind!=="array"||o.N!==0||!u||u.kind!=="array"||typeof u.N=="number"&&u.N!==0||(o=u),new gn(o,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Vt{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Us={string:Ke,number:Te,boolean:Ye,object:Ur};class mi{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let s,o=1;const u=e[0];if(u==="array"){let f,_;if(e.length>2){const x=e[1];if(typeof x!="string"||!(x in Us)||x==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);f=Us[x],o++}else f=Ge;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error('The length argument to "array" must be a positive integer literal',2);_=e[2],o++}s=ci(f,_)}else{if(!Us[u])throw new Error(`Types doesn't contain name = ${u}`);s=Us[u]}const p=[];for(;oe.outputDefined())}}const Vs={"to-boolean":Ye,"to-color":pi,"to-number":Te,"to-string":Ke};class Ir{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const s=e[0];if(!Vs[s])throw new Error(`Can't parse ${s} as it is not part of the known types`);if((s==="to-boolean"||s==="to-string")&&e.length!==2)return r.error("Expected one argument.");const o=Vs[s],u=[];for(let p=1;p4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:zo(r[0],r[1],r[2],r[3]),!s))return new Xe(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new Vt(s||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(const s of this.args){r=s.evaluate(e);const o=$i.parse(r);if(o)return o}throw new Vt(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(const s of this.args){r=s.evaluate(e);const o=fi.parse(r);if(o)return o}throw new Vt(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(const s of this.args){if(r=s.evaluate(e),r===null)return 0;const o=Number(r);if(!isNaN(o))return o}throw new Vt(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return Ot.fromString(sn(this.args[0].evaluate(e)));case"resolvedImage":return ir.fromString(sn(this.args[0].evaluate(e)));default:return sn(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const ns=["Unknown","Point","LineString","Polygon"];class pt{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?ns[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(e){let r=this._parseColorCache[e];return r||(r=this._parseColorCache[e]=Xe.parse(e)),r}}class Ns{constructor(e,r,s=[],o,u=new Or,p=[]){this.registry=e,this.path=s,this.key=s.map(f=>`[${f}]`).join(""),this.scope=u,this.errors=p,this.expectedType=o,this._isConstant=r}parse(e,r,s,o,u={}){return r?this.concat(r,s,o)._parse(e,u):this._parse(e,u)}_parse(e,r){function s(o,u,p){return p==="assert"?new mi(u,[o]):p==="coerce"?new Ir(u,[o]):o}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const o=e[0];if(typeof o!="string")return this.error(`Expression name must be a string, but found ${typeof o} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const u=this.registry[o];if(u){let p=u.parse(e,this);if(!p)return null;if(this.expectedType){const f=this.expectedType,_=p.type;if(f.kind!=="string"&&f.kind!=="number"&&f.kind!=="boolean"&&f.kind!=="object"&&f.kind!=="array"||_.kind!=="value")if(f.kind!=="color"&&f.kind!=="formatted"&&f.kind!=="resolvedImage"||_.kind!=="value"&&_.kind!=="string")if(f.kind!=="padding"||_.kind!=="value"&&_.kind!=="number"&&_.kind!=="array")if(f.kind!=="variableAnchorOffsetCollection"||_.kind!=="value"&&_.kind!=="array"){if(this.checkSubtype(f,_))return null}else p=s(p,f,r.typeAnnotation||"coerce");else p=s(p,f,r.typeAnnotation||"coerce");else p=s(p,f,r.typeAnnotation||"coerce");else p=s(p,f,r.typeAnnotation||"assert")}if(!(p instanceof gn)&&p.type.kind!=="resolvedImage"&&this._isConstant(p)){const f=new pt;try{p=new gn(p.type,p.evaluate(f))}catch(_){return this.error(_.message),null}}return p}return this.error(`Unknown expression "${o}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,r,s){const o=typeof e=="number"?this.path.concat(e):this.path,u=s?this.scope.concat(s):this.scope;return new Ns(this.registry,this._isConstant,o,r||null,u,this.errors)}error(e,...r){const s=`${this.key}${r.map(o=>`[${o}]`).join("")}`;this.errors.push(new zi(s,e))}checkSubtype(e,r){const s=Sr(e,r);return s&&this.error(s),s}}class Fn{constructor(e,r,s){this.type=Tr,this.locale=s,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");const s=e[1];if(typeof s!="object"||Array.isArray(s))return r.error("Collator options argument must be an object.");const o=r.parse(s["case-sensitive"]!==void 0&&s["case-sensitive"],1,Ye);if(!o)return null;const u=r.parse(s["diacritic-sensitive"]!==void 0&&s["diacritic-sensitive"],1,Ye);if(!u)return null;let p=null;return s.locale&&(p=r.parse(s.locale,1,Ke),!p)?null:new Fn(o,u,p)}evaluate(e){return new Gt(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}const an=8192;function $s(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function ss(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function Pl(i,e){const r=(180+i[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,o=Math.pow(2,e.z);return[Math.round(r*o*an),Math.round(s*o*an)]}function ko(i,e,r){const s=i[0]-e[0],o=i[1]-e[1],u=i[0]-r[0],p=i[1]-r[1];return s*p-u*o==0&&s*u<=0&&o*p<=0}function qs(i,e){let r=!1;for(let p=0,f=e.length;p(s=i)[1]!=(u=_[x+1])[1]>s[1]&&s[0]<(u[0]-o[0])*(s[1]-o[1])/(u[1]-o[1])+o[0]&&(r=!r)}}var s,o,u;return r}function zl(i,e){for(let r=0;r0&&f<0||p<0&&f>0}function kl(i,e,r){for(const x of r)for(let w=0;wr[2]){const o=.5*s;let u=i[0]-r[0]>o?-s:r[0]-i[0]>o?s:0;u===0&&(u=i[0]-r[2]>o?-s:r[2]-i[0]>o?s:0),i[0]+=u}$s(e,i)}function js(i,e,r,s){const o=Math.pow(2,s.z)*an,u=[s.x*an,s.y*an],p=[];for(const f of i)for(const _ of f){const x=[_.x+u[0],_.y+u[1]];Fo(x,e,r,o),p.push(x)}return p}function Oo(i,e,r,s){const o=Math.pow(2,s.z)*an,u=[s.x*an,s.y*an],p=[];for(const _ of i){const x=[];for(const w of _){const E=[w.x+u[0],w.y+u[1]];$s(e,E),x.push(E)}p.push(x)}if(e[2]-e[0]<=o/2){(f=e)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const _ of p)for(const x of _)Fo(x,e,r,o)}var f;return p}class _n{constructor(e,r){this.type=Ye,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Os(e[1])){const s=e[1];if(s.type==="FeatureCollection")for(let o=0;o!Array.isArray(x)||x.length===e.length-1);let _=null;for(const[x,w]of f){_=new Ns(r.registry,as,r.path,null,r.scope);const E=[];let I=!1;for(let M=1;M{return I=E,Array.isArray(I)?`(${I.map(bt).join(", ")})`:`(${bt(I.type)}...)`;var I}).join(" | "),w=[];for(let E=1;E{r=e?r&&as(s):r&&s instanceof gn}),!!r&&Xs(i)&&ls(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Xs(i){if(i instanceof qi&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||/^filter-/.test(i.name))||i instanceof _n)return!1;let e=!0;return i.eachChild(r=>{e&&!Xs(r)&&(e=!1)}),e}function os(i){if(i instanceof qi&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!os(r)&&(e=!1)}),e}function ls(i,e){if(i instanceof qi&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(s=>{r&&!ls(s,e)&&(r=!1)}),r}function cs(i,e){const r=i.length-1;let s,o,u=0,p=r,f=0;for(;u<=p;)if(f=Math.floor((u+p)/2),s=i[f],o=i[f+1],s<=e){if(f===r||ee))throw new Vt("Input is not a number.");p=f-1}return 0}class hs{constructor(e,r,s){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[o,u]of s)this.labels.push(o),this.outputs.push(u)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");const s=r.parse(e[1],1,Te);if(!s)return null;const o=[];let u=null;r.expectedType&&r.expectedType.kind!=="value"&&(u=r.expectedType);for(let p=1;p=f)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',x);const E=r.parse(_,w,u);if(!E)return null;u=u||E.type,o.push([f,E])}return new hs(u,s,o)}evaluate(e){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(e);const o=this.input.evaluate(e);if(o<=r[0])return s[0].evaluate(e);const u=r.length;return o>=r[u-1]?s[u-1].evaluate(e):s[cs(r,o)].evaluate(e)}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function yn(i,e,r){return i+r*(e-i)}function Ws(i,e,r){return i.map((s,o)=>yn(s,e[o],r))}const Zi={number:yn,color:function(i,e,r,s="rgb"){switch(s){case"rgb":{const[o,u,p,f]=Ws(i.rgb,e.rgb,r);return new Xe(o,u,p,f,!1)}case"hcl":{const[o,u,p,f]=i.hcl,[_,x,w,E]=e.hcl;let I,M;if(isNaN(o)||isNaN(_))isNaN(o)?isNaN(_)?I=NaN:(I=_,p!==1&&p!==0||(M=x)):(I=o,w!==1&&w!==0||(M=u));else{let Q=_-o;_>o&&Q>180?Q-=360:_180&&(Q+=360),I=o+r*Q}const[P,B,U,$]=function([Q,W,ie,se]){return Q=isNaN(Q)?0:Q*te,Le([ie,Math.cos(Q)*W,Math.sin(Q)*W,se])}([I,M??yn(u,x,r),yn(p,w,r),yn(f,E,r)]);return new Xe(P,B,U,$,!1)}case"lab":{const[o,u,p,f]=Le(Ws(i.lab,e.lab,r));return new Xe(o,u,p,f,!1)}}},array:Ws,padding:function(i,e,r){return new $i(Ws(i.values,e.values,r))},variableAnchorOffsetCollection:function(i,e,r){const s=i.values,o=e.values;if(s.length!==o.length)throw new Vt(`Cannot interpolate values of different length. from: ${i.toString()}, to: ${e.toString()}`);const u=[];for(let p=0;ptypeof w!="number"||w<0||w>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);o={name:"cubic-bezier",controlPoints:x}}}if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(u=r.parse(u,2,Te),!u)return null;const f=[];let _=null;s==="interpolate-hcl"||s==="interpolate-lab"?_=pi:r.expectedType&&r.expectedType.kind!=="value"&&(_=r.expectedType);for(let x=0;x=w)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',I);const P=r.parse(E,M,_);if(!P)return null;_=_||P.type,f.push([w,P])}return A(_,Te)||A(_,pi)||A(_,rn)||A(_,nn)||A(_,ci(Te))?new ji(_,s,o,u,f):r.error(`Type ${bt(_)} is not interpolatable.`)}evaluate(e){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(e);const o=this.input.evaluate(e);if(o<=r[0])return s[0].evaluate(e);const u=r.length;if(o>=r[u-1])return s[u-1].evaluate(e);const p=cs(r,o),f=ji.interpolationFactor(this.interpolation,o,r[p],r[p+1]),_=s[p].evaluate(e),x=s[p+1].evaluate(e);switch(this.operator){case"interpolate":return Zi[this.type.kind](_,x,f);case"interpolate-hcl":return Zi.color(_,x,f,"hcl");case"interpolate-lab":return Zi.color(_,x,f,"lab")}}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function ka(i,e,r,s){const o=s-r,u=i-r;return o===0?0:e===1?u/o:(Math.pow(e,u)-1)/(Math.pow(e,o)-1)}class Hs{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expectected at least one argument.");let s=null;const o=r.expectedType;o&&o.kind!=="value"&&(s=o);const u=[];for(const f of e.slice(1)){const _=r.parse(f,1+u.length,s,void 0,{typeAnnotation:"omit"});if(!_)return null;s=s||_.type,u.push(_)}if(!s)throw new Error("No output type");const p=o&&u.some(f=>Sr(o,f.type));return new Hs(p?Ge:s,u)}evaluate(e){let r,s=null,o=0;for(const u of this.args)if(o++,s=u.evaluate(e),s&&s instanceof ir&&!s.available&&(r||(r=s.name),s=null,o===this.args.length&&(s=r)),s!==null)break;return s}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}class On{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const s=[];for(let u=1;u=s.length)throw new Vt(`Array index out of bounds: ${r} > ${s.length-1}.`);if(r!==Math.floor(r))throw new Vt(`Array index must be an integer, but found ${r} instead.`);return s[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class lt{constructor(e,r){this.type=Ye,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,Ge),o=r.parse(e[2],2,Ge);return s&&o?O(s.type,[Ye,Ke,Te,tn,Ge])?new lt(s,o):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${bt(s.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!s)return!1;if(!S(r,["boolean","string","number","null"]))throw new Vt(`Expected first argument to be of type boolean, string, number or null, but found ${bt(Ut(r))} instead.`);if(!S(s,["string","array"]))throw new Vt(`Expected second argument to be of type array or string, but found ${bt(Ut(s))} instead.`);return s.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Ks{constructor(e,r,s){this.type=Te,this.needle=e,this.haystack=r,this.fromIndex=s}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,Ge),o=r.parse(e[2],2,Ge);if(!s||!o)return null;if(!O(s.type,[Ye,Ke,Te,tn,Ge]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${bt(s.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,Te);return u?new Ks(s,o,u):null}return new Ks(s,o)}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!S(r,["boolean","string","number","null"]))throw new Vt(`Expected first argument to be of type boolean, string, number or null, but found ${bt(Ut(r))} instead.`);if(!S(s,["string","array"]))throw new Vt(`Expected second argument to be of type array or string, but found ${bt(Ut(s))} instead.`);if(this.fromIndex){const o=this.fromIndex.evaluate(e);return s.indexOf(r,o)}return s.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class Da{constructor(e,r,s,o,u,p){this.inputType=e,this.type=r,this.input=s,this.cases=o,this.outputs=u,this.otherwise=p}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error("Expected an even number of arguments.");let s,o;r.expectedType&&r.expectedType.kind!=="value"&&(o=r.expectedType);const u={},p=[];for(let x=2;xNumber.MAX_SAFE_INTEGER)return I.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof P=="number"&&Math.floor(P)!==P)return I.error("Numeric branch labels must be integer values.");if(s){if(I.checkSubtype(s,Ut(P)))return null}else s=Ut(P);if(u[String(P)]!==void 0)return I.error("Branch labels must be unique.");u[String(P)]=p.length}const M=r.parse(E,x,o);if(!M)return null;o=o||M.type,p.push(M)}const f=r.parse(e[1],1,Ge);if(!f)return null;const _=r.parse(e[e.length-1],e.length-1,o);return _?f.type.kind!=="value"&&r.concat(1).checkSubtype(s,f.type)?null:new Da(s,o,f,u,p,_):null}evaluate(e){const r=this.input.evaluate(e);return(Ut(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class La{constructor(e,r,s){this.type=e,this.branches=r,this.otherwise=s}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error("Expected an odd number of arguments.");let s;r.expectedType&&r.expectedType.kind!=="value"&&(s=r.expectedType);const o=[];for(let p=1;pr.outputDefined())&&this.otherwise.outputDefined()}}class Ys{constructor(e,r,s,o){this.type=e,this.input=r,this.beginIndex=s,this.endIndex=o}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,Ge),o=r.parse(e[2],2,Te);if(!s||!o)return null;if(!O(s.type,[ci(Ge),Ke,Ge]))return r.error(`Expected first argument to be of type array or string, but found ${bt(s.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,Te);return u?new Ys(s.type,s,o,u):null}return new Ys(s.type,s,o)}evaluate(e){const r=this.input.evaluate(e),s=this.beginIndex.evaluate(e);if(!S(r,["string","array"]))throw new Vt(`Expected first argument to be of type array or string, but found ${bt(Ut(r))} instead.`);if(this.endIndex){const o=this.endIndex.evaluate(e);return r.slice(s,o)}return r.slice(s)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Uo(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function Vo(i,e,r,s){return s.compare(e,r)===0}function Vn(i,e,r){const s=i!=="=="&&i!=="!=";return class Cu{constructor(u,p,f){this.type=Ye,this.lhs=u,this.rhs=p,this.collator=f,this.hasUntypedArgument=u.type.kind==="value"||p.type.kind==="value"}static parse(u,p){if(u.length!==3&&u.length!==4)return p.error("Expected two or three arguments.");const f=u[0];let _=p.parse(u[1],1,Ge);if(!_)return null;if(!Uo(f,_.type))return p.concat(1).error(`"${f}" comparisons are not supported for type '${bt(_.type)}'.`);let x=p.parse(u[2],2,Ge);if(!x)return null;if(!Uo(f,x.type))return p.concat(2).error(`"${f}" comparisons are not supported for type '${bt(x.type)}'.`);if(_.type.kind!==x.type.kind&&_.type.kind!=="value"&&x.type.kind!=="value")return p.error(`Cannot compare types '${bt(_.type)}' and '${bt(x.type)}'.`);s&&(_.type.kind==="value"&&x.type.kind!=="value"?_=new mi(x.type,[_]):_.type.kind!=="value"&&x.type.kind==="value"&&(x=new mi(_.type,[x])));let w=null;if(u.length===4){if(_.type.kind!=="string"&&x.type.kind!=="string"&&_.type.kind!=="value"&&x.type.kind!=="value")return p.error("Cannot use collator to compare non-string types.");if(w=p.parse(u[3],3,Tr),!w)return null}return new Cu(_,x,w)}evaluate(u){const p=this.lhs.evaluate(u),f=this.rhs.evaluate(u);if(s&&this.hasUntypedArgument){const _=Ut(p),x=Ut(f);if(_.kind!==x.kind||_.kind!=="string"&&_.kind!=="number")throw new Vt(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${_.kind}, ${x.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const _=Ut(p),x=Ut(f);if(_.kind!=="string"||x.kind!=="string")return e(u,p,f)}return this.collator?r(u,p,f,this.collator.evaluate(u)):e(u,p,f)}eachChild(u){u(this.lhs),u(this.rhs),this.collator&&u(this.collator)}outputDefined(){return!0}}}const Dl=Vn("==",function(i,e,r){return e===r},Vo),Ll=Vn("!=",function(i,e,r){return e!==r},function(i,e,r,s){return!Vo(0,e,r,s)}),Bl=Vn("<",function(i,e,r){return e",function(i,e,r){return e>r},function(i,e,r,s){return s.compare(e,r)>0}),Fl=Vn("<=",function(i,e,r){return e<=r},function(i,e,r,s){return s.compare(e,r)<=0}),Ol=Vn(">=",function(i,e,r){return e>=r},function(i,e,r,s){return s.compare(e,r)>=0});class Ba{constructor(e,r,s,o,u){this.type=Ke,this.number=e,this.locale=r,this.currency=s,this.minFractionDigits=o,this.maxFractionDigits=u}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const s=r.parse(e[1],1,Te);if(!s)return null;const o=e[2];if(typeof o!="object"||Array.isArray(o))return r.error("NumberFormat options argument must be an object.");let u=null;if(o.locale&&(u=r.parse(o.locale,1,Ke),!u))return null;let p=null;if(o.currency&&(p=r.parse(o.currency,1,Ke),!p))return null;let f=null;if(o["min-fraction-digits"]&&(f=r.parse(o["min-fraction-digits"],1,Te),!f))return null;let _=null;return o["max-fraction-digits"]&&(_=r.parse(o["max-fraction-digits"],1,Te),!_)?null:new Ba(s,u,p,f,_)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class Js{constructor(e){this.type=Er,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const s=e[1];if(!Array.isArray(s)&&typeof s=="object")return r.error("First argument must be an image or text section.");const o=[];let u=!1;for(let p=1;p<=e.length-1;++p){const f=e[p];if(u&&typeof f=="object"&&!Array.isArray(f)){u=!1;let _=null;if(f["font-scale"]&&(_=r.parse(f["font-scale"],1,Te),!_))return null;let x=null;if(f["text-font"]&&(x=r.parse(f["text-font"],1,ci(Ke)),!x))return null;let w=null;if(f["text-color"]&&(w=r.parse(f["text-color"],1,pi),!w))return null;const E=o[o.length-1];E.scale=_,E.font=x,E.textColor=w}else{const _=r.parse(e[p],1,Ge);if(!_)return null;const x=_.type.kind;if(x!=="string"&&x!=="value"&&x!=="null"&&x!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");u=!0,o.push({content:_,scale:null,font:null,textColor:null})}}return new Js(o)}evaluate(e){return new Ot(this.sections.map(r=>{const s=r.content.evaluate(e);return Ut(s)===tr?new hi("",s,null,null,null):new hi(sn(s),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null)}))}eachChild(e){for(const r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}outputDefined(){return!1}}class Ra{constructor(e){this.type=tr,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const s=r.parse(e[1],1,Ke);return s?new Ra(s):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),s=ir.fromString(r);return s&&e.availableImages&&(s.available=e.availableImages.indexOf(r)>-1),s}eachChild(e){e(this.input)}outputDefined(){return!1}}class Fa{constructor(e){this.type=Te,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);const s=r.parse(e[1],1);return s?s.type.kind!=="array"&&s.type.kind!=="string"&&s.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${bt(s.type)} instead.`):new Fa(s):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new Vt(`Expected value to be of type string or array, but found ${bt(Ut(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Nn={"==":Dl,"!=":Ll,">":Rl,"<":Bl,">=":Ol,"<=":Fl,array:mi,at:Un,boolean:mi,case:La,coalesce:Hs,collator:Fn,format:Js,image:Ra,in:lt,"index-of":Ks,interpolate:ji,"interpolate-hcl":ji,"interpolate-lab":ji,length:Fa,let:On,literal:gn,match:Da,number:mi,"number-format":Ba,object:mi,slice:Ys,step:hs,string:mi,"to-boolean":Ir,"to-color":Ir,"to-number":Ir,"to-string":Ir,var:Gs,within:_n};function No(i,[e,r,s,o]){e=e.evaluate(i),r=r.evaluate(i),s=s.evaluate(i);const u=o?o.evaluate(i):1,p=zo(e,r,s,u);if(p)throw new Vt(p);return new Xe(e/255,r/255,s/255,u,!1)}function $o(i,e){return i in e}function Oa(i,e){const r=e[i];return r===void 0?null:r}function xn(i){return{type:i}}function qo(i){return{result:"success",value:i}}function $n(i){return{result:"error",value:i}}function qn(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function Zo(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function Ua(i){return!!i.expression&&i.expression.interpolated}function ut(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function Qs(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Ul(i){return i}function jo(i,e){const r=e.type==="color",s=i.stops&&typeof i.stops[0][0]=="object",o=s||!(s||i.property!==void 0),u=i.type||(Ua(e)?"exponential":"interval");if(r||e.type==="padding"){const w=r?Xe.parse:$i.parse;(i=Ai({},i)).stops&&(i.stops=i.stops.map(E=>[E[0],w(E[1])])),i.default=w(i.default?i.default:e.default)}if(i.colorSpace&&(p=i.colorSpace)!=="rgb"&&p!=="hcl"&&p!=="lab")throw new Error(`Unknown color space: "${i.colorSpace}"`);var p;let f,_,x;if(u==="exponential")f=Go;else if(u==="interval")f=Nl;else if(u==="categorical"){f=Vl,_=Object.create(null);for(const w of i.stops)_[w[0]]=w[1];x=typeof i.stops[0][0]}else{if(u!=="identity")throw new Error(`Unknown function type "${u}"`);f=$l}if(s){const w={},E=[];for(let P=0;PP[0]),evaluate:({zoom:P},B)=>Go({stops:I,base:i.base},e,P).evaluate(P,B)}}if(o){const w=u==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:w,interpolationFactor:ji.interpolationFactor.bind(void 0,w),zoomStops:i.stops.map(E=>E[0]),evaluate:({zoom:E})=>f(i,e,E,_,x)}}return{kind:"source",evaluate(w,E){const I=E&&E.properties?E.properties[i.property]:void 0;return I===void 0?vn(i.default,e.default):f(i,e,I,_,x)}}}function vn(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function Vl(i,e,r,s,o){return vn(typeof r===o?s[r]:void 0,i.default,e.default)}function Nl(i,e,r){if(ut(r)!=="number")return vn(i.default,e.default);const s=i.stops.length;if(s===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[s-1][0])return i.stops[s-1][1];const o=cs(i.stops.map(u=>u[0]),r);return i.stops[o][1]}function Go(i,e,r){const s=i.base!==void 0?i.base:1;if(ut(r)!=="number")return vn(i.default,e.default);const o=i.stops.length;if(o===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[o-1][0])return i.stops[o-1][1];const u=cs(i.stops.map(w=>w[0]),r),p=function(w,E,I,M){const P=M-I,B=w-I;return P===0?0:E===1?B/P:(Math.pow(E,B)-1)/(Math.pow(E,P)-1)}(r,s,i.stops[u][0],i.stops[u+1][0]),f=i.stops[u][1],_=i.stops[u+1][1],x=Zi[e.type]||Ul;return typeof f.evaluate=="function"?{evaluate(...w){const E=f.evaluate.apply(void 0,w),I=_.evaluate.apply(void 0,w);if(E!==void 0&&I!==void 0)return x(E,I,p,i.colorSpace)}}:x(f,_,p,i.colorSpace)}function $l(i,e,r){switch(e.type){case"color":r=Xe.parse(r);break;case"formatted":r=Ot.fromString(r.toString());break;case"resolvedImage":r=ir.fromString(r.toString());break;case"padding":r=$i.parse(r);break;default:ut(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return vn(r,i.default,e.default)}qi.register(Nn,{error:[{kind:"error"},[Ke],(i,[e])=>{throw new Vt(e.evaluate(i))}],typeof:[Ke,[Ge],(i,[e])=>bt(Ut(e.evaluate(i)))],"to-rgba":[ci(Te,4),[pi],(i,[e])=>{const[r,s,o,u]=e.evaluate(i).rgb;return[255*r,255*s,255*o,u]}],rgb:[pi,[Te,Te,Te],No],rgba:[pi,[Te,Te,Te,Te],No],has:{type:Ye,overloads:[[[Ke],(i,[e])=>$o(e.evaluate(i),i.properties())],[[Ke,Ur],(i,[e,r])=>$o(e.evaluate(i),r.evaluate(i))]]},get:{type:Ge,overloads:[[[Ke],(i,[e])=>Oa(e.evaluate(i),i.properties())],[[Ke,Ur],(i,[e,r])=>Oa(e.evaluate(i),r.evaluate(i))]]},"feature-state":[Ge,[Ke],(i,[e])=>Oa(e.evaluate(i),i.featureState||{})],properties:[Ur,[],i=>i.properties()],"geometry-type":[Ke,[],i=>i.geometryType()],id:[Ge,[],i=>i.id()],zoom:[Te,[],i=>i.globals.zoom],"heatmap-density":[Te,[],i=>i.globals.heatmapDensity||0],"line-progress":[Te,[],i=>i.globals.lineProgress||0],accumulated:[Ge,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Te,xn(Te),(i,e)=>{let r=0;for(const s of e)r+=s.evaluate(i);return r}],"*":[Te,xn(Te),(i,e)=>{let r=1;for(const s of e)r*=s.evaluate(i);return r}],"-":{type:Te,overloads:[[[Te,Te],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[Te],(i,[e])=>-e.evaluate(i)]]},"/":[Te,[Te,Te],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[Te,[Te,Te],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[Te,[],()=>Math.LN2],pi:[Te,[],()=>Math.PI],e:[Te,[],()=>Math.E],"^":[Te,[Te,Te],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[Te,[Te],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[Te,[Te],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[Te,[Te],(i,[e])=>Math.log(e.evaluate(i))],log2:[Te,[Te],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[Te,[Te],(i,[e])=>Math.sin(e.evaluate(i))],cos:[Te,[Te],(i,[e])=>Math.cos(e.evaluate(i))],tan:[Te,[Te],(i,[e])=>Math.tan(e.evaluate(i))],asin:[Te,[Te],(i,[e])=>Math.asin(e.evaluate(i))],acos:[Te,[Te],(i,[e])=>Math.acos(e.evaluate(i))],atan:[Te,[Te],(i,[e])=>Math.atan(e.evaluate(i))],min:[Te,xn(Te),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[Te,xn(Te),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[Te,[Te],(i,[e])=>Math.abs(e.evaluate(i))],round:[Te,[Te],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[Te,[Te],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[Te,[Te],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[Ye,[Ke,Ge],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[Ye,[Ge],(i,[e])=>i.id()===e.value],"filter-type-==":[Ye,[Ke],(i,[e])=>i.geometryType()===e.value],"filter-<":[Ye,[Ke,Ge],(i,[e,r])=>{const s=i.properties()[e.value],o=r.value;return typeof s==typeof o&&s{const r=i.id(),s=e.value;return typeof r==typeof s&&r":[Ye,[Ke,Ge],(i,[e,r])=>{const s=i.properties()[e.value],o=r.value;return typeof s==typeof o&&s>o}],"filter-id->":[Ye,[Ge],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>s}],"filter-<=":[Ye,[Ke,Ge],(i,[e,r])=>{const s=i.properties()[e.value],o=r.value;return typeof s==typeof o&&s<=o}],"filter-id-<=":[Ye,[Ge],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r<=s}],"filter->=":[Ye,[Ke,Ge],(i,[e,r])=>{const s=i.properties()[e.value],o=r.value;return typeof s==typeof o&&s>=o}],"filter-id->=":[Ye,[Ge],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>=s}],"filter-has":[Ye,[Ge],(i,[e])=>e.value in i.properties()],"filter-has-id":[Ye,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[Ye,[ci(Ke)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[Ye,[ci(Ge)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[Ye,[Ke,ci(Ge)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[Ye,[Ke,ci(Ge)],(i,[e,r])=>function(s,o,u,p){for(;u<=p;){const f=u+p>>1;if(o[f]===s)return!0;o[f]>s?p=f-1:u=f+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:Ye,overloads:[[[Ye,Ye],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[xn(Ye),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:Ye,overloads:[[[Ye,Ye],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[xn(Ye),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[Ye,[Ye],(i,[e])=>!e.evaluate(i)],"is-supported-script":[Ye,[Ke],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[Ke,[Ke],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[Ke,[Ke],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[Ke,xn(Ge),(i,e)=>e.map(r=>sn(r.evaluate(i))).join("")],"resolved-locale":[Ke,[Tr],(i,[e])=>e.evaluate(i).resolvedLocale()]});class Lt{constructor(e,r){var s;this.expression=e,this._warningHistory={},this._evaluator=new pt,this._defaultValue=r?(s=r).type==="color"&&Qs(s.default)?new Xe(0,0,0,0):s.type==="color"?Xe.parse(s.default)||null:s.type==="padding"?$i.parse(s.default)||null:s.type==="variableAnchorOffsetCollection"?fi.parse(s.default)||null:s.default===void 0?null:s.default:null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,s,o,u,p){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=s,this._evaluator.canonical=o,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=p,this.expression.evaluate(this._evaluator)}evaluate(e,r,s,o,u,p){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=s||null,this._evaluator.canonical=o,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=p||null;try{const f=this.expression.evaluate(this._evaluator);if(f==null||typeof f=="number"&&f!=f)return this._defaultValue;if(this._enumValues&&!(f in this._enumValues))throw new Vt(`Expected value to be one of ${Object.keys(this._enumValues).map(_=>JSON.stringify(_)).join(", ")}, but found ${JSON.stringify(f)} instead.`);return f}catch(f){return this._warningHistory[f.message]||(this._warningHistory[f.message]=!0,typeof console<"u"&&console.warn(f.message)),this._defaultValue}}}function ea(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in Nn}function nt(i,e){const r=new Ns(Nn,as,[],e?function(o){const u={color:pi,string:Ke,number:Te,enum:Ke,boolean:Ye,formatted:Er,padding:rn,resolvedImage:tr,variableAnchorOffsetCollection:nn};return o.type==="array"?ci(u[o.value]||Ge,o.length):u[o.type]}(e):void 0),s=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?qo(new Lt(s,e)):$n(r.errors)}class us{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!os(r.expression)}evaluateWithoutErrorHandling(e,r,s,o,u,p){return this._styleExpression.evaluateWithoutErrorHandling(e,r,s,o,u,p)}evaluate(e,r,s,o,u,p){return this._styleExpression.evaluate(e,r,s,o,u,p)}}class wt{constructor(e,r,s,o){this.kind=e,this.zoomStops=s,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!os(r.expression),this.interpolationType=o}evaluateWithoutErrorHandling(e,r,s,o,u,p){return this._styleExpression.evaluateWithoutErrorHandling(e,r,s,o,u,p)}evaluate(e,r,s,o,u,p){return this._styleExpression.evaluate(e,r,s,o,u,p)}interpolationFactor(e,r,s){return this.interpolationType?ji.interpolationFactor(this.interpolationType,e,r,s):0}}function Tt(i,e){const r=nt(i,e);if(r.result==="error")return r;const s=r.value.expression,o=Xs(s);if(!o&&!qn(e))return $n([new zi("","data expressions not supported")]);const u=ls(s,["zoom"]);if(!u&&!Zo(e))return $n([new zi("","zoom expressions not supported")]);const p=ds(s);return p||u?p instanceof zi?$n([p]):p instanceof ji&&!Ua(e)?$n([new zi("",'"interpolate" expressions cannot be used with this property')]):qo(p?new wt(o?"camera":"composite",r.value,p.labels,p instanceof ji?p.interpolation:void 0):new us(o?"constant":"source",r.value)):$n([new zi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class bn{constructor(e,r){this._parameters=e,this._specification=r,Ai(this,jo(this._parameters,this._specification))}static deserialize(e){return new bn(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function ds(i){let e=null;if(i instanceof On)e=ds(i.result);else if(i instanceof Hs){for(const r of i.args)if(e=ds(r),e)break}else(i instanceof hs||i instanceof ji)&&i.input instanceof qi&&i.input.name==="zoom"&&(e=i);return e instanceof zi||i.eachChild(r=>{const s=ds(r);s instanceof zi?e=s:!e&&s?e=new zi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&s&&e!==s&&(e=new zi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Va(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!Va(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const ql={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Na(i){if(i==null)return{filter:()=>!0,needGeometry:!1};Va(i)||(i=ps(i));const e=nt(i,ql);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,s,o)=>e.value.evaluate(r,s,{},o),needGeometry:$a(i)}}function Zl(i,e){return ie?1:0}function $a(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e"||e==="<="||e===">="?ta(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(ps))):e==="all"?["all"].concat(i.slice(1).map(ps)):e==="none"?["all"].concat(i.slice(1).map(ps).map(ra)):e==="in"?qa(i[1],i.slice(2)):e==="!in"?ra(qa(i[1],i.slice(2))):e==="has"?ia(i[1]):e==="!has"?ra(ia(i[1])):e!=="within"||i;var r}function ta(i,e,r){switch(i){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,i,e]}}function qa(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",i,["literal",e.sort(Zl)]]:["filter-in-small",i,["literal",e]]}}function ia(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function ra(i){return["!",i]}function Za(i){const e=typeof i;if(e==="number"||e==="boolean"||e==="string"||i==null)return JSON.stringify(i);if(Array.isArray(i)){let o="[";for(const u of i)o+=`${Za(u)},`;return`${o}]`}const r=Object.keys(i).sort();let s="{";for(let o=0;os.maximum?[new we(e,r,`${r} is greater than the maximum value ${s.maximum}`)]:[]}function Ga(i){const e=i.valueSpec,r=Nt(i.value.type);let s,o,u,p={};const f=r!=="categorical"&&i.value.property===void 0,_=!f,x=ut(i.value.stops)==="array"&&ut(i.value.stops[0])==="array"&&ut(i.value.stops[0][0])==="object",w=rr({key:i.key,value:i.value,valueSpec:i.styleSpec.function,validateSpec:i.validateSpec,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(M){if(r==="identity")return[new we(M.key,M.value,'identity function may not have a "stops" property')];let P=[];const B=M.value;return P=P.concat(ja({key:M.key,value:B,valueSpec:M.valueSpec,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec,arrayElementValidator:E})),ut(B)==="array"&&B.length===0&&P.push(new we(M.key,B,"array must have at least one stop")),P},default:function(M){return M.validateSpec({key:M.key,value:M.value,valueSpec:e,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec})}}});return r==="identity"&&f&&w.push(new we(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||w.push(new we(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!Ua(i.valueSpec)&&w.push(new we(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(_&&!qn(i.valueSpec)?w.push(new we(i.key,i.value,"property functions not supported")):f&&!Zo(i.valueSpec)&&w.push(new we(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!x||i.value.property!==void 0||w.push(new we(i.key,i.value,'"property" property is required')),w;function E(M){let P=[];const B=M.value,U=M.key;if(ut(B)!=="array")return[new we(U,B,`array expected, ${ut(B)} found`)];if(B.length!==2)return[new we(U,B,`array length 2 expected, length ${B.length} found`)];if(x){if(ut(B[0])!=="object")return[new we(U,B,`object expected, ${ut(B[0])} found`)];if(B[0].zoom===void 0)return[new we(U,B,"object stop key must have zoom")];if(B[0].value===void 0)return[new we(U,B,"object stop key must have value")];if(u&&u>Nt(B[0].zoom))return[new we(U,B[0].zoom,"stop zoom values must appear in ascending order")];Nt(B[0].zoom)!==u&&(u=Nt(B[0].zoom),o=void 0,p={}),P=P.concat(rr({key:`${U}[0]`,value:B[0],valueSpec:{zoom:{}},validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec,objectElementValidators:{zoom:na,value:I}}))}else P=P.concat(I({key:`${U}[0]`,value:B[0],valueSpec:{},validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec},B));return ea(wn(B[1]))?P.concat([new we(`${U}[1]`,B[1],"expressions are not allowed in function stops.")]):P.concat(M.validateSpec({key:`${U}[1]`,value:B[1],valueSpec:e,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec}))}function I(M,P){const B=ut(M.value),U=Nt(M.value),$=M.value!==null?M.value:P;if(s){if(B!==s)return[new we(M.key,$,`${B} stop domain type must match previous stop domain type ${s}`)]}else s=B;if(B!=="number"&&B!=="string"&&B!=="boolean")return[new we(M.key,$,"stop domain value must be a number, string, or boolean")];if(B!=="number"&&r!=="categorical"){let Q=`number expected, ${B} found`;return qn(e)&&r===void 0&&(Q+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new we(M.key,$,Q)]}return r!=="categorical"||B!=="number"||isFinite(U)&&Math.floor(U)===U?r!=="categorical"&&B==="number"&&o!==void 0&&Unew we(`${i.key}${s.key}`,i.value,s.message));const r=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new we(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!os(r))return[new we(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!os(r))return[new we(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!ls(r,["zoom","feature-state"]))return[new we(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!Xs(r))return[new we(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function fs(i){const e=i.key,r=i.value,s=i.valueSpec,o=[];return Array.isArray(s.values)?s.values.indexOf(Nt(r))===-1&&o.push(new we(e,r,`expected one of [${s.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(s.values).indexOf(Nt(r))===-1&&o.push(new we(e,r,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(r)} found`)),o}function sa(i){return Va(wn(i.value))?Vr(Ai({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Wo(i)}function Wo(i){const e=i.value,r=i.key;if(ut(e)!=="array")return[new we(r,e,`array expected, ${ut(e)} found`)];const s=i.styleSpec;let o,u=[];if(e.length<1)return[new we(r,e,"filter array must have at least 1 element")];switch(u=u.concat(fs({key:`${r}[0]`,value:e[0],valueSpec:s.filter_operator,style:i.style,styleSpec:i.styleSpec})),Nt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Nt(e[1])==="$type"&&u.push(new we(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&u.push(new we(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(o=ut(e[1]),o!=="string"&&u.push(new we(`${r}[1]`,e[1],`string expected, ${o} found`)));for(let p=2;p{x in r&&e.push(new we(s,r[x],`"${x}" is prohibited for ref layers`))}),o.layers.forEach(x=>{Nt(x.id)===f&&(_=x)}),_?_.ref?e.push(new we(s,r.ref,"ref cannot reference another ref layer")):p=Nt(_.type):e.push(new we(s,r.ref,`ref layer "${f}" not found`))}else if(p!=="background")if(r.source){const _=o.sources&&o.sources[r.source],x=_&&Nt(_.type);_?x==="vector"&&p==="raster"?e.push(new we(s,r.source,`layer "${r.id}" requires a raster source`)):x==="raster"&&p!=="raster"?e.push(new we(s,r.source,`layer "${r.id}" requires a vector source`)):x!=="vector"||r["source-layer"]?x==="raster-dem"&&p!=="hillshade"?e.push(new we(s,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):p!=="line"||!r.paint||!r.paint["line-gradient"]||x==="geojson"&&_.lineMetrics||e.push(new we(s,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new we(s,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new we(s,r.source,`source "${r.source}" not found`))}else e.push(new we(s,r,'missing required property "source"'));return e=e.concat(rr({key:s,value:r,valueSpec:u.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${s}.type`,value:r.type,valueSpec:u.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:r,objectKey:"type"}),filter:sa,layout:_=>rr({layer:r,key:_.key,value:_.value,style:_.style,styleSpec:_.styleSpec,validateSpec:_.validateSpec,objectElementValidators:{"*":x=>oa(Ai({layerType:p},x))}}),paint:_=>rr({layer:r,key:_.key,value:_.value,style:_.style,styleSpec:_.styleSpec,validateSpec:_.validateSpec,objectElementValidators:{"*":x=>ms(Ai({layerType:p},x))}})}})),e}function on(i){const e=i.value,r=i.key,s=ut(e);return s!=="string"?[new we(r,e,`string expected, ${s} found`)]:[]}const Ho={promoteId:function({key:i,value:e}){if(ut(e)==="string")return on({key:i,value:e});{const r=[];for(const s in e)r.push(...on({key:`${i}.${s}`,value:e[s]}));return r}}};function gs(i){const e=i.value,r=i.key,s=i.styleSpec,o=i.style,u=i.validateSpec;if(!e.type)return[new we(r,e,'"type" is required')];const p=Nt(e.type);let f;switch(p){case"vector":case"raster":case"raster-dem":return f=rr({key:r,value:e,valueSpec:s[`source_${p.replace("-","_")}`],style:i.style,styleSpec:s,objectElementValidators:Ho,validateSpec:u}),f;case"geojson":if(f=rr({key:r,value:e,valueSpec:s.source_geojson,style:o,styleSpec:s,validateSpec:u,objectElementValidators:Ho}),e.cluster)for(const _ in e.clusterProperties){const[x,w]=e.clusterProperties[_],E=typeof x=="string"?[x,["accumulated"],["get",_]]:x;f.push(...Vr({key:`${r}.${_}.map`,value:w,validateSpec:u,expressionContext:"cluster-map"})),f.push(...Vr({key:`${r}.${_}.reduce`,value:E,validateSpec:u,expressionContext:"cluster-reduce"}))}return f;case"video":return rr({key:r,value:e,valueSpec:s.source_video,style:o,validateSpec:u,styleSpec:s});case"image":return rr({key:r,value:e,valueSpec:s.source_image,style:o,validateSpec:u,styleSpec:s});case"canvas":return[new we(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return fs({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:o,validateSpec:u,styleSpec:s})}}function Ko(i){const e=i.value,r=i.styleSpec,s=r.light,o=i.style;let u=[];const p=ut(e);if(e===void 0)return u;if(p!=="object")return u=u.concat([new we("light",e,`object expected, ${p} found`)]),u;for(const f in e){const _=f.match(/^(.*)-transition$/);u=u.concat(_&&s[_[1]]&&s[_[1]].transition?i.validateSpec({key:f,value:e[f],valueSpec:r.transition,validateSpec:i.validateSpec,style:o,styleSpec:r}):s[f]?i.validateSpec({key:f,value:e[f],valueSpec:s[f],validateSpec:i.validateSpec,style:o,styleSpec:r}):[new we(f,e[f],`unknown property "${f}"`)])}return u}function Yo(i){const e=i.value,r=i.styleSpec,s=r.terrain,o=i.style;let u=[];const p=ut(e);if(e===void 0)return u;if(p!=="object")return u=u.concat([new we("terrain",e,`object expected, ${p} found`)]),u;for(const f in e)u=u.concat(s[f]?i.validateSpec({key:f,value:e[f],valueSpec:s[f],validateSpec:i.validateSpec,style:o,styleSpec:r}):[new we(f,e[f],`unknown property "${f}"`)]);return u}function Jo(i){let e=[];const r=i.value,s=i.key;if(Array.isArray(r)){const o=[],u=[];for(const p in r)r[p].id&&o.includes(r[p].id)&&e.push(new we(s,r,`all the sprites' ids must be unique, but ${r[p].id} is duplicated`)),o.push(r[p].id),r[p].url&&u.includes(r[p].url)&&e.push(new we(s,r,`all the sprites' URLs must be unique, but ${r[p].url} is duplicated`)),u.push(r[p].url),e=e.concat(rr({key:`${s}[${p}]`,value:r[p],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return e}return on({key:s,value:r})}const Qo={"*":()=>[],array:ja,boolean:function(i){const e=i.value,r=i.key,s=ut(e);return s!=="boolean"?[new we(r,e,`boolean expected, ${s} found`)]:[]},number:na,color:function(i){const e=i.key,r=i.value,s=ut(r);return s!=="string"?[new we(e,r,`color expected, ${s} found`)]:Xe.parse(String(r))?[]:[new we(e,r,`color expected, "${r}" found`)]},constants:Xo,enum:fs,filter:sa,function:Ga,layer:la,object:rr,source:gs,light:Ko,terrain:Yo,string:on,formatted:function(i){return on(i).length===0?[]:Vr(i)},resolvedImage:function(i){return on(i).length===0?[]:Vr(i)},padding:function(i){const e=i.key,r=i.value;if(ut(r)==="array"){if(r.length<1||r.length>4)return[new we(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const s={type:"number"};let o=[];for(let u=0;u[]}})),i.constants&&(r=r.concat(Xo({key:"constants",value:i.constants,style:i,styleSpec:e,validateSpec:_s}))),xs(r)}function Xt(i){return function(e){return i({...e,validateSpec:_s})}}function xs(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function Nr(i){return function(...e){return xs(i.apply(this,e))}}Gi.source=Nr(Xt(gs)),Gi.sprite=Nr(Xt(Jo)),Gi.glyphs=Nr(Xt(ys)),Gi.light=Nr(Xt(Ko)),Gi.terrain=Nr(Xt(Yo)),Gi.layer=Nr(Xt(la)),Gi.filter=Nr(Xt(sa)),Gi.paintProperty=Nr(Xt(ms)),Gi.layoutProperty=Nr(Xt(oa));const vs=Gi,Gl=vs.light,bs=vs.paintProperty,Xl=vs.layoutProperty;function ca(i,e){let r=!1;if(e&&e.length)for(const s of e)i.fire(new Ni(new Error(s.message))),r=!0;return r}class ws{constructor(e,r,s){const o=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const p=new Int32Array(this.arrayBuffer);e=p[0],this.d=(r=p[1])+2*(s=p[2]);for(let _=0;_=E[P+0]&&o>=E[P+1])?(f[M]=!0,p.push(w[M])):f[M]=!1}}}}_forEachCell(e,r,s,o,u,p,f,_){const x=this._convertToCellCoord(e),w=this._convertToCellCoord(r),E=this._convertToCellCoord(s),I=this._convertToCellCoord(o);for(let M=x;M<=E;M++)for(let P=w;P<=I;P++){const B=this.d*P+M;if((!_||_(this._convertFromCellCoord(M),this._convertFromCellCoord(P),this._convertFromCellCoord(M+1),this._convertFromCellCoord(P+1)))&&u.call(this,e,r,s,o,B,p,f,_))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,r=3+this.cells.length+1+1;let s=0;for(let p=0;p=0)continue;const p=i[u];o[u]=Ar[s].shallow.indexOf(u)>=0?p:Ts(p,e)}i instanceof Error&&(o.message=i.message)}if(o.$name)throw new Error("$name property is reserved for worker serialization logic.");return s!=="Object"&&(o.$name=s),o}throw new Error("can't serialize object of type "+typeof i)}function Tn(i){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||Zn(i)||Ti(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(Tn);if(typeof i=="object"){const e=i.$name||"Object";if(!Ar[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=Ar[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(i);const s=Object.create(r.prototype);for(const o of Object.keys(i)){if(o==="$name")continue;const u=i[o];s[o]=Ar[e].shallow.indexOf(o)>=0?u:Tn(u)}return s}throw new Error("can't deserialize object of type "+typeof i)}class Xa{constructor(){this.first=!0}update(e,r){const s=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=s,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=s,!0):(this.lastFloorZoom>s?(this.lastIntegerZoom=s+1,this.lastIntegerZoomTime=r):this.lastFloorZoomi>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function ha(i){for(const e of i)if(Es(e.charCodeAt(0)))return!0;return!1}function el(i){for(const e of i)if(!Wl(e.charCodeAt(0)))return!1;return!0}function Wl(i){return!(Ie.Arabic(i)||Ie["Arabic Supplement"](i)||Ie["Arabic Extended-A"](i)||Ie["Arabic Presentation Forms-A"](i)||Ie["Arabic Presentation Forms-B"](i))}function Es(i){return!(i!==746&&i!==747&&(i<4352||!(Ie["Bopomofo Extended"](i)||Ie.Bopomofo(i)||Ie["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||Ie["CJK Compatibility Ideographs"](i)||Ie["CJK Compatibility"](i)||Ie["CJK Radicals Supplement"](i)||Ie["CJK Strokes"](i)||!(!Ie["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||Ie["CJK Unified Ideographs Extension A"](i)||Ie["CJK Unified Ideographs"](i)||Ie["Enclosed CJK Letters and Months"](i)||Ie["Hangul Compatibility Jamo"](i)||Ie["Hangul Jamo Extended-A"](i)||Ie["Hangul Jamo Extended-B"](i)||Ie["Hangul Jamo"](i)||Ie["Hangul Syllables"](i)||Ie.Hiragana(i)||Ie["Ideographic Description Characters"](i)||Ie.Kanbun(i)||Ie["Kangxi Radicals"](i)||Ie["Katakana Phonetic Extensions"](i)||Ie.Katakana(i)&&i!==12540||!(!Ie["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!Ie["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||Ie["Unified Canadian Aboriginal Syllabics"](i)||Ie["Unified Canadian Aboriginal Syllabics Extended"](i)||Ie["Vertical Forms"](i)||Ie["Yijing Hexagram Symbols"](i)||Ie["Yi Syllables"](i)||Ie["Yi Radicals"](i))))}function Ss(i){return!(Es(i)||function(e){return!!(Ie["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||Ie["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||Ie["Letterlike Symbols"](e)||Ie["Number Forms"](e)||Ie["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||Ie["Control Pictures"](e)&&e!==9251||Ie["Optical Character Recognition"](e)||Ie["Enclosed Alphanumerics"](e)||Ie["Geometric Shapes"](e)||Ie["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||Ie["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Ie["CJK Symbols and Punctuation"](e)||Ie.Katakana(e)||Ie["Private Use Area"](e)||Ie["CJK Compatibility Forms"](e)||Ie["Small Form Variants"](e)||Ie["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(i))}function Wa(i){return i>=1424&&i<=2303||Ie["Arabic Presentation Forms-A"](i)||Ie["Arabic Presentation Forms-B"](i)}function Hl(i,e){return!(!e&&Wa(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||Ie.Khmer(i))}function tl(i){for(const e of i)if(Wa(e.charCodeAt(0)))return!0;return!1}const Ha="deferred",Is="loading",Ka="loaded";let Ya=null,Di="unavailable",ln=null;const Ja=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(Di="error"),Ya&&Ya(i)};function Qa(){eo.fire(new Ii("pluginStateChange",{pluginStatus:Di,pluginURL:ln}))}const eo=new pr,to=function(){return Di},il=function(){if(Di!==Ha||!ln)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Di=Is,Qa(),ln&&Br({url:ln},i=>{i?Ja(i):(Di=Ka,Qa())})},nr={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Di===Ka||nr.applyArabicShaping!=null,isLoading:()=>Di===Is,setState(i){if(!Pi())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Di=i.pluginStatus,ln=i.pluginURL},isParsed(){if(!Pi())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return nr.applyArabicShaping!=null&&nr.processBidirectionalText!=null&&nr.processStyledBidirectionalText!=null},getPluginURL(){if(!Pi())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return ln}};class St{constructor(e,r){this.zoom=e,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Xa,this.transition={})}isSupportedScript(e){return function(r,s){for(const o of r)if(!Hl(o.charCodeAt(0),s))return!1;return!0}(e,nr.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,r=e-Math.floor(e),s=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*s}:{fromScale:.5,toScale:1,t:1-(1-s)*r}}}class ua{constructor(e,r){this.property=e,this.value=r,this.expression=function(s,o){if(Qs(s))return new bn(s,o);if(ea(s)){const u=Tt(s,o);if(u.result==="error")throw new Error(u.value.map(p=>`${p.key}: ${p.message}`).join(", "));return u.value}{let u=s;return o.type==="color"&&typeof s=="string"?u=Xe.parse(s):o.type!=="padding"||typeof s!="number"&&!Array.isArray(s)?o.type==="variableAnchorOffsetCollection"&&Array.isArray(s)&&(u=fi.parse(s)):u=$i.parse(s),{kind:"constant",evaluate:()=>u}}}(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,s){return this.property.possiblyEvaluate(this,e,r,s)}}class jn{constructor(e){this.property=e,this.value=new ua(e,void 0)}transitioned(e,r){return new da(this.property,this.value,r,Jt({},e.transition,this.transition),e.now)}untransitioned(){return new da(this.property,this.value,null,{},0)}}class rl{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return wi(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new jn(this._values[e].property)),this._values[e].value=new ua(this._values[e].property,r===null?void 0:wi(r))}getTransition(e){return wi(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new jn(this._values[e].property)),this._values[e].transition=wi(r)||void 0}serialize(){const e={};for(const r of Object.keys(this._values)){const s=this.getValue(r);s!==void 0&&(e[r]=s);const o=this.getTransition(r);o!==void 0&&(e[`${r}-transition`]=o)}return e}transitioned(e,r){const s=new nl(this._properties);for(const o of Object.keys(this._values))s._values[o]=this._values[o].transitioned(e,r._values[o]);return s}untransitioned(){const e=new nl(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class da{constructor(e,r,s,o,u){this.property=e,this.value=r,this.begin=u+o.delay||0,this.end=this.begin+o.duration||0,e.specification.transition&&(o.delay||o.duration)&&(this.prior=s)}possiblyEvaluate(e,r,s){const o=e.now||0,u=this.value.possiblyEvaluate(e,r,s),p=this.prior;if(p){if(o>this.end)return this.prior=null,u;if(this.value.isDataDriven())return this.prior=null,u;if(o=1)return 1;const x=_*_,w=x*_;return 4*(_<.5?w:3*(_-x)+w-.75)}(f))}}return u}}class nl{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,s){const o=new As(this._properties);for(const u of Object.keys(this._values))o._values[u]=this._values[u].possiblyEvaluate(e,r,s);return o}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Kl{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return wi(this._values[e].value)}setValue(e,r){this._values[e]=new ua(this._values[e].property,r===null?void 0:wi(r))}serialize(){const e={};for(const r of Object.keys(this._values)){const s=this.getValue(r);s!==void 0&&(e[r]=s)}return e}possiblyEvaluate(e,r,s){const o=new As(this._properties);for(const u of Object.keys(this._values))o._values[u]=this._values[u].possiblyEvaluate(e,r,s);return o}}class fr{constructor(e,r,s){this.property=e,this.value=r,this.parameters=s}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,s,o){return this.property.evaluate(this.value,this.parameters,e,r,s,o)}}class As{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Ue{constructor(e){this.specification=e}possiblyEvaluate(e,r){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(r)}interpolate(e,r,s){const o=Zi[this.specification.type];return o?o(e,r,s):e}}class je{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,s,o){return new fr(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(r,null,{},s,o)}:e.expression,r)}interpolate(e,r,s){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new fr(this,{kind:"constant",value:void 0},e.parameters);const o=Zi[this.specification.type];if(o){const u=o(e.value.value,r.value.value,s);return new fr(this,{kind:"constant",value:u},e.parameters)}return e}evaluate(e,r,s,o,u,p){return e.kind==="constant"?e.value:e.evaluate(r,s,o,u,p)}}class pa extends je{possiblyEvaluate(e,r,s,o){if(e.value===void 0)return new fr(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const u=e.expression.evaluate(r,null,{},s,o),p=e.property.specification.type==="resolvedImage"&&typeof u!="string"?u.name:u,f=this._calculate(p,p,p,r);return new fr(this,{kind:"constant",value:f},r)}if(e.expression.kind==="camera"){const u=this._calculate(e.expression.evaluate({zoom:r.zoom-1}),e.expression.evaluate({zoom:r.zoom}),e.expression.evaluate({zoom:r.zoom+1}),r);return new fr(this,{kind:"constant",value:u},r)}return new fr(this,e.expression,r)}evaluate(e,r,s,o,u,p){if(e.kind==="source"){const f=e.evaluate(r,s,o,u,p);return this._calculate(f,f,f,r)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},s,o),e.evaluate({zoom:Math.floor(r.zoom)},s,o),e.evaluate({zoom:Math.floor(r.zoom)+1},s,o),r):e.value}_calculate(e,r,s,o){return o.zoom>o.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:s,to:r}}interpolate(e){return e}}class io{constructor(e){this.specification=e}possiblyEvaluate(e,r,s,o){if(e.value!==void 0){if(e.expression.kind==="constant"){const u=e.expression.evaluate(r,null,{},s,o);return this._calculate(u,u,u,r)}return this._calculate(e.expression.evaluate(new St(Math.floor(r.zoom-1),r)),e.expression.evaluate(new St(Math.floor(r.zoom),r)),e.expression.evaluate(new St(Math.floor(r.zoom+1),r)),r)}}_calculate(e,r,s,o){return o.zoom>o.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:s,to:r}}interpolate(e){return e}}class ro{constructor(e){this.specification=e}possiblyEvaluate(e,r,s,o){return!!e.expression.evaluate(r,null,{},s,o)}interpolate(){return!1}}class Li{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in e){const s=e[r];s.specification.overridable&&this.overridableProperties.push(r);const o=this.defaultPropertyValues[r]=new ua(s,void 0),u=this.defaultTransitionablePropertyValues[r]=new jn(s);this.defaultTransitioningPropertyValues[r]=u.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=o.possiblyEvaluate({})}}}Pe("DataDrivenProperty",je),Pe("DataConstantProperty",Ue),Pe("CrossFadedDataDrivenProperty",pa),Pe("CrossFadedProperty",io),Pe("ColorRampProperty",ro);const En="-transition";class Cr extends pr{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new Kl(r.layout)),r.paint)){this._transitionablePaint=new rl(r.paint);for(const s in e.paint)this.setPaintProperty(s,e.paint[s],{validate:!1});for(const s in e.layout)this.setLayoutProperty(s,e.layout[s],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new As(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,s={}){r!=null&&this._validate(Xl,`layers.${this.id}.layout.${e}`,e,r,s)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(En)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,s={}){if(r!=null&&this._validate(bs,`layers.${this.id}.paint.${e}`,e,r,s))return!1;if(e.endsWith(En))return this._transitionablePaint.setTransition(e.slice(0,-11),r||void 0),!1;{const o=this._transitionablePaint._values[e],u=o.property.specification["property-type"]==="cross-faded-data-driven",p=o.value.isDataDriven(),f=o.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const _=this._transitionablePaint._values[e].value;return _.isDataDriven()||p||u||this._handleOverridablePaintPropertyUpdate(e,f,_)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,s){return!1}isHidden(e){return!!(this.minzoom&&e=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){const e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),Jr(e,(r,s)=>!(r===void 0||s==="layout"&&!Object.keys(r).length||s==="paint"&&!Object.keys(r).length))}_validate(e,r,s,o,u={}){return(!u||u.validate!==!1)&&ca(this,e.call(vs,{key:r,layerType:this.type,objectKey:s,value:o,styleSpec:le,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const r=this.paint.get(e);if(r instanceof fr&&qn(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const Yl={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Cs{constructor(e,r){this._structArray=e,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Pt{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,r){return e._trim(),r&&(e.isTransferred=!0,r.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const r=Object.create(this.prototype);return r.arrayBuffer=e.arrayBuffer,r.length=e.length,r.capacity=e.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_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(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function $t(i,e=1){let r=0,s=0;return{members:i.map(o=>{const u=Yl[o.type].BYTES_PER_ELEMENT,p=r=sl(r,Math.max(e,u)),f=o.components||1;return s=Math.max(s,u),r+=u*f,{name:o.name,type:o.type,components:f,offset:p}}),size:sl(r,Math.max(s,e)),alignment:e}}function sl(i,e){return Math.ceil(i/e)*e}class sr extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const o=2*e;return this.int16[o+0]=r,this.int16[o+1]=s,e}}sr.prototype.bytesPerElement=4,Pe("StructArrayLayout2i4",sr);class Ms extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,r,s)}emplace(e,r,s,o){const u=3*e;return this.int16[u+0]=r,this.int16[u+1]=s,this.int16[u+2]=o,e}}Ms.prototype.bytesPerElement=6,Pe("StructArrayLayout3i6",Ms);class Ps extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,o){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,s,o)}emplace(e,r,s,o,u){const p=4*e;return this.int16[p+0]=r,this.int16[p+1]=s,this.int16[p+2]=o,this.int16[p+3]=u,e}}Ps.prototype.bytesPerElement=8,Pe("StructArrayLayout4i8",Ps);class fa extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,o,u,p){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,o,u,p)}emplace(e,r,s,o,u,p,f){const _=6*e;return this.int16[_+0]=r,this.int16[_+1]=s,this.int16[_+2]=o,this.int16[_+3]=u,this.int16[_+4]=p,this.int16[_+5]=f,e}}fa.prototype.bytesPerElement=12,Pe("StructArrayLayout2i4i12",fa);class zs extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,o,u,p){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,o,u,p)}emplace(e,r,s,o,u,p,f){const _=4*e,x=8*e;return this.int16[_+0]=r,this.int16[_+1]=s,this.uint8[x+4]=o,this.uint8[x+5]=u,this.uint8[x+6]=p,this.uint8[x+7]=f,e}}zs.prototype.bytesPerElement=8,Pe("StructArrayLayout2i4ub8",zs);class ks extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const o=2*e;return this.float32[o+0]=r,this.float32[o+1]=s,e}}ks.prototype.bytesPerElement=8,Pe("StructArrayLayout2f8",ks);class Gn extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,o,u,p,f,_,x,w){const E=this.length;return this.resize(E+1),this.emplace(E,e,r,s,o,u,p,f,_,x,w)}emplace(e,r,s,o,u,p,f,_,x,w,E){const I=10*e;return this.uint16[I+0]=r,this.uint16[I+1]=s,this.uint16[I+2]=o,this.uint16[I+3]=u,this.uint16[I+4]=p,this.uint16[I+5]=f,this.uint16[I+6]=_,this.uint16[I+7]=x,this.uint16[I+8]=w,this.uint16[I+9]=E,e}}Gn.prototype.bytesPerElement=20,Pe("StructArrayLayout10ui20",Gn);class Sn extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,o,u,p,f,_,x,w,E,I){const M=this.length;return this.resize(M+1),this.emplace(M,e,r,s,o,u,p,f,_,x,w,E,I)}emplace(e,r,s,o,u,p,f,_,x,w,E,I,M){const P=12*e;return this.int16[P+0]=r,this.int16[P+1]=s,this.int16[P+2]=o,this.int16[P+3]=u,this.uint16[P+4]=p,this.uint16[P+5]=f,this.uint16[P+6]=_,this.uint16[P+7]=x,this.int16[P+8]=w,this.int16[P+9]=E,this.int16[P+10]=I,this.int16[P+11]=M,e}}Sn.prototype.bytesPerElement=24,Pe("StructArrayLayout4i4ui4i24",Sn);class no extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,r,s)}emplace(e,r,s,o){const u=3*e;return this.float32[u+0]=r,this.float32[u+1]=s,this.float32[u+2]=o,e}}no.prototype.bytesPerElement=12,Pe("StructArrayLayout3f12",no);class ma extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint32[1*e+0]=r,e}}ma.prototype.bytesPerElement=4,Pe("StructArrayLayout1ul4",ma);class In extends Pt{_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(e,r,s,o,u,p,f,_,x){const w=this.length;return this.resize(w+1),this.emplace(w,e,r,s,o,u,p,f,_,x)}emplace(e,r,s,o,u,p,f,_,x,w){const E=10*e,I=5*e;return this.int16[E+0]=r,this.int16[E+1]=s,this.int16[E+2]=o,this.int16[E+3]=u,this.int16[E+4]=p,this.int16[E+5]=f,this.uint32[I+3]=_,this.uint16[E+8]=x,this.uint16[E+9]=w,e}}In.prototype.bytesPerElement=20,Pe("StructArrayLayout6i1ul2ui20",In);class so extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,o,u,p){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,o,u,p)}emplace(e,r,s,o,u,p,f){const _=6*e;return this.int16[_+0]=r,this.int16[_+1]=s,this.int16[_+2]=o,this.int16[_+3]=u,this.int16[_+4]=p,this.int16[_+5]=f,e}}so.prototype.bytesPerElement=12,Pe("StructArrayLayout2i2i2i12",so);class ao extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,o,u){const p=this.length;return this.resize(p+1),this.emplace(p,e,r,s,o,u)}emplace(e,r,s,o,u,p){const f=4*e,_=8*e;return this.float32[f+0]=r,this.float32[f+1]=s,this.float32[f+2]=o,this.int16[_+6]=u,this.int16[_+7]=p,e}}ao.prototype.bytesPerElement=16,Pe("StructArrayLayout2f1f2i16",ao);class ga extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,o){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,s,o)}emplace(e,r,s,o,u){const p=12*e,f=3*e;return this.uint8[p+0]=r,this.uint8[p+1]=s,this.float32[f+1]=o,this.float32[f+2]=u,e}}ga.prototype.bytesPerElement=12,Pe("StructArrayLayout2ub2f12",ga);class _a extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,r,s)}emplace(e,r,s,o){const u=3*e;return this.uint16[u+0]=r,this.uint16[u+1]=s,this.uint16[u+2]=o,e}}_a.prototype.bytesPerElement=6,Pe("StructArrayLayout3ui6",_a);class oo extends Pt{_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(e,r,s,o,u,p,f,_,x,w,E,I,M,P,B,U,$){const Q=this.length;return this.resize(Q+1),this.emplace(Q,e,r,s,o,u,p,f,_,x,w,E,I,M,P,B,U,$)}emplace(e,r,s,o,u,p,f,_,x,w,E,I,M,P,B,U,$,Q){const W=24*e,ie=12*e,se=48*e;return this.int16[W+0]=r,this.int16[W+1]=s,this.uint16[W+2]=o,this.uint16[W+3]=u,this.uint32[ie+2]=p,this.uint32[ie+3]=f,this.uint32[ie+4]=_,this.uint16[W+10]=x,this.uint16[W+11]=w,this.uint16[W+12]=E,this.float32[ie+7]=I,this.float32[ie+8]=M,this.uint8[se+36]=P,this.uint8[se+37]=B,this.uint8[se+38]=U,this.uint32[ie+10]=$,this.int16[W+22]=Q,e}}oo.prototype.bytesPerElement=48,Pe("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",oo);class ct extends Pt{_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(e,r,s,o,u,p,f,_,x,w,E,I,M,P,B,U,$,Q,W,ie,se,he,Ce,Re,Ae,Se,ve,ze){const be=this.length;return this.resize(be+1),this.emplace(be,e,r,s,o,u,p,f,_,x,w,E,I,M,P,B,U,$,Q,W,ie,se,he,Ce,Re,Ae,Se,ve,ze)}emplace(e,r,s,o,u,p,f,_,x,w,E,I,M,P,B,U,$,Q,W,ie,se,he,Ce,Re,Ae,Se,ve,ze,be){const ye=32*e,qe=16*e;return this.int16[ye+0]=r,this.int16[ye+1]=s,this.int16[ye+2]=o,this.int16[ye+3]=u,this.int16[ye+4]=p,this.int16[ye+5]=f,this.int16[ye+6]=_,this.int16[ye+7]=x,this.uint16[ye+8]=w,this.uint16[ye+9]=E,this.uint16[ye+10]=I,this.uint16[ye+11]=M,this.uint16[ye+12]=P,this.uint16[ye+13]=B,this.uint16[ye+14]=U,this.uint16[ye+15]=$,this.uint16[ye+16]=Q,this.uint16[ye+17]=W,this.uint16[ye+18]=ie,this.uint16[ye+19]=se,this.uint16[ye+20]=he,this.uint16[ye+21]=Ce,this.uint16[ye+22]=Re,this.uint32[qe+12]=Ae,this.float32[qe+13]=Se,this.float32[qe+14]=ve,this.uint16[ye+30]=ze,this.uint16[ye+31]=be,e}}ct.prototype.bytesPerElement=64,Pe("StructArrayLayout8i15ui1ul2f2ui64",ct);class h extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.float32[1*e+0]=r,e}}h.prototype.bytesPerElement=4,Pe("StructArrayLayout1f4",h);class t extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,r,s)}emplace(e,r,s,o){const u=3*e;return this.uint16[6*e+0]=r,this.float32[u+1]=s,this.float32[u+2]=o,e}}t.prototype.bytesPerElement=12,Pe("StructArrayLayout1ui2f12",t);class n extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,r,s)}emplace(e,r,s,o){const u=4*e;return this.uint32[2*e+0]=r,this.uint16[u+2]=s,this.uint16[u+3]=o,e}}n.prototype.bytesPerElement=8,Pe("StructArrayLayout1ul2ui8",n);class a extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const o=2*e;return this.uint16[o+0]=r,this.uint16[o+1]=s,e}}a.prototype.bytesPerElement=4,Pe("StructArrayLayout2ui4",a);class l extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint16[1*e+0]=r,e}}l.prototype.bytesPerElement=2,Pe("StructArrayLayout1ui2",l);class d extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,o){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,s,o)}emplace(e,r,s,o,u){const p=4*e;return this.float32[p+0]=r,this.float32[p+1]=s,this.float32[p+2]=o,this.float32[p+3]=u,e}}d.prototype.bytesPerElement=16,Pe("StructArrayLayout4f16",d);class m extends Cs{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 me(this.anchorPointX,this.anchorPointY)}}m.prototype.size=20;class g extends In{get(e){return new m(this,e)}}Pe("CollisionBoxArray",g);class y extends Cs{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(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}y.prototype.size=48;class v extends oo{get(e){return new y(this,e)}}Pe("PlacedSymbolArray",v);class b extends Cs{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(e){this._structArray.uint32[this._pos4+12]=e}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]}}b.prototype.size=64;class T extends ct{get(e){return new b(this,e)}}Pe("SymbolInstanceArray",T);class C extends h{getoffsetX(e){return this.float32[1*e+0]}}Pe("GlyphOffsetArray",C);class L extends Ms{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Pe("SymbolLineVertexArray",L);class D extends Cs{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]}}D.prototype.size=12;class F extends t{get(e){return new D(this,e)}}Pe("TextAnchorOffsetArray",F);class k extends Cs{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]}}k.prototype.size=8;class H extends n{get(e){return new k(this,e)}}Pe("FeatureIndexArray",H);class ne extends sr{}class N extends sr{}class K extends sr{}class ae extends fa{}class oe extends zs{}class ce extends ks{}class _e extends Gn{}class fe extends Sn{}class xe extends no{}class Be extends ma{}class et extends so{}class Ee extends ga{}class Ne extends _a{}class ke extends a{}const It=$t([{name:"a_pos",components:2,type:"Int16"}],4),{members:tt}=It;class $e{constructor(e=[]){this.segments=e}prepareSegment(e,r,s,o){let u=this.segments[this.segments.length-1];return e>$e.MAX_VERTEX_ARRAY_LENGTH&&Qt(`Max vertices per segment is ${$e.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!u||u.vertexLength+e>$e.MAX_VERTEX_ARRAY_LENGTH||u.sortKey!==o)&&(u={vertexOffset:r.length,primitiveOffset:s.length,vertexLength:0,primitiveLength:0},o!==void 0&&(u.sortKey=o),this.segments.push(u)),u}get(){return this.segments}destroy(){for(const e of this.segments)for(const r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,s,o){return new $e([{vertexOffset:e,primitiveOffset:r,vertexLength:s,primitiveLength:o,vaos:{},sortKey:0}])}}function it(i,e){return 256*(i=vt(Math.floor(i),0,255))+vt(Math.floor(e),0,255)}$e.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Pe("SegmentVector",$e);const zt=$t([{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"}]);var ft={exports:{}},Xi={exports:{}};Xi.exports=function(i,e){var r,s,o,u,p,f,_,x;for(s=i.length-(r=3&i.length),o=e,p=3432918353,f=461845907,x=0;x>>16)*p&65535)<<16)&4294967295)<<15|_>>>17))*f+(((_>>>16)*f&65535)<<16)&4294967295)<<13|o>>>19))+((5*(o>>>16)&65535)<<16)&4294967295))+((58964+(u>>>16)&65535)<<16);switch(_=0,r){case 3:_^=(255&i.charCodeAt(x+2))<<16;case 2:_^=(255&i.charCodeAt(x+1))<<8;case 1:o^=_=(65535&(_=(_=(65535&(_^=255&i.charCodeAt(x)))*p+(((_>>>16)*p&65535)<<16)&4294967295)<<15|_>>>17))*f+(((_>>>16)*f&65535)<<16)&4294967295}return o^=i.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};var ui=Xi.exports,Rt={exports:{}};Rt.exports=function(i,e){for(var r,s=i.length,o=e^s,u=0;s>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(u)|(255&i.charCodeAt(++u))<<8|(255&i.charCodeAt(++u))<<16|(255&i.charCodeAt(++u))<<24))+((1540483477*(r>>>16)&65535)<<16),o=1540483477*(65535&o)+((1540483477*(o>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),s-=4,++u;switch(s){case 3:o^=(255&i.charCodeAt(u+2))<<16;case 2:o^=(255&i.charCodeAt(u+1))<<8;case 1:o=1540483477*(65535&(o^=255&i.charCodeAt(u)))+((1540483477*(o>>>16)&65535)<<16)}return o=1540483477*(65535&(o^=o>>>13))+((1540483477*(o>>>16)&65535)<<16),(o^=o>>>15)>>>0};var Bi=ui,Mr=Rt.exports;ft.exports=Bi,ft.exports.murmur3=Bi,ft.exports.murmur2=Mr;var mr=Oe(ft.exports);class Pr{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,s,o){this.ids.push(Xn(e)),this.positions.push(r,s,o)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=Xn(e);let s=0,o=this.ids.length-1;for(;s>1;this.ids[p]>=r?o=p:s=p+1}const u=[];for(;this.ids[s]===r;)u.push({index:this.positions[3*s],start:this.positions[3*s+1],end:this.positions[3*s+2]}),s++;return u}static serialize(e,r){const s=new Float64Array(e.ids),o=new Uint32Array(e.positions);return cn(s,o,0,s.length-1),r&&r.push(s.buffer,o.buffer),{ids:s,positions:o}}static deserialize(e){const r=new Pr;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function Xn(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:mr(String(i))}function cn(i,e,r,s){for(;r>1];let u=r-1,p=s+1;for(;;){do u++;while(i[u]o);if(u>=p)break;$r(i,u,p),$r(e,3*u,3*p),$r(e,3*u+1,3*p+1),$r(e,3*u+2,3*p+2)}p-r`u_${o}`),this.type=s}setUniform(e,r,s){e.set(s.constantOr(this.value))}getBinding(e,r,s){return this.type==="color"?new Wn(e,r):new ti(e,r)}}class kt{constructor(e,r){this.uniformNames=r.map(s=>`u_${s}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setUniform(e,r,s,o){const u=o==="u_pattern_to"?this.patternTo:o==="u_pattern_from"?this.patternFrom:o==="u_pixel_ratio_to"?this.pixelRatioTo:o==="u_pixel_ratio_from"?this.pixelRatioFrom:null;u&&e.set(u)}getBinding(e,r,s){return s.substr(0,9)==="u_pattern"?new gi(e,r):new ti(e,r)}}class qr{constructor(e,r,s,o){this.expression=e,this.type=s,this.maxValue=0,this.paintVertexAttributes=r.map(u=>({name:`a_${u}`,type:"Float32",components:s==="color"?2:1,offset:0})),this.paintVertexArray=new o}populatePaintArray(e,r,s,o,u){const p=this.paintVertexArray.length,f=this.expression.evaluate(new St(0),r,{},o,[],u);this.paintVertexArray.resize(e),this._setPaintValue(p,e,f)}updatePaintArray(e,r,s,o){const u=this.expression.evaluate({zoom:0},s,o);this._setPaintValue(e,r,u)}_setPaintValue(e,r,s){if(this.type==="color"){const o=Wt(s);for(let u=e;u`u_${f}_t`),this.type=s,this.useIntegerZoom=o,this.zoom=u,this.maxValue=0,this.paintVertexAttributes=r.map(f=>({name:`a_${f}`,type:"Float32",components:s==="color"?4:2,offset:0})),this.paintVertexArray=new p}populatePaintArray(e,r,s,o,u){const p=this.expression.evaluate(new St(this.zoom),r,{},o,[],u),f=this.expression.evaluate(new St(this.zoom+1),r,{},o,[],u),_=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(_,e,p,f)}updatePaintArray(e,r,s,o){const u=this.expression.evaluate({zoom:this.zoom},s,o),p=this.expression.evaluate({zoom:this.zoom+1},s,o);this._setPaintValue(e,r,u,p)}_setPaintValue(e,r,s,o){if(this.type==="color"){const u=Wt(s),p=Wt(o);for(let f=e;f`#define HAS_UNIFORM_${o}`))}return e}getBinderAttributes(){const e=[];for(const r in this.binders){const s=this.binders[r];if(s instanceof qr||s instanceof gr)for(let o=0;o!0){this.programConfigurations={};for(const o of e)this.programConfigurations[o.id]=new al(o,r,s);this.needsUpload=!1,this._featureMap=new Pr,this._bufferOffset=0}populatePaintArrays(e,r,s,o,u,p){for(const f in this.programConfigurations)this.programConfigurations[f].populatePaintArrays(e,r,o,u,p);r.id!==void 0&&this._featureMap.add(r.id,s,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,s,o){for(const u of s)this.needsUpload=this.programConfigurations[u.id].updatePaintArrays(e,this._featureMap,r,u,o)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function Jl(i,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-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"]}[i]||[i.replace(`${e}-`,"").replace(/-/g,"_")]}function Cn(i,e,r){const s={color:{source:ks,composite:d},number:{source:h,composite:ks}},o=function(u){return{"line-pattern":{source:_e,composite:_e},"fill-pattern":{source:_e,composite:_e},"fill-extrusion-pattern":{source:_e,composite:_e}}[u]}(i);return o&&o[r]||s[e][r]}Pe("ConstantBinder",_i),Pe("CrossFadedConstantBinder",kt),Pe("SourceExpressionBinder",qr),Pe("CrossFadedCompositeBinder",hn),Pe("CompositeExpressionBinder",gr),Pe("ProgramConfiguration",al,{omit:["_buffers"]}),Pe("ProgramConfigurationSet",An);const Bt=8192,ya=Math.pow(2,14)-1,lo=-ya-1;function Zr(i){const e=Bt/i.extent,r=i.loadGeometry();for(let s=0;sp.x+1||_p.y+1)&&Qt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function un(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?Zr(i):[]}}function Hn(i,e,r,s,o){i.emplaceBack(2*e+(s+1)/2,2*r+(o+1)/2)}class Ql{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new N,this.indexArray=new Ne,this.segments=new $e,this.programConfigurations=new An(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){const o=this.layers[0],u=[];let p=null,f=!1;o.type==="circle"&&(p=o.layout.get("circle-sort-key"),f=!p.isConstant());for(const{feature:_,id:x,index:w,sourceLayerIndex:E}of e){const I=this.layers[0]._featureFilter.needGeometry,M=un(_,I);if(!this.layers[0]._featureFilter.filter(new St(this.zoom),M,s))continue;const P=f?p.evaluate(M,{},s):void 0,B={id:x,properties:_.properties,type:_.type,sourceLayerIndex:E,index:w,geometry:I?M.geometry:Zr(_),patterns:{},sortKey:P};u.push(B)}f&&u.sort((_,x)=>_.sortKey-x.sortKey);for(const _ of u){const{geometry:x,index:w,sourceLayerIndex:E}=_,I=e[w].feature;this.addFeature(_,x,w,s),r.featureIndex.insert(I,x,w,E,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,tt),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,r,s,o){for(const u of r)for(const p of u){const f=p.x,_=p.y;if(f<0||f>=Bt||_<0||_>=Bt)continue;const x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),w=x.vertexLength;Hn(this.layoutVertexArray,f,_,-1,-1),Hn(this.layoutVertexArray,f,_,1,-1),Hn(this.layoutVertexArray,f,_,1,1),Hn(this.layoutVertexArray,f,_,-1,1),this.indexArray.emplaceBack(w,w+1,w+2),this.indexArray.emplaceBack(w,w+3,w+2),x.vertexLength+=4,x.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{},o)}}function Xc(i,e){for(let r=0;r1){if(ec(i,e))return!0;for(let s=0;s1?r:r.sub(e)._mult(o)._add(e))}function Kc(i,e){let r,s,o,u=!1;for(let p=0;pe.y!=o.y>e.y&&e.x<(o.x-s.x)*(e.y-s.y)/(o.y-s.y)+s.x&&(u=!u)}return u}function xa(i,e){let r=!1;for(let s=0,o=i.length-1;se.y!=p.y>e.y&&e.x<(p.x-u.x)*(e.y-u.y)/(p.y-u.y)+u.x&&(r=!r)}return r}function ju(i,e,r){const s=r[0],o=r[2];if(i.xo.x&&e.x>o.x||i.yo.y&&e.y>o.y)return!1;const u=Je(i,e,r[0]);return u!==Je(i,e,r[1])||u!==Je(i,e,r[2])||u!==Je(i,e,r[3])}function co(i,e,r){const s=e.paint.get(i).value;return s.kind==="constant"?s.value:r.programConfigurations.get(e.id).getMaxValue(i)}function ol(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function ll(i,e,r,s,o){if(!e[0]&&!e[1])return i;const u=me.convert(e)._mult(o);r==="viewport"&&u._rotate(-s);const p=[];for(let f=0;feh(U,B))}(x,_),M=E?w*f:w;for(const P of o)for(const B of P){const U=E?B:eh(B,_);let $=M;const Q=cl([],[B.x,B.y,0,1],_);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?$*=Q[3]/p.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&($*=p.cameraToCenterDistance/Q[3]),$u(I,U,$))return!0}return!1}}function eh(i,e){const r=cl([],[i.x,i.y,0,1],e);return new me(r[0]/r[3],r[1]/r[3])}class th extends Ql{}let ih;Pe("HeatmapBucket",th,{omit:["layers"]});var Hu={get paint(){return ih=ih||new Li({"heatmap-radius":new je(le.paint_heatmap["heatmap-radius"]),"heatmap-weight":new je(le.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ue(le.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ro(le.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ue(le.paint_heatmap["heatmap-opacity"])})}};function rc(i,{width:e,height:r},s,o){if(o){if(o instanceof Uint8ClampedArray)o=new Uint8Array(o.buffer);else if(o.length!==e*r*s)throw new RangeError(`mismatched image size. expected: ${o.length} but got: ${e*r*s}`)}else o=new Uint8Array(e*r*s);return i.width=e,i.height=r,i.data=o,i}function rh(i,{width:e,height:r},s){if(e===i.width&&r===i.height)return;const o=rc({},{width:e,height:r},s);nc(i,o,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,e),height:Math.min(i.height,r)},s),i.width=e,i.height=r,i.data=o.data}function nc(i,e,r,s,o,u){if(o.width===0||o.height===0)return e;if(o.width>i.width||o.height>i.height||r.x>i.width-o.width||r.y>i.height-o.height)throw new RangeError("out of range source coordinates for image copy");if(o.width>e.width||o.height>e.height||s.x>e.width-o.width||s.y>e.height-o.height)throw new RangeError("out of range destination coordinates for image copy");const p=i.data,f=e.data;if(p===f)throw new Error("srcData equals dstData, so image is already copied");for(let _=0;_{e[i.evaluationKey]=_;const x=i.expression.evaluate(e);o.data[p+f+0]=Math.floor(255*x.r/x.a),o.data[p+f+1]=Math.floor(255*x.g/x.a),o.data[p+f+2]=Math.floor(255*x.b/x.a),o.data[p+f+3]=Math.floor(255*x.a)};if(i.clips)for(let p=0,f=0;p80*r){s=u=i[0],o=p=i[1];for(var P=r;Pu&&(u=f),_>p&&(p=_);x=(x=Math.max(u-s,p-o))!==0?32767/x:0}return po(I,M,r,s,o,x,0),M}function ah(i,e,r,s,o){var u,p;if(o===lc(i,e,r,s)>0)for(u=e;u=e;u-=s)p=ch(u,i[u],i[u+1],p);return p&&ul(p,p.next)&&(mo(p),p=p.next),p}function Ds(i,e){if(!i)return i;e||(e=i);var r,s=i;do if(r=!1,s.steiner||!ul(s,s.next)&&Zt(s.prev,s,s.next)!==0)s=s.next;else{if(mo(s),(s=e=s.prev)===s.next)break;r=!0}while(r||s!==e);return e}function po(i,e,r,s,o,u,p){if(i){!p&&u&&function(w,E,I,M){var P=w;do P.z===0&&(P.z=ac(P.x,P.y,E,I,M)),P.prevZ=P.prev,P.nextZ=P.next,P=P.next;while(P!==w);P.prevZ.nextZ=null,P.prevZ=null,function(B){var U,$,Q,W,ie,se,he,Ce,Re=1;do{for($=B,B=null,ie=null,se=0;$;){for(se++,Q=$,he=0,U=0;U0||Ce>0&&Q;)he!==0&&(Ce===0||!Q||$.z<=Q.z)?(W=$,$=$.nextZ,he--):(W=Q,Q=Q.nextZ,Ce--),ie?ie.nextZ=W:B=W,W.prevZ=ie,ie=W;$=Q}ie.nextZ=null,Re*=2}while(se>1)}(P)}(i,s,o,u);for(var f,_,x=i;i.prev!==i.next;)if(f=i.prev,_=i.next,u?id(i,s,o,u):td(i))e.push(f.i/r|0),e.push(i.i/r|0),e.push(_.i/r|0),mo(i),i=_.next,x=_.next;else if((i=_)===x){p?p===1?po(i=rd(Ds(i),e,r),e,r,s,o,u,2):p===2&&nd(i,e,r,s,o,u):po(Ds(i),e,r,s,o,u,1);break}}}function td(i){var e=i.prev,r=i,s=i.next;if(Zt(e,r,s)>=0)return!1;for(var o=e.x,u=r.x,p=s.x,f=e.y,_=r.y,x=s.y,w=ou?o>p?o:p:u>p?u:p,M=f>_?f>x?f:x:_>x?_:x,P=s.next;P!==e;){if(P.x>=w&&P.x<=I&&P.y>=E&&P.y<=M&&ba(o,f,u,_,p,x,P.x,P.y)&&Zt(P.prev,P,P.next)>=0)return!1;P=P.next}return!0}function id(i,e,r,s){var o=i.prev,u=i,p=i.next;if(Zt(o,u,p)>=0)return!1;for(var f=o.x,_=u.x,x=p.x,w=o.y,E=u.y,I=p.y,M=f<_?f_?f>x?f:x:_>x?_:x,U=w>E?w>I?w:I:E>I?E:I,$=ac(M,P,e,r,s),Q=ac(B,U,e,r,s),W=i.prevZ,ie=i.nextZ;W&&W.z>=$&&ie&&ie.z<=Q;){if(W.x>=M&&W.x<=B&&W.y>=P&&W.y<=U&&W!==o&&W!==p&&ba(f,w,_,E,x,I,W.x,W.y)&&Zt(W.prev,W,W.next)>=0||(W=W.prevZ,ie.x>=M&&ie.x<=B&&ie.y>=P&&ie.y<=U&&ie!==o&&ie!==p&&ba(f,w,_,E,x,I,ie.x,ie.y)&&Zt(ie.prev,ie,ie.next)>=0))return!1;ie=ie.nextZ}for(;W&&W.z>=$;){if(W.x>=M&&W.x<=B&&W.y>=P&&W.y<=U&&W!==o&&W!==p&&ba(f,w,_,E,x,I,W.x,W.y)&&Zt(W.prev,W,W.next)>=0)return!1;W=W.prevZ}for(;ie&&ie.z<=Q;){if(ie.x>=M&&ie.x<=B&&ie.y>=P&&ie.y<=U&&ie!==o&&ie!==p&&ba(f,w,_,E,x,I,ie.x,ie.y)&&Zt(ie.prev,ie,ie.next)>=0)return!1;ie=ie.nextZ}return!0}function rd(i,e,r){var s=i;do{var o=s.prev,u=s.next.next;!ul(o,u)&&oh(o,s,s.next,u)&&fo(o,u)&&fo(u,o)&&(e.push(o.i/r|0),e.push(s.i/r|0),e.push(u.i/r|0),mo(s),mo(s.next),s=i=u),s=s.next}while(s!==i);return Ds(s)}function nd(i,e,r,s,o,u){var p=i;do{for(var f=p.next.next;f!==p.prev;){if(p.i!==f.i&&cd(p,f)){var _=lh(p,f);return p=Ds(p,p.next),_=Ds(_,_.next),po(p,e,r,s,o,u,0),void po(_,e,r,s,o,u,0)}f=f.next}p=p.next}while(p!==i)}function sd(i,e){return i.x-e.x}function ad(i,e){var r=function(o,u){var p,f=u,_=o.x,x=o.y,w=-1/0;do{if(x<=f.y&&x>=f.next.y&&f.next.y!==f.y){var E=f.x+(x-f.y)*(f.next.x-f.x)/(f.next.y-f.y);if(E<=_&&E>w&&(w=E,p=f.x=f.x&&f.x>=P&&_!==f.x&&ba(xp.x||f.x===p.x&&od(p,f)))&&(p=f,U=I)),f=f.next;while(f!==M);return p}(i,e);if(!r)return e;var s=lh(r,i);return Ds(s,s.next),Ds(r,r.next)}function od(i,e){return Zt(i.prev,i,e.prev)<0&&Zt(e.next,i,i.next)<0}function ac(i,e,r,s,o){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*o|0)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-s)*o|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ld(i){var e=i,r=i;do(e.x=(i-p)*(u-f)&&(i-p)*(s-f)>=(r-p)*(e-f)&&(r-p)*(u-f)>=(o-p)*(s-f)}function cd(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,s){var o=r;do{if(o.i!==r.i&&o.next.i!==r.i&&o.i!==s.i&&o.next.i!==s.i&&oh(o,o.next,r,s))return!0;o=o.next}while(o!==r);return!1}(i,e)&&(fo(i,e)&&fo(e,i)&&function(r,s){var o=r,u=!1,p=(r.x+s.x)/2,f=(r.y+s.y)/2;do o.y>f!=o.next.y>f&&o.next.y!==o.y&&p<(o.next.x-o.x)*(f-o.y)/(o.next.y-o.y)+o.x&&(u=!u),o=o.next;while(o!==r);return u}(i,e)&&(Zt(i.prev,i,e.prev)||Zt(i,e.prev,e))||ul(i,e)&&Zt(i.prev,i,i.next)>0&&Zt(e.prev,e,e.next)>0)}function Zt(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function ul(i,e){return i.x===e.x&&i.y===e.y}function oh(i,e,r,s){var o=pl(Zt(i,e,r)),u=pl(Zt(i,e,s)),p=pl(Zt(r,s,i)),f=pl(Zt(r,s,e));return o!==u&&p!==f||!(o!==0||!dl(i,r,e))||!(u!==0||!dl(i,s,e))||!(p!==0||!dl(r,i,s))||!(f!==0||!dl(r,e,s))}function dl(i,e,r){return e.x<=Math.max(i.x,r.x)&&e.x>=Math.min(i.x,r.x)&&e.y<=Math.max(i.y,r.y)&&e.y>=Math.min(i.y,r.y)}function pl(i){return i>0?1:i<0?-1:0}function fo(i,e){return Zt(i.prev,i,i.next)<0?Zt(i,e,i.next)>=0&&Zt(i,i.prev,e)>=0:Zt(i,e,i.prev)<0||Zt(i,i.next,e)<0}function lh(i,e){var r=new oc(i.i,i.x,i.y),s=new oc(e.i,e.x,e.y),o=i.next,u=e.prev;return i.next=e,e.prev=i,r.next=o,o.prev=r,s.next=r,r.prev=s,u.next=s,s.prev=u,s}function ch(i,e,r,s){var o=new oc(i,e,r);return s?(o.next=s.next,o.prev=s,s.next.prev=o,s.next=o):(o.prev=o,o.next=o),o}function mo(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function oc(i,e,r){this.i=i,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function lc(i,e,r,s){for(var o=0,u=e,p=r-s;u0&&r.holes.push(s+=i[o-1].length)}return r};var hh=Oe(sc.exports);function hd(i,e,r,s,o){uh(i,e,r||0,s||i.length-1,o||ud)}function uh(i,e,r,s,o){for(;s>r;){if(s-r>600){var u=s-r+1,p=e-r+1,f=Math.log(u),_=.5*Math.exp(2*f/3),x=.5*Math.sqrt(f*_*(u-_)/u)*(p-u/2<0?-1:1);uh(i,e,Math.max(r,Math.floor(e-p*_/u+x)),Math.min(s,Math.floor(e+(u-p)*_/u+x)),o)}var w=i[e],E=r,I=s;for(go(i,r,e),o(i[s],w)>0&&go(i,r,s);E0;)I--}o(i[r],w)===0?go(i,r,I):go(i,++I,s),I<=e&&(r=I+1),e<=I&&(s=I-1)}}function go(i,e,r){var s=i[e];i[e]=i[r],i[r]=s}function ud(i,e){return ie?1:0}function cc(i,e){const r=i.length;if(r<=1)return[i];const s=[];let o,u;for(let p=0;p1)for(let p=0;pr.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new K,this.indexArray=new Ne,this.indexArray2=new ke,this.programConfigurations=new An(e.layers,e.zoom),this.segments=new $e,this.segments2=new $e,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.hasPattern=hc("fill",this.layers,r);const o=this.layers[0].layout.get("fill-sort-key"),u=!o.isConstant(),p=[];for(const{feature:f,id:_,index:x,sourceLayerIndex:w}of e){const E=this.layers[0]._featureFilter.needGeometry,I=un(f,E);if(!this.layers[0]._featureFilter.filter(new St(this.zoom),I,s))continue;const M=u?o.evaluate(I,{},s,r.availableImages):void 0,P={id:_,properties:f.properties,type:f.type,sourceLayerIndex:w,index:x,geometry:E?I.geometry:Zr(f),patterns:{},sortKey:M};p.push(P)}u&&p.sort((f,_)=>f.sortKey-_.sortKey);for(const f of p){const{geometry:_,index:x,sourceLayerIndex:w}=f;if(this.hasPattern){const E=uc("fill",this.layers,f,this.zoom,r);this.patternFeatures.push(E)}else this.addFeature(f,_,x,s,{});r.featureIndex.insert(e[x].feature,_,x,w,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}addFeatures(e,r,s){for(const o of this.patternFeatures)this.addFeature(o,o.geometry,o.index,r,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ed),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),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(e,r,s,o,u){for(const p of cc(r,500)){let f=0;for(const M of p)f+=M.length;const _=this.segments.prepareSegment(f,this.layoutVertexArray,this.indexArray),x=_.vertexLength,w=[],E=[];for(const M of p){if(M.length===0)continue;M!==p[0]&&E.push(w.length/2);const P=this.segments2.prepareSegment(M.length,this.layoutVertexArray,this.indexArray2),B=P.vertexLength;this.layoutVertexArray.emplaceBack(M[0].x,M[0].y),this.indexArray2.emplaceBack(B+M.length-1,B),w.push(M[0].x),w.push(M[0].y);for(let U=1;U>3}if(o--,s===1||s===2)u+=i.readSVarint(),p+=i.readSVarint(),s===1&&(e&&f.push(e),e=[]),e.push(new yd(u,p));else{if(s!==7)throw new Error("unknown command "+s);e&&e.push(e[0].clone())}}return e&&f.push(e),f},wa.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,s=0,o=0,u=0,p=1/0,f=-1/0,_=1/0,x=-1/0;i.pos>3}if(s--,r===1||r===2)(o+=i.readSVarint())f&&(f=o),(u+=i.readSVarint())<_&&(_=u),u>x&&(x=u);else if(r!==7)throw new Error("unknown command "+r)}return[p,_,f,x]},wa.prototype.toGeoJSON=function(i,e,r){var s,o,u=this.extent*Math.pow(2,r),p=this.extent*i,f=this.extent*e,_=this.loadGeometry(),x=wa.types[this.type];function w(M){for(var P=0;P>3;o=p===1?s.readString():p===2?s.readFloat():p===3?s.readDouble():p===4?s.readVarint64():p===5?s.readVarint():p===6?s.readSVarint():p===7?s.readBoolean():null}return o}(r))}gh.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var e=this._pbf.readVarint()+this._pbf.pos;return new bd(this._pbf,e,this.extent,this._keys,this._values)};var Td=mh;function Ed(i,e,r){if(i===3){var s=new Td(r,r.readVarint()+r.pos);s.length&&(e[s.name]=s)}}Kn.VectorTile=function(i,e){this.layers=i.readFields(Ed,{},e)},Kn.VectorTileFeature=fh,Kn.VectorTileLayer=mh;const Sd=Kn.VectorTileFeature.types,pc=Math.pow(2,13);function _o(i,e,r,s,o,u,p,f){i.emplaceBack(e,r,2*Math.floor(s*pc)+p,o*pc*2,u*pc*2,Math.round(f))}class fc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new ae,this.centroidVertexArray=new ne,this.indexArray=new Ne,this.programConfigurations=new An(e.layers,e.zoom),this.segments=new $e,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.features=[],this.hasPattern=hc("fill-extrusion",this.layers,r);for(const{feature:o,id:u,index:p,sourceLayerIndex:f}of e){const _=this.layers[0]._featureFilter.needGeometry,x=un(o,_);if(!this.layers[0]._featureFilter.filter(new St(this.zoom),x,s))continue;const w={id:u,sourceLayerIndex:f,index:p,geometry:_?x.geometry:Zr(o),properties:o.properties,type:o.type,patterns:{}};this.hasPattern?this.features.push(uc("fill-extrusion",this.layers,w,this.zoom,r)):this.addFeature(w,w.geometry,p,s,{}),r.featureIndex.insert(o,w.geometry,p,f,this.index,!0)}}addFeatures(e,r,s){for(const o of this.features){const{geometry:u}=o;this.addFeature(o,u,o.index,r,s)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,_d),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,gd.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,r,s,o,u){const p={x:0,y:0,vertexCount:0};for(const f of cc(r,500)){let _=0;for(const P of f)_+=P.length;let x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const P of f){if(P.length===0||Ad(P))continue;let B=0;for(let U=0;U=1){const Q=P[U-1];if(!Id($,Q)){x.vertexLength+4>$e.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const W=$.sub(Q)._perp()._unit(),ie=Q.dist($);B+ie>32768&&(B=0),_o(this.layoutVertexArray,$.x,$.y,W.x,W.y,0,0,B),_o(this.layoutVertexArray,$.x,$.y,W.x,W.y,0,1,B),p.x+=2*$.x,p.y+=2*$.y,p.vertexCount+=2,B+=ie,_o(this.layoutVertexArray,Q.x,Q.y,W.x,W.y,0,0,B),_o(this.layoutVertexArray,Q.x,Q.y,W.x,W.y,0,1,B),p.x+=2*Q.x,p.y+=2*Q.y,p.vertexCount+=2;const se=x.vertexLength;this.indexArray.emplaceBack(se,se+2,se+1),this.indexArray.emplaceBack(se+1,se+2,se+3),x.vertexLength+=4,x.primitiveLength+=2}}}}if(x.vertexLength+_>$e.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(_,this.layoutVertexArray,this.indexArray)),Sd[e.type]!=="Polygon")continue;const w=[],E=[],I=x.vertexLength;for(const P of f)if(P.length!==0){P!==f[0]&&E.push(w.length/2);for(let B=0;BBt)||i.y===e.y&&(i.y<0||i.y>Bt)}function Ad(i){return i.every(e=>e.x<0)||i.every(e=>e.x>Bt)||i.every(e=>e.y<0)||i.every(e=>e.y>Bt)}let _h;Pe("FillExtrusionBucket",fc,{omit:["layers","features"]});var Cd={get paint(){return _h=_h||new Li({"fill-extrusion-opacity":new Ue(le["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new je(le["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ue(le["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ue(le["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new pa(le["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new je(le["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new je(le["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ue(le["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Md extends Cr{constructor(e){super(e,Cd)}createBucket(e){return new fc(e)}queryRadius(){return ol(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,r,s,o,u,p,f,_){const x=ll(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),p.angle,f),w=this.paint.get("fill-extrusion-height").evaluate(r,s),E=this.paint.get("fill-extrusion-base").evaluate(r,s),I=function(P,B,U,$){const Q=[];for(const W of P){const ie=[W.x,W.y,0,1];cl(ie,ie,B),Q.push(new me(ie[0]/ie[3],ie[1]/ie[3]))}return Q}(x,_),M=function(P,B,U,$){const Q=[],W=[],ie=$[8]*B,se=$[9]*B,he=$[10]*B,Ce=$[11]*B,Re=$[8]*U,Ae=$[9]*U,Se=$[10]*U,ve=$[11]*U;for(const ze of P){const be=[],ye=[];for(const qe of ze){const Fe=qe.x,Qe=qe.y,Et=$[0]*Fe+$[4]*Qe+$[12],At=$[1]*Fe+$[5]*Qe+$[13],ni=$[2]*Fe+$[6]*Qe+$[14],ar=$[3]*Fe+$[7]*Qe+$[15],Fi=ni+he,Ht=ar+Ce,oi=Et+Re,xi=At+Ae,Hi=ni+Se,Oi=ar+ve,Kt=new me((Et+ie)/Ht,(At+se)/Ht);Kt.z=Fi/Ht,be.push(Kt);const si=new me(oi/Oi,xi/Oi);si.z=Hi/Oi,ye.push(si)}Q.push(be),W.push(ye)}return[Q,W]}(o,E,w,_);return function(P,B,U){let $=1/0;Wc(U,B)&&($=yh(U,B[0]));for(let Q=0;Qr.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new oe,this.layoutVertexArray2=new ce,this.indexArray=new Ne,this.programConfigurations=new An(e.layers,e.zoom),this.segments=new $e,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.hasPattern=hc("line",this.layers,r);const o=this.layers[0].layout.get("line-sort-key"),u=!o.isConstant(),p=[];for(const{feature:f,id:_,index:x,sourceLayerIndex:w}of e){const E=this.layers[0]._featureFilter.needGeometry,I=un(f,E);if(!this.layers[0]._featureFilter.filter(new St(this.zoom),I,s))continue;const M=u?o.evaluate(I,{},s):void 0,P={id:_,properties:f.properties,type:f.type,sourceLayerIndex:w,index:x,geometry:E?I.geometry:Zr(f),patterns:{},sortKey:M};p.push(P)}u&&p.sort((f,_)=>f.sortKey-_.sortKey);for(const f of p){const{geometry:_,index:x,sourceLayerIndex:w}=f;if(this.hasPattern){const E=uc("line",this.layers,f,this.zoom,r);this.patternFeatures.push(E)}else this.addFeature(f,_,x,s,{});r.featureIndex.insert(e[x].feature,_,x,w,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}addFeatures(e,r,s){for(const o of this.patternFeatures)this.addFeature(o,o.geometry,o.index,r,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Dd)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,zd),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,r,s,o,u){const p=this.layers[0].layout,f=p.get("line-join").evaluate(e,{}),_=p.get("line-cap"),x=p.get("line-miter-limit"),w=p.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const E of r)this.addLine(E,e,f,_,x,w);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,u,o)}addLine(e,r,s,o,u,p){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let $=0;$=2&&e[_-1].equals(e[_-2]);)_--;let x=0;for(;x<_-1&&e[x].equals(e[x+1]);)x++;if(_<(f?3:2))return;s==="bevel"&&(u=1.05);const w=this.overscaling<=16?15*Bt/(512*this.overscaling):0,E=this.segments.prepareSegment(10*_,this.layoutVertexArray,this.indexArray);let I,M,P,B,U;this.e1=this.e2=-1,f&&(I=e[_-2],U=e[x].sub(I)._unit()._perp());for(let $=x;$<_;$++){if(P=$===_-1?f?e[x+1]:void 0:e[$+1],P&&e[$].equals(P))continue;U&&(B=U),I&&(M=I),I=e[$],U=P?P.sub(I)._unit()._perp():B,B=B||U;let Q=B.add(U);Q.x===0&&Q.y===0||Q._unit();const W=B.x*U.x+B.y*U.y,ie=Q.x*U.x+Q.y*U.y,se=ie!==0?1/ie:1/0,he=2*Math.sqrt(2-2*ie),Ce=ie0;if(Ce&&$>x){const ve=I.dist(M);if(ve>2*w){const ze=I.sub(I.sub(M)._mult(w/ve)._round());this.updateDistance(M,ze),this.addCurrentVertex(ze,B,0,0,E),M=ze}}const Ae=M&&P;let Se=Ae?s:f?"butt":o;if(Ae&&Se==="round"&&(seu&&(Se="bevel"),Se==="bevel"&&(se>2&&(Se="flipbevel"),se100)Q=U.mult(-1);else{const ve=se*B.add(U).mag()/B.sub(U).mag();Q._perp()._mult(ve*(Re?-1:1))}this.addCurrentVertex(I,Q,0,0,E),this.addCurrentVertex(I,Q.mult(-1),0,0,E)}else if(Se==="bevel"||Se==="fakeround"){const ve=-Math.sqrt(se*se-1),ze=Re?ve:0,be=Re?0:ve;if(M&&this.addCurrentVertex(I,B,ze,be,E),Se==="fakeround"){const ye=Math.round(180*he/Math.PI/20);for(let qe=1;qe2*w){const ze=I.add(P.sub(I)._mult(w/ve)._round());this.updateDistance(I,ze),this.addCurrentVertex(ze,U,0,0,E),I=ze}}}}addCurrentVertex(e,r,s,o,u,p=!1){const f=r.y*o-r.x,_=-r.y-r.x*o;this.addHalfVertex(e,r.x+r.y*s,r.y-r.x*s,p,!1,s,u),this.addHalfVertex(e,f,_,p,!0,-o,u),this.distance>xh/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,r,s,o,u,p))}addHalfVertex({x:e,y:r},s,o,u,p,f,_){const x=.5*(this.lineClips?this.scaledDistance*(xh-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(u?1:0),(r<<1)+(p?1:0),Math.round(63*s)+128,Math.round(63*o)+128,1+(f===0?0:f<0?-1:1)|(63&x)<<2,x>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const w=_.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,w),_.primitiveLength++),p?this.e2=w:this.e1=w}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,r){this.distance+=e.dist(r),this.updateScaledDistance()}}let vh,bh;Pe("LineBucket",mc,{omit:["layers","patternFeatures"]});var wh={get paint(){return bh=bh||new Li({"line-opacity":new je(le.paint_line["line-opacity"]),"line-color":new je(le.paint_line["line-color"]),"line-translate":new Ue(le.paint_line["line-translate"]),"line-translate-anchor":new Ue(le.paint_line["line-translate-anchor"]),"line-width":new je(le.paint_line["line-width"]),"line-gap-width":new je(le.paint_line["line-gap-width"]),"line-offset":new je(le.paint_line["line-offset"]),"line-blur":new je(le.paint_line["line-blur"]),"line-dasharray":new io(le.paint_line["line-dasharray"]),"line-pattern":new pa(le.paint_line["line-pattern"]),"line-gradient":new ro(le.paint_line["line-gradient"])})},get layout(){return vh=vh||new Li({"line-cap":new Ue(le.layout_line["line-cap"]),"line-join":new je(le.layout_line["line-join"]),"line-miter-limit":new Ue(le.layout_line["line-miter-limit"]),"line-round-limit":new Ue(le.layout_line["line-round-limit"]),"line-sort-key":new je(le.layout_line["line-sort-key"])})}};class Rd extends je{possiblyEvaluate(e,r){return r=new St(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(e,r)}evaluate(e,r,s,o){return r=Jt({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,s,o)}}let fl;class Fd extends Cr{constructor(e){super(e,wh),this.gradientVersion=0,fl||(fl=new Rd(wh.paint.properties["line-width"].specification),fl.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){e==="line-gradient"&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof hs,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,r){super.recalculate(e,r),this.paint._values["line-floorwidth"]=fl.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new mc(e)}queryRadius(e){const r=e,s=Th(co("line-width",this,r),co("line-gap-width",this,r)),o=co("line-offset",this,r);return s/2+Math.abs(o)+ol(this.paint.get("line-translate"))}queryIntersectsFeature(e,r,s,o,u,p,f){const _=ll(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),p.angle,f),x=f/2*Th(this.paint.get("line-width").evaluate(r,s),this.paint.get("line-gap-width").evaluate(r,s)),w=this.paint.get("line-offset").evaluate(r,s);return w&&(o=function(E,I){const M=[];for(let P=0;P=3){for(let U=0;U0?e+2*i:i}const Od=$t([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Ud=$t([{name:"a_projected_pos",components:3,type:"Float32"}],4);$t([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Vd=$t([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);$t([{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 Eh=$t([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Nd=$t([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function $d(i,e,r){return i.sections.forEach(s=>{s.text=function(o,u,p){const f=u.layout.get("text-transform").evaluate(p,{});return f==="uppercase"?o=o.toLocaleUpperCase():f==="lowercase"&&(o=o.toLocaleLowerCase()),nr.applyArabicShaping&&(o=nr.applyArabicShaping(o)),o}(s.text,e,r)}),i}$t([{name:"triangle",components:3,type:"Uint16"}]),$t([{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"}]),$t([{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"}]),$t([{type:"Float32",name:"offsetX"}]),$t([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),$t([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const xo={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var ri=24,Sh=yt,Ih=function(i,e,r,s,o){var u,p,f=8*o-s-1,_=(1<>1,w=-7,E=r?o-1:0,I=r?-1:1,M=i[e+E];for(E+=I,u=M&(1<<-w)-1,M>>=-w,w+=f;w>0;u=256*u+i[e+E],E+=I,w-=8);for(p=u&(1<<-w)-1,u>>=-w,w+=s;w>0;p=256*p+i[e+E],E+=I,w-=8);if(u===0)u=1-x;else{if(u===_)return p?NaN:1/0*(M?-1:1);p+=Math.pow(2,s),u-=x}return(M?-1:1)*p*Math.pow(2,u-s)},Ah=function(i,e,r,s,o,u){var p,f,_,x=8*u-o-1,w=(1<>1,I=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=s?0:u-1,P=s?1:-1,B=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=isNaN(e)?1:0,p=w):(p=Math.floor(Math.log(e)/Math.LN2),e*(_=Math.pow(2,-p))<1&&(p--,_*=2),(e+=p+E>=1?I/_:I*Math.pow(2,1-E))*_>=2&&(p++,_/=2),p+E>=w?(f=0,p=w):p+E>=1?(f=(e*_-1)*Math.pow(2,o),p+=E):(f=e*Math.pow(2,E-1)*Math.pow(2,o),p=0));o>=8;i[r+M]=255&f,M+=P,f/=256,o-=8);for(p=p<0;i[r+M]=255&p,M+=P,p/=256,x-=8);i[r+M-P]|=128*B};function yt(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}yt.Varint=0,yt.Fixed64=1,yt.Bytes=2,yt.Fixed32=5;var gc=4294967296,Ch=1/gc,Mh=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Mn(i){return i.type===yt.Bytes?i.readVarint()+i.pos:i.pos+1}function Ta(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function Ph(i,e,r){var s=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(s);for(var o=r.pos-1;o>=i;o--)r.buf[o+s]=r.buf[o]}function qd(i,e){for(var r=0;r>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function zh(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}yt.prototype={destroy:function(){this.buf=null},readFields:function(i,e,r){for(r=r||this.length;this.pos>3,u=this.pos;this.type=7&s,i(o,e,this),this.pos===u&&this.skip(s)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=ml(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=zh(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=ml(this.buf,this.pos)+ml(this.buf,this.pos+4)*gc;return this.pos+=8,i},readSFixed64:function(){var i=ml(this.buf,this.pos)+zh(this.buf,this.pos+4)*gc;return this.pos+=8,i},readFloat:function(){var i=Ih(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Ih(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,r,s=this.buf;return e=127&(r=s[this.pos++]),r<128?e:(e|=(127&(r=s[this.pos++]))<<7,r<128?e:(e|=(127&(r=s[this.pos++]))<<14,r<128?e:(e|=(127&(r=s[this.pos++]))<<21,r<128?e:function(o,u,p){var f,_,x=p.buf;if(f=(112&(_=x[p.pos++]))>>4,_<128||(f|=(127&(_=x[p.pos++]))<<3,_<128)||(f|=(127&(_=x[p.pos++]))<<10,_<128)||(f|=(127&(_=x[p.pos++]))<<17,_<128)||(f|=(127&(_=x[p.pos++]))<<24,_<128)||(f|=(1&(_=x[p.pos++]))<<31,_<128))return Ta(o,f,u);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=s[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var i=this.readVarint()+this.pos,e=this.pos;return this.pos=i,i-e>=12&&Mh?function(r,s,o){return Mh.decode(r.subarray(s,o))}(this.buf,e,i):function(r,s,o){for(var u="",p=s;p239?4:w>223?3:w>191?2:1;if(p+I>o)break;I===1?w<128&&(E=w):I===2?(192&(f=r[p+1]))==128&&(E=(31&w)<<6|63&f)<=127&&(E=null):I===3?(_=r[p+2],(192&(f=r[p+1]))==128&&(192&_)==128&&((E=(15&w)<<12|(63&f)<<6|63&_)<=2047||E>=55296&&E<=57343)&&(E=null)):I===4&&(_=r[p+2],x=r[p+3],(192&(f=r[p+1]))==128&&(192&_)==128&&(192&x)==128&&((E=(15&w)<<18|(63&f)<<12|(63&_)<<6|63&x)<=65535||E>=1114112)&&(E=null)),E===null?(E=65533,I=1):E>65535&&(E-=65536,u+=String.fromCharCode(E>>>10&1023|55296),E=56320|1023&E),u+=String.fromCharCode(E),p+=I}return u}(this.buf,e,i)},readBytes:function(){var i=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,i);return this.pos=i,e},readPackedVarint:function(i,e){if(this.type!==yt.Bytes)return i.push(this.readVarint(e));var r=Mn(this);for(i=i||[];this.pos127;);else if(e===yt.Bytes)this.pos=this.readVarint()+this.pos;else if(e===yt.Fixed32)this.pos+=4;else{if(e!==yt.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(i,e){this.writeVarint(i<<3|e)},realloc:function(i){for(var e=this.length||16;e268435455||i<0?function(e,r){var s,o;if(e>=0?(s=e%4294967296|0,o=e/4294967296|0):(o=~(-e/4294967296),4294967295^(s=~(-e%4294967296))?s=s+1|0:(s=0,o=o+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(u,p,f){f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,f.buf[f.pos]=127&(u>>>=7)}(s,0,r),function(u,p){var f=(7&u)<<4;p.buf[p.pos++]|=f|((u>>>=3)?128:0),u&&(p.buf[p.pos++]=127&u|((u>>>=7)?128:0),u&&(p.buf[p.pos++]=127&u|((u>>>=7)?128:0),u&&(p.buf[p.pos++]=127&u|((u>>>=7)?128:0),u&&(p.buf[p.pos++]=127&u|((u>>>=7)?128:0),u&&(p.buf[p.pos++]=127&u)))))}(o,r)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(!!i)},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var e=this.pos;this.pos=function(s,o,u){for(var p,f,_=0;_55295&&p<57344){if(!f){p>56319||_+1===o.length?(s[u++]=239,s[u++]=191,s[u++]=189):f=p;continue}if(p<56320){s[u++]=239,s[u++]=191,s[u++]=189,f=p;continue}p=f-55296<<10|p-56320|65536,f=null}else f&&(s[u++]=239,s[u++]=191,s[u++]=189,f=null);p<128?s[u++]=p:(p<2048?s[u++]=p>>6|192:(p<65536?s[u++]=p>>12|224:(s[u++]=p>>18|240,s[u++]=p>>12&63|128),s[u++]=p>>6&63|128),s[u++]=63&p|128)}return u}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&Ph(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Ah(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Ah(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var e=i.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&Ph(r,s,this),this.pos=r-1,this.writeVarint(s),this.pos+=s},writeMessage:function(i,e,r){this.writeTag(i,yt.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,qd,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,Zd,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,Xd,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,jd,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,Gd,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,Wd,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,Hd,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,Kd,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,Yd,e)},writeBytesField:function(i,e){this.writeTag(i,yt.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,yt.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,yt.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,yt.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,yt.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,yt.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,yt.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,yt.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,yt.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,yt.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,!!e)}};var _c=Oe(Sh);const yc=3;function Jd(i,e,r){i===1&&r.readMessage(Qd,e)}function Qd(i,e,r){if(i===3){const{id:s,bitmap:o,width:u,height:p,left:f,top:_,advance:x}=r.readMessage(ep,{});e.push({id:s,bitmap:new uo({width:u+2*yc,height:p+2*yc},o),metrics:{width:u,height:p,left:f,top:_,advance:x}})}}function ep(i,e,r){i===1?e.id=r.readVarint():i===2?e.bitmap=r.readBytes():i===3?e.width=r.readVarint():i===4?e.height=r.readVarint():i===5?e.left=r.readSVarint():i===6?e.top=r.readSVarint():i===7&&(e.advance=r.readVarint())}const kh=yc;function Dh(i){let e=0,r=0;for(const p of i)e+=p.w*p.h,r=Math.max(r,p.w);i.sort((p,f)=>f.h-p.h);const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let o=0,u=0;for(const p of i)for(let f=s.length-1;f>=0;f--){const _=s[f];if(!(p.w>_.w||p.h>_.h)){if(p.x=_.x,p.y=_.y,u=Math.max(u,p.y+p.h),o=Math.max(o,p.x+p.w),p.w===_.w&&p.h===_.h){const x=s.pop();f=0&&s>=e&&_l[this.text.charCodeAt(s)];s--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){const s=new Sa;return s.text=this.text.substring(e,r),s.sectionIndex=this.sectionIndex.slice(e,r),s.sections=this.sections,s}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}addTextSection(e,r){this.text+=e.text,this.sections.push(bo.forText(e.scale,e.fontStack||r));const s=this.sections.length-1;for(let o=0;o=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function gl(i,e,r,s,o,u,p,f,_,x,w,E,I,M,P,B){const U=Sa.fromFeature(i,o);let $;E===c.WritingMode.vertical&&U.verticalizePunctuation();const{processBidirectionalText:Q,processStyledBidirectionalText:W}=nr;if(Q&&U.sections.length===1){$=[];const he=Q(U.toString(),vc(U,x,u,e,s,M,P));for(const Ce of he){const Re=new Sa;Re.text=Ce,Re.sections=U.sections;for(let Ae=0;Ae0&&zn>Yi&&(Yi=zn)}else{const xr=Re[st.fontStack],Ji=xr&&xr[bi];if(Ji&&Ji.rect)jr=Ji.rect,zr=Ji.metrics;else{const zn=Ce[st.fontStack],Io=zn&&zn[bi];if(!Io)continue;zr=Io.metrics}Vi=(si-st.scale)*ri}kr?(he.verticalizable=!0,Ki.push({glyph:bi,imageName:Gr,x:Et,y:At+Vi,vertical:kr,scale:st.scale,fontStack:st.fontStack,sectionIndex:or,metrics:zr,rect:jr}),Et+=Pn*st.scale+qe):(Ki.push({glyph:bi,imageName:Gr,x:Et,y:At+Vi,vertical:kr,scale:st.scale,fontStack:st.fontStack,sectionIndex:or,metrics:zr,rect:jr}),Et+=zr.advance*st.scale+qe)}Ki.length!==0&&(ni=Math.max(Et-qe,ni),rp(Ki,0,Ki.length-1,Fi,Yi)),Et=0;const Ft=ve*si+Yi;Ui.lineOffset=Math.max(Yi,Ci),At+=Ft,ar=Math.max(Ft,ar),++Ht}var oi;const xi=At-vo,{horizontalAlign:Hi,verticalAlign:Oi}=bc(ze);(function(Kt,si,Ci,Ui,Ki,Yi,Ft,vi,st){const or=(si-Ci)*Ki;let bi=0;bi=Yi!==Ft?-vi*Ui-vo:(-Ui*st+.5)*Ft;for(const Vi of Kt)for(const zr of Vi.positionedGlyphs)zr.x+=or,zr.y+=bi})(he.positionedLines,Fi,Hi,Oi,ni,ar,ve,xi,Se.length),he.top+=-Oi*xi,he.bottom=he.top+xi,he.left+=-Hi*ni,he.right=he.left+ni}(se,e,r,s,$,p,f,_,E,x,I,B),!function(he){for(const Ce of he)if(Ce.positionedGlyphs.length!==0)return!1;return!0}(ie)&&se}const _l={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},tp={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Bh(i,e,r,s,o,u){if(e.imageName){const p=s[e.imageName];return p?p.displaySize[0]*e.scale*ri/u+o:0}{const p=r[e.fontStack],f=p&&p[i];return f?f.metrics.advance*e.scale+o:0}}function Rh(i,e,r,s){const o=Math.pow(i-e,2);return s?i=0;let w=0;for(let I=0;Ip.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=ic([]),this.placementViewportMatrix=ic([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Vh(this.zoom,r["text-size"]),this.iconSizeData=Vh(this.zoom,r["icon-size"]);const s=this.layers[0].layout,o=s.get("symbol-sort-key"),u=s.get("symbol-z-order");this.canOverlap=wc(s,"text-overlap","text-allow-overlap")!=="never"||wc(s,"icon-overlap","icon-allow-overlap")!=="never"||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=u!=="viewport-y"&&!o.isConstant(),this.sortFeaturesByY=(u==="viewport-y"||u==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,s.get("symbol-placement")==="point"&&(this.writingModes=s.get("text-writing-mode").map(p=>c.WritingMode[p])),this.stateDependentLayerIds=this.layers.filter(p=>p.isStateDependent()).map(p=>p.id),this.sourceID=e.sourceID}createArrays(){this.text=new Ec(new An(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Ec(new An(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new C,this.lineVertexArray=new L,this.symbolInstances=new T,this.textAnchorOffsets=new F}calculateGlyphDependencies(e,r,s,o,u){for(let p=0;p0)&&(p.value.kind!=="constant"||p.value.value.length>0),w=_.value.kind!=="constant"||!!_.value.value||Object.keys(_.parameters).length>0,E=u.get("symbol-sort-key");if(this.features=[],!x&&!w)return;const I=r.iconDependencies,M=r.glyphDependencies,P=r.availableImages,B=new St(this.zoom);for(const{feature:U,id:$,index:Q,sourceLayerIndex:W}of e){const ie=o._featureFilter.needGeometry,se=un(U,ie);if(!o._featureFilter.filter(B,se,s))continue;let he,Ce;if(ie||(se.geometry=Zr(U)),x){const Ae=o.getValueAndResolveTokens("text-field",se,s,P),Se=Ot.factory(Ae);op(Se)&&(this.hasRTLText=!0),(!this.hasRTLText||to()==="unavailable"||this.hasRTLText&&nr.isParsed())&&(he=$d(Se,o,se))}if(w){const Ae=o.getValueAndResolveTokens("icon-image",se,s,P);Ce=Ae instanceof ir?Ae:ir.fromString(Ae)}if(!he&&!Ce)continue;const Re=this.sortFeaturesByKey?E.evaluate(se,{},s):void 0;if(this.features.push({id:$,text:he,icon:Ce,index:Q,sourceLayerIndex:W,geometry:se.geometry,properties:U.properties,type:sp[U.type],sortKey:Re}),Ce&&(I[Ce.name]=!0),he){const Ae=p.evaluate(se,{},s).join(","),Se=u.get("text-rotation-alignment")!=="viewport"&&u.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(c.WritingMode.vertical)>=0;for(const ve of he.sections)if(ve.image)I[ve.image.name]=!0;else{const ze=ha(he.toString()),be=ve.fontStack||Ae,ye=M[be]=M[be]||{};this.calculateGlyphDependencies(ve.text,ye,Se,this.allowVerticalPlacement,ze)}}}u.get("symbol-placement")==="line"&&(this.features=function(U){const $={},Q={},W=[];let ie=0;function se(Ae){W.push(U[Ae]),ie++}function he(Ae,Se,ve){const ze=Q[Ae];return delete Q[Ae],Q[Se]=ze,W[ze].geometry[0].pop(),W[ze].geometry[0]=W[ze].geometry[0].concat(ve[0]),ze}function Ce(Ae,Se,ve){const ze=$[Se];return delete $[Se],$[Ae]=ze,W[ze].geometry[0].shift(),W[ze].geometry[0]=ve[0].concat(W[ze].geometry[0]),ze}function Re(Ae,Se,ve){const ze=ve?Se[0][Se[0].length-1]:Se[0][0];return`${Ae}:${ze.x}:${ze.y}`}for(let Ae=0;AeAe.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((U,$)=>U.sortKey-$.sortKey)}update(e,r,s){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,s),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,s))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,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(e,r){const s=this.lineVertexArray.length;if(e.segment!==void 0){let o=e.dist(r[e.segment+1]),u=e.dist(r[e.segment]);const p={};for(let f=e.segment+1;f=0;f--)p[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:u},f>0&&(u+=r[f-1].dist(r[f]));for(let f=0;f0}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(e,r){const s=e.placedSymbolArray.get(r),o=s.vertexStartIndex+4*s.numGlyphs;for(let u=s.vertexStartIndex;uo[f]-o[_]||u[_]-u[f]),p}addToSortKeyRanges(e,r){const s=this.sortKeyRanges[this.sortKeyRanges.length-1];s&&s.sortKey===r?s.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const r of this.symbolInstanceIndexes){const s=this.symbolInstances.get(r);this.featureSortOrder.push(s.featureIndex),[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex].forEach((o,u,p)=>{o>=0&&p.indexOf(o)===u&&this.addIndicesForPlacedSymbol(this.text,o)}),s.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,s.verticalPlacedTextSymbolIndex),s.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.placedIconSymbolIndex),s.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Nh,$h;Pe("SymbolBucket",Ia,{omit:["layers","collisionBoxArray","features","compareText"]}),Ia.MAX_GLYPHS=65535,Ia.addDynamicAttributes=Tc;var Ic={get paint(){return $h=$h||new Li({"icon-opacity":new je(le.paint_symbol["icon-opacity"]),"icon-color":new je(le.paint_symbol["icon-color"]),"icon-halo-color":new je(le.paint_symbol["icon-halo-color"]),"icon-halo-width":new je(le.paint_symbol["icon-halo-width"]),"icon-halo-blur":new je(le.paint_symbol["icon-halo-blur"]),"icon-translate":new Ue(le.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ue(le.paint_symbol["icon-translate-anchor"]),"text-opacity":new je(le.paint_symbol["text-opacity"]),"text-color":new je(le.paint_symbol["text-color"],{runtimeType:pi,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new je(le.paint_symbol["text-halo-color"]),"text-halo-width":new je(le.paint_symbol["text-halo-width"]),"text-halo-blur":new je(le.paint_symbol["text-halo-blur"]),"text-translate":new Ue(le.paint_symbol["text-translate"]),"text-translate-anchor":new Ue(le.paint_symbol["text-translate-anchor"])})},get layout(){return Nh=Nh||new Li({"symbol-placement":new Ue(le.layout_symbol["symbol-placement"]),"symbol-spacing":new Ue(le.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ue(le.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new je(le.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ue(le.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ue(le.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ue(le.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ue(le.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ue(le.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ue(le.layout_symbol["icon-rotation-alignment"]),"icon-size":new je(le.layout_symbol["icon-size"]),"icon-text-fit":new Ue(le.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ue(le.layout_symbol["icon-text-fit-padding"]),"icon-image":new je(le.layout_symbol["icon-image"]),"icon-rotate":new je(le.layout_symbol["icon-rotate"]),"icon-padding":new je(le.layout_symbol["icon-padding"]),"icon-keep-upright":new Ue(le.layout_symbol["icon-keep-upright"]),"icon-offset":new je(le.layout_symbol["icon-offset"]),"icon-anchor":new je(le.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ue(le.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ue(le.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ue(le.layout_symbol["text-rotation-alignment"]),"text-field":new je(le.layout_symbol["text-field"]),"text-font":new je(le.layout_symbol["text-font"]),"text-size":new je(le.layout_symbol["text-size"]),"text-max-width":new je(le.layout_symbol["text-max-width"]),"text-line-height":new Ue(le.layout_symbol["text-line-height"]),"text-letter-spacing":new je(le.layout_symbol["text-letter-spacing"]),"text-justify":new je(le.layout_symbol["text-justify"]),"text-radial-offset":new je(le.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ue(le.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new je(le.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new je(le.layout_symbol["text-anchor"]),"text-max-angle":new Ue(le.layout_symbol["text-max-angle"]),"text-writing-mode":new Ue(le.layout_symbol["text-writing-mode"]),"text-rotate":new je(le.layout_symbol["text-rotate"]),"text-padding":new Ue(le.layout_symbol["text-padding"]),"text-keep-upright":new Ue(le.layout_symbol["text-keep-upright"]),"text-transform":new je(le.layout_symbol["text-transform"]),"text-offset":new je(le.layout_symbol["text-offset"]),"text-allow-overlap":new Ue(le.layout_symbol["text-allow-overlap"]),"text-overlap":new Ue(le.layout_symbol["text-overlap"]),"text-ignore-placement":new Ue(le.layout_symbol["text-ignore-placement"]),"text-optional":new Ue(le.layout_symbol["text-optional"])})}};class qh{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:tn,this.defaultValue=e}evaluate(e){if(e.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(e.formattedSection))return r.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Pe("FormatSectionOverride",qh,{omit:["defaultValue"]});class xl extends Cr{constructor(e){super(e,Ic)}recalculate(e,r){if(super.recalculate(e,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const s=this.layout.get("text-writing-mode");if(s){const o=[];for(const u of s)o.indexOf(u)<0&&o.push(u);this.layout._values["text-writing-mode"]=o}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,s,o){const u=this.layout.get(e).evaluate(r,{},s,o),p=this._unevaluatedLayout._values[e];return p.isDataDriven()||ea(p.value)||!u?u:function(f,_){return _.replace(/{([^{}]+)}/g,(x,w)=>w in f?String(f[w]):"")}(r.properties,u)}createBucket(e){return new Ia(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of Ic.paint.overridableProperties){if(!xl.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),s=new qh(r),o=new Lt(s,r.property.specification);let u=null;u=r.value.kind==="constant"||r.value.kind==="source"?new us("source",o):new wt("composite",o,r.value.zoomStops),this.paint._values[e]=new fr(r.property,u,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,s){return!(!this.layout||r.isDataDriven()||s.isDataDriven())&&xl.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const s=e.get("text-field"),o=Ic.paint.properties[r];let u=!1;const p=f=>{for(const _ of f)if(o.overrides&&o.overrides.hasOverride(_))return void(u=!0)};if(s.value.kind==="constant"&&s.value.value instanceof Ot)p(s.value.value.sections);else if(s.value.kind==="source"){const f=x=>{u||(x instanceof gn&&Ut(x.value)===Er?p(x.value.sections):x instanceof Js?p(x.sections):x.eachChild(f))},_=s.value;_._styleExpression&&f(_._styleExpression.expression)}return u}}let Zh;var lp={get paint(){return Zh=Zh||new Li({"background-color":new Ue(le.paint_background["background-color"]),"background-pattern":new io(le.paint_background["background-pattern"]),"background-opacity":new Ue(le.paint_background["background-opacity"])})}};class cp extends Cr{constructor(e){super(e,lp)}}let jh;var hp={get paint(){return jh=jh||new Li({"raster-opacity":new Ue(le.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ue(le.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ue(le.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ue(le.paint_raster["raster-brightness-max"]),"raster-saturation":new Ue(le.paint_raster["raster-saturation"]),"raster-contrast":new Ue(le.paint_raster["raster-contrast"]),"raster-resampling":new Ue(le.paint_raster["raster-resampling"]),"raster-fade-duration":new Ue(le.paint_raster["raster-fade-duration"])})}};class up extends Cr{constructor(e){super(e,hp)}}class dp extends Cr{constructor(e){super(e,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class pp{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const Ac=63710088e-1;class Qn{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Qn(Mt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const r=Math.PI/180,s=this.lat*r,o=e.lat*r,u=Math.sin(s)*Math.sin(o)+Math.cos(s)*Math.cos(o)*Math.cos((e.lng-this.lng)*r);return Ac*Math.acos(Math.min(u,1))}static convert(e){if(e instanceof Qn)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Qn(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Qn(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const Gh=2*Math.PI*Ac;function Xh(i){return Gh*Math.cos(i*Math.PI/180)}function Wh(i){return(180+i)/360}function Hh(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function Kh(i,e){return i/Xh(e)}function Cc(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class vl{constructor(e,r,s=0){this.x=+e,this.y=+r,this.z=+s}static fromLngLat(e,r=0){const s=Qn.convert(e);return new vl(Wh(s.lng),Hh(s.lat),Kh(r,s.lat))}toLngLat(){return new Qn(360*this.x-180,Cc(this.y))}toAltitude(){return this.z*Xh(Cc(this.y))}meterInMercatorCoordinateUnits(){return 1/Gh*(e=Cc(this.y),1/Math.cos(e*Math.PI/180));var e}}function Yh(i,e,r){var s=2*Math.PI*6378137/256/Math.pow(2,r);return[i*s-2*Math.PI*6378137/2,e*s-2*Math.PI*6378137/2]}class Mc{constructor(e,r,s){if(e<0||e>25||s<0||s>=Math.pow(2,e)||r<0||r>=Math.pow(2,e))throw new Error(`x=${r}, y=${s}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=r,this.y=s,this.key=To(0,e,e,r,s)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,s){const o=(p=this.y,f=this.z,_=Yh(256*(u=this.x),256*(p=Math.pow(2,f)-p-1),f),x=Yh(256*(u+1),256*(p+1),f),_[0]+","+_[1]+","+x[0]+","+x[1]);var u,p,f,_,x;const w=function(E,I,M){let P,B="";for(let U=E;U>0;U--)P=1<1?"@2x":"").replace(/{quadkey}/g,w).replace(/{bbox-epsg-3857}/g,o)}isChildOf(e){const r=this.z-e.z;return r>0&&e.x===this.x>>r&&e.y===this.y>>r}getTilePoint(e){const r=Math.pow(2,this.z);return new me((e.x*r-this.x)*Bt,(e.y*r-this.y)*Bt)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Jh{constructor(e,r){this.wrap=e,this.canonical=r,this.key=To(e,r.z,r.z,r.x,r.y)}}class yr{constructor(e,r,s,o,u){if(e= z; overscaledZ = ${e}; z = ${s}`);this.overscaledZ=e,this.wrap=r,this.canonical=new Mc(s,+o,+u),this.key=To(r,e,s,o,u)}clone(){return new yr(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-e;return e>this.canonical.z?new yr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new yr(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const s=this.canonical.z-e;return e>this.canonical.z?To(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):To(this.wrap*+r,e,e,this.canonical.x>>s,this.canonical.y>>s)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new yr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,s=2*this.canonical.x,o=2*this.canonical.y;return[new yr(r,this.wrap,r,s,o),new yr(r,this.wrap,r,s+1,o),new yr(r,this.wrap,r,s,o+1),new yr(r,this.wrap,r,s+1,o+1)]}isLessThan(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.ythis.max&&(this.max=f),f=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(e+1)}_unpackMapbox(e,r,s){return(256*e*256+256*r+s)/10-1e4}_unpackTerrarium(e,r,s){return 256*e+r+s/256-32768}getPixels(){return new _r({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,s){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let o=r*this.dim,u=r*this.dim+this.dim,p=s*this.dim,f=s*this.dim+this.dim;switch(r){case-1:o=u-1;break;case 1:u=o+1}switch(s){case-1:p=f-1;break;case 1:f=p+1}const _=-r*this.dim,x=-s*this.dim;for(let w=p;w=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class tu{constructor(e,r,s,o,u){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=s,e._y=o,this.properties=e.properties,this.id=u}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(e[r]=this[r]);return e}}class iu{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new ws(Bt,16,0),this.grid3D=new ws(Bt,16,0),this.featureIndexArray=new H,this.promoteId=r}insert(e,r,s,o,u,p){const f=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,o,u);const _=p?this.grid3D:this.grid;for(let x=0;x=0&&E[3]>=0&&_.insert(f,E[0],E[1],E[2],E[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Kn.VectorTile(new _c(this.rawTileData)).layers,this.sourceLayerCoder=new eu(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,s,o){this.loadVTLayers();const u=e.params||{},p=Bt/e.tileSize/e.scale,f=Na(u.filter),_=e.queryGeometry,x=e.queryPadding*p,w=nu(_),E=this.grid.query(w.minX-x,w.minY-x,w.maxX+x,w.maxY+x),I=nu(e.cameraQueryGeometry),M=this.grid3D.query(I.minX-x,I.minY-x,I.maxX+x,I.maxY+x,(U,$,Q,W)=>function(ie,se,he,Ce,Re){for(const Se of ie)if(se<=Se.x&&he<=Se.y&&Ce>=Se.x&&Re>=Se.y)return!0;const Ae=[new me(se,he),new me(se,Re),new me(Ce,Re),new me(Ce,he)];if(ie.length>2){for(const Se of Ae)if(xa(ie,Se))return!0}for(let Se=0;Se(W||(W=Zr(ie)),se.queryIntersectsFeature(_,ie,he,W,this.z,e.transform,p,e.pixelPosMatrix)))}return P}loadMatchingFeature(e,r,s,o,u,p,f,_,x,w,E){const I=this.bucketLayerIDs[r];if(p&&!function(U,$){for(let Q=0;Q=0)return!0;return!1}(p,I))return;const M=this.sourceLayerCoder.decode(s),P=this.vtLayers[M].feature(o);if(u.needGeometry){const U=un(P,!0);if(!u.filter(new St(this.tileID.overscaledZ),U,this.tileID.canonical))return}else if(!u.filter(new St(this.tileID.overscaledZ),P))return;const B=this.getId(P,M);for(let U=0;U{const f=e instanceof As?e.get(p):null;return f&&f.evaluate?f.evaluate(r,s,o):f})}function nu(i){let e=1/0,r=1/0,s=-1/0,o=-1/0;for(const u of i)e=Math.min(e,u.x),r=Math.min(r,u.y),s=Math.max(s,u.x),o=Math.max(o,u.y);return{minX:e,minY:r,maxX:s,maxY:o}}function fp(i,e){return e-i}function su(i,e,r,s,o){const u=[];for(let p=0;p=s&&E.x>=s||(w.x>=s?w=new me(s,w.y+(s-w.x)/(E.x-w.x)*(E.y-w.y))._round():E.x>=s&&(E=new me(s,w.y+(s-w.x)/(E.x-w.x)*(E.y-w.y))._round()),w.y>=o&&E.y>=o||(w.y>=o?w=new me(w.x+(o-w.y)/(E.y-w.y)*(E.x-w.x),o)._round():E.y>=o&&(E=new me(w.x+(o-w.y)/(E.y-w.y)*(E.x-w.x),o)._round()),_&&w.equals(_[_.length-1])||(_=[w],u.push(_)),_.push(E)))))}}return u}Pe("FeatureIndex",iu,{omit:["rawTileData","sourceLayerCoder"]});class es extends me{constructor(e,r,s,o){super(e,r),this.angle=s,o!==void 0&&(this.segment=o)}clone(){return new es(this.x,this.y,this.angle,this.segment)}}function au(i,e,r,s,o){if(e.segment===void 0||r===0)return!0;let u=e,p=e.segment+1,f=0;for(;f>-r/2;){if(p--,p<0)return!1;f-=i[p].dist(u),u=i[p]}f+=i[p].dist(i[p+1]),p++;const _=[];let x=0;for(;fs;)x-=_.shift().angleDelta;if(x>o)return!1;p++,f+=w.dist(E)}return!0}function ou(i){let e=0;for(let r=0;rx){const P=(x-_)/M,B=Zi.number(E.x,I.x,P),U=Zi.number(E.y,I.y,P),$=new es(B,U,I.angleTo(E),w);return $._round(),!p||au(i,$,f,p,e)?$:void 0}_+=M}}function gp(i,e,r,s,o,u,p,f,_){const x=lu(s,u,p),w=cu(s,o),E=w*p,I=i[0].x===0||i[0].x===_||i[0].y===0||i[0].y===_;return e-E=0&&ie<_&&se>=0&&se<_&&I-x>=0&&I+x<=w){const he=new es(ie,se,Q,P);he._round(),s&&!au(i,he,u,s,o)||M.push(he)}}E+=$}return f||M.length||p||(M=hu(i,E/2,r,s,o,u,p,!0,_)),M}Pe("Anchor",es);const Aa=Wi;function uu(i,e,r,s){const o=[],u=i.image,p=u.pixelRatio,f=u.paddedRect.w-2*Aa,_=u.paddedRect.h-2*Aa,x=i.right-i.left,w=i.bottom-i.top,E=u.stretchX||[[0,f]],I=u.stretchY||[[0,_]],M=(ve,ze)=>ve+ze[1]-ze[0],P=E.reduce(M,0),B=I.reduce(M,0),U=f-P,$=_-B;let Q=0,W=P,ie=0,se=B,he=0,Ce=U,Re=0,Ae=$;if(u.content&&s){const ve=u.content;Q=bl(E,0,ve[0]),ie=bl(I,0,ve[1]),W=bl(E,ve[0],ve[2]),se=bl(I,ve[1],ve[3]),he=ve[0]-Q,Re=ve[1]-ie,Ce=ve[2]-ve[0]-W,Ae=ve[3]-ve[1]-se}const Se=(ve,ze,be,ye)=>{const qe=wl(ve.stretch-Q,W,x,i.left),Fe=Tl(ve.fixed-he,Ce,ve.stretch,P),Qe=wl(ze.stretch-ie,se,w,i.top),Et=Tl(ze.fixed-Re,Ae,ze.stretch,B),At=wl(be.stretch-Q,W,x,i.left),ni=Tl(be.fixed-he,Ce,be.stretch,P),ar=wl(ye.stretch-ie,se,w,i.top),Fi=Tl(ye.fixed-Re,Ae,ye.stretch,B),Ht=new me(qe,Qe),oi=new me(At,Qe),xi=new me(At,ar),Hi=new me(qe,ar),Oi=new me(Fe/p,Et/p),Kt=new me(ni/p,Fi/p),si=e*Math.PI/180;if(si){const Ki=Math.sin(si),Yi=Math.cos(si),Ft=[Yi,-Ki,Ki,Yi];Ht._matMult(Ft),oi._matMult(Ft),Hi._matMult(Ft),xi._matMult(Ft)}const Ci=ve.stretch+ve.fixed,Ui=ze.stretch+ze.fixed;return{tl:Ht,tr:oi,bl:Hi,br:xi,tex:{x:u.paddedRect.x+Aa+Ci,y:u.paddedRect.y+Aa+Ui,w:be.stretch+be.fixed-Ci,h:ye.stretch+ye.fixed-Ui},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Oi,pixelOffsetBR:Kt,minFontScaleX:Ce/p/x,minFontScaleY:Ae/p/w,isSDF:r}};if(s&&(u.stretchX||u.stretchY)){const ve=du(E,U,P),ze=du(I,$,B);for(let be=0;be0&&(P=Math.max(10,P),this.circleDiameter=P)}else{let E=p.top*f-_[0],I=p.bottom*f+_[2],M=p.left*f-_[3],P=p.right*f+_[1];const B=p.collisionPadding;if(B&&(M-=B[0]*f,E-=B[1]*f,P+=B[2]*f,I+=B[3]*f),w){const U=new me(M,E),$=new me(P,E),Q=new me(M,I),W=new me(P,I),ie=w*Math.PI/180;U._rotate(ie),$._rotate(ie),Q._rotate(ie),W._rotate(ie),M=Math.min(U.x,$.x,Q.x,W.x),P=Math.max(U.x,$.x,Q.x,W.x),E=Math.min(U.y,$.y,Q.y,W.y),I=Math.max(U.y,$.y,Q.y,W.y)}e.emplaceBack(r.x,r.y,M,E,P,I,s,o,u)}this.boxEndIndex=e.length}}class _p{constructor(e=[],r=yp){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:r,compare:s}=this,o=r[e];for(;e>0;){const u=e-1>>1,p=r[u];if(s(o,p)>=0)break;r[e]=p,e=u}r[e]=o}_down(e){const{data:r,compare:s}=this,o=this.length>>1,u=r[e];for(;e=0)break;r[e]=f,e=p}r[e]=u}}function yp(i,e){return ie?1:0}function xp(i,e=1,r=!1){let s=1/0,o=1/0,u=-1/0,p=-1/0;const f=i[0];for(let M=0;Mu)&&(u=P.x),(!M||P.y>p)&&(p=P.y)}const _=Math.min(u-s,p-o);let x=_/2;const w=new _p([],vp);if(_===0)return new me(s,o);for(let M=s;ME.d||!E.d)&&(E=M,r&&console.log("found best %d after %d probes",Math.round(1e4*M.d)/1e4,I)),M.max-E.d<=e||(x=M.h/2,w.push(new Ca(M.p.x-x,M.p.y-x,x,i)),w.push(new Ca(M.p.x+x,M.p.y-x,x,i)),w.push(new Ca(M.p.x-x,M.p.y+x,x,i)),w.push(new Ca(M.p.x+x,M.p.y+x,x,i)),I+=4)}return r&&(console.log(`num probes: ${I}`),console.log(`best distance: ${E.d}`)),E.p}function vp(i,e){return e.max-i.max}function Ca(i,e,r,s){this.p=new me(i,e),this.h=r,this.d=function(o,u){let p=!1,f=1/0;for(let _=0;_o.y!=P.y>o.y&&o.x<(P.x-M.x)*(o.y-M.y)/(P.y-M.y)+M.x&&(p=!p),f=Math.min(f,Hc(o,M,P))}}return(p?1:-1)*Math.sqrt(f)}(this.p,s),this.max=this.d+this.h*Math.SQRT2}var yi;c.TextAnchorEnum=void 0,(yi=c.TextAnchorEnum||(c.TextAnchorEnum={}))[yi.center=1]="center",yi[yi.left=2]="left",yi[yi.right=3]="right",yi[yi.top=4]="top",yi[yi.bottom=5]="bottom",yi[yi["top-left"]=6]="top-left",yi[yi["top-right"]=7]="top-right",yi[yi["bottom-left"]=8]="bottom-left",yi[yi["bottom-right"]=9]="bottom-right";const ts=7,Pc=Number.POSITIVE_INFINITY;function pu(i,e){return e[1]!==Pc?function(r,s,o){let u=0,p=0;switch(s=Math.abs(s),o=Math.abs(o),r){case"top-right":case"top-left":case"top":p=o-ts;break;case"bottom-right":case"bottom-left":case"bottom":p=-o+ts}switch(r){case"top-right":case"bottom-right":case"right":u=-s;break;case"top-left":case"bottom-left":case"left":u=s}return[u,p]}(i,e[0],e[1]):function(r,s){let o=0,u=0;s<0&&(s=0);const p=s/Math.SQRT2;switch(r){case"top-right":case"top-left":u=p-ts;break;case"bottom-right":case"bottom-left":u=-p+ts;break;case"bottom":u=-s+ts;break;case"top":u=s-ts}switch(r){case"top-right":case"bottom-right":o=-p;break;case"top-left":case"bottom-left":o=p;break;case"left":o=s;break;case"right":o=-s}return[o,u]}(i,e[0])}function fu(i,e,r){var s;const o=i.layout,u=(s=o.get("text-variable-anchor-offset"))===null||s===void 0?void 0:s.evaluate(e,{},r);if(u){const f=u.values,_=[];for(let x=0;xI*ri);w.startsWith("top")?E[1]-=ts:w.startsWith("bottom")&&(E[1]+=ts),_[x+1]=E}return new fi(_)}const p=o.get("text-variable-anchor");if(p){let f;f=i._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[o.get("text-radial-offset").evaluate(e,{},r)*ri,Pc]:o.get("text-offset").evaluate(e,{},r).map(x=>x*ri);const _=[];for(const x of p)_.push(x,pu(x,f));return new fi(_)}return null}function zc(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function bp(i,e,r,s,o,u,p,f,_,x,w){let E=u.textMaxSize.evaluate(e,{});E===void 0&&(E=p);const I=i.layers[0].layout,M=I.get("icon-offset").evaluate(e,{},w),P=gu(r.horizontal),B=p/24,U=i.tilePixelRatio*B,$=i.tilePixelRatio*E/24,Q=i.tilePixelRatio*f,W=i.tilePixelRatio*I.get("symbol-spacing"),ie=I.get("text-padding")*i.tilePixelRatio,se=function(ye,qe,Fe,Qe=1){const Et=ye.get("icon-padding").evaluate(qe,{},Fe),At=Et&&Et.values;return[At[0]*Qe,At[1]*Qe,At[2]*Qe,At[3]*Qe]}(I,e,w,i.tilePixelRatio),he=I.get("text-max-angle")/180*Math.PI,Ce=I.get("text-rotation-alignment")!=="viewport"&&I.get("symbol-placement")!=="point",Re=I.get("icon-rotation-alignment")==="map"&&I.get("symbol-placement")!=="point",Ae=I.get("symbol-placement"),Se=W/2,ve=I.get("icon-text-fit");let ze;s&&ve!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(ze=Uh(s,r.vertical,ve,I.get("icon-text-fit-padding"),M,B)),P&&(s=Uh(s,P,ve,I.get("icon-text-fit-padding"),M,B)));const be=(ye,qe)=>{qe.x<0||qe.x>=Bt||qe.y<0||qe.y>=Bt||function(Fe,Qe,Et,At,ni,ar,Fi,Ht,oi,xi,Hi,Oi,Kt,si,Ci,Ui,Ki,Yi,Ft,vi,st,or,bi,Vi,zr){const jr=Fe.addToLineVertexArray(Qe,Et);let Gr,Pn,kr,xr,Ji=0,zn=0,Io=0,vu=0,Uc=-1,Vc=-1;const kn={};let bu=mr("");if(Fe.allowVerticalPlacement&&At.vertical){const Mi=Ht.layout.get("text-rotate").evaluate(st,{},Vi)+90;kr=new El(oi,Qe,xi,Hi,Oi,At.vertical,Kt,si,Ci,Mi),Fi&&(xr=new El(oi,Qe,xi,Hi,Oi,Fi,Ki,Yi,Ci,Mi))}if(ni){const Mi=Ht.layout.get("icon-rotate").evaluate(st,{}),vr=Ht.layout.get("icon-text-fit")!=="none",Ls=uu(ni,Mi,bi,vr),Wr=Fi?uu(Fi,Mi,bi,vr):void 0;Pn=new El(oi,Qe,xi,Hi,Oi,ni,Ki,Yi,!1,Mi),Ji=4*Ls.length;const Bs=Fe.iconSizeData;let pn=null;Bs.kind==="source"?(pn=[dn*Ht.layout.get("icon-size").evaluate(st,{})],pn[0]>Jn&&Qt(`${Fe.layerIds[0]}: Value for "icon-size" is >= ${wo}. Reduce your "icon-size".`)):Bs.kind==="composite"&&(pn=[dn*or.compositeIconSizes[0].evaluate(st,{},Vi),dn*or.compositeIconSizes[1].evaluate(st,{},Vi)],(pn[0]>Jn||pn[1]>Jn)&&Qt(`${Fe.layerIds[0]}: Value for "icon-size" is >= ${wo}. Reduce your "icon-size".`)),Fe.addSymbols(Fe.icon,Ls,pn,vi,Ft,st,c.WritingMode.none,Qe,jr.lineStartIndex,jr.lineLength,-1,Vi),Uc=Fe.icon.placedSymbolArray.length-1,Wr&&(zn=4*Wr.length,Fe.addSymbols(Fe.icon,Wr,pn,vi,Ft,st,c.WritingMode.vertical,Qe,jr.lineStartIndex,jr.lineLength,-1,Vi),Vc=Fe.icon.placedSymbolArray.length-1)}const wu=Object.keys(At.horizontal);for(const Mi of wu){const vr=At.horizontal[Mi];if(!Gr){bu=mr(vr.text);const Wr=Ht.layout.get("text-rotate").evaluate(st,{},Vi);Gr=new El(oi,Qe,xi,Hi,Oi,vr,Kt,si,Ci,Wr)}const Ls=vr.positionedLines.length===1;if(Io+=mu(Fe,Qe,vr,ar,Ht,Ci,st,Ui,jr,At.vertical?c.WritingMode.horizontal:c.WritingMode.horizontalOnly,Ls?wu:[Mi],kn,Uc,or,Vi),Ls)break}At.vertical&&(vu+=mu(Fe,Qe,At.vertical,ar,Ht,Ci,st,Ui,jr,c.WritingMode.vertical,["vertical"],kn,Vc,or,Vi));const Ep=Gr?Gr.boxStartIndex:Fe.collisionBoxArray.length,Sp=Gr?Gr.boxEndIndex:Fe.collisionBoxArray.length,Ip=kr?kr.boxStartIndex:Fe.collisionBoxArray.length,Ap=kr?kr.boxEndIndex:Fe.collisionBoxArray.length,Cp=Pn?Pn.boxStartIndex:Fe.collisionBoxArray.length,Mp=Pn?Pn.boxEndIndex:Fe.collisionBoxArray.length,Pp=xr?xr.boxStartIndex:Fe.collisionBoxArray.length,zp=xr?xr.boxEndIndex:Fe.collisionBoxArray.length;let Xr=-1;const Il=(Mi,vr)=>Mi&&Mi.circleDiameter?Math.max(Mi.circleDiameter,vr):vr;Xr=Il(Gr,Xr),Xr=Il(kr,Xr),Xr=Il(Pn,Xr),Xr=Il(xr,Xr);const Tu=Xr>-1?1:0;Tu&&(Xr*=zr/ri),Fe.glyphOffsetArray.length>=Ia.MAX_GLYPHS&&Qt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),st.sortKey!==void 0&&Fe.addToSortKeyRanges(Fe.symbolInstances.length,st.sortKey);const kp=fu(Ht,st,Vi),[Dp,Lp]=function(Mi,vr){const Ls=Mi.length,Wr=vr==null?void 0:vr.values;if((Wr==null?void 0:Wr.length)>0)for(let Bs=0;Bs=0?kn.right:-1,kn.center>=0?kn.center:-1,kn.left>=0?kn.left:-1,kn.vertical||-1,Uc,Vc,bu,Ep,Sp,Ip,Ap,Cp,Mp,Pp,zp,xi,Io,vu,Ji,zn,Tu,0,Kt,Xr,Dp,Lp)}(i,qe,ye,r,s,o,ze,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,U,[ie,ie,ie,ie],Ce,_,Q,se,Re,M,e,u,x,w,p)};if(Ae==="line")for(const ye of su(e.geometry,0,0,Bt,Bt)){const qe=gp(ye,W,he,r.vertical||P,s,24,$,i.overscaling,Bt);for(const Fe of qe)P&&wp(i,P.text,Se,Fe)||be(ye,Fe)}else if(Ae==="line-center"){for(const ye of e.geometry)if(ye.length>1){const qe=mp(ye,he,r.vertical||P,s,24,$);qe&&be(ye,qe)}}else if(e.type==="Polygon")for(const ye of cc(e.geometry,0)){const qe=xp(ye,16);be(ye[0],new es(qe.x,qe.y,0))}else if(e.type==="LineString")for(const ye of e.geometry)be(ye,new es(ye[0].x,ye[0].y,0));else if(e.type==="Point")for(const ye of e.geometry)for(const qe of ye)be([qe],new es(qe.x,qe.y,0))}function mu(i,e,r,s,o,u,p,f,_,x,w,E,I,M,P){const B=function(Q,W,ie,se,he,Ce,Re,Ae){const Se=se.layout.get("text-rotate").evaluate(Ce,{})*Math.PI/180,ve=[];for(const ze of W.positionedLines)for(const be of ze.positionedGlyphs){if(!be.rect)continue;const ye=be.rect||{};let qe=kh+1,Fe=!0,Qe=1,Et=0;const At=(he||Ae)&&be.vertical,ni=be.metrics.advance*be.scale/2;if(Ae&&W.verticalizable&&(Et=ze.lineOffset/2-(be.imageName?-(ri-be.metrics.width*be.scale)/2:(be.scale-1)*ri)),be.imageName){const Ft=Re[be.imageName];Fe=Ft.sdf,Qe=Ft.pixelRatio,qe=Wi/Qe}const ar=he?[be.x+ni,be.y]:[0,0];let Fi=he?[0,0]:[be.x+ni+ie[0],be.y+ie[1]-Et],Ht=[0,0];At&&(Ht=Fi,Fi=[0,0]);const oi=(be.metrics.left-qe)*be.scale-ni+Fi[0],xi=(-be.metrics.top-qe)*be.scale+Fi[1],Hi=oi+ye.w*be.scale/Qe,Oi=xi+ye.h*be.scale/Qe,Kt=new me(oi,xi),si=new me(Hi,xi),Ci=new me(oi,Oi),Ui=new me(Hi,Oi);if(At){const Ft=new me(-ni,ni-vo),vi=-Math.PI/2,st=ri/2-ni,or=new me(5-vo-st,-(be.imageName?st:0)),bi=new me(...Ht);Kt._rotateAround(vi,Ft)._add(or)._add(bi),si._rotateAround(vi,Ft)._add(or)._add(bi),Ci._rotateAround(vi,Ft)._add(or)._add(bi),Ui._rotateAround(vi,Ft)._add(or)._add(bi)}if(Se){const Ft=Math.sin(Se),vi=Math.cos(Se),st=[vi,-Ft,Ft,vi];Kt._matMult(st),si._matMult(st),Ci._matMult(st),Ui._matMult(st)}const Ki=new me(0,0),Yi=new me(0,0);ve.push({tl:Kt,tr:si,bl:Ci,br:Ui,tex:ye,writingMode:W.writingMode,glyphOffset:ar,sectionIndex:be.sectionIndex,isSDF:Fe,pixelOffsetTL:Ki,pixelOffsetBR:Yi,minFontScaleX:0,minFontScaleY:0})}return ve}(0,r,f,o,u,p,s,i.allowVerticalPlacement),U=i.textSizeData;let $=null;U.kind==="source"?($=[dn*o.layout.get("text-size").evaluate(p,{})],$[0]>Jn&&Qt(`${i.layerIds[0]}: Value for "text-size" is >= ${wo}. Reduce your "text-size".`)):U.kind==="composite"&&($=[dn*M.compositeTextSizes[0].evaluate(p,{},P),dn*M.compositeTextSizes[1].evaluate(p,{},P)],($[0]>Jn||$[1]>Jn)&&Qt(`${i.layerIds[0]}: Value for "text-size" is >= ${wo}. Reduce your "text-size".`)),i.addSymbols(i.text,B,$,f,u,p,x,e,_.lineStartIndex,_.lineLength,I,P);for(const Q of w)E[Q]=i.text.placedSymbolArray.length-1;return 4*B.length}function gu(i){for(const e in i)return i[e];return null}function wp(i,e,r,s){const o=i.compareText;if(e in o){const u=o[e];for(let p=u.length-1;p>=0;p--)if(s.dist(u[p])>4;if(o!==1)throw new Error(`Got v${o} data when expected v1.`);const u=_u[15&s];if(!u)throw new Error("Unrecognized array type.");const[p]=new Uint16Array(e,2,1),[f]=new Uint32Array(e,4,1);return new kc(f,p,u,e)}constructor(e,r=64,s=Float64Array,o){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=s,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const u=_u.indexOf(this.ArrayType),p=2*e*this.ArrayType.BYTES_PER_ELEMENT,f=e*this.IndexArrayType.BYTES_PER_ELEMENT,_=(8-f%8)%8;if(u<0)throw new Error(`Unexpected typed array class: ${s}.`);o&&o instanceof ArrayBuffer?(this.data=o,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+_,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+p+f+_),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+_,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+u]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=e)}add(e,r){const s=this._pos>>1;return this.ids[s]=s,this.coords[this._pos++]=e,this.coords[this._pos++]=r,s}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Dc(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,s,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:u,coords:p,nodeSize:f}=this,_=[0,u.length-1,0],x=[];for(;_.length;){const w=_.pop()||0,E=_.pop()||0,I=_.pop()||0;if(E-I<=f){for(let U=I;U<=E;U++){const $=p[2*U],Q=p[2*U+1];$>=e&&$<=s&&Q>=r&&Q<=o&&x.push(u[U])}continue}const M=I+E>>1,P=p[2*M],B=p[2*M+1];P>=e&&P<=s&&B>=r&&B<=o&&x.push(u[M]),(w===0?e<=P:r<=B)&&(_.push(I),_.push(M-1),_.push(1-w)),(w===0?s>=P:o>=B)&&(_.push(M+1),_.push(E),_.push(1-w))}return x}within(e,r,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:o,coords:u,nodeSize:p}=this,f=[0,o.length-1,0],_=[],x=s*s;for(;f.length;){const w=f.pop()||0,E=f.pop()||0,I=f.pop()||0;if(E-I<=p){for(let U=I;U<=E;U++)xu(u[2*U],u[2*U+1],e,r)<=x&&_.push(o[U]);continue}const M=I+E>>1,P=u[2*M],B=u[2*M+1];xu(P,B,e,r)<=x&&_.push(o[M]),(w===0?e-s<=P:r-s<=B)&&(f.push(I),f.push(M-1),f.push(1-w)),(w===0?e+s>=P:r+s>=B)&&(f.push(M+1),f.push(E),f.push(1-w))}return _}}function Dc(i,e,r,s,o,u){if(o-s<=r)return;const p=s+o>>1;yu(i,e,p,s,o,u),Dc(i,e,r,s,p-1,1-u),Dc(i,e,r,p+1,o,1-u)}function yu(i,e,r,s,o,u){for(;o>s;){if(o-s>600){const x=o-s+1,w=r-s+1,E=Math.log(x),I=.5*Math.exp(2*E/3),M=.5*Math.sqrt(E*I*(x-I)/x)*(w-x/2<0?-1:1);yu(i,e,r,Math.max(s,Math.floor(r-w*I/x+M)),Math.min(o,Math.floor(r+(x-w)*I/x+M)),u)}const p=e[2*r+u];let f=s,_=o;for(Eo(i,e,s,r),e[2*o+u]>p&&Eo(i,e,s,o);f<_;){for(Eo(i,e,f,_),f++,_--;e[2*f+u]p;)_--}e[2*s+u]===p?Eo(i,e,s,_):(_++,Eo(i,e,_,o)),_<=r&&(s=_+1),r<=_&&(o=_-1)}}function Eo(i,e,r,s){Lc(i,r,s),Lc(e,2*r,2*s),Lc(e,2*r+1,2*s+1)}function Lc(i,e,r){const s=i[e];i[e]=i[r],i[r]=s}function xu(i,e,r,s){const o=i-r,u=e-s;return o*o+u*u}var Bc;c.PerformanceMarkers=void 0,(Bc=c.PerformanceMarkers||(c.PerformanceMarkers={})).create="create",Bc.load="load",Bc.fullLoad="fullLoad";let Sl=null,So=[];const Rc=1e3/60,Fc="loadTime",Oc="fullLoadTime",Tp={mark(i){performance.mark(i)},frame(i){const e=i;Sl!=null&&So.push(e-Sl),Sl=e},clearMetrics(){Sl=null,So=[],performance.clearMeasures(Fc),performance.clearMeasures(Oc);for(const i in c.PerformanceMarkers)performance.clearMarks(c.PerformanceMarkers[i])},getPerformanceMetrics(){performance.measure(Fc,c.PerformanceMarkers.create,c.PerformanceMarkers.load),performance.measure(Oc,c.PerformanceMarkers.create,c.PerformanceMarkers.fullLoad);const i=performance.getEntriesByName(Fc)[0].duration,e=performance.getEntriesByName(Oc)[0].duration,r=So.length,s=1/(So.reduce((u,p)=>u+p,0)/r/1e3),o=So.filter(u=>u>Rc).reduce((u,p)=>u+(p-Rc)/Rc,0);return{loadTime:i,fullLoadTime:e,fps:s,percentDroppedFrames:o/(r+o)*100,totalFrames:r}}};c.AJAXError=cr,c.ARRAY_TYPE=va,c.Actor=class{constructor(i,e,r){this.receive=s=>{const o=s.data,u=o.id;if(u&&(!o.targetMapId||this.mapId===o.targetMapId))if(o.type===""){delete this.tasks[u];const p=this.cancelCallbacks[u];delete this.cancelCallbacks[u],p&&p()}else Pi()||o.mustQueue?(this.tasks[u]=o,this.taskQueue.push(u),this.invoker.trigger()):this.processTask(u,o)},this.process=()=>{if(!this.taskQueue.length)return;const s=this.taskQueue.shift(),o=this.tasks[s];delete this.tasks[s],this.taskQueue.length&&this.invoker.trigger(),o&&this.processTask(s,o)},this.target=i,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},this.invoker=new pp(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=Pi()?i:window}send(i,e,r,s,o=!1){const u=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[u]=r);const p=Dr(this.globalScope)?void 0:[];return this.target.postMessage({id:u,type:i,hasCallback:!!r,targetMapId:s,mustQueue:o,sourceMapId:this.mapId,data:Ts(e,p)},p),{cancel:()=>{r&&delete this.callbacks[u],this.target.postMessage({id:u,type:"",targetMapId:s,sourceMapId:this.mapId})}}}processTask(i,e){if(e.type===""){const r=this.callbacks[i];delete this.callbacks[i],r&&(e.error?r(Tn(e.error)):r(null,Tn(e.data)))}else{let r=!1;const s=Dr(this.globalScope)?void 0:[],o=e.hasCallback?(f,_)=>{r=!0,delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"",sourceMapId:this.mapId,error:f?Ts(f):null,data:Ts(_,s)},s)}:f=>{r=!0};let u=null;const p=Tn(e.data);if(this.parent[e.type])u=this.parent[e.type](e.sourceMapId,p,o);else if(this.parent.getWorkerSource){const f=e.type.split(".");u=this.parent.getWorkerSource(e.sourceMapId,f[0],p.source)[f[1]](p,o)}else o(new Error(`Could not find function ${e.type}`));!r&&u&&u.cancel&&(this.cancelCallbacks[i]=u.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},c.AlphaImage=uo,c.CanonicalTileID=Mc,c.CollisionBoxArray=g,c.CollisionCircleLayoutArray=class extends ao{},c.Color=Xe,c.DEMData=Qh,c.DataConstantProperty=Ue,c.DictionaryCoder=eu,c.EXTENT=Bt,c.ErrorEvent=Ni,c.EvaluationParameters=St,c.Event=Ii,c.Evented=pr,c.FeatureIndex=iu,c.FillBucket=dc,c.FillExtrusionBucket=fc,c.GeoJSONFeature=tu,c.ImageAtlas=Lh,c.ImagePosition=xc,c.KDBush=kc,c.LineBucket=mc,c.LineStripIndexArray=class extends l{},c.LngLat=Qn,c.MercatorCoordinate=vl,c.ONE_EM=ri,c.OverscaledTileID=yr,c.PerformanceUtils=Tp,c.Point=me,c.Pos3dArray=class extends Ms{},c.PosArray=ne,c.Properties=Li,c.Protobuf=_c,c.QuadTriangleArray=class extends _a{},c.RGBAImage=_r,c.RasterBoundsArray=class extends Ps{},c.RequestPerformance=class{constructor(i){this._marks={start:[i.url,"start"].join("#"),end:[i.url,"end"].join("#"),measure:i.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let i=performance.getEntriesByName(this._marks.measure);return i.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),i=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),i}},c.SegmentVector=$e,c.SymbolBucket=Ia,c.Transitionable=rl,c.TriangleIndexArray=Ne,c.Uniform1f=ti,c.Uniform1i=class extends qt{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},c.Uniform2f=class extends qt{constructor(i,e){super(i,e),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},c.Uniform3f=class extends qt{constructor(i,e){super(i,e),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},c.Uniform4f=gi,c.UniformColor=Wn,c.UniformMatrix4f=class extends qt{constructor(i,e){super(i,e),this.current=ii}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let e=1;e<16;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},c.UnwrappedTileID=Jh,c.ValidationError=we,c.ZoomHistory=Xa,c.addDynamicAttributes=Tc,c.arrayBufferToImage=function(i,e){const r=new Image;r.onload=()=>{e(null,r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame(()=>{r.src=Ei})},r.onerror=()=>e(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const s=new Blob([new Uint8Array(i)],{type:"image/png"});r.src=i.byteLength?URL.createObjectURL(s):Ei},c.arrayBufferToImageBitmap=function(i,e){const r=new Blob([new Uint8Array(i)],{type:"image/png"});createImageBitmap(r).then(s=>{e(null,s)}).catch(s=>{e(new Error(`Could not load image because of ${s.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})},c.asyncAll=function(i,e,r){if(!i.length)return r(null,[]);let s=i.length;const o=new Array(i.length);let u=null;i.forEach((p,f)=>{e(p,(_,x)=>{_&&(u=_),o[f]=x,--s==0&&r(u,o)})})},c.bezier=ai,c.browser=en,c.clamp=vt,c.clipLine=su,c.clone=function(i){var e=new va(16);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},c.clone$1=wi,c.collisionCircleLayout=Nd,c.config=Ln,c.copy=function(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},c.create=function(){var i=new va(16);return va!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},c.createExpression=nt,c.createFilter=Na,c.createLayout=$t,c.createStyleLayer=function(i){if(i.type==="custom")return new dp(i);switch(i.type){case"background":return new cp(i);case"circle":return new Wu(i);case"fill":return new fd(i);case"fill-extrusion":return new Md(i);case"heatmap":return new Ku(i);case"hillshade":return new Ju(i);case"line":return new Fd(i);case"raster":return new up(i);case"symbol":return new xl(i)}},c.deepEqual=function i(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(let s=0;s{s[p.source]?r.push({command:ht.removeLayer,args:[p.id]}):u.push(p)}),r=r.concat(o),function(p,f,_){f=f||[];const x=(p=p||[]).map(is),w=f.map(is),E=p.reduce(Rn,{}),I=f.reduce(Rn,{}),M=x.slice(),P=Object.create(null);let B,U,$,Q,W,ie,se;for(B=0,U=0;B{}}},c.groupByLayout=function(i,e){const r={};for(let o=0;o@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,s,o,u)=>{const p=o||u;return e[s]=!p||p.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e},c.parseGlyphPbf=function(i){return new _c(i).readFields(Jd,[])},c.pbf=Sh,c.performSymbolLayout=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=Bt/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;const e=i.bucket.layers[0],r=e.layout,s=e._unevaluatedLayout._values,o={layoutIconSize:s["icon-size"].possiblyEvaluate(new St(i.bucket.zoom+1),i.canonical),layoutTextSize:s["text-size"].possiblyEvaluate(new St(i.bucket.zoom+1),i.canonical),textMaxSize:s["text-size"].possiblyEvaluate(new St(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:x,maxZoom:w}=i.bucket.textSizeData;o.compositeTextSizes=[s["text-size"].possiblyEvaluate(new St(x),i.canonical),s["text-size"].possiblyEvaluate(new St(w),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:x,maxZoom:w}=i.bucket.iconSizeData;o.compositeIconSizes=[s["icon-size"].possiblyEvaluate(new St(x),i.canonical),s["icon-size"].possiblyEvaluate(new St(w),i.canonical)]}const u=r.get("text-line-height")*ri,p=r.get("text-rotation-alignment")!=="viewport"&&r.get("symbol-placement")!=="point",f=r.get("text-keep-upright"),_=r.get("text-size");for(const x of i.bucket.features){const w=r.get("text-font").evaluate(x,{},i.canonical).join(","),E=_.evaluate(x,{},i.canonical),I=o.layoutTextSize.evaluate(x,{},i.canonical),M=o.layoutIconSize.evaluate(x,{},i.canonical),P={horizontal:{},vertical:void 0},B=x.text;let U,$=[0,0];if(B){const ie=B.toString(),se=r.get("text-letter-spacing").evaluate(x,{},i.canonical)*ri,he=el(ie)?se:0,Ce=r.get("text-anchor").evaluate(x,{},i.canonical),Re=fu(e,x,i.canonical);if(!Re){const be=r.get("text-radial-offset").evaluate(x,{},i.canonical);$=be?pu(Ce,[be*ri,Pc]):r.get("text-offset").evaluate(x,{},i.canonical).map(ye=>ye*ri)}let Ae=p?"center":r.get("text-justify").evaluate(x,{},i.canonical);const Se=r.get("symbol-placement"),ve=Se==="point"?r.get("text-max-width").evaluate(x,{},i.canonical)*ri:0,ze=()=>{i.bucket.allowVerticalPlacement&&ha(ie)&&(P.vertical=gl(B,i.glyphMap,i.glyphPositions,i.imagePositions,w,ve,u,Ce,"left",he,$,c.WritingMode.vertical,!0,Se,I,E))};if(!p&&Re){const be=new Set;if(Ae==="auto")for(let qe=0;qethis._layers[de.id]),J=q[0];if(J.visibility==="none")continue;const G=J.source||"";let j=this.familiesBySource[G];j||(j=this.familiesBySource[G]={});const te=J.sourceLayer||"_geojsonTileLayer";let ue=j[te];ue||(ue=j[te]=[]),ue.push(q)}}}class re{constructor(S){const A={},z=[];for(const G in S){const j=S[G],te=A[G]={};for(const ue in j){const de=j[+ue];if(!de||de.bitmap.width===0||de.bitmap.height===0)continue;const pe={x:0,y:0,w:de.bitmap.width+2,h:de.bitmap.height+2};z.push(pe),te[ue]={rect:pe,metrics:de.metrics}}}const{w:V,h:q}=c.potpack(z),J=new c.AlphaImage({width:V||1,height:q||1});for(const G in S){const j=S[G];for(const te in j){const ue=j[+te];if(!ue||ue.bitmap.width===0||ue.bitmap.height===0)continue;const de=A[G][te].rect;c.AlphaImage.copy(ue.bitmap,J,{x:0,y:0},{x:de.x+1,y:de.y+1},ue.bitmap)}}this.image=J,this.positions=A}}c.register("GlyphAtlas",re);class De{constructor(S){this.tileID=new c.OverscaledTileID(S.tileID.overscaledZ,S.tileID.wrap,S.tileID.canonical.z,S.tileID.canonical.x,S.tileID.canonical.y),this.uid=S.uid,this.zoom=S.zoom,this.pixelRatio=S.pixelRatio,this.tileSize=S.tileSize,this.source=S.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=S.showCollisionBoxes,this.collectResourceTiming=!!S.collectResourceTiming,this.returnDependencies=!!S.returnDependencies,this.promoteId=S.promoteId,this.inFlightDependencies=[],this.dependencySentinel=-1}parse(S,A,z,V,q){this.status="parsing",this.data=S,this.collisionBoxArray=new c.CollisionBoxArray;const J=new c.DictionaryCoder(Object.keys(S.layers).sort()),G=new c.FeatureIndex(this.tileID,this.promoteId);G.bucketLayerIDs=[];const j={},te={featureIndex:G,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:z},ue=A.familiesBySource[this.source];for(const rt in ue){const at=S.layers[rt];if(!at)continue;at.version===1&&c.warnOnce(`Vector tile source "${this.source}" layer "${rt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const ki=J.encode(rt),Xe=[];for(let Gt=0;Gt=hi.maxzoom||hi.visibility!=="none"&&(me(Gt,this.zoom,z),(j[hi.id]=hi.createBucket({index:G.bucketLayerIDs.length,layers:Gt,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:ki,sourceID:this.source})).populate(Xe,te,this.tileID.canonical),G.bucketLayerIDs.push(Gt.map(Ot=>Ot.id)))}}let de,pe,Ze,He;const Le=c.mapObject(te.glyphDependencies,rt=>Object.keys(rt).map(Number));this.inFlightDependencies.forEach(rt=>rt==null?void 0:rt.cancel()),this.inFlightDependencies=[];const Ve=++this.dependencySentinel;Object.keys(Le).length?this.inFlightDependencies.push(V.send("getGlyphs",{uid:this.uid,stacks:Le,source:this.source,tileID:this.tileID,type:"glyphs"},(rt,at)=>{Ve===this.dependencySentinel&&(de||(de=rt,pe=at,_t.call(this)))})):pe={};const We=Object.keys(te.iconDependencies);We.length?this.inFlightDependencies.push(V.send("getImages",{icons:We,source:this.source,tileID:this.tileID,type:"icons"},(rt,at)=>{Ve===this.dependencySentinel&&(de||(de=rt,Ze=at,_t.call(this)))})):Ze={};const ot=Object.keys(te.patternDependencies);function _t(){if(de)return q(de);if(pe&&Ze&&He){const rt=new re(pe),at=new c.ImageAtlas(Ze,He);for(const ki in j){const Xe=j[ki];Xe instanceof c.SymbolBucket?(me(Xe.layers,this.zoom,z),c.performSymbolLayout({bucket:Xe,glyphMap:pe,glyphPositions:rt.positions,imageMap:Ze,imagePositions:at.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Xe.hasPattern&&(Xe instanceof c.LineBucket||Xe instanceof c.FillBucket||Xe instanceof c.FillExtrusionBucket)&&(me(Xe.layers,this.zoom,z),Xe.addFeatures(te,this.tileID.canonical,at.patternPositions))}this.status="done",q(null,{buckets:Object.values(j).filter(ki=>!ki.isEmpty()),featureIndex:G,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:rt.image,imageAtlas:at,glyphMap:this.returnDependencies?pe:null,iconMap:this.returnDependencies?Ze:null,glyphPositions:this.returnDependencies?rt.positions:null})}}ot.length?this.inFlightDependencies.push(V.send("getImages",{icons:ot,source:this.source,tileID:this.tileID,type:"patterns"},(rt,at)=>{Ve===this.dependencySentinel&&(de||(de=rt,He=at,_t.call(this)))})):He={},_t.call(this)}}function me(O,S,A){const z=new c.EvaluationParameters(S);for(const V of O)V.recalculate(z,A)}function dt(O,S){const A=c.getArrayBuffer(O.request,(z,V,q,J)=>{z?S(z):V&&S(null,{vectorTile:new c.vectorTile.VectorTile(new c.Protobuf(V)),rawData:V,cacheControl:q,expires:J})});return()=>{A.cancel(),S()}}class Ct{constructor(S,A,z,V){this.actor=S,this.layerIndex=A,this.availableImages=z,this.loadVectorData=V||dt,this.fetching={},this.loading={},this.loaded={}}loadTile(S,A){const z=S.uid;this.loading||(this.loading={});const V=!!(S&&S.request&&S.request.collectResourceTiming)&&new c.RequestPerformance(S.request),q=this.loading[z]=new De(S);q.abort=this.loadVectorData(S,(J,G)=>{if(delete this.loading[z],J||!G)return q.status="done",this.loaded[z]=q,A(J);const j=G.rawData,te={};G.expires&&(te.expires=G.expires),G.cacheControl&&(te.cacheControl=G.cacheControl);const ue={};if(V){const de=V.finish();de&&(ue.resourceTiming=JSON.parse(JSON.stringify(de)))}q.vectorTile=G.vectorTile,q.parse(G.vectorTile,this.layerIndex,this.availableImages,this.actor,(de,pe)=>{if(delete this.fetching[z],de||!pe)return A(de);A(null,c.extend({rawTileData:j.slice(0)},pe,te,ue))}),this.loaded=this.loaded||{},this.loaded[z]=q,this.fetching[z]={rawTileData:j,cacheControl:te,resourceTiming:ue}})}reloadTile(S,A){const z=this.loaded,V=S.uid;if(z&&z[V]){const q=z[V];q.showCollisionBoxes=S.showCollisionBoxes,q.status==="parsing"?q.parse(q.vectorTile,this.layerIndex,this.availableImages,this.actor,(J,G)=>{if(J||!G)return A(J,G);let j;if(this.fetching[V]){const{rawTileData:te,cacheControl:ue,resourceTiming:de}=this.fetching[V];delete this.fetching[V],j=c.extend({rawTileData:te.slice(0)},G,ue,de)}else j=G;A(null,j)}):q.status==="done"&&(q.vectorTile?q.parse(q.vectorTile,this.layerIndex,this.availableImages,this.actor,A):A())}}abortTile(S,A){const z=this.loading,V=S.uid;z&&z[V]&&z[V].abort&&(z[V].abort(),delete z[V]),A()}removeTile(S,A){const z=this.loaded,V=S.uid;z&&z[V]&&delete z[V],A()}}class Yt{constructor(){this.loaded={}}loadTile(S,A){const{uid:z,encoding:V,rawImageData:q}=S,J=c.isImageBitmap(q)?this.getImageData(q):q,G=new c.DEMData(z,J,V);this.loaded=this.loaded||{},this.loaded[z]=G,A(null,G)}getImageData(S){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(S.width,S.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=S.width,this.offscreenCanvas.height=S.height,this.offscreenCanvasContext.drawImage(S,0,0,S.width,S.height);const A=this.offscreenCanvasContext.getImageData(-1,-1,S.width+2,S.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new c.RGBAImage({width:A.width,height:A.height},A.data)}removeTile(S){const A=this.loaded,z=S.uid;A&&A[z]&&delete A[z]}}function ai(O,S){if(O.length!==0){jt(O[0],S);for(var A=1;A=Math.abs(G)?A-j+G:G-j+A,A=j}A+z>=0!=!!S&&O.reverse()}var vt=c.getDefaultExportFromCjs(function O(S,A){var z,V=S&&S.type;if(V==="FeatureCollection")for(z=0;z>31}function Lr(O,S){for(var A=O.loadGeometry(),z=O.type,V=0,q=0,J=A.length,G=0;GO},cr=Math.fround||(li=new Float32Array(1),O=>(li[0]=+O,li[0]));var li;const Si=3,mt=5,hr=6;class Br{constructor(S){this.options=Object.assign(Object.create(Ln),S),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(S){const{log:A,minZoom:z,maxZoom:V}=this.options;A&&console.time("total time");const q=`prepare ${S.length} points`;A&&console.time(q),this.points=S;const J=[];for(let j=0;j=z;j--){const te=+Date.now();G=this.trees[j]=this._createTree(this._cluster(G,j)),A&&console.log("z%d: %d clusters in %dms",j,G.numItems,+Date.now()-te)}return A&&console.timeEnd("total time"),this}getClusters(S,A){let z=((S[0]+180)%360+360)%360-180;const V=Math.max(-90,Math.min(90,S[1]));let q=S[2]===180?180:((S[2]+180)%360+360)%360-180;const J=Math.max(-90,Math.min(90,S[3]));if(S[2]-S[0]>=360)z=-180,q=180;else if(z>q){const de=this.getClusters([z,V,180,J],A),pe=this.getClusters([-180,V,q,J],A);return de.concat(pe)}const G=this.trees[this._limitZoom(A)],j=G.range(dr(z),Ii(J),dr(q),Ii(V)),te=G.data,ue=[];for(const de of j){const pe=this.stride*de;ue.push(te[pe+mt]>1?ur(te,pe,this.clusterProps):this.points[te[pe+Si]])}return ue}getChildren(S){const A=this._getOriginId(S),z=this._getOriginZoom(S),V="No cluster with the specified id.",q=this.trees[z];if(!q)throw new Error(V);const J=q.data;if(A*this.stride>=J.length)throw new Error(V);const G=this.options.radius/(this.options.extent*Math.pow(2,z-1)),j=q.within(J[A*this.stride],J[A*this.stride+1],G),te=[];for(const ue of j){const de=ue*this.stride;J[de+4]===S&&te.push(J[de+mt]>1?ur(J,de,this.clusterProps):this.points[J[de+Si]])}if(te.length===0)throw new Error(V);return te}getLeaves(S,A,z){const V=[];return this._appendLeaves(V,S,A=A||10,z=z||0,0),V}getTile(S,A,z){const V=this.trees[this._limitZoom(S)],q=Math.pow(2,S),{extent:J,radius:G}=this.options,j=G/J,te=(z-j)/q,ue=(z+1+j)/q,de={features:[]};return this._addTileFeatures(V.range((A-j)/q,te,(A+1+j)/q,ue),V.data,A,z,q,de),A===0&&this._addTileFeatures(V.range(1-j/q,te,1,ue),V.data,q,z,q,de),A===q-1&&this._addTileFeatures(V.range(0,te,j/q,ue),V.data,-1,z,q,de),de.features.length?de:null}getClusterExpansionZoom(S){let A=this._getOriginZoom(S)-1;for(;A<=this.options.maxZoom;){const z=this.getChildren(S);if(A++,z.length!==1)break;S=z[0].properties.cluster_id}return A}_appendLeaves(S,A,z,V,q){const J=this.getChildren(A);for(const G of J){const j=G.properties;if(j&&j.cluster?q+j.point_count<=V?q+=j.point_count:q=this._appendLeaves(S,j.cluster_id,z,V,q):q1;let ue,de,pe;if(te)ue=Rr(A,j,this.clusterProps),de=A[j],pe=A[j+1];else{const Le=this.points[A[j+Si]];ue=Le.properties;const[Ve,We]=Le.geometry.coordinates;de=dr(Ve),pe=Ii(We)}const Ze={type:1,geometry:[[Math.round(this.options.extent*(de*q-z)),Math.round(this.options.extent*(pe*q-V))]],tags:ue};let He;He=te||this.options.generateId?A[j+Si]:this.points[A[j+Si]].id,He!==void 0&&(Ze.id=He),J.features.push(Ze)}}_limitZoom(S){return Math.max(this.options.minZoom,Math.min(Math.floor(+S),this.options.maxZoom+1))}_cluster(S,A){const{radius:z,extent:V,reduce:q,minPoints:J}=this.options,G=z/(V*Math.pow(2,A)),j=S.data,te=[],ue=this.stride;for(let de=0;deA&&(Ve+=j[ot+mt])}if(Ve>Le&&Ve>=J){let We,ot=pe*Le,_t=Ze*Le,rt=-1;const at=((de/ue|0)<<5)+(A+1)+this.points.length;for(const ki of He){const Xe=ki*ue;if(j[Xe+2]<=A)continue;j[Xe+2]=A;const Gt=j[Xe+mt];ot+=j[Xe]*Gt,_t+=j[Xe+1]*Gt,j[Xe+4]=at,q&&(We||(We=this._map(j,de,!0),rt=this.clusterProps.length,this.clusterProps.push(We)),q(We,this._map(j,Xe)))}j[de+4]=at,te.push(ot/Ve,_t/Ve,1/0,at,-1,Ve),q&&te.push(rt)}else{for(let We=0;We1)for(const We of He){const ot=We*ue;if(!(j[ot+2]<=A)){j[ot+2]=A;for(let _t=0;_t>5}_getOriginZoom(S){return(S-this.points.length)%32}_map(S,A,z){if(S[A+mt]>1){const J=this.clusterProps[S[A+hr]];return z?Object.assign({},J):J}const V=this.points[S[A+Si]].properties,q=this.options.map(V);return z&&q===V?Object.assign({},q):q}}function ur(O,S,A){return{type:"Feature",id:O[S+Si],properties:Rr(O,S,A),geometry:{type:"Point",coordinates:[(z=O[S],360*(z-.5)),Ni(O[S+1])]}};var z}function Rr(O,S,A){const z=O[S+mt],V=z>=1e4?`${Math.round(z/1e3)}k`:z>=1e3?Math.round(z/100)/10+"k":z,q=O[S+hr],J=q===-1?{}:Object.assign({},A[q]);return Object.assign(J,{cluster:!0,cluster_id:O[S+Si],point_count:z,point_count_abbreviated:V})}function dr(O){return O/360+.5}function Ii(O){const S=Math.sin(O*Math.PI/180),A=.5-.25*Math.log((1+S)/(1-S))/Math.PI;return A<0?0:A>1?1:A}function Ni(O){const S=(180-360*O)*Math.PI/180;return 360*Math.atan(Math.exp(S))/Math.PI-90}function pr(O,S,A,z){for(var V,q=z,J=A-S>>1,G=A-S,j=O[S],te=O[S+1],ue=O[A],de=O[A+1],pe=S+3;peq)V=pe,q=Ze;else if(Ze===q){var He=Math.abs(pe-J);Hez&&(V-S>3&&pr(O,S,V,z),O[V+2]=q,A-V>3&&pr(O,V,A,z))}function le(O,S,A,z,V,q){var J=V-A,G=q-z;if(J!==0||G!==0){var j=((O-A)*J+(S-z)*G)/(J*J+G*G);j>1?(A=V,z=q):j>0&&(A+=J*j,z+=G*j)}return(J=O-A)*J+(G=S-z)*G}function Fr(O,S,A,z){var V={id:O===void 0?null:O,type:S,geometry:A,tags:z,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(q){var J=q.geometry,G=q.type;if(G==="Point"||G==="MultiPoint"||G==="LineString")Bn(q,J);else if(G==="Polygon"||G==="MultiLineString")for(var j=0;j0&&(J+=z?(V*te-j*q)/2:Math.sqrt(Math.pow(j-V,2)+Math.pow(te-q,2))),V=j,q=te}var ue=S.length-3;S[2]=1,pr(S,0,ue,A),S[ue+2]=1,S.size=Math.abs(J),S.start=0,S.end=S.size}function mn(O,S,A,z){for(var V=0;V1?1:A}function Dt(O,S,A,z,V,q,J,G){if(z/=S,q>=(A/=S)&&J=z)return null;for(var j=[],te=0;te=A&&He=z)){var Le=[];if(pe==="Point"||pe==="MultiPoint")is(de,Le,A,z,V);else if(pe==="LineString")Rn(de,Le,A,z,V,!1,G.lineMetrics);else if(pe==="MultiLineString")Ai(de,Le,A,z,V,!1);else if(pe==="Polygon")Ai(de,Le,A,z,V,!0);else if(pe==="MultiPolygon")for(var Ve=0;Ve=A&&J<=z&&(S.push(O[q]),S.push(O[q+1]),S.push(O[q+2]))}}function Rn(O,S,A,z,V,q,J){for(var G,j,te=we(O),ue=V===0?Or:tn,de=O.start,pe=0;peA&&(j=ue(te,Ze,He,Ve,We,A),J&&(te.start=de+G*j)):ot>z?_t=A&&(j=ue(te,Ze,He,Ve,We,A),rt=!0),_t>z&&ot<=z&&(j=ue(te,Ze,He,Ve,We,z),rt=!0),!q&&rt&&(J&&(te.end=de+G*j),S.push(te),te=we(O)),J&&(de+=G)}var at=O.length-3;Ze=O[at],He=O[at+1],Le=O[at+2],(ot=V===0?Ze:He)>=A&&ot<=z&&zi(te,Ze,He,Le),at=te.length-3,q&&at>=3&&(te[at]!==te[0]||te[at+1]!==te[1])&&zi(te,te[0],te[1],te[2]),te.length&&S.push(te)}function we(O){var S=[];return S.size=O.size,S.start=O.start,S.end=O.end,S}function Ai(O,S,A,z,V,q){for(var J=0;JJ.maxX&&(J.maxX=ue),de>J.maxY&&(J.maxY=de)}return J}function Ge(O,S,A,z){var V=S.geometry,q=S.type,J=[];if(q==="Point"||q==="MultiPoint")for(var G=0;G0&&S.size<(V?J:z))A.numPoints+=S.length/3;else{for(var G=[],j=0;jJ)&&(A.numSimplified++,G.push(S[j]),G.push(S[j+1])),A.numPoints++;V&&function(te,ue){for(var de=0,pe=0,Ze=te.length,He=Ze-2;pe0===ue)for(pe=0,Ze=te.length;pe24)throw new Error("maxZoom should be in the 0-24 range");if(S.promoteId&&S.generateId)throw new Error("promoteId and generateId cannot be used together.");var z=function(V,q){var J=[];if(V.type==="FeatureCollection")for(var G=0;G1&&console.time("creation"),pe=this.tiles[de]=Ur(O,S,A,z,j),this.tileCoords.push({z:S,x:A,y:z}),te)){te>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",S,A,z,pe.numFeatures,pe.numPoints,pe.numSimplified),console.timeEnd("creation"));var Ze="z"+S;this.stats[Ze]=(this.stats[Ze]||0)+1,this.total++}if(pe.source=O,V){if(S===j.maxZoom||S===V)continue;var He=1<1&&console.time("clipping");var Le,Ve,We,ot,_t,rt,at=.5*j.buffer/j.extent,ki=.5-at,Xe=.5+at,Gt=1+at;Le=Ve=We=ot=null,_t=Dt(O,ue,A-at,A+Xe,0,pe.minX,pe.maxX,j),rt=Dt(O,ue,A+ki,A+Gt,0,pe.minX,pe.maxX,j),O=null,_t&&(Le=Dt(_t,ue,z-at,z+Xe,1,pe.minY,pe.maxY,j),Ve=Dt(_t,ue,z+ki,z+Gt,1,pe.minY,pe.maxY,j),_t=null),rt&&(We=Dt(rt,ue,z-at,z+Xe,1,pe.minY,pe.maxY,j),ot=Dt(rt,ue,z+ki,z+Gt,1,pe.minY,pe.maxY,j),rt=null),te>1&&console.timeEnd("clipping"),G.push(Le||[],S+1,2*A,2*z),G.push(Ve||[],S+1,2*A,2*z+1),G.push(We||[],S+1,2*A+1,2*z),G.push(ot||[],S+1,2*A+1,2*z+1)}}},Er.prototype.getTile=function(O,S,A){var z=this.options,V=z.extent,q=z.debug;if(O<0||O>24)return null;var J=1<1&&console.log("drilling down to z%d-%d-%d",O,S,A);for(var j,te=O,ue=S,de=A;!j&&te>0;)te--,ue=Math.floor(ue/2),de=Math.floor(de/2),j=this.tiles[rn(te,ue,de)];return j&&j.source?(q>1&&console.log("found parent tile z%d-%d-%d",te,ue,de),q>1&&console.time("drilling down"),this.splitTile(j.source,te,ue,de,O,S,A),q>1&&console.timeEnd("drilling down"),this.tiles[G]?Ye(this.tiles[G],V):null):null};class rs extends Ct{constructor(S,A,z,V){super(S,A,z,bt),this._dataUpdateable=new Map,this.loadGeoJSON=(q,J)=>{const{promoteId:G}=q;if(q.request)return c.getJSON(q.request,(j,te,ue,de)=>{this._dataUpdateable=nn(te,G)?ci(te,G):void 0,J(j,te,ue,de)});if(typeof q.data=="string")try{const j=JSON.parse(q.data);this._dataUpdateable=nn(j,G)?ci(j,G):void 0,J(null,j)}catch{J(new Error(`Input data given to '${q.source}' is not a valid GeoJSON object.`))}else q.dataDiff?this._dataUpdateable?(function(j,te,ue){var de,pe,Ze,He;if(te.removeAll&&j.clear(),te.remove)for(const Le of te.remove)j.delete(Le);if(te.add)for(const Le of te.add){const Ve=tr(Le,ue);Ve!=null&&j.set(Ve,Le)}if(te.update)for(const Le of te.update){let Ve=j.get(Le.id);if(Ve==null)continue;const We=!Le.removeAllProperties&&(((de=Le.removeProperties)===null||de===void 0?void 0:de.length)>0||((pe=Le.addOrUpdateProperties)===null||pe===void 0?void 0:pe.length)>0);if((Le.newGeometry||Le.removeAllProperties||We)&&(Ve={...Ve},j.set(Le.id,Ve),We&&(Ve.properties={...Ve.properties})),Le.newGeometry&&(Ve.geometry=Le.newGeometry),Le.removeAllProperties)Ve.properties={};else if(((Ze=Le.removeProperties)===null||Ze===void 0?void 0:Ze.length)>0)for(const ot of Le.removeProperties)Object.prototype.hasOwnProperty.call(Ve.properties,ot)&&delete Ve.properties[ot];if(((He=Le.addOrUpdateProperties)===null||He===void 0?void 0:He.length)>0)for(const{key:ot,value:_t}of Le.addOrUpdateProperties)Ve.properties[ot]=_t}}(this._dataUpdateable,q.dataDiff,G),J(null,{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())})):J(new Error(`Cannot update existing geojson data in ${q.source}`)):J(new Error(`Input data given to '${q.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}},V&&(this.loadGeoJSON=V)}loadData(S,A){var z;(z=this._pendingRequest)===null||z===void 0||z.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const V=!!(S&&S.request&&S.request.collectResourceTiming)&&new c.RequestPerformance(S.request);this._pendingCallback=A,this._pendingRequest=this.loadGeoJSON(S,(q,J)=>{if(delete this._pendingCallback,delete this._pendingRequest,q||!J)return A(q);if(typeof J!="object")return A(new Error(`Input data given to '${S.source}' is not a valid GeoJSON object.`));{vt(J,!0);try{if(S.filter){const j=c.createExpression(S.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(j.result==="error")throw new Error(j.value.map(ue=>`${ue.key}: ${ue.message}`).join(", "));J={type:"FeatureCollection",features:J.features.filter(ue=>j.value.evaluate({zoom:0},ue))}}this._geoJSONIndex=S.cluster?new Br(function({superclusterOptions:j,clusterProperties:te}){if(!te||!j)return j;const ue={},de={},pe={accumulated:null,zoom:0},Ze={properties:null},He=Object.keys(te);for(const Le of He){const[Ve,We]=te[Le],ot=c.createExpression(We),_t=c.createExpression(typeof Ve=="string"?[Ve,["accumulated"],["get",Le]]:Ve);ue[Le]=ot.value,de[Le]=_t.value}return j.map=Le=>{Ze.properties=Le;const Ve={};for(const We of He)Ve[We]=ue[We].evaluate(pe,Ze);return Ve},j.reduce=(Le,Ve)=>{Ze.properties=Ve;for(const We of He)pe.accumulated=Le[We],Le[We]=de[We].evaluate(pe,Ze)},j}(S)).load(J.features):function(j,te){return new Er(j,te)}(J,S.geojsonVtOptions)}catch(j){return A(j)}this.loaded={};const G={};if(V){const j=V.finish();j&&(G.resourceTiming={},G.resourceTiming[S.source]=JSON.parse(JSON.stringify(j)))}A(null,G)}})}reloadTile(S,A){const z=this.loaded;return z&&z[S.uid]?super.reloadTile(S,A):this.loadTile(S,A)}removeSource(S,A){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),A()}getClusterExpansionZoom(S,A){try{A(null,this._geoJSONIndex.getClusterExpansionZoom(S.clusterId))}catch(z){A(z)}}getClusterChildren(S,A){try{A(null,this._geoJSONIndex.getChildren(S.clusterId))}catch(z){A(z)}}getClusterLeaves(S,A){try{A(null,this._geoJSONIndex.getLeaves(S.clusterId,S.limit,S.offset))}catch(z){A(z)}}}class Sr{constructor(S){this.self=S,this.actor=new c.Actor(S,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:Ct,geojson:rs},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(A,z)=>{if(this.workerSourceTypes[A])throw new Error(`Worker source with name "${A}" already registered.`);this.workerSourceTypes[A]=z},this.self.registerRTLTextPlugin=A=>{if(c.plugin.isParsed())throw new Error("RTL text plugin already registered.");c.plugin.applyArabicShaping=A.applyArabicShaping,c.plugin.processBidirectionalText=A.processBidirectionalText,c.plugin.processStyledBidirectionalText=A.processStyledBidirectionalText}}setReferrer(S,A){this.referrer=A}setImages(S,A,z){this.availableImages[S]=A;for(const V in this.workerSources[S]){const q=this.workerSources[S][V];for(const J in q)q[J].availableImages=A}z()}setLayers(S,A,z){this.getLayerIndex(S).replace(A),z()}updateLayers(S,A,z){this.getLayerIndex(S).update(A.layers,A.removedIds),z()}loadTile(S,A,z){this.getWorkerSource(S,A.type,A.source).loadTile(A,z)}loadDEMTile(S,A,z){this.getDEMWorkerSource(S,A.source).loadTile(A,z)}reloadTile(S,A,z){this.getWorkerSource(S,A.type,A.source).reloadTile(A,z)}abortTile(S,A,z){this.getWorkerSource(S,A.type,A.source).abortTile(A,z)}removeTile(S,A,z){this.getWorkerSource(S,A.type,A.source).removeTile(A,z)}removeDEMTile(S,A){this.getDEMWorkerSource(S,A.source).removeTile(A)}removeSource(S,A,z){if(!this.workerSources[S]||!this.workerSources[S][A.type]||!this.workerSources[S][A.type][A.source])return;const V=this.workerSources[S][A.type][A.source];delete this.workerSources[S][A.type][A.source],V.removeSource!==void 0?V.removeSource(A,z):z()}loadWorkerSource(S,A,z){try{this.self.importScripts(A.url),z()}catch(V){z(V.toString())}}syncRTLPluginState(S,A,z){try{c.plugin.setState(A);const V=c.plugin.getPluginURL();if(c.plugin.isLoaded()&&!c.plugin.isParsed()&&V!=null){this.self.importScripts(V);const q=c.plugin.isParsed();z(q?void 0:new Error(`RTL Text Plugin failed to import scripts from ${V}`),q)}}catch(V){z(V.toString())}}getAvailableImages(S){let A=this.availableImages[S];return A||(A=[]),A}getLayerIndex(S){let A=this.layerIndexes[S];return A||(A=this.layerIndexes[S]=new Oe),A}getWorkerSource(S,A,z){if(this.workerSources[S]||(this.workerSources[S]={}),this.workerSources[S][A]||(this.workerSources[S][A]={}),!this.workerSources[S][A][z]){const V={send:(q,J,G)=>{this.actor.send(q,J,G,S)}};this.workerSources[S][A][z]=new this.workerSourceTypes[A](V,this.getLayerIndex(S),this.getAvailableImages(S))}return this.workerSources[S][A][z]}getDEMWorkerSource(S,A){return this.demWorkerSources[S]||(this.demWorkerSources[S]={}),this.demWorkerSources[S][A]||(this.demWorkerSources[S][A]=new Yt),this.demWorkerSources[S][A]}}return c.isWorker()&&(self.worker=new Sr(self)),Sr}),ge(["./shared"],function(c){var Oe="3.3.1";class re{static testProp(t){if(!re.docStyle)return t[0];for(let n=0;n{window.removeEventListener("click",re.suppressClickInternal,!0)},0)}static mousePos(t,n){const a=t.getBoundingClientRect();return new c.Point(n.clientX-a.left-t.clientLeft,n.clientY-a.top-t.clientTop)}static touchPos(t,n){const a=t.getBoundingClientRect(),l=[];for(let d=0;d{t=[],n=0,a=0,l={}},h.addThrottleControl=v=>{const b=a++;return l[b]=v,b},h.removeThrottleControl=v=>{delete l[v],g()},h.getImage=(v,b,T=!0)=>{De.supported&&(v.headers||(v.headers={}),v.headers.accept="image/webp,*/*");const C={requestParameters:v,supportImageRefresh:T,callback:b,cancelled:!1,completed:!1,cancel:()=>{C.completed||C.cancelled||(C.cancelled=!0,C.innerRequest&&(C.innerRequest.cancel(),n--),g())}};return t.push(C),g(),C};const d=v=>{const{requestParameters:b,supportImageRefresh:T,callback:C}=v;return c.extend(b,{type:"image"}),(T!==!1||c.isWorker()||c.getProtocolAction(b.url)||b.headers&&!Object.keys(b.headers).reduce((L,D)=>L&&D==="accept",!0)?c.makeRequest:y)(b,(L,D,F,k)=>{m(v,C,L,D,F,k)})},m=(v,b,T,C,L,D)=>{T?b(T):C instanceof HTMLImageElement||c.isImageBitmap(C)?b(null,C):C&&((F,k)=>{typeof createImageBitmap=="function"?c.arrayBufferToImageBitmap(F,k):c.arrayBufferToImage(F,k)})(C,(F,k)=>{F!=null?b(F):k!=null&&b(null,k,{cacheControl:L,expires:D})}),v.cancelled||(v.completed=!0,n--,g())},g=()=>{const v=(()=>{const b=Object.keys(l);let T=!1;if(b.length>0){for(const C of b)if(T=l[C](),T)break}return T})()?c.config.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:c.config.MAX_PARALLEL_IMAGE_REQUESTS;for(let b=n;b0;b++){const T=t.shift();if(T.cancelled){b--;continue}const C=d(T);n++,T.innerRequest=C}},y=(v,b)=>{const T=new Image,C=v.url;let L=!1;const D=v.credentials;return D&&D==="include"?T.crossOrigin="use-credentials":(D&&D==="same-origin"||!c.sameOrigin(C))&&(T.crossOrigin="anonymous"),T.fetchPriority="high",T.onload=()=>{b(null,T),T.onerror=T.onload=null},T.onerror=()=>{L||b(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.")),T.onerror=T.onload=null},T.src=C,{cancel:()=>{L=!0,T.src=""}}}}(jt||(jt={})),jt.resetRequestQueue(),function(h){h.Glyphs="Glyphs",h.Image="Image",h.Source="Source",h.SpriteImage="SpriteImage",h.SpriteJSON="SpriteJSON",h.Style="Style",h.Tile="Tile",h.Unknown="Unknown"}(vt||(vt={}));class Mt{constructor(t){this._transformRequestFn=t}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}normalizeSpriteURL(t,n,a){const l=function(d){const m=d.match(Jt);if(!m)throw new Error(`Unable to parse URL "${d}"`);return{protocol:m[1],authority:m[2],path:m[3]||"/",params:m[4]?m[4].split("&"):[]}}(t);return l.path+=`${n}${a}`,function(d){const m=d.params.length?`?${d.params.join("&")}`:"";return`${d.protocol}://${d.authority}${d.path}${m}`}(l)}setTransformRequest(t){this._transformRequestFn=t}}const Jt=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Yr(h){var t=new c.ARRAY_TYPE(3);return t[0]=h[0],t[1]=h[1],t[2]=h[2],t}var er,Jr=function(h,t,n){return h[0]=t[0]-n[0],h[1]=t[1]-n[1],h[2]=t[2]-n[2],h};er=new c.ARRAY_TYPE(3),c.ARRAY_TYPE!=Float32Array&&(er[0]=0,er[1]=0,er[2]=0);var wi=function(h){var t=h[0],n=h[1];return t*t+n*n};function di(h){const t=[];if(typeof h=="string")t.push({id:"default",url:h});else if(h&&h.length>0){const n=[];for(const{id:a,url:l}of h){const d=`${a}${l}`;n.indexOf(d)===-1&&(n.push(d),t.push({id:a,url:l}))}}return t}function Qt(h,t,n,a,l){if(a)return void h(a);if(l!==Object.values(t).length||l!==Object.values(n).length)return;const d={};for(const m in t){d[m]={};const g=c.browser.getImageCanvasContext(n[m]),y=t[m];for(const v in y){const{width:b,height:T,x:C,y:L,sdf:D,pixelRatio:F,stretchX:k,stretchY:H,content:ne}=y[v];d[m][v]={data:null,pixelRatio:F,sdf:D,stretchX:k,stretchY:H,content:ne,spriteData:{width:b,height:T,x:C,y:L,context:g}}}}h(null,d)}(function(){var h=new c.ARRAY_TYPE(2);c.ARRAY_TYPE!=Float32Array&&(h[0]=0,h[1]=0)})();class Je{constructor(t,n,a,l){this.context=t,this.format=a,this.texture=t.gl.createTexture(),this.update(n,l)}update(t,n,a){const{width:l,height:d}=t,m=!(this.size&&this.size[0]===l&&this.size[1]===d||a),{context:g}=this,{gl:y}=g;if(this.useMipmap=!!(n&&n.useMipmap),y.bindTexture(y.TEXTURE_2D,this.texture),g.pixelStoreUnpackFlipY.set(!1),g.pixelStoreUnpack.set(1),g.pixelStoreUnpackPremultiplyAlpha.set(this.format===y.RGBA&&(!n||n.premultiply!==!1)),m)this.size=[l,d],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||c.isImageBitmap(t)?y.texImage2D(y.TEXTURE_2D,0,this.format,this.format,y.UNSIGNED_BYTE,t):y.texImage2D(y.TEXTURE_2D,0,this.format,l,d,0,this.format,y.UNSIGNED_BYTE,t.data);else{const{x:v,y:b}=a||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||c.isImageBitmap(t)?y.texSubImage2D(y.TEXTURE_2D,0,v,b,y.RGBA,y.UNSIGNED_BYTE,t):y.texSubImage2D(y.TEXTURE_2D,0,v,b,l,d,y.RGBA,y.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&y.generateMipmap(y.TEXTURE_2D)}bind(t,n,a){const{context:l}=this,{gl:d}=l;d.bindTexture(d.TEXTURE_2D,this.texture),a!==d.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(a=d.LINEAR),t!==this.filter&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,t),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,a||t),this.filter=t),n!==this.wrap&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,n),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,n),this.wrap=n)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function Qr(h){const{userImage:t}=h;return!!(t&&t.render&&t.render())&&(h.data.replace(new Uint8Array(t.data.buffer)),!0)}class Pi extends c.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new c.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:n,callback:a}of this.requestors)this._notify(n,a);this.requestors=[]}}getImage(t){const n=this.images[t];if(n&&!n.data&&n.spriteData){const a=n.spriteData;n.data=new c.RGBAImage({width:a.width,height:a.height},a.context.getImageData(a.x,a.y,a.width,a.height).data),n.spriteData=null}return n}addImage(t,n){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,n)&&(this.images[t]=n)}_validate(t,n){let a=!0;const l=n.data||n.spriteData;return this._validateStretch(n.stretchX,l&&l.width)||(this.fire(new c.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),a=!1),this._validateStretch(n.stretchY,l&&l.height)||(this.fire(new c.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),a=!1),this._validateContent(n.content,n)||(this.fire(new c.ErrorEvent(new Error(`Image "${t}" has invalid "content" value`))),a=!1),a}_validateStretch(t,n){if(!t)return!0;let a=0;for(const l of t){if(l[0]-1);y++,d[y]=g,m[y]=v,m[y+1]=lr}for(let g=0,y=0;g{let g=this.entries[l];g||(g=this.entries[l]={glyphs:{},requests:{},ranges:{}});let y=g.glyphs[d];if(y!==void 0)return void m(null,{stack:l,id:d,glyph:y});if(y=this._tinySDF(g,l,d),y)return g.glyphs[d]=y,void m(null,{stack:l,id:d,glyph:y});const v=Math.floor(d/256);if(256*v>65535)return void m(new Error("glyphs > 65535 not supported"));if(g.ranges[v])return void m(null,{stack:l,id:d,glyph:y});if(!this.url)return void m(new Error("glyphsUrl is not set"));let b=g.requests[v];b||(b=g.requests[v]=[],Ei.loadGlyphRange(l,v,this.url,this.requestManager,(T,C)=>{if(C){for(const L in C)this._doesCharSupportLocalGlyph(+L)||(g.glyphs[+L]=C[+L]);g.ranges[v]=!0}for(const L of b)L(T,C);delete g.requests[v]})),b.push((T,C)=>{T?m(T):C&&m(null,{stack:l,id:d,glyph:C[d]||null})})},(l,d)=>{if(l)n(l);else if(d){const m={};for(const{stack:g,id:y,glyph:v}of d)(m[g]||(m[g]={}))[y]=v&&{id:v.id,bitmap:v.bitmap.clone(),metrics:v.metrics};n(null,m)}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(c.unicodeBlockLookup["CJK Unified Ideographs"](t)||c.unicodeBlockLookup["Hangul Syllables"](t)||c.unicodeBlockLookup.Hiragana(t)||c.unicodeBlockLookup.Katakana(t))}_tinySDF(t,n,a){const l=this.localIdeographFontFamily;if(!l||!this._doesCharSupportLocalGlyph(a))return;let d=t.tinySDF;if(!d){let g="400";/bold/i.test(n)?g="900":/medium/i.test(n)?g="500":/light/i.test(n)&&(g="200"),d=t.tinySDF=new Ei.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:l,fontWeight:g})}const m=d.draw(String.fromCharCode(a));return{id:a,bitmap:new c.AlphaImage({width:m.width||30,height:m.height||30},m.data),metrics:{width:m.glyphWidth||24,height:m.glyphHeight||24,left:m.glyphLeft||0,top:m.glyphTop-27||-8,advance:m.glyphAdvance||24}}}}Ei.loadGlyphRange=function(h,t,n,a,l){const d=256*t,m=d+255,g=a.transformRequest(n.replace("{fontstack}",h).replace("{range}",`${d}-${m}`),vt.Glyphs);c.getArrayBuffer(g,(y,v)=>{if(y)l(y);else if(v){const b={};for(const T of c.parseGlyphPbf(v))b[T.id]=T;l(null,b)}})},Ei.TinySDF=class{constructor({fontSize:h=24,buffer:t=3,radius:n=8,cutoff:a=.25,fontFamily:l="sans-serif",fontWeight:d="normal",fontStyle:m="normal"}={}){this.buffer=t,this.cutoff=a,this.radius=n;const g=this.size=h+4*t,y=this._createCanvas(g),v=this.ctx=y.getContext("2d",{willReadFrequently:!0});v.font=`${m} ${d} ${h}px ${l}`,v.textBaseline="alphabetic",v.textAlign="left",v.fillStyle="black",this.gridOuter=new Float64Array(g*g),this.gridInner=new Float64Array(g*g),this.f=new Float64Array(g),this.z=new Float64Array(g+1),this.v=new Uint16Array(g)}_createCanvas(h){const t=document.createElement("canvas");return t.width=t.height=h,t}draw(h){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:a,actualBoundingBoxLeft:l,actualBoundingBoxRight:d}=this.ctx.measureText(h),m=Math.ceil(n),g=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(d-l))),y=Math.min(this.size-this.buffer,m+Math.ceil(a)),v=g+2*this.buffer,b=y+2*this.buffer,T=Math.max(v*b,0),C=new Uint8ClampedArray(T),L={data:C,width:v,height:b,glyphWidth:g,glyphHeight:y,glyphTop:m,glyphLeft:0,glyphAdvance:t};if(g===0||y===0)return L;const{ctx:D,buffer:F,gridInner:k,gridOuter:H}=this;D.clearRect(F,F,g,y),D.fillText(h,F,F+m);const ne=D.getImageData(F,F,g,y);H.fill(lr,0,T),k.fill(0,0,T);for(let N=0;N0?ce*ce:0,k[oe]=ce<0?ce*ce:0}}Dr(H,0,0,v,b,v,this.f,this.v,this.z),Dr(k,F,F,g,y,v,this.f,this.v,this.z);for(let N=0;N1&&(y=t[++g]);const b=Math.abs(v-y.left),T=Math.abs(v-y.right),C=Math.min(b,T);let L;const D=d/a*(l+1);if(y.isDash){const F=l-Math.abs(D);L=Math.sqrt(C*C+F*F)}else L=l-Math.sqrt(C*C+D*D);this.data[m+v]=Math.max(0,Math.min(255,L+128))}}}addRegularDash(t){for(let g=t.length-1;g>=0;--g){const y=t[g],v=t[g+1];y.zeroLength?t.splice(g,1):v&&v.isDash===y.isDash&&(v.left=y.left,t.splice(g,1))}const n=t[0],a=t[t.length-1];n.isDash===a.isDash&&(n.left=a.left-this.width,a.right=n.right+this.width);const l=this.width*this.nextRow;let d=0,m=t[d];for(let g=0;g1&&(m=t[++d]);const y=Math.abs(g-m.left),v=Math.abs(g-m.right),b=Math.min(y,v);this.data[l+g]=Math.max(0,Math.min(255,(m.isDash?b:-b)+128))}}addDash(t,n){const a=n?7:0,l=2*a+1;if(this.nextRow+l>this.height)return c.warnOnce("LineAtlas out of space"),null;let d=0;for(let g=0;g{l.send(t,n,d)},a=a||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach(n=>{n.remove()}),this.actors=[],t&&this.workerPool.release(this.id)}}function Si(h,t,n){const a=function(l,d){if(l)return n(l);if(d){const m=c.pick(c.extend(d,h),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);d.vector_layers&&(m.vectorLayers=d.vector_layers,m.vectorLayerIds=m.vectorLayers.map(g=>g.id)),n(null,m)}};return h.url?c.getJSON(t.transformRequest(h.url,vt.Source),a):c.browser.frame(()=>a(null,h))}li.Actor=c.Actor;class mt{constructor(t,n){t&&(n?this.setSouthWest(t).setNorthEast(n):Array.isArray(t)&&(t.length===4?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 c.LngLat?new c.LngLat(t.lng,t.lat):c.LngLat.convert(t),this}setSouthWest(t){return this._sw=t instanceof c.LngLat?new c.LngLat(t.lng,t.lat):c.LngLat.convert(t),this}extend(t){const n=this._sw,a=this._ne;let l,d;if(t instanceof c.LngLat)l=t,d=t;else{if(!(t instanceof mt))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(mt.convert(t)):this.extend(c.LngLat.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(c.LngLat.convert(t)):this;if(l=t._sw,d=t._ne,!l||!d)return this}return n||a?(n.lng=Math.min(l.lng,n.lng),n.lat=Math.min(l.lat,n.lat),a.lng=Math.max(d.lng,a.lng),a.lat=Math.max(d.lat,a.lat)):(this._sw=new c.LngLat(l.lng,l.lat),this._ne=new c.LngLat(d.lng,d.lat)),this}getCenter(){return new c.LngLat((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 c.LngLat(this.getWest(),this.getNorth())}getSouthEast(){return new c.LngLat(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){const{lng:n,lat:a}=c.LngLat.convert(t);let l=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(l=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=a&&a<=this._ne.lat&&l}static convert(t){return t instanceof mt?t:t&&new mt(t)}static fromLngLat(t,n=0){const a=360*n/40075017,l=a/Math.cos(Math.PI/180*t.lat);return new mt(new c.LngLat(t.lng-l,t.lat-a),new c.LngLat(t.lng+l,t.lat+a))}}class hr{constructor(t,n,a){this.bounds=mt.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=a||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[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){const n=Math.pow(2,t.z),a=Math.floor(c.mercatorXfromLng(this.bounds.getWest())*n),l=Math.floor(c.mercatorYfromLat(this.bounds.getNorth())*n),d=Math.ceil(c.mercatorXfromLng(this.bounds.getEast())*n),m=Math.ceil(c.mercatorYfromLat(this.bounds.getSouth())*n);return t.x>=a&&t.x=l&&t.y{this._loaded=!1,this.fire(new c.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=Si(this._options,this.map._requestManager,(d,m)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),d?this.fire(new c.ErrorEvent(d)):m&&(c.extend(this,m),m.bounds&&(this.tileBounds=new hr(m.bounds,this.minzoom,this.maxzoom)),this.fire(new c.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.Event("data",{dataType:"source",sourceDataType:"content"})))})},this.serialize=()=>c.extend({},this._options),this.id=t,this.dispatcher=a,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,c.extend(this,c.pick(n,["url","scheme","tileSize","promoteId"])),this._options=c.extend({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(l)}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.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),l={request:this.map._requestManager.transformRequest(a,vt.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};function d(m,g){return delete t.request,t.aborted?n(null):m&&m.status!==404?n(m):(g&&g.resourceTiming&&(t.resourceTiming=g.resourceTiming),this.map._refreshExpiredTiles&&g&&t.setExpiryData(g),t.loadVectorData(g,this.map.painter),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}l.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired"?t.state==="loading"?t.reloadCallback=n:t.request=t.actor.send("reloadTile",l,d.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",l,d.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class ur extends c.Evented{constructor(t,n,a,l){super(),this.id=t,this.dispatcher=a,this.setEventedParent(l),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=c.extend({type:"raster"},n),c.extend(this,c.pick(n,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new c.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=Si(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new c.ErrorEvent(t)):n&&(c.extend(this,n),n.bounds&&(this.tileBounds=new hr(n.bounds,this.minzoom,this.maxzoom)),this.fire(new c.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return c.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=jt.getImage(this.map._requestManager.transformRequest(a,vt.Tile),(l,d,m)=>{if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(l)t.state="errored",n(l);else if(d){this.map._refreshExpiredTiles&&m&&t.setExpiryData(m);const g=this.map.painter.context,y=g.gl;t.texture=this.map.painter.getTileTexture(d.width),t.texture?t.texture.update(d,{useMipmap:!0}):(t.texture=new Je(g,d,y.RGBA,{useMipmap:!0}),t.texture.bind(y.LINEAR,y.CLAMP_TO_EDGE,y.LINEAR_MIPMAP_NEAREST),g.extTextureFilterAnisotropic&&y.texParameterf(y.TEXTURE_2D,g.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,g.extTextureFilterAnisotropicMax)),t.state="loaded",n(null)}},this.map._refreshExpiredTiles)}abortTile(t,n){t.request&&(t.request.cancel(),delete t.request),n()}unloadTile(t,n){t.texture&&this.map.painter.saveTileTexture(t.texture),n()}hasTransition(){return!1}}class Rr extends ur{constructor(t,n,a,l){super(t,n,a,l),this.type="raster-dem",this.maxzoom=22,this._options=c.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function l(d,m){d&&(t.state="errored",n(d)),m&&(t.dem=m,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded",n(null))}t.request=jt.getImage(this.map._requestManager.transformRequest(a,vt.Tile),(function(d,m){if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(d)t.state="errored",n(d);else if(m){this.map._refreshExpiredTiles&&t.setExpiryData(m),delete m.cacheControl,delete m.expires;const g=c.isImageBitmap(m)&&(en==null&&(en=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),en)?m:c.browser.getImageData(m,1),y={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:g,encoding:this.encoding};t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",y,l.bind(this)))}}).bind(this),this.map._refreshExpiredTiles),t.neighboringTiles=this._getNeighboringTiles(t.tileID)}_getNeighboringTiles(t){const n=t.canonical,a=Math.pow(2,n.z),l=(n.x-1+a)%a,d=n.x===0?t.wrap-1:t.wrap,m=(n.x+1+a)%a,g=n.x+1===a?t.wrap+1:t.wrap,y={};return y[new c.OverscaledTileID(t.overscaledZ,d,n.z,l,n.y).key]={backfilled:!1},y[new c.OverscaledTileID(t.overscaledZ,g,n.z,m,n.y).key]={backfilled:!1},n.y>0&&(y[new c.OverscaledTileID(t.overscaledZ,d,n.z,l,n.y-1).key]={backfilled:!1},y[new c.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},y[new c.OverscaledTileID(t.overscaledZ,g,n.z,m,n.y-1).key]={backfilled:!1}),n.y+1{this._updateWorkerData()},this.serialize=()=>c.extend({},this._options,{type:this.type,data:this._data}),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._pendingLoads=0,this.actor=a.getActor(),this.setEventedParent(l),this._data=n.data,this._options=c.extend({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId;const d=c.EXTENT/this.tileSize;this.workerOptions=c.extend({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(n.buffer!==void 0?n.buffer:128)*d,tolerance:(n.tolerance!==void 0?n.tolerance:.375)*d,extent:c.EXTENT,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:n.clusterMaxZoom!==void 0?n.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:c.EXTENT,radius:(n.clusterRadius||50)*d,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData(),this}updateData(t){return this._updateWorkerData(t),this}setClusterOptions(t){return this.workerOptions.cluster=t.cluster,t&&(t.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=t.clusterRadius),t.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=t.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(t,n){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},n),this}getClusterChildren(t,n){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},n),this}getClusterLeaves(t,n,a,l){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:n,offset:a},l),this}_updateWorkerData(t){const n=c.extend({},this.workerOptions);t?n.dataDiff=t:typeof this._data=="string"?(n.request=this.map._requestManager.transformRequest(c.browser.resolveURL(this._data),vt.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new c.Event("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,n,(a,l)=>{if(this._pendingLoads--,this._removed||l&&l.abandoned)return void this.fire(new c.Event("dataabort",{dataType:"source"}));let d=null;if(l&&l.resourceTiming&&l.resourceTiming[this.id]&&(d=l.resourceTiming[this.id].slice(0)),a)return void this.fire(new c.ErrorEvent(a));const m={dataType:"source"};this._collectResourceTiming&&d&&d.length>0&&c.extend(m,{resourceTiming:d}),this.fire(new c.Event("data",{...m,sourceDataType:"metadata"})),this.fire(new c.Event("data",{...m,sourceDataType:"content"}))})}loaded(){return this._pendingLoads===0}loadTile(t,n){const a=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const l={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};t.request=this.actor.send(a,l,(d,m)=>(delete t.request,t.unloadVectorData(),t.aborted?n(null):d?n(d):(t.loadVectorData(m,this.map.painter,a==="reloadTile"),n(null))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}hasTransition(){return!1}}var Ii=c.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Ni extends c.Evented{constructor(t,n,a,l){super(),this.load=(d,m)=>{this._loaded=!1,this.fire(new c.Event("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=jt.getImage(this.map._requestManager.transformRequest(this.url,vt.Image),(g,y)=>{this._request=null,this._loaded=!0,g?this.fire(new c.ErrorEvent(g)):y&&(this.image=y,d&&(this.coordinates=d),m&&m(),this._finishLoading())})},this.prepare=()=>{if(Object.keys(this.tiles).length===0||!this.image)return;const d=this.map.painter.context,m=d.gl;this.boundsBuffer||(this.boundsBuffer=d.createVertexBuffer(this._boundsArray,Ii.members)),this.boundsSegments||(this.boundsSegments=c.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Je(d,this.image,m.RGBA),this.texture.bind(m.LINEAR,m.CLAMP_TO_EDGE));let g=!1;for(const y in this.tiles){const v=this.tiles[y];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,g=!0)}g&&this.fire(new c.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"image",url:this.options.url,coordinates:this.coordinates}),this.id=t,this.dispatcher=a,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(l),this.options=n}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.cancel(),this._request=null),this.options.url=t.url,this.load(t.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new c.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.cancel(),this._request=null)}setCoordinates(t){this.coordinates=t;const n=t.map(c.MercatorCoordinate.fromLngLat);this.tileID=function(l){let d=1/0,m=1/0,g=-1/0,y=-1/0;for(const C of l)d=Math.min(d,C.x),m=Math.min(m,C.y),g=Math.max(g,C.x),y=Math.max(y,C.y);const v=Math.max(g-d,y-m),b=Math.max(0,Math.floor(-Math.log(v)/Math.LN2)),T=Math.pow(2,b);return new c.CanonicalTileID(b,Math.floor((d+g)/2*T),Math.floor((m+y)/2*T))}(n),this.minzoom=this.maxzoom=this.tileID.z;const a=n.map(l=>this.tileID.getTilePoint(l)._round());return this._boundsArray=new c.RasterBoundsArray,this._boundsArray.emplaceBack(a[0].x,a[0].y,0,0),this._boundsArray.emplaceBack(a[1].x,a[1].y,c.EXTENT,0),this._boundsArray.emplaceBack(a[3].x,a[3].y,0,c.EXTENT),this._boundsArray.emplaceBack(a[2].x,a[2].y,c.EXTENT,c.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new c.Event("data",{dataType:"source",sourceDataType:"content"})),this}loadTile(t,n){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},n(null)):(t.state="errored",n(null))}hasTransition(){return!1}}class pr extends Ni{constructor(t,n,a,l){super(t,n,a,l),this.load=()=>{this._loaded=!1;const d=this.options;this.urls=[];for(const m of d.urls)this.urls.push(this.map._requestManager.transformRequest(m,vt.Source).url);c.getVideo(this.urls,(m,g)=>{this._loaded=!0,m?this.fire(new c.ErrorEvent(m)):g&&(this.video=g,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})},this.prepare=()=>{if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const d=this.map.painter.context,m=d.gl;this.boundsBuffer||(this.boundsBuffer=d.createVertexBuffer(this._boundsArray,Ii.members)),this.boundsSegments||(this.boundsSegments=c.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(m.LINEAR,m.CLAMP_TO_EDGE),m.texSubImage2D(m.TEXTURE_2D,0,0,0,m.RGBA,m.UNSIGNED_BYTE,this.video)):(this.texture=new Je(d,this.video,m.RGBA),this.texture.bind(m.LINEAR,m.CLAMP_TO_EDGE));let g=!1;for(const y in this.tiles){const v=this.tiles[y];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,g=!0)}g&&this.fire(new c.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"video",urls:this.urls,coordinates:this.coordinates}),this.roundZoom=!0,this.type="video",this.options=n}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const n=this.video.seekable;tn.end(0)?this.fire(new c.ErrorEvent(new c.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.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)))}hasTransition(){return this.video&&!this.video.paused}}class le extends Ni{constructor(t,n,a,l){super(t,n,a,l),this.load=()=>{this._loaded=!0,this.canvas||(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 c.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())},this.prepare=()=>{let d=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,d=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,d=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const m=this.map.painter.context,g=m.gl;this.boundsBuffer||(this.boundsBuffer=m.createVertexBuffer(this._boundsArray,Ii.members)),this.boundsSegments||(this.boundsSegments=c.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(d||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Je(m,this.canvas,g.RGBA,{premultiply:!0});let y=!1;for(const v in this.tiles){const b=this.tiles[v];b.state!=="loaded"&&(b.state="loaded",b.texture=this.texture,y=!0)}y&&this.fire(new c.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"canvas",coordinates:this.coordinates}),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(d=>!Array.isArray(d)||d.length!==2||d.some(m=>typeof m!="number"))||this.fire(new c.ErrorEvent(new c.ValidationError(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new c.ErrorEvent(new c.ValidationError(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new c.ErrorEvent(new c.ValidationError(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new c.ErrorEvent(new c.ValidationError(`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 c.ErrorEvent(new c.ValidationError(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const Fr={},Bn=h=>{switch(h){case"geojson":return dr;case"image":return Ni;case"raster":return ur;case"raster-dem":return Rr;case"vector":return Br;case"video":return pr;case"canvas":return le}return Fr[h]};function gt(h,t){const n=c.create();return c.translate(n,n,[1,1,0]),c.scale(n,n,[.5*h.width,.5*h.height,1]),c.multiply(n,n,h.calculatePosMatrix(t.toUnwrapped()))}function ht(h,t,n,a,l,d){const m=function(T,C,L){if(T)for(const D of T){const F=C[D];if(F&&F.source===L&&F.type==="fill-extrusion")return!0}else for(const D in C){const F=C[D];if(F.source===L&&F.type==="fill-extrusion")return!0}return!1}(l&&l.layers,t,h.id),g=d.maxPitchScaleFactor(),y=h.tilesIn(a,g,m);y.sort(fn);const v=[];for(const T of y)v.push({wrappedTileID:T.tileID.wrapped().key,queryResults:T.tile.queryRenderedFeatures(t,n,h._state,T.queryGeometry,T.cameraQueryGeometry,T.scale,l,d,g,gt(h.transform,T.tileID))});const b=function(T){const C={},L={};for(const D of T){const F=D.queryResults,k=D.wrappedTileID,H=L[k]=L[k]||{};for(const ne in F){const N=F[ne],K=H[ne]=H[ne]||{},ae=C[ne]=C[ne]||[];for(const oe of N)K[oe.featureIndex]||(K[oe.featureIndex]=!0,ae.push(oe))}}return C}(v);for(const T in b)b[T].forEach(C=>{const L=C.feature,D=h.getFeatureState(L.layer["source-layer"],L.id);L.source=L.layer.source,L.layer["source-layer"]&&(L.sourceLayer=L.layer["source-layer"]),L.state=D});return b}function fn(h,t){const n=h.tileID,a=t.tileID;return n.overscaledZ-a.overscaledZ||n.canonical.y-a.canonical.y||n.wrap-a.wrap||n.canonical.x-a.canonical.x}class mn{constructor(t,n){this.timeAdded=0,this.fadeEndTime=0,this.tileID=t,this.uid=c.uniqueId(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(t){const n=t+this.timeAdded;nd.getLayer(v)).filter(Boolean);if(y.length!==0){g.layers=y,g.stateDependentLayerIds&&(g.stateDependentLayers=g.stateDependentLayerIds.map(v=>y.filter(b=>b.id===v)[0]));for(const v of y)m[v.id]=g}}return m}(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const l in this.buckets){const d=this.buckets[l];if(d instanceof c.SymbolBucket){if(this.hasSymbolBuckets=!0,!a)break;d.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const l in this.buckets){const d=this.buckets[l];if(d instanceof c.SymbolBucket&&d.hasRTLText){this.hasRTLText=!0,c.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const l in this.buckets){const d=this.buckets[l];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(l).queryRadius(d))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new c.CollisionBoxArray}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const a in this.buckets){const l=this.buckets[a];l.uploadPending()&&l.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Je(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Je(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,a,l,d,m,g,y,v,b){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:l,cameraQueryGeometry:d,scale:m,tileSize:this.tileSize,pixelPosMatrix:b,transform:y,params:g,queryPadding:this.queryPadding*v},t,n,a):{}}querySourceFeatures(t,n){const a=this.latestFeatureIndex;if(!a||!a.rawTileData)return;const l=a.loadVTLayers(),d=n&&n.sourceLayer?n.sourceLayer:"",m=l._geojsonTileLayer||l[d];if(!m)return;const g=c.createFilter(n&&n.filter),{z:y,x:v,y:b}=this.tileID.canonical,T={z:y,x:v,y:b};for(let C=0;Ca)l=!1;else if(n)if(this.expirationTime{this.remove(t,d)},a)),this.data[l].push(d),this.order.push(l),this.order.length>this.max){const m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}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){const n=this.data[t].shift();return n.timeout&&clearTimeout(n.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),n.value}getByKey(t){const n=this.data[t];return n?n[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,n){if(!this.has(t))return this;const a=t.wrapped().key,l=n===void 0?0:this.data[a].indexOf(n),d=this.data[a][l];return this.data[a].splice(l,1),d.timeout&&clearTimeout(d.timeout),this.data[a].length===0&&delete this.data[a],this.onRemove(d.value),this.order.splice(this.order.indexOf(a),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(t){const n=[];for(const a in this.data)for(const l of this.data[a])t(l.value)||n.push(l);for(const a of n)this.remove(a.value.tileID,a)}}class Fs{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,a){const l=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][l]=this.stateChanges[t][l]||{},c.extend(this.stateChanges[t][l],a),this.deletedStates[t]===null){this.deletedStates[t]={};for(const d in this.state[t])d!==l&&(this.deletedStates[t][d]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][l]===null){this.deletedStates[t][l]={};for(const d in this.state[t][l])a[d]||(this.deletedStates[t][l][d]=null)}else for(const d in a)this.deletedStates[t]&&this.deletedStates[t][l]&&this.deletedStates[t][l][d]===null&&delete this.deletedStates[t][l][d]}removeFeatureState(t,n,a){if(this.deletedStates[t]===null)return;const l=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},a&&n!==void 0)this.deletedStates[t][l]!==null&&(this.deletedStates[t][l]=this.deletedStates[t][l]||{},this.deletedStates[t][l][a]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][l])for(a in this.deletedStates[t][l]={},this.stateChanges[t][l])this.deletedStates[t][l][a]=null;else this.deletedStates[t][l]=null;else this.deletedStates[t]=null}getState(t,n){const a=String(n),l=c.extend({},(this.state[t]||{})[a],(this.stateChanges[t]||{})[a]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const d=this.deletedStates[t][n];if(d===null)return{};for(const m in d)delete l[m]}return l}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){const a={};for(const l in this.stateChanges){this.state[l]=this.state[l]||{};const d={};for(const m in this.stateChanges[l])this.state[l][m]||(this.state[l][m]={}),c.extend(this.state[l][m],this.stateChanges[l][m]),d[m]=this.state[l][m];a[l]=d}for(const l in this.deletedStates){this.state[l]=this.state[l]||{};const d={};if(this.deletedStates[l]===null)for(const m in this.state[l])d[m]={},this.state[l][m]={};else for(const m in this.deletedStates[l]){if(this.deletedStates[l][m]===null)this.state[l][m]={};else for(const g of Object.keys(this.deletedStates[l][m]))delete this.state[l][m][g];d[m]=this.state[l][m]}a[l]=a[l]||{},c.extend(a[l],d)}if(this.stateChanges={},this.deletedStates={},Object.keys(a).length!==0)for(const l in t)t[l].setFeatureState(a,n)}}class Dt extends c.Evented{constructor(t,n,a){super(),this.id=t,this.dispatcher=a,this.on("data",l=>{l.dataType==="source"&&l.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&l.dataType==="source"&&l.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((l,d,m,g)=>{const y=new(Bn(d.type))(l,d,m,g);if(y.id!==l)throw new Error(`Expected Source id to be ${l} instead of ${y.id}`);return y})(t,n,a,this),this._tiles={},this._cache=new Rs(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Fs,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&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const t in this._tiles){const n=this._tiles[t];if(n.state!=="loaded"&&n.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,n){return this._source.loadTile(t,n)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,()=>{})}_abortTile(t){this._source.abortTile&&this._source.abortTile(t,()=>{}),this._source.fire(new c.Event("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const n in this._tiles){const a=this._tiles[n];a.upload(t),a.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(is).map(t=>t.key)}getRenderableIds(t){const n=[];for(const a in this._tiles)this._isIdRenderable(a,t)&&n.push(this._tiles[a]);return t?n.sort((a,l)=>{const d=a.tileID,m=l.tileID,g=new c.Point(d.canonical.x,d.canonical.y)._rotate(this.transform.angle),y=new c.Point(m.canonical.x,m.canonical.y)._rotate(this.transform.angle);return d.overscaledZ-m.overscaledZ||y.y-g.y||y.x-g.x}).map(a=>a.tileID.key):n.map(a=>a.tileID).sort(is).map(a=>a.key)}hasRenderableParent(t){const n=this.findLoadedParent(t,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(t,n){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(n||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(t,"reloading")}}_reloadTile(t,n){const a=this._tiles[t];a&&(a.state!=="loading"&&(a.state=n),this._loadTile(a,this._tileLoaded.bind(this,a,t,n)))}_tileLoaded(t,n,a,l){if(l)return t.state="errored",void(l.status!==404?this._source.fire(new c.ErrorEvent(l,{tile:t})):this.update(this.transform,this.terrain));t.timeAdded=c.browser.now(),a==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),this.getSource().type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new c.Event("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const n=this.getRenderableIds();for(let l=0;l1||(Math.abs(m)>1&&(Math.abs(m+y)===1?m+=y:Math.abs(m-y)===1&&(m-=y)),d.dem&&l.dem&&(l.dem.backfillBorder(d.dem,m,g),l.neighboringTiles&&l.neighboringTiles[v]&&(l.neighboringTiles[v].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,a,l){for(const d in this._tiles){let m=this._tiles[d];if(l[d]||!m.hasData()||m.tileID.overscaledZ<=n||m.tileID.overscaledZ>a)continue;let g=m.tileID;for(;m&&m.tileID.overscaledZ>n+1;){const v=m.tileID.scaledTo(m.tileID.overscaledZ-1);m=this._tiles[v.key],m&&m.hasData()&&(g=v)}let y=g;for(;y.overscaledZ>n;)if(y=y.scaledTo(y.overscaledZ-1),t[y.key]){l[g.key]=g;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const a=this._loadedParentTiles[t.key];return a&&a.tileID.overscaledZ>=n?a:null}for(let a=t.overscaledZ-1;a>=n;a--){const l=t.scaledTo(a),d=this._getLoadedTile(l);if(d)return d}}_getLoadedTile(t){const n=this._tiles[t.key];return n&&n.hasData()?n:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const n=Math.ceil(t.width/this._source.tileSize)+1,a=Math.ceil(t.height/this._source.tileSize)+1,l=Math.floor(n*a*(this._maxTileCacheZoomLevels===null?c.config.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),d=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,l):l;this._cache.setMaxSize(d)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const a={};for(const l in this._tiles){const d=this._tiles[l];d.tileID=d.tileID.unwrapTo(d.tileID.wrap+n),a[d.tileID.key]=d}this._tiles=a;for(const l in this._timers)clearTimeout(this._timers[l]),delete this._timers[l];for(const l in this._tiles)this._setTileReloadTimer(l,this._tiles[l])}}update(t,n){if(this.transform=t,this.terrain=n,!this._sourceLoaded||this._paused)return;let a;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?a=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(b=>new c.OverscaledTileID(b.canonical.z,b.wrap,b.canonical.z,b.canonical.x,b.canonical.y)):(a=t.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n}),this._source.hasTile&&(a=a.filter(b=>this._source.hasTile(b)))):a=[];const l=t.coveringZoomLevel(this._source),d=Math.max(l-Dt.maxOverzooming,this._source.minzoom),m=Math.max(l+Dt.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const b={};for(const T of a)if(T.canonical.z>this._source.minzoom){const C=T.scaledTo(T.canonical.z-1);b[C.key]=C;const L=T.scaledTo(Math.max(this._source.minzoom,Math.min(T.canonical.z,5)));b[L.key]=L}a=a.concat(Object.values(b))}const g=a.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,g&&this.fire(new c.Event("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const y=this._updateRetainedTiles(a,l);if(Rn(this._source.type)){const b={},T={},C=Object.keys(y),L=c.browser.now();for(const D of C){const F=y[D],k=this._tiles[D];if(!k||k.fadeEndTime!==0&&k.fadeEndTime<=L)continue;const H=this.findLoadedParent(F,d);H&&(this._addTile(H.tileID),b[H.tileID.key]=H.tileID),T[D]=F}this._retainLoadedChildren(T,l,m,y);for(const D in b)y[D]||(this._coveredTiles[D]=!0,y[D]=b[D]);if(n){const D={},F={};for(const k of a)this._tiles[k.key].hasData()?D[k.key]=k:F[k.key]=k;for(const k in F){const H=F[k].children(this._source.maxzoom);this._tiles[H[0].key]&&this._tiles[H[1].key]&&this._tiles[H[2].key]&&this._tiles[H[3].key]&&(D[H[0].key]=y[H[0].key]=H[0],D[H[1].key]=y[H[1].key]=H[1],D[H[2].key]=y[H[2].key]=H[2],D[H[3].key]=y[H[3].key]=H[3],delete F[k])}for(const k in F){const H=this.findLoadedParent(F[k],this._source.minzoom);if(H){D[H.tileID.key]=y[H.tileID.key]=H.tileID;for(const ne in D)D[ne].isChildOf(H.tileID)&&delete D[ne]}}for(const k in this._tiles)D[k]||(this._coveredTiles[k]=!0)}}for(const b in y)this._tiles[b].clearFadeHold();const v=c.keysDifference(this._tiles,y);for(const b of v){const T=this._tiles[b];T.hasSymbolBuckets&&!T.holdingForFade()?T.setHoldDuration(this.map._fadeDuration):T.hasSymbolBuckets&&!T.symbolFadeFinished()||this._removeTile(b)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){const a={},l={},d=Math.max(n-Dt.maxOverzooming,this._source.minzoom),m=Math.max(n+Dt.maxUnderzooming,this._source.minzoom),g={};for(const y of t){const v=this._addTile(y);a[y.key]=y,v.hasData()||nthis._source.maxzoom){const T=y.children(this._source.maxzoom)[0],C=this.getTile(T);if(C&&C.hasData()){a[T.key]=T;continue}}else{const T=y.children(this._source.maxzoom);if(a[T[0].key]&&a[T[1].key]&&a[T[2].key]&&a[T[3].key])continue}let b=v.wasRequested();for(let T=y.overscaledZ-1;T>=d;--T){const C=y.scaledTo(T);if(l[C.key])break;if(l[C.key]=!0,v=this.getTile(C),!v&&b&&(v=this._addTile(C)),v){const L=v.hasData();if((b||L)&&(a[C.key]=C),b=v.wasRequested(),L)break}}}return a}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const n=[];let a,l=this._tiles[t].tileID;for(;l.overscaledZ>0;){if(l.key in this._loadedParentTiles){a=this._loadedParentTiles[l.key];break}n.push(l.key);const d=l.scaledTo(l.overscaledZ-1);if(a=this._getLoadedTile(d),a)break;l=d}for(const d of n)this._loadedParentTiles[d]=a}}_addTile(t){let n=this._tiles[t.key];if(n)return n;n=this._cache.getAndRemove(t),n&&(this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,n)));const a=n;return n||(n=new mn(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,this._tileLoaded.bind(this,n,t.key,n.state))),n.uses++,this._tiles[t.key]=n,a||this._source.fire(new c.Event("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const a=n.getExpiryTimeout();a&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},a))}_removeTile(t){const n=this._tiles[t];n&&(n.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,n,a){const l=[],d=this.transform;if(!d)return l;const m=a?d.getCameraQueryGeometry(t):t,g=t.map(D=>d.pointCoordinate(D,this.terrain)),y=m.map(D=>d.pointCoordinate(D,this.terrain)),v=this.getIds();let b=1/0,T=1/0,C=-1/0,L=-1/0;for(const D of y)b=Math.min(b,D.x),T=Math.min(T,D.y),C=Math.max(C,D.x),L=Math.max(L,D.y);for(let D=0;D=0&&N[1].y+ne>=0){const K=g.map(oe=>k.getTilePoint(oe)),ae=y.map(oe=>k.getTilePoint(oe));l.push({tile:F,tileID:k,queryGeometry:K,cameraQueryGeometry:ae,scale:H})}}return l}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map(a=>this._tiles[a].tileID);for(const a of n)a.posMatrix=this.transform.calculatePosMatrix(a.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if(Rn(this._source.type)){const t=c.browser.now();for(const n in this._tiles)if(this._tiles[n].fadeEndTime>=t)return!0}return!1}setFeatureState(t,n,a){this._state.updateState(t=t||"_geojsonTileLayer",n,a)}removeFeatureState(t,n,a){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,a)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}setDependencies(t,n,a){const l=this._tiles[t];l&&l.setDependencies(n,a)}reloadTilesForDependencies(t,n){for(const a in this._tiles)this._tiles[a].hasDependency(t,n)&&this._reloadTile(a,"reloading");this._cache.filter(a=>!a.hasDependency(t,n))}}function is(h,t){const n=Math.abs(2*h.wrap)-+(h.wrap<0),a=Math.abs(2*t.wrap)-+(t.wrap<0);return h.overscaledZ-t.overscaledZ||a-n||t.canonical.y-h.canonical.y||t.canonical.x-h.canonical.x}function Rn(h){return h==="raster"||h==="image"||h==="video"}Dt.maxOverzooming=10,Dt.maxUnderzooming=3;const we="mapboxgl_preloaded_worker_pool";class Ai{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length{n.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[we]}numActive(){return Object.keys(this.active).length}}const zi=Math.floor(c.browser.hardwareConcurrency/2);let Or;function tn(){return Or||(Or=new Ai),Or}Ai.workerCount=c.isSafari(globalThis)?Math.max(Math.min(zi,3),1):1;class Te{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let a=1;a0?(l-m)/g:0;return this.points[d].mult(1-y).add(this.points[n].mult(y))}}function Ke(h,t){let n=!0;return h==="always"||h!=="never"&&t!=="never"||(n=!1),n}class Ye{constructor(t,n,a){const l=this.boxCells=[],d=this.circleCells=[];this.xCellCount=Math.ceil(t/a),this.yCellCount=Math.ceil(n/a);for(let m=0;mthis.width||l<0||n>this.height)return[];const y=[];if(t<=0&&n<=0&&this.width<=a&&this.height<=l){if(d)return[{key:null,x1:t,y1:n,x2:a,y2:l}];for(let v=0;v0}hitTestCircle(t,n,a,l,d){const m=t-a,g=t+a,y=n-a,v=n+a;if(g<0||m>this.width||v<0||y>this.height)return!1;const b=[];return this._forEachCell(m,y,g,v,this._queryCellCircle,b,{hitTest:!0,overlapMode:l,circle:{x:t,y:n,radius:a},seenUids:{box:{},circle:{}}},d),b.length>0}_queryCell(t,n,a,l,d,m,g,y){const{seenUids:v,hitTest:b,overlapMode:T}=g,C=this.boxCells[d];if(C!==null){const D=this.bboxes;for(const F of C)if(!v.box[F]){v.box[F]=!0;const k=4*F,H=this.boxKeys[F];if(t<=D[k+2]&&n<=D[k+3]&&a>=D[k+0]&&l>=D[k+1]&&(!y||y(H))&&(!b||!Ke(T,H.overlapMode))&&(m.push({key:H,x1:D[k],y1:D[k+1],x2:D[k+2],y2:D[k+3]}),b))return!0}}const L=this.circleCells[d];if(L!==null){const D=this.circles;for(const F of L)if(!v.circle[F]){v.circle[F]=!0;const k=3*F,H=this.circleKeys[F];if(this._circleAndRectCollide(D[k],D[k+1],D[k+2],t,n,a,l)&&(!y||y(H))&&(!b||!Ke(T,H.overlapMode))){const ne=D[k],N=D[k+1],K=D[k+2];if(m.push({key:H,x1:ne-K,y1:N-K,x2:ne+K,y2:N+K}),b)return!0}}}return!1}_queryCellCircle(t,n,a,l,d,m,g,y){const{circle:v,seenUids:b,overlapMode:T}=g,C=this.boxCells[d];if(C!==null){const D=this.bboxes;for(const F of C)if(!b.box[F]){b.box[F]=!0;const k=4*F,H=this.boxKeys[F];if(this._circleAndRectCollide(v.x,v.y,v.radius,D[k+0],D[k+1],D[k+2],D[k+3])&&(!y||y(H))&&!Ke(T,H.overlapMode))return m.push(!0),!0}}const L=this.circleCells[d];if(L!==null){const D=this.circles;for(const F of L)if(!b.circle[F]){b.circle[F]=!0;const k=3*F,H=this.circleKeys[F];if(this._circlesCollide(D[k],D[k+1],D[k+2],v.x,v.y,v.radius)&&(!y||y(H))&&!Ke(T,H.overlapMode))return m.push(!0),!0}}}_forEachCell(t,n,a,l,d,m,g,y){const v=this._convertToXCellCoord(t),b=this._convertToYCellCoord(n),T=this._convertToXCellCoord(a),C=this._convertToYCellCoord(l);for(let L=v;L<=T;L++)for(let D=b;D<=C;D++)if(d.call(this,t,n,a,l,this.xCellCount*D+L,m,g,y))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,n,a,l,d,m){const g=l-t,y=d-n,v=a+m;return v*v>g*g+y*y}_circleAndRectCollide(t,n,a,l,d,m,g){const y=(m-l)/2,v=Math.abs(t-(l+y));if(v>y+a)return!1;const b=(g-d)/2,T=Math.abs(n-(d+b));if(T>b+a)return!1;if(v<=y||T<=b)return!0;const C=v-y,L=T-b;return C*C+L*L<=a*a}}function pi(h,t,n,a,l){const d=c.create();return t?(c.scale(d,d,[1/l,1/l,1]),n||c.rotateZ(d,d,a.angle)):c.multiply(d,a.labelPlaneMatrix,h),d}function Ur(h,t,n,a,l){if(t){const d=c.clone(h);return c.scale(d,d,[l,l,1]),n||c.rotateZ(d,d,-a.angle),d}return a.glCoordMatrix}function Ge(h,t,n){let a;n?(a=[h.x,h.y,n(h.x,h.y),1],c.transformMat4(a,a,t)):(a=[h.x,h.y,0,1],V(a,a,t));const l=a[3];return{point:new c.Point(a[0]/l,a[1]/l),signedDistanceFromCamera:l}}function Tr(h,t){return .5+h/t*.5}function Er(h,t){const n=h[0]/h[3],a=h[1]/h[3];return n>=-t[0]&&n<=t[0]&&a>=-t[1]&&a<=t[1]}function rn(h,t,n,a,l,d,m,g,y,v){const b=a?h.textSizeData:h.iconSizeData,T=c.evaluateSizeForZoom(b,n.transform.zoom),C=[256/n.width*2+1,256/n.height*2+1],L=a?h.text.dynamicLayoutVertexArray:h.icon.dynamicLayoutVertexArray;L.clear();const D=h.lineVertexArray,F=a?h.text.placedSymbolArray:h.icon.placedSymbolArray,k=n.transform.width/n.transform.height;let H=!1;for(let ne=0;neMath.abs(n.x-t.x)*a?{useVertical:!0}:(h===c.WritingMode.vertical?t.yn.x)?{needsFlipping:!0}:null}function ci(h,t,n,a,l,d,m,g,y,v,b,T,C,L,D,F){const k=t/24,H=h.lineOffsetX*k,ne=h.lineOffsetY*k;let N;if(h.numGlyphs>1){const K=h.glyphStartIndex+h.numGlyphs,ae=h.lineStartIndex,oe=h.lineStartIndex+h.lineLength,ce=tr(k,g,H,ne,n,b,T,h,y,d,C,D,F);if(!ce)return{notEnoughRoom:!0};const _e=Ge(ce.first.point,m,F).point,fe=Ge(ce.last.point,m,F).point;if(a&&!n){const xe=nn(h.writingMode,_e,fe,L);if(xe)return xe}N=[ce.first];for(let xe=h.glyphStartIndex+1;xe0?_e.point:bt(T,ce,ae,1,l,F),xe=nn(h.writingMode,ae,fe,L);if(xe)return xe}const K=S(k*g.getoffsetX(h.glyphStartIndex),H,ne,n,b,T,h.segment,h.lineStartIndex,h.lineStartIndex+h.lineLength,y,d,C,D,F);if(!K)return{notEnoughRoom:!0};N=[K]}for(const K of N)c.addDynamicAttributes(v,K.point,K.angle);return{}}function bt(h,t,n,a,l,d){const m=Ge(h.add(h.sub(t)._unit()),l,d).point,g=n.sub(m);return n.add(g._mult(a/g.mag()))}function rs(h,t){const{projectionCache:n,lineVertexArray:a,labelPlaneMatrix:l,tileAnchorPoint:d,distanceFromAnchor:m,getElevation:g,previousVertex:y,direction:v,absOffsetX:b}=t;if(n.projections[h])return n.projections[h];const T=new c.Point(a.getx(h),a.gety(h)),C=Ge(T,l,g);if(C.signedDistanceFromCamera>0)return n.projections[h]=C.point,C.point;const L=h-v;return bt(m===0?d:new c.Point(a.getx(L),a.gety(L)),T,y,b-m+1,l,g)}function Sr(h,t,n){return h._unit()._perp()._mult(t*n)}function O(h,t,n,a,l,d,m,g){const{projectionCache:y,direction:v}=g;if(y.offsets[h])return y.offsets[h];const b=n.add(t);if(h+v=l)return y.offsets[h]=b,b;const T=rs(h+v,g),C=Sr(T.sub(n),m,v),L=n.add(C),D=T.add(C);return y.offsets[h]=c.findLineIntersection(d,b,L,D)||b,y.offsets[h]}function S(h,t,n,a,l,d,m,g,y,v,b,T,C,L){const D=a?h-t:h+t;let F=D>0?1:-1,k=0;a&&(F*=-1,k=Math.PI),F<0&&(k+=Math.PI);let H,ne,N=F>0?g+m:g+m+1,K=l,ae=l,oe=0,ce=0;const _e=Math.abs(D),fe=[];let xe;for(;oe+ce<=_e;){if(N+=F,N=y)return null;oe+=ce,ae=K,ne=H;const Ee={projectionCache:T,lineVertexArray:v,labelPlaneMatrix:b,tileAnchorPoint:d,distanceFromAnchor:oe,getElevation:L,previousVertex:ae,direction:F,absOffsetX:_e};if(K=rs(N,Ee),n===0)fe.push(ae),xe=K.sub(ae);else{let Ne;const ke=K.sub(ae);Ne=ke.mag()===0?Sr(rs(N+F,Ee).sub(K),n,F):Sr(ke,n,F),ne||(ne=ae.add(Ne)),H=O(N,Ne,K,g,y,ne,n,Ee),fe.push(ne),xe=H.sub(ne)}ce=xe.mag()}const Be=xe._mult((_e-oe)/ce)._add(ne||ae),et=k+Math.atan2(K.y-ae.y,K.x-ae.x);return fe.push(Be),{point:Be,angle:C?et:0,path:fe}}const A=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function z(h,t){for(let n=0;n=1;$e--)ke.push(Ee.path[$e]);for(let $e=1;$eGe(it,y,D));ke=$e.some(it=>it.signedDistanceFromCamera<=0)?[]:$e.map(it=>it.point)}let tt=[];if(ke.length>0){const $e=ke[0].clone(),it=ke[0].clone();for(let zt=1;zt=xe.x&&it.x<=Be.x&&$e.y>=xe.y&&it.y<=Be.y?[ke]:it.xBe.x||it.yBe.y?[]:c.clipLine([ke],xe.x,xe.y,Be.x,Be.y)}for(const $e of tt){et.reset($e,.25*fe);let it=0;it=et.length<=.5*fe?1:Math.ceil(et.paddedLength/It)+1;for(let zt=0;zt=this.screenRightBoundary||lthis.screenBottomBoundary}isInsideGrid(t,n,a,l){return a>=0&&t=0&&na.collisionGroupID===n}}return this.collisionGroups[t]}}function He(h,t,n,a,l){const{horizontalAlign:d,verticalAlign:m}=c.getAnchorAlignment(h);return new c.Point(-(d-.5)*t+a[0]*l,-(m-.5)*n+a[1]*l)}function Le(h,t,n,a,l,d){const{x1:m,x2:g,y1:y,y2:v,anchorPointX:b,anchorPointY:T}=h,C=new c.Point(t,n);return a&&C._rotate(l?d:-d),{x1:m+C.x,y1:y+C.y,x2:g+C.x,y2:v+C.y,anchorPointX:b,anchorPointY:T}}class Ve{constructor(t,n,a,l,d){this.transform=t.clone(),this.terrain=n,this.collisionIndex=new J(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=a,this.retainedQueryData={},this.collisionGroups=new Ze(l),this.collisionCircleArrays={},this.prevPlacement=d,d&&(d.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,a,l){const d=a.getBucket(n),m=a.latestFeatureIndex;if(!d||!m||n.id!==d.layerIds[0])return;const g=a.collisionBoxArray,y=d.layers[0].layout,v=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ),b=a.tileSize/c.EXTENT,T=this.transform.calculatePosMatrix(a.tileID.toUnwrapped()),C=y.get("text-pitch-alignment")==="map",L=y.get("text-rotation-alignment")==="map",D=G(a,1,this.transform.zoom),F=pi(T,C,L,this.transform,D);let k=null;if(C){const ne=Ur(T,C,L,this.transform,D);k=c.multiply([],this.transform.labelPlaneMatrix,ne)}this.retainedQueryData[d.bucketInstanceId]=new pe(d.bucketInstanceId,m,d.sourceLayerIndex,d.index,a.tileID);const H={bucket:d,layout:y,posMatrix:T,textLabelPlaneMatrix:F,labelToScreenMatrix:k,scale:v,textPixelRatio:b,holdingForFade:a.holdingForFade(),collisionBoxArray:g,partiallyEvaluatedTextSize:c.evaluateSizeForZoom(d.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(d.sourceID)};if(l)for(const ne of d.sortKeyRanges){const{sortKey:N,symbolInstanceStart:K,symbolInstanceEnd:ae}=ne;t.push({sortKey:N,symbolInstanceStart:K,symbolInstanceEnd:ae,parameters:H})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:d.symbolInstances.length,parameters:H})}attemptAnchorPlacement(t,n,a,l,d,m,g,y,v,b,T,C,L,D,F,k){const H=c.TextAnchorEnum[t.textAnchor],ne=[t.textOffset0,t.textOffset1],N=He(H,a,l,ne,d),K=this.collisionIndex.placeCollisionBox(Le(n,N.x,N.y,m,g,this.transform.angle),T,y,v,b.predicate,k);if((!F||this.collisionIndex.placeCollisionBox(Le(F,N.x,N.y,m,g,this.transform.angle),T,y,v,b.predicate,k).box.length!==0)&&K.box.length>0){let ae;if(this.prevPlacement&&this.prevPlacement.variableOffsets[C.crossTileID]&&this.prevPlacement.placements[C.crossTileID]&&this.prevPlacement.placements[C.crossTileID].text&&(ae=this.prevPlacement.variableOffsets[C.crossTileID].anchor),C.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[C.crossTileID]={textOffset:ne,width:a,height:l,anchor:H,textBoxScale:d,prevAnchor:ae},this.markUsedJustification(L,H,C,D),L.allowVerticalPlacement&&(this.markUsedOrientation(L,D,C),this.placedOrientations[C.crossTileID]=D),{shift:N,placedGlyphBoxes:K}}}placeLayerBucketPart(t,n,a){const{bucket:l,layout:d,posMatrix:m,textLabelPlaneMatrix:g,labelToScreenMatrix:y,textPixelRatio:v,holdingForFade:b,collisionBoxArray:T,partiallyEvaluatedTextSize:C,collisionGroup:L}=t.parameters,D=d.get("text-optional"),F=d.get("icon-optional"),k=c.getOverlapMode(d,"text-overlap","text-allow-overlap"),H=k==="always",ne=c.getOverlapMode(d,"icon-overlap","icon-allow-overlap"),N=ne==="always",K=d.get("text-rotation-alignment")==="map",ae=d.get("text-pitch-alignment")==="map",oe=d.get("icon-text-fit")!=="none",ce=d.get("symbol-z-order")==="viewport-y",_e=H&&(N||!l.hasIconData()||F),fe=N&&(H||!l.hasTextData()||D);!l.collisionArrays&&T&&l.deserializeCollisionBoxes(T);const xe=this.retainedQueryData[l.bucketInstanceId].tileID,Be=this.terrain?(Ee,Ne)=>this.terrain.getElevation(xe,Ee,Ne):null,et=(Ee,Ne)=>{var ke,It;if(n[Ee.crossTileID])return;if(b)return void(this.placements[Ee.crossTileID]=new ue(!1,!1,!1));let tt=!1,$e=!1,it=!0,zt=null,ft={box:null,offscreen:null},Xi={box:null,offscreen:null},ui=null,Rt=null,Bi=null,Mr=0,mr=0,Pr=0;Ne.textFeatureIndex?Mr=Ne.textFeatureIndex:Ee.useRuntimeCollisionCircles&&(Mr=Ee.featureIndex),Ne.verticalTextFeatureIndex&&(mr=Ne.verticalTextFeatureIndex);const Xn=Ne.textBox;if(Xn){const qt=ii=>{let Wt=c.WritingMode.horizontal;if(l.allowVerticalPlacement&&!ii&&this.prevPlacement){const _i=this.prevPlacement.placedOrientations[Ee.crossTileID];_i&&(this.placedOrientations[Ee.crossTileID]=_i,Wt=_i,this.markUsedOrientation(l,Wt,Ee))}return Wt},ti=(ii,Wt)=>{if(l.allowVerticalPlacement&&Ee.numVerticalGlyphVertices>0&&Ne.verticalTextBox){for(const _i of l.writingModes)if(_i===c.WritingMode.vertical?(ft=Wt(),Xi=ft):ft=ii(),ft&&ft.box&&ft.box.length)break}else ft=ii()},gi=Ee.textAnchorOffsetStartIndex,Wn=Ee.textAnchorOffsetEndIndex;if(Wn===gi){const ii=(Wt,_i)=>{const kt=this.collisionIndex.placeCollisionBox(Wt,k,v,m,L.predicate,Be);return kt&&kt.box&&kt.box.length&&(this.markUsedOrientation(l,_i,Ee),this.placedOrientations[Ee.crossTileID]=_i),kt};ti(()=>ii(Xn,c.WritingMode.horizontal),()=>{const Wt=Ne.verticalTextBox;return l.allowVerticalPlacement&&Ee.numVerticalGlyphVertices>0&&Wt?ii(Wt,c.WritingMode.vertical):{box:null,offscreen:null}}),qt(ft&&ft.box&&ft.box.length)}else{let ii=c.TextAnchorEnum[(It=(ke=this.prevPlacement)===null||ke===void 0?void 0:ke.variableOffsets[Ee.crossTileID])===null||It===void 0?void 0:It.anchor];const Wt=(kt,qr,gr)=>{const hn=kt.x2-kt.x1,al=kt.y2-kt.y1,An=Ee.textBoxScale,Jl=oe&&ne==="never"?qr:null;let Cn={box:[],offscreen:!1},Bt=k==="never"?1:2,ya="never";ii&&Bt++;for(let lo=0;loWt(Xn,Ne.iconBox,c.WritingMode.horizontal),()=>{const kt=Ne.verticalTextBox;return l.allowVerticalPlacement&&!(ft&&ft.box&&ft.box.length)&&Ee.numVerticalGlyphVertices>0&&kt?Wt(kt,Ne.verticalIconBox,c.WritingMode.vertical):{box:null,offscreen:null}}),ft&&(tt=ft.box,it=ft.offscreen);const _i=qt(ft&&ft.box);if(!tt&&this.prevPlacement){const kt=this.prevPlacement.variableOffsets[Ee.crossTileID];kt&&(this.variableOffsets[Ee.crossTileID]=kt,this.markUsedJustification(l,kt.anchor,Ee,_i))}}}if(ui=ft,tt=ui&&ui.box&&ui.box.length>0,it=ui&&ui.offscreen,Ee.useRuntimeCollisionCircles){const qt=l.text.placedSymbolArray.get(Ee.centerJustifiedTextSymbolIndex),ti=c.evaluateSizeForFeature(l.textSizeData,C,qt),gi=d.get("text-padding");Rt=this.collisionIndex.placeCollisionCircles(k,qt,l.lineVertexArray,l.glyphOffsetArray,ti,m,g,y,a,ae,L.predicate,Ee.collisionCircleDiameter,gi,Be),Rt.circles.length&&Rt.collisionDetected&&!a&&c.warnOnce("Collisions detected, but collision boxes are not shown"),tt=H||Rt.circles.length>0&&!Rt.collisionDetected,it=it&&Rt.offscreen}if(Ne.iconFeatureIndex&&(Pr=Ne.iconFeatureIndex),Ne.iconBox){const qt=ti=>{const gi=oe&&zt?Le(ti,zt.x,zt.y,K,ae,this.transform.angle):ti;return this.collisionIndex.placeCollisionBox(gi,ne,v,m,L.predicate,Be)};Xi&&Xi.box&&Xi.box.length&&Ne.verticalIconBox?(Bi=qt(Ne.verticalIconBox),$e=Bi.box.length>0):(Bi=qt(Ne.iconBox),$e=Bi.box.length>0),it=it&&Bi.offscreen}const cn=D||Ee.numHorizontalGlyphVertices===0&&Ee.numVerticalGlyphVertices===0,$r=F||Ee.numIconVertices===0;if(cn||$r?$r?cn||($e=$e&&tt):tt=$e&&tt:$e=tt=$e&&tt,tt&&ui&&ui.box&&this.collisionIndex.insertCollisionBox(ui.box,k,d.get("text-ignore-placement"),l.bucketInstanceId,Xi&&Xi.box&&mr?mr:Mr,L.ID),$e&&Bi&&this.collisionIndex.insertCollisionBox(Bi.box,ne,d.get("icon-ignore-placement"),l.bucketInstanceId,Pr,L.ID),Rt&&(tt&&this.collisionIndex.insertCollisionCircles(Rt.circles,k,d.get("text-ignore-placement"),l.bucketInstanceId,Mr,L.ID),a)){const qt=l.bucketInstanceId;let ti=this.collisionCircleArrays[qt];ti===void 0&&(ti=this.collisionCircleArrays[qt]=new de);for(let gi=0;gi=0;--Ne){const ke=Ee[Ne];et(l.symbolInstances.get(ke),l.collisionArrays[ke])}}else for(let Ee=t.symbolInstanceStart;Ee=0&&(t.text.placedSymbolArray.get(g).crossTileID=d>=0&&g!==d?0:a.crossTileID)}markUsedOrientation(t,n,a){const l=n===c.WritingMode.horizontal||n===c.WritingMode.horizontalOnly?n:0,d=n===c.WritingMode.vertical?n:0,m=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex];for(const g of m)t.text.placedSymbolArray.get(g).placedOrientation=l;a.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).placedOrientation=d)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let a=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const l=n?n.symbolFadeChange(t):1,d=n?n.opacities:{},m=n?n.variableOffsets:{},g=n?n.placedOrientations:{};for(const y in this.placements){const v=this.placements[y],b=d[y];b?(this.opacities[y]=new te(b,l,v.text,v.icon),a=a||v.text!==b.text.placed||v.icon!==b.icon.placed):(this.opacities[y]=new te(null,l,v.text,v.icon,v.skipFade),a=a||v.text||v.icon)}for(const y in d){const v=d[y];if(!this.opacities[y]){const b=new te(v,l,!1,!1);b.isHidden()||(this.opacities[y]=b,a=a||v.text.placed||v.icon.placed)}}for(const y in m)this.variableOffsets[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.variableOffsets[y]=m[y]);for(const y in g)this.placedOrientations[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.placedOrientations[y]=g[y]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");a?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const a={};for(const l of n){const d=l.getBucket(t);d&&l.latestFeatureIndex&&t.id===d.layerIds[0]&&this.updateBucketOpacities(d,a,l.collisionBoxArray)}}updateBucketOpacities(t,n,a){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();const l=t.layers[0],d=l.layout,m=new te(null,0,!1,!1,!0),g=d.get("text-allow-overlap"),y=d.get("icon-allow-overlap"),v=l._unevaluatedLayout.hasValue("text-variable-anchor")||l._unevaluatedLayout.hasValue("text-variable-anchor-offset"),b=d.get("text-rotation-alignment")==="map",T=d.get("text-pitch-alignment")==="map",C=d.get("icon-text-fit")!=="none",L=new te(null,0,g&&(y||!t.hasIconData()||d.get("icon-optional")),y&&(g||!t.hasTextData()||d.get("text-optional")),!0);!t.collisionArrays&&a&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(a);const D=(F,k,H)=>{for(let ne=0;ne0,oe=this.placedOrientations[k.crossTileID],ce=oe===c.WritingMode.vertical,_e=oe===c.WritingMode.horizontal||oe===c.WritingMode.horizontalOnly;if(H>0||ne>0){const fe=hi(K.text);D(t.text,H,ce?Ot:fe),D(t.text,ne,_e?Ot:fe);const xe=K.text.isHidden();[k.rightJustifiedTextSymbolIndex,k.centerJustifiedTextSymbolIndex,k.leftJustifiedTextSymbolIndex].forEach(Ee=>{Ee>=0&&(t.text.placedSymbolArray.get(Ee).hidden=xe||ce?1:0)}),k.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(k.verticalPlacedTextSymbolIndex).hidden=xe||_e?1:0);const Be=this.variableOffsets[k.crossTileID];Be&&this.markUsedJustification(t,Be.anchor,k,oe);const et=this.placedOrientations[k.crossTileID];et&&(this.markUsedJustification(t,"left",k,et),this.markUsedOrientation(t,et,k))}if(ae){const fe=hi(K.icon),xe=!(C&&k.verticalPlacedIconSymbolIndex&&ce);k.placedIconSymbolIndex>=0&&(D(t.icon,k.numIconVertices,xe?fe:Ot),t.icon.placedSymbolArray.get(k.placedIconSymbolIndex).hidden=K.icon.isHidden()),k.verticalPlacedIconSymbolIndex>=0&&(D(t.icon,k.numVerticalIconVertices,xe?Ot:fe),t.icon.placedSymbolArray.get(k.verticalPlacedIconSymbolIndex).hidden=K.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const fe=t.collisionArrays[F];if(fe){let xe=new c.Point(0,0);if(fe.textBox||fe.verticalTextBox){let et=!0;if(v){const Ee=this.variableOffsets[N];Ee?(xe=He(Ee.anchor,Ee.width,Ee.height,Ee.textOffset,Ee.textBoxScale),b&&xe._rotate(T?this.transform.angle:-this.transform.angle)):et=!1}fe.textBox&&We(t.textCollisionBox.collisionVertexArray,K.text.placed,!et||ce,xe.x,xe.y),fe.verticalTextBox&&We(t.textCollisionBox.collisionVertexArray,K.text.placed,!et||_e,xe.x,xe.y)}const Be=!!(!_e&&fe.verticalIconBox);fe.iconBox&&We(t.iconCollisionBox.collisionVertexArray,K.icon.placed,Be,C?xe.x:0,C?xe.y:0),fe.verticalIconBox&&We(t.iconCollisionBox.collisionVertexArray,K.icon.placed,!Be,C?xe.x:0,C?xe.y:0)}}}if(t.sortFeatures(this.transform.angle),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 new 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 new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);if(t.bucketInstanceId in this.collisionCircleArrays){const F=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=F.invProjMatrix,t.placementViewportMatrix=F.viewportMatrix,t.collisionCircleArray=F.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?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.lastPlacementChangeTimet}setStale(){this.stale=!0}}function We(h,t,n,a,l){h.emplaceBack(t?1:0,n?1:0,a||0,l||0),h.emplaceBack(t?1:0,n?1:0,a||0,l||0),h.emplaceBack(t?1:0,n?1:0,a||0,l||0),h.emplaceBack(t?1:0,n?1:0,a||0,l||0)}const ot=Math.pow(2,25),_t=Math.pow(2,24),rt=Math.pow(2,17),at=Math.pow(2,16),ki=Math.pow(2,9),Xe=Math.pow(2,8),Gt=Math.pow(2,1);function hi(h){if(h.opacity===0&&!h.placed)return 0;if(h.opacity===1&&h.placed)return 4294967295;const t=h.placed?1:0,n=Math.floor(127*h.opacity);return n*ot+t*_t+n*rt+t*at+n*ki+t*Xe+n*Gt+t}const Ot=0;class $i{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,n,a,l,d){const m=this._bucketParts;for(;this._currentTileIndexg.sortKey-y.sortKey));this._currentPartIndex!this._forceFullPlacement&&c.browser.now()-l>2;for(;this._currentPlacementIndex>=0;){const m=n[t[this._currentPlacementIndex]],g=this.placement.collisionIndex.transform.zoom;if(m.type==="symbol"&&(!m.minzoom||m.minzoom<=g)&&(!m.maxzoom||m.maxzoom>g)){if(this._inProgressLayer||(this._inProgressLayer=new $i(m)),this._inProgressLayer.continuePlacement(a[m.source],this.placement,this._showCollisionBoxes,m,d))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const fi=512/c.EXTENT/2;class ir{constructor(t,n,a){this.tileID=t,this.bucketInstanceId=a,this._symbolsByKey={};const l=new Map;for(let d=0;d({x:Math.floor(y.anchorX*fi),y:Math.floor(y.anchorY*fi)})),crossTileIDs:m.map(y=>y.crossTileID)};if(g.positions.length>128){const y=new c.KDBush(g.positions.length,16,Uint16Array);for(const{x:v,y:b}of g.positions)y.add(v,b);y.finish(),delete g.positions,g.index=y}this._symbolsByKey[d]=g}}getScaledCoordinates(t,n){const{x:a,y:l,z:d}=this.tileID.canonical,{x:m,y:g,z:y}=n.canonical,v=fi/Math.pow(2,y-d),b=(g*c.EXTENT+t.anchorY)*v,T=l*c.EXTENT*fi;return{x:Math.floor((m*c.EXTENT+t.anchorX)*v-a*c.EXTENT*fi),y:Math.floor(b-T)}}findMatches(t,n,a){const l=this.tileID.canonical.zt)}}class zo{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Os{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const a in this.indexes){const l=this.indexes[a],d={};for(const m in l){const g=l[m];g.tileID=g.tileID.unwrapTo(g.tileID.wrap+n),d[g.tileID.key]=g}this.indexes[a]=d}this.lng=t}addBucket(t,n,a){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let d=0;dt.overscaledZ)for(const g in m){const y=m[g];y.tileID.isChildOf(t)&&y.findMatches(n.symbolInstances,t,l)}else{const g=m[t.scaledTo(Number(d)).key];g&&g.findMatches(n.symbolInstances,t,l)}}for(let d=0;d{n[a]=!0});for(const a in this.layerIndexes)n[a]||delete this.layerIndexes[a]}}const sn=(h,t)=>c.emitValidationErrors(h,t&&t.filter(n=>n.identifier!=="source.canvas")),gn=c.pick(c.operations,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),Vt=c.pick(c.operations,["setCenter","setZoom","setBearing","setPitch"]),Us=c.emptyStyle();class mi extends c.Evented{constructor(t,n={}){super(),this.map=t,this.dispatcher=new li(tn(),this,t._getMapId()),this.imageManager=new Pi,this.imageManager.setEventedParent(this),this.glyphManager=new Ei(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new cr(256,512),this.crossTileSymbolIndex=new Ut,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new c.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",c.getReferrer());const a=this;this._rtlTextPluginCallback=mi.registerForPluginStateChange(l=>{a.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:l.pluginStatus,pluginURL:l.pluginURL},(d,m)=>{if(c.triggerPluginCompletionEvent(d),m&&m.every(g=>g))for(const g in a.sourceCaches){const y=a.sourceCaches[g].getSource().type;y!=="vector"&&y!=="geojson"||a.sourceCaches[g].reload()}})}),this.on("data",l=>{if(l.dataType!=="source"||l.sourceDataType!=="metadata")return;const d=this.sourceCaches[l.sourceId];if(!d)return;const m=d.getSource();if(m&&m.vectorLayerIds)for(const g in this._layers){const y=this._layers[g];y.source===m.id&&this._validateLayer(y)}})}loadURL(t,n={},a){this.fire(new c.Event("dataloading",{dataType:"style"})),n.validate=typeof n.validate!="boolean"||n.validate;const l=this.map._requestManager.transformRequest(t,vt.Style);this._request=c.getJSON(l,(d,m)=>{this._request=null,d?this.fire(new c.ErrorEvent(d)):m&&this._load(m,n,a)})}loadJSON(t,n={},a){this.fire(new c.Event("dataloading",{dataType:"style"})),this._request=c.browser.frame(()=>{this._request=null,n.validate=n.validate!==!1,this._load(t,n,a)})}loadEmpty(){this.fire(new c.Event("dataloading",{dataType:"style"})),this._load(Us,{validate:!1})}_load(t,n,a){var l;const d=n.transformStyle?n.transformStyle(a,t):t;if(!n.validate||!sn(this,c.validateStyle(d))){this._loaded=!0,this.stylesheet=d;for(const m in d.sources)this.addSource(m,d.sources[m],{validate:!1});d.sprite?this._loadSprite(d.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(d.glyphs),this._createLayers(),this.light=new Ln(this.stylesheet.light),this.map.setTerrain((l=this.stylesheet.terrain)!==null&&l!==void 0?l:null),this.fire(new c.Event("data",{dataType:"style"})),this.fire(new c.Event("style.load"))}}_createLayers(){const t=c.derefLayers(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",t),this._order=t.map(n=>n.id),this._layers={},this._serializedLayers=null;for(const n of t){const a=c.createStyleLayer(n);a.setEventedParent(this,{layer:{id:n.id}}),this._layers[n.id]=a}}_loadSprite(t,n=!1,a=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=function(l,d,m,g){const y=di(l),v=y.length,b=m>1?"@2x":"",T={},C={},L={};for(const{id:D,url:F}of y){const k=d.transformRequest(d.normalizeSpriteURL(F,b,".json"),vt.SpriteJSON),H=`${D}_${k.url}`;T[H]=c.getJSON(k,(K,ae)=>{delete T[H],C[D]=ae,Qt(g,C,L,K,v)});const ne=d.transformRequest(d.normalizeSpriteURL(F,b,".png"),vt.SpriteImage),N=`${D}_${ne.url}`;T[N]=jt.getImage(ne,(K,ae)=>{delete T[N],L[D]=ae,Qt(g,C,L,K,v)})}return{cancel(){for(const D of Object.values(T))D.cancel()}}}(t,this.map._requestManager,this.map.getPixelRatio(),(l,d)=>{if(this._spriteRequest=null,l)this.fire(new c.ErrorEvent(l));else if(d)for(const m in d){this._spritesImagesIds[m]=[];const g=this._spritesImagesIds[m]?this._spritesImagesIds[m].filter(y=>!(y in d)):[];for(const y of g)this.imageManager.removeImage(y),this._changedImages[y]=!0;for(const y in d[m]){const v=m==="default"?y:`${m}:${y}`;this._spritesImagesIds[m].push(v),v in this.imageManager.images?this.imageManager.updateImage(v,d[m][y],!1):this.imageManager.addImage(v,d[m][y]),n&&(this._changedImages[v]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new c.Event("data",{dataType:"style"})),a&&a(l)})}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new c.Event("data",{dataType:"style"}))}_validateLayer(t){const n=this.sourceCaches[t.source];if(!n)return;const a=t.sourceLayer;if(!a)return;const l=n.getSource();(l.type==="geojson"||l.vectorLayerIds&&l.vectorLayerIds.indexOf(a)===-1)&&this.fire(new c.ErrorEvent(new Error(`Source layer "${a}" does not exist on source "${l.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t){const n=this._serializedAllLayers();if(!t||t.length===0)return Object.values(n);const a=[];for(const l of t)n[l]&&a.push(n[l]);return a}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const n=Object.keys(this._layers);for(const a of n){const l=this._layers[a];l.type!=="custom"&&(t[a]=l.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const n=this._changed;if(this._changed){const l=Object.keys(this._updatedLayers),d=Object.keys(this._removedLayers);(l.length||d.length)&&this._updateWorkerLayers(l,d);for(const m in this._updatedSources){const g=this._updatedSources[m];if(g==="reload")this._reloadSource(m);else{if(g!=="clear")throw new Error(`Invalid action ${g}`);this._clearSource(m)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const m in this._updatedPaintProps)this._layers[m].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}const a={};for(const l in this.sourceCaches){const d=this.sourceCaches[l];a[l]=d.used,d.used=!1}for(const l of this._order){const d=this._layers[l];d.recalculate(t,this._availableImages),!d.isHidden(t.zoom)&&d.source&&(this.sourceCaches[d.source].used=!0)}for(const l in a){const d=this.sourceCaches[l];a[l]!==d.used&&d.fire(new c.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:l}))}this.light.recalculate(t),this.z=t.zoom,n&&this.fire(new c.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const n in this.sourceCaches)this.sourceCaches[n].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,n){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(t),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,n={}){this._checkLoaded();const a=this.serialize();if(t=n.transformStyle?n.transformStyle(a,t):t,sn(this,c.validateStyle(t)))return!1;(t=c.clone$1(t)).layers=c.derefLayers(t.layers);const l=c.diffStyles(a,t).filter(m=>!(m.command in Vt));if(l.length===0)return!1;const d=l.filter(m=>!(m.command in gn));if(d.length>0)throw new Error(`Unimplemented: ${d.map(m=>m.command).join(", ")}.`);for(const m of l)m.command!=="setTransition"&&this[m.command].apply(this,m.args);return this.stylesheet=t,!0}addImage(t,n){if(this.getImage(t))return this.fire(new c.ErrorEvent(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,n),this._afterImageUpdated(t)}updateImage(t,n){this.imageManager.updateImage(t,n)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new c.ErrorEvent(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new c.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,a={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(c.validateStyle.source,`sources.${t}`,n,null,a))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const l=this.sourceCaches[t]=new Dt(t,n,this.dispatcher);l.style=this,l.setEventedParent(this,()=>({isSourceLoaded:l.loaded(),source:l.serialize(),sourceId:t})),l.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(const a in this._layers)if(this._layers[a].source===t)return this.fire(new c.ErrorEvent(new Error(`Source "${t}" cannot be removed while layer "${a}" is using it.`)));const n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire(new c.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,n){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const a=this.sourceCaches[t].getSource();if(a.type!=="geojson")throw new Error(`geojsonSource.type is ${a.type}, which is !== 'geojson`);a.setData(n),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,n,a={}){this._checkLoaded();const l=t.id;if(this.getLayer(l))return void this.fire(new c.ErrorEvent(new Error(`Layer "${l}" already exists on this map.`)));let d;if(t.type==="custom"){if(sn(this,c.validateCustomStyleLayer(t)))return;d=c.createStyleLayer(t)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(l,t.source),t=c.clone$1(t),t=c.extend(t,{source:l})),this._validate(c.validateStyle.layer,`layers.${l}`,t,{arrayIndex:-1},a))return;d=c.createStyleLayer(t),this._validateLayer(d),d.setEventedParent(this,{layer:{id:l}})}const m=n?this._order.indexOf(n):this._order.length;if(n&&m===-1)this.fire(new c.ErrorEvent(new Error(`Cannot add layer "${l}" before non-existing layer "${n}".`)));else{if(this._order.splice(m,0,l),this._layerOrderChanged=!0,this._layers[l]=d,this._removedLayers[l]&&d.source&&d.type!=="custom"){const g=this._removedLayers[l];delete this._removedLayers[l],g.type!==d.type?this._updatedSources[d.source]="clear":(this._updatedSources[d.source]="reload",this.sourceCaches[d.source].pause())}this._updateLayer(d),d.onAdd&&d.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new c.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const a=this._order.indexOf(t);this._order.splice(a,1);const l=n?this._order.indexOf(n):this._order.length;n&&l===-1?this.fire(new c.ErrorEvent(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(l,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new c.ErrorEvent(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const a=this._order.indexOf(t);this._order.splice(a,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,n,a){this._checkLoaded();const l=this.getLayer(t);l?l.minzoom===n&&l.maxzoom===a||(n!=null&&(l.minzoom=n),a!=null&&(l.maxzoom=a),this._updateLayer(l)):this.fire(new c.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,a={}){this._checkLoaded();const l=this.getLayer(t);if(l){if(!c.deepEqual(l.filter,n))return n==null?(l.filter=void 0,void this._updateLayer(l)):void(this._validate(c.validateStyle.filter,`layers.${l.id}.filter`,n,null,a)||(l.filter=c.clone$1(n),this._updateLayer(l)))}else this.fire(new c.ErrorEvent(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return c.clone$1(this.getLayer(t).filter)}setLayoutProperty(t,n,a,l={}){this._checkLoaded();const d=this.getLayer(t);d?c.deepEqual(d.getLayoutProperty(n),a)||(d.setLayoutProperty(n,a,l),this._updateLayer(d)):this.fire(new c.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const a=this.getLayer(t);if(a)return a.getLayoutProperty(n);this.fire(new c.ErrorEvent(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,a,l={}){this._checkLoaded();const d=this.getLayer(t);d?c.deepEqual(d.getPaintProperty(n),a)||(d.setPaintProperty(n,a,l)&&this._updateLayer(d),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new c.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();const a=t.source,l=t.sourceLayer,d=this.sourceCaches[a];if(d===void 0)return void this.fire(new c.ErrorEvent(new Error(`The source '${a}' does not exist in the map's style.`)));const m=d.getSource().type;m==="geojson"&&l?this.fire(new c.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):m!=="vector"||l?(t.id===void 0&&this.fire(new c.ErrorEvent(new Error("The feature id parameter must be provided."))),d.setFeatureState(l,t.id,n)):this.fire(new c.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const a=t.source,l=this.sourceCaches[a];if(l===void 0)return void this.fire(new c.ErrorEvent(new Error(`The source '${a}' does not exist in the map's style.`)));const d=l.getSource().type,m=d==="vector"?t.sourceLayer:void 0;d!=="vector"||m?n&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new c.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):l.removeFeatureState(m,t.id,n):this.fire(new c.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,a=t.sourceLayer,l=this.sourceCaches[n];if(l!==void 0)return l.getSource().type!=="vector"||a?(t.id===void 0&&this.fire(new c.ErrorEvent(new Error("The feature id parameter must be provided."))),l.getFeatureState(a,t.id)):void this.fire(new c.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new c.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return c.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const t=c.mapObject(this.sourceCaches,l=>l.serialize()),n=this._serializeByIds(this._order),a=this.stylesheet;return c.filterObject({version:a.version,name:a.name,metadata:a.metadata,light:a.light,center:a.center,zoom:a.zoom,bearing:a.bearing,pitch:a.pitch,sprite:a.sprite,glyphs:a.glyphs,transition:a.transition,sources:t,layers:n},l=>l!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const n=m=>this._layers[m].type==="fill-extrusion",a={},l=[];for(let m=this._order.length-1;m>=0;m--){const g=this._order[m];if(n(g)){a[g]=m;for(const y of t){const v=y[g];if(v)for(const b of v)l.push(b)}}}l.sort((m,g)=>g.intersectionZ-m.intersectionZ);const d=[];for(let m=this._order.length-1;m>=0;m--){const g=this._order[m];if(n(g))for(let y=l.length-1;y>=0;y--){const v=l[y].feature;if(a[v.layer.id]{const _e=H.featureSortOrder;if(_e){const fe=_e.indexOf(oe.featureIndex);return _e.indexOf(ce.featureIndex)-fe}return ce.featureIndex-oe.featureIndex});for(const oe of ae)K.push(oe)}}for(const H in D)D[H].forEach(ne=>{const N=ne.feature,K=v[g[H].source].getFeatureState(N.layer["source-layer"],N.id);N.source=N.layer.source,N.layer["source-layer"]&&(N.sourceLayer=N.layer["source-layer"]),N.state=K});return D}(this._layers,m,this.sourceCaches,t,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(d)}querySourceFeatures(t,n){n&&n.filter&&this._validate(c.validateStyle.filter,"querySourceFeatures.filter",n.filter,null,n);const a=this.sourceCaches[t];return a?function(l,d){const m=l.getRenderableIds().map(v=>l.getTileByID(v)),g=[],y={};for(let v=0;v{Fr[l]=d})(t,n),n.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:n.workerSourceURL},a):a(null,null))}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();const a=this.light.getLight();let l=!1;for(const m in t)if(!c.deepEqual(t[m],a[m])){l=!0;break}if(!l)return;const d={now:c.browser.now(),transition:c.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(d)}_validate(t,n,a,l,d={}){return(!d||d.validate!==!1)&&sn(this,t.call(c.validateStyle,c.extend({key:n,style:this.serialize(),value:a,styleSpec:c.v8Spec},l)))}_remove(t=!0){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),c.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const n in this._layers)this._layers[n].setEventedParent(null);for(const n in this.sourceCaches){const a=this.sourceCaches[n];a.setEventedParent(null),a.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove(t)}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const n in this.sourceCaches)this.sourceCaches[n].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,n,a,l,d=!1){let m=!1,g=!1;const y={};for(const v of this._order){const b=this._layers[v];if(b.type!=="symbol")continue;if(!y[b.source]){const C=this.sourceCaches[b.source];y[b.source]=C.getRenderableIds(!0).map(L=>C.getTileByID(L)).sort((L,D)=>D.tileID.overscaledZ-L.tileID.overscaledZ||(L.tileID.isLessThan(D.tileID)?-1:1))}const T=this.crossTileSymbolIndex.addLayer(b,y[b.source],t.center.lng);m=m||T}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((d=d||this._layerOrderChanged||a===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(c.browser.now(),t.zoom))&&(this.pauseablePlacement=new Ml(t,this.map.terrain,this._order,d,n,a,l,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,y),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(c.browser.now()),g=!0),m&&this.pauseablePlacement.placement.setStale()),g||m)for(const v of this._order){const b=this._layers[v];b.type==="symbol"&&this.placement.updateLayerOpacities(b,y[b.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(c.browser.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,n,a){this.imageManager.getImages(n.icons,a),this._updateTilesForChangedImages();const l=this.sourceCaches[n.source];l&&l.setDependencies(n.tileID.key,n.type,n.icons)}getGlyphs(t,n,a){this.glyphManager.getGlyphs(n.stacks,a);const l=this.sourceCaches[n.source];l&&l.setDependencies(n.tileID.key,n.type,[""])}getResource(t,n,a){return c.makeRequest(n,a)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,n={}){this._checkLoaded(),t&&this._validate(c.validateStyle.glyphs,"glyphs",t,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,n,a={},l){this._checkLoaded();const d=[{id:t,url:n}],m=[...di(this.stylesheet.sprite),...d];this._validate(c.validateStyle.sprite,"sprite",m,null,a)||(this.stylesheet.sprite=m,this._loadSprite(d,!0,l))}removeSprite(t){this._checkLoaded();const n=di(this.stylesheet.sprite);if(n.find(a=>a.id===t)){if(this._spritesImagesIds[t])for(const a of this._spritesImagesIds[t])this.imageManager.removeImage(a),this._changedImages[a]=!0;n.splice(n.findIndex(a=>a.id===t),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new c.Event("data",{dataType:"style"}))}else this.fire(new c.ErrorEvent(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return di(this.stylesheet.sprite)}setSprite(t,n={},a){this._checkLoaded(),t&&this._validate(c.validateStyle.sprite,"sprite",t,null,n)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,a):(this._unloadSprite(),a&&a(null)))}}mi.registerForPluginStateChange=c.registerForPluginStateChange;var Vs=c.createLayout([{name:"a_pos",type:"Int16",components:2}]),Ir="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";const ns={prelude:pt(`#ifdef GL_ES +(function(){const Z=document.createElement("link").relList;if(Z&&Z.supports&&Z.supports("modulepreload"))return;for(const ee of document.querySelectorAll('link[rel="modulepreload"]'))Y(ee);new MutationObserver(ee=>{for(const ge of ee)if(ge.type==="childList")for(const Me of ge.addedNodes)Me.tagName==="LINK"&&Me.rel==="modulepreload"&&Y(Me)}).observe(document,{childList:!0,subtree:!0});function X(ee){const ge={};return ee.integrity&&(ge.integrity=ee.integrity),ee.referrerPolicy&&(ge.referrerPolicy=ee.referrerPolicy),ee.crossOrigin==="use-credentials"?ge.credentials="include":ee.crossOrigin==="anonymous"?ge.credentials="omit":ge.credentials="same-origin",ge}function Y(ee){if(ee.ep)return;ee.ep=!0;const ge=X(ee);fetch(ee.href,ge)}})();var Rp=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Fp(R){return R&&R.__esModule&&Object.prototype.hasOwnProperty.call(R,"default")?R.default:R}var Cu={exports:{}};(function(R,Z){(function(X,Y){R.exports=Y()})(Rp,function(){var X,Y,ee;function ge(c,Oe){if(!X)X=Oe;else if(!Y)Y=Oe;else{var re="var sharedChunk = {}; ("+X+")(sharedChunk); ("+Y+")(sharedChunk);",De={};X(De),ee=Oe(De),typeof window<"u"&&(ee.workerUrl=window.URL.createObjectURL(new Blob([re],{type:"text/javascript"})))}}ge(["exports"],function(c){function Oe(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var re=De;function De(i,e){this.x=i,this.y=e}De.prototype={clone:function(){return new De(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,e){return this.clone()._rotateAround(i,e)},matMult:function(i){return this.clone()._matMult(i)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var e=i.x-this.x,r=i.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var e=Math.cos(i),r=Math.sin(i),s=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=s,this},_rotateAround:function(i,e){var r=Math.cos(i),s=Math.sin(i),o=e.y+s*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-s*(this.y-e.y),this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},De.convert=function(i){return i instanceof De?i:Array.isArray(i)?new De(i[0],i[1]):i};var me=Oe(re),dt=Ct;function Ct(i,e,r,s){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(s-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=s}Ct.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,s=0;s<8;s++){var o=this.sampleCurveX(r)-i;if(Math.abs(o)o?p=r:f=r,r=.5*(f-p)+p;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};var Yt=Oe(dt);function ai(i,e,r,s){const o=new Yt(i,e,r,s);return function(u){return o.solve(u)}}const jt=ai(.25,.1,.25,1);function vt(i,e,r){return Math.min(r,Math.max(e,i))}function Mt(i,e,r){const s=r-e,o=((i-e)%s+s)%s+e;return o===e?r:o}function Jt(i,...e){for(const r of e)for(const s in r)i[s]=r[s];return i}let Yr=1;function er(i,e,r){const s={};for(const o in i)s[o]=e.call(r||this,i[o],o,i);return s}function Jr(i,e,r){const s={};for(const o in i)e.call(r||this,i[o],o,i)&&(s[o]=i[o]);return s}function wi(i){return Array.isArray(i)?i.map(wi):typeof i=="object"&&i?er(i,wi):i}const di={};function Qt(i){di[i]||(typeof console<"u"&&console.warn(i),di[i]=!0)}function Je(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function Qr(i){let e=0;for(let r,s,o=0,u=i.length,p=u-1;ocancelAnimationFrame(e)}},getImageData(i,e=0){return this.getImageCanvasContext(i).getImageData(-e,-e,i.width+2*e,i.height+2*e)},getImageCanvasContext(i){const e=window.document.createElement("canvas"),r=e.getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("failed to create canvas 2d context");return e.width=i.width,e.height=i.height,r.drawImage(i,0,0,i.width,i.height),r},resolveURL:i=>(Lr||(Lr=document.createElement("a")),Lr.href=i,Lr.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(ei==null&&(ei=matchMedia("(prefers-reduced-motion: reduce)")),ei.matches)}},Ln={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};class cr extends Error{constructor(e,r,s,o){super(`AJAXError: ${r} (${e}): ${s}`),this.status=e,this.statusText=r,this.url=s,this.body=o}}const li=Pi()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href,Si=i=>Ln.REGISTERED_PROTOCOLS[i.substring(0,i.indexOf("://"))];function mt(i,e){const r=new AbortController,s=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,cache:i.cache,referrer:li(),signal:r.signal});let o=!1,u=!1;return i.type==="json"&&s.headers.set("Accept","application/json"),u||fetch(s).then(p=>p.ok?(f=>{(i.type==="arrayBuffer"||i.type==="image"?f.arrayBuffer():i.type==="json"?f.json():f.text()).then(_=>{u||(o=!0,e(null,_,f.headers.get("Cache-Control"),f.headers.get("Expires")))}).catch(_=>{u||e(new Error(_.message))})})(p):p.blob().then(f=>e(new cr(p.status,p.statusText,i.url,f)))).catch(p=>{p.code!==20&&e(new Error(p.message))}),{cancel:()=>{u=!0,o||r.abort()}}}const hr=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if(Pi()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e);if(!Pi())return(Si(i.url)||mt)(i,e)}if(!(/^file:/.test(r=i.url)||/^file:/.test(li())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return mt(i,e);if(Pi()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e,void 0,!0)}var r;return function(s,o){const u=new XMLHttpRequest;u.open(s.method||"GET",s.url,!0),s.type!=="arrayBuffer"&&s.type!=="image"||(u.responseType="arraybuffer");for(const p in s.headers)u.setRequestHeader(p,s.headers[p]);return s.type==="json"&&(u.responseType="text",u.setRequestHeader("Accept","application/json")),u.withCredentials=s.credentials==="include",u.onerror=()=>{o(new Error(u.statusText))},u.onload=()=>{if((u.status>=200&&u.status<300||u.status===0)&&u.response!==null){let p=u.response;if(s.type==="json")try{p=JSON.parse(u.response)}catch(f){return o(f)}o(null,p,u.getResponseHeader("Cache-Control"),u.getResponseHeader("Expires"))}else{const p=new Blob([u.response],{type:u.getResponseHeader("Content-Type")});o(new cr(u.status,u.statusText,s.url,p))}},u.send(s.body),{cancel:()=>u.abort()}}(i,e)},Br=function(i,e){return hr(Jt(i,{type:"arrayBuffer"}),e)};function ur(i){if(!i||i.indexOf("://")<=0||i.indexOf("data:image/")===0||i.indexOf("blob:")===0)return!0;const e=new URL(i),r=window.location;return e.protocol===r.protocol&&e.host===r.host}function Rr(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function dr(i,e,r){if(r&&r[i]){const s=r[i].indexOf(e);s!==-1&&r[i].splice(s,1)}}class Ii{constructor(e,r={}){Jt(this,r),this.type=e}}class Ni extends Ii{constructor(e,r={}){super("error",Jt({error:e},r))}}class pr{on(e,r){return this._listeners=this._listeners||{},Rr(e,r,this._listeners),this}off(e,r){return dr(e,r,this._listeners),dr(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},Rr(e,r,this._oneTimeListeners),this):new Promise(s=>this.once(e,s))}fire(e,r){typeof e=="string"&&(e=new Ii(e,r||{}));const s=e.type;if(this.listens(s)){e.target=this;const o=this._listeners&&this._listeners[s]?this._listeners[s].slice():[];for(const f of o)f.call(this,e);const u=this._oneTimeListeners&&this._oneTimeListeners[s]?this._oneTimeListeners[s].slice():[];for(const f of u)dr(s,f,this._oneTimeListeners),f.call(this,e);const p=this._eventedParent;p&&(Jt(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),p.fire(e))}else e instanceof Ni&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,r){return this._eventedParent=e,this._eventedParentData=r,this}}var le={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"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"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"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"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const Fr=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Bn(i,e){const r={};for(const s in i)s!=="ref"&&(r[s]=i[s]);return Fr.forEach(s=>{s in e&&(r[s]=e[s])}),r}function gt(i,e){if(Array.isArray(i)){if(!Array.isArray(e)||i.length!==e.length)return!1;for(let r=0;r`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const rs=[tn,Te,Ke,Ye,pi,Er,Ur,ci(Ge),rn,tr,nn];function Sr(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Sr(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const r of rs)if(!Sr(r,e))return null}}return`Expected ${bt(i)} but found ${bt(e)} instead.`}function O(i,e){return e.some(r=>r.kind===i.kind)}function S(i,e){return e.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}function A(i,e){return i.kind==="array"&&e.kind==="array"?i.itemType.kind===e.itemType.kind&&typeof i.N=="number":i.kind===e.kind}const z=.96422,V=.82521,q=4/29,J=6/29,G=3*J*J,j=J*J*J,te=Math.PI/180,ue=180/Math.PI;function de(i){return(i%=360)<0&&(i+=360),i}function pe([i,e,r,s]){let o,u;const p=He((.2225045*(i=Ze(i))+.7168786*(e=Ze(e))+.0606169*(r=Ze(r)))/1);i===e&&e===r?o=u=p:(o=He((.4360747*i+.3850649*e+.1430804*r)/z),u=He((.0139322*i+.0971045*e+.7141733*r)/V));const f=116*p-16;return[f<0?0:f,500*(o-p),200*(p-u),s]}function Ze(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function He(i){return i>j?Math.pow(i,1/3):i/G+q}function Le([i,e,r,s]){let o=(i+16)/116,u=isNaN(e)?o:o+e/500,p=isNaN(r)?o:o-r/200;return o=1*We(o),u=z*We(u),p=V*We(p),[Ve(3.1338561*u-1.6168667*o-.4906146*p),Ve(-.9787684*u+1.9161415*o+.033454*p),Ve(.0719453*u-.2289914*o+1.4052427*p),s]}function Ve(i){return(i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055)<0?0:i>1?1:i}function We(i){return i>J?i*i*i:G*(i-q)}function ot(i){return parseInt(i.padEnd(2,i),16)/255}function _t(i,e){return rt(e?i/100:i,0,1)}function rt(i,e,r){return Math.min(Math.max(e,i),r)}function at(i){return!i.some(Number.isNaN)}const ki={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]};class Xe{constructor(e,r,s,o=1,u=!0){this.r=e,this.g=r,this.b=s,this.a=o,u||(this.r*=o,this.g*=o,this.b*=o,o||this.overwriteGetter("rgb",[e,r,s,o]))}static parse(e){if(e instanceof Xe)return e;if(typeof e!="string")return;const r=function(s){if((s=s.toLowerCase().trim())==="transparent")return[0,0,0,0];const o=ki[s];if(o){const[p,f,_]=o;return[p/255,f/255,_/255,1]}if(s.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(s)){const p=s.length<6?1:2;let f=1;return[ot(s.slice(f,f+=p)),ot(s.slice(f,f+=p)),ot(s.slice(f,f+=p)),ot(s.slice(f,f+p)||"ff")]}if(s.startsWith("rgb")){const p=s.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(p){const[f,_,x,w,E,I,M,P,B,U,$,Q]=p,W=[w||" ",M||" ",U].join("");if(W===" "||W===" /"||W===",,"||W===",,,"){const ie=[x,I,B].join(""),se=ie==="%%%"?100:ie===""?255:0;if(se){const he=[rt(+_/se,0,1),rt(+E/se,0,1),rt(+P/se,0,1),$?_t(+$,Q):1];if(at(he))return he}}return}}const u=s.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(u){const[p,f,_,x,w,E,I,M,P]=u,B=[_||" ",w||" ",I].join("");if(B===" "||B===" /"||B===",,"||B===",,,"){const U=[+f,rt(+x,0,100),rt(+E,0,100),M?_t(+M,P):1];if(at(U))return function([$,Q,W,ie]){function se(he){const Ce=(he+$/30)%12,Re=Q*Math.min(W,1-W);return W-Re*Math.max(-1,Math.min(Ce-3,9-Ce,1))}return $=de($),Q/=100,W/=100,[se(0),se(8),se(4),ie]}(U)}}}(e);return r?new Xe(...r,!1):void 0}get rgb(){const{r:e,g:r,b:s,a:o}=this,u=o||1/0;return this.overwriteGetter("rgb",[e/u,r/u,s/u,o])}get hcl(){return this.overwriteGetter("hcl",function(e){const[r,s,o,u]=pe(e),p=Math.sqrt(s*s+o*o);return[Math.round(1e4*p)?de(Math.atan2(o,s)*ue):NaN,p,r,u]}(this.rgb))}get lab(){return this.overwriteGetter("lab",pe(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){const[e,r,s,o]=this.rgb;return`rgba(${[e,r,s].map(u=>Math.round(255*u)).join(",")},${o})`}}Xe.black=new Xe(0,0,0,1),Xe.white=new Xe(1,1,1,1),Xe.transparent=new Xe(0,0,0,0),Xe.red=new Xe(1,0,0,1);class Gt{constructor(e,r,s){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=s,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class hi{constructor(e,r,s,o,u){this.text=e,this.image=r,this.scale=s,this.fontStack=o,this.textColor=u}}class Ot{constructor(e){this.sections=e}static fromString(e){return new Ot([new hi(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof Ot?e:Ot.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class $i{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof $i)return e;if(typeof e=="number")return new $i([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const r of e)if(typeof r!="number")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 $i(e)}}toString(){return JSON.stringify(this.values)}}const Ml=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class fi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof fi)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let r=0;r=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[i,e,r,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[i,e,r,s]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Os(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof Xe||i instanceof Gt||i instanceof Ot||i instanceof $i||i instanceof fi||i instanceof ir)return!0;if(Array.isArray(i)){for(const e of i)if(!Os(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!Os(i[e]))return!1;return!0}return!1}function Ut(i){if(i===null)return tn;if(typeof i=="string")return Ke;if(typeof i=="boolean")return Ye;if(typeof i=="number")return Te;if(i instanceof Xe)return pi;if(i instanceof Gt)return Tr;if(i instanceof Ot)return Er;if(i instanceof $i)return rn;if(i instanceof fi)return nn;if(i instanceof ir)return tr;if(Array.isArray(i)){const e=i.length;let r;for(const s of i){const o=Ut(s);if(r){if(r===o)continue;r=Ge;break}r=o}return ci(r||Ge,e)}return Ur}function sn(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof Xe||i instanceof Ot||i instanceof $i||i instanceof fi||i instanceof ir?i.toString():JSON.stringify(i)}class gn{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Os(e[1]))return r.error("invalid value");const s=e[1];let o=Ut(s);const u=r.expectedType;return o.kind!=="array"||o.N!==0||!u||u.kind!=="array"||typeof u.N=="number"&&u.N!==0||(o=u),new gn(o,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Vt{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Us={string:Ke,number:Te,boolean:Ye,object:Ur};class mi{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let s,o=1;const u=e[0];if(u==="array"){let f,_;if(e.length>2){const x=e[1];if(typeof x!="string"||!(x in Us)||x==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);f=Us[x],o++}else f=Ge;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error('The length argument to "array" must be a positive integer literal',2);_=e[2],o++}s=ci(f,_)}else{if(!Us[u])throw new Error(`Types doesn't contain name = ${u}`);s=Us[u]}const p=[];for(;oe.outputDefined())}}const Vs={"to-boolean":Ye,"to-color":pi,"to-number":Te,"to-string":Ke};class Ir{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const s=e[0];if(!Vs[s])throw new Error(`Can't parse ${s} as it is not part of the known types`);if((s==="to-boolean"||s==="to-string")&&e.length!==2)return r.error("Expected one argument.");const o=Vs[s],u=[];for(let p=1;p4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:ko(r[0],r[1],r[2],r[3]),!s))return new Xe(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new Vt(s||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(const s of this.args){r=s.evaluate(e);const o=$i.parse(r);if(o)return o}throw new Vt(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(const s of this.args){r=s.evaluate(e);const o=fi.parse(r);if(o)return o}throw new Vt(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(const s of this.args){if(r=s.evaluate(e),r===null)return 0;const o=Number(r);if(!isNaN(o))return o}throw new Vt(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return Ot.fromString(sn(this.args[0].evaluate(e)));case"resolvedImage":return ir.fromString(sn(this.args[0].evaluate(e)));default:return sn(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const ns=["Unknown","Point","LineString","Polygon"];class pt{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?ns[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(e){let r=this._parseColorCache[e];return r||(r=this._parseColorCache[e]=Xe.parse(e)),r}}class Ns{constructor(e,r,s=[],o,u=new Or,p=[]){this.registry=e,this.path=s,this.key=s.map(f=>`[${f}]`).join(""),this.scope=u,this.errors=p,this.expectedType=o,this._isConstant=r}parse(e,r,s,o,u={}){return r?this.concat(r,s,o)._parse(e,u):this._parse(e,u)}_parse(e,r){function s(o,u,p){return p==="assert"?new mi(u,[o]):p==="coerce"?new Ir(u,[o]):o}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const o=e[0];if(typeof o!="string")return this.error(`Expression name must be a string, but found ${typeof o} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const u=this.registry[o];if(u){let p=u.parse(e,this);if(!p)return null;if(this.expectedType){const f=this.expectedType,_=p.type;if(f.kind!=="string"&&f.kind!=="number"&&f.kind!=="boolean"&&f.kind!=="object"&&f.kind!=="array"||_.kind!=="value")if(f.kind!=="color"&&f.kind!=="formatted"&&f.kind!=="resolvedImage"||_.kind!=="value"&&_.kind!=="string")if(f.kind!=="padding"||_.kind!=="value"&&_.kind!=="number"&&_.kind!=="array")if(f.kind!=="variableAnchorOffsetCollection"||_.kind!=="value"&&_.kind!=="array"){if(this.checkSubtype(f,_))return null}else p=s(p,f,r.typeAnnotation||"coerce");else p=s(p,f,r.typeAnnotation||"coerce");else p=s(p,f,r.typeAnnotation||"coerce");else p=s(p,f,r.typeAnnotation||"assert")}if(!(p instanceof gn)&&p.type.kind!=="resolvedImage"&&this._isConstant(p)){const f=new pt;try{p=new gn(p.type,p.evaluate(f))}catch(_){return this.error(_.message),null}}return p}return this.error(`Unknown expression "${o}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,r,s){const o=typeof e=="number"?this.path.concat(e):this.path,u=s?this.scope.concat(s):this.scope;return new Ns(this.registry,this._isConstant,o,r||null,u,this.errors)}error(e,...r){const s=`${this.key}${r.map(o=>`[${o}]`).join("")}`;this.errors.push(new zi(s,e))}checkSubtype(e,r){const s=Sr(e,r);return s&&this.error(s),s}}class Fn{constructor(e,r,s){this.type=Tr,this.locale=s,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");const s=e[1];if(typeof s!="object"||Array.isArray(s))return r.error("Collator options argument must be an object.");const o=r.parse(s["case-sensitive"]!==void 0&&s["case-sensitive"],1,Ye);if(!o)return null;const u=r.parse(s["diacritic-sensitive"]!==void 0&&s["diacritic-sensitive"],1,Ye);if(!u)return null;let p=null;return s.locale&&(p=r.parse(s.locale,1,Ke),!p)?null:new Fn(o,u,p)}evaluate(e){return new Gt(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}const an=8192;function $s(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function ss(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function Pl(i,e){const r=(180+i[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,o=Math.pow(2,e.z);return[Math.round(r*o*an),Math.round(s*o*an)]}function Do(i,e,r){const s=i[0]-e[0],o=i[1]-e[1],u=i[0]-r[0],p=i[1]-r[1];return s*p-u*o==0&&s*u<=0&&o*p<=0}function qs(i,e){let r=!1;for(let p=0,f=e.length;p(s=i)[1]!=(u=_[x+1])[1]>s[1]&&s[0]<(u[0]-o[0])*(s[1]-o[1])/(u[1]-o[1])+o[0]&&(r=!r)}}var s,o,u;return r}function zl(i,e){for(let r=0;r0&&f<0||p<0&&f>0}function kl(i,e,r){for(const x of r)for(let w=0;wr[2]){const o=.5*s;let u=i[0]-r[0]>o?-s:r[0]-i[0]>o?s:0;u===0&&(u=i[0]-r[2]>o?-s:r[2]-i[0]>o?s:0),i[0]+=u}$s(e,i)}function js(i,e,r,s){const o=Math.pow(2,s.z)*an,u=[s.x*an,s.y*an],p=[];for(const f of i)for(const _ of f){const x=[_.x+u[0],_.y+u[1]];Oo(x,e,r,o),p.push(x)}return p}function Uo(i,e,r,s){const o=Math.pow(2,s.z)*an,u=[s.x*an,s.y*an],p=[];for(const _ of i){const x=[];for(const w of _){const E=[w.x+u[0],w.y+u[1]];$s(e,E),x.push(E)}p.push(x)}if(e[2]-e[0]<=o/2){(f=e)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const _ of p)for(const x of _)Oo(x,e,r,o)}var f;return p}class _n{constructor(e,r){this.type=Ye,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Os(e[1])){const s=e[1];if(s.type==="FeatureCollection")for(let o=0;o!Array.isArray(x)||x.length===e.length-1);let _=null;for(const[x,w]of f){_=new Ns(r.registry,as,r.path,null,r.scope);const E=[];let I=!1;for(let M=1;M{return I=E,Array.isArray(I)?`(${I.map(bt).join(", ")})`:`(${bt(I.type)}...)`;var I}).join(" | "),w=[];for(let E=1;E{r=e?r&&as(s):r&&s instanceof gn}),!!r&&Xs(i)&&ls(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Xs(i){if(i instanceof qi&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||/^filter-/.test(i.name))||i instanceof _n)return!1;let e=!0;return i.eachChild(r=>{e&&!Xs(r)&&(e=!1)}),e}function os(i){if(i instanceof qi&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!os(r)&&(e=!1)}),e}function ls(i,e){if(i instanceof qi&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(s=>{r&&!ls(s,e)&&(r=!1)}),r}function cs(i,e){const r=i.length-1;let s,o,u=0,p=r,f=0;for(;u<=p;)if(f=Math.floor((u+p)/2),s=i[f],o=i[f+1],s<=e){if(f===r||ee))throw new Vt("Input is not a number.");p=f-1}return 0}class hs{constructor(e,r,s){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[o,u]of s)this.labels.push(o),this.outputs.push(u)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");const s=r.parse(e[1],1,Te);if(!s)return null;const o=[];let u=null;r.expectedType&&r.expectedType.kind!=="value"&&(u=r.expectedType);for(let p=1;p=f)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',x);const E=r.parse(_,w,u);if(!E)return null;u=u||E.type,o.push([f,E])}return new hs(u,s,o)}evaluate(e){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(e);const o=this.input.evaluate(e);if(o<=r[0])return s[0].evaluate(e);const u=r.length;return o>=r[u-1]?s[u-1].evaluate(e):s[cs(r,o)].evaluate(e)}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function yn(i,e,r){return i+r*(e-i)}function Ws(i,e,r){return i.map((s,o)=>yn(s,e[o],r))}const Zi={number:yn,color:function(i,e,r,s="rgb"){switch(s){case"rgb":{const[o,u,p,f]=Ws(i.rgb,e.rgb,r);return new Xe(o,u,p,f,!1)}case"hcl":{const[o,u,p,f]=i.hcl,[_,x,w,E]=e.hcl;let I,M;if(isNaN(o)||isNaN(_))isNaN(o)?isNaN(_)?I=NaN:(I=_,p!==1&&p!==0||(M=x)):(I=o,w!==1&&w!==0||(M=u));else{let Q=_-o;_>o&&Q>180?Q-=360:_180&&(Q+=360),I=o+r*Q}const[P,B,U,$]=function([Q,W,ie,se]){return Q=isNaN(Q)?0:Q*te,Le([ie,Math.cos(Q)*W,Math.sin(Q)*W,se])}([I,M??yn(u,x,r),yn(p,w,r),yn(f,E,r)]);return new Xe(P,B,U,$,!1)}case"lab":{const[o,u,p,f]=Le(Ws(i.lab,e.lab,r));return new Xe(o,u,p,f,!1)}}},array:Ws,padding:function(i,e,r){return new $i(Ws(i.values,e.values,r))},variableAnchorOffsetCollection:function(i,e,r){const s=i.values,o=e.values;if(s.length!==o.length)throw new Vt(`Cannot interpolate values of different length. from: ${i.toString()}, to: ${e.toString()}`);const u=[];for(let p=0;ptypeof w!="number"||w<0||w>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);o={name:"cubic-bezier",controlPoints:x}}}if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(u=r.parse(u,2,Te),!u)return null;const f=[];let _=null;s==="interpolate-hcl"||s==="interpolate-lab"?_=pi:r.expectedType&&r.expectedType.kind!=="value"&&(_=r.expectedType);for(let x=0;x=w)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',I);const P=r.parse(E,M,_);if(!P)return null;_=_||P.type,f.push([w,P])}return A(_,Te)||A(_,pi)||A(_,rn)||A(_,nn)||A(_,ci(Te))?new ji(_,s,o,u,f):r.error(`Type ${bt(_)} is not interpolatable.`)}evaluate(e){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(e);const o=this.input.evaluate(e);if(o<=r[0])return s[0].evaluate(e);const u=r.length;if(o>=r[u-1])return s[u-1].evaluate(e);const p=cs(r,o),f=ji.interpolationFactor(this.interpolation,o,r[p],r[p+1]),_=s[p].evaluate(e),x=s[p+1].evaluate(e);switch(this.operator){case"interpolate":return Zi[this.type.kind](_,x,f);case"interpolate-hcl":return Zi.color(_,x,f,"hcl");case"interpolate-lab":return Zi.color(_,x,f,"lab")}}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Da(i,e,r,s){const o=s-r,u=i-r;return o===0?0:e===1?u/o:(Math.pow(e,u)-1)/(Math.pow(e,o)-1)}class Hs{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expectected at least one argument.");let s=null;const o=r.expectedType;o&&o.kind!=="value"&&(s=o);const u=[];for(const f of e.slice(1)){const _=r.parse(f,1+u.length,s,void 0,{typeAnnotation:"omit"});if(!_)return null;s=s||_.type,u.push(_)}if(!s)throw new Error("No output type");const p=o&&u.some(f=>Sr(o,f.type));return new Hs(p?Ge:s,u)}evaluate(e){let r,s=null,o=0;for(const u of this.args)if(o++,s=u.evaluate(e),s&&s instanceof ir&&!s.available&&(r||(r=s.name),s=null,o===this.args.length&&(s=r)),s!==null)break;return s}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}class On{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const s=[];for(let u=1;u=s.length)throw new Vt(`Array index out of bounds: ${r} > ${s.length-1}.`);if(r!==Math.floor(r))throw new Vt(`Array index must be an integer, but found ${r} instead.`);return s[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class lt{constructor(e,r){this.type=Ye,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,Ge),o=r.parse(e[2],2,Ge);return s&&o?O(s.type,[Ye,Ke,Te,tn,Ge])?new lt(s,o):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${bt(s.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!s)return!1;if(!S(r,["boolean","string","number","null"]))throw new Vt(`Expected first argument to be of type boolean, string, number or null, but found ${bt(Ut(r))} instead.`);if(!S(s,["string","array"]))throw new Vt(`Expected second argument to be of type array or string, but found ${bt(Ut(s))} instead.`);return s.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Ks{constructor(e,r,s){this.type=Te,this.needle=e,this.haystack=r,this.fromIndex=s}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,Ge),o=r.parse(e[2],2,Ge);if(!s||!o)return null;if(!O(s.type,[Ye,Ke,Te,tn,Ge]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${bt(s.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,Te);return u?new Ks(s,o,u):null}return new Ks(s,o)}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!S(r,["boolean","string","number","null"]))throw new Vt(`Expected first argument to be of type boolean, string, number or null, but found ${bt(Ut(r))} instead.`);if(!S(s,["string","array"]))throw new Vt(`Expected second argument to be of type array or string, but found ${bt(Ut(s))} instead.`);if(this.fromIndex){const o=this.fromIndex.evaluate(e);return s.indexOf(r,o)}return s.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class La{constructor(e,r,s,o,u,p){this.inputType=e,this.type=r,this.input=s,this.cases=o,this.outputs=u,this.otherwise=p}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error("Expected an even number of arguments.");let s,o;r.expectedType&&r.expectedType.kind!=="value"&&(o=r.expectedType);const u={},p=[];for(let x=2;xNumber.MAX_SAFE_INTEGER)return I.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof P=="number"&&Math.floor(P)!==P)return I.error("Numeric branch labels must be integer values.");if(s){if(I.checkSubtype(s,Ut(P)))return null}else s=Ut(P);if(u[String(P)]!==void 0)return I.error("Branch labels must be unique.");u[String(P)]=p.length}const M=r.parse(E,x,o);if(!M)return null;o=o||M.type,p.push(M)}const f=r.parse(e[1],1,Ge);if(!f)return null;const _=r.parse(e[e.length-1],e.length-1,o);return _?f.type.kind!=="value"&&r.concat(1).checkSubtype(s,f.type)?null:new La(s,o,f,u,p,_):null}evaluate(e){const r=this.input.evaluate(e);return(Ut(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class Ba{constructor(e,r,s){this.type=e,this.branches=r,this.otherwise=s}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error("Expected an odd number of arguments.");let s;r.expectedType&&r.expectedType.kind!=="value"&&(s=r.expectedType);const o=[];for(let p=1;pr.outputDefined())&&this.otherwise.outputDefined()}}class Ys{constructor(e,r,s,o){this.type=e,this.input=r,this.beginIndex=s,this.endIndex=o}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,Ge),o=r.parse(e[2],2,Te);if(!s||!o)return null;if(!O(s.type,[ci(Ge),Ke,Ge]))return r.error(`Expected first argument to be of type array or string, but found ${bt(s.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,Te);return u?new Ys(s.type,s,o,u):null}return new Ys(s.type,s,o)}evaluate(e){const r=this.input.evaluate(e),s=this.beginIndex.evaluate(e);if(!S(r,["string","array"]))throw new Vt(`Expected first argument to be of type array or string, but found ${bt(Ut(r))} instead.`);if(this.endIndex){const o=this.endIndex.evaluate(e);return r.slice(s,o)}return r.slice(s)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Vo(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function No(i,e,r,s){return s.compare(e,r)===0}function Vn(i,e,r){const s=i!=="=="&&i!=="!=";return class Mu{constructor(u,p,f){this.type=Ye,this.lhs=u,this.rhs=p,this.collator=f,this.hasUntypedArgument=u.type.kind==="value"||p.type.kind==="value"}static parse(u,p){if(u.length!==3&&u.length!==4)return p.error("Expected two or three arguments.");const f=u[0];let _=p.parse(u[1],1,Ge);if(!_)return null;if(!Vo(f,_.type))return p.concat(1).error(`"${f}" comparisons are not supported for type '${bt(_.type)}'.`);let x=p.parse(u[2],2,Ge);if(!x)return null;if(!Vo(f,x.type))return p.concat(2).error(`"${f}" comparisons are not supported for type '${bt(x.type)}'.`);if(_.type.kind!==x.type.kind&&_.type.kind!=="value"&&x.type.kind!=="value")return p.error(`Cannot compare types '${bt(_.type)}' and '${bt(x.type)}'.`);s&&(_.type.kind==="value"&&x.type.kind!=="value"?_=new mi(x.type,[_]):_.type.kind!=="value"&&x.type.kind==="value"&&(x=new mi(_.type,[x])));let w=null;if(u.length===4){if(_.type.kind!=="string"&&x.type.kind!=="string"&&_.type.kind!=="value"&&x.type.kind!=="value")return p.error("Cannot use collator to compare non-string types.");if(w=p.parse(u[3],3,Tr),!w)return null}return new Mu(_,x,w)}evaluate(u){const p=this.lhs.evaluate(u),f=this.rhs.evaluate(u);if(s&&this.hasUntypedArgument){const _=Ut(p),x=Ut(f);if(_.kind!==x.kind||_.kind!=="string"&&_.kind!=="number")throw new Vt(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${_.kind}, ${x.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const _=Ut(p),x=Ut(f);if(_.kind!=="string"||x.kind!=="string")return e(u,p,f)}return this.collator?r(u,p,f,this.collator.evaluate(u)):e(u,p,f)}eachChild(u){u(this.lhs),u(this.rhs),this.collator&&u(this.collator)}outputDefined(){return!0}}}const Dl=Vn("==",function(i,e,r){return e===r},No),Ll=Vn("!=",function(i,e,r){return e!==r},function(i,e,r,s){return!No(0,e,r,s)}),Bl=Vn("<",function(i,e,r){return e",function(i,e,r){return e>r},function(i,e,r,s){return s.compare(e,r)>0}),Fl=Vn("<=",function(i,e,r){return e<=r},function(i,e,r,s){return s.compare(e,r)<=0}),Ol=Vn(">=",function(i,e,r){return e>=r},function(i,e,r,s){return s.compare(e,r)>=0});class Ra{constructor(e,r,s,o,u){this.type=Ke,this.number=e,this.locale=r,this.currency=s,this.minFractionDigits=o,this.maxFractionDigits=u}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const s=r.parse(e[1],1,Te);if(!s)return null;const o=e[2];if(typeof o!="object"||Array.isArray(o))return r.error("NumberFormat options argument must be an object.");let u=null;if(o.locale&&(u=r.parse(o.locale,1,Ke),!u))return null;let p=null;if(o.currency&&(p=r.parse(o.currency,1,Ke),!p))return null;let f=null;if(o["min-fraction-digits"]&&(f=r.parse(o["min-fraction-digits"],1,Te),!f))return null;let _=null;return o["max-fraction-digits"]&&(_=r.parse(o["max-fraction-digits"],1,Te),!_)?null:new Ra(s,u,p,f,_)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class Js{constructor(e){this.type=Er,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const s=e[1];if(!Array.isArray(s)&&typeof s=="object")return r.error("First argument must be an image or text section.");const o=[];let u=!1;for(let p=1;p<=e.length-1;++p){const f=e[p];if(u&&typeof f=="object"&&!Array.isArray(f)){u=!1;let _=null;if(f["font-scale"]&&(_=r.parse(f["font-scale"],1,Te),!_))return null;let x=null;if(f["text-font"]&&(x=r.parse(f["text-font"],1,ci(Ke)),!x))return null;let w=null;if(f["text-color"]&&(w=r.parse(f["text-color"],1,pi),!w))return null;const E=o[o.length-1];E.scale=_,E.font=x,E.textColor=w}else{const _=r.parse(e[p],1,Ge);if(!_)return null;const x=_.type.kind;if(x!=="string"&&x!=="value"&&x!=="null"&&x!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");u=!0,o.push({content:_,scale:null,font:null,textColor:null})}}return new Js(o)}evaluate(e){return new Ot(this.sections.map(r=>{const s=r.content.evaluate(e);return Ut(s)===tr?new hi("",s,null,null,null):new hi(sn(s),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null)}))}eachChild(e){for(const r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}outputDefined(){return!1}}class Fa{constructor(e){this.type=tr,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const s=r.parse(e[1],1,Ke);return s?new Fa(s):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),s=ir.fromString(r);return s&&e.availableImages&&(s.available=e.availableImages.indexOf(r)>-1),s}eachChild(e){e(this.input)}outputDefined(){return!1}}class Oa{constructor(e){this.type=Te,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);const s=r.parse(e[1],1);return s?s.type.kind!=="array"&&s.type.kind!=="string"&&s.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${bt(s.type)} instead.`):new Oa(s):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new Vt(`Expected value to be of type string or array, but found ${bt(Ut(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Nn={"==":Dl,"!=":Ll,">":Rl,"<":Bl,">=":Ol,"<=":Fl,array:mi,at:Un,boolean:mi,case:Ba,coalesce:Hs,collator:Fn,format:Js,image:Fa,in:lt,"index-of":Ks,interpolate:ji,"interpolate-hcl":ji,"interpolate-lab":ji,length:Oa,let:On,literal:gn,match:La,number:mi,"number-format":Ra,object:mi,slice:Ys,step:hs,string:mi,"to-boolean":Ir,"to-color":Ir,"to-number":Ir,"to-string":Ir,var:Gs,within:_n};function $o(i,[e,r,s,o]){e=e.evaluate(i),r=r.evaluate(i),s=s.evaluate(i);const u=o?o.evaluate(i):1,p=ko(e,r,s,u);if(p)throw new Vt(p);return new Xe(e/255,r/255,s/255,u,!1)}function qo(i,e){return i in e}function Ua(i,e){const r=e[i];return r===void 0?null:r}function xn(i){return{type:i}}function Zo(i){return{result:"success",value:i}}function $n(i){return{result:"error",value:i}}function qn(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function jo(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function Va(i){return!!i.expression&&i.expression.interpolated}function ut(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function Qs(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Ul(i){return i}function Go(i,e){const r=e.type==="color",s=i.stops&&typeof i.stops[0][0]=="object",o=s||!(s||i.property!==void 0),u=i.type||(Va(e)?"exponential":"interval");if(r||e.type==="padding"){const w=r?Xe.parse:$i.parse;(i=Ai({},i)).stops&&(i.stops=i.stops.map(E=>[E[0],w(E[1])])),i.default=w(i.default?i.default:e.default)}if(i.colorSpace&&(p=i.colorSpace)!=="rgb"&&p!=="hcl"&&p!=="lab")throw new Error(`Unknown color space: "${i.colorSpace}"`);var p;let f,_,x;if(u==="exponential")f=Xo;else if(u==="interval")f=Nl;else if(u==="categorical"){f=Vl,_=Object.create(null);for(const w of i.stops)_[w[0]]=w[1];x=typeof i.stops[0][0]}else{if(u!=="identity")throw new Error(`Unknown function type "${u}"`);f=$l}if(s){const w={},E=[];for(let P=0;PP[0]),evaluate:({zoom:P},B)=>Xo({stops:I,base:i.base},e,P).evaluate(P,B)}}if(o){const w=u==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:w,interpolationFactor:ji.interpolationFactor.bind(void 0,w),zoomStops:i.stops.map(E=>E[0]),evaluate:({zoom:E})=>f(i,e,E,_,x)}}return{kind:"source",evaluate(w,E){const I=E&&E.properties?E.properties[i.property]:void 0;return I===void 0?vn(i.default,e.default):f(i,e,I,_,x)}}}function vn(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function Vl(i,e,r,s,o){return vn(typeof r===o?s[r]:void 0,i.default,e.default)}function Nl(i,e,r){if(ut(r)!=="number")return vn(i.default,e.default);const s=i.stops.length;if(s===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[s-1][0])return i.stops[s-1][1];const o=cs(i.stops.map(u=>u[0]),r);return i.stops[o][1]}function Xo(i,e,r){const s=i.base!==void 0?i.base:1;if(ut(r)!=="number")return vn(i.default,e.default);const o=i.stops.length;if(o===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[o-1][0])return i.stops[o-1][1];const u=cs(i.stops.map(w=>w[0]),r),p=function(w,E,I,M){const P=M-I,B=w-I;return P===0?0:E===1?B/P:(Math.pow(E,B)-1)/(Math.pow(E,P)-1)}(r,s,i.stops[u][0],i.stops[u+1][0]),f=i.stops[u][1],_=i.stops[u+1][1],x=Zi[e.type]||Ul;return typeof f.evaluate=="function"?{evaluate(...w){const E=f.evaluate.apply(void 0,w),I=_.evaluate.apply(void 0,w);if(E!==void 0&&I!==void 0)return x(E,I,p,i.colorSpace)}}:x(f,_,p,i.colorSpace)}function $l(i,e,r){switch(e.type){case"color":r=Xe.parse(r);break;case"formatted":r=Ot.fromString(r.toString());break;case"resolvedImage":r=ir.fromString(r.toString());break;case"padding":r=$i.parse(r);break;default:ut(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return vn(r,i.default,e.default)}qi.register(Nn,{error:[{kind:"error"},[Ke],(i,[e])=>{throw new Vt(e.evaluate(i))}],typeof:[Ke,[Ge],(i,[e])=>bt(Ut(e.evaluate(i)))],"to-rgba":[ci(Te,4),[pi],(i,[e])=>{const[r,s,o,u]=e.evaluate(i).rgb;return[255*r,255*s,255*o,u]}],rgb:[pi,[Te,Te,Te],$o],rgba:[pi,[Te,Te,Te,Te],$o],has:{type:Ye,overloads:[[[Ke],(i,[e])=>qo(e.evaluate(i),i.properties())],[[Ke,Ur],(i,[e,r])=>qo(e.evaluate(i),r.evaluate(i))]]},get:{type:Ge,overloads:[[[Ke],(i,[e])=>Ua(e.evaluate(i),i.properties())],[[Ke,Ur],(i,[e,r])=>Ua(e.evaluate(i),r.evaluate(i))]]},"feature-state":[Ge,[Ke],(i,[e])=>Ua(e.evaluate(i),i.featureState||{})],properties:[Ur,[],i=>i.properties()],"geometry-type":[Ke,[],i=>i.geometryType()],id:[Ge,[],i=>i.id()],zoom:[Te,[],i=>i.globals.zoom],"heatmap-density":[Te,[],i=>i.globals.heatmapDensity||0],"line-progress":[Te,[],i=>i.globals.lineProgress||0],accumulated:[Ge,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Te,xn(Te),(i,e)=>{let r=0;for(const s of e)r+=s.evaluate(i);return r}],"*":[Te,xn(Te),(i,e)=>{let r=1;for(const s of e)r*=s.evaluate(i);return r}],"-":{type:Te,overloads:[[[Te,Te],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[Te],(i,[e])=>-e.evaluate(i)]]},"/":[Te,[Te,Te],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[Te,[Te,Te],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[Te,[],()=>Math.LN2],pi:[Te,[],()=>Math.PI],e:[Te,[],()=>Math.E],"^":[Te,[Te,Te],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[Te,[Te],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[Te,[Te],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[Te,[Te],(i,[e])=>Math.log(e.evaluate(i))],log2:[Te,[Te],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[Te,[Te],(i,[e])=>Math.sin(e.evaluate(i))],cos:[Te,[Te],(i,[e])=>Math.cos(e.evaluate(i))],tan:[Te,[Te],(i,[e])=>Math.tan(e.evaluate(i))],asin:[Te,[Te],(i,[e])=>Math.asin(e.evaluate(i))],acos:[Te,[Te],(i,[e])=>Math.acos(e.evaluate(i))],atan:[Te,[Te],(i,[e])=>Math.atan(e.evaluate(i))],min:[Te,xn(Te),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[Te,xn(Te),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[Te,[Te],(i,[e])=>Math.abs(e.evaluate(i))],round:[Te,[Te],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[Te,[Te],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[Te,[Te],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[Ye,[Ke,Ge],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[Ye,[Ge],(i,[e])=>i.id()===e.value],"filter-type-==":[Ye,[Ke],(i,[e])=>i.geometryType()===e.value],"filter-<":[Ye,[Ke,Ge],(i,[e,r])=>{const s=i.properties()[e.value],o=r.value;return typeof s==typeof o&&s{const r=i.id(),s=e.value;return typeof r==typeof s&&r":[Ye,[Ke,Ge],(i,[e,r])=>{const s=i.properties()[e.value],o=r.value;return typeof s==typeof o&&s>o}],"filter-id->":[Ye,[Ge],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>s}],"filter-<=":[Ye,[Ke,Ge],(i,[e,r])=>{const s=i.properties()[e.value],o=r.value;return typeof s==typeof o&&s<=o}],"filter-id-<=":[Ye,[Ge],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r<=s}],"filter->=":[Ye,[Ke,Ge],(i,[e,r])=>{const s=i.properties()[e.value],o=r.value;return typeof s==typeof o&&s>=o}],"filter-id->=":[Ye,[Ge],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>=s}],"filter-has":[Ye,[Ge],(i,[e])=>e.value in i.properties()],"filter-has-id":[Ye,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[Ye,[ci(Ke)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[Ye,[ci(Ge)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[Ye,[Ke,ci(Ge)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[Ye,[Ke,ci(Ge)],(i,[e,r])=>function(s,o,u,p){for(;u<=p;){const f=u+p>>1;if(o[f]===s)return!0;o[f]>s?p=f-1:u=f+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:Ye,overloads:[[[Ye,Ye],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[xn(Ye),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:Ye,overloads:[[[Ye,Ye],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[xn(Ye),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[Ye,[Ye],(i,[e])=>!e.evaluate(i)],"is-supported-script":[Ye,[Ke],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[Ke,[Ke],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[Ke,[Ke],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[Ke,xn(Ge),(i,e)=>e.map(r=>sn(r.evaluate(i))).join("")],"resolved-locale":[Ke,[Tr],(i,[e])=>e.evaluate(i).resolvedLocale()]});class Lt{constructor(e,r){var s;this.expression=e,this._warningHistory={},this._evaluator=new pt,this._defaultValue=r?(s=r).type==="color"&&Qs(s.default)?new Xe(0,0,0,0):s.type==="color"?Xe.parse(s.default)||null:s.type==="padding"?$i.parse(s.default)||null:s.type==="variableAnchorOffsetCollection"?fi.parse(s.default)||null:s.default===void 0?null:s.default:null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,s,o,u,p){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=s,this._evaluator.canonical=o,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=p,this.expression.evaluate(this._evaluator)}evaluate(e,r,s,o,u,p){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=s||null,this._evaluator.canonical=o,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=p||null;try{const f=this.expression.evaluate(this._evaluator);if(f==null||typeof f=="number"&&f!=f)return this._defaultValue;if(this._enumValues&&!(f in this._enumValues))throw new Vt(`Expected value to be one of ${Object.keys(this._enumValues).map(_=>JSON.stringify(_)).join(", ")}, but found ${JSON.stringify(f)} instead.`);return f}catch(f){return this._warningHistory[f.message]||(this._warningHistory[f.message]=!0,typeof console<"u"&&console.warn(f.message)),this._defaultValue}}}function ea(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in Nn}function nt(i,e){const r=new Ns(Nn,as,[],e?function(o){const u={color:pi,string:Ke,number:Te,enum:Ke,boolean:Ye,formatted:Er,padding:rn,resolvedImage:tr,variableAnchorOffsetCollection:nn};return o.type==="array"?ci(u[o.value]||Ge,o.length):u[o.type]}(e):void 0),s=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?Zo(new Lt(s,e)):$n(r.errors)}class us{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!os(r.expression)}evaluateWithoutErrorHandling(e,r,s,o,u,p){return this._styleExpression.evaluateWithoutErrorHandling(e,r,s,o,u,p)}evaluate(e,r,s,o,u,p){return this._styleExpression.evaluate(e,r,s,o,u,p)}}class wt{constructor(e,r,s,o){this.kind=e,this.zoomStops=s,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!os(r.expression),this.interpolationType=o}evaluateWithoutErrorHandling(e,r,s,o,u,p){return this._styleExpression.evaluateWithoutErrorHandling(e,r,s,o,u,p)}evaluate(e,r,s,o,u,p){return this._styleExpression.evaluate(e,r,s,o,u,p)}interpolationFactor(e,r,s){return this.interpolationType?ji.interpolationFactor(this.interpolationType,e,r,s):0}}function Tt(i,e){const r=nt(i,e);if(r.result==="error")return r;const s=r.value.expression,o=Xs(s);if(!o&&!qn(e))return $n([new zi("","data expressions not supported")]);const u=ls(s,["zoom"]);if(!u&&!jo(e))return $n([new zi("","zoom expressions not supported")]);const p=ds(s);return p||u?p instanceof zi?$n([p]):p instanceof ji&&!Va(e)?$n([new zi("",'"interpolate" expressions cannot be used with this property')]):Zo(p?new wt(o?"camera":"composite",r.value,p.labels,p instanceof ji?p.interpolation:void 0):new us(o?"constant":"source",r.value)):$n([new zi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class bn{constructor(e,r){this._parameters=e,this._specification=r,Ai(this,Go(this._parameters,this._specification))}static deserialize(e){return new bn(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function ds(i){let e=null;if(i instanceof On)e=ds(i.result);else if(i instanceof Hs){for(const r of i.args)if(e=ds(r),e)break}else(i instanceof hs||i instanceof ji)&&i.input instanceof qi&&i.input.name==="zoom"&&(e=i);return e instanceof zi||i.eachChild(r=>{const s=ds(r);s instanceof zi?e=s:!e&&s?e=new zi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&s&&e!==s&&(e=new zi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Na(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!Na(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const ql={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function $a(i){if(i==null)return{filter:()=>!0,needGeometry:!1};Na(i)||(i=ps(i));const e=nt(i,ql);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,s,o)=>e.value.evaluate(r,s,{},o),needGeometry:qa(i)}}function Zl(i,e){return ie?1:0}function qa(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e"||e==="<="||e===">="?ta(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(ps))):e==="all"?["all"].concat(i.slice(1).map(ps)):e==="none"?["all"].concat(i.slice(1).map(ps).map(ra)):e==="in"?Za(i[1],i.slice(2)):e==="!in"?ra(Za(i[1],i.slice(2))):e==="has"?ia(i[1]):e==="!has"?ra(ia(i[1])):e!=="within"||i;var r}function ta(i,e,r){switch(i){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,i,e]}}function Za(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",i,["literal",e.sort(Zl)]]:["filter-in-small",i,["literal",e]]}}function ia(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function ra(i){return["!",i]}function ja(i){const e=typeof i;if(e==="number"||e==="boolean"||e==="string"||i==null)return JSON.stringify(i);if(Array.isArray(i)){let o="[";for(const u of i)o+=`${ja(u)},`;return`${o}]`}const r=Object.keys(i).sort();let s="{";for(let o=0;os.maximum?[new we(e,r,`${r} is greater than the maximum value ${s.maximum}`)]:[]}function Xa(i){const e=i.valueSpec,r=Nt(i.value.type);let s,o,u,p={};const f=r!=="categorical"&&i.value.property===void 0,_=!f,x=ut(i.value.stops)==="array"&&ut(i.value.stops[0])==="array"&&ut(i.value.stops[0][0])==="object",w=rr({key:i.key,value:i.value,valueSpec:i.styleSpec.function,validateSpec:i.validateSpec,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(M){if(r==="identity")return[new we(M.key,M.value,'identity function may not have a "stops" property')];let P=[];const B=M.value;return P=P.concat(Ga({key:M.key,value:B,valueSpec:M.valueSpec,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec,arrayElementValidator:E})),ut(B)==="array"&&B.length===0&&P.push(new we(M.key,B,"array must have at least one stop")),P},default:function(M){return M.validateSpec({key:M.key,value:M.value,valueSpec:e,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec})}}});return r==="identity"&&f&&w.push(new we(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||w.push(new we(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!Va(i.valueSpec)&&w.push(new we(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(_&&!qn(i.valueSpec)?w.push(new we(i.key,i.value,"property functions not supported")):f&&!jo(i.valueSpec)&&w.push(new we(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!x||i.value.property!==void 0||w.push(new we(i.key,i.value,'"property" property is required')),w;function E(M){let P=[];const B=M.value,U=M.key;if(ut(B)!=="array")return[new we(U,B,`array expected, ${ut(B)} found`)];if(B.length!==2)return[new we(U,B,`array length 2 expected, length ${B.length} found`)];if(x){if(ut(B[0])!=="object")return[new we(U,B,`object expected, ${ut(B[0])} found`)];if(B[0].zoom===void 0)return[new we(U,B,"object stop key must have zoom")];if(B[0].value===void 0)return[new we(U,B,"object stop key must have value")];if(u&&u>Nt(B[0].zoom))return[new we(U,B[0].zoom,"stop zoom values must appear in ascending order")];Nt(B[0].zoom)!==u&&(u=Nt(B[0].zoom),o=void 0,p={}),P=P.concat(rr({key:`${U}[0]`,value:B[0],valueSpec:{zoom:{}},validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec,objectElementValidators:{zoom:na,value:I}}))}else P=P.concat(I({key:`${U}[0]`,value:B[0],valueSpec:{},validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec},B));return ea(wn(B[1]))?P.concat([new we(`${U}[1]`,B[1],"expressions are not allowed in function stops.")]):P.concat(M.validateSpec({key:`${U}[1]`,value:B[1],valueSpec:e,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec}))}function I(M,P){const B=ut(M.value),U=Nt(M.value),$=M.value!==null?M.value:P;if(s){if(B!==s)return[new we(M.key,$,`${B} stop domain type must match previous stop domain type ${s}`)]}else s=B;if(B!=="number"&&B!=="string"&&B!=="boolean")return[new we(M.key,$,"stop domain value must be a number, string, or boolean")];if(B!=="number"&&r!=="categorical"){let Q=`number expected, ${B} found`;return qn(e)&&r===void 0&&(Q+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new we(M.key,$,Q)]}return r!=="categorical"||B!=="number"||isFinite(U)&&Math.floor(U)===U?r!=="categorical"&&B==="number"&&o!==void 0&&Unew we(`${i.key}${s.key}`,i.value,s.message));const r=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new we(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!os(r))return[new we(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!os(r))return[new we(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!ls(r,["zoom","feature-state"]))return[new we(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!Xs(r))return[new we(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function fs(i){const e=i.key,r=i.value,s=i.valueSpec,o=[];return Array.isArray(s.values)?s.values.indexOf(Nt(r))===-1&&o.push(new we(e,r,`expected one of [${s.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(s.values).indexOf(Nt(r))===-1&&o.push(new we(e,r,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(r)} found`)),o}function sa(i){return Na(wn(i.value))?Vr(Ai({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Ho(i)}function Ho(i){const e=i.value,r=i.key;if(ut(e)!=="array")return[new we(r,e,`array expected, ${ut(e)} found`)];const s=i.styleSpec;let o,u=[];if(e.length<1)return[new we(r,e,"filter array must have at least 1 element")];switch(u=u.concat(fs({key:`${r}[0]`,value:e[0],valueSpec:s.filter_operator,style:i.style,styleSpec:i.styleSpec})),Nt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Nt(e[1])==="$type"&&u.push(new we(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&u.push(new we(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(o=ut(e[1]),o!=="string"&&u.push(new we(`${r}[1]`,e[1],`string expected, ${o} found`)));for(let p=2;p{x in r&&e.push(new we(s,r[x],`"${x}" is prohibited for ref layers`))}),o.layers.forEach(x=>{Nt(x.id)===f&&(_=x)}),_?_.ref?e.push(new we(s,r.ref,"ref cannot reference another ref layer")):p=Nt(_.type):e.push(new we(s,r.ref,`ref layer "${f}" not found`))}else if(p!=="background")if(r.source){const _=o.sources&&o.sources[r.source],x=_&&Nt(_.type);_?x==="vector"&&p==="raster"?e.push(new we(s,r.source,`layer "${r.id}" requires a raster source`)):x==="raster"&&p!=="raster"?e.push(new we(s,r.source,`layer "${r.id}" requires a vector source`)):x!=="vector"||r["source-layer"]?x==="raster-dem"&&p!=="hillshade"?e.push(new we(s,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):p!=="line"||!r.paint||!r.paint["line-gradient"]||x==="geojson"&&_.lineMetrics||e.push(new we(s,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new we(s,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new we(s,r.source,`source "${r.source}" not found`))}else e.push(new we(s,r,'missing required property "source"'));return e=e.concat(rr({key:s,value:r,valueSpec:u.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${s}.type`,value:r.type,valueSpec:u.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:r,objectKey:"type"}),filter:sa,layout:_=>rr({layer:r,key:_.key,value:_.value,style:_.style,styleSpec:_.styleSpec,validateSpec:_.validateSpec,objectElementValidators:{"*":x=>oa(Ai({layerType:p},x))}}),paint:_=>rr({layer:r,key:_.key,value:_.value,style:_.style,styleSpec:_.styleSpec,validateSpec:_.validateSpec,objectElementValidators:{"*":x=>ms(Ai({layerType:p},x))}})}})),e}function on(i){const e=i.value,r=i.key,s=ut(e);return s!=="string"?[new we(r,e,`string expected, ${s} found`)]:[]}const Ko={promoteId:function({key:i,value:e}){if(ut(e)==="string")return on({key:i,value:e});{const r=[];for(const s in e)r.push(...on({key:`${i}.${s}`,value:e[s]}));return r}}};function gs(i){const e=i.value,r=i.key,s=i.styleSpec,o=i.style,u=i.validateSpec;if(!e.type)return[new we(r,e,'"type" is required')];const p=Nt(e.type);let f;switch(p){case"vector":case"raster":case"raster-dem":return f=rr({key:r,value:e,valueSpec:s[`source_${p.replace("-","_")}`],style:i.style,styleSpec:s,objectElementValidators:Ko,validateSpec:u}),f;case"geojson":if(f=rr({key:r,value:e,valueSpec:s.source_geojson,style:o,styleSpec:s,validateSpec:u,objectElementValidators:Ko}),e.cluster)for(const _ in e.clusterProperties){const[x,w]=e.clusterProperties[_],E=typeof x=="string"?[x,["accumulated"],["get",_]]:x;f.push(...Vr({key:`${r}.${_}.map`,value:w,validateSpec:u,expressionContext:"cluster-map"})),f.push(...Vr({key:`${r}.${_}.reduce`,value:E,validateSpec:u,expressionContext:"cluster-reduce"}))}return f;case"video":return rr({key:r,value:e,valueSpec:s.source_video,style:o,validateSpec:u,styleSpec:s});case"image":return rr({key:r,value:e,valueSpec:s.source_image,style:o,validateSpec:u,styleSpec:s});case"canvas":return[new we(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return fs({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:o,validateSpec:u,styleSpec:s})}}function Yo(i){const e=i.value,r=i.styleSpec,s=r.light,o=i.style;let u=[];const p=ut(e);if(e===void 0)return u;if(p!=="object")return u=u.concat([new we("light",e,`object expected, ${p} found`)]),u;for(const f in e){const _=f.match(/^(.*)-transition$/);u=u.concat(_&&s[_[1]]&&s[_[1]].transition?i.validateSpec({key:f,value:e[f],valueSpec:r.transition,validateSpec:i.validateSpec,style:o,styleSpec:r}):s[f]?i.validateSpec({key:f,value:e[f],valueSpec:s[f],validateSpec:i.validateSpec,style:o,styleSpec:r}):[new we(f,e[f],`unknown property "${f}"`)])}return u}function Jo(i){const e=i.value,r=i.styleSpec,s=r.terrain,o=i.style;let u=[];const p=ut(e);if(e===void 0)return u;if(p!=="object")return u=u.concat([new we("terrain",e,`object expected, ${p} found`)]),u;for(const f in e)u=u.concat(s[f]?i.validateSpec({key:f,value:e[f],valueSpec:s[f],validateSpec:i.validateSpec,style:o,styleSpec:r}):[new we(f,e[f],`unknown property "${f}"`)]);return u}function Qo(i){let e=[];const r=i.value,s=i.key;if(Array.isArray(r)){const o=[],u=[];for(const p in r)r[p].id&&o.includes(r[p].id)&&e.push(new we(s,r,`all the sprites' ids must be unique, but ${r[p].id} is duplicated`)),o.push(r[p].id),r[p].url&&u.includes(r[p].url)&&e.push(new we(s,r,`all the sprites' URLs must be unique, but ${r[p].url} is duplicated`)),u.push(r[p].url),e=e.concat(rr({key:`${s}[${p}]`,value:r[p],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return e}return on({key:s,value:r})}const el={"*":()=>[],array:Ga,boolean:function(i){const e=i.value,r=i.key,s=ut(e);return s!=="boolean"?[new we(r,e,`boolean expected, ${s} found`)]:[]},number:na,color:function(i){const e=i.key,r=i.value,s=ut(r);return s!=="string"?[new we(e,r,`color expected, ${s} found`)]:Xe.parse(String(r))?[]:[new we(e,r,`color expected, "${r}" found`)]},constants:Wo,enum:fs,filter:sa,function:Xa,layer:la,object:rr,source:gs,light:Yo,terrain:Jo,string:on,formatted:function(i){return on(i).length===0?[]:Vr(i)},resolvedImage:function(i){return on(i).length===0?[]:Vr(i)},padding:function(i){const e=i.key,r=i.value;if(ut(r)==="array"){if(r.length<1||r.length>4)return[new we(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const s={type:"number"};let o=[];for(let u=0;u[]}})),i.constants&&(r=r.concat(Wo({key:"constants",value:i.constants,style:i,styleSpec:e,validateSpec:_s}))),xs(r)}function Xt(i){return function(e){return i({...e,validateSpec:_s})}}function xs(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function Nr(i){return function(...e){return xs(i.apply(this,e))}}Gi.source=Nr(Xt(gs)),Gi.sprite=Nr(Xt(Qo)),Gi.glyphs=Nr(Xt(ys)),Gi.light=Nr(Xt(Yo)),Gi.terrain=Nr(Xt(Jo)),Gi.layer=Nr(Xt(la)),Gi.filter=Nr(Xt(sa)),Gi.paintProperty=Nr(Xt(ms)),Gi.layoutProperty=Nr(Xt(oa));const vs=Gi,Gl=vs.light,bs=vs.paintProperty,Xl=vs.layoutProperty;function ca(i,e){let r=!1;if(e&&e.length)for(const s of e)i.fire(new Ni(new Error(s.message))),r=!0;return r}class ws{constructor(e,r,s){const o=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const p=new Int32Array(this.arrayBuffer);e=p[0],this.d=(r=p[1])+2*(s=p[2]);for(let _=0;_=E[P+0]&&o>=E[P+1])?(f[M]=!0,p.push(w[M])):f[M]=!1}}}}_forEachCell(e,r,s,o,u,p,f,_){const x=this._convertToCellCoord(e),w=this._convertToCellCoord(r),E=this._convertToCellCoord(s),I=this._convertToCellCoord(o);for(let M=x;M<=E;M++)for(let P=w;P<=I;P++){const B=this.d*P+M;if((!_||_(this._convertFromCellCoord(M),this._convertFromCellCoord(P),this._convertFromCellCoord(M+1),this._convertFromCellCoord(P+1)))&&u.call(this,e,r,s,o,B,p,f,_))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,r=3+this.cells.length+1+1;let s=0;for(let p=0;p=0)continue;const p=i[u];o[u]=Ar[s].shallow.indexOf(u)>=0?p:Ts(p,e)}i instanceof Error&&(o.message=i.message)}if(o.$name)throw new Error("$name property is reserved for worker serialization logic.");return s!=="Object"&&(o.$name=s),o}throw new Error("can't serialize object of type "+typeof i)}function Tn(i){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||Zn(i)||Ti(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(Tn);if(typeof i=="object"){const e=i.$name||"Object";if(!Ar[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=Ar[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(i);const s=Object.create(r.prototype);for(const o of Object.keys(i)){if(o==="$name")continue;const u=i[o];s[o]=Ar[e].shallow.indexOf(o)>=0?u:Tn(u)}return s}throw new Error("can't deserialize object of type "+typeof i)}class Wa{constructor(){this.first=!0}update(e,r){const s=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=s,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=s,!0):(this.lastFloorZoom>s?(this.lastIntegerZoom=s+1,this.lastIntegerZoomTime=r):this.lastFloorZoomi>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function ha(i){for(const e of i)if(Es(e.charCodeAt(0)))return!0;return!1}function tl(i){for(const e of i)if(!Wl(e.charCodeAt(0)))return!1;return!0}function Wl(i){return!(Ie.Arabic(i)||Ie["Arabic Supplement"](i)||Ie["Arabic Extended-A"](i)||Ie["Arabic Presentation Forms-A"](i)||Ie["Arabic Presentation Forms-B"](i))}function Es(i){return!(i!==746&&i!==747&&(i<4352||!(Ie["Bopomofo Extended"](i)||Ie.Bopomofo(i)||Ie["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||Ie["CJK Compatibility Ideographs"](i)||Ie["CJK Compatibility"](i)||Ie["CJK Radicals Supplement"](i)||Ie["CJK Strokes"](i)||!(!Ie["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||Ie["CJK Unified Ideographs Extension A"](i)||Ie["CJK Unified Ideographs"](i)||Ie["Enclosed CJK Letters and Months"](i)||Ie["Hangul Compatibility Jamo"](i)||Ie["Hangul Jamo Extended-A"](i)||Ie["Hangul Jamo Extended-B"](i)||Ie["Hangul Jamo"](i)||Ie["Hangul Syllables"](i)||Ie.Hiragana(i)||Ie["Ideographic Description Characters"](i)||Ie.Kanbun(i)||Ie["Kangxi Radicals"](i)||Ie["Katakana Phonetic Extensions"](i)||Ie.Katakana(i)&&i!==12540||!(!Ie["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!Ie["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||Ie["Unified Canadian Aboriginal Syllabics"](i)||Ie["Unified Canadian Aboriginal Syllabics Extended"](i)||Ie["Vertical Forms"](i)||Ie["Yijing Hexagram Symbols"](i)||Ie["Yi Syllables"](i)||Ie["Yi Radicals"](i))))}function Ss(i){return!(Es(i)||function(e){return!!(Ie["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||Ie["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||Ie["Letterlike Symbols"](e)||Ie["Number Forms"](e)||Ie["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||Ie["Control Pictures"](e)&&e!==9251||Ie["Optical Character Recognition"](e)||Ie["Enclosed Alphanumerics"](e)||Ie["Geometric Shapes"](e)||Ie["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||Ie["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Ie["CJK Symbols and Punctuation"](e)||Ie.Katakana(e)||Ie["Private Use Area"](e)||Ie["CJK Compatibility Forms"](e)||Ie["Small Form Variants"](e)||Ie["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(i))}function Ha(i){return i>=1424&&i<=2303||Ie["Arabic Presentation Forms-A"](i)||Ie["Arabic Presentation Forms-B"](i)}function Hl(i,e){return!(!e&&Ha(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||Ie.Khmer(i))}function il(i){for(const e of i)if(Ha(e.charCodeAt(0)))return!0;return!1}const Ka="deferred",Is="loading",Ya="loaded";let Ja=null,Di="unavailable",ln=null;const Qa=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(Di="error"),Ja&&Ja(i)};function eo(){to.fire(new Ii("pluginStateChange",{pluginStatus:Di,pluginURL:ln}))}const to=new pr,io=function(){return Di},rl=function(){if(Di!==Ka||!ln)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Di=Is,eo(),ln&&Br({url:ln},i=>{i?Qa(i):(Di=Ya,eo())})},nr={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Di===Ya||nr.applyArabicShaping!=null,isLoading:()=>Di===Is,setState(i){if(!Pi())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Di=i.pluginStatus,ln=i.pluginURL},isParsed(){if(!Pi())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return nr.applyArabicShaping!=null&&nr.processBidirectionalText!=null&&nr.processStyledBidirectionalText!=null},getPluginURL(){if(!Pi())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return ln}};class St{constructor(e,r){this.zoom=e,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Wa,this.transition={})}isSupportedScript(e){return function(r,s){for(const o of r)if(!Hl(o.charCodeAt(0),s))return!1;return!0}(e,nr.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,r=e-Math.floor(e),s=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*s}:{fromScale:.5,toScale:1,t:1-(1-s)*r}}}class ua{constructor(e,r){this.property=e,this.value=r,this.expression=function(s,o){if(Qs(s))return new bn(s,o);if(ea(s)){const u=Tt(s,o);if(u.result==="error")throw new Error(u.value.map(p=>`${p.key}: ${p.message}`).join(", "));return u.value}{let u=s;return o.type==="color"&&typeof s=="string"?u=Xe.parse(s):o.type!=="padding"||typeof s!="number"&&!Array.isArray(s)?o.type==="variableAnchorOffsetCollection"&&Array.isArray(s)&&(u=fi.parse(s)):u=$i.parse(s),{kind:"constant",evaluate:()=>u}}}(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,s){return this.property.possiblyEvaluate(this,e,r,s)}}class jn{constructor(e){this.property=e,this.value=new ua(e,void 0)}transitioned(e,r){return new da(this.property,this.value,r,Jt({},e.transition,this.transition),e.now)}untransitioned(){return new da(this.property,this.value,null,{},0)}}class nl{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return wi(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new jn(this._values[e].property)),this._values[e].value=new ua(this._values[e].property,r===null?void 0:wi(r))}getTransition(e){return wi(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new jn(this._values[e].property)),this._values[e].transition=wi(r)||void 0}serialize(){const e={};for(const r of Object.keys(this._values)){const s=this.getValue(r);s!==void 0&&(e[r]=s);const o=this.getTransition(r);o!==void 0&&(e[`${r}-transition`]=o)}return e}transitioned(e,r){const s=new sl(this._properties);for(const o of Object.keys(this._values))s._values[o]=this._values[o].transitioned(e,r._values[o]);return s}untransitioned(){const e=new sl(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class da{constructor(e,r,s,o,u){this.property=e,this.value=r,this.begin=u+o.delay||0,this.end=this.begin+o.duration||0,e.specification.transition&&(o.delay||o.duration)&&(this.prior=s)}possiblyEvaluate(e,r,s){const o=e.now||0,u=this.value.possiblyEvaluate(e,r,s),p=this.prior;if(p){if(o>this.end)return this.prior=null,u;if(this.value.isDataDriven())return this.prior=null,u;if(o=1)return 1;const x=_*_,w=x*_;return 4*(_<.5?w:3*(_-x)+w-.75)}(f))}}return u}}class sl{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,s){const o=new As(this._properties);for(const u of Object.keys(this._values))o._values[u]=this._values[u].possiblyEvaluate(e,r,s);return o}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Kl{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return wi(this._values[e].value)}setValue(e,r){this._values[e]=new ua(this._values[e].property,r===null?void 0:wi(r))}serialize(){const e={};for(const r of Object.keys(this._values)){const s=this.getValue(r);s!==void 0&&(e[r]=s)}return e}possiblyEvaluate(e,r,s){const o=new As(this._properties);for(const u of Object.keys(this._values))o._values[u]=this._values[u].possiblyEvaluate(e,r,s);return o}}class fr{constructor(e,r,s){this.property=e,this.value=r,this.parameters=s}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,s,o){return this.property.evaluate(this.value,this.parameters,e,r,s,o)}}class As{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Ue{constructor(e){this.specification=e}possiblyEvaluate(e,r){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(r)}interpolate(e,r,s){const o=Zi[this.specification.type];return o?o(e,r,s):e}}class je{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,s,o){return new fr(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(r,null,{},s,o)}:e.expression,r)}interpolate(e,r,s){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new fr(this,{kind:"constant",value:void 0},e.parameters);const o=Zi[this.specification.type];if(o){const u=o(e.value.value,r.value.value,s);return new fr(this,{kind:"constant",value:u},e.parameters)}return e}evaluate(e,r,s,o,u,p){return e.kind==="constant"?e.value:e.evaluate(r,s,o,u,p)}}class pa extends je{possiblyEvaluate(e,r,s,o){if(e.value===void 0)return new fr(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const u=e.expression.evaluate(r,null,{},s,o),p=e.property.specification.type==="resolvedImage"&&typeof u!="string"?u.name:u,f=this._calculate(p,p,p,r);return new fr(this,{kind:"constant",value:f},r)}if(e.expression.kind==="camera"){const u=this._calculate(e.expression.evaluate({zoom:r.zoom-1}),e.expression.evaluate({zoom:r.zoom}),e.expression.evaluate({zoom:r.zoom+1}),r);return new fr(this,{kind:"constant",value:u},r)}return new fr(this,e.expression,r)}evaluate(e,r,s,o,u,p){if(e.kind==="source"){const f=e.evaluate(r,s,o,u,p);return this._calculate(f,f,f,r)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},s,o),e.evaluate({zoom:Math.floor(r.zoom)},s,o),e.evaluate({zoom:Math.floor(r.zoom)+1},s,o),r):e.value}_calculate(e,r,s,o){return o.zoom>o.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:s,to:r}}interpolate(e){return e}}class ro{constructor(e){this.specification=e}possiblyEvaluate(e,r,s,o){if(e.value!==void 0){if(e.expression.kind==="constant"){const u=e.expression.evaluate(r,null,{},s,o);return this._calculate(u,u,u,r)}return this._calculate(e.expression.evaluate(new St(Math.floor(r.zoom-1),r)),e.expression.evaluate(new St(Math.floor(r.zoom),r)),e.expression.evaluate(new St(Math.floor(r.zoom+1),r)),r)}}_calculate(e,r,s,o){return o.zoom>o.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:s,to:r}}interpolate(e){return e}}class no{constructor(e){this.specification=e}possiblyEvaluate(e,r,s,o){return!!e.expression.evaluate(r,null,{},s,o)}interpolate(){return!1}}class Li{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in e){const s=e[r];s.specification.overridable&&this.overridableProperties.push(r);const o=this.defaultPropertyValues[r]=new ua(s,void 0),u=this.defaultTransitionablePropertyValues[r]=new jn(s);this.defaultTransitioningPropertyValues[r]=u.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=o.possiblyEvaluate({})}}}Pe("DataDrivenProperty",je),Pe("DataConstantProperty",Ue),Pe("CrossFadedDataDrivenProperty",pa),Pe("CrossFadedProperty",ro),Pe("ColorRampProperty",no);const En="-transition";class Cr extends pr{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new Kl(r.layout)),r.paint)){this._transitionablePaint=new nl(r.paint);for(const s in e.paint)this.setPaintProperty(s,e.paint[s],{validate:!1});for(const s in e.layout)this.setLayoutProperty(s,e.layout[s],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new As(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,s={}){r!=null&&this._validate(Xl,`layers.${this.id}.layout.${e}`,e,r,s)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(En)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,s={}){if(r!=null&&this._validate(bs,`layers.${this.id}.paint.${e}`,e,r,s))return!1;if(e.endsWith(En))return this._transitionablePaint.setTransition(e.slice(0,-11),r||void 0),!1;{const o=this._transitionablePaint._values[e],u=o.property.specification["property-type"]==="cross-faded-data-driven",p=o.value.isDataDriven(),f=o.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const _=this._transitionablePaint._values[e].value;return _.isDataDriven()||p||u||this._handleOverridablePaintPropertyUpdate(e,f,_)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,s){return!1}isHidden(e){return!!(this.minzoom&&e=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){const e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),Jr(e,(r,s)=>!(r===void 0||s==="layout"&&!Object.keys(r).length||s==="paint"&&!Object.keys(r).length))}_validate(e,r,s,o,u={}){return(!u||u.validate!==!1)&&ca(this,e.call(vs,{key:r,layerType:this.type,objectKey:s,value:o,styleSpec:le,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const r=this.paint.get(e);if(r instanceof fr&&qn(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const Yl={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Cs{constructor(e,r){this._structArray=e,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Pt{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,r){return e._trim(),r&&(e.isTransferred=!0,r.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const r=Object.create(this.prototype);return r.arrayBuffer=e.arrayBuffer,r.length=e.length,r.capacity=e.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_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(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function $t(i,e=1){let r=0,s=0;return{members:i.map(o=>{const u=Yl[o.type].BYTES_PER_ELEMENT,p=r=al(r,Math.max(e,u)),f=o.components||1;return s=Math.max(s,u),r+=u*f,{name:o.name,type:o.type,components:f,offset:p}}),size:al(r,Math.max(s,e)),alignment:e}}function al(i,e){return Math.ceil(i/e)*e}class sr extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const o=2*e;return this.int16[o+0]=r,this.int16[o+1]=s,e}}sr.prototype.bytesPerElement=4,Pe("StructArrayLayout2i4",sr);class Ms extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,r,s)}emplace(e,r,s,o){const u=3*e;return this.int16[u+0]=r,this.int16[u+1]=s,this.int16[u+2]=o,e}}Ms.prototype.bytesPerElement=6,Pe("StructArrayLayout3i6",Ms);class Ps extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,o){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,s,o)}emplace(e,r,s,o,u){const p=4*e;return this.int16[p+0]=r,this.int16[p+1]=s,this.int16[p+2]=o,this.int16[p+3]=u,e}}Ps.prototype.bytesPerElement=8,Pe("StructArrayLayout4i8",Ps);class fa extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,o,u,p){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,o,u,p)}emplace(e,r,s,o,u,p,f){const _=6*e;return this.int16[_+0]=r,this.int16[_+1]=s,this.int16[_+2]=o,this.int16[_+3]=u,this.int16[_+4]=p,this.int16[_+5]=f,e}}fa.prototype.bytesPerElement=12,Pe("StructArrayLayout2i4i12",fa);class zs extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,o,u,p){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,o,u,p)}emplace(e,r,s,o,u,p,f){const _=4*e,x=8*e;return this.int16[_+0]=r,this.int16[_+1]=s,this.uint8[x+4]=o,this.uint8[x+5]=u,this.uint8[x+6]=p,this.uint8[x+7]=f,e}}zs.prototype.bytesPerElement=8,Pe("StructArrayLayout2i4ub8",zs);class ks extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const o=2*e;return this.float32[o+0]=r,this.float32[o+1]=s,e}}ks.prototype.bytesPerElement=8,Pe("StructArrayLayout2f8",ks);class Gn extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,o,u,p,f,_,x,w){const E=this.length;return this.resize(E+1),this.emplace(E,e,r,s,o,u,p,f,_,x,w)}emplace(e,r,s,o,u,p,f,_,x,w,E){const I=10*e;return this.uint16[I+0]=r,this.uint16[I+1]=s,this.uint16[I+2]=o,this.uint16[I+3]=u,this.uint16[I+4]=p,this.uint16[I+5]=f,this.uint16[I+6]=_,this.uint16[I+7]=x,this.uint16[I+8]=w,this.uint16[I+9]=E,e}}Gn.prototype.bytesPerElement=20,Pe("StructArrayLayout10ui20",Gn);class Sn extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,o,u,p,f,_,x,w,E,I){const M=this.length;return this.resize(M+1),this.emplace(M,e,r,s,o,u,p,f,_,x,w,E,I)}emplace(e,r,s,o,u,p,f,_,x,w,E,I,M){const P=12*e;return this.int16[P+0]=r,this.int16[P+1]=s,this.int16[P+2]=o,this.int16[P+3]=u,this.uint16[P+4]=p,this.uint16[P+5]=f,this.uint16[P+6]=_,this.uint16[P+7]=x,this.int16[P+8]=w,this.int16[P+9]=E,this.int16[P+10]=I,this.int16[P+11]=M,e}}Sn.prototype.bytesPerElement=24,Pe("StructArrayLayout4i4ui4i24",Sn);class so extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,r,s)}emplace(e,r,s,o){const u=3*e;return this.float32[u+0]=r,this.float32[u+1]=s,this.float32[u+2]=o,e}}so.prototype.bytesPerElement=12,Pe("StructArrayLayout3f12",so);class ma extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint32[1*e+0]=r,e}}ma.prototype.bytesPerElement=4,Pe("StructArrayLayout1ul4",ma);class In extends Pt{_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(e,r,s,o,u,p,f,_,x){const w=this.length;return this.resize(w+1),this.emplace(w,e,r,s,o,u,p,f,_,x)}emplace(e,r,s,o,u,p,f,_,x,w){const E=10*e,I=5*e;return this.int16[E+0]=r,this.int16[E+1]=s,this.int16[E+2]=o,this.int16[E+3]=u,this.int16[E+4]=p,this.int16[E+5]=f,this.uint32[I+3]=_,this.uint16[E+8]=x,this.uint16[E+9]=w,e}}In.prototype.bytesPerElement=20,Pe("StructArrayLayout6i1ul2ui20",In);class ao extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,o,u,p){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,o,u,p)}emplace(e,r,s,o,u,p,f){const _=6*e;return this.int16[_+0]=r,this.int16[_+1]=s,this.int16[_+2]=o,this.int16[_+3]=u,this.int16[_+4]=p,this.int16[_+5]=f,e}}ao.prototype.bytesPerElement=12,Pe("StructArrayLayout2i2i2i12",ao);class oo extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,o,u){const p=this.length;return this.resize(p+1),this.emplace(p,e,r,s,o,u)}emplace(e,r,s,o,u,p){const f=4*e,_=8*e;return this.float32[f+0]=r,this.float32[f+1]=s,this.float32[f+2]=o,this.int16[_+6]=u,this.int16[_+7]=p,e}}oo.prototype.bytesPerElement=16,Pe("StructArrayLayout2f1f2i16",oo);class ga extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,o){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,s,o)}emplace(e,r,s,o,u){const p=12*e,f=3*e;return this.uint8[p+0]=r,this.uint8[p+1]=s,this.float32[f+1]=o,this.float32[f+2]=u,e}}ga.prototype.bytesPerElement=12,Pe("StructArrayLayout2ub2f12",ga);class _a extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,r,s)}emplace(e,r,s,o){const u=3*e;return this.uint16[u+0]=r,this.uint16[u+1]=s,this.uint16[u+2]=o,e}}_a.prototype.bytesPerElement=6,Pe("StructArrayLayout3ui6",_a);class lo extends Pt{_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(e,r,s,o,u,p,f,_,x,w,E,I,M,P,B,U,$){const Q=this.length;return this.resize(Q+1),this.emplace(Q,e,r,s,o,u,p,f,_,x,w,E,I,M,P,B,U,$)}emplace(e,r,s,o,u,p,f,_,x,w,E,I,M,P,B,U,$,Q){const W=24*e,ie=12*e,se=48*e;return this.int16[W+0]=r,this.int16[W+1]=s,this.uint16[W+2]=o,this.uint16[W+3]=u,this.uint32[ie+2]=p,this.uint32[ie+3]=f,this.uint32[ie+4]=_,this.uint16[W+10]=x,this.uint16[W+11]=w,this.uint16[W+12]=E,this.float32[ie+7]=I,this.float32[ie+8]=M,this.uint8[se+36]=P,this.uint8[se+37]=B,this.uint8[se+38]=U,this.uint32[ie+10]=$,this.int16[W+22]=Q,e}}lo.prototype.bytesPerElement=48,Pe("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",lo);class ct extends Pt{_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(e,r,s,o,u,p,f,_,x,w,E,I,M,P,B,U,$,Q,W,ie,se,he,Ce,Re,Ae,Se,ve,ze){const be=this.length;return this.resize(be+1),this.emplace(be,e,r,s,o,u,p,f,_,x,w,E,I,M,P,B,U,$,Q,W,ie,se,he,Ce,Re,Ae,Se,ve,ze)}emplace(e,r,s,o,u,p,f,_,x,w,E,I,M,P,B,U,$,Q,W,ie,se,he,Ce,Re,Ae,Se,ve,ze,be){const ye=32*e,qe=16*e;return this.int16[ye+0]=r,this.int16[ye+1]=s,this.int16[ye+2]=o,this.int16[ye+3]=u,this.int16[ye+4]=p,this.int16[ye+5]=f,this.int16[ye+6]=_,this.int16[ye+7]=x,this.uint16[ye+8]=w,this.uint16[ye+9]=E,this.uint16[ye+10]=I,this.uint16[ye+11]=M,this.uint16[ye+12]=P,this.uint16[ye+13]=B,this.uint16[ye+14]=U,this.uint16[ye+15]=$,this.uint16[ye+16]=Q,this.uint16[ye+17]=W,this.uint16[ye+18]=ie,this.uint16[ye+19]=se,this.uint16[ye+20]=he,this.uint16[ye+21]=Ce,this.uint16[ye+22]=Re,this.uint32[qe+12]=Ae,this.float32[qe+13]=Se,this.float32[qe+14]=ve,this.uint16[ye+30]=ze,this.uint16[ye+31]=be,e}}ct.prototype.bytesPerElement=64,Pe("StructArrayLayout8i15ui1ul2f2ui64",ct);class h extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.float32[1*e+0]=r,e}}h.prototype.bytesPerElement=4,Pe("StructArrayLayout1f4",h);class t extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,r,s)}emplace(e,r,s,o){const u=3*e;return this.uint16[6*e+0]=r,this.float32[u+1]=s,this.float32[u+2]=o,e}}t.prototype.bytesPerElement=12,Pe("StructArrayLayout1ui2f12",t);class n extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,r,s)}emplace(e,r,s,o){const u=4*e;return this.uint32[2*e+0]=r,this.uint16[u+2]=s,this.uint16[u+3]=o,e}}n.prototype.bytesPerElement=8,Pe("StructArrayLayout1ul2ui8",n);class a extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const o=2*e;return this.uint16[o+0]=r,this.uint16[o+1]=s,e}}a.prototype.bytesPerElement=4,Pe("StructArrayLayout2ui4",a);class l extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint16[1*e+0]=r,e}}l.prototype.bytesPerElement=2,Pe("StructArrayLayout1ui2",l);class d extends Pt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,o){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,s,o)}emplace(e,r,s,o,u){const p=4*e;return this.float32[p+0]=r,this.float32[p+1]=s,this.float32[p+2]=o,this.float32[p+3]=u,e}}d.prototype.bytesPerElement=16,Pe("StructArrayLayout4f16",d);class m extends Cs{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 me(this.anchorPointX,this.anchorPointY)}}m.prototype.size=20;class g extends In{get(e){return new m(this,e)}}Pe("CollisionBoxArray",g);class y extends Cs{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(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}y.prototype.size=48;class v extends lo{get(e){return new y(this,e)}}Pe("PlacedSymbolArray",v);class b extends Cs{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(e){this._structArray.uint32[this._pos4+12]=e}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]}}b.prototype.size=64;class T extends ct{get(e){return new b(this,e)}}Pe("SymbolInstanceArray",T);class C extends h{getoffsetX(e){return this.float32[1*e+0]}}Pe("GlyphOffsetArray",C);class L extends Ms{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Pe("SymbolLineVertexArray",L);class D extends Cs{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]}}D.prototype.size=12;class F extends t{get(e){return new D(this,e)}}Pe("TextAnchorOffsetArray",F);class k extends Cs{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]}}k.prototype.size=8;class H extends n{get(e){return new k(this,e)}}Pe("FeatureIndexArray",H);class ne extends sr{}class N extends sr{}class K extends sr{}class ae extends fa{}class oe extends zs{}class ce extends ks{}class _e extends Gn{}class fe extends Sn{}class xe extends so{}class Be extends ma{}class et extends ao{}class Ee extends ga{}class Ne extends _a{}class ke extends a{}const It=$t([{name:"a_pos",components:2,type:"Int16"}],4),{members:tt}=It;class $e{constructor(e=[]){this.segments=e}prepareSegment(e,r,s,o){let u=this.segments[this.segments.length-1];return e>$e.MAX_VERTEX_ARRAY_LENGTH&&Qt(`Max vertices per segment is ${$e.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!u||u.vertexLength+e>$e.MAX_VERTEX_ARRAY_LENGTH||u.sortKey!==o)&&(u={vertexOffset:r.length,primitiveOffset:s.length,vertexLength:0,primitiveLength:0},o!==void 0&&(u.sortKey=o),this.segments.push(u)),u}get(){return this.segments}destroy(){for(const e of this.segments)for(const r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,s,o){return new $e([{vertexOffset:e,primitiveOffset:r,vertexLength:s,primitiveLength:o,vaos:{},sortKey:0}])}}function it(i,e){return 256*(i=vt(Math.floor(i),0,255))+vt(Math.floor(e),0,255)}$e.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Pe("SegmentVector",$e);const zt=$t([{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"}]);var ft={exports:{}},Xi={exports:{}};Xi.exports=function(i,e){var r,s,o,u,p,f,_,x;for(s=i.length-(r=3&i.length),o=e,p=3432918353,f=461845907,x=0;x>>16)*p&65535)<<16)&4294967295)<<15|_>>>17))*f+(((_>>>16)*f&65535)<<16)&4294967295)<<13|o>>>19))+((5*(o>>>16)&65535)<<16)&4294967295))+((58964+(u>>>16)&65535)<<16);switch(_=0,r){case 3:_^=(255&i.charCodeAt(x+2))<<16;case 2:_^=(255&i.charCodeAt(x+1))<<8;case 1:o^=_=(65535&(_=(_=(65535&(_^=255&i.charCodeAt(x)))*p+(((_>>>16)*p&65535)<<16)&4294967295)<<15|_>>>17))*f+(((_>>>16)*f&65535)<<16)&4294967295}return o^=i.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};var ui=Xi.exports,Rt={exports:{}};Rt.exports=function(i,e){for(var r,s=i.length,o=e^s,u=0;s>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(u)|(255&i.charCodeAt(++u))<<8|(255&i.charCodeAt(++u))<<16|(255&i.charCodeAt(++u))<<24))+((1540483477*(r>>>16)&65535)<<16),o=1540483477*(65535&o)+((1540483477*(o>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),s-=4,++u;switch(s){case 3:o^=(255&i.charCodeAt(u+2))<<16;case 2:o^=(255&i.charCodeAt(u+1))<<8;case 1:o=1540483477*(65535&(o^=255&i.charCodeAt(u)))+((1540483477*(o>>>16)&65535)<<16)}return o=1540483477*(65535&(o^=o>>>13))+((1540483477*(o>>>16)&65535)<<16),(o^=o>>>15)>>>0};var Bi=ui,Mr=Rt.exports;ft.exports=Bi,ft.exports.murmur3=Bi,ft.exports.murmur2=Mr;var mr=Oe(ft.exports);class Pr{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,s,o){this.ids.push(Xn(e)),this.positions.push(r,s,o)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=Xn(e);let s=0,o=this.ids.length-1;for(;s>1;this.ids[p]>=r?o=p:s=p+1}const u=[];for(;this.ids[s]===r;)u.push({index:this.positions[3*s],start:this.positions[3*s+1],end:this.positions[3*s+2]}),s++;return u}static serialize(e,r){const s=new Float64Array(e.ids),o=new Uint32Array(e.positions);return cn(s,o,0,s.length-1),r&&r.push(s.buffer,o.buffer),{ids:s,positions:o}}static deserialize(e){const r=new Pr;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function Xn(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:mr(String(i))}function cn(i,e,r,s){for(;r>1];let u=r-1,p=s+1;for(;;){do u++;while(i[u]o);if(u>=p)break;$r(i,u,p),$r(e,3*u,3*p),$r(e,3*u+1,3*p+1),$r(e,3*u+2,3*p+2)}p-r`u_${o}`),this.type=s}setUniform(e,r,s){e.set(s.constantOr(this.value))}getBinding(e,r,s){return this.type==="color"?new Wn(e,r):new ti(e,r)}}class kt{constructor(e,r){this.uniformNames=r.map(s=>`u_${s}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setUniform(e,r,s,o){const u=o==="u_pattern_to"?this.patternTo:o==="u_pattern_from"?this.patternFrom:o==="u_pixel_ratio_to"?this.pixelRatioTo:o==="u_pixel_ratio_from"?this.pixelRatioFrom:null;u&&e.set(u)}getBinding(e,r,s){return s.substr(0,9)==="u_pattern"?new gi(e,r):new ti(e,r)}}class qr{constructor(e,r,s,o){this.expression=e,this.type=s,this.maxValue=0,this.paintVertexAttributes=r.map(u=>({name:`a_${u}`,type:"Float32",components:s==="color"?2:1,offset:0})),this.paintVertexArray=new o}populatePaintArray(e,r,s,o,u){const p=this.paintVertexArray.length,f=this.expression.evaluate(new St(0),r,{},o,[],u);this.paintVertexArray.resize(e),this._setPaintValue(p,e,f)}updatePaintArray(e,r,s,o){const u=this.expression.evaluate({zoom:0},s,o);this._setPaintValue(e,r,u)}_setPaintValue(e,r,s){if(this.type==="color"){const o=Wt(s);for(let u=e;u`u_${f}_t`),this.type=s,this.useIntegerZoom=o,this.zoom=u,this.maxValue=0,this.paintVertexAttributes=r.map(f=>({name:`a_${f}`,type:"Float32",components:s==="color"?4:2,offset:0})),this.paintVertexArray=new p}populatePaintArray(e,r,s,o,u){const p=this.expression.evaluate(new St(this.zoom),r,{},o,[],u),f=this.expression.evaluate(new St(this.zoom+1),r,{},o,[],u),_=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(_,e,p,f)}updatePaintArray(e,r,s,o){const u=this.expression.evaluate({zoom:this.zoom},s,o),p=this.expression.evaluate({zoom:this.zoom+1},s,o);this._setPaintValue(e,r,u,p)}_setPaintValue(e,r,s,o){if(this.type==="color"){const u=Wt(s),p=Wt(o);for(let f=e;f`#define HAS_UNIFORM_${o}`))}return e}getBinderAttributes(){const e=[];for(const r in this.binders){const s=this.binders[r];if(s instanceof qr||s instanceof gr)for(let o=0;o!0){this.programConfigurations={};for(const o of e)this.programConfigurations[o.id]=new ol(o,r,s);this.needsUpload=!1,this._featureMap=new Pr,this._bufferOffset=0}populatePaintArrays(e,r,s,o,u,p){for(const f in this.programConfigurations)this.programConfigurations[f].populatePaintArrays(e,r,o,u,p);r.id!==void 0&&this._featureMap.add(r.id,s,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,s,o){for(const u of s)this.needsUpload=this.programConfigurations[u.id].updatePaintArrays(e,this._featureMap,r,u,o)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function Jl(i,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-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"]}[i]||[i.replace(`${e}-`,"").replace(/-/g,"_")]}function Cn(i,e,r){const s={color:{source:ks,composite:d},number:{source:h,composite:ks}},o=function(u){return{"line-pattern":{source:_e,composite:_e},"fill-pattern":{source:_e,composite:_e},"fill-extrusion-pattern":{source:_e,composite:_e}}[u]}(i);return o&&o[r]||s[e][r]}Pe("ConstantBinder",_i),Pe("CrossFadedConstantBinder",kt),Pe("SourceExpressionBinder",qr),Pe("CrossFadedCompositeBinder",hn),Pe("CompositeExpressionBinder",gr),Pe("ProgramConfiguration",ol,{omit:["_buffers"]}),Pe("ProgramConfigurationSet",An);const Bt=8192,ya=Math.pow(2,14)-1,co=-ya-1;function Zr(i){const e=Bt/i.extent,r=i.loadGeometry();for(let s=0;sp.x+1||_p.y+1)&&Qt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function un(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?Zr(i):[]}}function Hn(i,e,r,s,o){i.emplaceBack(2*e+(s+1)/2,2*r+(o+1)/2)}class Ql{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new N,this.indexArray=new Ne,this.segments=new $e,this.programConfigurations=new An(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){const o=this.layers[0],u=[];let p=null,f=!1;o.type==="circle"&&(p=o.layout.get("circle-sort-key"),f=!p.isConstant());for(const{feature:_,id:x,index:w,sourceLayerIndex:E}of e){const I=this.layers[0]._featureFilter.needGeometry,M=un(_,I);if(!this.layers[0]._featureFilter.filter(new St(this.zoom),M,s))continue;const P=f?p.evaluate(M,{},s):void 0,B={id:x,properties:_.properties,type:_.type,sourceLayerIndex:E,index:w,geometry:I?M.geometry:Zr(_),patterns:{},sortKey:P};u.push(B)}f&&u.sort((_,x)=>_.sortKey-x.sortKey);for(const _ of u){const{geometry:x,index:w,sourceLayerIndex:E}=_,I=e[w].feature;this.addFeature(_,x,w,s),r.featureIndex.insert(I,x,w,E,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,tt),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,r,s,o){for(const u of r)for(const p of u){const f=p.x,_=p.y;if(f<0||f>=Bt||_<0||_>=Bt)continue;const x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),w=x.vertexLength;Hn(this.layoutVertexArray,f,_,-1,-1),Hn(this.layoutVertexArray,f,_,1,-1),Hn(this.layoutVertexArray,f,_,1,1),Hn(this.layoutVertexArray,f,_,-1,1),this.indexArray.emplaceBack(w,w+1,w+2),this.indexArray.emplaceBack(w,w+3,w+2),x.vertexLength+=4,x.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{},o)}}function Xc(i,e){for(let r=0;r1){if(ec(i,e))return!0;for(let s=0;s1?r:r.sub(e)._mult(o)._add(e))}function Kc(i,e){let r,s,o,u=!1;for(let p=0;pe.y!=o.y>e.y&&e.x<(o.x-s.x)*(e.y-s.y)/(o.y-s.y)+s.x&&(u=!u)}return u}function xa(i,e){let r=!1;for(let s=0,o=i.length-1;se.y!=p.y>e.y&&e.x<(p.x-u.x)*(e.y-u.y)/(p.y-u.y)+u.x&&(r=!r)}return r}function Gu(i,e,r){const s=r[0],o=r[2];if(i.xo.x&&e.x>o.x||i.yo.y&&e.y>o.y)return!1;const u=Je(i,e,r[0]);return u!==Je(i,e,r[1])||u!==Je(i,e,r[2])||u!==Je(i,e,r[3])}function ho(i,e,r){const s=e.paint.get(i).value;return s.kind==="constant"?s.value:r.programConfigurations.get(e.id).getMaxValue(i)}function ll(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function cl(i,e,r,s,o){if(!e[0]&&!e[1])return i;const u=me.convert(e)._mult(o);r==="viewport"&&u._rotate(-s);const p=[];for(let f=0;feh(U,B))}(x,_),M=E?w*f:w;for(const P of o)for(const B of P){const U=E?B:eh(B,_);let $=M;const Q=hl([],[B.x,B.y,0,1],_);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?$*=Q[3]/p.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&($*=p.cameraToCenterDistance/Q[3]),qu(I,U,$))return!0}return!1}}function eh(i,e){const r=hl([],[i.x,i.y,0,1],e);return new me(r[0]/r[3],r[1]/r[3])}class th extends Ql{}let ih;Pe("HeatmapBucket",th,{omit:["layers"]});var Ku={get paint(){return ih=ih||new Li({"heatmap-radius":new je(le.paint_heatmap["heatmap-radius"]),"heatmap-weight":new je(le.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ue(le.paint_heatmap["heatmap-intensity"]),"heatmap-color":new no(le.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ue(le.paint_heatmap["heatmap-opacity"])})}};function rc(i,{width:e,height:r},s,o){if(o){if(o instanceof Uint8ClampedArray)o=new Uint8Array(o.buffer);else if(o.length!==e*r*s)throw new RangeError(`mismatched image size. expected: ${o.length} but got: ${e*r*s}`)}else o=new Uint8Array(e*r*s);return i.width=e,i.height=r,i.data=o,i}function rh(i,{width:e,height:r},s){if(e===i.width&&r===i.height)return;const o=rc({},{width:e,height:r},s);nc(i,o,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,e),height:Math.min(i.height,r)},s),i.width=e,i.height=r,i.data=o.data}function nc(i,e,r,s,o,u){if(o.width===0||o.height===0)return e;if(o.width>i.width||o.height>i.height||r.x>i.width-o.width||r.y>i.height-o.height)throw new RangeError("out of range source coordinates for image copy");if(o.width>e.width||o.height>e.height||s.x>e.width-o.width||s.y>e.height-o.height)throw new RangeError("out of range destination coordinates for image copy");const p=i.data,f=e.data;if(p===f)throw new Error("srcData equals dstData, so image is already copied");for(let _=0;_{e[i.evaluationKey]=_;const x=i.expression.evaluate(e);o.data[p+f+0]=Math.floor(255*x.r/x.a),o.data[p+f+1]=Math.floor(255*x.g/x.a),o.data[p+f+2]=Math.floor(255*x.b/x.a),o.data[p+f+3]=Math.floor(255*x.a)};if(i.clips)for(let p=0,f=0;p80*r){s=u=i[0],o=p=i[1];for(var P=r;Pu&&(u=f),_>p&&(p=_);x=(x=Math.max(u-s,p-o))!==0?32767/x:0}return fo(I,M,r,s,o,x,0),M}function ah(i,e,r,s,o){var u,p;if(o===lc(i,e,r,s)>0)for(u=e;u=e;u-=s)p=ch(u,i[u],i[u+1],p);return p&&dl(p,p.next)&&(go(p),p=p.next),p}function Ds(i,e){if(!i)return i;e||(e=i);var r,s=i;do if(r=!1,s.steiner||!dl(s,s.next)&&Zt(s.prev,s,s.next)!==0)s=s.next;else{if(go(s),(s=e=s.prev)===s.next)break;r=!0}while(r||s!==e);return e}function fo(i,e,r,s,o,u,p){if(i){!p&&u&&function(w,E,I,M){var P=w;do P.z===0&&(P.z=ac(P.x,P.y,E,I,M)),P.prevZ=P.prev,P.nextZ=P.next,P=P.next;while(P!==w);P.prevZ.nextZ=null,P.prevZ=null,function(B){var U,$,Q,W,ie,se,he,Ce,Re=1;do{for($=B,B=null,ie=null,se=0;$;){for(se++,Q=$,he=0,U=0;U0||Ce>0&&Q;)he!==0&&(Ce===0||!Q||$.z<=Q.z)?(W=$,$=$.nextZ,he--):(W=Q,Q=Q.nextZ,Ce--),ie?ie.nextZ=W:B=W,W.prevZ=ie,ie=W;$=Q}ie.nextZ=null,Re*=2}while(se>1)}(P)}(i,s,o,u);for(var f,_,x=i;i.prev!==i.next;)if(f=i.prev,_=i.next,u?rd(i,s,o,u):id(i))e.push(f.i/r|0),e.push(i.i/r|0),e.push(_.i/r|0),go(i),i=_.next,x=_.next;else if((i=_)===x){p?p===1?fo(i=nd(Ds(i),e,r),e,r,s,o,u,2):p===2&&sd(i,e,r,s,o,u):fo(Ds(i),e,r,s,o,u,1);break}}}function id(i){var e=i.prev,r=i,s=i.next;if(Zt(e,r,s)>=0)return!1;for(var o=e.x,u=r.x,p=s.x,f=e.y,_=r.y,x=s.y,w=ou?o>p?o:p:u>p?u:p,M=f>_?f>x?f:x:_>x?_:x,P=s.next;P!==e;){if(P.x>=w&&P.x<=I&&P.y>=E&&P.y<=M&&ba(o,f,u,_,p,x,P.x,P.y)&&Zt(P.prev,P,P.next)>=0)return!1;P=P.next}return!0}function rd(i,e,r,s){var o=i.prev,u=i,p=i.next;if(Zt(o,u,p)>=0)return!1;for(var f=o.x,_=u.x,x=p.x,w=o.y,E=u.y,I=p.y,M=f<_?f_?f>x?f:x:_>x?_:x,U=w>E?w>I?w:I:E>I?E:I,$=ac(M,P,e,r,s),Q=ac(B,U,e,r,s),W=i.prevZ,ie=i.nextZ;W&&W.z>=$&&ie&&ie.z<=Q;){if(W.x>=M&&W.x<=B&&W.y>=P&&W.y<=U&&W!==o&&W!==p&&ba(f,w,_,E,x,I,W.x,W.y)&&Zt(W.prev,W,W.next)>=0||(W=W.prevZ,ie.x>=M&&ie.x<=B&&ie.y>=P&&ie.y<=U&&ie!==o&&ie!==p&&ba(f,w,_,E,x,I,ie.x,ie.y)&&Zt(ie.prev,ie,ie.next)>=0))return!1;ie=ie.nextZ}for(;W&&W.z>=$;){if(W.x>=M&&W.x<=B&&W.y>=P&&W.y<=U&&W!==o&&W!==p&&ba(f,w,_,E,x,I,W.x,W.y)&&Zt(W.prev,W,W.next)>=0)return!1;W=W.prevZ}for(;ie&&ie.z<=Q;){if(ie.x>=M&&ie.x<=B&&ie.y>=P&&ie.y<=U&&ie!==o&&ie!==p&&ba(f,w,_,E,x,I,ie.x,ie.y)&&Zt(ie.prev,ie,ie.next)>=0)return!1;ie=ie.nextZ}return!0}function nd(i,e,r){var s=i;do{var o=s.prev,u=s.next.next;!dl(o,u)&&oh(o,s,s.next,u)&&mo(o,u)&&mo(u,o)&&(e.push(o.i/r|0),e.push(s.i/r|0),e.push(u.i/r|0),go(s),go(s.next),s=i=u),s=s.next}while(s!==i);return Ds(s)}function sd(i,e,r,s,o,u){var p=i;do{for(var f=p.next.next;f!==p.prev;){if(p.i!==f.i&&hd(p,f)){var _=lh(p,f);return p=Ds(p,p.next),_=Ds(_,_.next),fo(p,e,r,s,o,u,0),void fo(_,e,r,s,o,u,0)}f=f.next}p=p.next}while(p!==i)}function ad(i,e){return i.x-e.x}function od(i,e){var r=function(o,u){var p,f=u,_=o.x,x=o.y,w=-1/0;do{if(x<=f.y&&x>=f.next.y&&f.next.y!==f.y){var E=f.x+(x-f.y)*(f.next.x-f.x)/(f.next.y-f.y);if(E<=_&&E>w&&(w=E,p=f.x=f.x&&f.x>=P&&_!==f.x&&ba(xp.x||f.x===p.x&&ld(p,f)))&&(p=f,U=I)),f=f.next;while(f!==M);return p}(i,e);if(!r)return e;var s=lh(r,i);return Ds(s,s.next),Ds(r,r.next)}function ld(i,e){return Zt(i.prev,i,e.prev)<0&&Zt(e.next,i,i.next)<0}function ac(i,e,r,s,o){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*o|0)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-s)*o|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function cd(i){var e=i,r=i;do(e.x=(i-p)*(u-f)&&(i-p)*(s-f)>=(r-p)*(e-f)&&(r-p)*(u-f)>=(o-p)*(s-f)}function hd(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,s){var o=r;do{if(o.i!==r.i&&o.next.i!==r.i&&o.i!==s.i&&o.next.i!==s.i&&oh(o,o.next,r,s))return!0;o=o.next}while(o!==r);return!1}(i,e)&&(mo(i,e)&&mo(e,i)&&function(r,s){var o=r,u=!1,p=(r.x+s.x)/2,f=(r.y+s.y)/2;do o.y>f!=o.next.y>f&&o.next.y!==o.y&&p<(o.next.x-o.x)*(f-o.y)/(o.next.y-o.y)+o.x&&(u=!u),o=o.next;while(o!==r);return u}(i,e)&&(Zt(i.prev,i,e.prev)||Zt(i,e.prev,e))||dl(i,e)&&Zt(i.prev,i,i.next)>0&&Zt(e.prev,e,e.next)>0)}function Zt(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function dl(i,e){return i.x===e.x&&i.y===e.y}function oh(i,e,r,s){var o=fl(Zt(i,e,r)),u=fl(Zt(i,e,s)),p=fl(Zt(r,s,i)),f=fl(Zt(r,s,e));return o!==u&&p!==f||!(o!==0||!pl(i,r,e))||!(u!==0||!pl(i,s,e))||!(p!==0||!pl(r,i,s))||!(f!==0||!pl(r,e,s))}function pl(i,e,r){return e.x<=Math.max(i.x,r.x)&&e.x>=Math.min(i.x,r.x)&&e.y<=Math.max(i.y,r.y)&&e.y>=Math.min(i.y,r.y)}function fl(i){return i>0?1:i<0?-1:0}function mo(i,e){return Zt(i.prev,i,i.next)<0?Zt(i,e,i.next)>=0&&Zt(i,i.prev,e)>=0:Zt(i,e,i.prev)<0||Zt(i,i.next,e)<0}function lh(i,e){var r=new oc(i.i,i.x,i.y),s=new oc(e.i,e.x,e.y),o=i.next,u=e.prev;return i.next=e,e.prev=i,r.next=o,o.prev=r,s.next=r,r.prev=s,u.next=s,s.prev=u,s}function ch(i,e,r,s){var o=new oc(i,e,r);return s?(o.next=s.next,o.prev=s,s.next.prev=o,s.next=o):(o.prev=o,o.next=o),o}function go(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function oc(i,e,r){this.i=i,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function lc(i,e,r,s){for(var o=0,u=e,p=r-s;u0&&r.holes.push(s+=i[o-1].length)}return r};var hh=Oe(sc.exports);function ud(i,e,r,s,o){uh(i,e,r||0,s||i.length-1,o||dd)}function uh(i,e,r,s,o){for(;s>r;){if(s-r>600){var u=s-r+1,p=e-r+1,f=Math.log(u),_=.5*Math.exp(2*f/3),x=.5*Math.sqrt(f*_*(u-_)/u)*(p-u/2<0?-1:1);uh(i,e,Math.max(r,Math.floor(e-p*_/u+x)),Math.min(s,Math.floor(e+(u-p)*_/u+x)),o)}var w=i[e],E=r,I=s;for(_o(i,r,e),o(i[s],w)>0&&_o(i,r,s);E0;)I--}o(i[r],w)===0?_o(i,r,I):_o(i,++I,s),I<=e&&(r=I+1),e<=I&&(s=I-1)}}function _o(i,e,r){var s=i[e];i[e]=i[r],i[r]=s}function dd(i,e){return ie?1:0}function cc(i,e){const r=i.length;if(r<=1)return[i];const s=[];let o,u;for(let p=0;p1)for(let p=0;pr.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new K,this.indexArray=new Ne,this.indexArray2=new ke,this.programConfigurations=new An(e.layers,e.zoom),this.segments=new $e,this.segments2=new $e,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.hasPattern=hc("fill",this.layers,r);const o=this.layers[0].layout.get("fill-sort-key"),u=!o.isConstant(),p=[];for(const{feature:f,id:_,index:x,sourceLayerIndex:w}of e){const E=this.layers[0]._featureFilter.needGeometry,I=un(f,E);if(!this.layers[0]._featureFilter.filter(new St(this.zoom),I,s))continue;const M=u?o.evaluate(I,{},s,r.availableImages):void 0,P={id:_,properties:f.properties,type:f.type,sourceLayerIndex:w,index:x,geometry:E?I.geometry:Zr(f),patterns:{},sortKey:M};p.push(P)}u&&p.sort((f,_)=>f.sortKey-_.sortKey);for(const f of p){const{geometry:_,index:x,sourceLayerIndex:w}=f;if(this.hasPattern){const E=uc("fill",this.layers,f,this.zoom,r);this.patternFeatures.push(E)}else this.addFeature(f,_,x,s,{});r.featureIndex.insert(e[x].feature,_,x,w,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}addFeatures(e,r,s){for(const o of this.patternFeatures)this.addFeature(o,o.geometry,o.index,r,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,td),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),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(e,r,s,o,u){for(const p of cc(r,500)){let f=0;for(const M of p)f+=M.length;const _=this.segments.prepareSegment(f,this.layoutVertexArray,this.indexArray),x=_.vertexLength,w=[],E=[];for(const M of p){if(M.length===0)continue;M!==p[0]&&E.push(w.length/2);const P=this.segments2.prepareSegment(M.length,this.layoutVertexArray,this.indexArray2),B=P.vertexLength;this.layoutVertexArray.emplaceBack(M[0].x,M[0].y),this.indexArray2.emplaceBack(B+M.length-1,B),w.push(M[0].x),w.push(M[0].y);for(let U=1;U>3}if(o--,s===1||s===2)u+=i.readSVarint(),p+=i.readSVarint(),s===1&&(e&&f.push(e),e=[]),e.push(new xd(u,p));else{if(s!==7)throw new Error("unknown command "+s);e&&e.push(e[0].clone())}}return e&&f.push(e),f},wa.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,s=0,o=0,u=0,p=1/0,f=-1/0,_=1/0,x=-1/0;i.pos>3}if(s--,r===1||r===2)(o+=i.readSVarint())f&&(f=o),(u+=i.readSVarint())<_&&(_=u),u>x&&(x=u);else if(r!==7)throw new Error("unknown command "+r)}return[p,_,f,x]},wa.prototype.toGeoJSON=function(i,e,r){var s,o,u=this.extent*Math.pow(2,r),p=this.extent*i,f=this.extent*e,_=this.loadGeometry(),x=wa.types[this.type];function w(M){for(var P=0;P>3;o=p===1?s.readString():p===2?s.readFloat():p===3?s.readDouble():p===4?s.readVarint64():p===5?s.readVarint():p===6?s.readSVarint():p===7?s.readBoolean():null}return o}(r))}gh.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var e=this._pbf.readVarint()+this._pbf.pos;return new wd(this._pbf,e,this.extent,this._keys,this._values)};var Ed=mh;function Sd(i,e,r){if(i===3){var s=new Ed(r,r.readVarint()+r.pos);s.length&&(e[s.name]=s)}}Kn.VectorTile=function(i,e){this.layers=i.readFields(Sd,{},e)},Kn.VectorTileFeature=fh,Kn.VectorTileLayer=mh;const Id=Kn.VectorTileFeature.types,pc=Math.pow(2,13);function yo(i,e,r,s,o,u,p,f){i.emplaceBack(e,r,2*Math.floor(s*pc)+p,o*pc*2,u*pc*2,Math.round(f))}class fc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new ae,this.centroidVertexArray=new ne,this.indexArray=new Ne,this.programConfigurations=new An(e.layers,e.zoom),this.segments=new $e,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.features=[],this.hasPattern=hc("fill-extrusion",this.layers,r);for(const{feature:o,id:u,index:p,sourceLayerIndex:f}of e){const _=this.layers[0]._featureFilter.needGeometry,x=un(o,_);if(!this.layers[0]._featureFilter.filter(new St(this.zoom),x,s))continue;const w={id:u,sourceLayerIndex:f,index:p,geometry:_?x.geometry:Zr(o),properties:o.properties,type:o.type,patterns:{}};this.hasPattern?this.features.push(uc("fill-extrusion",this.layers,w,this.zoom,r)):this.addFeature(w,w.geometry,p,s,{}),r.featureIndex.insert(o,w.geometry,p,f,this.index,!0)}}addFeatures(e,r,s){for(const o of this.features){const{geometry:u}=o;this.addFeature(o,u,o.index,r,s)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,yd),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,_d.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,r,s,o,u){const p={x:0,y:0,vertexCount:0};for(const f of cc(r,500)){let _=0;for(const P of f)_+=P.length;let x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const P of f){if(P.length===0||Cd(P))continue;let B=0;for(let U=0;U=1){const Q=P[U-1];if(!Ad($,Q)){x.vertexLength+4>$e.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const W=$.sub(Q)._perp()._unit(),ie=Q.dist($);B+ie>32768&&(B=0),yo(this.layoutVertexArray,$.x,$.y,W.x,W.y,0,0,B),yo(this.layoutVertexArray,$.x,$.y,W.x,W.y,0,1,B),p.x+=2*$.x,p.y+=2*$.y,p.vertexCount+=2,B+=ie,yo(this.layoutVertexArray,Q.x,Q.y,W.x,W.y,0,0,B),yo(this.layoutVertexArray,Q.x,Q.y,W.x,W.y,0,1,B),p.x+=2*Q.x,p.y+=2*Q.y,p.vertexCount+=2;const se=x.vertexLength;this.indexArray.emplaceBack(se,se+2,se+1),this.indexArray.emplaceBack(se+1,se+2,se+3),x.vertexLength+=4,x.primitiveLength+=2}}}}if(x.vertexLength+_>$e.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(_,this.layoutVertexArray,this.indexArray)),Id[e.type]!=="Polygon")continue;const w=[],E=[],I=x.vertexLength;for(const P of f)if(P.length!==0){P!==f[0]&&E.push(w.length/2);for(let B=0;BBt)||i.y===e.y&&(i.y<0||i.y>Bt)}function Cd(i){return i.every(e=>e.x<0)||i.every(e=>e.x>Bt)||i.every(e=>e.y<0)||i.every(e=>e.y>Bt)}let _h;Pe("FillExtrusionBucket",fc,{omit:["layers","features"]});var Md={get paint(){return _h=_h||new Li({"fill-extrusion-opacity":new Ue(le["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new je(le["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ue(le["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ue(le["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new pa(le["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new je(le["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new je(le["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ue(le["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Pd extends Cr{constructor(e){super(e,Md)}createBucket(e){return new fc(e)}queryRadius(){return ll(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,r,s,o,u,p,f,_){const x=cl(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),p.angle,f),w=this.paint.get("fill-extrusion-height").evaluate(r,s),E=this.paint.get("fill-extrusion-base").evaluate(r,s),I=function(P,B,U,$){const Q=[];for(const W of P){const ie=[W.x,W.y,0,1];hl(ie,ie,B),Q.push(new me(ie[0]/ie[3],ie[1]/ie[3]))}return Q}(x,_),M=function(P,B,U,$){const Q=[],W=[],ie=$[8]*B,se=$[9]*B,he=$[10]*B,Ce=$[11]*B,Re=$[8]*U,Ae=$[9]*U,Se=$[10]*U,ve=$[11]*U;for(const ze of P){const be=[],ye=[];for(const qe of ze){const Fe=qe.x,Qe=qe.y,Et=$[0]*Fe+$[4]*Qe+$[12],At=$[1]*Fe+$[5]*Qe+$[13],ni=$[2]*Fe+$[6]*Qe+$[14],ar=$[3]*Fe+$[7]*Qe+$[15],Fi=ni+he,Ht=ar+Ce,oi=Et+Re,xi=At+Ae,Hi=ni+Se,Oi=ar+ve,Kt=new me((Et+ie)/Ht,(At+se)/Ht);Kt.z=Fi/Ht,be.push(Kt);const si=new me(oi/Oi,xi/Oi);si.z=Hi/Oi,ye.push(si)}Q.push(be),W.push(ye)}return[Q,W]}(o,E,w,_);return function(P,B,U){let $=1/0;Wc(U,B)&&($=yh(U,B[0]));for(let Q=0;Qr.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new oe,this.layoutVertexArray2=new ce,this.indexArray=new Ne,this.programConfigurations=new An(e.layers,e.zoom),this.segments=new $e,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.hasPattern=hc("line",this.layers,r);const o=this.layers[0].layout.get("line-sort-key"),u=!o.isConstant(),p=[];for(const{feature:f,id:_,index:x,sourceLayerIndex:w}of e){const E=this.layers[0]._featureFilter.needGeometry,I=un(f,E);if(!this.layers[0]._featureFilter.filter(new St(this.zoom),I,s))continue;const M=u?o.evaluate(I,{},s):void 0,P={id:_,properties:f.properties,type:f.type,sourceLayerIndex:w,index:x,geometry:E?I.geometry:Zr(f),patterns:{},sortKey:M};p.push(P)}u&&p.sort((f,_)=>f.sortKey-_.sortKey);for(const f of p){const{geometry:_,index:x,sourceLayerIndex:w}=f;if(this.hasPattern){const E=uc("line",this.layers,f,this.zoom,r);this.patternFeatures.push(E)}else this.addFeature(f,_,x,s,{});r.featureIndex.insert(e[x].feature,_,x,w,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}addFeatures(e,r,s){for(const o of this.patternFeatures)this.addFeature(o,o.geometry,o.index,r,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Ld)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,kd),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,r,s,o,u){const p=this.layers[0].layout,f=p.get("line-join").evaluate(e,{}),_=p.get("line-cap"),x=p.get("line-miter-limit"),w=p.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const E of r)this.addLine(E,e,f,_,x,w);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,u,o)}addLine(e,r,s,o,u,p){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let $=0;$=2&&e[_-1].equals(e[_-2]);)_--;let x=0;for(;x<_-1&&e[x].equals(e[x+1]);)x++;if(_<(f?3:2))return;s==="bevel"&&(u=1.05);const w=this.overscaling<=16?15*Bt/(512*this.overscaling):0,E=this.segments.prepareSegment(10*_,this.layoutVertexArray,this.indexArray);let I,M,P,B,U;this.e1=this.e2=-1,f&&(I=e[_-2],U=e[x].sub(I)._unit()._perp());for(let $=x;$<_;$++){if(P=$===_-1?f?e[x+1]:void 0:e[$+1],P&&e[$].equals(P))continue;U&&(B=U),I&&(M=I),I=e[$],U=P?P.sub(I)._unit()._perp():B,B=B||U;let Q=B.add(U);Q.x===0&&Q.y===0||Q._unit();const W=B.x*U.x+B.y*U.y,ie=Q.x*U.x+Q.y*U.y,se=ie!==0?1/ie:1/0,he=2*Math.sqrt(2-2*ie),Ce=ie0;if(Ce&&$>x){const ve=I.dist(M);if(ve>2*w){const ze=I.sub(I.sub(M)._mult(w/ve)._round());this.updateDistance(M,ze),this.addCurrentVertex(ze,B,0,0,E),M=ze}}const Ae=M&&P;let Se=Ae?s:f?"butt":o;if(Ae&&Se==="round"&&(seu&&(Se="bevel"),Se==="bevel"&&(se>2&&(Se="flipbevel"),se100)Q=U.mult(-1);else{const ve=se*B.add(U).mag()/B.sub(U).mag();Q._perp()._mult(ve*(Re?-1:1))}this.addCurrentVertex(I,Q,0,0,E),this.addCurrentVertex(I,Q.mult(-1),0,0,E)}else if(Se==="bevel"||Se==="fakeround"){const ve=-Math.sqrt(se*se-1),ze=Re?ve:0,be=Re?0:ve;if(M&&this.addCurrentVertex(I,B,ze,be,E),Se==="fakeround"){const ye=Math.round(180*he/Math.PI/20);for(let qe=1;qe2*w){const ze=I.add(P.sub(I)._mult(w/ve)._round());this.updateDistance(I,ze),this.addCurrentVertex(ze,U,0,0,E),I=ze}}}}addCurrentVertex(e,r,s,o,u,p=!1){const f=r.y*o-r.x,_=-r.y-r.x*o;this.addHalfVertex(e,r.x+r.y*s,r.y-r.x*s,p,!1,s,u),this.addHalfVertex(e,f,_,p,!0,-o,u),this.distance>xh/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,r,s,o,u,p))}addHalfVertex({x:e,y:r},s,o,u,p,f,_){const x=.5*(this.lineClips?this.scaledDistance*(xh-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(u?1:0),(r<<1)+(p?1:0),Math.round(63*s)+128,Math.round(63*o)+128,1+(f===0?0:f<0?-1:1)|(63&x)<<2,x>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const w=_.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,w),_.primitiveLength++),p?this.e2=w:this.e1=w}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,r){this.distance+=e.dist(r),this.updateScaledDistance()}}let vh,bh;Pe("LineBucket",mc,{omit:["layers","patternFeatures"]});var wh={get paint(){return bh=bh||new Li({"line-opacity":new je(le.paint_line["line-opacity"]),"line-color":new je(le.paint_line["line-color"]),"line-translate":new Ue(le.paint_line["line-translate"]),"line-translate-anchor":new Ue(le.paint_line["line-translate-anchor"]),"line-width":new je(le.paint_line["line-width"]),"line-gap-width":new je(le.paint_line["line-gap-width"]),"line-offset":new je(le.paint_line["line-offset"]),"line-blur":new je(le.paint_line["line-blur"]),"line-dasharray":new ro(le.paint_line["line-dasharray"]),"line-pattern":new pa(le.paint_line["line-pattern"]),"line-gradient":new no(le.paint_line["line-gradient"])})},get layout(){return vh=vh||new Li({"line-cap":new Ue(le.layout_line["line-cap"]),"line-join":new je(le.layout_line["line-join"]),"line-miter-limit":new Ue(le.layout_line["line-miter-limit"]),"line-round-limit":new Ue(le.layout_line["line-round-limit"]),"line-sort-key":new je(le.layout_line["line-sort-key"])})}};class Fd extends je{possiblyEvaluate(e,r){return r=new St(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(e,r)}evaluate(e,r,s,o){return r=Jt({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,s,o)}}let ml;class Od extends Cr{constructor(e){super(e,wh),this.gradientVersion=0,ml||(ml=new Fd(wh.paint.properties["line-width"].specification),ml.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){e==="line-gradient"&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof hs,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,r){super.recalculate(e,r),this.paint._values["line-floorwidth"]=ml.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new mc(e)}queryRadius(e){const r=e,s=Th(ho("line-width",this,r),ho("line-gap-width",this,r)),o=ho("line-offset",this,r);return s/2+Math.abs(o)+ll(this.paint.get("line-translate"))}queryIntersectsFeature(e,r,s,o,u,p,f){const _=cl(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),p.angle,f),x=f/2*Th(this.paint.get("line-width").evaluate(r,s),this.paint.get("line-gap-width").evaluate(r,s)),w=this.paint.get("line-offset").evaluate(r,s);return w&&(o=function(E,I){const M=[];for(let P=0;P=3){for(let U=0;U0?e+2*i:i}const Ud=$t([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Vd=$t([{name:"a_projected_pos",components:3,type:"Float32"}],4);$t([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Nd=$t([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);$t([{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 Eh=$t([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),$d=$t([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function qd(i,e,r){return i.sections.forEach(s=>{s.text=function(o,u,p){const f=u.layout.get("text-transform").evaluate(p,{});return f==="uppercase"?o=o.toLocaleUpperCase():f==="lowercase"&&(o=o.toLocaleLowerCase()),nr.applyArabicShaping&&(o=nr.applyArabicShaping(o)),o}(s.text,e,r)}),i}$t([{name:"triangle",components:3,type:"Uint16"}]),$t([{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"}]),$t([{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"}]),$t([{type:"Float32",name:"offsetX"}]),$t([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),$t([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const vo={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var ri=24,Sh=yt,Ih=function(i,e,r,s,o){var u,p,f=8*o-s-1,_=(1<>1,w=-7,E=r?o-1:0,I=r?-1:1,M=i[e+E];for(E+=I,u=M&(1<<-w)-1,M>>=-w,w+=f;w>0;u=256*u+i[e+E],E+=I,w-=8);for(p=u&(1<<-w)-1,u>>=-w,w+=s;w>0;p=256*p+i[e+E],E+=I,w-=8);if(u===0)u=1-x;else{if(u===_)return p?NaN:1/0*(M?-1:1);p+=Math.pow(2,s),u-=x}return(M?-1:1)*p*Math.pow(2,u-s)},Ah=function(i,e,r,s,o,u){var p,f,_,x=8*u-o-1,w=(1<>1,I=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=s?0:u-1,P=s?1:-1,B=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=isNaN(e)?1:0,p=w):(p=Math.floor(Math.log(e)/Math.LN2),e*(_=Math.pow(2,-p))<1&&(p--,_*=2),(e+=p+E>=1?I/_:I*Math.pow(2,1-E))*_>=2&&(p++,_/=2),p+E>=w?(f=0,p=w):p+E>=1?(f=(e*_-1)*Math.pow(2,o),p+=E):(f=e*Math.pow(2,E-1)*Math.pow(2,o),p=0));o>=8;i[r+M]=255&f,M+=P,f/=256,o-=8);for(p=p<0;i[r+M]=255&p,M+=P,p/=256,x-=8);i[r+M-P]|=128*B};function yt(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}yt.Varint=0,yt.Fixed64=1,yt.Bytes=2,yt.Fixed32=5;var gc=4294967296,Ch=1/gc,Mh=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Mn(i){return i.type===yt.Bytes?i.readVarint()+i.pos:i.pos+1}function Ta(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function Ph(i,e,r){var s=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(s);for(var o=r.pos-1;o>=i;o--)r.buf[o+s]=r.buf[o]}function Zd(i,e){for(var r=0;r>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function zh(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}yt.prototype={destroy:function(){this.buf=null},readFields:function(i,e,r){for(r=r||this.length;this.pos>3,u=this.pos;this.type=7&s,i(o,e,this),this.pos===u&&this.skip(s)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=gl(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=zh(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=gl(this.buf,this.pos)+gl(this.buf,this.pos+4)*gc;return this.pos+=8,i},readSFixed64:function(){var i=gl(this.buf,this.pos)+zh(this.buf,this.pos+4)*gc;return this.pos+=8,i},readFloat:function(){var i=Ih(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Ih(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,r,s=this.buf;return e=127&(r=s[this.pos++]),r<128?e:(e|=(127&(r=s[this.pos++]))<<7,r<128?e:(e|=(127&(r=s[this.pos++]))<<14,r<128?e:(e|=(127&(r=s[this.pos++]))<<21,r<128?e:function(o,u,p){var f,_,x=p.buf;if(f=(112&(_=x[p.pos++]))>>4,_<128||(f|=(127&(_=x[p.pos++]))<<3,_<128)||(f|=(127&(_=x[p.pos++]))<<10,_<128)||(f|=(127&(_=x[p.pos++]))<<17,_<128)||(f|=(127&(_=x[p.pos++]))<<24,_<128)||(f|=(1&(_=x[p.pos++]))<<31,_<128))return Ta(o,f,u);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=s[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var i=this.readVarint()+this.pos,e=this.pos;return this.pos=i,i-e>=12&&Mh?function(r,s,o){return Mh.decode(r.subarray(s,o))}(this.buf,e,i):function(r,s,o){for(var u="",p=s;p239?4:w>223?3:w>191?2:1;if(p+I>o)break;I===1?w<128&&(E=w):I===2?(192&(f=r[p+1]))==128&&(E=(31&w)<<6|63&f)<=127&&(E=null):I===3?(_=r[p+2],(192&(f=r[p+1]))==128&&(192&_)==128&&((E=(15&w)<<12|(63&f)<<6|63&_)<=2047||E>=55296&&E<=57343)&&(E=null)):I===4&&(_=r[p+2],x=r[p+3],(192&(f=r[p+1]))==128&&(192&_)==128&&(192&x)==128&&((E=(15&w)<<18|(63&f)<<12|(63&_)<<6|63&x)<=65535||E>=1114112)&&(E=null)),E===null?(E=65533,I=1):E>65535&&(E-=65536,u+=String.fromCharCode(E>>>10&1023|55296),E=56320|1023&E),u+=String.fromCharCode(E),p+=I}return u}(this.buf,e,i)},readBytes:function(){var i=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,i);return this.pos=i,e},readPackedVarint:function(i,e){if(this.type!==yt.Bytes)return i.push(this.readVarint(e));var r=Mn(this);for(i=i||[];this.pos127;);else if(e===yt.Bytes)this.pos=this.readVarint()+this.pos;else if(e===yt.Fixed32)this.pos+=4;else{if(e!==yt.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(i,e){this.writeVarint(i<<3|e)},realloc:function(i){for(var e=this.length||16;e268435455||i<0?function(e,r){var s,o;if(e>=0?(s=e%4294967296|0,o=e/4294967296|0):(o=~(-e/4294967296),4294967295^(s=~(-e%4294967296))?s=s+1|0:(s=0,o=o+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(u,p,f){f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,f.buf[f.pos]=127&(u>>>=7)}(s,0,r),function(u,p){var f=(7&u)<<4;p.buf[p.pos++]|=f|((u>>>=3)?128:0),u&&(p.buf[p.pos++]=127&u|((u>>>=7)?128:0),u&&(p.buf[p.pos++]=127&u|((u>>>=7)?128:0),u&&(p.buf[p.pos++]=127&u|((u>>>=7)?128:0),u&&(p.buf[p.pos++]=127&u|((u>>>=7)?128:0),u&&(p.buf[p.pos++]=127&u)))))}(o,r)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(!!i)},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var e=this.pos;this.pos=function(s,o,u){for(var p,f,_=0;_55295&&p<57344){if(!f){p>56319||_+1===o.length?(s[u++]=239,s[u++]=191,s[u++]=189):f=p;continue}if(p<56320){s[u++]=239,s[u++]=191,s[u++]=189,f=p;continue}p=f-55296<<10|p-56320|65536,f=null}else f&&(s[u++]=239,s[u++]=191,s[u++]=189,f=null);p<128?s[u++]=p:(p<2048?s[u++]=p>>6|192:(p<65536?s[u++]=p>>12|224:(s[u++]=p>>18|240,s[u++]=p>>12&63|128),s[u++]=p>>6&63|128),s[u++]=63&p|128)}return u}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&Ph(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Ah(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Ah(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var e=i.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&Ph(r,s,this),this.pos=r-1,this.writeVarint(s),this.pos+=s},writeMessage:function(i,e,r){this.writeTag(i,yt.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,Zd,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,jd,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,Wd,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,Gd,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,Xd,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,Hd,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,Kd,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,Yd,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,Jd,e)},writeBytesField:function(i,e){this.writeTag(i,yt.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,yt.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,yt.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,yt.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,yt.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,yt.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,yt.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,yt.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,yt.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,yt.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,!!e)}};var _c=Oe(Sh);const yc=3;function Qd(i,e,r){i===1&&r.readMessage(ep,e)}function ep(i,e,r){if(i===3){const{id:s,bitmap:o,width:u,height:p,left:f,top:_,advance:x}=r.readMessage(tp,{});e.push({id:s,bitmap:new po({width:u+2*yc,height:p+2*yc},o),metrics:{width:u,height:p,left:f,top:_,advance:x}})}}function tp(i,e,r){i===1?e.id=r.readVarint():i===2?e.bitmap=r.readBytes():i===3?e.width=r.readVarint():i===4?e.height=r.readVarint():i===5?e.left=r.readSVarint():i===6?e.top=r.readSVarint():i===7&&(e.advance=r.readVarint())}const kh=yc;function Dh(i){let e=0,r=0;for(const p of i)e+=p.w*p.h,r=Math.max(r,p.w);i.sort((p,f)=>f.h-p.h);const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let o=0,u=0;for(const p of i)for(let f=s.length-1;f>=0;f--){const _=s[f];if(!(p.w>_.w||p.h>_.h)){if(p.x=_.x,p.y=_.y,u=Math.max(u,p.y+p.h),o=Math.max(o,p.x+p.w),p.w===_.w&&p.h===_.h){const x=s.pop();f=0&&s>=e&&yl[this.text.charCodeAt(s)];s--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){const s=new Sa;return s.text=this.text.substring(e,r),s.sectionIndex=this.sectionIndex.slice(e,r),s.sections=this.sections,s}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}addTextSection(e,r){this.text+=e.text,this.sections.push(wo.forText(e.scale,e.fontStack||r));const s=this.sections.length-1;for(let o=0;o=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function _l(i,e,r,s,o,u,p,f,_,x,w,E,I,M,P,B){const U=Sa.fromFeature(i,o);let $;E===c.WritingMode.vertical&&U.verticalizePunctuation();const{processBidirectionalText:Q,processStyledBidirectionalText:W}=nr;if(Q&&U.sections.length===1){$=[];const he=Q(U.toString(),vc(U,x,u,e,s,M,P));for(const Ce of he){const Re=new Sa;Re.text=Ce,Re.sections=U.sections;for(let Ae=0;Ae0&&zn>Yi&&(Yi=zn)}else{const xr=Re[st.fontStack],Ji=xr&&xr[bi];if(Ji&&Ji.rect)jr=Ji.rect,zr=Ji.metrics;else{const zn=Ce[st.fontStack],Ao=zn&&zn[bi];if(!Ao)continue;zr=Ao.metrics}Vi=(si-st.scale)*ri}kr?(he.verticalizable=!0,Ki.push({glyph:bi,imageName:Gr,x:Et,y:At+Vi,vertical:kr,scale:st.scale,fontStack:st.fontStack,sectionIndex:or,metrics:zr,rect:jr}),Et+=Pn*st.scale+qe):(Ki.push({glyph:bi,imageName:Gr,x:Et,y:At+Vi,vertical:kr,scale:st.scale,fontStack:st.fontStack,sectionIndex:or,metrics:zr,rect:jr}),Et+=zr.advance*st.scale+qe)}Ki.length!==0&&(ni=Math.max(Et-qe,ni),np(Ki,0,Ki.length-1,Fi,Yi)),Et=0;const Ft=ve*si+Yi;Ui.lineOffset=Math.max(Yi,Ci),At+=Ft,ar=Math.max(Ft,ar),++Ht}var oi;const xi=At-bo,{horizontalAlign:Hi,verticalAlign:Oi}=bc(ze);(function(Kt,si,Ci,Ui,Ki,Yi,Ft,vi,st){const or=(si-Ci)*Ki;let bi=0;bi=Yi!==Ft?-vi*Ui-bo:(-Ui*st+.5)*Ft;for(const Vi of Kt)for(const zr of Vi.positionedGlyphs)zr.x+=or,zr.y+=bi})(he.positionedLines,Fi,Hi,Oi,ni,ar,ve,xi,Se.length),he.top+=-Oi*xi,he.bottom=he.top+xi,he.left+=-Hi*ni,he.right=he.left+ni}(se,e,r,s,$,p,f,_,E,x,I,B),!function(he){for(const Ce of he)if(Ce.positionedGlyphs.length!==0)return!1;return!0}(ie)&&se}const yl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},ip={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Bh(i,e,r,s,o,u){if(e.imageName){const p=s[e.imageName];return p?p.displaySize[0]*e.scale*ri/u+o:0}{const p=r[e.fontStack],f=p&&p[i];return f?f.metrics.advance*e.scale+o:0}}function Rh(i,e,r,s){const o=Math.pow(i-e,2);return s?i=0;let w=0;for(let I=0;Ip.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=ic([]),this.placementViewportMatrix=ic([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Vh(this.zoom,r["text-size"]),this.iconSizeData=Vh(this.zoom,r["icon-size"]);const s=this.layers[0].layout,o=s.get("symbol-sort-key"),u=s.get("symbol-z-order");this.canOverlap=wc(s,"text-overlap","text-allow-overlap")!=="never"||wc(s,"icon-overlap","icon-allow-overlap")!=="never"||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=u!=="viewport-y"&&!o.isConstant(),this.sortFeaturesByY=(u==="viewport-y"||u==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,s.get("symbol-placement")==="point"&&(this.writingModes=s.get("text-writing-mode").map(p=>c.WritingMode[p])),this.stateDependentLayerIds=this.layers.filter(p=>p.isStateDependent()).map(p=>p.id),this.sourceID=e.sourceID}createArrays(){this.text=new Ec(new An(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Ec(new An(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new C,this.lineVertexArray=new L,this.symbolInstances=new T,this.textAnchorOffsets=new F}calculateGlyphDependencies(e,r,s,o,u){for(let p=0;p0)&&(p.value.kind!=="constant"||p.value.value.length>0),w=_.value.kind!=="constant"||!!_.value.value||Object.keys(_.parameters).length>0,E=u.get("symbol-sort-key");if(this.features=[],!x&&!w)return;const I=r.iconDependencies,M=r.glyphDependencies,P=r.availableImages,B=new St(this.zoom);for(const{feature:U,id:$,index:Q,sourceLayerIndex:W}of e){const ie=o._featureFilter.needGeometry,se=un(U,ie);if(!o._featureFilter.filter(B,se,s))continue;let he,Ce;if(ie||(se.geometry=Zr(U)),x){const Ae=o.getValueAndResolveTokens("text-field",se,s,P),Se=Ot.factory(Ae);lp(Se)&&(this.hasRTLText=!0),(!this.hasRTLText||io()==="unavailable"||this.hasRTLText&&nr.isParsed())&&(he=qd(Se,o,se))}if(w){const Ae=o.getValueAndResolveTokens("icon-image",se,s,P);Ce=Ae instanceof ir?Ae:ir.fromString(Ae)}if(!he&&!Ce)continue;const Re=this.sortFeaturesByKey?E.evaluate(se,{},s):void 0;if(this.features.push({id:$,text:he,icon:Ce,index:Q,sourceLayerIndex:W,geometry:se.geometry,properties:U.properties,type:ap[U.type],sortKey:Re}),Ce&&(I[Ce.name]=!0),he){const Ae=p.evaluate(se,{},s).join(","),Se=u.get("text-rotation-alignment")!=="viewport"&&u.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(c.WritingMode.vertical)>=0;for(const ve of he.sections)if(ve.image)I[ve.image.name]=!0;else{const ze=ha(he.toString()),be=ve.fontStack||Ae,ye=M[be]=M[be]||{};this.calculateGlyphDependencies(ve.text,ye,Se,this.allowVerticalPlacement,ze)}}}u.get("symbol-placement")==="line"&&(this.features=function(U){const $={},Q={},W=[];let ie=0;function se(Ae){W.push(U[Ae]),ie++}function he(Ae,Se,ve){const ze=Q[Ae];return delete Q[Ae],Q[Se]=ze,W[ze].geometry[0].pop(),W[ze].geometry[0]=W[ze].geometry[0].concat(ve[0]),ze}function Ce(Ae,Se,ve){const ze=$[Se];return delete $[Se],$[Ae]=ze,W[ze].geometry[0].shift(),W[ze].geometry[0]=ve[0].concat(W[ze].geometry[0]),ze}function Re(Ae,Se,ve){const ze=ve?Se[0][Se[0].length-1]:Se[0][0];return`${Ae}:${ze.x}:${ze.y}`}for(let Ae=0;AeAe.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((U,$)=>U.sortKey-$.sortKey)}update(e,r,s){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,s),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,s))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,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(e,r){const s=this.lineVertexArray.length;if(e.segment!==void 0){let o=e.dist(r[e.segment+1]),u=e.dist(r[e.segment]);const p={};for(let f=e.segment+1;f=0;f--)p[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:u},f>0&&(u+=r[f-1].dist(r[f]));for(let f=0;f0}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(e,r){const s=e.placedSymbolArray.get(r),o=s.vertexStartIndex+4*s.numGlyphs;for(let u=s.vertexStartIndex;uo[f]-o[_]||u[_]-u[f]),p}addToSortKeyRanges(e,r){const s=this.sortKeyRanges[this.sortKeyRanges.length-1];s&&s.sortKey===r?s.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const r of this.symbolInstanceIndexes){const s=this.symbolInstances.get(r);this.featureSortOrder.push(s.featureIndex),[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex].forEach((o,u,p)=>{o>=0&&p.indexOf(o)===u&&this.addIndicesForPlacedSymbol(this.text,o)}),s.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,s.verticalPlacedTextSymbolIndex),s.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.placedIconSymbolIndex),s.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Nh,$h;Pe("SymbolBucket",Ia,{omit:["layers","collisionBoxArray","features","compareText"]}),Ia.MAX_GLYPHS=65535,Ia.addDynamicAttributes=Tc;var Ic={get paint(){return $h=$h||new Li({"icon-opacity":new je(le.paint_symbol["icon-opacity"]),"icon-color":new je(le.paint_symbol["icon-color"]),"icon-halo-color":new je(le.paint_symbol["icon-halo-color"]),"icon-halo-width":new je(le.paint_symbol["icon-halo-width"]),"icon-halo-blur":new je(le.paint_symbol["icon-halo-blur"]),"icon-translate":new Ue(le.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ue(le.paint_symbol["icon-translate-anchor"]),"text-opacity":new je(le.paint_symbol["text-opacity"]),"text-color":new je(le.paint_symbol["text-color"],{runtimeType:pi,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new je(le.paint_symbol["text-halo-color"]),"text-halo-width":new je(le.paint_symbol["text-halo-width"]),"text-halo-blur":new je(le.paint_symbol["text-halo-blur"]),"text-translate":new Ue(le.paint_symbol["text-translate"]),"text-translate-anchor":new Ue(le.paint_symbol["text-translate-anchor"])})},get layout(){return Nh=Nh||new Li({"symbol-placement":new Ue(le.layout_symbol["symbol-placement"]),"symbol-spacing":new Ue(le.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ue(le.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new je(le.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ue(le.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ue(le.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ue(le.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ue(le.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ue(le.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ue(le.layout_symbol["icon-rotation-alignment"]),"icon-size":new je(le.layout_symbol["icon-size"]),"icon-text-fit":new Ue(le.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ue(le.layout_symbol["icon-text-fit-padding"]),"icon-image":new je(le.layout_symbol["icon-image"]),"icon-rotate":new je(le.layout_symbol["icon-rotate"]),"icon-padding":new je(le.layout_symbol["icon-padding"]),"icon-keep-upright":new Ue(le.layout_symbol["icon-keep-upright"]),"icon-offset":new je(le.layout_symbol["icon-offset"]),"icon-anchor":new je(le.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ue(le.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ue(le.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ue(le.layout_symbol["text-rotation-alignment"]),"text-field":new je(le.layout_symbol["text-field"]),"text-font":new je(le.layout_symbol["text-font"]),"text-size":new je(le.layout_symbol["text-size"]),"text-max-width":new je(le.layout_symbol["text-max-width"]),"text-line-height":new Ue(le.layout_symbol["text-line-height"]),"text-letter-spacing":new je(le.layout_symbol["text-letter-spacing"]),"text-justify":new je(le.layout_symbol["text-justify"]),"text-radial-offset":new je(le.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ue(le.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new je(le.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new je(le.layout_symbol["text-anchor"]),"text-max-angle":new Ue(le.layout_symbol["text-max-angle"]),"text-writing-mode":new Ue(le.layout_symbol["text-writing-mode"]),"text-rotate":new je(le.layout_symbol["text-rotate"]),"text-padding":new Ue(le.layout_symbol["text-padding"]),"text-keep-upright":new Ue(le.layout_symbol["text-keep-upright"]),"text-transform":new je(le.layout_symbol["text-transform"]),"text-offset":new je(le.layout_symbol["text-offset"]),"text-allow-overlap":new Ue(le.layout_symbol["text-allow-overlap"]),"text-overlap":new Ue(le.layout_symbol["text-overlap"]),"text-ignore-placement":new Ue(le.layout_symbol["text-ignore-placement"]),"text-optional":new Ue(le.layout_symbol["text-optional"])})}};class qh{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:tn,this.defaultValue=e}evaluate(e){if(e.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(e.formattedSection))return r.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Pe("FormatSectionOverride",qh,{omit:["defaultValue"]});class vl extends Cr{constructor(e){super(e,Ic)}recalculate(e,r){if(super.recalculate(e,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const s=this.layout.get("text-writing-mode");if(s){const o=[];for(const u of s)o.indexOf(u)<0&&o.push(u);this.layout._values["text-writing-mode"]=o}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,s,o){const u=this.layout.get(e).evaluate(r,{},s,o),p=this._unevaluatedLayout._values[e];return p.isDataDriven()||ea(p.value)||!u?u:function(f,_){return _.replace(/{([^{}]+)}/g,(x,w)=>w in f?String(f[w]):"")}(r.properties,u)}createBucket(e){return new Ia(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of Ic.paint.overridableProperties){if(!vl.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),s=new qh(r),o=new Lt(s,r.property.specification);let u=null;u=r.value.kind==="constant"||r.value.kind==="source"?new us("source",o):new wt("composite",o,r.value.zoomStops),this.paint._values[e]=new fr(r.property,u,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,s){return!(!this.layout||r.isDataDriven()||s.isDataDriven())&&vl.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const s=e.get("text-field"),o=Ic.paint.properties[r];let u=!1;const p=f=>{for(const _ of f)if(o.overrides&&o.overrides.hasOverride(_))return void(u=!0)};if(s.value.kind==="constant"&&s.value.value instanceof Ot)p(s.value.value.sections);else if(s.value.kind==="source"){const f=x=>{u||(x instanceof gn&&Ut(x.value)===Er?p(x.value.sections):x instanceof Js?p(x.sections):x.eachChild(f))},_=s.value;_._styleExpression&&f(_._styleExpression.expression)}return u}}let Zh;var cp={get paint(){return Zh=Zh||new Li({"background-color":new Ue(le.paint_background["background-color"]),"background-pattern":new ro(le.paint_background["background-pattern"]),"background-opacity":new Ue(le.paint_background["background-opacity"])})}};class hp extends Cr{constructor(e){super(e,cp)}}let jh;var up={get paint(){return jh=jh||new Li({"raster-opacity":new Ue(le.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ue(le.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ue(le.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ue(le.paint_raster["raster-brightness-max"]),"raster-saturation":new Ue(le.paint_raster["raster-saturation"]),"raster-contrast":new Ue(le.paint_raster["raster-contrast"]),"raster-resampling":new Ue(le.paint_raster["raster-resampling"]),"raster-fade-duration":new Ue(le.paint_raster["raster-fade-duration"])})}};class dp extends Cr{constructor(e){super(e,up)}}class pp extends Cr{constructor(e){super(e,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class fp{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const Ac=63710088e-1;class Qn{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Qn(Mt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const r=Math.PI/180,s=this.lat*r,o=e.lat*r,u=Math.sin(s)*Math.sin(o)+Math.cos(s)*Math.cos(o)*Math.cos((e.lng-this.lng)*r);return Ac*Math.acos(Math.min(u,1))}static convert(e){if(e instanceof Qn)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Qn(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Qn(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const Gh=2*Math.PI*Ac;function Xh(i){return Gh*Math.cos(i*Math.PI/180)}function Wh(i){return(180+i)/360}function Hh(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function Kh(i,e){return i/Xh(e)}function Cc(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class bl{constructor(e,r,s=0){this.x=+e,this.y=+r,this.z=+s}static fromLngLat(e,r=0){const s=Qn.convert(e);return new bl(Wh(s.lng),Hh(s.lat),Kh(r,s.lat))}toLngLat(){return new Qn(360*this.x-180,Cc(this.y))}toAltitude(){return this.z*Xh(Cc(this.y))}meterInMercatorCoordinateUnits(){return 1/Gh*(e=Cc(this.y),1/Math.cos(e*Math.PI/180));var e}}function Yh(i,e,r){var s=2*Math.PI*6378137/256/Math.pow(2,r);return[i*s-2*Math.PI*6378137/2,e*s-2*Math.PI*6378137/2]}class Mc{constructor(e,r,s){if(e<0||e>25||s<0||s>=Math.pow(2,e)||r<0||r>=Math.pow(2,e))throw new Error(`x=${r}, y=${s}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=r,this.y=s,this.key=Eo(0,e,e,r,s)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,s){const o=(p=this.y,f=this.z,_=Yh(256*(u=this.x),256*(p=Math.pow(2,f)-p-1),f),x=Yh(256*(u+1),256*(p+1),f),_[0]+","+_[1]+","+x[0]+","+x[1]);var u,p,f,_,x;const w=function(E,I,M){let P,B="";for(let U=E;U>0;U--)P=1<1?"@2x":"").replace(/{quadkey}/g,w).replace(/{bbox-epsg-3857}/g,o)}isChildOf(e){const r=this.z-e.z;return r>0&&e.x===this.x>>r&&e.y===this.y>>r}getTilePoint(e){const r=Math.pow(2,this.z);return new me((e.x*r-this.x)*Bt,(e.y*r-this.y)*Bt)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Jh{constructor(e,r){this.wrap=e,this.canonical=r,this.key=Eo(e,r.z,r.z,r.x,r.y)}}class yr{constructor(e,r,s,o,u){if(e= z; overscaledZ = ${e}; z = ${s}`);this.overscaledZ=e,this.wrap=r,this.canonical=new Mc(s,+o,+u),this.key=Eo(r,e,s,o,u)}clone(){return new yr(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-e;return e>this.canonical.z?new yr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new yr(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const s=this.canonical.z-e;return e>this.canonical.z?Eo(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):Eo(this.wrap*+r,e,e,this.canonical.x>>s,this.canonical.y>>s)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new yr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,s=2*this.canonical.x,o=2*this.canonical.y;return[new yr(r,this.wrap,r,s,o),new yr(r,this.wrap,r,s+1,o),new yr(r,this.wrap,r,s,o+1),new yr(r,this.wrap,r,s+1,o+1)]}isLessThan(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.ythis.max&&(this.max=f),f=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(e+1)}_unpackMapbox(e,r,s){return(256*e*256+256*r+s)/10-1e4}_unpackTerrarium(e,r,s){return 256*e+r+s/256-32768}getPixels(){return new _r({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,s){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let o=r*this.dim,u=r*this.dim+this.dim,p=s*this.dim,f=s*this.dim+this.dim;switch(r){case-1:o=u-1;break;case 1:u=o+1}switch(s){case-1:p=f-1;break;case 1:f=p+1}const _=-r*this.dim,x=-s*this.dim;for(let w=p;w=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class tu{constructor(e,r,s,o,u){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=s,e._y=o,this.properties=e.properties,this.id=u}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(e[r]=this[r]);return e}}class iu{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new ws(Bt,16,0),this.grid3D=new ws(Bt,16,0),this.featureIndexArray=new H,this.promoteId=r}insert(e,r,s,o,u,p){const f=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,o,u);const _=p?this.grid3D:this.grid;for(let x=0;x=0&&E[3]>=0&&_.insert(f,E[0],E[1],E[2],E[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Kn.VectorTile(new _c(this.rawTileData)).layers,this.sourceLayerCoder=new eu(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,s,o){this.loadVTLayers();const u=e.params||{},p=Bt/e.tileSize/e.scale,f=$a(u.filter),_=e.queryGeometry,x=e.queryPadding*p,w=nu(_),E=this.grid.query(w.minX-x,w.minY-x,w.maxX+x,w.maxY+x),I=nu(e.cameraQueryGeometry),M=this.grid3D.query(I.minX-x,I.minY-x,I.maxX+x,I.maxY+x,(U,$,Q,W)=>function(ie,se,he,Ce,Re){for(const Se of ie)if(se<=Se.x&&he<=Se.y&&Ce>=Se.x&&Re>=Se.y)return!0;const Ae=[new me(se,he),new me(se,Re),new me(Ce,Re),new me(Ce,he)];if(ie.length>2){for(const Se of Ae)if(xa(ie,Se))return!0}for(let Se=0;Se(W||(W=Zr(ie)),se.queryIntersectsFeature(_,ie,he,W,this.z,e.transform,p,e.pixelPosMatrix)))}return P}loadMatchingFeature(e,r,s,o,u,p,f,_,x,w,E){const I=this.bucketLayerIDs[r];if(p&&!function(U,$){for(let Q=0;Q=0)return!0;return!1}(p,I))return;const M=this.sourceLayerCoder.decode(s),P=this.vtLayers[M].feature(o);if(u.needGeometry){const U=un(P,!0);if(!u.filter(new St(this.tileID.overscaledZ),U,this.tileID.canonical))return}else if(!u.filter(new St(this.tileID.overscaledZ),P))return;const B=this.getId(P,M);for(let U=0;U{const f=e instanceof As?e.get(p):null;return f&&f.evaluate?f.evaluate(r,s,o):f})}function nu(i){let e=1/0,r=1/0,s=-1/0,o=-1/0;for(const u of i)e=Math.min(e,u.x),r=Math.min(r,u.y),s=Math.max(s,u.x),o=Math.max(o,u.y);return{minX:e,minY:r,maxX:s,maxY:o}}function mp(i,e){return e-i}function su(i,e,r,s,o){const u=[];for(let p=0;p=s&&E.x>=s||(w.x>=s?w=new me(s,w.y+(s-w.x)/(E.x-w.x)*(E.y-w.y))._round():E.x>=s&&(E=new me(s,w.y+(s-w.x)/(E.x-w.x)*(E.y-w.y))._round()),w.y>=o&&E.y>=o||(w.y>=o?w=new me(w.x+(o-w.y)/(E.y-w.y)*(E.x-w.x),o)._round():E.y>=o&&(E=new me(w.x+(o-w.y)/(E.y-w.y)*(E.x-w.x),o)._round()),_&&w.equals(_[_.length-1])||(_=[w],u.push(_)),_.push(E)))))}}return u}Pe("FeatureIndex",iu,{omit:["rawTileData","sourceLayerCoder"]});class es extends me{constructor(e,r,s,o){super(e,r),this.angle=s,o!==void 0&&(this.segment=o)}clone(){return new es(this.x,this.y,this.angle,this.segment)}}function au(i,e,r,s,o){if(e.segment===void 0||r===0)return!0;let u=e,p=e.segment+1,f=0;for(;f>-r/2;){if(p--,p<0)return!1;f-=i[p].dist(u),u=i[p]}f+=i[p].dist(i[p+1]),p++;const _=[];let x=0;for(;fs;)x-=_.shift().angleDelta;if(x>o)return!1;p++,f+=w.dist(E)}return!0}function ou(i){let e=0;for(let r=0;rx){const P=(x-_)/M,B=Zi.number(E.x,I.x,P),U=Zi.number(E.y,I.y,P),$=new es(B,U,I.angleTo(E),w);return $._round(),!p||au(i,$,f,p,e)?$:void 0}_+=M}}function _p(i,e,r,s,o,u,p,f,_){const x=lu(s,u,p),w=cu(s,o),E=w*p,I=i[0].x===0||i[0].x===_||i[0].y===0||i[0].y===_;return e-E=0&&ie<_&&se>=0&&se<_&&I-x>=0&&I+x<=w){const he=new es(ie,se,Q,P);he._round(),s&&!au(i,he,u,s,o)||M.push(he)}}E+=$}return f||M.length||p||(M=hu(i,E/2,r,s,o,u,p,!0,_)),M}Pe("Anchor",es);const Aa=Wi;function uu(i,e,r,s){const o=[],u=i.image,p=u.pixelRatio,f=u.paddedRect.w-2*Aa,_=u.paddedRect.h-2*Aa,x=i.right-i.left,w=i.bottom-i.top,E=u.stretchX||[[0,f]],I=u.stretchY||[[0,_]],M=(ve,ze)=>ve+ze[1]-ze[0],P=E.reduce(M,0),B=I.reduce(M,0),U=f-P,$=_-B;let Q=0,W=P,ie=0,se=B,he=0,Ce=U,Re=0,Ae=$;if(u.content&&s){const ve=u.content;Q=wl(E,0,ve[0]),ie=wl(I,0,ve[1]),W=wl(E,ve[0],ve[2]),se=wl(I,ve[1],ve[3]),he=ve[0]-Q,Re=ve[1]-ie,Ce=ve[2]-ve[0]-W,Ae=ve[3]-ve[1]-se}const Se=(ve,ze,be,ye)=>{const qe=Tl(ve.stretch-Q,W,x,i.left),Fe=El(ve.fixed-he,Ce,ve.stretch,P),Qe=Tl(ze.stretch-ie,se,w,i.top),Et=El(ze.fixed-Re,Ae,ze.stretch,B),At=Tl(be.stretch-Q,W,x,i.left),ni=El(be.fixed-he,Ce,be.stretch,P),ar=Tl(ye.stretch-ie,se,w,i.top),Fi=El(ye.fixed-Re,Ae,ye.stretch,B),Ht=new me(qe,Qe),oi=new me(At,Qe),xi=new me(At,ar),Hi=new me(qe,ar),Oi=new me(Fe/p,Et/p),Kt=new me(ni/p,Fi/p),si=e*Math.PI/180;if(si){const Ki=Math.sin(si),Yi=Math.cos(si),Ft=[Yi,-Ki,Ki,Yi];Ht._matMult(Ft),oi._matMult(Ft),Hi._matMult(Ft),xi._matMult(Ft)}const Ci=ve.stretch+ve.fixed,Ui=ze.stretch+ze.fixed;return{tl:Ht,tr:oi,bl:Hi,br:xi,tex:{x:u.paddedRect.x+Aa+Ci,y:u.paddedRect.y+Aa+Ui,w:be.stretch+be.fixed-Ci,h:ye.stretch+ye.fixed-Ui},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Oi,pixelOffsetBR:Kt,minFontScaleX:Ce/p/x,minFontScaleY:Ae/p/w,isSDF:r}};if(s&&(u.stretchX||u.stretchY)){const ve=du(E,U,P),ze=du(I,$,B);for(let be=0;be0&&(P=Math.max(10,P),this.circleDiameter=P)}else{let E=p.top*f-_[0],I=p.bottom*f+_[2],M=p.left*f-_[3],P=p.right*f+_[1];const B=p.collisionPadding;if(B&&(M-=B[0]*f,E-=B[1]*f,P+=B[2]*f,I+=B[3]*f),w){const U=new me(M,E),$=new me(P,E),Q=new me(M,I),W=new me(P,I),ie=w*Math.PI/180;U._rotate(ie),$._rotate(ie),Q._rotate(ie),W._rotate(ie),M=Math.min(U.x,$.x,Q.x,W.x),P=Math.max(U.x,$.x,Q.x,W.x),E=Math.min(U.y,$.y,Q.y,W.y),I=Math.max(U.y,$.y,Q.y,W.y)}e.emplaceBack(r.x,r.y,M,E,P,I,s,o,u)}this.boxEndIndex=e.length}}class yp{constructor(e=[],r=xp){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:r,compare:s}=this,o=r[e];for(;e>0;){const u=e-1>>1,p=r[u];if(s(o,p)>=0)break;r[e]=p,e=u}r[e]=o}_down(e){const{data:r,compare:s}=this,o=this.length>>1,u=r[e];for(;e=0)break;r[e]=f,e=p}r[e]=u}}function xp(i,e){return ie?1:0}function vp(i,e=1,r=!1){let s=1/0,o=1/0,u=-1/0,p=-1/0;const f=i[0];for(let M=0;Mu)&&(u=P.x),(!M||P.y>p)&&(p=P.y)}const _=Math.min(u-s,p-o);let x=_/2;const w=new yp([],bp);if(_===0)return new me(s,o);for(let M=s;ME.d||!E.d)&&(E=M,r&&console.log("found best %d after %d probes",Math.round(1e4*M.d)/1e4,I)),M.max-E.d<=e||(x=M.h/2,w.push(new Ca(M.p.x-x,M.p.y-x,x,i)),w.push(new Ca(M.p.x+x,M.p.y-x,x,i)),w.push(new Ca(M.p.x-x,M.p.y+x,x,i)),w.push(new Ca(M.p.x+x,M.p.y+x,x,i)),I+=4)}return r&&(console.log(`num probes: ${I}`),console.log(`best distance: ${E.d}`)),E.p}function bp(i,e){return e.max-i.max}function Ca(i,e,r,s){this.p=new me(i,e),this.h=r,this.d=function(o,u){let p=!1,f=1/0;for(let _=0;_o.y!=P.y>o.y&&o.x<(P.x-M.x)*(o.y-M.y)/(P.y-M.y)+M.x&&(p=!p),f=Math.min(f,Hc(o,M,P))}}return(p?1:-1)*Math.sqrt(f)}(this.p,s),this.max=this.d+this.h*Math.SQRT2}var yi;c.TextAnchorEnum=void 0,(yi=c.TextAnchorEnum||(c.TextAnchorEnum={}))[yi.center=1]="center",yi[yi.left=2]="left",yi[yi.right=3]="right",yi[yi.top=4]="top",yi[yi.bottom=5]="bottom",yi[yi["top-left"]=6]="top-left",yi[yi["top-right"]=7]="top-right",yi[yi["bottom-left"]=8]="bottom-left",yi[yi["bottom-right"]=9]="bottom-right";const ts=7,Pc=Number.POSITIVE_INFINITY;function pu(i,e){return e[1]!==Pc?function(r,s,o){let u=0,p=0;switch(s=Math.abs(s),o=Math.abs(o),r){case"top-right":case"top-left":case"top":p=o-ts;break;case"bottom-right":case"bottom-left":case"bottom":p=-o+ts}switch(r){case"top-right":case"bottom-right":case"right":u=-s;break;case"top-left":case"bottom-left":case"left":u=s}return[u,p]}(i,e[0],e[1]):function(r,s){let o=0,u=0;s<0&&(s=0);const p=s/Math.SQRT2;switch(r){case"top-right":case"top-left":u=p-ts;break;case"bottom-right":case"bottom-left":u=-p+ts;break;case"bottom":u=-s+ts;break;case"top":u=s-ts}switch(r){case"top-right":case"bottom-right":o=-p;break;case"top-left":case"bottom-left":o=p;break;case"left":o=s;break;case"right":o=-s}return[o,u]}(i,e[0])}function fu(i,e,r){var s;const o=i.layout,u=(s=o.get("text-variable-anchor-offset"))===null||s===void 0?void 0:s.evaluate(e,{},r);if(u){const f=u.values,_=[];for(let x=0;xI*ri);w.startsWith("top")?E[1]-=ts:w.startsWith("bottom")&&(E[1]+=ts),_[x+1]=E}return new fi(_)}const p=o.get("text-variable-anchor");if(p){let f;f=i._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[o.get("text-radial-offset").evaluate(e,{},r)*ri,Pc]:o.get("text-offset").evaluate(e,{},r).map(x=>x*ri);const _=[];for(const x of p)_.push(x,pu(x,f));return new fi(_)}return null}function zc(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function wp(i,e,r,s,o,u,p,f,_,x,w){let E=u.textMaxSize.evaluate(e,{});E===void 0&&(E=p);const I=i.layers[0].layout,M=I.get("icon-offset").evaluate(e,{},w),P=gu(r.horizontal),B=p/24,U=i.tilePixelRatio*B,$=i.tilePixelRatio*E/24,Q=i.tilePixelRatio*f,W=i.tilePixelRatio*I.get("symbol-spacing"),ie=I.get("text-padding")*i.tilePixelRatio,se=function(ye,qe,Fe,Qe=1){const Et=ye.get("icon-padding").evaluate(qe,{},Fe),At=Et&&Et.values;return[At[0]*Qe,At[1]*Qe,At[2]*Qe,At[3]*Qe]}(I,e,w,i.tilePixelRatio),he=I.get("text-max-angle")/180*Math.PI,Ce=I.get("text-rotation-alignment")!=="viewport"&&I.get("symbol-placement")!=="point",Re=I.get("icon-rotation-alignment")==="map"&&I.get("symbol-placement")!=="point",Ae=I.get("symbol-placement"),Se=W/2,ve=I.get("icon-text-fit");let ze;s&&ve!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(ze=Uh(s,r.vertical,ve,I.get("icon-text-fit-padding"),M,B)),P&&(s=Uh(s,P,ve,I.get("icon-text-fit-padding"),M,B)));const be=(ye,qe)=>{qe.x<0||qe.x>=Bt||qe.y<0||qe.y>=Bt||function(Fe,Qe,Et,At,ni,ar,Fi,Ht,oi,xi,Hi,Oi,Kt,si,Ci,Ui,Ki,Yi,Ft,vi,st,or,bi,Vi,zr){const jr=Fe.addToLineVertexArray(Qe,Et);let Gr,Pn,kr,xr,Ji=0,zn=0,Ao=0,vu=0,Uc=-1,Vc=-1;const kn={};let bu=mr("");if(Fe.allowVerticalPlacement&&At.vertical){const Mi=Ht.layout.get("text-rotate").evaluate(st,{},Vi)+90;kr=new Sl(oi,Qe,xi,Hi,Oi,At.vertical,Kt,si,Ci,Mi),Fi&&(xr=new Sl(oi,Qe,xi,Hi,Oi,Fi,Ki,Yi,Ci,Mi))}if(ni){const Mi=Ht.layout.get("icon-rotate").evaluate(st,{}),vr=Ht.layout.get("icon-text-fit")!=="none",Ls=uu(ni,Mi,bi,vr),Wr=Fi?uu(Fi,Mi,bi,vr):void 0;Pn=new Sl(oi,Qe,xi,Hi,Oi,ni,Ki,Yi,!1,Mi),Ji=4*Ls.length;const Bs=Fe.iconSizeData;let pn=null;Bs.kind==="source"?(pn=[dn*Ht.layout.get("icon-size").evaluate(st,{})],pn[0]>Jn&&Qt(`${Fe.layerIds[0]}: Value for "icon-size" is >= ${To}. Reduce your "icon-size".`)):Bs.kind==="composite"&&(pn=[dn*or.compositeIconSizes[0].evaluate(st,{},Vi),dn*or.compositeIconSizes[1].evaluate(st,{},Vi)],(pn[0]>Jn||pn[1]>Jn)&&Qt(`${Fe.layerIds[0]}: Value for "icon-size" is >= ${To}. Reduce your "icon-size".`)),Fe.addSymbols(Fe.icon,Ls,pn,vi,Ft,st,c.WritingMode.none,Qe,jr.lineStartIndex,jr.lineLength,-1,Vi),Uc=Fe.icon.placedSymbolArray.length-1,Wr&&(zn=4*Wr.length,Fe.addSymbols(Fe.icon,Wr,pn,vi,Ft,st,c.WritingMode.vertical,Qe,jr.lineStartIndex,jr.lineLength,-1,Vi),Vc=Fe.icon.placedSymbolArray.length-1)}const wu=Object.keys(At.horizontal);for(const Mi of wu){const vr=At.horizontal[Mi];if(!Gr){bu=mr(vr.text);const Wr=Ht.layout.get("text-rotate").evaluate(st,{},Vi);Gr=new Sl(oi,Qe,xi,Hi,Oi,vr,Kt,si,Ci,Wr)}const Ls=vr.positionedLines.length===1;if(Ao+=mu(Fe,Qe,vr,ar,Ht,Ci,st,Ui,jr,At.vertical?c.WritingMode.horizontal:c.WritingMode.horizontalOnly,Ls?wu:[Mi],kn,Uc,or,Vi),Ls)break}At.vertical&&(vu+=mu(Fe,Qe,At.vertical,ar,Ht,Ci,st,Ui,jr,c.WritingMode.vertical,["vertical"],kn,Vc,or,Vi));const Sp=Gr?Gr.boxStartIndex:Fe.collisionBoxArray.length,Ip=Gr?Gr.boxEndIndex:Fe.collisionBoxArray.length,Ap=kr?kr.boxStartIndex:Fe.collisionBoxArray.length,Cp=kr?kr.boxEndIndex:Fe.collisionBoxArray.length,Mp=Pn?Pn.boxStartIndex:Fe.collisionBoxArray.length,Pp=Pn?Pn.boxEndIndex:Fe.collisionBoxArray.length,zp=xr?xr.boxStartIndex:Fe.collisionBoxArray.length,kp=xr?xr.boxEndIndex:Fe.collisionBoxArray.length;let Xr=-1;const Al=(Mi,vr)=>Mi&&Mi.circleDiameter?Math.max(Mi.circleDiameter,vr):vr;Xr=Al(Gr,Xr),Xr=Al(kr,Xr),Xr=Al(Pn,Xr),Xr=Al(xr,Xr);const Tu=Xr>-1?1:0;Tu&&(Xr*=zr/ri),Fe.glyphOffsetArray.length>=Ia.MAX_GLYPHS&&Qt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),st.sortKey!==void 0&&Fe.addToSortKeyRanges(Fe.symbolInstances.length,st.sortKey);const Dp=fu(Ht,st,Vi),[Lp,Bp]=function(Mi,vr){const Ls=Mi.length,Wr=vr==null?void 0:vr.values;if((Wr==null?void 0:Wr.length)>0)for(let Bs=0;Bs=0?kn.right:-1,kn.center>=0?kn.center:-1,kn.left>=0?kn.left:-1,kn.vertical||-1,Uc,Vc,bu,Sp,Ip,Ap,Cp,Mp,Pp,zp,kp,xi,Ao,vu,Ji,zn,Tu,0,Kt,Xr,Lp,Bp)}(i,qe,ye,r,s,o,ze,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,U,[ie,ie,ie,ie],Ce,_,Q,se,Re,M,e,u,x,w,p)};if(Ae==="line")for(const ye of su(e.geometry,0,0,Bt,Bt)){const qe=_p(ye,W,he,r.vertical||P,s,24,$,i.overscaling,Bt);for(const Fe of qe)P&&Tp(i,P.text,Se,Fe)||be(ye,Fe)}else if(Ae==="line-center"){for(const ye of e.geometry)if(ye.length>1){const qe=gp(ye,he,r.vertical||P,s,24,$);qe&&be(ye,qe)}}else if(e.type==="Polygon")for(const ye of cc(e.geometry,0)){const qe=vp(ye,16);be(ye[0],new es(qe.x,qe.y,0))}else if(e.type==="LineString")for(const ye of e.geometry)be(ye,new es(ye[0].x,ye[0].y,0));else if(e.type==="Point")for(const ye of e.geometry)for(const qe of ye)be([qe],new es(qe.x,qe.y,0))}function mu(i,e,r,s,o,u,p,f,_,x,w,E,I,M,P){const B=function(Q,W,ie,se,he,Ce,Re,Ae){const Se=se.layout.get("text-rotate").evaluate(Ce,{})*Math.PI/180,ve=[];for(const ze of W.positionedLines)for(const be of ze.positionedGlyphs){if(!be.rect)continue;const ye=be.rect||{};let qe=kh+1,Fe=!0,Qe=1,Et=0;const At=(he||Ae)&&be.vertical,ni=be.metrics.advance*be.scale/2;if(Ae&&W.verticalizable&&(Et=ze.lineOffset/2-(be.imageName?-(ri-be.metrics.width*be.scale)/2:(be.scale-1)*ri)),be.imageName){const Ft=Re[be.imageName];Fe=Ft.sdf,Qe=Ft.pixelRatio,qe=Wi/Qe}const ar=he?[be.x+ni,be.y]:[0,0];let Fi=he?[0,0]:[be.x+ni+ie[0],be.y+ie[1]-Et],Ht=[0,0];At&&(Ht=Fi,Fi=[0,0]);const oi=(be.metrics.left-qe)*be.scale-ni+Fi[0],xi=(-be.metrics.top-qe)*be.scale+Fi[1],Hi=oi+ye.w*be.scale/Qe,Oi=xi+ye.h*be.scale/Qe,Kt=new me(oi,xi),si=new me(Hi,xi),Ci=new me(oi,Oi),Ui=new me(Hi,Oi);if(At){const Ft=new me(-ni,ni-bo),vi=-Math.PI/2,st=ri/2-ni,or=new me(5-bo-st,-(be.imageName?st:0)),bi=new me(...Ht);Kt._rotateAround(vi,Ft)._add(or)._add(bi),si._rotateAround(vi,Ft)._add(or)._add(bi),Ci._rotateAround(vi,Ft)._add(or)._add(bi),Ui._rotateAround(vi,Ft)._add(or)._add(bi)}if(Se){const Ft=Math.sin(Se),vi=Math.cos(Se),st=[vi,-Ft,Ft,vi];Kt._matMult(st),si._matMult(st),Ci._matMult(st),Ui._matMult(st)}const Ki=new me(0,0),Yi=new me(0,0);ve.push({tl:Kt,tr:si,bl:Ci,br:Ui,tex:ye,writingMode:W.writingMode,glyphOffset:ar,sectionIndex:be.sectionIndex,isSDF:Fe,pixelOffsetTL:Ki,pixelOffsetBR:Yi,minFontScaleX:0,minFontScaleY:0})}return ve}(0,r,f,o,u,p,s,i.allowVerticalPlacement),U=i.textSizeData;let $=null;U.kind==="source"?($=[dn*o.layout.get("text-size").evaluate(p,{})],$[0]>Jn&&Qt(`${i.layerIds[0]}: Value for "text-size" is >= ${To}. Reduce your "text-size".`)):U.kind==="composite"&&($=[dn*M.compositeTextSizes[0].evaluate(p,{},P),dn*M.compositeTextSizes[1].evaluate(p,{},P)],($[0]>Jn||$[1]>Jn)&&Qt(`${i.layerIds[0]}: Value for "text-size" is >= ${To}. Reduce your "text-size".`)),i.addSymbols(i.text,B,$,f,u,p,x,e,_.lineStartIndex,_.lineLength,I,P);for(const Q of w)E[Q]=i.text.placedSymbolArray.length-1;return 4*B.length}function gu(i){for(const e in i)return i[e];return null}function Tp(i,e,r,s){const o=i.compareText;if(e in o){const u=o[e];for(let p=u.length-1;p>=0;p--)if(s.dist(u[p])>4;if(o!==1)throw new Error(`Got v${o} data when expected v1.`);const u=_u[15&s];if(!u)throw new Error("Unrecognized array type.");const[p]=new Uint16Array(e,2,1),[f]=new Uint32Array(e,4,1);return new kc(f,p,u,e)}constructor(e,r=64,s=Float64Array,o){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=s,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const u=_u.indexOf(this.ArrayType),p=2*e*this.ArrayType.BYTES_PER_ELEMENT,f=e*this.IndexArrayType.BYTES_PER_ELEMENT,_=(8-f%8)%8;if(u<0)throw new Error(`Unexpected typed array class: ${s}.`);o&&o instanceof ArrayBuffer?(this.data=o,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+_,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+p+f+_),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+_,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+u]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=e)}add(e,r){const s=this._pos>>1;return this.ids[s]=s,this.coords[this._pos++]=e,this.coords[this._pos++]=r,s}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Dc(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,s,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:u,coords:p,nodeSize:f}=this,_=[0,u.length-1,0],x=[];for(;_.length;){const w=_.pop()||0,E=_.pop()||0,I=_.pop()||0;if(E-I<=f){for(let U=I;U<=E;U++){const $=p[2*U],Q=p[2*U+1];$>=e&&$<=s&&Q>=r&&Q<=o&&x.push(u[U])}continue}const M=I+E>>1,P=p[2*M],B=p[2*M+1];P>=e&&P<=s&&B>=r&&B<=o&&x.push(u[M]),(w===0?e<=P:r<=B)&&(_.push(I),_.push(M-1),_.push(1-w)),(w===0?s>=P:o>=B)&&(_.push(M+1),_.push(E),_.push(1-w))}return x}within(e,r,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:o,coords:u,nodeSize:p}=this,f=[0,o.length-1,0],_=[],x=s*s;for(;f.length;){const w=f.pop()||0,E=f.pop()||0,I=f.pop()||0;if(E-I<=p){for(let U=I;U<=E;U++)xu(u[2*U],u[2*U+1],e,r)<=x&&_.push(o[U]);continue}const M=I+E>>1,P=u[2*M],B=u[2*M+1];xu(P,B,e,r)<=x&&_.push(o[M]),(w===0?e-s<=P:r-s<=B)&&(f.push(I),f.push(M-1),f.push(1-w)),(w===0?e+s>=P:r+s>=B)&&(f.push(M+1),f.push(E),f.push(1-w))}return _}}function Dc(i,e,r,s,o,u){if(o-s<=r)return;const p=s+o>>1;yu(i,e,p,s,o,u),Dc(i,e,r,s,p-1,1-u),Dc(i,e,r,p+1,o,1-u)}function yu(i,e,r,s,o,u){for(;o>s;){if(o-s>600){const x=o-s+1,w=r-s+1,E=Math.log(x),I=.5*Math.exp(2*E/3),M=.5*Math.sqrt(E*I*(x-I)/x)*(w-x/2<0?-1:1);yu(i,e,r,Math.max(s,Math.floor(r-w*I/x+M)),Math.min(o,Math.floor(r+(x-w)*I/x+M)),u)}const p=e[2*r+u];let f=s,_=o;for(So(i,e,s,r),e[2*o+u]>p&&So(i,e,s,o);f<_;){for(So(i,e,f,_),f++,_--;e[2*f+u]p;)_--}e[2*s+u]===p?So(i,e,s,_):(_++,So(i,e,_,o)),_<=r&&(s=_+1),r<=_&&(o=_-1)}}function So(i,e,r,s){Lc(i,r,s),Lc(e,2*r,2*s),Lc(e,2*r+1,2*s+1)}function Lc(i,e,r){const s=i[e];i[e]=i[r],i[r]=s}function xu(i,e,r,s){const o=i-r,u=e-s;return o*o+u*u}var Bc;c.PerformanceMarkers=void 0,(Bc=c.PerformanceMarkers||(c.PerformanceMarkers={})).create="create",Bc.load="load",Bc.fullLoad="fullLoad";let Il=null,Io=[];const Rc=1e3/60,Fc="loadTime",Oc="fullLoadTime",Ep={mark(i){performance.mark(i)},frame(i){const e=i;Il!=null&&Io.push(e-Il),Il=e},clearMetrics(){Il=null,Io=[],performance.clearMeasures(Fc),performance.clearMeasures(Oc);for(const i in c.PerformanceMarkers)performance.clearMarks(c.PerformanceMarkers[i])},getPerformanceMetrics(){performance.measure(Fc,c.PerformanceMarkers.create,c.PerformanceMarkers.load),performance.measure(Oc,c.PerformanceMarkers.create,c.PerformanceMarkers.fullLoad);const i=performance.getEntriesByName(Fc)[0].duration,e=performance.getEntriesByName(Oc)[0].duration,r=Io.length,s=1/(Io.reduce((u,p)=>u+p,0)/r/1e3),o=Io.filter(u=>u>Rc).reduce((u,p)=>u+(p-Rc)/Rc,0);return{loadTime:i,fullLoadTime:e,fps:s,percentDroppedFrames:o/(r+o)*100,totalFrames:r}}};c.AJAXError=cr,c.ARRAY_TYPE=va,c.Actor=class{constructor(i,e,r){this.receive=s=>{const o=s.data,u=o.id;if(u&&(!o.targetMapId||this.mapId===o.targetMapId))if(o.type===""){delete this.tasks[u];const p=this.cancelCallbacks[u];delete this.cancelCallbacks[u],p&&p()}else Pi()||o.mustQueue?(this.tasks[u]=o,this.taskQueue.push(u),this.invoker.trigger()):this.processTask(u,o)},this.process=()=>{if(!this.taskQueue.length)return;const s=this.taskQueue.shift(),o=this.tasks[s];delete this.tasks[s],this.taskQueue.length&&this.invoker.trigger(),o&&this.processTask(s,o)},this.target=i,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},this.invoker=new fp(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=Pi()?i:window}send(i,e,r,s,o=!1){const u=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[u]=r);const p=Dr(this.globalScope)?void 0:[];return this.target.postMessage({id:u,type:i,hasCallback:!!r,targetMapId:s,mustQueue:o,sourceMapId:this.mapId,data:Ts(e,p)},p),{cancel:()=>{r&&delete this.callbacks[u],this.target.postMessage({id:u,type:"",targetMapId:s,sourceMapId:this.mapId})}}}processTask(i,e){if(e.type===""){const r=this.callbacks[i];delete this.callbacks[i],r&&(e.error?r(Tn(e.error)):r(null,Tn(e.data)))}else{let r=!1;const s=Dr(this.globalScope)?void 0:[],o=e.hasCallback?(f,_)=>{r=!0,delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"",sourceMapId:this.mapId,error:f?Ts(f):null,data:Ts(_,s)},s)}:f=>{r=!0};let u=null;const p=Tn(e.data);if(this.parent[e.type])u=this.parent[e.type](e.sourceMapId,p,o);else if(this.parent.getWorkerSource){const f=e.type.split(".");u=this.parent.getWorkerSource(e.sourceMapId,f[0],p.source)[f[1]](p,o)}else o(new Error(`Could not find function ${e.type}`));!r&&u&&u.cancel&&(this.cancelCallbacks[i]=u.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},c.AlphaImage=po,c.CanonicalTileID=Mc,c.CollisionBoxArray=g,c.CollisionCircleLayoutArray=class extends oo{},c.Color=Xe,c.DEMData=Qh,c.DataConstantProperty=Ue,c.DictionaryCoder=eu,c.EXTENT=Bt,c.ErrorEvent=Ni,c.EvaluationParameters=St,c.Event=Ii,c.Evented=pr,c.FeatureIndex=iu,c.FillBucket=dc,c.FillExtrusionBucket=fc,c.GeoJSONFeature=tu,c.ImageAtlas=Lh,c.ImagePosition=xc,c.KDBush=kc,c.LineBucket=mc,c.LineStripIndexArray=class extends l{},c.LngLat=Qn,c.MercatorCoordinate=bl,c.ONE_EM=ri,c.OverscaledTileID=yr,c.PerformanceUtils=Ep,c.Point=me,c.Pos3dArray=class extends Ms{},c.PosArray=ne,c.Properties=Li,c.Protobuf=_c,c.QuadTriangleArray=class extends _a{},c.RGBAImage=_r,c.RasterBoundsArray=class extends Ps{},c.RequestPerformance=class{constructor(i){this._marks={start:[i.url,"start"].join("#"),end:[i.url,"end"].join("#"),measure:i.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let i=performance.getEntriesByName(this._marks.measure);return i.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),i=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),i}},c.SegmentVector=$e,c.SymbolBucket=Ia,c.Transitionable=nl,c.TriangleIndexArray=Ne,c.Uniform1f=ti,c.Uniform1i=class extends qt{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},c.Uniform2f=class extends qt{constructor(i,e){super(i,e),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},c.Uniform3f=class extends qt{constructor(i,e){super(i,e),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},c.Uniform4f=gi,c.UniformColor=Wn,c.UniformMatrix4f=class extends qt{constructor(i,e){super(i,e),this.current=ii}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let e=1;e<16;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},c.UnwrappedTileID=Jh,c.ValidationError=we,c.ZoomHistory=Wa,c.addDynamicAttributes=Tc,c.arrayBufferToImage=function(i,e){const r=new Image;r.onload=()=>{e(null,r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame(()=>{r.src=Ei})},r.onerror=()=>e(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const s=new Blob([new Uint8Array(i)],{type:"image/png"});r.src=i.byteLength?URL.createObjectURL(s):Ei},c.arrayBufferToImageBitmap=function(i,e){const r=new Blob([new Uint8Array(i)],{type:"image/png"});createImageBitmap(r).then(s=>{e(null,s)}).catch(s=>{e(new Error(`Could not load image because of ${s.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})},c.asyncAll=function(i,e,r){if(!i.length)return r(null,[]);let s=i.length;const o=new Array(i.length);let u=null;i.forEach((p,f)=>{e(p,(_,x)=>{_&&(u=_),o[f]=x,--s==0&&r(u,o)})})},c.bezier=ai,c.browser=en,c.clamp=vt,c.clipLine=su,c.clone=function(i){var e=new va(16);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},c.clone$1=wi,c.collisionCircleLayout=$d,c.config=Ln,c.copy=function(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},c.create=function(){var i=new va(16);return va!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},c.createExpression=nt,c.createFilter=$a,c.createLayout=$t,c.createStyleLayer=function(i){if(i.type==="custom")return new pp(i);switch(i.type){case"background":return new hp(i);case"circle":return new Hu(i);case"fill":return new md(i);case"fill-extrusion":return new Pd(i);case"heatmap":return new Yu(i);case"hillshade":return new Qu(i);case"line":return new Od(i);case"raster":return new dp(i);case"symbol":return new vl(i)}},c.deepEqual=function i(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(let s=0;s{s[p.source]?r.push({command:ht.removeLayer,args:[p.id]}):u.push(p)}),r=r.concat(o),function(p,f,_){f=f||[];const x=(p=p||[]).map(is),w=f.map(is),E=p.reduce(Rn,{}),I=f.reduce(Rn,{}),M=x.slice(),P=Object.create(null);let B,U,$,Q,W,ie,se;for(B=0,U=0;B{}}},c.groupByLayout=function(i,e){const r={};for(let o=0;o@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,s,o,u)=>{const p=o||u;return e[s]=!p||p.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e},c.parseGlyphPbf=function(i){return new _c(i).readFields(Qd,[])},c.pbf=Sh,c.performSymbolLayout=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=Bt/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;const e=i.bucket.layers[0],r=e.layout,s=e._unevaluatedLayout._values,o={layoutIconSize:s["icon-size"].possiblyEvaluate(new St(i.bucket.zoom+1),i.canonical),layoutTextSize:s["text-size"].possiblyEvaluate(new St(i.bucket.zoom+1),i.canonical),textMaxSize:s["text-size"].possiblyEvaluate(new St(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:x,maxZoom:w}=i.bucket.textSizeData;o.compositeTextSizes=[s["text-size"].possiblyEvaluate(new St(x),i.canonical),s["text-size"].possiblyEvaluate(new St(w),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:x,maxZoom:w}=i.bucket.iconSizeData;o.compositeIconSizes=[s["icon-size"].possiblyEvaluate(new St(x),i.canonical),s["icon-size"].possiblyEvaluate(new St(w),i.canonical)]}const u=r.get("text-line-height")*ri,p=r.get("text-rotation-alignment")!=="viewport"&&r.get("symbol-placement")!=="point",f=r.get("text-keep-upright"),_=r.get("text-size");for(const x of i.bucket.features){const w=r.get("text-font").evaluate(x,{},i.canonical).join(","),E=_.evaluate(x,{},i.canonical),I=o.layoutTextSize.evaluate(x,{},i.canonical),M=o.layoutIconSize.evaluate(x,{},i.canonical),P={horizontal:{},vertical:void 0},B=x.text;let U,$=[0,0];if(B){const ie=B.toString(),se=r.get("text-letter-spacing").evaluate(x,{},i.canonical)*ri,he=tl(ie)?se:0,Ce=r.get("text-anchor").evaluate(x,{},i.canonical),Re=fu(e,x,i.canonical);if(!Re){const be=r.get("text-radial-offset").evaluate(x,{},i.canonical);$=be?pu(Ce,[be*ri,Pc]):r.get("text-offset").evaluate(x,{},i.canonical).map(ye=>ye*ri)}let Ae=p?"center":r.get("text-justify").evaluate(x,{},i.canonical);const Se=r.get("symbol-placement"),ve=Se==="point"?r.get("text-max-width").evaluate(x,{},i.canonical)*ri:0,ze=()=>{i.bucket.allowVerticalPlacement&&ha(ie)&&(P.vertical=_l(B,i.glyphMap,i.glyphPositions,i.imagePositions,w,ve,u,Ce,"left",he,$,c.WritingMode.vertical,!0,Se,I,E))};if(!p&&Re){const be=new Set;if(Ae==="auto")for(let qe=0;qethis._layers[de.id]),J=q[0];if(J.visibility==="none")continue;const G=J.source||"";let j=this.familiesBySource[G];j||(j=this.familiesBySource[G]={});const te=J.sourceLayer||"_geojsonTileLayer";let ue=j[te];ue||(ue=j[te]=[]),ue.push(q)}}}class re{constructor(S){const A={},z=[];for(const G in S){const j=S[G],te=A[G]={};for(const ue in j){const de=j[+ue];if(!de||de.bitmap.width===0||de.bitmap.height===0)continue;const pe={x:0,y:0,w:de.bitmap.width+2,h:de.bitmap.height+2};z.push(pe),te[ue]={rect:pe,metrics:de.metrics}}}const{w:V,h:q}=c.potpack(z),J=new c.AlphaImage({width:V||1,height:q||1});for(const G in S){const j=S[G];for(const te in j){const ue=j[+te];if(!ue||ue.bitmap.width===0||ue.bitmap.height===0)continue;const de=A[G][te].rect;c.AlphaImage.copy(ue.bitmap,J,{x:0,y:0},{x:de.x+1,y:de.y+1},ue.bitmap)}}this.image=J,this.positions=A}}c.register("GlyphAtlas",re);class De{constructor(S){this.tileID=new c.OverscaledTileID(S.tileID.overscaledZ,S.tileID.wrap,S.tileID.canonical.z,S.tileID.canonical.x,S.tileID.canonical.y),this.uid=S.uid,this.zoom=S.zoom,this.pixelRatio=S.pixelRatio,this.tileSize=S.tileSize,this.source=S.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=S.showCollisionBoxes,this.collectResourceTiming=!!S.collectResourceTiming,this.returnDependencies=!!S.returnDependencies,this.promoteId=S.promoteId,this.inFlightDependencies=[],this.dependencySentinel=-1}parse(S,A,z,V,q){this.status="parsing",this.data=S,this.collisionBoxArray=new c.CollisionBoxArray;const J=new c.DictionaryCoder(Object.keys(S.layers).sort()),G=new c.FeatureIndex(this.tileID,this.promoteId);G.bucketLayerIDs=[];const j={},te={featureIndex:G,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:z},ue=A.familiesBySource[this.source];for(const rt in ue){const at=S.layers[rt];if(!at)continue;at.version===1&&c.warnOnce(`Vector tile source "${this.source}" layer "${rt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const ki=J.encode(rt),Xe=[];for(let Gt=0;Gt=hi.maxzoom||hi.visibility!=="none"&&(me(Gt,this.zoom,z),(j[hi.id]=hi.createBucket({index:G.bucketLayerIDs.length,layers:Gt,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:ki,sourceID:this.source})).populate(Xe,te,this.tileID.canonical),G.bucketLayerIDs.push(Gt.map(Ot=>Ot.id)))}}let de,pe,Ze,He;const Le=c.mapObject(te.glyphDependencies,rt=>Object.keys(rt).map(Number));this.inFlightDependencies.forEach(rt=>rt==null?void 0:rt.cancel()),this.inFlightDependencies=[];const Ve=++this.dependencySentinel;Object.keys(Le).length?this.inFlightDependencies.push(V.send("getGlyphs",{uid:this.uid,stacks:Le,source:this.source,tileID:this.tileID,type:"glyphs"},(rt,at)=>{Ve===this.dependencySentinel&&(de||(de=rt,pe=at,_t.call(this)))})):pe={};const We=Object.keys(te.iconDependencies);We.length?this.inFlightDependencies.push(V.send("getImages",{icons:We,source:this.source,tileID:this.tileID,type:"icons"},(rt,at)=>{Ve===this.dependencySentinel&&(de||(de=rt,Ze=at,_t.call(this)))})):Ze={};const ot=Object.keys(te.patternDependencies);function _t(){if(de)return q(de);if(pe&&Ze&&He){const rt=new re(pe),at=new c.ImageAtlas(Ze,He);for(const ki in j){const Xe=j[ki];Xe instanceof c.SymbolBucket?(me(Xe.layers,this.zoom,z),c.performSymbolLayout({bucket:Xe,glyphMap:pe,glyphPositions:rt.positions,imageMap:Ze,imagePositions:at.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Xe.hasPattern&&(Xe instanceof c.LineBucket||Xe instanceof c.FillBucket||Xe instanceof c.FillExtrusionBucket)&&(me(Xe.layers,this.zoom,z),Xe.addFeatures(te,this.tileID.canonical,at.patternPositions))}this.status="done",q(null,{buckets:Object.values(j).filter(ki=>!ki.isEmpty()),featureIndex:G,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:rt.image,imageAtlas:at,glyphMap:this.returnDependencies?pe:null,iconMap:this.returnDependencies?Ze:null,glyphPositions:this.returnDependencies?rt.positions:null})}}ot.length?this.inFlightDependencies.push(V.send("getImages",{icons:ot,source:this.source,tileID:this.tileID,type:"patterns"},(rt,at)=>{Ve===this.dependencySentinel&&(de||(de=rt,He=at,_t.call(this)))})):He={},_t.call(this)}}function me(O,S,A){const z=new c.EvaluationParameters(S);for(const V of O)V.recalculate(z,A)}function dt(O,S){const A=c.getArrayBuffer(O.request,(z,V,q,J)=>{z?S(z):V&&S(null,{vectorTile:new c.vectorTile.VectorTile(new c.Protobuf(V)),rawData:V,cacheControl:q,expires:J})});return()=>{A.cancel(),S()}}class Ct{constructor(S,A,z,V){this.actor=S,this.layerIndex=A,this.availableImages=z,this.loadVectorData=V||dt,this.fetching={},this.loading={},this.loaded={}}loadTile(S,A){const z=S.uid;this.loading||(this.loading={});const V=!!(S&&S.request&&S.request.collectResourceTiming)&&new c.RequestPerformance(S.request),q=this.loading[z]=new De(S);q.abort=this.loadVectorData(S,(J,G)=>{if(delete this.loading[z],J||!G)return q.status="done",this.loaded[z]=q,A(J);const j=G.rawData,te={};G.expires&&(te.expires=G.expires),G.cacheControl&&(te.cacheControl=G.cacheControl);const ue={};if(V){const de=V.finish();de&&(ue.resourceTiming=JSON.parse(JSON.stringify(de)))}q.vectorTile=G.vectorTile,q.parse(G.vectorTile,this.layerIndex,this.availableImages,this.actor,(de,pe)=>{if(delete this.fetching[z],de||!pe)return A(de);A(null,c.extend({rawTileData:j.slice(0)},pe,te,ue))}),this.loaded=this.loaded||{},this.loaded[z]=q,this.fetching[z]={rawTileData:j,cacheControl:te,resourceTiming:ue}})}reloadTile(S,A){const z=this.loaded,V=S.uid;if(z&&z[V]){const q=z[V];q.showCollisionBoxes=S.showCollisionBoxes,q.status==="parsing"?q.parse(q.vectorTile,this.layerIndex,this.availableImages,this.actor,(J,G)=>{if(J||!G)return A(J,G);let j;if(this.fetching[V]){const{rawTileData:te,cacheControl:ue,resourceTiming:de}=this.fetching[V];delete this.fetching[V],j=c.extend({rawTileData:te.slice(0)},G,ue,de)}else j=G;A(null,j)}):q.status==="done"&&(q.vectorTile?q.parse(q.vectorTile,this.layerIndex,this.availableImages,this.actor,A):A())}}abortTile(S,A){const z=this.loading,V=S.uid;z&&z[V]&&z[V].abort&&(z[V].abort(),delete z[V]),A()}removeTile(S,A){const z=this.loaded,V=S.uid;z&&z[V]&&delete z[V],A()}}class Yt{constructor(){this.loaded={}}loadTile(S,A){const{uid:z,encoding:V,rawImageData:q}=S,J=c.isImageBitmap(q)?this.getImageData(q):q,G=new c.DEMData(z,J,V);this.loaded=this.loaded||{},this.loaded[z]=G,A(null,G)}getImageData(S){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(S.width,S.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=S.width,this.offscreenCanvas.height=S.height,this.offscreenCanvasContext.drawImage(S,0,0,S.width,S.height);const A=this.offscreenCanvasContext.getImageData(-1,-1,S.width+2,S.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new c.RGBAImage({width:A.width,height:A.height},A.data)}removeTile(S){const A=this.loaded,z=S.uid;A&&A[z]&&delete A[z]}}function ai(O,S){if(O.length!==0){jt(O[0],S);for(var A=1;A=Math.abs(G)?A-j+G:G-j+A,A=j}A+z>=0!=!!S&&O.reverse()}var vt=c.getDefaultExportFromCjs(function O(S,A){var z,V=S&&S.type;if(V==="FeatureCollection")for(z=0;z>31}function Lr(O,S){for(var A=O.loadGeometry(),z=O.type,V=0,q=0,J=A.length,G=0;GO},cr=Math.fround||(li=new Float32Array(1),O=>(li[0]=+O,li[0]));var li;const Si=3,mt=5,hr=6;class Br{constructor(S){this.options=Object.assign(Object.create(Ln),S),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(S){const{log:A,minZoom:z,maxZoom:V}=this.options;A&&console.time("total time");const q=`prepare ${S.length} points`;A&&console.time(q),this.points=S;const J=[];for(let j=0;j=z;j--){const te=+Date.now();G=this.trees[j]=this._createTree(this._cluster(G,j)),A&&console.log("z%d: %d clusters in %dms",j,G.numItems,+Date.now()-te)}return A&&console.timeEnd("total time"),this}getClusters(S,A){let z=((S[0]+180)%360+360)%360-180;const V=Math.max(-90,Math.min(90,S[1]));let q=S[2]===180?180:((S[2]+180)%360+360)%360-180;const J=Math.max(-90,Math.min(90,S[3]));if(S[2]-S[0]>=360)z=-180,q=180;else if(z>q){const de=this.getClusters([z,V,180,J],A),pe=this.getClusters([-180,V,q,J],A);return de.concat(pe)}const G=this.trees[this._limitZoom(A)],j=G.range(dr(z),Ii(J),dr(q),Ii(V)),te=G.data,ue=[];for(const de of j){const pe=this.stride*de;ue.push(te[pe+mt]>1?ur(te,pe,this.clusterProps):this.points[te[pe+Si]])}return ue}getChildren(S){const A=this._getOriginId(S),z=this._getOriginZoom(S),V="No cluster with the specified id.",q=this.trees[z];if(!q)throw new Error(V);const J=q.data;if(A*this.stride>=J.length)throw new Error(V);const G=this.options.radius/(this.options.extent*Math.pow(2,z-1)),j=q.within(J[A*this.stride],J[A*this.stride+1],G),te=[];for(const ue of j){const de=ue*this.stride;J[de+4]===S&&te.push(J[de+mt]>1?ur(J,de,this.clusterProps):this.points[J[de+Si]])}if(te.length===0)throw new Error(V);return te}getLeaves(S,A,z){const V=[];return this._appendLeaves(V,S,A=A||10,z=z||0,0),V}getTile(S,A,z){const V=this.trees[this._limitZoom(S)],q=Math.pow(2,S),{extent:J,radius:G}=this.options,j=G/J,te=(z-j)/q,ue=(z+1+j)/q,de={features:[]};return this._addTileFeatures(V.range((A-j)/q,te,(A+1+j)/q,ue),V.data,A,z,q,de),A===0&&this._addTileFeatures(V.range(1-j/q,te,1,ue),V.data,q,z,q,de),A===q-1&&this._addTileFeatures(V.range(0,te,j/q,ue),V.data,-1,z,q,de),de.features.length?de:null}getClusterExpansionZoom(S){let A=this._getOriginZoom(S)-1;for(;A<=this.options.maxZoom;){const z=this.getChildren(S);if(A++,z.length!==1)break;S=z[0].properties.cluster_id}return A}_appendLeaves(S,A,z,V,q){const J=this.getChildren(A);for(const G of J){const j=G.properties;if(j&&j.cluster?q+j.point_count<=V?q+=j.point_count:q=this._appendLeaves(S,j.cluster_id,z,V,q):q1;let ue,de,pe;if(te)ue=Rr(A,j,this.clusterProps),de=A[j],pe=A[j+1];else{const Le=this.points[A[j+Si]];ue=Le.properties;const[Ve,We]=Le.geometry.coordinates;de=dr(Ve),pe=Ii(We)}const Ze={type:1,geometry:[[Math.round(this.options.extent*(de*q-z)),Math.round(this.options.extent*(pe*q-V))]],tags:ue};let He;He=te||this.options.generateId?A[j+Si]:this.points[A[j+Si]].id,He!==void 0&&(Ze.id=He),J.features.push(Ze)}}_limitZoom(S){return Math.max(this.options.minZoom,Math.min(Math.floor(+S),this.options.maxZoom+1))}_cluster(S,A){const{radius:z,extent:V,reduce:q,minPoints:J}=this.options,G=z/(V*Math.pow(2,A)),j=S.data,te=[],ue=this.stride;for(let de=0;deA&&(Ve+=j[ot+mt])}if(Ve>Le&&Ve>=J){let We,ot=pe*Le,_t=Ze*Le,rt=-1;const at=((de/ue|0)<<5)+(A+1)+this.points.length;for(const ki of He){const Xe=ki*ue;if(j[Xe+2]<=A)continue;j[Xe+2]=A;const Gt=j[Xe+mt];ot+=j[Xe]*Gt,_t+=j[Xe+1]*Gt,j[Xe+4]=at,q&&(We||(We=this._map(j,de,!0),rt=this.clusterProps.length,this.clusterProps.push(We)),q(We,this._map(j,Xe)))}j[de+4]=at,te.push(ot/Ve,_t/Ve,1/0,at,-1,Ve),q&&te.push(rt)}else{for(let We=0;We1)for(const We of He){const ot=We*ue;if(!(j[ot+2]<=A)){j[ot+2]=A;for(let _t=0;_t>5}_getOriginZoom(S){return(S-this.points.length)%32}_map(S,A,z){if(S[A+mt]>1){const J=this.clusterProps[S[A+hr]];return z?Object.assign({},J):J}const V=this.points[S[A+Si]].properties,q=this.options.map(V);return z&&q===V?Object.assign({},q):q}}function ur(O,S,A){return{type:"Feature",id:O[S+Si],properties:Rr(O,S,A),geometry:{type:"Point",coordinates:[(z=O[S],360*(z-.5)),Ni(O[S+1])]}};var z}function Rr(O,S,A){const z=O[S+mt],V=z>=1e4?`${Math.round(z/1e3)}k`:z>=1e3?Math.round(z/100)/10+"k":z,q=O[S+hr],J=q===-1?{}:Object.assign({},A[q]);return Object.assign(J,{cluster:!0,cluster_id:O[S+Si],point_count:z,point_count_abbreviated:V})}function dr(O){return O/360+.5}function Ii(O){const S=Math.sin(O*Math.PI/180),A=.5-.25*Math.log((1+S)/(1-S))/Math.PI;return A<0?0:A>1?1:A}function Ni(O){const S=(180-360*O)*Math.PI/180;return 360*Math.atan(Math.exp(S))/Math.PI-90}function pr(O,S,A,z){for(var V,q=z,J=A-S>>1,G=A-S,j=O[S],te=O[S+1],ue=O[A],de=O[A+1],pe=S+3;peq)V=pe,q=Ze;else if(Ze===q){var He=Math.abs(pe-J);Hez&&(V-S>3&&pr(O,S,V,z),O[V+2]=q,A-V>3&&pr(O,V,A,z))}function le(O,S,A,z,V,q){var J=V-A,G=q-z;if(J!==0||G!==0){var j=((O-A)*J+(S-z)*G)/(J*J+G*G);j>1?(A=V,z=q):j>0&&(A+=J*j,z+=G*j)}return(J=O-A)*J+(G=S-z)*G}function Fr(O,S,A,z){var V={id:O===void 0?null:O,type:S,geometry:A,tags:z,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(q){var J=q.geometry,G=q.type;if(G==="Point"||G==="MultiPoint"||G==="LineString")Bn(q,J);else if(G==="Polygon"||G==="MultiLineString")for(var j=0;j0&&(J+=z?(V*te-j*q)/2:Math.sqrt(Math.pow(j-V,2)+Math.pow(te-q,2))),V=j,q=te}var ue=S.length-3;S[2]=1,pr(S,0,ue,A),S[ue+2]=1,S.size=Math.abs(J),S.start=0,S.end=S.size}function mn(O,S,A,z){for(var V=0;V1?1:A}function Dt(O,S,A,z,V,q,J,G){if(z/=S,q>=(A/=S)&&J=z)return null;for(var j=[],te=0;te=A&&He=z)){var Le=[];if(pe==="Point"||pe==="MultiPoint")is(de,Le,A,z,V);else if(pe==="LineString")Rn(de,Le,A,z,V,!1,G.lineMetrics);else if(pe==="MultiLineString")Ai(de,Le,A,z,V,!1);else if(pe==="Polygon")Ai(de,Le,A,z,V,!0);else if(pe==="MultiPolygon")for(var Ve=0;Ve=A&&J<=z&&(S.push(O[q]),S.push(O[q+1]),S.push(O[q+2]))}}function Rn(O,S,A,z,V,q,J){for(var G,j,te=we(O),ue=V===0?Or:tn,de=O.start,pe=0;peA&&(j=ue(te,Ze,He,Ve,We,A),J&&(te.start=de+G*j)):ot>z?_t=A&&(j=ue(te,Ze,He,Ve,We,A),rt=!0),_t>z&&ot<=z&&(j=ue(te,Ze,He,Ve,We,z),rt=!0),!q&&rt&&(J&&(te.end=de+G*j),S.push(te),te=we(O)),J&&(de+=G)}var at=O.length-3;Ze=O[at],He=O[at+1],Le=O[at+2],(ot=V===0?Ze:He)>=A&&ot<=z&&zi(te,Ze,He,Le),at=te.length-3,q&&at>=3&&(te[at]!==te[0]||te[at+1]!==te[1])&&zi(te,te[0],te[1],te[2]),te.length&&S.push(te)}function we(O){var S=[];return S.size=O.size,S.start=O.start,S.end=O.end,S}function Ai(O,S,A,z,V,q){for(var J=0;JJ.maxX&&(J.maxX=ue),de>J.maxY&&(J.maxY=de)}return J}function Ge(O,S,A,z){var V=S.geometry,q=S.type,J=[];if(q==="Point"||q==="MultiPoint")for(var G=0;G0&&S.size<(V?J:z))A.numPoints+=S.length/3;else{for(var G=[],j=0;jJ)&&(A.numSimplified++,G.push(S[j]),G.push(S[j+1])),A.numPoints++;V&&function(te,ue){for(var de=0,pe=0,Ze=te.length,He=Ze-2;pe0===ue)for(pe=0,Ze=te.length;pe24)throw new Error("maxZoom should be in the 0-24 range");if(S.promoteId&&S.generateId)throw new Error("promoteId and generateId cannot be used together.");var z=function(V,q){var J=[];if(V.type==="FeatureCollection")for(var G=0;G1&&console.time("creation"),pe=this.tiles[de]=Ur(O,S,A,z,j),this.tileCoords.push({z:S,x:A,y:z}),te)){te>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",S,A,z,pe.numFeatures,pe.numPoints,pe.numSimplified),console.timeEnd("creation"));var Ze="z"+S;this.stats[Ze]=(this.stats[Ze]||0)+1,this.total++}if(pe.source=O,V){if(S===j.maxZoom||S===V)continue;var He=1<1&&console.time("clipping");var Le,Ve,We,ot,_t,rt,at=.5*j.buffer/j.extent,ki=.5-at,Xe=.5+at,Gt=1+at;Le=Ve=We=ot=null,_t=Dt(O,ue,A-at,A+Xe,0,pe.minX,pe.maxX,j),rt=Dt(O,ue,A+ki,A+Gt,0,pe.minX,pe.maxX,j),O=null,_t&&(Le=Dt(_t,ue,z-at,z+Xe,1,pe.minY,pe.maxY,j),Ve=Dt(_t,ue,z+ki,z+Gt,1,pe.minY,pe.maxY,j),_t=null),rt&&(We=Dt(rt,ue,z-at,z+Xe,1,pe.minY,pe.maxY,j),ot=Dt(rt,ue,z+ki,z+Gt,1,pe.minY,pe.maxY,j),rt=null),te>1&&console.timeEnd("clipping"),G.push(Le||[],S+1,2*A,2*z),G.push(Ve||[],S+1,2*A,2*z+1),G.push(We||[],S+1,2*A+1,2*z),G.push(ot||[],S+1,2*A+1,2*z+1)}}},Er.prototype.getTile=function(O,S,A){var z=this.options,V=z.extent,q=z.debug;if(O<0||O>24)return null;var J=1<1&&console.log("drilling down to z%d-%d-%d",O,S,A);for(var j,te=O,ue=S,de=A;!j&&te>0;)te--,ue=Math.floor(ue/2),de=Math.floor(de/2),j=this.tiles[rn(te,ue,de)];return j&&j.source?(q>1&&console.log("found parent tile z%d-%d-%d",te,ue,de),q>1&&console.time("drilling down"),this.splitTile(j.source,te,ue,de,O,S,A),q>1&&console.timeEnd("drilling down"),this.tiles[G]?Ye(this.tiles[G],V):null):null};class rs extends Ct{constructor(S,A,z,V){super(S,A,z,bt),this._dataUpdateable=new Map,this.loadGeoJSON=(q,J)=>{const{promoteId:G}=q;if(q.request)return c.getJSON(q.request,(j,te,ue,de)=>{this._dataUpdateable=nn(te,G)?ci(te,G):void 0,J(j,te,ue,de)});if(typeof q.data=="string")try{const j=JSON.parse(q.data);this._dataUpdateable=nn(j,G)?ci(j,G):void 0,J(null,j)}catch{J(new Error(`Input data given to '${q.source}' is not a valid GeoJSON object.`))}else q.dataDiff?this._dataUpdateable?(function(j,te,ue){var de,pe,Ze,He;if(te.removeAll&&j.clear(),te.remove)for(const Le of te.remove)j.delete(Le);if(te.add)for(const Le of te.add){const Ve=tr(Le,ue);Ve!=null&&j.set(Ve,Le)}if(te.update)for(const Le of te.update){let Ve=j.get(Le.id);if(Ve==null)continue;const We=!Le.removeAllProperties&&(((de=Le.removeProperties)===null||de===void 0?void 0:de.length)>0||((pe=Le.addOrUpdateProperties)===null||pe===void 0?void 0:pe.length)>0);if((Le.newGeometry||Le.removeAllProperties||We)&&(Ve={...Ve},j.set(Le.id,Ve),We&&(Ve.properties={...Ve.properties})),Le.newGeometry&&(Ve.geometry=Le.newGeometry),Le.removeAllProperties)Ve.properties={};else if(((Ze=Le.removeProperties)===null||Ze===void 0?void 0:Ze.length)>0)for(const ot of Le.removeProperties)Object.prototype.hasOwnProperty.call(Ve.properties,ot)&&delete Ve.properties[ot];if(((He=Le.addOrUpdateProperties)===null||He===void 0?void 0:He.length)>0)for(const{key:ot,value:_t}of Le.addOrUpdateProperties)Ve.properties[ot]=_t}}(this._dataUpdateable,q.dataDiff,G),J(null,{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())})):J(new Error(`Cannot update existing geojson data in ${q.source}`)):J(new Error(`Input data given to '${q.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}},V&&(this.loadGeoJSON=V)}loadData(S,A){var z;(z=this._pendingRequest)===null||z===void 0||z.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const V=!!(S&&S.request&&S.request.collectResourceTiming)&&new c.RequestPerformance(S.request);this._pendingCallback=A,this._pendingRequest=this.loadGeoJSON(S,(q,J)=>{if(delete this._pendingCallback,delete this._pendingRequest,q||!J)return A(q);if(typeof J!="object")return A(new Error(`Input data given to '${S.source}' is not a valid GeoJSON object.`));{vt(J,!0);try{if(S.filter){const j=c.createExpression(S.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(j.result==="error")throw new Error(j.value.map(ue=>`${ue.key}: ${ue.message}`).join(", "));J={type:"FeatureCollection",features:J.features.filter(ue=>j.value.evaluate({zoom:0},ue))}}this._geoJSONIndex=S.cluster?new Br(function({superclusterOptions:j,clusterProperties:te}){if(!te||!j)return j;const ue={},de={},pe={accumulated:null,zoom:0},Ze={properties:null},He=Object.keys(te);for(const Le of He){const[Ve,We]=te[Le],ot=c.createExpression(We),_t=c.createExpression(typeof Ve=="string"?[Ve,["accumulated"],["get",Le]]:Ve);ue[Le]=ot.value,de[Le]=_t.value}return j.map=Le=>{Ze.properties=Le;const Ve={};for(const We of He)Ve[We]=ue[We].evaluate(pe,Ze);return Ve},j.reduce=(Le,Ve)=>{Ze.properties=Ve;for(const We of He)pe.accumulated=Le[We],Le[We]=de[We].evaluate(pe,Ze)},j}(S)).load(J.features):function(j,te){return new Er(j,te)}(J,S.geojsonVtOptions)}catch(j){return A(j)}this.loaded={};const G={};if(V){const j=V.finish();j&&(G.resourceTiming={},G.resourceTiming[S.source]=JSON.parse(JSON.stringify(j)))}A(null,G)}})}reloadTile(S,A){const z=this.loaded;return z&&z[S.uid]?super.reloadTile(S,A):this.loadTile(S,A)}removeSource(S,A){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),A()}getClusterExpansionZoom(S,A){try{A(null,this._geoJSONIndex.getClusterExpansionZoom(S.clusterId))}catch(z){A(z)}}getClusterChildren(S,A){try{A(null,this._geoJSONIndex.getChildren(S.clusterId))}catch(z){A(z)}}getClusterLeaves(S,A){try{A(null,this._geoJSONIndex.getLeaves(S.clusterId,S.limit,S.offset))}catch(z){A(z)}}}class Sr{constructor(S){this.self=S,this.actor=new c.Actor(S,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:Ct,geojson:rs},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(A,z)=>{if(this.workerSourceTypes[A])throw new Error(`Worker source with name "${A}" already registered.`);this.workerSourceTypes[A]=z},this.self.registerRTLTextPlugin=A=>{if(c.plugin.isParsed())throw new Error("RTL text plugin already registered.");c.plugin.applyArabicShaping=A.applyArabicShaping,c.plugin.processBidirectionalText=A.processBidirectionalText,c.plugin.processStyledBidirectionalText=A.processStyledBidirectionalText}}setReferrer(S,A){this.referrer=A}setImages(S,A,z){this.availableImages[S]=A;for(const V in this.workerSources[S]){const q=this.workerSources[S][V];for(const J in q)q[J].availableImages=A}z()}setLayers(S,A,z){this.getLayerIndex(S).replace(A),z()}updateLayers(S,A,z){this.getLayerIndex(S).update(A.layers,A.removedIds),z()}loadTile(S,A,z){this.getWorkerSource(S,A.type,A.source).loadTile(A,z)}loadDEMTile(S,A,z){this.getDEMWorkerSource(S,A.source).loadTile(A,z)}reloadTile(S,A,z){this.getWorkerSource(S,A.type,A.source).reloadTile(A,z)}abortTile(S,A,z){this.getWorkerSource(S,A.type,A.source).abortTile(A,z)}removeTile(S,A,z){this.getWorkerSource(S,A.type,A.source).removeTile(A,z)}removeDEMTile(S,A){this.getDEMWorkerSource(S,A.source).removeTile(A)}removeSource(S,A,z){if(!this.workerSources[S]||!this.workerSources[S][A.type]||!this.workerSources[S][A.type][A.source])return;const V=this.workerSources[S][A.type][A.source];delete this.workerSources[S][A.type][A.source],V.removeSource!==void 0?V.removeSource(A,z):z()}loadWorkerSource(S,A,z){try{this.self.importScripts(A.url),z()}catch(V){z(V.toString())}}syncRTLPluginState(S,A,z){try{c.plugin.setState(A);const V=c.plugin.getPluginURL();if(c.plugin.isLoaded()&&!c.plugin.isParsed()&&V!=null){this.self.importScripts(V);const q=c.plugin.isParsed();z(q?void 0:new Error(`RTL Text Plugin failed to import scripts from ${V}`),q)}}catch(V){z(V.toString())}}getAvailableImages(S){let A=this.availableImages[S];return A||(A=[]),A}getLayerIndex(S){let A=this.layerIndexes[S];return A||(A=this.layerIndexes[S]=new Oe),A}getWorkerSource(S,A,z){if(this.workerSources[S]||(this.workerSources[S]={}),this.workerSources[S][A]||(this.workerSources[S][A]={}),!this.workerSources[S][A][z]){const V={send:(q,J,G)=>{this.actor.send(q,J,G,S)}};this.workerSources[S][A][z]=new this.workerSourceTypes[A](V,this.getLayerIndex(S),this.getAvailableImages(S))}return this.workerSources[S][A][z]}getDEMWorkerSource(S,A){return this.demWorkerSources[S]||(this.demWorkerSources[S]={}),this.demWorkerSources[S][A]||(this.demWorkerSources[S][A]=new Yt),this.demWorkerSources[S][A]}}return c.isWorker()&&(self.worker=new Sr(self)),Sr}),ge(["./shared"],function(c){var Oe="3.3.1";class re{static testProp(t){if(!re.docStyle)return t[0];for(let n=0;n{window.removeEventListener("click",re.suppressClickInternal,!0)},0)}static mousePos(t,n){const a=t.getBoundingClientRect();return new c.Point(n.clientX-a.left-t.clientLeft,n.clientY-a.top-t.clientTop)}static touchPos(t,n){const a=t.getBoundingClientRect(),l=[];for(let d=0;d{t=[],n=0,a=0,l={}},h.addThrottleControl=v=>{const b=a++;return l[b]=v,b},h.removeThrottleControl=v=>{delete l[v],g()},h.getImage=(v,b,T=!0)=>{De.supported&&(v.headers||(v.headers={}),v.headers.accept="image/webp,*/*");const C={requestParameters:v,supportImageRefresh:T,callback:b,cancelled:!1,completed:!1,cancel:()=>{C.completed||C.cancelled||(C.cancelled=!0,C.innerRequest&&(C.innerRequest.cancel(),n--),g())}};return t.push(C),g(),C};const d=v=>{const{requestParameters:b,supportImageRefresh:T,callback:C}=v;return c.extend(b,{type:"image"}),(T!==!1||c.isWorker()||c.getProtocolAction(b.url)||b.headers&&!Object.keys(b.headers).reduce((L,D)=>L&&D==="accept",!0)?c.makeRequest:y)(b,(L,D,F,k)=>{m(v,C,L,D,F,k)})},m=(v,b,T,C,L,D)=>{T?b(T):C instanceof HTMLImageElement||c.isImageBitmap(C)?b(null,C):C&&((F,k)=>{typeof createImageBitmap=="function"?c.arrayBufferToImageBitmap(F,k):c.arrayBufferToImage(F,k)})(C,(F,k)=>{F!=null?b(F):k!=null&&b(null,k,{cacheControl:L,expires:D})}),v.cancelled||(v.completed=!0,n--,g())},g=()=>{const v=(()=>{const b=Object.keys(l);let T=!1;if(b.length>0){for(const C of b)if(T=l[C](),T)break}return T})()?c.config.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:c.config.MAX_PARALLEL_IMAGE_REQUESTS;for(let b=n;b0;b++){const T=t.shift();if(T.cancelled){b--;continue}const C=d(T);n++,T.innerRequest=C}},y=(v,b)=>{const T=new Image,C=v.url;let L=!1;const D=v.credentials;return D&&D==="include"?T.crossOrigin="use-credentials":(D&&D==="same-origin"||!c.sameOrigin(C))&&(T.crossOrigin="anonymous"),T.fetchPriority="high",T.onload=()=>{b(null,T),T.onerror=T.onload=null},T.onerror=()=>{L||b(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.")),T.onerror=T.onload=null},T.src=C,{cancel:()=>{L=!0,T.src=""}}}}(jt||(jt={})),jt.resetRequestQueue(),function(h){h.Glyphs="Glyphs",h.Image="Image",h.Source="Source",h.SpriteImage="SpriteImage",h.SpriteJSON="SpriteJSON",h.Style="Style",h.Tile="Tile",h.Unknown="Unknown"}(vt||(vt={}));class Mt{constructor(t){this._transformRequestFn=t}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}normalizeSpriteURL(t,n,a){const l=function(d){const m=d.match(Jt);if(!m)throw new Error(`Unable to parse URL "${d}"`);return{protocol:m[1],authority:m[2],path:m[3]||"/",params:m[4]?m[4].split("&"):[]}}(t);return l.path+=`${n}${a}`,function(d){const m=d.params.length?`?${d.params.join("&")}`:"";return`${d.protocol}://${d.authority}${d.path}${m}`}(l)}setTransformRequest(t){this._transformRequestFn=t}}const Jt=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Yr(h){var t=new c.ARRAY_TYPE(3);return t[0]=h[0],t[1]=h[1],t[2]=h[2],t}var er,Jr=function(h,t,n){return h[0]=t[0]-n[0],h[1]=t[1]-n[1],h[2]=t[2]-n[2],h};er=new c.ARRAY_TYPE(3),c.ARRAY_TYPE!=Float32Array&&(er[0]=0,er[1]=0,er[2]=0);var wi=function(h){var t=h[0],n=h[1];return t*t+n*n};function di(h){const t=[];if(typeof h=="string")t.push({id:"default",url:h});else if(h&&h.length>0){const n=[];for(const{id:a,url:l}of h){const d=`${a}${l}`;n.indexOf(d)===-1&&(n.push(d),t.push({id:a,url:l}))}}return t}function Qt(h,t,n,a,l){if(a)return void h(a);if(l!==Object.values(t).length||l!==Object.values(n).length)return;const d={};for(const m in t){d[m]={};const g=c.browser.getImageCanvasContext(n[m]),y=t[m];for(const v in y){const{width:b,height:T,x:C,y:L,sdf:D,pixelRatio:F,stretchX:k,stretchY:H,content:ne}=y[v];d[m][v]={data:null,pixelRatio:F,sdf:D,stretchX:k,stretchY:H,content:ne,spriteData:{width:b,height:T,x:C,y:L,context:g}}}}h(null,d)}(function(){var h=new c.ARRAY_TYPE(2);c.ARRAY_TYPE!=Float32Array&&(h[0]=0,h[1]=0)})();class Je{constructor(t,n,a,l){this.context=t,this.format=a,this.texture=t.gl.createTexture(),this.update(n,l)}update(t,n,a){const{width:l,height:d}=t,m=!(this.size&&this.size[0]===l&&this.size[1]===d||a),{context:g}=this,{gl:y}=g;if(this.useMipmap=!!(n&&n.useMipmap),y.bindTexture(y.TEXTURE_2D,this.texture),g.pixelStoreUnpackFlipY.set(!1),g.pixelStoreUnpack.set(1),g.pixelStoreUnpackPremultiplyAlpha.set(this.format===y.RGBA&&(!n||n.premultiply!==!1)),m)this.size=[l,d],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||c.isImageBitmap(t)?y.texImage2D(y.TEXTURE_2D,0,this.format,this.format,y.UNSIGNED_BYTE,t):y.texImage2D(y.TEXTURE_2D,0,this.format,l,d,0,this.format,y.UNSIGNED_BYTE,t.data);else{const{x:v,y:b}=a||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||c.isImageBitmap(t)?y.texSubImage2D(y.TEXTURE_2D,0,v,b,y.RGBA,y.UNSIGNED_BYTE,t):y.texSubImage2D(y.TEXTURE_2D,0,v,b,l,d,y.RGBA,y.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&y.generateMipmap(y.TEXTURE_2D)}bind(t,n,a){const{context:l}=this,{gl:d}=l;d.bindTexture(d.TEXTURE_2D,this.texture),a!==d.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(a=d.LINEAR),t!==this.filter&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,t),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,a||t),this.filter=t),n!==this.wrap&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,n),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,n),this.wrap=n)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function Qr(h){const{userImage:t}=h;return!!(t&&t.render&&t.render())&&(h.data.replace(new Uint8Array(t.data.buffer)),!0)}class Pi extends c.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new c.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:n,callback:a}of this.requestors)this._notify(n,a);this.requestors=[]}}getImage(t){const n=this.images[t];if(n&&!n.data&&n.spriteData){const a=n.spriteData;n.data=new c.RGBAImage({width:a.width,height:a.height},a.context.getImageData(a.x,a.y,a.width,a.height).data),n.spriteData=null}return n}addImage(t,n){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,n)&&(this.images[t]=n)}_validate(t,n){let a=!0;const l=n.data||n.spriteData;return this._validateStretch(n.stretchX,l&&l.width)||(this.fire(new c.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),a=!1),this._validateStretch(n.stretchY,l&&l.height)||(this.fire(new c.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),a=!1),this._validateContent(n.content,n)||(this.fire(new c.ErrorEvent(new Error(`Image "${t}" has invalid "content" value`))),a=!1),a}_validateStretch(t,n){if(!t)return!0;let a=0;for(const l of t){if(l[0]-1);y++,d[y]=g,m[y]=v,m[y+1]=lr}for(let g=0,y=0;g{let g=this.entries[l];g||(g=this.entries[l]={glyphs:{},requests:{},ranges:{}});let y=g.glyphs[d];if(y!==void 0)return void m(null,{stack:l,id:d,glyph:y});if(y=this._tinySDF(g,l,d),y)return g.glyphs[d]=y,void m(null,{stack:l,id:d,glyph:y});const v=Math.floor(d/256);if(256*v>65535)return void m(new Error("glyphs > 65535 not supported"));if(g.ranges[v])return void m(null,{stack:l,id:d,glyph:y});if(!this.url)return void m(new Error("glyphsUrl is not set"));let b=g.requests[v];b||(b=g.requests[v]=[],Ei.loadGlyphRange(l,v,this.url,this.requestManager,(T,C)=>{if(C){for(const L in C)this._doesCharSupportLocalGlyph(+L)||(g.glyphs[+L]=C[+L]);g.ranges[v]=!0}for(const L of b)L(T,C);delete g.requests[v]})),b.push((T,C)=>{T?m(T):C&&m(null,{stack:l,id:d,glyph:C[d]||null})})},(l,d)=>{if(l)n(l);else if(d){const m={};for(const{stack:g,id:y,glyph:v}of d)(m[g]||(m[g]={}))[y]=v&&{id:v.id,bitmap:v.bitmap.clone(),metrics:v.metrics};n(null,m)}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(c.unicodeBlockLookup["CJK Unified Ideographs"](t)||c.unicodeBlockLookup["Hangul Syllables"](t)||c.unicodeBlockLookup.Hiragana(t)||c.unicodeBlockLookup.Katakana(t))}_tinySDF(t,n,a){const l=this.localIdeographFontFamily;if(!l||!this._doesCharSupportLocalGlyph(a))return;let d=t.tinySDF;if(!d){let g="400";/bold/i.test(n)?g="900":/medium/i.test(n)?g="500":/light/i.test(n)&&(g="200"),d=t.tinySDF=new Ei.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:l,fontWeight:g})}const m=d.draw(String.fromCharCode(a));return{id:a,bitmap:new c.AlphaImage({width:m.width||30,height:m.height||30},m.data),metrics:{width:m.glyphWidth||24,height:m.glyphHeight||24,left:m.glyphLeft||0,top:m.glyphTop-27||-8,advance:m.glyphAdvance||24}}}}Ei.loadGlyphRange=function(h,t,n,a,l){const d=256*t,m=d+255,g=a.transformRequest(n.replace("{fontstack}",h).replace("{range}",`${d}-${m}`),vt.Glyphs);c.getArrayBuffer(g,(y,v)=>{if(y)l(y);else if(v){const b={};for(const T of c.parseGlyphPbf(v))b[T.id]=T;l(null,b)}})},Ei.TinySDF=class{constructor({fontSize:h=24,buffer:t=3,radius:n=8,cutoff:a=.25,fontFamily:l="sans-serif",fontWeight:d="normal",fontStyle:m="normal"}={}){this.buffer=t,this.cutoff=a,this.radius=n;const g=this.size=h+4*t,y=this._createCanvas(g),v=this.ctx=y.getContext("2d",{willReadFrequently:!0});v.font=`${m} ${d} ${h}px ${l}`,v.textBaseline="alphabetic",v.textAlign="left",v.fillStyle="black",this.gridOuter=new Float64Array(g*g),this.gridInner=new Float64Array(g*g),this.f=new Float64Array(g),this.z=new Float64Array(g+1),this.v=new Uint16Array(g)}_createCanvas(h){const t=document.createElement("canvas");return t.width=t.height=h,t}draw(h){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:a,actualBoundingBoxLeft:l,actualBoundingBoxRight:d}=this.ctx.measureText(h),m=Math.ceil(n),g=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(d-l))),y=Math.min(this.size-this.buffer,m+Math.ceil(a)),v=g+2*this.buffer,b=y+2*this.buffer,T=Math.max(v*b,0),C=new Uint8ClampedArray(T),L={data:C,width:v,height:b,glyphWidth:g,glyphHeight:y,glyphTop:m,glyphLeft:0,glyphAdvance:t};if(g===0||y===0)return L;const{ctx:D,buffer:F,gridInner:k,gridOuter:H}=this;D.clearRect(F,F,g,y),D.fillText(h,F,F+m);const ne=D.getImageData(F,F,g,y);H.fill(lr,0,T),k.fill(0,0,T);for(let N=0;N0?ce*ce:0,k[oe]=ce<0?ce*ce:0}}Dr(H,0,0,v,b,v,this.f,this.v,this.z),Dr(k,F,F,g,y,v,this.f,this.v,this.z);for(let N=0;N1&&(y=t[++g]);const b=Math.abs(v-y.left),T=Math.abs(v-y.right),C=Math.min(b,T);let L;const D=d/a*(l+1);if(y.isDash){const F=l-Math.abs(D);L=Math.sqrt(C*C+F*F)}else L=l-Math.sqrt(C*C+D*D);this.data[m+v]=Math.max(0,Math.min(255,L+128))}}}addRegularDash(t){for(let g=t.length-1;g>=0;--g){const y=t[g],v=t[g+1];y.zeroLength?t.splice(g,1):v&&v.isDash===y.isDash&&(v.left=y.left,t.splice(g,1))}const n=t[0],a=t[t.length-1];n.isDash===a.isDash&&(n.left=a.left-this.width,a.right=n.right+this.width);const l=this.width*this.nextRow;let d=0,m=t[d];for(let g=0;g1&&(m=t[++d]);const y=Math.abs(g-m.left),v=Math.abs(g-m.right),b=Math.min(y,v);this.data[l+g]=Math.max(0,Math.min(255,(m.isDash?b:-b)+128))}}addDash(t,n){const a=n?7:0,l=2*a+1;if(this.nextRow+l>this.height)return c.warnOnce("LineAtlas out of space"),null;let d=0;for(let g=0;g{l.send(t,n,d)},a=a||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach(n=>{n.remove()}),this.actors=[],t&&this.workerPool.release(this.id)}}function Si(h,t,n){const a=function(l,d){if(l)return n(l);if(d){const m=c.pick(c.extend(d,h),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);d.vector_layers&&(m.vectorLayers=d.vector_layers,m.vectorLayerIds=m.vectorLayers.map(g=>g.id)),n(null,m)}};return h.url?c.getJSON(t.transformRequest(h.url,vt.Source),a):c.browser.frame(()=>a(null,h))}li.Actor=c.Actor;class mt{constructor(t,n){t&&(n?this.setSouthWest(t).setNorthEast(n):Array.isArray(t)&&(t.length===4?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 c.LngLat?new c.LngLat(t.lng,t.lat):c.LngLat.convert(t),this}setSouthWest(t){return this._sw=t instanceof c.LngLat?new c.LngLat(t.lng,t.lat):c.LngLat.convert(t),this}extend(t){const n=this._sw,a=this._ne;let l,d;if(t instanceof c.LngLat)l=t,d=t;else{if(!(t instanceof mt))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(mt.convert(t)):this.extend(c.LngLat.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(c.LngLat.convert(t)):this;if(l=t._sw,d=t._ne,!l||!d)return this}return n||a?(n.lng=Math.min(l.lng,n.lng),n.lat=Math.min(l.lat,n.lat),a.lng=Math.max(d.lng,a.lng),a.lat=Math.max(d.lat,a.lat)):(this._sw=new c.LngLat(l.lng,l.lat),this._ne=new c.LngLat(d.lng,d.lat)),this}getCenter(){return new c.LngLat((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 c.LngLat(this.getWest(),this.getNorth())}getSouthEast(){return new c.LngLat(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){const{lng:n,lat:a}=c.LngLat.convert(t);let l=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(l=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=a&&a<=this._ne.lat&&l}static convert(t){return t instanceof mt?t:t&&new mt(t)}static fromLngLat(t,n=0){const a=360*n/40075017,l=a/Math.cos(Math.PI/180*t.lat);return new mt(new c.LngLat(t.lng-l,t.lat-a),new c.LngLat(t.lng+l,t.lat+a))}}class hr{constructor(t,n,a){this.bounds=mt.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=a||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[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){const n=Math.pow(2,t.z),a=Math.floor(c.mercatorXfromLng(this.bounds.getWest())*n),l=Math.floor(c.mercatorYfromLat(this.bounds.getNorth())*n),d=Math.ceil(c.mercatorXfromLng(this.bounds.getEast())*n),m=Math.ceil(c.mercatorYfromLat(this.bounds.getSouth())*n);return t.x>=a&&t.x=l&&t.y{this._loaded=!1,this.fire(new c.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=Si(this._options,this.map._requestManager,(d,m)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),d?this.fire(new c.ErrorEvent(d)):m&&(c.extend(this,m),m.bounds&&(this.tileBounds=new hr(m.bounds,this.minzoom,this.maxzoom)),this.fire(new c.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.Event("data",{dataType:"source",sourceDataType:"content"})))})},this.serialize=()=>c.extend({},this._options),this.id=t,this.dispatcher=a,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,c.extend(this,c.pick(n,["url","scheme","tileSize","promoteId"])),this._options=c.extend({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(l)}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.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),l={request:this.map._requestManager.transformRequest(a,vt.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};function d(m,g){return delete t.request,t.aborted?n(null):m&&m.status!==404?n(m):(g&&g.resourceTiming&&(t.resourceTiming=g.resourceTiming),this.map._refreshExpiredTiles&&g&&t.setExpiryData(g),t.loadVectorData(g,this.map.painter),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}l.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired"?t.state==="loading"?t.reloadCallback=n:t.request=t.actor.send("reloadTile",l,d.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",l,d.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class ur extends c.Evented{constructor(t,n,a,l){super(),this.id=t,this.dispatcher=a,this.setEventedParent(l),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=c.extend({type:"raster"},n),c.extend(this,c.pick(n,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new c.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=Si(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new c.ErrorEvent(t)):n&&(c.extend(this,n),n.bounds&&(this.tileBounds=new hr(n.bounds,this.minzoom,this.maxzoom)),this.fire(new c.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return c.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=jt.getImage(this.map._requestManager.transformRequest(a,vt.Tile),(l,d,m)=>{if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(l)t.state="errored",n(l);else if(d){this.map._refreshExpiredTiles&&m&&t.setExpiryData(m);const g=this.map.painter.context,y=g.gl;t.texture=this.map.painter.getTileTexture(d.width),t.texture?t.texture.update(d,{useMipmap:!0}):(t.texture=new Je(g,d,y.RGBA,{useMipmap:!0}),t.texture.bind(y.LINEAR,y.CLAMP_TO_EDGE,y.LINEAR_MIPMAP_NEAREST),g.extTextureFilterAnisotropic&&y.texParameterf(y.TEXTURE_2D,g.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,g.extTextureFilterAnisotropicMax)),t.state="loaded",n(null)}},this.map._refreshExpiredTiles)}abortTile(t,n){t.request&&(t.request.cancel(),delete t.request),n()}unloadTile(t,n){t.texture&&this.map.painter.saveTileTexture(t.texture),n()}hasTransition(){return!1}}class Rr extends ur{constructor(t,n,a,l){super(t,n,a,l),this.type="raster-dem",this.maxzoom=22,this._options=c.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function l(d,m){d&&(t.state="errored",n(d)),m&&(t.dem=m,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded",n(null))}t.request=jt.getImage(this.map._requestManager.transformRequest(a,vt.Tile),(function(d,m){if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(d)t.state="errored",n(d);else if(m){this.map._refreshExpiredTiles&&t.setExpiryData(m),delete m.cacheControl,delete m.expires;const g=c.isImageBitmap(m)&&(en==null&&(en=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),en)?m:c.browser.getImageData(m,1),y={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:g,encoding:this.encoding};t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",y,l.bind(this)))}}).bind(this),this.map._refreshExpiredTiles),t.neighboringTiles=this._getNeighboringTiles(t.tileID)}_getNeighboringTiles(t){const n=t.canonical,a=Math.pow(2,n.z),l=(n.x-1+a)%a,d=n.x===0?t.wrap-1:t.wrap,m=(n.x+1+a)%a,g=n.x+1===a?t.wrap+1:t.wrap,y={};return y[new c.OverscaledTileID(t.overscaledZ,d,n.z,l,n.y).key]={backfilled:!1},y[new c.OverscaledTileID(t.overscaledZ,g,n.z,m,n.y).key]={backfilled:!1},n.y>0&&(y[new c.OverscaledTileID(t.overscaledZ,d,n.z,l,n.y-1).key]={backfilled:!1},y[new c.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},y[new c.OverscaledTileID(t.overscaledZ,g,n.z,m,n.y-1).key]={backfilled:!1}),n.y+1{this._updateWorkerData()},this.serialize=()=>c.extend({},this._options,{type:this.type,data:this._data}),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._pendingLoads=0,this.actor=a.getActor(),this.setEventedParent(l),this._data=n.data,this._options=c.extend({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId;const d=c.EXTENT/this.tileSize;this.workerOptions=c.extend({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(n.buffer!==void 0?n.buffer:128)*d,tolerance:(n.tolerance!==void 0?n.tolerance:.375)*d,extent:c.EXTENT,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:n.clusterMaxZoom!==void 0?n.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:c.EXTENT,radius:(n.clusterRadius||50)*d,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData(),this}updateData(t){return this._updateWorkerData(t),this}setClusterOptions(t){return this.workerOptions.cluster=t.cluster,t&&(t.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=t.clusterRadius),t.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=t.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(t,n){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},n),this}getClusterChildren(t,n){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},n),this}getClusterLeaves(t,n,a,l){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:n,offset:a},l),this}_updateWorkerData(t){const n=c.extend({},this.workerOptions);t?n.dataDiff=t:typeof this._data=="string"?(n.request=this.map._requestManager.transformRequest(c.browser.resolveURL(this._data),vt.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new c.Event("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,n,(a,l)=>{if(this._pendingLoads--,this._removed||l&&l.abandoned)return void this.fire(new c.Event("dataabort",{dataType:"source"}));let d=null;if(l&&l.resourceTiming&&l.resourceTiming[this.id]&&(d=l.resourceTiming[this.id].slice(0)),a)return void this.fire(new c.ErrorEvent(a));const m={dataType:"source"};this._collectResourceTiming&&d&&d.length>0&&c.extend(m,{resourceTiming:d}),this.fire(new c.Event("data",{...m,sourceDataType:"metadata"})),this.fire(new c.Event("data",{...m,sourceDataType:"content"}))})}loaded(){return this._pendingLoads===0}loadTile(t,n){const a=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const l={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};t.request=this.actor.send(a,l,(d,m)=>(delete t.request,t.unloadVectorData(),t.aborted?n(null):d?n(d):(t.loadVectorData(m,this.map.painter,a==="reloadTile"),n(null))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}hasTransition(){return!1}}var Ii=c.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Ni extends c.Evented{constructor(t,n,a,l){super(),this.load=(d,m)=>{this._loaded=!1,this.fire(new c.Event("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=jt.getImage(this.map._requestManager.transformRequest(this.url,vt.Image),(g,y)=>{this._request=null,this._loaded=!0,g?this.fire(new c.ErrorEvent(g)):y&&(this.image=y,d&&(this.coordinates=d),m&&m(),this._finishLoading())})},this.prepare=()=>{if(Object.keys(this.tiles).length===0||!this.image)return;const d=this.map.painter.context,m=d.gl;this.boundsBuffer||(this.boundsBuffer=d.createVertexBuffer(this._boundsArray,Ii.members)),this.boundsSegments||(this.boundsSegments=c.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Je(d,this.image,m.RGBA),this.texture.bind(m.LINEAR,m.CLAMP_TO_EDGE));let g=!1;for(const y in this.tiles){const v=this.tiles[y];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,g=!0)}g&&this.fire(new c.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"image",url:this.options.url,coordinates:this.coordinates}),this.id=t,this.dispatcher=a,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(l),this.options=n}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.cancel(),this._request=null),this.options.url=t.url,this.load(t.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new c.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.cancel(),this._request=null)}setCoordinates(t){this.coordinates=t;const n=t.map(c.MercatorCoordinate.fromLngLat);this.tileID=function(l){let d=1/0,m=1/0,g=-1/0,y=-1/0;for(const C of l)d=Math.min(d,C.x),m=Math.min(m,C.y),g=Math.max(g,C.x),y=Math.max(y,C.y);const v=Math.max(g-d,y-m),b=Math.max(0,Math.floor(-Math.log(v)/Math.LN2)),T=Math.pow(2,b);return new c.CanonicalTileID(b,Math.floor((d+g)/2*T),Math.floor((m+y)/2*T))}(n),this.minzoom=this.maxzoom=this.tileID.z;const a=n.map(l=>this.tileID.getTilePoint(l)._round());return this._boundsArray=new c.RasterBoundsArray,this._boundsArray.emplaceBack(a[0].x,a[0].y,0,0),this._boundsArray.emplaceBack(a[1].x,a[1].y,c.EXTENT,0),this._boundsArray.emplaceBack(a[3].x,a[3].y,0,c.EXTENT),this._boundsArray.emplaceBack(a[2].x,a[2].y,c.EXTENT,c.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new c.Event("data",{dataType:"source",sourceDataType:"content"})),this}loadTile(t,n){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},n(null)):(t.state="errored",n(null))}hasTransition(){return!1}}class pr extends Ni{constructor(t,n,a,l){super(t,n,a,l),this.load=()=>{this._loaded=!1;const d=this.options;this.urls=[];for(const m of d.urls)this.urls.push(this.map._requestManager.transformRequest(m,vt.Source).url);c.getVideo(this.urls,(m,g)=>{this._loaded=!0,m?this.fire(new c.ErrorEvent(m)):g&&(this.video=g,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})},this.prepare=()=>{if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const d=this.map.painter.context,m=d.gl;this.boundsBuffer||(this.boundsBuffer=d.createVertexBuffer(this._boundsArray,Ii.members)),this.boundsSegments||(this.boundsSegments=c.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(m.LINEAR,m.CLAMP_TO_EDGE),m.texSubImage2D(m.TEXTURE_2D,0,0,0,m.RGBA,m.UNSIGNED_BYTE,this.video)):(this.texture=new Je(d,this.video,m.RGBA),this.texture.bind(m.LINEAR,m.CLAMP_TO_EDGE));let g=!1;for(const y in this.tiles){const v=this.tiles[y];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,g=!0)}g&&this.fire(new c.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"video",urls:this.urls,coordinates:this.coordinates}),this.roundZoom=!0,this.type="video",this.options=n}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const n=this.video.seekable;tn.end(0)?this.fire(new c.ErrorEvent(new c.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.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)))}hasTransition(){return this.video&&!this.video.paused}}class le extends Ni{constructor(t,n,a,l){super(t,n,a,l),this.load=()=>{this._loaded=!0,this.canvas||(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 c.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())},this.prepare=()=>{let d=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,d=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,d=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const m=this.map.painter.context,g=m.gl;this.boundsBuffer||(this.boundsBuffer=m.createVertexBuffer(this._boundsArray,Ii.members)),this.boundsSegments||(this.boundsSegments=c.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(d||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Je(m,this.canvas,g.RGBA,{premultiply:!0});let y=!1;for(const v in this.tiles){const b=this.tiles[v];b.state!=="loaded"&&(b.state="loaded",b.texture=this.texture,y=!0)}y&&this.fire(new c.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"canvas",coordinates:this.coordinates}),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(d=>!Array.isArray(d)||d.length!==2||d.some(m=>typeof m!="number"))||this.fire(new c.ErrorEvent(new c.ValidationError(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new c.ErrorEvent(new c.ValidationError(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new c.ErrorEvent(new c.ValidationError(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new c.ErrorEvent(new c.ValidationError(`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 c.ErrorEvent(new c.ValidationError(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const Fr={},Bn=h=>{switch(h){case"geojson":return dr;case"image":return Ni;case"raster":return ur;case"raster-dem":return Rr;case"vector":return Br;case"video":return pr;case"canvas":return le}return Fr[h]};function gt(h,t){const n=c.create();return c.translate(n,n,[1,1,0]),c.scale(n,n,[.5*h.width,.5*h.height,1]),c.multiply(n,n,h.calculatePosMatrix(t.toUnwrapped()))}function ht(h,t,n,a,l,d){const m=function(T,C,L){if(T)for(const D of T){const F=C[D];if(F&&F.source===L&&F.type==="fill-extrusion")return!0}else for(const D in C){const F=C[D];if(F.source===L&&F.type==="fill-extrusion")return!0}return!1}(l&&l.layers,t,h.id),g=d.maxPitchScaleFactor(),y=h.tilesIn(a,g,m);y.sort(fn);const v=[];for(const T of y)v.push({wrappedTileID:T.tileID.wrapped().key,queryResults:T.tile.queryRenderedFeatures(t,n,h._state,T.queryGeometry,T.cameraQueryGeometry,T.scale,l,d,g,gt(h.transform,T.tileID))});const b=function(T){const C={},L={};for(const D of T){const F=D.queryResults,k=D.wrappedTileID,H=L[k]=L[k]||{};for(const ne in F){const N=F[ne],K=H[ne]=H[ne]||{},ae=C[ne]=C[ne]||[];for(const oe of N)K[oe.featureIndex]||(K[oe.featureIndex]=!0,ae.push(oe))}}return C}(v);for(const T in b)b[T].forEach(C=>{const L=C.feature,D=h.getFeatureState(L.layer["source-layer"],L.id);L.source=L.layer.source,L.layer["source-layer"]&&(L.sourceLayer=L.layer["source-layer"]),L.state=D});return b}function fn(h,t){const n=h.tileID,a=t.tileID;return n.overscaledZ-a.overscaledZ||n.canonical.y-a.canonical.y||n.wrap-a.wrap||n.canonical.x-a.canonical.x}class mn{constructor(t,n){this.timeAdded=0,this.fadeEndTime=0,this.tileID=t,this.uid=c.uniqueId(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(t){const n=t+this.timeAdded;nd.getLayer(v)).filter(Boolean);if(y.length!==0){g.layers=y,g.stateDependentLayerIds&&(g.stateDependentLayers=g.stateDependentLayerIds.map(v=>y.filter(b=>b.id===v)[0]));for(const v of y)m[v.id]=g}}return m}(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const l in this.buckets){const d=this.buckets[l];if(d instanceof c.SymbolBucket){if(this.hasSymbolBuckets=!0,!a)break;d.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const l in this.buckets){const d=this.buckets[l];if(d instanceof c.SymbolBucket&&d.hasRTLText){this.hasRTLText=!0,c.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const l in this.buckets){const d=this.buckets[l];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(l).queryRadius(d))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new c.CollisionBoxArray}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const a in this.buckets){const l=this.buckets[a];l.uploadPending()&&l.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Je(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Je(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,a,l,d,m,g,y,v,b){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:l,cameraQueryGeometry:d,scale:m,tileSize:this.tileSize,pixelPosMatrix:b,transform:y,params:g,queryPadding:this.queryPadding*v},t,n,a):{}}querySourceFeatures(t,n){const a=this.latestFeatureIndex;if(!a||!a.rawTileData)return;const l=a.loadVTLayers(),d=n&&n.sourceLayer?n.sourceLayer:"",m=l._geojsonTileLayer||l[d];if(!m)return;const g=c.createFilter(n&&n.filter),{z:y,x:v,y:b}=this.tileID.canonical,T={z:y,x:v,y:b};for(let C=0;Ca)l=!1;else if(n)if(this.expirationTime{this.remove(t,d)},a)),this.data[l].push(d),this.order.push(l),this.order.length>this.max){const m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}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){const n=this.data[t].shift();return n.timeout&&clearTimeout(n.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),n.value}getByKey(t){const n=this.data[t];return n?n[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,n){if(!this.has(t))return this;const a=t.wrapped().key,l=n===void 0?0:this.data[a].indexOf(n),d=this.data[a][l];return this.data[a].splice(l,1),d.timeout&&clearTimeout(d.timeout),this.data[a].length===0&&delete this.data[a],this.onRemove(d.value),this.order.splice(this.order.indexOf(a),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(t){const n=[];for(const a in this.data)for(const l of this.data[a])t(l.value)||n.push(l);for(const a of n)this.remove(a.value.tileID,a)}}class Fs{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,a){const l=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][l]=this.stateChanges[t][l]||{},c.extend(this.stateChanges[t][l],a),this.deletedStates[t]===null){this.deletedStates[t]={};for(const d in this.state[t])d!==l&&(this.deletedStates[t][d]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][l]===null){this.deletedStates[t][l]={};for(const d in this.state[t][l])a[d]||(this.deletedStates[t][l][d]=null)}else for(const d in a)this.deletedStates[t]&&this.deletedStates[t][l]&&this.deletedStates[t][l][d]===null&&delete this.deletedStates[t][l][d]}removeFeatureState(t,n,a){if(this.deletedStates[t]===null)return;const l=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},a&&n!==void 0)this.deletedStates[t][l]!==null&&(this.deletedStates[t][l]=this.deletedStates[t][l]||{},this.deletedStates[t][l][a]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][l])for(a in this.deletedStates[t][l]={},this.stateChanges[t][l])this.deletedStates[t][l][a]=null;else this.deletedStates[t][l]=null;else this.deletedStates[t]=null}getState(t,n){const a=String(n),l=c.extend({},(this.state[t]||{})[a],(this.stateChanges[t]||{})[a]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const d=this.deletedStates[t][n];if(d===null)return{};for(const m in d)delete l[m]}return l}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){const a={};for(const l in this.stateChanges){this.state[l]=this.state[l]||{};const d={};for(const m in this.stateChanges[l])this.state[l][m]||(this.state[l][m]={}),c.extend(this.state[l][m],this.stateChanges[l][m]),d[m]=this.state[l][m];a[l]=d}for(const l in this.deletedStates){this.state[l]=this.state[l]||{};const d={};if(this.deletedStates[l]===null)for(const m in this.state[l])d[m]={},this.state[l][m]={};else for(const m in this.deletedStates[l]){if(this.deletedStates[l][m]===null)this.state[l][m]={};else for(const g of Object.keys(this.deletedStates[l][m]))delete this.state[l][m][g];d[m]=this.state[l][m]}a[l]=a[l]||{},c.extend(a[l],d)}if(this.stateChanges={},this.deletedStates={},Object.keys(a).length!==0)for(const l in t)t[l].setFeatureState(a,n)}}class Dt extends c.Evented{constructor(t,n,a){super(),this.id=t,this.dispatcher=a,this.on("data",l=>{l.dataType==="source"&&l.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&l.dataType==="source"&&l.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((l,d,m,g)=>{const y=new(Bn(d.type))(l,d,m,g);if(y.id!==l)throw new Error(`Expected Source id to be ${l} instead of ${y.id}`);return y})(t,n,a,this),this._tiles={},this._cache=new Rs(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Fs,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&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const t in this._tiles){const n=this._tiles[t];if(n.state!=="loaded"&&n.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,n){return this._source.loadTile(t,n)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,()=>{})}_abortTile(t){this._source.abortTile&&this._source.abortTile(t,()=>{}),this._source.fire(new c.Event("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const n in this._tiles){const a=this._tiles[n];a.upload(t),a.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(is).map(t=>t.key)}getRenderableIds(t){const n=[];for(const a in this._tiles)this._isIdRenderable(a,t)&&n.push(this._tiles[a]);return t?n.sort((a,l)=>{const d=a.tileID,m=l.tileID,g=new c.Point(d.canonical.x,d.canonical.y)._rotate(this.transform.angle),y=new c.Point(m.canonical.x,m.canonical.y)._rotate(this.transform.angle);return d.overscaledZ-m.overscaledZ||y.y-g.y||y.x-g.x}).map(a=>a.tileID.key):n.map(a=>a.tileID).sort(is).map(a=>a.key)}hasRenderableParent(t){const n=this.findLoadedParent(t,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(t,n){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(n||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(t,"reloading")}}_reloadTile(t,n){const a=this._tiles[t];a&&(a.state!=="loading"&&(a.state=n),this._loadTile(a,this._tileLoaded.bind(this,a,t,n)))}_tileLoaded(t,n,a,l){if(l)return t.state="errored",void(l.status!==404?this._source.fire(new c.ErrorEvent(l,{tile:t})):this.update(this.transform,this.terrain));t.timeAdded=c.browser.now(),a==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),this.getSource().type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new c.Event("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const n=this.getRenderableIds();for(let l=0;l1||(Math.abs(m)>1&&(Math.abs(m+y)===1?m+=y:Math.abs(m-y)===1&&(m-=y)),d.dem&&l.dem&&(l.dem.backfillBorder(d.dem,m,g),l.neighboringTiles&&l.neighboringTiles[v]&&(l.neighboringTiles[v].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,a,l){for(const d in this._tiles){let m=this._tiles[d];if(l[d]||!m.hasData()||m.tileID.overscaledZ<=n||m.tileID.overscaledZ>a)continue;let g=m.tileID;for(;m&&m.tileID.overscaledZ>n+1;){const v=m.tileID.scaledTo(m.tileID.overscaledZ-1);m=this._tiles[v.key],m&&m.hasData()&&(g=v)}let y=g;for(;y.overscaledZ>n;)if(y=y.scaledTo(y.overscaledZ-1),t[y.key]){l[g.key]=g;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const a=this._loadedParentTiles[t.key];return a&&a.tileID.overscaledZ>=n?a:null}for(let a=t.overscaledZ-1;a>=n;a--){const l=t.scaledTo(a),d=this._getLoadedTile(l);if(d)return d}}_getLoadedTile(t){const n=this._tiles[t.key];return n&&n.hasData()?n:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const n=Math.ceil(t.width/this._source.tileSize)+1,a=Math.ceil(t.height/this._source.tileSize)+1,l=Math.floor(n*a*(this._maxTileCacheZoomLevels===null?c.config.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),d=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,l):l;this._cache.setMaxSize(d)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const a={};for(const l in this._tiles){const d=this._tiles[l];d.tileID=d.tileID.unwrapTo(d.tileID.wrap+n),a[d.tileID.key]=d}this._tiles=a;for(const l in this._timers)clearTimeout(this._timers[l]),delete this._timers[l];for(const l in this._tiles)this._setTileReloadTimer(l,this._tiles[l])}}update(t,n){if(this.transform=t,this.terrain=n,!this._sourceLoaded||this._paused)return;let a;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?a=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(b=>new c.OverscaledTileID(b.canonical.z,b.wrap,b.canonical.z,b.canonical.x,b.canonical.y)):(a=t.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n}),this._source.hasTile&&(a=a.filter(b=>this._source.hasTile(b)))):a=[];const l=t.coveringZoomLevel(this._source),d=Math.max(l-Dt.maxOverzooming,this._source.minzoom),m=Math.max(l+Dt.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const b={};for(const T of a)if(T.canonical.z>this._source.minzoom){const C=T.scaledTo(T.canonical.z-1);b[C.key]=C;const L=T.scaledTo(Math.max(this._source.minzoom,Math.min(T.canonical.z,5)));b[L.key]=L}a=a.concat(Object.values(b))}const g=a.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,g&&this.fire(new c.Event("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const y=this._updateRetainedTiles(a,l);if(Rn(this._source.type)){const b={},T={},C=Object.keys(y),L=c.browser.now();for(const D of C){const F=y[D],k=this._tiles[D];if(!k||k.fadeEndTime!==0&&k.fadeEndTime<=L)continue;const H=this.findLoadedParent(F,d);H&&(this._addTile(H.tileID),b[H.tileID.key]=H.tileID),T[D]=F}this._retainLoadedChildren(T,l,m,y);for(const D in b)y[D]||(this._coveredTiles[D]=!0,y[D]=b[D]);if(n){const D={},F={};for(const k of a)this._tiles[k.key].hasData()?D[k.key]=k:F[k.key]=k;for(const k in F){const H=F[k].children(this._source.maxzoom);this._tiles[H[0].key]&&this._tiles[H[1].key]&&this._tiles[H[2].key]&&this._tiles[H[3].key]&&(D[H[0].key]=y[H[0].key]=H[0],D[H[1].key]=y[H[1].key]=H[1],D[H[2].key]=y[H[2].key]=H[2],D[H[3].key]=y[H[3].key]=H[3],delete F[k])}for(const k in F){const H=this.findLoadedParent(F[k],this._source.minzoom);if(H){D[H.tileID.key]=y[H.tileID.key]=H.tileID;for(const ne in D)D[ne].isChildOf(H.tileID)&&delete D[ne]}}for(const k in this._tiles)D[k]||(this._coveredTiles[k]=!0)}}for(const b in y)this._tiles[b].clearFadeHold();const v=c.keysDifference(this._tiles,y);for(const b of v){const T=this._tiles[b];T.hasSymbolBuckets&&!T.holdingForFade()?T.setHoldDuration(this.map._fadeDuration):T.hasSymbolBuckets&&!T.symbolFadeFinished()||this._removeTile(b)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){const a={},l={},d=Math.max(n-Dt.maxOverzooming,this._source.minzoom),m=Math.max(n+Dt.maxUnderzooming,this._source.minzoom),g={};for(const y of t){const v=this._addTile(y);a[y.key]=y,v.hasData()||nthis._source.maxzoom){const T=y.children(this._source.maxzoom)[0],C=this.getTile(T);if(C&&C.hasData()){a[T.key]=T;continue}}else{const T=y.children(this._source.maxzoom);if(a[T[0].key]&&a[T[1].key]&&a[T[2].key]&&a[T[3].key])continue}let b=v.wasRequested();for(let T=y.overscaledZ-1;T>=d;--T){const C=y.scaledTo(T);if(l[C.key])break;if(l[C.key]=!0,v=this.getTile(C),!v&&b&&(v=this._addTile(C)),v){const L=v.hasData();if((b||L)&&(a[C.key]=C),b=v.wasRequested(),L)break}}}return a}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const n=[];let a,l=this._tiles[t].tileID;for(;l.overscaledZ>0;){if(l.key in this._loadedParentTiles){a=this._loadedParentTiles[l.key];break}n.push(l.key);const d=l.scaledTo(l.overscaledZ-1);if(a=this._getLoadedTile(d),a)break;l=d}for(const d of n)this._loadedParentTiles[d]=a}}_addTile(t){let n=this._tiles[t.key];if(n)return n;n=this._cache.getAndRemove(t),n&&(this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,n)));const a=n;return n||(n=new mn(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,this._tileLoaded.bind(this,n,t.key,n.state))),n.uses++,this._tiles[t.key]=n,a||this._source.fire(new c.Event("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const a=n.getExpiryTimeout();a&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},a))}_removeTile(t){const n=this._tiles[t];n&&(n.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,n,a){const l=[],d=this.transform;if(!d)return l;const m=a?d.getCameraQueryGeometry(t):t,g=t.map(D=>d.pointCoordinate(D,this.terrain)),y=m.map(D=>d.pointCoordinate(D,this.terrain)),v=this.getIds();let b=1/0,T=1/0,C=-1/0,L=-1/0;for(const D of y)b=Math.min(b,D.x),T=Math.min(T,D.y),C=Math.max(C,D.x),L=Math.max(L,D.y);for(let D=0;D=0&&N[1].y+ne>=0){const K=g.map(oe=>k.getTilePoint(oe)),ae=y.map(oe=>k.getTilePoint(oe));l.push({tile:F,tileID:k,queryGeometry:K,cameraQueryGeometry:ae,scale:H})}}return l}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map(a=>this._tiles[a].tileID);for(const a of n)a.posMatrix=this.transform.calculatePosMatrix(a.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if(Rn(this._source.type)){const t=c.browser.now();for(const n in this._tiles)if(this._tiles[n].fadeEndTime>=t)return!0}return!1}setFeatureState(t,n,a){this._state.updateState(t=t||"_geojsonTileLayer",n,a)}removeFeatureState(t,n,a){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,a)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}setDependencies(t,n,a){const l=this._tiles[t];l&&l.setDependencies(n,a)}reloadTilesForDependencies(t,n){for(const a in this._tiles)this._tiles[a].hasDependency(t,n)&&this._reloadTile(a,"reloading");this._cache.filter(a=>!a.hasDependency(t,n))}}function is(h,t){const n=Math.abs(2*h.wrap)-+(h.wrap<0),a=Math.abs(2*t.wrap)-+(t.wrap<0);return h.overscaledZ-t.overscaledZ||a-n||t.canonical.y-h.canonical.y||t.canonical.x-h.canonical.x}function Rn(h){return h==="raster"||h==="image"||h==="video"}Dt.maxOverzooming=10,Dt.maxUnderzooming=3;const we="mapboxgl_preloaded_worker_pool";class Ai{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length{n.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[we]}numActive(){return Object.keys(this.active).length}}const zi=Math.floor(c.browser.hardwareConcurrency/2);let Or;function tn(){return Or||(Or=new Ai),Or}Ai.workerCount=c.isSafari(globalThis)?Math.max(Math.min(zi,3),1):1;class Te{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let a=1;a0?(l-m)/g:0;return this.points[d].mult(1-y).add(this.points[n].mult(y))}}function Ke(h,t){let n=!0;return h==="always"||h!=="never"&&t!=="never"||(n=!1),n}class Ye{constructor(t,n,a){const l=this.boxCells=[],d=this.circleCells=[];this.xCellCount=Math.ceil(t/a),this.yCellCount=Math.ceil(n/a);for(let m=0;mthis.width||l<0||n>this.height)return[];const y=[];if(t<=0&&n<=0&&this.width<=a&&this.height<=l){if(d)return[{key:null,x1:t,y1:n,x2:a,y2:l}];for(let v=0;v0}hitTestCircle(t,n,a,l,d){const m=t-a,g=t+a,y=n-a,v=n+a;if(g<0||m>this.width||v<0||y>this.height)return!1;const b=[];return this._forEachCell(m,y,g,v,this._queryCellCircle,b,{hitTest:!0,overlapMode:l,circle:{x:t,y:n,radius:a},seenUids:{box:{},circle:{}}},d),b.length>0}_queryCell(t,n,a,l,d,m,g,y){const{seenUids:v,hitTest:b,overlapMode:T}=g,C=this.boxCells[d];if(C!==null){const D=this.bboxes;for(const F of C)if(!v.box[F]){v.box[F]=!0;const k=4*F,H=this.boxKeys[F];if(t<=D[k+2]&&n<=D[k+3]&&a>=D[k+0]&&l>=D[k+1]&&(!y||y(H))&&(!b||!Ke(T,H.overlapMode))&&(m.push({key:H,x1:D[k],y1:D[k+1],x2:D[k+2],y2:D[k+3]}),b))return!0}}const L=this.circleCells[d];if(L!==null){const D=this.circles;for(const F of L)if(!v.circle[F]){v.circle[F]=!0;const k=3*F,H=this.circleKeys[F];if(this._circleAndRectCollide(D[k],D[k+1],D[k+2],t,n,a,l)&&(!y||y(H))&&(!b||!Ke(T,H.overlapMode))){const ne=D[k],N=D[k+1],K=D[k+2];if(m.push({key:H,x1:ne-K,y1:N-K,x2:ne+K,y2:N+K}),b)return!0}}}return!1}_queryCellCircle(t,n,a,l,d,m,g,y){const{circle:v,seenUids:b,overlapMode:T}=g,C=this.boxCells[d];if(C!==null){const D=this.bboxes;for(const F of C)if(!b.box[F]){b.box[F]=!0;const k=4*F,H=this.boxKeys[F];if(this._circleAndRectCollide(v.x,v.y,v.radius,D[k+0],D[k+1],D[k+2],D[k+3])&&(!y||y(H))&&!Ke(T,H.overlapMode))return m.push(!0),!0}}const L=this.circleCells[d];if(L!==null){const D=this.circles;for(const F of L)if(!b.circle[F]){b.circle[F]=!0;const k=3*F,H=this.circleKeys[F];if(this._circlesCollide(D[k],D[k+1],D[k+2],v.x,v.y,v.radius)&&(!y||y(H))&&!Ke(T,H.overlapMode))return m.push(!0),!0}}}_forEachCell(t,n,a,l,d,m,g,y){const v=this._convertToXCellCoord(t),b=this._convertToYCellCoord(n),T=this._convertToXCellCoord(a),C=this._convertToYCellCoord(l);for(let L=v;L<=T;L++)for(let D=b;D<=C;D++)if(d.call(this,t,n,a,l,this.xCellCount*D+L,m,g,y))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,n,a,l,d,m){const g=l-t,y=d-n,v=a+m;return v*v>g*g+y*y}_circleAndRectCollide(t,n,a,l,d,m,g){const y=(m-l)/2,v=Math.abs(t-(l+y));if(v>y+a)return!1;const b=(g-d)/2,T=Math.abs(n-(d+b));if(T>b+a)return!1;if(v<=y||T<=b)return!0;const C=v-y,L=T-b;return C*C+L*L<=a*a}}function pi(h,t,n,a,l){const d=c.create();return t?(c.scale(d,d,[1/l,1/l,1]),n||c.rotateZ(d,d,a.angle)):c.multiply(d,a.labelPlaneMatrix,h),d}function Ur(h,t,n,a,l){if(t){const d=c.clone(h);return c.scale(d,d,[l,l,1]),n||c.rotateZ(d,d,-a.angle),d}return a.glCoordMatrix}function Ge(h,t,n){let a;n?(a=[h.x,h.y,n(h.x,h.y),1],c.transformMat4(a,a,t)):(a=[h.x,h.y,0,1],V(a,a,t));const l=a[3];return{point:new c.Point(a[0]/l,a[1]/l),signedDistanceFromCamera:l}}function Tr(h,t){return .5+h/t*.5}function Er(h,t){const n=h[0]/h[3],a=h[1]/h[3];return n>=-t[0]&&n<=t[0]&&a>=-t[1]&&a<=t[1]}function rn(h,t,n,a,l,d,m,g,y,v){const b=a?h.textSizeData:h.iconSizeData,T=c.evaluateSizeForZoom(b,n.transform.zoom),C=[256/n.width*2+1,256/n.height*2+1],L=a?h.text.dynamicLayoutVertexArray:h.icon.dynamicLayoutVertexArray;L.clear();const D=h.lineVertexArray,F=a?h.text.placedSymbolArray:h.icon.placedSymbolArray,k=n.transform.width/n.transform.height;let H=!1;for(let ne=0;neMath.abs(n.x-t.x)*a?{useVertical:!0}:(h===c.WritingMode.vertical?t.yn.x)?{needsFlipping:!0}:null}function ci(h,t,n,a,l,d,m,g,y,v,b,T,C,L,D,F){const k=t/24,H=h.lineOffsetX*k,ne=h.lineOffsetY*k;let N;if(h.numGlyphs>1){const K=h.glyphStartIndex+h.numGlyphs,ae=h.lineStartIndex,oe=h.lineStartIndex+h.lineLength,ce=tr(k,g,H,ne,n,b,T,h,y,d,C,D,F);if(!ce)return{notEnoughRoom:!0};const _e=Ge(ce.first.point,m,F).point,fe=Ge(ce.last.point,m,F).point;if(a&&!n){const xe=nn(h.writingMode,_e,fe,L);if(xe)return xe}N=[ce.first];for(let xe=h.glyphStartIndex+1;xe0?_e.point:bt(T,ce,ae,1,l,F),xe=nn(h.writingMode,ae,fe,L);if(xe)return xe}const K=S(k*g.getoffsetX(h.glyphStartIndex),H,ne,n,b,T,h.segment,h.lineStartIndex,h.lineStartIndex+h.lineLength,y,d,C,D,F);if(!K)return{notEnoughRoom:!0};N=[K]}for(const K of N)c.addDynamicAttributes(v,K.point,K.angle);return{}}function bt(h,t,n,a,l,d){const m=Ge(h.add(h.sub(t)._unit()),l,d).point,g=n.sub(m);return n.add(g._mult(a/g.mag()))}function rs(h,t){const{projectionCache:n,lineVertexArray:a,labelPlaneMatrix:l,tileAnchorPoint:d,distanceFromAnchor:m,getElevation:g,previousVertex:y,direction:v,absOffsetX:b}=t;if(n.projections[h])return n.projections[h];const T=new c.Point(a.getx(h),a.gety(h)),C=Ge(T,l,g);if(C.signedDistanceFromCamera>0)return n.projections[h]=C.point,C.point;const L=h-v;return bt(m===0?d:new c.Point(a.getx(L),a.gety(L)),T,y,b-m+1,l,g)}function Sr(h,t,n){return h._unit()._perp()._mult(t*n)}function O(h,t,n,a,l,d,m,g){const{projectionCache:y,direction:v}=g;if(y.offsets[h])return y.offsets[h];const b=n.add(t);if(h+v=l)return y.offsets[h]=b,b;const T=rs(h+v,g),C=Sr(T.sub(n),m,v),L=n.add(C),D=T.add(C);return y.offsets[h]=c.findLineIntersection(d,b,L,D)||b,y.offsets[h]}function S(h,t,n,a,l,d,m,g,y,v,b,T,C,L){const D=a?h-t:h+t;let F=D>0?1:-1,k=0;a&&(F*=-1,k=Math.PI),F<0&&(k+=Math.PI);let H,ne,N=F>0?g+m:g+m+1,K=l,ae=l,oe=0,ce=0;const _e=Math.abs(D),fe=[];let xe;for(;oe+ce<=_e;){if(N+=F,N=y)return null;oe+=ce,ae=K,ne=H;const Ee={projectionCache:T,lineVertexArray:v,labelPlaneMatrix:b,tileAnchorPoint:d,distanceFromAnchor:oe,getElevation:L,previousVertex:ae,direction:F,absOffsetX:_e};if(K=rs(N,Ee),n===0)fe.push(ae),xe=K.sub(ae);else{let Ne;const ke=K.sub(ae);Ne=ke.mag()===0?Sr(rs(N+F,Ee).sub(K),n,F):Sr(ke,n,F),ne||(ne=ae.add(Ne)),H=O(N,Ne,K,g,y,ne,n,Ee),fe.push(ne),xe=H.sub(ne)}ce=xe.mag()}const Be=xe._mult((_e-oe)/ce)._add(ne||ae),et=k+Math.atan2(K.y-ae.y,K.x-ae.x);return fe.push(Be),{point:Be,angle:C?et:0,path:fe}}const A=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function z(h,t){for(let n=0;n=1;$e--)ke.push(Ee.path[$e]);for(let $e=1;$eGe(it,y,D));ke=$e.some(it=>it.signedDistanceFromCamera<=0)?[]:$e.map(it=>it.point)}let tt=[];if(ke.length>0){const $e=ke[0].clone(),it=ke[0].clone();for(let zt=1;zt=xe.x&&it.x<=Be.x&&$e.y>=xe.y&&it.y<=Be.y?[ke]:it.xBe.x||it.yBe.y?[]:c.clipLine([ke],xe.x,xe.y,Be.x,Be.y)}for(const $e of tt){et.reset($e,.25*fe);let it=0;it=et.length<=.5*fe?1:Math.ceil(et.paddedLength/It)+1;for(let zt=0;zt=this.screenRightBoundary||lthis.screenBottomBoundary}isInsideGrid(t,n,a,l){return a>=0&&t=0&&na.collisionGroupID===n}}return this.collisionGroups[t]}}function He(h,t,n,a,l){const{horizontalAlign:d,verticalAlign:m}=c.getAnchorAlignment(h);return new c.Point(-(d-.5)*t+a[0]*l,-(m-.5)*n+a[1]*l)}function Le(h,t,n,a,l,d){const{x1:m,x2:g,y1:y,y2:v,anchorPointX:b,anchorPointY:T}=h,C=new c.Point(t,n);return a&&C._rotate(l?d:-d),{x1:m+C.x,y1:y+C.y,x2:g+C.x,y2:v+C.y,anchorPointX:b,anchorPointY:T}}class Ve{constructor(t,n,a,l,d){this.transform=t.clone(),this.terrain=n,this.collisionIndex=new J(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=a,this.retainedQueryData={},this.collisionGroups=new Ze(l),this.collisionCircleArrays={},this.prevPlacement=d,d&&(d.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,a,l){const d=a.getBucket(n),m=a.latestFeatureIndex;if(!d||!m||n.id!==d.layerIds[0])return;const g=a.collisionBoxArray,y=d.layers[0].layout,v=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ),b=a.tileSize/c.EXTENT,T=this.transform.calculatePosMatrix(a.tileID.toUnwrapped()),C=y.get("text-pitch-alignment")==="map",L=y.get("text-rotation-alignment")==="map",D=G(a,1,this.transform.zoom),F=pi(T,C,L,this.transform,D);let k=null;if(C){const ne=Ur(T,C,L,this.transform,D);k=c.multiply([],this.transform.labelPlaneMatrix,ne)}this.retainedQueryData[d.bucketInstanceId]=new pe(d.bucketInstanceId,m,d.sourceLayerIndex,d.index,a.tileID);const H={bucket:d,layout:y,posMatrix:T,textLabelPlaneMatrix:F,labelToScreenMatrix:k,scale:v,textPixelRatio:b,holdingForFade:a.holdingForFade(),collisionBoxArray:g,partiallyEvaluatedTextSize:c.evaluateSizeForZoom(d.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(d.sourceID)};if(l)for(const ne of d.sortKeyRanges){const{sortKey:N,symbolInstanceStart:K,symbolInstanceEnd:ae}=ne;t.push({sortKey:N,symbolInstanceStart:K,symbolInstanceEnd:ae,parameters:H})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:d.symbolInstances.length,parameters:H})}attemptAnchorPlacement(t,n,a,l,d,m,g,y,v,b,T,C,L,D,F,k){const H=c.TextAnchorEnum[t.textAnchor],ne=[t.textOffset0,t.textOffset1],N=He(H,a,l,ne,d),K=this.collisionIndex.placeCollisionBox(Le(n,N.x,N.y,m,g,this.transform.angle),T,y,v,b.predicate,k);if((!F||this.collisionIndex.placeCollisionBox(Le(F,N.x,N.y,m,g,this.transform.angle),T,y,v,b.predicate,k).box.length!==0)&&K.box.length>0){let ae;if(this.prevPlacement&&this.prevPlacement.variableOffsets[C.crossTileID]&&this.prevPlacement.placements[C.crossTileID]&&this.prevPlacement.placements[C.crossTileID].text&&(ae=this.prevPlacement.variableOffsets[C.crossTileID].anchor),C.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[C.crossTileID]={textOffset:ne,width:a,height:l,anchor:H,textBoxScale:d,prevAnchor:ae},this.markUsedJustification(L,H,C,D),L.allowVerticalPlacement&&(this.markUsedOrientation(L,D,C),this.placedOrientations[C.crossTileID]=D),{shift:N,placedGlyphBoxes:K}}}placeLayerBucketPart(t,n,a){const{bucket:l,layout:d,posMatrix:m,textLabelPlaneMatrix:g,labelToScreenMatrix:y,textPixelRatio:v,holdingForFade:b,collisionBoxArray:T,partiallyEvaluatedTextSize:C,collisionGroup:L}=t.parameters,D=d.get("text-optional"),F=d.get("icon-optional"),k=c.getOverlapMode(d,"text-overlap","text-allow-overlap"),H=k==="always",ne=c.getOverlapMode(d,"icon-overlap","icon-allow-overlap"),N=ne==="always",K=d.get("text-rotation-alignment")==="map",ae=d.get("text-pitch-alignment")==="map",oe=d.get("icon-text-fit")!=="none",ce=d.get("symbol-z-order")==="viewport-y",_e=H&&(N||!l.hasIconData()||F),fe=N&&(H||!l.hasTextData()||D);!l.collisionArrays&&T&&l.deserializeCollisionBoxes(T);const xe=this.retainedQueryData[l.bucketInstanceId].tileID,Be=this.terrain?(Ee,Ne)=>this.terrain.getElevation(xe,Ee,Ne):null,et=(Ee,Ne)=>{var ke,It;if(n[Ee.crossTileID])return;if(b)return void(this.placements[Ee.crossTileID]=new ue(!1,!1,!1));let tt=!1,$e=!1,it=!0,zt=null,ft={box:null,offscreen:null},Xi={box:null,offscreen:null},ui=null,Rt=null,Bi=null,Mr=0,mr=0,Pr=0;Ne.textFeatureIndex?Mr=Ne.textFeatureIndex:Ee.useRuntimeCollisionCircles&&(Mr=Ee.featureIndex),Ne.verticalTextFeatureIndex&&(mr=Ne.verticalTextFeatureIndex);const Xn=Ne.textBox;if(Xn){const qt=ii=>{let Wt=c.WritingMode.horizontal;if(l.allowVerticalPlacement&&!ii&&this.prevPlacement){const _i=this.prevPlacement.placedOrientations[Ee.crossTileID];_i&&(this.placedOrientations[Ee.crossTileID]=_i,Wt=_i,this.markUsedOrientation(l,Wt,Ee))}return Wt},ti=(ii,Wt)=>{if(l.allowVerticalPlacement&&Ee.numVerticalGlyphVertices>0&&Ne.verticalTextBox){for(const _i of l.writingModes)if(_i===c.WritingMode.vertical?(ft=Wt(),Xi=ft):ft=ii(),ft&&ft.box&&ft.box.length)break}else ft=ii()},gi=Ee.textAnchorOffsetStartIndex,Wn=Ee.textAnchorOffsetEndIndex;if(Wn===gi){const ii=(Wt,_i)=>{const kt=this.collisionIndex.placeCollisionBox(Wt,k,v,m,L.predicate,Be);return kt&&kt.box&&kt.box.length&&(this.markUsedOrientation(l,_i,Ee),this.placedOrientations[Ee.crossTileID]=_i),kt};ti(()=>ii(Xn,c.WritingMode.horizontal),()=>{const Wt=Ne.verticalTextBox;return l.allowVerticalPlacement&&Ee.numVerticalGlyphVertices>0&&Wt?ii(Wt,c.WritingMode.vertical):{box:null,offscreen:null}}),qt(ft&&ft.box&&ft.box.length)}else{let ii=c.TextAnchorEnum[(It=(ke=this.prevPlacement)===null||ke===void 0?void 0:ke.variableOffsets[Ee.crossTileID])===null||It===void 0?void 0:It.anchor];const Wt=(kt,qr,gr)=>{const hn=kt.x2-kt.x1,ol=kt.y2-kt.y1,An=Ee.textBoxScale,Jl=oe&&ne==="never"?qr:null;let Cn={box:[],offscreen:!1},Bt=k==="never"?1:2,ya="never";ii&&Bt++;for(let co=0;coWt(Xn,Ne.iconBox,c.WritingMode.horizontal),()=>{const kt=Ne.verticalTextBox;return l.allowVerticalPlacement&&!(ft&&ft.box&&ft.box.length)&&Ee.numVerticalGlyphVertices>0&&kt?Wt(kt,Ne.verticalIconBox,c.WritingMode.vertical):{box:null,offscreen:null}}),ft&&(tt=ft.box,it=ft.offscreen);const _i=qt(ft&&ft.box);if(!tt&&this.prevPlacement){const kt=this.prevPlacement.variableOffsets[Ee.crossTileID];kt&&(this.variableOffsets[Ee.crossTileID]=kt,this.markUsedJustification(l,kt.anchor,Ee,_i))}}}if(ui=ft,tt=ui&&ui.box&&ui.box.length>0,it=ui&&ui.offscreen,Ee.useRuntimeCollisionCircles){const qt=l.text.placedSymbolArray.get(Ee.centerJustifiedTextSymbolIndex),ti=c.evaluateSizeForFeature(l.textSizeData,C,qt),gi=d.get("text-padding");Rt=this.collisionIndex.placeCollisionCircles(k,qt,l.lineVertexArray,l.glyphOffsetArray,ti,m,g,y,a,ae,L.predicate,Ee.collisionCircleDiameter,gi,Be),Rt.circles.length&&Rt.collisionDetected&&!a&&c.warnOnce("Collisions detected, but collision boxes are not shown"),tt=H||Rt.circles.length>0&&!Rt.collisionDetected,it=it&&Rt.offscreen}if(Ne.iconFeatureIndex&&(Pr=Ne.iconFeatureIndex),Ne.iconBox){const qt=ti=>{const gi=oe&&zt?Le(ti,zt.x,zt.y,K,ae,this.transform.angle):ti;return this.collisionIndex.placeCollisionBox(gi,ne,v,m,L.predicate,Be)};Xi&&Xi.box&&Xi.box.length&&Ne.verticalIconBox?(Bi=qt(Ne.verticalIconBox),$e=Bi.box.length>0):(Bi=qt(Ne.iconBox),$e=Bi.box.length>0),it=it&&Bi.offscreen}const cn=D||Ee.numHorizontalGlyphVertices===0&&Ee.numVerticalGlyphVertices===0,$r=F||Ee.numIconVertices===0;if(cn||$r?$r?cn||($e=$e&&tt):tt=$e&&tt:$e=tt=$e&&tt,tt&&ui&&ui.box&&this.collisionIndex.insertCollisionBox(ui.box,k,d.get("text-ignore-placement"),l.bucketInstanceId,Xi&&Xi.box&&mr?mr:Mr,L.ID),$e&&Bi&&this.collisionIndex.insertCollisionBox(Bi.box,ne,d.get("icon-ignore-placement"),l.bucketInstanceId,Pr,L.ID),Rt&&(tt&&this.collisionIndex.insertCollisionCircles(Rt.circles,k,d.get("text-ignore-placement"),l.bucketInstanceId,Mr,L.ID),a)){const qt=l.bucketInstanceId;let ti=this.collisionCircleArrays[qt];ti===void 0&&(ti=this.collisionCircleArrays[qt]=new de);for(let gi=0;gi=0;--Ne){const ke=Ee[Ne];et(l.symbolInstances.get(ke),l.collisionArrays[ke])}}else for(let Ee=t.symbolInstanceStart;Ee=0&&(t.text.placedSymbolArray.get(g).crossTileID=d>=0&&g!==d?0:a.crossTileID)}markUsedOrientation(t,n,a){const l=n===c.WritingMode.horizontal||n===c.WritingMode.horizontalOnly?n:0,d=n===c.WritingMode.vertical?n:0,m=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex];for(const g of m)t.text.placedSymbolArray.get(g).placedOrientation=l;a.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).placedOrientation=d)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let a=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const l=n?n.symbolFadeChange(t):1,d=n?n.opacities:{},m=n?n.variableOffsets:{},g=n?n.placedOrientations:{};for(const y in this.placements){const v=this.placements[y],b=d[y];b?(this.opacities[y]=new te(b,l,v.text,v.icon),a=a||v.text!==b.text.placed||v.icon!==b.icon.placed):(this.opacities[y]=new te(null,l,v.text,v.icon,v.skipFade),a=a||v.text||v.icon)}for(const y in d){const v=d[y];if(!this.opacities[y]){const b=new te(v,l,!1,!1);b.isHidden()||(this.opacities[y]=b,a=a||v.text.placed||v.icon.placed)}}for(const y in m)this.variableOffsets[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.variableOffsets[y]=m[y]);for(const y in g)this.placedOrientations[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.placedOrientations[y]=g[y]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");a?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const a={};for(const l of n){const d=l.getBucket(t);d&&l.latestFeatureIndex&&t.id===d.layerIds[0]&&this.updateBucketOpacities(d,a,l.collisionBoxArray)}}updateBucketOpacities(t,n,a){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();const l=t.layers[0],d=l.layout,m=new te(null,0,!1,!1,!0),g=d.get("text-allow-overlap"),y=d.get("icon-allow-overlap"),v=l._unevaluatedLayout.hasValue("text-variable-anchor")||l._unevaluatedLayout.hasValue("text-variable-anchor-offset"),b=d.get("text-rotation-alignment")==="map",T=d.get("text-pitch-alignment")==="map",C=d.get("icon-text-fit")!=="none",L=new te(null,0,g&&(y||!t.hasIconData()||d.get("icon-optional")),y&&(g||!t.hasTextData()||d.get("text-optional")),!0);!t.collisionArrays&&a&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(a);const D=(F,k,H)=>{for(let ne=0;ne0,oe=this.placedOrientations[k.crossTileID],ce=oe===c.WritingMode.vertical,_e=oe===c.WritingMode.horizontal||oe===c.WritingMode.horizontalOnly;if(H>0||ne>0){const fe=hi(K.text);D(t.text,H,ce?Ot:fe),D(t.text,ne,_e?Ot:fe);const xe=K.text.isHidden();[k.rightJustifiedTextSymbolIndex,k.centerJustifiedTextSymbolIndex,k.leftJustifiedTextSymbolIndex].forEach(Ee=>{Ee>=0&&(t.text.placedSymbolArray.get(Ee).hidden=xe||ce?1:0)}),k.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(k.verticalPlacedTextSymbolIndex).hidden=xe||_e?1:0);const Be=this.variableOffsets[k.crossTileID];Be&&this.markUsedJustification(t,Be.anchor,k,oe);const et=this.placedOrientations[k.crossTileID];et&&(this.markUsedJustification(t,"left",k,et),this.markUsedOrientation(t,et,k))}if(ae){const fe=hi(K.icon),xe=!(C&&k.verticalPlacedIconSymbolIndex&&ce);k.placedIconSymbolIndex>=0&&(D(t.icon,k.numIconVertices,xe?fe:Ot),t.icon.placedSymbolArray.get(k.placedIconSymbolIndex).hidden=K.icon.isHidden()),k.verticalPlacedIconSymbolIndex>=0&&(D(t.icon,k.numVerticalIconVertices,xe?Ot:fe),t.icon.placedSymbolArray.get(k.verticalPlacedIconSymbolIndex).hidden=K.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const fe=t.collisionArrays[F];if(fe){let xe=new c.Point(0,0);if(fe.textBox||fe.verticalTextBox){let et=!0;if(v){const Ee=this.variableOffsets[N];Ee?(xe=He(Ee.anchor,Ee.width,Ee.height,Ee.textOffset,Ee.textBoxScale),b&&xe._rotate(T?this.transform.angle:-this.transform.angle)):et=!1}fe.textBox&&We(t.textCollisionBox.collisionVertexArray,K.text.placed,!et||ce,xe.x,xe.y),fe.verticalTextBox&&We(t.textCollisionBox.collisionVertexArray,K.text.placed,!et||_e,xe.x,xe.y)}const Be=!!(!_e&&fe.verticalIconBox);fe.iconBox&&We(t.iconCollisionBox.collisionVertexArray,K.icon.placed,Be,C?xe.x:0,C?xe.y:0),fe.verticalIconBox&&We(t.iconCollisionBox.collisionVertexArray,K.icon.placed,!Be,C?xe.x:0,C?xe.y:0)}}}if(t.sortFeatures(this.transform.angle),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 new 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 new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);if(t.bucketInstanceId in this.collisionCircleArrays){const F=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=F.invProjMatrix,t.placementViewportMatrix=F.viewportMatrix,t.collisionCircleArray=F.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?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.lastPlacementChangeTimet}setStale(){this.stale=!0}}function We(h,t,n,a,l){h.emplaceBack(t?1:0,n?1:0,a||0,l||0),h.emplaceBack(t?1:0,n?1:0,a||0,l||0),h.emplaceBack(t?1:0,n?1:0,a||0,l||0),h.emplaceBack(t?1:0,n?1:0,a||0,l||0)}const ot=Math.pow(2,25),_t=Math.pow(2,24),rt=Math.pow(2,17),at=Math.pow(2,16),ki=Math.pow(2,9),Xe=Math.pow(2,8),Gt=Math.pow(2,1);function hi(h){if(h.opacity===0&&!h.placed)return 0;if(h.opacity===1&&h.placed)return 4294967295;const t=h.placed?1:0,n=Math.floor(127*h.opacity);return n*ot+t*_t+n*rt+t*at+n*ki+t*Xe+n*Gt+t}const Ot=0;class $i{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,n,a,l,d){const m=this._bucketParts;for(;this._currentTileIndexg.sortKey-y.sortKey));this._currentPartIndex!this._forceFullPlacement&&c.browser.now()-l>2;for(;this._currentPlacementIndex>=0;){const m=n[t[this._currentPlacementIndex]],g=this.placement.collisionIndex.transform.zoom;if(m.type==="symbol"&&(!m.minzoom||m.minzoom<=g)&&(!m.maxzoom||m.maxzoom>g)){if(this._inProgressLayer||(this._inProgressLayer=new $i(m)),this._inProgressLayer.continuePlacement(a[m.source],this.placement,this._showCollisionBoxes,m,d))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const fi=512/c.EXTENT/2;class ir{constructor(t,n,a){this.tileID=t,this.bucketInstanceId=a,this._symbolsByKey={};const l=new Map;for(let d=0;d({x:Math.floor(y.anchorX*fi),y:Math.floor(y.anchorY*fi)})),crossTileIDs:m.map(y=>y.crossTileID)};if(g.positions.length>128){const y=new c.KDBush(g.positions.length,16,Uint16Array);for(const{x:v,y:b}of g.positions)y.add(v,b);y.finish(),delete g.positions,g.index=y}this._symbolsByKey[d]=g}}getScaledCoordinates(t,n){const{x:a,y:l,z:d}=this.tileID.canonical,{x:m,y:g,z:y}=n.canonical,v=fi/Math.pow(2,y-d),b=(g*c.EXTENT+t.anchorY)*v,T=l*c.EXTENT*fi;return{x:Math.floor((m*c.EXTENT+t.anchorX)*v-a*c.EXTENT*fi),y:Math.floor(b-T)}}findMatches(t,n,a){const l=this.tileID.canonical.zt)}}class ko{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Os{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const a in this.indexes){const l=this.indexes[a],d={};for(const m in l){const g=l[m];g.tileID=g.tileID.unwrapTo(g.tileID.wrap+n),d[g.tileID.key]=g}this.indexes[a]=d}this.lng=t}addBucket(t,n,a){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let d=0;dt.overscaledZ)for(const g in m){const y=m[g];y.tileID.isChildOf(t)&&y.findMatches(n.symbolInstances,t,l)}else{const g=m[t.scaledTo(Number(d)).key];g&&g.findMatches(n.symbolInstances,t,l)}}for(let d=0;d{n[a]=!0});for(const a in this.layerIndexes)n[a]||delete this.layerIndexes[a]}}const sn=(h,t)=>c.emitValidationErrors(h,t&&t.filter(n=>n.identifier!=="source.canvas")),gn=c.pick(c.operations,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),Vt=c.pick(c.operations,["setCenter","setZoom","setBearing","setPitch"]),Us=c.emptyStyle();class mi extends c.Evented{constructor(t,n={}){super(),this.map=t,this.dispatcher=new li(tn(),this,t._getMapId()),this.imageManager=new Pi,this.imageManager.setEventedParent(this),this.glyphManager=new Ei(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new cr(256,512),this.crossTileSymbolIndex=new Ut,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new c.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",c.getReferrer());const a=this;this._rtlTextPluginCallback=mi.registerForPluginStateChange(l=>{a.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:l.pluginStatus,pluginURL:l.pluginURL},(d,m)=>{if(c.triggerPluginCompletionEvent(d),m&&m.every(g=>g))for(const g in a.sourceCaches){const y=a.sourceCaches[g].getSource().type;y!=="vector"&&y!=="geojson"||a.sourceCaches[g].reload()}})}),this.on("data",l=>{if(l.dataType!=="source"||l.sourceDataType!=="metadata")return;const d=this.sourceCaches[l.sourceId];if(!d)return;const m=d.getSource();if(m&&m.vectorLayerIds)for(const g in this._layers){const y=this._layers[g];y.source===m.id&&this._validateLayer(y)}})}loadURL(t,n={},a){this.fire(new c.Event("dataloading",{dataType:"style"})),n.validate=typeof n.validate!="boolean"||n.validate;const l=this.map._requestManager.transformRequest(t,vt.Style);this._request=c.getJSON(l,(d,m)=>{this._request=null,d?this.fire(new c.ErrorEvent(d)):m&&this._load(m,n,a)})}loadJSON(t,n={},a){this.fire(new c.Event("dataloading",{dataType:"style"})),this._request=c.browser.frame(()=>{this._request=null,n.validate=n.validate!==!1,this._load(t,n,a)})}loadEmpty(){this.fire(new c.Event("dataloading",{dataType:"style"})),this._load(Us,{validate:!1})}_load(t,n,a){var l;const d=n.transformStyle?n.transformStyle(a,t):t;if(!n.validate||!sn(this,c.validateStyle(d))){this._loaded=!0,this.stylesheet=d;for(const m in d.sources)this.addSource(m,d.sources[m],{validate:!1});d.sprite?this._loadSprite(d.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(d.glyphs),this._createLayers(),this.light=new Ln(this.stylesheet.light),this.map.setTerrain((l=this.stylesheet.terrain)!==null&&l!==void 0?l:null),this.fire(new c.Event("data",{dataType:"style"})),this.fire(new c.Event("style.load"))}}_createLayers(){const t=c.derefLayers(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",t),this._order=t.map(n=>n.id),this._layers={},this._serializedLayers=null;for(const n of t){const a=c.createStyleLayer(n);a.setEventedParent(this,{layer:{id:n.id}}),this._layers[n.id]=a}}_loadSprite(t,n=!1,a=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=function(l,d,m,g){const y=di(l),v=y.length,b=m>1?"@2x":"",T={},C={},L={};for(const{id:D,url:F}of y){const k=d.transformRequest(d.normalizeSpriteURL(F,b,".json"),vt.SpriteJSON),H=`${D}_${k.url}`;T[H]=c.getJSON(k,(K,ae)=>{delete T[H],C[D]=ae,Qt(g,C,L,K,v)});const ne=d.transformRequest(d.normalizeSpriteURL(F,b,".png"),vt.SpriteImage),N=`${D}_${ne.url}`;T[N]=jt.getImage(ne,(K,ae)=>{delete T[N],L[D]=ae,Qt(g,C,L,K,v)})}return{cancel(){for(const D of Object.values(T))D.cancel()}}}(t,this.map._requestManager,this.map.getPixelRatio(),(l,d)=>{if(this._spriteRequest=null,l)this.fire(new c.ErrorEvent(l));else if(d)for(const m in d){this._spritesImagesIds[m]=[];const g=this._spritesImagesIds[m]?this._spritesImagesIds[m].filter(y=>!(y in d)):[];for(const y of g)this.imageManager.removeImage(y),this._changedImages[y]=!0;for(const y in d[m]){const v=m==="default"?y:`${m}:${y}`;this._spritesImagesIds[m].push(v),v in this.imageManager.images?this.imageManager.updateImage(v,d[m][y],!1):this.imageManager.addImage(v,d[m][y]),n&&(this._changedImages[v]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new c.Event("data",{dataType:"style"})),a&&a(l)})}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new c.Event("data",{dataType:"style"}))}_validateLayer(t){const n=this.sourceCaches[t.source];if(!n)return;const a=t.sourceLayer;if(!a)return;const l=n.getSource();(l.type==="geojson"||l.vectorLayerIds&&l.vectorLayerIds.indexOf(a)===-1)&&this.fire(new c.ErrorEvent(new Error(`Source layer "${a}" does not exist on source "${l.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t){const n=this._serializedAllLayers();if(!t||t.length===0)return Object.values(n);const a=[];for(const l of t)n[l]&&a.push(n[l]);return a}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const n=Object.keys(this._layers);for(const a of n){const l=this._layers[a];l.type!=="custom"&&(t[a]=l.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const n=this._changed;if(this._changed){const l=Object.keys(this._updatedLayers),d=Object.keys(this._removedLayers);(l.length||d.length)&&this._updateWorkerLayers(l,d);for(const m in this._updatedSources){const g=this._updatedSources[m];if(g==="reload")this._reloadSource(m);else{if(g!=="clear")throw new Error(`Invalid action ${g}`);this._clearSource(m)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const m in this._updatedPaintProps)this._layers[m].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}const a={};for(const l in this.sourceCaches){const d=this.sourceCaches[l];a[l]=d.used,d.used=!1}for(const l of this._order){const d=this._layers[l];d.recalculate(t,this._availableImages),!d.isHidden(t.zoom)&&d.source&&(this.sourceCaches[d.source].used=!0)}for(const l in a){const d=this.sourceCaches[l];a[l]!==d.used&&d.fire(new c.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:l}))}this.light.recalculate(t),this.z=t.zoom,n&&this.fire(new c.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const n in this.sourceCaches)this.sourceCaches[n].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,n){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(t),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,n={}){this._checkLoaded();const a=this.serialize();if(t=n.transformStyle?n.transformStyle(a,t):t,sn(this,c.validateStyle(t)))return!1;(t=c.clone$1(t)).layers=c.derefLayers(t.layers);const l=c.diffStyles(a,t).filter(m=>!(m.command in Vt));if(l.length===0)return!1;const d=l.filter(m=>!(m.command in gn));if(d.length>0)throw new Error(`Unimplemented: ${d.map(m=>m.command).join(", ")}.`);for(const m of l)m.command!=="setTransition"&&this[m.command].apply(this,m.args);return this.stylesheet=t,!0}addImage(t,n){if(this.getImage(t))return this.fire(new c.ErrorEvent(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,n),this._afterImageUpdated(t)}updateImage(t,n){this.imageManager.updateImage(t,n)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new c.ErrorEvent(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new c.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,a={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(c.validateStyle.source,`sources.${t}`,n,null,a))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const l=this.sourceCaches[t]=new Dt(t,n,this.dispatcher);l.style=this,l.setEventedParent(this,()=>({isSourceLoaded:l.loaded(),source:l.serialize(),sourceId:t})),l.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(const a in this._layers)if(this._layers[a].source===t)return this.fire(new c.ErrorEvent(new Error(`Source "${t}" cannot be removed while layer "${a}" is using it.`)));const n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire(new c.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,n){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const a=this.sourceCaches[t].getSource();if(a.type!=="geojson")throw new Error(`geojsonSource.type is ${a.type}, which is !== 'geojson`);a.setData(n),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,n,a={}){this._checkLoaded();const l=t.id;if(this.getLayer(l))return void this.fire(new c.ErrorEvent(new Error(`Layer "${l}" already exists on this map.`)));let d;if(t.type==="custom"){if(sn(this,c.validateCustomStyleLayer(t)))return;d=c.createStyleLayer(t)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(l,t.source),t=c.clone$1(t),t=c.extend(t,{source:l})),this._validate(c.validateStyle.layer,`layers.${l}`,t,{arrayIndex:-1},a))return;d=c.createStyleLayer(t),this._validateLayer(d),d.setEventedParent(this,{layer:{id:l}})}const m=n?this._order.indexOf(n):this._order.length;if(n&&m===-1)this.fire(new c.ErrorEvent(new Error(`Cannot add layer "${l}" before non-existing layer "${n}".`)));else{if(this._order.splice(m,0,l),this._layerOrderChanged=!0,this._layers[l]=d,this._removedLayers[l]&&d.source&&d.type!=="custom"){const g=this._removedLayers[l];delete this._removedLayers[l],g.type!==d.type?this._updatedSources[d.source]="clear":(this._updatedSources[d.source]="reload",this.sourceCaches[d.source].pause())}this._updateLayer(d),d.onAdd&&d.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new c.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const a=this._order.indexOf(t);this._order.splice(a,1);const l=n?this._order.indexOf(n):this._order.length;n&&l===-1?this.fire(new c.ErrorEvent(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(l,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new c.ErrorEvent(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const a=this._order.indexOf(t);this._order.splice(a,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,n,a){this._checkLoaded();const l=this.getLayer(t);l?l.minzoom===n&&l.maxzoom===a||(n!=null&&(l.minzoom=n),a!=null&&(l.maxzoom=a),this._updateLayer(l)):this.fire(new c.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,a={}){this._checkLoaded();const l=this.getLayer(t);if(l){if(!c.deepEqual(l.filter,n))return n==null?(l.filter=void 0,void this._updateLayer(l)):void(this._validate(c.validateStyle.filter,`layers.${l.id}.filter`,n,null,a)||(l.filter=c.clone$1(n),this._updateLayer(l)))}else this.fire(new c.ErrorEvent(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return c.clone$1(this.getLayer(t).filter)}setLayoutProperty(t,n,a,l={}){this._checkLoaded();const d=this.getLayer(t);d?c.deepEqual(d.getLayoutProperty(n),a)||(d.setLayoutProperty(n,a,l),this._updateLayer(d)):this.fire(new c.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const a=this.getLayer(t);if(a)return a.getLayoutProperty(n);this.fire(new c.ErrorEvent(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,a,l={}){this._checkLoaded();const d=this.getLayer(t);d?c.deepEqual(d.getPaintProperty(n),a)||(d.setPaintProperty(n,a,l)&&this._updateLayer(d),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new c.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();const a=t.source,l=t.sourceLayer,d=this.sourceCaches[a];if(d===void 0)return void this.fire(new c.ErrorEvent(new Error(`The source '${a}' does not exist in the map's style.`)));const m=d.getSource().type;m==="geojson"&&l?this.fire(new c.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):m!=="vector"||l?(t.id===void 0&&this.fire(new c.ErrorEvent(new Error("The feature id parameter must be provided."))),d.setFeatureState(l,t.id,n)):this.fire(new c.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const a=t.source,l=this.sourceCaches[a];if(l===void 0)return void this.fire(new c.ErrorEvent(new Error(`The source '${a}' does not exist in the map's style.`)));const d=l.getSource().type,m=d==="vector"?t.sourceLayer:void 0;d!=="vector"||m?n&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new c.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):l.removeFeatureState(m,t.id,n):this.fire(new c.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,a=t.sourceLayer,l=this.sourceCaches[n];if(l!==void 0)return l.getSource().type!=="vector"||a?(t.id===void 0&&this.fire(new c.ErrorEvent(new Error("The feature id parameter must be provided."))),l.getFeatureState(a,t.id)):void this.fire(new c.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new c.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return c.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const t=c.mapObject(this.sourceCaches,l=>l.serialize()),n=this._serializeByIds(this._order),a=this.stylesheet;return c.filterObject({version:a.version,name:a.name,metadata:a.metadata,light:a.light,center:a.center,zoom:a.zoom,bearing:a.bearing,pitch:a.pitch,sprite:a.sprite,glyphs:a.glyphs,transition:a.transition,sources:t,layers:n},l=>l!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const n=m=>this._layers[m].type==="fill-extrusion",a={},l=[];for(let m=this._order.length-1;m>=0;m--){const g=this._order[m];if(n(g)){a[g]=m;for(const y of t){const v=y[g];if(v)for(const b of v)l.push(b)}}}l.sort((m,g)=>g.intersectionZ-m.intersectionZ);const d=[];for(let m=this._order.length-1;m>=0;m--){const g=this._order[m];if(n(g))for(let y=l.length-1;y>=0;y--){const v=l[y].feature;if(a[v.layer.id]{const _e=H.featureSortOrder;if(_e){const fe=_e.indexOf(oe.featureIndex);return _e.indexOf(ce.featureIndex)-fe}return ce.featureIndex-oe.featureIndex});for(const oe of ae)K.push(oe)}}for(const H in D)D[H].forEach(ne=>{const N=ne.feature,K=v[g[H].source].getFeatureState(N.layer["source-layer"],N.id);N.source=N.layer.source,N.layer["source-layer"]&&(N.sourceLayer=N.layer["source-layer"]),N.state=K});return D}(this._layers,m,this.sourceCaches,t,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(d)}querySourceFeatures(t,n){n&&n.filter&&this._validate(c.validateStyle.filter,"querySourceFeatures.filter",n.filter,null,n);const a=this.sourceCaches[t];return a?function(l,d){const m=l.getRenderableIds().map(v=>l.getTileByID(v)),g=[],y={};for(let v=0;v{Fr[l]=d})(t,n),n.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:n.workerSourceURL},a):a(null,null))}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();const a=this.light.getLight();let l=!1;for(const m in t)if(!c.deepEqual(t[m],a[m])){l=!0;break}if(!l)return;const d={now:c.browser.now(),transition:c.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(d)}_validate(t,n,a,l,d={}){return(!d||d.validate!==!1)&&sn(this,t.call(c.validateStyle,c.extend({key:n,style:this.serialize(),value:a,styleSpec:c.v8Spec},l)))}_remove(t=!0){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),c.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const n in this._layers)this._layers[n].setEventedParent(null);for(const n in this.sourceCaches){const a=this.sourceCaches[n];a.setEventedParent(null),a.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove(t)}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const n in this.sourceCaches)this.sourceCaches[n].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,n,a,l,d=!1){let m=!1,g=!1;const y={};for(const v of this._order){const b=this._layers[v];if(b.type!=="symbol")continue;if(!y[b.source]){const C=this.sourceCaches[b.source];y[b.source]=C.getRenderableIds(!0).map(L=>C.getTileByID(L)).sort((L,D)=>D.tileID.overscaledZ-L.tileID.overscaledZ||(L.tileID.isLessThan(D.tileID)?-1:1))}const T=this.crossTileSymbolIndex.addLayer(b,y[b.source],t.center.lng);m=m||T}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((d=d||this._layerOrderChanged||a===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(c.browser.now(),t.zoom))&&(this.pauseablePlacement=new Ml(t,this.map.terrain,this._order,d,n,a,l,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,y),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(c.browser.now()),g=!0),m&&this.pauseablePlacement.placement.setStale()),g||m)for(const v of this._order){const b=this._layers[v];b.type==="symbol"&&this.placement.updateLayerOpacities(b,y[b.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(c.browser.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,n,a){this.imageManager.getImages(n.icons,a),this._updateTilesForChangedImages();const l=this.sourceCaches[n.source];l&&l.setDependencies(n.tileID.key,n.type,n.icons)}getGlyphs(t,n,a){this.glyphManager.getGlyphs(n.stacks,a);const l=this.sourceCaches[n.source];l&&l.setDependencies(n.tileID.key,n.type,[""])}getResource(t,n,a){return c.makeRequest(n,a)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,n={}){this._checkLoaded(),t&&this._validate(c.validateStyle.glyphs,"glyphs",t,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,n,a={},l){this._checkLoaded();const d=[{id:t,url:n}],m=[...di(this.stylesheet.sprite),...d];this._validate(c.validateStyle.sprite,"sprite",m,null,a)||(this.stylesheet.sprite=m,this._loadSprite(d,!0,l))}removeSprite(t){this._checkLoaded();const n=di(this.stylesheet.sprite);if(n.find(a=>a.id===t)){if(this._spritesImagesIds[t])for(const a of this._spritesImagesIds[t])this.imageManager.removeImage(a),this._changedImages[a]=!0;n.splice(n.findIndex(a=>a.id===t),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new c.Event("data",{dataType:"style"}))}else this.fire(new c.ErrorEvent(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return di(this.stylesheet.sprite)}setSprite(t,n={},a){this._checkLoaded(),t&&this._validate(c.validateStyle.sprite,"sprite",t,null,n)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,a):(this._unloadSprite(),a&&a(null)))}}mi.registerForPluginStateChange=c.registerForPluginStateChange;var Vs=c.createLayout([{name:"a_pos",type:"Int16",components:2}]),Ir="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";const ns={prelude:pt(`#ifdef GL_ES precision mediump float; #else #if !defined(lowp) @@ -574,7 +574,7 @@ uniform ${b} ${T} u_${C}; #endif `}),staticAttributes:a,staticUniforms:m}}class Ns{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,n,a,l,d,m,g,y,v){this.context=t;let b=this.boundPaintVertexBuffers.length!==l.length;for(let T=0;!b&&T({u_depth:new c.Uniform1i(oe,ce.u_depth),u_terrain:new c.Uniform1i(oe,ce.u_terrain),u_terrain_dim:new c.Uniform1f(oe,ce.u_terrain_dim),u_terrain_matrix:new c.UniformMatrix4f(oe,ce.u_terrain_matrix),u_terrain_unpack:new c.Uniform4f(oe,ce.u_terrain_unpack),u_terrain_exaggeration:new c.Uniform1f(oe,ce.u_terrain_exaggeration)}))(t,ae),this.binderUniforms=a?a.getUniforms(t,ae):[]}draw(t,n,a,l,d,m,g,y,v,b,T,C,L,D,F,k,H,ne){const N=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(a),t.setStencilMode(l),t.setColorMode(d),t.setCullFace(m),y){t.activeTexture.set(N.TEXTURE2),N.bindTexture(N.TEXTURE_2D,y.depthTexture),t.activeTexture.set(N.TEXTURE3),N.bindTexture(N.TEXTURE_2D,y.texture);for(const ae in this.terrainUniforms)this.terrainUniforms[ae].set(y[ae])}for(const ae in this.fixedUniforms)this.fixedUniforms[ae].set(g[ae]);F&&F.setUniforms(t,this.binderUniforms,L,{zoom:D});let K=0;switch(n){case N.LINES:K=2;break;case N.TRIANGLES:K=3;break;case N.LINE_STRIP:K=1}for(const ae of C.get()){const oe=ae.vaos||(ae.vaos={});(oe[v]||(oe[v]=new Ns)).bind(t,this,b,F?F.getPaintVertexBuffers():[],T,ae.vertexOffset,k,H,ne),N.drawElements(n,ae.primitiveLength*K,N.UNSIGNED_SHORT,ae.primitiveOffset*K*2)}}}function $s(h,t,n){const a=1/G(n,1,t.transform.tileZoom),l=Math.pow(2,n.tileID.overscaledZ),d=n.tileSize*Math.pow(2,t.transform.tileZoom)/l,m=d*(n.tileID.canonical.x+n.tileID.wrap*l),g=d*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[a,h.fromScale,h.toScale],u_fade:h.t,u_pixel_coord_upper:[m>>16,g>>16],u_pixel_coord_lower:[65535&m,65535&g]}}const ss=(h,t,n,a)=>{const l=t.style.light,d=l.properties.get("position"),m=[d.x,d.y,d.z],g=function(){var v=new c.ARRAY_TYPE(9);return c.ARRAY_TYPE!=Float32Array&&(v[1]=0,v[2]=0,v[3]=0,v[5]=0,v[6]=0,v[7]=0),v[0]=1,v[4]=1,v[8]=1,v}();l.properties.get("anchor")==="viewport"&&function(v,b){var T=Math.sin(b),C=Math.cos(b);v[0]=C,v[1]=T,v[2]=0,v[3]=-T,v[4]=C,v[5]=0,v[6]=0,v[7]=0,v[8]=1}(g,-t.transform.angle),function(v,b,T){var C=b[0],L=b[1],D=b[2];v[0]=C*T[0]+L*T[3]+D*T[6],v[1]=C*T[1]+L*T[4]+D*T[7],v[2]=C*T[2]+L*T[5]+D*T[8]}(m,m,g);const y=l.properties.get("color");return{u_matrix:h,u_lightpos:m,u_lightintensity:l.properties.get("intensity"),u_lightcolor:[y.r,y.g,y.b],u_vertical_gradient:+n,u_opacity:a}},Pl=(h,t,n,a,l,d,m)=>c.extend(ss(h,t,n,a),$s(d,t,m),{u_height_factor:-Math.pow(2,l.overscaledZ)/m.tileSize/8}),ko=h=>({u_matrix:h}),qs=(h,t,n,a)=>c.extend(ko(h),$s(n,t,a)),zl=(h,t)=>({u_matrix:h,u_world:t}),Do=(h,t,n,a,l)=>c.extend(qs(h,t,n,a),{u_world:l}),kl=(h,t,n,a)=>{const l=h.transform;let d,m;if(a.paint.get("circle-pitch-alignment")==="map"){const g=G(n,1,l.zoom);d=!0,m=[g,g]}else d=!1,m=l.pixelsToGLUnits;return{u_camera_to_center_distance:l.cameraToCenterDistance,u_scale_with_map:+(a.paint.get("circle-pitch-scale")==="map"),u_matrix:h.translatePosMatrix(t.posMatrix,n,a.paint.get("circle-translate"),a.paint.get("circle-translate-anchor")),u_pitch_with_map:+d,u_device_pixel_ratio:h.pixelRatio,u_extrude_scale:m}},Lo=(h,t,n)=>{const a=G(n,1,t.zoom),l=Math.pow(2,t.zoom-n.tileID.overscaledZ),d=n.tileID.overscaleFactor();return{u_matrix:h,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:a,u_extrude_scale:[t.pixelsToGLUnits[0]/(a*l),t.pixelsToGLUnits[1]/(a*l)],u_overscale_factor:d}},Bo=(h,t,n=1)=>({u_matrix:h,u_color:t,u_overlay:0,u_overlay_scale:n}),Zs=h=>({u_matrix:h}),Ro=(h,t,n,a)=>({u_matrix:h,u_extrude_scale:G(t,1,n),u_intensity:a});function Fo(h,t){const n=Math.pow(2,t.canonical.z),a=t.canonical.y;return[new c.MercatorCoordinate(0,a/n).toLngLat().lat,new c.MercatorCoordinate(0,(a+1)/n).toLngLat().lat]}const js=(h,t,n,a)=>{const l=h.transform;return{u_matrix:as(h,t,n,a),u_ratio:1/G(t,1,l.zoom),u_device_pixel_ratio:h.pixelRatio,u_units_to_pixels:[1/l.pixelsToGLUnits[0],1/l.pixelsToGLUnits[1]]}},Oo=(h,t,n,a,l)=>c.extend(js(h,t,n,l),{u_image:0,u_image_height:a}),_n=(h,t,n,a,l)=>{const d=h.transform,m=qi(t,d);return{u_matrix:as(h,t,n,l),u_texsize:t.imageAtlasTexture.size,u_ratio:1/G(t,1,d.zoom),u_device_pixel_ratio:h.pixelRatio,u_image:0,u_scale:[m,a.fromScale,a.toScale],u_fade:a.t,u_units_to_pixels:[1/d.pixelsToGLUnits[0],1/d.pixelsToGLUnits[1]]}},Gs=(h,t,n,a,l,d)=>{const m=h.lineAtlas,g=qi(t,h.transform),y=n.layout.get("line-cap")==="round",v=m.getDash(a.from,y),b=m.getDash(a.to,y),T=v.width*l.fromScale,C=b.width*l.toScale;return c.extend(js(h,t,n,d),{u_patternscale_a:[g/T,-v.height/2],u_patternscale_b:[g/C,-b.height/2],u_sdfgamma:m.width/(256*Math.min(T,C)*h.pixelRatio)/2,u_image:0,u_tex_y_a:v.y,u_tex_y_b:b.y,u_mix:l.t})};function qi(h,t){return 1/G(h,1,t.tileZoom)}function as(h,t,n,a){return h.translatePosMatrix(a?a.posMatrix:t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const Xs=(h,t,n,a,l)=>{return{u_matrix:h,u_tl_parent:t,u_scale_parent:n,u_buffer_scale:1,u_fade_t:a.mix,u_opacity:a.opacity*l.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:l.paint.get("raster-brightness-min"),u_brightness_high:l.paint.get("raster-brightness-max"),u_saturation_factor:(m=l.paint.get("raster-saturation"),m>0?1-1/(1.001-m):-m),u_contrast_factor:(d=l.paint.get("raster-contrast"),d>0?1/(1-d):1+d),u_spin_weights:os(l.paint.get("raster-hue-rotate"))};var d,m};function os(h){h*=Math.PI/180;const t=Math.sin(h),n=Math.cos(h);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const ls=(h,t,n,a,l,d,m,g,y,v)=>{const b=l.transform;return{u_is_size_zoom_constant:+(h==="constant"||h==="source"),u_is_size_feature_constant:+(h==="constant"||h==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:b.cameraToCenterDistance,u_pitch:b.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:b.width/b.height,u_fade_change:l.options.fadeDuration?l.symbolFadeChange:1,u_matrix:d,u_label_plane_matrix:m,u_coord_matrix:g,u_is_text:+y,u_pitch_with_map:+a,u_texsize:v,u_texture:0}},cs=(h,t,n,a,l,d,m,g,y,v,b)=>{const T=l.transform;return c.extend(ls(h,t,n,a,l,d,m,g,y,v),{u_gamma_scale:a?Math.cos(T._pitch)*T.cameraToCenterDistance:1,u_device_pixel_ratio:l.pixelRatio,u_is_halo:+b})},hs=(h,t,n,a,l,d,m,g,y,v)=>c.extend(cs(h,t,n,a,l,d,m,g,!0,y,!0),{u_texsize_icon:v,u_texture_icon:1}),yn=(h,t,n)=>({u_matrix:h,u_opacity:t,u_color:n}),Ws=(h,t,n,a,l,d)=>c.extend(function(m,g,y,v){const b=y.imageManager.getPattern(m.from.toString()),T=y.imageManager.getPattern(m.to.toString()),{width:C,height:L}=y.imageManager.getPixelSize(),D=Math.pow(2,v.tileID.overscaledZ),F=v.tileSize*Math.pow(2,y.transform.tileZoom)/D,k=F*(v.tileID.canonical.x+v.tileID.wrap*D),H=F*v.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:b.tl,u_pattern_br_a:b.br,u_pattern_tl_b:T.tl,u_pattern_br_b:T.br,u_texsize:[C,L],u_mix:g.t,u_pattern_size_a:b.displaySize,u_pattern_size_b:T.displaySize,u_scale_a:g.fromScale,u_scale_b:g.toScale,u_tile_units_to_pixels:1/G(v,1,y.transform.tileZoom),u_pixel_coord_upper:[k>>16,H>>16],u_pixel_coord_lower:[65535&k,65535&H]}}(a,d,n,l),{u_matrix:h,u_opacity:t}),Zi={fillExtrusion:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_lightpos:new c.Uniform3f(h,t.u_lightpos),u_lightintensity:new c.Uniform1f(h,t.u_lightintensity),u_lightcolor:new c.Uniform3f(h,t.u_lightcolor),u_vertical_gradient:new c.Uniform1f(h,t.u_vertical_gradient),u_opacity:new c.Uniform1f(h,t.u_opacity)}),fillExtrusionPattern:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_lightpos:new c.Uniform3f(h,t.u_lightpos),u_lightintensity:new c.Uniform1f(h,t.u_lightintensity),u_lightcolor:new c.Uniform3f(h,t.u_lightcolor),u_vertical_gradient:new c.Uniform1f(h,t.u_vertical_gradient),u_height_factor:new c.Uniform1f(h,t.u_height_factor),u_image:new c.Uniform1i(h,t.u_image),u_texsize:new c.Uniform2f(h,t.u_texsize),u_pixel_coord_upper:new c.Uniform2f(h,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.Uniform2f(h,t.u_pixel_coord_lower),u_scale:new c.Uniform3f(h,t.u_scale),u_fade:new c.Uniform1f(h,t.u_fade),u_opacity:new c.Uniform1f(h,t.u_opacity)}),fill:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix)}),fillPattern:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_image:new c.Uniform1i(h,t.u_image),u_texsize:new c.Uniform2f(h,t.u_texsize),u_pixel_coord_upper:new c.Uniform2f(h,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.Uniform2f(h,t.u_pixel_coord_lower),u_scale:new c.Uniform3f(h,t.u_scale),u_fade:new c.Uniform1f(h,t.u_fade)}),fillOutline:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_world:new c.Uniform2f(h,t.u_world)}),fillOutlinePattern:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_world:new c.Uniform2f(h,t.u_world),u_image:new c.Uniform1i(h,t.u_image),u_texsize:new c.Uniform2f(h,t.u_texsize),u_pixel_coord_upper:new c.Uniform2f(h,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.Uniform2f(h,t.u_pixel_coord_lower),u_scale:new c.Uniform3f(h,t.u_scale),u_fade:new c.Uniform1f(h,t.u_fade)}),circle:(h,t)=>({u_camera_to_center_distance:new c.Uniform1f(h,t.u_camera_to_center_distance),u_scale_with_map:new c.Uniform1i(h,t.u_scale_with_map),u_pitch_with_map:new c.Uniform1i(h,t.u_pitch_with_map),u_extrude_scale:new c.Uniform2f(h,t.u_extrude_scale),u_device_pixel_ratio:new c.Uniform1f(h,t.u_device_pixel_ratio),u_matrix:new c.UniformMatrix4f(h,t.u_matrix)}),collisionBox:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_camera_to_center_distance:new c.Uniform1f(h,t.u_camera_to_center_distance),u_pixels_to_tile_units:new c.Uniform1f(h,t.u_pixels_to_tile_units),u_extrude_scale:new c.Uniform2f(h,t.u_extrude_scale),u_overscale_factor:new c.Uniform1f(h,t.u_overscale_factor)}),collisionCircle:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_inv_matrix:new c.UniformMatrix4f(h,t.u_inv_matrix),u_camera_to_center_distance:new c.Uniform1f(h,t.u_camera_to_center_distance),u_viewport_size:new c.Uniform2f(h,t.u_viewport_size)}),debug:(h,t)=>({u_color:new c.UniformColor(h,t.u_color),u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_overlay:new c.Uniform1i(h,t.u_overlay),u_overlay_scale:new c.Uniform1f(h,t.u_overlay_scale)}),clippingMask:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix)}),heatmap:(h,t)=>({u_extrude_scale:new c.Uniform1f(h,t.u_extrude_scale),u_intensity:new c.Uniform1f(h,t.u_intensity),u_matrix:new c.UniformMatrix4f(h,t.u_matrix)}),heatmapTexture:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_world:new c.Uniform2f(h,t.u_world),u_image:new c.Uniform1i(h,t.u_image),u_color_ramp:new c.Uniform1i(h,t.u_color_ramp),u_opacity:new c.Uniform1f(h,t.u_opacity)}),hillshade:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_image:new c.Uniform1i(h,t.u_image),u_latrange:new c.Uniform2f(h,t.u_latrange),u_light:new c.Uniform2f(h,t.u_light),u_shadow:new c.UniformColor(h,t.u_shadow),u_highlight:new c.UniformColor(h,t.u_highlight),u_accent:new c.UniformColor(h,t.u_accent)}),hillshadePrepare:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_image:new c.Uniform1i(h,t.u_image),u_dimension:new c.Uniform2f(h,t.u_dimension),u_zoom:new c.Uniform1f(h,t.u_zoom),u_unpack:new c.Uniform4f(h,t.u_unpack)}),line:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_ratio:new c.Uniform1f(h,t.u_ratio),u_device_pixel_ratio:new c.Uniform1f(h,t.u_device_pixel_ratio),u_units_to_pixels:new c.Uniform2f(h,t.u_units_to_pixels)}),lineGradient:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_ratio:new c.Uniform1f(h,t.u_ratio),u_device_pixel_ratio:new c.Uniform1f(h,t.u_device_pixel_ratio),u_units_to_pixels:new c.Uniform2f(h,t.u_units_to_pixels),u_image:new c.Uniform1i(h,t.u_image),u_image_height:new c.Uniform1f(h,t.u_image_height)}),linePattern:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_texsize:new c.Uniform2f(h,t.u_texsize),u_ratio:new c.Uniform1f(h,t.u_ratio),u_device_pixel_ratio:new c.Uniform1f(h,t.u_device_pixel_ratio),u_image:new c.Uniform1i(h,t.u_image),u_units_to_pixels:new c.Uniform2f(h,t.u_units_to_pixels),u_scale:new c.Uniform3f(h,t.u_scale),u_fade:new c.Uniform1f(h,t.u_fade)}),lineSDF:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_ratio:new c.Uniform1f(h,t.u_ratio),u_device_pixel_ratio:new c.Uniform1f(h,t.u_device_pixel_ratio),u_units_to_pixels:new c.Uniform2f(h,t.u_units_to_pixels),u_patternscale_a:new c.Uniform2f(h,t.u_patternscale_a),u_patternscale_b:new c.Uniform2f(h,t.u_patternscale_b),u_sdfgamma:new c.Uniform1f(h,t.u_sdfgamma),u_image:new c.Uniform1i(h,t.u_image),u_tex_y_a:new c.Uniform1f(h,t.u_tex_y_a),u_tex_y_b:new c.Uniform1f(h,t.u_tex_y_b),u_mix:new c.Uniform1f(h,t.u_mix)}),raster:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_tl_parent:new c.Uniform2f(h,t.u_tl_parent),u_scale_parent:new c.Uniform1f(h,t.u_scale_parent),u_buffer_scale:new c.Uniform1f(h,t.u_buffer_scale),u_fade_t:new c.Uniform1f(h,t.u_fade_t),u_opacity:new c.Uniform1f(h,t.u_opacity),u_image0:new c.Uniform1i(h,t.u_image0),u_image1:new c.Uniform1i(h,t.u_image1),u_brightness_low:new c.Uniform1f(h,t.u_brightness_low),u_brightness_high:new c.Uniform1f(h,t.u_brightness_high),u_saturation_factor:new c.Uniform1f(h,t.u_saturation_factor),u_contrast_factor:new c.Uniform1f(h,t.u_contrast_factor),u_spin_weights:new c.Uniform3f(h,t.u_spin_weights)}),symbolIcon:(h,t)=>({u_is_size_zoom_constant:new c.Uniform1i(h,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.Uniform1i(h,t.u_is_size_feature_constant),u_size_t:new c.Uniform1f(h,t.u_size_t),u_size:new c.Uniform1f(h,t.u_size),u_camera_to_center_distance:new c.Uniform1f(h,t.u_camera_to_center_distance),u_pitch:new c.Uniform1f(h,t.u_pitch),u_rotate_symbol:new c.Uniform1i(h,t.u_rotate_symbol),u_aspect_ratio:new c.Uniform1f(h,t.u_aspect_ratio),u_fade_change:new c.Uniform1f(h,t.u_fade_change),u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_label_plane_matrix:new c.UniformMatrix4f(h,t.u_label_plane_matrix),u_coord_matrix:new c.UniformMatrix4f(h,t.u_coord_matrix),u_is_text:new c.Uniform1i(h,t.u_is_text),u_pitch_with_map:new c.Uniform1i(h,t.u_pitch_with_map),u_texsize:new c.Uniform2f(h,t.u_texsize),u_texture:new c.Uniform1i(h,t.u_texture)}),symbolSDF:(h,t)=>({u_is_size_zoom_constant:new c.Uniform1i(h,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.Uniform1i(h,t.u_is_size_feature_constant),u_size_t:new c.Uniform1f(h,t.u_size_t),u_size:new c.Uniform1f(h,t.u_size),u_camera_to_center_distance:new c.Uniform1f(h,t.u_camera_to_center_distance),u_pitch:new c.Uniform1f(h,t.u_pitch),u_rotate_symbol:new c.Uniform1i(h,t.u_rotate_symbol),u_aspect_ratio:new c.Uniform1f(h,t.u_aspect_ratio),u_fade_change:new c.Uniform1f(h,t.u_fade_change),u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_label_plane_matrix:new c.UniformMatrix4f(h,t.u_label_plane_matrix),u_coord_matrix:new c.UniformMatrix4f(h,t.u_coord_matrix),u_is_text:new c.Uniform1i(h,t.u_is_text),u_pitch_with_map:new c.Uniform1i(h,t.u_pitch_with_map),u_texsize:new c.Uniform2f(h,t.u_texsize),u_texture:new c.Uniform1i(h,t.u_texture),u_gamma_scale:new c.Uniform1f(h,t.u_gamma_scale),u_device_pixel_ratio:new c.Uniform1f(h,t.u_device_pixel_ratio),u_is_halo:new c.Uniform1i(h,t.u_is_halo)}),symbolTextAndIcon:(h,t)=>({u_is_size_zoom_constant:new c.Uniform1i(h,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.Uniform1i(h,t.u_is_size_feature_constant),u_size_t:new c.Uniform1f(h,t.u_size_t),u_size:new c.Uniform1f(h,t.u_size),u_camera_to_center_distance:new c.Uniform1f(h,t.u_camera_to_center_distance),u_pitch:new c.Uniform1f(h,t.u_pitch),u_rotate_symbol:new c.Uniform1i(h,t.u_rotate_symbol),u_aspect_ratio:new c.Uniform1f(h,t.u_aspect_ratio),u_fade_change:new c.Uniform1f(h,t.u_fade_change),u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_label_plane_matrix:new c.UniformMatrix4f(h,t.u_label_plane_matrix),u_coord_matrix:new c.UniformMatrix4f(h,t.u_coord_matrix),u_is_text:new c.Uniform1i(h,t.u_is_text),u_pitch_with_map:new c.Uniform1i(h,t.u_pitch_with_map),u_texsize:new c.Uniform2f(h,t.u_texsize),u_texsize_icon:new c.Uniform2f(h,t.u_texsize_icon),u_texture:new c.Uniform1i(h,t.u_texture),u_texture_icon:new c.Uniform1i(h,t.u_texture_icon),u_gamma_scale:new c.Uniform1f(h,t.u_gamma_scale),u_device_pixel_ratio:new c.Uniform1f(h,t.u_device_pixel_ratio),u_is_halo:new c.Uniform1i(h,t.u_is_halo)}),background:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_opacity:new c.Uniform1f(h,t.u_opacity),u_color:new c.UniformColor(h,t.u_color)}),backgroundPattern:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_opacity:new c.Uniform1f(h,t.u_opacity),u_image:new c.Uniform1i(h,t.u_image),u_pattern_tl_a:new c.Uniform2f(h,t.u_pattern_tl_a),u_pattern_br_a:new c.Uniform2f(h,t.u_pattern_br_a),u_pattern_tl_b:new c.Uniform2f(h,t.u_pattern_tl_b),u_pattern_br_b:new c.Uniform2f(h,t.u_pattern_br_b),u_texsize:new c.Uniform2f(h,t.u_texsize),u_mix:new c.Uniform1f(h,t.u_mix),u_pattern_size_a:new c.Uniform2f(h,t.u_pattern_size_a),u_pattern_size_b:new c.Uniform2f(h,t.u_pattern_size_b),u_scale_a:new c.Uniform1f(h,t.u_scale_a),u_scale_b:new c.Uniform1f(h,t.u_scale_b),u_pixel_coord_upper:new c.Uniform2f(h,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.Uniform2f(h,t.u_pixel_coord_lower),u_tile_units_to_pixels:new c.Uniform1f(h,t.u_tile_units_to_pixels)}),terrain:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_texture:new c.Uniform1i(h,t.u_texture),u_ele_delta:new c.Uniform1f(h,t.u_ele_delta)}),terrainDepth:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_ele_delta:new c.Uniform1f(h,t.u_ele_delta)}),terrainCoords:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_texture:new c.Uniform1i(h,t.u_texture),u_terrain_coords_id:new c.Uniform1f(h,t.u_terrain_coords_id),u_ele_delta:new c.Uniform1f(h,t.u_ele_delta)})};class ji{constructor(t,n,a){this.context=t;const l=t.gl;this.buffer=l.createBuffer(),this.dynamicDraw=!!a,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),l.bufferData(l.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?l.DYNAMIC_DRAW:l.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const n=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const ka={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Hs{constructor(t,n,a,l){this.length=n.length,this.attributes=a,this.itemSize=n.bytesPerElement,this.dynamicDraw=l,this.context=t;const d=t.gl;this.buffer=d.createBuffer(),t.bindVertexBuffer.set(this.buffer),d.bufferData(d.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?d.DYNAMIC_DRAW:d.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(let a=0;a0){const xe=c.create(),Be=ce;c.mul(xe,oe.placementInvProjMatrix,h.transform.glCoordMatrix),c.mul(xe,xe,oe.placementViewportMatrix),b.push({circleArray:fe,circleOffset:C,transform:Be,invTransform:xe,coord:K}),T+=fe.length/4,C=T}_e&&v.draw(g,y.LINES,nt.disabled,wt.disabled,h.colorModeForRenderPass(),Tt.disabled,Lo(ce,h.transform,ae),h.style.map.terrain&&h.style.map.terrain.getTerrainData(K),n.id,_e.layoutVertexBuffer,_e.indexBuffer,_e.segments,null,h.transform.zoom,null,null,_e.collisionVertexBuffer)}if(!m||!b.length)return;const L=h.useProgram("collisionCircle"),D=new c.CollisionCircleLayoutArray;D.resize(4*T),D._trim();let F=0;for(const N of b)for(let K=0;K=0&&(D[k.associatedIconIndex]={shiftedAnchor:et,angle:Ee})}else z(k.numGlyphs,C)}if(v){L.clear();const F=h.icon.placedSymbolArray;for(let k=0;kh.style.map.terrain.getElevation(_e,_i,kt):null,Wt=n.layout.get("text-rotation-alignment")==="map";rn(xe,_e.posMatrix,h,l,Mr,mr,k,v,Wt,ii)}const cn=h.translatePosMatrix(_e.posMatrix,fe,d,m),$r=H||l&&oe||Xn?Va:Mr,qt=h.translatePosMatrix(mr,fe,d,m,!0),ti=Ee&&n.paint.get(l?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let gi;gi=Ee?xe.iconsInText?hs(Ne.kind,tt,ne,k,h,cn,$r,qt,it,ui):cs(Ne.kind,tt,ne,k,h,cn,$r,qt,l,it,!0):ls(Ne.kind,tt,ne,k,h,cn,$r,qt,l,it);const Wn={program:It,buffers:Be,uniformValues:gi,atlasTexture:zt,atlasTextureIcon:Rt,atlasInterpolation:ft,atlasInterpolationIcon:Xi,isSDF:Ee,hasHalo:ti};if(N&&xe.canOverlap){K=!0;const ii=Be.segments.get();for(const Wt of ii)ce.push({segments:new c.SegmentVector([Wt]),sortKey:Wt.sortKey,state:Wn,terrainData:$e})}else ce.push({segments:Be.segments,sortKey:0,state:Wn,terrainData:$e})}K&&ce.sort((_e,fe)=>_e.sortKey-fe.sortKey);for(const _e of ce){const fe=_e.state;if(C.activeTexture.set(L.TEXTURE0),fe.atlasTexture.bind(fe.atlasInterpolation,L.CLAMP_TO_EDGE),fe.atlasTextureIcon&&(C.activeTexture.set(L.TEXTURE1),fe.atlasTextureIcon&&fe.atlasTextureIcon.bind(fe.atlasInterpolationIcon,L.CLAMP_TO_EDGE)),fe.isSDF){const xe=fe.uniformValues;fe.hasHalo&&(xe.u_is_halo=1,ps(fe.buffers,_e.segments,n,h,fe.program,ae,b,T,xe,_e.terrainData)),xe.u_is_halo=0}ps(fe.buffers,_e.segments,n,h,fe.program,ae,b,T,fe.uniformValues,_e.terrainData)}}function ps(h,t,n,a,l,d,m,g,y,v){const b=a.context;l.draw(b,b.gl.TRIANGLES,d,m,g,Tt.disabled,y,v,n.id,h.layoutVertexBuffer,h.indexBuffer,t,n.paint,a.transform.zoom,h.programConfigurations.get(n.id),h.dynamicLayoutVertexBuffer,h.opacityVertexBuffer)}function ta(h,t,n,a,l){if(!n||!a||!a.imageAtlas)return;const d=a.imageAtlas.patternPositions;let m=d[n.to.toString()],g=d[n.from.toString()];if(!m||!g){const y=l.getPaintProperty(t);m=d[y],g=d[y]}m&&g&&h.setConstantPatternPositions(m,g)}function qa(h,t,n,a,l,d,m){const g=h.context.gl,y="fill-pattern",v=n.paint.get(y),b=v&&v.constantOr(1),T=n.getCrossfadeParameters();let C,L,D,F,k;m?(L=b&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",C=g.LINES):(L=b?"fillPattern":"fill",C=g.TRIANGLES);const H=v.constantOr(null);for(const ne of a){const N=t.getTile(ne);if(b&&!N.patternsLoaded())continue;const K=N.getBucket(n);if(!K)continue;const ae=K.programConfigurations.get(n.id),oe=h.useProgram(L,ae),ce=h.style.map.terrain&&h.style.map.terrain.getTerrainData(ne);b&&(h.context.activeTexture.set(g.TEXTURE0),N.imageAtlasTexture.bind(g.LINEAR,g.CLAMP_TO_EDGE),ae.updatePaintBuffers(T)),ta(ae,y,H,N,n);const _e=ce?ne:null,fe=h.translatePosMatrix(_e?_e.posMatrix:ne.posMatrix,N,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(m){F=K.indexBuffer2,k=K.segments2;const xe=[g.drawingBufferWidth,g.drawingBufferHeight];D=L==="fillOutlinePattern"&&b?Do(fe,h,T,N,xe):zl(fe,xe)}else F=K.indexBuffer,k=K.segments,D=b?qs(fe,h,T,N):ko(fe);oe.draw(h.context,C,l,h.stencilModeForClipping(ne),d,Tt.disabled,D,ce,n.id,K.layoutVertexBuffer,F,k,n.paint,h.transform.zoom,ae)}}function ia(h,t,n,a,l,d,m){const g=h.context,y=g.gl,v="fill-extrusion-pattern",b=n.paint.get(v),T=b.constantOr(1),C=n.getCrossfadeParameters(),L=n.paint.get("fill-extrusion-opacity"),D=b.constantOr(null);for(const F of a){const k=t.getTile(F),H=k.getBucket(n);if(!H)continue;const ne=h.style.map.terrain&&h.style.map.terrain.getTerrainData(F),N=H.programConfigurations.get(n.id),K=h.useProgram(T?"fillExtrusionPattern":"fillExtrusion",N);T&&(h.context.activeTexture.set(y.TEXTURE0),k.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),N.updatePaintBuffers(C)),ta(N,v,D,k,n);const ae=h.translatePosMatrix(F.posMatrix,k,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),oe=n.paint.get("fill-extrusion-vertical-gradient"),ce=T?Pl(ae,h,oe,L,F,C,k):ss(ae,h,oe,L);K.draw(g,g.gl.TRIANGLES,l,d,m,Tt.backCCW,ce,ne,n.id,H.layoutVertexBuffer,H.indexBuffer,H.segments,n.paint,h.transform.zoom,N,h.style.map.terrain&&H.centroidVertexBuffer)}}function ra(h,t,n,a,l,d,m){const g=h.context,y=g.gl,v=n.fbo;if(!v)return;const b=h.useProgram("hillshade"),T=h.style.map.terrain&&h.style.map.terrain.getTerrainData(t);g.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,v.colorAttachment.get()),b.draw(g,y.TRIANGLES,l,d,m,Tt.disabled,((C,L,D,F)=>{const k=D.paint.get("hillshade-shadow-color"),H=D.paint.get("hillshade-highlight-color"),ne=D.paint.get("hillshade-accent-color");let N=D.paint.get("hillshade-illumination-direction")*(Math.PI/180);D.paint.get("hillshade-illumination-anchor")==="viewport"&&(N-=C.transform.angle);const K=!C.options.moving;return{u_matrix:F?F.posMatrix:C.transform.calculatePosMatrix(L.tileID.toUnwrapped(),K),u_image:0,u_latrange:Fo(0,L.tileID),u_light:[D.paint.get("hillshade-exaggeration"),N],u_shadow:k,u_highlight:H,u_accent:ne}})(h,n,a,T?t:null),T,a.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments)}function Za(h,t,n,a,l,d){const m=h.context,g=m.gl,y=t.dem;if(y&&y.data){const v=y.dim,b=y.stride,T=y.getPixels();if(m.activeTexture.set(g.TEXTURE1),m.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||h.getTileTexture(b),t.demTexture){const L=t.demTexture;L.update(T,{premultiply:!1}),L.bind(g.NEAREST,g.CLAMP_TO_EDGE)}else t.demTexture=new Je(m,T,g.RGBA,{premultiply:!1}),t.demTexture.bind(g.NEAREST,g.CLAMP_TO_EDGE);m.activeTexture.set(g.TEXTURE0);let C=t.fbo;if(!C){const L=new Je(m,{width:v,height:v,data:null},g.RGBA);L.bind(g.LINEAR,g.CLAMP_TO_EDGE),C=t.fbo=m.createFramebuffer(v,v,!0,!1),C.colorAttachment.set(L.texture)}m.bindFramebuffer.set(C.framebuffer),m.viewport.set([0,0,v,v]),h.useProgram("hillshadePrepare").draw(m,g.TRIANGLES,a,l,d,Tt.disabled,((L,D)=>{const F=D.stride,k=c.create();return c.ortho(k,0,c.EXTENT,-c.EXTENT,0,0,1),c.translate(k,k,[0,-c.EXTENT,0]),{u_matrix:k,u_image:1,u_dimension:[F,F],u_zoom:L.overscaledZ,u_unpack:D.getUnpackVector()}})(t.tileID,y),null,n.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function jl(h,t,n,a,l,d){const m=a.paint.get("raster-fade-duration");if(!d&&m>0){const g=c.browser.now(),y=(g-h.timeAdded)/m,v=t?(g-t.timeAdded)/m:-1,b=n.getSource(),T=l.coveringZoomLevel({tileSize:b.tileSize,roundZoom:b.roundZoom}),C=!t||Math.abs(t.tileID.overscaledZ-T)>Math.abs(h.tileID.overscaledZ-T),L=C&&h.refreshedUponExpiration?1:c.clamp(C?y:1-v,0,1);return h.refreshedUponExpiration&&y>=1&&(h.refreshedUponExpiration=!1),t?{opacity:1,mix:1-L}:{opacity:L,mix:0}}return{opacity:1,mix:0}}const Xo=new c.Color(1,0,0,1),Nt=new c.Color(0,1,0,1),wn=new c.Color(0,0,1,1),rr=new c.Color(1,0,1,1),ja=new c.Color(0,1,1,1);function na(h,t,n,a){Vr(h,0,t+n/2,h.transform.width,n,a)}function Ga(h,t,n,a){Vr(h,t-n/2,0,n,h.transform.height,a)}function Vr(h,t,n,a,l,d){const m=h.context,g=m.gl;g.enable(g.SCISSOR_TEST),g.scissor(t*h.pixelRatio,n*h.pixelRatio,a*h.pixelRatio,l*h.pixelRatio),m.clear({color:d}),g.disable(g.SCISSOR_TEST)}function fs(h,t,n){const a=h.context,l=a.gl,d=n.posMatrix,m=h.useProgram("debug"),g=nt.disabled,y=wt.disabled,v=h.colorModeForRenderPass(),b="$debug",T=h.style.map.terrain&&h.style.map.terrain.getTerrainData(n);a.activeTexture.set(l.TEXTURE0);const C=t.getTileByID(n.key).latestRawTileData,L=Math.floor((C&&C.byteLength||0)/1024),D=t.getTile(n).tileSize,F=512/Math.min(D,512)*(n.overscaledZ/h.transform.zoom)*.5;let k=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(k+=` => ${n.overscaledZ}`),function(H,ne){H.initDebugOverlayCanvas();const N=H.debugOverlayCanvas,K=H.context.gl,ae=H.debugOverlayCanvas.getContext("2d");ae.clearRect(0,0,N.width,N.height),ae.shadowColor="white",ae.shadowBlur=2,ae.lineWidth=1.5,ae.strokeStyle="white",ae.textBaseline="top",ae.font="bold 36px Open Sans, sans-serif",ae.fillText(ne,5,5),ae.strokeText(ne,5,5),H.debugOverlayTexture.update(N),H.debugOverlayTexture.bind(K.LINEAR,K.CLAMP_TO_EDGE)}(h,`${k} ${L}kB`),m.draw(a,l.TRIANGLES,g,y,Lt.alphaBlended,Tt.disabled,Bo(d,c.Color.transparent,F),null,b,h.debugBuffer,h.quadTriangleIndexBuffer,h.debugSegments),m.draw(a,l.LINE_STRIP,g,y,v,Tt.disabled,Bo(d,c.Color.red),T,b,h.debugBuffer,h.tileBorderIndexBuffer,h.debugSegments)}function sa(h,t,n){const a=h.context,l=a.gl,d=h.colorModeForRenderPass(),m=new nt(l.LEQUAL,nt.ReadWrite,h.depthRangeFor3D),g=h.useProgram("terrain"),y=t.getTerrainMesh();a.bindFramebuffer.set(null),a.viewport.set([0,0,h.width,h.height]);for(const v of n){const b=h.renderToTexture.getTexture(v),T=t.getTerrainData(v.tileID);a.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,b.texture);const C={u_matrix:h.transform.calculatePosMatrix(v.tileID.toUnwrapped()),u_texture:0,u_ele_delta:t.getMeshFrameDelta(h.transform.zoom)};g.draw(a,l.TRIANGLES,m,wt.disabled,d,Tt.backCCW,C,T,"terrain",y.vertexBuffer,y.indexBuffer,y.segments)}}class Wo{constructor(t,n){this.context=new ea(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.create(),renderTime:0},this.setup(),this.numSublayers=Dt.maxUnderzooming+Dt.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Ut}resize(t,n,a){if(this.width=Math.floor(t*a),this.height=Math.floor(n*a),this.pixelRatio=a,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const l of this.style._order)this.style._layers[l].resize()}setup(){const t=this.context,n=new c.PosArray;n.emplaceBack(0,0),n.emplaceBack(c.EXTENT,0),n.emplaceBack(0,c.EXTENT),n.emplaceBack(c.EXTENT,c.EXTENT),this.tileExtentBuffer=t.createVertexBuffer(n,Vs.members),this.tileExtentSegments=c.SegmentVector.simpleSegment(0,0,4,2);const a=new c.PosArray;a.emplaceBack(0,0),a.emplaceBack(c.EXTENT,0),a.emplaceBack(0,c.EXTENT),a.emplaceBack(c.EXTENT,c.EXTENT),this.debugBuffer=t.createVertexBuffer(a,Vs.members),this.debugSegments=c.SegmentVector.simpleSegment(0,0,4,5);const l=new c.RasterBoundsArray;l.emplaceBack(0,0,0,0),l.emplaceBack(c.EXTENT,0,c.EXTENT,0),l.emplaceBack(0,c.EXTENT,0,c.EXTENT),l.emplaceBack(c.EXTENT,c.EXTENT,c.EXTENT,c.EXTENT),this.rasterBoundsBuffer=t.createVertexBuffer(l,Ii.members),this.rasterBoundsSegments=c.SegmentVector.simpleSegment(0,0,4,2);const d=new c.PosArray;d.emplaceBack(0,0),d.emplaceBack(1,0),d.emplaceBack(0,1),d.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(d,Vs.members),this.viewportSegments=c.SegmentVector.simpleSegment(0,0,4,2);const m=new c.LineStripIndexArray;m.emplaceBack(0),m.emplaceBack(1),m.emplaceBack(3),m.emplaceBack(2),m.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(m);const g=new c.TriangleIndexArray;g.emplaceBack(0,1,2),g.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(g);const y=this.context.gl;this.stencilClearMode=new wt({func:y.ALWAYS,mask:0},0,255,y.ZERO,y.ZERO,y.ZERO)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const a=c.create();c.ortho(a,0,this.width,this.height,0,0,1),c.scale(a,a,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,n.TRIANGLES,nt.disabled,this.stencilClearMode,Lt.disabled,Tt.disabled,Zs(a),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,n){if(this.currentStencilSource===t.source||!t.isTileClipped()||!n||!n.length)return;this.currentStencilSource=t.source;const a=this.context,l=a.gl;this.nextStencilID+n.length>256&&this.clearStencil(),a.setColorMode(Lt.disabled),a.setDepthMode(nt.disabled);const d=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const m of n){const g=this._tileClippingMaskIDs[m.key]=this.nextStencilID++,y=this.style.map.terrain&&this.style.map.terrain.getTerrainData(m);d.draw(a,l.TRIANGLES,nt.disabled,new wt({func:l.ALWAYS,mask:0},g,255,l.KEEP,l.KEEP,l.REPLACE),Lt.disabled,Tt.disabled,Zs(m.posMatrix),y,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new wt({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new wt({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,a=t.sort((m,g)=>g.overscaledZ-m.overscaledZ),l=a[a.length-1].overscaledZ,d=a[0].overscaledZ-l+1;if(d>1){this.currentStencilSource=void 0,this.nextStencilID+d>256&&this.clearStencil();const m={};for(let g=0;g=0;this.currentLayer--){const y=this.style._layers[a[this.currentLayer]],v=l[y.source],b=d[y.source];this._renderTileClippingMasks(y,b),this.renderLayer(this,v,y,b)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerk.source&&!k.isHidden(b)?[v.sourceCaches[k.source]]:[]),L=C.filter(k=>k.getSource().type==="vector"),D=C.filter(k=>k.getSource().type!=="vector"),F=k=>{(!T||T.getSource().maxzoomF(k)),T||D.forEach(k=>F(k)),T}(this.style,this.transform.zoom);y&&function(v,b,T){for(let C=0;CL.style.map.terrain.getElevation(oe,Ne,ke):null)}}}(y,d,g,m,g.layout.get("text-rotation-alignment"),g.layout.get("text-pitch-alignment"),v),g.paint.get("icon-opacity").constantOr(1)!==0&&$a(d,m,g,y,!1,g.paint.get("icon-translate"),g.paint.get("icon-translate-anchor"),g.layout.get("icon-rotation-alignment"),g.layout.get("icon-pitch-alignment"),g.layout.get("icon-keep-upright"),b,T),g.paint.get("text-opacity").constantOr(1)!==0&&$a(d,m,g,y,!0,g.paint.get("text-translate"),g.paint.get("text-translate-anchor"),g.layout.get("text-rotation-alignment"),g.layout.get("text-pitch-alignment"),g.layout.get("text-keep-upright"),b,T),m.map.showCollisionBoxes&&(ds(d,m,g,y,g.paint.get("text-translate"),g.paint.get("text-translate-anchor"),!0),ds(d,m,g,y,g.paint.get("icon-translate"),g.paint.get("icon-translate-anchor"),!1))})(t,n,a,l,this.style.placement.variableOffsets);break;case"circle":(function(d,m,g,y){if(d.renderPass!=="translucent")return;const v=g.paint.get("circle-opacity"),b=g.paint.get("circle-stroke-width"),T=g.paint.get("circle-stroke-opacity"),C=!g.layout.get("circle-sort-key").isConstant();if(v.constantOr(1)===0&&(b.constantOr(1)===0||T.constantOr(1)===0))return;const L=d.context,D=L.gl,F=d.depthModeForSublayer(0,nt.ReadOnly),k=wt.disabled,H=d.colorModeForRenderPass(),ne=[];for(let N=0;NN.sortKey-K.sortKey);for(const N of ne){const{programConfiguration:K,program:ae,layoutVertexBuffer:oe,indexBuffer:ce,uniformValues:_e,terrainData:fe}=N.state;ae.draw(L,D.TRIANGLES,F,k,H,Tt.disabled,_e,fe,g.id,oe,ce,N.segments,g.paint,d.transform.zoom,K)}})(t,n,a,l);break;case"heatmap":(function(d,m,g,y){if(g.paint.get("heatmap-opacity")!==0)if(d.renderPass==="offscreen"){const v=d.context,b=v.gl,T=wt.disabled,C=new Lt([b.ONE,b.ONE],c.Color.transparent,[!0,!0,!0,!0]);(function(L,D,F){const k=L.gl;L.activeTexture.set(k.TEXTURE1),L.viewport.set([0,0,D.width/4,D.height/4]);let H=F.heatmapFbo;if(H)k.bindTexture(k.TEXTURE_2D,H.colorAttachment.get()),L.bindFramebuffer.set(H.framebuffer);else{const ne=k.createTexture();k.bindTexture(k.TEXTURE_2D,ne),k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE),k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE),k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,k.LINEAR),k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,k.LINEAR),H=F.heatmapFbo=L.createFramebuffer(D.width/4,D.height/4,!1,!1),function(N,K,ae,oe){var ce,_e;const fe=N.gl,xe=(ce=N.HALF_FLOAT)!==null&&ce!==void 0?ce:fe.UNSIGNED_BYTE,Be=(_e=N.RGBA16F)!==null&&_e!==void 0?_e:fe.RGBA;fe.texImage2D(fe.TEXTURE_2D,0,Be,K.width/4,K.height/4,0,fe.RGBA,xe,null),oe.colorAttachment.set(ae)}(L,D,ne,H)}})(v,d,g),v.clear({color:c.Color.transparent});for(let L=0;L{const N=c.create();c.ortho(N,0,F.width,F.height,0,0,1);const K=F.context.gl;return{u_matrix:N,u_world:[K.drawingBufferWidth,K.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:k.paint.get("heatmap-opacity")}})(v,b),null,b.id,v.viewportBuffer,v.quadTriangleIndexBuffer,v.viewportSegments,b.paint,v.transform.zoom)}(d,g))})(t,n,a,l);break;case"line":(function(d,m,g,y){if(d.renderPass!=="translucent")return;const v=g.paint.get("line-opacity"),b=g.paint.get("line-width");if(v.constantOr(1)===0||b.constantOr(1)===0)return;const T=d.depthModeForSublayer(0,nt.ReadOnly),C=d.colorModeForRenderPass(),L=g.paint.get("line-dasharray"),D=g.paint.get("line-pattern"),F=D.constantOr(1),k=g.paint.get("line-gradient"),H=g.getCrossfadeParameters(),ne=F?"linePattern":L?"lineSDF":k?"lineGradient":"line",N=d.context,K=N.gl;let ae=!0;for(const oe of y){const ce=m.getTile(oe);if(F&&!ce.patternsLoaded())continue;const _e=ce.getBucket(g);if(!_e)continue;const fe=_e.programConfigurations.get(g.id),xe=d.context.program.get(),Be=d.useProgram(ne,fe),et=ae||Be.program!==xe,Ee=d.style.map.terrain&&d.style.map.terrain.getTerrainData(oe),Ne=D.constantOr(null);if(Ne&&ce.imageAtlas){const tt=ce.imageAtlas,$e=tt.patternPositions[Ne.to.toString()],it=tt.patternPositions[Ne.from.toString()];$e&&it&&fe.setConstantPatternPositions($e,it)}const ke=Ee?oe:null,It=F?_n(d,ce,g,H,ke):L?Gs(d,ce,g,L,H,ke):k?Oo(d,ce,g,_e.lineClipsArray.length,ke):js(d,ce,g,ke);if(F)N.activeTexture.set(K.TEXTURE0),ce.imageAtlasTexture.bind(K.LINEAR,K.CLAMP_TO_EDGE),fe.updatePaintBuffers(H);else if(L&&(et||d.lineAtlas.dirty))N.activeTexture.set(K.TEXTURE0),d.lineAtlas.bind(N);else if(k){const tt=_e.gradients[g.id];let $e=tt.texture;if(g.gradientVersion!==tt.version){let it=256;if(g.stepInterpolant){const zt=m.getSource().maxzoom,ft=oe.canonical.z===zt?Math.ceil(1<0?n.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const n=this.imageManager.getPattern(t.from.toString()),a=this.imageManager.getPattern(t.to.toString());return!n||!a}useProgram(t,n){this.cache=this.cache||{};const a=t+(n?n.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[a]||(this.cache[a]=new an(this.context,ns[t],n,Zi[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[a]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const 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(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Je(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:n}=this.context.gl;return this.width!==t||this.height!==n}}class aa{constructor(t,n){this.points=t,this.planes=n}static fromInvProjectionMatrix(t,n,a){const l=Math.pow(2,a),d=[[-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(g=>{const y=1/(g=c.transformMat4([],g,t))[3]/n*l;return c.mul$1(g,g,[y,y,1/g[3],y])}),m=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(g=>{const y=function(C,L){var D=L[0],F=L[1],k=L[2],H=D*D+F*F+k*k;return H>0&&(H=1/Math.sqrt(H)),C[0]=L[0]*H,C[1]=L[1]*H,C[2]=L[2]*H,C}([],function(C,L,D){var F=L[0],k=L[1],H=L[2],ne=D[0],N=D[1],K=D[2];return C[0]=k*K-H*N,C[1]=H*ne-F*K,C[2]=F*N-k*ne,C}([],Jr([],d[g[0]],d[g[1]]),Jr([],d[g[2]],d[g[1]]))),v=-((b=y)[0]*(T=d[g[1]])[0]+b[1]*T[1]+b[2]*T[2]);var b,T;return y.concat(v)});return new aa(d,m)}}class ms{constructor(t,n){this.min=t,this.max=n,this.center=function(a,l,d){return a[0]=.5*l[0],a[1]=.5*l[1],a[2]=.5*l[2],a}([],function(a,l,d){return a[0]=l[0]+d[0],a[1]=l[1]+d[1],a[2]=l[2]+d[2],a}([],this.min,this.max))}quadrant(t){const n=[t%2==0,t<2],a=Yr(this.min),l=Yr(this.max);for(let d=0;d=0&&m++;if(m===0)return 0;m!==n.length&&(a=!1)}if(a)return 2;for(let l=0;l<3;l++){let d=Number.MAX_VALUE,m=-Number.MAX_VALUE;for(let g=0;gthis.max[l]-this.min[l])return 0}return 1}}class oa{constructor(t=0,n=0,a=0,l=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(a)||a<0||isNaN(l)||l<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=a,this.right=l}interpolate(t,n,a){return n.top!=null&&t.top!=null&&(this.top=c.interpolate.number(t.top,n.top,a)),n.bottom!=null&&t.bottom!=null&&(this.bottom=c.interpolate.number(t.bottom,n.bottom,a)),n.left!=null&&t.left!=null&&(this.left=c.interpolate.number(t.left,n.left,a)),n.right!=null&&t.right!=null&&(this.right=c.interpolate.number(t.right,n.right,a)),this}getCenter(t,n){const a=c.clamp((this.left+t-this.right)/2,0,t),l=c.clamp((this.top+n-this.bottom)/2,0,n);return new c.Point(a,l)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new oa(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class la{constructor(t,n,a,l,d){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=d===void 0||!!d,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=a??0,this._maxPitch=l??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new c.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new oa,this._posMatrixCache={},this._alignedPosMatrixCache={},this._minEleveationForCurrentTile=0}clone(){const t=new la(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this._minEleveationForCurrentTile=t._minEleveationForCurrentTile,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new c.Point(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const n=-c.wrap(t,-180,180)*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=function(){var a=new c.ARRAY_TYPE(4);return c.ARRAY_TYPE!=Float32Array&&(a[1]=0,a[2]=0),a[0]=1,a[3]=1,a}(),function(a,l,d){var m=l[0],g=l[1],y=l[2],v=l[3],b=Math.sin(d),T=Math.cos(d);a[0]=m*T+y*b,a[1]=g*T+v*b,a[2]=m*-b+y*T,a[3]=g*-b+v*T}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=c.clamp(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const n=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this.tileZoom=Math.max(0,Math.floor(n)),this.scale=this.zoomScale(n),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(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)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,a){this._unmodified=!1,this._edgeInsets.interpolate(t,n,a),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const n=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(t){const n=[new c.UnwrappedTileID(0,t)];if(this._renderWorldCopies){const a=this.pointCoordinate(new c.Point(0,0)),l=this.pointCoordinate(new c.Point(this.width,0)),d=this.pointCoordinate(new c.Point(this.width,this.height)),m=this.pointCoordinate(new c.Point(0,this.height)),g=Math.floor(Math.min(a.x,l.x,d.x,m.x)),y=Math.floor(Math.max(a.x,l.x,d.x,m.x)),v=1;for(let b=g-v;b<=y+v;b++)b!==0&&n.push(new c.UnwrappedTileID(b,t))}return n}coveringTiles(t){var n,a;let l=this.coveringZoomLevel(t);const d=l;if(t.minzoom!==void 0&&lt.maxzoom&&(l=t.maxzoom);const m=this.pointCoordinate(this.getCameraPoint()),g=c.MercatorCoordinate.fromLngLat(this.center),y=Math.pow(2,l),v=[y*m.x,y*m.y,0],b=[y*g.x,y*g.y,0],T=aa.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,l);let C=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(C=l);const L=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,D=N=>({aabb:new ms([N*y,0,0],[(N+1)*y,y,0]),zoom:0,x:0,y:0,wrap:N,fullyVisible:!1}),F=[],k=[],H=l,ne=t.reparseOverscaled?d:l;if(this._renderWorldCopies)for(let N=1;N<=3;N++)F.push(D(-N)),F.push(D(N));for(F.push(D(0));F.length>0;){const N=F.pop(),K=N.x,ae=N.y;let oe=N.fullyVisible;if(!oe){const Be=N.aabb.intersects(T);if(Be===0)continue;oe=Be===2}const ce=t.terrain?v:b,_e=N.aabb.distanceX(ce),fe=N.aabb.distanceY(ce),xe=Math.max(Math.abs(_e),Math.abs(fe));if(N.zoom===H||xe>L+(1<=C){const Be=H-N.zoom,et=v[0]-.5-(K<>1),Ne=N.zoom+1;let ke=N.aabb.quadrant(Be);if(t.terrain){const It=new c.OverscaledTileID(Ne,N.wrap,Ne,et,Ee),tt=t.terrain.getMinMaxElevation(It),$e=(n=tt.minElevation)!==null&&n!==void 0?n:this.elevation,it=(a=tt.maxElevation)!==null&&a!==void 0?a:this.elevation;ke=new ms([ke.min[0],ke.min[1],$e],[ke.max[0],ke.max[1],it])}F.push({aabb:ke,zoom:Ne,x:et,y:Ee,wrap:N.wrap,fullyVisible:oe})}}return k.sort((N,K)=>N.distanceSq-K.distanceSq).map(N=>N.tileID)}resize(t,n){this.width=t,this.height=n,this.pixelsToGLUnits=[2/t,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const n=c.clamp(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new c.Point(c.mercatorXfromLng(t.lng)*this.worldSize,c.mercatorYfromLat(n)*this.worldSize)}unproject(t){return new c.MercatorCoordinate(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const n=this.pointLocation(this.centerPoint,t),a=t.getElevationForLngLatZoom(n,this.tileZoom);if(!(this.elevation-a))return;const l=this.getCameraPosition(),d=c.MercatorCoordinate.fromLngLat(l.lngLat,l.altitude),m=c.MercatorCoordinate.fromLngLat(n,a),g=d.x-m.x,y=d.y-m.y,v=d.z-m.z,b=Math.sqrt(g*g+y*y+v*v),T=this.scaleZoom(this.cameraToCenterDistance/b/this.tileSize);this._elevation=a,this._center=n,this.zoom=T}setLocationAtPoint(t,n){const a=this.pointCoordinate(n),l=this.pointCoordinate(this.centerPoint),d=this.locationCoordinate(t),m=new c.MercatorCoordinate(d.x-(a.x-l.x),d.y-(a.y-l.y));this.center=this.coordinateLocation(m),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,n){return n?this.coordinatePoint(this.locationCoordinate(t),n.getElevationForLngLatZoom(t,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,n){return this.coordinateLocation(this.pointCoordinate(t,n))}locationCoordinate(t){return c.MercatorCoordinate.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,n){if(n){const C=n.pointCoordinate(t);if(C!=null)return C}const a=[t.x,t.y,0,1],l=[t.x,t.y,1,1];c.transformMat4(a,a,this.pixelMatrixInverse),c.transformMat4(l,l,this.pixelMatrixInverse);const d=a[3],m=l[3],g=a[1]/d,y=l[1]/m,v=a[2]/d,b=l[2]/m,T=v===b?0:(0-v)/(b-v);return new c.MercatorCoordinate(c.interpolate.number(a[0]/d,l[0]/m,T)/this.worldSize,c.interpolate.number(g,y,T)/this.worldSize)}coordinatePoint(t,n=0,a=this.pixelMatrix){const l=[t.x*this.worldSize,t.y*this.worldSize,n,1];return c.transformMat4(l,l,a),new c.Point(l[0]/l[3],l[1]/l[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new mt().extend(this.pointLocation(new c.Point(0,t))).extend(this.pointLocation(new c.Point(this.width,t))).extend(this.pointLocation(new c.Point(this.width,this.height))).extend(this.pointLocation(new c.Point(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new mt([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(t,n=!1){const a=t.key,l=n?this._alignedPosMatrixCache:this._posMatrixCache;if(l[a])return l[a];const d=t.canonical,m=this.worldSize/this.zoomScale(d.z),g=d.x+Math.pow(2,d.z)*t.wrap,y=c.identity(new Float64Array(16));return c.translate(y,y,[g*m,d.y*m,0]),c.scale(y,y,[m/c.EXTENT,m/c.EXTENT,1]),c.multiply(y,n?this.alignedProjMatrix:this.projMatrix,y),l[a]=new Float32Array(y),l[a]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let t,n,a,l,d=-90,m=90,g=-180,y=180;const v=this.size,b=this._unmodified;if(this.latRange){const L=this.latRange;d=c.mercatorYfromLat(L[1])*this.worldSize,m=c.mercatorYfromLat(L[0])*this.worldSize,t=m-dm&&(l=m-D)}if(this.lngRange){const L=(g+y)/2,D=c.wrap(T.x,L-this.worldSize/2,L+this.worldSize/2),F=v.x/2;D-Fy&&(a=y-F)}a===void 0&&l===void 0||(this.center=this.unproject(new c.Point(a!==void 0?a:T.x,l!==void 0?l:T.y)).wrap()),this._unmodified=b,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.point.x,a=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=c.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let l=c.identity(new Float64Array(16));c.scale(l,l,[this.width/2,-this.height/2,1]),c.translate(l,l,[1,-1,0]),this.labelPlaneMatrix=l,l=c.identity(new Float64Array(16)),c.scale(l,l,[1,-1,1]),c.translate(l,l,[-1,-1,0]),c.scale(l,l,[2/this.width,2/this.height,1]),this.glCoordMatrix=l;const d=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),m=Math.min(this.elevation,this._minEleveationForCurrentTile),g=d-m*this._pixelPerMeter/Math.cos(this._pitch),y=m<0?g:d,v=Math.PI/2+this._pitch,b=this._fov*(.5+t.y/this.height),T=Math.sin(b)*y/Math.sin(c.clamp(Math.PI-v-b,.01,Math.PI-.01)),C=this.getHorizon(),L=2*Math.atan(C/this.cameraToCenterDistance)*(.5+t.y/(2*C)),D=Math.sin(L)*y/Math.sin(c.clamp(Math.PI-v-L,.01,Math.PI-.01)),F=Math.min(T,D),k=1.01*(Math.cos(Math.PI/2-this._pitch)*F+y),H=this.height/50;l=new Float64Array(16),c.perspective(l,this._fov,this.width/this.height,H,k),l[8]=2*-t.x/this.width,l[9]=2*t.y/this.height,c.scale(l,l,[1,-1,1]),c.translate(l,l,[0,0,-this.cameraToCenterDistance]),c.rotateX(l,l,this._pitch),c.rotateZ(l,l,this.angle),c.translate(l,l,[-n,-a,0]),this.mercatorMatrix=c.scale([],l,[this.worldSize,this.worldSize,this.worldSize]),c.scale(l,l,[1,1,this._pixelPerMeter]),this.pixelMatrix=c.multiply(new Float64Array(16),this.labelPlaneMatrix,l),c.translate(l,l,[0,0,-this.elevation]),this.projMatrix=l,this.invProjMatrix=c.invert([],l),this.pixelMatrix3D=c.multiply(new Float64Array(16),this.labelPlaneMatrix,l);const ne=this.width%2/2,N=this.height%2/2,K=Math.cos(this.angle),ae=Math.sin(this.angle),oe=n-Math.round(n)+K*ne+ae*N,ce=a-Math.round(a)+K*N+ae*ne,_e=new Float64Array(l);if(c.translate(_e,_e,[oe>.5?oe-1:oe,ce>.5?ce-1:ce,0]),this.alignedProjMatrix=_e,l=c.invert(new Float64Array(16),this.pixelMatrix),!l)throw new Error("failed to invert matrix");this.pixelMatrixInverse=l,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new c.Point(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return c.transformMat4(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new c.Point(0,t))}getCameraQueryGeometry(t){const n=this.getCameraPoint();if(t.length===1)return[t[0],n];{let a=n.x,l=n.y,d=n.x,m=n.y;for(const g of t)a=Math.min(a,g.x),l=Math.min(l,g.y),d=Math.max(d,g.x),m=Math.max(m,g.y);return[new c.Point(a,l),new c.Point(d,l),new c.Point(d,m),new c.Point(a,m),new c.Point(a,l)]}}}function on(h,t){let n,a=!1,l=null,d=null;const m=()=>{l=null,a&&(h.apply(d,n),l=setTimeout(m,t),a=!1)};return(...g)=>(a=!0,d=this,n=g,l||m(),l)}class Ho{constructor(t){this._getCurrentHash=()=>{const n=window.location.hash.replace("#","");if(this._hashName){let a;return n.split("&").map(l=>l.split("=")).forEach(l=>{l[0]===this._hashName&&(a=l)}),(a&&a[1]||"").split("/")}return n.split("/")},this._onHashChange=()=>{const n=this._getCurrentHash();if(n.length>=3&&!n.some(a=>isNaN(a))){const a=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(n[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+n[2],+n[1]],zoom:+n[0],bearing:a,pitch:+(n[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const n=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,n)}catch{}},this._updateHash=on(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()),delete this._map,this}getHashString(t){const n=this._map.getCenter(),a=Math.round(100*this._map.getZoom())/100,l=Math.ceil((a*Math.LN2+Math.log(512/360/.5))/Math.LN10),d=Math.pow(10,l),m=Math.round(n.lng*d)/d,g=Math.round(n.lat*d)/d,y=this._map.getBearing(),v=this._map.getPitch();let b="";if(b+=t?`/${m}/${g}/${a}`:`${a}/${g}/${m}`,(y||v)&&(b+="/"+Math.round(10*y)/10),v&&(b+=`/${Math.round(v)}`),this._hashName){const T=this._hashName;let C=!1;const L=window.location.hash.slice(1).split("&").map(D=>{const F=D.split("=")[0];return F===T?(C=!0,`${F}=${b}`):D}).filter(D=>D);return C||L.push(`${T}=${b}`),`#${L.join("&")}`}return`#${b}`}}const gs={linearity:.3,easing:c.bezier(0,0,.3,1)},Ko=c.extend({deceleration:2500,maxSpeed:1400},gs),Yo=c.extend({deceleration:20,maxSpeed:1400},gs),Jo=c.extend({deceleration:1e3,maxSpeed:360},gs),Qo=c.extend({deceleration:1e3,maxSpeed:90},gs);class _s{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:c.browser.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=c.browser.now();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new c.Point(0,0),pinchAround:void 0,around:void 0};for(const{settings:d}of this._inertiaBuffer)n.zoom+=d.zoomDelta||0,n.bearing+=d.bearingDelta||0,n.pitch+=d.pitchDelta||0,d.panDelta&&n.pan._add(d.panDelta),d.around&&(n.around=d.around),d.pinchAround&&(n.pinchAround=d.pinchAround);const a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,l={};if(n.pan.mag()){const d=Gi(n.pan.mag(),a,c.extend({},Ko,t||{}));l.offset=n.pan.mult(d.amount/n.pan.mag()),l.center=this._map.transform.center,ys(l,d)}if(n.zoom){const d=Gi(n.zoom,a,Yo);l.zoom=this._map.transform.zoom+d.amount,ys(l,d)}if(n.bearing){const d=Gi(n.bearing,a,Jo);l.bearing=this._map.transform.bearing+c.clamp(d.amount,-179,179),ys(l,d)}if(n.pitch){const d=Gi(n.pitch,a,Qo);l.pitch=this._map.transform.pitch+d.amount,ys(l,d)}if(l.zoom||l.bearing){const d=n.pinchAround===void 0?n.around:n.pinchAround;l.around=d?this._map.unproject(d):this._map.getCenter()}return this.clear(),c.extend(l,{noMoveStart:!0})}}function ys(h,t){(!h.duration||h.durationn.unproject(y)),g=d.reduce((y,v,b,T)=>y.add(v.div(T.length)),new c.Point(0,0));super(t,{points:d,point:g,lngLats:m,lngLat:n.unproject(g),originalEvent:a}),this._defaultPrevented=!1}}class Nr extends c.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,a){super(t,{originalEvent:a}),this._defaultPrevented=!1}}class vs{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Nr(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Xt(t.type,this._map,t))}mouseup(t){this._map.fire(new Xt(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Xt(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Xt(t.type,this._map,t))}mouseover(t){this._map.fire(new Xt(t.type,this._map,t))}mouseout(t){this._map.fire(new Xt(t.type,this._map,t))}touchstart(t){return this._firePreventable(new xs(t.type,this._map,t))}touchmove(t){this._map.fire(new xs(t.type,this._map,t))}touchend(t){this._map.fire(new xs(t.type,this._map,t))}touchcancel(t){this._map.fire(new xs(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Gl{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Xt(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Xt("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Xt(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class bs{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.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.pointLocation(c.Point.convert(t),this._map.terrain)}}class Xl{constructor(t,n){this._map=t,this._tr=new bs(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(re.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const a=n;if(this._lastPos.equals(a)||!this._box&&a.dist(this._startPos)d.fitScreenCoordinates(a,l,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(re.remove(this._box),this._box=null),re.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new c.Event(t,{originalEvent:n}))}}function ca(h,t){if(h.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${h.length}, points ${t.length}`);const n={};for(let a=0;athis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),a.length===this.numTouches&&(this.centroid=function(l){const d=new c.Point(0,0);for(const m of l)d._add(m);return d.div(l.length)}(n),this.touches=ca(a,n)))}touchmove(t,n,a){if(this.aborted||!this.centroid)return;const l=ca(a,n);for(const d in this.touches){const m=l[d];(!m||m.dist(this.touches[d])>30)&&(this.aborted=!0)}}touchend(t,n,a){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),a.length===0){const l=!this.aborted&&this.centroid;if(this.reset(),l)return l}}}class Ar{constructor(t){this.singleTap=new ws(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,a){this.singleTap.touchstart(t,n,a)}touchmove(t,n,a){this.singleTap.touchmove(t,n,a)}touchend(t,n,a){const l=this.singleTap.touchend(t,n,a);if(l){const d=t.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(l)<30;if(d&&m||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=l,this.count===this.numTaps)return this.reset(),l}}}class Pe{constructor(t){this._tr=new bs(t),this._zoomIn=new Ar({numTouches:1,numTaps:2}),this._zoomOut=new Ar({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,a){this._zoomIn.touchstart(t,n,a),this._zoomOut.touchstart(t,n,a)}touchmove(t,n,a){this._zoomIn.touchmove(t,n,a),this._zoomOut.touchmove(t,n,a)}touchend(t,n,a){const l=this._zoomIn.touchend(t,n,a),d=this._zoomOut.touchend(t,n,a),m=this._tr;return l?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:g=>g.easeTo({duration:300,zoom:m.zoom+1,around:m.unproject(l)},{originalEvent:t})}):d?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:g=>g.easeTo({duration:300,zoom:m.zoom-1,around:m.unproject(d)},{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}}class Zn{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){const n=this._moveFunction(...t);if(n.bearingDelta||n.pitchDelta||n.around||n.panDelta)return this._active=!0,n}dragStart(t,n){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=n.length?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,n){if(!this.isEnabled())return;const a=this._lastPoint;if(!a)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const l=n.length?n[0]:n;return!this._moved&&l.dist(a){h.mousedown=h.dragStart,h.mousemoveWindow=h.dragMove,h.mouseup=h.dragEnd,h.contextmenu=function(t){t.preventDefault()}},ha=({enable:h,clickTolerance:t,bearingDegreesPerPixelMoved:n=.8})=>{const a=new Tn({checkCorrectEvent:l=>re.mouseButton(l)===0&&l.ctrlKey||re.mouseButton(l)===2});return new Zn({clickTolerance:t,move:(l,d)=>({bearingDelta:(d.x-l.x)*n}),moveStateManager:a,enable:h,assignEvents:Ie})},el=({enable:h,clickTolerance:t,pitchDegreesPerPixelMoved:n=-.5})=>{const a=new Tn({checkCorrectEvent:l=>re.mouseButton(l)===0&&l.ctrlKey||re.mouseButton(l)===2});return new Zn({clickTolerance:t,move:(l,d)=>({pitchDelta:(d.y-l.y)*n}),moveStateManager:a,enable:h,assignEvents:Ie})};class Wl{constructor(t,n){this._minTouches=t.cooperativeGestures?2:1,this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new c.Point(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(t,n,a){return this._calculateTransform(t,n,a)}touchmove(t,n,a){if(this._map._cooperativeGestures&&(this._minTouches===2&&a.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,a.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(a.length0&&(this._active=!0);const l=ca(a,n),d=new c.Point(0,0),m=new c.Point(0,0);let g=0;for(const v in l){const b=l[v],T=this._touches[v];T&&(d._add(b),m._add(b.sub(T)),g++,l[v]=b)}if(this._touches=l,gMath.abs(h.x)}class Ka extends Es{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,a){super.touchstart(t,n,a),this._currentTouchCount=a.length}_start(t){this._lastPoints=t,Is(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,a){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const l=t[0].sub(this._lastPoints[0]),d=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(l,d,a.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(l.y+d.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,a){if(this._valid!==void 0)return this._valid;const l=t.mag()>=2,d=n.mag()>=2;if(!l&&!d)return;if(!l||!d)return this._firstMove===void 0&&(this._firstMove=a),a-this._firstMove<100&&void 0;const m=t.y>0==n.y>0;return Is(t)&&Is(n)&&m}}const Ya={panStep:100,bearingStep:15,pitchStep:10};class Di{constructor(t){this._tr=new bs(t);const n=Ya;this._panStep=n.panStep,this._bearingStep=n.bearingStep,this._pitchStep=n.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,a=0,l=0,d=0,m=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?a=-1:(t.preventDefault(),d=-1);break;case 39:t.shiftKey?a=1:(t.preventDefault(),d=1);break;case 38:t.shiftKey?l=1:(t.preventDefault(),m=-1);break;case 40:t.shiftKey?l=-1:(t.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(a=0,l=0),{cameraAnimation:g=>{const y=this._tr;g.easeTo({duration:300,easeId:"keyboardHandler",easing:ln,zoom:n?Math.round(y.zoom)+n*(t.shiftKey?2:1):y.zoom,bearing:y.bearing+a*this._bearingStep,pitch:y.pitch+l*this._pitchStep,offset:[-d*this._panStep,-m*this._panStep],center:y.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 ln(h){return h*(2-h)}const Ja=4.000244140625;class Qa{constructor(t,n){this._onTimeout=a=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(a)},this._map=t,this._tr=new bs(t),this._el=t.getCanvasContainer(),this._triggerRenderFrame=n,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||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!t[this._map._metaKey])return;t.preventDefault()}let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const a=c.browser.now(),l=a-(this._lastWheelEventTime||0);this._lastWheelEventTime=a,n!==0&&n%Ja==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":l>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(l*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=re.mousePos(this._el,t),a=this._tr;this._around=c.LngLat.convert(this._aroundCenter?a.center:a.unproject(n)),this._aroundPoint=a.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._tr.transform;if(this._delta!==0){const g=this._type==="wheel"&&Math.abs(this._delta)>Ja?this._wheelZoomRate:this._defaultZoomRate;let y=2/(1+Math.exp(-Math.abs(this._delta*g)));this._delta<0&&y!==0&&(y=1/y);const v=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(v*y))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,a=this._startZoom,l=this._easing;let d,m=!1;if(this._type==="wheel"&&a&&l){const g=Math.min((c.browser.now()-this._lastWheelEventTime)/200,1),y=l(g);d=c.interpolate.number(a,n,y),g<1?this._frameId||(this._frameId=!0):m=!0}else d=n,m=!0;return this._active=!0,m&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!m,zoomDelta:d-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=c.defaultEasing;if(this._prevEase){const a=this._prevEase,l=(c.browser.now()-a.start)/a.duration,d=a.easing(l+.01)-a.easing(l),m=.27/Math.sqrt(d*d+1e-4)*.01,g=Math.sqrt(.0729-m*m);n=c.bezier(m,g,.25,1)}return this._prevEase={start:c.browser.now(),duration:t,easing:n},n}reset(){this._active=!1}}class eo{constructor(t,n){this._clickZoom=t,this._tapZoom=n}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()}}class to{constructor(t){this._tr=new bs(t),this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:a=>{a.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class il{constructor(){this._tap=new Ar({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,n,a){if(!this._swipePoint)if(this._tapTime){const l=n[0],d=t.timeStamp-this._tapTime<500,m=this._tapPoint.dist(l)<30;d&&m?a.length>0&&(this._swipePoint=l,this._swipeTouch=a[0].identifier):this.reset()}else this._tap.touchstart(t,n,a)}touchmove(t,n,a){if(this._tapTime){if(this._swipePoint){if(a[0].identifier!==this._swipeTouch)return;const l=n[0],d=l.y-this._swipePoint.y;return this._swipePoint=l,t.preventDefault(),this._active=!0,{zoomDelta:d/128}}}else this._tap.touchmove(t,n,a)}touchend(t,n,a){if(this._tapTime)this._swipePoint&&a.length===0&&this.reset();else{const l=this._tap.touchend(t,n,a);l&&(this._tapTime=t.timeStamp,this._tapPoint=l)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class nr{constructor(t,n,a){this._el=t,this._mousePan=n,this._touchPan=a}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()}}class St{constructor(t,n,a){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=n,this._mousePitch=a}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class ua{constructor(t,n,a,l){this._el=t,this._touchZoom=n,this._touchRotate=a,this._tapDragZoom=l,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()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const jn=h=>h.zoom||h.drag||h.pitch||h.rotate;class rl extends c.Event{}function da(h){return h.panDelta&&h.panDelta.mag()||h.zoomDelta||h.bearingDelta||h.pitchDelta}class nl{constructor(t,n){this.handleWindowEvent=l=>{this.handleEvent(l,`${l.type}Window`)},this.handleEvent=(l,d)=>{if(l.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const m=l.type==="renderFrame"?void 0:l,g={needsRenderFrame:!1},y={},v={},b=l.touches,T=b?this._getMapTouches(b):void 0,C=T?re.touchPos(this._el,T):re.mousePos(this._el,l);for(const{handlerName:F,handler:k,allowed:H}of this._handlers){if(!k.isEnabled())continue;let ne;this._blockedByActive(v,H,F)?k.reset():k[d||l.type]&&(ne=k[d||l.type](l,C,T),this.mergeHandlerResult(g,y,ne,F,m),ne&&ne.needsRenderFrame&&this._triggerRenderFrame()),(ne||k.isActive())&&(v[F]=k)}const L={};for(const F in this._previousActiveHandlers)v[F]||(L[F]=m);this._previousActiveHandlers=v,(Object.keys(L).length||da(g))&&(this._changes.push([g,y,L]),this._triggerRenderFrame()),(Object.keys(v).length||da(g))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:D}=g;D&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],D(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new _s(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n);const a=this._el;this._listeners=[[a,"touchstart",{passive:!0}],[a,"touchmove",{passive:!1}],[a,"touchend",void 0],[a,"touchcancel",void 0],[a,"mousedown",void 0],[a,"mousemove",void 0],[a,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[a,"mouseover",void 0],[a,"mouseout",void 0],[a,"dblclick",void 0],[a,"click",void 0],[a,"keydown",{capture:!1}],[a,"keyup",void 0],[a,"wheel",{passive:!1}],[a,"contextmenu",void 0],[window,"blur",void 0]];for(const[l,d,m]of this._listeners)re.addEventListener(l,d,l===document?this.handleWindowEvent:this.handleEvent,m)}destroy(){for(const[t,n,a]of this._listeners)re.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,a)}_addDefaultHandlers(t){const n=this._map,a=n.getCanvasContainer();this._add("mapEvent",new vs(n,t));const l=n.boxZoom=new Xl(n,t);this._add("boxZoom",l),t.interactive&&t.boxZoom&&l.enable();const d=new Pe(n),m=new to(n);n.doubleClickZoom=new eo(m,d),this._add("tapZoom",d),this._add("clickZoom",m),t.interactive&&t.doubleClickZoom&&n.doubleClickZoom.enable();const g=new il;this._add("tapDragZoom",g);const y=n.touchPitch=new Ka(n);this._add("touchPitch",y),t.interactive&&t.touchPitch&&n.touchPitch.enable(t.touchPitch);const v=ha(t),b=el(t);n.dragRotate=new St(t,v,b),this._add("mouseRotate",v,["mousePitch"]),this._add("mousePitch",b,["mouseRotate"]),t.interactive&&t.dragRotate&&n.dragRotate.enable();const T=(({enable:H,clickTolerance:ne})=>{const N=new Tn({checkCorrectEvent:K=>re.mouseButton(K)===0&&!K.ctrlKey});return new Zn({clickTolerance:ne,move:(K,ae)=>({around:ae,panDelta:ae.sub(K)}),activateOnStart:!0,moveStateManager:N,enable:H,assignEvents:Ie})})(t),C=new Wl(t,n);n.dragPan=new nr(a,T,C),this._add("mousePan",T),this._add("touchPan",C,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&n.dragPan.enable(t.dragPan);const L=new Ha,D=new Hl;n.touchZoomRotate=new ua(a,D,L,g),this._add("touchRotate",L,["touchPan","touchZoom"]),this._add("touchZoom",D,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&n.touchZoomRotate.enable(t.touchZoomRotate);const F=n.scrollZoom=new Qa(n,()=>this._triggerRenderFrame());this._add("scrollZoom",F,["mousePan"]),t.interactive&&t.scrollZoom&&n.scrollZoom.enable(t.scrollZoom);const k=n.keyboard=new Di(n);this._add("keyboard",k),t.interactive&&t.keyboard&&n.keyboard.enable(),this._add("blockableMapEvent",new Gl(n))}_add(t,n,a){this._handlers.push({handlerName:t,handler:n,allowed:a}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{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!!jn(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,n,a){for(const l in t)if(l!==a&&(!n||n.indexOf(l)<0))return!0;return!1}_getMapTouches(t){const n=[];for(const a of t)this._el.contains(a.target)&&n.push(a);return n}mergeHandlerResult(t,n,a,l,d){if(!a)return;c.extend(t,a);const m={handlerName:l,originalEvent:a.originalEvent||d};a.zoomDelta!==void 0&&(n.zoom=m),a.panDelta!==void 0&&(n.drag=m),a.pitchDelta!==void 0&&(n.pitch=m),a.bearingDelta!==void 0&&(n.rotate=m)}_applyChanges(){const t={},n={},a={};for(const[l,d,m]of this._changes)l.panDelta&&(t.panDelta=(t.panDelta||new c.Point(0,0))._add(l.panDelta)),l.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+l.zoomDelta),l.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+l.bearingDelta),l.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+l.pitchDelta),l.around!==void 0&&(t.around=l.around),l.pinchAround!==void 0&&(t.pinchAround=l.pinchAround),l.noInertia&&(t.noInertia=l.noInertia),c.extend(n,d),c.extend(a,m);this._updateMapTransform(t,n,a),this._changes=[]}_updateMapTransform(t,n,a){const l=this._map,d=l._getTransformForUpdate(),m=l.terrain;if(!(da(t)||m&&this._terrainMovement))return this._fireEvents(n,a,!0);let{panDelta:g,zoomDelta:y,bearingDelta:v,pitchDelta:b,around:T,pinchAround:C}=t;C!==void 0&&(T=C),l._stop(!0),T=T||l.transform.centerPoint;const L=d.pointLocation(g?T.sub(g):T);v&&(d.bearing+=v),b&&(d.pitch+=b),y&&(d.zoom+=y),m?this._terrainMovement||!n.drag&&!n.zoom?n.drag&&this._terrainMovement?d.center=d.pointLocation(d.centerPoint.sub(g)):d.setLocationAtPoint(L,T):(this._terrainMovement=!0,this._map._elevationFreeze=!0,d.setLocationAtPoint(L,T),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,d.recalculateZoom(l.terrain)})):d.setLocationAtPoint(L,T),l._applyUpdatedTransform(d),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,a,!0)}_fireEvents(t,n,a){const l=jn(this._eventsInProgress),d=jn(t),m={};for(const b in t){const{originalEvent:T}=t[b];this._eventsInProgress[b]||(m[`${b}start`]=T),this._eventsInProgress[b]=t[b]}!l&&d&&this._fireEvent("movestart",d.originalEvent);for(const b in m)this._fireEvent(b,m[b]);d&&this._fireEvent("move",d.originalEvent);for(const b in t){const{originalEvent:T}=t[b];this._fireEvent(b,T)}const g={};let y;for(const b in this._eventsInProgress){const{handlerName:T,originalEvent:C}=this._eventsInProgress[b];this._handlersById[T].isActive()||(delete this._eventsInProgress[b],y=n[T]||C,g[`${b}end`]=y)}for(const b in g)this._fireEvent(b,g[b]);const v=jn(this._eventsInProgress);if(a&&(l||d)&&!v){this._updatingCamera=!0;const b=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),T=C=>C!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new rl("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Kl extends c.Evented{constructor(t,n){super(),this._renderFrameCallback=()=>{const a=Math.min((c.browser.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(a)),a<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new c.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,a){return t=c.Point.convert(t).mult(-1),this.panTo(this.transform.center,c.extend({offset:t},n),a)}panTo(t,n,a){return this.easeTo(c.extend({center:t},n),a)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,a){return this.easeTo(c.extend({zoom:t},n),a)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getBearing(){return this.transform.bearing}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,a){return this.easeTo(c.extend({bearing:t},n),a)}resetNorth(t,n){return this.rotateTo(0,c.extend({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(c.extend({bearing:0,pitch:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing()){if(this._zooming&&(a.zoom=c.interpolate.number(l,y,oe)),this._rotating&&(a.bearing=c.interpolate.number(d,v,oe)),this._pitching&&(a.pitch=c.interpolate.number(m,b,oe)),this._padding&&(a.interpolatePadding(g,T,oe),L=a.centerPoint.add(C)),this.terrain&&!t.freezeElevation&&this._updateElevation(oe),N)a.setLocationAtPoint(N,K);else{const ce=a.zoomScale(a.zoom-l),_e=y>l?Math.min(2,ne):Math.max(.5,ne),fe=Math.pow(_e,1-oe),xe=a.unproject(k.add(H.mult(oe*fe)).mult(ce));a.setLocationAtPoint(a.renderWorldCopies?xe.wrap():xe,L)}this._applyUpdatedTransform(a),this._fireMoveEvents(n)},oe=>{this.terrain&&this._finalizeElevation(),this._afterEase(n,oe)},t),this}_prepareEase(t,n,a={}){this._moving=!0,n||a.moving||this.fire(new c.Event("movestart",t)),this._zooming&&!a.zooming&&this.fire(new c.Event("zoomstart",t)),this._rotating&&!a.rotating&&this.fire(new c.Event("rotatestart",t)),this._pitching&&!a.pitching&&this.fire(new c.Event("pitchstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const n=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&n!==this._elevationTarget){const a=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(a-(n-(a*t+this._elevationStart))/(1-t)),this._elevationTarget=n}this.transform.elevation=c.interpolate.number(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(t){if(!this.transformCameraUpdate)return;const n=t.clone(),{center:a,zoom:l,pitch:d,bearing:m,elevation:g}=this.transformCameraUpdate(n);a&&(n.center=a),l!==void 0&&(n.zoom=l),d!==void 0&&(n.pitch=d),m!==void 0&&(n.bearing=m),g!==void 0&&(n.elevation=g),this.transform.apply(n)}_fireMoveEvents(t){this.fire(new c.Event("move",t)),this._zooming&&this.fire(new c.Event("zoom",t)),this._rotating&&this.fire(new c.Event("rotate",t)),this._pitching&&this.fire(new c.Event("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const a=this._zooming,l=this._rotating,d=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,a&&this.fire(new c.Event("zoomend",t)),l&&this.fire(new c.Event("rotateend",t)),d&&this.fire(new c.Event("pitchend",t)),this.fire(new c.Event("moveend",t))}flyTo(t,n){if(!t.essential&&c.browser.prefersReducedMotion){const ke=c.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(ke,n)}this.stop(),t=c.extend({offset:[0,0],speed:1.2,curve:1.42,easing:c.defaultEasing},t);const a=this._getTransformForUpdate(),l=this.getZoom(),d=this.getBearing(),m=this.getPitch(),g=this.getPadding(),y="zoom"in t?c.clamp(+t.zoom,a.minZoom,a.maxZoom):l,v="bearing"in t?this._normalizeBearing(t.bearing,d):d,b="pitch"in t?+t.pitch:m,T="padding"in t?t.padding:a.padding,C=a.zoomScale(y-l),L=c.Point.convert(t.offset);let D=a.centerPoint.add(L);const F=a.pointLocation(D),k=c.LngLat.convert(t.center||F);this._normalizeCenter(k);const H=a.project(F),ne=a.project(k).sub(H);let N=t.curve;const K=Math.max(a.width,a.height),ae=K/C,oe=ne.mag();if("minZoom"in t){const ke=c.clamp(Math.min(t.minZoom,l,y),a.minZoom,a.maxZoom),It=K/a.zoomScale(ke-l);N=Math.sqrt(It/oe*2)}const ce=N*N;function _e(ke){const It=(ae*ae-K*K+(ke?-1:1)*ce*ce*oe*oe)/(2*(ke?ae:K)*ce*oe);return Math.log(Math.sqrt(It*It+1)-It)}function fe(ke){return(Math.exp(ke)-Math.exp(-ke))/2}function xe(ke){return(Math.exp(ke)+Math.exp(-ke))/2}const Be=_e(!1);let et=function(ke){return xe(Be)/xe(Be+N*ke)},Ee=function(ke){return K*((xe(Be)*(fe(It=Be+N*ke)/xe(It))-fe(Be))/ce)/oe;var It},Ne=(_e(!0)-Be)/N;if(Math.abs(oe)<1e-6||!isFinite(Ne)){if(Math.abs(K-ae)<1e-6)return this.easeTo(t,n);const ke=aet.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=d!==v,this._pitching=b!==m,this._padding=!a.isPaddingEqual(T),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(k),this._ease(ke=>{const It=ke*Ne,tt=1/et(It);a.zoom=ke===1?y:l+a.scaleZoom(tt),this._rotating&&(a.bearing=c.interpolate.number(d,v,ke)),this._pitching&&(a.pitch=c.interpolate.number(m,b,ke)),this._padding&&(a.interpolatePadding(g,T,ke),D=a.centerPoint.add(L)),this.terrain&&!t.freezeElevation&&this._updateElevation(ke);const $e=ke===1?k:a.unproject(H.add(ne.mult(Ee(It))).mult(tt));a.setLocationAtPoint(a.renderWorldCopies?$e.wrap():$e,D),this._applyUpdatedTransform(a),this._fireMoveEvents(n)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(n)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const a=this._onEaseEnd;delete this._onEaseEnd,a.call(this,n)}if(!t){const a=this.handlers;a&&a.stop(!1)}return this}_ease(t,n,a){a.animate===!1||a.duration===0?(t(1),n()):(this._easeStart=c.browser.now(),this._easeOptions=a,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,n){t=c.wrap(t,-180,180);const a=Math.abs(t-n);return Math.abs(t-360-n)180?-360:a<-180?360:0}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(c.LngLat.convert(t),this.transform.tileZoom)-this.transform.elevation:null}}class fr{constructor(t={}){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=n=>{!n||n.sourceDataType!=="metadata"&&n.sourceDataType!=="visibility"&&n.dataType!=="style"&&n.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?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&&this.options.compact,this._container=re.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=re.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=re.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(){re.remove(this._container),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,n){const a=this._map._getUIString(`AttributionControl.${n}`);t.title=a,t.setAttribute("aria-label",a)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(l=>typeof l!="string"?"":l)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const l=this._map.style.stylesheet;this.styleOwner=l.owner,this.styleId=l.id}const n=this._map.style.sourceCaches;for(const l in n){const d=n[l];if(d.used||d.usedForTerrain){const m=d.getSource();m.attribution&&t.indexOf(m.attribution)<0&&t.push(m.attribution)}}t=t.filter(l=>String(l).trim()),t.sort((l,d)=>l.length-d.length),t=t.filter((l,d)=>{for(let m=d+1;m=0)return!1;return!0});const a=t.join(" | ");a!==this._attribHTML&&(this._attribHTML=a,t.length?(this._innerContainer.innerHTML=a,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class As{constructor(t={}){this._updateCompact=()=>{const n=this._container.children;if(n.length){const a=n[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&a.classList.add("maplibregl-compact"):a.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=re.create("div","maplibregl-ctrl");const n=re.create("a","maplibregl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){re.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Ue{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,a=n?this._queue.concat(n):this._queue;for(const l of a)if(l.id===t)return void(l.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const n=this._currentlyRunning=this._queue;this._queue=[];for(const a of n)if(!a.cancelled&&(a.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const je={"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":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"};var pa=c.createLayout([{name:"a_pos3d",type:"Int16",components:3}]);class io extends c.Evented{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(t,n){this.sourceCache.update(t,n),this._renderableTilesKeys=[];const a={};for(const l of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))a[l.key]=!0,this._renderableTilesKeys.push(l.key),this._tiles[l.key]||(l.posMatrix=new Float64Array(16),c.ortho(l.posMatrix,0,c.EXTENT,0,c.EXTENT,0,1),this._tiles[l.key]=new mn(l,this.tileSize));for(const l in this._tiles)a[l]||delete this._tiles[l]}freeRtt(t){for(const n in this._tiles){const a=this._tiles[n];(!t||a.tileID.equals(t)||a.tileID.isChildOf(t)||t.isChildOf(a.tileID))&&(a.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const n={};for(const a of this._renderableTilesKeys){const l=this._tiles[a].tileID;if(l.canonical.equals(t.canonical)){const d=t.clone();d.posMatrix=new Float64Array(16),c.ortho(d.posMatrix,0,c.EXTENT,0,c.EXTENT,0,1),n[a]=d}else if(l.canonical.isChildOf(t.canonical)){const d=t.clone();d.posMatrix=new Float64Array(16);const m=l.canonical.z-t.canonical.z,g=l.canonical.x-(l.canonical.x>>m<>m<>m;c.ortho(d.posMatrix,0,v,0,v,0,1),c.translate(d.posMatrix,d.posMatrix,[-g*v,-y*v,0]),n[a]=d}else if(t.canonical.isChildOf(l.canonical)){const d=t.clone();d.posMatrix=new Float64Array(16);const m=t.canonical.z-l.canonical.z,g=t.canonical.x-(t.canonical.x>>m<>m<>m;c.ortho(d.posMatrix,0,c.EXTENT,0,c.EXTENT,0,1),c.translate(d.posMatrix,d.posMatrix,[g*v,y*v,0]),c.scale(d.posMatrix,d.posMatrix,[1/2**m,1/2**m,0]),n[a]=d}}return n}getSourceTile(t,n){const a=this.sourceCache._source;let l=t.overscaledZ-this.deltaZoom;if(l>a.maxzoom&&(l=a.maxzoom),l=a.minzoom&&(!d||!d.dem);)d=this.sourceCache.getTileByID(t.scaledTo(l--).key);return d}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(n=>n.timeAdded>=t)}}class ro{constructor(t,n,a){this.painter=t,this.sourceCache=new io(n),this.options=a,this.exaggeration=typeof a.exaggeration=="number"?a.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,n,a,l=c.EXTENT){var d;if(!(n>=0&&n=0&&at.canonical.z&&(t.canonical.z>=l?d=t.canonical.z-l:c.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const m=t.canonical.x-(t.canonical.x>>d<>d<>8<<4|d>>8,n[m+3]=0;const a=new c.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),l=new Je(t,a,t.gl.RGBA,{premultiply:!1});return l.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=l,l}pointCoordinate(t){const n=new Uint8Array(4),a=this.painter.context,l=a.gl;a.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),l.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,l.RGBA,l.UNSIGNED_BYTE,n),a.bindFramebuffer.set(null);const d=n[0]+(n[2]>>4<<8),m=n[1]+((15&n[2])<<8),g=this.coordsIndex[255-n[3]],y=g&&this.sourceCache.getTileByID(g);if(!y)return null;const v=this._coordsTextureSize,b=(1<t.id!==n),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const n of this._recentlyUsed)if(!this._objects[n].inUse)return this._objects[n];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length!t.inUse)===!1}}const En={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Cr{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new Li(t.context,30,n.sourceCache.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,n){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter(a=>!t._layers[a].isHidden(n)),this._coordsDescendingInv={};for(const a in t.sourceCaches){this._coordsDescendingInv[a]={};const l=t.sourceCaches[a].getVisibleCoordinates();for(const d of l){const m=this.terrain.sourceCache.getTerrainCoords(d);for(const g in m)this._coordsDescendingInv[a][g]||(this._coordsDescendingInv[a][g]=[]),this._coordsDescendingInv[a][g].push(m[g])}}this._coordsDescendingInvStr={};for(const a of t._order){const l=t._layers[a],d=l.source;if(En[l.type]&&!this._coordsDescendingInvStr[d]){this._coordsDescendingInvStr[d]={};for(const m in this._coordsDescendingInv[d])this._coordsDescendingInvStr[d][m]=this._coordsDescendingInv[d][m].map(g=>g.key).sort().join()}}for(const a of this._renderableTiles)for(const l in this._coordsDescendingInvStr){const d=this._coordsDescendingInvStr[l][a.tileID.key];d&&d!==a.rttCoords[l]&&(a.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const n=t.type,a=this.painter,l=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(En[n]&&(this._prevType&&En[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!l))return!0;if(En[this._prevType]||En[n]&&l){this._prevType=n;const d=this._stacks.length-1,m=this._stacks[d]||[];for(const g of this._renderableTiles){if(this.pool.isFull()&&(sa(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(g),g.rtt[d]){const v=this.pool.getObjectForId(g.rtt[d].id);if(v.stamp===g.rtt[d].stamp){this.pool.useObject(v);continue}}const y=this.pool.getOrCreateFreeObject();this.pool.useObject(y),this.pool.stampObject(y),g.rtt[d]={id:y.id,stamp:y.stamp},a.context.bindFramebuffer.set(y.fbo.framebuffer),a.context.clear({color:c.Color.transparent,stencil:0}),a.currentStencilSource=void 0;for(let v=0;v{h.touchstart=h.dragStart,h.touchmoveWindow=h.dragMove,h.touchend=h.dragEnd},$t={showCompass:!0,showZoom:!0,visualizePitch:!1};class sl{constructor(t,n,a=!1){this.mousedown=m=>{this.startMouse(c.extend({},m,{ctrlKey:!0,preventDefault:()=>m.preventDefault()}),re.mousePos(this.element,m)),re.addEventListener(window,"mousemove",this.mousemove),re.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=m=>{this.moveMouse(m,re.mousePos(this.element,m))},this.mouseup=m=>{this.mouseRotate.dragEnd(m),this.mousePitch&&this.mousePitch.dragEnd(m),this.offTemp()},this.touchstart=m=>{m.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=re.touchPos(this.element,m.targetTouches)[0],this.startTouch(m,this._startPos),re.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),re.addEventListener(window,"touchend",this.touchend))},this.touchmove=m=>{m.targetTouches.length!==1?this.reset():(this._lastPos=re.touchPos(this.element,m.targetTouches)[0],this.moveTouch(m,this._lastPos))},this.touchend=m=>{m.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const l=t.dragRotate._mouseRotate.getClickTolerance(),d=t.dragRotate._mousePitch.getClickTolerance();this.element=n,this.mouseRotate=ha({clickTolerance:l,enable:!0}),this.touchRotate=(({enable:m,clickTolerance:g,bearingDegreesPerPixelMoved:y=.8})=>{const v=new Xa;return new Zn({clickTolerance:g,move:(b,T)=>({bearingDelta:(T.x-b.x)*y}),moveStateManager:v,enable:m,assignEvents:Pt})})({clickTolerance:l,enable:!0}),this.map=t,a&&(this.mousePitch=el({clickTolerance:d,enable:!0}),this.touchPitch=(({enable:m,clickTolerance:g,pitchDegreesPerPixelMoved:y=-.5})=>{const v=new Xa;return new Zn({clickTolerance:g,move:(b,T)=>({pitchDelta:(T.y-b.y)*y}),moveStateManager:v,enable:m,assignEvents:Pt})})({clickTolerance:d,enable:!0})),re.addEventListener(n,"mousedown",this.mousedown),re.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),re.addEventListener(n,"touchcancel",this.reset)}startMouse(t,n){this.mouseRotate.dragStart(t,n),this.mousePitch&&this.mousePitch.dragStart(t,n),re.disableDrag()}startTouch(t,n){this.touchRotate.dragStart(t,n),this.touchPitch&&this.touchPitch.dragStart(t,n),re.disableDrag()}moveMouse(t,n){const a=this.map,{bearingDelta:l}=this.mouseRotate.dragMove(t,n)||{};if(l&&a.setBearing(a.getBearing()+l),this.mousePitch){const{pitchDelta:d}=this.mousePitch.dragMove(t,n)||{};d&&a.setPitch(a.getPitch()+d)}}moveTouch(t,n){const a=this.map,{bearingDelta:l}=this.touchRotate.dragMove(t,n)||{};if(l&&a.setBearing(a.getBearing()+l),this.touchPitch){const{pitchDelta:d}=this.touchPitch.dragMove(t,n)||{};d&&a.setPitch(a.getPitch()+d)}}off(){const t=this.element;re.removeEventListener(t,"mousedown",this.mousedown),re.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),re.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),re.removeEventListener(window,"touchend",this.touchend),re.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){re.enableDrag(),re.removeEventListener(window,"mousemove",this.mousemove),re.removeEventListener(window,"mouseup",this.mouseup),re.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),re.removeEventListener(window,"touchend",this.touchend)}}let sr;function Ms(h,t,n){if(h=new c.LngLat(h.lng,h.lat),t){const a=new c.LngLat(h.lng-360,h.lat),l=new c.LngLat(h.lng+360,h.lat),d=n.locationPoint(h).distSqr(t);n.locationPoint(a).distSqr(t)180;){const a=n.locationPoint(h);if(a.x>=0&&a.y>=0&&a.x<=n.width&&a.y<=n.height)break;h.lng>n.center.lng?h.lng-=360:h.lng+=360}return h}const Ps={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function fa(h,t,n){const a=h.classList;for(const l in Ps)a.remove(`maplibregl-${n}-anchor-${l}`);a.add(`maplibregl-${n}-anchor-${t}`)}class zs extends c.Evented{constructor(t){if(super(),this._onKeyPress=n=>{const a=n.code,l=n.charCode||n.keyCode;a!=="Space"&&a!=="Enter"&&l!==32&&l!==13||this.togglePopup()},this._onMapClick=n=>{const a=n.originalEvent.target,l=this._element;this._popup&&(a===l||l.contains(a))&&this.togglePopup()},this._update=n=>{if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=Ms(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let a="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?a=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(a=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let l="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?l="rotateX(0deg)":this._pitchAlignment==="map"&&(l=`rotateX(${this._map.getPitch()}deg)`),n&&n.type!=="moveend"||(this._pos=this._pos.round()),re.setTransform(this._element,`${Ps[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${l} ${a}`),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const d=this._map.unproject(this._pos),m=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=d.distanceTo(this._lngLat)>20*m?"0.2":"1.0",this._opacityTimeout=null},100))},this._onMove=n=>{if(!this._isDragging){const a=this._clickTolerance||this._map._clickTolerance;this._isDragging=n.point.dist(this._pointerdownPos)>=a}this._isDragging&&(this._pos=n.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new c.Event("dragstart"))),this.fire(new c.Event("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new c.Event("dragend")),this._state="inactive"},this._addDragHandler=n=>{this._element.contains(n.originalEvent.target)&&(n.preventDefault(),this._positionDelta=n.point.sub(this._pos).add(this._offset),this._pointerdownPos=n.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,t&&t.element)this._element=t.element,this._offset=c.Point.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=re.create("div"),this._element.setAttribute("aria-label","Map marker");const n=re.createNS("http://www.w3.org/2000/svg","svg"),a=41,l=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${a}px`),n.setAttributeNS(null,"width",`${l}px`),n.setAttributeNS(null,"viewBox",`0 0 ${l} ${a}`);const d=re.createNS("http://www.w3.org/2000/svg","g");d.setAttributeNS(null,"stroke","none"),d.setAttributeNS(null,"stroke-width","1"),d.setAttributeNS(null,"fill","none"),d.setAttributeNS(null,"fill-rule","evenodd");const m=re.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"fill-rule","nonzero");const g=re.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"transform","translate(3.0, 29.0)"),g.setAttributeNS(null,"fill","#000000");const y=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const H of y){const ne=re.createNS("http://www.w3.org/2000/svg","ellipse");ne.setAttributeNS(null,"opacity","0.04"),ne.setAttributeNS(null,"cx","10.5"),ne.setAttributeNS(null,"cy","5.80029008"),ne.setAttributeNS(null,"rx",H.rx),ne.setAttributeNS(null,"ry",H.ry),g.appendChild(ne)}const v=re.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"fill",this._color);const b=re.createNS("http://www.w3.org/2000/svg","path");b.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),v.appendChild(b);const T=re.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"opacity","0.25"),T.setAttributeNS(null,"fill","#000000");const C=re.createNS("http://www.w3.org/2000/svg","path");C.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),T.appendChild(C);const L=re.createNS("http://www.w3.org/2000/svg","g");L.setAttributeNS(null,"transform","translate(6.0, 7.0)"),L.setAttributeNS(null,"fill","#FFFFFF");const D=re.createNS("http://www.w3.org/2000/svg","g");D.setAttributeNS(null,"transform","translate(8.0, 8.0)");const F=re.createNS("http://www.w3.org/2000/svg","circle");F.setAttributeNS(null,"fill","#000000"),F.setAttributeNS(null,"opacity","0.25"),F.setAttributeNS(null,"cx","5.5"),F.setAttributeNS(null,"cy","5.5"),F.setAttributeNS(null,"r","5.4999962");const k=re.createNS("http://www.w3.org/2000/svg","circle");k.setAttributeNS(null,"fill","#FFFFFF"),k.setAttributeNS(null,"cx","5.5"),k.setAttributeNS(null,"cy","5.5"),k.setAttributeNS(null,"r","5.4999962"),D.appendChild(F),D.appendChild(k),m.appendChild(g),m.appendChild(v),m.appendChild(T),m.appendChild(L),m.appendChild(D),n.appendChild(m),n.setAttributeNS(null,"height",a*this._scale+"px"),n.setAttributeNS(null,"width",l*this._scale+"px"),this._element.appendChild(n),this._offset=c.Point.convert(t&&t.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",n=>{n.preventDefault()}),this._element.addEventListener("mousedown",n=>{n.preventDefault()}),fa(this._element,this._anchor,"marker"),t&&t.className)for(const n of t.className.split(" "))this._element.classList.add(n);this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),re.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=c.LngLat.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const l=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[l,-1*(38.1-13.5+l)],"bottom-right":[-l,-1*(38.1-13.5+l)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}getOffset(){return this._offset}setOffset(t){return this._offset=c.Point.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const ks={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Gn=0,Sn=!1;const no={maxWidth:100,unit:"metric"};function ma(h,t,n){const a=n&&n.maxWidth||100,l=h._container.clientHeight/2,d=h.unproject([0,l]),m=h.unproject([a,l]),g=d.distanceTo(m);if(n&&n.unit==="imperial"){const y=3.2808*g;y>5280?In(t,a,y/5280,h._getUIString("ScaleControl.Miles")):In(t,a,y,h._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?In(t,a,g/1852,h._getUIString("ScaleControl.NauticalMiles")):g>=1e3?In(t,a,g/1e3,h._getUIString("ScaleControl.Kilometers")):In(t,a,g,h._getUIString("ScaleControl.Meters"))}function In(h,t,n,a){const l=function(d){const m=Math.pow(10,`${Math.floor(d)}`.length-1);let g=d/m;return g=g>=10?10:g>=5?5:g>=3?3:g>=2?2:g>=1?1:function(y){const v=Math.pow(10,Math.ceil(-Math.log(y)/Math.LN10));return Math.round(y*v)/v}(g),m*g}(n);h.style.width=t*(l/n)+"px",h.innerHTML=`${l} ${a}`}const so={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},ao=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function ga(h){if(h){if(typeof h=="number"){const t=Math.round(Math.abs(h)/Math.SQRT2);return{center:new c.Point(0,0),top:new c.Point(0,h),"top-left":new c.Point(t,t),"top-right":new c.Point(-t,t),bottom:new c.Point(0,-h),"bottom-left":new c.Point(t,-t),"bottom-right":new c.Point(-t,-t),left:new c.Point(h,0),right:new c.Point(-h,0)}}if(h instanceof c.Point||Array.isArray(h)){const t=c.Point.convert(h);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:c.Point.convert(h.center||[0,0]),top:c.Point.convert(h.top||[0,0]),"top-left":c.Point.convert(h["top-left"]||[0,0]),"top-right":c.Point.convert(h["top-right"]||[0,0]),bottom:c.Point.convert(h.bottom||[0,0]),"bottom-left":c.Point.convert(h["bottom-left"]||[0,0]),"bottom-right":c.Point.convert(h["bottom-right"]||[0,0]),left:c.Point.convert(h.left||[0,0]),right:c.Point.convert(h.right||[0,0])}}return ga(new c.Point(0,0))}const _a={extend:(h,...t)=>c.extend(h,...t),run(h){h()},logToElement(h,t=!1,n="log"){const a=window.document.getElementById(n);a&&(t&&(a.innerHTML=""),a.innerHTML+=`
${h}`)}},oo=Oe;class ct{static get version(){return oo}static get workerCount(){return Ai.workerCount}static set workerCount(t){Ai.workerCount=t}static get maxParallelImageRequests(){return c.config.MAX_PARALLEL_IMAGE_REQUESTS}static set maxParallelImageRequests(t){c.config.MAX_PARALLEL_IMAGE_REQUESTS=t}static get workerUrl(){return c.config.WORKER_URL}static set workerUrl(t){c.config.WORKER_URL=t}static addProtocol(t,n){c.config.REGISTERED_PROTOCOLS[t]=n}static removeProtocol(t){delete c.config.REGISTERED_PROTOCOLS[t]}}return ct.Map=class extends Kl{constructor(h){if(c.PerformanceUtils.mark(c.PerformanceMarkers.create),(h=c.extend({},Cs,h)).minZoom!=null&&h.maxZoom!=null&&h.minZoom>h.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(h.minPitch!=null&&h.maxPitch!=null&&h.minPitch>h.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(h.minPitch!=null&&h.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(h.maxPitch!=null&&h.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new la(h.minZoom,h.maxZoom,h.minPitch,h.maxPitch,h.renderWorldCopies),{bearingSnap:h.bearingSnap}),this._cooperativeGesturesOnWheel=t=>{this._onCooperativeGesture(t,t[this._metaKey],1)},this._contextLost=t=>{t.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new c.Event("webglcontextlost",{originalEvent:t}))},this._contextRestored=t=>{this._setupPainter(),this.resize(),this._update(),this.fire(new c.Event("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()},this._interactive=h.interactive,this._cooperativeGestures=h.cooperativeGestures,this._metaKey=navigator.platform.indexOf("Mac")===0?"metaKey":"ctrlKey",this._maxTileCacheSize=h.maxTileCacheSize,this._maxTileCacheZoomLevels=h.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=h.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=h.preserveDrawingBuffer,this._antialias=h.antialias,this._trackResize=h.trackResize,this._bearingSnap=h.bearingSnap,this._refreshExpiredTiles=h.refreshExpiredTiles,this._fadeDuration=h.fadeDuration,this._crossSourceCollisions=h.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=h.collectResourceTiming,this._renderTaskQueue=new Ue,this._controls=[],this._mapId=c.uniqueId(),this._locale=c.extend({},je,h.locale),this._clickTolerance=h.clickTolerance,this._overridePixelRatio=h.pixelRatio,this._maxCanvasSize=h.maxCanvasSize,this.transformCameraUpdate=h.transformCameraUpdate,this._imageQueueHandle=jt.addThrottleControl(()=>this.isMoving()),this._requestManager=new Mt(h.transformRequest),typeof h.container=="string"){if(this._container=document.getElementById(h.container),!this._container)throw new Error(`Container '${h.container}' not found.`)}else{if(!(h.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=h.container}if(h.maxBounds&&this.setMaxBounds(h.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let t=!1;const n=on(a=>{this._trackResize&&!this._removed&&this.resize(a)._update()},50);this._resizeObserver=new ResizeObserver(a=>{t?n(a):t=!0}),this._resizeObserver.observe(this._container)}this.handlers=new nl(this,h),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=h.hash&&new Ho(typeof h.hash=="string"&&h.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:h.center,zoom:h.zoom,bearing:h.bearing,pitch:h.pitch}),h.bounds&&(this.resize(),this.fitBounds(h.bounds,c.extend({},h.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=h.localIdeographFontFamily,this._validateStyle=h.validateStyle,h.style&&this.setStyle(h.style,{localIdeographFontFamily:h.localIdeographFontFamily}),h.attributionControl&&this.addControl(new fr({customAttribution:h.customAttribution})),h.maplibreLogo&&this.addControl(new As,h.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",t=>{this._update(t.dataType==="style"),this.fire(new c.Event(`${t.dataType}data`,t))}),this.on("dataloading",t=>{this.fire(new c.Event(`${t.dataType}dataloading`,t))}),this.on("dataabort",t=>{this.fire(new c.Event("sourcedataabort",t))})}_getMapId(){return this._mapId}addControl(h,t){if(t===void 0&&(t=h.getDefaultPosition?h.getDefaultPosition():"top-right"),!h||!h.onAdd)return this.fire(new c.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=h.onAdd(this);this._controls.push(h);const a=this._controlPositions[t];return t.indexOf("bottom")!==-1?a.insertBefore(n,a.firstChild):a.appendChild(n),this}removeControl(h){if(!h||!h.onRemove)return this.fire(new c.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(h);return t>-1&&this._controls.splice(t,1),h.onRemove(this),this}hasControl(h){return this._controls.indexOf(h)>-1}calculateCameraOptionsFromTo(h,t,n,a){return a==null&&this.terrain&&(a=this.terrain.getElevationForLngLatZoom(n,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(h,t,n,a)}resize(h){var t;const n=this._containerDimensions(),a=n[0],l=n[1],d=this._getClampedPixelRatio(a,l);if(this._resizeCanvas(a,l,d),this.painter.resize(a,l,d),this.painter.overLimit()){const g=this.painter.context.gl;this._maxCanvasSize=[g.drawingBufferWidth,g.drawingBufferHeight];const y=this._getClampedPixelRatio(a,l);this._resizeCanvas(a,l,y),this.painter.resize(a,l,y)}this.transform.resize(a,l),(t=this._requestedCameraState)===null||t===void 0||t.resize(a,l);const m=!this._moving;return m&&(this.stop(),this.fire(new c.Event("movestart",h)).fire(new c.Event("move",h))),this.fire(new c.Event("resize",h)),m&&this.fire(new c.Event("moveend",h)),this}_getClampedPixelRatio(h,t){const{0:n,1:a}=this._maxCanvasSize,l=this.getPixelRatio(),d=h*l,m=t*l;return Math.min(d>n?n/d:1,m>a?a/m:1)*l}getPixelRatio(){var h;return(h=this._overridePixelRatio)!==null&&h!==void 0?h:devicePixelRatio}setPixelRatio(h){this._overridePixelRatio=h,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(h){return this.transform.setMaxBounds(mt.convert(h)),this._update()}setMinZoom(h){if((h=h??-2)>=-2&&h<=this.transform.maxZoom)return this.transform.minZoom=h,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=h,this._update(),this.getZoom()>h&&this.setZoom(h),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(h){if((h=h??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(h>=0&&h<=this.transform.maxPitch)return this.transform.minPitch=h,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(h>=this.transform.minPitch)return this.transform.maxPitch=h,this._update(),this.getPitch()>h&&this.setPitch(h),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(h){return this.transform.renderWorldCopies=h,this._update()}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(h){return this._cooperativeGestures=h,this._cooperativeGestures?this._setupCooperativeGestures():this._destroyCooperativeGestures(),this}project(h){return this.transform.locationPoint(c.LngLat.convert(h),this.style&&this.terrain)}unproject(h){return this.transform.pointLocation(c.Point.convert(h),this.terrain)}isMoving(){var h;return this._moving||((h=this.handlers)===null||h===void 0?void 0:h.isMoving())}isZooming(){var h;return this._zooming||((h=this.handlers)===null||h===void 0?void 0:h.isZooming())}isRotating(){var h;return this._rotating||((h=this.handlers)===null||h===void 0?void 0:h.isRotating())}_createDelegatedListener(h,t,n){if(h==="mouseenter"||h==="mouseover"){let a=!1;return{layer:t,listener:n,delegates:{mousemove:d=>{const m=this.getLayer(t)?this.queryRenderedFeatures(d.point,{layers:[t]}):[];m.length?a||(a=!0,n.call(this,new Xt(h,this,d.originalEvent,{features:m}))):a=!1},mouseout:()=>{a=!1}}}}if(h==="mouseleave"||h==="mouseout"){let a=!1;return{layer:t,listener:n,delegates:{mousemove:m=>{(this.getLayer(t)?this.queryRenderedFeatures(m.point,{layers:[t]}):[]).length?a=!0:a&&(a=!1,n.call(this,new Xt(h,this,m.originalEvent)))},mouseout:m=>{a&&(a=!1,n.call(this,new Xt(h,this,m.originalEvent)))}}}}{const a=l=>{const d=this.getLayer(t)?this.queryRenderedFeatures(l.point,{layers:[t]}):[];d.length&&(l.features=d,n.call(this,l),delete l.features)};return{layer:t,listener:n,delegates:{[h]:a}}}}on(h,t,n){if(n===void 0)return super.on(h,t);const a=this._createDelegatedListener(h,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[h]=this._delegatedListeners[h]||[],this._delegatedListeners[h].push(a);for(const l in a.delegates)this.on(l,a.delegates[l]);return this}once(h,t,n){if(n===void 0)return super.once(h,t);const a=this._createDelegatedListener(h,t,n);for(const l in a.delegates)this.once(l,a.delegates[l]);return this}off(h,t,n){return n===void 0?super.off(h,t):(this._delegatedListeners&&this._delegatedListeners[h]&&(a=>{const l=this._delegatedListeners[h];for(let d=0;dthis._updateStyle(h,t));const n=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!h)),h?(this.style=new mi(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof h=="string"?this.style.loadURL(h,t,n):this.style.loadJSON(h,t,n),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new mi(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(h,t){if(typeof h=="string"){const n=this._requestManager.transformRequest(h,vt.Style);c.getJSON(n,(a,l)=>{a?this.fire(new c.ErrorEvent(a)):l&&this._updateDiff(l,t)})}else typeof h=="object"&&this._updateDiff(h,t)}_updateDiff(h,t){try{this.style.setState(h,t)&&this._update(!0)}catch(n){c.warnOnce(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(h,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():c.warnOnce("There is no style added to the map.")}addSource(h,t){return this._lazyInitEmptyStyle(),this.style.addSource(h,t),this._update(!0)}isSourceLoaded(h){const t=this.style&&this.style.sourceCaches[h];if(t!==void 0)return t.loaded();this.fire(new c.ErrorEvent(new Error(`There is no source with ID '${h}'`)))}setTerrain(h){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),h){const t=this.style.sourceCaches[h.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${h.source}`);for(const n in this.style._layers){const a=this.style._layers[n];a.type==="hillshade"&&a.source===h.source&&c.warnOnce("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new ro(this.painter,t,h),this.painter.renderToTexture=new Cr(this.painter,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=n=>{n.dataType==="style"?this.terrain.sourceCache.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId!==h.source||this._elevationFreeze||(this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(n.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0;return this.fire(new c.Event("terrain",{terrain:h})),this}getTerrain(){var h,t;return(t=(h=this.terrain)===null||h===void 0?void 0:h.options)!==null&&t!==void 0?t:null}areTilesLoaded(){const h=this.style&&this.style.sourceCaches;for(const t in h){const n=h[t]._tiles;for(const a in n){const l=n[a];if(l.state!=="loaded"&&l.state!=="errored")return!1}}return!0}addSourceType(h,t,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(h,t,n)}removeSource(h){return this.style.removeSource(h),this._update(!0)}getSource(h){return this.style.getSource(h)}addImage(h,t,n={}){const{pixelRatio:a=1,sdf:l=!1,stretchX:d,stretchY:m,content:g}=n;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||c.isImageBitmap(t))){if(t.width===void 0||t.height===void 0)return this.fire(new c.ErrorEvent(new 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`")));{const{width:y,height:v,data:b}=t,T=t;return this.style.addImage(h,{data:new c.RGBAImage({width:y,height:v},new Uint8Array(b)),pixelRatio:a,stretchX:d,stretchY:m,content:g,sdf:l,version:0,userImage:T}),T.onAdd&&T.onAdd(this,h),this}}{const{width:y,height:v,data:b}=c.browser.getImageData(t);this.style.addImage(h,{data:new c.RGBAImage({width:y,height:v},b),pixelRatio:a,stretchX:d,stretchY:m,content:g,sdf:l,version:0})}}updateImage(h,t){const n=this.style.getImage(h);if(!n)return this.fire(new c.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const a=t instanceof HTMLImageElement||c.isImageBitmap(t)?c.browser.getImageData(t):t,{width:l,height:d,data:m}=a;if(l===void 0||d===void 0)return this.fire(new c.ErrorEvent(new 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(l!==n.data.width||d!==n.data.height)return this.fire(new c.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const g=!(t instanceof HTMLImageElement||c.isImageBitmap(t));return n.data.replace(m,g),this.style.updateImage(h,n),this}getImage(h){return this.style.getImage(h)}hasImage(h){return h?!!this.style.getImage(h):(this.fire(new c.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(h){this.style.removeImage(h)}loadImage(h,t){jt.getImage(this._requestManager.transformRequest(h,vt.Image),t)}listImages(){return this.style.listImages()}addLayer(h,t){return this._lazyInitEmptyStyle(),this.style.addLayer(h,t),this._update(!0)}moveLayer(h,t){return this.style.moveLayer(h,t),this._update(!0)}removeLayer(h){return this.style.removeLayer(h),this._update(!0)}getLayer(h){return this.style.getLayer(h)}setLayerZoomRange(h,t,n){return this.style.setLayerZoomRange(h,t,n),this._update(!0)}setFilter(h,t,n={}){return this.style.setFilter(h,t,n),this._update(!0)}getFilter(h){return this.style.getFilter(h)}setPaintProperty(h,t,n,a={}){return this.style.setPaintProperty(h,t,n,a),this._update(!0)}getPaintProperty(h,t){return this.style.getPaintProperty(h,t)}setLayoutProperty(h,t,n,a={}){return this.style.setLayoutProperty(h,t,n,a),this._update(!0)}getLayoutProperty(h,t){return this.style.getLayoutProperty(h,t)}setGlyphs(h,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(h,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(h,t,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(h,t,n,a=>{a||this._update(!0)}),this}removeSprite(h){return this._lazyInitEmptyStyle(),this.style.removeSprite(h),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(h,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(h,t,n=>{n||this._update(!0)}),this}setLight(h,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(h,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(h,t){return this.style.setFeatureState(h,t),this._update()}removeFeatureState(h,t){return this.style.removeFeatureState(h,t),this._update()}getFeatureState(h){return this.style.getFeatureState(h)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let h=0,t=0;return this._container&&(h=this._container.clientWidth||400,t=this._container.clientHeight||300),[h,t]}_setupContainer(){const h=this._container;h.classList.add("maplibregl-map");const t=this._canvasContainer=re.create("div","maplibregl-canvas-container",h);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=re.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const n=this._containerDimensions(),a=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],a);const l=this._controlContainer=re.create("div","maplibregl-control-container",h),d=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(m=>{d[m]=re.create("div",`maplibregl-ctrl-${m} `,l)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){this._cooperativeGesturesScreen=re.create("div","maplibregl-cooperative-gesture-screen",this._container);let h=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(h=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use ⌘ + scroll to zoom the map"),this._cooperativeGesturesScreen.innerHTML=` +`),N=g.createShader(g.FRAGMENT_SHADER);if(g.isContextLost())return void(this.failedToCreate=!0);if(g.shaderSource(N,H),g.compileShader(N),!g.getShaderParameter(N,g.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${g.getShaderInfoLog(N)}`);g.attachShader(this.program,N);const K=g.createShader(g.VERTEX_SHADER);if(g.isContextLost())return void(this.failedToCreate=!0);if(g.shaderSource(K,ne),g.compileShader(K),!g.getShaderParameter(K,g.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${g.getShaderInfoLog(K)}`);g.attachShader(this.program,K),this.attributes={};const ae={};this.numAttributes=b.length;for(let oe=0;oe({u_depth:new c.Uniform1i(oe,ce.u_depth),u_terrain:new c.Uniform1i(oe,ce.u_terrain),u_terrain_dim:new c.Uniform1f(oe,ce.u_terrain_dim),u_terrain_matrix:new c.UniformMatrix4f(oe,ce.u_terrain_matrix),u_terrain_unpack:new c.Uniform4f(oe,ce.u_terrain_unpack),u_terrain_exaggeration:new c.Uniform1f(oe,ce.u_terrain_exaggeration)}))(t,ae),this.binderUniforms=a?a.getUniforms(t,ae):[]}draw(t,n,a,l,d,m,g,y,v,b,T,C,L,D,F,k,H,ne){const N=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(a),t.setStencilMode(l),t.setColorMode(d),t.setCullFace(m),y){t.activeTexture.set(N.TEXTURE2),N.bindTexture(N.TEXTURE_2D,y.depthTexture),t.activeTexture.set(N.TEXTURE3),N.bindTexture(N.TEXTURE_2D,y.texture);for(const ae in this.terrainUniforms)this.terrainUniforms[ae].set(y[ae])}for(const ae in this.fixedUniforms)this.fixedUniforms[ae].set(g[ae]);F&&F.setUniforms(t,this.binderUniforms,L,{zoom:D});let K=0;switch(n){case N.LINES:K=2;break;case N.TRIANGLES:K=3;break;case N.LINE_STRIP:K=1}for(const ae of C.get()){const oe=ae.vaos||(ae.vaos={});(oe[v]||(oe[v]=new Ns)).bind(t,this,b,F?F.getPaintVertexBuffers():[],T,ae.vertexOffset,k,H,ne),N.drawElements(n,ae.primitiveLength*K,N.UNSIGNED_SHORT,ae.primitiveOffset*K*2)}}}function $s(h,t,n){const a=1/G(n,1,t.transform.tileZoom),l=Math.pow(2,n.tileID.overscaledZ),d=n.tileSize*Math.pow(2,t.transform.tileZoom)/l,m=d*(n.tileID.canonical.x+n.tileID.wrap*l),g=d*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[a,h.fromScale,h.toScale],u_fade:h.t,u_pixel_coord_upper:[m>>16,g>>16],u_pixel_coord_lower:[65535&m,65535&g]}}const ss=(h,t,n,a)=>{const l=t.style.light,d=l.properties.get("position"),m=[d.x,d.y,d.z],g=function(){var v=new c.ARRAY_TYPE(9);return c.ARRAY_TYPE!=Float32Array&&(v[1]=0,v[2]=0,v[3]=0,v[5]=0,v[6]=0,v[7]=0),v[0]=1,v[4]=1,v[8]=1,v}();l.properties.get("anchor")==="viewport"&&function(v,b){var T=Math.sin(b),C=Math.cos(b);v[0]=C,v[1]=T,v[2]=0,v[3]=-T,v[4]=C,v[5]=0,v[6]=0,v[7]=0,v[8]=1}(g,-t.transform.angle),function(v,b,T){var C=b[0],L=b[1],D=b[2];v[0]=C*T[0]+L*T[3]+D*T[6],v[1]=C*T[1]+L*T[4]+D*T[7],v[2]=C*T[2]+L*T[5]+D*T[8]}(m,m,g);const y=l.properties.get("color");return{u_matrix:h,u_lightpos:m,u_lightintensity:l.properties.get("intensity"),u_lightcolor:[y.r,y.g,y.b],u_vertical_gradient:+n,u_opacity:a}},Pl=(h,t,n,a,l,d,m)=>c.extend(ss(h,t,n,a),$s(d,t,m),{u_height_factor:-Math.pow(2,l.overscaledZ)/m.tileSize/8}),Do=h=>({u_matrix:h}),qs=(h,t,n,a)=>c.extend(Do(h),$s(n,t,a)),zl=(h,t)=>({u_matrix:h,u_world:t}),Lo=(h,t,n,a,l)=>c.extend(qs(h,t,n,a),{u_world:l}),kl=(h,t,n,a)=>{const l=h.transform;let d,m;if(a.paint.get("circle-pitch-alignment")==="map"){const g=G(n,1,l.zoom);d=!0,m=[g,g]}else d=!1,m=l.pixelsToGLUnits;return{u_camera_to_center_distance:l.cameraToCenterDistance,u_scale_with_map:+(a.paint.get("circle-pitch-scale")==="map"),u_matrix:h.translatePosMatrix(t.posMatrix,n,a.paint.get("circle-translate"),a.paint.get("circle-translate-anchor")),u_pitch_with_map:+d,u_device_pixel_ratio:h.pixelRatio,u_extrude_scale:m}},Bo=(h,t,n)=>{const a=G(n,1,t.zoom),l=Math.pow(2,t.zoom-n.tileID.overscaledZ),d=n.tileID.overscaleFactor();return{u_matrix:h,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:a,u_extrude_scale:[t.pixelsToGLUnits[0]/(a*l),t.pixelsToGLUnits[1]/(a*l)],u_overscale_factor:d}},Ro=(h,t,n=1)=>({u_matrix:h,u_color:t,u_overlay:0,u_overlay_scale:n}),Zs=h=>({u_matrix:h}),Fo=(h,t,n,a)=>({u_matrix:h,u_extrude_scale:G(t,1,n),u_intensity:a});function Oo(h,t){const n=Math.pow(2,t.canonical.z),a=t.canonical.y;return[new c.MercatorCoordinate(0,a/n).toLngLat().lat,new c.MercatorCoordinate(0,(a+1)/n).toLngLat().lat]}const js=(h,t,n,a)=>{const l=h.transform;return{u_matrix:as(h,t,n,a),u_ratio:1/G(t,1,l.zoom),u_device_pixel_ratio:h.pixelRatio,u_units_to_pixels:[1/l.pixelsToGLUnits[0],1/l.pixelsToGLUnits[1]]}},Uo=(h,t,n,a,l)=>c.extend(js(h,t,n,l),{u_image:0,u_image_height:a}),_n=(h,t,n,a,l)=>{const d=h.transform,m=qi(t,d);return{u_matrix:as(h,t,n,l),u_texsize:t.imageAtlasTexture.size,u_ratio:1/G(t,1,d.zoom),u_device_pixel_ratio:h.pixelRatio,u_image:0,u_scale:[m,a.fromScale,a.toScale],u_fade:a.t,u_units_to_pixels:[1/d.pixelsToGLUnits[0],1/d.pixelsToGLUnits[1]]}},Gs=(h,t,n,a,l,d)=>{const m=h.lineAtlas,g=qi(t,h.transform),y=n.layout.get("line-cap")==="round",v=m.getDash(a.from,y),b=m.getDash(a.to,y),T=v.width*l.fromScale,C=b.width*l.toScale;return c.extend(js(h,t,n,d),{u_patternscale_a:[g/T,-v.height/2],u_patternscale_b:[g/C,-b.height/2],u_sdfgamma:m.width/(256*Math.min(T,C)*h.pixelRatio)/2,u_image:0,u_tex_y_a:v.y,u_tex_y_b:b.y,u_mix:l.t})};function qi(h,t){return 1/G(h,1,t.tileZoom)}function as(h,t,n,a){return h.translatePosMatrix(a?a.posMatrix:t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const Xs=(h,t,n,a,l)=>{return{u_matrix:h,u_tl_parent:t,u_scale_parent:n,u_buffer_scale:1,u_fade_t:a.mix,u_opacity:a.opacity*l.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:l.paint.get("raster-brightness-min"),u_brightness_high:l.paint.get("raster-brightness-max"),u_saturation_factor:(m=l.paint.get("raster-saturation"),m>0?1-1/(1.001-m):-m),u_contrast_factor:(d=l.paint.get("raster-contrast"),d>0?1/(1-d):1+d),u_spin_weights:os(l.paint.get("raster-hue-rotate"))};var d,m};function os(h){h*=Math.PI/180;const t=Math.sin(h),n=Math.cos(h);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const ls=(h,t,n,a,l,d,m,g,y,v)=>{const b=l.transform;return{u_is_size_zoom_constant:+(h==="constant"||h==="source"),u_is_size_feature_constant:+(h==="constant"||h==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:b.cameraToCenterDistance,u_pitch:b.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:b.width/b.height,u_fade_change:l.options.fadeDuration?l.symbolFadeChange:1,u_matrix:d,u_label_plane_matrix:m,u_coord_matrix:g,u_is_text:+y,u_pitch_with_map:+a,u_texsize:v,u_texture:0}},cs=(h,t,n,a,l,d,m,g,y,v,b)=>{const T=l.transform;return c.extend(ls(h,t,n,a,l,d,m,g,y,v),{u_gamma_scale:a?Math.cos(T._pitch)*T.cameraToCenterDistance:1,u_device_pixel_ratio:l.pixelRatio,u_is_halo:+b})},hs=(h,t,n,a,l,d,m,g,y,v)=>c.extend(cs(h,t,n,a,l,d,m,g,!0,y,!0),{u_texsize_icon:v,u_texture_icon:1}),yn=(h,t,n)=>({u_matrix:h,u_opacity:t,u_color:n}),Ws=(h,t,n,a,l,d)=>c.extend(function(m,g,y,v){const b=y.imageManager.getPattern(m.from.toString()),T=y.imageManager.getPattern(m.to.toString()),{width:C,height:L}=y.imageManager.getPixelSize(),D=Math.pow(2,v.tileID.overscaledZ),F=v.tileSize*Math.pow(2,y.transform.tileZoom)/D,k=F*(v.tileID.canonical.x+v.tileID.wrap*D),H=F*v.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:b.tl,u_pattern_br_a:b.br,u_pattern_tl_b:T.tl,u_pattern_br_b:T.br,u_texsize:[C,L],u_mix:g.t,u_pattern_size_a:b.displaySize,u_pattern_size_b:T.displaySize,u_scale_a:g.fromScale,u_scale_b:g.toScale,u_tile_units_to_pixels:1/G(v,1,y.transform.tileZoom),u_pixel_coord_upper:[k>>16,H>>16],u_pixel_coord_lower:[65535&k,65535&H]}}(a,d,n,l),{u_matrix:h,u_opacity:t}),Zi={fillExtrusion:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_lightpos:new c.Uniform3f(h,t.u_lightpos),u_lightintensity:new c.Uniform1f(h,t.u_lightintensity),u_lightcolor:new c.Uniform3f(h,t.u_lightcolor),u_vertical_gradient:new c.Uniform1f(h,t.u_vertical_gradient),u_opacity:new c.Uniform1f(h,t.u_opacity)}),fillExtrusionPattern:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_lightpos:new c.Uniform3f(h,t.u_lightpos),u_lightintensity:new c.Uniform1f(h,t.u_lightintensity),u_lightcolor:new c.Uniform3f(h,t.u_lightcolor),u_vertical_gradient:new c.Uniform1f(h,t.u_vertical_gradient),u_height_factor:new c.Uniform1f(h,t.u_height_factor),u_image:new c.Uniform1i(h,t.u_image),u_texsize:new c.Uniform2f(h,t.u_texsize),u_pixel_coord_upper:new c.Uniform2f(h,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.Uniform2f(h,t.u_pixel_coord_lower),u_scale:new c.Uniform3f(h,t.u_scale),u_fade:new c.Uniform1f(h,t.u_fade),u_opacity:new c.Uniform1f(h,t.u_opacity)}),fill:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix)}),fillPattern:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_image:new c.Uniform1i(h,t.u_image),u_texsize:new c.Uniform2f(h,t.u_texsize),u_pixel_coord_upper:new c.Uniform2f(h,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.Uniform2f(h,t.u_pixel_coord_lower),u_scale:new c.Uniform3f(h,t.u_scale),u_fade:new c.Uniform1f(h,t.u_fade)}),fillOutline:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_world:new c.Uniform2f(h,t.u_world)}),fillOutlinePattern:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_world:new c.Uniform2f(h,t.u_world),u_image:new c.Uniform1i(h,t.u_image),u_texsize:new c.Uniform2f(h,t.u_texsize),u_pixel_coord_upper:new c.Uniform2f(h,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.Uniform2f(h,t.u_pixel_coord_lower),u_scale:new c.Uniform3f(h,t.u_scale),u_fade:new c.Uniform1f(h,t.u_fade)}),circle:(h,t)=>({u_camera_to_center_distance:new c.Uniform1f(h,t.u_camera_to_center_distance),u_scale_with_map:new c.Uniform1i(h,t.u_scale_with_map),u_pitch_with_map:new c.Uniform1i(h,t.u_pitch_with_map),u_extrude_scale:new c.Uniform2f(h,t.u_extrude_scale),u_device_pixel_ratio:new c.Uniform1f(h,t.u_device_pixel_ratio),u_matrix:new c.UniformMatrix4f(h,t.u_matrix)}),collisionBox:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_camera_to_center_distance:new c.Uniform1f(h,t.u_camera_to_center_distance),u_pixels_to_tile_units:new c.Uniform1f(h,t.u_pixels_to_tile_units),u_extrude_scale:new c.Uniform2f(h,t.u_extrude_scale),u_overscale_factor:new c.Uniform1f(h,t.u_overscale_factor)}),collisionCircle:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_inv_matrix:new c.UniformMatrix4f(h,t.u_inv_matrix),u_camera_to_center_distance:new c.Uniform1f(h,t.u_camera_to_center_distance),u_viewport_size:new c.Uniform2f(h,t.u_viewport_size)}),debug:(h,t)=>({u_color:new c.UniformColor(h,t.u_color),u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_overlay:new c.Uniform1i(h,t.u_overlay),u_overlay_scale:new c.Uniform1f(h,t.u_overlay_scale)}),clippingMask:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix)}),heatmap:(h,t)=>({u_extrude_scale:new c.Uniform1f(h,t.u_extrude_scale),u_intensity:new c.Uniform1f(h,t.u_intensity),u_matrix:new c.UniformMatrix4f(h,t.u_matrix)}),heatmapTexture:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_world:new c.Uniform2f(h,t.u_world),u_image:new c.Uniform1i(h,t.u_image),u_color_ramp:new c.Uniform1i(h,t.u_color_ramp),u_opacity:new c.Uniform1f(h,t.u_opacity)}),hillshade:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_image:new c.Uniform1i(h,t.u_image),u_latrange:new c.Uniform2f(h,t.u_latrange),u_light:new c.Uniform2f(h,t.u_light),u_shadow:new c.UniformColor(h,t.u_shadow),u_highlight:new c.UniformColor(h,t.u_highlight),u_accent:new c.UniformColor(h,t.u_accent)}),hillshadePrepare:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_image:new c.Uniform1i(h,t.u_image),u_dimension:new c.Uniform2f(h,t.u_dimension),u_zoom:new c.Uniform1f(h,t.u_zoom),u_unpack:new c.Uniform4f(h,t.u_unpack)}),line:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_ratio:new c.Uniform1f(h,t.u_ratio),u_device_pixel_ratio:new c.Uniform1f(h,t.u_device_pixel_ratio),u_units_to_pixels:new c.Uniform2f(h,t.u_units_to_pixels)}),lineGradient:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_ratio:new c.Uniform1f(h,t.u_ratio),u_device_pixel_ratio:new c.Uniform1f(h,t.u_device_pixel_ratio),u_units_to_pixels:new c.Uniform2f(h,t.u_units_to_pixels),u_image:new c.Uniform1i(h,t.u_image),u_image_height:new c.Uniform1f(h,t.u_image_height)}),linePattern:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_texsize:new c.Uniform2f(h,t.u_texsize),u_ratio:new c.Uniform1f(h,t.u_ratio),u_device_pixel_ratio:new c.Uniform1f(h,t.u_device_pixel_ratio),u_image:new c.Uniform1i(h,t.u_image),u_units_to_pixels:new c.Uniform2f(h,t.u_units_to_pixels),u_scale:new c.Uniform3f(h,t.u_scale),u_fade:new c.Uniform1f(h,t.u_fade)}),lineSDF:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_ratio:new c.Uniform1f(h,t.u_ratio),u_device_pixel_ratio:new c.Uniform1f(h,t.u_device_pixel_ratio),u_units_to_pixels:new c.Uniform2f(h,t.u_units_to_pixels),u_patternscale_a:new c.Uniform2f(h,t.u_patternscale_a),u_patternscale_b:new c.Uniform2f(h,t.u_patternscale_b),u_sdfgamma:new c.Uniform1f(h,t.u_sdfgamma),u_image:new c.Uniform1i(h,t.u_image),u_tex_y_a:new c.Uniform1f(h,t.u_tex_y_a),u_tex_y_b:new c.Uniform1f(h,t.u_tex_y_b),u_mix:new c.Uniform1f(h,t.u_mix)}),raster:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_tl_parent:new c.Uniform2f(h,t.u_tl_parent),u_scale_parent:new c.Uniform1f(h,t.u_scale_parent),u_buffer_scale:new c.Uniform1f(h,t.u_buffer_scale),u_fade_t:new c.Uniform1f(h,t.u_fade_t),u_opacity:new c.Uniform1f(h,t.u_opacity),u_image0:new c.Uniform1i(h,t.u_image0),u_image1:new c.Uniform1i(h,t.u_image1),u_brightness_low:new c.Uniform1f(h,t.u_brightness_low),u_brightness_high:new c.Uniform1f(h,t.u_brightness_high),u_saturation_factor:new c.Uniform1f(h,t.u_saturation_factor),u_contrast_factor:new c.Uniform1f(h,t.u_contrast_factor),u_spin_weights:new c.Uniform3f(h,t.u_spin_weights)}),symbolIcon:(h,t)=>({u_is_size_zoom_constant:new c.Uniform1i(h,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.Uniform1i(h,t.u_is_size_feature_constant),u_size_t:new c.Uniform1f(h,t.u_size_t),u_size:new c.Uniform1f(h,t.u_size),u_camera_to_center_distance:new c.Uniform1f(h,t.u_camera_to_center_distance),u_pitch:new c.Uniform1f(h,t.u_pitch),u_rotate_symbol:new c.Uniform1i(h,t.u_rotate_symbol),u_aspect_ratio:new c.Uniform1f(h,t.u_aspect_ratio),u_fade_change:new c.Uniform1f(h,t.u_fade_change),u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_label_plane_matrix:new c.UniformMatrix4f(h,t.u_label_plane_matrix),u_coord_matrix:new c.UniformMatrix4f(h,t.u_coord_matrix),u_is_text:new c.Uniform1i(h,t.u_is_text),u_pitch_with_map:new c.Uniform1i(h,t.u_pitch_with_map),u_texsize:new c.Uniform2f(h,t.u_texsize),u_texture:new c.Uniform1i(h,t.u_texture)}),symbolSDF:(h,t)=>({u_is_size_zoom_constant:new c.Uniform1i(h,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.Uniform1i(h,t.u_is_size_feature_constant),u_size_t:new c.Uniform1f(h,t.u_size_t),u_size:new c.Uniform1f(h,t.u_size),u_camera_to_center_distance:new c.Uniform1f(h,t.u_camera_to_center_distance),u_pitch:new c.Uniform1f(h,t.u_pitch),u_rotate_symbol:new c.Uniform1i(h,t.u_rotate_symbol),u_aspect_ratio:new c.Uniform1f(h,t.u_aspect_ratio),u_fade_change:new c.Uniform1f(h,t.u_fade_change),u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_label_plane_matrix:new c.UniformMatrix4f(h,t.u_label_plane_matrix),u_coord_matrix:new c.UniformMatrix4f(h,t.u_coord_matrix),u_is_text:new c.Uniform1i(h,t.u_is_text),u_pitch_with_map:new c.Uniform1i(h,t.u_pitch_with_map),u_texsize:new c.Uniform2f(h,t.u_texsize),u_texture:new c.Uniform1i(h,t.u_texture),u_gamma_scale:new c.Uniform1f(h,t.u_gamma_scale),u_device_pixel_ratio:new c.Uniform1f(h,t.u_device_pixel_ratio),u_is_halo:new c.Uniform1i(h,t.u_is_halo)}),symbolTextAndIcon:(h,t)=>({u_is_size_zoom_constant:new c.Uniform1i(h,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.Uniform1i(h,t.u_is_size_feature_constant),u_size_t:new c.Uniform1f(h,t.u_size_t),u_size:new c.Uniform1f(h,t.u_size),u_camera_to_center_distance:new c.Uniform1f(h,t.u_camera_to_center_distance),u_pitch:new c.Uniform1f(h,t.u_pitch),u_rotate_symbol:new c.Uniform1i(h,t.u_rotate_symbol),u_aspect_ratio:new c.Uniform1f(h,t.u_aspect_ratio),u_fade_change:new c.Uniform1f(h,t.u_fade_change),u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_label_plane_matrix:new c.UniformMatrix4f(h,t.u_label_plane_matrix),u_coord_matrix:new c.UniformMatrix4f(h,t.u_coord_matrix),u_is_text:new c.Uniform1i(h,t.u_is_text),u_pitch_with_map:new c.Uniform1i(h,t.u_pitch_with_map),u_texsize:new c.Uniform2f(h,t.u_texsize),u_texsize_icon:new c.Uniform2f(h,t.u_texsize_icon),u_texture:new c.Uniform1i(h,t.u_texture),u_texture_icon:new c.Uniform1i(h,t.u_texture_icon),u_gamma_scale:new c.Uniform1f(h,t.u_gamma_scale),u_device_pixel_ratio:new c.Uniform1f(h,t.u_device_pixel_ratio),u_is_halo:new c.Uniform1i(h,t.u_is_halo)}),background:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_opacity:new c.Uniform1f(h,t.u_opacity),u_color:new c.UniformColor(h,t.u_color)}),backgroundPattern:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_opacity:new c.Uniform1f(h,t.u_opacity),u_image:new c.Uniform1i(h,t.u_image),u_pattern_tl_a:new c.Uniform2f(h,t.u_pattern_tl_a),u_pattern_br_a:new c.Uniform2f(h,t.u_pattern_br_a),u_pattern_tl_b:new c.Uniform2f(h,t.u_pattern_tl_b),u_pattern_br_b:new c.Uniform2f(h,t.u_pattern_br_b),u_texsize:new c.Uniform2f(h,t.u_texsize),u_mix:new c.Uniform1f(h,t.u_mix),u_pattern_size_a:new c.Uniform2f(h,t.u_pattern_size_a),u_pattern_size_b:new c.Uniform2f(h,t.u_pattern_size_b),u_scale_a:new c.Uniform1f(h,t.u_scale_a),u_scale_b:new c.Uniform1f(h,t.u_scale_b),u_pixel_coord_upper:new c.Uniform2f(h,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.Uniform2f(h,t.u_pixel_coord_lower),u_tile_units_to_pixels:new c.Uniform1f(h,t.u_tile_units_to_pixels)}),terrain:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_texture:new c.Uniform1i(h,t.u_texture),u_ele_delta:new c.Uniform1f(h,t.u_ele_delta)}),terrainDepth:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_ele_delta:new c.Uniform1f(h,t.u_ele_delta)}),terrainCoords:(h,t)=>({u_matrix:new c.UniformMatrix4f(h,t.u_matrix),u_texture:new c.Uniform1i(h,t.u_texture),u_terrain_coords_id:new c.Uniform1f(h,t.u_terrain_coords_id),u_ele_delta:new c.Uniform1f(h,t.u_ele_delta)})};class ji{constructor(t,n,a){this.context=t;const l=t.gl;this.buffer=l.createBuffer(),this.dynamicDraw=!!a,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),l.bufferData(l.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?l.DYNAMIC_DRAW:l.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const n=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Da={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Hs{constructor(t,n,a,l){this.length=n.length,this.attributes=a,this.itemSize=n.bytesPerElement,this.dynamicDraw=l,this.context=t;const d=t.gl;this.buffer=d.createBuffer(),t.bindVertexBuffer.set(this.buffer),d.bufferData(d.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?d.DYNAMIC_DRAW:d.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(let a=0;a0){const xe=c.create(),Be=ce;c.mul(xe,oe.placementInvProjMatrix,h.transform.glCoordMatrix),c.mul(xe,xe,oe.placementViewportMatrix),b.push({circleArray:fe,circleOffset:C,transform:Be,invTransform:xe,coord:K}),T+=fe.length/4,C=T}_e&&v.draw(g,y.LINES,nt.disabled,wt.disabled,h.colorModeForRenderPass(),Tt.disabled,Bo(ce,h.transform,ae),h.style.map.terrain&&h.style.map.terrain.getTerrainData(K),n.id,_e.layoutVertexBuffer,_e.indexBuffer,_e.segments,null,h.transform.zoom,null,null,_e.collisionVertexBuffer)}if(!m||!b.length)return;const L=h.useProgram("collisionCircle"),D=new c.CollisionCircleLayoutArray;D.resize(4*T),D._trim();let F=0;for(const N of b)for(let K=0;K=0&&(D[k.associatedIconIndex]={shiftedAnchor:et,angle:Ee})}else z(k.numGlyphs,C)}if(v){L.clear();const F=h.icon.placedSymbolArray;for(let k=0;kh.style.map.terrain.getElevation(_e,_i,kt):null,Wt=n.layout.get("text-rotation-alignment")==="map";rn(xe,_e.posMatrix,h,l,Mr,mr,k,v,Wt,ii)}const cn=h.translatePosMatrix(_e.posMatrix,fe,d,m),$r=H||l&&oe||Xn?Na:Mr,qt=h.translatePosMatrix(mr,fe,d,m,!0),ti=Ee&&n.paint.get(l?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let gi;gi=Ee?xe.iconsInText?hs(Ne.kind,tt,ne,k,h,cn,$r,qt,it,ui):cs(Ne.kind,tt,ne,k,h,cn,$r,qt,l,it,!0):ls(Ne.kind,tt,ne,k,h,cn,$r,qt,l,it);const Wn={program:It,buffers:Be,uniformValues:gi,atlasTexture:zt,atlasTextureIcon:Rt,atlasInterpolation:ft,atlasInterpolationIcon:Xi,isSDF:Ee,hasHalo:ti};if(N&&xe.canOverlap){K=!0;const ii=Be.segments.get();for(const Wt of ii)ce.push({segments:new c.SegmentVector([Wt]),sortKey:Wt.sortKey,state:Wn,terrainData:$e})}else ce.push({segments:Be.segments,sortKey:0,state:Wn,terrainData:$e})}K&&ce.sort((_e,fe)=>_e.sortKey-fe.sortKey);for(const _e of ce){const fe=_e.state;if(C.activeTexture.set(L.TEXTURE0),fe.atlasTexture.bind(fe.atlasInterpolation,L.CLAMP_TO_EDGE),fe.atlasTextureIcon&&(C.activeTexture.set(L.TEXTURE1),fe.atlasTextureIcon&&fe.atlasTextureIcon.bind(fe.atlasInterpolationIcon,L.CLAMP_TO_EDGE)),fe.isSDF){const xe=fe.uniformValues;fe.hasHalo&&(xe.u_is_halo=1,ps(fe.buffers,_e.segments,n,h,fe.program,ae,b,T,xe,_e.terrainData)),xe.u_is_halo=0}ps(fe.buffers,_e.segments,n,h,fe.program,ae,b,T,fe.uniformValues,_e.terrainData)}}function ps(h,t,n,a,l,d,m,g,y,v){const b=a.context;l.draw(b,b.gl.TRIANGLES,d,m,g,Tt.disabled,y,v,n.id,h.layoutVertexBuffer,h.indexBuffer,t,n.paint,a.transform.zoom,h.programConfigurations.get(n.id),h.dynamicLayoutVertexBuffer,h.opacityVertexBuffer)}function ta(h,t,n,a,l){if(!n||!a||!a.imageAtlas)return;const d=a.imageAtlas.patternPositions;let m=d[n.to.toString()],g=d[n.from.toString()];if(!m||!g){const y=l.getPaintProperty(t);m=d[y],g=d[y]}m&&g&&h.setConstantPatternPositions(m,g)}function Za(h,t,n,a,l,d,m){const g=h.context.gl,y="fill-pattern",v=n.paint.get(y),b=v&&v.constantOr(1),T=n.getCrossfadeParameters();let C,L,D,F,k;m?(L=b&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",C=g.LINES):(L=b?"fillPattern":"fill",C=g.TRIANGLES);const H=v.constantOr(null);for(const ne of a){const N=t.getTile(ne);if(b&&!N.patternsLoaded())continue;const K=N.getBucket(n);if(!K)continue;const ae=K.programConfigurations.get(n.id),oe=h.useProgram(L,ae),ce=h.style.map.terrain&&h.style.map.terrain.getTerrainData(ne);b&&(h.context.activeTexture.set(g.TEXTURE0),N.imageAtlasTexture.bind(g.LINEAR,g.CLAMP_TO_EDGE),ae.updatePaintBuffers(T)),ta(ae,y,H,N,n);const _e=ce?ne:null,fe=h.translatePosMatrix(_e?_e.posMatrix:ne.posMatrix,N,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(m){F=K.indexBuffer2,k=K.segments2;const xe=[g.drawingBufferWidth,g.drawingBufferHeight];D=L==="fillOutlinePattern"&&b?Lo(fe,h,T,N,xe):zl(fe,xe)}else F=K.indexBuffer,k=K.segments,D=b?qs(fe,h,T,N):Do(fe);oe.draw(h.context,C,l,h.stencilModeForClipping(ne),d,Tt.disabled,D,ce,n.id,K.layoutVertexBuffer,F,k,n.paint,h.transform.zoom,ae)}}function ia(h,t,n,a,l,d,m){const g=h.context,y=g.gl,v="fill-extrusion-pattern",b=n.paint.get(v),T=b.constantOr(1),C=n.getCrossfadeParameters(),L=n.paint.get("fill-extrusion-opacity"),D=b.constantOr(null);for(const F of a){const k=t.getTile(F),H=k.getBucket(n);if(!H)continue;const ne=h.style.map.terrain&&h.style.map.terrain.getTerrainData(F),N=H.programConfigurations.get(n.id),K=h.useProgram(T?"fillExtrusionPattern":"fillExtrusion",N);T&&(h.context.activeTexture.set(y.TEXTURE0),k.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),N.updatePaintBuffers(C)),ta(N,v,D,k,n);const ae=h.translatePosMatrix(F.posMatrix,k,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),oe=n.paint.get("fill-extrusion-vertical-gradient"),ce=T?Pl(ae,h,oe,L,F,C,k):ss(ae,h,oe,L);K.draw(g,g.gl.TRIANGLES,l,d,m,Tt.backCCW,ce,ne,n.id,H.layoutVertexBuffer,H.indexBuffer,H.segments,n.paint,h.transform.zoom,N,h.style.map.terrain&&H.centroidVertexBuffer)}}function ra(h,t,n,a,l,d,m){const g=h.context,y=g.gl,v=n.fbo;if(!v)return;const b=h.useProgram("hillshade"),T=h.style.map.terrain&&h.style.map.terrain.getTerrainData(t);g.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,v.colorAttachment.get()),b.draw(g,y.TRIANGLES,l,d,m,Tt.disabled,((C,L,D,F)=>{const k=D.paint.get("hillshade-shadow-color"),H=D.paint.get("hillshade-highlight-color"),ne=D.paint.get("hillshade-accent-color");let N=D.paint.get("hillshade-illumination-direction")*(Math.PI/180);D.paint.get("hillshade-illumination-anchor")==="viewport"&&(N-=C.transform.angle);const K=!C.options.moving;return{u_matrix:F?F.posMatrix:C.transform.calculatePosMatrix(L.tileID.toUnwrapped(),K),u_image:0,u_latrange:Oo(0,L.tileID),u_light:[D.paint.get("hillshade-exaggeration"),N],u_shadow:k,u_highlight:H,u_accent:ne}})(h,n,a,T?t:null),T,a.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments)}function ja(h,t,n,a,l,d){const m=h.context,g=m.gl,y=t.dem;if(y&&y.data){const v=y.dim,b=y.stride,T=y.getPixels();if(m.activeTexture.set(g.TEXTURE1),m.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||h.getTileTexture(b),t.demTexture){const L=t.demTexture;L.update(T,{premultiply:!1}),L.bind(g.NEAREST,g.CLAMP_TO_EDGE)}else t.demTexture=new Je(m,T,g.RGBA,{premultiply:!1}),t.demTexture.bind(g.NEAREST,g.CLAMP_TO_EDGE);m.activeTexture.set(g.TEXTURE0);let C=t.fbo;if(!C){const L=new Je(m,{width:v,height:v,data:null},g.RGBA);L.bind(g.LINEAR,g.CLAMP_TO_EDGE),C=t.fbo=m.createFramebuffer(v,v,!0,!1),C.colorAttachment.set(L.texture)}m.bindFramebuffer.set(C.framebuffer),m.viewport.set([0,0,v,v]),h.useProgram("hillshadePrepare").draw(m,g.TRIANGLES,a,l,d,Tt.disabled,((L,D)=>{const F=D.stride,k=c.create();return c.ortho(k,0,c.EXTENT,-c.EXTENT,0,0,1),c.translate(k,k,[0,-c.EXTENT,0]),{u_matrix:k,u_image:1,u_dimension:[F,F],u_zoom:L.overscaledZ,u_unpack:D.getUnpackVector()}})(t.tileID,y),null,n.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function jl(h,t,n,a,l,d){const m=a.paint.get("raster-fade-duration");if(!d&&m>0){const g=c.browser.now(),y=(g-h.timeAdded)/m,v=t?(g-t.timeAdded)/m:-1,b=n.getSource(),T=l.coveringZoomLevel({tileSize:b.tileSize,roundZoom:b.roundZoom}),C=!t||Math.abs(t.tileID.overscaledZ-T)>Math.abs(h.tileID.overscaledZ-T),L=C&&h.refreshedUponExpiration?1:c.clamp(C?y:1-v,0,1);return h.refreshedUponExpiration&&y>=1&&(h.refreshedUponExpiration=!1),t?{opacity:1,mix:1-L}:{opacity:L,mix:0}}return{opacity:1,mix:0}}const Wo=new c.Color(1,0,0,1),Nt=new c.Color(0,1,0,1),wn=new c.Color(0,0,1,1),rr=new c.Color(1,0,1,1),Ga=new c.Color(0,1,1,1);function na(h,t,n,a){Vr(h,0,t+n/2,h.transform.width,n,a)}function Xa(h,t,n,a){Vr(h,t-n/2,0,n,h.transform.height,a)}function Vr(h,t,n,a,l,d){const m=h.context,g=m.gl;g.enable(g.SCISSOR_TEST),g.scissor(t*h.pixelRatio,n*h.pixelRatio,a*h.pixelRatio,l*h.pixelRatio),m.clear({color:d}),g.disable(g.SCISSOR_TEST)}function fs(h,t,n){const a=h.context,l=a.gl,d=n.posMatrix,m=h.useProgram("debug"),g=nt.disabled,y=wt.disabled,v=h.colorModeForRenderPass(),b="$debug",T=h.style.map.terrain&&h.style.map.terrain.getTerrainData(n);a.activeTexture.set(l.TEXTURE0);const C=t.getTileByID(n.key).latestRawTileData,L=Math.floor((C&&C.byteLength||0)/1024),D=t.getTile(n).tileSize,F=512/Math.min(D,512)*(n.overscaledZ/h.transform.zoom)*.5;let k=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(k+=` => ${n.overscaledZ}`),function(H,ne){H.initDebugOverlayCanvas();const N=H.debugOverlayCanvas,K=H.context.gl,ae=H.debugOverlayCanvas.getContext("2d");ae.clearRect(0,0,N.width,N.height),ae.shadowColor="white",ae.shadowBlur=2,ae.lineWidth=1.5,ae.strokeStyle="white",ae.textBaseline="top",ae.font="bold 36px Open Sans, sans-serif",ae.fillText(ne,5,5),ae.strokeText(ne,5,5),H.debugOverlayTexture.update(N),H.debugOverlayTexture.bind(K.LINEAR,K.CLAMP_TO_EDGE)}(h,`${k} ${L}kB`),m.draw(a,l.TRIANGLES,g,y,Lt.alphaBlended,Tt.disabled,Ro(d,c.Color.transparent,F),null,b,h.debugBuffer,h.quadTriangleIndexBuffer,h.debugSegments),m.draw(a,l.LINE_STRIP,g,y,v,Tt.disabled,Ro(d,c.Color.red),T,b,h.debugBuffer,h.tileBorderIndexBuffer,h.debugSegments)}function sa(h,t,n){const a=h.context,l=a.gl,d=h.colorModeForRenderPass(),m=new nt(l.LEQUAL,nt.ReadWrite,h.depthRangeFor3D),g=h.useProgram("terrain"),y=t.getTerrainMesh();a.bindFramebuffer.set(null),a.viewport.set([0,0,h.width,h.height]);for(const v of n){const b=h.renderToTexture.getTexture(v),T=t.getTerrainData(v.tileID);a.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,b.texture);const C={u_matrix:h.transform.calculatePosMatrix(v.tileID.toUnwrapped()),u_texture:0,u_ele_delta:t.getMeshFrameDelta(h.transform.zoom)};g.draw(a,l.TRIANGLES,m,wt.disabled,d,Tt.backCCW,C,T,"terrain",y.vertexBuffer,y.indexBuffer,y.segments)}}class Ho{constructor(t,n){this.context=new ea(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.create(),renderTime:0},this.setup(),this.numSublayers=Dt.maxUnderzooming+Dt.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Ut}resize(t,n,a){if(this.width=Math.floor(t*a),this.height=Math.floor(n*a),this.pixelRatio=a,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const l of this.style._order)this.style._layers[l].resize()}setup(){const t=this.context,n=new c.PosArray;n.emplaceBack(0,0),n.emplaceBack(c.EXTENT,0),n.emplaceBack(0,c.EXTENT),n.emplaceBack(c.EXTENT,c.EXTENT),this.tileExtentBuffer=t.createVertexBuffer(n,Vs.members),this.tileExtentSegments=c.SegmentVector.simpleSegment(0,0,4,2);const a=new c.PosArray;a.emplaceBack(0,0),a.emplaceBack(c.EXTENT,0),a.emplaceBack(0,c.EXTENT),a.emplaceBack(c.EXTENT,c.EXTENT),this.debugBuffer=t.createVertexBuffer(a,Vs.members),this.debugSegments=c.SegmentVector.simpleSegment(0,0,4,5);const l=new c.RasterBoundsArray;l.emplaceBack(0,0,0,0),l.emplaceBack(c.EXTENT,0,c.EXTENT,0),l.emplaceBack(0,c.EXTENT,0,c.EXTENT),l.emplaceBack(c.EXTENT,c.EXTENT,c.EXTENT,c.EXTENT),this.rasterBoundsBuffer=t.createVertexBuffer(l,Ii.members),this.rasterBoundsSegments=c.SegmentVector.simpleSegment(0,0,4,2);const d=new c.PosArray;d.emplaceBack(0,0),d.emplaceBack(1,0),d.emplaceBack(0,1),d.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(d,Vs.members),this.viewportSegments=c.SegmentVector.simpleSegment(0,0,4,2);const m=new c.LineStripIndexArray;m.emplaceBack(0),m.emplaceBack(1),m.emplaceBack(3),m.emplaceBack(2),m.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(m);const g=new c.TriangleIndexArray;g.emplaceBack(0,1,2),g.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(g);const y=this.context.gl;this.stencilClearMode=new wt({func:y.ALWAYS,mask:0},0,255,y.ZERO,y.ZERO,y.ZERO)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const a=c.create();c.ortho(a,0,this.width,this.height,0,0,1),c.scale(a,a,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,n.TRIANGLES,nt.disabled,this.stencilClearMode,Lt.disabled,Tt.disabled,Zs(a),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,n){if(this.currentStencilSource===t.source||!t.isTileClipped()||!n||!n.length)return;this.currentStencilSource=t.source;const a=this.context,l=a.gl;this.nextStencilID+n.length>256&&this.clearStencil(),a.setColorMode(Lt.disabled),a.setDepthMode(nt.disabled);const d=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const m of n){const g=this._tileClippingMaskIDs[m.key]=this.nextStencilID++,y=this.style.map.terrain&&this.style.map.terrain.getTerrainData(m);d.draw(a,l.TRIANGLES,nt.disabled,new wt({func:l.ALWAYS,mask:0},g,255,l.KEEP,l.KEEP,l.REPLACE),Lt.disabled,Tt.disabled,Zs(m.posMatrix),y,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new wt({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new wt({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,a=t.sort((m,g)=>g.overscaledZ-m.overscaledZ),l=a[a.length-1].overscaledZ,d=a[0].overscaledZ-l+1;if(d>1){this.currentStencilSource=void 0,this.nextStencilID+d>256&&this.clearStencil();const m={};for(let g=0;g=0;this.currentLayer--){const y=this.style._layers[a[this.currentLayer]],v=l[y.source],b=d[y.source];this._renderTileClippingMasks(y,b),this.renderLayer(this,v,y,b)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerk.source&&!k.isHidden(b)?[v.sourceCaches[k.source]]:[]),L=C.filter(k=>k.getSource().type==="vector"),D=C.filter(k=>k.getSource().type!=="vector"),F=k=>{(!T||T.getSource().maxzoomF(k)),T||D.forEach(k=>F(k)),T}(this.style,this.transform.zoom);y&&function(v,b,T){for(let C=0;CL.style.map.terrain.getElevation(oe,Ne,ke):null)}}}(y,d,g,m,g.layout.get("text-rotation-alignment"),g.layout.get("text-pitch-alignment"),v),g.paint.get("icon-opacity").constantOr(1)!==0&&qa(d,m,g,y,!1,g.paint.get("icon-translate"),g.paint.get("icon-translate-anchor"),g.layout.get("icon-rotation-alignment"),g.layout.get("icon-pitch-alignment"),g.layout.get("icon-keep-upright"),b,T),g.paint.get("text-opacity").constantOr(1)!==0&&qa(d,m,g,y,!0,g.paint.get("text-translate"),g.paint.get("text-translate-anchor"),g.layout.get("text-rotation-alignment"),g.layout.get("text-pitch-alignment"),g.layout.get("text-keep-upright"),b,T),m.map.showCollisionBoxes&&(ds(d,m,g,y,g.paint.get("text-translate"),g.paint.get("text-translate-anchor"),!0),ds(d,m,g,y,g.paint.get("icon-translate"),g.paint.get("icon-translate-anchor"),!1))})(t,n,a,l,this.style.placement.variableOffsets);break;case"circle":(function(d,m,g,y){if(d.renderPass!=="translucent")return;const v=g.paint.get("circle-opacity"),b=g.paint.get("circle-stroke-width"),T=g.paint.get("circle-stroke-opacity"),C=!g.layout.get("circle-sort-key").isConstant();if(v.constantOr(1)===0&&(b.constantOr(1)===0||T.constantOr(1)===0))return;const L=d.context,D=L.gl,F=d.depthModeForSublayer(0,nt.ReadOnly),k=wt.disabled,H=d.colorModeForRenderPass(),ne=[];for(let N=0;NN.sortKey-K.sortKey);for(const N of ne){const{programConfiguration:K,program:ae,layoutVertexBuffer:oe,indexBuffer:ce,uniformValues:_e,terrainData:fe}=N.state;ae.draw(L,D.TRIANGLES,F,k,H,Tt.disabled,_e,fe,g.id,oe,ce,N.segments,g.paint,d.transform.zoom,K)}})(t,n,a,l);break;case"heatmap":(function(d,m,g,y){if(g.paint.get("heatmap-opacity")!==0)if(d.renderPass==="offscreen"){const v=d.context,b=v.gl,T=wt.disabled,C=new Lt([b.ONE,b.ONE],c.Color.transparent,[!0,!0,!0,!0]);(function(L,D,F){const k=L.gl;L.activeTexture.set(k.TEXTURE1),L.viewport.set([0,0,D.width/4,D.height/4]);let H=F.heatmapFbo;if(H)k.bindTexture(k.TEXTURE_2D,H.colorAttachment.get()),L.bindFramebuffer.set(H.framebuffer);else{const ne=k.createTexture();k.bindTexture(k.TEXTURE_2D,ne),k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE),k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE),k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,k.LINEAR),k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,k.LINEAR),H=F.heatmapFbo=L.createFramebuffer(D.width/4,D.height/4,!1,!1),function(N,K,ae,oe){var ce,_e;const fe=N.gl,xe=(ce=N.HALF_FLOAT)!==null&&ce!==void 0?ce:fe.UNSIGNED_BYTE,Be=(_e=N.RGBA16F)!==null&&_e!==void 0?_e:fe.RGBA;fe.texImage2D(fe.TEXTURE_2D,0,Be,K.width/4,K.height/4,0,fe.RGBA,xe,null),oe.colorAttachment.set(ae)}(L,D,ne,H)}})(v,d,g),v.clear({color:c.Color.transparent});for(let L=0;L{const N=c.create();c.ortho(N,0,F.width,F.height,0,0,1);const K=F.context.gl;return{u_matrix:N,u_world:[K.drawingBufferWidth,K.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:k.paint.get("heatmap-opacity")}})(v,b),null,b.id,v.viewportBuffer,v.quadTriangleIndexBuffer,v.viewportSegments,b.paint,v.transform.zoom)}(d,g))})(t,n,a,l);break;case"line":(function(d,m,g,y){if(d.renderPass!=="translucent")return;const v=g.paint.get("line-opacity"),b=g.paint.get("line-width");if(v.constantOr(1)===0||b.constantOr(1)===0)return;const T=d.depthModeForSublayer(0,nt.ReadOnly),C=d.colorModeForRenderPass(),L=g.paint.get("line-dasharray"),D=g.paint.get("line-pattern"),F=D.constantOr(1),k=g.paint.get("line-gradient"),H=g.getCrossfadeParameters(),ne=F?"linePattern":L?"lineSDF":k?"lineGradient":"line",N=d.context,K=N.gl;let ae=!0;for(const oe of y){const ce=m.getTile(oe);if(F&&!ce.patternsLoaded())continue;const _e=ce.getBucket(g);if(!_e)continue;const fe=_e.programConfigurations.get(g.id),xe=d.context.program.get(),Be=d.useProgram(ne,fe),et=ae||Be.program!==xe,Ee=d.style.map.terrain&&d.style.map.terrain.getTerrainData(oe),Ne=D.constantOr(null);if(Ne&&ce.imageAtlas){const tt=ce.imageAtlas,$e=tt.patternPositions[Ne.to.toString()],it=tt.patternPositions[Ne.from.toString()];$e&&it&&fe.setConstantPatternPositions($e,it)}const ke=Ee?oe:null,It=F?_n(d,ce,g,H,ke):L?Gs(d,ce,g,L,H,ke):k?Uo(d,ce,g,_e.lineClipsArray.length,ke):js(d,ce,g,ke);if(F)N.activeTexture.set(K.TEXTURE0),ce.imageAtlasTexture.bind(K.LINEAR,K.CLAMP_TO_EDGE),fe.updatePaintBuffers(H);else if(L&&(et||d.lineAtlas.dirty))N.activeTexture.set(K.TEXTURE0),d.lineAtlas.bind(N);else if(k){const tt=_e.gradients[g.id];let $e=tt.texture;if(g.gradientVersion!==tt.version){let it=256;if(g.stepInterpolant){const zt=m.getSource().maxzoom,ft=oe.canonical.z===zt?Math.ceil(1<0?n.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const n=this.imageManager.getPattern(t.from.toString()),a=this.imageManager.getPattern(t.to.toString());return!n||!a}useProgram(t,n){this.cache=this.cache||{};const a=t+(n?n.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[a]||(this.cache[a]=new an(this.context,ns[t],n,Zi[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[a]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const 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(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Je(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:n}=this.context.gl;return this.width!==t||this.height!==n}}class aa{constructor(t,n){this.points=t,this.planes=n}static fromInvProjectionMatrix(t,n,a){const l=Math.pow(2,a),d=[[-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(g=>{const y=1/(g=c.transformMat4([],g,t))[3]/n*l;return c.mul$1(g,g,[y,y,1/g[3],y])}),m=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(g=>{const y=function(C,L){var D=L[0],F=L[1],k=L[2],H=D*D+F*F+k*k;return H>0&&(H=1/Math.sqrt(H)),C[0]=L[0]*H,C[1]=L[1]*H,C[2]=L[2]*H,C}([],function(C,L,D){var F=L[0],k=L[1],H=L[2],ne=D[0],N=D[1],K=D[2];return C[0]=k*K-H*N,C[1]=H*ne-F*K,C[2]=F*N-k*ne,C}([],Jr([],d[g[0]],d[g[1]]),Jr([],d[g[2]],d[g[1]]))),v=-((b=y)[0]*(T=d[g[1]])[0]+b[1]*T[1]+b[2]*T[2]);var b,T;return y.concat(v)});return new aa(d,m)}}class ms{constructor(t,n){this.min=t,this.max=n,this.center=function(a,l,d){return a[0]=.5*l[0],a[1]=.5*l[1],a[2]=.5*l[2],a}([],function(a,l,d){return a[0]=l[0]+d[0],a[1]=l[1]+d[1],a[2]=l[2]+d[2],a}([],this.min,this.max))}quadrant(t){const n=[t%2==0,t<2],a=Yr(this.min),l=Yr(this.max);for(let d=0;d=0&&m++;if(m===0)return 0;m!==n.length&&(a=!1)}if(a)return 2;for(let l=0;l<3;l++){let d=Number.MAX_VALUE,m=-Number.MAX_VALUE;for(let g=0;gthis.max[l]-this.min[l])return 0}return 1}}class oa{constructor(t=0,n=0,a=0,l=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(a)||a<0||isNaN(l)||l<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=a,this.right=l}interpolate(t,n,a){return n.top!=null&&t.top!=null&&(this.top=c.interpolate.number(t.top,n.top,a)),n.bottom!=null&&t.bottom!=null&&(this.bottom=c.interpolate.number(t.bottom,n.bottom,a)),n.left!=null&&t.left!=null&&(this.left=c.interpolate.number(t.left,n.left,a)),n.right!=null&&t.right!=null&&(this.right=c.interpolate.number(t.right,n.right,a)),this}getCenter(t,n){const a=c.clamp((this.left+t-this.right)/2,0,t),l=c.clamp((this.top+n-this.bottom)/2,0,n);return new c.Point(a,l)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new oa(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class la{constructor(t,n,a,l,d){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=d===void 0||!!d,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=a??0,this._maxPitch=l??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new c.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new oa,this._posMatrixCache={},this._alignedPosMatrixCache={},this._minEleveationForCurrentTile=0}clone(){const t=new la(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this._minEleveationForCurrentTile=t._minEleveationForCurrentTile,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new c.Point(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const n=-c.wrap(t,-180,180)*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=function(){var a=new c.ARRAY_TYPE(4);return c.ARRAY_TYPE!=Float32Array&&(a[1]=0,a[2]=0),a[0]=1,a[3]=1,a}(),function(a,l,d){var m=l[0],g=l[1],y=l[2],v=l[3],b=Math.sin(d),T=Math.cos(d);a[0]=m*T+y*b,a[1]=g*T+v*b,a[2]=m*-b+y*T,a[3]=g*-b+v*T}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=c.clamp(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const n=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this.tileZoom=Math.max(0,Math.floor(n)),this.scale=this.zoomScale(n),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(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)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,a){this._unmodified=!1,this._edgeInsets.interpolate(t,n,a),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const n=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(t){const n=[new c.UnwrappedTileID(0,t)];if(this._renderWorldCopies){const a=this.pointCoordinate(new c.Point(0,0)),l=this.pointCoordinate(new c.Point(this.width,0)),d=this.pointCoordinate(new c.Point(this.width,this.height)),m=this.pointCoordinate(new c.Point(0,this.height)),g=Math.floor(Math.min(a.x,l.x,d.x,m.x)),y=Math.floor(Math.max(a.x,l.x,d.x,m.x)),v=1;for(let b=g-v;b<=y+v;b++)b!==0&&n.push(new c.UnwrappedTileID(b,t))}return n}coveringTiles(t){var n,a;let l=this.coveringZoomLevel(t);const d=l;if(t.minzoom!==void 0&&lt.maxzoom&&(l=t.maxzoom);const m=this.pointCoordinate(this.getCameraPoint()),g=c.MercatorCoordinate.fromLngLat(this.center),y=Math.pow(2,l),v=[y*m.x,y*m.y,0],b=[y*g.x,y*g.y,0],T=aa.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,l);let C=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(C=l);const L=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,D=N=>({aabb:new ms([N*y,0,0],[(N+1)*y,y,0]),zoom:0,x:0,y:0,wrap:N,fullyVisible:!1}),F=[],k=[],H=l,ne=t.reparseOverscaled?d:l;if(this._renderWorldCopies)for(let N=1;N<=3;N++)F.push(D(-N)),F.push(D(N));for(F.push(D(0));F.length>0;){const N=F.pop(),K=N.x,ae=N.y;let oe=N.fullyVisible;if(!oe){const Be=N.aabb.intersects(T);if(Be===0)continue;oe=Be===2}const ce=t.terrain?v:b,_e=N.aabb.distanceX(ce),fe=N.aabb.distanceY(ce),xe=Math.max(Math.abs(_e),Math.abs(fe));if(N.zoom===H||xe>L+(1<=C){const Be=H-N.zoom,et=v[0]-.5-(K<>1),Ne=N.zoom+1;let ke=N.aabb.quadrant(Be);if(t.terrain){const It=new c.OverscaledTileID(Ne,N.wrap,Ne,et,Ee),tt=t.terrain.getMinMaxElevation(It),$e=(n=tt.minElevation)!==null&&n!==void 0?n:this.elevation,it=(a=tt.maxElevation)!==null&&a!==void 0?a:this.elevation;ke=new ms([ke.min[0],ke.min[1],$e],[ke.max[0],ke.max[1],it])}F.push({aabb:ke,zoom:Ne,x:et,y:Ee,wrap:N.wrap,fullyVisible:oe})}}return k.sort((N,K)=>N.distanceSq-K.distanceSq).map(N=>N.tileID)}resize(t,n){this.width=t,this.height=n,this.pixelsToGLUnits=[2/t,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const n=c.clamp(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new c.Point(c.mercatorXfromLng(t.lng)*this.worldSize,c.mercatorYfromLat(n)*this.worldSize)}unproject(t){return new c.MercatorCoordinate(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const n=this.pointLocation(this.centerPoint,t),a=t.getElevationForLngLatZoom(n,this.tileZoom);if(!(this.elevation-a))return;const l=this.getCameraPosition(),d=c.MercatorCoordinate.fromLngLat(l.lngLat,l.altitude),m=c.MercatorCoordinate.fromLngLat(n,a),g=d.x-m.x,y=d.y-m.y,v=d.z-m.z,b=Math.sqrt(g*g+y*y+v*v),T=this.scaleZoom(this.cameraToCenterDistance/b/this.tileSize);this._elevation=a,this._center=n,this.zoom=T}setLocationAtPoint(t,n){const a=this.pointCoordinate(n),l=this.pointCoordinate(this.centerPoint),d=this.locationCoordinate(t),m=new c.MercatorCoordinate(d.x-(a.x-l.x),d.y-(a.y-l.y));this.center=this.coordinateLocation(m),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,n){return n?this.coordinatePoint(this.locationCoordinate(t),n.getElevationForLngLatZoom(t,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,n){return this.coordinateLocation(this.pointCoordinate(t,n))}locationCoordinate(t){return c.MercatorCoordinate.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,n){if(n){const C=n.pointCoordinate(t);if(C!=null)return C}const a=[t.x,t.y,0,1],l=[t.x,t.y,1,1];c.transformMat4(a,a,this.pixelMatrixInverse),c.transformMat4(l,l,this.pixelMatrixInverse);const d=a[3],m=l[3],g=a[1]/d,y=l[1]/m,v=a[2]/d,b=l[2]/m,T=v===b?0:(0-v)/(b-v);return new c.MercatorCoordinate(c.interpolate.number(a[0]/d,l[0]/m,T)/this.worldSize,c.interpolate.number(g,y,T)/this.worldSize)}coordinatePoint(t,n=0,a=this.pixelMatrix){const l=[t.x*this.worldSize,t.y*this.worldSize,n,1];return c.transformMat4(l,l,a),new c.Point(l[0]/l[3],l[1]/l[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new mt().extend(this.pointLocation(new c.Point(0,t))).extend(this.pointLocation(new c.Point(this.width,t))).extend(this.pointLocation(new c.Point(this.width,this.height))).extend(this.pointLocation(new c.Point(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new mt([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(t,n=!1){const a=t.key,l=n?this._alignedPosMatrixCache:this._posMatrixCache;if(l[a])return l[a];const d=t.canonical,m=this.worldSize/this.zoomScale(d.z),g=d.x+Math.pow(2,d.z)*t.wrap,y=c.identity(new Float64Array(16));return c.translate(y,y,[g*m,d.y*m,0]),c.scale(y,y,[m/c.EXTENT,m/c.EXTENT,1]),c.multiply(y,n?this.alignedProjMatrix:this.projMatrix,y),l[a]=new Float32Array(y),l[a]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let t,n,a,l,d=-90,m=90,g=-180,y=180;const v=this.size,b=this._unmodified;if(this.latRange){const L=this.latRange;d=c.mercatorYfromLat(L[1])*this.worldSize,m=c.mercatorYfromLat(L[0])*this.worldSize,t=m-dm&&(l=m-D)}if(this.lngRange){const L=(g+y)/2,D=c.wrap(T.x,L-this.worldSize/2,L+this.worldSize/2),F=v.x/2;D-Fy&&(a=y-F)}a===void 0&&l===void 0||(this.center=this.unproject(new c.Point(a!==void 0?a:T.x,l!==void 0?l:T.y)).wrap()),this._unmodified=b,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.point.x,a=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=c.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let l=c.identity(new Float64Array(16));c.scale(l,l,[this.width/2,-this.height/2,1]),c.translate(l,l,[1,-1,0]),this.labelPlaneMatrix=l,l=c.identity(new Float64Array(16)),c.scale(l,l,[1,-1,1]),c.translate(l,l,[-1,-1,0]),c.scale(l,l,[2/this.width,2/this.height,1]),this.glCoordMatrix=l;const d=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),m=Math.min(this.elevation,this._minEleveationForCurrentTile),g=d-m*this._pixelPerMeter/Math.cos(this._pitch),y=m<0?g:d,v=Math.PI/2+this._pitch,b=this._fov*(.5+t.y/this.height),T=Math.sin(b)*y/Math.sin(c.clamp(Math.PI-v-b,.01,Math.PI-.01)),C=this.getHorizon(),L=2*Math.atan(C/this.cameraToCenterDistance)*(.5+t.y/(2*C)),D=Math.sin(L)*y/Math.sin(c.clamp(Math.PI-v-L,.01,Math.PI-.01)),F=Math.min(T,D),k=1.01*(Math.cos(Math.PI/2-this._pitch)*F+y),H=this.height/50;l=new Float64Array(16),c.perspective(l,this._fov,this.width/this.height,H,k),l[8]=2*-t.x/this.width,l[9]=2*t.y/this.height,c.scale(l,l,[1,-1,1]),c.translate(l,l,[0,0,-this.cameraToCenterDistance]),c.rotateX(l,l,this._pitch),c.rotateZ(l,l,this.angle),c.translate(l,l,[-n,-a,0]),this.mercatorMatrix=c.scale([],l,[this.worldSize,this.worldSize,this.worldSize]),c.scale(l,l,[1,1,this._pixelPerMeter]),this.pixelMatrix=c.multiply(new Float64Array(16),this.labelPlaneMatrix,l),c.translate(l,l,[0,0,-this.elevation]),this.projMatrix=l,this.invProjMatrix=c.invert([],l),this.pixelMatrix3D=c.multiply(new Float64Array(16),this.labelPlaneMatrix,l);const ne=this.width%2/2,N=this.height%2/2,K=Math.cos(this.angle),ae=Math.sin(this.angle),oe=n-Math.round(n)+K*ne+ae*N,ce=a-Math.round(a)+K*N+ae*ne,_e=new Float64Array(l);if(c.translate(_e,_e,[oe>.5?oe-1:oe,ce>.5?ce-1:ce,0]),this.alignedProjMatrix=_e,l=c.invert(new Float64Array(16),this.pixelMatrix),!l)throw new Error("failed to invert matrix");this.pixelMatrixInverse=l,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new c.Point(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return c.transformMat4(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new c.Point(0,t))}getCameraQueryGeometry(t){const n=this.getCameraPoint();if(t.length===1)return[t[0],n];{let a=n.x,l=n.y,d=n.x,m=n.y;for(const g of t)a=Math.min(a,g.x),l=Math.min(l,g.y),d=Math.max(d,g.x),m=Math.max(m,g.y);return[new c.Point(a,l),new c.Point(d,l),new c.Point(d,m),new c.Point(a,m),new c.Point(a,l)]}}}function on(h,t){let n,a=!1,l=null,d=null;const m=()=>{l=null,a&&(h.apply(d,n),l=setTimeout(m,t),a=!1)};return(...g)=>(a=!0,d=this,n=g,l||m(),l)}class Ko{constructor(t){this._getCurrentHash=()=>{const n=window.location.hash.replace("#","");if(this._hashName){let a;return n.split("&").map(l=>l.split("=")).forEach(l=>{l[0]===this._hashName&&(a=l)}),(a&&a[1]||"").split("/")}return n.split("/")},this._onHashChange=()=>{const n=this._getCurrentHash();if(n.length>=3&&!n.some(a=>isNaN(a))){const a=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(n[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+n[2],+n[1]],zoom:+n[0],bearing:a,pitch:+(n[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const n=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,n)}catch{}},this._updateHash=on(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()),delete this._map,this}getHashString(t){const n=this._map.getCenter(),a=Math.round(100*this._map.getZoom())/100,l=Math.ceil((a*Math.LN2+Math.log(512/360/.5))/Math.LN10),d=Math.pow(10,l),m=Math.round(n.lng*d)/d,g=Math.round(n.lat*d)/d,y=this._map.getBearing(),v=this._map.getPitch();let b="";if(b+=t?`/${m}/${g}/${a}`:`${a}/${g}/${m}`,(y||v)&&(b+="/"+Math.round(10*y)/10),v&&(b+=`/${Math.round(v)}`),this._hashName){const T=this._hashName;let C=!1;const L=window.location.hash.slice(1).split("&").map(D=>{const F=D.split("=")[0];return F===T?(C=!0,`${F}=${b}`):D}).filter(D=>D);return C||L.push(`${T}=${b}`),`#${L.join("&")}`}return`#${b}`}}const gs={linearity:.3,easing:c.bezier(0,0,.3,1)},Yo=c.extend({deceleration:2500,maxSpeed:1400},gs),Jo=c.extend({deceleration:20,maxSpeed:1400},gs),Qo=c.extend({deceleration:1e3,maxSpeed:360},gs),el=c.extend({deceleration:1e3,maxSpeed:90},gs);class _s{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:c.browser.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=c.browser.now();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new c.Point(0,0),pinchAround:void 0,around:void 0};for(const{settings:d}of this._inertiaBuffer)n.zoom+=d.zoomDelta||0,n.bearing+=d.bearingDelta||0,n.pitch+=d.pitchDelta||0,d.panDelta&&n.pan._add(d.panDelta),d.around&&(n.around=d.around),d.pinchAround&&(n.pinchAround=d.pinchAround);const a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,l={};if(n.pan.mag()){const d=Gi(n.pan.mag(),a,c.extend({},Yo,t||{}));l.offset=n.pan.mult(d.amount/n.pan.mag()),l.center=this._map.transform.center,ys(l,d)}if(n.zoom){const d=Gi(n.zoom,a,Jo);l.zoom=this._map.transform.zoom+d.amount,ys(l,d)}if(n.bearing){const d=Gi(n.bearing,a,Qo);l.bearing=this._map.transform.bearing+c.clamp(d.amount,-179,179),ys(l,d)}if(n.pitch){const d=Gi(n.pitch,a,el);l.pitch=this._map.transform.pitch+d.amount,ys(l,d)}if(l.zoom||l.bearing){const d=n.pinchAround===void 0?n.around:n.pinchAround;l.around=d?this._map.unproject(d):this._map.getCenter()}return this.clear(),c.extend(l,{noMoveStart:!0})}}function ys(h,t){(!h.duration||h.durationn.unproject(y)),g=d.reduce((y,v,b,T)=>y.add(v.div(T.length)),new c.Point(0,0));super(t,{points:d,point:g,lngLats:m,lngLat:n.unproject(g),originalEvent:a}),this._defaultPrevented=!1}}class Nr extends c.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,a){super(t,{originalEvent:a}),this._defaultPrevented=!1}}class vs{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Nr(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Xt(t.type,this._map,t))}mouseup(t){this._map.fire(new Xt(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Xt(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Xt(t.type,this._map,t))}mouseover(t){this._map.fire(new Xt(t.type,this._map,t))}mouseout(t){this._map.fire(new Xt(t.type,this._map,t))}touchstart(t){return this._firePreventable(new xs(t.type,this._map,t))}touchmove(t){this._map.fire(new xs(t.type,this._map,t))}touchend(t){this._map.fire(new xs(t.type,this._map,t))}touchcancel(t){this._map.fire(new xs(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Gl{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Xt(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Xt("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Xt(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class bs{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.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.pointLocation(c.Point.convert(t),this._map.terrain)}}class Xl{constructor(t,n){this._map=t,this._tr=new bs(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(re.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const a=n;if(this._lastPos.equals(a)||!this._box&&a.dist(this._startPos)d.fitScreenCoordinates(a,l,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(re.remove(this._box),this._box=null),re.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new c.Event(t,{originalEvent:n}))}}function ca(h,t){if(h.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${h.length}, points ${t.length}`);const n={};for(let a=0;athis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),a.length===this.numTouches&&(this.centroid=function(l){const d=new c.Point(0,0);for(const m of l)d._add(m);return d.div(l.length)}(n),this.touches=ca(a,n)))}touchmove(t,n,a){if(this.aborted||!this.centroid)return;const l=ca(a,n);for(const d in this.touches){const m=l[d];(!m||m.dist(this.touches[d])>30)&&(this.aborted=!0)}}touchend(t,n,a){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),a.length===0){const l=!this.aborted&&this.centroid;if(this.reset(),l)return l}}}class Ar{constructor(t){this.singleTap=new ws(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,a){this.singleTap.touchstart(t,n,a)}touchmove(t,n,a){this.singleTap.touchmove(t,n,a)}touchend(t,n,a){const l=this.singleTap.touchend(t,n,a);if(l){const d=t.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(l)<30;if(d&&m||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=l,this.count===this.numTaps)return this.reset(),l}}}class Pe{constructor(t){this._tr=new bs(t),this._zoomIn=new Ar({numTouches:1,numTaps:2}),this._zoomOut=new Ar({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,a){this._zoomIn.touchstart(t,n,a),this._zoomOut.touchstart(t,n,a)}touchmove(t,n,a){this._zoomIn.touchmove(t,n,a),this._zoomOut.touchmove(t,n,a)}touchend(t,n,a){const l=this._zoomIn.touchend(t,n,a),d=this._zoomOut.touchend(t,n,a),m=this._tr;return l?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:g=>g.easeTo({duration:300,zoom:m.zoom+1,around:m.unproject(l)},{originalEvent:t})}):d?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:g=>g.easeTo({duration:300,zoom:m.zoom-1,around:m.unproject(d)},{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}}class Zn{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){const n=this._moveFunction(...t);if(n.bearingDelta||n.pitchDelta||n.around||n.panDelta)return this._active=!0,n}dragStart(t,n){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=n.length?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,n){if(!this.isEnabled())return;const a=this._lastPoint;if(!a)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const l=n.length?n[0]:n;return!this._moved&&l.dist(a){h.mousedown=h.dragStart,h.mousemoveWindow=h.dragMove,h.mouseup=h.dragEnd,h.contextmenu=function(t){t.preventDefault()}},ha=({enable:h,clickTolerance:t,bearingDegreesPerPixelMoved:n=.8})=>{const a=new Tn({checkCorrectEvent:l=>re.mouseButton(l)===0&&l.ctrlKey||re.mouseButton(l)===2});return new Zn({clickTolerance:t,move:(l,d)=>({bearingDelta:(d.x-l.x)*n}),moveStateManager:a,enable:h,assignEvents:Ie})},tl=({enable:h,clickTolerance:t,pitchDegreesPerPixelMoved:n=-.5})=>{const a=new Tn({checkCorrectEvent:l=>re.mouseButton(l)===0&&l.ctrlKey||re.mouseButton(l)===2});return new Zn({clickTolerance:t,move:(l,d)=>({pitchDelta:(d.y-l.y)*n}),moveStateManager:a,enable:h,assignEvents:Ie})};class Wl{constructor(t,n){this._minTouches=t.cooperativeGestures?2:1,this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new c.Point(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(t,n,a){return this._calculateTransform(t,n,a)}touchmove(t,n,a){if(this._map._cooperativeGestures&&(this._minTouches===2&&a.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,a.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(a.length0&&(this._active=!0);const l=ca(a,n),d=new c.Point(0,0),m=new c.Point(0,0);let g=0;for(const v in l){const b=l[v],T=this._touches[v];T&&(d._add(b),m._add(b.sub(T)),g++,l[v]=b)}if(this._touches=l,gMath.abs(h.x)}class Ya extends Es{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,a){super.touchstart(t,n,a),this._currentTouchCount=a.length}_start(t){this._lastPoints=t,Is(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,a){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const l=t[0].sub(this._lastPoints[0]),d=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(l,d,a.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(l.y+d.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,a){if(this._valid!==void 0)return this._valid;const l=t.mag()>=2,d=n.mag()>=2;if(!l&&!d)return;if(!l||!d)return this._firstMove===void 0&&(this._firstMove=a),a-this._firstMove<100&&void 0;const m=t.y>0==n.y>0;return Is(t)&&Is(n)&&m}}const Ja={panStep:100,bearingStep:15,pitchStep:10};class Di{constructor(t){this._tr=new bs(t);const n=Ja;this._panStep=n.panStep,this._bearingStep=n.bearingStep,this._pitchStep=n.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,a=0,l=0,d=0,m=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?a=-1:(t.preventDefault(),d=-1);break;case 39:t.shiftKey?a=1:(t.preventDefault(),d=1);break;case 38:t.shiftKey?l=1:(t.preventDefault(),m=-1);break;case 40:t.shiftKey?l=-1:(t.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(a=0,l=0),{cameraAnimation:g=>{const y=this._tr;g.easeTo({duration:300,easeId:"keyboardHandler",easing:ln,zoom:n?Math.round(y.zoom)+n*(t.shiftKey?2:1):y.zoom,bearing:y.bearing+a*this._bearingStep,pitch:y.pitch+l*this._pitchStep,offset:[-d*this._panStep,-m*this._panStep],center:y.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 ln(h){return h*(2-h)}const Qa=4.000244140625;class eo{constructor(t,n){this._onTimeout=a=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(a)},this._map=t,this._tr=new bs(t),this._el=t.getCanvasContainer(),this._triggerRenderFrame=n,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||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!t[this._map._metaKey])return;t.preventDefault()}let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const a=c.browser.now(),l=a-(this._lastWheelEventTime||0);this._lastWheelEventTime=a,n!==0&&n%Qa==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":l>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(l*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=re.mousePos(this._el,t),a=this._tr;this._around=c.LngLat.convert(this._aroundCenter?a.center:a.unproject(n)),this._aroundPoint=a.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._tr.transform;if(this._delta!==0){const g=this._type==="wheel"&&Math.abs(this._delta)>Qa?this._wheelZoomRate:this._defaultZoomRate;let y=2/(1+Math.exp(-Math.abs(this._delta*g)));this._delta<0&&y!==0&&(y=1/y);const v=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(v*y))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,a=this._startZoom,l=this._easing;let d,m=!1;if(this._type==="wheel"&&a&&l){const g=Math.min((c.browser.now()-this._lastWheelEventTime)/200,1),y=l(g);d=c.interpolate.number(a,n,y),g<1?this._frameId||(this._frameId=!0):m=!0}else d=n,m=!0;return this._active=!0,m&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!m,zoomDelta:d-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=c.defaultEasing;if(this._prevEase){const a=this._prevEase,l=(c.browser.now()-a.start)/a.duration,d=a.easing(l+.01)-a.easing(l),m=.27/Math.sqrt(d*d+1e-4)*.01,g=Math.sqrt(.0729-m*m);n=c.bezier(m,g,.25,1)}return this._prevEase={start:c.browser.now(),duration:t,easing:n},n}reset(){this._active=!1}}class to{constructor(t,n){this._clickZoom=t,this._tapZoom=n}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()}}class io{constructor(t){this._tr=new bs(t),this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:a=>{a.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class rl{constructor(){this._tap=new Ar({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,n,a){if(!this._swipePoint)if(this._tapTime){const l=n[0],d=t.timeStamp-this._tapTime<500,m=this._tapPoint.dist(l)<30;d&&m?a.length>0&&(this._swipePoint=l,this._swipeTouch=a[0].identifier):this.reset()}else this._tap.touchstart(t,n,a)}touchmove(t,n,a){if(this._tapTime){if(this._swipePoint){if(a[0].identifier!==this._swipeTouch)return;const l=n[0],d=l.y-this._swipePoint.y;return this._swipePoint=l,t.preventDefault(),this._active=!0,{zoomDelta:d/128}}}else this._tap.touchmove(t,n,a)}touchend(t,n,a){if(this._tapTime)this._swipePoint&&a.length===0&&this.reset();else{const l=this._tap.touchend(t,n,a);l&&(this._tapTime=t.timeStamp,this._tapPoint=l)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class nr{constructor(t,n,a){this._el=t,this._mousePan=n,this._touchPan=a}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()}}class St{constructor(t,n,a){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=n,this._mousePitch=a}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class ua{constructor(t,n,a,l){this._el=t,this._touchZoom=n,this._touchRotate=a,this._tapDragZoom=l,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()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const jn=h=>h.zoom||h.drag||h.pitch||h.rotate;class nl extends c.Event{}function da(h){return h.panDelta&&h.panDelta.mag()||h.zoomDelta||h.bearingDelta||h.pitchDelta}class sl{constructor(t,n){this.handleWindowEvent=l=>{this.handleEvent(l,`${l.type}Window`)},this.handleEvent=(l,d)=>{if(l.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const m=l.type==="renderFrame"?void 0:l,g={needsRenderFrame:!1},y={},v={},b=l.touches,T=b?this._getMapTouches(b):void 0,C=T?re.touchPos(this._el,T):re.mousePos(this._el,l);for(const{handlerName:F,handler:k,allowed:H}of this._handlers){if(!k.isEnabled())continue;let ne;this._blockedByActive(v,H,F)?k.reset():k[d||l.type]&&(ne=k[d||l.type](l,C,T),this.mergeHandlerResult(g,y,ne,F,m),ne&&ne.needsRenderFrame&&this._triggerRenderFrame()),(ne||k.isActive())&&(v[F]=k)}const L={};for(const F in this._previousActiveHandlers)v[F]||(L[F]=m);this._previousActiveHandlers=v,(Object.keys(L).length||da(g))&&(this._changes.push([g,y,L]),this._triggerRenderFrame()),(Object.keys(v).length||da(g))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:D}=g;D&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],D(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new _s(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n);const a=this._el;this._listeners=[[a,"touchstart",{passive:!0}],[a,"touchmove",{passive:!1}],[a,"touchend",void 0],[a,"touchcancel",void 0],[a,"mousedown",void 0],[a,"mousemove",void 0],[a,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[a,"mouseover",void 0],[a,"mouseout",void 0],[a,"dblclick",void 0],[a,"click",void 0],[a,"keydown",{capture:!1}],[a,"keyup",void 0],[a,"wheel",{passive:!1}],[a,"contextmenu",void 0],[window,"blur",void 0]];for(const[l,d,m]of this._listeners)re.addEventListener(l,d,l===document?this.handleWindowEvent:this.handleEvent,m)}destroy(){for(const[t,n,a]of this._listeners)re.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,a)}_addDefaultHandlers(t){const n=this._map,a=n.getCanvasContainer();this._add("mapEvent",new vs(n,t));const l=n.boxZoom=new Xl(n,t);this._add("boxZoom",l),t.interactive&&t.boxZoom&&l.enable();const d=new Pe(n),m=new io(n);n.doubleClickZoom=new to(m,d),this._add("tapZoom",d),this._add("clickZoom",m),t.interactive&&t.doubleClickZoom&&n.doubleClickZoom.enable();const g=new rl;this._add("tapDragZoom",g);const y=n.touchPitch=new Ya(n);this._add("touchPitch",y),t.interactive&&t.touchPitch&&n.touchPitch.enable(t.touchPitch);const v=ha(t),b=tl(t);n.dragRotate=new St(t,v,b),this._add("mouseRotate",v,["mousePitch"]),this._add("mousePitch",b,["mouseRotate"]),t.interactive&&t.dragRotate&&n.dragRotate.enable();const T=(({enable:H,clickTolerance:ne})=>{const N=new Tn({checkCorrectEvent:K=>re.mouseButton(K)===0&&!K.ctrlKey});return new Zn({clickTolerance:ne,move:(K,ae)=>({around:ae,panDelta:ae.sub(K)}),activateOnStart:!0,moveStateManager:N,enable:H,assignEvents:Ie})})(t),C=new Wl(t,n);n.dragPan=new nr(a,T,C),this._add("mousePan",T),this._add("touchPan",C,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&n.dragPan.enable(t.dragPan);const L=new Ka,D=new Hl;n.touchZoomRotate=new ua(a,D,L,g),this._add("touchRotate",L,["touchPan","touchZoom"]),this._add("touchZoom",D,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&n.touchZoomRotate.enable(t.touchZoomRotate);const F=n.scrollZoom=new eo(n,()=>this._triggerRenderFrame());this._add("scrollZoom",F,["mousePan"]),t.interactive&&t.scrollZoom&&n.scrollZoom.enable(t.scrollZoom);const k=n.keyboard=new Di(n);this._add("keyboard",k),t.interactive&&t.keyboard&&n.keyboard.enable(),this._add("blockableMapEvent",new Gl(n))}_add(t,n,a){this._handlers.push({handlerName:t,handler:n,allowed:a}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{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!!jn(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,n,a){for(const l in t)if(l!==a&&(!n||n.indexOf(l)<0))return!0;return!1}_getMapTouches(t){const n=[];for(const a of t)this._el.contains(a.target)&&n.push(a);return n}mergeHandlerResult(t,n,a,l,d){if(!a)return;c.extend(t,a);const m={handlerName:l,originalEvent:a.originalEvent||d};a.zoomDelta!==void 0&&(n.zoom=m),a.panDelta!==void 0&&(n.drag=m),a.pitchDelta!==void 0&&(n.pitch=m),a.bearingDelta!==void 0&&(n.rotate=m)}_applyChanges(){const t={},n={},a={};for(const[l,d,m]of this._changes)l.panDelta&&(t.panDelta=(t.panDelta||new c.Point(0,0))._add(l.panDelta)),l.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+l.zoomDelta),l.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+l.bearingDelta),l.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+l.pitchDelta),l.around!==void 0&&(t.around=l.around),l.pinchAround!==void 0&&(t.pinchAround=l.pinchAround),l.noInertia&&(t.noInertia=l.noInertia),c.extend(n,d),c.extend(a,m);this._updateMapTransform(t,n,a),this._changes=[]}_updateMapTransform(t,n,a){const l=this._map,d=l._getTransformForUpdate(),m=l.terrain;if(!(da(t)||m&&this._terrainMovement))return this._fireEvents(n,a,!0);let{panDelta:g,zoomDelta:y,bearingDelta:v,pitchDelta:b,around:T,pinchAround:C}=t;C!==void 0&&(T=C),l._stop(!0),T=T||l.transform.centerPoint;const L=d.pointLocation(g?T.sub(g):T);v&&(d.bearing+=v),b&&(d.pitch+=b),y&&(d.zoom+=y),m?this._terrainMovement||!n.drag&&!n.zoom?n.drag&&this._terrainMovement?d.center=d.pointLocation(d.centerPoint.sub(g)):d.setLocationAtPoint(L,T):(this._terrainMovement=!0,this._map._elevationFreeze=!0,d.setLocationAtPoint(L,T),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,d.recalculateZoom(l.terrain)})):d.setLocationAtPoint(L,T),l._applyUpdatedTransform(d),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,a,!0)}_fireEvents(t,n,a){const l=jn(this._eventsInProgress),d=jn(t),m={};for(const b in t){const{originalEvent:T}=t[b];this._eventsInProgress[b]||(m[`${b}start`]=T),this._eventsInProgress[b]=t[b]}!l&&d&&this._fireEvent("movestart",d.originalEvent);for(const b in m)this._fireEvent(b,m[b]);d&&this._fireEvent("move",d.originalEvent);for(const b in t){const{originalEvent:T}=t[b];this._fireEvent(b,T)}const g={};let y;for(const b in this._eventsInProgress){const{handlerName:T,originalEvent:C}=this._eventsInProgress[b];this._handlersById[T].isActive()||(delete this._eventsInProgress[b],y=n[T]||C,g[`${b}end`]=y)}for(const b in g)this._fireEvent(b,g[b]);const v=jn(this._eventsInProgress);if(a&&(l||d)&&!v){this._updatingCamera=!0;const b=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),T=C=>C!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new nl("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Kl extends c.Evented{constructor(t,n){super(),this._renderFrameCallback=()=>{const a=Math.min((c.browser.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(a)),a<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new c.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,a){return t=c.Point.convert(t).mult(-1),this.panTo(this.transform.center,c.extend({offset:t},n),a)}panTo(t,n,a){return this.easeTo(c.extend({center:t},n),a)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,a){return this.easeTo(c.extend({zoom:t},n),a)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getBearing(){return this.transform.bearing}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,a){return this.easeTo(c.extend({bearing:t},n),a)}resetNorth(t,n){return this.rotateTo(0,c.extend({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(c.extend({bearing:0,pitch:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing()){if(this._zooming&&(a.zoom=c.interpolate.number(l,y,oe)),this._rotating&&(a.bearing=c.interpolate.number(d,v,oe)),this._pitching&&(a.pitch=c.interpolate.number(m,b,oe)),this._padding&&(a.interpolatePadding(g,T,oe),L=a.centerPoint.add(C)),this.terrain&&!t.freezeElevation&&this._updateElevation(oe),N)a.setLocationAtPoint(N,K);else{const ce=a.zoomScale(a.zoom-l),_e=y>l?Math.min(2,ne):Math.max(.5,ne),fe=Math.pow(_e,1-oe),xe=a.unproject(k.add(H.mult(oe*fe)).mult(ce));a.setLocationAtPoint(a.renderWorldCopies?xe.wrap():xe,L)}this._applyUpdatedTransform(a),this._fireMoveEvents(n)},oe=>{this.terrain&&this._finalizeElevation(),this._afterEase(n,oe)},t),this}_prepareEase(t,n,a={}){this._moving=!0,n||a.moving||this.fire(new c.Event("movestart",t)),this._zooming&&!a.zooming&&this.fire(new c.Event("zoomstart",t)),this._rotating&&!a.rotating&&this.fire(new c.Event("rotatestart",t)),this._pitching&&!a.pitching&&this.fire(new c.Event("pitchstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const n=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&n!==this._elevationTarget){const a=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(a-(n-(a*t+this._elevationStart))/(1-t)),this._elevationTarget=n}this.transform.elevation=c.interpolate.number(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(t){if(!this.transformCameraUpdate)return;const n=t.clone(),{center:a,zoom:l,pitch:d,bearing:m,elevation:g}=this.transformCameraUpdate(n);a&&(n.center=a),l!==void 0&&(n.zoom=l),d!==void 0&&(n.pitch=d),m!==void 0&&(n.bearing=m),g!==void 0&&(n.elevation=g),this.transform.apply(n)}_fireMoveEvents(t){this.fire(new c.Event("move",t)),this._zooming&&this.fire(new c.Event("zoom",t)),this._rotating&&this.fire(new c.Event("rotate",t)),this._pitching&&this.fire(new c.Event("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const a=this._zooming,l=this._rotating,d=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,a&&this.fire(new c.Event("zoomend",t)),l&&this.fire(new c.Event("rotateend",t)),d&&this.fire(new c.Event("pitchend",t)),this.fire(new c.Event("moveend",t))}flyTo(t,n){if(!t.essential&&c.browser.prefersReducedMotion){const ke=c.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(ke,n)}this.stop(),t=c.extend({offset:[0,0],speed:1.2,curve:1.42,easing:c.defaultEasing},t);const a=this._getTransformForUpdate(),l=this.getZoom(),d=this.getBearing(),m=this.getPitch(),g=this.getPadding(),y="zoom"in t?c.clamp(+t.zoom,a.minZoom,a.maxZoom):l,v="bearing"in t?this._normalizeBearing(t.bearing,d):d,b="pitch"in t?+t.pitch:m,T="padding"in t?t.padding:a.padding,C=a.zoomScale(y-l),L=c.Point.convert(t.offset);let D=a.centerPoint.add(L);const F=a.pointLocation(D),k=c.LngLat.convert(t.center||F);this._normalizeCenter(k);const H=a.project(F),ne=a.project(k).sub(H);let N=t.curve;const K=Math.max(a.width,a.height),ae=K/C,oe=ne.mag();if("minZoom"in t){const ke=c.clamp(Math.min(t.minZoom,l,y),a.minZoom,a.maxZoom),It=K/a.zoomScale(ke-l);N=Math.sqrt(It/oe*2)}const ce=N*N;function _e(ke){const It=(ae*ae-K*K+(ke?-1:1)*ce*ce*oe*oe)/(2*(ke?ae:K)*ce*oe);return Math.log(Math.sqrt(It*It+1)-It)}function fe(ke){return(Math.exp(ke)-Math.exp(-ke))/2}function xe(ke){return(Math.exp(ke)+Math.exp(-ke))/2}const Be=_e(!1);let et=function(ke){return xe(Be)/xe(Be+N*ke)},Ee=function(ke){return K*((xe(Be)*(fe(It=Be+N*ke)/xe(It))-fe(Be))/ce)/oe;var It},Ne=(_e(!0)-Be)/N;if(Math.abs(oe)<1e-6||!isFinite(Ne)){if(Math.abs(K-ae)<1e-6)return this.easeTo(t,n);const ke=aet.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=d!==v,this._pitching=b!==m,this._padding=!a.isPaddingEqual(T),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(k),this._ease(ke=>{const It=ke*Ne,tt=1/et(It);a.zoom=ke===1?y:l+a.scaleZoom(tt),this._rotating&&(a.bearing=c.interpolate.number(d,v,ke)),this._pitching&&(a.pitch=c.interpolate.number(m,b,ke)),this._padding&&(a.interpolatePadding(g,T,ke),D=a.centerPoint.add(L)),this.terrain&&!t.freezeElevation&&this._updateElevation(ke);const $e=ke===1?k:a.unproject(H.add(ne.mult(Ee(It))).mult(tt));a.setLocationAtPoint(a.renderWorldCopies?$e.wrap():$e,D),this._applyUpdatedTransform(a),this._fireMoveEvents(n)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(n)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const a=this._onEaseEnd;delete this._onEaseEnd,a.call(this,n)}if(!t){const a=this.handlers;a&&a.stop(!1)}return this}_ease(t,n,a){a.animate===!1||a.duration===0?(t(1),n()):(this._easeStart=c.browser.now(),this._easeOptions=a,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,n){t=c.wrap(t,-180,180);const a=Math.abs(t-n);return Math.abs(t-360-n)180?-360:a<-180?360:0}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(c.LngLat.convert(t),this.transform.tileZoom)-this.transform.elevation:null}}class fr{constructor(t={}){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=n=>{!n||n.sourceDataType!=="metadata"&&n.sourceDataType!=="visibility"&&n.dataType!=="style"&&n.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?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&&this.options.compact,this._container=re.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=re.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=re.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(){re.remove(this._container),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,n){const a=this._map._getUIString(`AttributionControl.${n}`);t.title=a,t.setAttribute("aria-label",a)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(l=>typeof l!="string"?"":l)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const l=this._map.style.stylesheet;this.styleOwner=l.owner,this.styleId=l.id}const n=this._map.style.sourceCaches;for(const l in n){const d=n[l];if(d.used||d.usedForTerrain){const m=d.getSource();m.attribution&&t.indexOf(m.attribution)<0&&t.push(m.attribution)}}t=t.filter(l=>String(l).trim()),t.sort((l,d)=>l.length-d.length),t=t.filter((l,d)=>{for(let m=d+1;m=0)return!1;return!0});const a=t.join(" | ");a!==this._attribHTML&&(this._attribHTML=a,t.length?(this._innerContainer.innerHTML=a,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class As{constructor(t={}){this._updateCompact=()=>{const n=this._container.children;if(n.length){const a=n[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&a.classList.add("maplibregl-compact"):a.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=re.create("div","maplibregl-ctrl");const n=re.create("a","maplibregl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){re.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Ue{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,a=n?this._queue.concat(n):this._queue;for(const l of a)if(l.id===t)return void(l.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const n=this._currentlyRunning=this._queue;this._queue=[];for(const a of n)if(!a.cancelled&&(a.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const je={"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":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"};var pa=c.createLayout([{name:"a_pos3d",type:"Int16",components:3}]);class ro extends c.Evented{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(t,n){this.sourceCache.update(t,n),this._renderableTilesKeys=[];const a={};for(const l of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))a[l.key]=!0,this._renderableTilesKeys.push(l.key),this._tiles[l.key]||(l.posMatrix=new Float64Array(16),c.ortho(l.posMatrix,0,c.EXTENT,0,c.EXTENT,0,1),this._tiles[l.key]=new mn(l,this.tileSize));for(const l in this._tiles)a[l]||delete this._tiles[l]}freeRtt(t){for(const n in this._tiles){const a=this._tiles[n];(!t||a.tileID.equals(t)||a.tileID.isChildOf(t)||t.isChildOf(a.tileID))&&(a.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const n={};for(const a of this._renderableTilesKeys){const l=this._tiles[a].tileID;if(l.canonical.equals(t.canonical)){const d=t.clone();d.posMatrix=new Float64Array(16),c.ortho(d.posMatrix,0,c.EXTENT,0,c.EXTENT,0,1),n[a]=d}else if(l.canonical.isChildOf(t.canonical)){const d=t.clone();d.posMatrix=new Float64Array(16);const m=l.canonical.z-t.canonical.z,g=l.canonical.x-(l.canonical.x>>m<>m<>m;c.ortho(d.posMatrix,0,v,0,v,0,1),c.translate(d.posMatrix,d.posMatrix,[-g*v,-y*v,0]),n[a]=d}else if(t.canonical.isChildOf(l.canonical)){const d=t.clone();d.posMatrix=new Float64Array(16);const m=t.canonical.z-l.canonical.z,g=t.canonical.x-(t.canonical.x>>m<>m<>m;c.ortho(d.posMatrix,0,c.EXTENT,0,c.EXTENT,0,1),c.translate(d.posMatrix,d.posMatrix,[g*v,y*v,0]),c.scale(d.posMatrix,d.posMatrix,[1/2**m,1/2**m,0]),n[a]=d}}return n}getSourceTile(t,n){const a=this.sourceCache._source;let l=t.overscaledZ-this.deltaZoom;if(l>a.maxzoom&&(l=a.maxzoom),l=a.minzoom&&(!d||!d.dem);)d=this.sourceCache.getTileByID(t.scaledTo(l--).key);return d}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(n=>n.timeAdded>=t)}}class no{constructor(t,n,a){this.painter=t,this.sourceCache=new ro(n),this.options=a,this.exaggeration=typeof a.exaggeration=="number"?a.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,n,a,l=c.EXTENT){var d;if(!(n>=0&&n=0&&at.canonical.z&&(t.canonical.z>=l?d=t.canonical.z-l:c.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const m=t.canonical.x-(t.canonical.x>>d<>d<>8<<4|d>>8,n[m+3]=0;const a=new c.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),l=new Je(t,a,t.gl.RGBA,{premultiply:!1});return l.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=l,l}pointCoordinate(t){const n=new Uint8Array(4),a=this.painter.context,l=a.gl;a.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),l.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,l.RGBA,l.UNSIGNED_BYTE,n),a.bindFramebuffer.set(null);const d=n[0]+(n[2]>>4<<8),m=n[1]+((15&n[2])<<8),g=this.coordsIndex[255-n[3]],y=g&&this.sourceCache.getTileByID(g);if(!y)return null;const v=this._coordsTextureSize,b=(1<t.id!==n),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const n of this._recentlyUsed)if(!this._objects[n].inUse)return this._objects[n];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length!t.inUse)===!1}}const En={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Cr{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new Li(t.context,30,n.sourceCache.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,n){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter(a=>!t._layers[a].isHidden(n)),this._coordsDescendingInv={};for(const a in t.sourceCaches){this._coordsDescendingInv[a]={};const l=t.sourceCaches[a].getVisibleCoordinates();for(const d of l){const m=this.terrain.sourceCache.getTerrainCoords(d);for(const g in m)this._coordsDescendingInv[a][g]||(this._coordsDescendingInv[a][g]=[]),this._coordsDescendingInv[a][g].push(m[g])}}this._coordsDescendingInvStr={};for(const a of t._order){const l=t._layers[a],d=l.source;if(En[l.type]&&!this._coordsDescendingInvStr[d]){this._coordsDescendingInvStr[d]={};for(const m in this._coordsDescendingInv[d])this._coordsDescendingInvStr[d][m]=this._coordsDescendingInv[d][m].map(g=>g.key).sort().join()}}for(const a of this._renderableTiles)for(const l in this._coordsDescendingInvStr){const d=this._coordsDescendingInvStr[l][a.tileID.key];d&&d!==a.rttCoords[l]&&(a.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const n=t.type,a=this.painter,l=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(En[n]&&(this._prevType&&En[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!l))return!0;if(En[this._prevType]||En[n]&&l){this._prevType=n;const d=this._stacks.length-1,m=this._stacks[d]||[];for(const g of this._renderableTiles){if(this.pool.isFull()&&(sa(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(g),g.rtt[d]){const v=this.pool.getObjectForId(g.rtt[d].id);if(v.stamp===g.rtt[d].stamp){this.pool.useObject(v);continue}}const y=this.pool.getOrCreateFreeObject();this.pool.useObject(y),this.pool.stampObject(y),g.rtt[d]={id:y.id,stamp:y.stamp},a.context.bindFramebuffer.set(y.fbo.framebuffer),a.context.clear({color:c.Color.transparent,stencil:0}),a.currentStencilSource=void 0;for(let v=0;v{h.touchstart=h.dragStart,h.touchmoveWindow=h.dragMove,h.touchend=h.dragEnd},$t={showCompass:!0,showZoom:!0,visualizePitch:!1};class al{constructor(t,n,a=!1){this.mousedown=m=>{this.startMouse(c.extend({},m,{ctrlKey:!0,preventDefault:()=>m.preventDefault()}),re.mousePos(this.element,m)),re.addEventListener(window,"mousemove",this.mousemove),re.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=m=>{this.moveMouse(m,re.mousePos(this.element,m))},this.mouseup=m=>{this.mouseRotate.dragEnd(m),this.mousePitch&&this.mousePitch.dragEnd(m),this.offTemp()},this.touchstart=m=>{m.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=re.touchPos(this.element,m.targetTouches)[0],this.startTouch(m,this._startPos),re.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),re.addEventListener(window,"touchend",this.touchend))},this.touchmove=m=>{m.targetTouches.length!==1?this.reset():(this._lastPos=re.touchPos(this.element,m.targetTouches)[0],this.moveTouch(m,this._lastPos))},this.touchend=m=>{m.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const l=t.dragRotate._mouseRotate.getClickTolerance(),d=t.dragRotate._mousePitch.getClickTolerance();this.element=n,this.mouseRotate=ha({clickTolerance:l,enable:!0}),this.touchRotate=(({enable:m,clickTolerance:g,bearingDegreesPerPixelMoved:y=.8})=>{const v=new Wa;return new Zn({clickTolerance:g,move:(b,T)=>({bearingDelta:(T.x-b.x)*y}),moveStateManager:v,enable:m,assignEvents:Pt})})({clickTolerance:l,enable:!0}),this.map=t,a&&(this.mousePitch=tl({clickTolerance:d,enable:!0}),this.touchPitch=(({enable:m,clickTolerance:g,pitchDegreesPerPixelMoved:y=-.5})=>{const v=new Wa;return new Zn({clickTolerance:g,move:(b,T)=>({pitchDelta:(T.y-b.y)*y}),moveStateManager:v,enable:m,assignEvents:Pt})})({clickTolerance:d,enable:!0})),re.addEventListener(n,"mousedown",this.mousedown),re.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),re.addEventListener(n,"touchcancel",this.reset)}startMouse(t,n){this.mouseRotate.dragStart(t,n),this.mousePitch&&this.mousePitch.dragStart(t,n),re.disableDrag()}startTouch(t,n){this.touchRotate.dragStart(t,n),this.touchPitch&&this.touchPitch.dragStart(t,n),re.disableDrag()}moveMouse(t,n){const a=this.map,{bearingDelta:l}=this.mouseRotate.dragMove(t,n)||{};if(l&&a.setBearing(a.getBearing()+l),this.mousePitch){const{pitchDelta:d}=this.mousePitch.dragMove(t,n)||{};d&&a.setPitch(a.getPitch()+d)}}moveTouch(t,n){const a=this.map,{bearingDelta:l}=this.touchRotate.dragMove(t,n)||{};if(l&&a.setBearing(a.getBearing()+l),this.touchPitch){const{pitchDelta:d}=this.touchPitch.dragMove(t,n)||{};d&&a.setPitch(a.getPitch()+d)}}off(){const t=this.element;re.removeEventListener(t,"mousedown",this.mousedown),re.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),re.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),re.removeEventListener(window,"touchend",this.touchend),re.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){re.enableDrag(),re.removeEventListener(window,"mousemove",this.mousemove),re.removeEventListener(window,"mouseup",this.mouseup),re.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),re.removeEventListener(window,"touchend",this.touchend)}}let sr;function Ms(h,t,n){if(h=new c.LngLat(h.lng,h.lat),t){const a=new c.LngLat(h.lng-360,h.lat),l=new c.LngLat(h.lng+360,h.lat),d=n.locationPoint(h).distSqr(t);n.locationPoint(a).distSqr(t)180;){const a=n.locationPoint(h);if(a.x>=0&&a.y>=0&&a.x<=n.width&&a.y<=n.height)break;h.lng>n.center.lng?h.lng-=360:h.lng+=360}return h}const Ps={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function fa(h,t,n){const a=h.classList;for(const l in Ps)a.remove(`maplibregl-${n}-anchor-${l}`);a.add(`maplibregl-${n}-anchor-${t}`)}class zs extends c.Evented{constructor(t){if(super(),this._onKeyPress=n=>{const a=n.code,l=n.charCode||n.keyCode;a!=="Space"&&a!=="Enter"&&l!==32&&l!==13||this.togglePopup()},this._onMapClick=n=>{const a=n.originalEvent.target,l=this._element;this._popup&&(a===l||l.contains(a))&&this.togglePopup()},this._update=n=>{if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=Ms(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let a="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?a=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(a=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let l="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?l="rotateX(0deg)":this._pitchAlignment==="map"&&(l=`rotateX(${this._map.getPitch()}deg)`),n&&n.type!=="moveend"||(this._pos=this._pos.round()),re.setTransform(this._element,`${Ps[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${l} ${a}`),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const d=this._map.unproject(this._pos),m=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=d.distanceTo(this._lngLat)>20*m?"0.2":"1.0",this._opacityTimeout=null},100))},this._onMove=n=>{if(!this._isDragging){const a=this._clickTolerance||this._map._clickTolerance;this._isDragging=n.point.dist(this._pointerdownPos)>=a}this._isDragging&&(this._pos=n.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new c.Event("dragstart"))),this.fire(new c.Event("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new c.Event("dragend")),this._state="inactive"},this._addDragHandler=n=>{this._element.contains(n.originalEvent.target)&&(n.preventDefault(),this._positionDelta=n.point.sub(this._pos).add(this._offset),this._pointerdownPos=n.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,t&&t.element)this._element=t.element,this._offset=c.Point.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=re.create("div"),this._element.setAttribute("aria-label","Map marker");const n=re.createNS("http://www.w3.org/2000/svg","svg"),a=41,l=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${a}px`),n.setAttributeNS(null,"width",`${l}px`),n.setAttributeNS(null,"viewBox",`0 0 ${l} ${a}`);const d=re.createNS("http://www.w3.org/2000/svg","g");d.setAttributeNS(null,"stroke","none"),d.setAttributeNS(null,"stroke-width","1"),d.setAttributeNS(null,"fill","none"),d.setAttributeNS(null,"fill-rule","evenodd");const m=re.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"fill-rule","nonzero");const g=re.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"transform","translate(3.0, 29.0)"),g.setAttributeNS(null,"fill","#000000");const y=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const H of y){const ne=re.createNS("http://www.w3.org/2000/svg","ellipse");ne.setAttributeNS(null,"opacity","0.04"),ne.setAttributeNS(null,"cx","10.5"),ne.setAttributeNS(null,"cy","5.80029008"),ne.setAttributeNS(null,"rx",H.rx),ne.setAttributeNS(null,"ry",H.ry),g.appendChild(ne)}const v=re.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"fill",this._color);const b=re.createNS("http://www.w3.org/2000/svg","path");b.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),v.appendChild(b);const T=re.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"opacity","0.25"),T.setAttributeNS(null,"fill","#000000");const C=re.createNS("http://www.w3.org/2000/svg","path");C.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),T.appendChild(C);const L=re.createNS("http://www.w3.org/2000/svg","g");L.setAttributeNS(null,"transform","translate(6.0, 7.0)"),L.setAttributeNS(null,"fill","#FFFFFF");const D=re.createNS("http://www.w3.org/2000/svg","g");D.setAttributeNS(null,"transform","translate(8.0, 8.0)");const F=re.createNS("http://www.w3.org/2000/svg","circle");F.setAttributeNS(null,"fill","#000000"),F.setAttributeNS(null,"opacity","0.25"),F.setAttributeNS(null,"cx","5.5"),F.setAttributeNS(null,"cy","5.5"),F.setAttributeNS(null,"r","5.4999962");const k=re.createNS("http://www.w3.org/2000/svg","circle");k.setAttributeNS(null,"fill","#FFFFFF"),k.setAttributeNS(null,"cx","5.5"),k.setAttributeNS(null,"cy","5.5"),k.setAttributeNS(null,"r","5.4999962"),D.appendChild(F),D.appendChild(k),m.appendChild(g),m.appendChild(v),m.appendChild(T),m.appendChild(L),m.appendChild(D),n.appendChild(m),n.setAttributeNS(null,"height",a*this._scale+"px"),n.setAttributeNS(null,"width",l*this._scale+"px"),this._element.appendChild(n),this._offset=c.Point.convert(t&&t.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",n=>{n.preventDefault()}),this._element.addEventListener("mousedown",n=>{n.preventDefault()}),fa(this._element,this._anchor,"marker"),t&&t.className)for(const n of t.className.split(" "))this._element.classList.add(n);this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),re.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=c.LngLat.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const l=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[l,-1*(38.1-13.5+l)],"bottom-right":[-l,-1*(38.1-13.5+l)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}getOffset(){return this._offset}setOffset(t){return this._offset=c.Point.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const ks={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Gn=0,Sn=!1;const so={maxWidth:100,unit:"metric"};function ma(h,t,n){const a=n&&n.maxWidth||100,l=h._container.clientHeight/2,d=h.unproject([0,l]),m=h.unproject([a,l]),g=d.distanceTo(m);if(n&&n.unit==="imperial"){const y=3.2808*g;y>5280?In(t,a,y/5280,h._getUIString("ScaleControl.Miles")):In(t,a,y,h._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?In(t,a,g/1852,h._getUIString("ScaleControl.NauticalMiles")):g>=1e3?In(t,a,g/1e3,h._getUIString("ScaleControl.Kilometers")):In(t,a,g,h._getUIString("ScaleControl.Meters"))}function In(h,t,n,a){const l=function(d){const m=Math.pow(10,`${Math.floor(d)}`.length-1);let g=d/m;return g=g>=10?10:g>=5?5:g>=3?3:g>=2?2:g>=1?1:function(y){const v=Math.pow(10,Math.ceil(-Math.log(y)/Math.LN10));return Math.round(y*v)/v}(g),m*g}(n);h.style.width=t*(l/n)+"px",h.innerHTML=`${l} ${a}`}const ao={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},oo=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function ga(h){if(h){if(typeof h=="number"){const t=Math.round(Math.abs(h)/Math.SQRT2);return{center:new c.Point(0,0),top:new c.Point(0,h),"top-left":new c.Point(t,t),"top-right":new c.Point(-t,t),bottom:new c.Point(0,-h),"bottom-left":new c.Point(t,-t),"bottom-right":new c.Point(-t,-t),left:new c.Point(h,0),right:new c.Point(-h,0)}}if(h instanceof c.Point||Array.isArray(h)){const t=c.Point.convert(h);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:c.Point.convert(h.center||[0,0]),top:c.Point.convert(h.top||[0,0]),"top-left":c.Point.convert(h["top-left"]||[0,0]),"top-right":c.Point.convert(h["top-right"]||[0,0]),bottom:c.Point.convert(h.bottom||[0,0]),"bottom-left":c.Point.convert(h["bottom-left"]||[0,0]),"bottom-right":c.Point.convert(h["bottom-right"]||[0,0]),left:c.Point.convert(h.left||[0,0]),right:c.Point.convert(h.right||[0,0])}}return ga(new c.Point(0,0))}const _a={extend:(h,...t)=>c.extend(h,...t),run(h){h()},logToElement(h,t=!1,n="log"){const a=window.document.getElementById(n);a&&(t&&(a.innerHTML=""),a.innerHTML+=`
${h}`)}},lo=Oe;class ct{static get version(){return lo}static get workerCount(){return Ai.workerCount}static set workerCount(t){Ai.workerCount=t}static get maxParallelImageRequests(){return c.config.MAX_PARALLEL_IMAGE_REQUESTS}static set maxParallelImageRequests(t){c.config.MAX_PARALLEL_IMAGE_REQUESTS=t}static get workerUrl(){return c.config.WORKER_URL}static set workerUrl(t){c.config.WORKER_URL=t}static addProtocol(t,n){c.config.REGISTERED_PROTOCOLS[t]=n}static removeProtocol(t){delete c.config.REGISTERED_PROTOCOLS[t]}}return ct.Map=class extends Kl{constructor(h){if(c.PerformanceUtils.mark(c.PerformanceMarkers.create),(h=c.extend({},Cs,h)).minZoom!=null&&h.maxZoom!=null&&h.minZoom>h.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(h.minPitch!=null&&h.maxPitch!=null&&h.minPitch>h.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(h.minPitch!=null&&h.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(h.maxPitch!=null&&h.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new la(h.minZoom,h.maxZoom,h.minPitch,h.maxPitch,h.renderWorldCopies),{bearingSnap:h.bearingSnap}),this._cooperativeGesturesOnWheel=t=>{this._onCooperativeGesture(t,t[this._metaKey],1)},this._contextLost=t=>{t.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new c.Event("webglcontextlost",{originalEvent:t}))},this._contextRestored=t=>{this._setupPainter(),this.resize(),this._update(),this.fire(new c.Event("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()},this._interactive=h.interactive,this._cooperativeGestures=h.cooperativeGestures,this._metaKey=navigator.platform.indexOf("Mac")===0?"metaKey":"ctrlKey",this._maxTileCacheSize=h.maxTileCacheSize,this._maxTileCacheZoomLevels=h.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=h.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=h.preserveDrawingBuffer,this._antialias=h.antialias,this._trackResize=h.trackResize,this._bearingSnap=h.bearingSnap,this._refreshExpiredTiles=h.refreshExpiredTiles,this._fadeDuration=h.fadeDuration,this._crossSourceCollisions=h.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=h.collectResourceTiming,this._renderTaskQueue=new Ue,this._controls=[],this._mapId=c.uniqueId(),this._locale=c.extend({},je,h.locale),this._clickTolerance=h.clickTolerance,this._overridePixelRatio=h.pixelRatio,this._maxCanvasSize=h.maxCanvasSize,this.transformCameraUpdate=h.transformCameraUpdate,this._imageQueueHandle=jt.addThrottleControl(()=>this.isMoving()),this._requestManager=new Mt(h.transformRequest),typeof h.container=="string"){if(this._container=document.getElementById(h.container),!this._container)throw new Error(`Container '${h.container}' not found.`)}else{if(!(h.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=h.container}if(h.maxBounds&&this.setMaxBounds(h.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let t=!1;const n=on(a=>{this._trackResize&&!this._removed&&this.resize(a)._update()},50);this._resizeObserver=new ResizeObserver(a=>{t?n(a):t=!0}),this._resizeObserver.observe(this._container)}this.handlers=new sl(this,h),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=h.hash&&new Ko(typeof h.hash=="string"&&h.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:h.center,zoom:h.zoom,bearing:h.bearing,pitch:h.pitch}),h.bounds&&(this.resize(),this.fitBounds(h.bounds,c.extend({},h.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=h.localIdeographFontFamily,this._validateStyle=h.validateStyle,h.style&&this.setStyle(h.style,{localIdeographFontFamily:h.localIdeographFontFamily}),h.attributionControl&&this.addControl(new fr({customAttribution:h.customAttribution})),h.maplibreLogo&&this.addControl(new As,h.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",t=>{this._update(t.dataType==="style"),this.fire(new c.Event(`${t.dataType}data`,t))}),this.on("dataloading",t=>{this.fire(new c.Event(`${t.dataType}dataloading`,t))}),this.on("dataabort",t=>{this.fire(new c.Event("sourcedataabort",t))})}_getMapId(){return this._mapId}addControl(h,t){if(t===void 0&&(t=h.getDefaultPosition?h.getDefaultPosition():"top-right"),!h||!h.onAdd)return this.fire(new c.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=h.onAdd(this);this._controls.push(h);const a=this._controlPositions[t];return t.indexOf("bottom")!==-1?a.insertBefore(n,a.firstChild):a.appendChild(n),this}removeControl(h){if(!h||!h.onRemove)return this.fire(new c.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(h);return t>-1&&this._controls.splice(t,1),h.onRemove(this),this}hasControl(h){return this._controls.indexOf(h)>-1}calculateCameraOptionsFromTo(h,t,n,a){return a==null&&this.terrain&&(a=this.terrain.getElevationForLngLatZoom(n,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(h,t,n,a)}resize(h){var t;const n=this._containerDimensions(),a=n[0],l=n[1],d=this._getClampedPixelRatio(a,l);if(this._resizeCanvas(a,l,d),this.painter.resize(a,l,d),this.painter.overLimit()){const g=this.painter.context.gl;this._maxCanvasSize=[g.drawingBufferWidth,g.drawingBufferHeight];const y=this._getClampedPixelRatio(a,l);this._resizeCanvas(a,l,y),this.painter.resize(a,l,y)}this.transform.resize(a,l),(t=this._requestedCameraState)===null||t===void 0||t.resize(a,l);const m=!this._moving;return m&&(this.stop(),this.fire(new c.Event("movestart",h)).fire(new c.Event("move",h))),this.fire(new c.Event("resize",h)),m&&this.fire(new c.Event("moveend",h)),this}_getClampedPixelRatio(h,t){const{0:n,1:a}=this._maxCanvasSize,l=this.getPixelRatio(),d=h*l,m=t*l;return Math.min(d>n?n/d:1,m>a?a/m:1)*l}getPixelRatio(){var h;return(h=this._overridePixelRatio)!==null&&h!==void 0?h:devicePixelRatio}setPixelRatio(h){this._overridePixelRatio=h,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(h){return this.transform.setMaxBounds(mt.convert(h)),this._update()}setMinZoom(h){if((h=h??-2)>=-2&&h<=this.transform.maxZoom)return this.transform.minZoom=h,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=h,this._update(),this.getZoom()>h&&this.setZoom(h),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(h){if((h=h??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(h>=0&&h<=this.transform.maxPitch)return this.transform.minPitch=h,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(h>=this.transform.minPitch)return this.transform.maxPitch=h,this._update(),this.getPitch()>h&&this.setPitch(h),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(h){return this.transform.renderWorldCopies=h,this._update()}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(h){return this._cooperativeGestures=h,this._cooperativeGestures?this._setupCooperativeGestures():this._destroyCooperativeGestures(),this}project(h){return this.transform.locationPoint(c.LngLat.convert(h),this.style&&this.terrain)}unproject(h){return this.transform.pointLocation(c.Point.convert(h),this.terrain)}isMoving(){var h;return this._moving||((h=this.handlers)===null||h===void 0?void 0:h.isMoving())}isZooming(){var h;return this._zooming||((h=this.handlers)===null||h===void 0?void 0:h.isZooming())}isRotating(){var h;return this._rotating||((h=this.handlers)===null||h===void 0?void 0:h.isRotating())}_createDelegatedListener(h,t,n){if(h==="mouseenter"||h==="mouseover"){let a=!1;return{layer:t,listener:n,delegates:{mousemove:d=>{const m=this.getLayer(t)?this.queryRenderedFeatures(d.point,{layers:[t]}):[];m.length?a||(a=!0,n.call(this,new Xt(h,this,d.originalEvent,{features:m}))):a=!1},mouseout:()=>{a=!1}}}}if(h==="mouseleave"||h==="mouseout"){let a=!1;return{layer:t,listener:n,delegates:{mousemove:m=>{(this.getLayer(t)?this.queryRenderedFeatures(m.point,{layers:[t]}):[]).length?a=!0:a&&(a=!1,n.call(this,new Xt(h,this,m.originalEvent)))},mouseout:m=>{a&&(a=!1,n.call(this,new Xt(h,this,m.originalEvent)))}}}}{const a=l=>{const d=this.getLayer(t)?this.queryRenderedFeatures(l.point,{layers:[t]}):[];d.length&&(l.features=d,n.call(this,l),delete l.features)};return{layer:t,listener:n,delegates:{[h]:a}}}}on(h,t,n){if(n===void 0)return super.on(h,t);const a=this._createDelegatedListener(h,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[h]=this._delegatedListeners[h]||[],this._delegatedListeners[h].push(a);for(const l in a.delegates)this.on(l,a.delegates[l]);return this}once(h,t,n){if(n===void 0)return super.once(h,t);const a=this._createDelegatedListener(h,t,n);for(const l in a.delegates)this.once(l,a.delegates[l]);return this}off(h,t,n){return n===void 0?super.off(h,t):(this._delegatedListeners&&this._delegatedListeners[h]&&(a=>{const l=this._delegatedListeners[h];for(let d=0;dthis._updateStyle(h,t));const n=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!h)),h?(this.style=new mi(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof h=="string"?this.style.loadURL(h,t,n):this.style.loadJSON(h,t,n),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new mi(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(h,t){if(typeof h=="string"){const n=this._requestManager.transformRequest(h,vt.Style);c.getJSON(n,(a,l)=>{a?this.fire(new c.ErrorEvent(a)):l&&this._updateDiff(l,t)})}else typeof h=="object"&&this._updateDiff(h,t)}_updateDiff(h,t){try{this.style.setState(h,t)&&this._update(!0)}catch(n){c.warnOnce(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(h,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():c.warnOnce("There is no style added to the map.")}addSource(h,t){return this._lazyInitEmptyStyle(),this.style.addSource(h,t),this._update(!0)}isSourceLoaded(h){const t=this.style&&this.style.sourceCaches[h];if(t!==void 0)return t.loaded();this.fire(new c.ErrorEvent(new Error(`There is no source with ID '${h}'`)))}setTerrain(h){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),h){const t=this.style.sourceCaches[h.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${h.source}`);for(const n in this.style._layers){const a=this.style._layers[n];a.type==="hillshade"&&a.source===h.source&&c.warnOnce("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new no(this.painter,t,h),this.painter.renderToTexture=new Cr(this.painter,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=n=>{n.dataType==="style"?this.terrain.sourceCache.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId!==h.source||this._elevationFreeze||(this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(n.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0;return this.fire(new c.Event("terrain",{terrain:h})),this}getTerrain(){var h,t;return(t=(h=this.terrain)===null||h===void 0?void 0:h.options)!==null&&t!==void 0?t:null}areTilesLoaded(){const h=this.style&&this.style.sourceCaches;for(const t in h){const n=h[t]._tiles;for(const a in n){const l=n[a];if(l.state!=="loaded"&&l.state!=="errored")return!1}}return!0}addSourceType(h,t,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(h,t,n)}removeSource(h){return this.style.removeSource(h),this._update(!0)}getSource(h){return this.style.getSource(h)}addImage(h,t,n={}){const{pixelRatio:a=1,sdf:l=!1,stretchX:d,stretchY:m,content:g}=n;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||c.isImageBitmap(t))){if(t.width===void 0||t.height===void 0)return this.fire(new c.ErrorEvent(new 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`")));{const{width:y,height:v,data:b}=t,T=t;return this.style.addImage(h,{data:new c.RGBAImage({width:y,height:v},new Uint8Array(b)),pixelRatio:a,stretchX:d,stretchY:m,content:g,sdf:l,version:0,userImage:T}),T.onAdd&&T.onAdd(this,h),this}}{const{width:y,height:v,data:b}=c.browser.getImageData(t);this.style.addImage(h,{data:new c.RGBAImage({width:y,height:v},b),pixelRatio:a,stretchX:d,stretchY:m,content:g,sdf:l,version:0})}}updateImage(h,t){const n=this.style.getImage(h);if(!n)return this.fire(new c.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const a=t instanceof HTMLImageElement||c.isImageBitmap(t)?c.browser.getImageData(t):t,{width:l,height:d,data:m}=a;if(l===void 0||d===void 0)return this.fire(new c.ErrorEvent(new 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(l!==n.data.width||d!==n.data.height)return this.fire(new c.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const g=!(t instanceof HTMLImageElement||c.isImageBitmap(t));return n.data.replace(m,g),this.style.updateImage(h,n),this}getImage(h){return this.style.getImage(h)}hasImage(h){return h?!!this.style.getImage(h):(this.fire(new c.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(h){this.style.removeImage(h)}loadImage(h,t){jt.getImage(this._requestManager.transformRequest(h,vt.Image),t)}listImages(){return this.style.listImages()}addLayer(h,t){return this._lazyInitEmptyStyle(),this.style.addLayer(h,t),this._update(!0)}moveLayer(h,t){return this.style.moveLayer(h,t),this._update(!0)}removeLayer(h){return this.style.removeLayer(h),this._update(!0)}getLayer(h){return this.style.getLayer(h)}setLayerZoomRange(h,t,n){return this.style.setLayerZoomRange(h,t,n),this._update(!0)}setFilter(h,t,n={}){return this.style.setFilter(h,t,n),this._update(!0)}getFilter(h){return this.style.getFilter(h)}setPaintProperty(h,t,n,a={}){return this.style.setPaintProperty(h,t,n,a),this._update(!0)}getPaintProperty(h,t){return this.style.getPaintProperty(h,t)}setLayoutProperty(h,t,n,a={}){return this.style.setLayoutProperty(h,t,n,a),this._update(!0)}getLayoutProperty(h,t){return this.style.getLayoutProperty(h,t)}setGlyphs(h,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(h,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(h,t,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(h,t,n,a=>{a||this._update(!0)}),this}removeSprite(h){return this._lazyInitEmptyStyle(),this.style.removeSprite(h),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(h,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(h,t,n=>{n||this._update(!0)}),this}setLight(h,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(h,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(h,t){return this.style.setFeatureState(h,t),this._update()}removeFeatureState(h,t){return this.style.removeFeatureState(h,t),this._update()}getFeatureState(h){return this.style.getFeatureState(h)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let h=0,t=0;return this._container&&(h=this._container.clientWidth||400,t=this._container.clientHeight||300),[h,t]}_setupContainer(){const h=this._container;h.classList.add("maplibregl-map");const t=this._canvasContainer=re.create("div","maplibregl-canvas-container",h);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=re.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const n=this._containerDimensions(),a=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],a);const l=this._controlContainer=re.create("div","maplibregl-control-container",h),d=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(m=>{d[m]=re.create("div",`maplibregl-ctrl-${m} `,l)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){this._cooperativeGesturesScreen=re.create("div","maplibregl-cooperative-gesture-screen",this._container);let h=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(h=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use ⌘ + scroll to zoom the map"),this._cooperativeGesturesScreen.innerHTML=`
${h}
${typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}
- `,this._cooperativeGesturesScreen.setAttribute("aria-hidden","true"),this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){re.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(h,t,n){this._canvas.width=Math.floor(n*h),this._canvas.height=Math.floor(n*t),this._canvas.style.width=`${h}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const h={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let t=null;this._canvas.addEventListener("webglcontextcreationerror",a=>{t={requestedAttributes:h},a&&(t.statusMessage=a.statusMessage,t.type=a.type)},{once:!0});const n=this._canvas.getContext("webgl2",h)||this._canvas.getContext("webgl",h);if(!n){const a="Failed to initialize WebGL";throw t?(t.message=a,new Error(JSON.stringify(t))):new Error(a)}this.painter=new Wo(n,this.transform),De.testSupport(n)}_onCooperativeGesture(h,t,n){return!t&&n<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(h){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||h,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(h){return this._update(),this._renderTaskQueue.add(h)}_cancelRenderFrame(h){this._renderTaskQueue.remove(h)}_render(h){const t=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(h),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const l=this.transform.zoom,d=c.browser.now();this.style.zoomHistory.update(l,d);const m=new c.EvaluationParameters(l,{now:d,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),g=m.crossFadingFactor();g===1&&g===this._crossFadingFactor||(n=!0,this._crossFadingFactor=g),this.style.update(m)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,t,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding}),this.fire(new c.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,c.PerformanceUtils.mark(c.PerformanceMarkers.load),this.fire(new c.Event("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const a=this._sourcesDirty||this._styleDirty||this._placementDirty;return a||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new c.Event("idle")),!this._loaded||this._fullyLoaded||a||(this._fullyLoaded=!0,c.PerformanceUtils.mark(c.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var h;this._hash&&this._hash.remove();for(const n of this._controls)n.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),jt.removeThrottleControl(this._imageQueueHandle),(h=this._resizeObserver)===null||h===void 0||h.disconnect();const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),re.remove(this._canvasContainer),re.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),c.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new c.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=c.browser.frame(h=>{c.PerformanceUtils.frame(h),this._frame=null,this._render(h)}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(h){this._showTileBoundaries!==h&&(this._showTileBoundaries=h,this._update())}get showPadding(){return!!this._showPadding}set showPadding(h){this._showPadding!==h&&(this._showPadding=h,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(h){this._showCollisionBoxes!==h&&(this._showCollisionBoxes=h,h?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(h){this._showOverdrawInspector!==h&&(this._showOverdrawInspector=h,this._update())}get repaint(){return!!this._repaint}set repaint(h){this._repaint!==h&&(this._repaint=h,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(h){this._vertices=h,this._update()}get version(){return Yl}getCameraTargetElevation(){return this.transform.elevation}},ct.NavigationControl=class{constructor(h){this._updateZoomButtons=()=>{const t=this._map.getZoom(),n=t===this._map.getMaxZoom(),a=t===this._map.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=a,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",a.toString())},this._rotateCompassArrow=()=>{const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t},this._setButtonTitle=(t,n)=>{const a=this._map._getUIString(`NavigationControl.${n}`);t.title=a,t.setAttribute("aria-label",a)},this.options=c.extend({},$t,h),this._container=re.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),re.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),re.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=re.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(h){return this._map=h,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new sl(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){re.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(h,t){const n=re.create("button",h,this._container);return n.type="button",n.addEventListener("click",t),n}},ct.GeolocateControl=class extends c.Evented{constructor(h){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new c.Event("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(t),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new c.Event("geolocate",t)),this._finish()}},this._updateCamera=t=>{const n=new c.LngLat(t.coords.longitude,t.coords.latitude),a=t.coords.accuracy,l=this._map.getBearing(),d=c.extend({bearing:l},this.options.fitBoundsOptions),m=mt.fromLngLat(n,a);this._map.fitBounds(m,d,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const n=new c.LngLat(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=t=>{if(this._map){if(this.options.trackUserLocation)if(t.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&Sn)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new c.Event("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=t=>{if(this._map){if(this._container.addEventListener("contextmenu",n=>n.preventDefault()),this._geolocateButton=re.create("button","maplibregl-ctrl-geolocate",this._container),re.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",t===!1){c.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}else{const n=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=re.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new zs({element:this._dotElement}),this._circleElement=re.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new zs({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",n=>{n.geolocateSource||this._watchState!=="ACTIVE_LOCK"||n.originalEvent&&n.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new c.Event("trackuserlocationend")))})}},this.options=c.extend({},ks,h)}onAdd(h){return this._map=h,this._container=re.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(t,n=!1){sr===void 0||n?window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(a=>{sr=a.state!=="denied",t(sr)}).catch(()=>{sr=!!window.navigator.geolocation,t(sr)}):(sr=!!window.navigator.geolocation,t(sr)):t(sr)}(this._setupUI),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),re.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Gn=0,Sn=!1}_isOutOfMapMaxBounds(h){const t=this._map.getMaxBounds(),n=h.coords;return t&&(n.longitudet.getEast()||n.latitudet.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const h=this._map.getBounds(),t=h.getSouthEast(),n=h.getNorthEast(),a=t.distanceTo(n),l=Math.ceil(this._accuracy/(a/this._map._container.clientHeight)*2);this._circleElement.style.width=`${l}px`,this._circleElement.style.height=`${l}px`}trigger(){if(!this._setup)return c.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new c.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Gn--,Sn=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new c.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new c.Event("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let h;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Gn++,Gn>1?(h={maximumAge:6e5,timeout:0},Sn=!0):(h=this.options.positionOptions,Sn=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,h)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},ct.AttributionControl=fr,ct.LogoControl=As,ct.ScaleControl=class{constructor(h){this._onMove=()=>{ma(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,ma(this._map,this._container,this.options)},this.options=c.extend({},no,h)}getDefaultPosition(){return"bottom-left"}onAdd(h){return this._map=h,this._container=re.create("div","maplibregl-ctrl maplibregl-ctrl-scale",h.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){re.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},ct.FullscreenControl=class extends c.Evented{constructor(h={}){super(),this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,h&&h.container&&(h.container instanceof HTMLElement?this._container=h.container:c.warnOnce("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(h){return this._map=h,this._container||(this._container=this._map.getContainer()),this._controlContainer=re.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){re.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const h=this._fullscreenButton=re.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);re.create("span","maplibregl-ctrl-icon",h).setAttribute("aria-hidden","true"),h.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const h=this._getTitle();this._fullscreenButton.setAttribute("aria-label",h),this._fullscreenButton.title=h}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new c.Event("fullscreenstart")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new c.Event("fullscreenend")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures))}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},ct.TerrainControl=class{constructor(h){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))},this.options=h}onAdd(h){return this._map=h,this._container=re.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=re.create("button","maplibregl-ctrl-terrain",this._container),re.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){re.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},ct.Popup=class extends c.Evented{constructor(h){super(),this.remove=()=>(this._content&&re.remove(this._content),this._container&&(re.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new c.Event("close")),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=re.create("div","maplibregl-popup",this._map.getContainer()),this._tip=re.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const m of this.options.className.split(" "))this._container.classList.add(m);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Ms(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!t)return;const n=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);let a=this.options.anchor;const l=ga(this.options.offset);if(!a){const m=this._container.offsetWidth,g=this._container.offsetHeight;let y;y=n.y+l.bottom.ythis._map.transform.height-g?["bottom"]:[],n.xthis._map.transform.width-m/2&&y.push("right"),a=y.length===0?"bottom":y.join("-")}const d=n.add(l[a]).round();re.setTransform(this._container,`${Ps[a]} translate(${d.x}px,${d.y}px)`),fa(this._container,a,"popup")},this._onClose=()=>{this.remove()},this.options=c.extend(Object.create(so),h)}addTo(h){return this._map&&this.remove(),this._map=h,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new c.Event("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(h){return this._lngLat=c.LngLat.convert(h),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(h){return this.setDOMContent(document.createTextNode(h))}setHTML(h){const t=document.createDocumentFragment(),n=document.createElement("body");let a;for(n.innerHTML=h;a=n.firstChild,a;)t.appendChild(a);return this.setDOMContent(t)}getMaxWidth(){var h;return(h=this._container)===null||h===void 0?void 0:h.style.maxWidth}setMaxWidth(h){return this.options.maxWidth=h,this._update(),this}setDOMContent(h){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=re.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(h),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(h){this._container&&this._container.classList.add(h)}removeClassName(h){this._container&&this._container.classList.remove(h)}setOffset(h){return this.options.offset=h,this._update(),this}toggleClassName(h){if(this._container)return this._container.classList.toggle(h)}_createCloseButton(){this.options.closeButton&&(this._closeButton=re.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const h=this._container.querySelector(ao);h&&h.focus()}},ct.Marker=zs,ct.Style=mi,ct.LngLat=c.LngLat,ct.LngLatBounds=mt,ct.Point=c.Point,ct.MercatorCoordinate=c.MercatorCoordinate,ct.Evented=c.Evented,ct.AJAXError=c.AJAXError,ct.config=c.config,ct.CanvasSource=le,ct.GeoJSONSource=dr,ct.ImageSource=Ni,ct.RasterDEMTileSource=Rr,ct.RasterTileSource=ur,ct.VectorTileSource=Br,ct.VideoSource=pr,ct.setRTLTextPlugin=c.setRTLTextPlugin,ct.getRTLTextPluginStatus=c.getRTLTextPluginStatus,ct.prewarm=function(){tn().acquire(we)},ct.clearPrewarmedResources=function(){const h=Or;h&&(h.isPreloaded()&&h.numActive()===1?(h.release(we),Or=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},_a.extend(ct,{isSafari:c.isSafari,getPerformanceMetrics:c.PerformanceUtils.getPerformanceMetrics}),ct});var Me=ee;return Me})})(Au);var Fp=Au.exports;const jc=Rp(Fp);var Qi=(R,Z,X)=>new Promise((Y,ee)=>{var ge=Oe=>{try{c(X.next(Oe))}catch(re){ee(re)}},Me=Oe=>{try{c(X.throw(Oe))}catch(re){ee(re)}},c=Oe=>Oe.done?Y(Oe.value):Promise.resolve(Oe.value).then(ge,Me);c((X=X.apply(R,Z)).next())}),wr=Uint8Array,Pa=Uint16Array,Op=Int32Array,Mu=new wr([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Pu=new wr([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Up=new wr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),zu=function(R,Z){for(var X=new Pa(31),Y=0;Y<31;++Y)X[Y]=Z+=1<>1|(xt&21845)<<1,Dn=(Dn&52428)>>2|(Dn&13107)<<2,Dn=(Dn&61680)>>4|(Dn&3855)<<4,qc[xt]=((Dn&65280)>>8|(Dn&255)<<8)>>1;var Dn,xt,Mo=function(R,Z,X){for(var Y=R.length,ee=0,ge=new Pa(Z);ee>Oe]=re}else for(c=new Pa(Y),ee=0;ee>15-R[ee]);return c},Po=new wr(288);for(xt=0;xt<144;++xt)Po[xt]=8;var xt;for(xt=144;xt<256;++xt)Po[xt]=9;var xt;for(xt=256;xt<280;++xt)Po[xt]=7;var xt;for(xt=280;xt<288;++xt)Po[xt]=8;var xt,Lu=new wr(32);for(xt=0;xt<32;++xt)Lu[xt]=5;var xt,qp=Mo(Po,9,1),Zp=Mo(Lu,5,1),Nc=function(R){for(var Z=R[0],X=1;XZ&&(Z=R[X]);return Z},Hr=function(R,Z,X){var Y=Z/8|0;return(R[Y]|R[Y+1]<<8)>>(Z&7)&X},$c=function(R,Z){var X=Z/8|0;return(R[X]|R[X+1]<<8|R[X+2]<<16)>>(Z&7)},jp=function(R){return(R+7)/8|0},Gp=function(R,Z,X){(Z==null||Z<0)&&(Z=0),(X==null||X>R.length)&&(X=R.length);var Y=new wr(X-Z);return Y.set(R.subarray(Z,X)),Y},Xp=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],br=function(R,Z,X){var Y=new Error(Z||Xp[R]);if(Y.code=R,Error.captureStackTrace&&Error.captureStackTrace(Y,br),!X)throw Y;return Y},Gc=function(R,Z,X,Y){var ee=R.length,ge=Y?Y.length:0;if(!ee||Z.f&&!Z.l)return X||new wr(0);var Me=!X||Z.i!=2,c=Z.i;X||(X=new wr(ee*3));var Oe=function(Ii){var Ni=X.length;if(Ii>Ni){var pr=new wr(Math.max(Ni*2,Ii));pr.set(X),X=pr}},re=Z.f||0,De=Z.p||0,me=Z.b||0,dt=Z.l,Ct=Z.d,Yt=Z.m,ai=Z.n,jt=ee*8;do{if(!dt){re=Hr(R,De,1);var vt=Hr(R,De+1,3);if(De+=3,vt)if(vt==1)dt=qp,Ct=Zp,Yt=9,ai=5;else if(vt==2){var er=Hr(R,De,31)+257,Jr=Hr(R,De+10,15)+4,wi=er+Hr(R,De+5,31)+1;De+=14;for(var di=new wr(wi),Qt=new wr(19),Je=0;Je>4;if(Mt<16)di[Je++]=Mt;else{var Ti=0,Ei=0;for(Mt==16?(Ei=3+Hr(R,De,3),De+=2,Ti=di[Je-1]):Mt==17?(Ei=3+Hr(R,De,7),De+=3):Mt==18&&(Ei=11+Hr(R,De,127),De+=7);Ei--;)di[Je++]=Ti}}var Lr=di.subarray(0,er),ei=di.subarray(er);Yt=Nc(Lr),ai=Nc(ei),dt=Mo(Lr,Yt,1),Ct=Mo(ei,ai,1)}else br(1);else{var Mt=jp(De)+4,Jt=R[Mt-4]|R[Mt-3]<<8,Yr=Mt+Jt;if(Yr>ee){c&&br(0);break}Me&&Oe(me+Jt),X.set(R.subarray(Mt,Yr),me),Z.b=me+=Jt,Z.p=De=Yr*8,Z.f=re;continue}if(De>jt){c&&br(0);break}}Me&&Oe(me+131072);for(var en=(1<>4;if(De+=Ti&15,De>jt){c&&br(0);break}if(Ti||br(2),li<256)X[me++]=li;else if(li==256){cr=De,dt=null;break}else{var Si=li-254;if(li>264){var Je=li-257,mt=Mu[Je];Si=Hr(R,De,(1<>4;hr||br(3),De+=hr&15;var ei=$p[Br];if(Br>3){var mt=Pu[Br];ei+=$c(R,De)&(1<jt){c&&br(0);break}Me&&Oe(me+131072);var ur=me+Si;if(me>3&1)+(Z>>4&1);Y>0;Y-=!R[X++]);return X+(Z&2)},Kp=function(R){var Z=R.length;return(R[Z-4]|R[Z-3]<<8|R[Z-2]<<16|R[Z-1]<<24)>>>0},Yp=function(R,Z){return((R[0]&15)!=8||R[0]>>4>7||(R[0]<<8|R[1])%31)&&br(6,"invalid zlib data"),(R[1]>>5&1)==+!Z&&br(6,"invalid zlib data: "+(R[1]&32?"need":"unexpected")+" dictionary"),(R[1]>>3&4)+2};function Jp(R,Z){return Gc(R,{i:2},Z&&Z.out,Z&&Z.dictionary)}function Qp(R,Z){var X=Hp(R);return X+8>R.length&&br(6,"invalid gzip data"),Gc(R.subarray(X,-8),{i:2},Z&&Z.out||new wr(Kp(R)),Z&&Z.dictionary)}function ef(R,Z){return Gc(R.subarray(Yp(R,Z&&Z.dictionary),-4),{i:2},Z&&Z.out,Z&&Z.dictionary)}function Zc(R,Z){return R[0]==31&&R[1]==139&&R[2]==8?Qp(R,Z):(R[0]&15)!=8||R[0]>>4>7||(R[0]<<8|R[1])%31?Jp(R,Z):ef(R,Z)}var tf=typeof TextDecoder<"u"&&new TextDecoder,rf=0;try{tf.decode(Wp,{stream:!0}),rf=1}catch{}var Bu=(R,Z)=>R*Math.pow(2,Z),Ao=(R,Z)=>Math.floor(R/Math.pow(2,Z)),Cl=(R,Z)=>Bu(R.getUint16(Z+1,!0),8)+R.getUint8(Z),Ru=(R,Z)=>Bu(R.getUint32(Z+2,!0),16)+R.getUint16(Z,!0),nf=(R,Z,X,Y,ee)=>{if(R!=Y.getUint8(ee))return R-Y.getUint8(ee);const ge=Cl(Y,ee+1);if(Z!=ge)return Z-ge;const Me=Cl(Y,ee+4);return X!=Me?X-Me:0},sf=(R,Z,X,Y)=>{const ee=Fu(R,Z|128,X,Y);return ee?{z:Z,x:X,y:Y,offset:ee[0],length:ee[1],is_dir:!0}:null},Eu=(R,Z,X,Y)=>{const ee=Fu(R,Z,X,Y);return ee?{z:Z,x:X,y:Y,offset:ee[0],length:ee[1],is_dir:!1}:null},Fu=(R,Z,X,Y)=>{let ee=0,ge=R.byteLength/17-1;for(;ee<=ge;){const Me=ge+ee>>1,c=nf(Z,X,Y,R,Me*17);if(c>0)ee=Me+1;else if(c<0)ge=Me-1;else return[Ru(R,Me*17+7),R.getUint32(Me*17+13,!0)]}return null},af=(R,Z)=>R.is_dir&&!Z.is_dir?1:!R.is_dir&&Z.is_dir?-1:R.z!==Z.z?R.z-Z.z:R.x!==Z.x?R.x-Z.x:R.y-Z.y,Ou=(R,Z)=>{const X=R.getUint8(Z*17);return{z:X&127,x:Cl(R,Z*17+1),y:Cl(R,Z*17+4),offset:Ru(R,Z*17+7),length:R.getUint32(Z*17+13,!0),is_dir:X>>7===1}},Su=R=>{const Z=[],X=new DataView(R);for(let Y=0;Y{R.sort(af);const Z=new ArrayBuffer(17*R.length),X=new Uint8Array(Z);for(let Y=0;Y>8&255,X[Y*17+3]=ee.x>>16&255,X[Y*17+4]=ee.y&255,X[Y*17+5]=ee.y>>8&255,X[Y*17+6]=ee.y>>16&255,X[Y*17+7]=ee.offset&255,X[Y*17+8]=Ao(ee.offset,8)&255,X[Y*17+9]=Ao(ee.offset,16)&255,X[Y*17+10]=Ao(ee.offset,24)&255,X[Y*17+11]=Ao(ee.offset,32)&255,X[Y*17+12]=Ao(ee.offset,48)&255,X[Y*17+13]=ee.length&255,X[Y*17+14]=ee.length>>8&255,X[Y*17+15]=ee.length>>16&255,X[Y*17+16]=ee.length>>24&255}return Z},lf=(R,Z)=>{if(R.byteLength<17)return null;const X=R.byteLength/17,Y=Ou(R,X-1);if(Y.is_dir){const ee=Y.z,ge=Z.z-ee,Me=Math.trunc(Z.x/(1<{if(R.type=="json"){const X=R.url.substr(10);let Y=this.tiles.get(X);return Y||(Y=new Iu(X),this.tiles.set(X,Y)),Y.getHeader().then(ee=>{const ge={tiles:[R.url+"/{z}/{x}/{y}"],minzoom:ee.minZoom,maxzoom:ee.maxZoom,bounds:[ee.minLon,ee.minLat,ee.maxLon,ee.maxLat]};Z(null,ge,null,null)}).catch(ee=>{Z(ee,null,null,null)}),{cancel:()=>{}}}else{const X=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),Y=R.url.match(X);if(!Y)throw new Error("Invalid PMTiles protocol URL");const ee=Y[1];let ge=this.tiles.get(ee);ge||(ge=new Iu(ee),this.tiles.set(ee,ge));const Me=Y[2],c=Y[3],Oe=Y[4],re=new AbortController,De=re.signal;let me=()=>{re.abort()};return ge.getHeader().then(dt=>{ge.getZxy(+Me,+c,+Oe,De).then(Ct=>{Ct?Z(null,new Uint8Array(Ct.data),Ct.cacheControl,Ct.expires):dt.tileType==1?Z(null,new Uint8Array,null,null):Z(null,null,null,null)}).catch(Ct=>{Ct.name!=="AbortError"&&Z(Ct,null,null,null)})}),{cancel:me}}},this.tiles=new Map}add(R){this.tiles.set(R.source.getKey(),R)}get(R){return this.tiles.get(R)}};function Ma(R,Z){return(Z>>>0)*4294967296+(R>>>0)}function df(R,Z){const X=Z.buf;let Y,ee;if(ee=X[Z.pos++],Y=(ee&112)>>4,ee<128||(ee=X[Z.pos++],Y|=(ee&127)<<3,ee<128)||(ee=X[Z.pos++],Y|=(ee&127)<<10,ee<128)||(ee=X[Z.pos++],Y|=(ee&127)<<17,ee<128)||(ee=X[Z.pos++],Y|=(ee&127)<<24,ee<128)||(ee=X[Z.pos++],Y|=(ee&1)<<31,ee<128))return Ma(R,Y);throw new Error("Expected varint not more than 10 bytes")}function Co(R){const Z=R.buf;let X,Y;return Y=Z[R.pos++],X=Y&127,Y<128||(Y=Z[R.pos++],X|=(Y&127)<<7,Y<128)||(Y=Z[R.pos++],X|=(Y&127)<<14,Y<128)||(Y=Z[R.pos++],X|=(Y&127)<<21,Y<128)?X:(Y=Z[R.pos],X|=(Y&15)<<28,df(X,R))}function pf(R,Z,X,Y){if(Y==0){X==1&&(Z[0]=R-1-Z[0],Z[1]=R-1-Z[1]);const ee=Z[0];Z[0]=Z[1],Z[1]=ee}}var ff=[0,1,5,21,85,341,1365,5461,21845,87381,349525,1398101,5592405,22369621,89478485,357913941,1431655765,5726623061,22906492245,91625968981,366503875925,1466015503701,5864062014805,23456248059221,93824992236885,375299968947541,0x5555555555555];function mf(R,Z,X){if(R>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(Z>Math.pow(2,R)-1||X>Math.pow(2,R)-1)throw Error("tile x/y outside zoom level bounds");const Y=ff[R],ee=Math.pow(2,R);let ge=0,Me=0,c=0;const Oe=[Z,X];let re=ee/2;for(;re>0;)ge=(Oe[0]&re)>0?1:0,Me=(Oe[1]&re)>0?1:0,c+=re*re*(3*ge^Me),pf(re,Oe,ge,Me),re=re/2;return Y+c}function Vu(R,Z){return Qi(this,null,function*(){if(Z===1||Z===0)return R;if(Z===2){if(typeof globalThis.DecompressionStream>"u")return Zc(new Uint8Array(R));{let Y=new Response(R).body.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(Y).arrayBuffer()}}else throw Error("Compression method not supported")})}var gf=127;function _f(R,Z){let X=0,Y=R.length-1;for(;X<=Y;){const ee=Y+X>>1,ge=Z-R[ee].tileId;if(ge>0)X=ee+1;else if(ge<0)Y=ee-1;else return R[ee]}return Y>=0&&(R[Y].runLength===0||Z-R[Y].tileId=300)throw Error("Bad response code: "+ee.status);const ge=ee.headers.get("Content-Length");if(ee.status===200&&(!ge||+ge>Z))throw Y&&Y.abort(),Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");return{data:yield ee.arrayBuffer(),etag:ee.headers.get("ETag")||void 0,cacheControl:ee.headers.get("Cache-Control")||void 0,expires:ee.headers.get("Expires")||void 0}})}};function Kr(R,Z){const X=R.getUint32(Z+4,!0),Y=R.getUint32(Z+0,!0);return X*Math.pow(2,32)+Y}function xf(R,Z){const X=new DataView(R),Y=X.getUint8(7);if(Y>3)throw Error(`Archive is spec version ${Y} but this library supports up to spec version 3`);return{specVersion:Y,rootDirectoryOffset:Kr(X,8),rootDirectoryLength:Kr(X,16),jsonMetadataOffset:Kr(X,24),jsonMetadataLength:Kr(X,32),leafDirectoryOffset:Kr(X,40),leafDirectoryLength:Kr(X,48),tileDataOffset:Kr(X,56),tileDataLength:Kr(X,64),numAddressedTiles:Kr(X,72),numTileEntries:Kr(X,80),numTileContents:Kr(X,88),clustered:X.getUint8(96)===1,internalCompression:X.getUint8(97),tileCompression:X.getUint8(98),tileType:X.getUint8(99),minZoom:X.getUint8(100),maxZoom:X.getUint8(101),minLon:X.getInt32(102,!0)/1e7,minLat:X.getInt32(106,!0)/1e7,maxLon:X.getInt32(110,!0)/1e7,maxLat:X.getInt32(114,!0)/1e7,centerZoom:X.getUint8(118),centerLon:X.getInt32(119,!0)/1e7,centerLat:X.getInt32(123,!0)/1e7,etag:Z}}function Nu(R){const Z={buf:new Uint8Array(R),pos:0},X=Co(Z),Y=[];let ee=0;for(let ge=0;ge0?Y[ge].offset=Y[ge-1].offset+Y[ge-1].length:Y[ge].offset=Me-1}return Y}function vf(R){const Z=new DataView(R);return Z.getUint16(2,!0)===2?(console.warn("PMTiles spec version 2 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),2):Z.getUint16(2,!0)===1?(console.warn("PMTiles spec version 1 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),1):3}var za=class extends Error{};function bf(R,Z,X,Y){return Qi(this,null,function*(){const ee=yield R.getBytes(0,16384);if(new DataView(ee.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");if(vf(ee.data)<3)return[yield Uu.getHeader(R)];const Me=ee.data.slice(0,gf);let c=ee.etag;Y&&ee.etag!=Y&&(console.warn("ETag conflict detected; your HTTP server might not support content-based ETag headers. ETags disabled for "+R.getKey()),c=void 0);const Oe=xf(Me,c);if(X){const re=ee.data.slice(Oe.rootDirectoryOffset,Oe.rootDirectoryOffset+Oe.rootDirectoryLength),De=R.getKey()+"|"+(Oe.etag||"")+"|"+Oe.rootDirectoryOffset+"|"+Oe.rootDirectoryLength,me=Nu(yield Z(re,Oe.internalCompression));return[Oe,[De,me.length,me]]}return[Oe,void 0]})}function wf(R,Z,X,Y,ee){return Qi(this,null,function*(){const ge=yield R.getBytes(X,Y);if(ee.etag&&ee.etag!==ge.etag)throw new za(ge.etag);const Me=yield Z(ge.data,ee.internalCompression),c=Nu(Me);if(c.length===0)throw new Error("Empty directory is invalid");return c})}var Tf=class{constructor(R=100,Z=!0,X=Vu){this.cache=new Map,this.maxCacheEntries=R,this.counter=1,this.prefetch=Z,this.decompress=X}getHeader(R,Z){return Qi(this,null,function*(){const X=R.getKey();if(this.cache.has(X))return this.cache.get(X).lastUsed=this.counter++,yield this.cache.get(X).data;const Y=new Promise((ee,ge)=>{bf(R,this.decompress,this.prefetch,Z).then(Me=>{Me[1]&&this.cache.set(Me[1][0],{lastUsed:this.counter++,data:Promise.resolve(Me[1][2])}),ee(Me[0]),this.prune()}).catch(Me=>{ge(Me)})});return this.cache.set(X,{lastUsed:this.counter++,data:Y}),Y})}getDirectory(R,Z,X,Y){return Qi(this,null,function*(){const ee=R.getKey()+"|"+(Y.etag||"")+"|"+Z+"|"+X;if(this.cache.has(ee))return this.cache.get(ee).lastUsed=this.counter++,yield this.cache.get(ee).data;const ge=new Promise((Me,c)=>{wf(R,this.decompress,Z,X,Y).then(Oe=>{Me(Oe),this.prune()}).catch(Oe=>{c(Oe)})});return this.cache.set(ee,{lastUsed:this.counter++,data:ge}),ge})}getArrayBuffer(R,Z,X,Y){return Qi(this,null,function*(){const ee=R.getKey()+"|"+(Y.etag||"")+"|"+Z+"|"+X;if(this.cache.has(ee))return this.cache.get(ee).lastUsed=this.counter++,yield this.cache.get(ee).data;const ge=new Promise((Me,c)=>{R.getBytes(Z,X).then(Oe=>{if(Y.etag&&Y.etag!==Oe.etag)throw new za(Oe.etag);Me(Oe.data),this.cache.has(ee),this.prune()}).catch(Oe=>{c(Oe)})});return this.cache.set(ee,{lastUsed:this.counter++,data:ge}),ge})}prune(){if(this.cache.size>=this.maxCacheEntries){let R=1/0,Z;this.cache.forEach((X,Y)=>{X.lastUsedge.maxZoom)return;let Me=ge.rootDirectoryOffset,c=ge.rootDirectoryLength;for(let Oe=0;Oe<=3;Oe++){const re=yield this.cache.getDirectory(this.source,Me,c,ge),De=_f(re,ee);if(De)if(De.runLength>0){const me=yield this.source.getBytes(ge.tileDataOffset+De.offset,De.length,Y);if(ge.etag&&ge.etag!==me.etag)throw new za(me.etag);return{data:yield this.decompress(me.data,ge.tileCompression),cacheControl:me.cacheControl,expires:me.expires}}else Me=ge.leafDirectoryOffset+De.offset,c=De.length;else return}throw Error("Maximum directory depth exceeded")})}getZxy(R,Z,X,Y){return Qi(this,null,function*(){try{return yield this.getZxyAttempt(R,Z,X,Y)}catch(ee){if(ee instanceof za)return this.cache.invalidate(this.source,ee.message),yield this.getZxyAttempt(R,Z,X,Y);throw ee}})}getMetadataAttempt(){return Qi(this,null,function*(){const R=yield this.cache.getHeader(this.source),Z=yield this.source.getBytes(R.jsonMetadataOffset,R.jsonMetadataLength);if(R.etag&&R.etag!==Z.etag)throw new za(Z.etag);const X=yield this.decompress(Z.data,R.internalCompression),Y=new TextDecoder("utf-8");return JSON.parse(Y.decode(X))})}getMetadata(){return Qi(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(R){if(R instanceof za)return this.cache.invalidate(this.source,R.message),yield this.getMetadataAttempt();throw R}})}};let Ef=new uf;jc.addProtocol("pmtiles",Ef.tile);let Sf=location.hostname;console.log(Sf);const Al=new jc.Map({container:"map",hash:!0,style:{version:8,glyphs:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf",sources:{overture:{type:"vector",url:location.hostname.includes("github.io")?"pmtiles://https://storage.googleapis.com/ahp-research/overture/pmtiles/overture.pmtiles":"pmtiles://dist/overture.pmtiles",attribution:"© OpenStreetMap, Overture Maps Foundation, Barry"}},layers:[{id:"admins",type:"fill",source:"overture","source-layer":"admins",paint:{"fill-color":"#000"}},{id:"admins-outline",type:"line",source:"overture","source-layer":"admins",paint:{"line-color":"#6a6a6a","line-width":1}},{id:"buldings-extruded",type:"fill-extrusion",source:"overture","source-layer":"buildings",paint:{"fill-extrusion-color":"#1C1C1C","fill-extrusion-height":["case",["==",["get","height"],-1],0,["get","height"]],"fill-extrusion-opacity":.9}},{id:"roads",type:"line",source:"overture","source-layer":"roads",paint:{"line-color":["case",["==",["get","class"],"motorway"],"#717171",["==",["get","class"],"primary"],"#717171",["==",["get","class"],"secondary"],"#717171",["==",["get","class"],"tertiary"],"#717171",["==",["get","class"],"residential"],"#464646",["==",["get","class"],"livingStreet"],"#464646",["==",["get","class"],"trunk"],"#5A5A5A",["==",["get","class"],"unclassified"],"#5A5A5A",["==",["get","class"],"parkingAisle"],"#323232",["==",["get","class"],"driveway"],"#1C1C1C",["==",["get","class"],"pedestrian"],"#232323",["==",["get","class"],"footway"],"#1C1C1C",["==",["get","class"],"steps"],"#1C1C1C",["==",["get","class"],"track"],"#1C1C1C",["==",["get","class"],"cycleway"],"#1C1C1C",["==",["get","class"],"unknown"],"#1C1C1C","#5A5A5A"],"line-width":["case",["==",["get","class"],"motorway"],6,["==",["get","class"],"primary"],5,["==",["get","class"],"secondary"],4,["==",["get","class"],"tertiary"],3,["==",["get","class"],"residential"],3,["==",["get","class"],"livingStreet"],3,["==",["get","class"],"trunk"],2,["==",["get","class"],"unclassified"],2,["==",["get","class"],"parkingAisle"],2,["==",["get","class"],"driveway"],2,["==",["get","class"],"pedestrian"],3,["==",["get","class"],"footway"],3,["==",["get","class"],"steps"],2,["==",["get","class"],"track"],2,["==",["get","class"],"cycleway"],2,["==",["get","class"],"unknown"],2,2]},layout:{"line-cap":"round"}},{id:"roads-labels",type:"symbol",source:"overture","source-layer":"roads",layout:{"icon-allow-overlap":!1,"symbol-placement":"line","text-field":["get","roadName"],"text-radial-offset":.5,"text-size":12},paint:{"text-color":"#E2E2E2","text-halo-color":"#000","text-halo-width":3,"text-halo-blur":2}},{id:"places",type:"circle",source:"overture","source-layer":"places",paint:{"circle-color":"#4EDAD8","circle-radius":5,"circle-blur":.3,"circle-opacity":.8}},{id:"places-labels",type:"symbol",source:"overture","source-layer":"places",layout:{"icon-allow-overlap":!1,"text-allow-overlap":!1,"text-anchor":"bottom","text-radial-offset":1,"symbol-placement":"point","text-field":["get","name"],"text-size":10},paint:{"text-color":"#4EDAD8","text-halo-color":"black","text-halo-width":3,"text-halo-blur":2}}]},center:[4.91431,52.34304],zoom:14});Al.on("click",function(R){for(var Z=Al.getStyle().layers,X=0;X"+Y+"";for(var c in ge.properties)ge.properties.hasOwnProperty(c)&&(Me+="");Me+="
"+c+""+ge.properties[c]+"
",new jc.Popup().setLngLat(R.lngLat).setHTML(Me).addTo(Al)}}}); + `,this._cooperativeGesturesScreen.setAttribute("aria-hidden","true"),this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){re.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(h,t,n){this._canvas.width=Math.floor(n*h),this._canvas.height=Math.floor(n*t),this._canvas.style.width=`${h}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const h={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let t=null;this._canvas.addEventListener("webglcontextcreationerror",a=>{t={requestedAttributes:h},a&&(t.statusMessage=a.statusMessage,t.type=a.type)},{once:!0});const n=this._canvas.getContext("webgl2",h)||this._canvas.getContext("webgl",h);if(!n){const a="Failed to initialize WebGL";throw t?(t.message=a,new Error(JSON.stringify(t))):new Error(a)}this.painter=new Ho(n,this.transform),De.testSupport(n)}_onCooperativeGesture(h,t,n){return!t&&n<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(h){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||h,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(h){return this._update(),this._renderTaskQueue.add(h)}_cancelRenderFrame(h){this._renderTaskQueue.remove(h)}_render(h){const t=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(h),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const l=this.transform.zoom,d=c.browser.now();this.style.zoomHistory.update(l,d);const m=new c.EvaluationParameters(l,{now:d,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),g=m.crossFadingFactor();g===1&&g===this._crossFadingFactor||(n=!0,this._crossFadingFactor=g),this.style.update(m)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,t,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding}),this.fire(new c.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,c.PerformanceUtils.mark(c.PerformanceMarkers.load),this.fire(new c.Event("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const a=this._sourcesDirty||this._styleDirty||this._placementDirty;return a||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new c.Event("idle")),!this._loaded||this._fullyLoaded||a||(this._fullyLoaded=!0,c.PerformanceUtils.mark(c.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var h;this._hash&&this._hash.remove();for(const n of this._controls)n.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),jt.removeThrottleControl(this._imageQueueHandle),(h=this._resizeObserver)===null||h===void 0||h.disconnect();const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),re.remove(this._canvasContainer),re.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),c.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new c.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=c.browser.frame(h=>{c.PerformanceUtils.frame(h),this._frame=null,this._render(h)}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(h){this._showTileBoundaries!==h&&(this._showTileBoundaries=h,this._update())}get showPadding(){return!!this._showPadding}set showPadding(h){this._showPadding!==h&&(this._showPadding=h,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(h){this._showCollisionBoxes!==h&&(this._showCollisionBoxes=h,h?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(h){this._showOverdrawInspector!==h&&(this._showOverdrawInspector=h,this._update())}get repaint(){return!!this._repaint}set repaint(h){this._repaint!==h&&(this._repaint=h,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(h){this._vertices=h,this._update()}get version(){return Yl}getCameraTargetElevation(){return this.transform.elevation}},ct.NavigationControl=class{constructor(h){this._updateZoomButtons=()=>{const t=this._map.getZoom(),n=t===this._map.getMaxZoom(),a=t===this._map.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=a,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",a.toString())},this._rotateCompassArrow=()=>{const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t},this._setButtonTitle=(t,n)=>{const a=this._map._getUIString(`NavigationControl.${n}`);t.title=a,t.setAttribute("aria-label",a)},this.options=c.extend({},$t,h),this._container=re.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),re.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),re.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=re.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(h){return this._map=h,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new al(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){re.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(h,t){const n=re.create("button",h,this._container);return n.type="button",n.addEventListener("click",t),n}},ct.GeolocateControl=class extends c.Evented{constructor(h){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new c.Event("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(t),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new c.Event("geolocate",t)),this._finish()}},this._updateCamera=t=>{const n=new c.LngLat(t.coords.longitude,t.coords.latitude),a=t.coords.accuracy,l=this._map.getBearing(),d=c.extend({bearing:l},this.options.fitBoundsOptions),m=mt.fromLngLat(n,a);this._map.fitBounds(m,d,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const n=new c.LngLat(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=t=>{if(this._map){if(this.options.trackUserLocation)if(t.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&Sn)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new c.Event("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=t=>{if(this._map){if(this._container.addEventListener("contextmenu",n=>n.preventDefault()),this._geolocateButton=re.create("button","maplibregl-ctrl-geolocate",this._container),re.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",t===!1){c.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}else{const n=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=re.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new zs({element:this._dotElement}),this._circleElement=re.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new zs({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",n=>{n.geolocateSource||this._watchState!=="ACTIVE_LOCK"||n.originalEvent&&n.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new c.Event("trackuserlocationend")))})}},this.options=c.extend({},ks,h)}onAdd(h){return this._map=h,this._container=re.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(t,n=!1){sr===void 0||n?window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(a=>{sr=a.state!=="denied",t(sr)}).catch(()=>{sr=!!window.navigator.geolocation,t(sr)}):(sr=!!window.navigator.geolocation,t(sr)):t(sr)}(this._setupUI),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),re.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Gn=0,Sn=!1}_isOutOfMapMaxBounds(h){const t=this._map.getMaxBounds(),n=h.coords;return t&&(n.longitudet.getEast()||n.latitudet.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const h=this._map.getBounds(),t=h.getSouthEast(),n=h.getNorthEast(),a=t.distanceTo(n),l=Math.ceil(this._accuracy/(a/this._map._container.clientHeight)*2);this._circleElement.style.width=`${l}px`,this._circleElement.style.height=`${l}px`}trigger(){if(!this._setup)return c.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new c.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Gn--,Sn=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new c.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new c.Event("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let h;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Gn++,Gn>1?(h={maximumAge:6e5,timeout:0},Sn=!0):(h=this.options.positionOptions,Sn=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,h)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},ct.AttributionControl=fr,ct.LogoControl=As,ct.ScaleControl=class{constructor(h){this._onMove=()=>{ma(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,ma(this._map,this._container,this.options)},this.options=c.extend({},so,h)}getDefaultPosition(){return"bottom-left"}onAdd(h){return this._map=h,this._container=re.create("div","maplibregl-ctrl maplibregl-ctrl-scale",h.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){re.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},ct.FullscreenControl=class extends c.Evented{constructor(h={}){super(),this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,h&&h.container&&(h.container instanceof HTMLElement?this._container=h.container:c.warnOnce("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(h){return this._map=h,this._container||(this._container=this._map.getContainer()),this._controlContainer=re.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){re.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const h=this._fullscreenButton=re.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);re.create("span","maplibregl-ctrl-icon",h).setAttribute("aria-hidden","true"),h.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const h=this._getTitle();this._fullscreenButton.setAttribute("aria-label",h),this._fullscreenButton.title=h}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new c.Event("fullscreenstart")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new c.Event("fullscreenend")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures))}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},ct.TerrainControl=class{constructor(h){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))},this.options=h}onAdd(h){return this._map=h,this._container=re.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=re.create("button","maplibregl-ctrl-terrain",this._container),re.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){re.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},ct.Popup=class extends c.Evented{constructor(h){super(),this.remove=()=>(this._content&&re.remove(this._content),this._container&&(re.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new c.Event("close")),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=re.create("div","maplibregl-popup",this._map.getContainer()),this._tip=re.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const m of this.options.className.split(" "))this._container.classList.add(m);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Ms(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!t)return;const n=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);let a=this.options.anchor;const l=ga(this.options.offset);if(!a){const m=this._container.offsetWidth,g=this._container.offsetHeight;let y;y=n.y+l.bottom.ythis._map.transform.height-g?["bottom"]:[],n.xthis._map.transform.width-m/2&&y.push("right"),a=y.length===0?"bottom":y.join("-")}const d=n.add(l[a]).round();re.setTransform(this._container,`${Ps[a]} translate(${d.x}px,${d.y}px)`),fa(this._container,a,"popup")},this._onClose=()=>{this.remove()},this.options=c.extend(Object.create(ao),h)}addTo(h){return this._map&&this.remove(),this._map=h,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new c.Event("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(h){return this._lngLat=c.LngLat.convert(h),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(h){return this.setDOMContent(document.createTextNode(h))}setHTML(h){const t=document.createDocumentFragment(),n=document.createElement("body");let a;for(n.innerHTML=h;a=n.firstChild,a;)t.appendChild(a);return this.setDOMContent(t)}getMaxWidth(){var h;return(h=this._container)===null||h===void 0?void 0:h.style.maxWidth}setMaxWidth(h){return this.options.maxWidth=h,this._update(),this}setDOMContent(h){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=re.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(h),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(h){this._container&&this._container.classList.add(h)}removeClassName(h){this._container&&this._container.classList.remove(h)}setOffset(h){return this.options.offset=h,this._update(),this}toggleClassName(h){if(this._container)return this._container.classList.toggle(h)}_createCloseButton(){this.options.closeButton&&(this._closeButton=re.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const h=this._container.querySelector(oo);h&&h.focus()}},ct.Marker=zs,ct.Style=mi,ct.LngLat=c.LngLat,ct.LngLatBounds=mt,ct.Point=c.Point,ct.MercatorCoordinate=c.MercatorCoordinate,ct.Evented=c.Evented,ct.AJAXError=c.AJAXError,ct.config=c.config,ct.CanvasSource=le,ct.GeoJSONSource=dr,ct.ImageSource=Ni,ct.RasterDEMTileSource=Rr,ct.RasterTileSource=ur,ct.VectorTileSource=Br,ct.VideoSource=pr,ct.setRTLTextPlugin=c.setRTLTextPlugin,ct.getRTLTextPluginStatus=c.getRTLTextPluginStatus,ct.prewarm=function(){tn().acquire(we)},ct.clearPrewarmedResources=function(){const h=Or;h&&(h.isPreloaded()&&h.numActive()===1?(h.release(we),Or=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},_a.extend(ct,{isSafari:c.isSafari,getPerformanceMetrics:c.PerformanceUtils.getPerformanceMetrics}),ct});var Me=ee;return Me})})(Cu);var Op=Cu.exports;const jc=Fp(Op);var Qi=(R,Z,X)=>new Promise((Y,ee)=>{var ge=Oe=>{try{c(X.next(Oe))}catch(re){ee(re)}},Me=Oe=>{try{c(X.throw(Oe))}catch(re){ee(re)}},c=Oe=>Oe.done?Y(Oe.value):Promise.resolve(Oe.value).then(ge,Me);c((X=X.apply(R,Z)).next())}),wr=Uint8Array,Pa=Uint16Array,Up=Int32Array,Pu=new wr([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),zu=new wr([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Vp=new wr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ku=function(R,Z){for(var X=new Pa(31),Y=0;Y<31;++Y)X[Y]=Z+=1<>1|(xt&21845)<<1,Dn=(Dn&52428)>>2|(Dn&13107)<<2,Dn=(Dn&61680)>>4|(Dn&3855)<<4,qc[xt]=((Dn&65280)>>8|(Dn&255)<<8)>>1;var Dn,xt,Po=function(R,Z,X){for(var Y=R.length,ee=0,ge=new Pa(Z);ee>Oe]=re}else for(c=new Pa(Y),ee=0;ee>15-R[ee]);return c},zo=new wr(288);for(xt=0;xt<144;++xt)zo[xt]=8;var xt;for(xt=144;xt<256;++xt)zo[xt]=9;var xt;for(xt=256;xt<280;++xt)zo[xt]=7;var xt;for(xt=280;xt<288;++xt)zo[xt]=8;var xt,Bu=new wr(32);for(xt=0;xt<32;++xt)Bu[xt]=5;var xt,Zp=Po(zo,9,1),jp=Po(Bu,5,1),Nc=function(R){for(var Z=R[0],X=1;XZ&&(Z=R[X]);return Z},Hr=function(R,Z,X){var Y=Z/8|0;return(R[Y]|R[Y+1]<<8)>>(Z&7)&X},$c=function(R,Z){var X=Z/8|0;return(R[X]|R[X+1]<<8|R[X+2]<<16)>>(Z&7)},Gp=function(R){return(R+7)/8|0},Xp=function(R,Z,X){(Z==null||Z<0)&&(Z=0),(X==null||X>R.length)&&(X=R.length);var Y=new wr(X-Z);return Y.set(R.subarray(Z,X)),Y},Wp=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],br=function(R,Z,X){var Y=new Error(Z||Wp[R]);if(Y.code=R,Error.captureStackTrace&&Error.captureStackTrace(Y,br),!X)throw Y;return Y},Gc=function(R,Z,X,Y){var ee=R.length,ge=Y?Y.length:0;if(!ee||Z.f&&!Z.l)return X||new wr(0);var Me=!X||Z.i!=2,c=Z.i;X||(X=new wr(ee*3));var Oe=function(Ii){var Ni=X.length;if(Ii>Ni){var pr=new wr(Math.max(Ni*2,Ii));pr.set(X),X=pr}},re=Z.f||0,De=Z.p||0,me=Z.b||0,dt=Z.l,Ct=Z.d,Yt=Z.m,ai=Z.n,jt=ee*8;do{if(!dt){re=Hr(R,De,1);var vt=Hr(R,De+1,3);if(De+=3,vt)if(vt==1)dt=Zp,Ct=jp,Yt=9,ai=5;else if(vt==2){var er=Hr(R,De,31)+257,Jr=Hr(R,De+10,15)+4,wi=er+Hr(R,De+5,31)+1;De+=14;for(var di=new wr(wi),Qt=new wr(19),Je=0;Je>4;if(Mt<16)di[Je++]=Mt;else{var Ti=0,Ei=0;for(Mt==16?(Ei=3+Hr(R,De,3),De+=2,Ti=di[Je-1]):Mt==17?(Ei=3+Hr(R,De,7),De+=3):Mt==18&&(Ei=11+Hr(R,De,127),De+=7);Ei--;)di[Je++]=Ti}}var Lr=di.subarray(0,er),ei=di.subarray(er);Yt=Nc(Lr),ai=Nc(ei),dt=Po(Lr,Yt,1),Ct=Po(ei,ai,1)}else br(1);else{var Mt=Gp(De)+4,Jt=R[Mt-4]|R[Mt-3]<<8,Yr=Mt+Jt;if(Yr>ee){c&&br(0);break}Me&&Oe(me+Jt),X.set(R.subarray(Mt,Yr),me),Z.b=me+=Jt,Z.p=De=Yr*8,Z.f=re;continue}if(De>jt){c&&br(0);break}}Me&&Oe(me+131072);for(var en=(1<>4;if(De+=Ti&15,De>jt){c&&br(0);break}if(Ti||br(2),li<256)X[me++]=li;else if(li==256){cr=De,dt=null;break}else{var Si=li-254;if(li>264){var Je=li-257,mt=Pu[Je];Si=Hr(R,De,(1<>4;hr||br(3),De+=hr&15;var ei=qp[Br];if(Br>3){var mt=zu[Br];ei+=$c(R,De)&(1<jt){c&&br(0);break}Me&&Oe(me+131072);var ur=me+Si;if(me>3&1)+(Z>>4&1);Y>0;Y-=!R[X++]);return X+(Z&2)},Yp=function(R){var Z=R.length;return(R[Z-4]|R[Z-3]<<8|R[Z-2]<<16|R[Z-1]<<24)>>>0},Jp=function(R,Z){return((R[0]&15)!=8||R[0]>>4>7||(R[0]<<8|R[1])%31)&&br(6,"invalid zlib data"),(R[1]>>5&1)==+!Z&&br(6,"invalid zlib data: "+(R[1]&32?"need":"unexpected")+" dictionary"),(R[1]>>3&4)+2};function Qp(R,Z){return Gc(R,{i:2},Z&&Z.out,Z&&Z.dictionary)}function ef(R,Z){var X=Kp(R);return X+8>R.length&&br(6,"invalid gzip data"),Gc(R.subarray(X,-8),{i:2},Z&&Z.out||new wr(Yp(R)),Z&&Z.dictionary)}function tf(R,Z){return Gc(R.subarray(Jp(R,Z&&Z.dictionary),-4),{i:2},Z&&Z.out,Z&&Z.dictionary)}function Zc(R,Z){return R[0]==31&&R[1]==139&&R[2]==8?ef(R,Z):(R[0]&15)!=8||R[0]>>4>7||(R[0]<<8|R[1])%31?Qp(R,Z):tf(R,Z)}var rf=typeof TextDecoder<"u"&&new TextDecoder,nf=0;try{rf.decode(Hp,{stream:!0}),nf=1}catch{}var Ru=(R,Z)=>R*Math.pow(2,Z),Co=(R,Z)=>Math.floor(R/Math.pow(2,Z)),Cl=(R,Z)=>Ru(R.getUint16(Z+1,!0),8)+R.getUint8(Z),Fu=(R,Z)=>Ru(R.getUint32(Z+2,!0),16)+R.getUint16(Z,!0),sf=(R,Z,X,Y,ee)=>{if(R!=Y.getUint8(ee))return R-Y.getUint8(ee);const ge=Cl(Y,ee+1);if(Z!=ge)return Z-ge;const Me=Cl(Y,ee+4);return X!=Me?X-Me:0},af=(R,Z,X,Y)=>{const ee=Ou(R,Z|128,X,Y);return ee?{z:Z,x:X,y:Y,offset:ee[0],length:ee[1],is_dir:!0}:null},Eu=(R,Z,X,Y)=>{const ee=Ou(R,Z,X,Y);return ee?{z:Z,x:X,y:Y,offset:ee[0],length:ee[1],is_dir:!1}:null},Ou=(R,Z,X,Y)=>{let ee=0,ge=R.byteLength/17-1;for(;ee<=ge;){const Me=ge+ee>>1,c=sf(Z,X,Y,R,Me*17);if(c>0)ee=Me+1;else if(c<0)ge=Me-1;else return[Fu(R,Me*17+7),R.getUint32(Me*17+13,!0)]}return null},of=(R,Z)=>R.is_dir&&!Z.is_dir?1:!R.is_dir&&Z.is_dir?-1:R.z!==Z.z?R.z-Z.z:R.x!==Z.x?R.x-Z.x:R.y-Z.y,Uu=(R,Z)=>{const X=R.getUint8(Z*17);return{z:X&127,x:Cl(R,Z*17+1),y:Cl(R,Z*17+4),offset:Fu(R,Z*17+7),length:R.getUint32(Z*17+13,!0),is_dir:X>>7===1}},Su=R=>{const Z=[],X=new DataView(R);for(let Y=0;Y{R.sort(of);const Z=new ArrayBuffer(17*R.length),X=new Uint8Array(Z);for(let Y=0;Y>8&255,X[Y*17+3]=ee.x>>16&255,X[Y*17+4]=ee.y&255,X[Y*17+5]=ee.y>>8&255,X[Y*17+6]=ee.y>>16&255,X[Y*17+7]=ee.offset&255,X[Y*17+8]=Co(ee.offset,8)&255,X[Y*17+9]=Co(ee.offset,16)&255,X[Y*17+10]=Co(ee.offset,24)&255,X[Y*17+11]=Co(ee.offset,32)&255,X[Y*17+12]=Co(ee.offset,48)&255,X[Y*17+13]=ee.length&255,X[Y*17+14]=ee.length>>8&255,X[Y*17+15]=ee.length>>16&255,X[Y*17+16]=ee.length>>24&255}return Z},cf=(R,Z)=>{if(R.byteLength<17)return null;const X=R.byteLength/17,Y=Uu(R,X-1);if(Y.is_dir){const ee=Y.z,ge=Z.z-ee,Me=Math.trunc(Z.x/(1<{if(R.type=="json"){const X=R.url.substr(10);let Y=this.tiles.get(X);return Y||(Y=new Iu(X),this.tiles.set(X,Y)),Y.getHeader().then(ee=>{const ge={tiles:[R.url+"/{z}/{x}/{y}"],minzoom:ee.minZoom,maxzoom:ee.maxZoom,bounds:[ee.minLon,ee.minLat,ee.maxLon,ee.maxLat]};Z(null,ge,null,null)}).catch(ee=>{Z(ee,null,null,null)}),{cancel:()=>{}}}else{const X=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),Y=R.url.match(X);if(!Y)throw new Error("Invalid PMTiles protocol URL");const ee=Y[1];let ge=this.tiles.get(ee);ge||(ge=new Iu(ee),this.tiles.set(ee,ge));const Me=Y[2],c=Y[3],Oe=Y[4],re=new AbortController,De=re.signal;let me=()=>{re.abort()};return ge.getHeader().then(dt=>{ge.getZxy(+Me,+c,+Oe,De).then(Ct=>{Ct?Z(null,new Uint8Array(Ct.data),Ct.cacheControl,Ct.expires):dt.tileType==1?Z(null,new Uint8Array,null,null):Z(null,null,null,null)}).catch(Ct=>{Ct.name!=="AbortError"&&Z(Ct,null,null,null)})}),{cancel:me}}},this.tiles=new Map}add(R){this.tiles.set(R.source.getKey(),R)}get(R){return this.tiles.get(R)}};function Ma(R,Z){return(Z>>>0)*4294967296+(R>>>0)}function pf(R,Z){const X=Z.buf;let Y,ee;if(ee=X[Z.pos++],Y=(ee&112)>>4,ee<128||(ee=X[Z.pos++],Y|=(ee&127)<<3,ee<128)||(ee=X[Z.pos++],Y|=(ee&127)<<10,ee<128)||(ee=X[Z.pos++],Y|=(ee&127)<<17,ee<128)||(ee=X[Z.pos++],Y|=(ee&127)<<24,ee<128)||(ee=X[Z.pos++],Y|=(ee&1)<<31,ee<128))return Ma(R,Y);throw new Error("Expected varint not more than 10 bytes")}function Mo(R){const Z=R.buf;let X,Y;return Y=Z[R.pos++],X=Y&127,Y<128||(Y=Z[R.pos++],X|=(Y&127)<<7,Y<128)||(Y=Z[R.pos++],X|=(Y&127)<<14,Y<128)||(Y=Z[R.pos++],X|=(Y&127)<<21,Y<128)?X:(Y=Z[R.pos],X|=(Y&15)<<28,pf(X,R))}function ff(R,Z,X,Y){if(Y==0){X==1&&(Z[0]=R-1-Z[0],Z[1]=R-1-Z[1]);const ee=Z[0];Z[0]=Z[1],Z[1]=ee}}var mf=[0,1,5,21,85,341,1365,5461,21845,87381,349525,1398101,5592405,22369621,89478485,357913941,1431655765,5726623061,22906492245,91625968981,366503875925,1466015503701,5864062014805,23456248059221,93824992236885,375299968947541,0x5555555555555];function gf(R,Z,X){if(R>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(Z>Math.pow(2,R)-1||X>Math.pow(2,R)-1)throw Error("tile x/y outside zoom level bounds");const Y=mf[R],ee=Math.pow(2,R);let ge=0,Me=0,c=0;const Oe=[Z,X];let re=ee/2;for(;re>0;)ge=(Oe[0]&re)>0?1:0,Me=(Oe[1]&re)>0?1:0,c+=re*re*(3*ge^Me),ff(re,Oe,ge,Me),re=re/2;return Y+c}function Nu(R,Z){return Qi(this,null,function*(){if(Z===1||Z===0)return R;if(Z===2){if(typeof globalThis.DecompressionStream>"u")return Zc(new Uint8Array(R));{let Y=new Response(R).body.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(Y).arrayBuffer()}}else throw Error("Compression method not supported")})}var _f=127;function yf(R,Z){let X=0,Y=R.length-1;for(;X<=Y;){const ee=Y+X>>1,ge=Z-R[ee].tileId;if(ge>0)X=ee+1;else if(ge<0)Y=ee-1;else return R[ee]}return Y>=0&&(R[Y].runLength===0||Z-R[Y].tileId=300)throw Error("Bad response code: "+ee.status);const ge=ee.headers.get("Content-Length");if(ee.status===200&&(!ge||+ge>Z))throw Y&&Y.abort(),Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");return{data:yield ee.arrayBuffer(),etag:ee.headers.get("ETag")||void 0,cacheControl:ee.headers.get("Cache-Control")||void 0,expires:ee.headers.get("Expires")||void 0}})}};function Kr(R,Z){const X=R.getUint32(Z+4,!0),Y=R.getUint32(Z+0,!0);return X*Math.pow(2,32)+Y}function vf(R,Z){const X=new DataView(R),Y=X.getUint8(7);if(Y>3)throw Error(`Archive is spec version ${Y} but this library supports up to spec version 3`);return{specVersion:Y,rootDirectoryOffset:Kr(X,8),rootDirectoryLength:Kr(X,16),jsonMetadataOffset:Kr(X,24),jsonMetadataLength:Kr(X,32),leafDirectoryOffset:Kr(X,40),leafDirectoryLength:Kr(X,48),tileDataOffset:Kr(X,56),tileDataLength:Kr(X,64),numAddressedTiles:Kr(X,72),numTileEntries:Kr(X,80),numTileContents:Kr(X,88),clustered:X.getUint8(96)===1,internalCompression:X.getUint8(97),tileCompression:X.getUint8(98),tileType:X.getUint8(99),minZoom:X.getUint8(100),maxZoom:X.getUint8(101),minLon:X.getInt32(102,!0)/1e7,minLat:X.getInt32(106,!0)/1e7,maxLon:X.getInt32(110,!0)/1e7,maxLat:X.getInt32(114,!0)/1e7,centerZoom:X.getUint8(118),centerLon:X.getInt32(119,!0)/1e7,centerLat:X.getInt32(123,!0)/1e7,etag:Z}}function $u(R){const Z={buf:new Uint8Array(R),pos:0},X=Mo(Z),Y=[];let ee=0;for(let ge=0;ge0?Y[ge].offset=Y[ge-1].offset+Y[ge-1].length:Y[ge].offset=Me-1}return Y}function bf(R){const Z=new DataView(R);return Z.getUint16(2,!0)===2?(console.warn("PMTiles spec version 2 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),2):Z.getUint16(2,!0)===1?(console.warn("PMTiles spec version 1 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),1):3}var za=class extends Error{};function wf(R,Z,X,Y){return Qi(this,null,function*(){const ee=yield R.getBytes(0,16384);if(new DataView(ee.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");if(bf(ee.data)<3)return[yield Vu.getHeader(R)];const Me=ee.data.slice(0,_f);let c=ee.etag;Y&&ee.etag!=Y&&(console.warn("ETag conflict detected; your HTTP server might not support content-based ETag headers. ETags disabled for "+R.getKey()),c=void 0);const Oe=vf(Me,c);if(X){const re=ee.data.slice(Oe.rootDirectoryOffset,Oe.rootDirectoryOffset+Oe.rootDirectoryLength),De=R.getKey()+"|"+(Oe.etag||"")+"|"+Oe.rootDirectoryOffset+"|"+Oe.rootDirectoryLength,me=$u(yield Z(re,Oe.internalCompression));return[Oe,[De,me.length,me]]}return[Oe,void 0]})}function Tf(R,Z,X,Y,ee){return Qi(this,null,function*(){const ge=yield R.getBytes(X,Y);if(ee.etag&&ee.etag!==ge.etag)throw new za(ge.etag);const Me=yield Z(ge.data,ee.internalCompression),c=$u(Me);if(c.length===0)throw new Error("Empty directory is invalid");return c})}var Ef=class{constructor(R=100,Z=!0,X=Nu){this.cache=new Map,this.maxCacheEntries=R,this.counter=1,this.prefetch=Z,this.decompress=X}getHeader(R,Z){return Qi(this,null,function*(){const X=R.getKey();if(this.cache.has(X))return this.cache.get(X).lastUsed=this.counter++,yield this.cache.get(X).data;const Y=new Promise((ee,ge)=>{wf(R,this.decompress,this.prefetch,Z).then(Me=>{Me[1]&&this.cache.set(Me[1][0],{lastUsed:this.counter++,data:Promise.resolve(Me[1][2])}),ee(Me[0]),this.prune()}).catch(Me=>{ge(Me)})});return this.cache.set(X,{lastUsed:this.counter++,data:Y}),Y})}getDirectory(R,Z,X,Y){return Qi(this,null,function*(){const ee=R.getKey()+"|"+(Y.etag||"")+"|"+Z+"|"+X;if(this.cache.has(ee))return this.cache.get(ee).lastUsed=this.counter++,yield this.cache.get(ee).data;const ge=new Promise((Me,c)=>{Tf(R,this.decompress,Z,X,Y).then(Oe=>{Me(Oe),this.prune()}).catch(Oe=>{c(Oe)})});return this.cache.set(ee,{lastUsed:this.counter++,data:ge}),ge})}getArrayBuffer(R,Z,X,Y){return Qi(this,null,function*(){const ee=R.getKey()+"|"+(Y.etag||"")+"|"+Z+"|"+X;if(this.cache.has(ee))return this.cache.get(ee).lastUsed=this.counter++,yield this.cache.get(ee).data;const ge=new Promise((Me,c)=>{R.getBytes(Z,X).then(Oe=>{if(Y.etag&&Y.etag!==Oe.etag)throw new za(Oe.etag);Me(Oe.data),this.cache.has(ee),this.prune()}).catch(Oe=>{c(Oe)})});return this.cache.set(ee,{lastUsed:this.counter++,data:ge}),ge})}prune(){if(this.cache.size>=this.maxCacheEntries){let R=1/0,Z;this.cache.forEach((X,Y)=>{X.lastUsedge.maxZoom)return;let Me=ge.rootDirectoryOffset,c=ge.rootDirectoryLength;for(let Oe=0;Oe<=3;Oe++){const re=yield this.cache.getDirectory(this.source,Me,c,ge),De=yf(re,ee);if(De)if(De.runLength>0){const me=yield this.source.getBytes(ge.tileDataOffset+De.offset,De.length,Y);if(ge.etag&&ge.etag!==me.etag)throw new za(me.etag);return{data:yield this.decompress(me.data,ge.tileCompression),cacheControl:me.cacheControl,expires:me.expires}}else Me=ge.leafDirectoryOffset+De.offset,c=De.length;else return}throw Error("Maximum directory depth exceeded")})}getZxy(R,Z,X,Y){return Qi(this,null,function*(){try{return yield this.getZxyAttempt(R,Z,X,Y)}catch(ee){if(ee instanceof za)return this.cache.invalidate(this.source,ee.message),yield this.getZxyAttempt(R,Z,X,Y);throw ee}})}getMetadataAttempt(){return Qi(this,null,function*(){const R=yield this.cache.getHeader(this.source),Z=yield this.source.getBytes(R.jsonMetadataOffset,R.jsonMetadataLength);if(R.etag&&R.etag!==Z.etag)throw new za(Z.etag);const X=yield this.decompress(Z.data,R.internalCompression),Y=new TextDecoder("utf-8");return JSON.parse(Y.decode(X))})}getMetadata(){return Qi(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(R){if(R instanceof za)return this.cache.invalidate(this.source,R.message),yield this.getMetadataAttempt();throw R}})}};let Sf=new df;jc.addProtocol("pmtiles",Sf.tile);const ka=new jc.Map({container:"map",hash:!0,style:{version:8,glyphs:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf",sources:{overture:{type:"vector",url:location.hostname.includes("github.io")?"pmtiles://https://storage.googleapis.com/ahp-research/overture/pmtiles/overture.pmtiles":"pmtiles://dist/overture.pmtiles",attribution:"© OpenStreetMap contributors, Overture Maps Foundation, Barry"},daylight:{type:"vector",url:location.hostname.includes("github.io")?"pmtiles://https://storage.googleapis.com/ahp-research/overture/pmtiles/daylight.pmtiles":"pmtiles://dist/daylight.pmtiles"}},layers:[{id:"admins",type:"fill",source:"overture","source-layer":"admins",paint:{"fill-color":"#292929"}},{id:"admins-outline",type:"line",source:"overture","source-layer":"admins",paint:{"line-color":"#6a6a6a","line-width":1}},{id:"land",type:"fill",source:"daylight","source-layer":"land",filter:["all",["any",["==",["geometry-type"],"Polygon"],["==",["geometry-type"],"MultiPolygon"]],["!=",["get","class"],"land"]],paint:{"fill-color":["case",["==",["get","class"],"forest"],"#1C2C23",["==",["get","class"],"glacier"],"#99CCFF ",["==",["get","class"],"grass"],"#264032",["==",["get","class"],"physical"],"#555555",["==",["get","class"],"reef"],"#FFCC99",["==",["get","class"],"sand"],"#322921",["==",["get","class"],"scrub"],"#2D241D",["==",["get","class"],"tree"],"#228B22",["==",["get","class"],"wetland"],"#1C2C23",["==",["get","class"],"land"],"#171717","red"]}},{id:"landuse",type:"fill",source:"daylight","source-layer":"landuse",filter:["all",["any",["==",["geometry-type"],"Polygon"],["==",["geometry-type"],"MultiPolygon"]]],paint:{"fill-color":["case",["==",["get","class"],"park"],"#264032",["==",["get","class"],"protected"],"#1C2C23",["==",["get","class"],"horticulture"],"#1C2C23",["==",["get","class"],"recreation"],"#454545",["==",["get","class"],"agriculture"],"#32322D",["==",["get","class"],"golf"],"#264032","#292929"]}},{id:"water-polygon",type:"fill",source:"daylight","source-layer":"water",filter:["any",["==",["geometry-type"],"Polygon"],["==",["geometry-type"],"MultiPolygon"]],paint:{"fill-color":"#263138 "}},{id:"water-line",type:"line",source:"daylight","source-layer":"water",filter:["any",["==",["geometry-type"],"LineString"],["==",["geometry-type"],"MultiLineString"]],paint:{"line-color":"#263138","line-width":3}},{id:"buldings-extruded",type:"fill-extrusion",source:"overture","source-layer":"buildings",paint:{"fill-extrusion-color":"#2B2B2B","fill-extrusion-height":["case",["==",["get","height"],-1],0,["get","height"]],"fill-extrusion-opacity":1}},{id:"roads",type:"line",source:"overture","source-layer":"roads",filter:["any",["==",["get","class"],"parkingAisle"],["==",["get","class"],"driveway"],["==",["get","class"],"unknown"]],paint:{"line-color":["case",["==",["get","class"],"parkingAisle"],"#323232",["==",["get","class"],"driveway"],"#1C1C1C",["==",["get","class"],"unknown"],"#1C1C1C","#5A5A5A"],"line-width":["interpolate",["exponential",2],["zoom"],8,["*",2,["^",2,-3]],21,["*",2,["^",2,5]]]},layout:{"line-cap":"round"}},{id:"roads-motorway",type:"line",source:"overture","source-layer":"roads",filter:["any",["==",["get","class"],"motorway"]],paint:{"line-color":"#717171","line-width":["interpolate",["exponential",2],["zoom"],3,["*",6,["^",2,-2]],21,["*",6,["^",2,6]]]},layout:{"line-cap":"round"}},{id:"roads-primary",type:"line",source:"overture","source-layer":"roads",filter:["any",["==",["get","class"],"primary"]],paint:{"line-color":"#717171","line-width":["interpolate",["exponential",2],["zoom"],3,["*",4,["^",2,-2]],21,["*",4,["^",2,6]]]},layout:{"line-cap":"round"}},{id:"roads-secondary",type:"line",source:"overture","source-layer":"roads",filter:["any",["==",["get","class"],"secondary"]],paint:{"line-color":"#717171","line-width":["interpolate",["exponential",2],["zoom"],3,["*",4,["^",2,-2]],21,["*",4,["^",2,5]]]},layout:{"line-cap":"round"}},{id:"roads-tertiary",type:"line",source:"overture","source-layer":"roads",filter:["any",["==",["get","class"],"tertiary"]],paint:{"line-color":"#717171","line-width":["interpolate",["exponential",2],["zoom"],8,["*",3,["^",2,-3]],21,["*",3,["^",2,6]]]},layout:{"line-cap":"round"}},{id:"roads-cyleway",type:"line",source:"overture","source-layer":"roads",filter:["all",["==",["get","class"],"cycleway"]],paint:{"line-color":"#4D3012","line-width":["interpolate",["exponential",2],["zoom"],8,["*",2,["^",2,-4]],21,["*",2,["^",2,5]]]},layout:{"line-cap":"round"}},{id:"roads-pedestrian",type:"line",source:"overture","source-layer":"roads",filter:["any",["==",["get","class"],"pedestrian"],["==",["get","class"],"footway"],["==",["get","class"],"track"]],paint:{"line-dasharray":[2,2],"line-color":"#464646","line-width":["interpolate",["exponential",2],["zoom"],8,["*",3,["^",2,-2]],21,["*",3,["^",2,3]]]},layout:{"line-cap":"round"}},{id:"roads-residential",type:"line",source:"overture","source-layer":"roads",filter:["any",["==",["get","class"],"residential"],["==",["get","class"],"livingStreet"],["==",["get","class"],"unclassified"]],paint:{"line-color":"#535353","line-width":["interpolate",["exponential",2],["zoom"],8,["*",2,["^",2,-3]],21,["*",2,["^",2,6]]]},layout:{"line-cap":"round"}},{id:"roads-labels",type:"symbol",source:"overture","source-layer":"roads",minzoom:12,layout:{"icon-allow-overlap":!1,"text-allow-overlap":!1,"symbol-placement":"line","text-field":["get","roadName"],"text-radial-offset":.5,"text-size":11},paint:{"text-color":"#E2E2E2","text-halo-color":"#000","text-halo-width":2,"text-halo-blur":1}},{id:"places",type:"circle",source:"overture","source-layer":"places",minzoom:16,filter:[">=",["get","confidence"],.9],paint:{"circle-color":"#4EDAD8","circle-radius":3,"circle-blur":.3,"circle-opacity":.8}},{id:"places-labels",type:"symbol",source:"overture","source-layer":"places",minzoom:16,filter:[">=",["get","confidence"],.9],layout:{"icon-allow-overlap":!1,"text-allow-overlap":!1,"text-anchor":"bottom","text-radial-offset":1,"symbol-placement":"point","text-field":["get","name"],"text-size":10},paint:{"text-color":"#4EDAD8","text-halo-color":"black","text-halo-width":3,"text-halo-blur":2}},{id:"urban-labels",type:"symbol",source:"daylight","source-layer":"placename",minzoom:2,maxzoom:14,filter:["any",["==",["get","subclass"],"city"],["==",["get","subclass"],"municipality"],["==",["get","subclass"],"metropolis"],["==",["get","subclass"],"megacity"]],layout:{"text-ignore-placement":!0,"text-allow-overlap":!1,"icon-allow-overlap":!1,"symbol-placement":"point","text-field":["get","name"],"text-size":16},paint:{"text-color":"white","text-halo-color":"black","text-halo-width":3,"text-halo-blur":2}},{id:"settlement-labels",type:"symbol",source:"daylight","source-layer":"placename",minzoom:11,maxzoom:21,filter:["any",["==",["get","subclass"],"town"],["==",["get","subclass"],"vilage"],["==",["get","subclass"],"hamlet"]],layout:{"text-ignore-placement":!0,"text-allow-overlap":!1,"icon-allow-overlap":!1,"symbol-placement":"point","text-field":["get","name"],"text-size":14},paint:{"text-color":"white","text-halo-color":"black","text-halo-width":3,"text-halo-blur":2}},{id:"local-labels",type:"symbol",source:"daylight","source-layer":"placename",minzoom:14,maxzoom:21,filter:["any",["==",["get","subclass"],"neighborhood"],["==",["get","subclass"],"suburb"],["==",["get","subclass"],"borough"],["==",["get","subclass"],"block"]],layout:{"text-ignore-placement":!0,"text-allow-overlap":!0,"icon-allow-overlap":!0,"icon-ignore-placement":!0,"symbol-placement":"point","text-field":["get","name"],"text-size":14},paint:{"text-color":"white","text-halo-color":"black","text-halo-width":3,"text-halo-blur":2}}]},center:[4.91431,52.34304],zoom:14});ka.on("click",function(R){for(var Z=ka.getStyle().layers,X=0;X"+Y+"";for(var c in ge.properties)ge.properties.hasOwnProperty(c)&&(Me+="");Me+="
"+c+""+ge.properties[c]+"
",new jc.Popup().setLngLat(R.lngLat).setHTML(Me).addTo(ka)}}});var Au=document.querySelector("#confidence-slider");Au.addEventListener("input",function(){const R=Au.value/100;ka.setFilter("places",[">=",["get","confidence"],R]),ka.setFilter("places-labels",[">=",["get","confidence"],R])}); diff --git a/viewer/dist/assets/index-e2144531.css b/viewer/dist/assets/index-e2144531.css deleted file mode 100644 index c062189..0000000 --- a/viewer/dist/assets/index-e2144531.css +++ /dev/null @@ -1 +0,0 @@ -html,body{height:100%;padding:0;margin:0;background-color:#000;font-family:Arial,sans-serif}#map{z-index:0;height:100%}#info{position:absolute;bottom:1rem;left:1rem;color:#d3d3d3;z-index:1}#info .header{font-size:2.25rem;font-weight:600;line-height:3rem}#info .description{font-size:.85rem}#info a{color:inherit}.maplibregl-popup-content h1{font-size:1rem;line-height:.1rem}.maplibregl-popup-content td{padding-right:1.25rem}.maplibregl-map{-webkit-tap-highlight-color:rgb(0 0 0/0);font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative}.maplibregl-canvas{left:0;position:absolute;top:0}.maplibregl-map:fullscreen{height:100%;width:100%}.maplibregl-ctrl-group button.maplibregl-ctrl-compass{touch-action:none}.maplibregl-canvas-container.maplibregl-interactive,.maplibregl-ctrl-group button.maplibregl-ctrl-compass{cursor:grab;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:grabbing}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.maplibregl-ctrl-top-left{left:0;top:0}.maplibregl-ctrl-top-right{right:0;top:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{bottom:0;right:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{float:left;margin:10px 0 0 10px}.maplibregl-ctrl-top-right .maplibregl-ctrl{float:right;margin:10px 10px 0 0}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{float:left;margin:0 0 10px 10px}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{float:right;margin:0 10px 10px 0}.maplibregl-ctrl-group{background:#fff;border-radius:4px}.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px #0000001a}@media (-ms-high-contrast:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.maplibregl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;padding:0;width:29px}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (-ms-high-contrast:active){.maplibregl-ctrl-icon{background-color:transparent}.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl button:disabled{cursor:not-allowed}.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}.maplibregl-ctrl button:not(:disabled):hover{background-color:#0000000d}.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.maplibregl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.maplibregl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.maplibregl-ctrl-group button:focus:only-child{border-radius:inherit}.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E")}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E")}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8h-8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8h-8z'/%3E%3C/svg%3E")}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8h-8z'/%3E%3Cpath fill='%23999' d='m10.5 16 4 8 4-8h-8z'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8h-8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8h-8z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%23333' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%2333b5e5' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23aaa' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1 9-9z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{animation:maplibregl-spin 2s linear infinite}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23999' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1 9-9z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23666' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1 9-9z'/%3E%3C/svg%3E")}}@keyframes maplibregl-spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.255 1.255 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.255 1.255 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5.11 5.11 0 0 1 .314-.787l.009-.016a4.623 4.623 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.548 4.548 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4.314.319.566.676.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.416 2.416 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.448 2.448 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675c.211.2.381.43.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.76 4.76 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.407 3.407 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.255 1.255 0 0 1 .689 1.004 4.73 4.73 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528 0 .343-.02.694-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.815 5.815 0 0 1-.548-2.512c0-.286.017-.567.053-.843a1.255 1.255 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.778 4.778 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.47 4.47 0 0 1-1.935-.424 1.252 1.252 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.402 2.402 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.703 4.703 0 0 1-1.782 1.884 4.767 4.767 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.47 4.47 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a4.983 4.983 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.255 1.255 0 0 1-1.115.676h-.098a1.255 1.255 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15c.329-.237.574-.499.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267c-.088-.22-.264-.438-.526-.658l-.032-.028a3.16 3.16 0 0 0-.668-.428l-.27-.12a3.293 3.293 0 0 0-1.235-.23c-.757 0-1.415.163-1.974.493a3.36 3.36 0 0 0-1.3 1.382c-.297.593-.444 1.284-.444 2.074 0 .8.17 1.503.51 2.107a3.795 3.795 0 0 0 1.382 1.381 3.883 3.883 0 0 0 1.893.477c.53 0 1.015-.11 1.455-.33zm-2.789-5.38c-.384.45-.575 1.038-.575 1.762 0 .735.186 1.332.559 1.794.384.45.933.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.17 2.17 0 0 0 .468-.29l.178-.161a2.163 2.163 0 0 0 .397-.561c.163-.333.244-.717.244-1.15v-.115c0-.472-.098-.894-.296-1.267l-.043-.077a2.211 2.211 0 0 0-.633-.709l-.13-.086-.047-.028a2.099 2.099 0 0 0-1.073-.285c-.702 0-1.244.231-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.958.958 0 0 0-.353-.389.851.851 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.626 2.626 0 0 0 .331.423c.213.22.464.402.755.548l.173.074c.433.17.93.255 1.49.255.68 0 1.295-.165 1.844-.493a3.447 3.447 0 0 0 1.316-1.4c.329-.603.493-1.299.493-2.089 0-1.273-.33-2.243-.988-2.913-.658-.68-1.52-1.02-2.584-1.02-.598 0-1.124.115-1.575.347a2.807 2.807 0 0 0-.415.262l-.199.166a3.35 3.35 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138c.137.193.297.36.48.5l.155.11.053.034c.34.197.713.297 1.119.297.714 0 1.262-.225 1.645-.675.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.29 0-.569.053-.835.16a2.366 2.366 0 0 0-.284.136 1.99 1.99 0 0 0-.363.254 2.237 2.237 0 0 0-.46.569l-.082.162a2.56 2.56 0 0 0-.213 1.072v.115c0 .471.098.894.296 1.267l.135.211zm.964-.818a1.11 1.11 0 0 0 .367.385.937.937 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a.995.995 0 0 0-.503.135l-.012.007a.859.859 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.43 1.43 0 0 0 .14.66zm15.7-6.222c.232-.23.346-.516.346-.856a1.053 1.053 0 0 0-.345-.79 1.175 1.175 0 0 0-.84-.329c-.34 0-.625.11-.855.33a1.053 1.053 0 0 0-.346.79c0 .34.115.625.346.855.23.23.516.346.856.346.34 0 .62-.115.839-.346zm4.337 9.314.033-1.332c.128.269.324.518.59.747l.098.081a3.727 3.727 0 0 0 .316.224l.223.122a3.21 3.21 0 0 0 1.44.322 3.785 3.785 0 0 0 1.875-.477 3.52 3.52 0 0 0 1.382-1.366c.352-.593.526-1.29.526-2.09 0-.79-.147-1.48-.444-2.073a3.235 3.235 0 0 0-1.283-1.399c-.549-.34-1.195-.51-1.942-.51a3.476 3.476 0 0 0-1.527.344l-.086.043-.165.09a3.412 3.412 0 0 0-.33.214c-.288.21-.507.446-.656.707a1.893 1.893 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.482 2.482 0 0 0 .566.7c.078.065.159.125.245.18l.144.08a2.105 2.105 0 0 0 .975.232c.713 0 1.262-.225 1.645-.675.384-.46.576-1.053.576-1.778 0-.734-.192-1.327-.576-1.777-.373-.46-.921-.692-1.645-.692a2.18 2.18 0 0 0-1.015.235c-.147.075-.285.17-.415.282l-.15.142a2.086 2.086 0 0 0-.42.594c-.149.32-.223.685-.223 1.1v.115c0 .47.097.89.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.868.868 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.13 1.13 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013c.23-.087.472-.134.724-.14l.069-.002c.329 0 .542.033.642.099l.247-1.794c-.13-.066-.37-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2.086 2.086 0 0 0-.411.148 2.18 2.18 0 0 0-.4.249 2.482 2.482 0 0 0-.485.499 2.659 2.659 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884c0-.364.053-.678.159-.943a1.49 1.49 0 0 1 .466-.636 2.52 2.52 0 0 1 .399-.253 2.19 2.19 0 0 1 .224-.099zm9.784 2.656.05-.922c0-1.162-.285-2.062-.856-2.698-.559-.647-1.42-.97-2.584-.97-.746 0-1.415.163-2.007.493a3.462 3.462 0 0 0-1.4 1.382c-.329.604-.493 1.306-.493 2.106 0 .714.143 1.371.428 1.975.285.593.73 1.07 1.332 1.432.604.351 1.355.526 2.255.526.649 0 1.204-.062 1.668-.185l.044-.012.135-.04c.409-.122.736-.263.984-.421l-.542-1.267c-.2.108-.415.199-.642.274l-.297.087c-.34.088-.773.131-1.3.131-.636 0-1.135-.147-1.497-.444a1.573 1.573 0 0 1-.192-.193c-.244-.294-.415-.705-.512-1.234l-.004-.021h5.43zm-5.427-1.256-.003.022h3.752v-.138c-.007-.485-.104-.857-.288-1.118a1.056 1.056 0 0 0-.156-.176c-.307-.285-.746-.428-1.316-.428-.657 0-1.155.202-1.494.604-.253.3-.417.712-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81c-.68 0-1.311-.16-1.893-.478a3.795 3.795 0 0 1-1.381-1.382c-.34-.604-.51-1.306-.51-2.106 0-.79.147-1.482.444-2.074a3.364 3.364 0 0 1 1.3-1.382c.559-.33 1.217-.494 1.974-.494a3.293 3.293 0 0 1 1.234.231 3.341 3.341 0 0 1 .97.575c.264.22.44.439.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332c-.186.395-.526.746-1.02 1.053a3.167 3.167 0 0 1-1.662.444zm.296-1.482c.626 0 1.152-.214 1.58-.642.428-.44.642-1.01.642-1.711v-.115c0-.472-.098-.894-.296-1.267a2.211 2.211 0 0 0-.807-.872 2.098 2.098 0 0 0-1.119-.313c-.702 0-1.245.231-1.629.692-.384.45-.575 1.037-.575 1.76 0 .736.186 1.333.559 1.795.384.45.933.675 1.645.675zm6.521-6.237h1.711v1.4c.604-1.065 1.547-1.597 2.83-1.597 1.064 0 1.926.34 2.584 1.02.659.67.988 1.641.988 2.914 0 .79-.164 1.487-.493 2.09a3.456 3.456 0 0 1-1.316 1.399 3.51 3.51 0 0 1-1.844.493c-.636 0-1.19-.11-1.662-.329a2.665 2.665 0 0 1-1.086-.97l.017 5.134h-1.728V9.242zm4.048 6.22c.714 0 1.262-.224 1.645-.674.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.395 0-.768.098-1.12.296-.34.187-.613.46-.822.823-.197.351-.296.763-.296 1.234v.115c0 .472.098.894.296 1.267.209.362.483.647.823.855.34.197.713.297 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.159 1.159 0 0 1-.856-.346 1.165 1.165 0 0 1-.346-.856 1.053 1.053 0 0 1 .346-.79c.23-.219.516-.329.856-.329.329 0 .609.11.839.33a1.053 1.053 0 0 1 .345.79 1.159 1.159 0 0 1-.345.855c-.22.23-.5.346-.84.346zm7.875 9.133a3.167 3.167 0 0 1-1.662-.444c-.482-.307-.817-.658-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283c.186-.438.548-.812 1.086-1.119a3.486 3.486 0 0 1 1.778-.477c.746 0 1.393.17 1.942.51a3.235 3.235 0 0 1 1.283 1.4c.297.592.444 1.282.444 2.072 0 .8-.175 1.498-.526 2.09a3.52 3.52 0 0 1-1.382 1.366 3.785 3.785 0 0 1-1.876.477zm-.296-1.481c.713 0 1.26-.225 1.645-.675.384-.46.577-1.053.577-1.778 0-.734-.193-1.327-.577-1.776-.373-.46-.921-.692-1.645-.692a2.115 2.115 0 0 0-1.58.659c-.428.428-.642.992-.642 1.694v.115c0 .473.098.895.296 1.267a2.385 2.385 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481c.176-.505.46-.91.856-1.217a2.14 2.14 0 0 1 1.349-.46c.351 0 .593.032.724.098l-.247 1.794c-.099-.066-.313-.099-.642-.099-.516 0-.988.164-1.416.494-.417.329-.626.855-.626 1.58v3.883h-1.777V9.242zm9.534 7.718c-.9 0-1.651-.175-2.255-.526-.603-.362-1.047-.84-1.332-1.432a4.567 4.567 0 0 1-.428-1.975c0-.8.164-1.502.493-2.106a3.462 3.462 0 0 1 1.4-1.382c.592-.33 1.262-.494 2.007-.494 1.163 0 2.024.324 2.584.97.57.637.856 1.537.856 2.7 0 .296-.017.603-.05.92h-5.43c.12.67.356 1.153.708 1.45.362.296.86.443 1.497.443.526 0 .96-.044 1.3-.131a4.123 4.123 0 0 0 .938-.362l.542 1.267c-.274.175-.647.329-1.119.46-.472.132-1.042.197-1.711.197zm1.596-4.558c.01-.68-.137-1.158-.444-1.432-.307-.285-.746-.428-1.316-.428-1.152 0-1.815.62-1.991 1.86h3.752z'/%3E%3Cg fill-rule='evenodd' stroke-width='1.036'%3E%3Cpath fill='%23000' fill-opacity='.4' d='m8.166 16.146-.002.002a1.54 1.54 0 0 1-2.009 0l-.002-.002-.043-.034-.002-.002-.199-.162H4.377a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659H8.411l-.202.164zm-1.121-.905a.29.29 0 0 0 .113.023.286.286 0 0 0 .189-.07l.077-.063c.634-.508 4.672-3.743 4.672-7.575 0-2.55-2.215-4.625-4.938-4.625S2.221 5.006 2.221 7.556c0 3.225 2.86 6.027 4.144 7.137h.004l.04.038.484.4.077.063a.628.628 0 0 0 .074.047zm-2.52-.548a16.898 16.898 0 0 1-1.183-1.315C2.187 11.942.967 9.897.967 7.555c0-3.319 2.855-5.88 6.192-5.88 3.338 0 6.193 2.561 6.193 5.881 0 2.34-1.22 4.387-2.376 5.822a16.898 16.898 0 0 1-1.182 1.315h.15a1.912 1.912 0 0 1 1.914 1.914v1.84a1.912 1.912 0 0 1-1.914 1.914H4.377a1.912 1.912 0 0 1-1.914-1.914v-1.84a1.912 1.912 0 0 1 1.914-1.914zm3.82-6.935c0 .692-.55 1.222-1.187 1.222s-1.185-.529-1.185-1.222.548-1.222 1.185-1.222c.638 0 1.186.529 1.186 1.222zm-1.186 2.477c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477zm2.048 7.71H5.114v-.838h4.093z'/%3E%3Cpath fill='%23e1e3e9' d='M2.222 7.555c0-2.55 2.214-4.625 4.937-4.625 2.723 0 4.938 2.075 4.938 4.625 0 3.832-4.038 7.068-4.672 7.575l-.077.063a.286.286 0 0 1-.189.07.286.286 0 0 1-.188-.07l-.077-.063c-.634-.507-4.672-3.743-4.672-7.575zm4.937 2.68c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477z'/%3E%3Cpath fill='%23fff' d='M4.377 15.948a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659zm4.83 1.16H5.114v.838h4.093z'/%3E%3C/g%3E%3C/svg%3E");background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (-ms-high-contrast:active){a.maplibregl-ctrl-logo{background-color:transparent;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.255 1.255 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.255 1.255 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5.11 5.11 0 0 1 .314-.787l.009-.016a4.623 4.623 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.548 4.548 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4.314.319.566.676.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.416 2.416 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.448 2.448 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675c.211.2.381.43.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.76 4.76 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.407 3.407 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.255 1.255 0 0 1 .689 1.004 4.73 4.73 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528 0 .343-.02.694-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.815 5.815 0 0 1-.548-2.512c0-.286.017-.567.053-.843a1.255 1.255 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.778 4.778 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.47 4.47 0 0 1-1.935-.424 1.252 1.252 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.402 2.402 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.703 4.703 0 0 1-1.782 1.884 4.767 4.767 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.47 4.47 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a4.983 4.983 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.255 1.255 0 0 1-1.115.676h-.098a1.255 1.255 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15c.329-.237.574-.499.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267c-.088-.22-.264-.438-.526-.658l-.032-.028a3.16 3.16 0 0 0-.668-.428l-.27-.12a3.293 3.293 0 0 0-1.235-.23c-.757 0-1.415.163-1.974.493a3.36 3.36 0 0 0-1.3 1.382c-.297.593-.444 1.284-.444 2.074 0 .8.17 1.503.51 2.107a3.795 3.795 0 0 0 1.382 1.381 3.883 3.883 0 0 0 1.893.477c.53 0 1.015-.11 1.455-.33zm-2.789-5.38c-.384.45-.575 1.038-.575 1.762 0 .735.186 1.332.559 1.794.384.45.933.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.17 2.17 0 0 0 .468-.29l.178-.161a2.163 2.163 0 0 0 .397-.561c.163-.333.244-.717.244-1.15v-.115c0-.472-.098-.894-.296-1.267l-.043-.077a2.211 2.211 0 0 0-.633-.709l-.13-.086-.047-.028a2.099 2.099 0 0 0-1.073-.285c-.702 0-1.244.231-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.958.958 0 0 0-.353-.389.851.851 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.626 2.626 0 0 0 .331.423c.213.22.464.402.755.548l.173.074c.433.17.93.255 1.49.255.68 0 1.295-.165 1.844-.493a3.447 3.447 0 0 0 1.316-1.4c.329-.603.493-1.299.493-2.089 0-1.273-.33-2.243-.988-2.913-.658-.68-1.52-1.02-2.584-1.02-.598 0-1.124.115-1.575.347a2.807 2.807 0 0 0-.415.262l-.199.166a3.35 3.35 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138c.137.193.297.36.48.5l.155.11.053.034c.34.197.713.297 1.119.297.714 0 1.262-.225 1.645-.675.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.29 0-.569.053-.835.16a2.366 2.366 0 0 0-.284.136 1.99 1.99 0 0 0-.363.254 2.237 2.237 0 0 0-.46.569l-.082.162a2.56 2.56 0 0 0-.213 1.072v.115c0 .471.098.894.296 1.267l.135.211zm.964-.818a1.11 1.11 0 0 0 .367.385.937.937 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a.995.995 0 0 0-.503.135l-.012.007a.859.859 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.43 1.43 0 0 0 .14.66zm15.7-6.222c.232-.23.346-.516.346-.856a1.053 1.053 0 0 0-.345-.79 1.175 1.175 0 0 0-.84-.329c-.34 0-.625.11-.855.33a1.053 1.053 0 0 0-.346.79c0 .34.115.625.346.855.23.23.516.346.856.346.34 0 .62-.115.839-.346zm4.337 9.314.033-1.332c.128.269.324.518.59.747l.098.081a3.727 3.727 0 0 0 .316.224l.223.122a3.21 3.21 0 0 0 1.44.322 3.785 3.785 0 0 0 1.875-.477 3.52 3.52 0 0 0 1.382-1.366c.352-.593.526-1.29.526-2.09 0-.79-.147-1.48-.444-2.073a3.235 3.235 0 0 0-1.283-1.399c-.549-.34-1.195-.51-1.942-.51a3.476 3.476 0 0 0-1.527.344l-.086.043-.165.09a3.412 3.412 0 0 0-.33.214c-.288.21-.507.446-.656.707a1.893 1.893 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.482 2.482 0 0 0 .566.7c.078.065.159.125.245.18l.144.08a2.105 2.105 0 0 0 .975.232c.713 0 1.262-.225 1.645-.675.384-.46.576-1.053.576-1.778 0-.734-.192-1.327-.576-1.777-.373-.46-.921-.692-1.645-.692a2.18 2.18 0 0 0-1.015.235c-.147.075-.285.17-.415.282l-.15.142a2.086 2.086 0 0 0-.42.594c-.149.32-.223.685-.223 1.1v.115c0 .47.097.89.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.868.868 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.13 1.13 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013c.23-.087.472-.134.724-.14l.069-.002c.329 0 .542.033.642.099l.247-1.794c-.13-.066-.37-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2.086 2.086 0 0 0-.411.148 2.18 2.18 0 0 0-.4.249 2.482 2.482 0 0 0-.485.499 2.659 2.659 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884c0-.364.053-.678.159-.943a1.49 1.49 0 0 1 .466-.636 2.52 2.52 0 0 1 .399-.253 2.19 2.19 0 0 1 .224-.099zm9.784 2.656.05-.922c0-1.162-.285-2.062-.856-2.698-.559-.647-1.42-.97-2.584-.97-.746 0-1.415.163-2.007.493a3.462 3.462 0 0 0-1.4 1.382c-.329.604-.493 1.306-.493 2.106 0 .714.143 1.371.428 1.975.285.593.73 1.07 1.332 1.432.604.351 1.355.526 2.255.526.649 0 1.204-.062 1.668-.185l.044-.012.135-.04c.409-.122.736-.263.984-.421l-.542-1.267c-.2.108-.415.199-.642.274l-.297.087c-.34.088-.773.131-1.3.131-.636 0-1.135-.147-1.497-.444a1.573 1.573 0 0 1-.192-.193c-.244-.294-.415-.705-.512-1.234l-.004-.021h5.43zm-5.427-1.256-.003.022h3.752v-.138c-.007-.485-.104-.857-.288-1.118a1.056 1.056 0 0 0-.156-.176c-.307-.285-.746-.428-1.316-.428-.657 0-1.155.202-1.494.604-.253.3-.417.712-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81c-.68 0-1.311-.16-1.893-.478a3.795 3.795 0 0 1-1.381-1.382c-.34-.604-.51-1.306-.51-2.106 0-.79.147-1.482.444-2.074a3.364 3.364 0 0 1 1.3-1.382c.559-.33 1.217-.494 1.974-.494a3.293 3.293 0 0 1 1.234.231 3.341 3.341 0 0 1 .97.575c.264.22.44.439.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332c-.186.395-.526.746-1.02 1.053a3.167 3.167 0 0 1-1.662.444zm.296-1.482c.626 0 1.152-.214 1.58-.642.428-.44.642-1.01.642-1.711v-.115c0-.472-.098-.894-.296-1.267a2.211 2.211 0 0 0-.807-.872 2.098 2.098 0 0 0-1.119-.313c-.702 0-1.245.231-1.629.692-.384.45-.575 1.037-.575 1.76 0 .736.186 1.333.559 1.795.384.45.933.675 1.645.675zm6.521-6.237h1.711v1.4c.604-1.065 1.547-1.597 2.83-1.597 1.064 0 1.926.34 2.584 1.02.659.67.988 1.641.988 2.914 0 .79-.164 1.487-.493 2.09a3.456 3.456 0 0 1-1.316 1.399 3.51 3.51 0 0 1-1.844.493c-.636 0-1.19-.11-1.662-.329a2.665 2.665 0 0 1-1.086-.97l.017 5.134h-1.728V9.242zm4.048 6.22c.714 0 1.262-.224 1.645-.674.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.395 0-.768.098-1.12.296-.34.187-.613.46-.822.823-.197.351-.296.763-.296 1.234v.115c0 .472.098.894.296 1.267.209.362.483.647.823.855.34.197.713.297 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.159 1.159 0 0 1-.856-.346 1.165 1.165 0 0 1-.346-.856 1.053 1.053 0 0 1 .346-.79c.23-.219.516-.329.856-.329.329 0 .609.11.839.33a1.053 1.053 0 0 1 .345.79 1.159 1.159 0 0 1-.345.855c-.22.23-.5.346-.84.346zm7.875 9.133a3.167 3.167 0 0 1-1.662-.444c-.482-.307-.817-.658-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283c.186-.438.548-.812 1.086-1.119a3.486 3.486 0 0 1 1.778-.477c.746 0 1.393.17 1.942.51a3.235 3.235 0 0 1 1.283 1.4c.297.592.444 1.282.444 2.072 0 .8-.175 1.498-.526 2.09a3.52 3.52 0 0 1-1.382 1.366 3.785 3.785 0 0 1-1.876.477zm-.296-1.481c.713 0 1.26-.225 1.645-.675.384-.46.577-1.053.577-1.778 0-.734-.193-1.327-.577-1.776-.373-.46-.921-.692-1.645-.692a2.115 2.115 0 0 0-1.58.659c-.428.428-.642.992-.642 1.694v.115c0 .473.098.895.296 1.267a2.385 2.385 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481c.176-.505.46-.91.856-1.217a2.14 2.14 0 0 1 1.349-.46c.351 0 .593.032.724.098l-.247 1.794c-.099-.066-.313-.099-.642-.099-.516 0-.988.164-1.416.494-.417.329-.626.855-.626 1.58v3.883h-1.777V9.242zm9.534 7.718c-.9 0-1.651-.175-2.255-.526-.603-.362-1.047-.84-1.332-1.432a4.567 4.567 0 0 1-.428-1.975c0-.8.164-1.502.493-2.106a3.462 3.462 0 0 1 1.4-1.382c.592-.33 1.262-.494 2.007-.494 1.163 0 2.024.324 2.584.97.57.637.856 1.537.856 2.7 0 .296-.017.603-.05.92h-5.43c.12.67.356 1.153.708 1.45.362.296.86.443 1.497.443.526 0 .96-.044 1.3-.131a4.123 4.123 0 0 0 .938-.362l.542 1.267c-.274.175-.647.329-1.119.46-.472.132-1.042.197-1.711.197zm1.596-4.558c.01-.68-.137-1.158-.444-1.432-.307-.285-.746-.428-1.316-.428-1.152 0-1.815.62-1.991 1.86h3.752z'/%3E%3Cg fill-rule='evenodd' stroke-width='1.036'%3E%3Cpath fill='%23000' fill-opacity='.4' d='m8.166 16.146-.002.002a1.54 1.54 0 0 1-2.009 0l-.002-.002-.043-.034-.002-.002-.199-.162H4.377a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659H8.411l-.202.164zm-1.121-.905a.29.29 0 0 0 .113.023.286.286 0 0 0 .189-.07l.077-.063c.634-.508 4.672-3.743 4.672-7.575 0-2.55-2.215-4.625-4.938-4.625S2.221 5.006 2.221 7.556c0 3.225 2.86 6.027 4.144 7.137h.004l.04.038.484.4.077.063a.628.628 0 0 0 .074.047zm-2.52-.548a16.898 16.898 0 0 1-1.183-1.315C2.187 11.942.967 9.897.967 7.555c0-3.319 2.855-5.88 6.192-5.88 3.338 0 6.193 2.561 6.193 5.881 0 2.34-1.22 4.387-2.376 5.822a16.898 16.898 0 0 1-1.182 1.315h.15a1.912 1.912 0 0 1 1.914 1.914v1.84a1.912 1.912 0 0 1-1.914 1.914H4.377a1.912 1.912 0 0 1-1.914-1.914v-1.84a1.912 1.912 0 0 1 1.914-1.914zm3.82-6.935c0 .692-.55 1.222-1.187 1.222s-1.185-.529-1.185-1.222.548-1.222 1.185-1.222c.638 0 1.186.529 1.186 1.222zm-1.186 2.477c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477zm2.048 7.71H5.114v-.838h4.093z'/%3E%3Cpath fill='%23e1e3e9' d='M2.222 7.555c0-2.55 2.214-4.625 4.937-4.625 2.723 0 4.938 2.075 4.938 4.625 0 3.832-4.038 7.068-4.672 7.575l-.077.063a.286.286 0 0 1-.189.07.286.286 0 0 1-.188-.07l-.077-.063c-.634-.507-4.672-3.743-4.672-7.575zm4.937 2.68c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477z'/%3E%3Cpath fill='%23fff' d='M4.377 15.948a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659zm4.83 1.16H5.114v.838h4.093z'/%3E%3C/g%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.255 1.255 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.255 1.255 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5.11 5.11 0 0 1 .314-.787l.009-.016a4.623 4.623 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.548 4.548 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4.314.319.566.676.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.416 2.416 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.448 2.448 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675c.211.2.381.43.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.76 4.76 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.407 3.407 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.255 1.255 0 0 1 .689 1.004 4.73 4.73 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528 0 .343-.02.694-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.815 5.815 0 0 1-.548-2.512c0-.286.017-.567.053-.843a1.255 1.255 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.778 4.778 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.47 4.47 0 0 1-1.935-.424 1.252 1.252 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.402 2.402 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.703 4.703 0 0 1-1.782 1.884 4.767 4.767 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.47 4.47 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a4.983 4.983 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.255 1.255 0 0 1-1.115.676h-.098a1.255 1.255 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15c.329-.237.574-.499.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267c-.088-.22-.264-.438-.526-.658l-.032-.028a3.16 3.16 0 0 0-.668-.428l-.27-.12a3.293 3.293 0 0 0-1.235-.23c-.757 0-1.415.163-1.974.493a3.36 3.36 0 0 0-1.3 1.382c-.297.593-.444 1.284-.444 2.074 0 .8.17 1.503.51 2.107a3.795 3.795 0 0 0 1.382 1.381 3.883 3.883 0 0 0 1.893.477c.53 0 1.015-.11 1.455-.33zm-2.789-5.38c-.384.45-.575 1.038-.575 1.762 0 .735.186 1.332.559 1.794.384.45.933.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.17 2.17 0 0 0 .468-.29l.178-.161a2.163 2.163 0 0 0 .397-.561c.163-.333.244-.717.244-1.15v-.115c0-.472-.098-.894-.296-1.267l-.043-.077a2.211 2.211 0 0 0-.633-.709l-.13-.086-.047-.028a2.099 2.099 0 0 0-1.073-.285c-.702 0-1.244.231-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.958.958 0 0 0-.353-.389.851.851 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.626 2.626 0 0 0 .331.423c.213.22.464.402.755.548l.173.074c.433.17.93.255 1.49.255.68 0 1.295-.165 1.844-.493a3.447 3.447 0 0 0 1.316-1.4c.329-.603.493-1.299.493-2.089 0-1.273-.33-2.243-.988-2.913-.658-.68-1.52-1.02-2.584-1.02-.598 0-1.124.115-1.575.347a2.807 2.807 0 0 0-.415.262l-.199.166a3.35 3.35 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138c.137.193.297.36.48.5l.155.11.053.034c.34.197.713.297 1.119.297.714 0 1.262-.225 1.645-.675.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.29 0-.569.053-.835.16a2.366 2.366 0 0 0-.284.136 1.99 1.99 0 0 0-.363.254 2.237 2.237 0 0 0-.46.569l-.082.162a2.56 2.56 0 0 0-.213 1.072v.115c0 .471.098.894.296 1.267l.135.211zm.964-.818a1.11 1.11 0 0 0 .367.385.937.937 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a.995.995 0 0 0-.503.135l-.012.007a.859.859 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.43 1.43 0 0 0 .14.66zm15.7-6.222c.232-.23.346-.516.346-.856a1.053 1.053 0 0 0-.345-.79 1.175 1.175 0 0 0-.84-.329c-.34 0-.625.11-.855.33a1.053 1.053 0 0 0-.346.79c0 .34.115.625.346.855.23.23.516.346.856.346.34 0 .62-.115.839-.346zm4.337 9.314.033-1.332c.128.269.324.518.59.747l.098.081a3.727 3.727 0 0 0 .316.224l.223.122a3.21 3.21 0 0 0 1.44.322 3.785 3.785 0 0 0 1.875-.477 3.52 3.52 0 0 0 1.382-1.366c.352-.593.526-1.29.526-2.09 0-.79-.147-1.48-.444-2.073a3.235 3.235 0 0 0-1.283-1.399c-.549-.34-1.195-.51-1.942-.51a3.476 3.476 0 0 0-1.527.344l-.086.043-.165.09a3.412 3.412 0 0 0-.33.214c-.288.21-.507.446-.656.707a1.893 1.893 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.482 2.482 0 0 0 .566.7c.078.065.159.125.245.18l.144.08a2.105 2.105 0 0 0 .975.232c.713 0 1.262-.225 1.645-.675.384-.46.576-1.053.576-1.778 0-.734-.192-1.327-.576-1.777-.373-.46-.921-.692-1.645-.692a2.18 2.18 0 0 0-1.015.235c-.147.075-.285.17-.415.282l-.15.142a2.086 2.086 0 0 0-.42.594c-.149.32-.223.685-.223 1.1v.115c0 .47.097.89.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.868.868 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.13 1.13 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013c.23-.087.472-.134.724-.14l.069-.002c.329 0 .542.033.642.099l.247-1.794c-.13-.066-.37-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2.086 2.086 0 0 0-.411.148 2.18 2.18 0 0 0-.4.249 2.482 2.482 0 0 0-.485.499 2.659 2.659 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884c0-.364.053-.678.159-.943a1.49 1.49 0 0 1 .466-.636 2.52 2.52 0 0 1 .399-.253 2.19 2.19 0 0 1 .224-.099zm9.784 2.656.05-.922c0-1.162-.285-2.062-.856-2.698-.559-.647-1.42-.97-2.584-.97-.746 0-1.415.163-2.007.493a3.462 3.462 0 0 0-1.4 1.382c-.329.604-.493 1.306-.493 2.106 0 .714.143 1.371.428 1.975.285.593.73 1.07 1.332 1.432.604.351 1.355.526 2.255.526.649 0 1.204-.062 1.668-.185l.044-.012.135-.04c.409-.122.736-.263.984-.421l-.542-1.267c-.2.108-.415.199-.642.274l-.297.087c-.34.088-.773.131-1.3.131-.636 0-1.135-.147-1.497-.444a1.573 1.573 0 0 1-.192-.193c-.244-.294-.415-.705-.512-1.234l-.004-.021h5.43zm-5.427-1.256-.003.022h3.752v-.138c-.007-.485-.104-.857-.288-1.118a1.056 1.056 0 0 0-.156-.176c-.307-.285-.746-.428-1.316-.428-.657 0-1.155.202-1.494.604-.253.3-.417.712-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81c-.68 0-1.311-.16-1.893-.478a3.795 3.795 0 0 1-1.381-1.382c-.34-.604-.51-1.306-.51-2.106 0-.79.147-1.482.444-2.074a3.364 3.364 0 0 1 1.3-1.382c.559-.33 1.217-.494 1.974-.494a3.293 3.293 0 0 1 1.234.231 3.341 3.341 0 0 1 .97.575c.264.22.44.439.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332c-.186.395-.526.746-1.02 1.053a3.167 3.167 0 0 1-1.662.444zm.296-1.482c.626 0 1.152-.214 1.58-.642.428-.44.642-1.01.642-1.711v-.115c0-.472-.098-.894-.296-1.267a2.211 2.211 0 0 0-.807-.872 2.098 2.098 0 0 0-1.119-.313c-.702 0-1.245.231-1.629.692-.384.45-.575 1.037-.575 1.76 0 .736.186 1.333.559 1.795.384.45.933.675 1.645.675zm6.521-6.237h1.711v1.4c.604-1.065 1.547-1.597 2.83-1.597 1.064 0 1.926.34 2.584 1.02.659.67.988 1.641.988 2.914 0 .79-.164 1.487-.493 2.09a3.456 3.456 0 0 1-1.316 1.399 3.51 3.51 0 0 1-1.844.493c-.636 0-1.19-.11-1.662-.329a2.665 2.665 0 0 1-1.086-.97l.017 5.134h-1.728V9.242zm4.048 6.22c.714 0 1.262-.224 1.645-.674.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.395 0-.768.098-1.12.296-.34.187-.613.46-.822.823-.197.351-.296.763-.296 1.234v.115c0 .472.098.894.296 1.267.209.362.483.647.823.855.34.197.713.297 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.159 1.159 0 0 1-.856-.346 1.165 1.165 0 0 1-.346-.856 1.053 1.053 0 0 1 .346-.79c.23-.219.516-.329.856-.329.329 0 .609.11.839.33a1.053 1.053 0 0 1 .345.79 1.159 1.159 0 0 1-.345.855c-.22.23-.5.346-.84.346zm7.875 9.133a3.167 3.167 0 0 1-1.662-.444c-.482-.307-.817-.658-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283c.186-.438.548-.812 1.086-1.119a3.486 3.486 0 0 1 1.778-.477c.746 0 1.393.17 1.942.51a3.235 3.235 0 0 1 1.283 1.4c.297.592.444 1.282.444 2.072 0 .8-.175 1.498-.526 2.09a3.52 3.52 0 0 1-1.382 1.366 3.785 3.785 0 0 1-1.876.477zm-.296-1.481c.713 0 1.26-.225 1.645-.675.384-.46.577-1.053.577-1.778 0-.734-.193-1.327-.577-1.776-.373-.46-.921-.692-1.645-.692a2.115 2.115 0 0 0-1.58.659c-.428.428-.642.992-.642 1.694v.115c0 .473.098.895.296 1.267a2.385 2.385 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481c.176-.505.46-.91.856-1.217a2.14 2.14 0 0 1 1.349-.46c.351 0 .593.032.724.098l-.247 1.794c-.099-.066-.313-.099-.642-.099-.516 0-.988.164-1.416.494-.417.329-.626.855-.626 1.58v3.883h-1.777V9.242zm9.534 7.718c-.9 0-1.651-.175-2.255-.526-.603-.362-1.047-.84-1.332-1.432a4.567 4.567 0 0 1-.428-1.975c0-.8.164-1.502.493-2.106a3.462 3.462 0 0 1 1.4-1.382c.592-.33 1.262-.494 2.007-.494 1.163 0 2.024.324 2.584.97.57.637.856 1.537.856 2.7 0 .296-.017.603-.05.92h-5.43c.12.67.356 1.153.708 1.45.362.296.86.443 1.497.443.526 0 .96-.044 1.3-.131a4.123 4.123 0 0 0 .938-.362l.542 1.267c-.274.175-.647.329-1.119.46-.472.132-1.042.197-1.711.197zm1.596-4.558c.01-.68-.137-1.158-.444-1.432-.307-.285-.746-.428-1.316-.428-1.152 0-1.815.62-1.991 1.86h3.752z'/%3E%3Cg fill-rule='evenodd' stroke-width='1.036'%3E%3Cpath fill='%23000' fill-opacity='.4' d='m8.166 16.146-.002.002a1.54 1.54 0 0 1-2.009 0l-.002-.002-.043-.034-.002-.002-.199-.162H4.377a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659H8.411l-.202.164zm-1.121-.905a.29.29 0 0 0 .113.023.286.286 0 0 0 .189-.07l.077-.063c.634-.508 4.672-3.743 4.672-7.575 0-2.55-2.215-4.625-4.938-4.625S2.221 5.006 2.221 7.556c0 3.225 2.86 6.027 4.144 7.137h.004l.04.038.484.4.077.063a.628.628 0 0 0 .074.047zm-2.52-.548a16.898 16.898 0 0 1-1.183-1.315C2.187 11.942.967 9.897.967 7.555c0-3.319 2.855-5.88 6.192-5.88 3.338 0 6.193 2.561 6.193 5.881 0 2.34-1.22 4.387-2.376 5.822a16.898 16.898 0 0 1-1.182 1.315h.15a1.912 1.912 0 0 1 1.914 1.914v1.84a1.912 1.912 0 0 1-1.914 1.914H4.377a1.912 1.912 0 0 1-1.914-1.914v-1.84a1.912 1.912 0 0 1 1.914-1.914zm3.82-6.935c0 .692-.55 1.222-1.187 1.222s-1.185-.529-1.185-1.222.548-1.222 1.185-1.222c.638 0 1.186.529 1.186 1.222zm-1.186 2.477c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477zm2.048 7.71H5.114v-.838h4.093z'/%3E%3Cpath fill='%23e1e3e9' d='M2.222 7.555c0-2.55 2.214-4.625 4.937-4.625 2.723 0 4.938 2.075 4.938 4.625 0 3.832-4.038 7.068-4.672 7.575l-.077.063a.286.286 0 0 1-.189.07.286.286 0 0 1-.188-.07l-.077-.063c-.634-.507-4.672-3.743-4.672-7.575zm4.937 2.68c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477z'/%3E%3Cpath fill='%23fff' d='M4.377 15.948a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659zm4.83 1.16H5.114v.838h4.093z'/%3E%3C/g%3E%3C/svg%3E")}}.maplibregl-ctrl.maplibregl-ctrl-attrib{background-color:#ffffff80;margin:0;padding:0 5px}@media screen{.maplibregl-ctrl-attrib.maplibregl-compact{background-color:#fff;border-radius:12px;box-sizing:content-box;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.maplibregl-ctrl-attrib-button{background-color:#ffffff80;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E");border:0;border-radius:12px;box-sizing:border-box;cursor:pointer;display:none;height:24px;outline:none;position:absolute;right:0;top:0;width:24px}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button{-webkit-appearance:none;-moz-appearance:none;appearance:none;list-style:none}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker{display:none}.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button{left:0}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner{display:block}.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button{background-color:#0000000d}.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{right:0;top:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{left:0;top:0}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (-ms-high-contrast:active){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%23fff' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}@media screen and (-ms-high-contrast:black-on-white){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}.maplibregl-ctrl-attrib a{color:#000000bf;text-decoration:none}.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.maplibregl-attrib-empty{display:none}.maplibregl-ctrl-scale{background-color:#ffffffbf;border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px}.maplibregl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.maplibregl-popup-anchor-top,.maplibregl-popup-anchor-top-left,.maplibregl-popup-anchor-top-right{flex-direction:column}.maplibregl-popup-anchor-bottom,.maplibregl-popup-anchor-bottom-left,.maplibregl-popup-anchor-bottom-right{flex-direction:column-reverse}.maplibregl-popup-anchor-left{flex-direction:row}.maplibregl-popup-anchor-right{flex-direction:row-reverse}.maplibregl-popup-tip{border:10px solid transparent;height:0;width:0;z-index:1}.maplibregl-popup-anchor-top .maplibregl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.maplibregl-popup-anchor-left .maplibregl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.maplibregl-popup-anchor-right .maplibregl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}.maplibregl-popup-close-button{background-color:transparent;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.maplibregl-popup-close-button:hover{background-color:#0000000d}.maplibregl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px #0000001a;padding:15px 10px;pointer-events:auto;position:relative}.maplibregl-popup-anchor-top-left .maplibregl-popup-content{border-top-left-radius:0}.maplibregl-popup-anchor-top-right .maplibregl-popup-content{border-top-right-radius:0}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-content{border-bottom-left-radius:0}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-content{border-bottom-right-radius:0}.maplibregl-popup-track-pointer{display:none}.maplibregl-popup-track-pointer *{pointer-events:none;-webkit-user-select:none;user-select:none}.maplibregl-map:hover .maplibregl-popup-track-pointer{display:flex}.maplibregl-map:active .maplibregl-popup-track-pointer{display:none}.maplibregl-marker{left:0;position:absolute;top:0;will-change:transform}.maplibregl-user-location-dot,.maplibregl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.maplibregl-user-location-dot:before{animation:maplibregl-user-location-dot-pulse 2s infinite;content:"";position:absolute}.maplibregl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px #00000059;box-sizing:border-box;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px}@keyframes maplibregl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.maplibregl-user-location-dot-stale{background-color:#aaa}.maplibregl-user-location-dot-stale:after{display:none}.maplibregl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.maplibregl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}.maplibregl-cooperative-gesture-screen{align-items:center;background:rgba(0,0,0,.4);color:#fff;display:flex;font-size:1.4em;top:0;right:0;bottom:0;left:0;justify-content:center;line-height:1.2;opacity:0;padding:1rem;pointer-events:none;position:absolute;transition:opacity 1s ease 1s;z-index:99999}.maplibregl-cooperative-gesture-screen.maplibregl-show{opacity:1;transition:opacity .05s}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:none}@media (hover:none),(width <= 480px){.maplibregl-cooperative-gesture-screen .maplibregl-desktop-message{display:none}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:block}}.maplibregl-pseudo-fullscreen{height:100%!important;left:0!important;position:fixed!important;top:0!important;width:100%!important;z-index:99999} diff --git a/viewer/dist/index.html b/viewer/dist/index.html index 34450a1..c25b77c 100644 --- a/viewer/dist/index.html +++ b/viewer/dist/index.html @@ -5,18 +5,30 @@ OvertureMaps PMTiles - - + +
-
OvertureMaps PMTiles
+
PMTiles
+
OvertureMaps
+ +
+
POI Confidence
+
+
diff --git a/viewer/index.html b/viewer/index.html index 4bb508f..34d3db0 100644 --- a/viewer/index.html +++ b/viewer/index.html @@ -8,13 +8,25 @@
-
OvertureMaps PMTiles
+
PMTiles
+
OvertureMaps
+ +
+
POI Confidence
+
+
diff --git a/viewer/src/main.ts b/viewer/src/main.ts index c975a62..02f31c5 100644 --- a/viewer/src/main.ts +++ b/viewer/src/main.ts @@ -1,17 +1,13 @@ -import './style.css' -import 'maplibre-gl/dist/maplibre-gl.css'; -import maplibregl from 'maplibre-gl'; -import * as pmtiles from 'pmtiles' - +import "./style.css" +import "maplibre-gl/dist/maplibre-gl.css"; +import maplibregl from "maplibre-gl"; +import * as pmtiles from "pmtiles" let protocol = new pmtiles.Protocol(); maplibregl.addProtocol("pmtiles", protocol.tile); -let hostname = location.hostname; -console.log(hostname); - const map = new maplibregl.Map({ - container: 'map', + container: "map", hash: true, style: { version: 8, @@ -20,156 +16,467 @@ const map = new maplibregl.Map({ "overture": { "type": "vector", "url": location.hostname.includes("github.io") ? "pmtiles://https://storage.googleapis.com/ahp-research/overture/pmtiles/overture.pmtiles" : "pmtiles://dist/overture.pmtiles", - "attribution": "© OpenStreetMap, Overture Maps Foundation, Barry" + "attribution": "© OpenStreetMap contributors, Overture Maps Foundation, Barry" + }, + "daylight": { + "type": "vector", + "url": location.hostname.includes("github.io") ? "pmtiles://https://storage.googleapis.com/ahp-research/overture/pmtiles/daylight.pmtiles" : "pmtiles://dist/daylight.pmtiles", } }, layers: [ { - "id": 'admins', - "type": 'fill', - "source": 'overture', - "source-layer": 'admins', + "id": "admins", + "type": "fill", + "source": "overture", + "source-layer": "admins", + "paint": { + "fill-color": "#292929" + } + }, + { + "id": "admins-outline", + "type": "line", + "source": "overture", + "source-layer": "admins", + "paint": { + "line-color": "#6a6a6a", + "line-width": 1 + } + }, + { + "id": "land", + "type": "fill", + "source": "daylight", + "source-layer": "land", + "filter": [ + "all", + ["any", ["==", ["geometry-type"], "Polygon"], ["==", ["geometry-type"], "MultiPolygon"]], + ["!=", ["get", "class"], "land"] + ], "paint": { - 'fill-color': "#000" + "fill-color": ["case", + ["==", ["get", "class"], "forest"], "#1C2C23", + ["==", ["get", "class"], "glacier"], "#99CCFF ", + ["==", ["get", "class"], "grass"], "#264032", + ["==", ["get", "class"], "physical"], "#555555", + ["==", ["get", "class"], "reef"], "#FFCC99", + ["==", ["get", "class"], "sand"], "#322921", + ["==", ["get", "class"], "scrub"], "#2D241D", + ["==", ["get", "class"], "tree"], "#228B22", + ["==", ["get", "class"], "wetland"], "#1C2C23", + ["==", ["get", "class"], "land"], "#171717", + "red" + ], + } + }, + { + "id": "landuse", + "type": "fill", + "source": "daylight", + "source-layer": "landuse", + "filter": [ + "all", + ["any", ["==", ["geometry-type"], "Polygon"], ["==", ["geometry-type"], "MultiPolygon"]] + ], + "paint": { + "fill-color": ["case", + ["==", ["get", "class"], "park"], "#264032", + ["==", ["get", "class"], "protected"], "#1C2C23", + ["==", ["get", "class"], "horticulture"], "#1C2C23", + ["==", ["get", "class"], "recreation"], "#454545", + ["==", ["get", "class"], "agriculture"], "#32322D", + ["==", ["get", "class"], "golf"], "#264032", + "#292929" + ], } }, { - "id": 'admins-outline', - "type": 'line', - "source": 'overture', - "source-layer": 'admins', + "id": "water-polygon", + "type": "fill", + "source": "daylight", + "source-layer": "water", + "filter": [ + "any", + ["==", ["geometry-type"], "Polygon"], + ["==", ["geometry-type"], "MultiPolygon"], + ], "paint": { - 'line-color': '#6a6a6a', - 'line-width': 1 + "fill-color": "#263138 " } }, - /* { - "id": 'buldings', - "type": 'fill', - "source": 'overture', - "source-layer": 'buildings', + { + "id": "water-line", + "type": "line", + "source": "daylight", + "source-layer": "water", + "filter": [ + "any", + ["==", ["geometry-type"], "LineString"], + ["==", ["geometry-type"], "MultiLineString"], + ], "paint": { - 'fill-color': '#1C1C1C' + "line-color": "#263138", + "line-width": 3 } - }, */ + }, { - "id": 'buldings-extruded', - "type": 'fill-extrusion', - "source": 'overture', - "source-layer": 'buildings', + "id": "buldings-extruded", + "type": "fill-extrusion", + "source": "overture", + "source-layer": "buildings", "paint": { - 'fill-extrusion-color': '#1C1C1C', + "fill-extrusion-color": "#2B2B2B", "fill-extrusion-height": [ "case", ["==", ["get", "height"], -1], 0, - ["get", "height"] // Otherwise, use the actual height value + ["get", "height"] ], - 'fill-extrusion-opacity': 0.9 - } - }, - { - "id": 'roads', - "type": 'line', - "source": 'overture', - "source-layer": 'roads', - "paint": { - 'line-color': - ['case', - ['==', ['get', 'class'], 'motorway'], '#717171', - ['==', ['get', 'class'], 'primary'], '#717171', - ['==', ['get', 'class'], 'secondary'], '#717171', - ['==', ['get', 'class'], 'tertiary'], '#717171', - ['==', ['get', 'class'], 'residential'], '#464646', - ['==', ['get', 'class'], 'livingStreet'], '#464646', - ['==', ['get', 'class'], 'trunk'], '#5A5A5A', - ['==', ['get', 'class'], 'unclassified'], '#5A5A5A', - ['==', ['get', 'class'], 'parkingAisle'], '#323232', - ['==', ['get', 'class'], 'driveway'], '#1C1C1C', - ['==', ['get', 'class'], 'pedestrian'], '#232323', - ['==', ['get', 'class'], 'footway'], '#1C1C1C', - ['==', ['get', 'class'], 'steps'], '#1C1C1C', - ['==', ['get', 'class'], 'track'], '#1C1C1C', - ['==', ['get', 'class'], 'cycleway'], '#1C1C1C', - ['==', ['get', 'class'], 'unknown'], '#1C1C1C', - '#5A5A5A' - ], - 'line-width': - ['case', - ['==', ['get', 'class'], 'motorway'], 6, - ['==', ['get', 'class'], 'primary'], 5, - ['==', ['get', 'class'], 'secondary'], 4, - ['==', ['get', 'class'], 'tertiary'], 3, - ['==', ['get', 'class'], 'residential'], 3, - ['==', ['get', 'class'], 'livingStreet'], 3, - ['==', ['get', 'class'], 'trunk'], 2, - ['==', ['get', 'class'], 'unclassified'], 2, - ['==', ['get', 'class'], 'parkingAisle'], 2, - ['==', ['get', 'class'], 'driveway'], 2, - ['==', ['get', 'class'], 'pedestrian'], 3, - ['==', ['get', 'class'], 'footway'], 3, - ['==', ['get', 'class'], 'steps'], 2, - ['==', ['get', 'class'], 'track'], 2, - ['==', ['get', 'class'], 'cycleway'], 2, - ['==', ['get', 'class'], 'unknown'], 2, - 2 + "fill-extrusion-opacity": 1 + } + }, + { + "id": "roads", + "type": "line", + "source": "overture", + "source-layer": "roads", + "filter": [ + "any", + ["==", ["get", "class"], "parkingAisle"], + ["==", ["get", "class"], "driveway"], + ["==", ["get", "class"], "unknown"] + ], + "paint": { + "line-color": + ["case", + + ["==", ["get", "class"], "parkingAisle"], "#323232", + ["==", ["get", "class"], "driveway"], "#1C1C1C", + ["==", ["get", "class"], "unknown"], "#1C1C1C", + "#5A5A5A" ], + "line-width": [ + "interpolate", + ["exponential", 2], + ["zoom"], + 8, ["*", 2, ["^", 2, -3]], + 21, ["*", 2, ["^", 2, 5]] + ] }, "layout": { "line-cap": "round" } }, { - "id": 'roads-labels', - "type": 'symbol', - "source": 'overture', - "source-layer": 'roads', + "id": "roads-motorway", + "type": "line", + "source": "overture", + "source-layer": "roads", + "filter": [ + "any", + ["==", ["get", "class"], "motorway"] + ], + "paint": { + "line-color": "#717171", + "line-width": [ + "interpolate", + ["exponential", 2], + ["zoom"], + 3, ["*", 6, ["^", 2, -2]], + 21, ["*", 6, ["^", 2, 6]] + ] + }, "layout": { - 'icon-allow-overlap': false, - 'symbol-placement': "line", - 'text-field': ['get', 'roadName'], - 'text-radial-offset': 0.5, - 'text-size': 12, + "line-cap": "round" + } + }, + { + "id": "roads-primary", + "type": "line", + "source": "overture", + "source-layer": "roads", + "filter": [ + "any", + ["==", ["get", "class"], "primary"] + ], + "paint": { + "line-color": "#717171", + "line-width": [ + "interpolate", + ["exponential", 2], + ["zoom"], + 3, ["*", 4, ["^", 2, -2]], + 21, ["*", 4, ["^", 2, 6]] + ] }, + "layout": { + "line-cap": "round" + } + }, + { + "id": "roads-secondary", + "type": "line", + "source": "overture", + "source-layer": "roads", + "filter": [ + "any", + ["==", ["get", "class"], "secondary"] + ], "paint": { - 'text-color': "#E2E2E2", - 'text-halo-color': "#000", - 'text-halo-width': 3, - 'text-halo-blur': 2 + "line-color": "#717171", + "line-width": [ + "interpolate", + ["exponential", 2], + ["zoom"], + 3, ["*", 4, ["^", 2, -2]], + 21, ["*", 4, ["^", 2, 5]] + ] + }, + "layout": { + "line-cap": "round" } }, { - "id": 'places', - "type": 'circle', - "source": 'overture', - "source-layer": 'places', - + "id": "roads-tertiary", + "type": "line", + "source": "overture", + "source-layer": "roads", + "filter": [ + "any", + ["==", ["get", "class"], "tertiary"] + ], + "paint": { + "line-color": "#717171", + "line-width": [ + "interpolate", + ["exponential", 2], + ["zoom"], + 8, ["*", 3, ["^", 2, -3]], + 21, ["*", 3, ["^", 2, 6]] + ] + }, + "layout": { + "line-cap": "round" + } + }, + { + "id": "roads-cyleway", + "type": "line", + "source": "overture", + "source-layer": "roads", + "filter": [ + "all", + ["==", ["get", "class"], "cycleway"] + ], + "paint": { + "line-color": "#4D3012", + "line-width": [ + "interpolate", + ["exponential", 2], + ["zoom"], + 8, ["*", 2, ["^", 2, -4]], + 21, ["*", 2, ["^", 2, 5]] + ] + }, + "layout": { + "line-cap": "round" + } + }, + { + "id": "roads-pedestrian", + "type": "line", + "source": "overture", + "source-layer": "roads", + "filter": [ + "any", + ["==", ["get", "class"], "pedestrian"], + ["==", ["get", "class"], "footway"], + ["==", ["get", "class"], "track"], + ], + "paint": { + "line-dasharray": [2, 2], + "line-color": "#464646", + "line-width": [ + "interpolate", + ["exponential", 2], + ["zoom"], + 8, ["*", 3, ["^", 2, -2]], + 21, ["*", 3, ["^", 2, 3]] + ] + }, + "layout": { + "line-cap": "round" + } + }, + { + "id": "roads-residential", + "type": "line", + "source": "overture", + "source-layer": "roads", + "filter": [ + "any", + ["==", ["get", "class"], "residential"], + ["==", ["get", "class"], "livingStreet"], + ["==", ["get", "class"], "unclassified"], + ], + "paint": { + "line-color": "#535353", + "line-width": [ + "interpolate", + ["exponential", 2], + ["zoom"], + 8, ["*", 2, ["^", 2, -3]], + 21, ["*", 2, ["^", 2, 6]] + ] + }, + "layout": { + "line-cap": "round" + } + }, + { + "id": "roads-labels", + "type": "symbol", + "source": "overture", + "source-layer": "roads", + "minzoom": 12, + "layout": { + "icon-allow-overlap": false, + "text-allow-overlap": false, + "symbol-placement": "line", + "text-field": ["get", "roadName"], + "text-radial-offset": 0.5, + "text-size": 11, + }, + "paint": { + "text-color": "#E2E2E2", + "text-halo-color": "#000", + "text-halo-width": 2, + "text-halo-blur": 1 + } + }, + { + "id": "places", + "type": "circle", + "source": "overture", + "source-layer": "places", + "minzoom": 16, + "filter": [">=", ["get", "confidence"], 0.9], "paint": { "circle-color": "#4EDAD8", - "circle-radius": 5, + "circle-radius": 3, "circle-blur": 0.3, "circle-opacity": 0.8 } }, { - "id": 'places-labels', - "type": 'symbol', - "source": 'overture', - "source-layer": 'places', + "id": "places-labels", + "type": "symbol", + "source": "overture", + "source-layer": "places", + "minzoom": 16, + "filter": [">=", ["get", "confidence"], 0.9], + "layout": { + + "icon-allow-overlap": false, + "text-allow-overlap": false, + "text-anchor": "bottom", + "text-radial-offset": 1, + "symbol-placement": "point", + "text-field": ["get", "name"], + "text-size": 10, + }, + "paint": { + "text-color": "#4EDAD8", + "text-halo-color": "black", + "text-halo-width": 3, + "text-halo-blur": 2 + } + }, + { + "id": "urban-labels", + "type": "symbol", + "source": "daylight", + "source-layer": "placename", + "minzoom": 2, + "maxzoom": 14, + "filter": [ + "any", + ["==", ["get", "subclass"], "city"], + ["==", ["get", "subclass"], "municipality"], + ["==", ["get", "subclass"], "metropolis"], + ["==", ["get", "subclass"], "megacity"] + ], + "layout": { + "text-ignore-placement": true, + "text-allow-overlap": false, + "icon-allow-overlap": false, + "symbol-placement": "point", + "text-field": ["get", "name"], + "text-size": 16, + }, + "paint": { + "text-color": "white", + "text-halo-color": "black", + "text-halo-width": 3, + "text-halo-blur": 2 + } + }, + { + "id": "settlement-labels", + "type": "symbol", + "source": "daylight", + "source-layer": "placename", + "minzoom": 11, + "maxzoom": 21, + "filter": [ + "any", + ["==", ["get", "subclass"], "town"], + ["==", ["get", "subclass"], "vilage"], + ["==", ["get", "subclass"], "hamlet"], + ], + "layout": { + "text-ignore-placement": true, + "text-allow-overlap": false, + "icon-allow-overlap": false, + "symbol-placement": "point", + "text-field": ["get", "name"], + "text-size": 14, + }, + "paint": { + "text-color": "white", + "text-halo-color": "black", + "text-halo-width": 3, + "text-halo-blur": 2 + } + }, + { + "id": "local-labels", + "type": "symbol", + "source": "daylight", + "source-layer": "placename", + "minzoom": 14, + "maxzoom": 21, + "filter": [ + "any", + ["==", ["get", "subclass"], "neighborhood"], + ["==", ["get", "subclass"], "suburb"], + ["==", ["get", "subclass"], "borough"], + ["==", ["get", "subclass"], "block"] + ], "layout": { - 'icon-allow-overlap': false, - 'text-allow-overlap': false, - 'text-anchor': "bottom", - 'text-radial-offset': 1, - 'symbol-placement': "point", - 'text-field': ['get', 'name'], - 'text-size': 10, + "text-ignore-placement": true, + "text-allow-overlap": true, + "icon-allow-overlap": true, + "icon-ignore-placement": true, + "symbol-placement": "point", + "text-field": ["get", "name"], + "text-size": 14, }, "paint": { - 'text-color': "#4EDAD8", - 'text-halo-color': "black", - 'text-halo-width': 3, - 'text-halo-blur': 2 + "text-color": "white", + "text-halo-color": "black", + "text-halo-width": 3, + "text-halo-blur": 2 } }, ], @@ -178,7 +485,7 @@ const map = new maplibregl.Map({ zoom: 14, }); -map.on('click', function (e) { +map.on("click", function (e) { var visibleLayers = map.getStyle().layers; for (var i = 0; i < visibleLayers.length; i++) { @@ -189,13 +496,13 @@ map.on('click', function (e) { var feature = features[0]; // Create an HTML table to display key-value pairs from feature properties - var tableHTML = '

' + layerId + '

'; + var tableHTML = "

" + layerId + "

"; for (var property in feature.properties) { if (feature.properties.hasOwnProperty(property)) { - tableHTML += ''; + tableHTML += ""; } } - tableHTML += '
' + property + '' + feature.properties[property] + '
" + property + "" + feature.properties[property] + "
'; + tableHTML += ""; new maplibregl.Popup() .setLngLat(e.lngLat) @@ -205,8 +512,11 @@ map.on('click', function (e) { } }); -/* map.addControl( - new maplibregl.NavigationControl({ - visualizePitch: true, - }) -); */ +var slider = document.querySelector("#confidence-slider"); +//@ts-ignore +slider.addEventListener("input", function () { + //@ts-ignore + const confidence = slider.value / 100; + map.setFilter("places", [">=", ["get", "confidence"], confidence]); + map.setFilter("places-labels", [">=", ["get", "confidence"], confidence]); +}); diff --git a/viewer/src/style.css b/viewer/src/style.css index bdf2347..bf96cf0 100644 --- a/viewer/src/style.css +++ b/viewer/src/style.css @@ -3,7 +3,7 @@ body { height: 100%; padding: 0; margin: 0; - background-color: black; + background-color: #292929; font-family: Arial, sans-serif; } @@ -14,26 +14,76 @@ body { #info { position: absolute; - bottom: 1rem; + top: 1rem; left: 1rem; color: #d3d3d3; z-index: 1; + padding: 0.75rem; + border-radius: 0.5rem; + -webkit-backdrop-filter: blur(8px); /* Safari 9+ */ + backdrop-filter: blur(6px); /* Chrome and Opera */ + box-shadow: inset 0 0 0 200px rgba(255, 255, 255, 0.1); } #info .header { font-size: 2.25rem; font-weight: 600; - line-height: 3rem; + line-height: 2rem; + color: #bdbdbd; + text-shadow: 2px 4px 1px #373737; } #info .description { - font-size: 0.85rem; + margin-top: 0.25rem; + font-size: 1rem; + color: #bdbdbd; + font-family: "Courier New", Courier, monospace; } #info a { color: inherit; } +.controls { + margin-top: 2rem; + font-size: 0.75rem; + font-family: "Courier New", Courier, monospace; +} + +.slider { + -webkit-appearance: none; /* Override default CSS styles */ + appearance: none; + width: 100%; /* Full-width */ + height: 15px; /* Specified height */ + background: #d3d3d3; /* Grey background */ + outline: none; /* Remove outline */ + opacity: 0.7; /* Set transparency (for mouse-over effects on hover) */ + -webkit-transition: 0.2s; /* 0.2 seconds transition on hover */ + transition: opacity 0.2s; +} + +/* Mouse-over effects */ +.slider:hover { + opacity: 1; /* Fully shown on mouse-over */ +} + +/* The slider handle (use -webkit- (Chrome, Opera, Safari, Edge) and -moz- (Firefox) to override default look) */ +.slider::-webkit-slider-thumb { + -webkit-appearance: none; /* Override default look */ + appearance: none; + width: 25px; /* Set a specific slider handle width */ + height: 13px; /* Slider handle height */ + background: #4bbbba; /* Green background */ + cursor: pointer; /* Cursor on hover */ +} + +.slider::-moz-range-thumb { + width: 25px; /* Set a specific slider handle width */ + height: 15px; /* Slider handle height */ + background: #04aa6d; /* Green background */ + cursor: pointer; /* Cursor on hover */ +} + .maplibregl-popup-content h1 { font-size: 1rem; line-height: 0.1rem;