diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6101a2b02..a1c5d6843 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -42,7 +42,7 @@ jobs: makepot: "true" services: postgres: - image: postgres:13 + image: postgis/postgis:13-3.4 env: POSTGRES_USER: odoo POSTGRES_PASSWORD: odoo diff --git a/base_geoengine/README.rst b/base_geoengine/README.rst new file mode 100644 index 000000000..518ab5557 --- /dev/null +++ b/base_geoengine/README.rst @@ -0,0 +1,368 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +=========================== +Geospatial support for Odoo +=========================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:a22713167bb39e1995e9bc618b29382cd03bba76a910d58cf62993288b0a385b + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fgeospatial-lightgray.png?logo=github + :target: https://github.com/OCA/geospatial/tree/19.0/base_geoengine + :alt: OCA/geospatial +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/geospatial-19-0/geospatial-19-0-base_geoengine + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/geospatial&target_branch=19.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +GeoEngine is an Odoo module that adds spatial/GIS capabilites to Odoo. +It will allow you to : + +- Visualize and query your business information on map +- Perform GeoBI and spatial query +- Configure your spatial layers and spatial datasources +- Extend Odoo models with spatial columns + +GeoEngine relies on `OpenLayers `__ and +`PostgGIS `__ technologies. + +Postgis is used to store spatial information in databases. OpenLayer is +used to represent spatial data in other words to show maps and the +different spatial layers. The GeoEngine module acts as a data provider +and as an OpenLayers configurator. It also provides a complete extension +to Odoo ORM. + +**Table of contents** + +.. contents:: + :local: + +Installation +============ + +To install this module, you need to have +`PostGIS `__ installed. + +On Ubuntu: + +:: + + .. code-block:: bash + +.. + + sudo apt-get install postgis + +The module also requires two additional python libs: + +- `Shapely `__ +- `geojson `__ + +When you will install the module this two additional libs will be +installed. + +For a complete documentation please refer to the `public +documenation `__ + +Usage +===== + +Geoengine Demo +-------------- + +1. As a user/admin, when I am in the Geoengine Demo module and I go to + the ZIP menu. When I click on an item in the list view, I get to the + form view showing me the different information about the ZIP. We can + see its ZIP, city, priority, total sales and his spatial + representation. +2. As a user, I can't modify the information in the form view. +3. As an admin, I can modify the information in the form view. I can + click on the bin button to clear the map and I can draw a new shape. +4. As a user, when I go the "Retail machines" tab and there are no + items to display, it does not show me anything. +5. As an admin, when I go the "Retail machines" tab and there are no + items to display, the list view of the retail machines suggests to + me to add a new line. +6. As a user/admin, if there are items to be displayed in the "Retail + machines" tab then I can click on an item and the retail machines + form view will be displayed. We can see its spatial representation + by going to "The point" tab and its attributes in "Attributes" tab. +7. As a user/admin, when I go to the geoengine zip view by clicking on + the map button at the top right of the screen. The geoengine view + appears with the first 80 results displayed on the map. The vector + layers selected are those defined as "active on startup" by the + admin. The selected raster layer is the first one that is not an + overlay layer. +8. As a user/admin, when I hover over an area on the map, the area + changes its style. +9. As a user/admin, when I click on an area, a popup appears an I can + see the different information about the area. If I click on the + cross, the popup will disappear. If I click somewhere else on the + map, the popup will also disappear. If I click on the about button, + then the form view will be displayed. +10. As a user/admin, when I use the paging system, then the results + displayed on the map are different (corresponding to the request). +11. As a user/admin, if we use the search bar, we can search results by + his zip or his city. +12. As an admin, if I change the sequence of layers with the handle + button then the change are persisted in database. +13. As a user, if I change the sequence of layers with the handle button + then the change are not persisted in database. There are just the + changes in the display. +14. As an admin, if I change the domain of a layer with the filter + button then the change are persisted in database. +15. As a user, if I change the domain of a layer with the filter button + then the change are not persisted in database. There are just the + changes in the display. +16. As an admin, I have the possibility to edit the layer with its + corresponding button. +17. As a user/admin, I can open/close LayerPanel with its button. +18. As a user/admin, I can open/close RecordsPanel with its button. +19. As a user/admin, when I click on a record in RecordsPanel, a move is + made on the map to the selected record. +20. As a user/admin, when I click on a record in RecordsPanel, I can + also click on the left magnifying glass to zoom on the record. +21. As a user/admin, when I click on a record in RecordsPanel, I can + also click on the right magnifying glass to get the original zoom. +22. As a user/admin, I can use the search bar to search in the + RecordsPanel. +23. As an admin,If the geoengine view is in edit mode, I can create new + records by drawing them in the view. +24. As an admin, If the geoengine view is in edit mode, I can modify its + spatial representation. + +Geoengine Backend +----------------- + +1. As an admin, if I go into the configuration of the raster layers and + it has elements, I can click on one and see its information. +2. As an admin, if I want to create a new raster layer, I can click on + "NEW" and fill out the form. The required fields for OpenStreetMap + type are "Layer Name" and "Related View". If we want to have a WMTS + (Web Map Tile Service) raster type. The required fields in addition + to the precedents are "Service URL", "Matrix set","Format", + "Projection" and "Resolutions". If we take WMS (Web Map Service) + raster type, then the required fields are "Layer Name", "Related + View", "Service URL", "Params", "Server Type". +3. As an admin,if I go into the configuration of the vector layers and + it has elements, I can click on one and see its information. +4. As an admin, if I want to create a new vector layer, I can click on + "NEW" and fill out the form. The required fields are "Layer Name", + "Related View", "Geo field" and "Representation mode". + +Known issues / Roadmap +====================== + + + +Changelog +========= + +16.0.1.0.0 (2023-03-20) +----------------------- + +- LayerSwitcher has been removed as it was not really practical. A + LayerPanel is now active. +- The geo_search method is now deprecated and replaced by the standard + odoo search method. +- The widget "geo_edit_map" attribute is no longer necessary as the + field is automatically detected by his type. We can also provide an + option attribute that allows us to pass an opacity and a color as + parameters. + +.. code:: xml + +
+ + + + + +
+ +- The method geo_search is now deprecated. We now need to use the + standard odoo search method. + +.. code:: python + + obj.search([("the_point","geo_intersect",{"dummy.zip.the_geom": [("id", "=", rec.id)]})]) + +- We can now pass to the geoengine view a template to display the + information we want to see when clicking on a feature. + +.. code:: xml + + + + + + + + + +
    +
  • ZIP : +
  • +
  • Total Sales: +
  • +
+
+
+
+ +- We can now pass a model to use to a layer to display other information + on the map. + +.. code:: xml + + + + [('state', '=', 'hs')] + + HS retail machines + + basic + + #FF0000 + + 0.8 + + +- There is some new features in the LayerPanel. + +1. If you are logged in as an admin, you have the possibility to edit + the layer by clicking on the edit button. This will open a dialog + box. Changes will appear in real time on the view. +2. If you are logged in as an admin, you can also change the domain of + the layer. If you are logged in as a user, changes will not be + persisted in the database. Changes will appear in real time on the + view. +3. If you are logged in as an admin, you can also change the sequence of + the layers by sliding them over each other. If you are logged in as a + user, changes will not be persisted in the database. + +- Widget domain is now implemented for geo field This means that the + geo-operators are also implemented and that there is the possibility + to add a sub-domain. If we want to add a domain that includes all the + records that are displayed in the geoengine view (active_ids). We can + use the two new operators : "in active_ids" and "not in active_ids". + These will automatically replace the marker with ids. Note that the + widget will indicate that the domain is invalid because of the marker. +- Creation of the RecordsPanel. This panel allows you to retrieve all + active records. You can click on record to get the movement to the + selected record. Two magnifying glass are also available. You can + click on the left one to zoom on the record. You can click on the + right one to get the original zoom. +- A search bar is also available. It allows you to perform a search into + the RecordsPanel. +- A button to open/close the panels is also available. +- The module has been translated in French. +- Now you can now make the geoengine view editable. Simply add editable + attribute in the geoengine view. + +.. code:: xml + + + + + + + + + + +
    +
  • ZIP : +
  • +
  • Total Sales: +
  • +
+
+
+
+ + Thanks to that, you can create new records by drawing them directly in the geoengine view. You can also edit record in the same view. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Camptocamp +* ACSONE SA/NV + +Contributors +------------ + +- Nicolas Bessi +- Frederic Junod +- Yannick Payot +- Sandy Carter +- Laurent Mignon +- Jonathan Nemry +- David Lasley +- Daniel Reis +- Matthieu Dietrich +- Alan Ramos +- Damien Crier +- Cyril Gaudin +- Pierre Verkest +- Benjamin Willig +- Devendra Kavthekar +- Emanuel Cino +- Thomas Nowicki +- Alexandre Saunier +- Sandip Mangukiya +- Samuel Kouff +- `APSL-Nagarro `__: + + - Antoni Marroig + - Miquel Alzanillas + +- Red Butay <> +- Sergio Sancho + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/geospatial `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/base_geoengine/__init__.py b/base_geoengine/__init__.py new file mode 100644 index 000000000..5985c83ac --- /dev/null +++ b/base_geoengine/__init__.py @@ -0,0 +1,7 @@ +from . import models +from . import expressions +from . import fields +from . import geo_convertion_helper +from . import geo_operators +from .geo_db import init_postgis +from . import domains diff --git a/base_geoengine/__manifest__.py b/base_geoengine/__manifest__.py new file mode 100644 index 000000000..b620bf7b8 --- /dev/null +++ b/base_geoengine/__manifest__.py @@ -0,0 +1,34 @@ +# Copyright 2011-2015 Nicolas Bessi (Camptocamp SA) +# Copyright 2016 Yannick Payot (Camptocamp SA) +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +{ + "name": "Geospatial support for Odoo", + "version": "19.0.1.0.2", + "category": "GeoBI", + "author": "Camptocamp,ACSONE SA/NV,Odoo Community Association (OCA)", + "license": "AGPL-3", + "website": "https://github.com/OCA/geospatial", + "depends": ["base", "web"], + "data": [ + "security/data.xml", + "views/base_geoengine_view.xml", + "views/ir_model_view.xml", + "views/ir_view_view.xml", + "views/geo_raster_layer_view.xml", + "views/geo_vector_layer_view.xml", + "security/ir.model.access.csv", + ], + "assets": { + "web.assets_backend": [ + "base_geoengine/static/src/js/**/*", + "base_geoengine/static/src/css/style.css", + "base_geoengine/static/lib/geostats-2.1.0/geostats.css", + ], + # Note: Third-party libraries (ol.js, chroma.js, geostats.js) are loaded + # dynamically via loadJS() in geoengine_libs.esm.js to avoid bundler issues + }, + "external_dependencies": {"python": ["shapely", "geojson"]}, + "installable": True, + "pre_init_hook": "init_postgis", +} diff --git a/base_geoengine/domains.py b/base_geoengine/domains.py new file mode 100644 index 000000000..61df5530a --- /dev/null +++ b/base_geoengine/domains.py @@ -0,0 +1,149 @@ +import contextlib +import logging +import warnings + +from odoo.fields import Domain +from odoo.models import BaseModel +from odoo.orm import domains +from odoo.orm.domains import ( + CONDITION_OPERATORS, + NEGATIVE_CONDITION_OPERATORS, + SQL, + DomainCondition, + OptimizationLevel, + Query, +) +from odoo.orm.identifiers import NewId + +_logger = logging.getLogger(__name__) + +GEO_OPERATORS = frozenset( + [ + "geo_greater", + "geo_lesser", + "geo_equal", + "geo_touch", + "geo_within", + "geo_contains", + "geo_intersect", + ] +) + + +def checked(self) -> DomainCondition: + """Validate `self` and return it if correct, otherwise raise an exception.""" + if not isinstance(self.field_expr, str) or not self.field_expr: + self._raise("Empty field name", error=TypeError) + operator = self.operator.lower() + if operator != self.operator: + warnings.warn( + ( + f"Deprecated since 19.0, the domain condition " + f"{(self.field_expr, self.operator, self.value)!r} " + f"should have a lower-case operator" + ), + DeprecationWarning, + # + stacklevel=2, + # + ) + return DomainCondition(self.field_expr, operator, self.value).checked() + if operator not in CONDITION_OPERATORS: + # + if operator not in GEO_OPERATORS: + # + self._raise("Invalid operator") + + # check already the consistency for domain manipulation + # these are common mistakes and optimizations, + # do them here to avoid recreating the domain + # - NewId is not a value + # - records are not accepted, use values + # - Query and Domain values should be using a relational operator + # + # from .models import BaseModel # noqa: PLC0415 + # + + value = self.value + if value is None: + value = False + elif isinstance(value, NewId): + _logger.warning( + "Domains don't support NewId, use .ids instead, for %r", + (self.field_expr, self.operator, self.value), + ) + operator = "not in" if operator in NEGATIVE_CONDITION_OPERATORS else "in" + value = [] + elif isinstance(value, BaseModel): + _logger.warning( + "The domain condition %r should not have a value which is a model", + (self.field_expr, self.operator, self.value), + ) + value = value.ids + elif isinstance(value, (Domain, Query, SQL)) and operator not in ( + "any", + "not any", + "any!", + "not any!", + "in", + "not in", + ): + # accept SQL object in the right part for simple operators + # use case: compare 2 fields + _logger.warning( + "The domain condition %r should use the 'any' or 'not any' operator.", + (self.field_expr, self.operator, self.value), + ) + if value is not self.value: + return DomainCondition(self.field_expr, operator, value) + return self + + +def _to_sql(self, model: BaseModel, alias: str, query: Query) -> SQL: + """Enhanced _to_sql that handles geospatial operators.""" + field_expr, operator, value = self.field_expr, self.operator, self.value + + # Only handle geospatial operators here, delegate everything else to original method + if operator in GEO_OPERATORS: + # Ensure geospatial conditions are fully optimized + assert self._opt_level >= OptimizationLevel.FULL, ( + "Must fully optimize before generating the query " + f"{(field_expr, operator, value)}" + ) + + field = self._field(model) + model._check_field_access(field, "read") + return field.condition_to_sql(field_expr, operator, value, model, alias, query) + + # For all other operators, use the original method + return original__to_sql(self, model, alias, query) + + +def _optimize_step(self, model: BaseModel, level: OptimizationLevel) -> Domain: + """Optimization step for geospatial operators.""" + # For geospatial operators, we need to handle them specially during optimization + # If this is a geospatial operator, mark it as optimized at FULL level + if self.operator in GEO_OPERATORS: + # Perform basic validation and normalization + with contextlib.suppress(Exception): + field = self._field(model) + # Basic geospatial operator validation + if hasattr(field, "geo_type"): # It's a geospatial field + # Create optimized version with FULL level + optimized = DomainCondition(self.field_expr, self.operator, self.value) + object.__setattr__(optimized, "_opt_level", OptimizationLevel.FULL) + return optimized + + # Fall back to original optimization for non-geo operators + return original__optimize_step(self, model, level) + + +# Store original methods before monkey patching +original__optimize_step = DomainCondition._optimize_step +original__to_sql = DomainCondition._to_sql + +DomainCondition.checked = checked +DomainCondition._to_sql = _to_sql +DomainCondition._optimize_step = _optimize_step + +domains.CONDITION_OPERATORS = domains.CONDITION_OPERATORS.union(GEO_OPERATORS) diff --git a/base_geoengine/expressions.py b/base_geoengine/expressions.py new file mode 100644 index 000000000..3a7f4a2c7 --- /dev/null +++ b/base_geoengine/expressions.py @@ -0,0 +1,191 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +import logging +import random +import string + +from odoo import fields +from odoo.fields import Domain +from odoo.models import BaseModel +from odoo.tools import SQL, Query + +from .fields import GeoField +from .geo_operators import GeoOperator + +logger = logging.getLogger(__name__) + +original___condition_to_sql = fields.Field._condition_to_sql + +GEO_OPERATORS = { + "geo_greater": ">", + "geo_lesser": "<", + "geo_equal": "=", + "geo_touch": "ST_Touches", + "geo_within": "ST_Within", + "geo_contains": "ST_Contains", + "geo_intersect": "ST_Intersects", +} + +GEO_SQL_OPERATORS = { + "geo_greater": SQL(">"), + "geo_lesser": SQL("<"), + "geo_equal": SQL("="), + "geo_touch": SQL("ST_Touches"), + "geo_within": SQL("ST_Within"), + "geo_contains": SQL("ST_Contains"), + "geo_intersect": SQL("ST_Intersects"), +} + + +def _condition_to_sql( + self, + field_expr: str, + operator: str, + value, + model: BaseModel, + alias: str, + query: Query, +) -> SQL: + """ + This method has been monkey patched in order to be able to include + geo_operators into the Odoo search method. + """ + if operator in GEO_OPERATORS.keys(): + current_field = model._fields.get(field_expr) + current_operator = GeoOperator(current_field) + if current_field and isinstance(current_field, GeoField): + params = [] + if isinstance(value, dict): + # We are having indirect geo_operator like (‘geom’, ‘geo_...’, + # {‘res.zip.poly’: [‘id’, ‘in’, [1,2,3]] }) + ref_search = value + sub_queries = [] + for key in ref_search: + i = key.rfind(".") + rel_model_name = key[0:i] + rel_col = key[i + 1 :] + rel_model = model.env[rel_model_name] + # we compute the attributes search on spatial rel + if ref_search[key]: + rel_alias = ( + rel_model._table + + "_" + + "".join(random.choices(string.ascii_lowercase, k=5)) + ) + rel_query = where_calc( + rel_model, + ref_search[key], + active_test=True, + alias=rel_alias, + ) + # Record rules (ir.rule) on the related model are applied + # inside where_calc(), mirroring BaseModel._search(). + if operator == "geo_equal": + rel_query.add_where( + f'"{alias}"."{field_expr}" {GEO_OPERATORS[operator]} ' + f"{rel_alias}.{rel_col}" + ) + elif operator in ("geo_greater", "geo_lesser"): + rel_query.add_where( + f"ST_Area({alias}.{field_expr}) " + f"{GEO_OPERATORS[operator]} " + f"ST_Area({rel_alias}.{rel_col})" + ) + else: + rel_query.add_where( + f'{GEO_OPERATORS[operator]}("{alias}"."{field_expr}", ' + f"{rel_alias}.{rel_col})" + ) + + subquery_sql = rel_query.subselect("1") + sub_query_mogrified = ( + model.env.cr.mogrify(subquery_sql.code, subquery_sql.params) + .decode("utf-8") + .replace(f"'{rel_model._table}'", f'"{rel_model._table}"') + .replace("%", "%%") + ) + sub_queries.append(f"EXISTS({sub_query_mogrified})") + query_str = " AND ".join(sub_queries) + else: + query_str = get_geo_func( + current_operator, operator, field_expr, value, params, model._table + ) + return SQL(query_str, *params) + return original___condition_to_sql( + self, + field_expr=field_expr, + operator=operator, + value=value, + model=model, + alias=alias, + query=query, + ) + + +fields.Field._condition_to_sql = _condition_to_sql + + +def get_geo_func(current_operator, operator, left, value, params, table): + """ + This method will call the SQL query corresponding to the requested geo operator + """ + match operator: + case "geo_greater": + query = current_operator.get_geo_greater_sql(table, left, value, params) + case "geo_lesser": + query = current_operator.get_geo_lesser_sql(table, left, value, params) + case "geo_equal": + query = current_operator.get_geo_equal_sql(table, left, value, params) + case "geo_touch": + query = current_operator.get_geo_touch_sql(table, left, value, params) + case "geo_within": + query = current_operator.get_geo_within_sql(table, left, value, params) + case "geo_contains": + query = current_operator.get_geo_contains_sql(table, left, value, params) + case "geo_intersect": + query = current_operator.get_geo_intersect_sql(table, left, value, params) + case _: + raise NotImplementedError(f"The operator {operator} is not supported") + return query + + +def where_calc(model, domain, active_test=True, alias=None): + """ + This method is copied from base, we need to create our own query. + + It mirrors ``BaseModel._search``: besides ``active_test`` filtering, it also + applies record rules (``ir.rule``) to the resulting query. This matters for + the indirect geo-operators, whose spatial sub-query is built here: without + it, the sub-query would match related records the user is not allowed to + read (row-level security bypass). + """ + # if the object has an active field ('active', 'x_active'), filter out all + # inactive records unless they were explicitly asked for + if model._active_name and active_test and model._context.get("active_test", True): + # the item[0] trick below works for domain items and '&'/'|'/'!' + # operators too + if not any(item[0] == model._active_name for item in domain): + domain = [(model._active_name, "=", 1)] + domain + + query = Query(model.env, alias, model._table) + if domain: + # In Odoo 19, create Domain object and use its _to_sql method + domain_obj = Domain(domain) + optimized_domain = domain_obj.optimize_full(model) + sql_condition = optimized_domain._to_sql(model, alias, query) + query.add_where(sql_condition) + + # Apply record rules, like BaseModel._search does. Skipped for the + # superuser (env.su), exactly as in core. + if not model.env.su: + model.browse().check_access("read") + model_sudo = model.sudo().with_context(active_test=False) + sec_domain = model.env["ir.rule"]._compute_domain(model._name, "read") + sec_domain = sec_domain.optimize_full(model_sudo) + if sec_domain.is_false(): + query.add_where(SQL("FALSE")) + elif not sec_domain.is_true(): + query.add_where(sec_domain._to_sql(model_sudo, alias, query)) + + return query diff --git a/base_geoengine/fields.py b/base_geoengine/fields.py new file mode 100644 index 000000000..1cd79f843 --- /dev/null +++ b/base_geoengine/fields.py @@ -0,0 +1,347 @@ +# Part of Odoo. See LICENSE file for full copyright and licensing details. +# Copyright 2011-2012 Nicolas Bessi (Camptocamp SA) +# Copyright 2016 Yannick Payot (Camptocamp SA) +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from __future__ import annotations + +import json +import logging +from operator import attrgetter + +from odoo import fields +from odoo.tools import sql + +from . import geo_convertion_helper as convert +from .geo_db import create_geo_column, create_geo_index + +logger = logging.getLogger(__name__) +try: + import geojson + from shapely.geometry import Point, shape + from shapely.geometry.base import BaseGeometry + from shapely.wkb import loads as wkbloads +except ImportError: + logger.warning("Shapely or geojson are not available in the sys path") + + +class GeoField(fields.Field): + """The field descriptor contains the field definition common to all + specialized fields for geolocalization. Subclasses must define a type + and a geo_type. The type is the name of the corresponding column type, + the geo_type is the name of the corresponding type in the GIS system. + """ + + geo_type = None + dim = "2" + srid = 3857 + gist_index = True + + @property + def column_type(self): + postgis_geom_type = self.geo_type.upper() if self.geo_type else "GEOMETRY" + if self.dim == "3": + postgis_geom_type += "Z" + elif self.dim == "4": + postgis_geom_type += "ZM" + return ("geometry", f"geometry({postgis_geom_type}, {self.srid})") + + def convert_to_column(self, value, record, values=None, validate=True): + """Convert value to database format + + value can be geojson, wkt, shapely geometry object. + If geo_direct_write in context you can pass diretly WKT""" + if not value: + return None + shape_to_write = self.entry_to_shape(value, same_type=True) + if shape_to_write.is_empty: + return None + else: + return f"SRID={self.srid};{shape_to_write.wkt}" + + def convert_to_cache(self, value, record, validate=True): + val = value + if isinstance(val, bytes | str): + try: + int(val, 16) + except Exception: + # not an hex value -> try to load from a sting + # representation of a geometry + value = convert.value_to_shape(value, use_wkb=False) + if isinstance(value, BaseGeometry): + val = value.wkb_hex + return val + + def convert_to_record(self, value, record): + """Value may be: + - a GeoJSON string when field onchange is triggered + - a geometry object hexcode from cache + - a unicode containing dict + """ + if not value: + return False + return convert.value_to_shape(value, use_wkb=True) + + def convert_to_read(self, value, record, use_display_name=True): + if not isinstance(value, BaseGeometry): + # read hexadecimal value from database + shape = self.load_geo(value) + else: + shape = value + if not shape or shape.is_empty: + return False + return geojson.dumps(shape) + + # + # Field description + # + + # properties used by get_description() + _description_dim = property(attrgetter("dim")) + _description_srid = property(attrgetter("srid")) + _description_gist_index = property(attrgetter("gist_index")) + + @classmethod + def load_geo(cls, wkb): + """Load geometry into browse record after read was done""" + if isinstance(wkb, BaseGeometry): + return wkb + return wkbloads(wkb, hex=True) if wkb else False + + def entry_to_shape(self, value, same_type=False): + """Transform input into an object""" + shape = convert.value_to_shape(value) + if same_type and not shape.is_empty: + if shape.geom_type.lower() != self.geo_type.lower(): + msg = self.env._( + "Geo Value %(geom_type)s must be of the same type %(geo_type)s \ + as fields", + geom_type=shape.geom_type.lower(), + geo_type=self.geo_type.lower(), + ) + raise TypeError(msg) + return shape + + def update_geo_db_column(self, model): + """Update the column type in the database.""" + cr = model.env.cr + query = """SELECT srid, type, coord_dimension + FROM geometry_columns + WHERE f_table_name = %s + AND f_geometry_column = %s""" + cr.execute(query, (model._table, self.name)) + check_data = cr.fetchone() + if not check_data: + raise TypeError( + self.env._( + "geometry_columns table seems to be corrupted." + " SRID check is not possible" + ) + ) + if check_data[0] != self.srid: + raise TypeError( + self.env._( + "Reprojection of column is not implemented." + " We can not change srid %(srid)s to %(data)s", + srid=self.srid, + data=check_data[0], + ) + ) + elif check_data[1] != self.geo_type.upper(): + raise TypeError( + self.env._( + "Geo type modification is not implemented." + " We can not change type %(data)s to %(geo_type)s", + data=check_data[1], + geo_type=self.geo_type.upper(), + ) + ) + elif check_data[2] != self.dim: + raise TypeError( + self.env._( + "Geo dimention modification is not implemented." + " We can not change dimention %(data)s to %(dim)s", + data=check_data[2], + dim=self.dim, + ) + ) + if self.gist_index: + create_geo_index(cr, self.name, model._table) + return True + + def update_db_column(self, model, column): + """Create/update the column corresponding to ``self``. + + For creation of geo column + + :param model: an instance of the field's model + :param column: the column's configuration (dict) + if it exists, or ``None`` + """ + # the column does not exist, create it + + if not column: + create_geo_column( + model.env.cr, + model._table, + self.name, + self.geo_type.upper(), + self.srid, + self.dim, + self.string, + ) + if self.gist_index: + create_geo_index(model.env.cr, self.name, model._table) + return + + if column["udt_name"] == self.column_type[0]: + if self.gist_index: + create_geo_index(model.env.cr, self.name, model._table) + return + + self.update_geo_db_column(model) + + if column["udt_name"] in self.column_cast_from: + sql.convert_column( + model.env.cr, model._table, self.name, self.column_type[1] + ) + else: + newname = (self.name + "_moved{}").format + i = 0 + while sql.column_exists(model.env.cr, model._table, newname(i)): + i += 1 + if column["is_nullable"] == "NO": + sql.drop_not_null(model.env.cr, model._table, self.name) + sql.rename_column(model.env.cr, model._table, self.name, newname(i)) + sql.create_column( + model.env.cr, model._table, self.name, self.column_type[1], self.string + ) + + +class GeoLine(GeoField): + """Field for POSTGIS geometry Line type""" + + type = "geo_line" + geo_type = "LineString" + + @classmethod + def from_points(cls, cr, point1, point2, srid=None): + """ + Converts given points in parameter to a line. + :param cr: DB cursor + :param point1: Point (BaseGeometry) + :param point2: Point (BaseGeometry) + :param srid: SRID + :return: LINESTRING Object + """ + sql = """ + SELECT + ST_MakeLine( + ST_GeomFromText(%(wkt1)s, %(srid)s), + ST_GeomFromText(%(wkt2)s, %(srid)s) + ) + """ + cr.execute( + sql, + { + "wkt1": point1.wkt, + "wkt2": point2.wkt, + "srid": srid or cls.srid, + }, + ) + res = cr.fetchone() + return cls.load_geo(res[0]) + + +class GeoPoint(GeoField): + """Field for POSTGIS geometry Point type""" + + type = "geo_point" + geo_type = "Point" + + @classmethod + def from_latlon(cls, cr, latitude, longitude): + """Convert a (latitude, longitude) into an UTM coordinate Point:""" + pt = Point(longitude, latitude) + cr.execute( + """ + SELECT + ST_Transform( + ST_GeomFromText(%(wkt)s, 4326), + %(srid)s) + """, + {"wkt": pt.wkt, "srid": cls.srid}, + ) + res = cr.fetchone() + return cls.load_geo(res[0]) + + @classmethod + def to_latlon(cls, cr, geopoint): + """Convert a UTM coordinate point to \ + (latitude, longitude):""" + # Line to execute to retrieve + # longitude, latitude from UTM in postgres command line: + # SELECT ST_X(geom), ST_Y(geom) FROM (SELECT ST_TRANSFORM(ST_SetSRID( + # ST_MakePoint(601179.61612, 6399375,681364), + # ..............900913), 4326) as geom) g; + if isinstance(geopoint, BaseGeometry): + geo_point_instance = geopoint + else: + geo_point_instance = shape(json.loads(geopoint)) + cr.execute( + """ + SELECT + ST_TRANSFORM( + ST_SetSRID( + ST_MakePoint( + %(coord_x)s, %(coord_y)s + ), + %(srid)s + ), 4326)""", + { + "coord_x": geo_point_instance.x, + "coord_y": geo_point_instance.y, + "srid": cls.srid, + }, + ) + + res = cr.fetchone() + point_latlon = cls.load_geo(res[0]) + return point_latlon.x, point_latlon.y + + +class GeoPolygon(GeoField): + """Field for POSTGIS geometry Polygon type""" + + type = "geo_polygon" + geo_type = "Polygon" + + +class GeoMultiLine(GeoField): + """Field for POSTGIS geometry MultiLine type""" + + type = "geo_multi_line" + geo_type = "MultiLineString" + + +class GeoMultiPoint(GeoField): + """Field for POSTGIS geometry MultiPoint type""" + + type = "geo_multi_point" + geo_type = "MultiPoint" + + +class GeoMultiPolygon(GeoField): + """Field for POSTGIS geometry MultiPolygon type""" + + type = "geo_multi_polygon" + geo_type = "MultiPolygon" + + +fields.GeoLine = GeoLine +fields.GeoPoint = GeoPoint +fields.GeoPolygon = GeoPolygon +fields.GeoMultiLine = GeoMultiLine +fields.GeoMultiPoint = GeoMultiPoint +fields.GeoMultiPolygon = GeoMultiPolygon diff --git a/base_geoengine/geo_convertion_helper.py b/base_geoengine/geo_convertion_helper.py new file mode 100644 index 000000000..f1d8de753 --- /dev/null +++ b/base_geoengine/geo_convertion_helper.py @@ -0,0 +1,48 @@ +# Copyright 2011-2012 Nicolas Bessi (Camptocamp SA) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +import logging + +from odoo import _ + +logger = logging.getLogger(__name__) + +try: + import geojson + from shapely import wkb, wkt + from shapely.geometry import shape + from shapely.geometry.base import BaseGeometry +except ImportError: + logger = logging.getLogger(__name__) + logger.warning(_("Shapely or geojson are not available in the sys path")) # pylint: disable=prefer-env-translation + + +def value_to_shape(value, use_wkb=False): + """Transforms input into a Shapely object""" + if not value: + return wkt.loads("GEOMETRYCOLLECTION EMPTY") + if isinstance(value, str): + # We try to do this before parsing json exception + # exception are ressource costly + if "{" in value: + geo_dict = geojson.loads(value) + return shape(geo_dict) + elif use_wkb: + return wkb.loads(value, hex=True) + else: + try: + int(value, 16) + return wkb.loads(value, hex=True) + except Exception: + return wkt.loads(value) + elif hasattr(value, "wkt"): + if isinstance(value, BaseGeometry): + return value + else: + return wkt.loads(value.wkt) + else: + raise TypeError( + _( # pylint: disable=prefer-env-translation + "Write/create/search geo type must be wkt/geojson " + "string or must respond to wkt" + ) + ) diff --git a/base_geoengine/geo_db.py b/base_geoengine/geo_db.py new file mode 100644 index 000000000..65221a019 --- /dev/null +++ b/base_geoengine/geo_db.py @@ -0,0 +1,89 @@ +# Copyright 2011-2012 Nicolas Bessi (Camptocamp SA) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +"""Helper to setup Postgis""" + +import logging + +from odoo.exceptions import MissingError +from odoo.tools import sql + +logger = logging.getLogger("geoengine.sql") +_schema = logging.getLogger("odoo.schema") + + +def init_postgis(env): + """Initialize postgis + Add PostGIS support to the database. PostGIS is a spatial database + extender for PostgreSQL object-relational database. It adds support for + geographic objects allowing location queries to be run in SQL. + """ + cr = env.cr + cr.execute( + """ + SELECT + tablename + FROM + pg_tables + WHERE + tablename='spatial_ref_sys'; + """ + ) + check = cr.fetchone() + if check: + return {} + try: + cr.execute( + """ + CREATE EXTENSION postgis; + CREATE EXTENSION postgis_topology; + """ + ) + except Exception as exc: + raise MissingError( + env._( + "Error, can not automatically initialize spatial postgis" + " support. Database user may have to be superuser and" + " postgres/postgis extensions with their devel header have" + " to be installed. If you do not want Odoo to connect with a" + " super user you can manually prepare your database. To do" + " this, open a client to your database using a super user and" + " run:\n" + "CREATE EXTENSION postgis;\n" + "CREATE EXTENSION postgis_topology;\n" + ) + ) from exc + + +def create_geo_column(cr, tablename, columnname, geotype, srid, dim, comment=None): + """Create a geometry column with the given type. + + :params: srid: geometry's projection srid + :params: dim: geometry's dimension (2D or 3D) + """ + cr.execute( + "SELECT AddGeometryColumn( %s, %s, %s, %s, %s)", + (tablename, columnname, srid, geotype, dim), + ) + if comment: + # pylint: disable=E8103 + cr.execute( + f'COMMENT ON COLUMN "{tablename}"."{columnname}" IS %s', + (comment,), + ) + _schema.debug( + "Table %r: added geometry column %r of type %s", tablename, columnname, geotype + ) + + +def _postgis_index_name(table, col_name): + return f"{table}_{col_name}_gist_index" + + +def create_geo_index(cr, columnname, tablename): + """Create the given index unless it exists.""" + indexname = _postgis_index_name(tablename, columnname) + if sql.index_exists(cr, indexname): + return + # pylint: disable=E8103 + cr.execute(f"CREATE INDEX {indexname} ON {tablename} USING GIST ( {columnname} )") + _schema.debug("Table %r: created index %r", tablename, indexname) diff --git a/base_geoengine/geo_operators.py b/base_geoengine/geo_operators.py new file mode 100644 index 000000000..8be01f44e --- /dev/null +++ b/base_geoengine/geo_operators.py @@ -0,0 +1,75 @@ +# Copyright 2011-2012 Nicolas Bessi (Camptocamp SA) +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + + +class GeoOperator: + def __init__(self, geo_field): + self.geo_field = geo_field + + def _get_direct_como_op_sql(self, table, col, value, params, op=""): + """provide raw sql for geater and lesser operators""" + if isinstance(value, int | float): + return f" ST_Area({table}.{col}) {op} {value}" + else: + base = self.geo_field.entry_to_shape(value, same_type=False) + params.append(base.wkt) + return f" ST_Area({table}.{col}) {op} ST_Area(ST_GeomFromText(%s))" + + def _get_postgis_comp_sql(self, table, col, value, params, op=""): + """return raw sql for all search based on St_**(a, b) posgis operator""" + base = self.geo_field.entry_to_shape(value, same_type=False) + srid = self.geo_field.srid + params.append(base.wkt) + params.append(srid) + return f"{op}({table}.{col}, ST_GeomFromText(%s, %s))" + + def get_geo_greater_sql(self, table, col, value, params): + """Returns raw sql for geo_greater operator + (used for area comparison) + """ + return self._get_direct_como_op_sql(table, col, value, params, op=">") + + def get_geo_lesser_sql(self, table, col, value, params): + """Returns raw sql for geo_lesser operator + (used for area comparison)""" + return self._get_direct_como_op_sql(table, col, value, params, op="<") + + def get_geo_equal_sql( + self, + table, + col, + value, + params, + ): + """Returns raw sql for geo_equal operator + (used for equality comparison) + """ + base = self.geo_field.entry_to_shape(value, same_type=False) + compare_to = "ST_GeomFromText(%s)" + params.append(base.wkt) + return f" {table}.{col} = {compare_to}" + + def get_geo_intersect_sql(self, table, col, value, params): + """Returns raw sql for geo_intersec operator + (used for spatial comparison) + """ + return self._get_postgis_comp_sql(table, col, value, params, op="ST_Intersects") + + def get_geo_touch_sql(self, table, col, value, params): + """Returns raw sql for geo_touch operator + (used for spatial comparison) + """ + return self._get_postgis_comp_sql(table, col, value, params, op="ST_Touches") + + def get_geo_within_sql(self, table, col, value, params): + """Returns raw sql for geo_within operator + (used for spatial comparison) + """ + return self._get_postgis_comp_sql(table, col, value, params, op="ST_Within") + + def get_geo_contains_sql(self, table, col, value, params): + """Returns raw sql for geo_contains operator + (used for spatial comparison) + """ + return self._get_postgis_comp_sql(table, col, value, params, op="ST_Contains") diff --git a/base_geoengine/i18n/base_geoengine.pot b/base_geoengine/i18n/base_geoengine.pot new file mode 100644 index 000000000..35bcde7b3 --- /dev/null +++ b/base_geoengine/i18n/base_geoengine.pot @@ -0,0 +1,946 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * base_geoengine +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/base.py:0 +msgid "%s column does not exists or is not a geo field" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__active_on_startup +msgid "Active On Startup" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_field_input_with_tags/domain_selector_field_input_with_tags.xml:0 +msgid "Add new value" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_field_input_with_tags/domain_selector_field_input_with_tags.xml:0 +msgid "Add tag" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__attribute_field_id +msgid "Attribute field" +msgstr "" + +#. module: base_geoengine +#: model:ir.model,name:base_geoengine.model_base +msgid "Base" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__geo_repr__basic +msgid "Basic" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__begin_color +msgid "Begin color class" +msgstr "" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_geoengine_view_form +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "Classification" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__classification +msgid "Classification mode" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__type +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__code +msgid "Code" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__geo_repr__colored +msgid "Colored range/Chroma.js" +msgstr "" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_geoengine_view_form +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "Colors" +msgstr "" + +#. module: base_geoengine +#: model:ir.ui.menu,name:base_geoengine.geoengine_base_view_menu +msgid "Configuration" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_model_fields__gist_index +msgid "Create gist index" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__create_uid +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__create_uid +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__create_uid +msgid "Created by" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__create_date +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__create_date +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__create_date +msgid "Created on" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__classification__custom +msgid "Custom" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__default_extent +msgid "Default map extent" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__default_zoom +msgid "Default map zoom" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__params +msgid "Dictiorary of values for dimensions as JSON" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__dimensions +msgid "Dimensions" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_controller/geoengine_controller.xml:0 +msgid "Discard" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__display_polygon_labels +msgid "Display Labels on Polygon" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__display_name +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__display_name +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__display_name +msgid "Display Name" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_raster_layer__raster_type__d_wms +msgid "Distant WMS" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.esm.js:0 +msgid "Domain editing" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.esm.js:0 +msgid "Editing Raster Layer" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.esm.js:0 +msgid "Editing vector layer" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__end_color +msgid "End color class" +msgstr "" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/geo_db.py:0 +msgid "" +"Error, can not automatically initialize spatial postgis support. Database user may have to be superuser and postgres/postgis extensions with their devel header have to be installed. If you do not want Odoo to connect with a super user you can manually prepare your database. To do this, open a client to your database using a super user and run:\n" +"CREATE EXTENSION postgis;\n" +"CREATE EXTENSION postgis_topology;\n" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_model_fields__ttype +msgid "Field Type" +msgstr "" + +#. module: base_geoengine +#: model:ir.model,name:base_geoengine.model_ir_model_fields +msgid "Fields" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__format_suffix +msgid "Format" +msgstr "" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_geoengine_view_form +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "General" +msgstr "" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/fields.py:0 +msgid "" +"Geo Value %(geom_type)s must be of the same type %(geo_type)s" +" as fields" +msgstr "" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/fields.py:0 +msgid "" +"Geo dimention modification is not implemented. We can not change dimention " +"%(data)s to %(dim)s" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__geo_field_id +msgid "Geo field" +msgstr "" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/fields.py:0 +msgid "" +"Geo type modification is not implemented. We can not change type %(data)s to" +" %(geo_type)s" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_ui_view__type__geoengine +msgid "GeoEngine" +msgstr "" + +#. module: base_geoengine +#: model:ir.ui.menu,name:base_geoengine.geoengine_base_menu +msgid "GeoEngine Backend" +msgstr "" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geoengine_view_form +msgid "GeoEngine Data" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_view.esm.js:0 +msgid "Geoengine" +msgstr "" + +#. module: base_geoengine +#: model:res.groups,name:base_geoengine.group_geoengine_admin +msgid "Geoengine Admin" +msgstr "" + +#. module: base_geoengine +#: model:res.groups,name:base_geoengine.group_geoengine_user +msgid "Geoengine User" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__has_type +msgid "Has Type" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__id +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__id +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__id +msgid "ID" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__classification__interval +msgid "Interval" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__is_wms +msgid "Is Wms" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__is_wmts +msgid "Is Wmts" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__overlay +msgid "Is overlay layer?" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__write_uid +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__write_uid +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__write_date +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__write_date +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__write_date +msgid "Last Updated on" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__type_id +msgid "Layer" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__name +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__name +msgid "Layer Name" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__layer_opacity +msgid "Layer Opacity" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__sequence +msgid "Layer Priority" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__layer_transparent +msgid "Layer Transparent" +msgstr "" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "Layer data" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__readonly +msgid "Layer is read only" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__sequence +msgid "Layer priority" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_vector_layer__active_on_startup +msgid "Layer will be shown on startup if checked." +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.xml:0 +msgid "Layers (" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__linestring +msgid "LineString" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__dimensions +msgid "List of dimensions separated by ','" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__matrix_set +msgid "Matrix set" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__max_extent +msgid "Max extent" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_arch_parser.esm.js:0 +msgid "Missing ${INFO_BOX_ATTRIBUTE} template." +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__model_name +msgid "Model" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__model_domain +msgid "Model Domain" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__model_id +msgid "Model to use" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__model_view_id +msgid "Model view" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__multilinestring +msgid "MultiLineString" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__multipoint +msgid "MultiPoint" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__multipolygon +msgid "MultiPolygon" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__name +msgid "Name" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__params_wms +msgid "Need to provide at least a LAYERS param" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_controller/geoengine_controller.esm.js:0 +msgid "New record" +msgstr "" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/base.py:0 +msgid "" +"No GeoEngine view defined for the model %s. Please " +"create a view or modify view mode" +msgstr "" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/base.py:0 +msgid "No raster layer for view %s" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__nb_class +msgid "Number of class" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_renderer/geoengine_renderer.xml:0 +msgid "OPEN" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_raster_layer__raster_type__odoo +msgid "Odoo field" +msgstr "" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "Odoo layer data (Not implemented)" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__field_id +msgid "Odoo layer field to use" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__opacity +msgid "Opacity" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_raster_layer__raster_type__osm +msgid "OpenStreetMap" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__params +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "Params" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__params_wms +msgid "Params Wms" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__point +msgid "Point" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__polygon +msgid "Polygon" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_model_fields__dim +msgid "PostGIs Dimension" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_model_fields__geo_type +msgid "PostGIs type" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__projection +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__projection +msgid "Projection" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__geo_repr__proportion +msgid "Proportional Symbol" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__classification__quantile +msgid "Quantile" +msgstr "" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geoengine_view_form +msgid "Raster (Background layers)" +msgstr "" + +#. module: base_geoengine +#: model:ir.actions.act_window,name:base_geoengine.geo_engine_form_view_raster_action +#: model:ir.actions.act_window,name:base_geoengine.geo_engine_view_rater_action +#: model:ir.model,name:base_geoengine.model_geoengine_raster_layer +msgid "Raster Layer" +msgstr "" + +#. module: base_geoengine +#: model:ir.ui.menu,name:base_geoengine.geoengine_raster_layer_menu +msgid "Raster Layer Management" +msgstr "" + +#. module: base_geoengine +#: model:ir.model,name:base_geoengine.model_geoengine_raster_layer_type +msgid "Raster Layer Type" +msgstr "" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "Raster Layer View" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__raster_type +msgid "Raster layer type" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__raster_layer_ids +msgid "Raster layers" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.xml:0 +msgid "Rasters" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/records_panel/records_panel.xml:0 +msgid "Records (" +msgstr "" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "Related Model" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__view_id +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__view_id +msgid "Related View" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_field_input_with_tags/domain_selector_field_input_with_tags.xml:0 +msgid "Remove tag" +msgstr "" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_geoengine_view_form +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "Representation" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__geo_repr +msgid "Representation mode" +msgstr "" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/fields.py:0 +msgid "" +"Reprojection of column is not implemented. We can not change srid %(srid)s " +"to %(data)s" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__request_encoding +msgid "Request encoding" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__resolutions +msgid "Resolutions" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__restricted_extent +msgid "Restricted map extent" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_controller/geoengine_controller.xml:0 +msgid "Save" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/records_panel/search_bar_records/search_bar_records.xml:0 +msgid "Search..." +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__server_type +msgid "Server Type" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__service +msgid "Service" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__url +msgid "Service URL" +msgstr "" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/geo_convertion_helper.py:0 +msgid "Shapely or geojson are not available in the sys path" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field_input/domain_selector_geo_field_input.esm.js:0 +msgid "Subdomain" +msgstr "" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/geo_vector_layer.py:0 +msgid "The geo_field_id must be a field in %s model" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__server_type +msgid "" +"The type of the remote WMS server: mapserver, geoserver, " +"carmentaserver, or qgis" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__classification__unique +msgid "Unique value" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__units +msgid "Units" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__use_to_edit +msgid "Use to edit" +msgstr "" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "Vector" +msgstr "" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geoengine_view_form +msgid "Vector (Active layers)" +msgstr "" + +#. module: base_geoengine +#: model:ir.actions.act_window,name:base_geoengine.geo_engine_view_raster_action +#: model:ir.actions.act_window,name:base_geoengine.geo_vector_geoengine_view_action +#: model:ir.model,name:base_geoengine.model_geoengine_vector_layer +msgid "Vector Layer" +msgstr "" + +#. module: base_geoengine +#: model:ir.ui.menu,name:base_geoengine.geoengine_vector_layer_menu +msgid "Vector Layer Management" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__vector_layer_ids +msgid "Vector layers" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.xml:0 +msgid "Vectors" +msgstr "" + +#. module: base_geoengine +#: model:ir.model,name:base_geoengine.model_ir_ui_view +msgid "View" +msgstr "" + +#. module: base_geoengine +#: model:ir.ui.menu,name:base_geoengine.geoengine_view_menu +msgid "View Management" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__type +msgid "View Type" +msgstr "" + +#. module: base_geoengine +#: model:ir.actions.act_window,name:base_geoengine.geo_engine_view_action +msgid "Views" +msgstr "" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "WMS options" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_raster_layer__raster_type__wmts +msgid "WMTS" +msgstr "" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "WMTS options" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_controller/geoengine_controller.esm.js:0 +msgid "Warning" +msgstr "" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/geo_convertion_helper.py:0 +msgid "" +"Write/create/search geo type must be wkt/geojson string or must respond to " +"wkt" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_controller/geoengine_controller.esm.js:0 +msgid "" +"You are about to create a new record without having displayed all the " +"others. A risk of overlap could occur. Would you like to continue ?" +msgstr "" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/base.py:0 +msgid "You must at least provide one of domain or geo_domain" +msgstr "" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/geo_vector_layer.py:0 +msgid "You need to provide an attribute that exists in %s model" +msgstr "" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/geo_vector_layer.py:0 +msgid "You need to select a numeric field" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__projection +msgid "eg. EPSG:21781" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__request_encoding +msgid "eg. REST" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__units +msgid "eg. m" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__format_suffix +msgid "eg. png" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +msgid "geo_contains" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +msgid "geo_equal" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +msgid "geo_greater" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +msgid "geo_intersect" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +msgid "geo_lesser" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_line +msgid "geo_line" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_multi_line +msgid "geo_multi_line" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_multi_point +msgid "geo_multi_point" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_multi_polygon +msgid "geo_multi_polygon" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_point +msgid "geo_point" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_polygon +msgid "geo_polygon" +msgstr "" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/base.py:0 +msgid "geo_search is deprecated: uses search method defined on base model" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +msgid "geo_touch" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +msgid "geo_within" +msgstr "" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/fields.py:0 +msgid "" +"geometry_columns table seems to be corrupted. SRID check is not possible" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_vector_layer__begin_color +#: model:ir.model.fields,help:base_geoengine.field_geoengine_vector_layer__end_color +msgid "hex value" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_number_field/domain_selector_number_field.esm.js:0 +msgid "in active_ids" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_number_field/domain_selector_number_field.esm.js:0 +msgid "not in active_ids" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_model_fields__srid +msgid "srid" +msgstr "" diff --git a/base_geoengine/i18n/es.po b/base_geoengine/i18n/es.po new file mode 100644 index 000000000..9c09f6137 --- /dev/null +++ b/base_geoengine/i18n/es.po @@ -0,0 +1,1044 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * base_geoengine +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-08-08 11:10+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/base.py:0 +#, python-format +msgid "%s column does not exists or is not a geo field" +msgstr "La columna %s no existe o no es un campo geográfico" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__active_on_startup +msgid "Active On Startup" +msgstr "Activo en el arranque" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_field_input_with_tags/domain_selector_field_input_with_tags.xml:0 +#, python-format +msgid "Add new value" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_field_input_with_tags/domain_selector_field_input_with_tags.xml:0 +#, python-format +msgid "Add tag" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__attribute_field_id +msgid "Attribute field" +msgstr "Campo de atributo" + +#. module: base_geoengine +#: model:ir.model,name:base_geoengine.model_base +msgid "Base" +msgstr "Base/Fuente" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__geo_repr__basic +msgid "Basic" +msgstr "Básico" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__begin_color +msgid "Begin color class" +msgstr "Iniciar clase de color" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_geoengine_view_form +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "Classification" +msgstr "Clasificación" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__classification +msgid "Classification mode" +msgstr "Modo de clasificación" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__type +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__code +msgid "Code" +msgstr "Código" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__geo_repr__colored +msgid "Colored range/Chroma.js" +msgstr "Gama de colores/Chroma.js" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_geoengine_view_form +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "Colors" +msgstr "Colores" + +#. module: base_geoengine +#: model:ir.ui.menu,name:base_geoengine.geoengine_base_view_menu +msgid "Configuration" +msgstr "Configuración" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_model_fields__gist_index +msgid "Create gist index" +msgstr "Crear un índice gist" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__create_uid +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__create_uid +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__create_uid +msgid "Created by" +msgstr "Creado por" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__create_date +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__create_date +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__create_date +msgid "Created on" +msgstr "Creado el" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__classification__custom +msgid "Custom" +msgstr "Personalizar" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__default_extent +msgid "Default map extent" +msgstr "Extensión predeterminada del mapa" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__default_zoom +msgid "Default map zoom" +msgstr "Zoom predeterminado del mapa" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__params +msgid "Dictiorary of values for dimensions as JSON" +msgstr "Diccionario de valores de las dimensiones en formato JSON" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__dimensions +msgid "Dimensions" +msgstr "Dimensiones" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_controller/geoengine_controller.xml:0 +#, python-format +msgid "Discard" +msgstr "Descartar" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__display_polygon_labels +msgid "Display Labels on Polygon" +msgstr "Mostrar etiquetas en el polígono" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__display_name +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__display_name +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__display_name +msgid "Display Name" +msgstr "Mostrar Nombre" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_raster_layer__raster_type__d_wms +msgid "Distant WMS" +msgstr "Sistema de gestión de almacenes (SGA) a distancia" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.esm.js:0 +#, python-format +msgid "Domain editing" +msgstr "Editando Dominio" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.esm.js:0 +#, python-format +msgid "Editing Raster Layer" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.esm.js:0 +#, python-format +msgid "Editing vector layer" +msgstr "Edición de capas vectoriales" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__end_color +msgid "End color class" +msgstr "Fin de la clase de color" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/geo_db.py:0 +#, python-format +msgid "" +"Error, can not automatically initialize spatial postgis support. Database " +"user may have to be superuser and postgres/postgis extensions with their " +"devel header have to be installed. If you do not want Odoo to connect with a " +"super user you can manually prepare your database. To do this, open a client " +"to your database using a super user and run:\n" +"CREATE EXTENSION postgis;\n" +"CREATE EXTENSION postgis_topology;\n" +msgstr "" +"Error, no se puede inicializar automáticamente el soporte espacial postgis. " +"El usuario de la base de datos debe ser superusuario y las extensiones " +"postgres/postgis con su cabecera devel deben estar instaladas. Si no quieres " +"que Odoo se conecte con un superusuario puedes preparar manualmente tu base " +"de datos. Para hacer esto, abre un cliente a tu base de datos usando un " +"superusuario y ejecuta\n" +"CREAR EXTENSIÓN postgis;\n" +"CREAR EXTENSIÓN postgis_topología;\n" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_model_fields__ttype +msgid "Field Type" +msgstr "Tipo de campo" + +#. module: base_geoengine +#: model:ir.model,name:base_geoengine.model_ir_model_fields +msgid "Fields" +msgstr "Campos" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__format_suffix +msgid "Format" +msgstr "Formato" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_geoengine_view_form +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "General" +msgstr "General" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/fields.py:0 +#, python-format +msgid "" +"Geo Value %(geom_type)s must be of the same type " +"%(geo_type)s as fields" +msgstr "" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/fields.py:0 +#, python-format +msgid "" +"Geo dimention modification is not implemented. We can not change dimention " +"%(data)s to %(dim)s" +msgstr "" +"La modificación de la dimensión geográfica no está implementada. No podemos " +"cambiar la dimensión %(data)s a %(dim)s" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__geo_field_id +msgid "Geo field" +msgstr "Campo geográfico" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/fields.py:0 +#, python-format +msgid "" +"Geo type modification is not implemented. We can not change type %(data)s to " +"%(geo_type)s" +msgstr "" +"La modificación del geotipo no está implementada. No podemos cambiar el tipo " +"%(data)s a %(geo_type)s" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_ui_view__type__geoengine +msgid "GeoEngine" +msgstr "GeoIngeniería" + +#. module: base_geoengine +#: model:ir.ui.menu,name:base_geoengine.geoengine_base_menu +msgid "GeoEngine Backend" +msgstr "Servidor de Geoingeniería" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geoengine_view_form +msgid "GeoEngine Data" +msgstr "Fecha de Geoingeniería" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_view.esm.js:0 +#, python-format +msgid "Geoengine" +msgstr "Geoingeniería" + +#. module: base_geoengine +#: model:res.groups,name:base_geoengine.group_geoengine_admin +msgid "Geoengine Admin" +msgstr "Administración de Geoingeniería" + +#. module: base_geoengine +#: model:res.groups,name:base_geoengine.group_geoengine_user +msgid "Geoengine User" +msgstr "Usuario de Geoingeniería" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__has_type +msgid "Has Type" +msgstr "Tiene Tipo" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__id +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__id +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__id +msgid "ID" +msgstr "ID (identificación)" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__classification__interval +msgid "Interval" +msgstr "Intervalo" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__is_wms +msgid "Is Wms" +msgstr "Es Wms" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__is_wmts +msgid "Is Wmts" +msgstr "Es Wmts" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__overlay +msgid "Is overlay layer?" +msgstr "¿Es una capa de superposición?" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__write_uid +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__write_uid +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__write_uid +msgid "Last Updated by" +msgstr "Última actualización por" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__write_date +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__write_date +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__write_date +msgid "Last Updated on" +msgstr "Última Actualización el" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__type_id +msgid "Layer" +msgstr "Capa" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__name +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__name +msgid "Layer Name" +msgstr "nombre de Capa" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__layer_opacity +msgid "Layer Opacity" +msgstr "Opacidad de la capa" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__sequence +msgid "Layer Priority" +msgstr "Prioridad de Capa" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__layer_transparent +msgid "Layer Transparent" +msgstr "" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "Layer data" +msgstr "Fecha de Capa" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__readonly +msgid "Layer is read only" +msgstr "La capa es de sólo lectura" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__sequence +msgid "Layer priority" +msgstr "Prioridad de Capa" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_vector_layer__active_on_startup +msgid "Layer will be shown on startup if checked." +msgstr "La capa se mostrará al inicio si está marcada." + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.xml:0 +#, python-format +msgid "Layers (" +msgstr "Capas (" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__linestring +msgid "LineString" +msgstr "Secuencia de líneas" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__dimensions +msgid "List of dimensions separated by ','" +msgstr "Lista de dimensiones separadas por ','" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__matrix_set +msgid "Matrix set" +msgstr "Conjunto matriz" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__max_extent +msgid "Max extent" +msgstr "Extensión máxima" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_arch_parser.esm.js:0 +#, python-format +msgid "Missing ${INFO_BOX_ATTRIBUTE} template." +msgstr "Falta la plantilla ${INFO_BOX_ATTRIBUTE}." + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__model_name +msgid "Model" +msgstr "Modelo" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__model_domain +msgid "Model Domain" +msgstr "Dominio del modelo" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__model_id +msgid "Model to use" +msgstr "Modelo a utilizar" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__model_view_id +msgid "Model view" +msgstr "Vista del modelo" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__multilinestring +msgid "MultiLineString" +msgstr "Cadena multilínea" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__multipoint +msgid "MultiPoint" +msgstr "Punto Múltiple" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__multipolygon +msgid "MultiPolygon" +msgstr "Multipolígono" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__name +msgid "Name" +msgstr "Nombre" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__params_wms +msgid "Need to provide at least a LAYERS param" +msgstr "Necesidad de proporcionar al menos un parámetro de CAPAS" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_controller/geoengine_controller.esm.js:0 +#, python-format +msgid "New record" +msgstr "Nuevo récord" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/base.py:0 +#, python-format +msgid "" +"No GeoEngine view defined for the model %s. Please " +"create a view or modify view mode" +msgstr "" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/base.py:0 +#, python-format +msgid "No raster layer for view %s" +msgstr "No hay capa ráster para la vista %s" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__nb_class +msgid "Number of class" +msgstr "Número de clase" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_renderer/geoengine_renderer.xml:0 +#, python-format +msgid "OPEN" +msgstr "ABRIR" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_raster_layer__raster_type__odoo +msgid "Odoo field" +msgstr "Campo de odoo" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "Odoo layer data (Not implemented)" +msgstr "Datos de la capa Odoo (No implementado)" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__field_id +msgid "Odoo layer field to use" +msgstr "Campo de capa de Odoo a utilizar" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__opacity +msgid "Opacity" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_raster_layer__raster_type__osm +msgid "OpenStreetMap" +msgstr "OpenStreetMap" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__params +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "Params" +msgstr "Parámetros" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__params_wms +msgid "Params Wms" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__point +msgid "Point" +msgstr "Punto" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__polygon +msgid "Polygon" +msgstr "Polígono" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_model_fields__dim +msgid "PostGIs Dimension" +msgstr "Dimensión PostGIs" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_model_fields__geo_type +msgid "PostGIs type" +msgstr "Tipo PostGIs" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__projection +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__projection +msgid "Projection" +msgstr "Proyección" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__geo_repr__proportion +msgid "Proportional Symbol" +msgstr "Símbolo proporcional" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__classification__quantile +msgid "Quantile" +msgstr "Cuantil" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geoengine_view_form +msgid "Raster (Background layers)" +msgstr "Ráster (capas de fondo)" + +#. module: base_geoengine +#: model:ir.actions.act_window,name:base_geoengine.geo_engine_form_view_raster_action +#: model:ir.actions.act_window,name:base_geoengine.geo_engine_view_rater_action +#: model:ir.model,name:base_geoengine.model_geoengine_raster_layer +msgid "Raster Layer" +msgstr "Capa Ráster" + +#. module: base_geoengine +#: model:ir.ui.menu,name:base_geoengine.geoengine_raster_layer_menu +msgid "Raster Layer Management" +msgstr "Gestión de capas rasterizadas" + +#. module: base_geoengine +#: model:ir.model,name:base_geoengine.model_geoengine_raster_layer_type +msgid "Raster Layer Type" +msgstr "Tipo de capa rasterizada" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "Raster Layer View" +msgstr "Vista de capa rasterizada" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__raster_type +msgid "Raster layer type" +msgstr "Tipo de capa rasterizada" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__raster_layer_ids +msgid "Raster layers" +msgstr "Capas Ráster" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.xml:0 +#, python-format +msgid "Rasters" +msgstr "Rásteres" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/records_panel/records_panel.xml:0 +#, python-format +msgid "Records (" +msgstr "Registros (" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "Related Model" +msgstr "Modelo relacionado" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__view_id +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__view_id +msgid "Related View" +msgstr "Vista relacionada" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_field_input_with_tags/domain_selector_field_input_with_tags.xml:0 +#, python-format +msgid "Remove tag" +msgstr "" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_geoengine_view_form +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "Representation" +msgstr "Representación" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__geo_repr +msgid "Representation mode" +msgstr "Modo de representación" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/fields.py:0 +#, python-format +msgid "" +"Reprojection of column is not implemented. We can not change srid %(srid)s " +"to %(data)s" +msgstr "" +"La reproyección de columna no está implementada. No podemos cambiar srid " +"%(srid)s por %(data)s" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__request_encoding +msgid "Request encoding" +msgstr "Solicitar codificación" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__resolutions +msgid "Resolutions" +msgstr "Resoluciones" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__restricted_extent +msgid "Restricted map extent" +msgstr "Extensión de mapa restringida" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_controller/geoengine_controller.xml:0 +#, python-format +msgid "Save" +msgstr "Guardar" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/records_panel/search_bar_records/search_bar_records.xml:0 +#, python-format +msgid "Search..." +msgstr "Buscar..." + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__server_type +msgid "Server Type" +msgstr "Tipo de servidor" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__service +msgid "Service" +msgstr "Servicio" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__url +msgid "Service URL" +msgstr "URL de servicio" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/geo_convertion_helper.py:0 +#, python-format +msgid "Shapely or geojson are not available in the sys path" +msgstr "Shapely o geojson no están disponibles en la ruta del sistema" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field_input/domain_selector_geo_field_input.esm.js:0 +#, python-format +msgid "Subdomain" +msgstr "Subdominio" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/geo_vector_layer.py:0 +#, python-format +msgid "The geo_field_id must be a field in %s model" +msgstr "El geo_field_id debe ser un campo del modelo %s" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__server_type +msgid "" +"The type of the remote WMS server: mapserver, geoserver, " +"carmentaserver, or qgis" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__classification__unique +msgid "Unique value" +msgstr "Valor único" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__units +msgid "Units" +msgstr "Unidades" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__use_to_edit +msgid "Use to edit" +msgstr "Utilizar para editar" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "Vector" +msgstr "Vector" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geoengine_view_form +msgid "Vector (Active layers)" +msgstr "Vector (capas activas)" + +#. module: base_geoengine +#: model:ir.actions.act_window,name:base_geoengine.geo_engine_view_raster_action +#: model:ir.actions.act_window,name:base_geoengine.geo_vector_geoengine_view_action +#: model:ir.model,name:base_geoengine.model_geoengine_vector_layer +msgid "Vector Layer" +msgstr "Capa vectorial" + +#. module: base_geoengine +#: model:ir.ui.menu,name:base_geoengine.geoengine_vector_layer_menu +msgid "Vector Layer Management" +msgstr "Gestión de capas vectoriales" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__vector_layer_ids +msgid "Vector layers" +msgstr "Capas vectoriales" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.xml:0 +#, python-format +msgid "Vectors" +msgstr "Vectores" + +#. module: base_geoengine +#: model:ir.model,name:base_geoengine.model_ir_ui_view +msgid "View" +msgstr "Vista" + +#. module: base_geoengine +#: model:ir.ui.menu,name:base_geoengine.geoengine_view_menu +msgid "View Management" +msgstr "Gestión de visualización" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__type +msgid "View Type" +msgstr "Tipo de vista" + +#. module: base_geoengine +#: model:ir.actions.act_window,name:base_geoengine.geo_engine_view_action +msgid "Views" +msgstr "Vistas" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "WMS options" +msgstr "Opciones WMS" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_raster_layer__raster_type__wmts +msgid "WMTS" +msgstr "WMTS" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "WMTS options" +msgstr "Opciones WMTS" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_controller/geoengine_controller.esm.js:0 +#, python-format +msgid "Warning" +msgstr "Aviso" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/geo_convertion_helper.py:0 +#, python-format +msgid "" +"Write/create/search geo type must be wkt/geojson string or must respond to " +"wkt" +msgstr "" +"Write/create/search geo type debe ser wkt/geojson string o debe responder a " +"wkt" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_controller/geoengine_controller.esm.js:0 +#, python-format +msgid "" +"You are about to create a new record without having displayed all the " +"others. A risk of overlap could occur. Would you like to continue ?" +msgstr "" +"Está a punto de crear un nuevo registro sin haber visualizado todos los " +"demás. Podría producirse un riesgo de solapamiento. ¿Desea continuar?" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/base.py:0 +#, python-format +msgid "You must at least provide one of domain or geo_domain" +msgstr "Debe proporcionar al menos uno de los dominios o geo_domain" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/geo_vector_layer.py:0 +#, python-format +msgid "You need to provide an attribute that exists in %s model" +msgstr "Necesita proporcionar un atributo que existe en el modelo %s" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/geo_vector_layer.py:0 +#, python-format +msgid "You need to select a numeric field" +msgstr "Debe seleccionar un campo numérico" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__projection +msgid "eg. EPSG:21781" +msgstr "ej. EPSG:21781" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__request_encoding +msgid "eg. REST" +msgstr "ej. REST" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__units +msgid "eg. m" +msgstr "ej. m" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__format_suffix +msgid "eg. png" +msgstr "ej. png" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_contains" +msgstr "geo_contains (geo_contenedores)" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_equal" +msgstr "geo_equal (geo_igual)" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_greater" +msgstr "geo_greater (geo_mayor)" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_intersect" +msgstr "geo_intersect (geo_intersección)" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_lesser" +msgstr "geo_lesser (geo_menor)" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_line +msgid "geo_line" +msgstr "geo_line (geo_línea)" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_multi_line +msgid "geo_multi_line" +msgstr "geo_multi_line (geo_multi_línea)" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_multi_point +msgid "geo_multi_point" +msgstr "geo_multi_point (geo_multi_punto)" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_multi_polygon +msgid "geo_multi_polygon" +msgstr "geo_multi_polygon (geo_multi_polígono)" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_point +msgid "geo_point" +msgstr "geo_point (geo_punto)" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_polygon +msgid "geo_polygon" +msgstr "geo_polygon (geo_polígono)" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/base.py:0 +#, python-format +msgid "geo_search is deprecated: uses search method defined on base model" +msgstr "" +"geo_search está obsoleto: utiliza el método de búsqueda definido en el " +"modelo base" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_touch" +msgstr "geo_touch (geo_táctil)" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_within" +msgstr "geo_within (geo_interior)" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/fields.py:0 +#, python-format +msgid "" +"geometry_columns table seems to be corrupted. SRID check is not possible" +msgstr "" +"La tabla geometry_columns parece estar dañada. No es posible comprobar el " +"SRID" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_vector_layer__begin_color +#: model:ir.model.fields,help:base_geoengine.field_geoengine_vector_layer__end_color +msgid "hex value" +msgstr "valor hexadecimal" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_number_field/domain_selector_number_field.esm.js:0 +#, python-format +msgid "in active_ids" +msgstr "En active_ids" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_number_field/domain_selector_number_field.esm.js:0 +#, python-format +msgid "not in active_ids" +msgstr "No en active_ids" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_model_fields__srid +msgid "srid" +msgstr "srid" + +#, python-format +#~ msgid "" +#~ "Geo Value %(geom_type)s must be of the same type %(geo_type)s as fields" +#~ msgstr "" +#~ "Los valores geográficos %(geom_type)s deben ser del mismo tipo " +#~ "%(geo_type)s que los campos" + +#~ msgid "Last Modified on" +#~ msgstr "Última Modificación el" + +#, python-format +#~ msgid "No GeoEngine view defined for the model %s" +#~ msgstr "No se definió una vista de GeoIngeniería para el modelo %s" + +#, python-format +#~ msgid "Please create a view or modify view mode" +#~ msgstr "Por favor, cree una vista o modifique el modo de vista" + +#~ msgid "" +#~ "The type of the remote WMS server: mapserver, geoserver, carmentaserver, " +#~ "or qgis" +#~ msgstr "" +#~ "Tipo de servidor WMS remoto: mapserver, geoserver, carmentaserver o qgis" diff --git a/base_geoengine/i18n/fr_BE.po b/base_geoengine/i18n/fr_BE.po new file mode 100644 index 000000000..34ca132cd --- /dev/null +++ b/base_geoengine/i18n/fr_BE.po @@ -0,0 +1,1046 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * base_geoengine +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-05-15 06:18+0000\n" +"PO-Revision-Date: 2023-05-15 06:18+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/base.py:0 +#, python-format +msgid "%s column does not exists or is not a geo field" +msgstr "%s la colonne n'existe pas ou n'est pas un champ géographique" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__active_on_startup +msgid "Active On Startup" +msgstr "Actif au démarrage" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_field_input_with_tags/domain_selector_field_input_with_tags.xml:0 +#, python-format +msgid "Add new value" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_field_input_with_tags/domain_selector_field_input_with_tags.xml:0 +#, python-format +msgid "Add tag" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__attribute_field_id +msgid "Attribute field" +msgstr "Attribut" + +#. module: base_geoengine +#: model:ir.model,name:base_geoengine.model_base +msgid "Base" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__geo_repr__basic +msgid "Basic" +msgstr "Basique" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__begin_color +msgid "Begin color class" +msgstr "Début de la classe de couleur" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_geoengine_view_form +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "Classification" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__classification +msgid "Classification mode" +msgstr "Mode de classification" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__type +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__code +msgid "Code" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__geo_repr__colored +msgid "Colored range/Chroma.js" +msgstr "Plage de couleurs/Chroma.js" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_geoengine_view_form +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "Colors" +msgstr "Couleurs" + +#. module: base_geoengine +#: model:ir.ui.menu,name:base_geoengine.geoengine_base_view_menu +msgid "Configuration" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_model_fields__gist_index +msgid "Create gist index" +msgstr "Création d'un index gist" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__create_uid +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__create_uid +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__create_uid +msgid "Created by" +msgstr "Créé par" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__create_date +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__create_date +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__create_date +msgid "Created on" +msgstr "Créé le" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__classification__custom +msgid "Custom" +msgstr "Personnalisable" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__default_extent +msgid "Default map extent" +msgstr "Étendue de la carte par défaut" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__default_zoom +msgid "Default map zoom" +msgstr "Zoom par défaut de la carte" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__params +msgid "Dictiorary of values for dimensions as JSON" +msgstr "Liste de valeurs pour les dimensions sous forme de JSON" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__dimensions +msgid "Dimensions" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_controller/geoengine_controller.xml:0 +#, python-format +msgid "Discard" +msgstr "Annuler" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__display_polygon_labels +msgid "Display Labels on Polygon" +msgstr "Afficher les étiquettes sur les polygones" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__display_name +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__display_name +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__display_name +msgid "Display Name" +msgstr "Nom d'affichage" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_raster_layer__raster_type__d_wms +msgid "Distant WMS" +msgstr "WMS distant" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.esm.js:0 +#, python-format +msgid "Domain editing" +msgstr "Édition du domaine" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.esm.js:0 +#, python-format +msgid "Editing Raster Layer" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.esm.js:0 +#, python-format +msgid "Editing vector layer" +msgstr "Edition de la couche vectorielle" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__end_color +msgid "End color class" +msgstr "Fin de la classe de couleur" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/geo_db.py:0 +#, python-format +msgid "" +"Error, can not automatically initialize spatial postgis support. Database " +"user may have to be superuser and postgres/postgis extensions with their " +"devel header have to be installed. If you do not want Odoo to connect with a " +"super user you can manually prepare your database. To do this, open a client " +"to your database using a super user and run:\n" +"CREATE EXTENSION postgis;\n" +"CREATE EXTENSION postgis_topology;\n" +msgstr "" +"Erreur, impossible d'initialiser automatiquement le support spatial postigs. " +"L'utilisateur de la base de données doit être un super utilisateur et les " +"extensions postgres/postgis doivent être installées avec leurs en-tête " +"devel. Si vous ne voulez pas qu'Odoo se connecte avec un super utilisateur, " +"vous pouvez préparer manuellement votre base de données. Pour ce faire, " +"ouvrez un client à votre base de données en utilisant un super utilisateur " +"et exécutez:\n" +"CREATE EXTENSION postgis;\n" +"CREATE EXTENSION postgis_topology;\n" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_model_fields__ttype +msgid "Field Type" +msgstr "Type de champ" + +#. module: base_geoengine +#: model:ir.model,name:base_geoengine.model_ir_model_fields +msgid "Fields" +msgstr "Champs" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__format_suffix +msgid "Format" +msgstr "" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_geoengine_view_form +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "General" +msgstr "Général" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/fields.py:0 +#, python-format +msgid "" +"Geo Value %(geom_type)s must be of the same type " +"%(geo_type)s as fields" +msgstr "" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/fields.py:0 +#, python-format +msgid "" +"Geo dimention modification is not implemented. We can not change dimention " +"%(data)s to %(dim)s" +msgstr "" +"La modification de la dimension de la géométrie n'est pas implémentée. Nous " +"ne pouvons pas modifier la dimension %(data)s to %(dim)s" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__geo_field_id +msgid "Geo field" +msgstr "Champ géographique" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/fields.py:0 +#, python-format +msgid "" +"Geo type modification is not implemented. We can not change type %(data)s to " +"%(geo_type)s" +msgstr "" +"La modification du type de la géométrie n'est pas implémentée. Nous ne " +"pouvons pas changer le type %(data)s to %(geo_type)s" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_ui_view__type__geoengine +msgid "GeoEngine" +msgstr "" + +#. module: base_geoengine +#: model:ir.ui.menu,name:base_geoengine.geoengine_base_menu +msgid "GeoEngine Backend" +msgstr "" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geoengine_view_form +msgid "GeoEngine Data" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_view.esm.js:0 +#, python-format +msgid "Geoengine" +msgstr "" + +#. module: base_geoengine +#: model:res.groups,name:base_geoengine.group_geoengine_admin +msgid "Geoengine Admin" +msgstr "Admin Geoengine" + +#. module: base_geoengine +#: model:res.groups,name:base_geoengine.group_geoengine_user +msgid "Geoengine User" +msgstr "Utilisateur GeoEngine" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__has_type +msgid "Has Type" +msgstr "A le type" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__id +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__id +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__id +msgid "ID" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__classification__interval +msgid "Interval" +msgstr "Intervalle" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__is_wms +msgid "Is Wms" +msgstr "Est un Wms" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__is_wmts +msgid "Is Wmts" +msgstr "Est un Wmts" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__overlay +msgid "Is overlay layer?" +msgstr "S'agit-il d'une couche superposée ?" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__write_uid +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__write_uid +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__write_uid +msgid "Last Updated by" +msgstr "Dernière mise à jour par" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__write_date +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__write_date +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__write_date +msgid "Last Updated on" +msgstr "Dernière mise à jour le" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__type_id +msgid "Layer" +msgstr "Couche" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__name +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__name +msgid "Layer Name" +msgstr "Nom de la couche" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__layer_opacity +msgid "Layer Opacity" +msgstr "Opacité de la couche" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__sequence +msgid "Layer Priority" +msgstr "Priorité de la couche" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__layer_transparent +msgid "Layer Transparent" +msgstr "" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "Layer data" +msgstr "Données de la couche" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__readonly +msgid "Layer is read only" +msgstr "La couche est en lecture seule" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__sequence +msgid "Layer priority" +msgstr "Priorité de la couche" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_vector_layer__active_on_startup +msgid "Layer will be shown on startup if checked." +msgstr "Si cette case est cochée, la couche sera affichée au démarrage" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.xml:0 +#, python-format +msgid "Layers (" +msgstr "Couches (" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__linestring +msgid "LineString" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__dimensions +msgid "List of dimensions separated by ','" +msgstr "Liste des dimensions séparées par ','" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__matrix_set +msgid "Matrix set" +msgstr "Ensemble matriciel" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__max_extent +msgid "Max extent" +msgstr "Étendue maximum" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_arch_parser.esm.js:0 +#, python-format +msgid "Missing ${INFO_BOX_ATTRIBUTE} template." +msgstr "Template ${INFO_BOX_ATTRIBUTE} manquant." + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__model_name +msgid "Model" +msgstr "Modèle" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__model_domain +msgid "Model Domain" +msgstr "Domaine du modèle" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__model_id +msgid "Model to use" +msgstr "Modèle à utiliser" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__model_view_id +msgid "Model view" +msgstr "Vue du modèle" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__multilinestring +msgid "MultiLineString" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__multipoint +msgid "MultiPoint" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__multipolygon +msgid "MultiPolygon" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__name +msgid "Name" +msgstr "Nom" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__params_wms +msgid "Need to provide at least a LAYERS param" +msgstr "Besoin de fournir au moins un paramètre LAYERS" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_controller/geoengine_controller.esm.js:0 +#, python-format +msgid "New record" +msgstr "Nouvel enregistrement" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/base.py:0 +#, python-format +msgid "" +"No GeoEngine view defined for the model %s. Please " +"create a view or modify view mode" +msgstr "" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/base.py:0 +#, python-format +msgid "No raster layer for view %s" +msgstr "Pas de couche d'arrière-plan pour la vue %s" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__nb_class +msgid "Number of class" +msgstr "Nombre de classe" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_renderer/geoengine_renderer.xml:0 +#, python-format +msgid "OPEN" +msgstr "OUVRIR" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_raster_layer__raster_type__odoo +msgid "Odoo field" +msgstr "Champ Odoo" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "Odoo layer data (Not implemented)" +msgstr "Données de couche Odoo (non implémenté)" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__field_id +msgid "Odoo layer field to use" +msgstr "Champ de couche Odoo à utiliser" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__opacity +msgid "Opacity" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_raster_layer__raster_type__osm +msgid "OpenStreetMap" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__params +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "Params" +msgstr "Paramètres" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__params_wms +msgid "Params Wms" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__point +msgid "Point" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__polygon +msgid "Polygon" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_model_fields__dim +msgid "PostGIs Dimension" +msgstr "Dimension PostGIs" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_model_fields__geo_type +msgid "PostGIs type" +msgstr "Type PostGIs" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__projection +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__projection +msgid "Projection" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__geo_repr__proportion +msgid "Proportional Symbol" +msgstr "Symbole proportionnel" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__classification__quantile +msgid "Quantile" +msgstr "" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geoengine_view_form +msgid "Raster (Background layers)" +msgstr "Raster (Couches d'arrière-plan)" + +#. module: base_geoengine +#: model:ir.actions.act_window,name:base_geoengine.geo_engine_form_view_raster_action +#: model:ir.actions.act_window,name:base_geoengine.geo_engine_view_rater_action +#: model:ir.model,name:base_geoengine.model_geoengine_raster_layer +msgid "Raster Layer" +msgstr "Couche d'arrière-plan" + +#. module: base_geoengine +#: model:ir.ui.menu,name:base_geoengine.geoengine_raster_layer_menu +msgid "Raster Layer Management" +msgstr "Gestion des couches d'arrière-plan" + +#. module: base_geoengine +#: model:ir.model,name:base_geoengine.model_geoengine_raster_layer_type +msgid "Raster Layer Type" +msgstr "Type de couche d'arrière-plan" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "Raster Layer View" +msgstr "Vue de la couche d'arrière-plan" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__raster_type +msgid "Raster layer type" +msgstr "Type de couche d'arrière-plan" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__raster_layer_ids +msgid "Raster layers" +msgstr "Couches d'arrière-plan" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.xml:0 +#, python-format +msgid "Rasters" +msgstr "Couches d'arrière-plan" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/records_panel/records_panel.xml:0 +#, python-format +msgid "Records (" +msgstr "Enregistrements (" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "Related Model" +msgstr "Modèle associé" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__view_id +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__view_id +msgid "Related View" +msgstr "Vue associé" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_field_input_with_tags/domain_selector_field_input_with_tags.xml:0 +#, python-format +msgid "Remove tag" +msgstr "" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_geoengine_view_form +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "Representation" +msgstr "Représentation" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__geo_repr +msgid "Representation mode" +msgstr "Mode de représentation" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/fields.py:0 +#, python-format +msgid "" +"Reprojection of column is not implemented. We can not change srid %(srid)s " +"to %(data)s" +msgstr "" +"La reprojection de la colonne n'est pas mise en oeuvre. Nous ne pouvons pas " +"modifier le srid %(srid)s to %(data)s" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__request_encoding +msgid "Request encoding" +msgstr "Demande d'encodage" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__resolutions +msgid "Resolutions" +msgstr "Résolutions" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__restricted_extent +msgid "Restricted map extent" +msgstr "Limitation de l'étendue de la carte" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_controller/geoengine_controller.xml:0 +#, python-format +msgid "Save" +msgstr "Sauvegarder" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/records_panel/search_bar_records/search_bar_records.xml:0 +#, python-format +msgid "Search..." +msgstr "Rechercher..." + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__server_type +msgid "Server Type" +msgstr "Type de serveur" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__service +msgid "Service" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__url +msgid "Service URL" +msgstr "URL du service" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/geo_convertion_helper.py:0 +#, python-format +msgid "Shapely or geojson are not available in the sys path" +msgstr "" +"Shapely ou geojson ne sont pas disponibles dans le chemin d'accès système" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field_input/domain_selector_geo_field_input.esm.js:0 +#, python-format +msgid "Subdomain" +msgstr "Sous domaine" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/geo_vector_layer.py:0 +#, python-format +msgid "The geo_field_id must be a field in %s model" +msgstr "Le geo_field_id doit être un champ dans le modèle %s" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__server_type +msgid "" +"The type of the remote WMS server: mapserver, geoserver, " +"carmentaserver, or qgis" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__classification__unique +msgid "Unique value" +msgstr "Valeur unique" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__units +msgid "Units" +msgstr "Unités" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__use_to_edit +msgid "Use to edit" +msgstr "Autorisation d'édition" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "Vector" +msgstr "Vecteur" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geoengine_view_form +msgid "Vector (Active layers)" +msgstr "Vecteur (couche actives)" + +#. module: base_geoengine +#: model:ir.actions.act_window,name:base_geoengine.geo_engine_view_raster_action +#: model:ir.actions.act_window,name:base_geoengine.geo_vector_geoengine_view_action +#: model:ir.model,name:base_geoengine.model_geoengine_vector_layer +msgid "Vector Layer" +msgstr "Couche vectorielle" + +#. module: base_geoengine +#: model:ir.ui.menu,name:base_geoengine.geoengine_vector_layer_menu +msgid "Vector Layer Management" +msgstr "Gestion des couches vectorielles" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__vector_layer_ids +msgid "Vector layers" +msgstr "Couches vectorielles" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.xml:0 +#, python-format +msgid "Vectors" +msgstr "Couches vectorielles" + +#. module: base_geoengine +#: model:ir.model,name:base_geoengine.model_ir_ui_view +msgid "View" +msgstr "Vue" + +#. module: base_geoengine +#: model:ir.ui.menu,name:base_geoengine.geoengine_view_menu +msgid "View Management" +msgstr "Gestion des vues" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__type +msgid "View Type" +msgstr "Type de vue" + +#. module: base_geoengine +#: model:ir.actions.act_window,name:base_geoengine.geo_engine_view_action +msgid "Views" +msgstr "Vues" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "WMS options" +msgstr "Options du WMS" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_raster_layer__raster_type__wmts +msgid "WMTS" +msgstr "" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "WMTS options" +msgstr "Options du WMTS" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_controller/geoengine_controller.esm.js:0 +#, python-format +msgid "Warning" +msgstr "Attention" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/geo_convertion_helper.py:0 +#, python-format +msgid "" +"Write/create/search geo type must be wkt/geojson string or must respond to " +"wkt" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_controller/geoengine_controller.esm.js:0 +#, python-format +msgid "" +"You are about to create a new record without having displayed all the " +"others. A risk of overlap could occur. Would you like to continue ?" +msgstr "" +"Vous êtes sur le point de créer un nouvel enregistrement sans avoir affiché " +"tous les autres. Un risque de chevauchement pourrait se produire. Voulez-" +"vous continuer ?" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/base.py:0 +#, python-format +msgid "You must at least provide one of domain or geo_domain" +msgstr "Vous devez fournir au moins un domaine ou un géo-domaine" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/geo_vector_layer.py:0 +#, python-format +msgid "You need to provide an attribute that exists in %s model" +msgstr "Vous devez fournir un attribut qui existe dans le modèle %s" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/geo_vector_layer.py:0 +#, python-format +msgid "You need to select a numeric field" +msgstr "Vous devez sélectionner un champ numérique" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__projection +msgid "eg. EPSG:21781" +msgstr "ex. EPSG:21781" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__request_encoding +msgid "eg. REST" +msgstr "ex. REST" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__units +msgid "eg. m" +msgstr "ex. m" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__format_suffix +msgid "eg. png" +msgstr "ex. png" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_contains" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_equal" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_greater" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_intersect" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_lesser" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_line +msgid "geo_line" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_multi_line +msgid "geo_multi_line" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_multi_point +msgid "geo_multi_point" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_multi_polygon +msgid "geo_multi_polygon" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_point +msgid "geo_point" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_polygon +msgid "geo_polygon" +msgstr "" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/base.py:0 +#, python-format +msgid "geo_search is deprecated: uses search method defined on base model" +msgstr "" +"la méthode geo_search est dépréciée : utilisez la méthode search définie " +"dans le modèle de base" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_touch" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_within" +msgstr "" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/fields.py:0 +#, python-format +msgid "" +"geometry_columns table seems to be corrupted. SRID check is not possible" +msgstr "" +"La table geometry_columns semble être corrompue. La vérification de SRID " +"n'est pas possible" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_vector_layer__begin_color +#: model:ir.model.fields,help:base_geoengine.field_geoengine_vector_layer__end_color +msgid "hex value" +msgstr "valeur hexadécimale" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_number_field/domain_selector_number_field.esm.js:0 +#, python-format +msgid "in active_ids" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_number_field/domain_selector_number_field.esm.js:0 +#, python-format +msgid "not in active_ids" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_model_fields__srid +msgid "srid" +msgstr "" + +#, python-format +#~ msgid "" +#~ "Geo Value %(geom_type)s must be of the same type %(geo_type)s as fields" +#~ msgstr "" +#~ "La valeur géographique %(geom_type)s doit être du même type %(geo_type)s " +#~ "queles champs" + +#~ msgid "Last Modified on" +#~ msgstr "Dernière modification le" + +#, python-format +#~ msgid "No GeoEngine view defined for the model %s" +#~ msgstr "Aucune vue GeoEngine n'est définie pour le modèle %s" + +#, python-format +#~ msgid "Please create a view or modify view mode" +#~ msgstr "Veuillez créer une vue ou modifier le mode de vue" + +#~ msgid "" +#~ "The type of the remote WMS server: mapserver, geoserver, carmentaserver, " +#~ "or qgis" +#~ msgstr "" +#~ "Le type du serveur WMS distant: mapserver, geoserver, camentaserver, " +#~ "orqgis" diff --git a/base_geoengine/i18n/it.po b/base_geoengine/i18n/it.po new file mode 100644 index 000000000..b7c259406 --- /dev/null +++ b/base_geoengine/i18n/it.po @@ -0,0 +1,1049 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * base_geoengine +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-09-27 15:06+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 5.6.2\n" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/base.py:0 +#, python-format +msgid "%s column does not exists or is not a geo field" +msgstr "La colonna %s non esiste, o non è un campo geo" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__active_on_startup +msgid "Active On Startup" +msgstr "Attivo all'avvio" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_field_input_with_tags/domain_selector_field_input_with_tags.xml:0 +#, python-format +msgid "Add new value" +msgstr "Aggiungi nuovo valore" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_field_input_with_tags/domain_selector_field_input_with_tags.xml:0 +#, python-format +msgid "Add tag" +msgstr "Aggiungi etichetta" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__attribute_field_id +msgid "Attribute field" +msgstr "Campo attributo" + +#. module: base_geoengine +#: model:ir.model,name:base_geoengine.model_base +msgid "Base" +msgstr "Base" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__geo_repr__basic +msgid "Basic" +msgstr "Base" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__begin_color +msgid "Begin color class" +msgstr "Classe colore inizio" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_geoengine_view_form +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "Classification" +msgstr "Classificazione" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__classification +msgid "Classification mode" +msgstr "Modo di classificazione" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__type +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__code +msgid "Code" +msgstr "Codice" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__geo_repr__colored +msgid "Colored range/Chroma.js" +msgstr "Intervallo colorato/Chroma.js" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_geoengine_view_form +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "Colors" +msgstr "Colori" + +#. module: base_geoengine +#: model:ir.ui.menu,name:base_geoengine.geoengine_base_view_menu +msgid "Configuration" +msgstr "Configurazione" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_model_fields__gist_index +msgid "Create gist index" +msgstr "Crea indice gist" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__create_uid +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__create_uid +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__create_uid +msgid "Created by" +msgstr "Creato da" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__create_date +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__create_date +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__create_date +msgid "Created on" +msgstr "Creato il" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__classification__custom +msgid "Custom" +msgstr "Personalizzato" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__default_extent +msgid "Default map extent" +msgstr "Estensione predefinita della mappa" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__default_zoom +msgid "Default map zoom" +msgstr "Zoom predefinito della mappa" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__params +msgid "Dictiorary of values for dimensions as JSON" +msgstr "Dizionario JSON di valori delle dimensioni" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__dimensions +msgid "Dimensions" +msgstr "Dimensioni" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_controller/geoengine_controller.xml:0 +#, python-format +msgid "Discard" +msgstr "Abbandona" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__display_polygon_labels +msgid "Display Labels on Polygon" +msgstr "Mostra etichette sul poligono" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__display_name +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__display_name +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__display_name +msgid "Display Name" +msgstr "Nome visualizzato" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_raster_layer__raster_type__d_wms +msgid "Distant WMS" +msgstr "WMS remoto" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.esm.js:0 +#, python-format +msgid "Domain editing" +msgstr "Modifica dminio" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.esm.js:0 +#, python-format +msgid "Editing Raster Layer" +msgstr "Modifica livello raster" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.esm.js:0 +#, python-format +msgid "Editing vector layer" +msgstr "Modifica livello vettore" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__end_color +msgid "End color class" +msgstr "Classe colore fine" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/geo_db.py:0 +#, python-format +msgid "" +"Error, can not automatically initialize spatial postgis support. Database " +"user may have to be superuser and postgres/postgis extensions with their " +"devel header have to be installed. If you do not want Odoo to connect with a " +"super user you can manually prepare your database. To do this, open a client " +"to your database using a super user and run:\n" +"CREATE EXTENSION postgis;\n" +"CREATE EXTENSION postgis_topology;\n" +msgstr "" +"Errore, impossibile inizializzare automaticamente il supporto spaziale " +"postgis. L'utente database deve essere superutente e le estensioni postgres/" +"postgis con le loro intestazioni devono essere installate. Se non si vuole " +"che Odoo si connetta con un super utente si può preparare manualmente il " +"database. Per questo, aprire un client verso il database utilizzando un " +"super utente ed eseguendo:\n" +"CREATE EXTENSION postgis;\n" +"CREATE EXTENSION postgis_topology;\n" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_model_fields__ttype +msgid "Field Type" +msgstr "Tipo campo" + +#. module: base_geoengine +#: model:ir.model,name:base_geoengine.model_ir_model_fields +msgid "Fields" +msgstr "Campi" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__format_suffix +msgid "Format" +msgstr "Formato" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_geoengine_view_form +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "General" +msgstr "Generale" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/fields.py:0 +#, python-format +msgid "" +"Geo Value %(geom_type)s must be of the same type " +"%(geo_type)s as fields" +msgstr "" +"Il valore geografico %(geom_type)s deve essere dello stesso tipo %(geo_type)" +"s come campo" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/fields.py:0 +#, python-format +msgid "" +"Geo dimention modification is not implemented. We can not change dimention " +"%(data)s to %(dim)s" +msgstr "" +"La modifica della dimensione geo non è implementata. Non si possono cambiare " +"le dimensioni %(data)s a %(dim)s" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__geo_field_id +msgid "Geo field" +msgstr "Campo geo" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/fields.py:0 +#, python-format +msgid "" +"Geo type modification is not implemented. We can not change type %(data)s to " +"%(geo_type)s" +msgstr "" +"La modifica del tipo geo non è implementata. Non si può cambiare il tipo " +"%(data)s a %(geo_type)s" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_ui_view__type__geoengine +msgid "GeoEngine" +msgstr "GeoEngine" + +#. module: base_geoengine +#: model:ir.ui.menu,name:base_geoengine.geoengine_base_menu +msgid "GeoEngine Backend" +msgstr "Backend GeoEngine" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geoengine_view_form +msgid "GeoEngine Data" +msgstr "Dati GeoEngine" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_view.esm.js:0 +#, python-format +msgid "Geoengine" +msgstr "GeoEngine" + +#. module: base_geoengine +#: model:res.groups,name:base_geoengine.group_geoengine_admin +msgid "Geoengine Admin" +msgstr "Amministratore Geoengine" + +#. module: base_geoengine +#: model:res.groups,name:base_geoengine.group_geoengine_user +msgid "Geoengine User" +msgstr "Utente GeoEngine" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__has_type +msgid "Has Type" +msgstr "Ha tipo" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__id +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__id +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__id +msgid "ID" +msgstr "ID" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__classification__interval +msgid "Interval" +msgstr "Intervallo" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__is_wms +msgid "Is Wms" +msgstr "È WMS" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__is_wmts +msgid "Is Wmts" +msgstr "È WMTS" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__overlay +msgid "Is overlay layer?" +msgstr "È livello in sovraimpressione?" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__write_uid +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__write_uid +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__write_uid +msgid "Last Updated by" +msgstr "Ultimo aggiornamento di" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__write_date +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__write_date +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__write_date +msgid "Last Updated on" +msgstr "Ultimo aggiornamento il" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__type_id +msgid "Layer" +msgstr "Livello" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__name +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__name +msgid "Layer Name" +msgstr "Nome livello" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__layer_opacity +msgid "Layer Opacity" +msgstr "Opacità ivello" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__sequence +msgid "Layer Priority" +msgstr "Priorità livello" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__layer_transparent +msgid "Layer Transparent" +msgstr "Livello trasparente" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "Layer data" +msgstr "Dati ivello" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__readonly +msgid "Layer is read only" +msgstr "Il ivello è in sola lettura" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__sequence +msgid "Layer priority" +msgstr "Priorità livello" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_vector_layer__active_on_startup +msgid "Layer will be shown on startup if checked." +msgstr "Il livello verrà mostrato all'avvio se selezionato." + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.xml:0 +#, python-format +msgid "Layers (" +msgstr "Livelli (" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__linestring +msgid "LineString" +msgstr "Stringa riga" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__dimensions +msgid "List of dimensions separated by ','" +msgstr "Elenco dimensioni separate da ','" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__matrix_set +msgid "Matrix set" +msgstr "Set matrice" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__max_extent +msgid "Max extent" +msgstr "Estensione massima" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_arch_parser.esm.js:0 +#, python-format +msgid "Missing ${INFO_BOX_ATTRIBUTE} template." +msgstr "Modello ${INFO_BOX_ATTRIBUTE} non trovato." + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__model_name +msgid "Model" +msgstr "Modello" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__model_domain +msgid "Model Domain" +msgstr "Dominio modello" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__model_id +msgid "Model to use" +msgstr "Modello da usare" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__model_view_id +msgid "Model view" +msgstr "Vista modello" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__multilinestring +msgid "MultiLineString" +msgstr "Stringa multi riga" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__multipoint +msgid "MultiPoint" +msgstr "Punto multiplo" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__multipolygon +msgid "MultiPolygon" +msgstr "Poligono multiplo" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__name +msgid "Name" +msgstr "Nome" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__params_wms +msgid "Need to provide at least a LAYERS param" +msgstr "Serve fornire almeno un parametro LAYERS" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_controller/geoengine_controller.esm.js:0 +#, python-format +msgid "New record" +msgstr "Nuovo record" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/base.py:0 +#, python-format +msgid "" +"No GeoEngine view defined for the model %s. Please " +"create a view or modify view mode" +msgstr "" +"Nessuna vista GeoEngine definita per il modello %s. " +"Creare una vista o modificare il modo vista" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/base.py:0 +#, python-format +msgid "No raster layer for view %s" +msgstr "Nessuno livello raster per la vista %s" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__nb_class +msgid "Number of class" +msgstr "Numero di classi" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_renderer/geoengine_renderer.xml:0 +#, python-format +msgid "OPEN" +msgstr "OPEN" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_raster_layer__raster_type__odoo +msgid "Odoo field" +msgstr "Campo Odoo" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "Odoo layer data (Not implemented)" +msgstr "Livello dati Odoo (non implementato)" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__field_id +msgid "Odoo layer field to use" +msgstr "Livello campo Odoo da usare" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__opacity +msgid "Opacity" +msgstr "Opacità" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_raster_layer__raster_type__osm +msgid "OpenStreetMap" +msgstr "OpenStreetMap" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__params +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "Params" +msgstr "Parametri" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__params_wms +msgid "Params Wms" +msgstr "Parametri WMS" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__point +msgid "Point" +msgstr "Punto" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__polygon +msgid "Polygon" +msgstr "Poligono" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_model_fields__dim +msgid "PostGIs Dimension" +msgstr "Dimensione PostGIs" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_model_fields__geo_type +msgid "PostGIs type" +msgstr "Tipo PostGIs" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__projection +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__projection +msgid "Projection" +msgstr "Proiezione" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__geo_repr__proportion +msgid "Proportional Symbol" +msgstr "Simbolo proporzionale" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__classification__quantile +msgid "Quantile" +msgstr "Quantile" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geoengine_view_form +msgid "Raster (Background layers)" +msgstr "Raster (livello di sfondo)" + +#. module: base_geoengine +#: model:ir.actions.act_window,name:base_geoengine.geo_engine_form_view_raster_action +#: model:ir.actions.act_window,name:base_geoengine.geo_engine_view_rater_action +#: model:ir.model,name:base_geoengine.model_geoengine_raster_layer +msgid "Raster Layer" +msgstr "Livello raster" + +#. module: base_geoengine +#: model:ir.ui.menu,name:base_geoengine.geoengine_raster_layer_menu +msgid "Raster Layer Management" +msgstr "Gestione livello raster" + +#. module: base_geoengine +#: model:ir.model,name:base_geoengine.model_geoengine_raster_layer_type +msgid "Raster Layer Type" +msgstr "Tipo livello raster" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "Raster Layer View" +msgstr "Vista livello raster" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__raster_type +msgid "Raster layer type" +msgstr "Tipo livello raster" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__raster_layer_ids +msgid "Raster layers" +msgstr "Livelli raster" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.xml:0 +#, python-format +msgid "Rasters" +msgstr "Raster" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/records_panel/records_panel.xml:0 +#, python-format +msgid "Records (" +msgstr "Record (" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "Related Model" +msgstr "Modello correlato" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__view_id +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__view_id +msgid "Related View" +msgstr "Viste correlata" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_field_input_with_tags/domain_selector_field_input_with_tags.xml:0 +#, python-format +msgid "Remove tag" +msgstr "Rimuovi etichetta" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_geoengine_view_form +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "Representation" +msgstr "Rappresentazione" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__geo_repr +msgid "Representation mode" +msgstr "Modalità di rappresentazione" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/fields.py:0 +#, python-format +msgid "" +"Reprojection of column is not implemented. We can not change srid %(srid)s " +"to %(data)s" +msgstr "" +"Riproiezione della colonna nn implementata. Non si può modificare srid " +"%(srid)s a %(data)s" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__request_encoding +msgid "Request encoding" +msgstr "Codifica richiesta" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__resolutions +msgid "Resolutions" +msgstr "Risoluzione" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__restricted_extent +msgid "Restricted map extent" +msgstr "Estensione ristretta della mappa" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_controller/geoengine_controller.xml:0 +#, python-format +msgid "Save" +msgstr "Salva" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/records_panel/search_bar_records/search_bar_records.xml:0 +#, python-format +msgid "Search..." +msgstr "Cerca..." + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__server_type +msgid "Server Type" +msgstr "Tipo server" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__service +msgid "Service" +msgstr "Servizio" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__url +msgid "Service URL" +msgstr "URL servizio" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/geo_convertion_helper.py:0 +#, python-format +msgid "Shapely or geojson are not available in the sys path" +msgstr "Shapely o geojson non sono disponibili nel path di sistema" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field_input/domain_selector_geo_field_input.esm.js:0 +#, python-format +msgid "Subdomain" +msgstr "Sottodominio" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/geo_vector_layer.py:0 +#, python-format +msgid "The geo_field_id must be a field in %s model" +msgstr "Il geo_field_id deve essere un campo nel modello %s" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__server_type +msgid "" +"The type of the remote WMS server: mapserver, geoserver, " +"carmentaserver, or qgis" +msgstr "" +"Il tipo sel server WMS remoto: mapserver, geoserver, " +"carmentaserver, o qgis" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__classification__unique +msgid "Unique value" +msgstr "Valore unico" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__units +msgid "Units" +msgstr "Unità" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__use_to_edit +msgid "Use to edit" +msgstr "Usa per modificare" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "Vector" +msgstr "Vettore" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geoengine_view_form +msgid "Vector (Active layers)" +msgstr "Vettore (livelli attivi)" + +#. module: base_geoengine +#: model:ir.actions.act_window,name:base_geoengine.geo_engine_view_raster_action +#: model:ir.actions.act_window,name:base_geoengine.geo_vector_geoengine_view_action +#: model:ir.model,name:base_geoengine.model_geoengine_vector_layer +msgid "Vector Layer" +msgstr "Livello vettoriale" + +#. module: base_geoengine +#: model:ir.ui.menu,name:base_geoengine.geoengine_vector_layer_menu +msgid "Vector Layer Management" +msgstr "Gestione livello vettoriale" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__vector_layer_ids +msgid "Vector layers" +msgstr "Livelli vettoriali" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.xml:0 +#, python-format +msgid "Vectors" +msgstr "Vettori" + +#. module: base_geoengine +#: model:ir.model,name:base_geoengine.model_ir_ui_view +msgid "View" +msgstr "Vista" + +#. module: base_geoengine +#: model:ir.ui.menu,name:base_geoengine.geoengine_view_menu +msgid "View Management" +msgstr "Gestione vista" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__type +msgid "View Type" +msgstr "Tipo vista" + +#. module: base_geoengine +#: model:ir.actions.act_window,name:base_geoengine.geo_engine_view_action +msgid "Views" +msgstr "Viste" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "WMS options" +msgstr "Opzioni WMS" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_raster_layer__raster_type__wmts +msgid "WMTS" +msgstr "WMTS" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "WMTS options" +msgstr "Opzioni WMTS" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_controller/geoengine_controller.esm.js:0 +#, python-format +msgid "Warning" +msgstr "Attenzione" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/geo_convertion_helper.py:0 +#, python-format +msgid "" +"Write/create/search geo type must be wkt/geojson string or must respond to " +"wkt" +msgstr "" +"Il tipo geo scrittura/creazione/ricerca deve essere una stringa wkt/geojson " +"odeve rispondere a wkt" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_controller/geoengine_controller.esm.js:0 +#, python-format +msgid "" +"You are about to create a new record without having displayed all the " +"others. A risk of overlap could occur. Would you like to continue ?" +msgstr "" +"Si sta per creare un nuovo record senza aver disabilitato tutti gli altri. " +"C'è il rischio di sovrapposizione. Si vuole continuare?" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/base.py:0 +#, python-format +msgid "You must at least provide one of domain or geo_domain" +msgstr "Bisogna fornire almeno un dominio o un geo_domain" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/geo_vector_layer.py:0 +#, python-format +msgid "You need to provide an attribute that exists in %s model" +msgstr "Bisogna fornire un attributo che esista nel modello %s" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/geo_vector_layer.py:0 +#, python-format +msgid "You need to select a numeric field" +msgstr "Bisogna selezionare un campo numerico" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__projection +msgid "eg. EPSG:21781" +msgstr "es. EPSG:21781" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__request_encoding +msgid "eg. REST" +msgstr "es. REST" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__units +msgid "eg. m" +msgstr "es. m" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__format_suffix +msgid "eg. png" +msgstr "es. png" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_contains" +msgstr "geo_contains" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_equal" +msgstr "geo_equal" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_greater" +msgstr "geo_greater" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_intersect" +msgstr "geo_intersect" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_lesser" +msgstr "geo_lesser" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_line +msgid "geo_line" +msgstr "geo_line" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_multi_line +msgid "geo_multi_line" +msgstr "geo_multi_line" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_multi_point +msgid "geo_multi_point" +msgstr "geo_multi_point" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_multi_polygon +msgid "geo_multi_polygon" +msgstr "geo_multi_polygon" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_point +msgid "geo_point" +msgstr "geo_point" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_polygon +msgid "geo_polygon" +msgstr "geo_polygon" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/base.py:0 +#, python-format +msgid "geo_search is deprecated: uses search method defined on base model" +msgstr "" +"geo_search è deprecat: usare il motodo ricerca definito nel modello base" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_touch" +msgstr "geo_touch" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_within" +msgstr "geo_within" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/fields.py:0 +#, python-format +msgid "" +"geometry_columns table seems to be corrupted. SRID check is not possible" +msgstr "" +"la tabella geometry_columns sembra corrotta.Il controllo SRID non è possibile" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_vector_layer__begin_color +#: model:ir.model.fields,help:base_geoengine.field_geoengine_vector_layer__end_color +msgid "hex value" +msgstr "valore esadecimale" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_number_field/domain_selector_number_field.esm.js:0 +#, python-format +msgid "in active_ids" +msgstr "in active_ids" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_number_field/domain_selector_number_field.esm.js:0 +#, python-format +msgid "not in active_ids" +msgstr "not in active_ids" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_model_fields__srid +msgid "srid" +msgstr "srid" + +#, python-format +#~ msgid "" +#~ "Geo Value %(geom_type)s must be of the same type %(geo_type)s as fields" +#~ msgstr "" +#~ "Il valore geo %(geom_type)s deve essere dello stesso tipo %(geo_type)s " +#~ "come i campi" + +#~ msgid "Last Modified on" +#~ msgstr "Ultima modifica il" + +#, python-format +#~ msgid "No GeoEngine view defined for the model %s" +#~ msgstr "Nessuna vista GeoEngine definita per il modello %s" + +#, python-format +#~ msgid "Please create a view or modify view mode" +#~ msgstr "Creare una vista o modificare la modalità di visualizzazione" + +#~ msgid "" +#~ "The type of the remote WMS server: mapserver, geoserver, carmentaserver, " +#~ "or qgis" +#~ msgstr "" +#~ "Il tipo sel server WMS remoto: mapserver, geoserver, carmentaserver, o " +#~ "qgis" diff --git a/base_geoengine/i18n/sv.po b/base_geoengine/i18n/sv.po new file mode 100644 index 000000000..b02fbf617 --- /dev/null +++ b/base_geoengine/i18n/sv.po @@ -0,0 +1,1038 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * base_geoengine +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-11-02 13:38+0000\n" +"Last-Translator: jakobkrabbe \n" +"Language-Team: none\n" +"Language: sv\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/base.py:0 +#, python-format +msgid "%s column does not exists or is not a geo field" +msgstr "%s kolumnen finns inte eller är inte ett geofält" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__active_on_startup +msgid "Active On Startup" +msgstr "Aktiv vid uppstart" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_field_input_with_tags/domain_selector_field_input_with_tags.xml:0 +#, python-format +msgid "Add new value" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_field_input_with_tags/domain_selector_field_input_with_tags.xml:0 +#, python-format +msgid "Add tag" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__attribute_field_id +msgid "Attribute field" +msgstr "Attributfält" + +#. module: base_geoengine +#: model:ir.model,name:base_geoengine.model_base +msgid "Base" +msgstr "Bas" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__geo_repr__basic +msgid "Basic" +msgstr "Grundläggande" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__begin_color +msgid "Begin color class" +msgstr "Börja färgklass" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_geoengine_view_form +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "Classification" +msgstr "Klassificering" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__classification +msgid "Classification mode" +msgstr "Klassificeringsläge" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__type +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__code +msgid "Code" +msgstr "Kod" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__geo_repr__colored +msgid "Colored range/Chroma.js" +msgstr "Färgat område/Chroma.js" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_geoengine_view_form +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "Colors" +msgstr "Färger" + +#. module: base_geoengine +#: model:ir.ui.menu,name:base_geoengine.geoengine_base_view_menu +msgid "Configuration" +msgstr "Konfiguration" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_model_fields__gist_index +msgid "Create gist index" +msgstr "Skapa huvudindex" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__create_uid +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__create_uid +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__create_uid +msgid "Created by" +msgstr "Skapad av" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__create_date +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__create_date +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__create_date +msgid "Created on" +msgstr "Skapad på" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__classification__custom +msgid "Custom" +msgstr "Anpassad" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__default_extent +msgid "Default map extent" +msgstr "Standard kartomfattning" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__default_zoom +msgid "Default map zoom" +msgstr "Standard kartzoom" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__params +msgid "Dictiorary of values for dimensions as JSON" +msgstr "Ordbok med värden för dimensioner som JSON" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__dimensions +msgid "Dimensions" +msgstr "Dimensioner" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_controller/geoengine_controller.xml:0 +#, python-format +msgid "Discard" +msgstr "Kassera" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__display_polygon_labels +msgid "Display Labels on Polygon" +msgstr "Visa etiketter på polygon" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__display_name +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__display_name +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__display_name +msgid "Display Name" +msgstr "Visningsnamn" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_raster_layer__raster_type__d_wms +msgid "Distant WMS" +msgstr "Avlägsen WMS" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.esm.js:0 +#, python-format +msgid "Domain editing" +msgstr "Domänredigering" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.esm.js:0 +#, python-format +msgid "Editing Raster Layer" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.esm.js:0 +#, python-format +msgid "Editing vector layer" +msgstr "Redigera vektorlager" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__end_color +msgid "End color class" +msgstr "Avsluta färgklass" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/geo_db.py:0 +#, python-format +msgid "" +"Error, can not automatically initialize spatial postgis support. Database " +"user may have to be superuser and postgres/postgis extensions with their " +"devel header have to be installed. If you do not want Odoo to connect with a " +"super user you can manually prepare your database. To do this, open a client " +"to your database using a super user and run:\n" +"CREATE EXTENSION postgis;\n" +"CREATE EXTENSION postgis_topology;\n" +msgstr "" +"Fel, kan inte automatiskt initiera spatial postgis-stöd. Databasanvändare " +"kan behöva vara superanvändare och postgres/postgis-tillägg med deras " +"utvecklingshuvud måste installeras. Om du inte vill att Odoo ska ansluta " +"till en superanvändare kan du manuellt förbereda din databas. För att göra " +"detta, öppna en klient till din databas med en superanvändare och kör:\n" +"CREATE EXTENSION postgis;\n" +"CREATE EXTENSION postgis_topology;\n" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_model_fields__ttype +msgid "Field Type" +msgstr "Fälttyp" + +#. module: base_geoengine +#: model:ir.model,name:base_geoengine.model_ir_model_fields +msgid "Fields" +msgstr "Fält" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__format_suffix +msgid "Format" +msgstr "Format" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_geoengine_view_form +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "General" +msgstr "Generell" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/fields.py:0 +#, python-format +msgid "" +"Geo Value %(geom_type)s must be of the same type " +"%(geo_type)s as fields" +msgstr "" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/fields.py:0 +#, python-format +msgid "" +"Geo dimention modification is not implemented. We can not change dimention " +"%(data)s to %(dim)s" +msgstr "" +"Modifiering av geografisk dimension är inte implementerad. Vi kan inte ändra " +"dimension %(data)s till %(dim)s" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__geo_field_id +msgid "Geo field" +msgstr "Geofält" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/fields.py:0 +#, python-format +msgid "" +"Geo type modification is not implemented. We can not change type %(data)s to " +"%(geo_type)s" +msgstr "" +"Ändring av geotyp är inte implementerad. Vi kan inte ändra typ %(data)s till " +"%(geo_type)s" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_ui_view__type__geoengine +msgid "GeoEngine" +msgstr "GeoMotor" + +#. module: base_geoengine +#: model:ir.ui.menu,name:base_geoengine.geoengine_base_menu +msgid "GeoEngine Backend" +msgstr "GeoMotor Backend" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geoengine_view_form +msgid "GeoEngine Data" +msgstr "GeoMotor data" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_view.esm.js:0 +#, python-format +msgid "Geoengine" +msgstr "Geomotor" + +#. module: base_geoengine +#: model:res.groups,name:base_geoengine.group_geoengine_admin +msgid "Geoengine Admin" +msgstr "Geomotor Admin" + +#. module: base_geoengine +#: model:res.groups,name:base_geoengine.group_geoengine_user +msgid "Geoengine User" +msgstr "Geomotor användare" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__has_type +msgid "Has Type" +msgstr "Har typ" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__id +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__id +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__id +msgid "ID" +msgstr "ID" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__classification__interval +msgid "Interval" +msgstr "Intervall" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__is_wms +msgid "Is Wms" +msgstr "Är Wms" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__is_wmts +msgid "Is Wmts" +msgstr "Är Wmts" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__overlay +msgid "Is overlay layer?" +msgstr "Är överläggslager?" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__write_uid +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__write_uid +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__write_uid +msgid "Last Updated by" +msgstr "Senast uppdaterad av" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__write_date +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__write_date +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__write_date +msgid "Last Updated on" +msgstr "Senast uppdaterad på" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__type_id +msgid "Layer" +msgstr "Lager" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__name +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__name +msgid "Layer Name" +msgstr "Lagernamn" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__layer_opacity +msgid "Layer Opacity" +msgstr "Lageropacitet" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__sequence +msgid "Layer Priority" +msgstr "Lagerprioritet" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__layer_transparent +msgid "Layer Transparent" +msgstr "" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "Layer data" +msgstr "Lagerdata" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__readonly +msgid "Layer is read only" +msgstr "Layer är skrivskyddad" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__sequence +msgid "Layer priority" +msgstr "Lagerprioritet" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_vector_layer__active_on_startup +msgid "Layer will be shown on startup if checked." +msgstr "Lager kommer att visas vid start om det är markerat." + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.xml:0 +#, python-format +msgid "Layers (" +msgstr "Lager (" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__linestring +msgid "LineString" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__dimensions +msgid "List of dimensions separated by ','" +msgstr "Lista över dimensioner avgränsade med ','" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__matrix_set +msgid "Matrix set" +msgstr "Matris set" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__max_extent +msgid "Max extent" +msgstr "Max omfattning" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_arch_parser.esm.js:0 +#, python-format +msgid "Missing ${INFO_BOX_ATTRIBUTE} template." +msgstr "${INFO_BOX_ATTRIBUTE} mall saknas." + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__model_name +msgid "Model" +msgstr "Modell" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__model_domain +msgid "Model Domain" +msgstr "Modelldomän" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__model_id +msgid "Model to use" +msgstr "Modell att använda" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__model_view_id +msgid "Model view" +msgstr "Modellvy" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__multilinestring +msgid "MultiLineString" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__multipoint +msgid "MultiPoint" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__multipolygon +msgid "MultiPolygon" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__name +msgid "Name" +msgstr "Namn" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__params_wms +msgid "Need to provide at least a LAYERS param" +msgstr "Behöver tillhandahålla minst en LAGER parameter" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_controller/geoengine_controller.esm.js:0 +#, python-format +msgid "New record" +msgstr "Ny post" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/base.py:0 +#, python-format +msgid "" +"No GeoEngine view defined for the model %s. Please " +"create a view or modify view mode" +msgstr "" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/base.py:0 +#, python-format +msgid "No raster layer for view %s" +msgstr "Inget rasterlager för vyn %s" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__nb_class +msgid "Number of class" +msgstr "Nummer av klass" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_renderer/geoengine_renderer.xml:0 +#, python-format +msgid "OPEN" +msgstr "ÖPPNA" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_raster_layer__raster_type__odoo +msgid "Odoo field" +msgstr "Odoofält" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "Odoo layer data (Not implemented)" +msgstr "Odoo lagerdata (inte implementerad)" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__field_id +msgid "Odoo layer field to use" +msgstr "Odoo lagerfält att använda" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__opacity +msgid "Opacity" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_raster_layer__raster_type__osm +msgid "OpenStreetMap" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__params +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "Params" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__params_wms +msgid "Params Wms" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__point +msgid "Point" +msgstr "Peka" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__polygon +msgid "Polygon" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_model_fields__dim +msgid "PostGIs Dimension" +msgstr "PostGIs dimension" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_model_fields__geo_type +msgid "PostGIs type" +msgstr "PostGIs typ" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__projection +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__projection +msgid "Projection" +msgstr "Projektion" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__geo_repr__proportion +msgid "Proportional Symbol" +msgstr "Proportionell symbol" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__classification__quantile +msgid "Quantile" +msgstr "Kvantil" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geoengine_view_form +msgid "Raster (Background layers)" +msgstr "Raster (bakgrundslager)" + +#. module: base_geoengine +#: model:ir.actions.act_window,name:base_geoengine.geo_engine_form_view_raster_action +#: model:ir.actions.act_window,name:base_geoengine.geo_engine_view_rater_action +#: model:ir.model,name:base_geoengine.model_geoengine_raster_layer +msgid "Raster Layer" +msgstr "Raster lager" + +#. module: base_geoengine +#: model:ir.ui.menu,name:base_geoengine.geoengine_raster_layer_menu +msgid "Raster Layer Management" +msgstr "Rasterlagerhantering" + +#. module: base_geoengine +#: model:ir.model,name:base_geoengine.model_geoengine_raster_layer_type +msgid "Raster Layer Type" +msgstr "Rasterlagertyp" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "Raster Layer View" +msgstr "Rasterlagervy" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__raster_type +msgid "Raster layer type" +msgstr "Rasterlagertyp" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__raster_layer_ids +msgid "Raster layers" +msgstr "Rasterlager" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.xml:0 +#, python-format +msgid "Rasters" +msgstr "Raster" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/records_panel/records_panel.xml:0 +#, python-format +msgid "Records (" +msgstr "Poster (" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "Related Model" +msgstr "Relaterad modell" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__view_id +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__view_id +msgid "Related View" +msgstr "Relaterad vy" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_field_input_with_tags/domain_selector_field_input_with_tags.xml:0 +#, python-format +msgid "Remove tag" +msgstr "" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_geoengine_view_form +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "Representation" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__geo_repr +msgid "Representation mode" +msgstr "Representationsläge" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/fields.py:0 +#, python-format +msgid "" +"Reprojection of column is not implemented. We can not change srid %(srid)s " +"to %(data)s" +msgstr "" +"Omprojektering av kolumn är inte implementerad. Vi kan inte ändra srid " +"%(srid)s till %(data)s" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__request_encoding +msgid "Request encoding" +msgstr "Begär kodning" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__resolutions +msgid "Resolutions" +msgstr "Upplösningar" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__restricted_extent +msgid "Restricted map extent" +msgstr "Begränsad kartutsträckning" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_controller/geoengine_controller.xml:0 +#, python-format +msgid "Save" +msgstr "Spara" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/records_panel/search_bar_records/search_bar_records.xml:0 +#, python-format +msgid "Search..." +msgstr "Sök..." + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__server_type +msgid "Server Type" +msgstr "Servertyp" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__service +msgid "Service" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__url +msgid "Service URL" +msgstr "" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/geo_convertion_helper.py:0 +#, python-format +msgid "Shapely or geojson are not available in the sys path" +msgstr "Shapely eller geojson är inte tillgängliga i sys-sökvägen" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field_input/domain_selector_geo_field_input.esm.js:0 +#, python-format +msgid "Subdomain" +msgstr "Subdomän" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/geo_vector_layer.py:0 +#, python-format +msgid "The geo_field_id must be a field in %s model" +msgstr "Värdet i geo_field_id fältet måste vara i %s modellen" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__server_type +msgid "" +"The type of the remote WMS server: mapserver, geoserver, " +"carmentaserver, or qgis" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__classification__unique +msgid "Unique value" +msgstr "Unikt värde" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__units +msgid "Units" +msgstr "Enheter" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__use_to_edit +msgid "Use to edit" +msgstr "Använd för att redigera" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "Vector" +msgstr "Vektor" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geoengine_view_form +msgid "Vector (Active layers)" +msgstr "Vektor (aktivt lager)" + +#. module: base_geoengine +#: model:ir.actions.act_window,name:base_geoengine.geo_engine_view_raster_action +#: model:ir.actions.act_window,name:base_geoengine.geo_vector_geoengine_view_action +#: model:ir.model,name:base_geoengine.model_geoengine_vector_layer +msgid "Vector Layer" +msgstr "Vektor lager" + +#. module: base_geoengine +#: model:ir.ui.menu,name:base_geoengine.geoengine_vector_layer_menu +msgid "Vector Layer Management" +msgstr "Vektor lagerhantering" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__vector_layer_ids +msgid "Vector layers" +msgstr "Vektor lager" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.xml:0 +#, python-format +msgid "Vectors" +msgstr "Vektorer" + +#. module: base_geoengine +#: model:ir.model,name:base_geoengine.model_ir_ui_view +msgid "View" +msgstr "Vy" + +#. module: base_geoengine +#: model:ir.ui.menu,name:base_geoengine.geoengine_view_menu +msgid "View Management" +msgstr "Visningshanterare" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__type +msgid "View Type" +msgstr "Vytyp" + +#. module: base_geoengine +#: model:ir.actions.act_window,name:base_geoengine.geo_engine_view_action +msgid "Views" +msgstr "Vyer" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "WMS options" +msgstr "WMS alternativ" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_raster_layer__raster_type__wmts +msgid "WMTS" +msgstr "" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "WMTS options" +msgstr "WMTS alternativ" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_controller/geoengine_controller.esm.js:0 +#, python-format +msgid "Warning" +msgstr "Varning" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/geo_convertion_helper.py:0 +#, python-format +msgid "" +"Write/create/search geo type must be wkt/geojson string or must respond to " +"wkt" +msgstr "" +"Skriv/skapa/sök geotyp måste vara wkt/geojson-sträng eller måste svara på wkt" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_controller/geoengine_controller.esm.js:0 +#, python-format +msgid "" +"You are about to create a new record without having displayed all the " +"others. A risk of overlap could occur. Would you like to continue ?" +msgstr "" +"Du är på väg att skapa en ny post utan att ha visat alla de andra. Det kan " +"uppstå risk för överlappning. Vill du fortsätta?" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/base.py:0 +#, python-format +msgid "You must at least provide one of domain or geo_domain" +msgstr "Du måste åtminstone tillhandahålla en av domän eller geo_domän" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/geo_vector_layer.py:0 +#, python-format +msgid "You need to provide an attribute that exists in %s model" +msgstr "" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/geo_vector_layer.py:0 +#, python-format +msgid "You need to select a numeric field" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__projection +msgid "eg. EPSG:21781" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__request_encoding +msgid "eg. REST" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__units +msgid "eg. m" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__format_suffix +msgid "eg. png" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_contains" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_equal" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_greater" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_intersect" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_lesser" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_line +msgid "geo_line" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_multi_line +msgid "geo_multi_line" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_multi_point +msgid "geo_multi_point" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_multi_polygon +msgid "geo_multi_polygon" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_point +msgid "geo_point" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_polygon +msgid "geo_polygon" +msgstr "" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/base.py:0 +#, python-format +msgid "geo_search is deprecated: uses search method defined on base model" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_touch" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_within" +msgstr "" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/fields.py:0 +#, python-format +msgid "" +"geometry_columns table seems to be corrupted. SRID check is not possible" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_vector_layer__begin_color +#: model:ir.model.fields,help:base_geoengine.field_geoengine_vector_layer__end_color +msgid "hex value" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_number_field/domain_selector_number_field.esm.js:0 +#, python-format +msgid "in active_ids" +msgstr "" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_number_field/domain_selector_number_field.esm.js:0 +#, python-format +msgid "not in active_ids" +msgstr "" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_model_fields__srid +msgid "srid" +msgstr "" + +#, python-format +#~ msgid "" +#~ "Geo Value %(geom_type)s must be of the same type %(geo_type)s as fields" +#~ msgstr "" +#~ "Geovärde %(geom_type)s måste vara av samma typ %(geo_type)s som fält" + +#~ msgid "Last Modified on" +#~ msgstr "Senast modifierad på" + +#, python-format +#~ msgid "No GeoEngine view defined for the model %s" +#~ msgstr "Ingen GeoMotor-vy definierad för modellen %s" + +#, python-format +#~ msgid "Please create a view or modify view mode" +#~ msgstr "Vänligen skapa en vy eller ändra visningsläge" + +#~ msgid "" +#~ "The type of the remote WMS server: mapserver, geoserver, carmentaserver, " +#~ "or qgis" +#~ msgstr "" +#~ "Typen av fjärr-WMS-servern: mapserver, geoserver, carmentaserver eller " +#~ "qgis" diff --git a/base_geoengine/i18n/zh_CN.po b/base_geoengine/i18n/zh_CN.po new file mode 100644 index 000000000..faaed618a --- /dev/null +++ b/base_geoengine/i18n/zh_CN.po @@ -0,0 +1,1005 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * base_geoengine +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-11-25 09:06+0000\n" +"Last-Translator: xtanuiha \n" +"Language-Team: none\n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 5.6.2\n" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/base.py:0 +#, python-format +msgid "%s column does not exists or is not a geo field" +msgstr "%s 列不存在或不是地理字段" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__active_on_startup +msgid "Active On Startup" +msgstr "启动时激活" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_field_input_with_tags/domain_selector_field_input_with_tags.xml:0 +#, python-format +msgid "Add new value" +msgstr "添加新值" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_field_input_with_tags/domain_selector_field_input_with_tags.xml:0 +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_field_input_with_tags/domain_selector_field_input_with_tags.xml:0 +#, python-format +msgid "Add tag" +msgstr "添加标签" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__attribute_field_id +msgid "Attribute field" +msgstr "属性字段" + +#. module: base_geoengine +#: model:ir.model,name:base_geoengine.model_base +msgid "Base" +msgstr "基础" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__geo_repr__basic +msgid "Basic" +msgstr "基本" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__begin_color +msgid "Begin color class" +msgstr "开始颜色类别" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_geoengine_view_form +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "Classification" +msgstr "分类" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__classification +msgid "Classification mode" +msgstr "分类模式" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__type +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__code +msgid "Code" +msgstr "代码" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__geo_repr__colored +msgid "Colored range/Chroma.js" +msgstr "彩色范围/Chroma.js" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_geoengine_view_form +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "Colors" +msgstr "颜色" + +#. module: base_geoengine +#: model:ir.ui.menu,name:base_geoengine.geoengine_base_view_menu +msgid "Configuration" +msgstr "配置" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_model_fields__gist_index +msgid "Create gist index" +msgstr "创建gist索引" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__create_uid +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__create_uid +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__create_uid +msgid "Created by" +msgstr "由...创建" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__create_date +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__create_date +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__create_date +msgid "Created on" +msgstr "创建于" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__classification__custom +msgid "Custom" +msgstr "自定义" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__default_extent +msgid "Default map extent" +msgstr "默认地图范围" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__default_zoom +msgid "Default map zoom" +msgstr "默认地图缩放" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__params +msgid "Dictiorary of values for dimensions as JSON" +msgstr "维度值的字典作为JSON" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__dimensions +msgid "Dimensions" +msgstr "维度" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_controller/geoengine_controller.xml:0 +#, python-format +msgid "Discard" +msgstr "放弃" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__display_polygon_labels +msgid "Display Labels on Polygon" +msgstr "在多边形上显示标签" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__display_name +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__display_name +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__display_name +msgid "Display Name" +msgstr "显示名称" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_raster_layer__raster_type__d_wms +msgid "Distant WMS" +msgstr "远程WMS" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.esm.js:0 +#, python-format +msgid "Domain editing" +msgstr "域编辑" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.esm.js:0 +#, python-format +msgid "Editing Raster Layer" +msgstr "编辑栅格层" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.esm.js:0 +#, python-format +msgid "Editing vector layer" +msgstr "编辑矢量层" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__end_color +msgid "End color class" +msgstr "结束颜色类别" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/geo_db.py:0 +#, python-format +msgid "" +"Error, can not automatically initialize spatial postgis support. Database user may have to be superuser and postgres/postgis extensions with their devel header have to be installed. If you do not want Odoo to connect with a super user you can manually prepare your database. To do this, open a client to your database using a super user and run:\n" +"CREATE EXTENSION postgis;\n" +"CREATE EXTENSION postgis_topology;\n" +msgstr "" +"错误,无法自动初始化空间postgis支持。数据库用户可能需要是超级用户,并且必须安" +"装postgres/postgis扩展及其开发头文件。如果您不希望Odoo与超级用户连接,您可以" +"手动准备数据库。为此,请使用超级用户打开数据库客户端并运行:\\n" +"CREATE EXTENSION postgis;\\n" +"CREATE EXTENSION postgis_topology;\\n" +"\n" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_model_fields__ttype +msgid "Field Type" +msgstr "字段类型" + +#. module: base_geoengine +#: model:ir.model,name:base_geoengine.model_ir_model_fields +msgid "Fields" +msgstr "字段" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__format_suffix +msgid "Format" +msgstr "格式" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_geoengine_view_form +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "General" +msgstr "通用" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/fields.py:0 +#, python-format +msgid "" +"Geo Value %(geom_type)s must be of the same type %(geo_type)s" +" as fields" +msgstr "地理值%(geom_type)s必须与字段的类型%(geo_type)s相同" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/fields.py:0 +#, python-format +msgid "" +"Geo dimention modification is not implemented. We can not change dimention " +"%(data)s to %(dim)s" +msgstr "地理维度修改未实现。我们无法将维度%(data)s更改为%(dim)s" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__geo_field_id +msgid "Geo field" +msgstr "地理字段" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/fields.py:0 +#, python-format +msgid "" +"Geo type modification is not implemented. We can not change type %(data)s to" +" %(geo_type)s" +msgstr "地理类型修改未实现。我们无法将类型%(data)s更改为%(geo_type)s" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_ui_view__type__geoengine +msgid "GeoEngine" +msgstr "地理引擎" + +#. module: base_geoengine +#: model:ir.ui.menu,name:base_geoengine.geoengine_base_menu +msgid "GeoEngine Backend" +msgstr "地理引擎后端" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geoengine_view_form +msgid "GeoEngine Data" +msgstr "地理引擎数据" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_view.esm.js:0 +#, python-format +msgid "Geoengine" +msgstr "地理引擎" + +#. module: base_geoengine +#: model:res.groups,name:base_geoengine.group_geoengine_admin +msgid "Geoengine Admin" +msgstr "地理引擎管理员" + +#. module: base_geoengine +#: model:res.groups,name:base_geoengine.group_geoengine_user +msgid "Geoengine User" +msgstr "地理引擎用户" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__has_type +msgid "Has Type" +msgstr "具有类型" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__id +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__id +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__id +msgid "ID" +msgstr "ID" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__classification__interval +msgid "Interval" +msgstr "间隔" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__is_wms +msgid "Is Wms" +msgstr "是否为WMS" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__is_wmts +msgid "Is Wmts" +msgstr "是否为WMTS" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__overlay +msgid "Is overlay layer?" +msgstr "是否为叠加层?" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__write_uid +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__write_uid +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__write_uid +msgid "Last Updated by" +msgstr "最后更新者" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__write_date +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__write_date +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__write_date +msgid "Last Updated on" +msgstr "最后更新时间" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__type_id +msgid "Layer" +msgstr "图层" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__name +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__name +msgid "Layer Name" +msgstr "图层名称" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__layer_opacity +msgid "Layer Opacity" +msgstr "图层不透明度" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__sequence +msgid "Layer Priority" +msgstr "图层优先级" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__layer_transparent +msgid "Layer Transparent" +msgstr "图层透明度" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "Layer data" +msgstr "图层数据" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__readonly +msgid "Layer is read only" +msgstr "只读图层" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__sequence +msgid "Layer priority" +msgstr "图层优先级" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_vector_layer__active_on_startup +msgid "Layer will be shown on startup if checked." +msgstr "如果选中,则图层将在启动时显示。" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.xml:0 +#, python-format +msgid "Layers (" +msgstr "图层 (" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__linestring +msgid "LineString" +msgstr "线字符串" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__dimensions +msgid "List of dimensions separated by ','" +msgstr "用逗号分隔的维度列表" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__matrix_set +msgid "Matrix set" +msgstr "矩阵集" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__max_extent +msgid "Max extent" +msgstr "最大范围" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_arch_parser.esm.js:0 +#, python-format +msgid "Missing ${INFO_BOX_ATTRIBUTE} template." +msgstr "缺少 \\${INFO_BOX_ATTRIBUTE} 模板。" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__model_name +msgid "Model" +msgstr "模型" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__model_domain +msgid "Model Domain" +msgstr "模型域" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__model_id +msgid "Model to use" +msgstr "要使用的模型" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__model_view_id +msgid "Model view" +msgstr "模型视图" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__multilinestring +msgid "MultiLineString" +msgstr "多线字符串" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__multipoint +msgid "MultiPoint" +msgstr "多点" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__multipolygon +msgid "MultiPolygon" +msgstr "多边形" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__name +msgid "Name" +msgstr "名称" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__params_wms +msgid "Need to provide at least a LAYERS param" +msgstr "至少需要提供一个 LAYERS 参数" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_controller/geoengine_controller.esm.js:0 +#, python-format +msgid "New record" +msgstr "新记录" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/base.py:0 +#, python-format +msgid "" +"No GeoEngine view defined for the model %s. Please " +"create a view or modify view mode" +msgstr "模型 %s 没有定义 GeoEngine 视图。请创建视图或修改视图模式" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/base.py:0 +#, python-format +msgid "No raster layer for view %s" +msgstr "视图 %s 没有栅格图层" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__nb_class +msgid "Number of class" +msgstr "类别数量" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_renderer/geoengine_renderer.xml:0 +#, python-format +msgid "OPEN" +msgstr "打开" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_raster_layer__raster_type__odoo +msgid "Odoo field" +msgstr "Odoo 字段" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "Odoo layer data (Not implemented)" +msgstr "Odoo 层数据(未实现)" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__field_id +msgid "Odoo layer field to use" +msgstr "要使用的 Odoo 层字段" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__opacity +msgid "Opacity" +msgstr "不透明度" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_raster_layer__raster_type__osm +msgid "OpenStreetMap" +msgstr "开放街图" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__params +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "Params" +msgstr "参数" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__params_wms +msgid "Params Wms" +msgstr "Wms 参数" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__point +msgid "Point" +msgstr "点" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__geo_type__polygon +msgid "Polygon" +msgstr "多边形" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_model_fields__dim +msgid "PostGIs Dimension" +msgstr "PostGIS 维度" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_model_fields__geo_type +msgid "PostGIs type" +msgstr "PostGIS 类型" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__projection +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__projection +msgid "Projection" +msgstr "投影" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__geo_repr__proportion +msgid "Proportional Symbol" +msgstr "比例符号" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__classification__quantile +msgid "Quantile" +msgstr "分位数" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geoengine_view_form +msgid "Raster (Background layers)" +msgstr "栅格(背景图层)" + +#. module: base_geoengine +#: model:ir.actions.act_window,name:base_geoengine.geo_engine_form_view_raster_action +#: model:ir.actions.act_window,name:base_geoengine.geo_engine_view_rater_action +#: model:ir.model,name:base_geoengine.model_geoengine_raster_layer +msgid "Raster Layer" +msgstr "栅格图层" + +#. module: base_geoengine +#: model:ir.ui.menu,name:base_geoengine.geoengine_raster_layer_menu +msgid "Raster Layer Management" +msgstr "栅格图层管理" + +#. module: base_geoengine +#: model:ir.model,name:base_geoengine.model_geoengine_raster_layer_type +msgid "Raster Layer Type" +msgstr "栅格图层类型" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "Raster Layer View" +msgstr "栅格图层视图" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__raster_type +msgid "Raster layer type" +msgstr "栅格图层类型" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__raster_layer_ids +msgid "Raster layers" +msgstr "栅格图层" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.xml:0 +#, python-format +msgid "Rasters" +msgstr "栅格数据" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/records_panel/records_panel.xml:0 +#, python-format +msgid "Records (" +msgstr "记录 (" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "Related Model" +msgstr "相关模型" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__view_id +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__view_id +msgid "Related View" +msgstr "相关视图" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_field_input_with_tags/domain_selector_field_input_with_tags.xml:0 +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_field_input_with_tags/domain_selector_field_input_with_tags.xml:0 +#, python-format +msgid "Remove tag" +msgstr "移除标签" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_geoengine_view_form +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "Representation" +msgstr "表示" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_vector_layer__geo_repr +msgid "Representation mode" +msgstr "表示模式" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/fields.py:0 +#, python-format +msgid "" +"Reprojection of column is not implemented. We can not change srid %(srid)s " +"to %(data)s" +msgstr "列的重投影未实现。我们不能将srid %(srid)s更改为%(data)s" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__request_encoding +msgid "Request encoding" +msgstr "请求编码" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__resolutions +msgid "Resolutions" +msgstr "分辨率" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__restricted_extent +msgid "Restricted map extent" +msgstr "限制地图范围" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_controller/geoengine_controller.xml:0 +#, python-format +msgid "Save" +msgstr "保存" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/records_panel/search_bar_records/search_bar_records.xml:0 +#: code:addons/base_geoengine/static/src/js/views/geoengine/records_panel/search_bar_records/search_bar_records.xml:0 +#: code:addons/base_geoengine/static/src/js/views/geoengine/records_panel/search_bar_records/search_bar_records.xml:0 +#, python-format +msgid "Search..." +msgstr "搜索..." + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__server_type +msgid "Server Type" +msgstr "服务器类型" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer_type__service +msgid "Service" +msgstr "服务" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__url +msgid "Service URL" +msgstr "服务URL" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/geo_convertion_helper.py:0 +#, python-format +msgid "Shapely or geojson are not available in the sys path" +msgstr "sys路径中不可用Shapely或geojson" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field_input/domain_selector_geo_field_input.esm.js:0 +#, python-format +msgid "Subdomain" +msgstr "子域名" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/geo_vector_layer.py:0 +#, python-format +msgid "The geo_field_id must be a field in %s model" +msgstr "geo_field_id 必须是 %s 模型中的一个字段" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__server_type +msgid "" +"The type of the remote WMS server: mapserver, geoserver, " +"carmentaserver, or qgis" +msgstr "远程 WMS 服务器的类型:mapserver、geoserver、carmentaserver 或 qgis" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_vector_layer__classification__unique +msgid "Unique value" +msgstr "唯一值" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__units +msgid "Units" +msgstr "单位" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_geoengine_raster_layer__use_to_edit +msgid "Use to edit" +msgstr "用于编辑" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_vector_view_form +msgid "Vector" +msgstr "矢量" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geoengine_view_form +msgid "Vector (Active layers)" +msgstr "矢量(活动图层)" + +#. module: base_geoengine +#: model:ir.actions.act_window,name:base_geoengine.geo_engine_view_raster_action +#: model:ir.actions.act_window,name:base_geoengine.geo_vector_geoengine_view_action +#: model:ir.model,name:base_geoengine.model_geoengine_vector_layer +msgid "Vector Layer" +msgstr "矢量图层" + +#. module: base_geoengine +#: model:ir.ui.menu,name:base_geoengine.geoengine_vector_layer_menu +msgid "Vector Layer Management" +msgstr "矢量图层管理" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__vector_layer_ids +msgid "Vector layers" +msgstr "矢量图层" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.xml:0 +#, python-format +msgid "Vectors" +msgstr "矢量数据" + +#. module: base_geoengine +#: model:ir.model,name:base_geoengine.model_ir_ui_view +msgid "View" +msgstr "视图" + +#. module: base_geoengine +#: model:ir.ui.menu,name:base_geoengine.geoengine_view_menu +msgid "View Management" +msgstr "视图管理" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_ui_view__type +msgid "View Type" +msgstr "视图类型" + +#. module: base_geoengine +#: model:ir.actions.act_window,name:base_geoengine.geo_engine_view_action +msgid "Views" +msgstr "视图" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "WMS options" +msgstr "WMS 选项" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__geoengine_raster_layer__raster_type__wmts +msgid "WMTS" +msgstr "WMTS" + +#. module: base_geoengine +#: model_terms:ir.ui.view,arch_db:base_geoengine.geo_raster_view_form +msgid "WMTS options" +msgstr "WMTS 选项" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_controller/geoengine_controller.esm.js:0 +#, python-format +msgid "Warning" +msgstr "警告" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/geo_convertion_helper.py:0 +#, python-format +msgid "" +"Write/create/search geo type must be wkt/geojson string or must respond to " +"wkt" +msgstr "写入/创建/搜索地理类型必须是 wkt/geojson 字符串或必须响应 wkt" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/views/geoengine/geoengine_controller/geoengine_controller.esm.js:0 +#, python-format +msgid "" +"You are about to create a new record without having displayed all the " +"others. A risk of overlap could occur. Would you like to continue ?" +msgstr "您即将创建一条新记录,而没有显示所有其他记录。可能会发生重叠的风险。您想要继" +"续吗?" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/base.py:0 +#, python-format +msgid "You must at least provide one of domain or geo_domain" +msgstr "您至少需要提供一个域名或地理域名" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/geo_vector_layer.py:0 +#, python-format +msgid "You need to provide an attribute that exists in %s model" +msgstr "您需要提供一个存在于 %s 模型中的属性" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/geo_vector_layer.py:0 +#, python-format +msgid "You need to select a numeric field" +msgstr "您需要选择一个数值字段" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__projection +msgid "eg. EPSG:21781" +msgstr "例如 EPSG:21781" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__request_encoding +msgid "eg. REST" +msgstr "例如 REST" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__units +msgid "eg. m" +msgstr "例如 m" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_raster_layer__format_suffix +msgid "eg. png" +msgstr "例如 png" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_contains" +msgstr "地理包含" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_equal" +msgstr "地理相等" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_greater" +msgstr "地理大于" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_intersect" +msgstr "地理相交" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_lesser" +msgstr "地理小于" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_line +msgid "geo_line" +msgstr "地理线" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_multi_line +msgid "geo_multi_line" +msgstr "地理多线" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_multi_point +msgid "geo_multi_point" +msgstr "地理多点" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_multi_polygon +msgid "geo_multi_polygon" +msgstr "地理多边形" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_point +msgid "geo_point" +msgstr "地理点" + +#. module: base_geoengine +#: model:ir.model.fields.selection,name:base_geoengine.selection__ir_model_fields__ttype__geo_polygon +msgid "geo_polygon" +msgstr "地理多边形" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/models/base.py:0 +#, python-format +msgid "geo_search is deprecated: uses search method defined on base model" +msgstr "geo_search 已弃用:使用在基础模型上定义的搜索方法" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_touch" +msgstr "地理接触" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js:0 +#, python-format +msgid "geo_within" +msgstr "地理包含" + +#. module: base_geoengine +#. odoo-python +#: code:addons/base_geoengine/fields.py:0 +#, python-format +msgid "" +"geometry_columns table seems to be corrupted. SRID check is not possible" +msgstr "geometry_columns 表似乎已损坏。无法进行 SRID 检查" + +#. module: base_geoengine +#: model:ir.model.fields,help:base_geoengine.field_geoengine_vector_layer__begin_color +#: model:ir.model.fields,help:base_geoengine.field_geoengine_vector_layer__end_color +msgid "hex value" +msgstr "十六进制值" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_number_field/domain_selector_number_field.esm.js:0 +#, python-format +msgid "in active_ids" +msgstr "在 active_ids 中" + +#. module: base_geoengine +#. odoo-javascript +#: code:addons/base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_number_field/domain_selector_number_field.esm.js:0 +#, python-format +msgid "not in active_ids" +msgstr "不在 active_ids 中" + +#. module: base_geoengine +#: model:ir.model.fields,field_description:base_geoengine.field_ir_model_fields__srid +msgid "srid" +msgstr "空间参考系统标识符" diff --git a/base_geoengine/images/map-hover.png b/base_geoengine/images/map-hover.png new file mode 100644 index 000000000..14799049f Binary files /dev/null and b/base_geoengine/images/map-hover.png differ diff --git a/base_geoengine/images/map.png b/base_geoengine/images/map.png new file mode 100644 index 000000000..17214344b Binary files /dev/null and b/base_geoengine/images/map.png differ diff --git a/base_geoengine/models/__init__.py b/base_geoengine/models/__init__.py new file mode 100644 index 000000000..7436a36f5 --- /dev/null +++ b/base_geoengine/models/__init__.py @@ -0,0 +1,26 @@ +############################################################################## +# +# Author: Nicolas Bessi +# Copyright 2011-2012 Camptocamp SA +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## +"""Module that manages map view and vector/raster layer""" + +from . import base +from . import geo_raster_layer +from . import geo_vector_layer +from . import ir_view +from . import ir_model diff --git a/base_geoengine/models/base.py b/base_geoengine/models/base.py new file mode 100644 index 000000000..3bbe96188 --- /dev/null +++ b/base_geoengine/models/base.py @@ -0,0 +1,177 @@ +# Copyright 2011-2012 Nicolas Bessi (Camptocamp SA) +# Copyright 2016 Yannick Payot (Camptocamp SA) +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +import logging + +from odoo import api, models +from odoo.exceptions import MissingError, UserError +from odoo.fields import Domain + +from .. import fields as geo_fields + +DEFAULT_EXTENT = "-123164.85222423, 5574694.9538936, 1578017.6490538, 6186191.1800898" + +_logger = logging.getLogger(__name__) + + +class Base(models.AbstractModel): + """Extend Base class for to allow definition of geo fields.""" + + _inherit = "base" + + # Array of ash that define layer and data to use + _georepr = [] + + @api.model + def fields_get(self, allfields=None, attributes=None): + """Add geo_type definition for geo fields""" + res = super().fields_get(allfields=allfields, attributes=attributes) + for f_name in res: + field = self._fields.get(f_name) + if field and field.type.startswith("geo_"): + geo_type = { + "type": field.type, + "dim": int(field.dim), + "srid": field.srid, + "geo_type": field.geo_type, + } + # TODO + if field.compute or field.related: + if not field.dim: + geo_type["dim"] = 2 + if not field.srid: + geo_type["srid"] = 3857 + res[f_name]["geo_type"] = geo_type + return res + + @api.model + def _get_geo_view(self): + IrView = self.env["ir.ui.view"] + geo_view = IrView.sudo().search( + [("model", "=", self._name), ("type", "=", "geoengine")], + limit=1, + ) + if not geo_view: + message = self.env._( + "No GeoEngine view defined for the model %s. \ + Please create a view or modify view mode" + ) + raise UserError( + message % self._name, + ) + return geo_view + + @api.model + def set_field_real_name(self, in_tuple): + field_obj = self.env["ir.model.fields"] + if not in_tuple: + return in_tuple + name = field_obj.browse(in_tuple[0]).name + out = (in_tuple[0], name, in_tuple[1]) + return out + + @api.model + def get_geoengine_layers(self, view_id=None, view_type="geoengine", **options): + view_obj = self.env["ir.ui.view"] + + if not view_id: + view = self._get_geo_view() + else: + view = view_obj.browse(view_id) + geoengine_layers = { + "backgrounds": [], + "actives": [], + "projection": view.projection, + "restricted_extent": view.restricted_extent, + "default_extent": view.default_extent or DEFAULT_EXTENT, + "default_zoom": view.default_zoom, + } + + for layer in view.raster_layer_ids: + layer_dict = layer.read()[0] + geoengine_layers["backgrounds"].append(layer_dict) + for layer in view.vector_layer_ids: + layer_dict = layer.read()[0] + layer_dict["attribute_field_id"] = self.set_field_real_name( + layer_dict.get("attribute_field_id", False) + ) + layer_dict["geo_field_id"] = self.set_field_real_name( + layer_dict.get("geo_field_id", False) + ) + layer_dict["resModel"] = layer._name + layer_dict["model"] = layer.model_id.model + layer_dict["model_domain"] = layer.model_domain + geoengine_layers["actives"].append(layer_dict) + return geoengine_layers + + @api.model + def get_edit_info_for_geo_column(self, column): + raster_obj = self.env["geoengine.raster.layer"] + + field = self._fields.get(column) + if not field or not isinstance(field, geo_fields.GeoField): + message = self.env._("%s column does not exists or is not a geo field") + raise ValueError(message % column) + view = self._get_geo_view() + raster = raster_obj.search( + [("view_id", "=", view.id), ("use_to_edit", "=", True)], limit=1 + ) + if not raster: + raster = raster_obj.search([("view_id", "=", view.id)], limit=1) + if not raster: + message = self.env._("No raster layer for view %s") + raise MissingError(message % (view.name,)) + return { + "edit_raster": raster.read()[0], + "srid": field.srid, + "projection": view.projection, + "restricted_extent": view.restricted_extent, + "default_extent": view.default_extent or DEFAULT_EXTENT, + "default_zoom": view.default_zoom, + } + + @api.model + def geo_search( + self, domain=None, geo_domain=None, offset=0, limit=None, order=None + ): + """Perform a geo search it allows direct domain: + geo_search( + domain=[('name', 'ilike', 'toto']), + geo_domain=[('the_point', 'geo_intersect', + myshaply_obj or mywkt or mygeojson)]) + + We can also support indirect geo_domain ( + ‘geom’, ‘geo_operator’, {‘res.zip.poly’: [‘id’, ‘in’, [1,2,3]] }) + + The supported operators are : + * geo_greater + * geo_lesser + * geo_equal + * geo_touch + * geo_within + * geo_contains + * geo_intersect""" + # First we do a standard search in order to apply security rules + # and do a search on standard attributes + # Limit and offset are managed after, we may loose a lot of performance + # here + _logger.debug( + self.env._( + "geo_search is deprecated: uses search method defined on base model" + ) + ) + domain = domain or [] + geo_domain = geo_domain or [] + search_domain = domain or [] + if domain and geo_domain: + search_domain = Domain.AND([domain, geo_domain]) + elif geo_domain: + search_domain = geo_domain + + if not search_domain: + raise ValueError( + self.env._("You must at least provide one of domain or geo_domain") + ) + + return self.search(search_domain, limit=limit, offset=offset, order=order) diff --git a/base_geoengine/models/geo_raster_layer.py b/base_geoengine/models/geo_raster_layer.py new file mode 100644 index 000000000..80b99a071 --- /dev/null +++ b/base_geoengine/models/geo_raster_layer.py @@ -0,0 +1,92 @@ +# Copyright 2011-2012 Nicolas Bessi (Camptocamp SA) +# Copyright 2016 Yannick Payot (Camptocamp SA) +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import api, fields, models + + +class GeoRasterLayerType(models.Model): + _name = "geoengine.raster.layer.type" + _description = "Raster Layer Type" + + name = fields.Char(translate=True, required=True) + code = fields.Char(required=True) + service = fields.Char(required=True) + + +class GeoRasterLayer(models.Model): + _name = "geoengine.raster.layer" + _description = "Raster Layer" + _order = "sequence ASC, name" + + raster_type = fields.Selection( + [ + ("osm", "OpenStreetMap"), + ("wmts", "WMTS"), + ("d_wms", "Distant WMS"), + ("odoo", "Odoo field"), + ], + string="Raster layer type", + default="osm", + required=True, + ) + name = fields.Char("Layer Name", translate=True, required=True) + url = fields.Char("Service URL") + + # technical field to display or not wmts options + is_wmts = fields.Boolean(compute="_compute_is_wmts") + # technical field to display or not wms options + is_wms = fields.Boolean(compute="_compute_is_wms") + # wmts options + matrix_set = fields.Char("Matrix set") + format_suffix = fields.Char("Format", help="eg. png") + request_encoding = fields.Char("Request encoding", help="eg. REST") + projection = fields.Char(help="eg. EPSG:21781") + units = fields.Char(help="eg. m") # Not used + resolutions = fields.Char() + max_extent = fields.Char("Max extent") + dimensions = fields.Char(help="List of dimensions separated by ','") + params = fields.Char(help="Dictiorary of values for dimensions as JSON") + + # wms options + params_wms = fields.Char( + "Params WMS", help="Need to provide at least a LAYERS param" + ) + server_type = fields.Char( + help="The type of the remote WMS server: mapserver, \ + geoserver, carmentaserver, or qgis", + ) + + # technical field to display or not layer type -- Not used + has_type = fields.Boolean(compute="_compute_has_type") + type_id = fields.Many2one( + "geoengine.raster.layer.type", "Layer", domain="[('service', '=', raster_type)]" + ) + type = fields.Char(related="type_id.code") + sequence = fields.Integer("Layer priority", default=6) + overlay = fields.Boolean("Is overlay layer?") + field_id = fields.Many2one( + "ir.model.fields", + "Odoo layer field to use", + domain=[("ttype", "ilike", "geo_"), ("model", "=", "view_id.model")], + ) + view_id = fields.Many2one( + "ir.ui.view", "Related View", domain=[("type", "=", "geoengine")], required=True + ) + use_to_edit = fields.Boolean("Use to edit") + opacity = fields.Float(default=1.0) + + @api.depends("raster_type", "is_wmts") + def _compute_has_type(self): + for rec in self: + rec.has_type = rec.raster_type == "is_wmts" + + @api.depends("raster_type") + def _compute_is_wmts(self): + for rec in self: + rec.is_wmts = rec.raster_type == "wmts" + + @api.depends("raster_type") + def _compute_is_wms(self): + for rec in self: + rec.is_wms = rec.raster_type == "d_wms" diff --git a/base_geoengine/models/geo_vector_layer.py b/base_geoengine/models/geo_vector_layer.py new file mode 100644 index 000000000..b0cc6cdf1 --- /dev/null +++ b/base_geoengine/models/geo_vector_layer.py @@ -0,0 +1,172 @@ +# Copyright 2011-2012 Nicolas Bessi (Camptocamp SA) +# Copyright 2016 Yannick Payot (Camptocamp SA) +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models +from odoo.exceptions import ValidationError + +SUPPORTED_ATT = [ + "float", + "integer", + "integer_big", + "related", + "function", + "date", + "datetime", + "char", + "text", + "selection", +] + +NUMBER_ATT = ["float", "integer", "integer_big"] + + +class GeoVectorLayer(models.Model): + _name = "geoengine.vector.layer" + _description = "Vector Layer" + _order = "sequence ASC, name" + + geo_repr = fields.Selection( + [ + ("basic", "Basic"), + # Actually we have to think if we should separate it for colored + ("proportion", "Proportional Symbol"), + ("colored", "Colored range/Chroma.js"), + ], + string="Representation mode", + required=True, + ) + + classification = fields.Selection( + [ + ("unique", "Unique value"), + ("interval", "Interval"), + ("quantile", "Quantile"), + ("custom", "Custom"), + ], + string="Classification mode", + required=False, + ) + name = fields.Char("Layer Name", translate=True, required=True) + begin_color = fields.Char("Begin color class", required=False, help="hex value") + end_color = fields.Char( + "End color class", required=False, help="hex value", default="#FF680A" + ) + nb_class = fields.Integer("Number of class", default=1) + geo_field_id = fields.Many2one( + "ir.model.fields", + "Geo field", + required=True, + ondelete="cascade", + domain=[("ttype", "ilike", "geo_")], + ) + + attribute_field_id_domain = fields.Binary( + compute="_compute_attribute_field_id_domain", readonly=True, store=False + ) + attribute_field_id = fields.Many2one("ir.model.fields", "Attribute field") + + model_id = fields.Many2one( + "ir.model", + "Model to use", + store=True, + readonly=False, + compute="_compute_model_id", + ) + model_name = fields.Char(related="model_id.model", readonly=True) + + view_id = fields.Many2one( + "ir.ui.view", "Related View", domain=[("type", "=", "geoengine")], required=True + ) + sequence = fields.Integer("Layer Priority", default=6) + readonly = fields.Boolean("Layer is read only") + display_polygon_labels = fields.Boolean("Display Labels on Polygon") + active_on_startup = fields.Boolean( + help="Layer will be shown on startup if checked." + ) + layer_opacity = fields.Float(default=1.0) + model_domain = fields.Char(default="[]") + model_view_id = fields.Many2one( + "ir.ui.view", + "Model view", + domain=[("type", "=", "geoengine")], + compute="_compute_model_view_id", + readonly=False, + ) + layer_transparent = fields.Boolean() + + @api.constrains("geo_field_id", "model_id") + def _check_geo_field_id(self): + for rec in self: + if rec.model_id: + if not rec.geo_field_id.model_id == rec.model_id: + raise ValidationError( + self.env._( + "The geo_field_id must be a field in %s model", + rec.model_id.display_name, + ) + ) + + @api.constrains("geo_repr", "attribute_field_id") + def _check_geo_repr(self): + for rec in self: + if ( + rec.attribute_field_id + and rec.attribute_field_id.ttype not in NUMBER_ATT + ): + if ( + rec.geo_repr == "colored" + and rec.classification != "unique" + or rec.geo_repr == "proportion" + ): + raise ValidationError( + self.env._( + "You need to select a numeric field", + ) + ) + + @api.constrains("attribute_field_id", "geo_field_id") + def _check_if_attribute_in_geo_field(self): + for rec in self: + if rec.attribute_field_id and rec.geo_field_id: + if rec.attribute_field_id.model != rec.geo_field_id.model: + raise ValidationError( + self.env._( + "You need to provide an attribute that exists in %s model", + rec.geo_field_id.model_id.display_name, + ) + ) + + @api.depends("model_id") + def _compute_model_view_id(self): + for rec in self: + if rec.model_id: + for view in rec.model_id.view_ids: + if view.type == "geoengine": + rec.model_view_id = view + else: + rec.model_view_id = "" + + @api.depends("geo_field_id", "view_id") + def _compute_model_id(self): + for rec in self: + if rec.view_id and rec.geo_field_id: + if rec.view_id.model != rec.geo_field_id.model: + rec.model_id = rec.geo_field_id.model_id + else: + rec.model_id = "" + else: + rec.model_id = "" + + @api.depends("geo_field_id") + def _compute_attribute_field_id_domain(self): + for rec in self: + rec.attribute_field_id_domain = ( + [ + ("ttype", "in", SUPPORTED_ATT), + ("model", "=", rec.geo_field_id.model_id.model), + ] + if rec.geo_field_id + else [("ttype", "in", SUPPORTED_ATT)] + ) diff --git a/base_geoengine/models/ir_model.py b/base_geoengine/models/ir_model.py new file mode 100644 index 000000000..ba3f44218 --- /dev/null +++ b/base_geoengine/models/ir_model.py @@ -0,0 +1,51 @@ +# Copyright 2011-2012 Nicolas Bessi (Camptocamp SA) +# Copyright 2023 Yannick Payot (Camptocamp SA) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import fields, models + +from odoo.addons import base + +if "geoengine" not in base.models.ir_actions.VIEW_TYPES: + base.models.ir_actions.VIEW_TYPES.append(("geoengine", "Geoengine")) + +GEO_TYPES = [ + ("geo_polygon", "geo_polygon"), + ("geo_multi_polygon", "geo_multi_polygon"), + ("geo_point", "geo_point"), + ("geo_multi_point", "geo_multi_point"), + ("geo_line", "geo_line"), + ("geo_multi_line", "geo_multi_line"), +] + +GEO_TYPES_ONDELETE = { + "geo_polygon": "cascade", + "geo_multi_polygon": "cascade", + "geo_point": "cascade", + "geo_multi_point": "cascade", + "geo_line": "cascade", + "geo_multi_line": "cascade", +} + +POSTGIS_GEO_TYPES = [ + ("Point", "Point"), + ("MultiPoint", "MultiPoint"), + ("LineString", "LineString"), + ("MultiLineString", "MultiLineString"), + ("Polygon", "Polygon"), + ("MultiPolygon", "MultiPolygon"), +] + + +class IrModelField(models.Model): + _inherit = "ir.model.fields" + + srid = fields.Integer("srid", required=False) + geo_type = fields.Selection(POSTGIS_GEO_TYPES, string="PostGIs type") + dim = fields.Selection( + [("2", "2"), ("3", "3"), ("4", "4")], string="PostGIs Dimension", default="2" + ) + gist_index = fields.Boolean("Create gist index") + ttype = fields.Selection( + selection_add=GEO_TYPES, + ondelete=GEO_TYPES_ONDELETE, + ) diff --git a/base_geoengine/models/ir_view.py b/base_geoengine/models/ir_view.py new file mode 100644 index 000000000..aaec60ac7 --- /dev/null +++ b/base_geoengine/models/ir_view.py @@ -0,0 +1,39 @@ +# Copyright 2011-2012 Nicolas Bessi (Camptocamp SA) +# Copyright 2016-2023 Yannick Payot (Camptocamp SA) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import fields, models + + +class IrUIView(models.Model): + _inherit = "ir.ui.view" + + type = fields.Selection( + selection_add=[("geoengine", "GeoEngine")], + ondelete={"geoengine": "cascade"}, + ) + + raster_layer_ids = fields.One2many( + "geoengine.raster.layer", "view_id", "Raster layers", required=False + ) + + vector_layer_ids = fields.One2many( + "geoengine.vector.layer", "view_id", "Vector layers", required=True + ) + + projection = fields.Char(default="EPSG:3857", required=True) + default_extent = fields.Char( + "Default map extent", + default="-123164.85222423, 5574694.9538936, 1578017.6490538, 6186191.1800898", + ) + default_zoom = fields.Integer("Default map zoom") + restricted_extent = fields.Char("Restricted map extent") + + def _is_qweb_based_view(self, view_type): + if view_type == "geoengine": + return True + return super()._is_qweb_based_view(view_type) + + def _get_view_info(self): + res = super()._get_view_info() + res.update({"geoengine": {"icon": "fa fa-globe"}}) + return res diff --git a/base_geoengine/pyproject.toml b/base_geoengine/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/base_geoengine/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/base_geoengine/readme/CONTRIBUTORS.md b/base_geoengine/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..7313dd40f --- /dev/null +++ b/base_geoengine/readme/CONTRIBUTORS.md @@ -0,0 +1,25 @@ +- Nicolas Bessi \<\> +- Frederic Junod \<\> +- Yannick Payot \<\> +- Sandy Carter \<\> +- Laurent Mignon \<\> +- Jonathan Nemry \<\> +- David Lasley \<\> +- Daniel Reis \<\> +- Matthieu Dietrich \<\> +- Alan Ramos \<\> +- Damien Crier \<\> +- Cyril Gaudin \<\> +- Pierre Verkest \<\> +- Benjamin Willig \<\> +- Devendra Kavthekar \<\> +- Emanuel Cino \<\> +- Thomas Nowicki \<\> +- Alexandre Saunier \<\> +- Sandip Mangukiya \<\> +- Samuel Kouff \<\> +- [APSL-Nagarro](https://www.apsl.tech): + - Antoni Marroig \<\> + - Miquel Alzanillas \<\> +- Red Butay \<\> +- Sergio Sancho \<\> diff --git a/base_geoengine/readme/DESCRIPTION.md b/base_geoengine/readme/DESCRIPTION.md new file mode 100644 index 000000000..3af0efdc1 --- /dev/null +++ b/base_geoengine/readme/DESCRIPTION.md @@ -0,0 +1,16 @@ +GeoEngine is an Odoo module that adds spatial/GIS capabilites to Odoo. +It will allow you to : + +- Visualize and query your business information on map +- Perform GeoBI and spatial query +- Configure your spatial layers and spatial datasources +- Extend Odoo models with spatial columns + +GeoEngine relies on [OpenLayers](http://openlayers.org) and +[PostgGIS](http://postgis.refractions.net/) technologies. + +Postgis is used to store spatial information in databases. OpenLayer is +used to represent spatial data in other words to show maps and the +different spatial layers. The GeoEngine module acts as a data provider +and as an OpenLayers configurator. It also provides a complete extension +to Odoo ORM. diff --git a/base_geoengine/readme/HISTORY.md b/base_geoengine/readme/HISTORY.md new file mode 100644 index 000000000..77872b7ff --- /dev/null +++ b/base_geoengine/readme/HISTORY.md @@ -0,0 +1,123 @@ +## 16.0.1.0.0 (2023-03-20) + +- LayerSwitcher has been removed as it was not really practical. A + LayerPanel is now active. +- The geo_search method is now deprecated and replaced by the standard + odoo search method. +- The widget "geo_edit_map" attribute is no longer necessary as the + field is automatically detected by his type. We can also provide an + option attribute that allows us to pass an opacity and a color as + parameters. + +``` xml +
+ + + + + +
+``` + +- The method geo_search is now deprecated. We now need to use the + standard odoo search method. + +``` python +obj.search([("the_point","geo_intersect",{"dummy.zip.the_geom": [("id", "=", rec.id)]})]) +``` + +- We can now pass to the geoengine view a template to display the + information we want to see when clicking on a feature. + +``` xml + + + + + + + + +
    +
  • ZIP : +
  • +
  • Total Sales: +
  • +
+
+
+
+``` + +- We can now pass a model to use to a layer to display other information + on the map. + +``` xml + + + [('state', '=', 'hs')] + + HS retail machines + + basic + + #FF0000 + + 0.8 + +``` + +- There is some new features in the LayerPanel. + +1. If you are logged in as an admin, you have the possibility to edit + the layer by clicking on the edit button. This will open a dialog + box. Changes will appear in real time on the view. +2. If you are logged in as an admin, you can also change the domain of + the layer. If you are logged in as a user, changes will not be + persisted in the database. Changes will appear in real time on the + view. +3. If you are logged in as an admin, you can also change the sequence + of the layers by sliding them over each other. If you are logged in + as a user, changes will not be persisted in the database. + +- Widget domain is now implemented for geo field This means that the + geo-operators are also implemented and that there is the possibility + to add a sub-domain. If we want to add a domain that includes all the + records that are displayed in the geoengine view (active_ids). We can + use the two new operators : "in active_ids" and "not in active_ids". + These will automatically replace the marker with ids. Note that the + widget will indicate that the domain is invalid because of the marker. +- Creation of the RecordsPanel. This panel allows you to retrieve all + active records. You can click on record to get the movement to the + selected record. Two magnifying glass are also available. You can + click on the left one to zoom on the record. You can click on the + right one to get the original zoom. +- A search bar is also available. It allows you to perform a search into + the RecordsPanel. +- A button to open/close the panels is also available. +- The module has been translated in French. +- Now you can now make the geoengine view editable. Simply add editable + attribute in the geoengine view. + +``` xml + + + + + + + + + +
    +
  • ZIP : +
  • +
  • Total Sales: +
  • +
+
+
+
+ +Thanks to that, you can create new records by drawing them directly in the geoengine view. You can also edit record in the same view. +``` diff --git a/base_geoengine/readme/INSTALL.md b/base_geoengine/readme/INSTALL.md new file mode 100644 index 000000000..c72a805b7 --- /dev/null +++ b/base_geoengine/readme/INSTALL.md @@ -0,0 +1,19 @@ +To install this module, you need to have [PostGIS](http://postgis.net/) +installed. + +On Ubuntu: + + .. code-block:: bash + +> sudo apt-get install postgis + +The module also requires two additional python libs: + +- [Shapely](http://pypi.python.org/pypi/Shapely) +- [geojson](http://pypi.python.org/pypi/geojson) + +When you will install the module this two additional libs will be +installed. + +For a complete documentation please refer to the [public +documenation](http://oca.github.io/geospatial/index.html) diff --git a/base_geoengine/readme/ROADMAP.md b/base_geoengine/readme/ROADMAP.md new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/base_geoengine/readme/ROADMAP.md @@ -0,0 +1 @@ + diff --git a/base_geoengine/readme/USAGE.md b/base_geoengine/readme/USAGE.md new file mode 100644 index 000000000..6ddda6d33 --- /dev/null +++ b/base_geoengine/readme/USAGE.md @@ -0,0 +1,80 @@ +## Geoengine Demo + +1. As a user/admin, when I am in the Geoengine Demo module and I go to + the ZIP menu. When I click on an item in the list view, I get to the + form view showing me the different information about the ZIP. We can + see its ZIP, city, priority, total sales and his spatial + representation. +2. As a user, I can't modify the information in the form view. +3. As an admin, I can modify the information in the form view. I can + click on the bin button to clear the map and I can draw a new shape. +4. As a user, when I go the "Retail machines" tab and there are no + items to display, it does not show me anything. +5. As an admin, when I go the "Retail machines" tab and there are no + items to display, the list view of the retail machines suggests to + me to add a new line. +6. As a user/admin, if there are items to be displayed in the "Retail + machines" tab then I can click on an item and the retail machines + form view will be displayed. We can see its spatial representation + by going to "The point" tab and its attributes in "Attributes" tab. +7. As a user/admin, when I go to the geoengine zip view by clicking on + the map button at the top right of the screen. The geoengine view + appears with the first 80 results displayed on the map. The vector + layers selected are those defined as "active on startup" by the + admin. The selected raster layer is the first one that is not an + overlay layer. +8. As a user/admin, when I hover over an area on the map, the area + changes its style. +9. As a user/admin, when I click on an area, a popup appears an I can + see the different information about the area. If I click on the + cross, the popup will disappear. If I click somewhere else on the + map, the popup will also disappear. If I click on the about button, + then the form view will be displayed. +10. As a user/admin, when I use the paging system, then the results + displayed on the map are different (corresponding to the request). +11. As a user/admin, if we use the search bar, we can search results by + his zip or his city. +12. As an admin, if I change the sequence of layers with the handle + button then the change are persisted in database. +13. As a user, if I change the sequence of layers with the handle button + then the change are not persisted in database. There are just the + changes in the display. +14. As an admin, if I change the domain of a layer with the filter + button then the change are persisted in database. +15. As a user, if I change the domain of a layer with the filter button + then the change are not persisted in database. There are just the + changes in the display. +16. As an admin, I have the possibility to edit the layer with its + corresponding button. +17. As a user/admin, I can open/close LayerPanel with its button. +18. As a user/admin, I can open/close RecordsPanel with its button. +19. As a user/admin, when I click on a record in RecordsPanel, a move is + made on the map to the selected record. +20. As a user/admin, when I click on a record in RecordsPanel, I can + also click on the left magnifying glass to zoom on the record. +21. As a user/admin, when I click on a record in RecordsPanel, I can + also click on the right magnifying glass to get the original zoom. +22. As a user/admin, I can use the search bar to search in the + RecordsPanel. +23. As an admin,If the geoengine view is in edit mode, I can create new + records by drawing them in the view. +24. As an admin, If the geoengine view is in edit mode, I can modify its + spatial representation. + +## Geoengine Backend + +1. As an admin, if I go into the configuration of the raster layers and + it has elements, I can click on one and see its information. +2. As an admin, if I want to create a new raster layer, I can click on + "NEW" and fill out the form. The required fields for OpenStreetMap + type are "Layer Name" and "Related View". If we want to have a WMTS + (Web Map Tile Service) raster type. The required fields in addition + to the precedents are "Service URL", "Matrix set","Format", + "Projection" and "Resolutions". If we take WMS (Web Map Service) + raster type, then the required fields are "Layer Name", "Related + View", "Service URL", "Params", "Server Type". +3. As an admin,if I go into the configuration of the vector layers and + it has elements, I can click on one and see its information. +4. As an admin, if I want to create a new vector layer, I can click on + "NEW" and fill out the form. The required fields are "Layer Name", + "Related View", "Geo field" and "Representation mode". diff --git a/base_geoengine/security/data.xml b/base_geoengine/security/data.xml new file mode 100644 index 000000000..f14235ee3 --- /dev/null +++ b/base_geoengine/security/data.xml @@ -0,0 +1,20 @@ + + + + Geoengine User + + + + Geoengine Admin + + + + + + + + + + + + diff --git a/base_geoengine/security/ir.model.access.csv b/base_geoengine/security/ir.model.access.csv new file mode 100644 index 000000000..44559f50e --- /dev/null +++ b/base_geoengine/security/ir.model.access.csv @@ -0,0 +1,9 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_geo_user_vector_user,geoengine.user.vector.layer,base_geoengine.model_geoengine_vector_layer,base_geoengine.group_geoengine_user,1,0,0,0 +access_geo_admin_vector_user,geoengine.admin.vector.layer,base_geoengine.model_geoengine_vector_layer,base_geoengine.group_geoengine_admin,1,1,1,1 +access_geo_user_raster_user,geoengine.user.raster.layer,base_geoengine.model_geoengine_raster_layer,base_geoengine.group_geoengine_user,1,0,0,0 +access_geo_admin_raster_user,geoengine.admin.raster.layer,base_geoengine.model_geoengine_raster_layer,base_geoengine.group_geoengine_admin,1,1,1,1 +access_geo_user_raster_type_user,geoengine.user.raster.layer.type,base_geoengine.model_geoengine_raster_layer_type,base_geoengine.group_geoengine_user,1,0,0,0 +access_geo_admin_raster_type_user,geoengine.admin.raster.layer.type,base_geoengine.model_geoengine_raster_layer_type,base_geoengine.group_geoengine_admin,1,1,1,1 +access_geo_user_allmodels,ir.model,base.model_ir_model,base_geoengine.group_geoengine_user,1,0,0,0 +access_geo_user_allviews,ir.ui.view,base.model_ir_ui_view,base_geoengine.group_geoengine_user,1,0,0,0 diff --git a/base_geoengine/static/description/icon.png b/base_geoengine/static/description/icon.png new file mode 100644 index 000000000..b698310ee Binary files /dev/null and b/base_geoengine/static/description/icon.png differ diff --git a/base_geoengine/static/description/index.html b/base_geoengine/static/description/index.html new file mode 100644 index 000000000..03fc525c3 --- /dev/null +++ b/base_geoengine/static/description/index.html @@ -0,0 +1,723 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

Geospatial support for Odoo

+ +

Beta License: AGPL-3 OCA/geospatial Translate me on Weblate Try me on Runboat

+

GeoEngine is an Odoo module that adds spatial/GIS capabilites to Odoo. +It will allow you to :

+
    +
  • Visualize and query your business information on map
  • +
  • Perform GeoBI and spatial query
  • +
  • Configure your spatial layers and spatial datasources
  • +
  • Extend Odoo models with spatial columns
  • +
+

GeoEngine relies on OpenLayers and +PostgGIS technologies.

+

Postgis is used to store spatial information in databases. OpenLayer is +used to represent spatial data in other words to show maps and the +different spatial layers. The GeoEngine module acts as a data provider +and as an OpenLayers configurator. It also provides a complete extension +to Odoo ORM.

+

Table of contents

+ +
+

Installation

+

To install this module, you need to have +PostGIS installed.

+

On Ubuntu:

+
+.. code-block:: bash
+
+ +
+sudo apt-get install postgis
+

The module also requires two additional python libs:

+ +

When you will install the module this two additional libs will be +installed.

+

For a complete documentation please refer to the public +documenation

+
+
+

Usage

+
+

Geoengine Demo

+
    +
  1. As a user/admin, when I am in the Geoengine Demo module and I go to +the ZIP menu. When I click on an item in the list view, I get to the +form view showing me the different information about the ZIP. We can +see its ZIP, city, priority, total sales and his spatial +representation.
  2. +
  3. As a user, I can’t modify the information in the form view.
  4. +
  5. As an admin, I can modify the information in the form view. I can +click on the bin button to clear the map and I can draw a new shape.
  6. +
  7. As a user, when I go the “Retail machines” tab and there are no +items to display, it does not show me anything.
  8. +
  9. As an admin, when I go the “Retail machines” tab and there are no +items to display, the list view of the retail machines suggests to +me to add a new line.
  10. +
  11. As a user/admin, if there are items to be displayed in the “Retail +machines” tab then I can click on an item and the retail machines +form view will be displayed. We can see its spatial representation +by going to “The point” tab and its attributes in “Attributes” tab.
  12. +
  13. As a user/admin, when I go to the geoengine zip view by clicking on +the map button at the top right of the screen. The geoengine view +appears with the first 80 results displayed on the map. The vector +layers selected are those defined as “active on startup” by the +admin. The selected raster layer is the first one that is not an +overlay layer.
  14. +
  15. As a user/admin, when I hover over an area on the map, the area +changes its style.
  16. +
  17. As a user/admin, when I click on an area, a popup appears an I can +see the different information about the area. If I click on the +cross, the popup will disappear. If I click somewhere else on the +map, the popup will also disappear. If I click on the about button, +then the form view will be displayed.
  18. +
  19. As a user/admin, when I use the paging system, then the results +displayed on the map are different (corresponding to the request).
  20. +
  21. As a user/admin, if we use the search bar, we can search results by +his zip or his city.
  22. +
  23. As an admin, if I change the sequence of layers with the handle +button then the change are persisted in database.
  24. +
  25. As a user, if I change the sequence of layers with the handle button +then the change are not persisted in database. There are just the +changes in the display.
  26. +
  27. As an admin, if I change the domain of a layer with the filter +button then the change are persisted in database.
  28. +
  29. As a user, if I change the domain of a layer with the filter button +then the change are not persisted in database. There are just the +changes in the display.
  30. +
  31. As an admin, I have the possibility to edit the layer with its +corresponding button.
  32. +
  33. As a user/admin, I can open/close LayerPanel with its button.
  34. +
  35. As a user/admin, I can open/close RecordsPanel with its button.
  36. +
  37. As a user/admin, when I click on a record in RecordsPanel, a move is +made on the map to the selected record.
  38. +
  39. As a user/admin, when I click on a record in RecordsPanel, I can +also click on the left magnifying glass to zoom on the record.
  40. +
  41. As a user/admin, when I click on a record in RecordsPanel, I can +also click on the right magnifying glass to get the original zoom.
  42. +
  43. As a user/admin, I can use the search bar to search in the +RecordsPanel.
  44. +
  45. As an admin,If the geoengine view is in edit mode, I can create new +records by drawing them in the view.
  46. +
  47. As an admin, If the geoengine view is in edit mode, I can modify its +spatial representation.
  48. +
+
+
+

Geoengine Backend

+
    +
  1. As an admin, if I go into the configuration of the raster layers and +it has elements, I can click on one and see its information.
  2. +
  3. As an admin, if I want to create a new raster layer, I can click on +“NEW” and fill out the form. The required fields for OpenStreetMap +type are “Layer Name” and “Related View”. If we want to have a WMTS +(Web Map Tile Service) raster type. The required fields in addition +to the precedents are “Service URL”, “Matrix set”,”Format”, +“Projection” and “Resolutions”. If we take WMS (Web Map Service) +raster type, then the required fields are “Layer Name”, “Related +View”, “Service URL”, “Params”, “Server Type”.
  4. +
  5. As an admin,if I go into the configuration of the vector layers and +it has elements, I can click on one and see its information.
  6. +
  7. As an admin, if I want to create a new vector layer, I can click on +“NEW” and fill out the form. The required fields are “Layer Name”, +“Related View”, “Geo field” and “Representation mode”.
  8. +
+
+
+ +
+

Changelog

+
+

16.0.1.0.0 (2023-03-20)

+
    +
  • LayerSwitcher has been removed as it was not really practical. A +LayerPanel is now active.
  • +
  • The geo_search method is now deprecated and replaced by the standard +odoo search method.
  • +
  • The widget “geo_edit_map” attribute is no longer necessary as the +field is automatically detected by his type. We can also provide an +option attribute that allows us to pass an opacity and a color as +parameters.
  • +
+
+<form>
+    <notebook colspan="4">
+        <page string="Geometry">
+            <field name="the_geom" options="{'opacity': 0.8, 'color': '#0000FF' }" />
+        </page>
+    </notebook>
+</form>
+
+
    +
  • The method geo_search is now deprecated. We now need to use the +standard odoo search method.
  • +
+
+obj.search([("the_point","geo_intersect",{"dummy.zip.the_geom": [("id", "=", rec.id)]})])
+
+
    +
  • We can now pass to the geoengine view a template to display the +information we want to see when clicking on a feature.
  • +
+
+<geoengine>
+    <field name="name" />
+    <field name="city" />
+    <field name="total_sales" />
+    <field name="the_geom" />
+    <templates>
+        <t t-name="info_box">
+            <field name="city" widget="badge" />
+            <ul>
+                <li>ZIP : <field name="name" />
+                </li>
+                <li>Total Sales: <field name="total_sales" />
+                </li>
+            </ul>
+        </t>
+    </templates>
+</geoengine>
+
+
    +
  • We can now pass a model to use to a layer to display other information +on the map.
  • +
+
+<record id="geoengine_vector_layer_hs_retail_machines" model="geoengine.vector.layer">
+    <field name="model_id" ref="base_geoengine_demo.model_geoengine_demo_automatic_retailing_machine"/>
+    <field name="model_domain">[('state', '=', 'hs')]</field>
+    <field name="geo_field_id" ref="base_geoengine_demo.field_geoengine_demo_automatic_retailing_machine__the_point"/>
+    <field name="name">HS retail machines</field>
+    <field name="view_id" ref="ir_ui_view_resbetterzipgeoview0" />
+    <field name="geo_repr">basic</field>
+    <field name="attribute_field_id" ref="base_geoengine_demo.field_geoengine_demo_automatic_retailing_machine__name"/>
+    <field name="begin_color">#FF0000</field>
+    <field name="display_polygon_labels" eval="0" />
+    <field name="layer_opacity">0.8</field>
+</record>
+
+
    +
  • There is some new features in the LayerPanel.
  • +
+
    +
  1. If you are logged in as an admin, you have the possibility to edit +the layer by clicking on the edit button. This will open a dialog +box. Changes will appear in real time on the view.
  2. +
  3. If you are logged in as an admin, you can also change the domain of +the layer. If you are logged in as a user, changes will not be +persisted in the database. Changes will appear in real time on the +view.
  4. +
  5. If you are logged in as an admin, you can also change the sequence of +the layers by sliding them over each other. If you are logged in as a +user, changes will not be persisted in the database.
  6. +
+
    +
  • Widget domain is now implemented for geo field This means that the +geo-operators are also implemented and that there is the possibility +to add a sub-domain. If we want to add a domain that includes all the +records that are displayed in the geoengine view (active_ids). We can +use the two new operators : “in active_ids” and “not in active_ids”. +These will automatically replace the marker with ids. Note that the +widget will indicate that the domain is invalid because of the marker.
  • +
  • Creation of the RecordsPanel. This panel allows you to retrieve all +active records. You can click on record to get the movement to the +selected record. Two magnifying glass are also available. You can +click on the left one to zoom on the record. You can click on the +right one to get the original zoom.
  • +
  • A search bar is also available. It allows you to perform a search into +the RecordsPanel.
  • +
  • A button to open/close the panels is also available.
  • +
  • The module has been translated in French.
  • +
  • Now you can now make the geoengine view editable. Simply add editable +attribute in the geoengine view.
  • +
+
+<geoengine editable="1">
+    <field name="name" />
+    <field name="city" />
+    <field name="total_sales" />
+    <field name="the_geom" />
+    <field name="display_name" />
+    <templates>
+      <t t-name="info_box">
+        <field name="city" widget="badge" />
+        <ul>
+          <li>ZIP : <field name="name" />
+          </li>
+          <li>Total Sales: <field name="total_sales" />
+          </li>
+        </ul>
+      </t>
+    </templates>
+  </geoengine>
+
+Thanks to that, you can create new records by drawing them directly in the geoengine view. You can also edit record in the same view.
+
+
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Camptocamp
  • +
  • ACSONE SA/NV
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/geospatial project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+
+ + diff --git a/base_geoengine/static/img/map-marker.png b/base_geoengine/static/img/map-marker.png new file mode 100644 index 000000000..096893583 Binary files /dev/null and b/base_geoengine/static/img/map-marker.png differ diff --git a/base_geoengine/static/lib/chromajs-3.2.0/LICENSE b/base_geoengine/static/lib/chromajs-3.2.0/LICENSE new file mode 100644 index 000000000..229c24a90 --- /dev/null +++ b/base_geoengine/static/lib/chromajs-3.2.0/LICENSE @@ -0,0 +1,54 @@ +chroma.js - JavaScript library for color conversions + +Copyright (c) 2011-2025, Gregor Aisch +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. The name Gregor Aisch may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL GREGOR AISCH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------------------------------------------- + +chroma.js includes colors from colorbrewer2.org, which are released under +the following license: + +Copyright (c) 2002 Cynthia Brewer, Mark Harrower, +and The Pennsylvania State University. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +either express or implied. See the License for the specific +language governing permissions and limitations under the License. + +------------------------------------------------------ + +Named colors are taken from X11 Color Names. +http://www.w3.org/TR/css3-color/#svg-color + +@preserve diff --git a/base_geoengine/static/lib/chromajs-3.2.0/chroma.js b/base_geoengine/static/lib/chromajs-3.2.0/chroma.js new file mode 100644 index 000000000..cc687c83e --- /dev/null +++ b/base_geoengine/static/lib/chromajs-3.2.0/chroma.js @@ -0,0 +1,72 @@ +/** + * chroma.js - JavaScript library for color conversions + * + * Copyright (c) 2011-2025, Gregor Aisch + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. The name Gregor Aisch may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL GREGOR AISCH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ------------------------------------------------------- + * + * chroma.js includes colors from colorbrewer2.org, which are released under + * the following license: + * + * Copyright (c) 2002 Cynthia Brewer, Mark Harrower, + * and The Pennsylvania State University. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the License. + * + * ------------------------------------------------------ + * + * Named colors are taken from X11 Color Names. + * http://www.w3.org/TR/css3-color/#svg-color + * + * @preserve + */ + +!function(r,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(r="undefined"!=typeof globalThis?globalThis:r||self).chroma=n()}(this,(function(){"use strict";var r=Math.min,n=Math.max;function e(e,t,a){return void 0===t&&(t=0),void 0===a&&(a=1),r(n(t,e),a)}function t(r){r._clipped=!1,r._unclipped=r.slice(0);for(var n=0;n<=3;n++)n<3?((r[n]<0||r[n]>255)&&(r._clipped=!0),r[n]=e(r[n],0,255)):3===n&&(r[n]=e(r[n],0,1));return r}for(var a={},f=0,o=["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"];f=3?Array.prototype.slice.call(r):"object"==c(r[0])&&n?n.split("").filter((function(n){return void 0!==r[0][n]})).map((function(n){return r[0][n]})):r[0].slice(0)}function l(r){if(r.length<2)return null;var n=r.length-1;return"string"==c(r[n])?r[n].toLowerCase():null}var h=Math.PI,s=Math.min,d=Math.max,b=function(r){return Math.round(100*r)/100},g=function(r){return Math.round(100*r)/100},v=2*h,p=h/3,m=h/180,y=180/h;function w(r){return r.slice(0,3).reverse().concat(r.slice(3))}var k={format:{},autodetect:[]},M=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=this;if("object"===c(r[0])&&r[0].constructor&&r[0].constructor===this.constructor)return r[0];var a=l(r),f=!1;if(!a){f=!0,k.sorted||(k.autodetect=k.autodetect.sort((function(r,n){return n.p-r.p})),k.sorted=!0);for(var o=0,u=k.autodetect;o4?r[4]:1;return 1===f?[0,0,0,o]:[e>=1?0:255*(1-e)*(1-f),t>=1?0:255*(1-t)*(1-f),a>=1?0:255*(1-a)*(1-f),o]},k.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if("array"===c(r=i(r,"cmyk"))&&4===r.length)return"cmyk"}});var A=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t,a=(r=i(r,"rgba"))[0],f=r[1],o=r[2],u=s(a/=255,f/=255,o/=255),c=d(a,f,o),l=(c+u)/2;return c===u?(e=0,t=Number.NaN):e=l<.5?(c-u)/(c+u):(c-u)/(2-c-u),a==c?t=(f-o)/(c-u):f==c?t=2+(o-a)/(c-u):o==c&&(t=4+(a-f)/(c-u)),(t*=60)<0&&(t+=360),r.length>3&&void 0!==r[3]?[t,e,l,r[3]]:[t,e,l]},j={Kn:18,labWhitePoint:"d65",Xn:.95047,Yn:1,Zn:1.08883,kE:216/24389,kKE:8,kK:24389/27,RefWhiteRGB:{X:.95047,Y:1,Z:1.08883},MtxRGB2XYZ:{m00:.4124564390896922,m01:.21267285140562253,m02:.0193338955823293,m10:.357576077643909,m11:.715152155287818,m12:.11919202588130297,m20:.18043748326639894,m21:.07217499330655958,m22:.9503040785363679},MtxXYZ2RGB:{m00:3.2404541621141045,m01:-.9692660305051868,m02:.055643430959114726,m10:-1.5371385127977166,m11:1.8760108454466942,m12:-.2040259135167538,m20:-.498531409556016,m21:.041556017530349834,m22:1.0572251882231791},As:.9414285350000001,Bs:1.040417467,Cs:1.089532651,MtxAdaptMa:{m00:.8951,m01:-.7502,m02:.0389,m10:.2664,m11:1.7135,m12:-.0685,m20:-.1614,m21:.0367,m22:1.0296},MtxAdaptMaI:{m00:.9869929054667123,m01:.43230526972339456,m02:-.008528664575177328,m10:-.14705425642099013,m11:.5183602715367776,m12:.04004282165408487,m20:.15996265166373125,m21:.0492912282128556,m22:.9684866957875502}},E=new Map([["a",[1.0985,.35585]],["b",[1.0985,.35585]],["c",[.98074,1.18232]],["d50",[.96422,.82521]],["d55",[.95682,.92149]],["d65",[.95047,1.08883]],["e",[1,1,1]],["f2",[.99186,.67393]],["f7",[.95041,1.08747]],["f11",[1.00962,.6435]],["icc",[.96422,.82521]]]);function R(r){var n=E.get(String(r).toLowerCase());if(!n)throw new Error("unknown Lab illuminant "+r);j.labWhitePoint=r,j.Xn=n[0],j.Zn=n[1]}function O(){return j.labWhitePoint}var P=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=i(r,"rgb"),t=e[0],a=e[1],f=e[2],o=e.slice(3),u=L(t,a,f),c=function(r,n,e){var t=j.Xn,a=j.Yn,f=j.Zn,o=j.kE,u=j.kK,c=r/t,i=n/a,l=e/f,h=c>o?Math.pow(c,1/3):(u*c+16)/116,s=i>o?Math.pow(i,1/3):(u*i+16)/116,d=l>o?Math.pow(l,1/3):(u*l+16)/116;return[116*s-16,500*(h-s),200*(s-d)]}(u[0],u[1],u[2]);return[c[0],c[1],c[2]].concat(o.length>0&&o[0]<1?[o[0]]:[])};function F(r){var n=Math.sign(r);return((r=Math.abs(r))<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4))*n}var L=function(r,n,e){r=F(r/255),n=F(n/255),e=F(e/255);var t=j.MtxRGB2XYZ,a=j.MtxAdaptMa,f=j.MtxAdaptMaI,o=j.Xn,u=j.Yn,c=j.Zn,i=j.As,l=j.Bs,h=j.Cs,s=r*t.m00+n*t.m10+e*t.m20,d=r*t.m01+n*t.m11+e*t.m21,b=r*t.m02+n*t.m12+e*t.m22,g=o*a.m00+u*a.m10+c*a.m20,v=o*a.m01+u*a.m11+c*a.m21,p=o*a.m02+u*a.m12+c*a.m22,m=s*a.m00+d*a.m10+b*a.m20,y=s*a.m01+d*a.m11+b*a.m21,w=s*a.m02+d*a.m12+b*a.m22;return y*=v/l,w*=p/h,[s=(m*=g/i)*f.m00+y*f.m10+w*f.m20,d=m*f.m01+y*f.m11+w*f.m21,b=m*f.m02+y*f.m12+w*f.m22]},B=Math.sqrt,G=Math.atan2,Y=Math.round,q=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=i(r,"lab"),t=e[0],a=e[1],f=e[2],o=B(a*a+f*f),u=(G(f,a)*y+360)%360;return 0===Y(1e4*o)&&(u=Number.NaN),[t,o,u]},C=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=i(r,"rgb"),t=e[0],a=e[1],f=e[2],o=e.slice(3),u=P(t,a,f),c=u[0],l=u[1],h=u[2],s=q(c,l,h);return[s[0],s[1],s[2]].concat(o.length>0&&o[0]<1?[o[0]]:[])};function X(r,n){var e=r.length;Array.isArray(r[0])||(r=[r]),Array.isArray(n[0])||(n=n.map((function(r){return[r]})));var t=n[0].length,a=n[0].map((function(r,e){return n.map((function(r){return r[e]}))})),f=r.map((function(r){return a.map((function(n){return Array.isArray(r)?r.reduce((function(r,e,t){return r+e*(n[t]||0)}),0):n.reduce((function(n,e){return n+e*r}),0)}))}));return 1===e&&(f=f[0]),1===t?f.map((function(r){return r[0]})):f}var Z=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t,a=i(r,"rgb"),f=a[0],o=a[1],u=a[2],c=a.slice(3),l=L(f,o,u);return(e=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],t=X([[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],l),X(e,t.map((function(r){return Math.cbrt(r)})))).concat(c.length>0&&c[0]<1?[c[0]]:[])};var $=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=i(r,"rgb"),t=e[0],a=e[1],f=e[2],o=e.slice(3),u=Z(t,a,f),c=u[0],l=u[1],h=u[2],s=q(c,l,h);return[s[0],s[1],s[2]].concat(o.length>0&&o[0]<1?[o[0]]:[])},S=Math.round,W=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=i(r,"rgba"),t=l(r)||"rgb";if("hsl"===t.substr(0,3))return function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=i(r,"hsla"),t=l(r)||"lsa";return e[0]=b(e[0]||0)+"deg",e[1]=b(100*e[1])+"%",e[2]=b(100*e[2])+"%","hsla"===t||e.length>3&&e[3]<1?(e[3]="/ "+(e.length>3?e[3]:1),t="hsla"):e.length=3,t.substr(0,3)+"("+e.join(" ")+")"}(A(e),t);if("lab"===t.substr(0,3)){var a=O();R("d50");var f=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=i(r,"lab"),t=l(r)||"lab";return e[0]=b(e[0])+"%",e[1]=b(e[1]),e[2]=b(e[2]),"laba"===t||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,"lab("+e.join(" ")+")"}(P(e),t);return R(a),f}if("lch"===t.substr(0,3)){var o=O();R("d50");var u=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=i(r,"lch"),t=l(r)||"lab";return e[0]=b(e[0])+"%",e[1]=b(e[1]),e[2]=isNaN(e[2])?"none":b(e[2])+"deg","lcha"===t||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,"lch("+e.join(" ")+")"}(C(e),t);return R(o),u}return"oklab"===t.substr(0,5)?function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=i(r,"lab");return e[0]=b(100*e[0])+"%",e[1]=g(e[1]),e[2]=g(e[2]),e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,"oklab("+e.join(" ")+")"}(Z(e)):"oklch"===t.substr(0,5)?function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=i(r,"lch");return e[0]=b(100*e[0])+"%",e[1]=g(e[1]),e[2]=isNaN(e[2])?"none":b(e[2])+"deg",e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,"oklch("+e.join(" ")+")"}($(e)):(e[0]=S(e[0]),e[1]=S(e[1]),e[2]=S(e[2]),("rgba"===t||e.length>3&&e[3]<1)&&(e[3]="/ "+(e.length>3?e[3]:1),t="rgba"),t.substr(0,3)+"("+e.slice(0,"rgb"===t?3:4).join(" ")+")")},I=function(){for(var r,n=[],e=arguments.length;e--;)n[e]=arguments[e];var t,a,f,o=(n=i(n,"hsl"))[0],u=n[1],c=n[2];if(0===u)t=a=f=255*c;else{var l=[0,0,0],h=[0,0,0],s=c<.5?c*(1+u):c+u-c*u,d=2*c-s,b=o/360;l[0]=b+1/3,l[1]=b,l[2]=b-1/3;for(var g=0;g<3;g++)l[g]<0&&(l[g]+=1),l[g]>1&&(l[g]-=1),6*l[g]<1?h[g]=d+6*(s-d)*l[g]:2*l[g]<1?h[g]=s:3*l[g]<2?h[g]=d+(s-d)*(2/3-l[g])*6:h[g]=d;t=(r=[255*h[0],255*h[1],255*h[2]])[0],a=r[1],f=r[2]}return n.length>3?[t,a,f,n[3]]:[t,a,f,1]},K=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=(r=i(r,"lab"))[0],t=r[1],a=r[2],f=z(e,t,a),o=f[0],u=f[1],c=f[2],l=V(o,u,c);return[l[0],l[1],l[2],r.length>3?r[3]:1]},z=function(r,n,e){var t=j.kE,a=j.kK,f=j.kKE,o=j.Xn,u=j.Yn,c=j.Zn,i=(r+16)/116,l=.002*n+i,h=i-.005*e,s=l*l*l,d=h*h*h;return[(s>t?s:(116*l-16)/a)*o,(r>f?Math.pow((r+16)/116,3):r/a)*u,(d>t?d:(116*h-16)/a)*c]},U=function(r){var n=Math.sign(r);return((r=Math.abs(r))<=.0031308?12.92*r:1.055*Math.pow(r,1/2.4)-.055)*n},V=function(r,n,e){var t=j.MtxAdaptMa,a=j.MtxAdaptMaI,f=j.MtxXYZ2RGB,o=j.RefWhiteRGB,u=j.Xn,c=j.Yn,i=j.Zn,l=u*t.m00+c*t.m10+i*t.m20,h=u*t.m01+c*t.m11+i*t.m21,s=u*t.m02+c*t.m12+i*t.m22,d=o.X*t.m00+o.Y*t.m10+o.Z*t.m20,b=o.X*t.m01+o.Y*t.m11+o.Z*t.m21,g=o.X*t.m02+o.Y*t.m12+o.Z*t.m22,v=(r*t.m00+n*t.m10+e*t.m20)*(d/l),p=(r*t.m01+n*t.m11+e*t.m21)*(b/h),m=(r*t.m02+n*t.m12+e*t.m22)*(g/s),y=v*a.m00+p*a.m10+m*a.m20,w=v*a.m01+p*a.m11+m*a.m21,k=v*a.m02+p*a.m12+m*a.m22;return[255*U(y*f.m00+w*f.m10+k*f.m20),255*U(y*f.m01+w*f.m11+k*f.m21),255*U(y*f.m02+w*f.m12+k*f.m22)]},D=Math.sin,T=Math.cos,H=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=i(r,"lch"),t=e[0],a=e[1],f=e[2];return isNaN(f)&&(f=0),[t,T(f*=m)*a,D(f)*a]},J=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=(r=i(r,"lch"))[0],t=r[1],a=r[2],f=H(e,t,a),o=f[0],u=f[1],c=f[2],l=K(o,u,c);return[l[0],l[1],l[2],r.length>3?r[3]:1]},Q=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t,a=(r=i(r,"lab"))[0],f=r[1],o=r[2],u=r.slice(3),c=(e=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],t=X([[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],[a,f,o]),X(e,t.map((function(r){return Math.pow(r,3)})))),l=c[0],h=c[1],s=c[2],d=V(l,h,s);return[d[0],d[1],d[2]].concat(u.length>0&&u[0]<1?[u[0]]:[])};var rr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=(r=i(r,"lch"))[0],t=r[1],a=r[2],f=r.slice(3),o=H(e,t,a),u=o[0],c=o[1],l=o[2],h=Q(u,c,l);return[h[0],h[1],h[2]].concat(f.length>0&&f[0]<1?[f[0]]:[])},nr=/((?:-?\d+)|(?:-?\d+(?:\.\d+)?)%|none)/.source,er=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)%?)|none)/.source,tr=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)%)|none)/.source,ar=/\s*/.source,fr=/\s+/.source,or=/\s*,\s*/.source,ur=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)(?:deg)?)|none)/.source,cr=/\s*(?:\/\s*((?:[01]|[01]?\.\d+)|\d+(?:\.\d+)?%))?/.source,ir=new RegExp("^rgba?\\("+ar+[nr,nr,nr].join(fr)+cr+"\\)$"),lr=new RegExp("^rgb\\("+ar+[nr,nr,nr].join(or)+ar+"\\)$"),hr=new RegExp("^rgba\\("+ar+[nr,nr,nr,er].join(or)+ar+"\\)$"),sr=new RegExp("^hsla?\\("+ar+[ur,tr,tr].join(fr)+cr+"\\)$"),dr=new RegExp("^hsl?\\("+ar+[ur,tr,tr].join(or)+ar+"\\)$"),br=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,gr=new RegExp("^lab\\("+ar+[er,er,er].join(fr)+cr+"\\)$"),vr=new RegExp("^lch\\("+ar+[er,er,ur].join(fr)+cr+"\\)$"),pr=new RegExp("^oklab\\("+ar+[er,er,er].join(fr)+cr+"\\)$"),mr=new RegExp("^oklch\\("+ar+[er,er,ur].join(fr)+cr+"\\)$"),yr=Math.round,wr=function(r){return r.map((function(r,n){return n<=2?e(yr(r),0,255):r}))},kr=function(r,n,e,t){return void 0===n&&(n=0),void 0===e&&(e=100),void 0===t&&(t=!1),"string"==typeof r&&r.endsWith("%")&&(r=parseFloat(r.substring(0,r.length-1))/100,r=t?n+.5*(r+1)*(e-n):n+r*(e-n)),+r},Mr=function(r,n){return"none"===r?n:r},Nr=function(r){if("transparent"===(r=r.toLowerCase().trim()))return[0,0,0,0];var n;if(k.format.named)try{return k.format.named(r)}catch(r){}if((n=r.match(ir))||(n=r.match(lr))){for(var e=n.slice(1,4),t=0;t<3;t++)e[t]=+kr(Mr(e[t],0),0,255);e=wr(e);var a=void 0!==n[4]?+kr(n[4],0,1):1;return e[3]=a,e}if(n=r.match(hr)){for(var f=n.slice(1,5),o=0;o<4;o++)f[o]=+kr(f[o],0,255);return f}if((n=r.match(sr))||(n=r.match(dr))){var u=n.slice(1,4);u[0]=+Mr(u[0].replace("deg",""),0),u[1]=.01*+kr(Mr(u[1],0),0,100),u[2]=.01*+kr(Mr(u[2],0),0,100);var c=wr(I(u)),i=void 0!==n[4]?+kr(n[4],0,1):1;return c[3]=i,c}if(n=r.match(br)){var l=n.slice(1,4);l[1]*=.01,l[2]*=.01;for(var h=I(l),s=0;s<3;s++)h[s]=yr(h[s]);return h[3]=+n[4],h}if(n=r.match(gr)){var d=n.slice(1,4);d[0]=kr(Mr(d[0],0),0,100),d[1]=kr(Mr(d[1],0),-125,125,!0),d[2]=kr(Mr(d[2],0),-125,125,!0);var b=O();R("d50");var g=wr(K(d));R(b);var v=void 0!==n[4]?+kr(n[4],0,1):1;return g[3]=v,g}if(n=r.match(vr)){var p=n.slice(1,4);p[0]=kr(p[0],0,100),p[1]=kr(Mr(p[1],0),0,150,!1),p[2]=+Mr(p[2].replace("deg",""),0);var m=O();R("d50");var y=wr(J(p));R(m);var w=void 0!==n[4]?+kr(n[4],0,1):1;return y[3]=w,y}if(n=r.match(pr)){var M=n.slice(1,4);M[0]=kr(Mr(M[0],0),0,1),M[1]=kr(Mr(M[1],0),-.4,.4,!0),M[2]=kr(Mr(M[2],0),-.4,.4,!0);var N=wr(Q(M)),x=void 0!==n[4]?+kr(n[4],0,1):1;return N[3]=x,N}if(n=r.match(mr)){var _=n.slice(1,4);_[0]=kr(Mr(_[0],0),0,1),_[1]=kr(Mr(_[1],0),0,.4,!1),_[2]=+Mr(_[2].replace("deg",""),0);var A=wr(rr(_)),j=void 0!==n[4]?+kr(n[4],0,1):1;return A[3]=j,A}};Nr.test=function(r){return ir.test(r)||sr.test(r)||gr.test(r)||vr.test(r)||pr.test(r)||mr.test(r)||lr.test(r)||hr.test(r)||dr.test(r)||br.test(r)||"transparent"===r},M.prototype.css=function(r){return W(this._rgb,r)};var xr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(M,[null].concat(r,["css"])))};N.css=xr,k.format.css=Nr,k.autodetect.push({p:5,test:function(r){for(var n=[],e=arguments.length-1;e-- >0;)n[e]=arguments[e+1];if(!n.length&&"string"===c(r)&&Nr.test(r))return"css"}}),k.format.gl=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=i(r,"rgba");return e[0]*=255,e[1]*=255,e[2]*=255,e};var _r=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(M,[null].concat(r,["gl"])))};N.gl=_r,M.prototype.gl=function(){var r=this._rgb;return[r[0]/255,r[1]/255,r[2]/255,r[3]]};var Ar=Math.floor;M.prototype.hcg=function(){return function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t=i(r,"rgb"),a=t[0],f=t[1],o=t[2],u=s(a,f,o),c=d(a,f,o),l=c-u,h=100*l/255,b=u/(255-l)*100;return 0===l?e=Number.NaN:(a===c&&(e=(f-o)/l),f===c&&(e=2+(o-a)/l),o===c&&(e=4+(a-f)/l),(e*=60)<0&&(e+=360)),[e,h,b]}(this._rgb)};var jr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(M,[null].concat(r,["hcg"])))};N.hcg=jr,k.format.hcg=function(){for(var r,n,e,t,a,f,o=[],u=arguments.length;u--;)o[u]=arguments[u];var c,l,h,s=(o=i(o,"hcg"))[0],d=o[1],b=o[2];b*=255;var g=255*d;if(0===d)c=l=h=b;else{360===s&&(s=0),s>360&&(s-=360),s<0&&(s+=360);var v=Ar(s/=60),p=s-v,m=b*(1-d),y=m+g*(1-p),w=m+g*p,k=m+g;switch(v){case 0:c=(r=[k,w,m])[0],l=r[1],h=r[2];break;case 1:c=(n=[y,k,m])[0],l=n[1],h=n[2];break;case 2:c=(e=[m,k,w])[0],l=e[1],h=e[2];break;case 3:c=(t=[m,y,k])[0],l=t[1],h=t[2];break;case 4:c=(a=[w,m,k])[0],l=a[1],h=a[2];break;case 5:c=(f=[k,m,y])[0],l=f[1],h=f[2]}}return[c,l,h,o.length>3?o[3]:1]},k.autodetect.push({p:1,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if("array"===c(r=i(r,"hcg"))&&3===r.length)return"hcg"}});var Er=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,Rr=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,Or=function(r){if(r.match(Er)){4!==r.length&&7!==r.length||(r=r.substr(1)),3===r.length&&(r=(r=r.split(""))[0]+r[0]+r[1]+r[1]+r[2]+r[2]);var n=parseInt(r,16);return[n>>16,n>>8&255,255&n,1]}if(r.match(Rr)){5!==r.length&&9!==r.length||(r=r.substr(1)),4===r.length&&(r=(r=r.split(""))[0]+r[0]+r[1]+r[1]+r[2]+r[2]+r[3]+r[3]);var e=parseInt(r,16);return[e>>24&255,e>>16&255,e>>8&255,Math.round((255&e)/255*100)/100]}throw new Error("unknown hex color: "+r)},Pr=Math.round,Fr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=i(r,"rgba"),t=e[0],a=e[1],f=e[2],o=e[3],u=l(r)||"auto";void 0===o&&(o=1),"auto"===u&&(u=o<1?"rgba":"rgb");var c="000000"+((t=Pr(t))<<16|(a=Pr(a))<<8|(f=Pr(f))).toString(16);c=c.substr(c.length-6);var h="0"+Pr(255*o).toString(16);switch(h=h.substr(h.length-2),u.toLowerCase()){case"rgba":return"#"+c+h;case"argb":return"#"+h+c;default:return"#"+c}};M.prototype.hex=function(r){return Fr(this._rgb,r)};var Lr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(M,[null].concat(r,["hex"])))};N.hex=Lr,k.format.hex=Or,k.autodetect.push({p:4,test:function(r){for(var n=[],e=arguments.length-1;e-- >0;)n[e]=arguments[e+1];if(!n.length&&"string"===c(r)&&[3,4,5,6,7,8,9].indexOf(r.length)>=0)return"hex"}});var Br=Math.cos,Gr=Math.min,Yr=Math.sqrt,qr=Math.acos;M.prototype.hsi=function(){return function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t=i(r,"rgb"),a=t[0],f=t[1],o=t[2],u=Gr(a/=255,f/=255,o/=255),c=(a+f+o)/3,l=c>0?1-u/c:0;return 0===l?e=NaN:(e=(a-f+(a-o))/2,e/=Yr((a-f)*(a-f)+(a-o)*(f-o)),e=qr(e),o>f&&(e=v-e),e/=v),[360*e,l,c]}(this._rgb)};var Cr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(M,[null].concat(r,["hsi"])))};N.hsi=Cr,k.format.hsi=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var t,a,f,o=(r=i(r,"hsi"))[0],u=r[1],c=r[2];return isNaN(o)&&(o=0),isNaN(u)&&(u=0),o>360&&(o-=360),o<0&&(o+=360),(o/=360)<1/3?a=1-((f=(1-u)/3)+(t=(1+u*Br(v*o)/Br(p-v*o))/3)):o<2/3?f=1-((t=(1-u)/3)+(a=(1+u*Br(v*(o-=1/3))/Br(p-v*o))/3)):t=1-((a=(1-u)/3)+(f=(1+u*Br(v*(o-=2/3))/Br(p-v*o))/3)),[255*(t=e(c*t*3)),255*(a=e(c*a*3)),255*(f=e(c*f*3)),r.length>3?r[3]:1]},k.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if("array"===c(r=i(r,"hsi"))&&3===r.length)return"hsi"}}),M.prototype.hsl=function(){return A(this._rgb)};var Xr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(M,[null].concat(r,["hsl"])))};N.hsl=Xr,k.format.hsl=I,k.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if("array"===c(r=i(r,"hsl"))&&3===r.length)return"hsl"}});var Zr=Math.floor,$r=Math.min,Sr=Math.max;M.prototype.hsv=function(){return function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t,a,f=(r=i(r,"rgb"))[0],o=r[1],u=r[2],c=$r(f,o,u),l=Sr(f,o,u),h=l-c;return a=l/255,0===l?(e=Number.NaN,t=0):(t=h/l,f===l&&(e=(o-u)/h),o===l&&(e=2+(u-f)/h),u===l&&(e=4+(f-o)/h),(e*=60)<0&&(e+=360)),[e,t,a]}(this._rgb)};var Wr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(M,[null].concat(r,["hsv"])))};N.hsv=Wr,k.format.hsv=function(){for(var r,n,e,t,a,f,o=[],u=arguments.length;u--;)o[u]=arguments[u];var c,l,h,s=(o=i(o,"hsv"))[0],d=o[1],b=o[2];if(b*=255,0===d)c=l=h=b;else{360===s&&(s=0),s>360&&(s-=360),s<0&&(s+=360);var g=Zr(s/=60),v=s-g,p=b*(1-d),m=b*(1-d*v),y=b*(1-d*(1-v));switch(g){case 0:c=(r=[b,y,p])[0],l=r[1],h=r[2];break;case 1:c=(n=[m,b,p])[0],l=n[1],h=n[2];break;case 2:c=(e=[p,b,y])[0],l=e[1],h=e[2];break;case 3:c=(t=[p,m,b])[0],l=t[1],h=t[2];break;case 4:c=(a=[y,p,b])[0],l=a[1],h=a[2];break;case 5:c=(f=[b,p,m])[0],l=f[1],h=f[2]}}return[c,l,h,o.length>3?o[3]:1]},k.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if("array"===c(r=i(r,"hsv"))&&3===r.length)return"hsv"}}),M.prototype.lab=function(){return P(this._rgb)};var Ir=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(M,[null].concat(r,["lab"])))};Object.assign(N,{lab:Ir,getLabWhitePoint:O,setLabWhitePoint:R}),k.format.lab=K,k.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if("array"===c(r=i(r,"lab"))&&3===r.length)return"lab"}});M.prototype.lch=function(){return C(this._rgb)},M.prototype.hcl=function(){return w(C(this._rgb))};var Kr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(M,[null].concat(r,["lch"])))},zr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(M,[null].concat(r,["hcl"])))};Object.assign(N,{lch:Kr,hcl:zr}),k.format.lch=J,k.format.hcl=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=w(i(r,"hcl"));return J.apply(void 0,e)},["lch","hcl"].forEach((function(r){return k.autodetect.push({p:2,test:function(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];if("array"===c(n=i(n,r))&&3===n.length)return r}})}));M.prototype.num=function(){return function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=i(r,"rgb");return(e[0]<<16)+(e[1]<<8)+e[2]}(this._rgb)};var Ur=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(M,[null].concat(r,["num"])))};Object.assign(N,{num:Ur}),k.format.num=function(r){if("number"==c(r)&&r>=0&&r<=16777215)return[r>>16,r>>8&255,255&r,1];throw new Error("unknown num color: "+r)},k.autodetect.push({p:5,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(1===r.length&&"number"===c(r[0])&&r[0]>=0&&r[0]<=16777215)return"num"}});var Vr=Math.round;M.prototype.rgb=function(r){return void 0===r&&(r=!0),!1===r?this._rgb.slice(0,3):this._rgb.slice(0,3).map(Vr)},M.prototype.rgba=function(r){return void 0===r&&(r=!0),this._rgb.slice(0,4).map((function(n,e){return e<3?!1===r?n:Vr(n):n}))};var Dr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(M,[null].concat(r,["rgb"])))};Object.assign(N,{rgb:Dr}),k.format.rgb=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=i(r,"rgba");return void 0===e[3]&&(e[3]=1),e},k.autodetect.push({p:3,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if("array"===c(r=i(r,"rgba"))&&(3===r.length||4===r.length&&"number"==c(r[3])&&r[3]>=0&&r[3]<=1))return"rgb"}});var Tr=Math.log,Hr=function(r){var n,e,t,a=r/100;return a<66?(n=255,e=a<6?0:-155.25485562709179-.44596950469579133*(e=a-2)+104.49216199393888*Tr(e),t=a<20?0:.8274096064007395*(t=a-10)-254.76935184120902+115.67994401066147*Tr(t)):(n=351.97690566805693+.114206453784165*(n=a-55)-40.25366309332127*Tr(n),e=325.4494125711974+.07943456536662342*(e=a-50)-28.0852963507957*Tr(e),t=255),[n,e,t,1]},Jr=Math.round;M.prototype.temp=M.prototype.kelvin=M.prototype.temperature=function(){return function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];for(var e,t=i(r,"rgb"),a=t[0],f=t[2],o=1e3,u=4e4;u-o>.4;){var c=Hr(e=.5*(u+o));c[2]/c[0]>=f/a?u=e:o=e}return Jr(e)}(this._rgb)};var Qr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(M,[null].concat(r,["temp"])))};Object.assign(N,{temp:Qr,kelvin:Qr,temperature:Qr}),k.format.temp=k.format.kelvin=k.format.temperature=Hr,M.prototype.oklab=function(){return Z(this._rgb)};var rn=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(M,[null].concat(r,["oklab"])))};Object.assign(N,{oklab:rn}),k.format.oklab=Q,k.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if("array"===c(r=i(r,"oklab"))&&3===r.length)return"oklab"}}),M.prototype.oklch=function(){return $(this._rgb)};var nn=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(M,[null].concat(r,["oklch"])))};Object.assign(N,{oklch:nn}),k.format.oklch=rr,k.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if("array"===c(r=i(r,"oklch"))&&3===r.length)return"oklch"}});var en={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",maroon2:"#7f0000",maroon3:"#b03060",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",purple2:"#7f007f",purple3:"#a020f0",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};M.prototype.name=function(){for(var r=Fr(this._rgb,"rgb"),n=0,e=Object.keys(en);n0;)n[e]=arguments[e+1];if(!n.length&&"string"===c(r)&&en[r.toLowerCase()])return"named"}}),M.prototype.alpha=function(r,n){return void 0===n&&(n=!1),void 0!==r&&"number"===c(r)?n?(this._rgb[3]=r,this):new M([this._rgb[0],this._rgb[1],this._rgb[2],r],"rgb"):this._rgb[3]},M.prototype.clipped=function(){return this._rgb._clipped||!1},M.prototype.darken=function(r){void 0===r&&(r=1);var n=this.lab();return n[0]-=j.Kn*r,new M(n,"lab").alpha(this.alpha(),!0)},M.prototype.brighten=function(r){return void 0===r&&(r=1),this.darken(-r)},M.prototype.darker=M.prototype.darken,M.prototype.brighter=M.prototype.brighten,M.prototype.get=function(r){var n=r.split("."),e=n[0],t=n[1],a=this[e]();if(t){var f=e.indexOf(t)-("ok"===e.substr(0,2)?2:0);if(f>-1)return a[f];throw new Error("unknown channel "+t+" in mode "+e)}return a};var tn=Math.pow;M.prototype.luminance=function(r,n){if(void 0===n&&(n="rgb"),void 0!==r&&"number"===c(r)){if(0===r)return new M([0,0,0,this._rgb[3]],"rgb");if(1===r)return new M([255,255,255,this._rgb[3]],"rgb");var e=this.luminance(),t=20,a=function(e,f){var o=e.interpolate(f,.5,n),u=o.luminance();return Math.abs(r-u)<1e-7||!t--?o:u>r?a(e,o):a(o,f)},f=(e>r?a(new M([0,0,0]),this):a(this,new M([255,255,255]))).rgb();return new M(f.concat([this._rgb[3]]))}return an.apply(void 0,this._rgb.slice(0,3))};var an=function(r,n,e){return.2126*(r=fn(r))+.7152*(n=fn(n))+.0722*(e=fn(e))},fn=function(r){return(r/=255)<=.03928?r/12.92:tn((r+.055)/1.055,2.4)},on={};function un(r,n,e){void 0===e&&(e=.5);for(var t=[],a=arguments.length-3;a-- >0;)t[a]=arguments[a+3];var f=t[0]||"lrgb";if(on[f]||t.length||(f=Object.keys(on)[0]),!on[f])throw new Error("interpolation mode "+f+" is not defined");return"object"!==c(r)&&(r=new M(r)),"object"!==c(n)&&(n=new M(n)),on[f](r,n,e).alpha(r.alpha()+e*(n.alpha()-r.alpha()))}M.prototype.mix=M.prototype.interpolate=function(r,n){void 0===n&&(n=.5);for(var e=[],t=arguments.length-2;t-- >0;)e[t]=arguments[t+2];return un.apply(void 0,[this,r,n].concat(e))},M.prototype.premultiply=function(r){void 0===r&&(r=!1);var n=this._rgb,e=n[3];return r?(this._rgb=[n[0]*e,n[1]*e,n[2]*e,e],this):new M([n[0]*e,n[1]*e,n[2]*e,e],"rgb")},M.prototype.saturate=function(r){void 0===r&&(r=1);var n=this.lch();return n[1]+=j.Kn*r,n[1]<0&&(n[1]=0),new M(n,"lch").alpha(this.alpha(),!0)},M.prototype.desaturate=function(r){return void 0===r&&(r=1),this.saturate(-r)},M.prototype.set=function(r,n,e){void 0===e&&(e=!1);var t=r.split("."),a=t[0],f=t[1],o=this[a]();if(f){var u=a.indexOf(f)-("ok"===a.substr(0,2)?2:0);if(u>-1){if("string"==c(n))switch(n.charAt(0)){case"+":case"-":o[u]+=+n;break;case"*":o[u]*=+n.substr(1);break;case"/":o[u]/=+n.substr(1);break;default:o[u]=+n}else{if("number"!==c(n))throw new Error("unsupported value for Color.set");o[u]=n}var i=new M(o,a);return e?(this._rgb=i._rgb,this):i}throw new Error("unknown channel "+f+" in mode "+a)}return o},M.prototype.tint=function(r){void 0===r&&(r=.5);for(var n=[],e=arguments.length-1;e-- >0;)n[e]=arguments[e+1];return un.apply(void 0,[this,"white",r].concat(n))},M.prototype.shade=function(r){void 0===r&&(r=.5);for(var n=[],e=arguments.length-1;e-- >0;)n[e]=arguments[e+1];return un.apply(void 0,[this,"black",r].concat(n))};on.rgb=function(r,n,e){var t=r._rgb,a=n._rgb;return new M(t[0]+e*(a[0]-t[0]),t[1]+e*(a[1]-t[1]),t[2]+e*(a[2]-t[2]),"rgb")};var cn=Math.sqrt,ln=Math.pow;on.lrgb=function(r,n,e){var t=r._rgb,a=t[0],f=t[1],o=t[2],u=n._rgb,c=u[0],i=u[1],l=u[2];return new M(cn(ln(a,2)*(1-e)+ln(c,2)*e),cn(ln(f,2)*(1-e)+ln(i,2)*e),cn(ln(o,2)*(1-e)+ln(l,2)*e),"rgb")};function hn(r,n,e,t){var a,f,o,u,c,i,l,h,s,d,b,g,v;return"hsl"===t?(o=r.hsl(),u=n.hsl()):"hsv"===t?(o=r.hsv(),u=n.hsv()):"hcg"===t?(o=r.hcg(),u=n.hcg()):"hsi"===t?(o=r.hsi(),u=n.hsi()):"lch"===t||"hcl"===t?(t="hcl",o=r.hcl(),u=n.hcl()):"oklch"===t&&(o=r.oklch().reverse(),u=n.oklch().reverse()),"h"!==t.substr(0,1)&&"oklch"!==t||(c=(a=o)[0],l=a[1],s=a[2],i=(f=u)[0],h=f[1],d=f[2]),isNaN(c)||isNaN(i)?isNaN(c)?isNaN(i)?g=Number.NaN:(g=i,1!=s&&0!=s||"hsv"==t||(b=h)):(g=c,1!=d&&0!=d||"hsv"==t||(b=l)):g=c+e*(i>c&&i-c>180?i-(c+360):i180?i+360-c:i-c),void 0===b&&(b=l+e*(h-l)),v=s+e*(d-s),new M("oklch"===t?[v,b,g]:[g,b,v],t)}on.lab=function(r,n,e){var t=r.lab(),a=n.lab();return new M(t[0]+e*(a[0]-t[0]),t[1]+e*(a[1]-t[1]),t[2]+e*(a[2]-t[2]),"lab")};var sn=function(r,n,e){return hn(r,n,e,"lch")};on.lch=sn,on.hcl=sn;on.num=function(r,n,e){var t=r.num(),a=n.num();return new M(t+e*(a-t),"num")};on.hcg=function(r,n,e){return hn(r,n,e,"hcg")};on.hsi=function(r,n,e){return hn(r,n,e,"hsi")};on.hsl=function(r,n,e){return hn(r,n,e,"hsl")};on.hsv=function(r,n,e){return hn(r,n,e,"hsv")};on.oklab=function(r,n,e){var t=r.oklab(),a=n.oklab();return new M(t[0]+e*(a[0]-t[0]),t[1]+e*(a[1]-t[1]),t[2]+e*(a[2]-t[2]),"oklab")};on.oklch=function(r,n,e){return hn(r,n,e,"oklch")};var dn=Math.pow,bn=Math.sqrt,gn=Math.PI,vn=Math.cos,pn=Math.sin,mn=Math.atan2;var yn=function(r,n){for(var e=r.length,a=[0,0,0,0],f=0;f.9999999&&(a[3]=1),new M(t(a))},wn=Math.pow;function kn(r){var n="rgb",t=N("#ccc"),a=0,f=[0,1],o=[0,1],u=[],i=[0,0],l=!1,h=[],s=!1,d=0,b=1,g=!1,v={},p=!0,m=1,y=function(r){if((r=r||["#fff","#000"])&&"string"===c(r)&&N.brewer&&N.brewer[r.toLowerCase()]&&(r=N.brewer[r.toLowerCase()]),"array"===c(r)){1===r.length&&(r=[r[0],r[0]]),r=r.slice(0);for(var n=0;n2){var s=function(r){if(null!=l){for(var n=l.length-1,e=0;e=l[e];)e++;return e-1}return 0}(r);o=s/(l.length-2)}else o=b!==d?(r-d)/(b-d):1;o=k(o),a||(o=w(o)),1!==m&&(o=wn(o,m)),o=e(o=i[0]+o*(1-i[0]-i[1]),0,1);var g=Math.floor(1e4*o);if(p&&v[g])f=v[g];else{if("array"===c(h))for(var y=0;y=M&&y===u.length-1){f=h[y];break}if(o>M&&o2){var i=r.map((function(n,e){return e/(r.length-1)})),l=r.map((function(r){return(r-d)/(b-d)}));l.every((function(r,n){return i[n]===r}))||(k=function(r){if(r<=0||r>=1)return r;for(var n=0;r>=l[n+1];)n++;var e=(r-l[n])/(l[n+1]-l[n]);return i[n]+e*(i[n+1]-i[n])})}}return f=[d,b],_},_.mode=function(r){return arguments.length?(n=r,x(),_):n},_.range=function(r,n){return y(r),_},_.out=function(r){return s=r,_},_.spread=function(r){return arguments.length?(a=r,_):a},_.correctLightness=function(r){return null==r&&(r=!0),g=r,x(),w=g?function(r){for(var n=M(0,!0).lab()[0],e=M(1,!0).lab()[0],t=n>e,a=M(r,!0).lab()[0],f=n+(e-n)*r,o=a-f,u=0,c=1,i=20;Math.abs(o)>.01&&i-- >0;)t&&(o*=-1),o<0?(u=r,r+=.5*(c-r)):(c=r,r+=.5*(u-r)),a=M(r,!0).lab()[0],o=a-f;return r}:function(r){return r},_},_.padding=function(r){return null!=r?("number"===c(r)&&(r=[r,r]),i=r,_):i},_.colors=function(n,e){arguments.length<2&&(e="hex");var t=[];if(0===arguments.length)t=h.slice(0);else if(1===n)t=[_(.5)];else if(n>1){var a=f[0],o=f[1]-a;t=function(r,n){for(var e=[],t=ra;t?f++:f--)e.push(f);return e}(0,n).map((function(r){return _(a+r/(n-1)*o)}))}else{r=[];var u=[];if(l&&l.length>2)for(var c=1,i=l.length,s=1<=i;s?ci;s?c++:c--)u.push(.5*(l[c-1]+l[c]));else u=f;t=u.map((function(r){return _(r)}))}return N[e]&&(t=t.map((function(r){return r[e]()}))),t},_.cache=function(r){return null!=r?(p=r,_):p},_.gamma=function(r){return null!=r?(m=r,_):m},_.nodata=function(r){return null!=r?(t=N(r),_):t},_}var Mn=function(r,n,e){if(!Mn[e])throw new Error("unknown blend mode "+e);return Mn[e](r,n)},Nn=function(r){return function(n,e){var t=N(e).rgb(),a=N(n).rgb();return N.rgb(r(t,a))}},xn=function(r){return function(n,e){var t=[];return t[0]=r(n[0],e[0]),t[1]=r(n[1],e[1]),t[2]=r(n[2],e[2]),t}};Mn.normal=Nn(xn((function(r){return r}))),Mn.multiply=Nn(xn((function(r,n){return r*n/255}))),Mn.screen=Nn(xn((function(r,n){return 255*(1-(1-r/255)*(1-n/255))}))),Mn.overlay=Nn(xn((function(r,n){return n<128?2*r*n/255:255*(1-2*(1-r/255)*(1-n/255))}))),Mn.darken=Nn(xn((function(r,n){return r>n?n:r}))),Mn.lighten=Nn(xn((function(r,n){return r>n?r:n}))),Mn.dodge=Nn(xn((function(r,n){return 255===r||(r=n/255*255/(1-r/255))>255?255:r}))),Mn.burn=Nn(xn((function(r,n){return 255*(1-(1-n/255)/(r/255))})));var _n=Math.pow,An=Math.sin,jn=Math.cos;var En=Math.floor,Rn=Math.random;var On=Math.log,Pn=Math.pow,Fn=Math.floor,Ln=Math.abs;function Bn(r,n){void 0===n&&(n=null);var e={min:Number.MAX_VALUE,max:-1*Number.MAX_VALUE,sum:0,values:[],count:0};return"object"===c(r)&&(r=Object.values(r)),r.forEach((function(r){n&&"object"===c(r)&&(r=r[n]),null==r||isNaN(r)||(e.values.push(r),e.sum+=r,re.max&&(e.max=r),e.count+=1)})),e.domain=[e.min,e.max],e.limits=function(r,n){return Gn(e,r,n)},e}function Gn(r,n,e){void 0===n&&(n="equal"),void 0===e&&(e=7),"array"==c(r)&&(r=Bn(r));var t=r.min,a=r.max,f=r.values.sort((function(r,n){return r-n}));if(1===e)return[t,a];var o=[];if("c"===n.substr(0,1)&&(o.push(t),o.push(a)),"e"===n.substr(0,1)){o.push(t);for(var u=1;u 0");var i=Math.LOG10E*On(t),l=Math.LOG10E*On(a);o.push(t);for(var h=1;h200&&(w=!1)}for(var Y={},q=0;q=360;)b-=360;o[d]=b}else o[d]=o[d]/u[d];return s/=t,new M(o,n).alpha(s>.99999?1:s,!0)},bezier:function(r){var n=function(r){var n,e,t,a,f,o,u;if(2===(r=r.map((function(r){return new M(r)}))).length)n=r.map((function(r){return r.lab()})),f=n[0],o=n[1],a=function(r){var n=[0,1,2].map((function(n){return f[n]+r*(o[n]-f[n])}));return new M(n,"lab")};else if(3===r.length)e=r.map((function(r){return r.lab()})),f=e[0],o=e[1],u=e[2],a=function(r){var n=[0,1,2].map((function(n){return(1-r)*(1-r)*f[n]+2*(1-r)*r*o[n]+r*r*u[n]}));return new M(n,"lab")};else if(4===r.length){var c;t=r.map((function(r){return r.lab()})),f=t[0],o=t[1],u=t[2],c=t[3],a=function(r){var n=[0,1,2].map((function(n){return(1-r)*(1-r)*(1-r)*f[n]+3*(1-r)*(1-r)*r*o[n]+3*(1-r)*r*r*u[n]+r*r*r*c[n]}));return new M(n,"lab")}}else{if(!(r.length>=5))throw new RangeError("No point in running bezier with only one color.");var i,l,h;i=r.map((function(r){return r.lab()})),h=r.length-1,l=function(r){for(var n=[1,1],e=1;et?(e+.05)/(t+.05):(t+.05)/(e+.05)},contrastAPCA:function(r,n){r=new M(r),n=new M(n),r.alpha()<1&&(r=un(n,r,r.alpha(),"rgb"));var e=qn.apply(void 0,r.rgb()),t=qn.apply(void 0,n.rgb()),a=e>=Yn?e:e+Math.pow(Yn-e,1.414),f=t>=Yn?t:t+Math.pow(Yn-t,1.414),o=Math.pow(f,.56)-Math.pow(a,.57),u=Math.pow(f,.65)-Math.pow(a,.62),c=Math.abs(f-a)<5e-4?0:a0?c-.027:c+.027)},cubehelix:function(r,n,e,a,f){void 0===r&&(r=300),void 0===n&&(n=-1.5),void 0===e&&(e=1),void 0===a&&(a=1),void 0===f&&(f=[0,1]);var o,u=0;"array"===c(f)?o=f[1]-f[0]:(o=0,f=[f,f]);var i=function(c){var i=v*((r+120)/360+n*c),l=_n(f[0]+o*c,a),h=(0!==u?e[0]+c*u:e)*l*(1-l)/2,s=jn(i),d=An(i);return N(t([255*(l+h*(-.14861*s+1.78277*d)),255*(l+h*(-.29227*s-.90649*d)),255*(l+h*(1.97294*s)),1]))};return i.start=function(n){return null==n?r:(r=n,i)},i.rotations=function(r){return null==r?n:(n=r,i)},i.gamma=function(r){return null==r?a:(a=r,i)},i.hue=function(r){return null==r?e:("array"===c(e=r)?0===(u=e[1]-e[0])&&(e=e[1]):u=0,i)},i.lightness=function(r){return null==r?f:("array"===c(r)?(f=r,o=r[1]-r[0]):(f=[r,r],o=0),i)},i.scale=function(){return N.scale(i)},i.hue(e),i},deltaE:function(r,n,e,t,a){void 0===e&&(e=1),void 0===t&&(t=1),void 0===a&&(a=1);var f=function(r){return 360*r/(2*Un)},o=function(r){return 2*Un*r/360};r=new M(r),n=new M(n);var u=Array.from(r.lab()),c=u[0],i=u[1],l=u[2],h=Array.from(n.lab()),s=h[0],d=h[1],b=h[2],g=(c+s)/2,v=(Cn(Xn(i,2)+Xn(l,2))+Cn(Xn(d,2)+Xn(b,2)))/2,p=.5*(1-Cn(Xn(v,7)/(Xn(v,7)+Xn(25,7)))),m=i*(1+p),y=d*(1+p),w=Cn(Xn(m,2)+Xn(l,2)),k=Cn(Xn(y,2)+Xn(b,2)),N=(w+k)/2,x=f(Sn(l,m)),_=f(Sn(b,y)),A=x>=0?x:x+360,j=_>=0?_:_+360,E=Wn(A-j)>180?(A+j+360)/2:(A+j)/2,R=1-.17*In(o(E-30))+.24*In(o(2*E))+.32*In(o(3*E+6))-.2*In(o(4*E-63)),O=j-A;O=Wn(O)<=180?O:j<=A?O+360:O-360,O=2*Cn(w*k)*Kn(o(O)/2);var P=s-c,F=k-w,L=1+.015*Xn(g-50,2)/Cn(20+Xn(g-50,2)),B=1+.045*N,G=1+.015*N*R,Y=30*zn(-Xn((E-275)/25,2)),q=-(2*Cn(Xn(N,7)/(Xn(N,7)+Xn(25,7))))*Kn(2*o(Y)),C=Cn(Xn(P/(e*L),2)+Xn(F/(t*B),2)+Xn(O/(a*G),2)+q*(F/(t*B))*(O/(a*G)));return $n(0,Zn(100,C))},distance:function(r,n,e){void 0===e&&(e="lab"),r=new M(r),n=new M(n);var t=r.get(e),a=n.get(e),f=0;for(var o in t){var u=(t[o]||0)-(a[o]||0);f+=u*u}return Math.sqrt(f)},input:k,interpolate:un,limits:Gn,mix:un,random:function(r){void 0===r&&(r=Rn);for(var n="#",e=0;e<6;e++)n+="0123456789abcdef".charAt(En(16*r()));return new M(n,"hex")},scale:kn,scales:Vn,valid:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];try{return new(Function.prototype.bind.apply(M,[null].concat(r))),!0}catch(r){return!1}},cmyk:_,css:xr,gl:_r,hcg:jr,hex:Lr,hsi:Cr,hsl:Xr,hsv:Wr,lab:Ir,lch:Kr,hcl:zr,num:Ur,rgb:Dr,temp:Qr,kelvin:Qr,temperature:Qr,oklab:rn,oklch:nn,getLabWhitePoint:O,setLabWhitePoint:R}),N})); diff --git a/base_geoengine/static/lib/geostats-2.1.0/geostats.css b/base_geoengine/static/lib/geostats-2.1.0/geostats.css new file mode 100644 index 000000000..72556271e --- /dev/null +++ b/base_geoengine/static/lib/geostats-2.1.0/geostats.css @@ -0,0 +1,24 @@ +.geostats-legend div { + margin:3px 10px 5px 10px; + clear:left; +} + +.geostats-legend-title { + font-weight: bold; + margin-bottom: 4px; +} + +.geostats-legend-block { + border: 1px solid #555555; + display: block; + float: left; + height: 12px; + margin: 0 5px 0 20px; + width: 20px; +} + +.geostats-legend-counter { + font-size: 0.8em; + color:#666; + font-style: italic; +} diff --git a/base_geoengine/static/lib/geostats-2.1.0/geostats.js b/base_geoengine/static/lib/geostats-2.1.0/geostats.js new file mode 100755 index 000000000..2864139c7 --- /dev/null +++ b/base_geoengine/static/lib/geostats-2.1.0/geostats.js @@ -0,0 +1,29 @@ +(function(v){"object"===typeof exports?module.exports=v():"function"===typeof define&&define.amd?define(v):geostats=v()})(function(){var v=function(m){return"number"===typeof m&&parseFloat(m)==parseInt(m,10)&&!isNaN(m)};Array.prototype.indexOf||(Array.prototype.indexOf=function(m,a){if(void 0===this||null===this)throw new TypeError('"this" is null or not defined');var b=this.length>>>0;a=+a||0;Infinity===Math.abs(a)&&(a=0);0>a&&(a+=b,0>a&&(a=0));for(;athis.precision&&(this.precision=b)}20this.stat_max&&!a.includes(this.serie[b])&&(this.stat_max=this.serie[b]);return this.stat_max}};this.sum=function(){if(!this._nodata()){if(null==this.stat_sum)for(var a=this.stat_sum=0;a=this.pop())if(a="Error. "+a+" classes are defined for only "+this.pop()+" values in serie ! For the current serie, no more than "+(this.pop()-1)+" classes can be defined.",this.silent)this.log(a,!0);else throw alert(a),new TypeError(a);};this._nbClassInt=function(a){a=parseInt(a,10);if(isNaN(a))if(this.silent)this.log("[silent mode] '"+a+"' is not a valid integer. Enable to set class number.", +!0);else throw new TypeError("'"+a+"' is not a valid integer. Enable to set class number.");else return a};this._hasNegativeValue=function(){for(var a=0;athis.serie[a])return!0;return!1};this._hasZeroValue=function(){for(var a=0;ae?1:0}));return this.stat_sorted};this.info=function(){if(!this._nodata()){var a="Population : "+this.pop()+" - [Min : "+this.min()+" | Max : "+this.max()+"]\n";a+="Mean : "+this.mean()+" - Median : "+this.median()+"\n";return a+="Variance : "+this.variance()+" - Standard deviation : "+this.stddev()+" - Coefficient of variation : "+this.cov()+"\n"}};this.setClassManually=function(a){if(!this._nodata())if(a[0]!==this.min()||a[a.length- +1]!==this.max())if(this.silent)this.log("[silent mode] "+t("Given bounds may not be correct! please check your input.\nMin value : "+this.min()+" / Max value : "+this.max()),!0);else throw new TypeError("Given bounds may not be correct! please check your input.\nMin value : "+this.min()+" / Max value : "+this.max());else return this.setBounds(a),this.setRanges(),this.method="manual classification ("+(a.length-1)+" classes)",this.bounds};this.getClassEqInterval=function(a,b,c){a=this._nbClassInt(a); +if(!this._nodata()){var e="undefined"===typeof b?this.min():b;c="undefined"===typeof c?this.max():c;b=[];var d=e;e=(c-e)/a;for(var f=0;f<=a;f++)b[f]=d,d+=e;b[a]=c;this.setBounds(b);this.setRanges();this.method="eq. intervals ("+a+" classes)";return this.bounds}};this.getQuantiles=function(a){a=this._nbClassInt(a);for(var b=this.sorted(),c=[],e=this.pop()/a,d=1;d=k+e[p][q-1]&&(c[d][q]=n,e[d][q]=k+e[p][q-1])}c[d][1]=1;e[d][1]=k}k=b.length;e=[];for(d=0;d<=a;d++)e.push(0);e[a]=parseFloat(b[b.length-1]);e[0]=parseFloat(b[0]);for(d=a;2<=d;)f=parseInt(c[k][d]-2),e[d-1]=b[f],k=parseInt(c[k][d]-1),--d;e[0]==e[1]&&(e[0]=0);this.setBounds(e);this.setRanges();this.method="Jenks2 ("+ +a+" classes)";return this.bounds}};this.getClassJenks=function(a){a=this._nbClassInt(a);if(!this._nodata()){this._classificationCheck(a);var b=this.sorted(),c=a,e=[],d=[],f,g,h=0;for(f=0;f= +h+d[u][g-1]&&(e[f][g]=p,d[f][g]=h+d[u][g-1])}e[f][1]=1;d[f][1]=h}c=b.length-1;d=[];g=a;d[a]=b[b.length-1];for(d[0]=b[0];1parseFloat(this.bounds[c])&&(a[c-1]=""+d+this.separator+b[e-1],d=b[e],c++);if(c==this.bounds.length-1)return a[c-1]=""+d+this.separator+b[b.length-1],this.inner_ranges=a}};this.getSortedlist=function(){return this.sorted().join(", ")};this.getHtmlLegend=function(a,b,c,e,d,f){var g="",h=[];this.doCount();ccolors=null!=a?a:this.colors;lg=null!=b?b:"Legend";getcounter=null!=c?!0:!1;fn=null!=e?e:function(l){return l};null==d&&(d="default");if("discontinuous"==d&&(this.getInnerRanges(), +-1!==this.counter.indexOf(0))){if(this.silent)this.log("[silent mode] Geostats cannot apply 'discontinuous' mode to the getHtmlLegend() method because some classes are not populated.\nPlease switch to 'default' or 'distinct' modes. Exit!",!0);else throw new TypeError("Geostats cannot apply 'discontinuous' mode to the getHtmlLegend() method because some classes are not populated.\nPlease switch to 'default' or 'distinct' modes. Exit!");return}"DESC"!==f&&(f="ASC");if(ccolors.length('+this.counter[a]+")"),c=this.ranges[a].split(this.separator),b=parseFloat(c[0]).toFixed(this.precision),c=parseFloat(c[1]).toFixed(this.precision),"distinct"==d&&0!=a&&(v(b)?(b=parseInt(b)+1,"manual"==this.precisionflag&&0!=this.precision&&(b=parseFloat(b).toFixed(this.precision))): +(b=parseFloat(b)+1/Math.pow(10,this.precision),b=parseFloat(b).toFixed(this.precision))),"discontinuous"==d&&(c=this.inner_ranges[a].split(this.separator),b=parseFloat(c[0]).toFixed(this.precision),c=parseFloat(c[1]).toFixed(this.precision)),b=fn(b)+this.legendSeparator+fn(c),b='
'+b+g+"
",h.push(b);else for(a=0;a('+this.counter[a]+ +")"),b=fn(this.bounds[a]),b='
'+b+g+"
",h.push(b);"DESC"===f&&h.reverse();d='
'+lg+"
";for(a=0;a"}};this.objectID=(new Date).getUTCMilliseconds();this.log("Creating new geostats object");"undefined"!==typeof m&&0>1),r=+i(t[n],e),r<0?s=n+1:(o=n,a=!r);return a?s:~s}function y(t,e){return t>e?1:te?-1:0}function v(t,e,i){if(t[0]<=e)return 0;const n=t.length;if(e<=t[n-1])return n-1;if("function"==typeof i){for(let r=1;r0?r-1:r}return n-1}if(i>0){for(let i=1;i0||i&&0===s)}))}function C(){return!0}function b(){return!1}function R(){}function P(t){let e,i,n;return function(){const r=Array.prototype.slice.call(arguments);return i&&this===n&&w(r,i)||(n=this,i=r,e=t.apply(this,arguments)),e}}function I(t){return function(){let e;try{e=t()}catch(t){return Promise.reject(t)}return e instanceof Promise?e:Promise.resolve(e)}()}function F(t){for(const e in t)delete t[e]}function L(t){let e;for(e in t)return!1;return!e}class M{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}function A(t){t.stopPropagation()}class O extends _{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),n=i[t]||(i[t]=[]);n.includes(e)||n.push(e)}dispatchEvent(t){const e="string"==typeof t,i=e?t:t.type,n=this.listeners_&&this.listeners_[i];if(!n)return;const r=e?new M(t):t;r.target||(r.target=this.eventTarget_||this);const s=this.dispatching_||(this.dispatching_={}),o=this.pendingRemovals_||(this.pendingRemovals_={});let a;i in s||(s[i]=0,o[i]=0),++s[i];for(let t=0,e=n.length;t0)}removeEventListener(t,e){if(!this.listeners_)return;const i=this.listeners_[t];if(!i)return;const n=i.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=R,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}}function D(t,e,i,n,r){if(r){const r=i;i=function(s){return t.removeEventListener(e,i),r.call(n??this,s)}}else n&&n!==t&&(i=i.bind(n));const s={target:t,type:e,listener:i};return t.addEventListener(e,i),s}function N(t,e,i,n){return D(t,e,i,n,!0)}function k(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),F(t))}class G extends O{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(n)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let r=0;r0;)this.pop()}extend(t){for(let e=0,i=t.length;ethis.getLength())throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(i),this.array_.splice(e,0,i),this.updateLength_(),this.dispatchEvent(new W(t,i,e))}pop(){return this.removeAt(this.getLength()-1)}push(t){const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,n=e.length;i=this.getLength())return;const i=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new W(e,i,t)),i}setAt(i,n){if(i>=this.getLength())return void this.insertAt(i,n);if(i<0)throw new Error("Index out of bounds: "+i);this.unique_&&this.assertUnique_(n,i);const r=this.array_[i];this.array_[i]=n,this.dispatchEvent(new W(e,r,i)),this.dispatchEvent(new W(t,n,i))}updateLength_(){this.set($,this.array_.length)}assertUnique_(t,e){const i=this.array_;for(let n=0,r=i.length;nt)throw new Error("Tile load sequence violation");this.state=t,this.changed()}}load(){U()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(i){if(-1===i)return 1}else i=e,this.transitionStarts_[t]=i;const n=e-i+1e3/60;return n>=this.transition_?1:Q(n/this.transition_)}inTransition(t){return!!this.transition_&&-1!==this.transitionStarts_[t]}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}disposeInternal(){this.release(),super.disposeInternal()}}const rt="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"",st=rt.includes("safari")&&!rt.includes("chrom"),ot=st&&(rt.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(rt)),at=rt.includes("webkit")&&!rt.includes("edge"),lt=rt.includes("macintosh"),ht="undefined"!=typeof devicePixelRatio?devicePixelRatio:1,ct="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,ut="undefined"!=typeof Image&&Image.prototype.decode,dt="function"==typeof createImageBitmap,gt=function(){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch{}return t}();function ft(t,e,i,n){let r;return r=i&&i.length?i.shift():ct?new class extends OffscreenCanvas{style={}}(t??300,e??150):document.createElement("canvas"),t&&(r.width=t),e&&(r.height=e),r.getContext("2d",n)}let pt;function _t(){return pt||(pt=ft(1,1)),pt}function mt(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function yt(t){let e=t.offsetWidth;const i=getComputedStyle(t);return e+=parseInt(i.marginLeft,10)+parseInt(i.marginRight,10),e}function xt(t){let e=t.offsetHeight;const i=getComputedStyle(t);return e+=parseInt(i.marginTop,10)+parseInt(i.marginBottom,10),e}function vt(t,e){const i=e.parentNode;i&&i.replaceChild(t,e)}function St(t){for(;t.lastChild;)t.lastChild.remove()}function Et(t,e){const i=t.childNodes;for(let n=0;;++n){const r=i[n],s=e[n];if(!r&&!s)break;r!==s&&(r?s?t.insertBefore(s,r):(t.removeChild(r),--n):t.appendChild(s))}}function wt(){return new Proxy({childNodes:[],appendChild:function(t){return this.childNodes.push(t),t},remove:function(){},removeChild:function(t){const e=this.childNodes.indexOf(t);if(-1===e)throw new Error("Node to remove was not found");return this.childNodes.splice(e,1),t},insertBefore:function(t,e){const i=this.childNodes.indexOf(e);if(-1===i)throw new Error("Reference node not found");return this.childNodes.splice(i,0,t),t},style:{}},{get:(t,e,i)=>"firstElementChild"===e?t.childNodes.length>0?t.childNodes[0]:null:Reflect.get(t,e,i)})}function Tt(t){return"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas}function Ct(t){return t instanceof Image||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageBitmap?t:null}function bt(t){return t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||t instanceof DataView?t:null}const Rt=new Error("disposed");let Pt=null;function It(t){Pt||(Pt=ft(t.width,t.height,void 0,{willReadFrequently:!0}));const e=Pt.canvas,i=t.width;e.width!==i&&(e.width=i);const n=t.height;return e.height!==n&&(e.height=n),Pt.clearRect(0,0,i,n),Pt.drawImage(t,0,0),Pt.getImageData(0,0,i,n).data}const Ft=[256,256];class Lt extends nt{constructor(t){const e=Y;super(t.tileCoord,e,{transition:t.transition,interpolate:t.interpolate}),this.loader_=t.loader,this.data_=null,this.error_=null,this.size_=t.size||null,this.controller_=t.controller||null}getSize(){if(this.size_)return this.size_;const t=Ct(this.data_);return t?[t.width,t.height]:Ft}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==Y&&this.state!==q)return;this.state=H,this.changed();const t=this;this.loader_().then((function(e){t.data_=e,t.state=K,t.changed()})).catch((function(e){t.error_=e,t.state=q,t.changed()}))}disposeInternal(){this.controller_&&(this.controller_.abort(Rt),this.controller_=null),super.disposeInternal()}}function Mt(t,e){if(!t)throw new Error(e)}class At extends V{constructor(t){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),t)if("function"==typeof t.getSimplifiedGeometry){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new At(this.hasProperties()?this.getProperties():null);t.setGeometryName(this.getGeometryName());const e=this.getGeometry();e&&t.setGeometry(e.clone());const i=this.getStyle();return i&&t.setStyle(i),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(k(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=D(t,n,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?Ot(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}}function Ot(t){if("function"==typeof t)return t;let e;if(Array.isArray(t))e=t;else{Mt("function"==typeof t.getZIndex,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`");e=[t]}return function(){return e}}var Dt=0,Nt=1,kt=2,Gt=4,jt=8,Ut=16;function Bt(t){const e=Ht();for(let i=0,n=t.length;ir&&(l|=Gt),as&&(l|=kt),l===Dt&&(l=Nt),l}function Ht(){return[1/0,1/0,-1/0,-1/0]}function Kt(t,e,i,n,r){return r?(r[0]=t,r[1]=e,r[2]=i,r[3]=n,r):[t,e,i,n]}function qt(t){return Kt(1/0,1/0,-1/0,-1/0,t)}function Jt(t,e){const i=t[0],n=t[1];return Kt(i,n,i,n,e)}function Qt(t,e,i,n,r){return se(qt(r),t,e,i,n)}function te(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function ee(t,e,i){return Math.abs(t[0]-e[0])t[2]&&(t[2]=e[2]),e[1]t[3]&&(t[3]=e[3]),t}function ne(t,e){e[0]t[2]&&(t[2]=e[0]),e[1]t[3]&&(t[3]=e[1])}function re(t,e){for(let i=0,n=e.length;ie[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function Ee(t){return t[2]=o&&p<=l),n||!(s&Gt)||r&Gt||(_=g-(d-l)*f,n=_>=a&&_<=h),n||!(s&jt)||r&jt||(p=d-(g-a)/f,n=p>=o&&p<=l),n||!(s&Ut)||r&Ut||(_=g-(d-o)*f,n=_>=a&&_<=h)}return n}function be(t,e,i,n){if(Ee(t))return qt(i);let r=[];if(n>1){const e=t[2]-t[0],i=t[3]-t[1];for(let s=0;s=i[2])){const e=ve(i),r=Math.floor((n[0]-i[0])/e)*e;t[0]-=r,t[2]-=r}return t}function Pe(t,e,i){if(e.canWrapX()){const n=e.getExtent();if(!isFinite(t[0])||!isFinite(t[2]))return[[n[0],t[1],n[2],t[3]]];Re(t,e);const r=ve(n);if(ve(t)>r&&!i)return[[n[0],t[1],n[2],t[3]]];if(t[0]n[2])return[[t[0],t[1],n[2],t[3]],[n[0],t[1],t[2]-r,t[3]]]}return[t]}function Ie(t,e,i){return Math.min(Math.max(t,e),i)}function Fe(t,e,i,n,r,s){const o=r-i,a=s-n;if(0!==o||0!==a){const l=((t-i)*o+(e-n)*a)/(o*o+a*a);l>1?(i=r,n=s):l>0&&(i+=o*l,n+=a*l)}return Le(t,e,i,n)}function Le(t,e,i,n){const r=i-t,s=n-e;return r*r+s*s}function Me(t){const e=t.length;for(let i=0;ir&&(r=e,n=s)}if(0===r)return null;const s=t[n];t[n]=t[i],t[i]=s;for(let n=i+1;n=0;n--){i[n]=t[n][e]/t[n][n];for(let r=n-1;r>=0;r--)t[r][e]-=t[r][n]*i[n]}return i}function Ae(t){return 180*t/Math.PI}function Oe(t){return t*Math.PI/180}function De(t,e){const i=t%e;return i*e<0?i+e:i}function Ne(t,e,i){return t+i*(e-t)}function ke(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function Ge(t,e){return Math.round(ke(t,e))}function je(t,e){return Math.floor(ke(t,e))}function Ue(t,e){return Math.ceil(ke(t,e))}function Be(t,e,i){if(t>=e&&tZe.warn||console.warn(...t)}function Ke(...t){Ye>Ze.error||console.error(...t)}function qe(t,e,i){const n=void 0!==i?t.toFixed(i):""+t;let r=n.indexOf(".");return r=-1===r?n.length:r,r>e?n:new Array(1+e-r).join("0")+n}function Je(t,e){const i=(""+t).split("."),n=(""+e).split(".");for(let t=0;tr)return 1;if(r>e)return-1}return 0}function Qe(t,e){return t[0]+=+e[0],t[1]+=+e[1],t}function ti(t,e){const i=e.getRadius(),n=e.getCenter(),r=n[0],s=n[1];let o=t[0]-r;const a=t[1]-s;0===o&&0===a&&(o=1);const l=Math.sqrt(o*o+a*a);return[r+i*o/l,s+i*a/l]}function ei(t,e){const i=t[0],n=t[1],r=e[0],s=e[1],o=r[0],a=r[1],l=s[0],h=s[1],c=l-o,u=h-a,d=0===c&&0===u?0:(c*(i-o)+u*(n-a))/(c*c+u*u||0);let g,f;return d<=0?(g=o,f=a):d>=1?(g=l,f=h):(g=o+d*c,f=a+d*u),[g,f]}function ii(t,e,i){const n=De(e+180,360)-180,r=Math.abs(3600*n),s=i||0;let o=Math.floor(r/3600),a=Math.floor((r-3600*o)/60),l=ke(r-3600*o-60*a,s);l>=60&&(l=0,a+=1),a>=60&&(a=0,o+=1);let h=o+"°";return 0===a&&0===l||(h+=" "+qe(a,2)+"′"),0!==l&&(h+=" "+qe(l,2,s)+"″"),0!==n&&(h+=" "+t.charAt(n<0?1:0)),h}function ni(t,e,i){return t?e.replace("{x}",t[0].toFixed(i)).replace("{y}",t[1].toFixed(i)):""}function ri(t,e){let i=!0;for(let n=t.length-1;n>=0;--n)if(t[n]!=e[n]){i=!1;break}return i}function si(t,e){const i=Math.cos(e),n=Math.sin(e),r=t[0]*i-t[1]*n,s=t[1]*i+t[0]*n;return t[0]=r,t[1]=s,t}function oi(t,e){return t[0]*=e,t[1]*=e,t}function ai(t,e){const i=t[0]-e[0],n=t[1]-e[1];return i*i+n*n}function li(t,e){return Math.sqrt(ai(t,e))}function hi(t,e){return ai(t,ei(t,e))}function ci(t,e){return ni(t,"{x}, {y}",e)}function ui(t,e){if(e.canWrapX()){const i=ve(e.getExtent()),n=di(t,e,i);n&&(t[0]-=n*i)}return t}function di(t,e,i){const n=e.getExtent();let r=0;return e.canWrapX()&&(t[0]n[2])&&(i=i||ve(n),r=Math.floor((t[0]-n[0])/i)),r}function gi(t,e,i){const n=Math.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])),r=[(e[0]-t[0])/n,(e[1]-t[1])/n],s=[-r[1],r[0]],o=Math.sqrt((i[0]-t[0])*(i[0]-t[0])+(i[1]-t[1])*(i[1]-t[1])),a=[(i[0]-t[0])/o,(i[1]-t[1])/o];let l=0===n||0===o?0:Math.acos(Ie(a[0]*r[0]+a[1]*r[1],-1,1));l=Math.max(l,1e-5);return a[0]*s[0]+a[1]*s[1]>0?l:2*Math.PI-l}const fi={9001:"m",9002:"ft",9003:"us-ft",9101:"radians",9102:"degrees"};function pi(t){return fi[t]}const _i={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class mi{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||_i[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}}const yi=6378137,xi=Math.PI*yi,vi=[-xi,-xi,xi,xi],Si=[-180,-85,180,85],Ei=yi*Math.log(Math.tan(Math.PI/2));class wi extends mi{constructor(t){super({code:t,units:"m",extent:vi,global:!0,worldExtent:Si,getPointResolution:function(t,e){return t/Math.cosh(e[1]/yi)}})}}const Ti=[new wi("EPSG:3857"),new wi("EPSG:102100"),new wi("EPSG:102113"),new wi("EPSG:900913"),new wi("http://www.opengis.net/def/crs/EPSG/0/3857"),new wi("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Ci(t,e,i,n){const r=t.length;i=i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(r));for(let i=0;iEi?n=Ei:n<-Ei&&(n=-Ei),e[i+1]=n}return e}function bi(t,e,i,n){const r=t.length;i=i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(r));for(let i=0;i84&&(e=84);const n=Oe(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,h=Oe(t),c=Oe(ln(i.number)),u=sn/Math.sqrt(1-Bi*r**2),d=Vi*s**2,g=s*Be(h-c,-Math.PI,Math.PI),f=g*g,p=f*g,_=p*g,m=_*g,y=m*g,x=sn*(qi*n-.002514607064228144*Math.sin(2*n)+Ji*Math.sin(4*n)-Qi*Math.sin(6*n)),v=Ui*u*(g+p/6*(1-a+d)+m/120*(5-18*a+l+72*d-58*Vi))+5e5;let S=Ui*(x+u*o*(f/2+_/24*(5-a+9*d+4*d**2)+y/720*(61-58*a+l+600*d-330*Vi)));return i.north||(S+=1e7),[v,S]}function ln(t){return 6*(t-1)-180+3}const hn=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function cn(t){let e=0;for(const i of hn){const n=t.match(i);if(n){e=parseInt(n[1]);break}}if(!e)return null;let i=0,n=!1;return e>32700&&e<32761?i=e-32700:e>32600&&e<32661&&(n=!0,i=e-32600),i?{number:i,north:n}:null}function un(t,e){return function(i,n,r,s){const o=i.length;r=r>1?r:2,s=s??r,n||(n=r>2?i.slice():new Array(o));for(let r=0;r=a?e[o+t]:s[t]}return i}}function Pn(t,e,i,n){const r=En(t),s=En(e);Gi(r,s,Rn(i)),Gi(s,r,Rn(n))}function In(t,e){const i=On(t,void 0!==e?e:"EPSG:3857","EPSG:4326"),n=i[0];return(n<-180||n>180)&&(i[0]=De(n+180,360)-180),i}function Fn(t,e){if(t===e)return!0;const i=t.getUnits()===e.getUnits();if(t.getCode()===e.getCode())return i;return Ln(t,e)===yn&&i}function Ln(t,e){const i=t.getCode(),n=e.getCode();let r=ji(i,n);if(r)return r;let s=null,o=null;for(const i of fn)s||(s=i(t)),o||(o=i(e));if(!s&&!o)return null;const a="EPSG:4326";if(o)if(s)r=Mn(s.inverse,o.forward);else{const t=ji(i,a);t&&(r=Mn(t,o.forward))}else{const t=ji(a,n);t&&(r=Mn(s.inverse,t))}return r&&(vn(t),vn(e),Gi(t,e,r)),r}function Mn(t,e){return function(i,n,r,s){return n=t(i,n,r,s),e(n,n,r,s)}}function An(t,e){return Ln(En(t),En(e))}function On(t,e,i){const n=An(e,i);if(!n){const t=En(e).getCode(),n=En(i).getCode();throw new Error(`No transform available between ${t} and ${n}`)}return n(t,void 0,t.length)}function Dn(t,e,i,n){return be(t,An(e,i),void 0,n)}let Nn=null;function kn(t){Nn=En(t)}function Gn(){return Nn}function jn(t,e){return Nn?On(t,e,Nn):t}function Un(t,e){return Nn?On(t,Nn,e):(_n&&!ri(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(_n=!1,He("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t)}function Bn(t,e){return Nn?Dn(t,e,Nn):t}function zn(t,e){return Nn?Dn(t,Nn,e):t}function Xn(t,e){if(!Nn)return t;const i=En(e).getMetersPerUnit(),n=Nn.getMetersPerUnit();return i&&n?t*i/n:t}function Vn(t,e){if(!Nn)return t;const i=En(e).getMetersPerUnit(),n=Nn.getMetersPerUnit();return i&&n?t*n/i:t}function $n(t,e,i){return function(n){let r,s;if(t.canWrapX()){const e=t.getExtent(),o=ve(e);s=di(n=n.slice(0),t,o),s&&(n[0]=n[0]-s*o),n[0]=Ie(n[0],e[0],e[2]),n[1]=Ie(n[1],e[1],e[3]),r=i(n)}else r=i(n);return s&&e.canWrapX()&&(r[0]+=s*ve(e.getExtent())),r}}function Wn(){Tn(Ti),Tn(Li),Cn(Li,Ti,Ci,bi)}Wn();const Zn=new Array(6);function Yn(){return[1,0,0,1,0,0]}function Hn(t){return qn(t,1,0,0,1,0,0)}function Kn(t,e){const i=t[0],n=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=e[0],h=e[1],c=e[2],u=e[3],d=e[4],g=e[5];return t[0]=i*l+r*h,t[1]=n*l+s*h,t[2]=i*c+r*u,t[3]=n*c+s*u,t[4]=i*d+r*g+o,t[5]=n*d+s*g+a,t}function qn(t,e,i,n,r,s,o){return t[0]=e,t[1]=i,t[2]=n,t[3]=r,t[4]=s,t[5]=o,t}function Jn(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function Qn(t,e){const i=e[0],n=e[1];return e[0]=t[0]*i+t[2]*n+t[4],e[1]=t[1]*i+t[3]*n+t[5],e}function tr(t,e){const i=Math.cos(e),n=Math.sin(e);return Kn(t,qn(Zn,i,n,-n,i,0,0))}function er(t,e,i){return Kn(t,qn(Zn,e,0,0,i,0,0))}function ir(t,e,i){return Kn(t,qn(Zn,1,0,0,1,e,i))}function nr(t,e,i,n,r,s,o,a){const l=Math.sin(s),h=Math.cos(s);return t[0]=n*h,t[1]=r*l,t[2]=-n*l,t[3]=r*h,t[4]=o*n*h-a*n*l+e,t[5]=o*r*l+a*r*h+i,t}function rr(t,e){const i=sr(e);Mt(0!==i,"Transformation matrix cannot be inverted");const n=e[0],r=e[1],s=e[2],o=e[3],a=e[4],l=e[5];return t[0]=o/i,t[1]=-r/i,t[2]=-s/i,t[3]=n/i,t[4]=(s*l-o*a)/i,t[5]=-(n*l-r*a)/i,t}function sr(t){return t[0]*t[3]-t[1]*t[2]}const or=[1e5,1e5,1e5,1e5,2,2];function ar(t){return"matrix("+t.join(", ")+")"}function lr(t){return t.substring(7,t.length-1).split(",").map(parseFloat)}function hr(t,e){const i=lr(t),n=lr(e);for(let t=0;t<6;++t)if(0!==Math.round((i[t]-n[t])*or[t]))return!1;return!0}function cr(t,e,i,n,r,s,o){s=s||[],o=o||2;let a=0;for(let l=e;l{if(!i)return this.getSimplifiedGeometry(e);const n=this.clone();return n.applyTransform(i),n.getSimplifiedGeometry(e)}))}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return U()}closestPointXY(t,e,i,n){return U()}containsXY(t,e){return 0===this.closestPointXY(t,e,pr,Number.MIN_VALUE)}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return U()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&qt(t),this.extentRevision_=this.getRevision()}return we(this.extent_,t)}rotate(t,e){U()}scale(t,e,i){U()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return U()}getType(){return U()}applyTransform(t){U()}intersectsExtent(t){return U()}translate(t,e){U()}transform(t,e){const i=En(t),n="tile-pixels"==i.getUnits()?function(t,n,r){const s=i.getExtent(),o=i.getWorldExtent(),a=_e(o)/_e(s);nr(fr,o[0],o[3],a,-a,0,0,0);const l=cr(t,0,t.length,r,fr,n),h=An(i,e);return h?h(l,l,r):l}:An(i,e);return this.applyTransform(n),this}}class mr extends _r{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return Qt(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return U()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length1)u=i;else{if(d>0){for(let r=0;rr&&(r=a),s=i,o=n}return r}function br(t,e,i,n,r){for(let s=0,o=i.length;s0;){const i=h.pop(),s=h.pop();let o=0;const a=t[s],u=t[s+1],d=t[i],g=t[i+1];for(let e=s+n;eo&&(c=e,o=i)}o>r&&(l[(c-e)/n]=1,s+nr&&(s[o++]=h,s[o++]=c,a=h,l=c);return h==a&&c==l||(s[o++]=h,s[o++]=c),o}function Br(t,e){return e*Math.round(t/e)}function zr(t,e,i,n,r,s,o){if(e==i)return o;let a,l,h=Br(t[e],r),c=Br(t[e+1],r);e+=n,s[o++]=h,s[o++]=c;do{if(a=Br(t[e],r),l=Br(t[e+1],r),(e+=n)==i)return s[o++]=a,s[o++]=l,o}while(a==h&&l==c);for(;e0&&f>d)&&(g<0&&p0&&p>g)?(a=i,l=u):(s[o++]=a,s[o++]=l,h=a,c=l,a=i,l=u)}return s[o++]=a,s[o++]=l,o}function Xr(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;ls&&(i-a)*(s-l)-(r-a)*(n-l)>0&&o++:n<=s&&(i-a)*(s-l)-(r-a)*(n-l)<0&&o--,a=i,l=n}return 0!==o}function Hr(t,e,i,n,r,s){if(0===i.length)return!1;if(!Yr(t,e,i[0],n,r,s))return!1;for(let e=1,o=i.length;em&&(h=(c+u)/2,Hr(t,e,i,n,h,f)&&(_=h,m=r)),c=u}return isNaN(_)&&(_=r[s]),o?(o.push(_,f,m),o):[_,f,m]}function Jr(t,e,i,n,r){let s=[];for(let o=0,a=i.length;o=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]||Qr(t,e,i,n,(function(t,e){return Ce(r,t,e)})))}function is(t,e,i,n,r){for(let s=0,o=i.length;s0}function ls(t,e,i,n,r){r=void 0!==r&&r;for(let s=0,o=i.length;sthis.loader(this.getExtent(),e,this.getPixelRatio()))).then((t=>{"image"in t&&(this.image_=t.image),"extent"in t&&(this.extent=t.extent),"resolution"in t&&(this.resolution=t.resolution),"pixelRatio"in t&&(this.pixelRatio_=t.pixelRatio),(t instanceof HTMLImageElement||dt&&t instanceof ImageBitmap||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement)&&(this.image_=t),this.state=Ms})).catch((t=>{this.state=As,console.error(t)})).finally((()=>this.changed()))}}setImage(t){this.image_=t}setResolution(t){this.resolution=t}}function Ns(t,e,i){const n=t;let s=!0,o=!1,a=!1;const l=[N(n,g,(function(){a=!0,o||e()}))];return n.src&&ut?(o=!0,n.decode().then((function(){s&&e()})).catch((function(t){s&&(a?e():i())}))):l.push(N(n,r,i)),function(){s=!1,l.forEach(k)}}function ks(t,e){return new Promise(((i,n)=>{function r(){o(),i(t)}function s(){o(),n(new Error("Image load error"))}function o(){t.removeEventListener("load",r),t.removeEventListener("error",s)}t.addEventListener("load",r),t.addEventListener("error",s),e&&(t.src=e)}))}function Gs(t,e){return e&&(t.src=e),t.src&&ut?new Promise(((e,i)=>t.decode().then((()=>e(t))).catch((n=>t.complete&&t.width?e(t):i(n))))):ks(t)}function js(t,e){return e&&(t.src=e),t.src&&ut&&dt?t.decode().then((()=>createImageBitmap(t))).catch((e=>{if(t.complete&&t.width)return t;throw e})):Gs(t)}class Us extends Ds{constructor(t,e,i,n,r){super(t,e,i,void 0!==r?Fs:Ms),this.loader_=void 0!==r?r:null,this.canvas_=n,this.error_=null}getError(){return this.error_}handleLoad_(t){t?(this.error_=t,this.state=As):this.state=Ms,this.changed()}load(){this.state==Fs&&(this.state=Ls,this.changed(),this.loader_(this.handleLoad_.bind(this)))}getImage(){return this.canvas_}}class Bs extends nt{constructor(t,e,i,n,r,s){super(t,e,s),this.crossOrigin_=n?.crossOrigin,this.referrerPolicy_=n?.referrerPolicy,this.src_=i,this.key=i,this.image_,ct?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(t){this.image_=t,this.state=K,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=q,this.unlistenImage_(),this.image_=function(){const t=ft(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}(),this.changed()}handleImageLoad_(){if(ct)this.state=K;else{const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=K:this.state=J}this.unlistenImage_(),this.changed()}load(){this.state==q&&(this.state=Y,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==Y&&(this.state=H,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=Ns(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}}class zs{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]0&&this.points_[i+2]>t;)i-=3;const n=this.points_[e+2]-this.points_[i+2];if(n<1e3/60)return!1;const r=this.points_[e]-this.points_[i],s=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(s,r),this.initialVelocity_=Math.sqrt(r*r+s*s)/n,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}class Xs extends M{constructor(t,e,i){super(t),this.map=e,this.frameState=void 0!==i?i:null}}class Vs extends Xs{constructor(t,e,i,n,r,s){super(t,e,r),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=void 0!==n&&n,this.activePointers=s}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(t){this.pixel_=t}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(t){this.coordinate_=t}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}}var $s={SINGLECLICK:"singleclick",CLICK:o,DBLCLICK:a,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},Ws="pointermove",Zs="pointerdown",Ys="pointerup",Hs="pointerout";class Ks extends O{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=void 0===e?1:e,this.down_=null;const i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=D(i,Zs,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=D(i,Ws,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(f,this.boundHandleTouchMove_,!!gt&&{passive:!1})}emulateClick_(t){let e=new Vs($s.CLICK,this.map_,t);this.dispatchEvent(e),void 0!==this.clickTimeoutId_?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new Vs($s.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout((()=>{this.clickTimeoutId_=void 0;const e=new Vs($s.SINGLECLICK,this.map_,t);this.dispatchEvent(e)}),250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==$s.POINTERUP||e.type==$s.POINTERCANCEL){delete this.trackedTouches_[i];for(const t in this.trackedTouches_)if(this.trackedTouches_[t].target!==e.target){delete this.trackedTouches_[t];break}}else e.type!=$s.POINTERDOWN&&e.type!=$s.POINTERMOVE||(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new Vs($s.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),0===this.activePointers_.length&&(this.dragListenerKeys_.forEach(k),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return 0===t.button}handlePointerDown_(t){this.emulateClicks_=0===this.activePointers_.length,this.updateActivePointers_(t);const e=new Vs($s.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),0===this.dragListenerKeys_.length){const t=this.map_.getOwnerDocument();this.dragListenerKeys_.push(D(t,$s.POINTERMOVE,this.handlePointerMove_,this),D(t,$s.POINTERUP,this.handlePointerUp_,this),D(this.element_,$s.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==t&&this.dragListenerKeys_.push(D(this.element_.getRootNode(),$s.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new Vs($s.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!(!this.down_||!this.isMoving_(t));this.dispatchEvent(new Vs($s.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;e&&!e.defaultPrevented||"boolean"==typeof t.cancelable&&!0!==t.cancelable||t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(k(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(f,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(k(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(k),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}var qs="postrender",Js="movestart",Qs="moveend",to="loadstart",eo="loadend",io="layergroup",no="size",ro="target",so="view";const oo=1/0;class ao{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,F(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const n=this.keyFunction_(i);return delete this.queuedElements_[n],i}enqueue(t){Mt(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=oo&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(t){return 2*t+1}getRightChildIndex_(t){return 2*t+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return 0===this.elements_.length}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,n=e.length,r=e[t],s=i[t],o=t;for(;t>1;){const r=this.getLeftChildIndex_(t),s=this.getRightChildIndex_(t),o=st;){const t=this.getParentIndex_(e);if(!(n[t]>s))break;i[e]=i[t],n[e]=n[t],e=t}i[e]=r,n[e]=s}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let n=0;const r=e.length;let s,o,a;for(o=0;ot.apply(null,e)),(t=>t[0].getKey())),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);if(e){t[0].addEventListener(n,this.boundHandleTileChange_)}return e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(i===K||i===q||i===J){i!==q&&e.removeEventListener(n,this.boundHandleTileChange_);const t=e.getKey();t in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[t],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i=0;for(;this.tilesLoading_0;){const t=this.dequeue()[0],e=t.getKey();t.getState()!==Y||e in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[e]=!0,++this.tilesLoading_,++i,t.load())}}}function ho(t,e,i,n,r){if(!t||!(i in t.wantedTiles))return oo;if(!t.wantedTiles[i][e.getKey()])return oo;const s=t.viewState.center,o=n[0]-s[0],a=n[1]-s[1];return 65536*Math.log(r)+Math.sqrt(o*o+a*a)/r}var co=0,uo=1,go={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function fo(t,e,i){return function(n,r,s,o,a){if(!n)return;if(!r&&!e)return n;const l=e?0:s[0]*r,h=e?0:s[1]*r,c=a?a[0]:0,u=a?a[1]:0;let d=t[0]+l/2+c,g=t[2]-l/2+c,f=t[1]+h/2+u,p=t[3]-h/2+u;d>g&&(d=(g+d)/2,g=d),f>p&&(f=(p+f)/2,p=f);let _=Ie(n[0],d,g),m=Ie(n[1],f,p);if(o&&i&&r){const t=30*r;_+=-t*Math.log(1+Math.max(0,d-n[0])/t)+t*Math.log(1+Math.max(0,n[0]-g)/t),m+=-t*Math.log(1+Math.max(0,f-n[1])/t)+t*Math.log(1+Math.max(0,n[1]-p)/t)}return[_,m]}}function po(t){return t}function _o(t,e,i,n){const r=ve(e)/i[0],s=_e(e)/i[1];return n?Math.min(t,Math.max(r,s)):Math.min(t,Math.min(r,s))}function mo(t,e,i){let n=Math.min(t,e);return n*=Math.log(1+50*Math.max(0,t/e-1))/50+1,i&&(n=Math.max(n,i),n/=Math.log(1+50*Math.max(0,i/t-1))/50+1),Ie(n,i/2,2*e)}function yo(t,e,i,n){return e=void 0===e||e,function(r,s,o,a){if(void 0!==r){const l=t[0],h=t[t.length-1],c=i?_o(l,i,o,n):l;if(a)return e?mo(r,c,h):Ie(r,h,c);const u=Math.min(c,r),d=Math.floor(v(t,u,s));return t[d]>c&&d1&&"function"==typeof arguments[i-1]&&(e=arguments[i-1],--i);let n=0;for(;n0}getInteracting(){return this.hints_[uo]>0}cancelAnimations(){let t;this.setHint(co,-this.hints_[co]);for(let e=0,i=this.animations_.length;e=0;--i){const n=this.animations_[i];let r=!0;for(let i=0,s=n.length;i0?o/s.duration:1;a>=1?(s.complete=!0,a=1):r=!1;const l=s.easing(a);if(s.sourceCenter){const t=s.sourceCenter[0],e=s.sourceCenter[1],i=s.targetCenter[0],n=s.targetCenter[1];this.nextCenter_=s.targetCenter;const r=t+l*(i-t),o=e+l*(n-e);this.targetCenter_=[r,o]}if(s.sourceResolution&&s.targetResolution){const t=1===l?s.targetResolution:s.sourceResolution+l*(s.targetResolution-s.sourceResolution);if(s.anchor){const e=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(i,s.anchor)}this.nextResolution_=s.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==s.sourceRotation&&void 0!==s.targetRotation){const t=1===l?De(s.targetRotation+Math.PI,2*Math.PI)-Math.PI:s.sourceRotation+l*(s.targetRotation-s.sourceRotation);if(s.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,s.anchor)}this.nextRotation_=s.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!s.complete)break}if(r){this.animations_[i]=null,this.setHint(co,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=n[0].callback;t&&Ro(t,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const n=this.getCenterInternal();return void 0!==n&&(i=[n[0]-e[0],n[1]-e[1]],si(i,t-this.getRotation()),Qe(i,e)),i}calculateCenterZoom(t,e){let i;const n=this.getCenterInternal(),r=this.getResolution();if(void 0!==n&&void 0!==r){i=[e[0]-t*(e[0]-n[0])/r,e[1]-t*(e[1]-n[1])/r]}return i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],n=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t?jn(t,this.getProjection()):t}getCenterInternal(){return this.get(go.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){return Bn(this.calculateExtentInternal(t),this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();Mt(e,"The view center is not defined");const i=this.getResolution();Mt(void 0!==i,"The view resolution is not defined");const n=this.getRotation();return Mt(void 0!==n,"The view rotation is not defined"),fe(e,i,n,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(go.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(zn(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=ve(t)/e[0],n=_e(t)/e[1];return Math.max(i,n)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,n=Math.log(e/i)/Math.log(t);return function(i){return e/Math.pow(t,i*n)}}getRotation(){return this.get(go.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(i/n)/e;return function(t){return Math.log(i/t)/e/r}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let n=this.getCenterInternal();const r=this.padding_;if(r){const t=this.getViewportSizeMinusPadding_();n=Mo(n,this.getViewportSize_(),[t[0]/2+r[3],t[1]/2+r[0]],e,i)}return{center:n.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,i,n=this.minZoom_||0;if(this.resolutions_){const r=v(this.resolutions_,t,1);n=r,e=this.resolutions_[r],i=r==this.resolutions_.length-1?2:e/this.resolutions_[r+1]}else e=this.maxResolution_,i=this.zoomFactor_;return n+Math.log(e/t)/Math.log(i)}getResolutionForZoom(t){if(this.resolutions_?.length){if(1===this.resolutions_.length)return this.resolutions_[0];const e=Ie(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,Ie(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(Mt(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){Mt(!Ee(t),"Cannot fit empty extent provided as `geometry`");i=ps(zn(t,this.getProjection()))}else if("Circle"===t.getType()){const e=zn(t.getExtent(),this.getProjection());i=ps(e),i.rotate(this.getRotation(),de(e))}else{const e=Gn();i=e?t.clone().transform(e,this.getProjection()):t}this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),n=Math.sin(-e),r=t.getFlatCoordinates(),s=t.getStride();let o=1/0,a=1/0,l=-1/0,h=-1/0;for(let t=0,e=r.length;tt.trim().replace(/^['"]|['"]$/g,""))),i};class Xo extends V{constructor(t){super();const e=t.element;!e||t.target||e.style.pointerEvents||(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&this.element?.remove();for(let t=0,e=this.listenerKeys.length;te.getAttributions(t))));if(void 0!==this.attributions_&&(Array.isArray(this.attributions_)?this.attributions_.forEach((t=>i.add(t))):i.add(this.attributions_)),!this.overrideCollapsible_){const t=!e.some((t=>!1===t.getSource()?.getAttributionsCollapsible()));this.setCollapsible(t)}return Array.from(i)}async updateElement_(t){if(!t)return void(this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1));const e=await Promise.all(this.collectSourceAttributions_(t).map((t=>I((()=>t))))),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!w(e,this.renderedAttributions_)){St(this.ulElement_);for(let t=0,i=e.length;t0&&e%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:tt}):t.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.rotation_){const t="rotate("+i+"rad)";if(this.autoHide_){const t=this.element.classList.contains(Ao);t||0!==i?t&&0!==i&&this.element.classList.remove(Ao):this.element.classList.add(Ao)}this.label_.style.transform=t}this.rotation_=i}}class Wo extends Xo{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=void 0!==t.className?t.className:"ol-zoom",i=void 0!==t.delta?t.delta:1,n=void 0!==t.zoomInClassName?t.zoomInClassName:e+"-in",r=void 0!==t.zoomOutClassName?t.zoomOutClassName:e+"-out",s=void 0!==t.zoomInLabel?t.zoomInLabel:"+",a=void 0!==t.zoomOutLabel?t.zoomOutLabel:"–",l=void 0!==t.zoomInTipLabel?t.zoomInTipLabel:"Zoom in",h=void 0!==t.zoomOutTipLabel?t.zoomOutTipLabel:"Zoom out",c=document.createElement("button");c.className=n,c.setAttribute("type","button"),c.title=l,c.appendChild("string"==typeof s?document.createTextNode(s):s),c.addEventListener(o,this.handleClick_.bind(this,i),!1);const u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=h,u.appendChild("string"==typeof a?document.createTextNode(a):a),u.addEventListener(o,this.handleClick_.bind(this,-i),!1);const d=e+" "+Do+" "+ko,g=this.element;g.className=d,g.appendChild(c),g.appendChild(u),this.duration_=void 0!==t.duration?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const e=this.getMap().getView();if(!e)return;const i=e.getZoom();if(void 0!==i){const n=e.getConstrainedZoom(i+t);this.duration_>0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:n,duration:this.duration_,easing:tt})):e.setZoom(n)}}}function Zo(t){t=t||{};const e=new Z;(void 0===t.zoom||t.zoom)&&e.push(new Wo(t.zoomOptions));(void 0===t.rotate||t.rotate)&&e.push(new $o(t.rotateOptions));return(void 0===t.attribution||t.attribution)&&e.push(new Vo(t.attributionOptions)),e}var Yo="active";class Ho extends V{constructor(t){super(),this.on,this.once,this.un,t&&t.handleEvent&&(this.handleEvent=t.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(Yo)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(Yo,t)}setMap(t){this.map_=t}}function Ko(t,e,i){const n=t.getCenterInternal();if(n){const r=[n[0]+e[0],n[1]+e[1]];t.animateInternal({duration:void 0!==i?i:250,easing:it,center:t.getConstrainedCenter(r)})}}function qo(t,e,i,n){const r=t.getZoom();if(void 0===r)return;const s=t.getConstrainedZoom(r+e),o=t.getResolutionForZoom(s);t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:o,anchor:i,duration:void 0!==n?n:250,easing:tt})}class Jo extends Ho{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:250}handleEvent(t){let e=!1;if(t.type==$s.DBLCLICK){const i=t.originalEvent,n=t.map,r=t.coordinate,s=i.shiftKey?-this.delta_:this.delta_;qo(n.getView(),s,r,this.duration_),i.preventDefault(),e=!0}return!e}}function Qo(t){const e=arguments;return function(t){let i=!0;for(let n=0,r=e.length;n0}}else if(t.type==$s.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==$s.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}}function pa(t){const e=t.length;let i=0,n=0;for(let r=0;r0&&this.condition_(t)){const e=t.map.getView();return this.lastCentroid=null,e.getAnimating()&&e.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}}class ma extends fa{constructor(t){t=t||{},super({stopDown:b}),this.condition_=t.condition?t.condition:ea,this.lastAngle_=void 0,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){if(!da(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===So)return;const n=e.getSize(),r=t.pixel,s=Math.atan2(n[1]/2-r[1],r[0]-n[0]/2);if(void 0!==this.lastAngle_){const t=s-this.lastAngle_;i.adjustRotationInternal(-t)}this.lastAngle_=s}handleUpEvent(t){if(!da(t))return!0;return t.map.getView().endInteraction(this.duration_),!1}handleDownEvent(t){if(!da(t))return!1;if(sa(t)&&this.condition_(t)){return t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0}return!1}}class ya extends _{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_,i="px",n=this.element_.style;n.left=Math.min(t[0],e[0])+i,n.top=Math.min(t[1],e[1])+i,n.width=Math.abs(e[0]-t[0])+i,n.height=Math.abs(e[1]-t[1])+i}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;const t=this.startPixel_,e=this.endPixel_,i=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);i[4]=i[0].slice(),this.geometry_?this.geometry_.setCoordinates([i]):this.geometry_=new gs([i])}getGeometry(){return this.geometry_}}const xa="boxstart",va="boxdrag",Sa="boxend",Ea="boxcancel";class wa extends M{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}class Ta extends fa{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new ya(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??sa,this.boxEndCondition_=t.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){const n=i[0]-e[0],r=i[1]-e[1];return n*n+r*r>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.startPixel_&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new wa(va,t.coordinate,t)))}handleUpEvent(t){if(!this.startPixel_)return!1;const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new wa(e?Sa:Ea,t.coordinate,t)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(t){return!!this.condition_(t)&&(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new wa(xa,t.coordinate,t)),!0)}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new wa(Ea,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new wa(Ea,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}}class Ca extends Ta{constructor(t){super({condition:(t=t||{}).condition?t.condition:ca,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=void 0!==t.duration?t.duration:200,this.out_=void 0!==t.out&&t.out}onBoxEnd(t){const e=this.getMap().getView();let i=this.getGeometry();if(this.out_){const t=e.rotatedExtentForGeometry(i),n=e.getResolutionForExtentInternal(t),r=e.getResolution()/n;i=i.clone(),i.scale(r*r)}e.fitInternal(i,{duration:this.duration_,easing:tt})}}var ba="ArrowLeft",Ra="ArrowUp",Pa="ArrowRight",Ia="ArrowDown";class Fa extends Ho{constructor(t){super(),t=t||{},this.defaultCondition_=function(t){return la(t)&&ua(t)},this.condition_=void 0!==t.condition?t.condition:this.defaultCondition_,this.duration_=void 0!==t.duration?t.duration:100,this.pixelDelta_=void 0!==t.pixelDelta?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==u){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&(n==Ia||n==ba||n==Pa||n==Ra)){const r=t.map.getView(),s=r.getResolution()*this.pixelDelta_;let o=0,a=0;n==Ia?a=-s:n==ba?o=-s:n==Pa?o=s:a=s;const l=[o,a];si(l,r.getRotation()),Ko(r,l,this.duration_),i.preventDefault(),e=!0}}return!e}}class La extends Ho{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(t){return!ha(t)&&ua(t)},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:100}handleEvent(t){let e=!1;if(t.type==u||t.type==d){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&("+"===n||"-"===n)){const r=t.map,s="+"===n?this.delta_:-this.delta_;qo(r.getView(),s,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}}class Ma extends Ho{constructor(t){super(t=t||{}),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=void 0!==t.maxDelta?t.maxDelta:1,this.duration_=void 0!==t.duration?t.duration:250,this.timeout_=void 0!==t.timeout?t.timeout:80,this.useAnchor_=void 0===t.useAnchor||t.useAnchor,this.constrainResolution_=void 0!==t.constrainResolution&&t.constrainResolution;const e=t.condition?t.condition:ra;this.condition_=t.onFocusOnly?Qo(na,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();if(!t)return;t.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(t){if(!this.condition_(t))return!0;if(t.type!==p)return!0;const e=t.map,i=t.originalEvent;i.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.pixel);let n=i.deltaY;switch(i.deltaMode){case WheelEvent.DOM_DELTA_LINE:n*=40;break;case WheelEvent.DOM_DELTA_PAGE:n*=300}if(0===n)return!1;this.lastDelta_=n;const r=Date.now();void 0===this.startTime_&&(this.startTime_=r),(!this.mode_||r-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(n)<4?"trackpad":"wheel");const s=e.getView();if("trackpad"===this.mode_&&!s.getConstrainResolution()&&!this.constrainResolution_)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(s.getAnimating()&&s.cancelAnimations(),s.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),s.adjustZoom(-n/this.deltaPerZoom_,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=r,!1;this.totalDelta_+=n;const o=Math.max(this.timeout_-(r-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,e),o),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-Ie(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),qo(e,i,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}}class Aa extends fa{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=b),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=void 0!==t.threshold?t.threshold:.3,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){let e=0;const i=this.targetPointers[0],n=this.targetPointers[1],r=Math.atan2(n.clientY-i.clientY,n.clientX-i.clientX);if(void 0!==this.lastAngle_){const t=r-this.lastAngle_;this.rotationDelta_+=t,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=t}this.lastAngle_=r;const s=t.map,o=s.getView();o.getConstraints().rotation!==So&&(this.anchor_=s.getCoordinateFromPixelInternal(s.getEventPixel(pa(this.targetPointers))),this.rotating_&&(s.render(),o.adjustRotationInternal(e,this.anchor_)))}handleUpEvent(t){if(this.targetPointers.length<2){return t.map.getView().endInteraction(this.duration_),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}class Oa extends fa{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=b),super(e),this.anchor_=null,this.duration_=void 0!==t.duration?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const i=this.targetPointers[0],n=this.targetPointers[1],r=i.clientX-n.clientX,s=i.clientY-n.clientY,o=Math.sqrt(r*r+s*s);void 0!==this.lastDistance_&&(e=this.lastDistance_/o),this.lastDistance_=o;const a=t.map,l=a.getView();1!=e&&(this.lastScaleDelta_=e),this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(pa(this.targetPointers))),a.render(),l.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const e=t.map.getView(),i=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,i),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}function Da(t){t=t||{};const e=new Z,i=new zs(-.005,.05,100);(void 0===t.altShiftDragRotate||t.altShiftDragRotate)&&e.push(new ma);(void 0===t.doubleClickZoom||t.doubleClickZoom)&&e.push(new Jo({delta:t.zoomDelta,duration:t.zoomDuration}));(void 0===t.dragPan||t.dragPan)&&e.push(new _a({onFocusOnly:t.onFocusOnly,kinetic:i}));(void 0===t.pinchRotate||t.pinchRotate)&&e.push(new Aa);(void 0===t.pinchZoom||t.pinchZoom)&&e.push(new Oa({duration:t.zoomDuration}));(void 0===t.keyboard||t.keyboard)&&(e.push(new Fa),e.push(new La({delta:t.zoomDelta,duration:t.zoomDuration})));(void 0===t.mouseWheelZoom||t.mouseWheelZoom)&&e.push(new Ma({onFocusOnly:t.onFocusOnly,duration:t.zoomDuration}));return(void 0===t.shiftDragZoom||t.shiftDragZoom)&&e.push(new Ca({duration:t.zoomDuration})),e}var Na="opacity",ka="visible",Ga="extent",ja="zIndex",Ua="maxResolution",Ba="minResolution",za="maxZoom",Xa="minZoom",Va="source",$a="map";class Wa extends V{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);"object"==typeof t.properties&&(delete e.properties,Object.assign(e,t.properties)),e[Na]=void 0!==t.opacity?t.opacity:1,Mt("number"==typeof e[Na],"Layer opacity must be a number"),e[ka]=void 0===t.visible||t.visible,e[ja]=t.zIndex,e[Ua]=void 0!==t.maxResolution?t.maxResolution:1/0,e[Ba]=void 0!==t.minResolution?t.minResolution:0,e[Xa]=void 0!==t.minZoom?t.minZoom:-1/0,e[za]=void 0!==t.maxZoom?t.maxZoom:1/0,this.className_=void 0!==e.className?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:void 0===t||t},i=this.getZIndex();return e.opacity=Ie(Math.round(100*this.getOpacity())/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=void 0!==i||e.managed?i:1/0,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return U()}getLayerStatesArray(t){return U()}getExtent(){return this.get(Ga)}getMaxResolution(){return this.get(Ua)}getMinResolution(){return this.get(Ba)}getMinZoom(){return this.get(Xa)}getMaxZoom(){return this.get(za)}getOpacity(){return this.get(Na)}getSourceState(){return U()}getVisible(){return this.get(ka)}getZIndex(){return this.get(ja)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(Ga,t)}setMaxResolution(t){this.set(Ua,t)}setMinResolution(t){this.set(Ba,t)}setMaxZoom(t){this.set(za,t)}setMinZoom(t){this.set(Xa,t)}setOpacity(t){Mt("number"==typeof t,"Layer opacity must be a number"),this.set(Na,t)}setVisible(t){this.set(ka,t)}setZIndex(t){this.set(ja,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}const Za="addlayer",Ya="removelayer";class Ha extends M{constructor(t,e){super(t),this.layer=e}}const Ka="layers";class qa extends Wa{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let i=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(Ka,this.handleLayersChanged_),i?Array.isArray(i)?i=new Z(i.slice(),{unique:!0}):Mt("function"==typeof i.getArray,"Expected `layers` to be an array or a `Collection`"):i=new Z(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(k),this.layersListenerKeys_.length=0;const i=this.getLayers();this.layersListenerKeys_.push(D(i,t,this.handleLayersAdd_,this),D(i,e,this.handleLayersRemove_,this));for(const t in this.listenerKeys_)this.listenerKeys_[t].forEach(k);F(this.listenerKeys_);const n=i.getArray();for(let t=0,e=n.length;t{this.dispatchEvent("sourceready")}),0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return this.renderer_&&this.rendered?this.renderer_.getData(t):null}isVisible(t){let e;const i=this.getMapInternal();let n;if(!t&&i&&(t=i.getView()),e=t instanceof bo?{viewState:t.getState(),extent:t.calculateExtent()}:t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray()),e.layerStatesArray){if(n=e.layerStatesArray.find((t=>t.layer===this)),!n)return!1}else n=this.getLayerState();const r=this.getExtent();return rl(n,e.viewState)&&(!r||Se(r,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];let i=e(t instanceof bo?t.getViewStateAndExtent():t);return Array.isArray(i)||(i=[i]),i}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,e){}renderDeferred(t){const e=this.getRenderer();e&&e.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set($a,t)}getMapInternal(){return this.get($a)}setMap(t){this.mapPrecomposeKey_&&(k(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(k(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=D(t,tl,this.handlePrecompose_,this),this.mapRenderKey_=D(this,n,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);Mt(!e.some((t=>t.layer===i.layer)),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(i)}setSource(t){this.set(Va,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}}function rl(t,e){if(!t.visible)return!1;const i=e.resolution;if(i=t.maxResolution)return!1;const n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}function sl(t,e,i=0,n=t.length-1,r=al){for(;n>i;){if(n-i>600){const s=n-i+1,o=e-i+1,a=Math.log(s),l=.5*Math.exp(2*a/3),h=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1);sl(t,e,Math.max(i,Math.floor(e-o*l/s+h)),Math.min(n,Math.floor(e+(s-o)*l/s+h)),r)}const s=t[e];let o=i,a=n;for(ol(t,i,e),r(t[n],s)>0&&ol(t,i,n);o0;)a--}0===r(t[i],s)?ol(t,i,a):(a++,ol(t,a,n)),a<=e&&(i=a+1),e<=a&&(n=a-1)}}function ol(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function al(t,e){return te?1:0}let ll=class{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const i=[];if(!xl(t,e))return i;const n=this.toBBox,r=[];for(;e;){for(let s=0;s=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(n,r,e)}_split(t,e){const i=t[e],n=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,n);const s=this._chooseSplitIndex(i,r,n),o=vl(i.children.splice(s,i.children.length-s));o.height=i.height,o.leaf=i.leaf,cl(i,this.toBBox),cl(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(i,o)}_splitRoot(t,e){this.data=vl([t,e]),this.data.height=t.height+1,this.data.leaf=!1,cl(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let n,r=1/0,s=1/0;for(let o=e;o<=i-e;o++){const e=ul(t,0,o,this.toBBox),a=ul(t,o,i,this.toBBox),l=ml(e,a),h=pl(e)+pl(a);l=e;n--){const e=t.children[n];dl(o,t.leaf?r(e):e),a+=_l(o)}return a}_adjustParentBBoxes(t,e,i){for(let n=i;n>=0;n--)dl(e[n],t)}_condense(t){for(let e,i=t.length-1;i>=0;i--)0===t[i].children.length?i>0?(e=t[i-1].children,e.splice(e.indexOf(t[i]),1)):this.clear():cl(t[i],this.toBBox)}};function hl(t,e,i){if(!i)return e.indexOf(t);for(let n=0;n=t.minX&&e.maxY>=t.minY}function vl(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Sl(t,e,i,n,r){const s=[e,i];for(;s.length;){if((i=s.pop())-(e=s.pop())<=n)continue;const o=e+Math.ceil((i-e)/n/2)*n;sl(t,o,e,i,r),s.push(e,o,o,i)}}const El=[NaN,NaN,NaN,0];let wl;const Tl=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Cl=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,bl=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Rl=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function Pl(t,e){return t.endsWith("%")?Number(t.substring(0,t.length-1))/e:Number(t)}function Il(t){throw new Error('failed to parse "'+t+'" as color')}function Fl(t){if(t.toLowerCase().startsWith("rgb")){const e=t.match(Cl)||t.match(Tl)||t.match(bl);if(e){const t=e[4],i=100/255;return[Ie(Pl(e[1],i)+.5|0,0,255),Ie(Pl(e[2],i)+.5|0,0,255),Ie(Pl(e[3],i)+.5|0,0,255),void 0!==t?Ie(Pl(t,100),0,1):1]}Il(t)}if(t.startsWith("#")){if(Rl.test(t)){const e=t.substring(1),i=e.length<=4?1:2,n=[0,0,0,255];for(let t=0,r=e.length;t.0031308?269.025*Math.pow(t,1/2.4)-14.025:3294.6*t}function Nl(t){return t>.2068965?Math.pow(t,3):108/841*(t-4/29)}function kl(t){return t>10.314724?Math.pow((t+14.025)/269.025,2.4):t/3294.6}function Gl(t){return t>.0088564?Math.pow(t,1/3):t/(108/841)+4/29}function jl(t){const e=kl(t[0]),i=kl(t[1]),n=kl(t[2]),r=Gl(.222488403*e+.716873169*i+.06060791*n),s=500*(Gl(.452247074*e+.399439023*i+.148375274*n)-r),o=200*(r-Gl(.016863605*e+.117638439*i+.865350722*n)),a=Math.atan2(o,s)*(180/Math.PI);return[116*r-16,Math.sqrt(s*s+o*o),a<0?a+360:a,t[3]]}function Ul(t){const e=(t[0]+16)/116,i=t[1],n=t[2]*Math.PI/180,r=Nl(e),s=Nl(e+i/500*Math.cos(n)),o=Nl(e-i/200*Math.sin(n)),a=Dl(3.021973625*s-1.617392459*r-.404875592*o),l=Dl(-.943766287*s+1.916279586*r+.027607165*o),h=Dl(.069407491*s-.22898585*r+1.159737864*o);return[Ie(a+.5|0,0,255),Ie(l+.5|0,0,255),Ie(h+.5|0,0,255),t[3]]}function Bl(t){if("none"===t)return El;if(Ml.hasOwnProperty(t))return Ml[t];if(Al>=1024){let t=0;for(const e in Ml)3&t++||(delete Ml[e],--Al)}const e=Fl(t);4!==e.length&&Il(t);for(const i of e)isNaN(i)&&Il(t);return Ml[t]=e,++Al,e}function zl(t){return Array.isArray(t)?t:Bl(t)}function Xl(t){let e=t[0];e!=(0|e)&&(e=e+.5|0);let i=t[1];i!=(0|i)&&(i=i+.5|0);let n=t[2];n!=(0|n)&&(n=n+.5|0);return"rgba("+e+","+i+","+n+","+(void 0===t[3]?1:Math.round(1e3*t[3])/1e3)+")"}function Vl(t){return t[0]>0&&t[1]>0}function $l(t,e,i){return void 0===i&&(i=[0,0]),i[0]=t[0]*e+.5|0,i[1]=t[1]*e+.5|0,i}function Wl(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}let Zl=0;const Yl=1<",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string",Has:"has"},uh={[ch.Get]:xh(ph(1,1/0),dh),[ch.Var]:xh(ph(1,1),(function(t,e,i){const n=t[1];if("string"!=typeof n)throw new Error("expected a string argument for var operation");return i.variables.add(n),[new oh(Kl,n)]})),[ch.Has]:xh(ph(1,1/0),dh),[ch.Id]:xh((function(t,e,i){i.featureId=!0}),fh),[ch.Concat]:xh(ph(2,1/0),mh(Kl)),[ch.GeometryType]:xh((function(t,e,i){i.geometryType=!0}),fh),[ch.LineMetric]:xh(fh),[ch.Resolution]:xh(gh,fh),[ch.Zoom]:xh(gh,fh),[ch.Time]:xh(gh,fh),[ch.Any]:xh(ph(2,1/0),mh(Yl)),[ch.All]:xh(ph(2,1/0),mh(Yl)),[ch.Not]:xh(ph(1,1),mh(Yl)),[ch.Equal]:xh(ph(2,2),mh(th)),[ch.NotEqual]:xh(ph(2,2),mh(th)),[ch.GreaterThan]:xh(ph(2,2),mh(Hl)),[ch.GreaterThanOrEqualTo]:xh(ph(2,2),mh(Hl)),[ch.LessThan]:xh(ph(2,2),mh(Hl)),[ch.LessThanOrEqualTo]:xh(ph(2,2),mh(Hl)),[ch.Multiply]:xh(ph(2,1/0),_h),[ch.Coalesce]:xh(ph(2,1/0),_h),[ch.Divide]:xh(ph(2,2),mh(Hl)),[ch.Add]:xh(ph(2,1/0),mh(Hl)),[ch.Subtract]:xh(ph(2,2),mh(Hl)),[ch.Clamp]:xh(ph(3,3),mh(Hl)),[ch.Mod]:xh(ph(2,2),mh(Hl)),[ch.Pow]:xh(ph(2,2),mh(Hl)),[ch.Abs]:xh(ph(1,1),mh(Hl)),[ch.Floor]:xh(ph(1,1),mh(Hl)),[ch.Ceil]:xh(ph(1,1),mh(Hl)),[ch.Round]:xh(ph(1,1),mh(Hl)),[ch.Sin]:xh(ph(1,1),mh(Hl)),[ch.Cos]:xh(ph(1,1),mh(Hl)),[ch.Atan]:xh(ph(1,2),mh(Hl)),[ch.Sqrt]:xh(ph(1,1),mh(Hl)),[ch.Match]:xh(ph(4,1/0),yh,(function(t,e,i){const n=t.length-1,r=Kl|Hl|Yl,s=hh(t[1],r,i),o=hh(t[t.length-1],e,i),a=new Array(n-2);for(let e=0;ee){throw new Error(`expected ${e===1/0?`${t} or more`:`${t} to ${e}`} arguments for ${s}, got ${o}`)}}}function _h(t,e,i){const n=t.length-1,r=new Array(n);for(let s=0;s{for(let e=0;e{for(let r=0;r{const n=t.args;let r=e.properties[i];for(let t=1,e=n.length;tt.variables[i];case ch.Has:return e=>{const n=t.args;if(!(i in e.properties))return!1;let r=e.properties[i];for(let t=1,e=n.length;tt.featureId;case ch.GeometryType:return t=>t.geometryType;case ch.Concat:{const e=t.args.map((t=>wh(t)));return t=>"".concat(...e.map((e=>e(t).toString())))}case ch.Resolution:return t=>t.resolution;case ch.Any:case ch.All:case ch.Between:case ch.In:case ch.Not:return function(t){const e=t.operator,i=t.args.length,n=new Array(i);for(let e=0;e{for(let e=0;e{for(let e=0;e{const e=n[0](t),i=n[1](t),r=n[2](t);return e>=i&&e<=r};case ch.In:return t=>{const e=n[0](t);for(let r=1;r!n[0](t);default:throw new Error(`Unsupported logical operator ${e}`)}}(t);case ch.Equal:case ch.NotEqual:case ch.LessThan:case ch.LessThanOrEqualTo:case ch.GreaterThan:case ch.GreaterThanOrEqualTo:return function(t){const e=t.operator,i=wh(t.args[0]),n=wh(t.args[1]);switch(e){case ch.Equal:return t=>i(t)===n(t);case ch.NotEqual:return t=>i(t)!==n(t);case ch.LessThan:return t=>i(t)i(t)<=n(t);case ch.GreaterThan:return t=>i(t)>n(t);case ch.GreaterThanOrEqualTo:return t=>i(t)>=n(t);default:throw new Error(`Unsupported comparison operator ${e}`)}}(t);case ch.Multiply:case ch.Divide:case ch.Add:case ch.Subtract:case ch.Clamp:case ch.Mod:case ch.Pow:case ch.Abs:case ch.Floor:case ch.Ceil:case ch.Round:case ch.Sin:case ch.Cos:case ch.Atan:case ch.Sqrt:return function(t){const e=t.operator,i=t.args.length,n=new Array(i);for(let e=0;e{let e=1;for(let r=0;rn[0](t)/n[1](t);case ch.Add:return t=>{let e=0;for(let r=0;rn[0](t)-n[1](t);case ch.Clamp:return t=>{const e=n[0](t),i=n[1](t);if(er?r:e};case ch.Mod:return t=>n[0](t)%n[1](t);case ch.Pow:return t=>Math.pow(n[0](t),n[1](t));case ch.Abs:return t=>Math.abs(n[0](t));case ch.Floor:return t=>Math.floor(n[0](t));case ch.Ceil:return t=>Math.ceil(n[0](t));case ch.Round:return t=>Math.round(n[0](t));case ch.Sin:return t=>Math.sin(n[0](t));case ch.Cos:return t=>Math.cos(n[0](t));case ch.Atan:return 2===i?t=>Math.atan2(n[0](t),n[1](t)):t=>Math.atan(n[0](t));case ch.Sqrt:return t=>Math.sqrt(n[0](t));default:throw new Error(`Unsupported numeric operator ${e}`)}}(t);case ch.Case:return function(t){const e=t.args.length,i=new Array(e);for(let n=0;n{for(let n=0;n{const n=i[0](t);for(let r=1;r{const n=i[0](t),r=i[1](t);let s,o;for(let a=2;a=r)return 2===a?l:h?Ch(n,r,s,o,e,l):Th(n,r,s,o,e,l);s=e,o=l}return o}}(t);case ch.ToString:return function(t){const e=t.operator,i=t.args.length,n=new Array(i);for(let e=0;e{const i=n[0](e);return t.args[0].type===ql?Xl(i):i.toString()};throw new Error(`Unsupported convert operator ${e}`)}(t);default:throw new Error(`Unsupported operator ${i}`)}}function Th(t,e,i,n,r,s){const o=r-i;if(0===o)return n;const a=e-i;return n+(1===t?a/o:(Math.pow(t,a)-1)/(Math.pow(t,o)-1))*(s-n)}function Ch(t,e,i,n,r,s){if(0===r-i)return n;const o=jl(n),a=jl(s);let l=a[2]-o[2];l>180?l-=360:l<-180&&(l+=360);return Ul([Th(t,e,i,o[0],r,a[0]),Th(t,e,i,o[1],r,a[1]),o[2]+Th(t,e,i,0,r,l),Th(t,e,i,n[3],r,s[3])])}class bh{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];3&t++||i.hasListener()||(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e){const i=Rh(t,e);return i in this.cache_?this.cache_[i]:null}getPattern(t,e){const i=Rh(t,e);return i in this.patternCache_?this.patternCache_[i]:null}set(t,e,i,n){const r=Rh(t,e),s=r in this.cache_;this.cache_[r]=i,n&&(i.getImageState()===Fs&&i.load(),i.getImageState()===Ls?i.ready().then((()=>{this.patternCache_[r]=_t().createPattern(i.getImage(1),"repeat")})):this.patternCache_[r]=_t().createPattern(i.getImage(1),"repeat")),s||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function Rh(t,e){return t+":"+(e?zl(e):"null")}const Ph=new bh;let Ih=null;class Fh extends O{constructor(t,e,i,n,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i?.crossOrigin,this.referrerPolicy_=i?.referrerPolicy,this.canvas_={},this.color_=r,this.imageState_=void 0===n?Fs:n,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(void 0===this.tainted_&&this.imageState_===Ms){Ih||(Ih=ft(1,1,void 0,{willReadFrequently:!0})),Ih.drawImage(this.image_,0,0);try{Ih.getImageData(0,0,1,1),this.tainted_=!1}catch{Ih=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(n)}handleImageError_(){this.imageState_=As,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Ms,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}setImage(t){this.image_=t}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=ft(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===Fs){this.image_||this.initializeImage_(),this.imageState_=Ls;try{void 0!==this.src_&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&Gs(this.image_,this.src_).then((t=>{this.image_=t,this.handleImageLoad_()})).catch(this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==Ms)return;const e=this.image_,i=ft(Math.ceil(e.width*t),Math.ceil(e.height*t)),n=i.canvas;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle=Ll(this.color_),i.fillRect(0,0,n.width/t,n.height/t),i.globalCompositeOperation="destination-in",i.drawImage(e,0,0),this.canvas_[t]=n}ready(){return this.ready_||(this.ready_=new Promise((t=>{if(this.imageState_===Ms||this.imageState_===As)t();else{const e=()=>{this.imageState_!==Ms&&this.imageState_!==As||(this.removeEventListener(n,e),t())};this.addEventListener(n,e)}}))),this.ready_}}function Lh(t,e,i,n,r,s){let o=void 0===e?void 0:Ph.get(e,r);return o||(o=new Fh(t,t&&"src"in t?t.src||void 0:e,i,n,r),Ph.set(e,r,o,s)),s&&o&&!Ph.getPattern(e,r)&&Ph.set(e,r,o,s),o}function Mh(t){return t?Array.isArray(t)?Xl(t):"object"==typeof t&&"src"in t?function(t){if(!t.offset||!t.size)return Ph.getPattern(t.src,t.color);const e=t.src+":"+t.offset,i=Ph.getPattern(e,t.color);if(i)return i;const n=Ph.get(t.src,null);if(n.getImageState()!==Ms)return null;const r=ft(t.size[0],t.size[1]);return r.drawImage(n.getImage(1),t.offset[0],t.offset[1],t.size[0],t.size[1],0,0,t.size[0],t.size[1]),Lh(r.canvas,e,void 0,Ms,t.color,!0),Ph.getPattern(e,t.color)}(t):t:null}const Ah="10px sans-serif",Oh="#000",Dh="round",Nh=[],kh="round",Gh=10,jh="#000",Uh="center",Bh="middle",zh=[0,0,0,0],Xh=new V;let Vh,$h=null;const Wh={},Zh=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function Yh(t,e,i){return`${t} ${e} 16px "${i}"`}const Hh=function(){const t=100;let e,i;async function n(t){await i.ready;const e=await i.load(t);if(0===e.length)return!1;const n=zo(t),r=n.families[0].toLowerCase(),s=n.weight;return e.some((t=>{const e=t.family.replace(/^['"]|['"]$/g,"").toLowerCase(),i=Bo[t.weight]||t.weight;return e===r&&t.style===n.style&&i==s}))}async function r(){await i.ready;let s=!0;const o=Xh.getProperties(),a=Object.keys(o).filter((e=>o[e]=0;--e){const i=a[e];let r=o[i];rMath.max(e,Jh(t,i))),0);return i[e]=n,n}function tc(t,e){const i=[],n=[],r=[];let s=0,o=0,a=0,l=0;for(let h=0,c=e.length;h<=c;h+=2){const u=e[h];if("\n"===u||h===c){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}const d=e[h+1]||t.font,g=Jh(d,u);i.push(g),o+=g;const f=Kh(d);n.push(f),l=Math.max(l,f)}return{width:s,height:a,widths:i,heights:n,lineWidths:r}}function ec(t,e,i,n,r,s,o,a,l,h,c){t.save(),1!==i&&(void 0===t.globalAlpha?t.globalAlpha=t=>t.globalAlpha*=i:t.globalAlpha*=i),e&&t.transform.apply(t,e),n.contextInstructions?(t.translate(l,h),t.scale(c[0],c[1]),function(t,e){const i=t.contextInstructions;for(let t=0,n=i.length;tthis.imageState_=Ms)),this.render()}clone(){const t=this.getScale(),e=new nc({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){const e=this.fill_?.getKey(),i=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(",");let n=Ph.get(i,null)?.getImage(1);if(!n){const e=this.renderOptions_,r=Math.ceil(e.size*t),s=ft(r,r);this.draw_(e,s,t),n=s.canvas;const o=new Fh(n,void 0,null,Ms,null);Ph.set(i,null,o),createImageBitmap(n).then((t=>{o.setImage(t)}))}return n}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(t){this.radius!==t&&(this.radius=t,this.render())}getRadius2(){return this.radius2_}setRadius2(t){this.radius2_!==t&&(this.radius2_=t,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(0===e||this.points_===1/0||"bevel"!==t&&"miter"!==t)return e;let n=this.radius,r=void 0===this.radius2_?n:this.radius2_;if(n{this.patternImage_=null})),e.getImageState()===Fs&&e.load(),e.getImageState()===Ls&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?z(t):"object"==typeof t&&"src"in t?t.src+":"+t.offset:zl(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}function oc(t,e,i,n){return void 0!==i&&void 0!==n?[i/t,n/e]:void 0!==i?i/t:void 0!==n?n/e:1}class ac extends ic{constructor(t){const e=void 0!==(t=t||{}).opacity?t.opacity:1,i=void 0!==t.rotation?t.rotation:0,n=void 0!==t.scale?t.scale:1,r=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:i,scale:n,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:r,declutterMode:t.declutterMode}),this.anchor_=void 0!==t.anchor?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==t.anchorOrigin?t.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==t.anchorXUnits?t.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==t.anchorYUnits?t.anchorYUnits:"fraction",this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null,this.referrerPolicy_=t.referrerPolicy;const s=void 0!==t.img?t.img:null;let o,a=t.src;if(Mt(!(void 0!==a&&s),"`image` and `src` cannot be provided at the same time"),void 0!==a&&0!==a.length||!s||(a=s.src||z(s)),Mt(void 0!==a&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),Mt(!((void 0!==t.width||void 0!==t.height)&&void 0!==t.scale),"`width` or `height` cannot be provided together with `scale`"),void 0!==t.src?o=Fs:void 0!==s&&(o="complete"in s?s.complete?s.src?Ms:Fs:Ls:Ms),this.color_=void 0!==t.color?zl(t.color):null,this.iconImage_=Lh(s,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},o,this.color_),this.offset_=void 0!==t.offset?t.offset:[0,0],this.offsetOrigin_=void 0!==t.offsetOrigin?t.offsetOrigin:"top-left",this.origin_=null,this.size_=void 0!==t.size?t.size:null,this.initialOptions_,void 0!==t.width||void 0!==t.height){let e,i;if(t.size)[e,i]=t.size;else{const n=this.getImage(1);if(n.width&&n.height)e=n.width,i=n.height;else if(n instanceof HTMLImageElement){this.initialOptions_=t;const e=()=>{if(this.unlistenImageChange(e),!this.initialOptions_)return;const i=this.iconImage_.getSize();this.setScale(oc(i[0],i[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(oc(e,i,t.width,t.height))}}clone(){let t,e,i;return this.initialOptions_?(e=this.initialOptions_.width,i=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new ac({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:i,size:null!==this.size_?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const e=this.getSize();if("fraction"==this.anchorXUnits_||"fraction"==this.anchorYUnits_){if(!e)return null;t=this.anchor_.slice(),"fraction"==this.anchorXUnits_&&(t[0]*=e[0]),"fraction"==this.anchorYUnits_&&(t[1]*=e[1])}if("top-left"!=this.anchorOrigin_){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),"top-right"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[0]=-t[0]+e[0]),"bottom-left"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[1]=-t[1]+e[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(t){const e=t?zl(t):null;if(this.color_===e||this.color_&&e&&this.color_.length===e.length&&this.color_.every(((t,i)=>t===e[i])))return;this.color_=e;const i=this.getSrc(),n=void 0!==i?null:this.getHitDetectionImage(),r=void 0!==i?Fs:this.iconImage_.getImageState();this.iconImage_=Lh(n,i,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},r,this.color_)}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if("top-left"!=this.offsetOrigin_){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),"top-right"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[0]=i[0]-e[0]-t[0]),"bottom-left"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(t){this.iconImage_=Lh(null,t,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},Fs,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();return this.size_?this.size_[0]*t[0]:this.iconImage_.getImageState()==Ms?this.iconImage_.getSize()[0]*t[0]:void 0}getHeight(){const t=this.getScaleArray();return this.size_?this.size_[1]*t[1]:this.iconImage_.getImageState()==Ms?this.iconImage_.getSize()[1]*t[1]:void 0}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(n,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(n,t)}ready(){return this.iconImage_.ready()}}class lc{constructor(t){t=t||{},this.color_=void 0!==t.color?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=void 0!==t.lineDash?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.offset_=t.offset,this.width_=t.width}clone(){const t=this.getColor();return new lc({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),offset:this.getOffset(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getOffset(){return this.offset_}getWidth(){return this.width_}setColor(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setOffset(t){this.offset_=t}setWidth(t){this.width_=t}}class hc{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=fc,void 0!==t.geometry&&this.setGeometry(t.geometry),this.fill_=void 0!==t.fill?t.fill:null,this.image_=void 0!==t.image?t.image:null,this.renderer_=void 0!==t.renderer?t.renderer:null,this.hitDetectionRenderer_=void 0!==t.hitDetectionRenderer?t.hitDetectionRenderer:null,this.stroke_=void 0!==t.stroke?t.stroke:null,this.text_=void 0!==t.text?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&"object"==typeof t&&(t=t.clone()),new hc({geometry:t??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){"function"==typeof t?this.geometryFunction_=t:"string"==typeof t?this.geometryFunction_=function(e){return e.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=fc,this.geometry_=t}setZIndex(t){this.zIndex_=t}}function cc(t){let e;if("function"==typeof t)e=t;else{let i;if(Array.isArray(t))i=t;else{Mt("function"==typeof t.getZIndex,"Expected an `Style` or an array of `Style`");i=[t]}e=function(){return i}}return e}let uc=null;function dc(t,e){if(!uc){const t=new sc({color:"rgba(255,255,255,0.4)"}),e=new lc({color:"#3399CC",width:1.25});uc=[new hc({image:new rc({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return uc}function gc(){const t={},e=[255,255,255,1],i=[0,153,255,1];return t.Polygon=[new hc({fill:new sc({color:[255,255,255,.5]})})],t.MultiPolygon=t.Polygon,t.LineString=[new hc({stroke:new lc({color:e,width:5})}),new hc({stroke:new lc({color:i,width:3})})],t.MultiLineString=t.LineString,t.Circle=t.Polygon.concat(t.LineString),t.Point=[new hc({image:new rc({radius:6,fill:new sc({color:i}),stroke:new lc({color:e,width:1.5})}),zIndex:1/0})],t.MultiPoint=t.Point,t.GeometryCollection=t.Polygon.concat(t.LineString,t.Point),t}function fc(t){return t.getGeometry()}class pc{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.keepUpright_=t.keepUpright,this.scale_=t.scale,this.scaleArray_=Wl(void 0!==t.scale?t.scale:1),this.text_=t.text,this.textAlign_=t.textAlign,this.justify_=t.justify,this.repeat_=t.repeat,this.textBaseline_=t.textBaseline,this.fill_=void 0!==t.fill?t.fill:new sc({color:"#333"}),this.maxAngle_=void 0!==t.maxAngle?t.maxAngle:Math.PI/4,this.placement_=void 0!==t.placement?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=void 0!==t.stroke?t.stroke:null,this.offsetX_=void 0!==t.offsetX?t.offsetX:0,this.offsetY_=void 0!==t.offsetY?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=void 0===t.padding?null:t.padding,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new pc({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof sc?this.getFill().clone():this.getFill(),stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setKeepUpright(t){this.keepUpright_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=Wl(void 0!==t?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}}function _c(t){return!0}function mc(t){const e=lh(),i=xc(t,e),n={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""};return function(t,r){if(n.properties=t.getPropertiesInternal(),n.resolution=r,e.featureId){const e=t.getId();n.featureId=void 0!==e?e:null}return e.geometryType&&(n.geometryType=vh(t.getGeometry())),i(n)}}function yc(t){const e=lh(),i=t.length,n=new Array(i);for(let r=0;r0&&"string"==typeof f[0]?_=Rc(t,i+"color",e):p=jc(f,i+"color")}const m=function(t,e){const i=t[e];if(void 0===i)return;if("string"!=typeof i)throw new Error(`Expected a string for ${e}`);return i}(t,i+"cross-origin"),y=function(t,e){const i=t[e];if(void 0===i)return;return Nc(i,e)}(t,i+"offset"),x=Ac(t,i+"offset-origin"),v=Mc(t,i+"width"),S=Mc(t,i+"height"),E=function(t,e){const i=t[e];if(void 0===i)return;if("number"==typeof i)return Wl(i);if(!Array.isArray(i))throw new Error(`Expected a number or size array for ${e}`);if(2!==i.length||"number"!=typeof i[0]||"number"!=typeof i[1])throw new Error(`Expected a number or size array for ${e}`);return i}(t,i+"size"),w=Dc(t,i+"declutter-mode"),T={src:r,anchorOrigin:u,anchorXUnits:d,anchorYUnits:g,crossOrigin:m,offset:y,offsetOrigin:x,height:S,width:v,size:E,declutterMode:w};let C=null;return function(t){if(C)_&&C.setColor(_(t));else{const e=_?_(t):p;C=new ac(void 0!==e?Object.assign({},T,{color:e}):Object.assign({},T))}return a&&C.setOpacity(a(t)),l&&C.setDisplacement(l(t)),h&&C.setRotation(h(t)),c&&C.setRotateWithView(c(t)),o&&C.setScale(o(t)),s&&C.setAnchor(s(t)),C}}(t,e);if("shape-points"in t)return function(t,e){const i="shape-",n=i+"points",r=i+"radius",s=Gc(t[n],n);if(!(r in t))throw new Error(`Expected a number for ${r}`);const o=Tc(t,r,e),a="number"==typeof t[r]?t[r]:5,l=i+"radius2",h=Tc(t,l,e),c="number"==typeof t[l]?t[l]:void 0,u=Sc(t,i,e),d=Ec(t,i,e),g=Lc(t,i+"scale",e),f=Ic(t,i+"displacement",e),p=Tc(t,i+"rotation",e),_=bc(t,i+"rotate-with-view",e),m=Mc(t,i+"angle"),y=Dc(t,i+"declutter-mode"),x=new nc({points:s,radius:a,radius2:c,angle:m,declutterMode:y});return function(t){return o&&x.setRadius(o(t)),h&&x.setRadius2(h(t)),u&&x.setFill(u(t)),d&&x.setStroke(d(t)),f&&x.setDisplacement(f(t)),p&&x.setRotation(p(t)),_&&x.setRotateWithView(_(t)),g&&x.setScale(g(t)),x}}(t,e);if("circle-radius"in t)return function(t,e){const i="circle-",n=Sc(t,i,e),r=Ec(t,i,e),s=Tc(t,i+"radius",e),o=Lc(t,i+"scale",e),a=Ic(t,i+"displacement",e),l=Tc(t,i+"rotation",e),h=bc(t,i+"rotate-with-view",e),c=Dc(t,i+"declutter-mode"),u=new rc({radius:5,declutterMode:c});return function(t){return s&&u.setRadius(s(t)),n&&u.setFill(n(t)),r&&u.setStroke(r(t)),a&&u.setDisplacement(a(t)),l&&u.setRotation(l(t)),h&&u.setRotateWithView(h(t)),o&&u.setScale(o(t)),u}}(t,e);return null}(t,e),o=Tc(t,"z-index",e);if(!(i||n||r||s||L(t)))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(t));const a=new hc;return function(t){let e=!0;if(i){const n=i(t);n&&(e=!1),a.setFill(n)}if(n){const i=n(t);i&&(e=!1),a.setStroke(i)}if(r){const i=r(t);i&&(e=!1),a.setText(i)}if(s){const i=s(t);i&&(e=!1),a.setImage(i)}return o&&a.setZIndex(o(t)),e?null:a}}function Sc(t,e,i){let n;if(e+"fill-pattern-src"in t)n=function(t,e,i){const n=Cc(t,e+"pattern-src",i),r=Fc(t,e+"pattern-offset",i),s=Fc(t,e+"pattern-size",i),o=Rc(t,e+"color",i);return function(t){return{src:n(t),offset:r&&r(t),size:s&&s(t),color:o&&o(t)}}}(t,e+"fill-",i);else{if("none"===t[e+"fill-color"])return t=>null;n=Rc(t,e+"fill-color",i)}if(!n)return null;const r=new sc;return function(t){const e=n(t);return e===El?null:(r.setColor(e),r)}}function Ec(t,e,i){const n=Tc(t,e+"stroke-width",i),r=Rc(t,e+"stroke-color",i);if(!n&&!r)return null;const s=Cc(t,e+"stroke-line-cap",i),o=Cc(t,e+"stroke-line-join",i),a=Pc(t,e+"stroke-line-dash",i),l=Tc(t,e+"stroke-line-dash-offset",i),h=Tc(t,e+"stroke-miter-limit",i),c=Tc(t,e+"stroke-offset",i),u=new lc;return function(t){if(r){const e=r(t);if(e===El)return null;u.setColor(e)}if(n&&u.setWidth(n(t)),s){const e=s(t);if("butt"!==e&&"round"!==e&&"square"!==e)throw new Error("Expected butt, round, or square line cap");u.setLineCap(e)}if(o){const e=o(t);if("bevel"!==e&&"round"!==e&&"miter"!==e)throw new Error("Expected bevel, round, or miter line join");u.setLineJoin(e)}return a&&u.setLineDash(a(t)),l&&u.setLineDashOffset(l(t)),h&&u.setMiterLimit(h(t)),c&&u.setOffset(c(t)),u}}function wc(t,e){if(!(e in t))return;const i=t[e];return void 0===i?void 0:i}function Tc(t,e,i){const n=wc(t,e);if(void 0===n)return;const r=Eh(n,Hl,i);return function(t){return Gc(r(t),e)}}function Cc(t,e,i){const n=wc(t,e);if(void 0===n)return null;const r=Eh(n,Kl,i);return function(t){return kc(r(t),e)}}function bc(t,e,i){const n=wc(t,e);if(void 0===n)return null;const r=Eh(n,Yl,i);return function(t){const i=r(t);if("boolean"!=typeof i)throw new Error(`Expected a boolean for ${e}`);return i}}function Rc(t,e,i){const n=wc(t,e);if(void 0===n)return null;const r=Eh(n,ql,i);return function(t){return jc(r(t),e)}}function Pc(t,e,i){const n=wc(t,e);if(void 0===n)return null;if(Array.isArray(n)&&(0===n.length||"string"!=typeof n[0])){const t=n.map(((t,n)=>{if("number"==typeof t)return()=>t;const r=Eh(t,Hl,i);return function(t){return Gc(r(t),`${e}[${n}]`)}}));return function(e){const i=new Array(t.length);for(let n=0;n4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return i}function Uc(t,e){const i=Nc(t,e);if(2!==i.length)throw new Error(`Expected an array of two numbers for ${e}`);return i}const Bc="renderOrder";class zc extends nl{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=t.declutter?String(t.declutter):void 0,this.renderBuffer_=void 0!==t.renderBuffer?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=void 0!==t.updateWhileAnimating&&t.updateWhileAnimating,this.updateWhileInteracting_=void 0!==t.updateWhileInteracting&&t.updateWhileInteracting}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(Bc)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){const i=this.getDeclutter();i in t.declutter==!1&&(t.declutter[i]=new ll(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(Bc,t)}setStyle(t){this.style_=void 0===t?dc:t;const e=function(t){if(void 0===t)return dc;if(!t)return null;if("function"==typeof t)return t;if(t instanceof hc)return t;if(!Array.isArray(t))return yc([t]);if(0===t.length)return[];const e=t.length,i=t[0];if(i instanceof hc){const i=new Array(e);for(let n=0;n=0;--r){const s=f[r],u=s.layer;if(u.hasRenderer()&&rl(s,h)&&o.call(a,u)){const r=u.getRenderer(),o=u.getSource();if(r&&o){const a=o.getWrapX()?d:t,h=c.bind(null,s.managed);m[0]=a[0]+g[n][0],m[1]=a[1]+g[n][1],l=r.forEachFeatureAtCoordinate(m,e,i,h,_)}if(l)return l}}if(0===_.length)return;const y=1/_.length;return _.forEach(((t,e)=>t.distanceSq+=e*y)),_.sort(((t,e)=>t.distanceSq-e.distanceSq)),_.some((t=>l=t.callback(t.feature,t.layer,t.geometry))),l}hasFeatureAtCoordinate(t,e,i,n,r,s){return void 0!==this.forEachFeatureAtCoordinate(t,e,i,n,C,this,r,s)}getMap(){return this.map_}renderFrame(t){U()}scheduleExpireIconCache(t){Ph.canExpireCache()&&t.postRenderFunctions.push($c)}}function $c(t,e){Ph.expire()}class Wc extends Vc{constructor(t){super(t),this.fontChangeListenerKey_=D(Xh,i,t.redrawText,t),this.element_=ct?wt():document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=Do+" ol-layers";const n=t.getViewport();n&&n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const n=new Xc(t,void 0,e);i.dispatchEvent(n)}}disposeInternal(){k(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(t){if(!t)return void(this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1));this.calculateMatrices2D(t),this.dispatchRenderEvent(tl,t);const e=t.layerStatesArray.sort(((t,e)=>t.zIndex-e.zIndex));e.some((t=>t.layer instanceof zc&&t.layer.getDeclutter()))&&(t.declutter={});const i=t.viewState;this.children_.length=0;const n=[];let r=null;for(let s=0,o=e.length;s0)&&(t.fillStyle=n,t.fillRect(0,0,s.width,s.height)),Tt(i)&&i.width>0){t.save();const n=e.style.opacity||i.style.opacity;t.globalAlpha=""===n?1:Number(n);const r=i.style.transform;if(r)t.transform(...lr(r));else{const e=parseFloat(i.style.width)/i.width,n=parseFloat(i.style.height)/i.height;t.transform(e,0,0,n,0,0)}t.drawImage(i,0,0),t.restore()}}}this.dispatchRenderEvent(el,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}declutter(t,e){if(t.declutter){for(let i=e.length-1;i>=0;--i){const n=e[i],r=n.layer;r.getDeclutter()&&r.renderDeclutter(t,n)}e.forEach((e=>e.layer.renderDeferred(t)))}}}function Zc(t){t instanceof nl?t.setMapInternal(null):t instanceof qa&&t.getLayers().forEach(Zc)}function Yc(t,e){if(t instanceof nl)t.setMapInternal(e);else if(t instanceof qa){const i=t.getLayers().getArray();for(let t=0,n=i.length;tthis.updateSize()))),this.controls=n.controls||(ct?new Z:Zo()),this.interactions=n.interactions||(ct?new Z:Da({onFocusOnly:!0})),this.overlays_=n.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new lo(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(io,this.handleLayerGroupChanged_),this.addChangeListener(so,this.handleViewChanged_),this.addChangeListener(no,this.handleSizeChanged_),this.addChangeListener(ro,this.handleTargetChanged_),this.setProperties(n.values);const r=this;!i.view||i.view instanceof bo||i.view.then((function(t){r.setView(new bo(t))})),this.controls.addEventListener(t,(t=>{t.element.setMap(this)})),this.controls.addEventListener(e,(t=>{t.element.setMap(null)})),this.interactions.addEventListener(t,(t=>{t.element.setMap(this)})),this.interactions.addEventListener(e,(t=>{t.element.setMap(null)})),this.overlays_.addEventListener(t,(t=>{this.addOverlayInternal_(t.element)})),this.overlays_.addEventListener(e,(t=>{const e=t.element.getId();void 0!==e&&delete this.overlayIdIndex_[e.toString()],t.element.setMap(null)})),this.controls.forEach((t=>{t.setMap(this)})),this.interactions.forEach((t=>{t.setMap(this)})),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){Yc(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();void 0!==e&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const n=this.getCoordinateFromPixelInternal(t),r=void 0!==(i=void 0!==i?i:{}).hitTolerance?i.hitTolerance:0,s=void 0!==i.layerFilter?i.layerFilter:C,o=!1!==i.checkWrapped;return this.renderer_.forEachFeatureAtCoordinate(n,this.frameState_,r,o,e,null,s,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,(function(t){i.push(t)}),e),i}getAllLayers(){const t=[];return function e(i){i.forEach((function(i){i instanceof qa?e(i.getLayers()):t.push(i)}))}(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(t),n=void 0!==(e=void 0!==e?e:{}).layerFilter?e.layerFilter:C,r=void 0!==e.hitTolerance?e.hitTolerance:0,s=!1!==e.checkWrapped;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,r,s,n,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const e=this.viewport_.getBoundingClientRect(),i=this.getSize(),n=e.width/i[0],r=e.height/i[1],s="changedTouches"in t?t.changedTouches[0]:t;return[(s.clientX-e.left)/n,(s.clientY-e.top)/r]}getTarget(){return this.get(ro)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return jn(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?Qn(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return void 0!==e?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(io)}setLayers(t){const e=this.getLayerGroup();if(t instanceof Z)return void e.setLayers(t);const i=e.getLayers();i.clear(),i.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e=0;i--){const n=e[i];if(n.getMap()!==this||!n.getActive()||!this.getTargetElement())continue;if(!n.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let i=this.maxTilesLoading_,n=i;if(t){const e=t.viewHints;if(e[co]||e[uo]){const e=Date.now()-t.time>8;i=e?0:8,n=e?0:2}}e.getTilesLoading(){this.postRenderTimeoutHandle_=void 0,this.handlePostRender()}),0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new Ha("removelayer",e)),this.set(io,t)}setSize(t){this.set(no,t)}setTarget(t){this.set(ro,t)}setView(t){if(!t||t instanceof bo)return void this.set(so,t);this.set(so,new bo);const e=this;t.then((function(t){e.setView(new bo(t))}))}updateSize(){const t=this.getTargetElement();let e;if(t){let i,n;if(Tt(t)){const e=t.getContext("2d").getTransform();i=t.width/e.a,n=t.height/e.d}else{const e=getComputedStyle(t);i=t.offsetWidth-parseFloat(e.borderLeftWidth)-parseFloat(e.paddingLeft)-parseFloat(e.paddingRight)-parseFloat(e.borderRightWidth),n=t.offsetHeight-parseFloat(e.borderTopWidth)-parseFloat(e.paddingTop)-parseFloat(e.paddingBottom)-parseFloat(e.borderBottomWidth)}isNaN(i)||isNaN(n)||(e=[Math.max(0,i),Math.max(0,n)],!Vl(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&He("No map visible because the map container's width or height are 0."))}const i=this.getSize();!e||i&&w(e,i)||(this.setSize(e),this.updateViewportSize_(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}};const Kc="element",qc="map",Jc="offset",Qc="position",tu="positioning";class eu extends V{constructor(t){super(),this.on,this.once,this.un,this.options=t,this.id=t.id,this.insertFirst=void 0===t.insertFirst||t.insertFirst,this.stopEvent=void 0===t.stopEvent||t.stopEvent,this.element=document.createElement("div"),this.element.className=void 0!==t.className?t.className:"ol-overlay-container "+Oo,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=!0===t.autoPan?{}:t.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(Kc,this.handleElementChanged),this.addChangeListener(qc,this.handleMapChanged),this.addChangeListener(Jc,this.handleOffsetChanged),this.addChangeListener(Qc,this.handlePositionChanged),this.addChangeListener(tu,this.handlePositioningChanged),void 0!==t.element&&this.setElement(t.element),this.setOffset(void 0!==t.offset?t.offset:[0,0]),this.setPositioning(t.positioning||"top-left"),void 0!==t.position&&this.setPosition(t.position)}getElement(){return this.get(Kc)}getId(){return this.id}getMap(){return this.get(qc)||null}getOffset(){return this.get(Jc)}getPosition(){return this.get(Qc)}getPositioning(){return this.get(tu)}handleElementChanged(){St(this.element);const t=this.getElement();t&&this.element.appendChild(t)}handleMapChanged(){this.mapPostrenderListenerKey&&(this.element?.remove(),k(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=D(t,qs,this.render,this),this.updatePixelPosition();const e=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?e.insertBefore(this.element,e.childNodes[0]||null):e.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(t){this.set(Kc,t)}setMap(t){this.set(qc,t)}setOffset(t){this.set(Jc,t)}setPosition(t){this.set(Qc,t)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(t){const e=this.getMap();if(!e||!e.getTargetElement()||!this.get(Qc))return;const i=this.getRect(e.getTargetElement(),e.getSize()),n=this.getElement(),r=this.getRect(n,[yt(n),xt(n)]),s=void 0===(t=t||{}).margin?20:t.margin;if(!Wt(i,r)){const n=r[0]-i[0],o=i[2]-r[2],a=r[1]-i[1],l=i[3]-r[3],h=[0,0];if(n<0?h[0]=n-s:o<0&&(h[0]=Math.abs(o)+s),a<0?h[1]=a-s:l<0&&(h[1]=Math.abs(l)+s),0!==h[0]||0!==h[1]){const i=e.getView().getCenterInternal(),n=e.getPixelFromCoordinateInternal(i);if(!n)return;const r=[n[0]+h[0],n[1]+h[1]],s=t.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(r),duration:s.duration,easing:s.easing})}}}getRect(t,e){const i=t.getBoundingClientRect(),n=i.left+window.pageXOffset,r=i.top+window.pageYOffset;return[n,r,n+e[0],r+e[1]]}setPositioning(t){this.set(tu,t)}setVisible(t){this.rendered.visible!==t&&(this.element.style.display=t?"":"none",this.rendered.visible=t)}updatePixelPosition(){const t=this.getMap(),e=this.getPosition();if(!t||!t.isRendered()||!e)return void this.setVisible(!1);const i=t.getPixelFromCoordinate(e),n=t.getSize();this.updateRenderedPosition(i,n)}updateRenderedPosition(t,e){const i=this.element.style,n=this.getOffset(),r=this.getPositioning();this.setVisible(!0);let s="0%",o="0%";"bottom-right"==r||"center-right"==r||"top-right"==r?s="-100%":"bottom-center"!=r&&"center-center"!=r&&"top-center"!=r||(s="-50%"),"bottom-left"==r||"bottom-center"==r||"bottom-right"==r?o="-100%":"center-left"!=r&&"center-center"!=r&&"center-right"!=r||(o="-50%");const a=`translate(${s}, ${o}) translate(${`${t[0]+n[0]}px`}, ${`${t[1]+n[1]}px`})`;this.rendered.transform_!=a&&(this.rendered.transform_=a,i.transform=a)}getOptions(){return this.options}}class iu{constructor(t,e,i,n){this.minX=t,this.maxX=e,this.minY=i,this.maxY=n}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minXthis.maxX&&(this.maxX=t.maxX),t.minYthis.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function nu(t,e,i,n,r){return void 0!==r?(r.minX=t,r.maxX=e,r.minY=i,r.maxY=n,r):new iu(t,e,i,n)}const ru=[];class su extends nt{constructor(t,e,i,n,r){super(t,e,{transition:0}),this.context_=null,this.executorGroups={},this.loadingSourceTiles=0,this.hitDetectionImageData={},this.replayState_={},this.sourceTiles=[],this.errorTileKeys={},this.wantedResolution,this.getSourceTiles=n.bind(void 0,this),this.removeSourceTiles_=r,this.wrappedTileCoord=i}getContext(){return this.context_||(this.context_=ft(1,1,ru)),this.context_}hasContext(){return!!this.context_}getImage(){return this.hasContext()?this.getContext().canvas:null}getReplayState(t){const e=z(t);return e in this.replayState_||(this.replayState_[e]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedPixelRatio:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedTileZ:-1}),this.replayState_[e]}load(){this.getSourceTiles()}release(){this.context_&&(mt(this.context_),ru.push(this.context_.canvas),this.context_=null),this.removeSourceTiles_(this),this.sourceTiles.length=0,super.release()}}let ou,au=class extends nt{constructor(t,e,i,n,r,s){super(t,e,s),this.extent=null,this.format_=n,this.features_=null,this.loader_,this.projection=null,this.resolution,this.tileLoadFunction_=r,this.url_=i,this.key=i}getTileUrl(){return this.url_}getFormat(){return this.format_}getFeatures(){return this.features_}load(){this.state==Y&&(this.setState(H),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))}onLoad(t,e){this.setFeatures(t)}onError(){this.setState(q)}setFeatures(t){this.features_=t,this.setState(K)}setLoader(t){this.loader_=t}},lu=!1;function hu(t,e,i,n,r,s,o){const a=new XMLHttpRequest;a.open("GET","function"==typeof t?t(i,n,r):t,!0),"arraybuffer"==e.getType()&&(a.responseType="arraybuffer"),a.withCredentials=lu,a.onload=function(t){if(!a.status||a.status>=200&&a.status<300){const t=e.getType();try{let n;"text"==t||"json"==t?n=a.responseText:"xml"==t?n=a.responseXML||a.responseText:"arraybuffer"==t&&(n=a.response),n?s(e.readFeatures(n,{extent:i,featureProjection:r}),e.readProjection(n)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function cu(t,e){return function(i,n,r,s,o){hu(t,e,i,n,r,((t,e)=>{this.addFeatures(t),void 0!==s&&s(t)}),(()=>{this.changed(),void 0!==o&&o()}))}}function uu(t,e){return[[-1/0,-1/0,1/0,1/0]]}function du(t,e,i,n){const r=document.createElement("script"),s="olc_"+z(e);function o(){delete window[s],r.parentNode.removeChild(r)}r.async=!0,r.src=t+(t.includes("?")?"&":"?")+(n||"callback")+"="+s;const a=setTimeout((function(){o(),i&&i()}),1e4);window[s]=function(t){clearTimeout(a),o(),e(t)},document.head.appendChild(r)}class gu extends Error{constructor(t){super("Unexpected response status: "+t.status),this.name="ResponseError",this.response=t}}class fu extends Error{constructor(t){super("Failed to issue request"),this.name="ClientError",this.client=t}}function pu(t){return new Promise((function(e,i){const n=new XMLHttpRequest;n.addEventListener("load",(function(t){const n=t.target;if(!n.status||n.status>=200&&n.status<300){let t;try{t=JSON.parse(n.responseText)}catch(t){const e="Error parsing response text as JSON: "+t.message;return void i(new Error(e))}e(t)}else i(new gu(n))})),n.addEventListener("error",(function(t){i(new fu(t.target))})),n.open("GET",t),n.setRequestHeader("Accept","application/json"),n.send()}))}function _u(t,e){return e.includes("://")?e:new URL(e,t).href}function mu(t,e,i,n,r,s,o){let a,l;void 0!==i&&void 0!==n?(a=t-i,l=e-n):void 0!==r&&void 0!==s?(a=r-t,l=s-e):(a=1,l=0);const h=Math.hypot(a,l),c=a/h,u=l/h;if(a=-u,l=c,void 0===i||void 0===n)return[t+a*o,e+l*o];if(void 0===r||void 0===s)return[t+a*o,e+l*o];const d=gi([t,e],[i,n],[r,s]);if(Math.cos(d)>.998)return[t+c*o,e+u*o];const g=Math.cos(d/2),f=Math.sin(d/2);return[t+(f*a+g*l)*(1/f)*o,e+(-g*a+f*l)*(1/f)*o]}class yu{drawCustom(t,e,i,n,r){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}}class xu extends yu{constructor(t,e,i,n,r,s,o){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=n,this.transformRotation_=n?ke(Math.atan2(n[1],n[0]),10):0,this.viewRotation_=r,this.squaredTolerance_=s,this.userTransform_=o,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=[1,0,0,1,0,0]}drawImages_(t,e,i,n){if(!this.image_)return;const r=cr(t,e,i,n,this.transform_,this.pixelCoordinates_),s=this.context_,o=this.tmpLocalTransform_,a=s.globalAlpha;1!=this.imageOpacity_&&(s.globalAlpha=a*this.imageOpacity_);let l=this.imageRotation_;0===this.transformRotation_&&(l-=this.viewRotation_),this.imageRotateWithView_&&(l+=this.viewRotation_);for(let t=0,e=r.length;t0&&(a=function(t,e,i,n,r,s){r=r??[],s=s??e;const o=t[0],a=t[1],l=t[t.length-4],h=t[t.length-3];let c,u,d,g,f,p,_,m,y=0;for(let x=0;xt*this.pixelRatio_)),lineDashOffset:(r||0)*this.pixelRatio_,lineJoin:void 0!==s?s:kh,lineWidth:(void 0!==o?o:1)*this.pixelRatio_,miterLimit:void 0!==a?a:Gh,strokeStyle:Mh(t||jh),strokeOffset:(h??0)*this.pixelRatio_}}else this.strokeState_=null}setImageStyle(t){let e;if(!t||!(e=t.getSize()))return void(this.image_=null);const i=t.getPixelRatio(this.pixelRatio_),n=t.getAnchor(),r=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=r[0],this.imageOriginY_=r[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const s=t.getScaleArray();this.imageScale_=[s[0]*this.pixelRatio_/i,s[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(t){const e=t.getFill();if(e){const t=e.getColor();this.textFillState_={fillStyle:Mh(t||Oh)}}else this.textFillState_=null;const i=t.getStroke();if(i){const t=i.getColor(),e=i.getLineCap(),n=i.getLineDash(),r=i.getLineDashOffset(),s=i.getLineJoin(),o=i.getWidth(),a=i.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:Dh,lineDash:n||Nh,lineDashOffset:r||0,lineJoin:void 0!==s?s:kh,lineWidth:void 0!==o?o:1,miterLimit:void 0!==a?a:Gh,strokeStyle:Mh(t||jh)}}else this.textStrokeState_=null;const n=t.getFont(),r=t.getOffsetX(),s=t.getOffsetY(),o=t.getRotateWithView(),a=t.getRotation(),l=t.getScaleArray(),h=t.getText(),c=t.getTextAlign(),u=t.getTextBaseline();this.textState_={font:void 0!==n?n:Ah,textAlign:void 0!==c?c:Uh,textBaseline:void 0!==u?u:Bh},this.text_=void 0!==h?Array.isArray(h)?h.reduce(((t,e,i)=>t+(i%2?" ":e)),""):h:"",this.textOffsetX_=void 0!==r?this.pixelRatio_*r:0,this.textOffsetY_=void 0!==s?this.pixelRatio_*s:0,this.textRotateWithView_=void 0!==o&&o,this.textRotation_=void 0!==a?a:0,this.textScale_=[this.pixelRatio_*l[0],this.pixelRatio_*l[1]]}else this.text_=""}}const vu={Point:function(t,e,i,n,r,s){const o=i.getImage(),a=i.getText(),l=a&&a.getText(),h=s&&o&&l?{}:void 0;if(o){if(o.getImageState()!=Ms)return;const s=t.getBuilder(i.getZIndex(),"Image");s.setImageStyle(o,h),s.drawPoint(e,n,r)}if(l){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a,h),s.drawText(e,n,r)}},LineString:function(t,e,i,n,r){const s=i.getStroke();if(s){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,s),o.drawLineString(e,n,r)}const o=i.getText();if(o&&o.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(o),s.drawText(e,n,r)}},Polygon:function(t,e,i,n,r){const s=i.getFill(),o=i.getStroke();if(s||o){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(s,o),a.drawPolygon(e,n,r)}const a=i.getText();if(a&&a.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n,r)}},MultiPoint:function(t,e,i,n,r,s){const o=i.getImage(),a=o&&0!==o.getOpacity(),l=i.getText(),h=l&&l.getText(),c=s&&a&&h?{}:void 0;if(a){if(o.getImageState()!=Ms)return;const s=t.getBuilder(i.getZIndex(),"Image");s.setImageStyle(o,c),s.drawMultiPoint(e,n,r)}if(h){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(l,c),s.drawText(e,n,r)}},MultiLineString:function(t,e,i,n,r){const s=i.getStroke();if(s){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,s),o.drawMultiLineString(e,n,r)}const o=i.getText();if(o&&o.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(o),s.drawText(e,n,r)}},MultiPolygon:function(t,e,i,n,r){const s=i.getFill(),o=i.getStroke();if(o||s){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(s,o),a.drawMultiPolygon(e,n,r)}const a=i.getText();if(a&&a.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n,r)}},GeometryCollection:function(t,e,i,n,r,s){const o=e.getGeometriesArray();let a,l;for(a=0,l=o.length;a0;return u&&Promise.all(l).then((()=>r(null))),function(t,e,i,n,r,s,o){const a=i.getGeometryFunction()(e);if(!a)return;const l=a.simplifyTransformed(n,r),h=i.getRenderer();if(h)Cu(t,l,i,e,o);else{(0,vu[l.getType()])(t,l,i,e,o,s)}}(t,e,i,n,s,o,a),u}function Cu(t,e,i,n,r){if("GeometryCollection"==e.getType()){const s=e.getGeometries();for(let e=0,o=s.length;e2||Math.abs(t[4*e+3]-191.25)>2}function Lu(t,e,i,n){const r=On(i,e,t);let s=wn(e,n,i);const o=e.getMetersPerUnit();void 0!==o&&(s*=o);const a=t.getMetersPerUnit();void 0!==a&&(s/=a);const l=t.getExtent();if(!l||$t(l,r)){const e=wn(t,s,r)/s;isFinite(e)&&e>0&&(s/=e)}return s}function Mu(t,e,i,n){const r=de(i);let s=Lu(t,e,r,n);return(!isFinite(s)||s<=0)&&le(i,(function(i){return s=Lu(t,e,i,n),isFinite(s)&&s>0})),s}function Au(t,e,i,n,r,s,o,a,l,h,c,u,d,g){const f=ft(Math.round(i*t),Math.round(i*e),Pu);if(u||(f.imageSmoothingEnabled=!1),0===l.length)return f.canvas;function p(t){return Math.round(t*i)/i}f.scale(i,i),f.globalCompositeOperation="lighter";const _=[1/0,1/0,-1/0,-1/0];let m;l.forEach((function(t,e,i){ie(_,t.extent)}));const y=i/n,x=(u?1:1+Math.pow(2,-24))/y;if(!d||1!==l.length||0!==h){if(m=ft(Math.round(ve(_)*y),Math.round(_e(_)*y),Pu),u||(m.imageSmoothingEnabled=!1),r&&g){const t=(r[0]-_[0])*y,e=-(r[3]-_[3])*y,i=ve(r)*y,n=_e(r)*y;m.rect(t,e,i,n),m.clip()}l.forEach((function(t,e,i){if(t.image.width>0&&t.image.height>0){if(t.clipExtent){m.save();const e=(t.clipExtent[0]-_[0])*y,i=-(t.clipExtent[3]-_[3])*y,n=ve(t.clipExtent)*y,r=_e(t.clipExtent)*y;m.rect(u?e:Math.round(e),u?i:Math.round(i),u?n:Math.round(e+n)-Math.round(e),u?r:Math.round(i+r)-Math.round(i)),m.clip()}const e=(t.extent[0]-_[0])*y,i=-(t.extent[3]-_[3])*y,n=ve(t.extent)*y,r=_e(t.extent)*y;m.drawImage(t.image,h,h,t.image.width-2*h,t.image.height-2*h,u?e:Math.round(e),u?i:Math.round(i),u?n:Math.round(e+n)-Math.round(e),u?r:Math.round(i+r)-Math.round(i)),t.clipExtent&&m.restore()}}))}const v=ye(o);return a.getTriangles().forEach((function(t,e,i){const n=t.source,r=t.target;let o=n[0][0],a=n[0][1],h=n[1][0],c=n[1][1],d=n[2][0],g=n[2][1];const y=p((r[0][0]-v[0])/s),S=p(-(r[0][1]-v[1])/s),E=p((r[1][0]-v[0])/s),w=p(-(r[1][1]-v[1])/s),T=p((r[2][0]-v[0])/s),C=p(-(r[2][1]-v[1])/s),b=o,R=a;o=0,a=0,h-=b,c-=R,d-=b,g-=R;const P=Me([[h,c,0,0,E-y],[d,g,0,0,T-y],[0,0,h,c,w-S],[0,0,d,g,C-S]]);if(!P)return;if(f.save(),f.beginPath(),function(){if(void 0===Ru){const t=ft(6,6,Pu);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",Iu(t,4,5,4,0),Iu(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;Ru=Fu(e,0)||Fu(e,4)||Fu(e,8),mt(t),Pu.push(t.canvas)}return Ru}()||!u){f.moveTo(E,w);const t=4,e=y-E,i=S-w;for(let n=0;n0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){const i=this.entries_[t];return Mt(void 0!==i,"Tried to get a value for a key that does not exist in the cache"),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_}remove(t){const e=this.entries_[t];return Mt(void 0!==e,"Tried to get a value for a key that does not exist in the cache"),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_}getCount(){return this.count_}getKeys(){const t=new Array(this.count_);let e,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.key_;return t}getValues(){const t=new Array(this.count_);let e,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){return this.entries_[t]?.value_}pop(){const t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_}replace(t,e){this.get(t),this.entries_[t].value_=e}set(t,e){Mt(!(t in this.entries_),"Tried to set a value for a key that is used already");const i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_}setSize(t){this.highWaterMark=t}}function Nu(t,e,i,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=i,n):[t,e,i]}function ku(t,e,i){return t+"/"+e+"/"+i}function Gu(t){return ku(t[0],t[1],t[2])}function ju(t,e,i,n,r){return`${z(t)},${e},${ku(i,n,r)}`}function Uu(t){return Bu(t[0],t[1],t[2])}function Bu(t,e,i){return(e<i||i>e.getMaxZoom())return!1;const s=e.getFullTileRange(i);return!s||s.containsXY(n,r)}const Xu=[0,0,0];class Vu{constructor(t){let e;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=t.resolutions,Mt(T(this.resolutions_,((t,e)=>e-t),!0),"`resolutions` must be sorted in descending order"),!t.origins)for(let t=0,i=this.resolutions_.length-1;t{const n=new iu(Math.min(0,t[0]),Math.max(t[0]-1,-1),Math.min(0,t[1]),Math.max(t[1]-1,-1));if(i){const t=this.getTileRangeForExtentAndZ(i,e);n.minX=Math.max(t.minX,n.minX),n.maxX=Math.min(t.maxX,n.maxX),n.minY=Math.max(t.minY,n.minY),n.maxY=Math.min(t.maxY,n.maxY)}return n})):i&&this.calculateTileRanges_(i)}forEachTileCoord(t,e,i){const n=this.getTileRangeForExtentAndZ(t,e);for(let t=n.minX,r=n.maxX;t<=r;++t)for(let r=n.minY,s=n.maxY;r<=s;++r)i([e,t,r])}forEachTileCoordParentTileRange(t,e,i,n){let r,s,o,a=null,l=t[0]-1;for(2===this.zoomFactor_?(s=t[1],o=t[2]):a=this.getTileCoordExtent(t,n);l>=this.minZoom;){if(void 0!==s&&void 0!==o?(s=Math.floor(s/2),o=Math.floor(o/2),r=nu(s,s,o,o,i)):r=this.getTileRangeForExtentAndZ(a,l,i),e(l,r))return!0;--l}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getOrigins(){return this.origins_}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]this.maxZoom||e0)||i.find((function(i){return e[h]==i[l]||!e[h].includes(":")&&t[h]+":"+e[h]===i[l]})),d){r.push(e[h]);const t=28e-5*e[c]/g,i=e.TileWidth,l=e.TileHeight;f?s.push([e[u][1],e[u][0]]):s.push(e[u]),n.push(t),o.push(i==l?i:[i,l]),a.push([e.MatrixWidth,e.MatrixHeight])}})),new $u({extent:e,origins:s,resolutions:n,matrixIds:r,tileSizes:o,sizes:a})}function Zu(t){let e=t.getDefaultTileGrid();return e||(e=Ju(t),t.setDefaultTileGrid(e)),e}function Yu(t,e,i){const n=e[0],r=t.getTileCoordCenter(e),s=Qu(i);if(!$t(s,r)){const e=ve(s),i=Math.ceil((s[0]-r[0])/e);return r[0]+=e*i,t.getTileCoordForCoordAndZ(r,n)}return e}function Hu(t,e,i,n){n=void 0!==n?n:"top-left";const r=qu(t,e,i);return new Vu({extent:t,origin:ge(t,n),resolutions:r,tileSize:i})}function Ku(t){const e=t||{},i=e.extent||En("EPSG:3857").getExtent(),n={extent:i,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:qu(i,e.maxZoom,e.tileSize,e.maxResolution)};return new Vu(n)}function qu(t,e,i,n){e=void 0!==e?e:42,i=Wl(void 0!==i?i:Co);const r=_e(t),s=ve(t);n=n>0?n:Math.max(s/i[0],r/i[1]);const o=e+1,a=new Array(o);for(let t=0;tQn(o,On(t,this.targetProj_,this.sourceProj_)))):An(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){const e=t[0]+"/"+t[1];return a[e]||(a[e]=l(t)),a[e]},this.maxSourceExtent_=n,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&ve(n)>=ve(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?ve(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?ve(this.targetProj_.getExtent()):null;const h=ye(i),c=xe(i),u=ue(i),d=ce(i),g=this.transformInv_(h),f=this.transformInv_(c),p=this.transformInv_(u),_=this.transformInv_(d),m=10+(s?Math.max(0,Math.ceil(Math.log2(he(i)/(s*s*256*256)))):0);if(this.addQuad_(h,c,u,d,g,f,p,_,m),this.wrapsXInSource_){let t=1/0;this.triangles_.forEach((function(e,i,n){t=Math.min(t,e.source[0][0],e.source[1][0],e.source[2][0])})),this.triangles_.forEach((e=>{if(Math.max(e.source[0][0],e.source[1][0],e.source[2][0])-t>this.sourceWorldWidth_/2){const i=[[e.source[0][0],e.source[0][1]],[e.source[1][0],e.source[1][1]],[e.source[2][0],e.source[2][1]]];i[0][0]-t>this.sourceWorldWidth_/2&&(i[0][0]-=this.sourceWorldWidth_),i[1][0]-t>this.sourceWorldWidth_/2&&(i[1][0]-=this.sourceWorldWidth_),i[2][0]-t>this.sourceWorldWidth_/2&&(i[2][0]-=this.sourceWorldWidth_);const n=Math.min(i[0][0],i[1][0],i[2][0]);Math.max(i[0][0],i[1][0],i[2][0])-n.5&&c<1;let g=!1;if(l>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){g=ve(Bt([t,e,i,n]))/this.targetWorldWidth_>.25||g}!d&&this.sourceProj_.isGlobal()&&c&&(g=c>.25||g)}if(!g&&this.maxSourceExtent_&&isFinite(h[0])&&isFinite(h[1])&&isFinite(h[2])&&isFinite(h[3])&&!Se(h,this.maxSourceExtent_))return;let f=0;if(!(g||isFinite(r[0])&&isFinite(r[1])&&isFinite(s[0])&&isFinite(s[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])))if(l>0)g=!0;else if(f=(isFinite(r[0])&&isFinite(r[1])?0:8)+(isFinite(s[0])&&isFinite(s[1])?0:4)+(isFinite(o[0])&&isFinite(o[1])?0:2)+(isFinite(a[0])&&isFinite(a[1])?0:1),1!=f&&2!=f&&4!=f&&8!=f)return;if(l>0){if(!g){const e=[(t[0]+i[0])/2,(t[1]+i[1])/2],n=this.transformInv_(e);let s;if(d){s=(De(r[0],u)+De(o[0],u))/2-De(n[0],u)}else s=(r[0]+o[0])/2-n[0];const a=(r[1]+o[1])/2-n[1];g=s*s+a*a>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const h=[(e[0]+i[0])/2,(e[1]+i[1])/2],c=this.transformInv_(h),u=[(n[0]+t[0])/2,(n[1]+t[1])/2],d=this.transformInv_(u);this.addQuad_(t,e,h,u,r,s,c,d,l-1),this.addQuad_(u,h,i,n,d,c,o,a,l-1)}else{const h=[(t[0]+e[0])/2,(t[1]+e[1])/2],c=this.transformInv_(h),u=[(i[0]+n[0])/2,(i[1]+n[1])/2],d=this.transformInv_(u);this.addQuad_(t,h,u,n,r,c,d,a,l-1),this.addQuad_(h,e,i,u,c,s,o,d,l-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}11&f||this.addTriangle_(t,i,n,r,o,a),14&f||this.addTriangle_(t,i,e,r,o,s),f&&(13&f||this.addTriangle_(e,n,t,s,a,r),7&f||this.addTriangle_(e,n,i,s,a,o))}calculateSourceExtent(){const t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach((function(e,i,n){const r=e.source;ne(t,r[0]),ne(t,r[1]),ne(t,r[2])})),t}getTriangles(){return this.triangles_}}const gd=.5;class fd extends nt{constructor(t,e,i,n,r,s,o,a,l,h,c,u){super(r,Y,u),this.renderEdges_=void 0!==c&&c,this.pixelRatio_=o,this.gutter_=a,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=n,this.wrappedTileCoord_=s||r,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;const d=n.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let f=this.sourceTileGrid_.getExtent();const p=g?me(d,g):d;if(0===he(p))return void(this.state=J);const _=t.getExtent();_&&(f=f?me(f,_):_);const m=n.getResolution(this.wrappedTileCoord_[0]),y=Mu(t,i,p,m);if(!isFinite(y)||y<=0)return void(this.state=J);const x=void 0!==h?h:gd;if(this.triangulation_=new dd(t,i,p,f,y*x,m),0===this.triangulation_.getTriangles().length)return void(this.state=J);this.sourceZ_=e.getZForResolution(y);let v=this.triangulation_.calculateSourceExtent();if(f&&(t.canWrapX()?(v[1]=Ie(v[1],f[1],f[3]),v[3]=Ie(v[3],f[1],f[3])):v=me(v,f)),he(v)){let i=0,n=0;t.canWrapX()&&(i=ve(_),n=Math.floor((v[0]-_[0])/i));Pe(v.slice(),t,!0).forEach((t=>{const r=e.getTileRangeForExtentAndZ(t,this.sourceZ_);for(let t=r.minX;t<=r.maxX;t++)for(let e=r.minY;e<=r.maxY;e++){const r=n*i;this.sourceTiles_.push({getTile:()=>l(this.sourceZ_,t,e,o),offset:r})}++n})),0===this.sourceTiles_.length&&(this.state=J)}else this.state=J}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach((e=>{const i=e.tile;if(i&&i.getState()==K){const n=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);n[0]+=e.offset,n[2]+=e.offset;const r=this.clipExtent_?.slice();r&&(r[0]+=e.offset,r[2]+=e.offset),t.push({extent:n,clipExtent:r,image:i.getImage()})}})),this.sourceTiles_.length=0,0===t.length)this.state=q;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),n="number"==typeof i?i:i[0],r="number"==typeof i?i:i[1],s=this.targetTileGrid_.getResolution(e),o=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Au(n,r,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),s,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=K}this.changed()}load(){for(const t of this.sourceTiles_)t.tile=t.getTile();if(this.state==Y){this.state=H,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach((({tile:e})=>{const i=e.getState();if(i==Y||i==H){t++;const i=D(e,n,(n=>{const r=e.getState();r!=K&&r!=q&&r!=J||(k(i),t--,0===t&&(this.unlistenSources_(),this.reproject_()))}));this.sourcesListenerKeys_.push(i)}})),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach((function({tile:t},e,i){t.getState()==Y&&t.load()}))}}unlistenSources_(){this.sourcesListenerKeys_.forEach(k),this.sourcesListenerKeys_=null}release(){this.canvas_&&(mt(this.canvas_.getContext("2d")),Pu.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}}class pd extends V{constructor(t){super(),this.projection=En(t.projection),this.attributions_=_d(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible??!0,this.loading=!1,this.state_=void 0!==t.state?t.state:"ready",this.wrapX_=void 0!==t.wrapX&&t.wrapX,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;const e=this;this.viewPromise_=new Promise((function(t,i){e.viewResolver=t,e.viewRejector=i}))}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(t){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(t){this.attributions_=_d(t),this.changed()}setState(t){this.state_=t,this.changed()}}function _d(t){return t?"function"==typeof t?t:(Array.isArray(t)||(t=[t]),e=>t):null}class md extends pd{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:t.projection,state:t.state,wrapX:t.wrapX,interpolate:t.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=void 0!==t.tilePixelRatio?t.tilePixelRatio:1,this.tileGrid=void 0!==t.tileGrid?t.tileGrid:null;const e=[256,256];this.tileGrid&&Wl(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tmpSize=[0,0],this.key_=t.key||z(this),this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,n,r,s){return U()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:Zu(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const n=this.getTileGridForProjection(i),r=this.getTilePixelRatio(e),s=Wl(n.getTileSize(t),this.tmpSize);return 1==r?s:$l(s,r,this.tmpSize)}getTileCoordForTileUrlFunction(t,e){const i=void 0!==e?e:this.getProjection(),n=void 0!==e?this.getTileGridForProjection(i):this.tileGrid||this.getTileGridForProjection(i);return this.getWrapX()&&i.isGlobal()&&(t=Yu(n,t,i)),zu(t,n)?t:null}clear(){}refresh(){this.clear(),super.refresh()}}class yd extends M{constructor(t,e){super(t),this.tile=e}}var xd="tileloadstart",vd="tileloadend",Sd="tileloaderror";class Ed extends md{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===Ed.prototype.tileUrlFunction,this.tileLoadFunction=t.tileLoadFunction,t.tileUrlFunction&&(this.tileUrlFunction=t.tileUrlFunction),this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(t){const e=t.target,i=z(e),n=e.getState();let r;n==H?(this.tileLoadingKeys_[i]=!0,r=xd):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],r=n==q?Sd:n==K?vd:void 0),null!=r&&this.dispatchEvent(new yd(r,e))}setTileLoadFunction(t){this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,void 0!==e?this.setKey(e):this.changed()}setUrl(t){const e=ad(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction(hd(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}}class wd extends Ed{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:Td,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition,interpolate:void 0===t.interpolate||t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.crossOrigin=void 0!==t.crossOrigin?t.crossOrigin:null,this.referrerPolicy=t.referrerPolicy,this.tileClass=void 0!==t.tileClass?t.tileClass:Bs,this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(t){return this.getProjection()&&t&&!Fn(this.getProjection(),t)?0:this.getGutter()}getGutter(){return 0}getKey(){let t=super.getKey();return this.getInterpolate()||(t+=":disable-interpolation"),t}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||Fn(e,t)))return this.tileGrid;const i=z(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=Zu(t)),this.tileGridForProjection[i]}createTile_(t,e,i,r,s,o){const a=[t,e,i],l=this.getTileCoordForTileUrlFunction(a,s),h=l?this.tileUrlFunction(l,r,s):void 0,c=new this.tileClass(a,void 0!==h?Y:J,void 0!==h?h:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return c.key=o,c.addEventListener(n,this.handleTileChange.bind(this)),c}getTile(t,e,i,n,r,s){const o=this.getProjection();if(!o||!r||Fn(o,r))return this.getTileInternal(t,e,i,n,o||r);const a=[t,e,i],l=this.getKey(),h=this.getTileGridForProjection(o),c=this.getTileGridForProjection(r),u=this.getTileCoordForTileUrlFunction(a,r),d=new fd(o,h,r,c,a,u,this.getTilePixelRatio(n),this.getGutter(),((t,e,i,n)=>this.getTileInternal(t,e,i,n,o,s)),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return d.key=l,d}getTileInternal(t,e,i,n,r,s){const o=this.getKey(),a=ju(this,o,t,e,i);if(s&&s.containsKey(a)){return s.get(a)}const l=this.createTile_(t,e,i,n,r,o);return s?.set(a,l),l}setRenderReprojectionEdges(t){this.renderReprojectionEdges_!=t&&(this.renderReprojectionEdges_=t,this.changed())}setTileGridForProjection(t,e){const i=En(t);if(i){const t=z(i);t in this.tileGridForProjection||(this.tileGridForProjection[t]=e)}}}function Td(t,e){if(ct){const i=t.getCrossOrigin();let n="same-origin",r="same-origin";"anonymous"===i||""===i?(n="cors",r="omit"):"use-credentials"===i&&(n="cors",r="include");const s={mode:n,credentials:r,referrerPolicy:t.getReferrerPolicy()};fetch(e,s).then((t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.blob()})).then((t=>createImageBitmap(t))).then((e=>{const i=t.getImage();i.width=e.width,i.height=e.height;i.getContext("2d").drawImage(e,0,0),e.close?.(),i.dispatchEvent(new Event("load"))})).catch((()=>{t.getImage().dispatchEvent(new Event("error"))}))}else t.getImage().src=e}function Cd(t){const e=t[0],i=new Array(e);let n,r,s=1<>=1;return i.join("")}class bd extends wd{constructor(t){const e=void 0!==(t=t||{}).projection?t.projection:"EPSG:3857",i=void 0!==t.tileGrid?t.tileGrid:Ku({extent:Qu(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,interpolate:t.interpolate,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.gutter_=void 0!==t.gutter?t.gutter:0}getGutter(){return this.gutter_}}function Rd(t,e,i,n){const r=[];let s=[1/0,1/0,-1/0,-1/0];for(let o=0,a=i.length;o1?o:2,s=s||new Array(o);for(let e=0;e>1;r=e[0]||(t[1]<=e[1]&&t[3]>=e[1]||le(t,this.intersectsCoordinate.bind(this)))}return!1}setCenter(t){const e=this.stride,i=this.flatCoordinates[e]-this.flatCoordinates[0],n=t.slice();n[e]=n[0]+i;for(let i=1;it.clone()))}function Od(t,e,i,n){let r=t[e],s=t[e+1],o=0;for(let a=e+n;a{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const i=this.simplifiedGeometry_.getFlatCoordinates();let n;switch(this.type_){case"LineString":i.length=Gr(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),n=[i.length];break;case"MultiLineString":n=[],i.length=jr(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,n);break;case"Polygon":n=[],i.length=Xr(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,n)}return n&&(this.simplifiedGeometry_=new Ud(this.type_,i,n,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_})),this}}function Bd(t){const e=t.getType();switch(e){case"Point":return new Wr(t.getFlatCoordinates());case"MultiPoint":return new kd(t.getFlatCoordinates(),"XY");case"LineString":return new Dd(t.getFlatCoordinates(),"XY");case"MultiLineString":return new Nd(t.getFlatCoordinates(),"XY",t.getEnds());case"Polygon":const i=t.getFlatCoordinates(),n=t.getEnds(),r=ds(i,n);return r.length>1?new Gd(i,"XY",r):new gs(i,"XY",n);default:throw new Error("Invalid geometry type:"+e)}}Ud.prototype.getFlatCoordinates=Ud.prototype.getOrientedFlatCoordinates;class zd{constructor(t){this.rbush_=new ll(t),this.items_={}}insert(t,e){const i={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(i),this.items_[z(e)]=i}load(t,e){const i=new Array(e.length);for(let n=0,r=e.length;n{n||(n=!0,this.addFeature(t.element),n=!1)})),i.addEventListener(e,(t=>{n||(n=!0,this.removeFeature(t.element),n=!1)})),this.featuresCollection_=i}clear(t){if(t){for(const t in this.featureChangeKeys_){this.featureChangeKeys_[t].forEach(k)}this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach((t=>{this.removeFeatureInternal(t)}));for(const t in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[t])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new Kd($d);this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const i=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(i,(function(i){const n=i.getGeometry();if(n instanceof Ud||n.intersectsCoordinate(t))return e(i)}))}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,(function(i){const n=i.getGeometry();if(n instanceof Ud||n.intersectsExtent(t)){const t=e(i);if(t)return t}}))}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),L(this.nullGeometryFeatures_)||E(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,(function(t){e.push(t)})),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const i=Pe(t,e);return[].concat(...i.map((t=>this.featuresRtree_.getInExtent(t))))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],n=t[1];let r=null;const s=[NaN,NaN];let o=1/0;const a=[-1/0,-1/0,1/0,1/0];return e=e||C,this.featuresRtree_.forEachInExtent(a,(function(t){if(e(t)){const e=t.getGeometry(),l=o;if(o=e instanceof Ud?0:e.closestPointXY(i,n,s,o),o{--this.loadingExtentsCount_,this.dispatchEvent(new Kd(Yd,void 0,t))}),(()=>{--this.loadingExtentsCount_,this.dispatchEvent(new Kd(Hd))})),n.insert(s,{extent:s.slice()}))}this.loading=!(this.loader_.length<4)&&this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_,i=e.forEachInExtent(t,(function(e){if(te(e.extent,t))return e}));i&&e.remove(i)}removeFeatures(t){let e=!1;for(let i=0,n=t.length;i 1.0 ||\n v_texcoord.y > 1.0\n ) {\n discard;\n }\n gl_FragColor = texture2D(u_texture, v_texcoord);\n }\n","\n attribute vec4 a_position;\n attribute vec4 a_texcoord;\n\n uniform mat4 u_matrix;\n uniform mat4 u_textureMatrix;\n\n varying vec2 v_texcoord;\n\n void main() {\n gl_Position = u_matrix * a_position;\n vec2 texcoord = (u_textureMatrix * a_texcoord).xy;\n v_texcoord = texcoord;\n }\n"),this.positionLocation=t.getAttribLocation(this.program_,"a_position"),this.texcoordLocation=t.getAttribLocation(this.program_,"a_texcoord"),this.matrixLocation=t.getUniformLocation(this.program_,"u_matrix"),this.textureMatrixLocation=t.getUniformLocation(this.program_,"u_textureMatrix"),this.textureLocation=t.getUniformLocation(this.program_,"u_texture"),this.positionBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),this.positions=[0,0,0,1,1,0,1,0,0,1,1,1],t.bufferData(t.ARRAY_BUFFER,new Float32Array(this.positions),t.STATIC_DRAW),this.texcoordBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this.texcoordBuffer),this.texcoords=[0,0,0,1,1,0,1,0,0,1,1,1],t.bufferData(t.ARRAY_BUFFER,new Float32Array(this.texcoords),t.STATIC_DRAW)}drawImage(t,e,i,n,r,s,o,a,l,h,c,u,d){const g=this.gl_;void 0===a&&(a=n),void 0===l&&(l=r),void 0===s&&(s=e),void 0===o&&(o=i),void 0===h&&(h=s),void 0===c&&(c=o),void 0===u&&(u=g.canvas.width),void 0===d&&(d=g.canvas.height),g.bindTexture(g.TEXTURE_2D,t),g.useProgram(this.program_),g.bindBuffer(g.ARRAY_BUFFER,this.positionBuffer),g.enableVertexAttribArray(this.positionLocation),g.vertexAttribPointer(this.positionLocation,2,g.FLOAT,!1,0,0),g.bindBuffer(g.ARRAY_BUFFER,this.texcoordBuffer),g.enableVertexAttribArray(this.texcoordLocation),g.vertexAttribPointer(this.texcoordLocation,2,g.FLOAT,!1,0,0);let f=tg(0,u,0,d,-1,1);f=ig(f,a,l,0),f=eg(f,h,c,1),g.uniformMatrix4fv(this.matrixLocation,!1,f);let p=ng(n/e,r/i,0);p=eg(p,s/e,o/i,1),g.uniformMatrix4fv(this.textureMatrixLocation,!1,p),g.uniform1i(this.textureLocation,0),g.drawArrays(g.TRIANGLES,0,this.positions.length/2)}}function sg(t,e,i){const n=t.createShader(e);if(null===n)throw new Error("Shader compilation failed");if(t.shaderSource(n,i),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS)){const e=t.getShaderInfoLog(n);if(null===e)throw new Error("Shader info log creation failed");throw new Error(e)}return n}function og(t,e,i){const n=t.createProgram(),r=sg(t,t.VERTEX_SHADER,i),s=sg(t,t.FRAGMENT_SHADER,e);if(null===n)throw new Error("Program creation failed");if(t.attachShader(n,r),t.attachShader(n,s),t.linkProgram(n),!t.getProgramParameter(n,t.LINK_STATUS)){if(null===t.getProgramInfoLog(n))throw new Error("Program info log creation failed");throw new Error}return n}function ag(t,e,i,n){let r;return r=i&&i.length?i.shift():ct?new OffscreenCanvas(t||300,e||300):document.createElement("canvas"),t&&(r.width=t),e&&(r.height=e),r.getContext("webgl",n)}function lg(t){const e=t.canvas;e.width=1,e.height=1,t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT|t.STENCIL_BUFFER_BIT)}const hg=[];function cg(t,e,i,n,r,s,o,a,l,h,c,u,d,g){const f=Math.round(n*e),p=Math.round(n*i);let _,m;if(t.canvas.width=f,t.canvas.height=p,m=t.createTexture(),t.bindTexture(t.TEXTURE_2D,m),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),d?(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR)):(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST)),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,f,p,0,t.RGBA,c,null),_=t.createFramebuffer(),t.bindFramebuffer(t.FRAMEBUFFER,_),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,m,0),null===_)throw new Error("Could not create framebuffer");if(null===m)throw new Error("Could not create texture");if(0===l.length)return{width:f,height:p,framebuffer:_,texture:m};const y=[1/0,1/0,-1/0,-1/0];let x,v,S;l.forEach((function(t,e,i){ie(y,t.extent)}));const E=1/r;if(g&&1===l.length&&0===h)x=l[0].texture,v=l[0].width,S=l[0].width;else{if(x=t.createTexture(),null===m)throw new Error("Could not create texture");v=Math.round(ve(y)*E),S=Math.round(_e(y)*E);const e=t.getParameter(t.MAX_TEXTURE_SIZE),i=Math.max(v,S),n=i>e?e/i:1,r=Math.round(v*n),s=Math.round(S*n);t.bindTexture(t.TEXTURE_2D,x),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),d?(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR)):(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST)),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,r,s,0,t.RGBA,c,null);const o=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,o),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,x,0);const a=new rg(t);l.forEach((function(e,i,l){const c=(e.extent[0]-y[0])*E*n,u=-(e.extent[3]-y[3])*E*n,g=ve(e.extent)*E*n,f=_e(e.extent)*E*n;if(t.bindFramebuffer(t.FRAMEBUFFER,o),t.viewport(0,0,r,s),e.clipExtent){const i=(e.clipExtent[0]-y[0])*E*n,r=-(e.clipExtent[3]-y[3])*E*n,s=ve(e.clipExtent)*E*n,o=_e(e.clipExtent)*E*n;t.enable(t.SCISSOR_TEST),t.scissor(d?i:Math.round(i),d?r:Math.round(r),d?s:Math.round(i+s)-Math.round(i),d?o:Math.round(r+o)-Math.round(r))}a.drawImage(e.texture,e.width,e.height,h,h,e.width-2*h,e.height-2*h,d?c:Math.round(c),d?u:Math.round(u),d?g:Math.round(c+g)-Math.round(c),d?f:Math.round(u+f)-Math.round(u),r,s),t.disable(t.SCISSOR_TEST)})),t.deleteFramebuffer(o)}const w=ye(o),T=ye(y),C=t=>{const e=(t[0][0]-w[0])/s*n,i=-(t[0][1]-w[1])/s*n;return{u1:(t[1][0]-w[0])/s*n,v1:-(t[1][1]-w[1])/s*n,u0:e,v0:i,u2:(t[2][0]-w[0])/s*n,v2:-(t[2][1]-w[1])/s*n}};t.bindFramebuffer(t.FRAMEBUFFER,_),t.viewport(0,0,f,p);{const e=[],i=[],n=og(t,"\n precision mediump float;\n\n varying vec2 v_texcoord;\n\n uniform sampler2D u_texture;\n\n void main() {\n if (v_texcoord.x < 0.0 || v_texcoord.x > 1.0 || v_texcoord.y < 0.0 || v_texcoord.y > 1.0) {\n discard;\n }\n gl_FragColor = texture2D(u_texture, v_texcoord);\n }\n","\n attribute vec4 a_position;\n attribute vec2 a_texcoord;\n\n varying vec2 v_texcoord;\n\n uniform mat4 u_matrix;\n\n void main() {\n gl_Position = u_matrix * a_position;\n v_texcoord = a_texcoord;\n }\n");t.useProgram(n);const s=t.getUniformLocation(n,"u_texture");t.bindTexture(t.TEXTURE_2D,x),t.uniform1i(s,0),a.getTriangles().forEach((function(t,n,s){const o=t.source,a=t.target,{u1:l,v1:h,u0:c,v0:u,u2:d,v2:g}=C(a),f=(o[0][0]-T[0])/r/v,p=-(o[0][1]-T[1])/r/S,_=(o[1][0]-T[0])/r/v,m=-(o[1][1]-T[1])/r/S,y=(o[2][0]-T[0])/r/v,x=-(o[2][1]-T[1])/r/S;e.push(l,h,c,u,d,g),i.push(_,m,f,p,y,x)}));const o=tg(0,f,p,0,-1,1),l=t.getUniformLocation(n,"u_matrix");t.uniformMatrix4fv(l,!1,o);const h=t.getAttribLocation(n,"a_position"),c=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,c),t.bufferData(t.ARRAY_BUFFER,new Float32Array(e),t.STATIC_DRAW),t.vertexAttribPointer(h,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(h);const u=t.getAttribLocation(n,"a_texcoord"),d=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,d),t.bufferData(t.ARRAY_BUFFER,new Float32Array(i),t.STATIC_DRAW),t.vertexAttribPointer(u,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(u),t.drawArrays(t.TRIANGLES,0,e.length/2)}if(u){const e=og(t,"\n precision mediump float;\n\n uniform vec4 u_val;\n void main() {\n gl_FragColor = u_val;\n }\n","\n attribute vec4 a_position;\n\n uniform mat4 u_matrix;\n\n void main() {\n gl_Position = u_matrix * a_position;\n }\n");t.useProgram(e);const i=tg(0,f,p,0,-1,1),n=t.getUniformLocation(e,"u_matrix");t.uniformMatrix4fv(n,!1,i);const r=Array.isArray(u)?u:[0,0,0,255],s=t.getUniformLocation(e,"u_val");t.uniform4fv(s,r);const o=t.getAttribLocation(e,"a_position"),l=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,l),t.vertexAttribPointer(o,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(o);const h=a.getTriangles().reduce((function(t,e){const i=e.target,{u1:n,v1:r,u0:s,v0:o,u2:a,v2:l}=C(i);return t.concat([n,r,s,o,s,o,a,l,a,l,n,r])}),[]);t.bufferData(t.ARRAY_BUFFER,new Float32Array(h),t.STATIC_DRAW),t.drawArrays(t.LINES,0,h.length/2)}return{width:f,height:p,framebuffer:_,texture:m}}class ug extends Lt{constructor(t){super({tileCoord:t.tileCoord,loader:()=>Promise.resolve(new Uint8ClampedArray(4)),interpolate:t.interpolate,transition:t.transition}),this.renderEdges_=void 0!==t.renderEdges&&t.renderEdges,this.pixelRatio_=t.pixelRatio,this.gutter_=t.gutter,this.reprojData_=null,this.reprojError_=null,this.reprojSize_=void 0,this.sourceTileGrid_=t.sourceTileGrid,this.targetTileGrid_=t.targetTileGrid,this.wrappedTileCoord_=t.wrappedTileCoord||t.tileCoord,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;const e=t.sourceProj,i=e.getExtent(),n=t.sourceTileGrid.getExtent();this.clipExtent_=e.canWrapX()?n?me(i,n):i:n;const r=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_),s=this.targetTileGrid_.getExtent();let o=this.sourceTileGrid_.getExtent();const a=s?me(r,s):r;if(0===he(a))return void(this.state=J);i&&(o=o?me(o,i):i);const l=this.targetTileGrid_.getResolution(this.wrappedTileCoord_[0]),h=t.targetProj,c=Mu(e,h,a,l);if(!isFinite(c)||c<=0)return void(this.state=J);const u=void 0!==t.errorThreshold?t.errorThreshold:gd;if(this.triangulation_=new dd(e,h,a,o,c*u,l,t.transformMatrix),0===this.triangulation_.getTriangles().length)return void(this.state=J);this.sourceZ_=this.sourceTileGrid_.getZForResolution(c);let d=this.triangulation_.calculateSourceExtent();if(o&&(e.canWrapX()?(d[1]=Ie(d[1],o[1],o[3]),d[3]=Ie(d[3],o[1],o[3])):d=me(d,o)),he(d)){let n=0,r=0;e.canWrapX()&&(n=ve(i),r=Math.floor((d[0]-i[0])/n));Pe(d.slice(),e,!0).forEach((e=>{const i=this.sourceTileGrid_.getTileRangeForExtentAndZ(e,this.sourceZ_),s=t.getTileFunction;for(let t=i.minX;t<=i.maxX;t++)for(let e=i.minY;e<=i.maxY;e++){const i=s(this.sourceZ_,t,e,this.pixelRatio_);if(i){const t=r*n;this.sourceTiles_.push({tile:i,offset:t})}}++r})),0===this.sourceTiles_.length&&(this.state=J)}else this.state=J}getSize(){return this.reprojSize_}getData(){return this.reprojData_}getError(){return this.reprojError_}reproject_(){const t=[];let e=!1;if(this.sourceTiles_.forEach((i=>{const n=i.tile;if(!n||n.getState()!==K)return;const r=n.getSize(),s=this.gutter_;let o;const a=bt(n.getData());a?o=a:(e=!0,o=It(Ct(n.getData())));const l=[r[0]+2*s,r[1]+2*s],h=o instanceof Float32Array,c=l[0]*l[1],u=h?Float32Array:Uint8ClampedArray,d=new u(o.buffer),g=u.BYTES_PER_ELEMENT,f=g*d.length/c,p=d.byteLength/l[1],_=Math.floor(p/g/l[0]),m=this.sourceTileGrid_.getTileCoordExtent(n.tileCoord);m[0]+=i.offset,m[2]+=i.offset;const y=this.clipExtent_?.slice();y&&(y[0]+=i.offset,y[2]+=i.offset),t.push({extent:m,clipExtent:y,data:d,dataType:u,bytesPerPixel:f,pixelSize:l,bandCount:_})})),this.sourceTiles_.length=0,0===t.length)return this.state=q,void this.changed();const i=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(i),r="number"==typeof n?n:n[0],s="number"==typeof n?n:n[1],o=Math.round(r*this.pixelRatio_),a=Math.round(s*this.pixelRatio_),l=this.targetTileGrid_.getResolution(i),h=this.sourceTileGrid_.getResolution(this.sourceZ_),c=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_),u=t[0].bandCount,d=new t[0].dataType(u*o*a),g=ag(o,a,hg,{premultipliedAlpha:!1,antialias:!1});let f;const p=g.RGBA;let _;if(t[0].dataType==Float32Array){_=g.FLOAT,g.getExtension("WEBGL_color_buffer_float"),g.getExtension("OES_texture_float"),g.getExtension("EXT_float_blend");f=null!==g.getExtension("OES_texture_float_linear")&&this.interpolate}else _=g.UNSIGNED_BYTE,f=this.interpolate;for(let e=Math.ceil(u/4)-1;e>=0;--e){const i=[];for(let n=0,r=t.length;n{const i=e.getState();if(i!==Y&&i!==H)return;t++;const r=D(e,n,(()=>{const i=e.getState();i!=K&&i!=q&&i!=J||(k(r),t--,0===t&&(this.unlistenSources_(),this.reproject_()))}));this.sourcesListenerKeys_.push(r)})),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach((function({tile:t}){t.getState()==Y&&t.load()}))}unlistenSources_(){this.sourcesListenerKeys_.forEach(k),this.sourcesListenerKeys_=null}}class dg extends md{constructor(t){const e=void 0===t.projection?"EPSG:3857":t.projection;let i=t.tileGrid;void 0===i&&e&&(i=Ku({extent:Qu(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize})),super({cacheSize:.1,attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:e,tileGrid:i,state:t.state,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,zDirection:t.zDirection}),this.gutter_=void 0!==t.gutter?t.gutter:0,this.tileSize_=t.tileSize?Wl(t.tileSize):null,this.tileSizes_=null,this.tileLoadingKeys_={},this.loader_=t.loader,this.handleTileChange_=this.handleTileChange_.bind(this),this.bandCount=void 0===t.bandCount?4:t.bandCount,this.tileGridForProjection_={},this.crossOrigin_=t.crossOrigin||"anonymous",this.referrerPolicy_=t.referrerPolicy,this.transformMatrix=null}setTileSizes(t){this.tileSizes_=t}getTileSize(t){if(this.tileSizes_)return this.tileSizes_[t];if(this.tileSize_)return this.tileSize_;const e=this.getTileGrid();return e?Wl(e.getTileSize(t)):[256,256]}getGutterForProjection(t){const e=this.getProjection();return e&&!Fn(e,t)||this.transformMatrix?0:this.gutter_}setLoader(t){this.loader_=t}getReprojTile_(t,e,i,n,r,s){const o=this.tileGrid||this.getTileGridForProjection(r||n),a=Math.max.apply(null,o.getResolutions().map(((t,e)=>{const i=Wl(o.getTileSize(e)),n=this.getTileSize(e);return Math.max(n[0]/i[0],n[1]/i[1])}))),l=this.getTileGridForProjection(n),h=[t,e,i],c=this.getTileCoordForTileUrlFunction(h,n),u=Object.assign({sourceProj:r||n,sourceTileGrid:o,targetProj:n,targetTileGrid:l,tileCoord:h,wrappedTileCoord:c,pixelRatio:a,gutter:this.gutter_,getTileFunction:(t,e,i,n)=>this.getTile(t,e,i,n,void 0,s),transformMatrix:this.transformMatrix},this.tileOptions),d=new ug(u);return d.key=this.getKey(),d}getTile(t,e,i,r,s,o){const a=this.getProjection();if(s&&(a&&!Fn(a,s)||this.transformMatrix))return this.getReprojTile_(t,e,i,s,a,o);const l=this.getTileSize(t),h=this.loader_,c=new AbortController,u={signal:c.signal,crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},d=this.getTileCoordForTileUrlFunction([t,e,i]);if(!d)return null;const g=ju(this,this.getKey(),t,e,i);if(o&&o.containsKey(g))return o.get(g);const f=d[0],p=d[1],_=d[2],m=this.getTileGrid()?.getFullTileRange(f);m&&(u.maxY=m.getHeight()-1);const y=Object.assign({tileCoord:[t,e,i],loader:function(){return I((function(){return h(f,p,_,u)}))},size:l,controller:c},this.tileOptions),x=new Lt(y);return x.key=this.getKey(),x.addEventListener(n,this.handleTileChange_),o?.set(g,x),x}handleTileChange_(t){const e=t.target,i=z(e),n=e.getState();let r;n==H?(this.tileLoadingKeys_[i]=!0,r=xd):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],r=n==q?Sd:n==K?vd:void 0),r&&this.dispatchEvent(new yd(r,e))}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||Fn(e,t))&&!this.transformMatrix)return this.tileGrid;const i=z(t);return i in this.tileGridForProjection_||(this.tileGridForProjection_[i]=Zu(t)),this.tileGridForProjection_[i]}setTileGridForProjection(t,e){const i=En(t);if(i){const t=z(i);t in this.tileGridForProjection_||(this.tileGridForProjection_[t]=e)}}}function gg(t,e){if(!t)return!1;if(!0===t)return!0;if(3!==e.getSamplesPerPixel())return!1;const i=e.fileDirectory.getValue("PhotometricInterpretation"),n=GeoTIFF.globals.photometricInterpretations;return i===n.CMYK||i===n.YCbCr||i===n.CIELab||i===n.ICCLab}const fg="STATISTICS_MAXIMUM",pg="STATISTICS_MINIMUM";let _g;function mg(t){try{return t.getBoundingBox(!0)}catch{return[0,0,t.getWidth(),t.getHeight()]}}function yg(t){try{return t.getOrigin().slice(0,2)}catch{return[0,t.getHeight()]}}function xg(t,e){try{return t.getResolution(e)}catch{return[e.getWidth()/t.getWidth(),e.getHeight()/t.getHeight()]}}function vg(t){const e=t.getGeoKeys();if(!e)return null;if(e.ProjectedCSTypeGeoKey&&32767!==e.ProjectedCSTypeGeoKey){const t="EPSG:"+e.ProjectedCSTypeGeoKey;let i=En(t);if(!i){const n=pi(e.ProjLinearUnitsGeoKey);n&&(i=new mi({code:t,units:n}))}return i}if(e.GeographicTypeGeoKey&&32767!==e.GeographicTypeGeoKey){const t="EPSG:"+e.GeographicTypeGeoKey;let i=En(t);if(!i){const n=pi(e.GeogAngularUnitsGeoKey);n&&(i=new mi({code:t,units:n}))}return i}return null}function Sg(t){return t.getImageCount().then((function(e){const i=new Array(e);for(let n=0;ni*t)throw new Error(n)}function Tg(t){return t instanceof Int8Array?127:t instanceof Uint8Array||t instanceof Uint8ClampedArray?255:t instanceof Int16Array?32767:t instanceof Uint16Array?65535:t instanceof Int32Array?2147483647:t instanceof Uint32Array?4294967295:t instanceof Float32Array?34e37:255}class Cg extends dg{constructor(t){super({attributions:t.attributions,state:"loading",tileGrid:null,projection:t.projection||null,transition:t.transition,interpolate:!1!==t.interpolate,wrapX:t.wrapX}),this.sourceInfo_=t.sources;const e=this.sourceInfo_.length;this.sourceOptions_=t.sourceOptions,this.sourceImagery_=new Array(e),this.sourceMasks_=new Array(e),this.resolutionFactors_=new Array(e),this.samplesPerPixel_,this.nodataValues_,this.metadata_,this.normalize_=!1!==t.normalize,this.addAlpha_=!1,this.error_=null,this.convertToRGB_=t.convertToRGB||!1,this.setKey(this.sourceInfo_.map((t=>t.url)).join(","));const i=this,n=new Array(e);for(let t=0;t=0;--t){const i=vg(e[t]);if(i){this.projection=i;break}}}determineTransformMatrix(t){const e=t[0];for(let t=e.length-1;t>=0;--t){const i=e[t].fileDirectory.getValue("ModelTransformation");if(i){const[t,e,n,r,s,o,a,l]=i,h=Kn(Kn([1/Math.sqrt(t*t+s*s),0,0,-1/Math.sqrt(e*e+o*o),r,l],[t,s,e,o,0,0]),[1,0,0,1,-r,-l]);this.transformMatrix=h,this.addAlpha_=!0;break}}}configure_(t){let e,i,n,r,s;const o=new Array(t.length),a=new Array(t.length),l=new Array(t.length);let h=0;const c=t.length;for(let u=0;u{4&~(t.fileDirectory.getValue("NewSubfileType")||0)?c.push(t):d.push(t)}));const g=c.length;if(d.length>0&&d.length!==g)throw new Error(`Expected one mask per image found ${d.length} masks and ${g} images`);let f,p;const _=new Array(g),m=new Array(g),y=new Array(g);a[u]=new Array(g),l[u]=new Array(g);for(let t=0;ty.length&&(h=s.length-y.length);const t=s[s.length-1]/y[y.length-1];this.resolutionFactors_[u]=t;const e=y.map((e=>e*t)),i=`Resolution mismatch for source ${u}, got [${e}] but expected [${s}]`;wg(s.slice(h,s.length),e,.02,i,this.viewRejector)}else s=y,this.resolutionFactors_[u]=1;n?wg(n.slice(h,n.length),m,.01,`Tile size mismatch for source ${u}`,this.viewRejector):n=m,r?wg(r.slice(h,r.length),_,0,`Tile size mismatch for source ${u}`,this.viewRejector):r=_,this.sourceImagery_[u]=c.reverse(),this.sourceMasks_[u]=d.reverse()}for(let t=0,e=this.sourceImagery_.length;tQn(t,e))))}this.viewResolver({showFullExtent:!0,projection:this.projection,resolutions:s,center:jn(de(g),this.projection),extent:Bn(g,this.projection),zoom:1})}loadTile_(t,e,i,n){const r=this.getTileSize(t),s=this.sourceImagery_.length,o=new Array(2*s),a=this.nodataValues_,l=this.sourceInfo_,h=(_g||(_g=new GeoTIFF.Pool),_g);for(let c=0;c1,n=i&&t.imageInfo.profile[1].supports?t.imageInfo.profile[1].supports:[],r=i&&t.imageInfo.profile[1].formats?t.imageInfo.profile[1].formats:[],s=i&&t.imageInfo.profile[1].qualities?t.imageInfo.profile[1].qualities:[];return{url:t.imageInfo["@id"].replace(/\/?(?:info\.json)?$/g,""),sizes:void 0===t.imageInfo.sizes?void 0:t.imageInfo.sizes.map((function(t){return[t.width,t.height]})),tileSize:void 0===t.imageInfo.tiles?void 0:[t.imageInfo.tiles.map((function(t){return t.width}))[0],t.imageInfo.tiles.map((function(t){return void 0===t.height?t.width:t.height}))[0]],resolutions:void 0===t.imageInfo.tiles?void 0:t.imageInfo.tiles.map((function(t){return t.scaleFactors}))[0],supports:[...e.supports,...n],formats:[...e.formats,...r],qualities:[...e.qualities,...s]}},Ag[Pg]=function(t){const e=t.getComplianceLevelSupportedFeatures(),i=void 0===t.imageInfo.extraFormats?e.formats:[...e.formats,...t.imageInfo.extraFormats],n=void 0!==t.imageInfo.preferredFormats&&Array.isArray(t.imageInfo.preferredFormats)&&t.imageInfo.preferredFormats.length>0?t.imageInfo.preferredFormats.filter((function(t){return["jpg","png","gif"].includes(t)})).reduce((function(t,e){return void 0===t&&i.includes(e)?e:t}),void 0):void 0;return{url:t.imageInfo.id,sizes:void 0===t.imageInfo.sizes?void 0:t.imageInfo.sizes.map((function(t){return[t.width,t.height]})),tileSize:void 0===t.imageInfo.tiles?void 0:[t.imageInfo.tiles.map((function(t){return t.width}))[0],t.imageInfo.tiles.map((function(t){return t.height}))[0]],resolutions:void 0===t.imageInfo.tiles?void 0:t.imageInfo.tiles.map((function(t){return t.scaleFactors}))[0],supports:void 0===t.imageInfo.extraFeatures?e.supports:[...e.supports,...t.imageInfo.extraFeatures],formats:i,qualities:void 0===t.imageInfo.extraQualities?e.qualities:[...e.qualities,...t.imageInfo.extraQualities],preferredFormat:n}};let Og=class extends Bs{constructor(t,e,i,n,r,s,o){super(e,i,n,r,s,o),this.zoomifyImage_=null,this.tileSize_=t}getImage(){if(this.zoomifyImage_)return this.zoomifyImage_;const t=super.getImage();if(this.state==K){const e=this.tileSize_;if(t.width==e[0]&&t.height==e[1])return this.zoomifyImage_=t,t;const i=ft(e[0],e[1]);return i.drawImage(t,0,0),this.zoomifyImage_=i.canvas,i.canvas}return t}};function Dg(t){return t.toLocaleString("en",{maximumFractionDigits:10})}class Ng extends Ds{constructor(t,e,i,n,r,s,o){let a=t.getExtent();a&&t.canWrapX()&&(a=a.slice(),a[0]=-1/0,a[2]=1/0);let l=e.getExtent();l&&e.canWrapX()&&(l=l.slice(),l[0]=-1/0,l[2]=1/0);const h=l?me(i,l):i,c=Lu(t,e,de(h),n),u=new dd(t,e,h,a,.5*c,n),d=u.calculateSourceExtent(),g=Ee(d)?null:s(d,c,r),f=g?Fs:Os,p=g?g.getPixelRatio():1;super(i,n,p,f),this.targetProj_=e,this.maxSourceExtent_=a,this.triangulation_=u,this.targetResolution_=n,this.targetExtent_=i,this.sourceImage_=g,this.sourcePixelRatio_=p,this.interpolate_=o,this.canvas_=null,this.sourceListenerKey_=null}disposeInternal(){this.state==Ls&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){const t=this.sourceImage_.getState();if(t==Ms){const t=ve(this.targetExtent_)/this.targetResolution_,e=_e(this.targetExtent_)/this.targetResolution_;this.canvas_=Au(t,e,this.sourcePixelRatio_,Ou(this.sourceImage_.getResolution()),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.interpolate_,!0)}this.state=t,this.changed()}load(){if(this.state==Fs){this.state=Ls,this.changed();const t=this.sourceImage_.getState();t==Ms||t==As?this.reproject_():(this.sourceListenerKey_=D(this.sourceImage_,n,(t=>{const e=this.sourceImage_.getState();e!=Ms&&e!=As||(this.unlistenSource_(),this.reproject_())})),this.sourceImage_.load())}}unlistenSource_(){k(this.sourceListenerKey_),this.sourceListenerKey_=null}}const kg="imageloadstart",Gg="imageloadend",jg="imageloaderror";class Ug extends M{constructor(t,e){super(t),this.image=e}}class Bg extends pd{constructor(t){super({attributions:t.attributions,projection:t.projection,state:t.state,interpolate:void 0===t.interpolate||t.interpolate}),this.on,this.once,this.un,this.loader=t.loader||null,this.resolutions_=void 0!==t.resolutions?t.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0,this.image=null,this.wantedExtent_,this.wantedResolution_,this.static_=!!t.loader&&0===t.loader.length,this.wantedProjection_=null}getResolutions(){return this.resolutions_}setResolutions(t){this.resolutions_=t}findNearestResolution(t){const e=this.getResolutions();if(e){t=e[v(e,t,0)]}return t}getImage(t,e,i,n){const r=this.getProjection();if(!r||!n||Fn(r,n))return r&&(n=r),this.getImageInternal(t,e,i,n);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&Fn(this.reprojectedImage_.getProjection(),n)&&this.reprojectedImage_.getResolution()==e&&te(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new Ng(r,n,t,e,i,((t,e,i)=>this.getImageInternal(t,e,i,r)),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(t,e,i,r){if(this.loader){const s=Xg(t,e,i,1),o=this.findNearestResolution(e);if(this.image&&(this.static_||this.wantedProjection_===r&&(this.wantedExtent_&&Wt(this.wantedExtent_,s)||Wt(this.image.getExtent(),s))&&(this.wantedResolution_&&Ou(this.wantedResolution_)===o||Ou(this.image.getResolution())===o)))return this.image;this.wantedProjection_=r,this.wantedExtent_=s,this.wantedResolution_=o,this.image=new Ds(s,o,i,this.loader),this.image.addEventListener(n,this.handleImageChange.bind(this))}return this.image}handleImageChange(t){const e=t.target;let i;switch(e.getState()){case Ls:this.loading=!0,i=kg;break;case Ms:this.loading=!1,i=Gg;break;case As:this.loading=!1,i=jg;break;default:return}this.hasListener(i)&&this.dispatchEvent(new Ug(i,e))}}function zg(t,e){t.getImage().src=e}function Xg(t,e,i,n){const r=e/i,s=de(t),o=Ue(ve(t)/r,4),a=Ue(_e(t)/r,4);return fe(s,r,0,[o+2*Ue((n-1)*o/2,4),a+2*Ue((n-1)*a/2,4)])}function Vg(t,e,i,n,r,s){const o=r.getCode().split(/:(?=\d+$)/).pop(),a=i/n,l=[Ge(ve(e)/a,4),Ge(_e(e)/a,4)];s.SIZE=l[0]+","+l[1],s.BBOX=e.join(","),s.BBOXSR=o,s.IMAGESR=o,s.DPI=Math.round(s.DPI?s.DPI*n:90*n);return td(t.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage"),s)}function $g(t){const e=t.load?t.load:js,i=En(t.projection||"EPSG:3857"),n=t.ratio??1.5,r=t.crossOrigin??null,s=t.referrerPolicy;return function(o,a,l){l=t.hidpi?l:1;const h={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};Object.assign(h,t.params),o=Xg(o,a,l,n);const c=Vg(t.url,o,a,l,i,h),u=new Image;return u.crossOrigin=r,void 0!==s&&(u.referrerPolicy=s),e(u,c).then((t=>{const e=ve(o)/t.width*l;return{image:t,extent:o,resolution:e,pixelRatio:l}}))}}function Wg(t,e,i,n,r,s,o){const a=function(t,e,i,n){const r=ve(t),s=_e(t),o=e[0],a=e[1],l=.0254/n;return a*r>o*s?r*i/(o*l):s*i/(a*l)}(i,n,s,o),l=de(i),h={OPERATION:r?"GETDYNAMICMAPOVERLAYIMAGE":"GETMAPIMAGE",VERSION:"2.0.0",LOCALE:"en",CLIENTAGENT:"ol/source/ImageMapGuide source",CLIP:"1",SETDISPLAYDPI:o,SETDISPLAYWIDTH:Math.round(n[0]),SETDISPLAYHEIGHT:Math.round(n[1]),SETVIEWSCALE:a,SETVIEWCENTERX:l[0],SETVIEWCENTERY:l[1]};return Object.assign(h,e),td(t,h)}function Zg(t){const e=t.load||js,i=t.useOverlay??!1,n=t.metersPerUnit||1,r=t.displayDpi||96,s=t.ratio??1,o=t.crossOrigin??null,a=t.referrerPolicy;return function(l,h,c){const u=new Image;u.crossOrigin=o,void 0!==a&&(u.referrerPolicy=a);const d=ve(l=Xg(l,h,c,s))/h,g=_e(l)/h,f=[d*c,g*c],p=Wg(t.url,t.params,l,f,i,n,r);return e(u,p).then((t=>({image:t,extent:l,pixelRatio:c})))}}function Yg(t){const e=t.load||js,i=t.imageExtent,n=t.crossOrigin??null;return()=>{const r=new Image;return r.crossOrigin=n,void 0!==t.referrerPolicy&&(r.referrerPolicy=t.referrerPolicy),e(r,t.url).then((t=>{const e=ve(i)/t.width,n=_e(i)/t.height;return{image:t,extent:i,resolution:e!==n?[e,n]:n,pixelRatio:1}}))}}const Hg=new Error("Image failed to load");function Kg(t,e,i,n,r){return new Promise(((s,o)=>{const a=new Image;a.crossOrigin=r.crossOrigin??null,void 0!==r.referrerPolicy&&(a.referrerPolicy=r.referrerPolicy),a.addEventListener("load",(()=>s(a))),a.addEventListener("error",(()=>o(Hg))),a.src=sd(t,e,i,n,r.maxY)}))}function qg(t){return function(e,i,n,r){return Kg(od(t,e,i,n),e,i,n,r)}}function Jg(t){let e;if(Array.isArray(t))e=qg(t);else if("string"==typeof t){e=qg(ad(t))}else{if("function"!=typeof t)throw new Error("The url option must be a single template, an array of templates, or a function for getting a URL");i=t,e=function(t,e,n,r){return Kg(i(t,e,n,r),t,e,n,r)}}var i;return e}let Qg=0;function tf(t){return Array.isArray(t)?t.join("\n"):"string"==typeof t?t:(++Qg,"url-function-key-"+Qg)}class ef extends dg{constructor(t){let e,i=(t=t||{}).loader;t.url&&(i=Jg(t.url),e=tf(t.url));const n=i?t.state:"loading",r=void 0===t.wrapX||t.wrapX;super({loader:i,key:e,attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize,gutter:t.gutter,maxResolution:t.maxResolution,projection:t.projection,tileGrid:t.tileGrid,state:n,wrapX:r,transition:t.transition,interpolate:!1!==t.interpolate,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,zDirection:t.zDirection})}setUrl(t){const e=Jg(t);this.setLoader(e),this.setKey(tf(t)),"ready"!==this.getState()&&this.setState("ready")}}const nf="1.3.0",rf=[101,101];function sf(t,e,i,n,r){r.WIDTH=i[0],r.HEIGHT=i[1];const s=n.getAxisOrientation(),o=Je(r.VERSION,"1.3")>=0;r[o?"CRS":"SRS"]=n.getCode();const a=o&&s.startsWith("ne")?[e[1],e[0],e[3],e[2]]:e;return r.BBOX=a.join(","),td(t,r)}function of(t,e,i,n,r,s,o){s=Object.assign({REQUEST:"GetMap"},s);const a=e/i,l=[Ge(ve(t)/a,4),Ge(_e(t)/a,4)];if(1!=i)switch(o){case"geoserver":const t=90*i+.5|0;"FORMAT_OPTIONS"in s?s.FORMAT_OPTIONS+=";dpi:"+t:s.FORMAT_OPTIONS="dpi:"+t;break;case"mapserver":s.MAP_RESOLUTION=90*i;break;case"carmentaserver":case"qgis":s.DPI=90*i;break;default:throw new Error("Unknown `serverType` configured")}return sf(r,t,l,n,s)}function af(t,e){return Object.assign({REQUEST:e,SERVICE:"WMS",VERSION:nf,FORMAT:"image/png",STYLES:"",TRANSPARENT:"TRUE"},t)}function lf(t){const e=void 0===t.hidpi||t.hidpi,i=En(t.projection||"EPSG:3857"),n=t.ratio||1.5,r=t.load||js,s=t.crossOrigin??null,o=t.referrerPolicy;return(a,l,h)=>{a=Xg(a,l,h,n),1==h||e&&void 0!==t.serverType||(h=1);const c=of(a,l,h,i,t.url,af(t.params,"GetMap"),t.serverType),u=new Image;return u.crossOrigin=s,void 0!==o&&(u.referrerPolicy=o),r(u,c).then((t=>({image:t,extent:a,pixelRatio:h})))}}function hf(t,e,i){if(void 0===t.url)return;const n=En(t.projection||"EPSG:3857"),r=fe(e,i,0,rf),s={QUERY_LAYERS:t.params.LAYERS,INFO_FORMAT:"application/json"};Object.assign(s,af(t.params,"GetFeatureInfo"),t.params);const o=je((e[0]-r[0])/i,4),a=je((r[3]-e[1])/i,4),l=Je(s.VERSION,"1.3")>=0;return s[l?"I":"X"]=o,s[l?"J":"Y"]=a,sf(t.url,r,rf,n,s)}function cf(t,e){if(void 0===t.url)return;const i={SERVICE:"WMS",VERSION:nf,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0!==e){const n=En(t.projection||"EPSG:3857").getMetersPerUnit()||1,r=28e-5;i.SCALE=e*n/r}if(Object.assign(i,t.params),void 0!==t.params&&void 0===i.LAYER){const t=i.LAYERS;if(!(!Array.isArray(t)||1!==t.length))return;i.LAYER=t}return td(t.url,i)}const uf={"image/png":!0,"image/jpeg":!0,"image/gif":!0,"image/webp":!0},df={"application/vnd.mapbox-vector-tile":!0,"application/geo+json":!0};function gf(t,e){if(!e.length)return t;const i=new URL(t,"file:/");if(i.pathname.split("/").includes("collections"))return Ke('The "collections" query parameter cannot be added to collection endpoints'),t;const n=e.map((t=>encodeURIComponent(t))).join(",");i.searchParams.append("collections",n);return`${t.split("?")[0]}?${decodeURIComponent(i.searchParams.toString())}`}function ff(t,e,i){let n,r;for(let i=0;it.replace(/E|X|Lon/i,"e").replace(/N|Y|Lat/i,"n"))).join(""):r.getAxisOrientation()).startsWith("en"),a=e.tileMatrices.sort((function(t,e){return e.cellSize-t.cellSize})),l={};for(let t=0;tt.maxTileCol||u.tileRowt.maxTileRow)return}Object.assign(u,{z:u.tileMatrix,x:u.tileCol,y:u.tileRow},y);const d=i.replace(/\{(\w+?)\}/g,(function(t,e){return u[e]}));return _u(x,d)}}}function mf(t){return pu(t.url).then((function(e){return function(t,e){const i=e.tileMatrixSetLimits;let n;if("map"===e.dataType)n=ff(e.links,t.mediaType,t.collections);else{if("vector"!==e.dataType)throw new Error('Expected tileset data type to be "map" or "vector"');n=pf(e.links,t.mediaType,t.supportedMediaTypes,t.collections)}if(e.tileMatrixSet)return _f(t,e.tileMatrixSet,n,i);const r=e.links.find((t=>"http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme"===t.rel));if(!r)throw new Error("Expected http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme link or tileMatrixSet");const s=r.href;return pu(_u(t.url,s)).then((function(e){return _f(t,e,n,i)}))}(t,e)}))}class yf extends Ed{constructor(t){const e=t.projection||"EPSG:3857",i=t.extent||Qu(e),n=t.tileGrid||Ku({extent:i,maxResolution:t.maxResolution,maxZoom:void 0!==t.maxZoom?t.maxZoom:22,minZoom:t.minZoom,tileSize:t.tileSize||512});super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,interpolate:!0,projection:e,state:t.state,tileGrid:n,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:xf,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:void 0===t.zDirection?1:t.zDirection}),this.format_=t.format?t.format:null,this.tileKeysBySourceTileUrl_={},this.sourceTiles_={},this.overlaps_=null==t.overlaps||t.overlaps,this.tileClass=t.tileClass?t.tileClass:au,this.tileGrids_={}}getOverlaps(){return this.overlaps_}getSourceTiles(t,e,i){if(i.getState()===Y){i.setState(H);const r=i.wrappedTileCoord,s=this.getTileGridForProjection(e);let o=s.getTileCoordExtent(r);const a=r[0],l=s.getResolution(a);zt(o,-l,o);const h=this.projection;e&&this.projection&&!Fn(e,h)&&(o=Dn(o,e,h));const c=this.tileGrid,u=c.getExtent();u&&me(o,u,o);let d=l;e&&h&&!Fn(e,h)&&(d=l/h.getMetersPerUnit()/e.getMetersPerUnit());const g=c.getZForResolution(d,this.zDirection);c.forEachTileCoord(o,g,(r=>{const s=this.tileUrlFunction(r,t,e);this.sourceTiles_[s]||(this.sourceTiles_[s]=new this.tileClass(r,s?Y:J,s,this.format_,this.tileLoadFunction));const o=this.sourceTiles_[s];i.sourceTiles.push(o),this.tileKeysBySourceTileUrl_[s]||(this.tileKeysBySourceTileUrl_[s]=[]),this.tileKeysBySourceTileUrl_[s].push(i.getKey());const a=o.getState();if(a{this.handleTileChange(e);const r=o.getState();if(r===K||r===q){const e=o.getKey();e in i.errorTileKeys?o.getState()===K&&delete i.errorTileKeys[e]:i.loadingSourceTiles--,r===q?i.errorTileKeys[e]=!0:o.removeEventListener(n,t),0===i.loadingSourceTiles&&i.setState(L(i.errorTileKeys)?K:q)}};o.addEventListener(n,t),i.loadingSourceTiles++}a===Y&&(o.extent=c.getTileCoordExtent(r),o.projection=this.projection,o.resolution=c.getResolution(r[0]),o.load())})),i.loadingSourceTiles||i.setState(i.sourceTiles.some((t=>t.getState()===q))?q:K)}return i.sourceTiles}removeSourceTiles(t){const e=t.getKey(),i=t.sourceTiles;for(let t=0,n=i.length;t{c=c&&!this.tileUrlFunction(t,n,l)}))}const u=new su(s,c?J:Y,o,this.getSourceTiles.bind(this,n,r),this.removeSourceTiles.bind(this));return u.key=this.getKey(),u}getTileGridForProjection(t){const e=t.getCode();let i=this.tileGrids_[e];if(!i){const n=this.projection;if(null!==n&&!Fn(n,t))return Zu(t);const r=this.tileGrid,s=r.getResolutions().slice(),o=s.map((function(t,e){return r.getOrigin(e)})),a=s.map((function(t,e){return r.getTileSize(e)})),l=43;for(let t=s.length;t{if("function"==typeof _t()[e])return this.push_(e),this.pushMethodArgs_},set:(t,e,i)=>(this.push_(e,i),!0)})}push_(...t){const e=this.instructions_,i=this.zIndex+this.offset_;e[i]||(e[i]=[]),e[i].push(...t)}pushMethodArgs_=(...t)=>(this.push_(t),this);pushFunction(t){this.push_(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach((e=>{for(let i=0,n=e.length;ithis.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return U()}getData(t){return null}prepareFrame(t){return U()}renderFrame(t,e){return U()}forEachFeatureAtCoordinate(t,e,i,n,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;e.getState()!==Ms&&e.getState()!==As||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=Ms&&e!=As&&t.addEventListener(n,this.boundHandleImageChange_),e==Fs&&(t.load(),e=t.getState()),e==Ms}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}}const wf=[];let Tf=null;class Cf extends Ef{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=[1,0,0,1,0,0],this.pixelTransform=[1,0,0,1,0,0],this.inversePixelTransform=[1,0,0,1,0,0],this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){let n;Tf||(Tf=ft(1,1,void 0,{willReadFrequently:!0})),Tf.clearRect(0,0,1,1);try{Tf.drawImage(t,e,i,1,1,0,0,1,1),n=Tf.getImageData(0,0,1,1).data}catch{return Tf=null,null}return n}getBackground(t){let e=this.getLayer().getBackground();return"function"==typeof e&&(e=e(t.viewState.resolution)),e||void 0}useContainer(t,e,i){const n=this.getLayer().getClassName();let r,s;if(t&&t.className===n&&(!i||t&&t.style.backgroundColor&&w(zl(t.style.backgroundColor),zl(i)))){const e=t.firstElementChild;Tt(e)&&(s=e.getContext("2d"))}if(s&&hr(s.canvas.style.transform,e)?(this.container=t,this.context=s,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){r=ct?wt():document.createElement("div"),r.className=n;let t=r.style;t.position="absolute",t.width="100%",t.height="100%",s=ft();const e=s.canvas;r.appendChild(e),t=e.style,t.position="absolute",t.left="0",t.transformOrigin="top left",this.container=r,this.context=s}this.containerReused||!i||this.container.style.backgroundColor||(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const n=ye(i),r=xe(i),s=ue(i),o=ce(i);Qn(e.coordinateToPixelTransform,n),Qn(e.coordinateToPixelTransform,r),Qn(e.coordinateToPixelTransform,s),Qn(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;Qn(a,n),Qn(a,r),Qn(a,s),Qn(a,o),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.clip()}prepareContainer(t,e){const i=t.extent,n=t.viewState.resolution,r=t.viewState.rotation,s=t.pixelRatio,o=Math.round(ve(i)/n*s),a=Math.round(_e(i)/n*s);nr(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/s,1/s,r,-o/2,-a/2),rr(this.inversePixelTransform,this.pixelTransform);const l=ar(this.pixelTransform);if(this.useContainer(e,l,this.getBackground(t)),!this.containerReused){const t=this.context.canvas;t.width!=o||t.height!=a?(t.width=o,t.height=a):this.context.clearRect(0,0,o,a),l!==t.style.transform&&(t.style.transform=l)}}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const r=new Xc(t,this.inversePixelTransform,i,e);n.dispatchEvent(r)}}preRender(t,e){this.frameState=e,e.declutter||this.dispatchRenderEvent_(Ja,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(Qa,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new Sf),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(Ja,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(Qa,this.context,t))}getRenderTransform(t,e,i,n,r,s,o){const a=r/2,l=s/2,h=n/e,c=-h,u=-t[0]+o,d=-t[1];return nr(this.tempTransform,a,l,h,c,-i,u,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}}class bf extends Cf{constructor(t){super(t),this.image=null,this.renderedSourceRevision_=0}getImage(){return this.image?this.image.getImage():null}prepareFrame(t){const e=t.layerStatesArray[t.layerIndex],i=t.pixelRatio,n=t.viewState,r=n.resolution,s=this.getLayer().getSource(),o=t.viewHints;let a=t.extent;if(void 0!==e.extent&&(a=me(a,zn(e.extent,n.projection))),!o[co]&&!o[uo]&&!Ee(a))if(s){this.getLayer().rendered||this.renderedSourceRevision_===s.getRevision()||(this.image=null),this.renderedSourceRevision_=s.getRevision();const t=n.projection,e=s.getImage(a,r,i,t);e&&(this.loadImage(e)?this.image=e:e.getState()===Os&&(this.image=null))}else this.image=null;return!!this.image}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=Qn(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!$t(r,n))return null;const s=this.image.getExtent(),o=this.image.getImage(),a=ve(s),l=Math.floor(o.width*((n[0]-s[0])/a));if(l<0||l>=o.width)return null;const h=_e(s),c=Math.floor(o.height*((s[3]-n[1])/h));return c<0||c>=o.height?null:this.getImageData(o,l,c)}renderFrame(t,e){const i=this.image,n=i.getExtent(),r=i.getResolution(),[s,o]=Array.isArray(r)?r:[r,r],a=i.getPixelRatio(),l=t.layerStatesArray[t.layerIndex],h=t.pixelRatio,c=t.viewState,u=c.center,d=c.resolution,g=h*s/(d*a),f=h*o/(d*a);this.prepareContainer(t,e);const p=this.context.canvas.width,_=this.context.canvas.height,m=this.getRenderContext(t);let y=!1,x=!0;if(l.extent){const e=zn(l.extent,c.projection);x=Se(e,t.extent),y=x&&!Wt(e,t.extent),y&&this.clipUnrotated(m,t,e)}const v=i.getImage(),S=nr(this.tempTransform,p/2,_/2,g,f,0,a*(n[0]-u[0])/s,a*(u[1]-n[3])/o);this.renderedResolution=o*h/a;const E=v.width*S[0],w=v.height*S[3];if(this.getLayer().getSource().getInterpolate()||(m.imageSmoothingEnabled=!1),this.preRender(m,t),x&&E>=.5&&w>=.5){const t=S[4],e=S[5],i=l.opacity;1!==i&&(m.save(),m.globalAlpha=i),m.drawImage(v,0,0,+v.width,+v.height,t,e,E,w),1!==i&&m.restore()}return this.postRender(this.context,t),y&&m.restore(),m.imageSmoothingEnabled=!0,this.container}}class Rf extends nl{constructor(t){super(t=t||{})}}class Pf extends Rf{constructor(t){super(t)}createRenderer(){return new bf(this)}getData(t){return super.getData(t)}}function If(t,e,i){if(!(i in t))return t[i]=new Set([e]),!0;const n=t[i],r=n.has(e);return r||n.add(e),!r}function Ff(t,e,i){const n=t[i];return!!n&&n.delete(e)}function Lf(t,e){const i=t.layerStatesArray[t.layerIndex];i.extent&&(e=me(e,zn(i.extent,t.viewState.projection)));const n=i.layer.getRenderSource();if(!n.getWrapX()){const i=n.getTileGridForProjection(t.viewState.projection).getExtent();i&&(e=me(e,i))}return e}class Mf extends Cf{constructor(t,e){super(t),e=e||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=[1/0,1/0,-1/0,-1/0],this.tempTileRange_=new iu(0,0,0,0),this.tempTileCoord_=Nu(0,0,0);const i=void 0!==e.cacheSize?e.cacheSize:512;this.tileCache_=new Du(i),this.sourceTileCache_=null,this.maxStaleKeys=.5*i}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new Du(512)),this.sourceTileCache_}getOrCreateTile(t,e,i,n){const r=this.tileCache_,s=this.getLayer().getSource(),o=ju(s,s.getKey(),t,e,i);let a;if(r.containsKey(o))a=r.get(o);else{const l=n.viewState.projection,h=s.getProjection();if(a=s.getTile(t,e,i,n.pixelRatio,l,!h||Fn(h,l)?void 0:this.getSourceTileCache()),!a)return null;r.set(o,a)}return a}getTile(t,e,i,n){const r=this.getOrCreateTile(t,e,i,n);return r||null}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=Qn(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!$t(r,n))return null;const s=e.viewState,o=i.getRenderSource(),a=o.getTileGridForProjection(s.projection),l=o.getTilePixelRatio(e.pixelRatio);for(let t=a.getZForResolution(s.resolution);t>=a.getMinZoom();--t){const i=a.getTileCoordForCoordAndZ(n,t),r=this.getTile(t,i[1],i[2],e);if(!r||r.getState()!==K)continue;const h=a.getOrigin(t),c=Wl(a.getTileSize(t)),u=a.getResolution(t);let d;if(r instanceof Bs||r instanceof fd)d=r.getImage();else{if(!(r instanceof Lt))continue;if(d=Ct(r.getData()),!d)continue}const g=Math.floor(l*((n[0]-h[0])/u-i[1]*c[0])),f=Math.floor(l*((h[1]-n[1])/u-i[2]*c[1])),p=Math.round(l*o.getGutterForProjection(s.projection));return this.getImageData(d,g+p,f+p)}return null}prepareFrame(t){this.renderedProjection?t.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=t.viewState.projection):this.renderedProjection=t.viewState.projection;const e=this.getLayer().getSource();if(!e)return!1;const i=e.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==i&&(this.renderedSourceRevision_=i,this.renderedSourceKey_===e.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=i,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(t,e,i,n,r){const s=t.viewState,o=this.getLayer(),a=o.getRenderSource(),l=a.getTileGridForProjection(s.projection),h=z(a);h in t.wantedTiles||(t.wantedTiles[h]={});const c=t.wantedTiles[h],u=o.getMapInternal(),d=Math.max(i-r,l.getMinZoom(),l.getZForResolution(Math.min(o.getMaxResolution(),u?u.getView().getResolutionForZoom(Math.max(o.getMinZoom(),0)):l.getResolution(0)),a.zDirection)),g=s.rotation,f=g?pe(s.center,s.resolution,g,t.size):void 0;for(let r=i;r>=d;--r){const i=l.getTileRangeForExtentAndZ(e,r,this.tempTileRange_),s=l.getResolution(r);for(let e=i.minX;e<=i.maxX;++e)for(let o=i.minY;o<=i.maxY;++o){if(g&&!l.tileCoordIntersectsViewport([r,e,o],f))continue;const i=this.getTile(r,e,o,t);if(!i)continue;if(!If(n,i,r))continue;const a=i.getKey();if(c[a]=!0,i.getState()===Y&&!t.tileQueue.isKeyQueued(a)){const n=Nu(r,e,o,this.tempTileCoord_);t.tileQueue.enqueue([i,h,l.getTileCoordCenter(n),s])}}}}findStaleTile_(t,e){const i=this.tileCache_,n=t[0],r=t[1],s=t[2],o=this.getStaleKeys();for(let t=0;t0&&setTimeout((()=>{this.enqueueTiles(t,C,u-1,w,T-1)}),0),!(u in w))return this.container;const b=z(this),R=t.time;for(const e of w[u]){const i=e.getState();if(i===J)continue;const n=e.tileCoord;if(i===K){if(1===e.getAlpha(b,R)){e.endTransition(b);continue}}i!==q&&(this.renderComplete=!1);if(this.findStaleTile_(n,w)){Ff(w,e,u),t.animate=!0;continue}if(this.findAltTiles_(c,n,u+1,w))continue;const r=c.getMinZoom();for(let t=u-1;t>=r;--t){if(this.findAltTiles_(c,n,t,w))break}}const P=d/s*a/p,I=this.getRenderContext(t);nr(this.tempTransform,_/2,m/2,P,P,0,-_/2,-m/2),i.extent&&this.clipUnrotated(I,t,x),h.getInterpolate()||(I.imageSmoothingEnabled=!1),this.preRender(I,t);const F=Object.keys(w).map(Number);let L;F.sort(y);const M=[],A=[];for(let e=F.length-1;e>=0;--e){const i=F[e],n=h.getTilePixelSize(i,a,r),s=c.getResolution(i)/d,o=n[0]*s*P,l=n[1]*s*P,u=c.getTileCoordForCoordAndZ(ye(E),i),g=c.getTileCoordExtent(u),f=Qn(this.tempTransform,[p*(g[0]-E[0])/d,p*(E[3]-g[3])/d]),_=p*h.getGutterForProjection(r);for(const e of w[i]){if(e.getState()!==K)continue;const n=e.tileCoord,r=u[1]-n[1],s=Math.round(f[0]-(r-1)*o),a=u[2]-n[2],c=Math.round(f[1]-(a-1)*l),d=Math.round(f[0]-r*o),g=Math.round(f[1]-a*l),p=s-d,m=c-g,y=1===F.length;let x=!1;L=[d,g,d+p,g,d+p,g+m,d,g+m];for(let t=0,e=M.length;t{const i=z(h),n=e.wantedTiles[i],r=n?Object.keys(n).length:0;this.updateCacheSize(r),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};t.postRenderFunctions.push(e)}return this.container}updateCacheSize(t){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,2*t)}drawTile(t,e,i,n,r,s,o,a){let l;if(t instanceof Lt){if(l=Ct(t.getData()),!l)throw new Error("Rendering array data is not yet supported")}else l=this.getTileImage(t);if(!l)return;const h=this.getRenderContext(e),c=z(this),u=e.layerStatesArray[e.layerIndex],d=u.opacity*(a?t.getAlpha(c,e.time):1),g=d!==h.globalAlpha;g&&(h.save(),h.globalAlpha=d),h.drawImage(l,o,o,l.width-2*o,l.height-2*o,i,n,r,s),g&&h.restore(),d!==u.opacity?e.animate=!0:a&&t.endTransition(c)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}updateUsedTiles(t,e,i){const n=z(e);n in t||(t[n]={}),t[n][i.getKey()]=!0}}var Af="preload",Of="useInterimTilesOnError";class Df extends nl{constructor(t){t=t||{};const e=Object.assign({},t),i=t.cacheSize;delete t.cacheSize,delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=i,this.setPreload(void 0!==t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(Af)}setPreload(t){this.set(Af,t)}getUseInterimTilesOnError(){return this.get(Of)}setUseInterimTilesOnError(t){this.set(Of,t)}getData(t){return super.getData(t)}}class Nf extends Df{constructor(t){super(t)}createRenderer(){return new Mf(this,{cacheSize:this.getCacheSize()})}}function kf(t){return function(e){const i=e.buffers,n=e.meta,r=e.imageOps,s=e.width,o=e.height,a=i.length,l=i[0].byteLength;if(r){const e=new Array(a);for(let t=0;tthis.maxQueueLength_;)this.queue_.shift().callback(null,null)}dispatch_(){if(this.running_||0===this.queue_.length)return;const t=this.queue_.shift();this.job_=t;const e=t.inputs[0].width,i=t.inputs[0].height,n=t.inputs.map((function(t){return t.data.buffer})),r=this.workers_.length;if(this.running_=r,1===r)return void this.workers_[0].postMessage({buffers:n,meta:t.meta,imageOps:this.imageOps_,width:e,height:i},n);const s=t.inputs[0].data.length,o=4*Math.ceil(s/4/r);for(let s=0;s=93&&r--,r>=35&&r--,r-=32;let s=null;if(r in this.keys_){const t=this.keys_[r];s=this.data_&&t in this.data_?this.data_[t]:t}return s}forDataAtCoordinate(t,e,i){this.state==J&&!0===i?(this.state=Y,N(this,n,(i=>{e(this.getData(t))})),this.loadInternal_()):!0===i?setTimeout((()=>{e(this.getData(t))}),0):e(this.getData(t))}getKey(){return this.src_}handleError_(){this.state=q,this.changed()}handleLoad_(t){this.grid_=t.grid,this.keys_=t.keys,this.data_=t.data,this.state=K,this.changed()}loadInternal_(){if(this.state==Y)if(this.state=H,this.jsonp_)du(this.src_,this.handleLoad_.bind(this),this.handleError_.bind(this));else{const t=new XMLHttpRequest;t.addEventListener("load",this.onXHRLoad_.bind(this)),t.addEventListener("error",this.onXHRError_.bind(this)),t.open("GET",this.src_),t.send()}}onXHRLoad_(t){const e=t.target;if(!e.status||e.status>=200&&e.status<300){let t;try{t=JSON.parse(e.responseText)}catch{return void this.handleError_()}this.handleLoad_(t)}else this.handleError_()}onXHRError_(t){this.handleError_()}load(){this.preemptive_?this.loadInternal_():this.setState(J)}}const Kf=34962,qf=34963,Jf=35044,Qf=35048,tp=5126,ep=["experimental-webgl","webgl","webkit-3d","moz-webgl"];function ip(t,e){e=Object.assign({preserveDrawingBuffer:!0,antialias:!ot},e);const i=ep.length;for(let n=0;n{this.uniforms_.push({value:t.uniforms[i],location:e.getUniformLocation(this.renderTargetProgram_,i)})}))}getRenderTargetTexture(){return this.renderTargetTexture_}getGL(){return this.gl_}init(t){const e=this.getGL(),i=[e.drawingBufferWidth*this.scaleRatio_,e.drawingBufferHeight*this.scaleRatio_];if(e.bindFramebuffer(e.FRAMEBUFFER,this.getFrameBuffer()),e.bindRenderbuffer(e.RENDERBUFFER,this.getDepthBuffer()),e.viewport(0,0,i[0],i[1]),!this.renderTargetTextureSize_||this.renderTargetTextureSize_[0]!==i[0]||this.renderTargetTextureSize_[1]!==i[1]){this.renderTargetTextureSize_=i;const t=0,n=e.RGBA,r=0,s=e.RGBA,o=e.UNSIGNED_BYTE,a=null;e.bindTexture(e.TEXTURE_2D,this.renderTargetTexture_),e.texImage2D(e.TEXTURE_2D,t,n,i[0],i[1],r,s,o,a),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this.renderTargetTexture_,0),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,i[0],i[1]),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,this.depthBuffer_)}}apply(t,e,i,n){const r=this.getGL(),s=t.size;if(r.bindFramebuffer(r.FRAMEBUFFER,e?e.getFrameBuffer():null),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,this.renderTargetTexture_),!e){const e=z(r.canvas);if(!t.renderTargets[e]){const i=r.getContextAttributes();i&&i.preserveDrawingBuffer&&(r.clearColor(0,0,0,0),r.clearDepth(1),r.clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT)),t.renderTargets[e]=!0}}r.disable(r.DEPTH_TEST),r.enable(r.BLEND),r.blendFunc(r.ONE,r.ONE_MINUS_SRC_ALPHA),r.viewport(0,0,r.drawingBufferWidth,r.drawingBufferHeight),r.bindBuffer(r.ARRAY_BUFFER,this.renderTargetVerticesBuffer_),r.useProgram(this.renderTargetProgram_),r.enableVertexAttribArray(this.renderTargetAttribLocation_),r.vertexAttribPointer(this.renderTargetAttribLocation_,2,r.FLOAT,!1,0,0),r.uniform2f(this.renderTargetUniformLocation_,s[0],s[1]),r.uniform1i(this.renderTargetTextureLocation_,0);const o=t.layerStatesArray[t.layerIndex].opacity;r.uniform1f(this.renderTargetOpacityLocation_,o),this.applyUniforms(t),i&&i(r,t),r.drawArrays(r.TRIANGLES,0,6),n&&n(r,t)}getFrameBuffer(){return this.frameBuffer_}getDepthBuffer(){return this.depthBuffer_}applyUniforms(t){const e=this.getGL();let i,n=1;this.uniforms_.forEach((function(r){if(i="function"==typeof r.value?r.value(t):r.value,i instanceof HTMLCanvasElement||i instanceof ImageData)r.texture||(r.texture=e.createTexture()),e.activeTexture(e[`TEXTURE${n}`]),e.bindTexture(e.TEXTURE_2D,r.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),i instanceof ImageData?e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,i.width,i.height,0,e.UNSIGNED_BYTE,new Uint8Array(i.data)):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,i),e.uniform1i(r.location,n++);else if(Array.isArray(i))switch(i.length){case 2:return void e.uniform2f(r.location,i[0],i[1]);case 3:return void e.uniform3f(r.location,i[0],i[1],i[2]);case 4:return void e.uniform4f(r.location,i[0],i[1],i[2],i[3]);default:return}else"number"==typeof i&&e.uniform1f(r.location,i)}))}}const kp={PROJECTION_MATRIX:"u_projectionMatrix",SCREEN_TO_WORLD_MATRIX:"u_screenToWorldMatrix",TIME:"u_time",ZOOM:"u_zoom",RESOLUTION:"u_resolution",ROTATION:"u_rotation",VIEWPORT_SIZE_PX:"u_viewportSizePx",PIXEL_RATIO:"u_pixelRatio",HIT_DETECTION:"u_hitDetection"},Gp=5121,jp=5123,Up=5125,Bp=tp,zp={};function Xp(t){return"shared/"+t}let Vp=0;class $p extends _{constructor(t){super(),t=t||{},this.boundHandleWebGLContextLost_=this.handleWebGLContextLost.bind(this),this.boundHandleWebGLContextRestored_=this.handleWebGLContextRestored.bind(this),this.canvasCacheKey_=t.canvasCacheKey?Xp(t.canvasCacheKey):function(){const t="unique/"+Vp;return Vp+=1,t}(),this.gl_=function(t){let e=zp[t];if(!e){const i=document.createElement("canvas");i.width=1,i.height=1,i.style.position="absolute",i.style.left="0",e={users:0,context:ip(i)},zp[t]=e}return e.users+=1,e.context}(this.canvasCacheKey_),this.bufferCache_={},this.extensionCache_={},this.currentProgram_=null,this.needsToBeRecreated_=!1;const e=this.gl_.canvas;e.addEventListener(Op,this.boundHandleWebGLContextLost_),e.addEventListener(Dp,this.boundHandleWebGLContextRestored_),this.offsetRotateMatrix_=[1,0,0,1,0,0],this.offsetScaleMatrix_=[1,0,0,1,0,0],this.tmpMat4_=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],this.uniformLocationsByProgram_={},this.attribLocationsByProgram_={},this.uniforms_=[],t.uniforms&&this.setUniforms(t.uniforms),this.postProcessPasses_=t.postProcesses?t.postProcesses.map((t=>new Np({webGlContext:this.gl_,scaleRatio:t.scaleRatio,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,uniforms:t.uniforms}))):[new Np({webGlContext:this.gl_})],this.shaderCompileErrors_=null,this.startTime_=Date.now(),this.maxAttributeCount_=this.gl_.getParameter(this.gl_.MAX_VERTEX_ATTRIBS)}setUniforms(t){this.uniforms_=[],this.addUniforms(t)}addUniforms(t){for(const e in t)this.uniforms_.push({name:e,value:t[e]})}canvasCacheKeyMatches(t){return this.canvasCacheKey_===Xp(t)}getExtension(t){if(t in this.extensionCache_)return this.extensionCache_[t];const e=this.gl_.getExtension(t);return this.extensionCache_[t]=e,e}getInstancedRenderingExtension_(){const t=this.getExtension("ANGLE_instanced_arrays");return Mt(!!t,"WebGL extension 'ANGLE_instanced_arrays' is required for vector rendering"),t}bindBuffer(t){const e=this.gl_,i=z(t);let n=this.bufferCache_[i];if(!n){n={buffer:t,webGlBuffer:e.createBuffer()},this.bufferCache_[i]=n}e.bindBuffer(t.getType(),n.webGlBuffer)}flushBufferData(t){const e=this.gl_;this.bindBuffer(t),e.bufferData(t.getType(),t.getArray(),t.getUsage())}deleteBuffer(t){const e=z(t);delete this.bufferCache_[e]}disposeInternal(){const t=this.gl_.canvas;t.removeEventListener(Op,this.boundHandleWebGLContextLost_),t.removeEventListener(Dp,this.boundHandleWebGLContextRestored_),function(t){const e=zp[t];if(!e)return;if(e.users-=1,e.users>0)return;const i=e.context,n=i.getExtension("WEBGL_lose_context");n&&n.loseContext();const r=i.canvas;r.width=1,r.height=1,delete zp[t]}(this.canvasCacheKey_),delete this.gl_}prepareDraw(t,e,i){const n=this.gl_,r=this.getCanvas(),s=t.size,o=t.pixelRatio;r.width===s[0]*o&&r.height===s[1]*o||(r.width=s[0]*o,r.height=s[1]*o,r.style.width=s[0]+"px",r.style.height=s[1]+"px");for(let e=this.postProcessPasses_.length-1;e>=0;e--)this.postProcessPasses_[e].init(t);n.bindTexture(n.TEXTURE_2D,null),n.clearColor(0,0,0,0),n.depthRange(0,1),n.clearDepth(1),n.clear(n.COLOR_BUFFER_BIT|n.DEPTH_BUFFER_BIT),n.enable(n.BLEND),n.blendFunc(n.ONE,e?n.ZERO:n.ONE_MINUS_SRC_ALPHA),i?(n.enable(n.DEPTH_TEST),n.depthFunc(n.LEQUAL)):n.disable(n.DEPTH_TEST)}bindFrameBuffer(t,e){const i=this.getGL();i.bindFramebuffer(i.FRAMEBUFFER,t),e&&i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e,0)}bindInitialFrameBuffer(){const t=this.getGL(),e=this.postProcessPasses_[0].getFrameBuffer();t.bindFramebuffer(t.FRAMEBUFFER,e);const i=this.postProcessPasses_[0].getRenderTargetTexture();t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0)}bindTexture(t,e,i){const n=this.gl_;n.activeTexture(n.TEXTURE0+e),n.bindTexture(n.TEXTURE_2D,t),n.uniform1i(this.getUniformLocation(i),e)}bindAttribute(t,e,i){const n=this.getGL();this.bindBuffer(t);const r=this.getAttributeLocation(e);n.enableVertexAttribArray(r),n.vertexAttribPointer(r,i,n.FLOAT,!1,0,0)}prepareDrawToRenderTarget(t,e,i,n){const r=this.gl_,s=e.getSize();r.bindFramebuffer(r.FRAMEBUFFER,e.getFramebuffer()),r.bindRenderbuffer(r.RENDERBUFFER,e.getDepthbuffer()),r.viewport(0,0,s[0],s[1]),r.bindTexture(r.TEXTURE_2D,e.getTexture()),r.clearColor(0,0,0,0),r.depthRange(0,1),r.clearDepth(1),r.clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT),r.enable(r.BLEND),r.blendFunc(r.ONE,i?r.ZERO:r.ONE_MINUS_SRC_ALPHA),n?(r.enable(r.DEPTH_TEST),r.depthFunc(r.LEQUAL)):r.disable(r.DEPTH_TEST)}drawElements(t,e){const i=this.gl_;this.getExtension("OES_element_index_uint");const n=i.UNSIGNED_INT,r=e-t,s=4*t;i.drawElements(i.TRIANGLES,r,n,s)}drawElementsInstanced(t,e,i){const n=this.gl_;this.getExtension("OES_element_index_uint");const r=this.getInstancedRenderingExtension_(),s=n.UNSIGNED_INT,o=e-t,a=4*t;r.drawElementsInstancedANGLE(n.TRIANGLES,o,s,a,i);for(let t=0;t{if(i="function"==typeof r.value?r.value(t):r.value,i instanceof HTMLCanvasElement||i instanceof HTMLImageElement||i instanceof ImageData||i instanceof WebGLTexture){i instanceof WebGLTexture&&!r.texture?(r.prevValue=void 0,r.texture=i):r.texture||(r.prevValue=void 0,r.texture=e.createTexture()),this.bindTexture(r.texture,n,r.name),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);const t=!(i instanceof HTMLImageElement)||i.complete;i instanceof WebGLTexture||!t||r.prevValue===i||(r.prevValue=i,e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,i)),n++}else if(Array.isArray(i)&&6===i.length)this.setUniformMatrixValue(r.name,Qd(this.tmpMat4_,i));else if(Array.isArray(i)&&i.length<=4)switch(i.length){case 2:return void e.uniform2f(this.getUniformLocation(r.name),i[0],i[1]);case 3:return void e.uniform3f(this.getUniformLocation(r.name),i[0],i[1],i[2]);case 4:return void e.uniform4f(this.getUniformLocation(r.name),i[0],i[1],i[2],i[3]);default:return}else"number"==typeof i&&e.uniform1f(this.getUniformLocation(r.name),i)}))}useProgram(t,e){this.disableAllAttributes_();this.gl_.useProgram(t),this.currentProgram_=t,e&&(this.applyFrameState(e),this.applyUniforms(e))}compileShader(t,e){const i=this.gl_,n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}getProgram(t,e){const i=this.gl_,n=this.compileShader(t,i.FRAGMENT_SHADER),r=this.compileShader(e,i.VERTEX_SHADER),s=i.createProgram();if(i.attachShader(s,n),i.attachShader(s,r),i.linkProgram(s),!i.getShaderParameter(n,i.COMPILE_STATUS)){const t=`Fragment shader compilation failed: ${i.getShaderInfoLog(n)}`;throw new Error(t)}if(i.deleteShader(n),!i.getShaderParameter(r,i.COMPILE_STATUS)){const t=`Vertex shader compilation failed: ${i.getShaderInfoLog(r)}`;throw new Error(t)}if(i.deleteShader(r),!i.getProgramParameter(s,i.LINK_STATUS)){const t=`GL program linking failed: ${i.getProgramInfoLog(s)}`;throw new Error(t)}return s}getUniformLocation(t){const e=z(this.currentProgram_);return void 0===this.uniformLocationsByProgram_[e]&&(this.uniformLocationsByProgram_[e]={}),void 0===this.uniformLocationsByProgram_[e][t]&&(this.uniformLocationsByProgram_[e][t]=this.gl_.getUniformLocation(this.currentProgram_,t)),this.uniformLocationsByProgram_[e][t]}getAttributeLocation(t){const e=z(this.currentProgram_);return void 0===this.attribLocationsByProgram_[e]&&(this.attribLocationsByProgram_[e]={}),void 0===this.attribLocationsByProgram_[e][t]&&(this.attribLocationsByProgram_[e][t]=this.gl_.getAttribLocation(this.currentProgram_,t)),this.attribLocationsByProgram_[e][t]}makeProjectionTransform(t,e){const i=t.size,n=t.viewState.rotation,r=t.viewState.resolution,s=t.viewState.center;return nr(e,0,0,2/(r*i[0]),2/(r*i[1]),-n,-s[0],-s[1]),e}setUniformFloatValue(t,e){this.gl_.uniform1f(this.getUniformLocation(t),e)}setUniformFloatVec2(t,e){this.gl_.uniform2fv(this.getUniformLocation(t),e)}setUniformFloatVec4(t,e){this.gl_.uniform4fv(this.getUniformLocation(t),e)}setUniformMatrixValue(t,e){this.gl_.uniformMatrix4fv(this.getUniformLocation(t),!1,e)}disableAllAttributes_(){for(let t=0;tthis.size_[0]||e>=this.size_[1])return Hp[0]=0,Hp[1]=0,Hp[2]=0,Hp[3]=0,Hp;this.readAll();const i=Math.floor(t)+(this.size_[1]-Math.floor(e)-1)*this.size_[0];return Hp[0]=this.data_[4*i],Hp[1]=this.data_[4*i+1],Hp[2]=this.data_[4*i+2],Hp[3]=this.data_[4*i+3],Hp}getTexture(){return this.texture_}getFramebuffer(){return this.framebuffer_}getDepthbuffer(){return this.depthbuffer_}updateSize_(){const t=this.size_,e=this.helper_.getGL();this.texture_=this.helper_.createTexture(t,null,this.texture_),e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer_),e.viewport(0,0,t[0],t[1]),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this.texture_,0),e.bindRenderbuffer(e.RENDERBUFFER,this.depthbuffer_),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,t[0],t[1]),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,this.depthbuffer_),this.data_=new Uint8Array(t[0]*t[1]*4)}}class qp{constructor(){this.globalCounter_=0,this.refToFeature_=new Map,this.uidToRef_=new Map,this.freeGlobalRef_=[],this.polygonBatch={entries:{},geometriesCount:0,verticesCount:0,ringsCount:0},this.pointBatch={entries:{},geometriesCount:0},this.lineStringBatch={entries:{},geometriesCount:0,verticesCount:0}}addFeatures(t,e){for(let i=0;i0?t[i-1]:null,h=l?l[l.length-1]:0,c=a[a.length-1];a=h>0?a.map((t=>t-h)):a,this.addCoordinates_("Polygon",e.slice(h,c),a,n,r,s,o)}break}case"MultiLineString":{const t=i;for(let i=0,a=t.length;i0?t[i-1]:0;this.addCoordinates_("LineString",e.slice(a,t[i]),null,n,r,s,o)}break}case"MultiPoint":for(let t=0,i=e.length;t1)return void this.addCoordinates_("MultiPolygon",e,i,n,r,s,o)}this.polygonBatch.entries[r]||(this.polygonBatch.entries[r]=this.addRefToEntry_(r,{feature:n,flatCoordss:[],verticesCount:0,ringsCount:0,ringsVerticesCounts:[]})),a=e.length/s;const l=i.length,h=i.map(((t,e,i)=>e>0?(t-i[e-1])/s:t/s));this.polygonBatch.verticesCount+=a,this.polygonBatch.ringsCount+=l,this.polygonBatch.geometriesCount++,this.polygonBatch.entries[r].flatCoordss.push(function(t,e){if(2===e)return t;return t.filter(((t,i)=>i%e<2))}(e,s)),this.polygonBatch.entries[r].ringsVerticesCounts.push(h),this.polygonBatch.entries[r].verticesCount+=a,this.polygonBatch.entries[r].ringsCount+=l;for(let i=0,a=t.length;i0?t[i-1]:0;this.addCoordinates_("LinearRing",e.slice(a,t[i]),null,n,r,s,o)}break}case"Point":this.pointBatch.entries[r]||(this.pointBatch.entries[r]=this.addRefToEntry_(r,{feature:n,flatCoordss:[]})),this.pointBatch.geometriesCount++,this.pointBatch.entries[r].flatCoordss.push(e);break;case"LineString":case"LinearRing":this.lineStringBatch.entries[r]||(this.lineStringBatch.entries[r]=this.addRefToEntry_(r,{feature:n,flatCoordss:[],verticesCount:0})),a=e.length/s,this.lineStringBatch.verticesCount+=a,this.lineStringBatch.geometriesCount++,this.lineStringBatch.entries[r].flatCoordss.push(function(t,e,i){if(3===e&&"XYM"===i)return t;if(4===e)return t.filter(((t,i)=>i%e!=2));if(3===e)return t.map(((t,i)=>i%e!=2?t:0));return new Array(1.5*t.length).fill(0).map(((e,i)=>i%3==2?0:t[Math.round(i/1.5)]))}(e,s,o)),this.lineStringBatch.entries[r].verticesCount+=a}}addRefToEntry_(t,e){const i=this.uidToRef_.get(t),n=i||this.freeGlobalRef_.pop()||++this.globalCounter_;return e.ref=n,i||(this.refToFeature_.set(n,e.feature),this.uidToRef_.set(t,n)),e}removeRef_(t,e){if(!t)throw new Error("This feature has no ref: "+e);this.refToFeature_.delete(t),this.uidToRef_.delete(e),this.freeGlobalRef_.push(t)}changeFeature(t,e){if(!this.uidToRef_.get(z(t)))return;this.removeFeature(t);let i=t.getGeometry();i&&(e&&(i=i.clone(),i.applyTransform(e)),this.addGeometry_(i,t))}removeFeature(t){let e=this.clearFeatureEntryInPointBatch_(t);e=this.clearFeatureEntryInPolygonBatch_(t)||e,e=this.clearFeatureEntryInLineStringBatch_(t)||e,e&&this.removeRef_(e.ref,z(e.feature))}clear(){this.polygonBatch.entries={},this.polygonBatch.geometriesCount=0,this.polygonBatch.verticesCount=0,this.polygonBatch.ringsCount=0,this.lineStringBatch.entries={},this.lineStringBatch.geometriesCount=0,this.lineStringBatch.verticesCount=0,this.pointBatch.entries={},this.pointBatch.geometriesCount=0,this.globalCounter_=0,this.freeGlobalRef_=[],this.refToFeature_.clear(),this.uidToRef_.clear()}getFeatureFromRef(t){return this.refToFeature_.get(t)}isEmpty(){return 0===this.globalCounter_}filter(t){const e=new qp;e.globalCounter_=this.globalCounter_,e.uidToRef_=this.uidToRef_,e.refToFeature_=this.refToFeature_;let i=!0;for(const n of this.refToFeature_.values())t(n)&&(e.addFeature(n),i=!1);return i?new qp:e}}class Jp extends Fp{constructor(t,e){super(t),this.batch_=new qp,this.styleRenderer_=e,this.buffers=null,this.maskVertices=new Mp(Kf,Jf),this.setTile(t.tile)}generateMaskBuffer_(){const t=this.tile.getSourceTiles()[0].extent;this.maskVertices.fromArray([t[0],t[1],t[2],t[1],t[2],t[3],t[0],t[3]]),this.helper.flushBufferData(this.maskVertices)}uploadTile(){this.generateMaskBuffer_(),this.batch_.clear();const t=this.tile.getSourceTiles(),e=t.reduce(((t,e)=>t.concat(e.getFeatures())),[]);this.batch_.addFeatures(e);const i=ir([1,0,0,1,0,0],-t[0].extent[0],-t[0].extent[1]);this.styleRenderer_.generateBuffers(this.batch_,i).then((t=>{this.buffers=t,this.setReady()}))}disposeInternal(){if(this.buffers){const t=t=>{for(const e of t)e&&this.helper.deleteBuffer(e)};this.buffers.pointBuffers&&t(this.buffers.pointBuffers),this.buffers.lineStringBuffers&&t(this.buffers.lineStringBuffers),this.buffers.polygonBuffers&&t(this.buffers.polygonBuffers)}super.disposeInternal()}}function Qp(t,e,i){const n=i?t.LINEAR:t.NEAREST;t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,n)}function t_(t,e,i,n,r,s){const o=t.getGL();let a,l;if(i instanceof Float32Array){a=o.FLOAT,t.getExtension("OES_texture_float");l=null!==t.getExtension("OES_texture_float_linear")}else a=o.UNSIGNED_BYTE,l=!0;Qp(o,e,s&&l);const h=i.byteLength/n[1];let c,u=1;switch(h%8==0?u=8:h%4==0?u=4:h%2==0&&(u=2),r){case 1:c=o.LUMINANCE;break;case 2:c=o.LUMINANCE_ALPHA;break;case 3:c=o.RGB;break;case 4:c=o.RGBA;break;default:throw new Error(`Unsupported number of bands: ${r}`)}const d=o.getParameter(o.UNPACK_ALIGNMENT);o.pixelStorei(o.UNPACK_ALIGNMENT,u),o.texImage2D(o.TEXTURE_2D,0,c,n[0],n[1],0,c,a,i),o.pixelStorei(o.UNPACK_ALIGNMENT,d)}let e_=null;class i_ extends Fp{constructor(t){super(t),this.textures=[],this.renderSize_=Wl(t.grid.getTileSize(t.tile.tileCoord[0])),this.bandCount=NaN;const e=new Mp(Kf,Jf);e.fromArray([0,1,1,1,1,0,0,0]),this.helper.flushBufferData(e),this.coords=e,this.setTile(t.tile)}setHelper(t){const e=this.helper?.getGL();if(e){this.helper.deleteBuffer(this.coords);for(let t=0;t{o=Xg(o,a,l,n),1===l||e||(l=1);const h=o_(o,a,l,i,t.url,t.params),c=new Image;return c.crossOrigin=s,void 0!==t.referrerPolicy&&(c.referrerPolicy=t.referrerPolicy),r(c,h).then((t=>({image:t,extent:o,pixelRatio:l})))}}const l_=[512,512];function h_(t){const e=t.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),i=atob(e).split(""),n=i.length,r=new Array(n);for(let t=0;t{this.clearCache(),this.removeHelper()},t.addChangeListener($a,this.onMapChanged_),this.dispatchPreComposeEvent=this.dispatchPreComposeEvent.bind(this),this.dispatchPostComposeEvent=this.dispatchPostComposeEvent.bind(this)}dispatchPreComposeEvent(t,e){const i=this.getLayer();if(i.hasListener(tl)){const n=new Xc(tl,void 0,e,t);i.dispatchEvent(n)}}dispatchPostComposeEvent(t,e){const i=this.getLayer();if(i.hasListener(el)){const n=new Xc(el,void 0,e,t);i.dispatchEvent(n)}}reset(t){this.uniforms_=t.uniforms,this.helper&&this.helper.setUniforms(this.uniforms_)}removeHelper(){this.helper&&(this.helper.dispose(),delete this.helper)}prepareFrame(t){if(this.getLayer().getRenderSource()){let e,i=!0,n=-1;for(let r=0,s=t.layerStatesArray.length;r=f;--r){const i=l.getTileRangeForExtentAndZ(e,r,this.tempTileRange_),o=l.getResolution(r);for(let e=i.minX;e<=i.maxX;++e)for(let g=i.minY;g<=i.maxY;++g){if(p&&!l.tileCoordIntersectsViewport([r,e,g],_))continue;const i=Nu(r,e,g,this.tempTileCoord_),f=x_(a,i);let m,y;if(d.containsKey(f)&&(m=d.get(f),y=m.tile),!(m&&m.tile.key===a.getKey()||(y=a.getTile(r,e,g,t.pixelRatio,s.projection),y)))continue;if(__(n,y))continue;m?m.setTile(y):(m=this.createTileRepresentation({tile:y,grid:l,helper:this.helper,gutter:h}),d.set(f,m)),m_(n,m,r);const x=y.getKey();u[x]=!0,y.getState()===Y&&(t.tileQueue.isKeyQueued(x)||t.tileQueue.enqueue([y,c,l.getTileCoordCenter(i),o]))}}}beforeTilesRender(t,e){this.helper.prepareDraw(this.frameState,!e,!0)}beforeTilesMaskRender(t){return!1}renderTile(t,e,i,n,r,s,o,a,l,h,c){}renderTileMask(t,e,i,n){}drawTile_(t,e,i,n,r,s,o){if(!e.ready)return;const a=e.tile.tileCoord,l=Gu(a),h=l in s?s[l]:1,c=o.getResolution(i),u=Wl(o.getTileSize(i),this.tempSize_),d=o.getOrigin(i),g=o.getTileCoordExtent(a),f=h<1?-1:f_(i);h<1&&(t.animate=!0);const p=t.viewState,_=p.center[0],m=p.center[1],y=u[0]+2*n,x=u[1]+2*n,v=y/x,S=(_-d[0])/(u[0]*c),E=(d[1]-m)/(u[1]*c),w=p.resolution/c,T=a[1],C=a[2];Hn(this.tileTransform_),er(this.tileTransform_,2/(t.size[0]*w/y),-2/(t.size[1]*w/y)),tr(this.tileTransform_,p.rotation),er(this.tileTransform_,1,1/v),ir(this.tileTransform_,(u[0]*(T-S)-n)/y,(u[1]*(C-E)-n)/x),this.renderTile(e,this.tileTransform_,t,r,c,u,d,g,f,n,h)}renderFrame(t){this.frameState=t,this.renderComplete=!0;const e=this.helper.getGL();this.preRender(e,t);const i=t.viewState,n=this.getLayer(),r=n.getRenderSource(),s=r.getTileGridForProjection(i.projection),o=r.getGutterForProjection(i.projection),a=y_(t,t.extent),l=s.getZForResolution(i.resolution,r.zDirection),h=p_(),c=n.getPreload();if(t.nextExtent){const e=s.getZForResolution(i.nextResolution,r.zDirection),n=y_(t,t.nextExtent);this.enqueueTiles(t,n,e,h,c)}this.enqueueTiles(t,a,l,h,0),c>0&&setTimeout((()=>{this.enqueueTiles(t,a,l-1,h,c-1)}),0);const u={};let d=!1;const g=h.representationsByZ;if(l in g){const e=z(this),i=t.time;for(const t of g[l]){const n=t.tile;if(n.getState()===J)continue;const r=n.tileCoord;if(t.ready){const t=n.getAlpha(e,i);if(1===t){n.endTransition(e);continue}d=!0;u[Gu(r)]=t}this.renderComplete=!1;if(this.findAltTiles_(s,r,l+1,h))continue;const o=s.getMinZoom();for(let t=l-1;t>=o;--t){if(this.findAltTiles_(s,r,t,h))break}}}const f=Object.keys(g).map(Number).sort(x);if(this.beforeTilesMaskRender(t))for(let t=0,e=f.length;tt.dispose())),t.clear()}afterHelperCreated(){super.afterHelperCreated(),this.tileRepresentationCache.forEach((t=>t.setHelper(this.helper)))}disposeInternal(){super.disposeInternal(),delete this.frameState}}const S_={...g_,TILE_TEXTURE_ARRAY:"u_tileTextures",TEXTURE_PIXEL_WIDTH:"u_texturePixelWidth",TEXTURE_PIXEL_HEIGHT:"u_texturePixelHeight",TEXTURE_RESOLUTION:"u_textureResolution",TEXTURE_ORIGIN_X:"u_textureOriginX",TEXTURE_ORIGIN_Y:"u_textureOriginY"},E_={TEXTURE_COORD:"a_textureCoord"},w_=[{name:E_.TEXTURE_COORD,size:2,type:Bp}];class T_ extends v_{constructor(t,e){super(t,e),this.program_,this.vertexShader_=e.vertexShader,this.fragmentShader_=e.fragmentShader,this.indices_=new Mp(qf,Jf),this.indices_.fromArray([0,1,3,1,2,3]),this.paletteTextures_=e.paletteTextures||[]}reset(t){if(super.reset(t),this.helper){const t=this.helper.getGL();for(const e of this.paletteTextures_)e.delete(t)}if(this.vertexShader_=t.vertexShader,this.fragmentShader_=t.fragmentShader,this.paletteTextures_=t.paletteTextures||[],this.helper){this.program_=this.helper.getProgram(this.fragmentShader_,this.vertexShader_);const t=this.helper.getGL();for(const e of this.paletteTextures_)e.getTexture(t)}}afterHelperCreated(){super.afterHelperCreated();const t=this.helper.getGL();for(const e of this.paletteTextures_)e.getTexture(t);this.program_=this.helper.getProgram(this.fragmentShader_,this.vertexShader_),this.helper.flushBufferData(this.indices_)}removeHelper(){if(this.helper){const t=this.helper.getGL();for(const e of this.paletteTextures_)e.delete(t)}super.removeHelper()}createTileRepresentation(t){return new i_(t)}beforeTilesRender(t,e){super.beforeTilesRender(t,e),this.helper.useProgram(this.program_,t)}renderTile(t,e,i,n,r,s,o,a,l,h,c){const u=this.helper.getGL();this.helper.bindBuffer(t.coords),this.helper.bindBuffer(this.indices_),this.helper.enableAttributes(w_);let d=0;for(;d0&&(x=a,me(x,n,x)),this.helper.setUniformFloatVec4(S_.RENDER_EXTENT,x),this.helper.setUniformFloatValue(S_.RESOLUTION,g.resolution),this.helper.setUniformFloatValue(S_.ZOOM,g.zoom),this.helper.setUniformFloatValue(S_.TEXTURE_PIXEL_WIDTH,f),this.helper.setUniformFloatValue(S_.TEXTURE_PIXEL_HEIGHT,p),this.helper.setUniformFloatValue(S_.TEXTURE_RESOLUTION,r),this.helper.setUniformFloatValue(S_.TEXTURE_ORIGIN_X,o[0]+m*s[0]*r-h*r),this.helper.setUniformFloatValue(S_.TEXTURE_ORIGIN_Y,o[1]-y*s[1]*r+h*r),this.helper.drawElements(0,this.indices_.getSize())}getData(t){if(!this.helper.getGL())return null;const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=Qn(e.pixelToCoordinateTransform,t.slice()),r=e.viewState,s=i.getExtent();if(s&&!$t(zn(s,r.projection),n))return null;const o=i.getSources(Bt([n]),r.resolution);let a,l,h;for(a=o.length-1;a>=0;--a)if(l=o[a],"ready"===l.getState()){if(h=l.getTileGridForProjection(r.projection),l.getWrapX())break;const t=h.getExtent();if(!t||$t(t,n))break}if(a<0)return null;const c=this.tileRepresentationCache;for(let t=h.getZForResolution(r.resolution);t>=h.getMinZoom();--t){const e=h.getTileCoordForCoordAndZ(n,t),i=x_(l,e);if(!c.containsKey(i))continue;const r=c.get(i);if(r.tile.getState()===J)return null;if(!r.loaded)continue;const s=h.getOrigin(t),o=Wl(h.getTileSize(t)),a=h.getResolution(t),u=(n[0]-s[0])/a-e[1]*o[0],d=(s[1]-n[1])/a-e[2]*o[1];return r.getPixelData(u,d)}return null}disposeInternal(){const t=this.helper;if(t){const e=t.getGL();for(const t of this.paletteTextures_)t.delete(e);this.paletteTextures_.length=0,e.deleteProgram(this.program_),delete this.program_,t.deleteBuffer(this.indices_)}super.disposeInternal(),delete this.indices_}}const C_={TEXTURE:"u_texture",VELOCITY_TEXTURE:"u_velocityTexture",POSITION_TEXTURE:"u_positionTexture",PARTICLE_COUNT_SQRT:"u_particleCountSqrt",MAX_SPEED:"u_maxSpeed",RANDOM_SEED:"u_randomSeed",SPEED_FACTOR:"u_speedFactor",DROP_RATE:"u_dropRate",DROP_RATE_BUMP:"u_dropRateBump",OPACITY:"u_opacity",ROTATION:kp.ROTATION,VIEWPORT_SIZE_PX:kp.VIEWPORT_SIZE_PX},b_="a_position",R_="a_index",P_="v_position";class I_ extends T_{constructor(t,e){super(t,{vertexShader:e.tileVertexShader,fragmentShader:e.tileFragmentShader,cacheSize:e.cacheSize,postProcesses:[{}],uniforms:{[C_.MAX_SPEED]:e.maxSpeed}}),this.particleColorFragmentShader_=e.particleColorFragmentShader,this.velocityTexture_=null,this.particleCountSqrt_=e.particles?Math.ceil(Math.sqrt(e.particles)):256,this.particleIndexBuffer_,this.quadBuffer_,this.particlePositionProgram_,this.particlePositionVertexShader_=e.particlePositionVertexShader,this.particlePositionFragmentShader_=e.particlePositionFragmentShader,this.previousPositionTexture_,this.nextPositionTexture_,this.particleColorProgram_,this.particleColorVertexShader_=e.particleColorVertexShader,this.particleColorFragmentShader_=e.particleColorFragmentShader,this.textureProgram_,this.textureVertexShader_=e.textureVertexShader,this.textureFragmentShader_=e.textureFragmentShader,this.previousTrailsTexture_,this.nextTrailsTexture_,this.fadeOpacity_=.996,this.maxSpeed_=e.maxSpeed,this.speedFactor_=e.speedFactor||.001,this.dropRate_=.003,this.dropRateBump_=.01,this.tempVec2_=[0,0],this.renderedWidth_=0,this.renderedHeight_=0}afterHelperCreated(){super.afterHelperCreated();const t=this.helper,e=t.getGL();this.framebuffer_=e.createFramebuffer();const i=this.particleCountSqrt_*this.particleCountSqrt_,n=new Float32Array(i);for(let t=0;t{const e=t.data;if(e.type===L_){const i=e.projectionTransform;this.verticesBuffer_.fromArrayBuffer(e.vertexAttributesBuffer),this.instanceAttributesBuffer_.fromArrayBuffer(e.instanceAttributesBuffer),this.helper.flushBufferData(this.verticesBuffer_),this.helper.flushBufferData(this.instanceAttributesBuffer_),this.indicesBuffer_.fromArrayBuffer(e.indicesBuffer),this.helper.flushBufferData(this.indicesBuffer_),this.renderTransform_=i,rr(this.invertRenderTransform_,this.renderTransform_),this.renderInstructions_=new Float32Array(t.data.renderInstructions),e.id===this.lastSentId&&(this.ready=!0),this.getLayer().changed()}})),this.featureCache_={},this.featureCount_=0;const s=this.getLayer().getSource();this.sourceListenKeys_=[D(s,Xd,this.handleSourceFeatureAdded_,this),D(s,Vd,this.handleSourceFeatureChanged_,this),D(s,Wd,this.handleSourceFeatureDelete_,this),D(s,$d,this.handleSourceFeatureClear_,this)],s.forEachFeature((t=>{const e=t.getGeometry();e&&"Point"===e.getType()&&(this.featureCache_[z(t)]={feature:t,properties:t.getProperties(),flatCoordinates:e.getFlatCoordinates()},this.featureCount_++)}))}afterHelperCreated(){this.program_=this.helper.getProgram(this.fragmentShader_,this.vertexShader_),this.hitDetectionEnabled_&&(this.hitRenderTarget_=new Kp(this.helper)),this.verticesBuffer_.getArray()&&this.helper.flushBufferData(this.verticesBuffer_),this.indicesBuffer_.getArray()&&this.helper.flushBufferData(this.indicesBuffer_)}handleSourceFeatureAdded_(t){const e=t.feature,i=e.getGeometry();i&&"Point"===i.getType()&&(this.featureCache_[z(e)]={feature:e,properties:e.getProperties(),flatCoordinates:i.getFlatCoordinates()},this.featureCount_++)}handleSourceFeatureChanged_(t){const e=t.feature,i=z(e),n=this.featureCache_[i],r=e.getGeometry();n?r&&"Point"===r.getType()?(n.properties=e.getProperties(),n.flatCoordinates=r.getFlatCoordinates()):(delete this.featureCache_[i],this.featureCount_--):r&&"Point"===r.getType()&&(this.featureCache_[i]={feature:e,properties:e.getProperties(),flatCoordinates:r.getFlatCoordinates()},this.featureCount_++)}handleSourceFeatureDelete_(t){const e=z(t.feature);e in this.featureCache_&&(delete this.featureCache_[e],this.featureCount_--)}handleSourceFeatureClear_(){this.featureCache_={},this.featureCount_=0}renderFrame(t){const e=this.helper.getGL();this.preRender(e,t);const[i,n,r]=N_(t,this.getLayer());this.renderWorlds(t,!1,i,n,r),this.helper.finalizeDraw(t,this.dispatchPreComposeEvent,this.dispatchPostComposeEvent),this.hitDetectionEnabled_&&(this.renderWorlds(t,!0,i,n,r),this.hitRenderTarget_.clearCachedData()),this.postRender(e,t);return this.helper.getCanvas()}prepareFrameInternal(t){const e=this.getLayer(),i=e.getSource(),n=t.viewState,r=!t.viewHints[co]&&!t.viewHints[uo],s=!te(this.previousExtent_,t.extent),o=this.sourceRevision_t+(e.size||1)),0),a=this.instanceAttributesBuffer_.getSize()/o;do{this.helper.bindBuffer(this.indicesBuffer_),this.helper.bindBuffer(this.verticesBuffer_),this.helper.enableAttributes(this.attributes),this.helper.bindBuffer(this.instanceAttributesBuffer_),this.helper.enableAttributesInstanced(this.instanceAttributes),this.helper.makeProjectionTransform(t,this.currentTransform_),ir(this.currentTransform_,s*r,0),Kn(this.currentTransform_,this.invertRenderTransform_),this.helper.applyUniforms(t),this.helper.applyHitDetectionUniform(e);const i=this.indicesBuffer_.getSize();this.helper.drawElementsInstanced(0,i,a)}while(++s4)throw new Error("`formatArray` can only output `vec2`, `vec3` or `vec4` arrays.");return`vec${t.length}(${t.map(G_).join(", ")})`}function U_(t){const e=zl(t),i=e.length>3?e[3]:1;return j_([e[0]/255,e[1]/255,e[2]/255,i])}function B_(t){return j_(Wl(t))}const z_={};let X_=0;function V_(t){return t in z_||(z_[t]=X_++),z_[t]}function $_(t){return G_(V_(t))}function W_(t){return"u_var_"+t}function Z_(){return{variables:{},properties:{},functions:{},bandCount:0,featureId:!1,geometryType:!1}}const Y_="getBandValue",H_="u_paletteTextures",K_="featureId",q_="geometryType",J_=-9999999;function Q_(t,e,i,n){return im(hh(t,e,i),e,n)}function tm(t){return(e,i,n)=>{const r=i.args.length,s=new Array(r);for(let t=0;t{const i=e.args[0].value;i in t.properties||(t.properties[i]={name:i,type:e.type});let n="a_prop_"+i;return sh(e.type,Yl)&&(n=`(${n} > 0.0)`),n},[ch.Id]:t=>(t.featureId=!0,"a_"+K_),[ch.GeometryType]:t=>(t.geometryType=!0,"a_"+q_),[ch.LineMetric]:()=>"currentLineMetric",[ch.Var]:(t,e)=>{const i=e.args[0].value;i in t.variables||(t.variables[i]={name:i,type:e.type});let n=W_(i);return sh(e.type,Yl)&&(n=`(${n} > 0.0)`),n},[ch.Has]:(t,e)=>{const i=e.args[0].value;return i in t.properties||(t.properties[i]={name:i,type:e.type}),`(a_prop_${i} != ${G_(J_)})`},[ch.Resolution]:()=>"u_resolution",[ch.Zoom]:()=>"u_zoom",[ch.Time]:()=>"u_time",[ch.Any]:tm((t=>`(${t.join(" || ")})`)),[ch.All]:tm((t=>`(${t.join(" && ")})`)),[ch.Not]:tm((([t])=>`(!${t})`)),[ch.Equal]:tm((([t,e])=>`(${t} == ${e})`)),[ch.NotEqual]:tm((([t,e])=>`(${t} != ${e})`)),[ch.GreaterThan]:tm((([t,e])=>`(${t} > ${e})`)),[ch.GreaterThanOrEqualTo]:tm((([t,e])=>`(${t} >= ${e})`)),[ch.LessThan]:tm((([t,e])=>`(${t} < ${e})`)),[ch.LessThanOrEqualTo]:tm((([t,e])=>`(${t} <= ${e})`)),[ch.Multiply]:tm((t=>`(${t.join(" * ")})`)),[ch.Divide]:tm((([t,e])=>`(${t} / ${e})`)),[ch.Add]:tm((t=>`(${t.join(" + ")})`)),[ch.Subtract]:tm((([t,e])=>`(${t} - ${e})`)),[ch.Clamp]:tm((([t,e,i])=>`clamp(${t}, ${e}, ${i})`)),[ch.Mod]:tm((([t,e])=>`mod(${t}, ${e})`)),[ch.Pow]:tm((([t,e])=>`pow(${t}, ${e})`)),[ch.Abs]:tm((([t])=>`abs(${t})`)),[ch.Floor]:tm((([t])=>`floor(${t})`)),[ch.Ceil]:tm((([t])=>`ceil(${t})`)),[ch.Round]:tm((([t])=>`floor(${t} + 0.5)`)),[ch.Sin]:tm((([t])=>`sin(${t})`)),[ch.Cos]:tm((([t])=>`cos(${t})`)),[ch.Atan]:tm((([t,e])=>void 0!==e?`atan(${t}, ${e})`:`atan(${t})`)),[ch.Sqrt]:tm((([t])=>`sqrt(${t})`)),[ch.Match]:tm((t=>{const e=t[0],i=t[t.length-1];let n=null;for(let r=t.length-3;r>=1;r-=2){n=`(${e} == ${t[r]} ? ${t[r+1]} : ${n||i})`}return n})),[ch.Between]:tm((([t,e,i])=>`(${t} >= ${e} && ${t} <= ${i})`)),[ch.Interpolate]:tm((([t,e,...i])=>{let n="";for(let r=0;r{const e=t[t.length-1];let i=null;for(let n=t.length-3;n>=0;n-=2){i=`(${t[n]} ? ${t[n+1]} : ${i||e})`}return i})),[ch.In]:tm((([t,...e],i)=>{const n=function(t,e){return`operator_${t}_${Object.keys(e.functions).length}`}("in",i),r=[];for(let t=0;t`vec${t.length}(${t.join(", ")})`)),[ch.Color]:tm((t=>{if(1===t.length)return`vec4(vec3(${t[0]} / 255.0), 1.0)`;if(2===t.length)return`vec4(vec3(${t[0]} / 255.0), ${t[1]})`;const e=t.slice(0,3).map((t=>`${t} / 255.0`));if(3===t.length)return`vec4(${e.join(", ")}, 1.0)`;const i=t[3];return`vec4(${e.join(", ")}, ${i})`})),[ch.Band]:tm((([t,e,i],n)=>{if(!(Y_ in n.functions)){let t="";const e=n.bandCount||1;for(let i=0;i{const[i,...n]=e.args,r=n.length,s=new Uint8Array(4*r);for(let t=0;t0)return G_(t.value);if((t.type&Yl)>0)return t.value.toString();if((t.type&Kl)>0)return $_(t.value.toString());if((t.type&ql)>0)return U_(t.value);if((t.type&Jl)>0)return j_(t.value);if((t.type&Ql)>0)return B_(t.value);throw new Error(`Unexpected expression ${t.value} (expected type ${nh(e)})`)}function nm(t,e,i,n){let r=0;for(const s in e){const o=e[s],a=o.callback.call(i,i.feature);let l=a?.[0]??a;l===J_&&console.warn('The "has" operator might return false positives.'),void 0===l?l=J_:null===l&&(l=0),t[n+r++]=l,o.size&&1!==o.size&&(t[n+r++]=a[1],o.size<3||(t[n+r++]=a[2],o.size<4||(t[n+r++]=a[3])))}return r}function rm(t){return Object.keys(t).reduce(((e,i)=>e+(t[i].size||1)),0)}function sm(t,e,i,n){const r=(2+rm(i))*t.geometriesCount;e&&e.length===r||(e=new Float32Array(r));const s=[];let o=0;for(const r in t.entries){const a=t.entries[r];for(let t=0,r=a.flatCoordss.length;t80*i){a=t[0],l=t[1];let e=a,n=l;for(let s=i;se&&(e=i),r>n&&(n=r)}h=Math.max(e-a,n-l),h=0!==h?32767/h:0}return um(s,o,i,a,l,h,0),o}function hm(t,e,i,n,r){let s;if(r===function(t,e,i,n){let r=0;for(let s=e,o=i-n;s0)for(let r=e;r=e;r-=n)s=Lm(r/n|0,t[r],t[r+1],s);return s&&Cm(s,s.next)&&(Mm(s),s=s.next),s}function cm(t,e){if(!t)return t;e||(e=t);let i,n=t;do{if(i=!1,n.steiner||!Cm(n,n.next)&&0!==Tm(n.prev,n,n.next))n=n.next;else{if(Mm(n),n=e=n.prev,n===n.next)break;i=!0}}while(i||n!==e);return e}function um(t,e,i,n,r,s,o){if(!t)return;!o&&s&&function(t,e,i,n){let r=t;do{0===r.z&&(r.z=xm(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,i=1;do{let n,r=t;t=null;let s=null;for(e=0;r;){e++;let o=r,a=0;for(let t=0;t0||l>0&&o;)0!==a&&(0===l||!o||r.z<=o.z)?(n=r,r=r.nextZ,a--):(n=o,o=o.nextZ,l--),s?s.nextZ=n:t=n,n.prevZ=s,s=n;r=o}s.nextZ=null,i*=2}while(e>1)}(r)}(t,n,r,s);let a=t;for(;t.prev!==t.next;){const l=t.prev,h=t.next;if(s?gm(t,n,r,s):dm(t))e.push(l.i,t.i,h.i),Mm(t),t=h.next,a=h.next;else if((t=h)===a){o?1===o?um(t=fm(cm(t),e),e,i,n,r,s,2):2===o&&pm(t,e,i,n,r,s):um(cm(t),e,i,n,r,s,1);break}}}function dm(t){const e=t.prev,i=t,n=t.next;if(Tm(e,i,n)>=0)return!1;const r=e.x,s=i.x,o=n.x,a=e.y,l=i.y,h=n.y,c=Math.min(r,s,o),u=Math.min(a,l,h),d=Math.max(r,s,o),g=Math.max(a,l,h);let f=n.next;for(;f!==e;){if(f.x>=c&&f.x<=d&&f.y>=u&&f.y<=g&&Em(r,a,s,l,o,h,f.x,f.y)&&Tm(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function gm(t,e,i,n){const r=t.prev,s=t,o=t.next;if(Tm(r,s,o)>=0)return!1;const a=r.x,l=s.x,h=o.x,c=r.y,u=s.y,d=o.y,g=Math.min(a,l,h),f=Math.min(c,u,d),p=Math.max(a,l,h),_=Math.max(c,u,d),m=xm(g,f,e,i,n),y=xm(p,_,e,i,n);let x=t.prevZ,v=t.nextZ;for(;x&&x.z>=m&&v&&v.z<=y;){if(x.x>=g&&x.x<=p&&x.y>=f&&x.y<=_&&x!==r&&x!==o&&Em(a,c,l,u,h,d,x.x,x.y)&&Tm(x.prev,x,x.next)>=0)return!1;if(x=x.prevZ,v.x>=g&&v.x<=p&&v.y>=f&&v.y<=_&&v!==r&&v!==o&&Em(a,c,l,u,h,d,v.x,v.y)&&Tm(v.prev,v,v.next)>=0)return!1;v=v.nextZ}for(;x&&x.z>=m;){if(x.x>=g&&x.x<=p&&x.y>=f&&x.y<=_&&x!==r&&x!==o&&Em(a,c,l,u,h,d,x.x,x.y)&&Tm(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;v&&v.z<=y;){if(v.x>=g&&v.x<=p&&v.y>=f&&v.y<=_&&v!==r&&v!==o&&Em(a,c,l,u,h,d,v.x,v.y)&&Tm(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function fm(t,e){let i=t;do{const n=i.prev,r=i.next.next;!Cm(n,r)&&bm(n,i,i.next,r)&&Im(n,r)&&Im(r,n)&&(e.push(n.i,i.i,r.i),Mm(i),Mm(i.next),i=t=r),i=i.next}while(i!==t);return cm(i)}function pm(t,e,i,n,r,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){if(o.i!==t.i&&wm(o,t)){let a=Fm(o,t);return o=cm(o,o.next),a=cm(a,a.next),um(o,e,i,n,r,s,0),void um(a,e,i,n,r,s,0)}t=t.next}o=o.next}while(o!==t)}function _m(t,e){let i=t.x-e.x;if(0===i&&(i=t.y-e.y,0===i)){i=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}return i}function mm(t,e){const i=function(t,e){let i=e;const n=t.x,r=t.y;let s,o=-1/0;if(Cm(t,i))return i;do{if(Cm(t,i.next))return i.next;if(r<=i.y&&r>=i.next.y&&i.next.y!==i.y){const t=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=n&&t>o&&(o=t,s=i.x=i.x&&i.x>=l&&n!==i.x&&Sm(rs.x||i.x===s.x&&ym(s,i)))&&(s=i,c=e)}i=i.next}while(i!==a);return s}(t,e);if(!i)return e;const n=Fm(i,t);return cm(n,n.next),cm(i,i.next)}function ym(t,e){return Tm(t.prev,t,e.prev)<0&&Tm(e.next,t,t.next)<0}function xm(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function vm(t){let e=t,i=t;do{(e.x=(t-o)*(s-a)&&(t-o)*(n-a)>=(i-o)*(e-a)&&(i-o)*(s-a)>=(r-o)*(n-a)}function Em(t,e,i,n,r,s,o,a){return!(t===o&&e===a)&&Sm(t,e,i,n,r,s,o,a)}function wm(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&bm(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Im(t,e)&&Im(e,t)&&function(t,e){let i=t,n=!1;const r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(Tm(t.prev,t,e.prev)||Tm(t,e.prev,e))||Cm(t,e)&&Tm(t.prev,t,t.next)>0&&Tm(e.prev,e,e.next)>0)}function Tm(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Cm(t,e){return t.x===e.x&&t.y===e.y}function bm(t,e,i,n){const r=Pm(Tm(t,e,i)),s=Pm(Tm(t,e,n)),o=Pm(Tm(i,n,t)),a=Pm(Tm(i,n,e));return r!==s&&o!==a||(!(0!==r||!Rm(t,i,e))||(!(0!==s||!Rm(t,n,e))||(!(0!==o||!Rm(i,t,n))||!(0!==a||!Rm(i,e,n)))))}function Rm(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Pm(t){return t>0?1:t<0?-1:0}function Im(t,e){return Tm(t.prev,t,t.next)<0?Tm(t,e,t.next)>=0&&Tm(t,t.prev,e)>=0:Tm(t,e,t.prev)<0||Tm(t,t.next,e)<0}function Fm(t,e){const i=Am(t.i,t.x,t.y),n=Am(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,s.next=n,n.prev=s,n}function Lm(t,e,i,n){const r=Am(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function Mm(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Am(t,e,i){return{i:t,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}const Om=.985,Dm=[],Nm={vertexAttributesPosition:0,instanceAttributesPosition:0,indicesPosition:0};function km(t,e,i){return Q_(e,i,lh(),t)}function Gm(t){const e=zl(t);return[256*e[0]+e[1],256*e[2]+Math.round(255*e[3])]}const jm="vec4 unpackColor(vec2 packedColor) {\n return vec4(\n min(floor(packedColor[0] / 256.0) / 255.0, 1.0),\n min(mod(packedColor[0], 256.0) / 255.0, 1.0),\n min(floor(packedColor[1] / 256.0) / 255.0, 1.0),\n min(mod(packedColor[1], 256.0) / 255.0, 1.0)\n );\n}";function Um(t){return t===ql||t===Ql?2:t===Jl?4:1}function Bm(t){const e=Um(t);return e>1?`vec${e}`:"float"}function zm(t,e){for(const i in e.variables){const n=e.variables[i],r=W_(n.name);let s=Bm(n.type);n.type===ql&&(s="vec4"),t.addUniform(r,s)}for(const i in e.properties){const n=e.properties[i],r=Bm(n.type),s=`a_prop_${n.name}`;n.type===ql?t.addAttribute(s,r,`unpackColor(${s})`,"vec4"):t.addAttribute(s,r)}for(const i in e.functions)t.addVertexShaderFunction(e.functions[i]),t.addFragmentShaderFunction(e.functions[i])}function Xm(t,e){const i={};for(const n in t.variables){const r=t.variables[n];i[W_(r.name)]=()=>{const t=e[r.name];if("number"==typeof t)return t;if("boolean"==typeof t)return t?1:0;if(r.type===ql){const e=[...zl(t||"#eee")];return e[0]/=255,e[1]/=255,e[2]/=255,e[3]??=1,e}return"string"==typeof t?V_(t):t}}return i}function Vm(t){const e={};for(const i in t.properties){const n=t.properties[i],r=t=>{const e=t.get(n.name);return n.type===ql?Gm([...zl(e||"#eee")]):"string"==typeof e?V_(e):"boolean"==typeof e?e?1:0:e};e[`prop_${n.name}`]={size:Um(n.type),callback:r}}return e}const $m=`#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_screenToWorldMatrix;\nuniform vec2 u_viewportSizePx;\nuniform float u_pixelRatio;\nuniform float u_globalAlpha;\nuniform float u_time;\nuniform float u_zoom;\nuniform float u_resolution;\nuniform float u_rotation;\nuniform vec4 u_renderExtent;\nuniform vec2 u_patternOrigin;\nuniform float u_depth;\nuniform mediump int u_hitDetection;\n\nconst float PI = 3.141592653589793238;\nconst float TWO_PI = 2.0 * PI;\nfloat currentLineMetric = 0.; // an actual value will be used in the stroke shaders\n\n${jm}\n`,Wm={"fill-color":"rgba(255,255,255,0.4)","stroke-color":"#3399CC","stroke-width":1.25,"circle-radius":5,"circle-fill-color":"rgba(255,255,255,0.4)","circle-stroke-width":1.25,"circle-stroke-color":"#3399CC"};class Zm{constructor(){this.uniforms_=[],this.attributes_=[],this.hasSymbol_=!1,this.symbolSizeExpression_=`vec2(${G_(Wm["circle-radius"])} + ${G_(.5*Wm["circle-stroke-width"])})`,this.symbolRotationExpression_="0.0",this.symbolOffsetExpression_="vec2(0.0)",this.symbolColorExpression_=U_(Wm["circle-fill-color"]),this.texCoordExpression_="vec4(0.0, 0.0, 1.0, 1.0)",this.discardExpression_="false",this.symbolRotateWithView_=!1,this.hasStroke_=!1,this.strokeWidthExpression_=G_(Wm["stroke-width"]),this.strokeColorExpression_=U_(Wm["stroke-color"]),this.strokeOffsetExpression_="0.",this.strokeCapExpression_=$_("round"),this.strokeJoinExpression_=$_("round"),this.strokeMiterLimitExpression_="10.",this.strokeDistanceFieldExpression_="-1000.",this.strokePatternLengthExpression_=null,this.hasFill_=!1,this.fillColorExpression_=U_(Wm["fill-color"]),this.vertexShaderFunctions_=[],this.fragmentShaderFunctions_=[]}addUniform(t,e){return this.uniforms_.push({name:t,type:e}),this}addAttribute(t,e,i,n){return this.attributes_.push({name:t,type:e,varyingName:t.replace(/^a_/,"v_"),varyingType:n??e,varyingExpression:i??t}),this}setSymbolSizeExpression(t){return this.hasSymbol_=!0,this.symbolSizeExpression_=t,this}getSymbolSizeExpression(){return this.symbolSizeExpression_}setSymbolRotationExpression(t){return this.symbolRotationExpression_=t,this}setSymbolOffsetExpression(t){return this.symbolOffsetExpression_=t,this}getSymbolOffsetExpression(){return this.symbolOffsetExpression_}setSymbolColorExpression(t){return this.hasSymbol_=!0,this.symbolColorExpression_=t,this}getSymbolColorExpression(){return this.symbolColorExpression_}setTextureCoordinateExpression(t){return this.texCoordExpression_=t,this}setFragmentDiscardExpression(t){return this.discardExpression_=t,this}getFragmentDiscardExpression(){return this.discardExpression_}setSymbolRotateWithView(t){return this.symbolRotateWithView_=t,this}setStrokeWidthExpression(t){return this.hasStroke_=!0,this.strokeWidthExpression_=t,this}setStrokeColorExpression(t){return this.hasStroke_=!0,this.strokeColorExpression_=t,this}getStrokeColorExpression(){return this.strokeColorExpression_}setStrokeOffsetExpression(t){return this.strokeOffsetExpression_=t,this}setStrokeCapExpression(t){return this.strokeCapExpression_=t,this}setStrokeJoinExpression(t){return this.strokeJoinExpression_=t,this}setStrokeMiterLimitExpression(t){return this.strokeMiterLimitExpression_=t,this}setStrokeDistanceFieldExpression(t){return this.strokeDistanceFieldExpression_=t,this}setStrokePatternLengthExpression(t){return this.strokePatternLengthExpression_=t,this}getStrokePatternLengthExpression(){return this.strokePatternLengthExpression_}setFillColorExpression(t){return this.hasFill_=!0,this.fillColorExpression_=t,this}getFillColorExpression(){return this.fillColorExpression_}addVertexShaderFunction(t){return this.vertexShaderFunctions_.includes(t)||this.vertexShaderFunctions_.push(t),this}addFragmentShaderFunction(t){return this.fragmentShaderFunctions_.includes(t)||this.fragmentShaderFunctions_.push(t),this}getSymbolVertexShader(){return this.hasSymbol_?`${$m}\n${this.uniforms_.map((t=>`uniform ${t.type} ${t.name};`)).join("\n")}\nattribute vec2 a_position;\nattribute vec2 a_localPosition;\nattribute vec2 a_hitColor;\n\nvarying vec2 v_texCoord;\nvarying vec2 v_quadCoord;\nvarying vec4 v_hitColor;\nvarying vec2 v_centerPx;\nvarying float v_angle;\nvarying vec2 v_quadSizePx;\n\n${this.attributes_.map((t=>`attribute ${t.type} ${t.name};\nvarying ${t.varyingType} ${t.varyingName};`)).join("\n")}\n${this.vertexShaderFunctions_.join("\n")}\nvec2 pxToScreen(vec2 coordPx) {\n vec2 scaled = coordPx / u_viewportSizePx / 0.5;\n return scaled;\n}\n\nvec2 screenToPx(vec2 coordScreen) {\n return (coordScreen * 0.5 + 0.5) * u_viewportSizePx;\n}\n\nvoid main(void) {\n v_quadSizePx = ${this.symbolSizeExpression_};\n vec2 halfSizePx = v_quadSizePx * 0.5;\n vec2 centerOffsetPx = ${this.symbolOffsetExpression_};\n vec2 offsetPx = centerOffsetPx + a_localPosition * halfSizePx * vec2(1., -1.);\n float angle = ${this.symbolRotationExpression_}${this.symbolRotateWithView_?" + u_rotation":""};\n float c = cos(-angle);\n float s = sin(-angle);\n offsetPx = vec2(c * offsetPx.x - s * offsetPx.y, s * offsetPx.x + c * offsetPx.y);\n vec4 center = u_projectionMatrix * vec4(a_position, 0.0, 1.0);\n gl_Position = center + vec4(pxToScreen(offsetPx), u_depth, 0.);\n vec4 texCoord = ${this.texCoordExpression_};\n float u = mix(texCoord.s, texCoord.p, a_localPosition.x * 0.5 + 0.5);\n float v = mix(texCoord.t, texCoord.q, a_localPosition.y * 0.5 + 0.5);\n v_texCoord = vec2(u, v);\n v_hitColor = unpackColor(a_hitColor);\n v_angle = angle;\n c = cos(-v_angle);\n s = sin(-v_angle);\n centerOffsetPx = vec2(c * centerOffsetPx.x - s * centerOffsetPx.y, s * centerOffsetPx.x + c * centerOffsetPx.y);\n v_centerPx = screenToPx(center.xy) + centerOffsetPx;\n${this.attributes_.map((t=>` ${t.varyingName} = ${t.varyingExpression};`)).join("\n")}\n}`:null}getSymbolFragmentShader(){return this.hasSymbol_?`${$m}\n${this.uniforms_.map((t=>`uniform ${t.type} ${t.name};`)).join("\n")}\nvarying vec2 v_texCoord;\nvarying vec4 v_hitColor;\nvarying vec2 v_centerPx;\nvarying float v_angle;\nvarying vec2 v_quadSizePx;\n${this.attributes_.map((t=>`varying ${t.varyingType} ${t.varyingName};`)).join("\n")}\n${this.fragmentShaderFunctions_.join("\n")}\n\nvoid main(void) {\n${this.attributes_.map((t=>` ${t.varyingType} ${t.name} = ${t.varyingName}; // assign to original attribute name`)).join("\n")}\n if (${this.discardExpression_}) { discard; }\n vec2 coordsPx = gl_FragCoord.xy / u_pixelRatio - v_centerPx; // relative to center\n float c = cos(v_angle);\n float s = sin(v_angle);\n coordsPx = vec2(c * coordsPx.x - s * coordsPx.y, s * coordsPx.x + c * coordsPx.y);\n gl_FragColor = ${this.symbolColorExpression_};\n gl_FragColor.rgb *= gl_FragColor.a;\n if (u_hitDetection > 0) {\n if (gl_FragColor.a < 0.05) { discard; };\n gl_FragColor = v_hitColor;\n }\n}`:null}getStrokeVertexShader(){return this.hasStroke_?`${$m}\n${this.uniforms_.map((t=>`uniform ${t.type} ${t.name};`)).join("\n")}\nattribute vec2 a_segmentStart;\nattribute vec2 a_segmentEnd;\nattribute vec2 a_localPosition;\nattribute float a_measureStart;\nattribute float a_measureEnd;\nattribute float a_angleTangentSum;\nattribute float a_distanceLow;\nattribute float a_distanceHigh;\nattribute vec2 a_joinAngles;\nattribute vec2 a_hitColor;\n\nvarying vec2 v_segmentStartPx;\nvarying vec2 v_segmentEndPx;\nvarying float v_angleStart;\nvarying float v_angleEnd;\nvarying float v_width;\nvarying vec4 v_hitColor;\nvarying float v_distancePx;\nvarying float v_measureStart;\nvarying float v_measureEnd;\n\n${this.attributes_.map((t=>`attribute ${t.type} ${t.name};\nvarying ${t.varyingType} ${t.varyingName};`)).join("\n")}\n${this.vertexShaderFunctions_.join("\n")}\nvec2 worldToPx(vec2 worldPos) {\n vec4 screenPos = u_projectionMatrix * vec4(worldPos, 0.0, 1.0);\n return (0.5 * screenPos.xy + 0.5) * u_viewportSizePx;\n}\n\nvec4 pxToScreen(vec2 pxPos) {\n vec2 screenPos = 2.0 * pxPos / u_viewportSizePx - 1.0;\n return vec4(screenPos, u_depth, 1.0);\n}\n\nbool isCap(float joinAngle) {\n return joinAngle < -0.1;\n}\n\nvec2 getJoinOffsetDirection(vec2 normalPx, float joinAngle) {\n float halfAngle = joinAngle / 2.0;\n float c = cos(halfAngle);\n float s = sin(halfAngle);\n vec2 angleBisectorNormal = vec2(s * normalPx.x + c * normalPx.y, -c * normalPx.x + s * normalPx.y);\n float length = 1.0 / s;\n return angleBisectorNormal * length;\n}\n\nvec2 getOffsetPoint(vec2 point, vec2 normal, float joinAngle, float offsetPx) {\n // if on a cap or the join angle is too high, offset the line along the segment normal\n if (cos(joinAngle) > 0.998 || isCap(joinAngle)) {\n return point - normal * offsetPx;\n }\n // offset is applied along the inverted normal (positive offset goes "right" relative to line direction)\n return point - getJoinOffsetDirection(normal, joinAngle) * offsetPx;\n}\n\nvoid main(void) {\n v_angleStart = a_joinAngles.x;\n v_angleEnd = a_joinAngles.y;\n float startEndRatio = a_localPosition.x * 0.5 + 0.5;\n currentLineMetric = mix(a_measureStart, a_measureEnd, startEndRatio);\n // we're reading the fractional part while keeping the sign (so -4.12 gives -0.12, 3.45 gives 0.45)\n\n float lineWidth = ${this.strokeWidthExpression_};\n float lineOffsetPx = ${this.strokeOffsetExpression_};\n\n // compute segment start/end in px with offset\n vec2 segmentStartPx = worldToPx(a_segmentStart);\n vec2 segmentEndPx = worldToPx(a_segmentEnd);\n vec2 tangentPx = normalize(segmentEndPx - segmentStartPx);\n vec2 normalPx = vec2(-tangentPx.y, tangentPx.x);\n segmentStartPx = getOffsetPoint(segmentStartPx, normalPx, v_angleStart, lineOffsetPx),\n segmentEndPx = getOffsetPoint(segmentEndPx, normalPx, v_angleEnd, lineOffsetPx);\n\n // compute current vertex position\n float normalDir = -1. * a_localPosition.y;\n float tangentDir = -1. * a_localPosition.x;\n float angle = mix(v_angleStart, v_angleEnd, startEndRatio);\n vec2 joinDirection;\n vec2 positionPx = mix(segmentStartPx, segmentEndPx, startEndRatio);\n // if angle is too high, do not make a proper join\n if (cos(angle) > 0.985 || isCap(angle)) {\n joinDirection = normalPx * normalDir - tangentPx * tangentDir;\n } else {\n joinDirection = getJoinOffsetDirection(normalPx * normalDir, angle);\n }\n positionPx = positionPx + joinDirection * (lineWidth * 0.5 + 1.); // adding 1 pixel for antialiasing\n gl_Position = pxToScreen(positionPx);\n\n v_segmentStartPx = segmentStartPx;\n v_segmentEndPx = segmentEndPx;\n v_width = lineWidth;\n v_hitColor = unpackColor(a_hitColor);\n\n v_distancePx = a_distanceLow / u_resolution - (lineOffsetPx * a_angleTangentSum);\n float distanceHighPx = a_distanceHigh / u_resolution;\n ${null!==this.strokePatternLengthExpression_?`v_distancePx = mod(v_distancePx, ${this.strokePatternLengthExpression_});\n distanceHighPx = mod(distanceHighPx, ${this.strokePatternLengthExpression_});\n `:""}v_distancePx += distanceHighPx;\n\n v_measureStart = a_measureStart;\n v_measureEnd = a_measureEnd;\n${this.attributes_.map((t=>` ${t.varyingName} = ${t.varyingExpression};`)).join("\n")}\n}`:null}getStrokeFragmentShader(){return this.hasStroke_?`${$m}\n${this.uniforms_.map((t=>`uniform ${t.type} ${t.name};`)).join("\n")}\nvarying vec2 v_segmentStartPx;\nvarying vec2 v_segmentEndPx;\nvarying float v_angleStart;\nvarying float v_angleEnd;\nvarying float v_width;\nvarying vec4 v_hitColor;\nvarying float v_distancePx;\nvarying float v_measureStart;\nvarying float v_measureEnd;\n${this.attributes_.map((t=>`varying ${t.varyingType} ${t.varyingName};`)).join("\n")}\n${this.fragmentShaderFunctions_.join("\n")}\n\nvec2 pxToWorld(vec2 pxPos) {\n vec2 screenPos = 2.0 * pxPos / u_viewportSizePx - 1.0;\n return (u_screenToWorldMatrix * vec4(screenPos, 0.0, 1.0)).xy;\n}\n\nbool isCap(float joinAngle) {\n return joinAngle < -0.1;\n}\n\nfloat segmentDistanceField(vec2 point, vec2 start, vec2 end, float width) {\n vec2 tangent = normalize(end - start);\n vec2 normal = vec2(-tangent.y, tangent.x);\n vec2 startToPoint = point - start;\n return abs(dot(startToPoint, normal)) - width * 0.5;\n}\n\nfloat buttCapDistanceField(vec2 point, vec2 start, vec2 end) {\n vec2 startToPoint = point - start;\n vec2 tangent = normalize(end - start);\n return dot(startToPoint, -tangent);\n}\n\nfloat squareCapDistanceField(vec2 point, vec2 start, vec2 end, float width) {\n return buttCapDistanceField(point, start, end) - width * 0.5;\n}\n\nfloat roundCapDistanceField(vec2 point, vec2 start, vec2 end, float width) {\n float onSegment = max(0., 1000. * dot(point - start, end - start)); // this is very high when inside the segment\n return length(point - start) - width * 0.5 - onSegment;\n}\n\nfloat roundJoinDistanceField(vec2 point, vec2 start, vec2 end, float width) {\n return roundCapDistanceField(point, start, end, width);\n}\n\nfloat bevelJoinField(vec2 point, vec2 start, vec2 end, float width, float joinAngle) {\n vec2 startToPoint = point - start;\n vec2 tangent = normalize(end - start);\n float c = cos(joinAngle * 0.5);\n float s = sin(joinAngle * 0.5);\n float direction = -sign(sin(joinAngle));\n vec2 bisector = vec2(c * tangent.x - s * tangent.y, s * tangent.x + c * tangent.y);\n float radius = width * 0.5 * s;\n return dot(startToPoint, bisector * direction) - radius;\n}\n\nfloat miterJoinDistanceField(vec2 point, vec2 start, vec2 end, float width, float joinAngle) {\n if (cos(joinAngle) > 0.985) { // avoid risking a division by zero\n return bevelJoinField(point, start, end, width, joinAngle);\n }\n float miterLength = 1. / sin(joinAngle * 0.5);\n float miterLimit = ${this.strokeMiterLimitExpression_};\n if (miterLength > miterLimit) {\n return bevelJoinField(point, start, end, width, joinAngle);\n }\n return -1000.;\n}\n\nfloat capDistanceField(vec2 point, vec2 start, vec2 end, float width, float capType) {\n if (capType == ${$_("butt")}) {\n return buttCapDistanceField(point, start, end);\n } else if (capType == ${$_("square")}) {\n return squareCapDistanceField(point, start, end, width);\n }\n return roundCapDistanceField(point, start, end, width);\n}\n\nfloat joinDistanceField(vec2 point, vec2 start, vec2 end, float width, float joinAngle, float joinType) {\n if (joinType == ${$_("bevel")}) {\n return bevelJoinField(point, start, end, width, joinAngle);\n } else if (joinType == ${$_("miter")}) {\n return miterJoinDistanceField(point, start, end, width, joinAngle);\n }\n return roundJoinDistanceField(point, start, end, width);\n}\n\nfloat computeSegmentPointDistance(vec2 point, vec2 start, vec2 end, float width, float joinAngle, float capType, float joinType) {\n if (isCap(joinAngle)) {\n return capDistanceField(point, start, end, width, capType);\n }\n return joinDistanceField(point, start, end, width, joinAngle, joinType);\n}\n\nfloat distanceFromSegment(vec2 point, vec2 start, vec2 end) {\n vec2 tangent = end - start;\n vec2 startToPoint = point - start;\n // inspire by capsule fn in https://iquilezles.org/articles/distfunctions/\n float h = clamp(dot(startToPoint, tangent) / dot(tangent, tangent), 0.0, 1.0);\n return length(startToPoint - tangent * h);\n}\n\nvoid main(void) {\n${this.attributes_.map((t=>` ${t.varyingType} ${t.name} = ${t.varyingName}; // assign to original attribute name`)).join("\n")}\n\n vec2 currentPointPx = gl_FragCoord.xy / u_pixelRatio;\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n vec2 worldPos = pxToWorld(currentPointPx);\n if (\n abs(u_renderExtent[0] - u_renderExtent[2]) > 0.0 && (\n worldPos[0] < u_renderExtent[0] ||\n worldPos[1] < u_renderExtent[1] ||\n worldPos[0] > u_renderExtent[2] ||\n worldPos[1] > u_renderExtent[3]\n )\n ) {\n discard;\n }\n #endif\n\n float segmentLengthPx = length(v_segmentEndPx - v_segmentStartPx);\n segmentLengthPx = max(segmentLengthPx, 1.17549429e-38); // avoid divide by zero\n vec2 segmentTangent = (v_segmentEndPx - v_segmentStartPx) / segmentLengthPx;\n vec2 segmentNormal = vec2(-segmentTangent.y, segmentTangent.x);\n vec2 startToPointPx = currentPointPx - v_segmentStartPx;\n float lengthToPointPx = max(0., min(dot(segmentTangent, startToPointPx), segmentLengthPx));\n float currentLengthPx = lengthToPointPx + v_distancePx;\n float currentRadiusPx = distanceFromSegment(currentPointPx, v_segmentStartPx, v_segmentEndPx);\n float currentRadiusRatio = dot(segmentNormal, startToPointPx) * 2. / v_width;\n currentLineMetric = mix(v_measureStart, v_measureEnd, lengthToPointPx / segmentLengthPx);\n\n if (${this.discardExpression_}) { discard; }\n\n float capType = ${this.strokeCapExpression_};\n float joinType = ${this.strokeJoinExpression_};\n float segmentStartDistance = computeSegmentPointDistance(currentPointPx, v_segmentStartPx, v_segmentEndPx, v_width, v_angleStart, capType, joinType);\n float segmentEndDistance = computeSegmentPointDistance(currentPointPx, v_segmentEndPx, v_segmentStartPx, v_width, v_angleEnd, capType, joinType);\n float distanceField = max(\n segmentDistanceField(currentPointPx, v_segmentStartPx, v_segmentEndPx, v_width),\n max(segmentStartDistance, segmentEndDistance)\n );\n distanceField = max(distanceField, ${this.strokeDistanceFieldExpression_});\n\n vec4 color = ${this.strokeColorExpression_};\n color.a *= smoothstep(0.5, -0.5, distanceField);\n gl_FragColor = color;\n gl_FragColor.a *= u_globalAlpha;\n gl_FragColor.rgb *= gl_FragColor.a;\n if (u_hitDetection > 0) {\n if (gl_FragColor.a < 0.1) { discard; };\n gl_FragColor = v_hitColor;\n }\n}`:null}getFillVertexShader(){return this.hasFill_?`${$m}\n${this.uniforms_.map((t=>`uniform ${t.type} ${t.name};`)).join("\n")}\nattribute vec2 a_position;\nattribute vec2 a_hitColor;\n\nvarying vec4 v_hitColor;\n\n${this.attributes_.map((t=>`attribute ${t.type} ${t.name};\nvarying ${t.varyingType} ${t.varyingName};`)).join("\n")}\n${this.vertexShaderFunctions_.join("\n")}\nvoid main(void) {\n gl_Position = u_projectionMatrix * vec4(a_position, u_depth, 1.0);\n v_hitColor = unpackColor(a_hitColor);\n${this.attributes_.map((t=>` ${t.varyingName} = ${t.varyingExpression};`)).join("\n")}\n}`:null}getFillFragmentShader(){return this.hasFill_?`${$m}\n${this.uniforms_.map((t=>`uniform ${t.type} ${t.name};`)).join("\n")}\nvarying vec4 v_hitColor;\n${this.attributes_.map((t=>`varying ${t.varyingType} ${t.varyingName};`)).join("\n")}\n${this.fragmentShaderFunctions_.join("\n")}\nvec2 pxToWorld(vec2 pxPos) {\n vec2 screenPos = 2.0 * pxPos / u_viewportSizePx - 1.0;\n return (u_screenToWorldMatrix * vec4(screenPos, 0.0, 1.0)).xy;\n}\n\nvec2 worldToPx(vec2 worldPos) {\n vec4 screenPos = u_projectionMatrix * vec4(worldPos, 0.0, 1.0);\n return (0.5 * screenPos.xy + 0.5) * u_viewportSizePx;\n}\n\nvoid main(void) {\n${this.attributes_.map((t=>` ${t.varyingType} ${t.name} = ${t.varyingName}; // assign to original attribute name`)).join("\n")}\n vec2 pxPos = gl_FragCoord.xy / u_pixelRatio;\n vec2 pxOrigin = worldToPx(u_patternOrigin);\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n vec2 worldPos = pxToWorld(pxPos);\n if (\n abs(u_renderExtent[0] - u_renderExtent[2]) > 0.0 && (\n worldPos[0] < u_renderExtent[0] ||\n worldPos[1] < u_renderExtent[1] ||\n worldPos[0] > u_renderExtent[2] ||\n worldPos[1] > u_renderExtent[3]\n )\n ) {\n discard;\n }\n #endif\n if (${this.discardExpression_}) { discard; }\n gl_FragColor = ${this.fillColorExpression_};\n gl_FragColor.a *= u_globalAlpha;\n gl_FragColor.rgb *= gl_FragColor.a;\n if (u_hitDetection > 0) {\n if (gl_FragColor.a < 0.1) { discard; };\n gl_FragColor = v_hitColor;\n }\n}`:null}}function Ym(t){return(JSON.stringify(t).split("").reduce(((t,e)=>(t<<5)-t+e.charCodeAt(0)),0)>>>0).toString()}function Hm(t,e,i,n){if(`${n}radius`in t&&"icon-"!==n){let r=km(i,t[`${n}radius`],Hl);if(`${n}radius2`in t){r=`max(${r}, ${km(i,t[`${n}radius2`],Hl)})`}`${n}stroke-width`in t&&(r=`(${r} + ${km(i,t[`${n}stroke-width`],Hl)} * 0.5)`),e.setSymbolSizeExpression(`vec2(${r} * 2. + 0.5)`)}if(`${n}scale`in t){const r=km(i,t[`${n}scale`],Ql);e.setSymbolSizeExpression(`${e.getSymbolSizeExpression()} * ${r}`)}`${n}displacement`in t&&e.setSymbolOffsetExpression(km(i,t[`${n}displacement`],Jl)),`${n}rotation`in t&&e.setSymbolRotationExpression(km(i,t[`${n}rotation`],Hl)),`${n}rotate-with-view`in t&&e.setSymbolRotateWithView(!!t[`${n}rotate-with-view`])}function Km(t,e,i,n,r){let s="vec4(0.)";if(null!==e&&(s=e),null!==i&&null!==n){s=`mix(${i}, ${s}, ${`smoothstep(-${n} + 0.63, -${n} - 0.58, ${t})`})`}let o=`${s} * vec4(1.0, 1.0, 1.0, ${`(1.0 - smoothstep(-0.63, 0.58, ${t}))`})`;return null!==r&&(o=`${o} * vec4(1.0, 1.0, 1.0, ${r})`),o}function qm(t,e,i,n,r){const s=new Image;s.crossOrigin=void 0===t[`${n}cross-origin`]?"anonymous":t[`${n}cross-origin`],Mt("string"==typeof t[`${n}src`],`WebGL layers do not support expressions for the ${n}src style property`),s.src=t[`${n}src`],i[`u_texture${r}_size`]=()=>s.complete?[s.width,s.height]:[0,0],e.addUniform(`u_texture${r}_size`,"vec2");const o=`u_texture${r}_size`;return i[`u_texture${r}`]=s,e.addUniform(`u_texture${r}`,"sampler2D"),o}function Jm(t,e,i,n,r){let s=km(i,t[`${e}offset`],Ql);if(`${e}offset-origin`in t)switch(t[`${e}offset-origin`]){case"top-right":s=`vec2(${n}.x, 0.) + ${r} * vec2(-1., 0.) + ${s} * vec2(-1., 1.)`;break;case"bottom-left":s=`vec2(0., ${n}.y) + ${r} * vec2(0., -1.) + ${s} * vec2(1., -1.)`;break;case"bottom-right":s=`${n} - ${r} - ${s}`}return s}function Qm(t,e,i){const n={variables:{},properties:{},functions:{},bandCount:0,featureId:!1,geometryType:!1},r=new Zm,s={};if("icon-src"in t?function(t,e,i,n){let r="vec4(1.0)";"icon-color"in t&&(r=km(n,t["icon-color"],ql)),"icon-opacity"in t&&(r=`${r} * vec4(1.0, 1.0, 1.0, ${km(n,t["icon-opacity"],Hl)})`);const s=Ym(t["icon-src"]),o=qm(t,e,i,"icon-",s);if(e.setSymbolColorExpression(`${r} * texture2D(u_texture${s}, v_texCoord)`).setSymbolSizeExpression(o),"icon-width"in t&&"icon-height"in t&&e.setSymbolSizeExpression(`vec2(${km(n,t["icon-width"],Hl)}, ${km(n,t["icon-height"],Hl)})`),"icon-offset"in t&&"icon-size"in t){const i=km(n,t["icon-size"],Jl),r=e.getSymbolSizeExpression();e.setSymbolSizeExpression(i);const s=Jm(t,"icon-",n,"v_quadSizePx",i);e.setTextureCoordinateExpression(`(vec4((${s}).xyxy) + vec4(0., 0., ${i})) / (${r}).xyxy`)}if(Hm(t,e,n,"icon-"),"icon-anchor"in t){const i=km(n,t["icon-anchor"],Jl);let r,s="1.0";"icon-scale"in t&&(s=km(n,t["icon-scale"],Ql)),r="pixels"===t["icon-anchor-x-units"]&&"pixels"===t["icon-anchor-y-units"]?`${i} * ${s}`:"pixels"===t["icon-anchor-x-units"]?`${i} * vec2(vec2(${s}).x, v_quadSizePx.y)`:"pixels"===t["icon-anchor-y-units"]?`${i} * vec2(v_quadSizePx.x, vec2(${s}).x)`:`${i} * v_quadSizePx`;let o=`v_quadSizePx * vec2(0.5, -0.5) + ${r} * vec2(-1., 1.)`;if("icon-anchor-origin"in t)switch(t["icon-anchor-origin"]){case"top-right":o=`v_quadSizePx * -0.5 + ${r}`;break;case"bottom-left":o=`v_quadSizePx * 0.5 - ${r}`;break;case"bottom-right":o=`v_quadSizePx * vec2(-0.5, 0.5) + ${r} * vec2(1., -1.)`}e.setSymbolOffsetExpression(`${e.getSymbolOffsetExpression()} + ${o}`)}}(t,r,s,n):"shape-points"in t?function(t,e,i,n){n.functions.round="float round(float v) {\n return sign(v) * floor(abs(v) + 0.5);\n}",n.functions.starDistanceField="float starDistanceField(vec2 point, float numPoints, float radius, float radius2, float angle) {\n float startAngle = -PI * 0.5 + angle; // tip starts upwards and rotates clockwise with angle\n float c = cos(startAngle);\n float s = sin(startAngle);\n vec2 pointRotated = vec2(c * point.x - s * point.y, s * point.x + c * point.y);\n float alpha = TWO_PI / numPoints; // the angle of one sector\n float beta = atan(pointRotated.y, pointRotated.x);\n float gamma = round(beta / alpha) * alpha; // angle in sector\n c = cos(-gamma);\n s = sin(-gamma);\n vec2 inSector = vec2(c * pointRotated.x - s * pointRotated.y, abs(s * pointRotated.x + c * pointRotated.y));\n vec2 tipToPoint = inSector + vec2(-radius, 0.);\n vec2 edgeNormal = vec2(radius2 * sin(alpha * 0.5), -radius2 * cos(alpha * 0.5) + radius);\n return dot(normalize(edgeNormal), tipToPoint);\n}",n.functions.regularDistanceField="float regularDistanceField(vec2 point, float numPoints, float radius, float angle) {\n float startAngle = -PI * 0.5 + angle; // tip starts upwards and rotates clockwise with angle\n float c = cos(startAngle);\n float s = sin(startAngle);\n vec2 pointRotated = vec2(c * point.x - s * point.y, s * point.x + c * point.y);\n float alpha = TWO_PI / numPoints; // the angle of one sector\n float radiusIn = radius * cos(PI / numPoints);\n float beta = atan(pointRotated.y, pointRotated.x);\n float gamma = round((beta - alpha * 0.5) / alpha) * alpha + alpha * 0.5; // angle in sector from mid\n c = cos(-gamma);\n s = sin(-gamma);\n vec2 inSector = vec2(c * pointRotated.x - s * pointRotated.y, abs(s * pointRotated.x + c * pointRotated.y));\n return inSector.x - radiusIn;\n}",Hm(t,e,n,"shape-");let r=null;"shape-opacity"in t&&(r=km(n,t["shape-opacity"],Hl));let s="coordsPx";"shape-scale"in t&&(s=`coordsPx / ${km(n,t["shape-scale"],Ql)}`);let o=null;"shape-fill-color"in t&&(o=km(n,t["shape-fill-color"],ql));let a=null;"shape-stroke-color"in t&&(a=km(n,t["shape-stroke-color"],ql));let l=null;"shape-stroke-width"in t&&(l=km(n,t["shape-stroke-width"],Hl));const h=km(n,t["shape-points"],Hl);let c,u="0.";"shape-angle"in t&&(u=km(n,t["shape-angle"],Hl));let d=km(n,t["shape-radius"],Hl);if(null!==l&&(d=`${d} + ${l} * 0.5`),"shape-radius2"in t){let e=km(n,t["shape-radius2"],Hl);null!==l&&(e=`${e} + ${l} * 0.5`),c=`starDistanceField(${s}, ${h}, ${d}, ${e}, ${u})`}else c=`regularDistanceField(${s}, ${h}, ${d}, ${u})`;const g=Km(c,o,a,l,r);e.setSymbolColorExpression(g)}(t,r,0,n):"circle-radius"in t&&function(t,e,i,n){n.functions.circleDistanceField="float circleDistanceField(vec2 point, float radius) {\n return length(point) - radius;\n}",Hm(t,e,n,"circle-");let r=null;"circle-opacity"in t&&(r=km(n,t["circle-opacity"],Hl));let s="coordsPx";"circle-scale"in t&&(s=`coordsPx / ${km(n,t["circle-scale"],Ql)}`);let o=null;"circle-fill-color"in t&&(o=km(n,t["circle-fill-color"],ql));let a=null;"circle-stroke-color"in t&&(a=km(n,t["circle-stroke-color"],ql));let l=km(n,t["circle-radius"],Hl),h=null;"circle-stroke-width"in t&&(h=km(n,t["circle-stroke-width"],Hl),l=`(${l} + ${h} * 0.5)`);const c=Km(`circleDistanceField(${s}, ${l})`,o,a,h,r);e.setSymbolColorExpression(c)}(t,r,0,n),function(t,e,i,n){if("stroke-color"in t&&e.setStrokeColorExpression(km(n,t["stroke-color"],ql)),"stroke-pattern-src"in t){const r=Ym(t["stroke-pattern-src"]),s=qm(t,e,i,"stroke-pattern-",r);let o=s,a="vec2(0.)";"stroke-pattern-offset"in t&&"stroke-pattern-size"in t&&(o=km(n,t["stroke-pattern-size"],Jl),a=Jm(t,"stroke-pattern-",n,s,o));let l="0.";"stroke-pattern-spacing"in t&&(l=km(n,t["stroke-pattern-spacing"],Hl));let h="0.";"stroke-pattern-start-offset"in t&&(h=km(n,t["stroke-pattern-start-offset"],Hl)),n.functions.sampleStrokePattern="vec4 sampleStrokePattern(sampler2D texture, vec2 textureSize, vec2 textureOffset, vec2 sampleSize, float spacingPx, float startOffsetPx, float currentLengthPx, float currentRadiusRatio, float lineWidth) {\n float currentLengthScaled = (currentLengthPx - startOffsetPx) * sampleSize.y / lineWidth;\n float spacingScaled = spacingPx * sampleSize.y / lineWidth;\n float uCoordPx = mod(currentLengthScaled, (sampleSize.x + spacingScaled));\n float isInsideOfPattern = step(uCoordPx, sampleSize.x);\n float vCoordPx = (-currentRadiusRatio * 0.5 + 0.5) * sampleSize.y;\n // make sure that we're not sampling too close to the borders to avoid interpolation with outside pixels\n uCoordPx = clamp(uCoordPx, 0.5, sampleSize.x - 0.5);\n vCoordPx = clamp(vCoordPx, 0.5, sampleSize.y - 0.5);\n vec2 texCoord = (vec2(uCoordPx, vCoordPx) + textureOffset) / textureSize;\n return texture2D(texture, texCoord) * vec4(1.0, 1.0, 1.0, isInsideOfPattern);\n}";const c=`u_texture${r}`;let u="1.";"stroke-color"in t&&(u=e.getStrokeColorExpression()),e.setStrokeColorExpression(`${u} * sampleStrokePattern(${c}, ${s}, ${a}, ${o}, ${l}, ${h}, currentLengthPx, currentRadiusRatio, v_width)`),n.functions.computeStrokePatternLength="float computeStrokePatternLength(vec2 sampleSize, float spacingPx, float lineWidth) {\n float patternLengthPx = sampleSize.x / sampleSize.y * lineWidth;\n return patternLengthPx + spacingPx;\n}",e.setStrokePatternLengthExpression(`computeStrokePatternLength(${o}, ${l}, v_width)`)}if("stroke-width"in t&&e.setStrokeWidthExpression(km(n,t["stroke-width"],Hl)),"stroke-offset"in t&&e.setStrokeOffsetExpression(km(n,t["stroke-offset"],Hl)),"stroke-line-cap"in t&&e.setStrokeCapExpression(km(n,t["stroke-line-cap"],Kl)),"stroke-line-join"in t&&e.setStrokeJoinExpression(km(n,t["stroke-line-join"],Kl)),"stroke-miter-limit"in t&&e.setStrokeMiterLimitExpression(km(n,t["stroke-miter-limit"],Hl)),"stroke-line-dash"in t){n.functions.getSingleDashDistance=`float getSingleDashDistance(float distance, float radius, float dashOffset, float dashLength, float dashLengthTotal, float capType, float lineWidth) {\n float localDistance = mod(distance, dashLengthTotal);\n float distanceSegment = abs(localDistance - dashOffset - dashLength * 0.5) - dashLength * 0.5;\n distanceSegment = min(distanceSegment, dashLengthTotal - localDistance);\n if (capType == ${$_("square")}) {\n distanceSegment -= lineWidth * 0.5;\n } else if (capType == ${$_("round")}) {\n distanceSegment = min(distanceSegment, sqrt(distanceSegment * distanceSegment + radius * radius) - lineWidth * 0.5);\n }\n return distanceSegment;\n}`;let i=t["stroke-line-dash"].map((t=>km(n,t,Hl)));i.length%2==1&&(i=[...i,...i]);let r="0.";"stroke-line-dash-offset"in t&&(r=km(n,t["stroke-line-dash-offset"],Hl));const s=`dashDistanceField_${Ym(t["stroke-line-dash"])}`,o=i.map(((t,e)=>`float dashLength${e}`)).join(", "),a=i.map(((t,e)=>`dashLength${e}`)).join(" + ");let l="0.",h=`getSingleDashDistance(distance, radius, ${l}, dashLength0, totalDashLength, capType, lineWidth)`;for(let t=2;t`${t}`)).join(", ");e.setStrokeDistanceFieldExpression(`${s}(currentLengthPx + ${r}, currentRadiusPx, capType, v_width, ${c})`);let u=i.join(" + ");e.getStrokePatternLengthExpression()&&(n.functions.combinePatternLengths="float combinePatternLengths(float patternLength1, float patternLength2) {\n return patternLength1 * patternLength2;\n}",u=`combinePatternLengths(${e.getStrokePatternLengthExpression()}, ${u})`),e.setStrokePatternLengthExpression(u)}}(t,r,s,n),function(t,e,i,n){if("fill-color"in t&&e.setFillColorExpression(km(n,t["fill-color"],ql)),"fill-pattern-src"in t){const r=Ym(t["fill-pattern-src"]),s=qm(t,e,i,"fill-pattern-",r);let o=s,a="vec2(0.)";"fill-pattern-offset"in t&&"fill-pattern-size"in t&&(o=km(n,t["fill-pattern-size"],Jl),a=Jm(t,"fill-pattern-",n,s,o)),n.functions.sampleFillPattern="vec4 sampleFillPattern(sampler2D texture, vec2 textureSize, vec2 textureOffset, vec2 sampleSize, vec2 pxOrigin, vec2 pxPosition) {\n float scaleRatio = pow(2., mod(u_zoom + 0.5, 1.) - 0.5);\n vec2 pxRelativePos = pxPosition - pxOrigin;\n // rotate the relative position from origin by the current view rotation\n pxRelativePos = vec2(pxRelativePos.x * cos(u_rotation) - pxRelativePos.y * sin(u_rotation), pxRelativePos.x * sin(u_rotation) + pxRelativePos.y * cos(u_rotation));\n // sample position is computed according to the sample offset & size\n vec2 samplePos = mod(pxRelativePos / scaleRatio, sampleSize);\n // also make sure that we're not sampling too close to the borders to avoid interpolation with outside pixels\n samplePos = clamp(samplePos, vec2(0.5), sampleSize - vec2(0.5));\n samplePos.y = sampleSize.y - samplePos.y; // invert y axis so that images appear upright\n return texture2D(texture, (samplePos + textureOffset) / textureSize);\n}";const l=`u_texture${r}`;let h="1.";"fill-color"in t&&(h=e.getFillColorExpression()),e.setFillColorExpression(`${h} * sampleFillPattern(${l}, ${s}, ${a}, ${o}, pxOrigin, pxPos)`)}}(t,r,s,n),i){const t=km(n,i,Yl);r.setFragmentDiscardExpression(`!${t}`)}const o={};function a(t,e,i,s){if(!n[t])return;const a=Bm(i),l=Um(i);r.addAttribute(`a_${e}`,a),o[e]={size:l,callback:s}}return a("geometryType",q_,Kl,(t=>V_(vh(t.getGeometry())))),a("featureId",K_,Kl|Hl,(t=>{const e=t.getId()??null;return"string"==typeof e?V_(e):e})),zm(r,n),{builder:r,attributes:{...o,...Vm(n)},uniforms:{...s,...Xm(n,e)}}}const ty=[];let ey;function iy(){return ey||(ey=D_()),ey}let ny=0;const ry="a_position",sy="a_localPosition",oy="a_segmentStart",ay="a_segmentEnd",ly="a_measureStart",hy="a_measureEnd",cy="a_angleTangentSum",uy="a_joinAngles",dy="a_distanceLow",gy="a_distanceHigh";class fy{constructor(t,e,i,n){this.helper_,this.hitDetectionEnabled_=!!n,this.styleShaders=py(t,e),this.customAttributes_={},this.uniforms_={},this.hitDetectionEnabled_&&(this.customAttributes_.hitColor={callback(){return A_(this.ref,ty)},size:2});for(const t of this.styleShaders){for(const e in t.attributes)e in this.customAttributes_||(this.customAttributes_[e]=t.attributes[e]);for(const e in t.uniforms)e in this.uniforms_||(this.uniforms_[e]=t.uniforms[e])}this.renderPasses_=this.styleShaders.map((t=>{const e={},i=Object.entries(this.customAttributes_).map((([e,i])=>({name:e in t.attributes||"hitColor"===e?`a_${e}`:null,size:i.size||1,type:Bp})));return t.builder.getFillVertexShader()&&(e.fillRenderPass={vertexShader:t.builder.getFillVertexShader(),fragmentShader:t.builder.getFillFragmentShader(),attributesDesc:[{name:ry,size:2,type:Bp},...i],instancedAttributesDesc:[],instancePrimitiveVertexCount:3}),t.builder.getStrokeVertexShader()&&(e.strokeRenderPass={vertexShader:t.builder.getStrokeVertexShader(),fragmentShader:t.builder.getStrokeFragmentShader(),attributesDesc:[{name:sy,size:2,type:Bp}],instancedAttributesDesc:[{name:oy,size:2,type:Bp},{name:ly,size:1,type:Bp},{name:ay,size:2,type:Bp},{name:hy,size:1,type:Bp},{name:uy,size:2,type:Bp},{name:dy,size:1,type:Bp},{name:gy,size:1,type:Bp},{name:cy,size:1,type:Bp},...i],instancePrimitiveVertexCount:6}),t.builder.getSymbolVertexShader()&&(e.symbolRenderPass={vertexShader:t.builder.getSymbolVertexShader(),fragmentShader:t.builder.getSymbolFragmentShader(),attributesDesc:[{name:sy,size:2,type:Bp}],instancedAttributesDesc:[{name:ry,size:2,type:Bp},...i],instancePrimitiveVertexCount:6}),e})),this.hasFill_=this.renderPasses_.some((t=>t.fillRenderPass)),this.hasStroke_=this.renderPasses_.some((t=>t.strokeRenderPass)),this.hasSymbol_=this.renderPasses_.some((t=>t.symbolRenderPass)),this.setHelper(i)}async generateBuffers(t,e){if(t.isEmpty())return null;const i=this.generateRenderInstructions_(t,e),[n,r,s]=await Promise.all([this.generateBuffersForType_(i.polygonInstructions,"Polygon",e),this.generateBuffersForType_(i.lineStringInstructions,"LineString",e),this.generateBuffersForType_(i.pointInstructions,"Point",e)]);return{polygonBuffers:n,lineStringBuffers:r,pointBuffers:s,invertVerticesTransform:rr([1,0,0,1,0,0],e)}}generateRenderInstructions_(t,e){return{polygonInstructions:this.hasFill_?am(t.polygonBatch,new Float32Array(0),this.customAttributes_,e):null,lineStringInstructions:this.hasStroke_?om(t.lineStringBatch,new Float32Array(0),this.customAttributes_,e):null,pointInstructions:this.hasSymbol_?sm(t.pointBatch,new Float32Array(0),this.customAttributes_,e):null}}generateBuffersForType_(t,e,i){if(null===t)return null;const n=ny++;let r;switch(e){case"Polygon":r=F_;break;case"LineString":r=M_;break;case"Point":r=L_}const s={id:n,type:r,renderInstructions:t.buffer,renderInstructionsTransform:i,customAttributesSize:rm(this.customAttributes_)},o=iy();return o.postMessage(s,[t.buffer]),t=null,new Promise((t=>{const e=i=>{const r=i.data;if(r.id!==n)return;if(o.removeEventListener("message",e),!this.helper_.getGL())return;const s=new Mp(qf,Qf).fromArrayBuffer(r.indicesBuffer),a=new Mp(Kf,Qf).fromArrayBuffer(r.vertexAttributesBuffer),l=new Mp(Kf,Qf).fromArrayBuffer(r.instanceAttributesBuffer);this.helper_.flushBufferData(s),this.helper_.flushBufferData(a),this.helper_.flushBufferData(l),t([s,a,l])};o.addEventListener("message",e)}))}render(t,e,i){for(const n of this.renderPasses_)n.fillRenderPass&&this.renderInternal_(t.polygonBuffers[0],t.polygonBuffers[1],t.polygonBuffers[2],n.fillRenderPass,e,i),n.strokeRenderPass&&this.renderInternal_(t.lineStringBuffers[0],t.lineStringBuffers[1],t.lineStringBuffers[2],n.strokeRenderPass,e,i),n.symbolRenderPass&&this.renderInternal_(t.pointBuffers[0],t.pointBuffers[1],t.pointBuffers[2],n.symbolRenderPass,e,i)}renderInternal_(t,e,i,n,r,s){const o=t.getSize();if(0===o)return;const a=n.instancedAttributesDesc.length;if(this.helper_.useProgram(n.program,r),this.helper_.bindBuffer(e),this.helper_.bindBuffer(t),this.helper_.enableAttributes(n.attributesDesc),this.helper_.bindBuffer(i),this.helper_.enableAttributesInstanced(n.instancedAttributesDesc),s(),a){const t=n.instancedAttributesDesc.reduce(((t,e)=>t+(e.size||1)),0),e=i.getSize()/t;this.helper_.drawElementsInstanced(0,o,e)}else this.helper_.drawElements(0,o)}setHelper(t,e=null){this.helper_=t;for(const t of this.renderPasses_)t.fillRenderPass&&(t.fillRenderPass.program=this.helper_.getProgram(t.fillRenderPass.fragmentShader,t.fillRenderPass.vertexShader)),t.strokeRenderPass&&(t.strokeRenderPass.program=this.helper_.getProgram(t.strokeRenderPass.fragmentShader,t.strokeRenderPass.vertexShader)),t.symbolRenderPass&&(t.symbolRenderPass.program=this.helper_.getProgram(t.symbolRenderPass.fragmentShader,t.symbolRenderPass.vertexShader));this.helper_.addUniforms(this.uniforms_),e&&(e.polygonBuffers&&(this.helper_.flushBufferData(e.polygonBuffers[0]),this.helper_.flushBufferData(e.polygonBuffers[1]),this.helper_.flushBufferData(e.polygonBuffers[2])),e.lineStringBuffers&&(this.helper_.flushBufferData(e.lineStringBuffers[0]),this.helper_.flushBufferData(e.lineStringBuffers[1]),this.helper_.flushBufferData(e.lineStringBuffers[2])),e.pointBuffers&&(this.helper_.flushBufferData(e.pointBuffers[0]),this.helper_.flushBufferData(e.pointBuffers[1]),this.helper_.flushBufferData(e.pointBuffers[2])))}}function py(t,e){const i=Array.isArray(t)?t:[t];if("style"in i[0]){const t=[],n=i,r=[];for(const i of n){const n=Array.isArray(i.style)?i.style:[i.style];let s=i.filter;i.else&&r.length&&(s=["all",...r.map((t=>["!",t]))],i.filter&&s.push(i.filter),s.length<3&&(s=s[1])),i.filter&&r.push(i.filter);const o=n.map((t=>Qm(t,e,s)));t.push(...o)}return t}return"builder"in i[0]?i:i.map((t=>Qm(t,e,null)))}const _y={...kp,RENDER_EXTENT:"u_renderExtent",PATTERN_ORIGIN:"u_patternOrigin",GLOBAL_ALPHA:"u_globalAlpha"};class my extends d_{constructor(t,e){super(t,{uniforms:{[_y.RENDER_EXTENT]:[0,0,0,0],[_y.PATTERN_ORIGIN]:[0,0],[_y.GLOBAL_ALPHA]:1},postProcesses:e.postProcesses}),this.hitDetectionEnabled_=!e.disableHitDetection,this.hitRenderTarget_,this.sourceRevision_=-1,this.previousExtent_=[1/0,1/0,-1/0,-1/0],this.currentTransform_=[1,0,0,1,0,0],this.tmpCoords_=[0,0],this.tmpTransform_=[1,0,0,1,0,0],this.tmpMat4_=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],this.currentFrameStateTransform_=[1,0,0,1,0,0],this.styleVariables_={},this.style_=[],this.styleRenderer_=null,this.buffers_=null,this.applyOptions_(e),this.batch_=new qp,this.initialFeaturesAdded_=!1,this.sourceListenKeys_=null}addInitialFeatures_(t){const e=this.getLayer().getSource(),i=Gn();let n;i&&(n=Ln(i,t.viewState.projection)),this.batch_.addFeatures(e.getFeatures(),n),this.sourceListenKeys_=[D(e,Xd,this.handleSourceFeatureAdded_.bind(this,n)),D(e,Vd,this.handleSourceFeatureChanged_.bind(this,n),this),D(e,Wd,this.handleSourceFeatureDelete_,this),D(e,$d,this.handleSourceFeatureClear_,this)]}applyOptions_(t){this.styleVariables_=t.variables,this.style_=t.style}createRenderers_(){this.buffers_=null,this.styleRenderer_=new fy(this.style_,this.styleVariables_,this.helper,this.hitDetectionEnabled_)}reset(t){this.applyOptions_(t),this.helper&&this.createRenderers_(),super.reset(t)}afterHelperCreated(){this.styleRenderer_?this.styleRenderer_.setHelper(this.helper,this.buffers_):this.createRenderers_(),this.hitDetectionEnabled_&&(this.hitRenderTarget_=new Kp(this.helper))}handleSourceFeatureAdded_(t,e){const i=e.feature;this.batch_.addFeature(i,t)}handleSourceFeatureChanged_(t,e){const i=e.feature;this.batch_.changeFeature(i,t)}handleSourceFeatureDelete_(t){const e=t.feature;this.batch_.removeFeature(e)}handleSourceFeatureClear_(){this.batch_.clear()}applyUniforms_(t){Jn(this.tmpTransform_,this.currentFrameStateTransform_),Kn(this.tmpTransform_,t),this.helper.setUniformMatrixValue(_y.PROJECTION_MATRIX,Qd(this.tmpMat4_,this.tmpTransform_)),rr(this.tmpTransform_,this.tmpTransform_),this.helper.setUniformMatrixValue(_y.SCREEN_TO_WORLD_MATRIX,Qd(this.tmpMat4_,this.tmpTransform_)),this.tmpCoords_[0]=0,this.tmpCoords_[1]=0,rr(this.tmpTransform_,t),Qn(this.tmpTransform_,this.tmpCoords_),this.helper.setUniformFloatVec2(_y.PATTERN_ORIGIN,this.tmpCoords_)}renderFrame(t){const e=this.helper.getGL();this.preRender(e,t);const[i,n,r]=N_(t,this.getLayer());this.helper.prepareDraw(t),this.renderWorlds(t,!1,i,n,r),this.helper.finalizeDraw(t,this.dispatchPreComposeEvent,this.dispatchPostComposeEvent);const s=this.helper.getCanvas();return this.hitDetectionEnabled_&&(this.renderWorlds(t,!0,i,n,r),this.hitRenderTarget_.clearCachedData()),this.postRender(e,t),s}prepareFrameInternal(t){this.initialFeaturesAdded_||(this.addInitialFeatures_(t),this.initialFeaturesAdded_=!0);const e=this.getLayer(),i=e.getSource(),n=t.viewState,r=!t.viewHints[co]&&!t.viewHints[uo],s=!te(this.previousExtent_,t.extent),o=this.sourceRevision_{this.buffers_&&this.disposeBuffers(this.buffers_),this.buffers_=t,this.ready=!0,this.getLayer().changed()})),this.previousExtent_=t.extent.slice()}return!0}renderWorlds(t,e,i,n,r){let s=i;e&&(this.hitRenderTarget_.setSize([Math.floor(t.size[0]/2),Math.floor(t.size[1]/2)]),this.helper.prepareDrawToRenderTarget(t,this.hitRenderTarget_,!0));do{this.helper.makeProjectionTransform(t,this.currentFrameStateTransform_),ir(this.currentFrameStateTransform_,s*r,0),this.buffers_&&this.styleRenderer_.render(this.buffers_,t,(()=>{this.applyUniforms_(this.buffers_.invertVerticesTransform),this.helper.applyHitDetectionUniform(e)}))}while(++s{for(const e of t)e&&this.helper.deleteBuffer(e)};t.pointBuffers&&e(t.pointBuffers),t.lineStringBuffers&&e(t.lineStringBuffers),t.polygonBuffers&&e(t.polygonBuffers)}disposeInternal(){this.buffers_&&this.disposeBuffers(this.buffers_),this.sourceListenKeys_&&(this.sourceListenKeys_.forEach((function(t){k(t)})),this.sourceListenKeys_=null),super.disposeInternal()}renderDeclutter(){}}const yy={...g_,TILE_MASK_TEXTURE:"u_depthMask",TILE_ZOOM_LEVEL:"u_tileZoomLevel"},xy={POSITION:"a_position"};class vy extends v_{constructor(t,e){super(t,{cacheSize:e.cacheSize,uniforms:{[yy.PATTERN_ORIGIN]:[0,0],[yy.TILE_MASK_TEXTURE]:()=>this.tileMaskTarget_.getTexture()}}),this.hitDetectionEnabled_=!e.disableHitDetection,this.style_=null,this.styleVariables_=e.variables||{},this.styleRenderer_=null,this.currentFrameStateTransform_=[1,0,0,1,0,0],this.tmpTransform_=[1,0,0,1,0,0],this.tmpMat4_=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],this.tileMaskTarget_=null,this.tileMaskIndices_=new Mp(qf,Jf),this.tileMaskIndices_.fromArray([0,1,3,1,2,3]),this.tileMaskAttributes_=[{name:xy.POSITION,size:2,type:Bp}],this.tileMaskProgram_,this.applyOptions_(e)}reset(t){super.reset(t),this.applyOptions_(t),this.helper&&(this.createRenderers_(),this.initTileMask_())}applyOptions_(t){this.style_=t.style}createRenderers_(){function t(t){const e=t.getFragmentDiscardExpression(),i=`texture2D(${yy.TILE_MASK_TEXTURE}, gl_FragCoord.xy / u_pixelRatio / u_viewportSizePx).r * 50. > ${yy.TILE_ZOOM_LEVEL} + 0.5`;t.setFragmentDiscardExpression("false"!==e?`(${e}) || (${i})`:i),t.addUniform(yy.TILE_MASK_TEXTURE,"sampler2D"),t.addUniform(yy.TILE_ZOOM_LEVEL,"float")}const e=py(this.style_,this.styleVariables_);for(const i of e)t(i.builder);this.styleRenderer_=new fy(e,this.styleVariables_,this.helper,this.hitDetectionEnabled_)}initTileMask_(){this.tileMaskTarget_=new Kp(this.helper);const t=(new Zm).setFillColorExpression(`vec4(${yy.TILE_ZOOM_LEVEL} / 50., 0., 0., 1.)`).addUniform(yy.TILE_ZOOM_LEVEL,"float");this.tileMaskProgram_=this.helper.getProgram(t.getFillFragmentShader(),t.getFillVertexShader()),this.helper.flushBufferData(this.tileMaskIndices_)}afterHelperCreated(){this.createRenderers_(),this.initTileMask_()}createTileRepresentation(t){const e=new Jp(t,this.styleRenderer_),i=()=>{e.ready&&(this.getLayer().changed(),e.removeEventListener(n,i))};return e.addEventListener(n,i),e}beforeTilesRender(t,e){super.beforeTilesRender(t,!0),this.helper.makeProjectionTransform(t,this.currentFrameStateTransform_)}beforeTilesMaskRender(t){this.helper.makeProjectionTransform(t,this.currentFrameStateTransform_);const e=t.pixelRatio,i=t.size;return this.tileMaskTarget_.setSize([i[0]*e,i[1]*e]),this.helper.prepareDrawToRenderTarget(t,this.tileMaskTarget_,!0,!0),this.helper.useProgram(this.tileMaskProgram_,t),Jn(this.tmpTransform_,this.currentFrameStateTransform_),this.helper.setUniformMatrixValue(yy.PROJECTION_MATRIX,Qd(this.tmpMat4_,this.tmpTransform_)),rr(this.tmpTransform_,this.currentFrameStateTransform_),this.helper.setUniformMatrixValue(yy.SCREEN_TO_WORLD_MATRIX,Qd(this.tmpMat4_,this.tmpTransform_)),!0}renderTileMask(t,e,i,n){if(!t.ready)return;this.helper.setUniformFloatValue(yy.DEPTH,n),this.helper.setUniformFloatValue(yy.TILE_ZOOM_LEVEL,e),this.helper.setUniformFloatVec4(yy.RENDER_EXTENT,i),this.helper.setUniformFloatValue(yy.GLOBAL_ALPHA,1),this.helper.bindBuffer(t.maskVertices),this.helper.bindBuffer(this.tileMaskIndices_),this.helper.enableAttributes(this.tileMaskAttributes_);const r=this.tileMaskIndices_.getSize();this.helper.drawElements(0,r)}applyUniforms_(t,e,i,n,r){Jn(this.tmpTransform_,this.currentFrameStateTransform_),Kn(this.tmpTransform_,i),this.helper.setUniformMatrixValue(yy.PROJECTION_MATRIX,Qd(this.tmpMat4_,this.tmpTransform_)),rr(this.tmpTransform_,this.currentFrameStateTransform_),this.helper.setUniformMatrixValue(yy.SCREEN_TO_WORLD_MATRIX,Qd(this.tmpMat4_,this.tmpTransform_)),this.helper.setUniformFloatValue(yy.GLOBAL_ALPHA,t),this.helper.setUniformFloatValue(yy.DEPTH,r),this.helper.setUniformFloatValue(yy.TILE_ZOOM_LEVEL,n),this.helper.setUniformFloatVec4(yy.RENDER_EXTENT,e)}renderTile(t,e,i,n,r,s,o,a,l,h,c){const u=me(a,n,a),d=t.tile.getTileCoord()[0],g=t.buffers;g&&this.styleRenderer_.render(g,i,(()=>{this.applyUniforms_(c,u,g.invertVerticesTransform,d,l)}))}renderDeclutter(t){}disposeInternal(){super.disposeInternal()}}const Sy=0,Ey=1,wy=2,Ty=3,Cy=4,by=5,Ry=6,Py=7,Iy=8,Fy=9,Ly=10,My=11,Ay=12,Oy=[Iy],Dy=[Ay],Ny=[Ey],ky=[Ty];class Gy extends yu{constructor(t,e,i,n){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=n,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return 1==e?t:t.map((function(t){return t*e}))}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),n=this.tmpCoordinate_,r=this.coordinates;let s=r.length;for(let o=0,a=t.length;oa&&(this.instructions.push([Cy,a,h,t,i,Dr,r]),this.hitDetectionInstructions.push([Cy,a,h,t,n||i,Dr,r]));break;case"Point":l=t.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),h=this.coordinates.length,this.instructions.push([Cy,a,h,t,i,void 0,r]),this.hitDetectionInstructions.push([Cy,a,h,t,n||i,void 0,r])}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[Sy,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[Sy,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;let e;t.reverse();const i=t.length;let n,r,s=-1;for(e=0;ethis.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0,e.strokeOffset=void 0;return e}setFillStrokeStyle(t,e){const i=this.state;this.fillStyleToState(t,i),this.strokeStyleToState(e,i)}createFill(t){const e=t.fillStyle,i=[Ly,e];return"string"!=typeof e&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[My,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,t.lineDash?this.applyPixelRatio(t.lineDash):null,t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;"string"==typeof i&&t.currentFillStyle==i||(this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,n=t.lineCap,r=t.lineDash,s=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,l=t.miterLimit,h=t.strokeOffset;(t.currentStrokeStyle!=i||t.currentLineCap!=n||r!=t.currentLineDash&&!w(t.currentLineDash,r)||t.currentLineDashOffset!=s||t.currentLineJoin!=o||t.currentLineWidth!=a||t.currentMiterLimit!=l||t.currentStrokeOffset!=h)&&(e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=r,t.currentLineDashOffset=s,t.currentLineJoin=o,t.currentLineWidth=a,t.currentMiterLimit=l,t.currentStrokeOffset=h)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[Py,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Xt(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;zt(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class jy extends Gy{constructor(t,e,i,n){super(t,e,i,n),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e,i){if(!this.image_||this.maxExtent&&!$t(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),r=t.getStride(),s=this.coordinates.length,o=this.appendFlatPointCoordinates(n,r);this.instructions.push([Ry,s,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([Ry,s,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e,i){if(!this.image_)return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),r=[];for(let e=0,i=n.length;ethis.drawCircle(t,e,i))))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([Ly,Oh]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([My,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Nh,0]);const a=t.getFlatCoordinates(),l=t.getStride(),h=this.coordinates.length;this.appendFlatLineCoordinates(a,0,a.length,l,!1,!1);const c=[wy,h,o];this.instructions.push(Ny,c),this.hitDetectionInstructions.push(Ny,c),void 0!==n.fillStyle&&(this.instructions.push(Oy),this.hitDetectionInstructions.push(Oy)),void 0!==n.strokeStyle&&(this.instructions.push(Dy),this.hitDetectionInstructions.push(Dy)),this.endGeometry(e)}drawPolygon(t,e,i){const n=this.state,r=n.fillStyle,s=n.strokeStyle,o=n.strokeOffset;if(void 0===r&&void 0===s)return;if(this.handleStrokeOffset_((()=>this.drawPolygon(t,e,i))))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([Ly,Oh]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([My,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Nh,0]);const a=t.getEnds(),l=t.getOrientedFlatCoordinates(),h=t.getStride();this.drawFlatCoordinatess_(l,0,a,h,o),this.endGeometry(e)}drawMultiPolygon(t,e,i){const n=this.state,r=n.fillStyle,s=n.strokeStyle,o=n.strokeOffset;if(void 0===r&&void 0===s)return;if(this.handleStrokeOffset_((()=>this.drawMultiPolygon(t,e,i))))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([Ly,Oh]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([My,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Nh,0]);const a=t.getEndss(),l=t.getOrientedFlatCoordinates(),h=t.getStride();let c=0;for(let t=0,e=a.length;t0&&void 0!==i&&void 0!==n&&(e.strokeStyle=void 0,e.strokeOffset=0,t(),e.fillStyle=void 0,e.strokeStyle=n,e.strokeOffset=r,t(),e.fillStyle=i,!0)}}function zy(t,e,i,n,r){const s=[];let o=i,a=0,l=e.slice(i,2);for(;a=t){const e=(t-a+u)/u,d=Ne(i,h,e),g=Ne(n,c,e);l.push(d,g),s.push(l),l=[d,g],a==t&&(o+=r),a=0}else if(a0&&s.push(l),s}function Xy(t,e,i,n,r){let s,o,a,l,h,c,u,d,g,f,p=i,_=i,m=0,y=0,x=i;for(o=i;ot&&(y>m&&(m=y,p=x,_=o),y=0,x=o-r)),a=l,u=g,d=f),h=i,c=n}return y+=l,y>m?[x,o]:[p,_]}const Vy={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class $y extends Gy{constructor(t,e,i,n){super(t,e,i,n),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[Oh]={fillStyle:Oh},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e,i){const n=this.textFillState_,r=this.textStrokeState_,s=this.textState_;if(""===this.text_||!s||!n&&!r)return;const o=this.coordinates;let a=o.length;const l=t.getType();let h=null,c=t.getStride();if("line"!==s.placement||"LineString"!=l&&"MultiLineString"!=l&&"Polygon"!=l&&"MultiPolygon"!=l){let n=s.overflow?null:[];switch(l){case"Point":case"MultiPoint":h=t.getFlatCoordinates();break;case"LineString":h=t.getFlatMidpoint();break;case"Circle":h=t.getCenter();break;case"MultiLineString":h=t.getFlatMidpoints(),c=2;break;case"Polygon":h=t.getFlatInteriorPoint(),s.overflow||n.push(h[2]/this.resolution),c=3;break;case"MultiPolygon":const e=t.getFlatInteriorPoints();h=[];for(let t=0,i=e.length;t{const n=o[2*(t+i)]===h[i*c]&&o[2*(t+i)+1]===h[i*c+1];return n||--t,n}))}this.saveTextStates_();const u=s.backgroundFill?this.createFill(this.fillStyleToState(s.backgroundFill)):null,d=s.backgroundStroke?this.createStroke(this.strokeStyleToState(s.backgroundStroke)):null;this.beginGeometry(t,e,i);let g=s.padding;if(g!=zh&&(s.scale[0]<0||s.scale[1]<0)){let t=s.padding[0],e=s.padding[1],i=s.padding[2],n=s.padding[3];s.scale[0]<0&&(e=-e,n=-n),s.scale[1]<0&&(t=-t,i=-i),g=[t,e,i,n]}const f=this.pixelRatio;this.instructions.push([Ry,a,r,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,g==zh?zh:g.map((function(t){return t*f})),u,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]);const p=1/f,_=u?u.slice(0):null;_&&(_[1]=Oh),this.hitDetectionInstructions.push([Ry,a,r,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[p,p],NaN,this.declutterMode_,this.declutterImageWithText_,g,_,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?Oh:this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]),this.endGeometry(e)}else{if(!Se(this.maxExtent,t.getExtent()))return;let n;if(h=t.getFlatCoordinates(),"LineString"==l)n=[h.length];else if("MultiLineString"==l)n=t.getEnds();else if("Polygon"==l)n=t.getEnds().slice(0,1);else if("MultiPolygon"==l){const e=t.getEndss();n=[];for(let t=0,i=e.length;tt[2]}else P=S>b;const I=Math.PI,F=[],L=w+n===e;let M;if(m=0,y=T,g=t[e=w],f=t[e+1],L){x(),M=Math.atan2(f-_,g-p),P&&(M+=M>0?-I:I);const t=(b+S)/2,e=(R+E)/2;return F[0]=[t,e,(C-s)/2,M,r],F}for(let t=0,u=(r=r.replace(/\n/g," ")).length;t0?-I:I),void 0!==M){let t=d-M;if(t+=t>I?-2*I:t<-I?2*I:0,Math.abs(t)>o)return null}M=d;const S=t;let E=0;for(;t0&&t.push("\n",""),t.push(e,""),t}function rx(t,e,i){return i%2==0&&(t+=e),t}class sx{constructor(t,e,i,n,r){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=[1,0,0,1,0,0],this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=r?new Sf:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,i,n){const r=t+e+i+n;if(this.labels_[r])return this.labels_[r];const s=n?this.strokeStates[n]:null,o=i?this.fillStates[i]:null,a=this.textStates[e],l=this.pixelRatio,h=[a.scale[0]*l,a.scale[1]*l],c=a.justify?Vy[a.justify]:ix(Array.isArray(t)?t[0]:t,a.textAlign||Uh),u=n&&s.lineWidth?s.lineWidth:0,d=Array.isArray(t)?t:String(t).split("\n").reduce(nx,[]),{width:g,height:f,widths:p,heights:_,lineWidths:m}=tc(a,d),y=g+u,x=[],v=(y+2)*h[0],S=(f+u)*h[1],E={width:v<0?Math.floor(v):Math.ceil(v),height:S<0?Math.floor(S):Math.ceil(S),contextInstructions:x};1==h[0]&&1==h[1]||x.push("scale",h),n&&(x.push("strokeStyle",s.strokeStyle),x.push("lineWidth",u),x.push("lineCap",s.lineCap),x.push("lineJoin",s.lineJoin),x.push("miterLimit",s.miterLimit),x.push("setLineDash",[s.lineDash]),x.push("lineDashOffset",s.lineDashOffset)),i&&x.push("fillStyle",o.fillStyle),x.push("textBaseline","middle"),x.push("textAlign","center");const w=.5-c;let T=c*y+w*u;const C=[],b=[];let R,P=0,I=0,F=0,L=0;for(let t=0,e=d.length;tt?t-l:r,x=s+h>e?e-h:s,v=g[3]+y*u[0]+g[1],S=g[0]+x*u[1]+g[2],E=_-g[3],w=m-g[0];let T;return(f||0!==c)&&(Ky[0]=E,Qy[0]=E,Ky[1]=w,qy[1]=w,qy[0]=E+v,Jy[0]=qy[0],Jy[1]=w+S,Qy[1]=Jy[1]),0!==c?(T=nr([1,0,0,1,0,0],i,n,1,1,c,-i,-n),Qn(T,Ky),Qn(T,qy),Qn(T,Jy),Qn(T,Qy),Kt(Math.min(Ky[0],qy[0],Jy[0],Qy[0]),Math.min(Ky[1],qy[1],Jy[1],Qy[1]),Math.max(Ky[0],qy[0],Jy[0],Qy[0]),Math.max(Ky[1],qy[1],Jy[1],Qy[1]),Hy)):Kt(Math.min(E,E+v),Math.min(w,w+S),Math.max(E,E+v),Math.max(w,w+S),Hy),d&&(_=Math.round(_),m=Math.round(m)),{drawImageX:_,drawImageY:m,drawImageW:y,drawImageH:x,originX:l,originY:h,declutterBox:{minX:Hy[0],minY:Hy[1],maxX:Hy[2],maxY:Hy[3],value:p},canvasTransform:T,scale:u}}replayImageOrLabel_(t,e,i,n,r,s,o){const a=!(!s&&!o),l=n.declutterBox,h=o?o[2]*n.scale[0]/2:0;return l.minX-h<=e[0]&&l.maxX+h>=0&&l.minY-h<=e[1]&&l.maxY+h>=0&&(a&&this.replayTextBackground_(t,Ky,qy,Jy,Qy,s,o),ec(t,n.canvasTransform,r,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=Qn(this.renderedTransform_,[0,0]),n=512*this.pixelRatio;t.save(),t.translate(i[0]%n,i[1]%n),1!==e&&t.scale(e,e)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],e[1]&&(t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6]))}drawLabelWithPointPlacement_(t,e,i,n){const r=this.textStates[e],s=this.createLabel(t,e,n,i),o=this.strokeStates[i],a=this.pixelRatio,l=ix(Array.isArray(t)?t[0]:t,r.textAlign||Uh),h=Vy[r.textBaseline||Bh],c=o&&o.lineWidth?o.lineWidth:0;return{label:s,anchorX:l*(s.width/a-2*r.scale[0])+2*(.5-l)*c,anchorY:h*s.height/a+2*(.5-h)*c}}execute_(t,e,i,n,r,s,o,a){const l=this.zIndexContext_;let h;this.pixelCoordinates_&&w(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=cr(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),Jn(this.renderedTransform_,i));let c=0;const u=n.length;let d,g,f,p,_,m,y,x,v,S,E,T,C,b,R,P,I=0,F=0,L=0;const M=this.coordinateCache_,A=this.viewRotation_,O=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,D={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:A},N=this.instructions!=n||this.overlaps?0:200;let k,G,j,U;for(;cN&&(this.fill_(t),F=0),L>N&&(t.stroke(),L=0),F||L||(t.beginPath(),x=NaN,v=NaN),++c;break;case wy:I=i[1],p=i[2]??0;const n=h[I],u=h[I+1],w=h[I+2]-p-n,B=h[I+3]-p-u,z=Math.sqrt(w*w+B*B);t.moveTo(n+z,u),t.arc(n,u,z,0,2*Math.PI,!0),++c;break;case Ty:t.closePath(),++c;break;case Cy:I=i[1],d=i[2];const X=i[3],V=i[4],$=i[5];D.geometry=X,D.feature=k,c in M||(M[c]=[]);const W=M[c];$?$(h,I,d,2,W):(W[0]=h[I],W[1]=h[I+1],W.length=2),l&&(l.zIndex=i[6]),V(W,D),++c;break;case Ry:I=i[1],d=i[2],T=i[3],g=i[4],f=i[5];let Z=i[6];const Y=i[7],H=i[8],K=i[9],q=i[10];let J=i[11];const Q=i[12];let tt=i[13];y=i[14]||"declutter";const et=i[15];if(!T&&i.length>=20){C=i[19],b=i[20],R=i[21],P=i[22];const t=this.drawLabelWithPointPlacement_(C,b,R,P);T=t.label,i[3]=T;const e=i[23];g=(t.anchorX-e)*this.pixelRatio,i[4]=g;const n=i[24];f=(t.anchorY-n)*this.pixelRatio,i[5]=f,Z=T.height,i[6]=Z,tt=T.width,i[13]=tt}let it,nt,rt,st;i.length>25&&(it=i[25]),i.length>17?(nt=i[16],rt=i[17],st=i[18]):(nt=zh,rt=null,st=null),q&&O?J+=A:q||O||(J-=A);let ot=0;for(;I!ax.includes(t)));let hx=!1,cx=!1;class ux{constructor(t,e,i,n,r,s,o){this.maxExtent_=t,this.overlaps_=n,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=s,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=[1,0,0,1,0,0],this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(r,o)}clip(t,e){const i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t,e){for(const i in t){let n=this.executorsByZIndex_[i];void 0===n&&(n={},this.executorsByZIndex_[i]=n);const r=t[i];for(const t in r){const i=r[t];n[t]=new sx(this.resolution_,this.pixelRatio_,this.overlaps_,i,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let e=0,n=t.length;e{const i=ft(1,1,null,{willReadFrequently:e});let n=0;const r=performance.now();for(;performance.now()-r<50;++n)i.fillStyle=`rgba(255,0,${n%256},1)`,i.fillRect(0,0,1,1),i.getImageData(0,0,1,1);return t=n>t?n:t,n},i={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0};hx=i[t],cx=!0}();const o=2*(n=Math.round(n))+1,a=nr(this.hitDetectionTransform_,n+.5,n+.5,1/e,-1/e,-i,-t[0],-t[1]),l=!this.hitDetectionContext_;l&&(this.hitDetectionContext_=ft(o,o,null,{willReadFrequently:hx}));const h=this.hitDetectionContext_;let c;h.canvas.width!==o||h.canvas.height!==o?(h.canvas.width=o,h.canvas.height=o):l||h.clearRect(0,0,o,o),void 0!==this.renderBuffer_&&(c=[1/0,1/0,-1/0,-1/0],ne(c,t),zt(c,e*(this.renderBuffer_+n),c));const u=gx(n);let d;function g(t,e,i){const a=h.getImageData(0,0,o,o).data;for(let l=0,c=u.length;l0){if(!s||"none"===i||"Image"!==d&&"Text"!==d||s.includes(t)){const i=(u[l]-3)/4,s=n-i%o,a=n-(i/o|0),h=r(t,e,s*s+a*a);if(h)return h}h.clearRect(0,0,o,o);break}}const f=Object.keys(this.executorsByZIndex_).map(Number);let p,_,m,x,v;for(f.sort(y),p=f.length-1;p>=0;--p){const t=f[p].toString();for(m=this.executorsByZIndex_[t],_=ox.length-1;_>=0;--_)if(d=ox[_],x=m[d],void 0!==x&&(v=x.executeHitDetection(h,a,i,g,c),v))return v}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],r=e[2],s=e[3],o=[i,n,i,s,r,s,r,n];return cr(o,0,8,2,t,o),o}isEmpty(){return L(this.executorsByZIndex_)}execute(t,e,i,n,r,s,o){const a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(o?x:y),s=s||ox;const l=ox.length;for(let h=0,c=a.length;hg.execute(t,e,i,n,r,o))):g.execute(c,e,i,n,r,o),u&&c.restore(),s){s.offset();const t=a[h]*l+ox.indexOf(d);this.deferredZIndexContexts_[t]||(this.deferredZIndexContexts_[t]=[]),this.deferredZIndexContexts_[t].push(s)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(y);for(let i=0,n=e.length;i{t.draw(this.renderedContext_),t.clear()})),t[e[i]].length=0}}const dx={};function gx(t){if(void 0!==dx[t])return dx[t];const e=2*t+1,i=t*t,n=new Array(i+1);for(let r=0;r<=t;++r)for(let s=0;s<=t;++s){const o=r*r+s*s;if(o>i)break;let a=n[o];a||(a=[],n[o]=a),a.push(4*((t+r)*e+(t+s))+3),r>0&&a.push(4*((t-r)*e+(t+s))+3),s>0&&(a.push(4*((t+r)*e+(t-s))+3),r>0&&a.push(4*((t-r)*e+(t-s))+3))}const r=[];for(let t=0,e=n.length;t{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const t=this.frameState.size.slice(),e=this.renderedCenter_,i=this.renderedResolution_,n=this.renderedRotation_,r=this.renderedProjection_,s=this.wrappedRenderedExtent_,o=this.getLayer(),a=[],l=t[0]*fx,h=t[1]*fx;a.push(this.getRenderTransform(e,i,n,fx,l,h,0).slice());const c=o.getSource(),u=r.getExtent();if(c.getWrapX()&&r.canWrapX()&&!Wt(u,s)){let t=s[0];const r=ve(u);let o,c=0;for(;tu[2];)++c,o=r*c,a.push(this.getRenderTransform(e,i,n,fx,l,h,o).slice()),t-=r}const d=Gn();this.hitDetectionImageData_=px(t,a,this.renderedFeatures_,o.getStyleFunction(),s,i,n,Eu(i,this.renderedPixelRatio_),d?r:null)}e(_x(t,this.renderedFeatures_,this.hitDetectionImageData_))}))}forEachFeatureAtCoordinate(t,e,i,n,r){if(!this.replayGroup_)return;const s=e.viewState.resolution,o=e.viewState.rotation,a=this.getLayer(),l={},h=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,s,o,i,(function(t,e,i){const s=z(t),o=l[s];if(o){if(!0!==o&&it.value)):null)}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const n=t.viewHints[co],r=t.viewHints[uo],s=e.getUpdateWhileAnimating(),o=e.getUpdateWhileInteracting();if(this.ready&&!s&&n||!o&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=t.extent,l=t.viewState,h=l.projection,c=l.resolution,u=t.pixelRatio,d=e.getRevision(),g=e.getRenderBuffer();let f=e.getRenderOrder();void 0===f&&(f=Su);const p=l.center.slice(),_=zt(a,g*c),m=_.slice(),y=[_.slice()],x=h.getExtent(),v=i.getWrapX()&&h.canWrapX();if(this.extendX_=!1,v){const t=i.getExtent();t&&!Ee(t)&&(this.extendX_=t[0]x[2])}if(v&&(!Wt(x,t.extent)||this.extendX_)){const t=ve(x),e=Math.max(ve(_)/2,t);let i=x[0],n=x[2];this.extendX_&&(i-=t,n+=t),_[0]=i-e,_[2]=n+e,ui(p,h);const r=Re(y[0],h);r[0]x[0]&&r[2]>x[2]&&y.push([r[0]-t,r[1],r[2]-t,r[3]])}if(this.ready&&this.renderedResolution_==c&&this.renderedPixelRatio_===u&&this.renderedRevision_==d&&this.renderedRenderOrder_==f&&this.renderedFrameDeclutter_===!!t.declutter&&Wt(this.wrappedRenderedExtent_,_))return w(this.renderedExtent_,m)||(this.hitDetectionImageData_=null,this.renderedExtent_=m),this.renderedCenter_=p,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const S=new Zy(wu(c,u),_,c,u),E=Gn();let T;if(E){for(let t=0,e=y.length;t{let n;const r=t.getStyleFunction()||e.getStyleFunction();if(r&&(n=r(t,c)),n){const e=this.renderFeature(t,C,n,S,T,this.getLayer().getDeclutter(),i);b=b&&!e}},P=Bn(_,h),I=i.getFeaturesInExtent(P);f&&I.sort(f);for(let t=0,e=I.length;t{if(f.getState()!==Ms)return;this.image=f;const t=f.getPixelRatio(),n=Ou(f.getResolution())*e/t;this.renderedResolution=n,this.coordinateToVectorPixelTransform_=nr(this.coordinateToVectorPixelTransform_,l/2,h/2,1/n,-1/n,0,-i.center[0],-i.center[1])})),f.load()}return this.image&&(this.renderedPixelToCoordinateTransform_=t.pixelToCoordinateTransform.slice()),!this.getLayer().getSource()?.loading&&!!this.image}preRender(){}postRender(){}renderDeclutter(){}forEachFeatureAtCoordinate(t,e,i,n,r){return this.vectorRenderer_?this.vectorRenderer_.forEachFeatureAtCoordinate(t,e,i,n,r):super.forEachFeatureAtCoordinate(t,e,i,n,r)}}const xx={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},vx={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]};class Sx extends Mf{constructor(t,e){super(t,e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.renderedOpacity_=1,this.tmpTransform_=[1,0,0,1,0,0],this.tileClipContexts_=null}enqueueTilesForNextExtent(){return"vector"!==this.getLayer().getRenderMode()}drawTile(t,e,i,n,r,s,o,a){this.updateExecutorGroup_(t,e.pixelRatio,e.viewState.projection),this.tileImageNeedsRender_(t)&&this.renderTileImage_(t,e),super.drawTile(t,e,i,n,r,s,o,a)}getTile(t,e,i,n){const r=this.getOrCreateTile(t,e,i,n);if(!r)return null;const s=n.viewState,o=s.resolution,a=n.viewHints,l=this.getLayer().getSource(),h=l.getTileGridForProjection(s.projection),c=!(a[co]||a[uo]),u=h.getZForResolution(o,l.zDirection)===t;return c&&u?r.wantedResolution=o:r.wantedResolution||(r.wantedResolution=h.getResolution(t)),r}prepareFrame(t){const e=this.getLayer().getRevision();return this.renderedLayerRevision_!==e&&(this.renderedLayerRevision_=e,this.renderedTiles.length=0),super.prepareFrame(t)}updateExecutorGroup_(t,e,i){const n=this.getLayer(),r=n.getRevision(),s=n.getRenderOrder()||null,o=t.wantedResolution,a=t.getReplayState(n);if(!a.dirty&&a.renderedResolution===o&&a.renderedRevision==r&&a.renderedPixelRatio===e&&a.renderedRenderOrder==s)return;const l=n.getSource(),h=!!n.getDeclutter(),c=l.getTileGrid(),u=l.getTileGridForProjection(i).getTileCoordExtent(t.wrappedTileCoord),d=l.getSourceTiles(e,i,t),g=z(n);delete t.hitDetectionImageData[g],t.executorGroups[g]=[],a.dirty=!1;for(let r=0,f=d.length;rt.value)):null;let _;t:for(let e=0,n=d.length;e{const n=this.getLayer(),r=n.getSource(),s=this.renderedProjection,o=s.getExtent(),a=this.renderedResolution,l=r.getTileGridForProjection(s),h=Qn(this.renderedPixelToCoordinateTransform_,t.slice()),c=l.getTileCoordForCoordAndResolution(h,a).toString(),u=this.renderedTiles.find((t=>t.tileCoord.toString()===c&&t.getState()===K));if(!u||u.loadingSourceTiles>0)return void e([]);r.getWrapX()&&s.canWrapX()&&!Wt(o,l.getTileCoordExtent(u.tileCoord))&&ui(h,s);const d=z(n),g=ye(l.getTileCoordExtent(u.wrappedTileCoord)),f=[(h[0]-g[0])/a,(g[1]-h[1])/a],p=u.getSourceTiles().reduce(((t,e)=>t.concat(e.getFeatures())),[]);let _=u.hitDetectionImageData[d];if(!_){const t=Wl(l.getTileSize(l.getZForResolution(a,r.zDirection))),e=this.renderedRotation_;_=px(t,[this.getRenderTransform(l.getTileCoordCenter(u.wrappedTileCoord),a,0,fx,t[0]*fx,t[1]*fx,0)],p,n.getStyleFunction(),l.getTileCoordExtent(u.wrappedTileCoord),u.getReplayState(n).renderedResolution,e),u.hitDetectionImageData[d]=_}e(_x(f,p,_))}))}getFeaturesInExtent(t){const e=[],i=this.getTileCache();if(0===i.getCount())return e;const n=this.getLayer().getSource().getTileGridForProjection(this.frameState.viewState.projection),r=n.getZForResolution(this.renderedResolution),s={};return i.forEach((i=>{if(i.tileCoord[0]!==r||i.getState()!==K)return;const o=i.getSourceTiles();for(let i=0,r=o.length;i=0;--e)n[e].execute(this.context,o,this.getTileRenderTransform(i,t),t.viewState.rotation,s,ax,l)}i.globalAlpha=n}renderDeferredInternal(t){const e=this.renderedTiles,i=z(this.getLayer()),n=e.reduce(((t,e,n)=>(e.executorGroups[i].forEach((e=>t.push({executorGroup:e,index:n}))),t)),[]),r=n.map((({executorGroup:t})=>t.getDeferredZIndexContexts())),s={};for(let t=0,e=n.length;t{r.forEach(((e,i)=>{e[t]&&(e[t].forEach((t=>{const{executorGroup:e,index:r}=n[i],s=e.getRenderedContext(),o=s.globalAlpha;s.globalAlpha=this.renderedOpacity_;const a=this.tileClipContexts_[r];a&&a.draw(s),t.draw(s),a&&s.restore(),s.globalAlpha=o,t.clear()})),e[t].length=0)}))}))}getTileRenderTransform(t,e){const i=e.pixelRatio,n=e.viewState,r=n.center,s=n.resolution,o=n.rotation,a=e.size,l=Math.round(a[0]*i),h=Math.round(a[1]*i),c=this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),u=t.tileCoord,d=c.getTileCoordExtent(t.wrappedTileCoord),g=c.getTileCoordExtent(u,this.tempExtent)[0]-d[0];return Kn(er(this.inversePixelTransform.slice(),1/i,1/i),this.getRenderTransform(r,s,o,i,l,h,g))}postRender(t,e){const i=e.viewHints,n=!(i[co]||i[uo]);this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation,this.renderedOpacity_=e.layerStatesArray[e.layerIndex].opacity;const r=this.getLayer(),s=r.getRenderMode(),o=t.globalAlpha;t.globalAlpha=this.renderedOpacity_;const a=r.getDeclutter(),l=a?vx[s].filter((t=>!ax.includes(t))):vx[s],h=e.viewState,c=h.rotation,u=r.getSource(),d=u.getTileGridForProjection(h.projection).getZForResolution(h.resolution,u.zDirection),g=this.renderedTiles,f=[],p=[],_=[],m=z(r);let y=!0;for(let i=g.length-1;i>=0;--i){const s=g[i];y=y&&!s.getReplayState(r).dirty;const o=s.executorGroups[m].filter((t=>t.hasExecutors(l)));if(0===o.length)continue;const h=this.getTileRenderTransform(s,e),u=s.tileCoord[0];let x=!1;const v=o[0].getClipCoords(h);let S,E=t;if(v){S=new Sf,E=S.getContext();for(let t=0,e=f.length;t ${S_.RENDER_EXTENT}[2] ||\n v_mapCoord[1] > ${S_.RENDER_EXTENT}[3]\n ) {\n discard;\n }\n\n vec4 velocity = texture2D(${S_.TILE_TEXTURE_ARRAY}[0], v_textureCoord);\n gl_FragColor = vec4((velocity.xy + ${C_.MAX_SPEED}) / (2.0 * ${C_.MAX_SPEED}), 0, 1);\n }\n`,Ix=`\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n\n attribute vec2 ${b_};\n\n varying vec2 ${P_};\n\n void main() {\n ${P_} = ${b_};\n gl_Position = vec4(1.0 - 2.0 * ${b_}, 0, 1);\n }\n`,Fx=`\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n\n uniform sampler2D ${C_.TEXTURE};\n uniform float ${C_.OPACITY};\n\n varying vec2 ${P_};\n\n void main() {\n vec4 color = texture2D(${C_.TEXTURE}, 1.0 - ${P_});\n gl_FragColor = vec4(floor(255.0 * color * ${C_.OPACITY}) / 255.0);\n }\n`,Lx=`\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n\n uniform sampler2D ${C_.POSITION_TEXTURE};\n uniform sampler2D ${C_.VELOCITY_TEXTURE};\n uniform float ${C_.RANDOM_SEED};\n uniform float ${C_.SPEED_FACTOR};\n uniform float ${C_.DROP_RATE};\n uniform float ${C_.DROP_RATE_BUMP};\n uniform vec2 ${C_.ROTATION};\n uniform vec2 ${C_.VIEWPORT_SIZE_PX};\n\n varying vec2 ${P_};\n\n // pseudo-random generator\n const vec3 randConstants = vec3(12.9898, 78.233, 4375.85453);\n\n float rand(const vec2 co) {\n float t = dot(randConstants.xy, co);\n return fract(sin(t) * (randConstants.z + t));\n }\n\n void main() {\n vec4 positionColor = texture2D(${C_.POSITION_TEXTURE}, ${P_});\n\n // decode particle position from pixel RGBA\n vec2 particlePosition = vec2(\n positionColor.r / 255.0 + positionColor.b,\n positionColor.g / 255.0 + positionColor.a\n );\n\n vec4 velocityColor = texture2D(${C_.VELOCITY_TEXTURE}, particlePosition);\n if (velocityColor.a == 0.0) {\n discard;\n }\n\n float vx = 2.0 * velocityColor.r - 1.0;\n float vy = 2.0 * velocityColor.g - 1.0;\n\n // normalized veloicty (magnitude 0 - 1)\n vec2 velocity = vec2(\n vx * ${C_.ROTATION}.x - vy * ${C_.ROTATION}.y,\n vx * ${C_.ROTATION}.y + vy * ${C_.ROTATION}.x\n );\n\n // account for aspect ratio (square particle position texture, non-square map)\n float aspectRatio = ${C_.VIEWPORT_SIZE_PX}.x / ${C_.VIEWPORT_SIZE_PX}.y;\n vec2 offset = vec2(velocity.x / aspectRatio, velocity.y) * ${C_.SPEED_FACTOR};\n\n // update particle position, wrapping around the edge\n particlePosition = fract(1.0 + particlePosition + offset);\n\n // a random seed to use for the particle drop\n vec2 seed = (particlePosition + ${P_}) * ${C_.RANDOM_SEED};\n\n // drop rate is a chance a particle will restart at random position, to avoid degeneration\n float dropRate = ${C_.DROP_RATE} + length(velocity) * ${C_.DROP_RATE_BUMP};\n float drop = step(1.0 - dropRate, rand(seed));\n\n vec2 randomPosition = vec2(rand(seed + 1.3), rand(seed + 2.1));\n particlePosition = mix(particlePosition, randomPosition, drop);\n\n // encode the new particle position back into RGBA\n gl_FragColor = vec4(\n fract(particlePosition * 255.0),\n floor(particlePosition * 255.0) / 255.0\n );\n }\n`,Mx=`\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n\n attribute float ${R_};\n\n uniform sampler2D ${C_.POSITION_TEXTURE};\n uniform float ${C_.PARTICLE_COUNT_SQRT};\n\n varying vec2 ${P_};\n\n void main() {\n vec4 color = texture2D(\n ${C_.POSITION_TEXTURE},\n vec2(\n fract(${R_} / ${C_.PARTICLE_COUNT_SQRT}),\n floor(${R_} / ${C_.PARTICLE_COUNT_SQRT}) / ${C_.PARTICLE_COUNT_SQRT}\n )\n );\n\n ${P_} = vec2(\n color.r / 255.0 + color.b,\n color.g / 255.0 + color.a\n );\n\n gl_PointSize = 1.0;\n gl_Position = vec4(\n 2.0 * ${P_}.x - 1.0,\n 2.0 * ${P_}.y - 1.0,\n 0,\n 1\n );\n }\n`;const Ax=[];class Ox extends Df{constructor(t){const e=Object.assign({},t);if(delete e.maxSpeed,delete e.speedFactor,delete e.particles,super(e),this.style_=t.style||{},!(t.maxSpeed>0))throw new Error("maxSpeed is required");this.maxSpeed_=t.maxSpeed,this.speedFactor_=t.speedFactor,this.particles_=t.particles,this.styleVariables_=this.style_.variables||{},this.addChangeListener(Va,this.handleSourceUpdate_)}handleSourceUpdate_(){this.hasRenderer()&&this.getRenderer().clearCache()}updateStyleVariables(t){Object.assign(this.styleVariables_,t),this.changed()}getSources(t,e){const i=this.getSource();return Ax[0]=i,Ax}createRenderer(){const t=function(t){const e={variables:{},properties:{},functions:{},bandCount:0,featureId:!1,geometryType:!1},i=[];if(void 0!==t.color){const n=km(e,t.color,ql);i.push(`color = ${n};`)}const n=Object.keys(e.variables);if(n.length>1&&!t.variables)throw new Error(`Missing variables in style (expected ${e.variables})`);const r={};for(const e of n){if(!(e in t.variables))throw new Error(`Missing '${e}' in style variables`);r[W_(e)]=function(){let i=t.variables[e];return"string"==typeof i&&(i=V_(i)),void 0!==i?i:-9999999}}const s=Object.keys(r).map((function(t){return`uniform float ${t};`})),o=Object.keys(e.functions).map((function(t){return e.functions[t]})),a=`\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n\n uniform sampler2D ${C_.VELOCITY_TEXTURE};\n uniform float ${C_.MAX_SPEED};\n uniform vec2 ${C_.ROTATION};\n\n ${s.join("\n")}\n\n varying vec2 ${P_};\n \n ${o.join("\n")}\n\n void main() {\n vec4 velocityColor = texture2D(${C_.VELOCITY_TEXTURE}, ${P_});\n\n float vx = mix(-${C_.MAX_SPEED}, ${C_.MAX_SPEED}, velocityColor.r);\n float vy = mix(-${C_.MAX_SPEED}, ${C_.MAX_SPEED}, velocityColor.g);\n\n vec2 velocity = vec2(\n vx * ${C_.ROTATION}.x - vy * ${C_.ROTATION}.y,\n vx * ${C_.ROTATION}.y + vy * ${C_.ROTATION}.x\n );\n\n float a_prop_speed = length(velocity);\n\n vec4 color;\n\n ${i.join("\n")}\n\n if (color.a == 0.0) {\n discard;\n }\n\n gl_FragColor = color;\n }\n `;return{tileVertexShader:Rx,tileFragmentShader:Px,particleColorVertexShader:Mx,particleColorFragmentShader:a,particlePositionVertexShader:Ix,particlePositionFragmentShader:Lx,textureVertexShader:Ix,textureFragmentShader:Fx}}(this.style_);return new I_(this,{...t,cacheSize:this.getCacheSize(),maxSpeed:this.maxSpeed_,speedFactor:this.speedFactor_,particles:this.particles_})}}function Dx(t,e,i){const n=[];let r=t(0),s=t(1),o=e(r),a=e(s);const l=[s,r],h=[a,o],c=[1,0],u={};let d,g,f,p,_,m,y=1e5;for(;--y>0&&c.length>0;)f=c.pop(),r=l.pop(),o=h.pop(),m=f.toString(),m in u||(n.push(o[0],o[1]),u[m]=!0),p=c.pop(),s=l.pop(),a=h.pop(),_=(f+p)/2,d=t(_),g=e(d),Fe(g[0],g[1],o[0],o[1],a[0],a[1])1&&!t.variables)throw new Error(`Missing variables in style (expected ${n.variables})`);for(let e=0;e ${S_.RENDER_EXTENT}[2] ||\n v_mapCoord[1] > ${S_.RENDER_EXTENT}[3]\n ) {\n discard;\n }\n\n vec4 color = texture2D(${S_.TILE_TEXTURE_ARRAY}[0], v_textureCoord);\n\n ${r.join("\n")}\n\n gl_FragColor = color;\n gl_FragColor.rgb *= gl_FragColor.a;\n gl_FragColor *= ${S_.TRANSITION_ALPHA};\n }`,uniforms:s,paletteTextures:n.paletteTextures}}class Wx extends Df{constructor(t){const e=(t=t?Object.assign({},t):{}).style||{};delete t.style,super(t),this.sources_=t.sources,this.renderedSource_=null,this.renderedResolution_=NaN,this.style_=e,this.styleVariables_=this.style_.variables||{},this.handleSourceUpdate_(),this.addChangeListener(Va,this.handleSourceUpdate_)}getSources(t,e){const i=this.getSource();return this.sources_?"function"==typeof this.sources_?this.sources_(t,e):this.sources_:i?[i]:[]}getRenderSource(){return this.renderedSource_||this.getSource()}getSourceState(){const t=this.getRenderSource();return t?t.getState():"undefined"}handleSourceUpdate_(){this.hasRenderer()&&this.getRenderer().clearCache();const t=this.getSource();if(t)if("loading"===t.getState()){const e=()=>{"ready"===t.getState()&&(t.removeEventListener("change",e),this.setStyle(this.style_))};t.addEventListener("change",e)}else this.setStyle(this.style_)}getSourceBandCount_(){const t=Number.MAX_SAFE_INTEGER,e=this.getSources([-t,-t,t,t],t);return e&&e.length&&"bandCount"in e[0]?e[0].bandCount:4}createRenderer(){const t=$x(this.style_,this.getSourceBandCount_());return new T_(this,{vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,uniforms:t.uniforms,cacheSize:this.getCacheSize(),paletteTextures:t.paletteTextures})}renderSources(t,e){const i=this.getRenderer();let n;for(let r=0,s=e.length;r{"ready"==e.getState()&&(e.removeEventListener("change",t),this.changed())};e.addEventListener("change",t)}r=r&&"ready"==i}const s=this.renderSources(t,n);if(this.getRenderer().renderComplete&&r)return this.renderedResolution_=i.resolution,s;if(this.renderedResolution_>.5*i.resolution){const e=this.getSources(t.extent,this.renderedResolution_).filter((t=>!n.includes(t)));if(e.length>0)return this.renderSources(t,e)}return s}setStyle(t){if(this.styleVariables_=t.variables||{},this.style_=t,this.hasRenderer()){const t=$x(this.style_,this.getSourceBandCount_());this.getRenderer().reset({vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,uniforms:t.uniforms,paletteTextures:t.paletteTextures}),this.changed()}}updateStyleVariables(t){Object.assign(this.styleVariables_,t),this.changed()}}Wx.prototype.dispose;const Zx="addfeatures";class Yx extends M{constructor(t,e,i,n){super(t),this.features=i,this.file=e,this.projection=n}}function Hx(t,e){const i=t.length;return e<0?t[e+i]:e>=i?t[e-i]:t[e]}function Kx(t,e){const i=t.length;let n=Math.floor(e);const r=e-n;n>=i?n-=i:n<0&&(n+=i);let s=n+1;s>=i&&(s-=i);const o=t[n],a=o[0],l=o[1],h=t[s];return[a+(h[0]-a)*r,l+(h[1]-l)*r]}const qx={index:-1,endIndex:NaN,closestTargetDistance:1/0};function Jx(t,e,i,n){const r=t[0],s=t[1];let o=1/0,a=-1,l=NaN;for(let t=0;ti.startIndex?hi.startIndex&&(h-=n.length)),l=h,a=t)}const h=e.targets[a];let c=h.ring;if(e.targetIndex===a&&c){const t=Kx(h.coordinates,l);li(i.getPixelFromCoordinate(t),i.getPixelFromCoordinate(e.startCoord))>n&&(c=!1)}if(c){const t=h.coordinates,e=t.length,i=h.startIndex,n=l;if(io){return iv(Kx(t,n),Kx(t,r))}let a=0;if(n=0;--i){const n=e[i];if(n!==this&&n instanceof Av&&n.getStyle()&&-1!==n.getFeatures().getArray().lastIndexOf(t))return void t.setStyle(n.getStyle())}const i=z(t);t.setStyle(Mv[i]),delete Mv[i]}removeFeatureLayerAssociation_(t){delete this.featureLayerAssociation_[z(t)]}selectFeature(t){const e=this.findLayerOfFeature_(t);if(!this.layerFilter_(e)||!this.filter_(t,e))return!1;const i=this.getFeatures();return!i.getArray().includes(t)&&(this.addFeatureLayerAssociation_(t,e),i.push(t),this.dispatchEvent(new Lv(Fv,[t],[],void 0)),!0)}deselectFeature(t){const e=this.getFeatures(),i=e.getArray().indexOf(t);return-1!==i&&(e.removeAt(i),this.dispatchEvent(new Lv(Fv,[],[t],void 0)),!0)}toggleFeature(t){this.deselectFeature(t)||this.selectFeature(t)}clearSelection(){const t=this.getFeatures();if(0!==t.getLength()){const e=t.getArray().slice();t.clear(),this.dispatchEvent(new Lv(Fv,[],e,void 0))}}handleEvent(t){if(!this.condition_(t))return!0;const e=this.addCondition_(t),i=this.removeCondition_(t),n=this.toggleCondition_(t),r=!e&&!i&&!n,s=t.map,o=this.getFeatures(),a=[],l=[];if(r){s.forEachFeatureAtPixel(t.pixel,((t,e)=>{if(t instanceof At&&this.filter_(t,e))return this.addFeatureLayerAssociation_(t,e),l.push(t),!this.multi_}),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(let t=o.getLength()-1;t>=0;--t){const e=o.item(t),i=l.indexOf(e);-1===i?(o.removeAt(t),a.push(e)):l.splice(i,1)}0!==l.length&&o.extend(l)}else{s.forEachFeatureAtPixel(t.pixel,((t,r)=>{if(!(t instanceof At&&this.filter_(t,r)))return;const s=o.getArray().includes(t);return s&&(i||n)?a.push(t):s||!e&&!n||(this.addFeatureLayerAssociation_(t,r),l.push(t)),!this.multi_}),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(let t=a.length-1;t>=0;--t)o.remove(a[t]);o.extend(l)}return(l.length>0||a.length>0)&&this.dispatchEvent(new Lv(Fv,l,a,t)),!0}}const Ov="snap",Dv="unsnap";class Nv extends M{constructor(t,e){super(t),this.vertex=e.vertex,this.vertexPixel=e.vertexPixel,this.feature=e.feature,this.segment=e.segment}}const kv={Circle(t,e){let i=t;const n=Gn();n&&(i=i.clone().transform(n,e));const r=_s(i);return n&&r.transform(e,n),kv.Polygon(r)},GeometryCollection(t,e){const i=[],n=t.getGeometriesArray();for(let t=0;t[[t.getFlatCoordinates().slice(0,2)]],Polygon(t){const e=[],i=t.getFlatCoordinates(),n=t.getStride(),r=t.getEnds();let s=0;for(let t=0,o=r.length;tqv({...t,geometry:e}))).flat();const n="MultiPolygon"===i.type?"Polygon":i.type;if("GeometryCollection"===n||"Circle"===n)throw new Error("Unsupported geometry type: "+n);const r=i.layout.length;return Yv(new Ud(n,"Polygon"===n?function(t,e,i){return Array.isArray(e[0])?(hs(t,0,e,i)||us(t=t.slice(),0,e,i),t):(ls(t,0,e,i)||cs(t=t.slice(),0,e,i),t)}(i.flatCoordinates,i.ends,r):i.flatCoordinates,i.ends?.flat(),r,t.properties||{},t.id).enableSimplifyTransformed(),!1,e)}function Jv(t,e){if(!t)return null;if(Array.isArray(t)){const i=t.map((t=>Jv(t,e)));return new Md(i)}return Yv(new(0,Kv[t.type])(t.flatCoordinates,t.layout||"XY",t.ends),!1,e)}class Qv extends Zv{constructor(){super()}getType(){return"json"}readFeature(t,e){return this.readFeatureFromObject(tS(t),this.getReadOptions(t,e))}readFeatures(t,e){return this.readFeaturesFromObject(tS(t),this.getReadOptions(t,e))}readFeatureFromObject(t,e){return U()}readFeaturesFromObject(t,e){return U()}readGeometry(t,e){return this.readGeometryFromObject(tS(t),this.getReadOptions(t,e))}readGeometryFromObject(t,e){return U()}readProjection(t){return this.readProjectionFromObject(tS(t))}readProjectionFromObject(t){return U()}writeFeature(t,e){return JSON.stringify(this.writeFeatureObject(t,e))}writeFeatureObject(t,e){return U()}writeFeatures(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))}writeFeaturesObject(t,e){return U()}writeGeometry(t,e){return JSON.stringify(this.writeGeometryObject(t,e))}writeGeometryObject(t,e){return U()}}function tS(t){if("string"==typeof t){const e=JSON.parse(t);return e||null}return null!==t?t:null}const eS={Point:function(t){let e;e=void 0!==t.m&&void 0!==t.z?new Wr([t.x,t.y,t.z,t.m],"XYZM"):void 0!==t.z?new Wr([t.x,t.y,t.z],"XYZ"):void 0!==t.m?new Wr([t.x,t.y,t.m],"XYM"):new Wr([t.x,t.y]);return e},LineString:function(t){const e=rS(t);return new Dd(t.paths[0],e)},Polygon:function(t){const e=rS(t);return new gs(t.rings,e)},MultiPoint:function(t){const e=rS(t);return new kd(t.points,e)},MultiLineString:function(t){const e=rS(t);return new Nd(t.paths,e)},MultiPolygon:function(t){const e=rS(t);return new Gd(t.rings,e)}},iS={Point:function(t,e){const i=t.getCoordinates();let n;const r=t.getLayout();if("XYZ"===r)n={x:i[0],y:i[1],z:i[2]};else if("XYM"===r)n={x:i[0],y:i[1],m:i[2]};else if("XYZM"===r)n={x:i[0],y:i[1],z:i[2],m:i[3]};else{if("XY"!==r)throw new Error("Invalid geometry layout");n={x:i[0],y:i[1]}}return n},LineString:function(t,e){const i=sS(t);return{hasZ:i.hasZ,hasM:i.hasM,paths:[t.getCoordinates()]}},Polygon:function(t,e){const i=sS(t);return{hasZ:i.hasZ,hasM:i.hasM,rings:t.getCoordinates(!1)}},MultiPoint:function(t,e){const i=sS(t);return{hasZ:i.hasZ,hasM:i.hasM,points:t.getCoordinates()}},MultiLineString:function(t,e){const i=sS(t);return{hasZ:i.hasZ,hasM:i.hasM,paths:t.getCoordinates()}},MultiPolygon:function(t,e){const i=sS(t),n=t.getCoordinates(!1),r=[];for(let t=0;t=0;e--)r.push(n[t][e]);return{hasZ:i.hasZ,hasM:i.hasM,rings:r}}};function nS(t,e){if(!t)return null;let i;if("number"==typeof t.x&&"number"==typeof t.y)i="Point";else if(t.points)i="MultiPoint";else if(t.paths){i=1===t.paths.length?"LineString":"MultiLineString"}else if(t.rings){const e=t,n=rS(e),r=function(t,e){const i=[],n=[],r=[];let s,o;for(s=0,o=t.length;s=0;s--){const i=n[s][0];if(Wt(new $r(i).getExtent(),new $r(t).getExtent())){n[s].push(t),e=!0;break}}e||n.push([t.reverse()])}return n}(e.rings,n);1===r.length?(i="Polygon",t=Object.assign({},t,{rings:r[0]})):(i="MultiPolygon",t=Object.assign({},t,{rings:r}))}return Yv((0,eS[i])(t),!1,e)}function rS(t){let e="XY";return!0===t.hasZ&&!0===t.hasM?e="XYZM":!0===t.hasZ?e="XYZ":!0===t.hasM&&(e="XYM"),e}function sS(t){const e=t.getLayout();return{hasZ:"XYZ"===e||"XYZM"===e,hasM:"XYM"===e||"XYZM"===e}}function oS(t,e){return(0,iS[t.getType()])(Yv(t,!0,e),e)}class aS extends Zv{constructor(){super(),this.xmlSerializer_=Pp()}getType(){return"xml"}readFeature(t,e){if(!t)return null;if("string"==typeof t){const i=cp(t);return this.readFeatureFromDocument(i,e)}return lp(t)?this.readFeatureFromDocument(t,e):this.readFeatureFromNode(t,e)}readFeatureFromDocument(t,e){const i=this.readFeaturesFromDocument(t,e);return i.length>0?i[0]:null}readFeatureFromNode(t,e){return null}readFeatures(t,e){if(!t)return[];if("string"==typeof t){const i=cp(t);return this.readFeaturesFromDocument(i,e)}return lp(t)?this.readFeaturesFromDocument(t,e):this.readFeaturesFromNode(t,e)}readFeaturesFromDocument(t,e){const i=[];for(let n=t.firstChild;n;n=n.nextSibling)n.nodeType==Node.ELEMENT_NODE&&E(i,this.readFeaturesFromNode(n,e));return i}readFeaturesFromNode(t,e){return U()}readGeometry(t,e){if(!t)return null;if("string"==typeof t){const i=cp(t);return this.readGeometryFromDocument(i,e)}return lp(t)?this.readGeometryFromDocument(t,e):this.readGeometryFromNode(t,e)}readGeometryFromDocument(t,e){return null}readGeometryFromNode(t,e){return null}readProjection(t){if(!t)return null;if("string"==typeof t){const e=cp(t);return this.readProjectionFromDocument(e)}return lp(t)?this.readProjectionFromDocument(t):this.readProjectionFromNode(t)}readProjectionFromDocument(t){return this.dataProjection}readProjectionFromNode(t){return this.dataProjection}writeFeature(t,e){const i=this.writeFeatureNode(t,e);return this.xmlSerializer_.serializeToString(i)}writeFeatureNode(t,e){return null}writeFeatures(t,e){const i=this.writeFeaturesNode(t,e);return this.xmlSerializer_.serializeToString(i)}writeFeaturesNode(t,e){return null}writeGeometry(t,e){const i=this.writeGeometryNode(t,e);return this.xmlSerializer_.serializeToString(i)}writeGeometryNode(t,e){return null}}const lS="http://www.opengis.net/gml",hS=/^\s*$/;class cS extends aS{constructor(t){super(),t=t||{},this.featureType=t.featureType,this.featureNS=t.featureNS,this.srsName=t.srsName,this.schemaLocation="",this.FEATURE_COLLECTION_PARSERS={},this.FEATURE_COLLECTION_PARSERS[this.namespace]={featureMember:dp(this.readFeaturesInternal),featureMembers:gp(this.readFeaturesInternal)},this.supportedMediaTypes=["application/gml+xml"]}readFeaturesInternal(t,e){const i=t.localName;let n=null;if("FeatureCollection"==i)n=wp([],this.FEATURE_COLLECTION_PARSERS,t,e,this);else if("featureMembers"==i||"featureMember"==i||"member"==i){const r=e[0];let s=r.featureType,o=r.featureNS;const a="p",l="p0";if(!s&&t.childNodes){s=[],o={};for(let e=0,i=t.childNodes.length;e0&&!(t instanceof _r)){t={_content_:t};for(let e=0;e").forEach(((e,i,n)=>{i0&&(e=">"+e),vS(t,e)})):t.appendChild(Ip().createTextNode(e))}const PS=lS+" http://schemas.opengis.net/gml/2.1.2/feature.xsd",IS={MultiLineString:"lineStringMember",MultiCurve:"curveMember",MultiPolygon:"polygonMember",MultiSurface:"surfaceMember"};class FS extends cS{constructor(t){super(t=t||{}),this.FEATURE_COLLECTION_PARSERS[lS].featureMember=dp(this.readFeaturesInternal),this.schemaLocation=t.schemaLocation?t.schemaLocation:PS}readFlatCoordinates(t,e){const i=op(t,!1).replace(/^\s*|\s*$/g,""),n=e[0].srsName;let r="enu";if(n){const t=En(n);t&&(r=t.getAxisOrientation())}const s=i.trim().split(/\s+/),o=[];for(let t=0,e=s.length;t0){e[e.length-1].push(...i)}},outerBoundaryIs:function(t,e){const i=wp(void 0,Uw,t,e);if(i){e[e.length-1][0]=i}}});function Rw(t,e){const i=wp({},vw,t,e),n=wp([null],bw,t,e);if(n&&n[0]){const t=n[0],e=[t.length];for(let i=1,r=n.length;i0;let o;const a=r.href;let l,h,c;a?o=a:s&&(o=zE);let u="bottom-left";const d=i.hotSpot;let g;d?(l=[d.x,d.y],h=d.xunits,c=d.yunits,u=d.origin):/^https?:\/\/maps\.(?:google|gstatic)\.com\//.test(o)&&(o.includes("pushpin")?(l=GE,h=jE,c=UE):o.includes("arrow-reverse")?(l=[54,42],h=jE,c=UE):o.includes("paddle")&&(l=[32,1],h=jE,c=UE));const f=r.x,p=r.y;let _;void 0!==f&&void 0!==p&&(g=[f,p]);const m=r.w,y=r.h;let x;void 0!==m&&void 0!==y&&(_=[m,y]);const v=i.heading;void 0!==v&&(x=Oe(v));const S=i.scale,E=i.color;if(s){o==zE&&(_=BE);const t=new ac({anchor:l,anchorOrigin:u,anchorXUnits:h,anchorYUnits:c,crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,offset:g,offsetOrigin:"bottom-left",rotation:x,scale:S,size:_,src:this.iconUrlFunction_(o),color:E}),e=t.getScaleArray()[0],i=t.getSize();if(null===i){const i=t.getImageState();if(i===Fs||i===Ls){const n=function(){const i=t.getImageState();if(i!==Fs&&i!==Ls){const i=t.getSize();if(i&&2==i.length){const n=JE(i);t.setScale(e*n)}t.unlistenImageChange(n)}};t.listenImageChange(n),i===Fs&&t.load()}}else if(2==i.length){const n=JE(i);t.setScale(e*n)}n.imageStyle=t}else n.imageStyle=VE},LabelStyle:function(t,e){const i=wp({},hw,t,e);if(!i)return;const n=e[e.length-1],r=new pc({fill:new sc({color:"color"in i?i.color:kE}),scale:i.scale});n.textStyle=r},LineStyle:function(t,e){const i=wp({},cw,t,e);if(!i)return;const n=e[e.length-1],r=new lc({color:"color"in i?i.color:kE,width:"width"in i?i.width:1});n.strokeStyle=r},PolyStyle:function(t,e){const i=wp({},uw,t,e);if(!i)return;const n=e[e.length-1],r=new sc({color:"color"in i?i.color:kE});n.fillStyle=r;const s=i.fill;void 0!==s&&(n.fill=s);const o=i.outline;void 0!==o&&(n.outline=o)}});function Iw(t,e){const i=wp({},Pw,t,e,this);if(!i)return null;let n="fillStyle"in i?i.fillStyle:XE;const r=i.fill;let s;void 0===r||r||(n=null),"imageStyle"in i?i.imageStyle!=VE&&(s=i.imageStyle):s=$E;const o="textStyle"in i?i.textStyle:YE,a="strokeStyle"in i?i.strokeStyle:ZE,l=i.outline;return void 0===l||l?[new hc({fill:n,image:s,stroke:a,text:o,zIndex:void 0})]:[new hc({geometry:function(t){const e=t.getGeometry(),i=e.getType();if("GeometryCollection"===i){return new Md(e.getGeometriesArrayRecursive().filter((function(t){const e=t.getType();return"Polygon"!==e&&"MultiPolygon"!==e})))}if("Polygon"!==i&&"MultiPolygon"!==i)return e},fill:n,image:s,stroke:a,text:o,zIndex:void 0}),new hc({geometry:function(t){const e=t.getGeometry(),i=e.getType();if("GeometryCollection"===i){return new Md(e.getGeometriesArrayRecursive().filter((function(t){const e=t.getType();return"Polygon"===e||"MultiPolygon"===e})))}if("Polygon"===i||"MultiPolygon"===i)return e},fill:n,stroke:null,zIndex:void 0})]}function Fw(t,e){const i=e.length,n=new Array(e.length),r=new Array(e.length),s=new Array(e.length);let o,a,l;o=!1,a=!1,l=!1;for(let t=0;t0){const t=vp(r,o);Cp(n,uT,gT,[{names:o,values:t}],i)}const u=i[0];let d=e.getGeometry();d&&(d=Yv(d,!0,u)),Cp(n,uT,iT,[d],i)}const pT=Sp(PE,["extrude","tessellate","altitudeMode","coordinates"]),_T=Sp(PE,{extrude:_p(xS),tessellate:_p(xS),altitudeMode:_p(RS),coordinates:_p((function(t,e,i){const n=i[i.length-1],r=n.layout,s=n.stride;let o;if("XY"==r||"XYM"==r)o=2;else{if("XYZ"!=r&&"XYZM"!=r)throw new Error("Invalid geometry layout");o=3}const a=e.length;let l="";if(a>0){l+=e[0];for(let t=1;t>3,r=this.pos;this.type=7&i,t(n,e,this),this.pos===r&&this.skip(i)}return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){const t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*RT;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*RT;return this.pos+=8,t}readFloat(){const t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){const t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){const e=this.buf;let i,n;return n=e[this.pos++],i=127&n,n<128?i:(n=e[this.pos++],i|=(127&n)<<7,n<128?i:(n=e[this.pos++],i|=(127&n)<<14,n<128?i:(n=e[this.pos++],i|=(127&n)<<21,n<128?i:(n=e[this.pos],i|=(15&n)<<28,function(t,e,i){const n=i.buf;let r,s;if(s=n[i.pos++],r=(112&s)>>4,s<128)return LT(t,r,e);if(s=n[i.pos++],r|=(127&s)<<3,s<128)return LT(t,r,e);if(s=n[i.pos++],r|=(127&s)<<10,s<128)return LT(t,r,e);if(s=n[i.pos++],r|=(127&s)<<17,s<128)return LT(t,r,e);if(s=n[i.pos++],r|=(127&s)<<24,s<128)return LT(t,r,e);if(s=n[i.pos++],r|=(1&s)<<31,s<128)return LT(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(i,t,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return Boolean(this.readVarint())}readString(){const t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&IT?IT.decode(this.buf.subarray(e,t)):function(t,e,i){let n="",r=e;for(;r239?4:e>223?3:e>191?2:1;if(r+h>i)break;1===h?e<128&&(l=e):2===h?(s=t[r+1],128==(192&s)&&(l=(31&e)<<6|63&s,l<=127&&(l=null))):3===h?(s=t[r+1],o=t[r+2],128==(192&s)&&128==(192&o)&&(l=(15&e)<<12|(63&s)<<6|63&o,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===h&&(s=t[r+1],o=t[r+2],a=t[r+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(l=(15&e)<<18|(63&s)<<12|(63&o)<<6|63&a,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,h=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),r+=h}return n}(this.buf,e,t)}readBytes(){const t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){const i=this.readPackedEnd();for(;this.pos127;);else if(2===e)this.pos=this.readVarint()+this.pos;else if(5===e)this.pos+=4;else{if(1!==e)throw new Error(`Unimplemented type: ${e}`);this.pos+=8}}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e268435455||t<0?function(t,e){let i,n;t>=0?(i=t%4294967296|0,n=t/4294967296|0):(i=~(-t%4294967296),n=~(-t/4294967296),4294967295^i?i=i+1|0:(i=0,n=n+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos]=127&t}(i,0,e),function(t,e){const i=(7&t)<<4;if(e.buf[e.pos++]|=i|((t>>>=3)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;e.buf[e.pos++]=127&t}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))}writeSVarint(t){this.writeVarint(t<0?2*-t-1:2*t)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(4*t.length),this.pos++;const e=this.pos;this.pos=function(t,e,i){for(let n,r,s=0;s55295&&n<57344){if(!r){n>56319||s+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):r=n;continue}if(n<56320){t[i++]=239,t[i++]=191,t[i++]=189,r=n;continue}n=r-55296<<10|n-56320|65536,r=null}else r&&(t[i++]=239,t[i++]=191,t[i++]=189,r=null);n<128?t[i++]=n:(n<2048?t[i++]=n>>6|192:(n<65536?t[i++]=n>>12|224:(t[i++]=n>>18|240,t[i++]=n>>12&63|128),t[i++]=n>>6&63|128),t[i++]=63&n|128)}return i}(this.buf,t,this.pos);const i=this.pos-e;i>=128&&MT(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){const e=t.length;this.writeVarint(e),this.realloc(e);for(let i=0;i=128&&MT(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n}writeMessage(t,e,i){this.writeTag(t,2),this.writeRawMessage(e,i)}writePackedVarint(t,e){e.length&&this.writeMessage(t,AT,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,OT,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,kT,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,DT,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,NT,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,GT,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,jT,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,UT,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,BT,e)}writeBytesField(t,e){this.writeTag(t,2),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,5),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,5),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,1),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,1),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,0),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,0),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,2),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,5),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,1),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}}function LT(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function MT(t,e,i){const n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(let e=i.pos-1;e>=t;e--)i.buf[e+n]=i.buf[e]}function AT(t,e){for(let i=0;i>3)?i.readString():2===t?i.readFloat():3===t?i.readDouble():4===t?i.readVarint64():5===t?i.readVarint():6===t?i.readSVarint():7===t?i.readBoolean():null;e.values.push(n)}}function VT(t,e,i){if(1==t)e.id=i.readVarint();else if(2==t){const t=i.readVarint()+i.pos;for(;i.pos>1):i>>1}return e}function xC(t){let e="";for(let i=0,n=t.length;i=32;)e=63+(32|31&t),i+=String.fromCharCode(e),t>>=5;return e=t+63,i+=String.fromCharCode(e),i}const EC={Point:function(t,e,i){const n=t.coordinates;e&&i&&RC(n,e,i);return new Wr(n)},LineString:function(t,e){const i=wC(t.arcs,e);return new Dd(i)},Polygon:function(t,e){const i=[];for(let n=0,r=t.arcs.length;n0&&i.pop(),n>=0){const t=e[n];for(let e=0,n=t.length;e=0;--e)i.push(t[e].slice(0))}return i}function TC(t,e,i,n,r,s,o){const a=t.geometries,l=[];for(let t=0,h=a.length;t=2,"At least 2 conditions are required")}}class FC extends IC{constructor(t){super("And",Array.prototype.slice.call(arguments))}}class LC extends PC{constructor(t,e,i){if(super("BBOX"),this.geometryName=t,this.extent=e,4!==e.length)throw new Error("Expected an extent with four values ([minX, minY, maxX, maxY])");this.srsName=i}}class MC extends PC{constructor(t,e,i,n){super(t),this.geometryName=e||"the_geom",this.geometry=i,this.srsName=n}}class AC extends MC{constructor(t,e,i){super("Contains",t,e,i)}}class OC extends MC{constructor(t,e,i,n,r){super("DWithin",t,e,r),this.distance=i,this.unit=n}}class DC extends MC{constructor(t,e,i){super("Disjoint",t,e,i)}}class NC extends PC{constructor(t,e){super(t),this.propertyName=e}}class kC extends NC{constructor(t,e,i){super("During",t),this.begin=e,this.end=i}}class GC extends NC{constructor(t,e,i,n){super(t,e),this.expression=i,this.matchCase=n}}class jC extends GC{constructor(t,e,i){super("PropertyIsEqualTo",t,e,i)}}class UC extends GC{constructor(t,e){super("PropertyIsGreaterThan",t,e)}}class BC extends GC{constructor(t,e){super("PropertyIsGreaterThanOrEqualTo",t,e)}}class zC extends MC{constructor(t,e,i){super("Intersects",t,e,i)}}class XC extends NC{constructor(t,e,i){super("PropertyIsBetween",t),this.lowerBoundary=e,this.upperBoundary=i}}class VC extends NC{constructor(t,e,i,n,r,s){super("PropertyIsLike",t),this.pattern=e,this.wildCard=void 0!==i?i:"*",this.singleChar=void 0!==n?n:".",this.escapeChar=void 0!==r?r:"!",this.matchCase=s}}class $C extends NC{constructor(t){super("PropertyIsNull",t)}}class WC extends GC{constructor(t,e){super("PropertyIsLessThan",t,e)}}class ZC extends GC{constructor(t,e){super("PropertyIsLessThanOrEqualTo",t,e)}}class YC extends PC{constructor(t){super("Not"),this.condition=t}}class HC extends GC{constructor(t,e,i){super("PropertyIsNotEqualTo",t,e,i)}}class KC extends IC{constructor(t){super("Or",Array.prototype.slice.call(arguments))}}class qC extends PC{constructor(t){super("ResourceId"),this.rid=t}}class JC extends MC{constructor(t,e,i){super("Within",t,e,i)}}function QC(t){const e=[null].concat(Array.prototype.slice.call(arguments));return new(Function.prototype.bind.apply(FC,e))}function tb(t,e,i){return new LC(t,e,i)}const eb={"http://www.opengis.net/gml":{boundedBy:pp(cS.prototype.readExtentElement,"bounds")},"http://www.opengis.net/wfs/2.0":{member:dp(cS.prototype.readFeaturesInternal)}},ib={"http://www.opengis.net/wfs":{totalInserted:pp(_S),totalUpdated:pp(_S),totalDeleted:pp(_S)},"http://www.opengis.net/wfs/2.0":{totalInserted:pp(_S),totalUpdated:pp(_S),totalDeleted:pp(_S)}},nb={"http://www.opengis.net/wfs":{TransactionSummary:pp(fb,"transactionSummary"),InsertResults:pp(yb,"insertIds")},"http://www.opengis.net/wfs/2.0":{TransactionSummary:pp(fb,"transactionSummary"),InsertResults:pp(yb,"insertIds")}},rb={"http://www.opengis.net/wfs":{PropertyName:_p(RS)},"http://www.opengis.net/wfs/2.0":{PropertyName:_p(RS)}},sb={"http://www.opengis.net/wfs":{Insert:_p(xb),Update:_p(wb),Delete:_p(Eb),Property:_p(Tb),Native:_p(Cb)},"http://www.opengis.net/wfs/2.0":{Insert:_p(xb),Update:_p(wb),Delete:_p(Eb),Property:_p(Tb),Native:_p(Cb)}},ob="feature",ab="http://www.w3.org/2000/xmlns/",lb={"2.0.0":"http://www.opengis.net/ogc/1.1","1.1.0":"http://www.opengis.net/ogc","1.0.0":"http://www.opengis.net/ogc"},hb={"2.0.0":"http://www.opengis.net/wfs/2.0","1.1.0":"http://www.opengis.net/wfs","1.0.0":"http://www.opengis.net/wfs"},cb={"2.0.0":"http://www.opengis.net/fes/2.0","1.1.0":"http://www.opengis.net/fes","1.0.0":"http://www.opengis.net/fes"},ub={"2.0.0":"http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd","1.1.0":"http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd","1.0.0":"http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/wfs.xsd"},db={"2.0.0":DS,"1.1.0":AS,"1.0.0":FS};function gb(t,e,i,n){Cp(n,sb,yp(t),e,i)}function fb(t,e){return wp({},ib,t,e)}const pb={"http://www.opengis.net/ogc":{FeatureId:dp((function(t,e){return t.getAttribute("fid")}))},"http://www.opengis.net/ogc/1.1":{FeatureId:dp((function(t,e){return t.getAttribute("fid")}))}};function _b(t,e){Ep(pb,t,e)}const mb={"http://www.opengis.net/wfs":{Feature:_b},"http://www.opengis.net/wfs/2.0":{Feature:_b}};function yb(t,e){return wp([],mb,t,e)}function xb(t,e,i){const n=i[i.length-1],r=n.featureType,s=n.featureNS,o=n.gmlVersion,a=sp(s,r);t.appendChild(a),2===o?FS.prototype.writeFeatureElement(a,e,i):3===o?AS.prototype.writeFeatureElement(a,e,i):DS.prototype.writeFeatureElement(a,e,i)}function vb(t,e,i){const n=i[i.length-1].version,r=lb[n],s=sp(r,"Filter"),o=sp(r,"FeatureId");s.appendChild(o),o.setAttribute("fid",e),t.appendChild(s)}function Sb(t,e){const i=(t=t||ob)+":";return e.startsWith(i)?e:i+e}function Eb(t,e,i){const n=i[i.length-1];Mt(void 0!==e.getId(),"Features must have an id set");const r=n.featureType,s=n.featurePrefix,o=n.featureNS,a=Sb(s,r);t.setAttribute("typeName",a),t.setAttributeNS(ab,"xmlns:"+s,o);const l=e.getId();void 0!==l&&vb(t,l,i)}function wb(t,e,i){const n=i[i.length-1];Mt(void 0!==e.getId(),"Features must have an id set");const r=n.version,s=n.featureType,o=n.featurePrefix,a=n.featureNS,l=Sb(o,s),h=e.getGeometryName();t.setAttribute("typeName",l),t.setAttributeNS(ab,"xmlns:"+o,a);const c=e.getId();if(void 0!==c){const s=e.getKeys(),o=[];for(let t=0,i=s.length;t0,i=this.readUint32(e),n=Math.floor((268435455&i)/1e3),r=Boolean(2147483648&i)||1===n||3===n,s=Boolean(1073741824&i)||2===n||3===n,o=Boolean(536870912&i),a=(268435455&i)%1e3,l=["XY",r?"Z":"",s?"M":""].join(""),h=o?this.readUint32(e):null;if(void 0!==t&&t!==a)throw new Error("Unexpected WKB geometry type "+a);if(this.initialized_){if(this.isLittleEndian_!==e)throw new Error("Inconsistent endian");if(this.layout_!==l)throw new Error("Inconsistent geometry layout");if(h&&this.srid_!==h)throw new Error("Inconsistent coordinate system (SRID)")}else this.isLittleEndian_=e,this.hasZ_=r,this.hasM_=s,this.layout_=l,this.srid_=h,this.initialized_=!0;return a}readWkbPayload(t){switch(t){case $b:return this.readPoint();case Wb:return this.readLineString();case Zb:case tR:return this.readPolygon();case Yb:return this.readMultiPoint();case Hb:return this.readMultiLineString();case Kb:case Jb:case Qb:return this.readMultiPolygon();case qb:return this.readGeometryCollection();default:throw new Error("Unsupported WKB geometry type "+t+" is found")}}readWkbBlock(t){return this.readWkbPayload(this.readWkbHeader(t))}readWkbCollection(t,e){const i=this.readUint32(),n=[];for(let r=0;r({[e]:t[i]}))));for(const t of this.layout_)this.writeDouble(t in i?i[t]:this.nodata_[t])}writeLineString(t,e){this.writeUint32(t.length);for(let i=0;it+e[0]),0),e=new ArrayBuffer(t),i=new DataView(e);let n=0;return this.writeQueue_.forEach((t=>{switch(t[0]){case 1:i.setUint8(n,t[1]);break;case 4:i.setUint32(n,t[1],this.isLittleEndian_);break;case 8:i.setFloat64(n,t[1],this.isLittleEndian_)}n+=t[0]})),e}}function nR(t){return"string"==typeof t?function(t){const e=new Uint8Array(t.length/2);for(let i=0;i="a"&&t<="z"||t>="A"&&t<="Z"}isNumeric_(t,e){return e=void 0!==e&&e,t>="0"&&t<="9"||"."==t&&!e}isWhiteSpace_(t){return" "==t||"\t"==t||"\r"==t||"\n"==t}nextChar_(){return this.wkt.charAt(++this.index_)}nextToken(){const t=this.nextChar_(),e=this.index_;let i,n=t;if("("==t)i=lR;else if(","==t)i=uR;else if(")"==t)i=hR;else if(this.isNumeric_(t)||"-"==t)i=cR,n=this.readNumber_();else if(this.isAlpha_(t))i=aR,n=this.readText_();else{if(this.isWhiteSpace_(t))return this.nextToken();if(""!==t)throw new Error("Unexpected character: "+t);i=dR}return{position:e,value:n,type:i}}readNumber_(){let t;const e=this.index_;let i=!1,n=!1;do{"."==t?i=!0:"e"!=t&&"E"!=t||(n=!0),t=this.nextChar_()}while(this.isNumeric_(t,i)||!n&&("e"==t||"E"==t)||n&&("-"==t||"+"==t));return parseFloat(this.wkt.substring(e,this.index_--))}readText_(){let t;const e=this.index_;do{t=this.nextChar_()}while(this.isAlpha_(t));return this.wkt.substring(e,this.index_--).toUpperCase()}}class pR{constructor(t){this.lexer_=t,this.token_={position:0,type:oR},this.layout_="XY"}consume_(){this.token_=this.lexer_.nextToken()}isTokenType(t){return this.token_.type==t}match(t){const e=this.isTokenType(t);return e&&this.consume_(),e}parse(){return this.consume_(),this.parseGeometry_()}parseGeometryLayout_(){let t="XY";const e=this.token_;if(this.isTokenType(aR)){const i=e.value;"Z"===i?t="XYZ":"M"===i?t="XYM":"ZM"===i&&(t="XYZM"),"XY"!==t&&this.consume_()}return t}parseGeometryCollectionText_(){if(this.match(lR)){const t=[];do{t.push(this.parseGeometry_())}while(this.match(uR));if(this.match(hR))return t}throw new Error(this.formatErrorMessage_())}parsePointText_(){if(this.match(lR)){const t=this.parsePoint_();if(this.match(hR))return t}throw new Error(this.formatErrorMessage_())}parseLineStringText_(){if(this.match(lR)){const t=this.parsePointList_();if(this.match(hR))return t}throw new Error(this.formatErrorMessage_())}parsePolygonText_(){if(this.match(lR)){const t=this.parseLineStringTextList_();if(this.match(hR))return t}throw new Error(this.formatErrorMessage_())}parseMultiPointText_(){if(this.match(lR)){let t;if(t=this.token_.type==lR?this.parsePointTextList_():this.parsePointList_(),this.match(hR))return t}throw new Error(this.formatErrorMessage_())}parseMultiLineStringText_(){if(this.match(lR)){const t=this.parseLineStringTextList_();if(this.match(hR))return t}throw new Error(this.formatErrorMessage_())}parseMultiPolygonText_(){if(this.match(lR)){const t=this.parsePolygonTextList_();if(this.match(hR))return t}throw new Error(this.formatErrorMessage_())}parsePoint_(){const t=[],e=this.layout_.length;for(let i=0;i0&&(n+=" "+e)}return 0===i.length?n+" "+sR:n+"("+i+")"}const SR=[null,"http://www.opengis.net/wms","http://www.opengis.net/sld"];function ER(t){return Je(t[0].version,"1.3")>=0}const wR=Sp(SR,{Service:pp((function(t,e){return wp({},ER(e)?RR:bR,t,e)})),Capability:pp((function(t,e){return wp({},TR,t,e)}))}),TR=Sp(SR,{Request:pp((function(t,e){return wp({},kR,t,e)})),Exception:pp((function(t,e){return wp([],LR,t,e)})),Layer:pp((function(t,e){const i=wp({},ER(e)?OR:AR,t,e);if(void 0===i.Layer)return Object.assign(i,$R(t,e));return i})),UserDefinedSymbolization:pp((function(t,e){return{SupportSLD:!!dS(t.getAttribute("SupportSLD")),UserLayer:!!dS(t.getAttribute("UserLayer")),UserStyle:!!dS(t.getAttribute("UserStyle")),RemoteWFS:!!dS(t.getAttribute("RemoteWFS")),InlineFeatureData:!!dS(t.getAttribute("InlineFeatureData")),RemoteWCS:!!dS(t.getAttribute("RemoteWCS"))}}))});const CR={Name:pp(yS),Title:pp(yS),Abstract:pp(yS),KeywordList:pp(HR),OnlineResource:pp(JT),ContactInformation:pp((function(t,e){return wp({},PR,t,e)})),Fees:pp(yS),AccessConstraints:pp(yS)},bR=Sp(SR,CR),RR=Sp(SR,{...CR,LayerLimit:pp(_S),MaxWidth:pp(_S),MaxHeight:pp(_S)}),PR=Sp(SR,{ContactPersonPrimary:pp((function(t,e){return wp({},IR,t,e)})),ContactPosition:pp(yS),ContactAddress:pp((function(t,e){return wp({},FR,t,e)})),ContactVoiceTelephone:pp(yS),ContactFacsimileTelephone:pp(yS),ContactElectronicMailAddress:pp(yS)}),IR=Sp(SR,{ContactPerson:pp(yS),ContactOrganization:pp(yS)}),FR=Sp(SR,{AddressType:pp(yS),Address:pp(yS),City:pp(yS),StateOrProvince:pp(yS),PostCode:pp(yS),Country:pp(yS)}),LR=Sp(SR,{Format:dp(yS)}),MR={Name:pp(yS),Title:pp(yS),Abstract:pp(yS),KeywordList:pp(HR),BoundingBox:fp(VR),Dimension:fp((function(t,e){const i={name:t.getAttribute("name"),units:t.getAttribute("units"),unitSymbol:t.getAttribute("unitSymbol")};ER(e)&&Object.assign(i,{default:t.getAttribute("default"),multipleValues:dS(t.getAttribute("multipleValues")),nearestValue:dS(t.getAttribute("nearestValue")),current:dS(t.getAttribute("current")),values:yS(t)});return i})),Attribution:pp((function(t,e){return wp({},DR,t,e)})),AuthorityURL:fp((function(t,e){const i=WR(t,e);if(i)return i.name=t.getAttribute("name"),i;return})),Identifier:fp(yS),MetadataURL:fp((function(t,e){const i=WR(t,e);if(i)return i.type=t.getAttribute("type"),i;return})),DataURL:fp(WR),FeatureListURL:fp(WR),Style:fp((function(t,e){return wp({},BR,t,e)})),Layer:fp($R)},AR=Sp(SR,{...MR,SRS:fp(yS),Extent:pp((function(t,e){return{name:t.getAttribute("name"),default:t.getAttribute("default"),nearestValue:dS(t.getAttribute("nearestValue"))}})),ScaleHint:fp((function(t,e){return{min:pS(t.getAttribute("min")),max:pS(t.getAttribute("max"))}})),LatLonBoundingBox:pp(((t,e)=>VR(t,e,!1))),Layer:fp($R)}),OR=Sp(SR,{...MR,CRS:fp(yS),EX_GeographicBoundingBox:pp((function(t,e){const i=wp({},NR,t,e);if(!i)return;const n=i.westBoundLongitude,r=i.southBoundLatitude,s=i.eastBoundLongitude,o=i.northBoundLatitude;if(void 0===n||void 0===r||void 0===s||void 0===o)return;return[n,r,s,o]})),MinScaleDenominator:pp(fS),MaxScaleDenominator:pp(fS),Layer:fp($R)}),DR=Sp(SR,{Title:pp(yS),OnlineResource:pp(JT),LogoURL:pp(YR)}),NR=Sp(SR,{westBoundLongitude:pp(fS),eastBoundLongitude:pp(fS),southBoundLatitude:pp(fS),northBoundLatitude:pp(fS)}),kR=Sp(SR,{GetCapabilities:pp(ZR),GetMap:pp(ZR),GetFeatureInfo:pp(ZR),DescribeLayer:pp(ZR),GetLegendGraphic:pp(ZR)}),GR=Sp(SR,{Format:fp(yS),DCPType:fp((function(t,e){return wp({},jR,t,e)}))}),jR=Sp(SR,{HTTP:pp((function(t,e){return wp({},UR,t,e)}))}),UR=Sp(SR,{Get:pp(WR),Post:pp(WR)}),BR=Sp(SR,{Name:pp(yS),Title:pp(yS),Abstract:pp(yS),LegendURL:fp(YR),StyleSheetURL:pp(WR),StyleURL:pp(WR)}),zR=Sp(SR,{Format:pp(yS),OnlineResource:pp(JT)}),XR=Sp(SR,{Keyword:dp(yS)});function VR(t,e,i=!0){const n={extent:[pS(t.getAttribute("minx")),pS(t.getAttribute("miny")),pS(t.getAttribute("maxx")),pS(t.getAttribute("maxy"))],res:[pS(t.getAttribute("resx")),pS(t.getAttribute("resy"))]};return i?(ER(e)?n.crs=t.getAttribute("CRS"):n.srs=t.getAttribute("SRS"),n):n}function $R(t,e){const i=ER(e),n=e[e.length-1],r=wp({},i?OR:AR,t,e);if(!r)return;let s=dS(t.getAttribute("queryable"));void 0===s&&(s=n.queryable),r.queryable=void 0!==s&&s;let o=mS(t.getAttribute("cascaded"));void 0===o&&(o=n.cascaded),r.cascaded=o;let a=dS(t.getAttribute("opaque"));void 0===a&&(a=n.opaque),r.opaque=void 0!==a&&a;let l=dS(t.getAttribute("noSubsets"));void 0===l&&(l=n.noSubsets),r.noSubsets=void 0!==l&&l;let h=pS(t.getAttribute("fixedWidth"));h||(h=n.fixedWidth),r.fixedWidth=h;let c=pS(t.getAttribute("fixedHeight"));c||(c=n.fixedHeight),r.fixedHeight=c;const u=["Style","AuthorityURL"];i?u.push("CRS"):u.push("SRS","Dimension"),u.forEach((function(t){if(t in n){const e=r[t]||[];r[t]=e.concat(n[t])}}));const d=["BoundingBox","Attribution"];return i?d.push("Dimension","EX_GeographicBoundingBox","MinScaleDenominator","MaxScaleDenominator"):d.push("LatLonBoundingBox","ScaleHint","Extent"),d.forEach((function(t){if(!(t in r)){const e=n[t];r[t]=e}})),r}function WR(t,e){return wp({},zR,t,e)}function ZR(t,e){return wp({},GR,t,e)}function YR(t,e){const i=WR(t,e);if(i){const e=[mS(t.getAttribute("width")),mS(t.getAttribute("height"))];return i.size=e,i}}function HR(t,e){return wp([],XR,t,e)}const KR=[null,"http://www.opengis.net/wmts/1.0"],qR=[null,"http://www.opengis.net/ows/1.1"],JR=Sp(KR,{Contents:pp((function(t,e){return wp({},QR,t,e)}))});const QR=Sp(KR,{Layer:fp((function(t,e){return wp({},tP,t,e)})),TileMatrixSet:fp((function(t,e){return wp({},aP,t,e)}))}),tP=Sp(KR,{Style:fp((function(t,e){const i=wp({},eP,t,e);if(!i)return;const n="true"===t.getAttribute("isDefault");return i.isDefault=n,i})),Format:fp(yS),TileMatrixSetLink:fp((function(t,e){return wp({},iP,t,e)})),Dimension:fp((function(t,e){return wp({},sP,t,e)})),ResourceURL:fp((function(t,e){const i=t.getAttribute("format"),n=t.getAttribute("template"),r=t.getAttribute("resourceType"),s={};i&&(s.format=i);n&&(s.template=n);r&&(s.resourceType=r);return s}))},Sp(qR,{Title:pp(yS),Abstract:pp(yS),WGS84BoundingBox:pp(hP),BoundingBox:fp((function(t,e){const i=t.getAttribute("crs"),n=wp([],oP,t,e);if(2!=n.length)return;return{extent:Bt(n),crs:i}})),Identifier:pp(yS)})),eP=Sp(KR,{LegendURL:fp((function(t,e){const i={};return i.format=t.getAttribute("format"),i.href=JT(t),i}))},Sp(qR,{Title:pp(yS),Identifier:pp(yS)})),iP=Sp(KR,{TileMatrixSet:pp(yS),TileMatrixSetLimits:pp((function(t,e){return wp([],nP,t,e)}))}),nP=Sp(KR,{TileMatrixLimits:dp((function(t,e){return wp({},rP,t,e)}))}),rP=Sp(KR,{TileMatrix:pp(yS),MinTileRow:pp(_S),MaxTileRow:pp(_S),MinTileCol:pp(_S),MaxTileCol:pp(_S)}),sP=Sp(KR,{Default:pp(yS),Value:fp(yS)},Sp(qR,{Identifier:pp(yS)})),oP=Sp(qR,{LowerCorner:dp(cP),UpperCorner:dp(cP)}),aP=Sp(KR,{WellKnownScaleSet:pp(yS),TileMatrix:fp((function(t,e){return wp({},lP,t,e)}))},Sp(qR,{SupportedCRS:pp(yS),Identifier:pp(yS),BoundingBox:pp(hP)})),lP=Sp(KR,{TopLeftCorner:pp(cP),ScaleDenominator:pp(fS),TileWidth:pp(_S),TileHeight:pp(_S),MatrixWidth:pp(_S),MatrixHeight:pp(_S)},Sp(qR,{Identifier:pp(yS)}));function hP(t,e){const i=wp([],oP,t,e);if(2==i.length)return Bt(i)}function cP(t,e){const i=yS(t).split(/\s+/);if(!i||2!=i.length)return;const n=+i[0],r=+i[1];return isNaN(n)||isNaN(r)?void 0:[n,r]}const uP=["fullscreenchange","webkitfullscreenchange"],dP="enterfullscreen",gP="leavefullscreen";function fP(t){const e=t.body;return!!(e.webkitRequestFullscreen||e.requestFullscreen&&t.fullscreenEnabled)}function pP(t){return!(!t.webkitIsFullScreen&&!t.fullscreenElement)}function _P(t){t.requestFullscreen?t.requestFullscreen():t.webkitRequestFullscreen&&t.webkitRequestFullscreen()}const mP="projection",yP="coordinateFormat";const xP=.75,vP=.1;const SP="units",EP=[1,2,5],wP=25.4/.28;const TP=0,CP=1;var bP={};return bP.Collection=Z,bP.Collection.CollectionEvent=W,bP.DataTile=Lt,bP.DataTile.asArrayLike=bt,bP.DataTile.asImageLike=Ct,bP.DataTile.disposedError=Rt,bP.DataTile.toArray=It,bP.Disposable=_,bP.Feature=At,bP.Feature.createStyleFunction=Ot,bP.Geolocation=class extends V{constructor(t){super(),this.on,this.once,this.un,t=t||{},this.position_=null,this.transform_=xn,this.watchId_=void 0,this.addChangeListener(Ts,this.handleProjectionChanged_),this.addChangeListener(bs,this.handleTrackingChanged_),void 0!==t.projection&&this.setProjection(t.projection),void 0!==t.trackingOptions&&this.setTrackingOptions(t.trackingOptions),this.setTracking(void 0!==t.tracking&&t.tracking)}disposeInternal(){this.setTracking(!1),super.disposeInternal()}handleProjectionChanged_(){const t=this.getProjection();t&&(this.transform_=Ln(En("EPSG:4326"),t),this.position_&&this.set(ws,this.transform_(this.position_)))}handleTrackingChanged_(){if("geolocation"in navigator){const t=this.getTracking();t&&void 0===this.watchId_?this.watchId_=navigator.geolocation.watchPosition(this.positionChange_.bind(this),this.positionError_.bind(this),this.getTrackingOptions()):t||void 0===this.watchId_||(navigator.geolocation.clearWatch(this.watchId_),this.watchId_=void 0)}}positionChange_(t){const e=t.coords;this.set(ys,e.accuracy),this.set(vs,null===e.altitude?void 0:e.altitude),this.set(Ss,null===e.altitudeAccuracy?void 0:e.altitudeAccuracy),this.set(Es,null===e.heading?void 0:Oe(e.heading)),this.position_?(this.position_[0]=e.longitude,this.position_[1]=e.latitude):this.position_=[e.longitude,e.latitude];const i=this.transform_(this.position_);this.set(ws,i.slice()),this.set(Cs,null===e.speed?void 0:e.speed);const n=fs(this.position_,e.accuracy);n.applyTransform(this.transform_),this.set(xs,n),this.changed()}positionError_(t){this.dispatchEvent(new Is(t))}getAccuracy(){return this.get(ys)}getAccuracyGeometry(){return this.get(xs)||null}getAltitude(){return this.get(vs)}getAltitudeAccuracy(){return this.get(Ss)}getHeading(){return this.get(Es)}getPosition(){return this.get(ws)}getProjection(){return this.get(Ts)}getSpeed(){return this.get(Cs)}getTracking(){return this.get(bs)}getTrackingOptions(){return this.get(Rs)}setProjection(t){this.set(Ts,En(t))}setTracking(t){this.set(bs,t)}setTrackingOptions(t){this.set(Rs,t)}},bP.Geolocation.GeolocationError=Is,bP.Image=Ds,bP.Image.decode=js,bP.Image.decodeFallback=Gs,bP.Image.listenImage=Ns,bP.Image.load=ks,bP.ImageCanvas=Us,bP.ImageTile=Bs,bP.Kinetic=zs,bP.Map=Hc,bP.MapBrowserEvent=Vs,bP.MapBrowserEventHandler=Ks,bP.MapEvent=Xs,bP.Object=V,bP.Object.ObjectEvent=X,bP.Observable=G,bP.Observable.unByKey=j,bP.Overlay=eu,bP.Tile=nt,bP.TileQueue=lo,bP.TileQueue.getTilePriority=ho,bP.TileRange=iu,bP.TileRange.createOrUpdate=nu,bP.VectorRenderTile=su,bP.VectorTile=au,bP.View=bo,bP.View.createCenterConstraint=Po,bP.View.createResolutionConstraint=Io,bP.View.createRotationConstraint=Fo,bP.View.getView=async function(t,...e){let i=await t.getView();for(const t of e)i=t(i);return i},bP.View.isNoopAnimation=Lo,bP.View.withExtentCenter=function(){return function(t){if(!t.extent)return t;const e=de(t.extent),i={...t,center:e};return delete i.extent,i}},bP.View.withHigherResolutions=function(t){return function(e){if(!e.resolutions)return e;const i=[...e.resolutions],n=i[i.length-1];for(let e=0;e-1;return n&&t.splice(i,1),n},bP.array.reverseSubArray=S,bP.array.stableSort=function(t,e){const i=t.length,n=Array(t.length);let r;for(r=0;rZe.info||console.log(...t)},bP.console.setLevel=function(t){Ye=Ze[t]},bP.console.warn=He,bP.control={},bP.control.Attribution=Vo,bP.control.Control=Xo,bP.control.FullScreen=class extends Xo{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target}),this.on,this.once,this.un,this.keys_=void 0!==t.keys&&t.keys,this.source_=t.source,this.isInFullscreen_=!1,this.boundHandleMapTargetChange_=this.handleMapTargetChange_.bind(this),this.cssClassName_=void 0!==t.className?t.className:"ol-full-screen",this.documentListeners_=[],this.activeClassName_=void 0!==t.activeClassName?t.activeClassName.split(" "):[this.cssClassName_+"-true"],this.inactiveClassName_=void 0!==t.inactiveClassName?t.inactiveClassName.split(" "):[this.cssClassName_+"-false"];const e=void 0!==t.label?t.label:"⤢";this.labelNode_="string"==typeof e?document.createTextNode(e):e;const i=void 0!==t.labelActive?t.labelActive:"×";this.labelActiveNode_="string"==typeof i?document.createTextNode(i):i;const n=t.tipLabel?t.tipLabel:"Toggle full-screen";this.button_=document.createElement("button"),this.button_.title=n,this.button_.setAttribute("type","button"),this.button_.appendChild(this.labelNode_),this.button_.addEventListener(o,this.handleClick_.bind(this),!1),this.setClassName_(this.button_,this.isInFullscreen_),this.element.className=`${this.cssClassName_} ${Do} ${ko}`,this.element.appendChild(this.button_)}handleClick_(t){t.preventDefault(),this.handleFullScreen_()}handleFullScreen_(){const t=this.getMap();if(!t)return;const e=t.getOwnerDocument();if(fP(e))if(pP(e))!function(t){t.exitFullscreen?t.exitFullscreen():t.webkitExitFullscreen&&t.webkitExitFullscreen()}(e);else{let i;i=this.source_?"string"==typeof this.source_?e.getElementById(this.source_):this.source_:t.getTargetElement(),this.keys_?function(t){t.webkitRequestFullscreen?t.webkitRequestFullscreen():_P(t)}(i):_P(i)}}handleFullScreenChange_(){const t=this.getMap();if(!t)return;const e=this.isInFullscreen_;this.isInFullscreen_=pP(t.getOwnerDocument()),e!==this.isInFullscreen_&&(this.setClassName_(this.button_,this.isInFullscreen_),this.isInFullscreen_?(vt(this.labelActiveNode_,this.labelNode_),this.dispatchEvent(dP)):(vt(this.labelNode_,this.labelActiveNode_),this.dispatchEvent(gP)),t.updateSize())}setClassName_(t,e){e?(t.classList.remove(...this.inactiveClassName_),t.classList.add(...this.activeClassName_)):(t.classList.remove(...this.activeClassName_),t.classList.add(...this.inactiveClassName_))}setMap(t){const e=this.getMap();e&&e.removeChangeListener(ro,this.boundHandleMapTargetChange_),super.setMap(t),this.handleMapTargetChange_(),t&&t.addChangeListener(ro,this.boundHandleMapTargetChange_)}handleMapTargetChange_(){const t=this.documentListeners_;for(let e=0,i=t.length;e{const e=l.getEventCoordinateInternal(t),i=this.getMap();i.getView().setCenterInternal(e);const n=i.getOwnerDocument();n.removeEventListener("pointermove",f),n.removeEventListener("pointerup",p)};this.ovmapDiv_.addEventListener("pointerdown",(t=>{const e=this.getMap().getOwnerDocument();t.target===g&&e.addEventListener("pointermove",f),e.addEventListener("pointerup",p)}))}setMap(t){const e=this.getMap();if(t!==e){if(e){const t=e.getView();t&&this.unbindView_(t),this.ovmap_.setTarget(null)}if(super.setMap(t),t){this.ovmap_.setTarget(this.ovmapDiv_),this.listenerKeys.push(D(t,i,this.handleMapPropertyChange_,this));const e=t.getView();e&&this.bindView_(e),this.ovmap_.isRendered()||this.updateBoxAfterOvmapIsRendered_()}}}handleMapPropertyChange_(t){if(t.key===so){const e=t.oldValue;e&&this.unbindView_(e);const i=this.getMap().getView();this.bindView_(i)}else this.ovmap_.isRendered()||t.key!==ro&&t.key!==no||this.ovmap_.updateSize()}bindView_(t){if(!this.view_){const e=new bo({projection:t.getProjection()});this.ovmap_.setView(e)}t.addChangeListener(go.ROTATION,this.boundHandleRotationChanged_),this.handleRotationChanged_(),t.isDef()&&(this.ovmap_.updateSize(),this.resetExtent_())}unbindView_(t){t.removeChangeListener(go.ROTATION,this.boundHandleRotationChanged_)}handleRotationChanged_(){this.rotateWithView_&&this.ovmap_.getView().setRotation(this.getMap().getView().getRotation())}validateExtent_(){const t=this.getMap(),e=this.ovmap_;if(!t.isRendered()||!e.isRendered())return;const i=t.getSize(),n=t.getView().calculateExtentInternal(i);if(this.viewExtent_&&te(n,this.viewExtent_))return;this.viewExtent_=n;const r=e.getSize(),s=e.getView().calculateExtentInternal(r),o=e.getPixelFromCoordinateInternal(ye(n)),a=e.getPixelFromCoordinateInternal(ue(n)),l=Math.abs(o[0]-a[0]),h=Math.abs(o[1]-a[1]),c=r[0],u=r[1];lc*xP||h>u*xP?this.resetExtent_():Wt(s,n)||this.recenter_()}resetExtent_(){const t=this.getMap(),e=this.ovmap_,i=t.getSize(),n=t.getView().calculateExtentInternal(i),r=e.getView(),s=Math.log(7.5)/Math.LN2;Te(n,1/(Math.pow(2,s/2)*vP)),r.fitInternal(ps(n))}recenter_(){const t=this.getMap(),e=this.ovmap_,i=t.getView();e.getView().setCenterInternal(i.getCenterInternal())}updateBox_(){const t=this.getMap(),e=this.ovmap_;if(!t.isRendered()||!e.isRendered())return;const i=t.getSize(),n=t.getView(),r=e.getView(),s=this.rotateWithView_?0:-n.getRotation(),o=this.boxOverlay_,a=this.boxOverlay_.getElement(),l=n.getCenter(),h=n.getResolution(),c=r.getResolution(),u=i[0]*h/c,d=i[1]*h/c;if(o.setPosition(l),a){a.style.width=u+"px",a.style.height=d+"px";const t="rotate("+s+"rad)";a.style.transform=t}}updateBoxAfterOvmapIsRendered_(){this.ovmapPostrenderKey_||(this.ovmapPostrenderKey_=N(this.ovmap_,qs,(t=>{delete this.ovmapPostrenderKey_,this.updateBox_()})))}handleClick_(t){t.preventDefault(),this.handleToggle_()}handleToggle_(){this.element.classList.toggle(Go),this.collapsed_?vt(this.collapseLabel_,this.label_):vt(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_;const t=this.ovmap_;if(!this.collapsed_){if(t.isRendered())return this.viewExtent_=void 0,void t.render();t.updateSize(),this.resetExtent_(),this.updateBoxAfterOvmapIsRendered_()}}getCollapsible(){return this.collapsible_}setCollapsible(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),!t&&this.collapsed_&&this.handleToggle_())}setCollapsed(t){this.collapsible_&&this.collapsed_!==t&&this.handleToggle_()}getCollapsed(){return this.collapsed_}getRotateWithView(){return this.rotateWithView_}setRotateWithView(t){this.rotateWithView_!==t&&(this.rotateWithView_=t,0!==this.getMap().getView().getRotation()&&(this.rotateWithView_?this.handleRotationChanged_():this.ovmap_.getView().setRotation(0),this.viewExtent_=void 0,this.validateExtent_(),this.updateBox_()))}getOverviewMap(){return this.ovmap_}render(t){this.validateExtent_(),this.updateBox_()}},bP.control.Rotate=$o,bP.control.ScaleLine=class extends Xo{constructor(t){t=t||{};const e=document.createElement("div");e.style.pointerEvents="none",super({element:e,render:t.render,target:t.target}),this.on,this.once,this.un;const i=void 0!==t.className?t.className:t.bar?"ol-scale-bar":"ol-scale-line";this.innerElement_=document.createElement("div"),this.innerElement_.className=i+"-inner",this.element.className=i+" "+Do,this.element.appendChild(this.innerElement_),this.viewState_=null,this.minWidth_=void 0!==t.minWidth?t.minWidth:64,this.maxWidth_=t.maxWidth,this.renderedVisible_=!1,this.renderedWidth_=void 0,this.renderedHTML_="",this.addChangeListener(SP,this.handleUnitsChanged_),this.setUnits(t.units||"metric"),this.scaleBar_=t.bar||!1,this.scaleBarSteps_=t.steps||4,this.scaleBarText_=t.text||!1,this.dpi_=t.dpi||void 0}getUnits(){return this.get(SP)}handleUnitsChanged_(){this.updateElement_()}setUnits(t){this.set(SP,t)}setDpi(t){this.dpi_=t}updateElement_(){const t=this.viewState_;if(!t)return void(this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1));const e=t.center,i=t.projection,n=this.getUnits(),r="degrees"==n?"degrees":"m";let s=wn(i,t.resolution,e,r);const o=this.minWidth_*(this.dpi_||wP)/wP,a=void 0!==this.maxWidth_?this.maxWidth_*(this.dpi_||wP)/wP:void 0;let l=o*s,h="";if("degrees"==n){const t=_i.degrees;l*=t,l=a){c=_,u=g,d=f;break}if(u>=o)break;_=c,g=u,f=d,++p}const m=this.scaleBar_?this.createScaleBar(u,c,h):c.toFixed(d<0?-d:0)+" "+h;this.renderedHTML_!=m&&(this.innerElement_.innerHTML=m,this.renderedHTML_=m),this.renderedWidth_!=u&&(this.innerElement_.style.width=u+"px",this.renderedWidth_=u),this.renderedVisible_||(this.element.style.display="",this.renderedVisible_=!0)}createScaleBar(t,e,i){const n=this.getScaleForResolution(),r=n<1?Math.round(1/n).toLocaleString()+" : 1":"1 : "+Math.round(n).toLocaleString(),s=this.scaleBarSteps_,o=t/s,a=[this.createMarker("absolute")];for(let n=0;n
`+this.createMarker("relative")+(n%2==0||2===s?this.createStepText(n,t,!1,e,i):"")+"
")}a.push(this.createStepText(s,t,!0,e,i));return(this.scaleBarText_?`
`+r+"
":"")+a.join("")}createMarker(t){return`
`}createStepText(t,e,i,n,r){const s=(0===t?0:Math.round(n/this.scaleBarSteps_*t*100)/100)+(0===t?"":" "+r);return`
`+s+"
"}getScaleForResolution(){return wn(this.viewState_.projection,this.viewState_.resolution,this.viewState_.center,"m")*(1e3/25.4)*(this.dpi_||wP)}render(t){const e=t.frameState;this.viewState_=e?e.viewState:null,this.updateElement_()}},bP.control.Zoom=Wo,bP.control.ZoomSlider=class extends Xo{constructor(t){super({target:(t=t||{}).target,element:document.createElement("div"),render:t.render}),this.dragListenerKeys_=[],this.currentResolution_=void 0,this.direction_=TP,this.dragging_,this.heightLimit_=0,this.widthLimit_=0,this.startX_,this.startY_,this.thumbSize_=null,this.sliderInitialized_=!1,this.duration_=void 0!==t.duration?t.duration:200;const e=void 0!==t.className?t.className:"ol-zoomslider",i=document.createElement("button");i.setAttribute("type","button"),i.className=e+"-thumb "+Do;const n=this.element;n.className=e+" "+Do+" "+ko,n.appendChild(i),n.addEventListener(Zs,this.handleDraggerStart_.bind(this),!1),n.addEventListener(Ws,this.handleDraggerDrag_.bind(this),!1),n.addEventListener(Ys,this.handleDraggerEnd_.bind(this),!1),n.addEventListener(o,this.handleContainerClick_.bind(this),!1),i.addEventListener(o,A,!1)}setMap(t){super.setMap(t),t&&t.render()}initSlider_(){const t=this.element;let e=t.offsetWidth,i=t.offsetHeight;if(0===e&&0===i)return this.sliderInitialized_=!1;const n=getComputedStyle(t);e-=parseFloat(n.paddingRight)+parseFloat(n.paddingLeft),i-=parseFloat(n.paddingTop)+parseFloat(n.paddingBottom);const r=t.firstElementChild,s=getComputedStyle(r),o=r.offsetWidth+parseFloat(s.marginRight)+parseFloat(s.marginLeft),a=r.offsetHeight+parseFloat(s.marginTop)+parseFloat(s.marginBottom);return this.thumbSize_=[o,a],e>i?(this.direction_=CP,this.widthLimit_=e-o):(this.direction_=TP,this.heightLimit_=i-a),this.sliderInitialized_=!0}handleContainerClick_(t){const e=this.getMap().getView(),i=this.getRelativePosition_(t.offsetX-this.thumbSize_[0]/2,t.offsetY-this.thumbSize_[1]/2),n=this.getResolutionForPosition_(i),r=e.getConstrainedZoom(e.getZoomForResolution(n));e.animateInternal({zoom:r,duration:this.duration_,easing:tt})}handleDraggerStart_(t){if(!this.dragging_&&t.target===this.element.firstElementChild){const e=this.element.firstElementChild;if(this.getMap().getView().beginInteraction(),this.startX_=t.clientX-parseFloat(e.style.left),this.startY_=t.clientY-parseFloat(e.style.top),this.dragging_=!0,0===this.dragListenerKeys_.length){const t=this.handleDraggerDrag_,e=this.handleDraggerEnd_,i=this.getMap().getOwnerDocument();this.dragListenerKeys_.push(D(i,Ws,t,this),D(i,Ys,e,this))}}}handleDraggerDrag_(t){if(this.dragging_){const e=t.clientX-this.startX_,i=t.clientY-this.startY_,n=this.getRelativePosition_(e,i);this.currentResolution_=this.getResolutionForPosition_(n),this.getMap().getView().setResolution(this.currentResolution_)}}handleDraggerEnd_(t){if(this.dragging_){this.getMap().getView().endInteraction(),this.dragging_=!1,this.startX_=void 0,this.startY_=void 0,this.dragListenerKeys_.forEach(k),this.dragListenerKeys_.length=0}}setThumbPosition_(t){const e=this.getPositionForResolution_(t),i=this.element.firstElementChild;this.direction_==CP?i.style.left=this.widthLimit_*e+"px":i.style.top=this.heightLimit_*e+"px"}getRelativePosition_(t,e){let i;return i=this.direction_===CP?t/this.widthLimit_:e/this.heightLimit_,Ie(i,0,1)}getResolutionForPosition_(t){return this.getMap().getView().getResolutionForValueFunction()(1-t)}getPositionForResolution_(t){return Ie(1-this.getMap().getView().getValueForResolutionFunction()(t),0,1)}render(t){if(!t.frameState)return;if(!this.sliderInitialized_&&!this.initSlider_())return;const e=t.frameState.viewState.resolution;this.currentResolution_=e,this.setThumbPosition_(e)}},bP.control.ZoomToExtent=class extends Xo{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target}),this.extent=t.extent?t.extent:null,this.fitOptions=t.fitOptions||{};const e=void 0!==t.className?t.className:"ol-zoom-extent",i=void 0!==t.label?t.label:"E",n=void 0!==t.tipLabel?t.tipLabel:"Fit to extent",r=document.createElement("button");r.setAttribute("type","button"),r.title=n,r.appendChild("string"==typeof i?document.createTextNode(i):i),r.addEventListener(o,this.handleClick_.bind(this),!1);const s=e+" "+Do+" "+ko,a=this.element;a.className=s,a.appendChild(r)}handleClick_(t){t.preventDefault(),this.handleZoomToExtent()}handleZoomToExtent(){const t=this.getMap().getView(),e=this.extent?zn(this.extent,t.getProjection()):t.getProjection().getExtent();t.fitInternal(ps(e),this.fitOptions)}},bP.control.defaults={},bP.control.defaults.defaults=Zo,bP.coordinate={},bP.coordinate.add=Qe,bP.coordinate.angleBetween=gi,bP.coordinate.closestOnCircle=ti,bP.coordinate.closestOnSegment=ei,bP.coordinate.createStringXY=function(t){return function(e){return ci(e,t)}},bP.coordinate.degreesToStringHDMS=ii,bP.coordinate.distance=li,bP.coordinate.equals=ri,bP.coordinate.format=ni,bP.coordinate.getWorldsAway=di,bP.coordinate.rotate=si,bP.coordinate.scale=oi,bP.coordinate.squaredDistance=ai,bP.coordinate.squaredDistanceToSegment=hi,bP.coordinate.toStringHDMS=function(t,e){return t?ii("NS",t[1],e)+" "+ii("EW",t[0],e):""},bP.coordinate.toStringXY=ci,bP.coordinate.wrapX=ui,bP.css={},bP.css.CLASS_COLLAPSED=Go,bP.css.CLASS_CONTROL=ko,bP.css.CLASS_HIDDEN=Ao,bP.css.CLASS_SELECTABLE=Oo,bP.css.CLASS_UNSELECTABLE=Do,bP.css.CLASS_UNSUPPORTED=No,bP.css.fontWeights=Bo,bP.css.getFontParameters=zo,bP.dom={},bP.dom.createCanvasContext2D=ft,bP.dom.createMockDiv=wt,bP.dom.getSharedCanvasContext2D=_t,bP.dom.isCanvas=Tt,bP.dom.outerHeight=xt,bP.dom.outerWidth=yt,bP.dom.releaseCanvas=mt,bP.dom.removeChildren=St,bP.dom.replaceChildren=Et,bP.dom.replaceNode=vt,bP.easing={},bP.easing.easeIn=Q,bP.easing.easeOut=tt,bP.easing.inAndOut=et,bP.easing.linear=it,bP.easing.upAndDown=function(t){return t<.5?et(2*t):1-et(2*(t-.5))},bP.events={},bP.events.Event=M,bP.events.Event.preventDefault=function(t){t.preventDefault()},bP.events.Event.stopPropagation=A,bP.events.SnapEvent={},bP.events.SnapEvent.SnapEvent=Nv,bP.events.Target=O,bP.events.condition={},bP.events.condition.all=Qo,bP.events.condition.altKeyOnly=ta,bP.events.condition.altShiftKeysOnly=ea,bP.events.condition.always=ra,bP.events.condition.click=function(t){return t.type==$s.CLICK},bP.events.condition.doubleClick=function(t){return t.type==$s.DBLCLICK},bP.events.condition.focus=ia,bP.events.condition.focusWithTabindex=na,bP.events.condition.mouseActionButton=sa,bP.events.condition.mouseOnly=da,bP.events.condition.never=oa,bP.events.condition.noModifierKeys=la,bP.events.condition.penOnly=function(t){const e=t.originalEvent;return"pointerId"in e&&"pen"===e.pointerType},bP.events.condition.platformModifierKey=ha,bP.events.condition.platformModifierKeyOnly=function(t){const e=t.originalEvent;return!e.altKey&&(lt?e.metaKey:e.ctrlKey)&&!e.shiftKey},bP.events.condition.pointerMove=function(t){return"pointermove"==t.type},bP.events.condition.primaryAction=ga,bP.events.condition.shiftKeyOnly=ca,bP.events.condition.singleClick=aa,bP.events.condition.targetNotEditable=ua,bP.events.condition.touchOnly=function(t){const e=t.originalEvent;return"pointerId"in e&&"touch"===e.pointerType},bP.events.listen=D,bP.events.listenOnce=N,bP.events.unlistenByKey=k,bP.expr={},bP.expr.cpu={},bP.expr.cpu.buildExpression=Eh,bP.expr.cpu.newEvaluationContext=Sh,bP.expr.expression={},bP.expr.expression.AnyType=th,bP.expr.expression.BooleanType=Yl,bP.expr.expression.CallExpression=ah,bP.expr.expression.ColorType=ql,bP.expr.expression.LiteralExpression=oh,bP.expr.expression.NoneType=0,bP.expr.expression.NumberArrayType=Jl,bP.expr.expression.NumberType=Hl,bP.expr.expression.Ops=ch,bP.expr.expression.SizeType=Ql,bP.expr.expression.StringType=Kl,bP.expr.expression.computeGeometryType=vh,bP.expr.expression.includesType=rh,bP.expr.expression.isType=sh,bP.expr.expression.newParsingContext=lh,bP.expr.expression.overlapsType=function(t,e){return!!(t&e)},bP.expr.expression.parse=hh,bP.expr.expression.typeName=nh,bP.expr.gpu={},bP.expr.gpu.FEATURE_ID_PROPERTY_NAME=K_,bP.expr.gpu.GEOMETRY_TYPE_PROPERTY_NAME=q_,bP.expr.gpu.PALETTE_TEXTURE_ARRAY=H_,bP.expr.gpu.UNDEFINED_PROP_VALUE=J_,bP.expr.gpu.arrayToGlsl=j_,bP.expr.gpu.buildExpression=Q_,bP.expr.gpu.colorToGlsl=U_,bP.expr.gpu.getStringNumberEquivalent=V_,bP.expr.gpu.newCompilationContext=Z_,bP.expr.gpu.numberToGlsl=G_,bP.expr.gpu.sizeToGlsl=B_,bP.expr.gpu.stringToGlsl=$_,bP.expr.gpu.uniformNameForVariable=W_,bP.extent={},bP.extent.applyTransform=be,bP.extent.approximatelyEquals=ee,bP.extent.boundingExtent=Bt,bP.extent.buffer=zt,bP.extent.clone=Xt,bP.extent.closestSquaredDistanceXY=Vt,bP.extent.containsCoordinate=$t,bP.extent.containsExtent=Wt,bP.extent.containsXY=Zt,bP.extent.coordinateRelationship=Yt,bP.extent.createEmpty=Ht,bP.extent.createOrUpdate=Kt,bP.extent.createOrUpdateEmpty=qt,bP.extent.createOrUpdateFromCoordinate=Jt,bP.extent.createOrUpdateFromCoordinates=function(t,e){return re(qt(e),t)},bP.extent.createOrUpdateFromFlatCoordinates=Qt,bP.extent.createOrUpdateFromRings=function(t,e){return oe(qt(e),t)},bP.extent.equals=te,bP.extent.extend=ie,bP.extent.extendCoordinate=ne,bP.extent.extendCoordinates=re,bP.extent.extendFlatCoordinates=se,bP.extent.extendRings=oe,bP.extent.extendXY=ae,bP.extent.forEachCorner=le,bP.extent.getArea=he,bP.extent.getBottomLeft=ce,bP.extent.getBottomRight=ue,bP.extent.getCenter=de,bP.extent.getCorner=ge,bP.extent.getEnlargedArea=function(t,e){const i=Math.min(t[0],e[0]),n=Math.min(t[1],e[1]);return(Math.max(t[2],e[2])-i)*(Math.max(t[3],e[3])-n)},bP.extent.getForViewAndSize=fe,bP.extent.getHeight=_e,bP.extent.getIntersection=me,bP.extent.getIntersectionArea=function(t,e){return he(me(t,e))},bP.extent.getMargin=function(t){return ve(t)+_e(t)},bP.extent.getRotatedViewport=pe,bP.extent.getSize=function(t){return[t[2]-t[0],t[3]-t[1]]},bP.extent.getTopLeft=ye,bP.extent.getTopRight=xe,bP.extent.getWidth=ve,bP.extent.intersects=Se,bP.extent.intersectsSegment=Ce,bP.extent.isEmpty=Ee,bP.extent.returnOrUpdate=we,bP.extent.scaleFromCenter=Te,bP.extent.wrapAndSliceX=Pe,bP.extent.wrapX=Re,bP.featureloader={},bP.featureloader.loadFeaturesXhr=hu,bP.featureloader.setWithCredentials=function(t){lu=t},bP.featureloader.xhr=cu,bP.format={},bP.format.EsriJSON=class extends Qv{constructor(t){t=t||{},super(),this.geometryName_=t.geometryName}readFeatureFromObject(t,e,i){const n=t,r=nS(n.geometry,e),s=new At;if(this.geometryName_&&s.setGeometryName(this.geometryName_),s.setGeometry(r),n.attributes){s.setProperties(n.attributes,!0);const t=n.attributes[i];void 0!==t&&s.setId(t)}return s}readFeaturesFromObject(t,e){if(e=e||{},t.features){const i=[],n=t.features;for(let r=0,s=n.length;r0&&"string"==typeof this.imageInfo.profile[0]&&Lg.test(this.imageInfo.profile[0]))return this.imageInfo.profile[0]}}getComplianceLevelFromProfile(t){const e=this.getComplianceLevelEntryFromProfile(t);if(void 0===e)return;const i=e.match(/level[0-2](?:\.json)?$/g);return Array.isArray(i)?i[0].replace(".json",""):void 0}getComplianceLevelSupportedFeatures(){if(void 0===this.imageInfo)return;const t=this.getImageApiVersion(),e=this.getComplianceLevelFromProfile(t);return void 0===e?Ig.none.none:Ig[t][e]}getTileSourceOptions(t){const e=t||{},i=this.getImageApiVersion();if(void 0===i)return;const n=void 0===i?void 0:Ag[i](this);return void 0!==n?{url:n.url,version:i,size:[this.imageInfo.width,this.imageInfo.height],sizes:n.sizes,format:void 0!==e.format&&n.formats.includes(e.format)?e.format:void 0!==n.preferredFormat?n.preferredFormat:"jpg",supports:n.supports,quality:e.quality&&n.qualities.includes(e.quality)?e.quality:n.qualities.includes("native")?"native":"default",resolutions:Array.isArray(n.resolutions)?n.resolutions.sort((function(t,e){return e-t})):void 0,tileSize:n.tileSize}:void 0}},bP.format.JSONFeature=Qv,bP.format.KML=class extends aS{constructor(t){super(),t=t||{},qE||(kE=[255,255,255,1],XE=new sc({color:kE}),GE=[20,2],jE="pixels",UE="pixels",BE=[64,64],zE="https://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png",$E=new ac({anchor:GE,anchorOrigin:"bottom-left",anchorXUnits:jE,anchorYUnits:UE,crossOrigin:"anonymous",rotation:0,scale:JE(BE),size:BE,src:zE}),VE="NO_IMAGE",ZE=new lc({color:kE,width:1}),WE=new lc({color:[51,51,51,1],width:2}),YE=new pc({font:"bold 16px Helvetica",fill:XE,stroke:WE,scale:.8}),HE=new hc({fill:XE,image:$E,text:YE,stroke:ZE,zIndex:0}),qE=[HE]),this.dataProjection=En("EPSG:4326"),this.defaultStyle_=t.defaultStyle?t.defaultStyle:qE,this.extractStyles_=void 0===t.extractStyles||t.extractStyles,this.writeStyles_=void 0===t.writeStyles||t.writeStyles,this.sharedStyles_={},this.showPointNames_=void 0===t.showPointNames||t.showPointNames,this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:"anonymous",this.referrerPolicy_=t.referrerPolicy,this.iconUrlFunction_=t.iconUrlFunction?t.iconUrlFunction:QE,this.supportedMediaTypes=["application/vnd.google-earth.kml+xml"]}readDocumentOrFolder_(t,e){const i=wp([],Sp(PE,{Document:up(this.readDocumentOrFolder_,this),Folder:up(this.readDocumentOrFolder_,this),Placemark:dp(this.readPlacemark_,this),Style:this.readSharedStyle_.bind(this),StyleMap:this.readSharedStyleMap_.bind(this)}),t,e,this);if(i)return i}readPlacemark_(t,e){const i=wp({geometry:null},FE,t,e,this);if(!i)return;const n=new At,r=t.getAttribute("id");null!==r&&n.setId(r);const s=e[0],o=i.geometry;if(o&&Yv(o,!1,s),n.setGeometry(o),delete i.geometry,this.extractStyles_){const t=function(t,e,i,n,r){return function(s,o){let a=r,l="",h=[];if(a){const t=s.getGeometry();if(t)if(t instanceof Md)h=t.getGeometriesArrayRecursive().filter((function(t){const e=t.getType();return"Point"===e||"MultiPoint"===e})),a=h.length>0;else{const e=t.getType();a="Point"===e||"MultiPoint"===e}}a&&(l=s.get("name"),a=a&&!!l,a&&/&[^&]+;/.test(l)&&(KE||(KE=document.createElement("textarea")),KE.innerHTML=l,l=KE.value));let c=i;if(t?c=t:e&&(c=tw(e,i,n)),a){const t=function(t,e){const i=[0,0];let n="start";const r=t.getImage();if(r){const t=r.getSize();if(t&&2==t.length){const e=r.getScaleArray(),s=r.getAnchor();i[0]=e[0]*(t[0]-s[0]),i[1]=e[1]*(t[1]/2-s[1]),n="left"}}let s=t.getText();s?(s=s.clone(),s.setFont(s.getFont()||YE.getFont()),s.setScale(s.getScale()||YE.getScale()),s.setFill(s.getFill()||YE.getFill()),s.setStroke(s.getStroke()||WE)):s=YE.clone();s.setText(e),s.setOffsetX(i[0]),s.setOffsetY(i[1]),s.setTextAlign(n);const o=new hc({image:r,text:s});return o}(c[0],l);if(h.length>0){t.setGeometry(new Md(h));return[t,new hc({geometry:c[0].getGeometry(),image:null,fill:c[0].getFill(),stroke:c[0].getStroke(),text:null})].concat(c.slice(1))}return t}return c}}(i.Style,i.styleUrl,this.defaultStyle_,this.sharedStyles_,this.showPointNames_);n.setStyle(t)}return delete i.Style,n.setProperties(i,!0),n}readSharedStyle_(t,e){const i=t.getAttribute("id");if(null!==i){const n=Iw.call(this,t,e);if(n){let e,r=t.baseURI;if(r&&"about:blank"!=r||(r=window.location.href),r){e=new URL("#"+i,r).href}else e="#"+i;this.sharedStyles_[e]=n}}}readSharedStyleMap_(t,e){const i=t.getAttribute("id");if(null===i)return;const n=aw.call(this,t,e);if(!n)return;let r,s=t.baseURI;if(s&&"about:blank"!=s||(s=window.location.href),s){r=new URL("#"+i,s).href}else r="#"+i;this.sharedStyles_[r]=n}readFeatureFromNode(t,e){if(!PE.includes(t.namespaceURI))return null;const i=this.readPlacemark_(t,[this.getReadOptions(t,e)]);return i||null}readFeaturesFromNode(t,e){if(!PE.includes(t.namespaceURI))return[];let i;const n=t.localName;if("Document"==n||"Folder"==n)return i=this.readDocumentOrFolder_(t,[this.getReadOptions(t,e)]),i||[];if("Placemark"==n){const i=this.readPlacemark_(t,[this.getReadOptions(t,e)]);return i?[i]:[]}if("kml"==n){i=[];for(let n=t.firstElementChild;n;n=n.nextElementSibling){const t=this.readFeaturesFromNode(n,e);t&&E(i,t)}return i}return[]}readName(t){if(t){if("string"==typeof t){const e=cp(t);return this.readNameFromDocument(e)}return lp(t)?this.readNameFromDocument(t):this.readNameFromNode(t)}}readNameFromDocument(t){for(let e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE){const t=this.readNameFromNode(e);if(t)return t}}readNameFromNode(t){for(let e=t.firstElementChild;e;e=e.nextElementSibling)if(PE.includes(e.namespaceURI)&&"name"==e.localName)return yS(e);for(let e=t.firstElementChild;e;e=e.nextElementSibling){const t=e.localName;if(PE.includes(e.namespaceURI)&&("Document"==t||"Folder"==t||"Placemark"==t||"kml"==t)){const t=this.readNameFromNode(e);if(t)return t}}}readNetworkLinks(t){const e=[];if("string"==typeof t){const i=cp(t);E(e,this.readNetworkLinksFromDocument(i))}else lp(t)?E(e,this.readNetworkLinksFromDocument(t)):E(e,this.readNetworkLinksFromNode(t));return e}readNetworkLinksFromDocument(t){const e=[];for(let i=t.firstChild;i;i=i.nextSibling)i.nodeType==Node.ELEMENT_NODE&&E(e,this.readNetworkLinksFromNode(i));return e}readNetworkLinksFromNode(t){const e=[];for(let i=t.firstElementChild;i;i=i.nextElementSibling)if(PE.includes(i.namespaceURI)&&"NetworkLink"==i.localName){const t=wp({},LE,i,[]);e.push(t)}for(let i=t.firstElementChild;i;i=i.nextElementSibling){const t=i.localName;!PE.includes(i.namespaceURI)||"Document"!=t&&"Folder"!=t&&"kml"!=t||E(e,this.readNetworkLinksFromNode(i))}return e}readRegion(t){const e=[];if("string"==typeof t){const i=cp(t);E(e,this.readRegionFromDocument(i))}else lp(t)?E(e,this.readRegionFromDocument(t)):E(e,this.readRegionFromNode(t));return e}readRegionFromDocument(t){const e=[];for(let i=t.firstChild;i;i=i.nextSibling)i.nodeType==Node.ELEMENT_NODE&&E(e,this.readRegionFromNode(i));return e}readRegionFromNode(t){const e=[];for(let i=t.firstElementChild;i;i=i.nextElementSibling)if(PE.includes(i.namespaceURI)&&"Region"==i.localName){const t=wp({},OE,i,[]);e.push(t)}for(let i=t.firstElementChild;i;i=i.nextElementSibling){const t=i.localName;!PE.includes(i.namespaceURI)||"Document"!=t&&"Folder"!=t&&"kml"!=t||E(e,this.readRegionFromNode(i))}return e}readCamera(t){const e=[];if("string"==typeof t){const i=cp(t);E(e,this.readCameraFromDocument(i))}else lp(t)?E(e,this.readCameraFromDocument(t)):E(e,this.readCameraFromNode(t));return e}readCameraFromDocument(t){const e=[];for(let i=t.firstChild;i;i=i.nextSibling)i.nodeType===Node.ELEMENT_NODE&&E(e,this.readCameraFromNode(i));return e}readCameraFromNode(t){const e=[];for(let i=t.firstElementChild;i;i=i.nextElementSibling)if(PE.includes(i.namespaceURI)&&"Camera"===i.localName){const t=wp({},AE,i,[]);e.push(t)}for(let i=t.firstElementChild;i;i=i.nextElementSibling){const t=i.localName;!PE.includes(i.namespaceURI)||"Document"!==t&&"Folder"!==t&&"Placemark"!==t&&"kml"!==t||E(e,this.readCameraFromNode(i))}return e}writeFeaturesNode(t,e){e=this.adaptOptions(e);const i=sp(PE[4],"kml"),n="http://www.w3.org/2000/xmlns/";i.setAttributeNS(n,"xmlns:gx",RE[0]),i.setAttributeNS(n,"xmlns:xsi",rp),i.setAttributeNS(rp,"xsi:schemaLocation","http://www.opengis.net/kml/2.2 https://developers.google.com/kml/schema/kml22gx.xsd");const r={node:i},s={};t.length>1?s.Document=t:1==t.length&&(s.Placemark=t[0]);const o=DE[i.namespaceURI],a=vp(s,o);return Cp(r,NE,xp,a,[e],o,this),i}},bP.format.KML.getDefaultFillStyle=function(){return XE},bP.format.KML.getDefaultImageStyle=function(){return $E},bP.format.KML.getDefaultStrokeStyle=function(){return ZE},bP.format.KML.getDefaultStyle=function(){return HE},bP.format.KML.getDefaultStyleArray=function(){return qE},bP.format.KML.getDefaultTextStyle=function(){return YE},bP.format.KML.readFlatCoordinates=iw,bP.format.MVT=class extends Zv{constructor(t){super(),t=t||{},this.dataProjection=new mi({code:"",units:"tile-pixels"}),this.featureClass=t.featureClass?t.featureClass:Ud,this.geometryName_=t.geometryName,this.layerName_=t.layerName?t.layerName:"layer",this.layers_=t.layers?t.layers:null,this.idProperty_=t.idProperty,this.supportedMediaTypes=["application/vnd.mapbox-vector-tile","application/x-protobuf"]}readRawGeometry_(t,e,i,n){t.pos=e.geometry;const r=t.readVarint()+t.pos;let s=1,o=0,a=0,l=0,h=0,c=0;for(;t.pos>3}if(o--,1===s||2===s)a+=t.readSVarint(),l+=t.readSVarint(),1===s&&h>c&&(n.push(h),c=h),i.push(a,l),h+=2;else{if(7!==s)throw new Error("Invalid command found in the PBF");h>c&&(i.push(i[c],i[c+1]),h+=2)}}h>c&&(n.push(h),c=h)}createFeature_(t,e,i){const n=e.type;if(0===n)return null;let r;const s=e.properties;let o;this.idProperty_?(o=s[this.idProperty_],delete s[this.idProperty_]):o=e.id,s[this.layerName_]=e.layer.name;const a=[],l=[];this.readRawGeometry_(t,e,a,l);const h=function(t,e){let i;1===t?i=1===e?"Point":"MultiPoint":2===t?i=1===e?"LineString":"MultiLineString":3===t&&(i="Polygon");return i}(n,l.length);if(this.featureClass===Ud)r=new this.featureClass(h,a,l,2,s,o),r.transform(i.dataProjection);else{let t;if("Polygon"==h){const e=ds(a,l);t=e.length>1?new Gd(a,"XY",e):new gs(a,"XY",l)}else t="Point"===h?new Wr(a,"XY"):"LineString"===h?new Dd(a,"XY"):"MultiPoint"===h?new kd(a,"XY"):"MultiLineString"===h?new Nd(a,"XY",l):null;r=new(0,this.featureClass),this.geometryName_&&r.setGeometryName(this.geometryName_);const e=Yv(t,!1,i);r.setGeometry(e),void 0!==o&&r.setId(o),r.setProperties(s,!0)}return r}getType(){return"arraybuffer"}readFeatures(t,e){const i=this.layers_,n=En((e=this.adaptOptions(e)).dataProjection);n.setWorldExtent(e.extent),e.dataProjection=n;const r=new FT(t),s=r.readFields(zT,{}),o=[];for(const t in s){if(i&&!i.includes(t))continue;const a=s[t],l=a?[0,0,a.extent,a.extent]:null;n.setExtent(l);for(let t=0,i=a.length;t{const r=this.combineBboxAndFilter(n.geometryName,n.bbox,t.srsName,t.filter);Object.assign(i,{geometryName:n.geometryName,filter:r}),Xb(e,[n.name],[i])}));return e}combineBboxAndFilter(t,e,i,n){const r=tb(t,e,i);return n?QC(n,r):r}writeTransaction(t,e,i,n){const r=[],s=n.version?n.version:this.version_,o=sp(hb[s],"Transaction");let a;o.setAttribute("service","WFS"),o.setAttribute("version",s),n&&(a=n.gmlOptions?n.gmlOptions:{},n.handle&&o.setAttribute("handle",n.handle)),o.setAttributeNS(rp,"xsi:schemaLocation",ub[s]);const l=function(t,e,i,n){const r=n.featurePrefix?n.featurePrefix:ob;let s;"1.0.0"===i?s=2:"1.1.0"===i?s=3:"2.0.0"===i&&(s=3.2);const o=Object.assign({node:t},{version:i,featureNS:n.featureNS,featureType:n.featureType,featurePrefix:r,gmlVersion:s,hasZ:n.hasZ,srsName:n.srsName},e);return o}(o,a,s,n);return t&&gb("Insert",t,r,l),e&&gb("Update",e,r,l),i&&gb("Delete",i,r,l),n.nativeElements&&gb("Native",n.nativeElements,r,l),o}readProjectionFromDocument(t){for(let e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readProjectionFromNode(e);return null}readProjectionFromNode(t){if(t.firstElementChild&&t.firstElementChild.firstElementChild)for(let e=(t=t.firstElementChild.firstElementChild).firstElementChild;e;e=e.nextElementSibling)if(0!==e.childNodes.length&&(1!==e.childNodes.length||3!==e.firstChild.nodeType)){const t=[{}];return this.gmlFormat_.readGeometryElement(e,t),En(t.pop().srsName)}return null}},bP.format.WFS.writeFilter=function(t,e){const i=sp(Vb(e=e||"1.1.0"),"Filter"),n={node:i};return Object.assign(n,{version:e,filter:t}),Pb(i,t,[n]),i},bP.format.WKB=class extends Zv{constructor(t){super(),t=t||{},this.splitCollection=Boolean(t.splitCollection),this.viewCache_=null,this.hex_=!1!==t.hex,this.littleEndian_=!1!==t.littleEndian,this.ewkb_=!1!==t.ewkb,this.layout_=t.geometryLayout,this.nodataZ_=t.nodataZ||0,this.nodataM_=t.nodataM||0,this.srid_=t.srid}getType(){return this.hex_?"text":"arraybuffer"}readFeature(t,e){return new At({geometry:this.readGeometry(t,e)})}readFeatures(t,e){let i=[];const n=this.readGeometry(t,e);return i=this.splitCollection&&n instanceof Md?n.getGeometriesArray():[n],i.map((t=>new At({geometry:t})))}readGeometry(t,e){const i=nR(t);if(!i)return null;const n=new eR(i).readGeometry();return this.viewCache_=i,e=this.getReadOptions(t,e),this.viewCache_=null,Yv(n,!1,e)}readProjection(t){const e=this.viewCache_||nR(t);if(!e)return;const i=new eR(e);return i.readWkbHeader(),i.getSrid()&&En("EPSG:"+i.getSrid())||void 0}writeFeature(t,e){return this.writeGeometry(t.getGeometry(),e)}writeFeatures(t,e){return this.writeGeometry(new Md(t.map((t=>t.getGeometry()))),e)}writeGeometry(t,e){e=this.adaptOptions(e);const i=new iR({layout:this.layout_,littleEndian:this.littleEndian_,ewkb:this.ewkb_,nodata:{Z:this.nodataZ_,M:this.nodataM_}});let n=Number.isInteger(this.srid_)?Number(this.srid_):null;if(!1!==this.srid_&&!Number.isInteger(this.srid_)){const t=e.dataProjection&&En(e.dataProjection);if(t){const e=t.getCode();e.startsWith("EPSG:")&&(n=Number(e.substring(5)))}}i.writeGeometry(Yv(t,!0,e),n);const r=i.getBuffer();return this.hex_?function(t){const e=new Uint8Array(t);return Array.from(e.values()).map((t=>(t<16?"0":"")+Number(t).toString(16).toUpperCase())).join("")}(r):r}},bP.format.WKT=class extends vE{constructor(t){super(),t=t||{},this.splitCollection_=void 0!==t.splitCollection&&t.splitCollection}parse_(t){const e=new fR(t);return new pR(e).parse()}readFeatureFromText(t,e){const i=this.readGeometryFromText(t,e),n=new At;return n.setGeometry(i),n}readFeaturesFromText(t,e){let i=[];const n=this.readGeometryFromText(t,e);i=this.splitCollection_&&"GeometryCollection"==n.getType()?n.getGeometriesArray():[n];const r=[];for(let t=0,e=i.length;t3&&!!Sr(t,e,i,n)},bP.geom.flat.transform={},bP.geom.flat.transform.rotate=ur,bP.geom.flat.transform.scale=dr,bP.geom.flat.transform.transform2D=cr,bP.geom.flat.transform.translate=gr,bP.has={},bP.has.CREATE_IMAGE_BITMAP=dt,bP.has.DEVICE_PIXEL_RATIO=ht,bP.has.IMAGE_DECODE=ut,bP.has.MAC=lt,bP.has.PASSIVE_EVENT_LISTENERS=gt,bP.has.SAFARI=st,bP.has.SAFARI_BUG_237906=ot,bP.has.WEBKIT=at,bP.has.WORKER_OFFSCREEN_CANVAS=ct,bP.interaction={},bP.interaction.DblClickDragZoom=class extends Ho{constructor(t){const e=t||{};super(e),e.stopDown&&(this.stopDown=e.stopDown),this.scaleDeltaByPixel_=e.delta?e.delta:.01,this.duration_=void 0!==e.duration?e.duration:250,this.handlingDownUpSequence_=!1,this.handlingDoubleDownSequence_=!1,this.doubleTapTimeoutId_=void 0,this.trackedPointers_={},this.down_=null,this.targetPointers=[]}handleEvent(t){if(!t.originalEvent)return!0;let e=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence_){if(t.type==$s.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==$s.POINTERUP){const e=this.handleUpEvent(t);this.handlingDownUpSequence_=e}}else if(t.type==$s.POINTERDOWN)if(this.handlingDoubleDownSequence_){this.handlingDoubleDownSequence_=!1;const i=this.handleDownEvent(t);this.handlingDownUpSequence_=i,e=this.stopDown(i)}else e=this.stopDown(!1),this.waitForDblTap_();return!e}handleDragEvent(t){let e=1;const i=this.targetPointers[0],n=this.down_,r=i.clientY-n.clientY;void 0!==this.lastDistance_&&(e=1-(this.lastDistance_-r)*this.scaleDeltaByPixel_),this.lastDistance_=r,1!=e&&(this.lastScaleDelta_=e);const s=t.map,o=s.getView();s.render(),o.adjustResolutionInternal(e)}handleDownEvent(t){if(1==this.targetPointers.length){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.down_=t.originalEvent,this.handlingDownUpSequence_||e.getView().beginInteraction(),!0}return!1}handleUpEvent(t){if(0==this.targetPointers.length){const e=t.map.getView(),i=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,i),this.handlingDownUpSequence_=!1,this.handlingDoubleDownSequence_=!1,!1}return!0}stopDown(t){return t}updateTrackedPointers_(t){if(function(t){const e=t.type;return e===$s.POINTERDOWN||e===$s.POINTERDRAG||e===$s.POINTERUP}(t)){const e=t.originalEvent,i=e.pointerId.toString();t.type==$s.POINTERUP?delete this.trackedPointers_[i]:(t.type==$s.POINTERDOWN||i in this.trackedPointers_)&&(this.trackedPointers_[i]=e),this.targetPointers=Object.values(this.trackedPointers_)}}waitForDblTap_(){void 0!==this.doubleTapTimeoutId_?(clearTimeout(this.doubleTapTimeoutId_),this.doubleTapTimeoutId_=void 0):(this.handlingDoubleDownSequence_=!0,this.doubleTapTimeoutId_=setTimeout(this.endInteraction_.bind(this),250))}endInteraction_(){this.handlingDoubleDownSequence_=!1,this.doubleTapTimeoutId_=void 0}},bP.interaction.DoubleClickZoom=Jo,bP.interaction.DragAndDrop=class extends Ho{constructor(t){t=t||{},super({handleEvent:C}),this.on,this.once,this.un,this.readAsBuffer_=!1,this.formats_=[];const e=t.formatConstructors?t.formatConstructors:[];for(let t=0,i=e.length;t0){this.source_&&(this.source_.clear(),this.source_.addFeatures(l)),this.dispatchEvent(new Yx(Zx,t,l,s));break}}}registerListeners_(){const t=this.getMap();if(t){const e=this.target?this.target:t.getViewport();this.dropListenKeys_=[D(e,c,this.handleDrop,this),D(e,l,this.handleStop,this),D(e,h,this.handleStop,this),D(e,c,this.handleStop,this)]}}setActive(t){!this.getActive()&&t&&this.registerListeners_(),this.getActive()&&!t&&this.unregisterListeners_(),super.setActive(t)}setMap(t){this.unregisterListeners_(),super.setMap(t),this.getActive()&&this.registerListeners_()}tryReadFeatures_(t,e,i){try{return t.readFeatures(e,i)}catch{return null}}unregisterListeners_(){this.dropListenKeys_&&(this.dropListenKeys_.forEach(k),this.dropListenKeys_=null)}handleDrop(t){const e=t.dataTransfer.files;for(let t=0,i=e.length;t1?1:-1;return e.endInteraction(this.duration_,i),this.lastScaleDelta_=0,!1}handleDownEvent(t){return!!da(t)&&(!!this.condition_(t)&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,this.lastMagnitude_=void 0,!0))}},bP.interaction.DragZoom=Ca,bP.interaction.Draw=class extends fa{constructor(t){const e=t;e.stopDown||(e.stopDown=b),super(e),this.on,this.once,this.un,this.options_=t,this.shouldHandle_=!1,this.downPx_=null,this.downTimeout_,this.lastDragTime_,this.pointerType_,this.freehand_=!1,this.source_=t.source?t.source:null,this.features_=t.features?t.features:null,this.snapTolerance_=t.snapTolerance?t.snapTolerance:12,this.type_=t.type,this.mode_=function(t){switch(t){case"Point":case"MultiPoint":return"Point";case"LineString":case"MultiLineString":return"LineString";case"Polygon":case"MultiPolygon":return"Polygon";case"Circle":return"Circle";default:throw new Error("Invalid type: "+t)}}(this.type_),this.stopClick_=!!t.stopClick,this.ignoreNextUpEvent_=!1,this.minPoints_=t.minPoints?t.minPoints:"Polygon"===this.mode_?3:2,this.maxPoints_="Circle"===this.mode_?2:t.maxPoints?t.maxPoints:1/0,this.finishCondition_=t.finishCondition?t.finishCondition:C,this.geometryLayout_=t.geometryLayout?t.geometryLayout:"XY";let i=t.geometryFunction;if(!i){const t=this.mode_;if("Circle"===t)i=(t,e,i)=>{const n=e||new Ld([NaN,NaN]),r=Un(t[0],i),s=ai(r,Un(t[t.length-1],i));n.setCenterAndRadius(r,Math.sqrt(s),this.geometryLayout_);const o=Gn();return o&&n.transform(i,o),n};else{let e;"Point"===t?e=Wr:"LineString"===t?e=Dd:"Polygon"===t&&(e=gs),i=(i,n,r)=>(n?"Polygon"===t?i[0].length?n.setCoordinates([i[0].concat([i[0][0]])],this.geometryLayout_):n.setCoordinates([],this.geometryLayout_):n.setCoordinates(i,this.geometryLayout_):n=new e(i,this.geometryLayout_),n)}}this.geometryFunction_=i,this.dragVertexDelay_=void 0!==t.dragVertexDelay?t.dragVertexDelay:500,this.finishCoordinate_=null,this.sketchFeature_=null,this.sketchPoint_=null,this.sketchCoords_=null,this.sketchLine_=null,this.sketchLineCoords_=null,this.squaredClickTolerance_=t.clickTolerance?t.clickTolerance*t.clickTolerance:36,this.overlay_=new Gx({source:new qd({useSpatialIndex:!1,wrapX:!!t.wrapX&&t.wrapX}),style:t.style?t.style:cv(),updateWhileInteracting:!0}),this.geometryName_=t.geometryName,this.condition_=t.condition?t.condition:la,this.freehandCondition_,t.freehand?this.freehandCondition_=ra:this.freehandCondition_=t.freehandCondition?t.freehandCondition:ca,this.traceCondition_,this.setTrace(t.trace||!1),this.traceState_={active:!1},this.traceSource_=t.traceSource||t.source||null,this.addChangeListener(Yo,this.updateState_)}setTrace(t){let e;e=t?!0===t?ra:t:oa,this.traceCondition_=e}setMap(t){super.setMap(t),this.updateState_()}setFreehand(t){this.freehand_=t,this.freehand_?this.freehandCondition_=ra:this.freehandCondition_=this.options_&&this.options_.freehandCondition?this.options_.freehandCondition:ca}getOverlay(){return this.overlay_}getFreehand(){return this.freehand_}handleEvent(t){t.originalEvent.type===s&&t.originalEvent.preventDefault(),this.freehand_="Point"!==this.mode_&&this.freehandCondition_(t);let e=t.type===$s.POINTERMOVE,i=!0;if(!this.freehand_&&this.lastDragTime_&&t.type===$s.POINTERDRAG){Date.now()-this.lastDragTime_>=this.dragVertexDelay_?(this.downPx_=t.pixel,this.shouldHandle_=!this.freehand_,e=!0):this.lastDragTime_=void 0,this.shouldHandle_&&void 0!==this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0)}return this.freehand_&&t.type===$s.POINTERDRAG&&null!==this.sketchFeature_?(this.addToDrawing_(t.coordinate),i=!1):this.freehand_&&t.type===$s.POINTERDOWN?i=!1:e&&this.getPointerCount()<2?(i=t.type===$s.POINTERMOVE,i&&this.freehand_?(this.handlePointerMove_(t),this.shouldHandle_&&t.originalEvent.preventDefault()):("mouse"===t.originalEvent.pointerType||t.type===$s.POINTERDRAG&&void 0===this.downTimeout_)&&this.handlePointerMove_(t)):t.type===$s.DBLCLICK&&(i=!1),super.handleEvent(t)&&i}handleDownEvent(t){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=t.pixel,this.finishCoordinate_||this.startDrawing_(t.coordinate),!0):this.condition_(t)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout((()=>{this.handlePointerMove_(new Vs($s.POINTERMOVE,t.map,t.originalEvent,!1,t.frameState))}),this.dragVertexDelay_),this.downPx_=t.pixel,!0):(this.lastDragTime_=void 0,!1)}deactivateTrace_(){this.traceState_={active:!1}}toggleTraceState_(t){if(!this.traceSource_||!this.traceCondition_(t))return;if(this.traceState_.active)return void this.deactivateTrace_();const e=this.getMap(),i=Bt([e.getCoordinateFromPixel([t.pixel[0]-this.snapTolerance_,t.pixel[1]+this.snapTolerance_]),e.getCoordinateFromPixel([t.pixel[0]+this.snapTolerance_,t.pixel[1]-this.snapTolerance_])]),n=this.traceSource_.getFeaturesInExtent(i);if(0===n.length)return;const r=Qx(t.coordinate,n);r.length&&(this.traceState_={active:!0,startCoord:t.coordinate.slice(),targets:r,targetIndex:-1})}addOrRemoveTracedCoordinates_(t,e){const i=t.startIndex<=t.endIndex;i===t.startIndex<=e?i&&e>t.endIndex||!i&&et.endIndex)&&this.removeTracedCoordinates_(e,t.endIndex):(this.removeTracedCoordinates_(t.startIndex,t.endIndex),this.addTracedCoordinates_(t,t.startIndex,e))}removeTracedCoordinates_(t,e){if(t===e)return;let i=0;if(t0&&this.removeLastPoints_(i)}addTracedCoordinates_(t,e,i){if(e===i)return;const n=[];if(e=s;--e)n.push(Hx(t.coordinates,e))}n.length&&this.appendCoordinates(n)}updateTrace_(t){const e=this.traceState_;if(!e.active)return;if(-1===e.targetIndex){if(li(t.map.getPixelFromCoordinate(e.startCoord),t.pixel)this.squaredClickTolerance_:s<=this.squaredClickTolerance_,!this.shouldHandle_)return}this.finishCoordinate_?(this.updateTrace_(t),this.modifyDrawing_(t.coordinate)):this.createOrUpdateSketchPoint_(t.coordinate.slice())}atFinish_(t,e){let i=!1;if(this.sketchFeature_){let n=!1,r=[this.finishCoordinate_];const s=this.mode_;if("Point"===s)i=!0;else if("Circle"===s)i=2===this.sketchCoords_.length;else if("LineString"===s)n=!e&&this.sketchCoords_.length>this.minPoints_;else if("Polygon"===s){const t=this.sketchCoords_;n=t[0].length>this.minPoints_,r=[t[0][0],t[0][t[0].length-2]],r=e?[t[0][0]]:[t[0][0],t[0][t[0].length-2]]}if(n){const e=this.getMap();for(let n=0,s=r.length;n=this.maxPoints_&&(this.freehand_?r.pop():n=!0),r.push(t.slice()),this.geometryFunction_(r,e,i)):"Polygon"===s&&(r=this.sketchCoords_[0],r.length>=this.maxPoints_&&(this.freehand_?r.pop():n=!0),r.push(t.slice()),n&&(this.finishCoordinate_=r[0]),this.geometryFunction_(this.sketchCoords_,e,i)),this.createOrUpdateSketchPoint_(t.slice()),this.updateSketchFeatures_(),n?this.finishDrawing():this.sketchFeature_}removeLastPoints_(t){if(!this.sketchFeature_)return;const e=this.sketchFeature_.getGeometry(),i=this.getMap().getView().getProjection(),n=this.mode_;for(let r=0;r=2){this.finishCoordinate_=t[t.length-2].slice();const e=this.finishCoordinate_.slice();t[t.length-1]=e,this.createOrUpdateSketchPoint_(e)}this.geometryFunction_(t,e,i),"Polygon"===e.getType()&&this.sketchLine_&&this.createOrUpdateCustomSketchLine_(e)}else if("Polygon"===n){t=this.sketchCoords_[0],t.splice(-2,1);const n=this.sketchLine_.getGeometry();if(t.length>=2){const e=t[t.length-2].slice();t[t.length-1]=e,this.createOrUpdateSketchPoint_(e)}n.setCoordinates(t),this.geometryFunction_(this.sketchCoords_,e,i)}if(1===t.length){this.abortDrawing();break}}this.updateSketchFeatures_()}removeLastPoint(){this.removeLastPoints_(1)}finishDrawing(){const t=this.abortDrawing_();if(!t)return null;let e=this.sketchCoords_;const i=t.getGeometry(),n=this.getMap().getView().getProjection();return"LineString"===this.mode_?(e.pop(),this.geometryFunction_(e,i,n)):"Polygon"===this.mode_&&(e[0].pop(),this.geometryFunction_(e,i,n),e=i.getCoordinates()),"MultiPoint"===this.type_?t.setGeometry(new kd([e])):"MultiLineString"===this.type_?t.setGeometry(new Nd([e])):"MultiPolygon"===this.type_&&t.setGeometry(new Gd([e])),this.dispatchEvent(new hv(av,t)),this.features_&&this.features_.push(t),this.source_&&this.source_.addFeature(t),t}abortDrawing_(){this.finishCoordinate_=null;const t=this.sketchFeature_;return this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0),this.deactivateTrace_(),t}abortDrawing(){const t=this.abortDrawing_();t&&this.dispatchEvent(new hv(lv,t))}appendCoordinates(t){const e=this.mode_,i=!this.sketchFeature_;let n;if(i&&this.startDrawing_(t[0]),"LineString"===e||"Circle"===e)n=this.sketchCoords_;else{if("Polygon"!==e)return;n=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[]}i&&n.shift(),n.pop();for(let e=0;er?o[1]:o[0]),a}}return null}handlePointerMove_(t){const e=t.pixel,i=t.map,n=this.drag_&&$t(this.extent_,t.coordinate);let r=this.snapToVertex_(e,i);return r||!this.createCondition_(t)||n||(r=i.getCoordinateFromPixelInternal(e)),n&&!r?this.getMap().getViewport().classList.add("ol-grab"):this.getMap().getViewport().classList.remove("ol-grab"),r?(this.updatePointerFeature_(r),!0):(this.noVertexFeature_(),!1)}createOrUpdateExtentFeature_(t){let e=this.extentFeature_;return e?t?e.setGeometry(ps(t)):e.setGeometry(void 0):(e=new At(t?ps(t):{}),this.extentFeature_=e,this.extentOverlay_.getSource().addFeature(e)),e}updatePointerFeature_(t,e=!0){let i=this.vertexFeature_;if(e&&!i&&(i=new At(new Wr(t)),this.vertexFeature_=i,this.vertexOverlay_.getSource().addFeature(i)),i){i.getGeometry().setCoordinates(t)}return i}noVertexFeature_(){this.vertexFeature_&&(this.vertexOverlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)}handleEvent(t){if(!t.originalEvent||!this.condition_(t))return this.noVertexFeature_(),!0;let e=this.handlingDownUpSequence;return t.type!=$s.POINTERMOVE||this.handlingDownUpSequence||(e=this.handlePointerMove_(t)),super.handleEvent(t),!e}handleDownEvent(t){const e=t.pixel,i=t.map,n=this.getExtentInternal();let r=this.snapToVertex_(e,i);const s=function(t){let e=null,i=null;return t[0]==n[0]?e=n[2]:t[0]==n[2]&&(e=n[0]),t[1]==n[1]?i=n[3]:t[1]==n[3]&&(i=n[1]),null!==e&&null!==i?[e,i]:null};if(r&&n){const t=r[0]==n[0]||r[0]==n[2]?r[0]:null,e=r[1]==n[1]||r[1]==n[3]?r[1]:null;null!==t&&null!==e?this.pointerHandler_=pv(s(r)):null!==t?this.pointerHandler_=_v(s([t,n[1]]),s([t,n[3]])):null!==e&&(this.pointerHandler_=_v(s([n[0],e]),s([n[2],e])))}else{r=i.getCoordinateFromPixelInternal(e);let s=!1;this.drag_&&$t(n,r)&&(this.pointerHandler_=function(t,e){return function(i){const n=i[0]-e[0],r=i[1]-e[1];return[t[0]+n,t[1]+r,t[2]+n,t[3]+r]}}(n,r),s=!0),!s&&this.createCondition_(t)&&(this.setExtent([r[0],r[1],r[0],r[1]]),this.pointerHandler_=pv(r))}return!!this.pointerHandler_}handleDragEvent(t){if(this.pointerHandler_){const e=t.coordinate;this.setExtent(this.pointerHandler_(e)),this.updatePointerFeature_(e,!1)}}handleUpEvent(t){this.pointerHandler_=null;const e=this.getExtentInternal();return e&&0!==he(e)||this.setExtent(null),!1}setMap(t){this.extentOverlay_.setMap(t),this.vertexOverlay_.setMap(t),super.setMap(t)}getExtent(){return Bn(this.getExtentInternal(),this.getMap().getView().getProjection())}getExtentInternal(){return this.extent_}setExtent(t){this.extent_=t||null,this.createOrUpdateExtentFeature_(t),this.dispatchEvent(new dv(this.extent_))}},bP.interaction.Extent.ExtentEvent=dv,bP.interaction.Interaction=Ho,bP.interaction.Interaction.pan=Ko,bP.interaction.Interaction.zoomByDelta=qo,bP.interaction.KeyboardPan=Fa,bP.interaction.KeyboardZoom=La,bP.interaction.Link=class extends Ho{constructor(t){let e;super(),e=!0===(t=Object.assign({animate:!0,params:["x","y","z","r","l"],replace:!1,prefix:""},t||{})).animate?{duration:250}:t.animate?t.animate:null,this.animationOptions_=e,this.params_=t.params.reduce(((t,e)=>(t[e]=!0,t)),{}),this.replace_=t.replace,this.prefix_=t.prefix,this.listenerKeys_=[],this.initial_=!0,this.updateState_=this.updateState_.bind(this),this.trackedCallbacks_={},this.trackedValues_={}}getParamName_(t){return this.prefix_?this.prefix_+t:t}get_(t,e){return t.get(this.getParamName_(e))}set_(t,e,i){e in this.params_&&t.set(this.getParamName_(e),i)}delete_(t,e){e in this.params_&&t.delete(this.getParamName_(e))}setMap(t){const e=this.getMap();super.setMap(t),t!==e&&(e&&this.unregisterListeners_(e),t&&(this.initial_=!0,this.updateState_(),this.registerListeners_(t)))}registerListeners_(t){this.listenerKeys_.push(D(t,Qs,this.updateUrl_,this),D(t.getLayerGroup(),n,this.updateUrl_,this),D(t,"change:layergroup",this.handleChangeLayerGroup_,this)),this.replace_||addEventListener("popstate",this.updateState_)}unregisterListeners_(t){for(let t=0,e=this.listenerKeys_.length;t!0,!r.features&&!r.source)throw new Error("The modify interaction requires features collection or a source");let s;r.features?(s=r.features.getArray(),r.features.addEventListener(t,this.handleExternalCollectionAdd_),r.features.addEventListener(e,this.handleExternalCollectionRemove_),this.featuresCollection_=r.features):r.source&&(s=r.source.getFeatures(),r.source.addEventListener(Xd,this.handleSourceAdd_),r.source.addEventListener(Wd,this.handleSourceRemove_),this.source_=r.source),s.forEach((t=>{t.addEventListener(n,this.handleFeatureChange_),this.filterFunctionWasSupplied_&&t.addEventListener(i,this.handleFeatureChange_)})),r.hitDetection&&(this.hitDetection_=r.hitDetection),this.features_=[],s.filter(this.filter_).forEach((t=>this.addFeature_(t))),this.lastPointerEvent_=null,this.delta_=[0,0],this.snapToPointer_=void 0===r.snapToPointer?!this.hitDetection_:r.snapToPointer}setTrace(t){let e;e=t?!0===t?ra:t:oa,this.traceCondition_=e}addFeature_(t){this.features_.push(t);const e=t.getGeometry();if(e){const i=this.SEGMENT_WRITERS_[e.getType()];i&&i(t,e)}const i=this.getMap();i&&i.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastCoordinate_)}willModifyFeatures_(t,e){if(!this.featuresBeingModified_){this.featuresBeingModified_=new Z;const i=this.featuresBeingModified_.getArray();for(let t=0,n=e.length;t=0;--t){const n=i[t];for(let t=this.dragSegments_.length-1;t>=0;--t)this.dragSegments_[t][0]===n&&this.dragSegments_.splice(t,1);e.remove(n)}}setActive(t){this.vertexFeature_&&!t&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),super.setActive(t)}setMap(t){this.overlay_.setMap(t),super.setMap(t)}getOverlay(){return this.overlay_}handleSourceAdd_(t){const e=t.feature;e&&this.externalAddFeatureHandler_(e)}handleSourceRemove_(t){const e=t.feature;e&&this.externalRemoveFeatureHandler_(e)}handleExternalCollectionAdd_(t){const e=t.element;e&&this.externalAddFeatureHandler_(e)}handleExternalCollectionRemove_(t){const e=t.element;e&&this.externalRemoveFeatureHandler_(e)}externalAddFeatureHandler_(t){t.addEventListener(n,this.handleFeatureChange_),this.filterFunctionWasSupplied_&&t.addEventListener(i,this.handleFeatureChange_),this.filter_(t)&&this.addFeature_(t)}externalRemoveFeatureHandler_(t){t.removeEventListener(n,this.handleFeatureChange_),this.filterFunctionWasSupplied_&&t.removeEventListener(i,this.handleFeatureChange_),this.removeFeature_(t)}handleFeatureChange_(t){if(!this.changingFeature_){const e=t.target;this.removeFeature_(e),this.filter_(e)&&this.addFeature_(e)}}writePointGeometry_(t,e){const i=e.getCoordinates(),n={feature:t,geometry:e,segment:[i,i]};this.rBush_.insert(e.getExtent(),n)}writeMultiPointGeometry_(t,e){const i=e.getCoordinates();for(let n=0,r=i.length;nthis.pixelTolerance_)return;if(e.targetIndex!==i.index){if(-1!==e.targetIndex){const t=e.targets[e.targetIndex];this.removeTracedCoordinates_(t.startIndex,t.endIndex)}else for(const t of this.traceSegments_){const e=t[0],i=e.geometry,n=t[1],r=i.getCoordinates();Tv(r,i.getType(),e.depth).splice(e.index+n,1),i.setCoordinates(r),0===n&&(e.index-=1)}const t=e.targets[i.index];this.addTracedCoordinates_(t,t.startIndex,i.endIndex)}else{const t=e.targets[e.targetIndex];this.addOrRemoveTracedCoordinates_(t,i.endIndex)}e.targetIndex=i.index;e.targets[e.targetIndex].endIndex=i.endIndex}getTraceCandidates_(t){const e=this.getMap(),i=this.pixelTolerance_,n=Bt([e.getCoordinateFromPixel([t.pixel[0]-i,t.pixel[1]+i]),e.getCoordinateFromPixel([t.pixel[0]+i,t.pixel[1]-i])]);return this.traceSource_.getFeaturesInExtent(n)}toggleTraceState_(t){if(!this.traceSource_||!this.traceCondition_(t))return;if(this.traceState_.active)return this.deactivateTrace_(),void(this.traceSegments_=null);const e=this.getTraceCandidates_(t);if(0===e.length)return;const i=Qx(t.coordinate,e);i.length&&(this.traceState_={active:!0,startCoord:t.coordinate.slice(),targets:i,targetIndex:-1})}addOrRemoveTracedCoordinates_(t,e){const i=t.startIndex<=t.endIndex;i===t.startIndex<=e?i&&e>t.endIndex||!i&&et.endIndex)&&this.removeTracedCoordinates_(e,t.endIndex):(this.removeTracedCoordinates_(t.startIndex,t.endIndex),this.addTracedCoordinates_(t,t.startIndex,e))}removeTracedCoordinates_(t,e){if(t===e)return;let i=0;if(t0)for(const t of this.traceSegments_){const e=t[0],n=e.geometry,r=t[1];let s=t[0].index+1;1===r&&(s-=i);const o=n.getCoordinates();Tv(o,n.getType(),e.depth).splice(s,i),n.setCoordinates(o),1===r&&(e.index-=i)}}addTracedCoordinates_(t,e,i){if(e===i)return;const n=[];if(e=s;--e)n.push(Hx(t.coordinates,e))}if(n.length)for(const t of this.traceSegments_){const e=t[0],i=e.geometry,r=t[1],s=e.index+1;0===r&&n.reverse();const o=i.getCoordinates();Tv(o,i.getType(),e.depth).splice(s,0,...n),i.setCoordinates(o),1===r&&(e.index+=n.length)}}updateGeometry_(t,e){const i=e[0],n=i.depth;let r;const s=i.segment,o=i.geometry,a=e[1];for(;t.lengtht)));const e=[t.coordinate[0]+this.delta_[0],t.coordinate[1]+this.delta_[1]],i=[],n=[],r=this.traceState_.active&&!this.traceSegments_?this.traceState_.startCoord:null;if(r){this.traceSegments_=[];for(const e of this.dragSegments_){li(ei(r,e[0].segment),r)/t.map.getView().getResolution()<1&&this.traceSegments_.push(e)}}for(let t=0,r=this.dragSegments_.length;t=0;--e)this.insertVertex_(i[e],t);this.ignoreNextSingleClick_=!0}return!!this.vertexFeature_}handleUpEvent(t){for(let e=this.dragSegments_.length-1;e>=0;--e){const i=this.dragSegments_[e][0],n=i.geometry;if("Circle"===n.getType()){const e=n,r=e.getCenter(),s=i.featureSegments[0],o=i.featureSegments[1];s.segment[0]=r,s.segment[1]=r,o.segment[0]=r,o.segment[1]=r,this.rBush_.update(Jt(r),s);let a=e;const l=Gn();if(l){const e=t.map.getView().getProjection();a=a.clone().transform(l,e),a=_s(a).transform(e,l)}this.rBush_.update(a.getExtent(),o)}else this.rBush_.update(Bt(i.segment),i)}return this.featuresBeingModified_&&(this.toggleTraceState_(t),this.dispatchEvent(new Cv(wv,this.featuresBeingModified_,t)),this.featuresBeingModified_=null),!1}handlePointerMove_(t){this.lastCoordinate_=t.coordinate,this.handlePointerAtPixel_(this.lastCoordinate_)}handlePointerAtPixel_(t){const e=this.getMap(),i=e.getPixelFromCoordinate(t),n=e.getView().getProjection(),r=function(e,i){return Rv(t,e,n)-Rv(t,i,n)};let s,o;if(this.hitDetection_){const t="object"==typeof this.hitDetection_?t=>t===this.hitDetection_:void 0;e.forEachFeatureAtPixel(i,((t,e,i)=>{i&&"Point"===i.getType()&&(i=new Wr(jn(i.getCoordinates(),n)));const r=i||t.getGeometry();if(r&&"Point"===r.getType()&&t instanceof At&&this.features_.includes(t)){o=r;const e=t.getGeometry().getFlatCoordinates().slice(0,2);s=[{feature:t,geometry:o,segment:[e,e]}]}return!0}),{layerFilter:t})}if(!s){const i=Bn(zt(zn(Jt(t,vv),n),e.getView().getResolution()*this.pixelTolerance_,vv),n);s=this.rBush_.getInExtent(i)}if(s&&s.length>0){const a=s.sort(r)[0],l=a.segment;let h=Pv(t,a,n);const c=e.getPixelFromCoordinate(h);let u=li(i,c);if(o||u<=this.pixelTolerance_){const i={};if(i[z(l)]=!0,this.snapToPointer_||(this.delta_[0]=h[0]-t[0],this.delta_[1]=h[1]-t[1]),"Circle"===a.geometry.getType()&&1===a.index)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(h,[a.feature],[a.geometry],this.snappedToVertex_);else{const t=e.getPixelFromCoordinate(l[0]),n=e.getPixelFromCoordinate(l[1]),r=ai(c,t),o=ai(c,n);if(u=Math.sqrt(Math.min(r,o)),this.snappedToVertex_=u<=this.pixelTolerance_,!this.snappedToVertex_&&!this.insertVertexCondition_(this.lastPointerEvent_))return void(this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null));this.snappedToVertex_&&(h=r>o?l[1]:l[0]),this.createOrUpdateVertexFeature_(h,[a.feature],[a.geometry],this.snappedToVertex_);const d={};d[z(a.geometry)]=!0;for(let t=1,e=s.length;t"Circle"===t.getType()||t.getType().endsWith("Point"))))return!1;const t=this.vertexFeature_.getGeometry().getCoordinates();return this.rBush_.getInExtent(Bt([t])).some((({segment:e})=>ri(e[0],t)||ri(e[1],t)))}removePoint(t){if(t&&(t=Un(t,this.getMap().getView().getProjection()),this.updatePointer_(t)),!this.lastPointerEvent_||this.lastPointerEvent_&&this.lastPointerEvent_.type!=$s.POINTERDRAG){const t=this.lastPointerEvent_;this.willModifyFeatures_(t,this.dragSegments_.map((([t])=>t)));const e=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new Cv(wv,this.featuresBeingModified_,t)),this.featuresBeingModified_=null,e}return!1}removeVertex_(){const t=this.dragSegments_,e={};let i,n,r,s,o,a,l,h,c,u,d,g=!1;for(o=t.length-1;o>=0;--o)r=t[o],u=r[0],d=z(u.feature),u.depth&&(d+="-"+u.depth.join("-")),d in e||(e[d]={}),0===r[1]?(e[d].right=u,e[d].index=u.index):1==r[1]&&(e[d].left=u,e[d].index=u.index+1);for(d in e){switch(c=e[d].right,l=e[d].left,a=e[d].index,h=a-1,u=void 0!==l?l:c,h<0&&(h=0),s=u.geometry,n=s.getCoordinates(),i=n,g=!1,s.getType()){case"MultiLineString":n[u.depth[0]].length>2&&(n[u.depth[0]].splice(a,1),g=!0);break;case"LineString":n.length>2&&(n.splice(a,1),g=!0);break;case"MultiPolygon":i=i[u.depth[1]];case"Polygon":i=i[u.depth[0]],i.length>4&&(a==i.length-1&&(a=0),i.splice(a,1),g=!0,0===a&&(i.pop(),i.push(i[0]),h=i.length-1))}if(g){this.setGeometryCoordinates_(s,n);const e=[];if(void 0!==l&&(this.rBush_.remove(l),e.push(l.segment[0])),void 0!==c&&(this.rBush_.remove(c),e.push(c.segment[1])),void 0!==l&&void 0!==c){const t={depth:u.depth,feature:u.feature,geometry:u.geometry,index:h,segment:e};this.rBush_.insert(Bt(t.segment),t)}this.updateSegmentIndices_(s,a,u.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.length=0}}return g}canInsertPoint(){if(!this.vertexFeature_)return!1;if(this.vertexFeature_.get("geometries").every((t=>"Circle"===t.getType()||t.getType().endsWith("Point"))))return!1;const t=this.vertexFeature_.getGeometry().getCoordinates();return this.rBush_.getInExtent(Bt([t])).some((({segment:e})=>!(ri(e[0],t)||ri(e[1],t))))}insertPoint(t){const e=t?Un(t,this.getMap().getView().getProjection()):this.vertexFeature_?.getGeometry().getCoordinates();if(!e)return!1;return this.findInsertVerticesAndUpdateDragSegments_(e).reduce(((t,i)=>t||this.insertVertex_(i,e)),!1)}setGeometryCoordinates_(t,e){this.changingFeature_=!0,t.setCoordinates(e),this.changingFeature_=!1}updateSegmentIndices_(t,e,i,n){this.rBush_.forEachInExtent(t.getExtent(),(function(r){r.geometry===t&&(void 0===i||void 0===r.depth||w(r.depth,i))&&r.index>e&&(r.index+=n)}))}disposeInternal(){if(super.disposeInternal(),this.featuresCollection_){this.featuresCollection_.removeEventListener(t,this.handleExternalCollectionAdd_),this.featuresCollection_.removeEventListener(e,this.handleExternalCollectionRemove_);for(const t of this.featuresCollection_.getArray())t.removeEventListener(n,this.handleFeatureChange_),this.filterFunctionWasSupplied_&&t.removeEventListener(i,this.handleFeatureChange_)}else if(this.source_){this.source_.removeEventListener(Xd,this.handleSourceAdd_),this.source_.removeEventListener(Wd,this.handleSourceRemove_);for(const t of this.source_.getFeatures())t.removeEventListener(n,this.handleFeatureChange_),this.filterFunctionWasSupplied_&&t.removeEventListener(i,this.handleFeatureChange_)}}},bP.interaction.Modify.ModifyEvent=Cv,bP.interaction.MouseWheelZoom=Ma,bP.interaction.PinchRotate=Aa,bP.interaction.PinchZoom=Oa,bP.interaction.Pointer=fa,bP.interaction.Pointer.centroid=pa,bP.interaction.Select=Av,bP.interaction.Select.SelectEvent=Lv,bP.interaction.Snap=class extends fa{constructor(t){t=t||{},super({handleDownEvent:C,stopDown:b}),this.on,this.once,this.un,this.source_=t.source?t.source:null,this.vertex_=void 0===t.vertex||t.vertex,this.edge_=void 0===t.edge||t.edge,this.intersection_=void 0!==t.intersection&&t.intersection,this.features_=t.features?t.features:null,this.featuresListenerKeys_=[],this.featureChangeListenerKeys_={},this.indexedFeaturesExtents_={},this.pendingFeatures_={},this.pixelTolerance_=void 0!==t.pixelTolerance?t.pixelTolerance:10,this.rBush_=new zd,this.snapped_=null,this.segmenters_=Object.assign({},kv,t.segmenters)}addFeature(t,e){e=void 0===e||e;const i=z(t),r=t.getGeometry();if(r){const e=this.segmenters_[r.getType()];if(e){this.indexedFeaturesExtents_[i]=r.getExtent([1/0,1/0,-1/0,-1/0]);const n=e.call(this.segmenters_,r,this.getMap().getView().getProjection());let s=n.length;for(let e=0;e{t!==i.feature&&t!==i.intersectionFeature||e.remove(i)}))}i&&(k(this.featureChangeListenerKeys_[n]),delete this.featureChangeListenerKeys_[n])}setMap(i){const n=this.getMap(),r=this.featuresListenerKeys_;let s=this.getFeatures_();if(Array.isArray(s)||(s=s.getArray()),n&&(r.forEach(k),r.length=0,this.rBush_.clear(),Object.values(this.featureChangeListenerKeys_).forEach(k),this.featureChangeListenerKeys_={}),super.setMap(i),i){this.features_?r.push(D(this.features_,t,this.handleFeatureAdd_,this),D(this.features_,e,this.handleFeatureRemove_,this)):this.source_&&r.push(D(this.source_,Xd,this.handleFeatureAdd_,this),D(this.source_,Wd,this.handleFeatureRemove_,this));for(const t of s)this.addFeature(t)}}snapTo(t,e,i){const n=i.getView().getProjection(),r=Un(e,n),s=Bn(zt(Bt([r]),i.getView().getResolution()*this.pixelTolerance_),n),o=this.rBush_.getInExtent(s),a=o.length;if(0===a)return null;let l,h,c=1/0,u=null;const d=this.pixelTolerance_*this.pixelTolerance_,g=()=>{if(!l)return null;const e=i.getPixelFromCoordinate(l);return ai(t,e)>d?null:{vertex:l,vertexPixel:[Math.round(e[0]),Math.round(e[1])],feature:h,segment:u}};if(this.vertex_||this.intersection_){for(let t=0;t{if(t instanceof At&&this.filter_(t,e)&&(!this.features_||this.features_.getArray().includes(t)))return t}),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_})}getHitTolerance(){return this.hitTolerance_}setHitTolerance(t){this.hitTolerance_=t}setMap(t){const e=this.getMap();super.setMap(t),this.updateState_(e)}handleActiveChanged_(){this.updateState_(null)}updateState_(t){let e=this.getMap();const i=this.getActive();if((!e||!i)&&(e=e||t,e)){e.getViewport().classList.remove("ol-grab","ol-grabbing")}}},bP.interaction.Translate.TranslateEvent=$v,bP.interaction.defaults={},bP.interaction.defaults.defaults=Da,bP.layer={},bP.layer.Base=Wa,bP.layer.BaseImage=Rf,bP.layer.BaseTile=Df,bP.layer.BaseVector=zc,bP.layer.Flow=Ox,bP.layer.Graticule=class extends Gx{constructor(t){t=t||{};const e=Object.assign({updateWhileAnimating:!0,updateWhileInteracting:!0,renderBuffer:0},t);delete e.maxLines,delete e.strokeStyle,delete e.targetSize,delete e.showLabels,delete e.lonLabelFormatter,delete e.latLabelFormatter,delete e.lonLabelPosition,delete e.latLabelPosition,delete e.lonLabelStyle,delete e.latLabelStyle,delete e.intervals,super(e),this.projection_=null,this.maxLat_=1/0,this.maxLon_=1/0,this.minLat_=-1/0,this.minLon_=-1/0,this.maxX_=1/0,this.maxY_=1/0,this.minX_=-1/0,this.minY_=-1/0,this.targetSize_=void 0!==t.targetSize?t.targetSize:100,this.maxLines_=void 0!==t.maxLines?t.maxLines:100,this.meridians_=[],this.parallels_=[],this.strokeStyle_=void 0!==t.strokeStyle?t.strokeStyle:jx,this.fromLonLatTransform_=void 0,this.toLonLatTransform_=void 0,this.projectionCenterLonLat_=null,this.bottomLeft_=null,this.bottomRight_=null,this.topLeft_=null,this.topRight_=null,this.meridiansLabels_=null,this.parallelsLabels_=null,t.showLabels&&(this.lonLabelFormatter_=null==t.lonLabelFormatter?ii.bind(this,"EW"):t.lonLabelFormatter,this.latLabelFormatter_=null==t.latLabelFormatter?ii.bind(this,"NS"):t.latLabelFormatter,this.lonLabelPosition_=null==t.lonLabelPosition?0:t.lonLabelPosition,this.latLabelPosition_=null==t.latLabelPosition?1:t.latLabelPosition,this.lonLabelStyleBase_=new hc({text:void 0!==t.lonLabelStyle?t.lonLabelStyle.clone():new pc({font:"12px Calibri,sans-serif",textBaseline:"bottom",fill:new sc({color:"rgba(0,0,0,1)"}),stroke:new lc({color:"rgba(255,255,255,1)",width:3})})}),this.lonLabelStyle_=t=>{const e=t.get("graticule_label");return this.lonLabelStyleBase_.getText().setText(e),this.lonLabelStyleBase_},this.latLabelStyleBase_=new hc({text:void 0!==t.latLabelStyle?t.latLabelStyle.clone():new pc({font:"12px Calibri,sans-serif",textAlign:"right",fill:new sc({color:"rgba(0,0,0,1)"}),stroke:new lc({color:"rgba(255,255,255,1)",width:3})})}),this.latLabelStyle_=t=>{const e=t.get("graticule_label");return this.latLabelStyleBase_.getText().setText(e),this.latLabelStyleBase_},this.meridiansLabels_=[],this.parallelsLabels_=[],this.addEventListener(Qa,this.drawLabels_.bind(this))),this.intervals_=void 0!==t.intervals?t.intervals:Ux,this.setSource(new qd({loader:this.loaderFunction.bind(this),strategy:this.strategyFunction.bind(this),features:new Z,overlaps:!1,useSpatialIndex:!1,wrapX:t.wrapX})),this.featurePool_=[],this.lineStyle_=new hc({stroke:this.strokeStyle_}),this.loadedExtent_=null,this.renderedExtent_=null,this.renderedResolution_=null,this.setRenderOrder(null)}strategyFunction(t,e){let i=t.slice();return this.projection_&&this.getSource().getWrapX()&&Re(i,this.projection_),this.loadedExtent_&&(ee(this.loadedExtent_,i,e)?i=this.loadedExtent_.slice():this.getSource().removeLoadedExtent(this.loadedExtent_)),[i]}loaderFunction(t,e,i){this.loadedExtent_=t;const n=this.getSource(),r=me(this.getExtent()||[-1/0,-1/0,1/0,1/0],t);if(this.renderedExtent_&&te(this.renderedExtent_,r)&&this.renderedResolution_===e)return;if(this.renderedExtent_=r,this.renderedResolution_=e,Ee(r))return;const s=de(r),o=e*e/4;(!this.projection_||!Fn(this.projection_,i))&&this.updateProjectionInfo_(i),this.createGraticule_(r,s,e,o);let a,l=this.meridians_.length+this.parallels_.length;for(this.meridiansLabels_&&(l+=this.meridians_.length),this.parallelsLabels_&&(l+=this.parallels_.length);l>this.featurePool_.length;)a=new At,this.featurePool_.push(a);const h=n.getFeaturesCollection();h.clear();let c,u,d=0;for(c=0,u=this.meridians_.length;cMath.PI/2}const d=bu(t);for(let t=a;t<=l;++t){let i,n,c,g,f=this.meridians_.length+this.parallels_.length;if(this.meridiansLabels_)for(n=0,c=this.meridiansLabels_.length;n=a?(t[0]=o[0],t[2]=o[2]):s=!0);const l=[Ie(e[0],this.minX_,this.maxX_),Ie(e[1],this.minY_,this.maxY_)],h=this.toLonLatTransform_(l);isNaN(h[1])&&(h[1]=Math.abs(this.maxLat_)>=Math.abs(this.minLat_)?this.maxLat_:this.minLat_);let c=Ie(h[0],this.minLon_,this.maxLon_),u=Ie(h[1],this.minLat_,this.maxLat_);const d=this.maxLines_;let g,f,p,_,m=t;s||(m=[Ie(t[0],this.minX_,this.maxX_),Ie(t[1],this.minY_,this.maxY_),Ie(t[2],this.minX_,this.maxX_),Ie(t[3],this.minY_,this.maxY_)]);const y=be(m,this.toLonLatTransform_,void 0,8);let x=y[3],v=y[2],S=y[1],E=y[0];if(s||($t(m,this.bottomLeft_)&&(E=this.minLon_,S=this.minLat_),$t(m,this.bottomRight_)&&(v=this.maxLon_,S=this.minLat_),$t(m,this.topLeft_)&&(E=this.minLon_,x=this.maxLat_),$t(m,this.topRight_)&&(v=this.maxLon_,x=this.maxLat_),x=Ie(x,u,this.maxLat_),v=Ie(v,c,this.maxLon_),S=Ie(S,this.minLat_,u),E=Ie(E,this.minLon_,c)),c=Math.floor(c/r)*r,_=Ie(c,this.minLon_,this.maxLon_),f=this.addMeridian_(_,S,x,n,t,0),g=0,s)for(;(_-=r)>=E&&g++n[s]&&(r=s,s=1);const o=Math.max(e[1],n[r]),a=Math.min(e[3],n[s]),l=Ie(e[1]+Math.abs(e[1]-e[3])*this.lonLabelPosition_,o,a),h=[n[r-1]+(n[s-1]-n[r-1])*(l-n[r])/(n[s]-n[r]),l],c=this.meridiansLabels_[i].geom;return c.setCoordinates(h),c}getMeridians(){return this.meridians_}getParallel_(t,e,i,n,r){const s=kx(t,e,i,this.projection_,n);let o=this.parallels_[r];return o?(o.setFlatCoordinates("XY",s),o.changed()):o=new Dd(s,"XY"),o}getParallelPoint_(t,e,i){const n=t.getFlatCoordinates();let r=0,s=n.length-2;n[r]>n[s]&&(r=s,s=0);const o=Math.max(e[0],n[r]),a=Math.min(e[2],n[s]),l=Ie(e[0]+Math.abs(e[0]-e[2])*this.latLabelPosition_,o,a),h=[l,n[r+1]+(n[s+1]-n[r+1])*(l-n[r])/(n[s]-n[r])],c=this.parallelsLabels_[i].geom;return c.setCoordinates(h),c}getParallels(){return this.parallels_}updateProjectionInfo_(t){const e=En("EPSG:4326"),i=t.getWorldExtent();this.maxLat_=i[3],this.maxLon_=i[2],this.minLat_=i[1],this.minLon_=i[0];const n=An(t,e);if(this.minLon_=Math.abs(this.minLat_)?this.maxLat_:this.minLat_),this.projection_=t}},bP.layer.Group=qa,bP.layer.Group.GroupEvent=Ha,bP.layer.Heatmap=class extends zc{constructor(t){t=t||{};const e=Object.assign({},t);delete e.gradient,delete e.radius,delete e.blur,delete e.weight,super(e),this.on,this.once,this.un,this.filter_=t.filter??!0,this.styleVariables_=t.variables||{},this.gradient_=null,this.addChangeListener(zx,this.handleGradientChanged_),this.setGradient(t.gradient?t.gradient:Vx),this.setBlur(void 0!==t.blur?t.blur:15),this.setRadius(void 0!==t.radius?t.radius:8);const i=t.weight?t.weight:"weight";this.weight_=i,this.setRenderOrder(null)}getBlur(){return this.get(Bx)}getGradient(){return this.get(zx)}getRadius(){return this.get(Xx)}handleGradientChanged_(){this.gradient_=function(t){const e=1,i=256,n=ft(e,i),r=n.createLinearGradient(0,0,e,i),s=1/(t.length-1);for(let e=0,i=t.length;ethis.getBlur(),t.addUniform("a_blur","float")),"number"==typeof this.getRadius()&&(n="a_radius",s.a_radius=()=>this.getRadius(),t.addUniform("a_radius","float"));const o={};let a=null;if("string"==typeof this.weight_||"function"==typeof this.weight_){const e="string"==typeof this.weight_?t=>t.get(this.weight_):this.weight_;o.prop_weight={size:1,callback:t=>{const i=e(t);return void 0!==i?Ie(i,0,1):1}},a="a_prop_weight",t.addAttribute("a_prop_weight","float")}else{a=km(e,["clamp",this.weight_,0,1],Hl)}t.addFragmentShaderFunction(`float getBlurSlope() {\n float blur = max(1., ${r});\n float radius = ${n};\n return radius / blur;\n}`).setSymbolSizeExpression(`vec2(${n} + ${r}) * 2.`).setSymbolColorExpression(`vec4(smoothstep(0., 1., (1. - length(coordsPx * 2. / v_quadSizePx)) * getBlurSlope()) * ${a})`).setStrokeColorExpression(`vec4(smoothstep(0., 1., (1. - length(currentRadiusPx * 2. / v_width)) * getBlurSlope()) * ${a})`).setStrokeWidthExpression(`(${n} + ${r}) * 2.`).setFillColorExpression(`vec4(${a})`).setFragmentDiscardExpression(`!${i}`),zm(t,e);const l=Vm(e),h=Xm(e,this.styleVariables_);return new my(this,{className:this.getClassName(),variables:this.styleVariables_,style:{builder:t,attributes:{...l,...o},uniforms:{...h,...s}},disableHitDetection:!1,postProcesses:[{fragmentShader:"\n precision mediump float;\n\n uniform sampler2D u_image;\n uniform sampler2D u_gradientTexture;\n uniform float u_opacity;\n\n varying vec2 v_texCoord;\n\n void main() {\n vec4 color = texture2D(u_image, v_texCoord);\n gl_FragColor.a = color.a * u_opacity;\n gl_FragColor.rgb = texture2D(u_gradientTexture, vec2(0.5, color.a)).rgb;\n gl_FragColor.rgb *= gl_FragColor.a;\n }",uniforms:{u_gradientTexture:()=>this.gradient_,u_opacity:()=>this.getOpacity()}}]})}updateStyleVariables(t){Object.assign(this.styleVariables_,t),this.changed()}renderDeclutter(){}},bP.layer.Image=Pf,bP.layer.Layer=nl,bP.layer.Layer.inView=rl,bP.layer.Tile=Nf,bP.layer.Vector=Gx,bP.layer.VectorImage=class extends zc{constructor(t){t=t||{};const e=Object.assign({},t);delete e.imageRatio,super(e),this.imageRatio_=void 0!==t.imageRatio?t.imageRatio:1}getImageRatio(){return this.imageRatio_}createRenderer(){return new yx(this)}},bP.layer.VectorTile=class extends zc{constructor(t){t=t||{};const e=Object.assign({},t);delete e.preload;const i=void 0===t.cacheSize?0:t.cacheSize;delete t.cacheSize,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=i;const n=t.renderMode||"hybrid";Mt("hybrid"==n||"vector"==n,"`renderMode` must be `'hybrid'` or `'vector'`"),this.renderMode_=n,this.setPreload(t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError),this.getBackground,this.setBackground}createRenderer(){return new Sx(this,{cacheSize:this.cacheSize_})}getFeatures(t){return super.getFeatures(t)}getFeaturesInExtent(t){return this.getRenderer().getFeaturesInExtent(t)}getRenderMode(){return this.renderMode_}getPreload(){return this.get(Af)}getUseInterimTilesOnError(){return this.get(Of)}setPreload(t){this.set(Af,t)}setUseInterimTilesOnError(t){this.set(Of,t)}},bP.layer.WebGLPoints=class extends nl{constructor(t){super(Object.assign({},t)),this.styleVariables_=t.variables||{},this.parseResult_=Qm(t.style,this.styleVariables_,t.filter),this.hitDetectionDisabled_=!!t.disableHitDetection}createRenderer(){const t=Object.keys(this.parseResult_.attributes).map((t=>({name:t,...this.parseResult_.attributes[t]})));return new k_(this,{vertexShader:this.parseResult_.builder.getSymbolVertexShader(),fragmentShader:this.parseResult_.builder.getSymbolFragmentShader(),hitDetectionEnabled:!this.hitDetectionDisabled_,uniforms:this.parseResult_.uniforms,attributes:t})}updateStyleVariables(t){Object.assign(this.styleVariables_,t),this.changed()}},bP.layer.WebGLTile=Wx,bP.layer.WebGLVector=class extends nl{constructor(t){super(Object.assign({},t)),this.styleVariables_=t.variables||{},this.style_=t.style,this.hitDetectionDisabled_=!!t.disableHitDetection}createRenderer(){return new my(this,{style:this.style_,variables:this.styleVariables_,disableHitDetection:this.hitDetectionDisabled_})}updateStyleVariables(t){Object.assign(this.styleVariables_,t),this.changed()}setStyle(t){this.style_=t,this.clearRenderer(),this.changed()}},bP.layer.WebGLVectorTile=class extends Df{constructor(t){super(Object.assign({},t)),this.styleVariables_=t.variables||{},this.style_=t.style,this.hitDetectionDisabled_=!!t.disableHitDetection}createRenderer(){return new vy(this,{style:this.style_,variables:this.styleVariables_,disableHitDetection:this.hitDetectionDisabled_,cacheSize:this.getCacheSize()})}updateStyleVariables(t){Object.assign(this.styleVariables_,t),this.changed()}setStyle(t){this.style_=t,this.clearRenderer(),this.changed()}},bP.loadingstrategy={},bP.loadingstrategy.all=uu,bP.loadingstrategy.bbox=function(t,e){return[t]},bP.loadingstrategy.tile=function(t){return function(e,i,n){const r=t.getZForResolution(Vn(i,n)),s=t.getTileRangeForExtentAndZ(zn(e,n),r),o=[],a=[r,0,0];for(a[1]=s.minX;a[1]<=s.maxX;++a[1])for(a[2]=s.minY;a[2]<=s.maxY;++a[2])o.push(Bn(t.getTileCoordExtent(a),n));return o}},bP.math={},bP.math.ceil=Ue,bP.math.clamp=Ie,bP.math.floor=je,bP.math.lerp=Ne,bP.math.modulo=De,bP.math.round=Ge,bP.math.solveLinearSystem=Me,bP.math.squaredDistance=Le,bP.math.squaredSegmentDistance=Fe,bP.math.toDegrees=Ae,bP.math.toFixed=ke,bP.math.toRadians=Oe,bP.math.wrap=Be,bP.net={},bP.net.ClientError=fu,bP.net.ResponseError=gu,bP.net.getJSON=pu,bP.net.jsonp=du,bP.net.overrideXHR=function(t){"undefined"!=typeof XMLHttpRequest&&(ou=XMLHttpRequest),global.XMLHttpRequest=t},bP.net.resolveUrl=_u,bP.net.restoreXHR=function(){global.XMLHttpRequest=ou},bP.obj={},bP.obj.clear=F,bP.obj.isEmpty=L,bP.proj={},bP.proj.Projection=mi,bP.proj.Units={},bP.proj.Units.METERS_PER_UNIT=_i,bP.proj.Units.fromCode=pi,bP.proj.addCommon=Wn,bP.proj.addCoordinateTransforms=Pn,bP.proj.addEquivalentProjections=Tn,bP.proj.addEquivalentTransforms=Cn,bP.proj.addProjection=vn,bP.proj.addProjections=Sn,bP.proj.clearAllProjections=function(){Ai(),ki()},bP.proj.clearUserProjection=function(){Nn=null},bP.proj.cloneTransform=yn,bP.proj.createProjection=bn,bP.proj.createSafeCoordinateTransform=$n,bP.proj.createTransformFromCoordinateTransform=Rn,bP.proj.disableCoordinateWarning=mn,bP.proj.epsg3857={},bP.proj.epsg3857.EXTENT=vi,bP.proj.epsg3857.HALF_SIZE=xi,bP.proj.epsg3857.MAX_SAFE_Y=Ei,bP.proj.epsg3857.PROJECTIONS=Ti,bP.proj.epsg3857.RADIUS=yi,bP.proj.epsg3857.WORLD_EXTENT=Si,bP.proj.epsg3857.fromEPSG4326=Ci,bP.proj.epsg3857.toEPSG4326=bi,bP.proj.epsg4326={},bP.proj.epsg4326.EXTENT=Pi,bP.proj.epsg4326.METERS_PER_UNIT=Ii,bP.proj.epsg4326.PROJECTIONS=Li,bP.proj.epsg4326.RADIUS=Ri,bP.proj.equivalent=Fn,bP.proj.fromLonLat=function(t,e){return mn(),On(t,"EPSG:4326",void 0!==e?e:"EPSG:3857")},bP.proj.fromUserCoordinate=Un,bP.proj.fromUserExtent=zn,bP.proj.fromUserResolution=Vn,bP.proj.get=En,bP.proj.getPointResolution=wn,bP.proj.getTransform=An,bP.proj.getTransformFromProjections=Ln,bP.proj.getUserProjection=Gn,bP.proj.identityTransform=xn,bP.proj.proj4={},bP.proj.proj4.epsgLookupMapTiler=function(t){return async function(e){const i=await fetch(`https://api.maptiler.com/coordinates/search/code:${e}.json?transformations=true&exports=true&key=${t}`);if(!i.ok)throw new Error(`Unexpected response from maptiler.com: ${i.status}`);return i.json().then((t=>{const i=t.results;if(i?.length>0){const t=i.filter((t=>"EPSG"===t.id?.authority&&t.id?.code===e))[0];if(t){const e=t.transformations;if(e?.length>0){const i=t.default_transformation;if(e.filter((t=>t.id?.authority===i?.authority&&t.id?.code===i?.code&&0===t.grids?.length)).length>0)return t.exports?.proj4;const n=e.filter((t=>0===t.grids?.length&&"EPSG"===t.target_crs?.authority&&4326===t.target_crs?.code&&!1===t.deprecated&&!0===t.usable)).sort(((t,e)=>t.accuracy-e.accuracy))[0]?.exports?.proj4;if(n)return n}return t.exports?.proj4}}}))}},bP.proj.proj4.fromEPSGCode=async function(t){return"number"==typeof t&&(t="EPSG:"+t),await Cx(t)},bP.proj.proj4.fromProjectionCode=Cx,bP.proj.proj4.getEPSGLookup=function(){return bx},bP.proj.proj4.getProjectionCodeLookup=function(){return Tx},bP.proj.proj4.isRegistered=function(){return!!Ex},bP.proj.proj4.register=wx,bP.proj.proj4.setEPSGLookup=function(t){bx=t},bP.proj.proj4.setProjectionCodeLookup=function(t){Tx=t},bP.proj.proj4.unregister=function(){Ex=null},bP.proj.projections={},bP.proj.projections.add=Di,bP.proj.projections.clear=Ai,bP.proj.projections.get=Oi,bP.proj.setUserProjection=kn,bP.proj.toLonLat=In,bP.proj.toUserCoordinate=jn,bP.proj.toUserExtent=Bn,bP.proj.toUserResolution=Xn,bP.proj.transform=On,bP.proj.transformExtent=Dn,bP.proj.transformWithProjections=function(t,e,i){return Ln(e,i)(t)},bP.proj.transforms={},bP.proj.transforms.add=Gi,bP.proj.transforms.clear=ki,bP.proj.transforms.get=ji,bP.proj.transforms.remove=function(t,e){const i=t.getCode(),n=e.getCode(),r=Ni[i][n];return delete Ni[i][n],L(Ni[i])&&delete Ni[i],r},bP.proj.useGeographic=function(){kn("EPSG:4326")},bP.proj.utm={},bP.proj.utm.makeProjection=dn,bP.proj.utm.makeTransforms=gn,bP.proj.utm.zoneFromCode=cn,bP.render={},bP.render.Box=ya,bP.render.Event=Xc,bP.render.Feature=Ud,bP.render.Feature.toFeature=function(t,e){const i=t.getId(),n=Bd(t),r=t.getProperties(),s=new At;return void 0!==e&&s.setGeometryName(e),s.setGeometry(n),void 0!==i&&s.setId(i),s.setProperties(r,!0),s},bP.render.Feature.toGeometry=Bd,bP.render.VectorContext=yu,bP.render.canvas={},bP.render.canvas.Builder=Gy,bP.render.canvas.BuilderGroup=Zy,bP.render.canvas.Executor=sx,bP.render.canvas.ExecutorGroup=ux,bP.render.canvas.ExecutorGroup.ALL=ox,bP.render.canvas.ExecutorGroup.DECLUTTER=ax,bP.render.canvas.ExecutorGroup.NON_DECLUTTER=lx,bP.render.canvas.ExecutorGroup.getPixelIndexArray=gx,bP.render.canvas.ImageBuilder=jy,bP.render.canvas.Immediate=xu,bP.render.canvas.Instruction={},bP.render.canvas.Instruction.beginPathInstruction=Ny,bP.render.canvas.Instruction.closePathInstruction=ky,bP.render.canvas.Instruction.fillInstruction=Oy,bP.render.canvas.Instruction.strokeInstruction=Dy,bP.render.canvas.LineStringBuilder=Uy,bP.render.canvas.PolygonBuilder=By,bP.render.canvas.TextBuilder=$y,bP.render.canvas.TextBuilder.TEXT_ALIGN=Vy,bP.render.canvas.ZIndexContext=Sf,bP.render.canvas.checkedFonts=Xh,bP.render.canvas.defaultFillStyle=Oh,bP.render.canvas.defaultFont=Ah,bP.render.canvas.defaultLineCap=Dh,bP.render.canvas.defaultLineDash=Nh,bP.render.canvas.defaultLineDashOffset=0,bP.render.canvas.defaultLineJoin=kh,bP.render.canvas.defaultLineWidth=1,bP.render.canvas.defaultMiterLimit=Gh,bP.render.canvas.defaultPadding=zh,bP.render.canvas.defaultStrokeOffset=0,bP.render.canvas.defaultStrokeStyle=jh,bP.render.canvas.defaultTextAlign=Uh,bP.render.canvas.defaultTextBaseline=Bh,bP.render.canvas.drawImageOrLabel=ec,bP.render.canvas.getTextDimensions=tc,bP.render.canvas.hitdetect={},bP.render.canvas.hitdetect.HIT_DETECT_RESOLUTION=fx,bP.render.canvas.hitdetect.createHitDetectionImageData=px,bP.render.canvas.hitdetect.hitDetect=_x,bP.render.canvas.measureAndCacheTextWidth=Qh,bP.render.canvas.measureTextHeight=Kh,bP.render.canvas.measureTextWidth=Jh,bP.render.canvas.registerFont=Hh,bP.render.canvas.rotateAtOffset=function(t,e,i,n){0!==e&&(t.translate(i,n),t.rotate(e),t.translate(-i,-n))},bP.render.canvas.style={},bP.render.canvas.style.buildRuleSet=xc,bP.render.canvas.style.buildStyle=vc,bP.render.canvas.style.flatStylesToStyleFunction=yc,bP.render.canvas.style.rulesToStyleFunction=mc,bP.render.canvas.textHeights=Wh,bP.render.getRenderPixel=function(t,e){return Qn(t.inversePixelTransform,e.slice(0))},bP.render.getVectorContext=bu,bP.render.toContext=function(t,e){const i=t.canvas,n=(e=e||{}).pixelRatio||ht,r=e.size;r&&(i.width=r[0]*n,i.height=r[1]*n,i.style.width=r[0]+"px",i.style.height=r[1]+"px");const s=[0,0,i.width,i.height],o=er([1,0,0,1,0,0],n,n);return new xu(t,n,s,o,0)},bP.render.webgl={},bP.render.webgl.MixedGeometryBatch=qp,bP.render.webgl.ShaderBuilder={},bP.render.webgl.ShaderBuilder.COMMON_HEADER=$m,bP.render.webgl.ShaderBuilder.ShaderBuilder=Zm,bP.render.webgl.VectorStyleRenderer=fy,bP.render.webgl.VectorStyleRenderer.convertStyleToShaders=py,bP.render.webgl.bufferUtil={},bP.render.webgl.bufferUtil.LINESTRING_ANGLE_COSINE_CUTOFF=Om,bP.render.webgl.bufferUtil.writeLineSegmentToBuffers=function(t,e,i,n,r,s,o,a,l,h){const c=[t[e],t[e+1]],u=[t[i],t[i+1]],d=t[e+2],g=t[i+2],f=Qn(a,[...c]),p=Qn(a,[...u]);let _=-1,m=-1,y=h;const x=null!==r;if(null!==n){_=gi(f,p,Qn(a,[...[t[n],t[n+1]]])),Math.cos(_)<=Om&&(y+=Math.tan((_-Math.PI)/2))}if(x){m=gi(p,f,Qn(a,[...[t[r],t[r+1]]])),Math.cos(m)<=Om&&(y+=Math.tan((Math.PI-m)/2))}const v=Math.pow(2,24),S=l%v,E=Math.floor(l/v)*v;return s.push(c[0],c[1],d,u[0],u[1],g,_,m,S,E,h),s.push(...o),{length:l+Math.sqrt((p[0]-f[0])*(p[0]-f[0])+(p[1]-f[1])*(p[1]-f[1])),angle:y}},bP.render.webgl.bufferUtil.writePointFeatureToBuffers=function(t,e,i,n,r){const s=t[e++],o=t[e++],a=Dm;a.length=n;for(let i=0;it.json())).then((t=>this.handleImageryMetadataResponse(t)))}getApiKey(){return this.apiKey_}getImagerySet(){return this.imagerySet_}handleImageryMetadataResponse(t){if(200!=t.statusCode||"OK"!=t.statusDescription||"ValidCredentials"!=t.authenticationResultCode||1!=t.resourceSets.length||1!=t.resourceSets[0].resources.length)return void this.setState("error");const e=t.resourceSets[0].resources[0],i=-1==this.maxZoom_?e.zoomMax:this.maxZoom_,n=Qu(this.getProjection()),r=this.hidpi_?2:1,s=e.imageWidth==e.imageHeight?e.imageWidth/r:[e.imageWidth/r,e.imageHeight/r],o=Ku({extent:n,minZoom:e.zoomMin,maxZoom:i,tileSize:s});this.tileGrid=o;const a=this.culture_,l=this.hidpi_,h=this.placeholderTiles_;if(this.tileUrlFunction=cd(e.imageUrlSubdomains.map((function(t){const i=[0,0,0],n=e.imageUrl.replace("{subdomain}",t).replace("{culture}",a);return function(t,e,r){if(!t)return;Nu(t[0],t[1],t[2],i);const s=new URL(n.replace("{quadkey}",Cd(i))),o=s.searchParams;return l&&(o.set("dpi","d1"),o.set("device","mobile")),!0===h?o.delete("n"):!1===h&&o.set("n","z"),s.toString()}}))),e.imageryProviders){const t=Ln(En("EPSG:4326"),this.getProjection());this.setAttributions((i=>{const n=[],r=i.viewState,s=this.getTileGrid(),o=s.getZForResolution(r.resolution,this.zDirection),a=s.getTileCoordForCoordAndZ(r.center,o)[0];return e.imageryProviders.map((function(e){let r=!1;const s=e.coverageAreas;for(let e=0,n=s.length;e=n.zoomMin&&a<=n.zoomMax){const e=n.bbox;if(Se(be([e[1],e[0],e[3],e[2]],t),i.extent)){r=!0;break}}}r&&n.push(e.attribution)})),n.push('Terms of Use'),n}))}this.setState("ready")}},bP.source.BingMaps.quadKey=Cd,bP.source.CartoDB=class extends bd{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,maxZoom:void 0!==t.maxZoom?t.maxZoom:18,minZoom:t.minZoom,projection:t.projection,transition:t.transition,wrapX:t.wrapX,zDirection:t.zDirection}),this.account_=t.account,this.mapId_=t.map||"",this.config_=t.config||{},this.templateCache_={},this.initializeMap_()}getConfig(){return this.config_}updateConfig(t){Object.assign(this.config_,t),this.initializeMap_()}setConfig(t){this.config_=t||{},this.initializeMap_()}initializeMap_(){const t=JSON.stringify(this.config_);if(this.templateCache_[t])return void this.applyTemplate_(this.templateCache_[t]);let e="https://"+this.account_+".carto.com/api/v1/map";this.mapId_&&(e+="/named/"+this.mapId_);const i=new XMLHttpRequest;i.addEventListener("load",this.handleInitResponse_.bind(this,t)),i.addEventListener("error",this.handleInitError_.bind(this)),i.open("POST",e),i.setRequestHeader("Content-type","application/json"),i.send(JSON.stringify(this.config_))}handleInitResponse_(t,e){const i=e.target;if(!i.status||i.status>=200&&i.status<300){let e;try{e=JSON.parse(i.responseText)}catch{return void this.setState("error")}this.applyTemplate_(e),this.templateCache_[t]=e,this.setState("ready")}else this.setState("error")}handleInitError_(t){this.setState("error")}applyTemplate_(t){const e="https://"+t.cdn_url.https+"/"+this.account_+"/api/v1/map/"+t.layergroupid+"/{z}/{x}/{y}.png";this.setUrl(e)}},bP.source.Cluster=class extends qd{constructor(t){super({attributions:(t=t||{}).attributions,wrapX:t.wrapX}),this.resolution=void 0,this.distance=void 0!==t.distance?t.distance:20,this.minDistance=t.minDistance||0,this.interpolationRatio=0,this.features=[],this.geometryFunction=t.geometryFunction||function(t){const e=t.getGeometry();return Mt(!e||"Point"===e.getType(),"The default `geometryFunction` can only handle `Point` or null geometries"),e},this.createCustomCluster_=t.createCluster,this.source=null,this.boundRefresh_=this.refresh.bind(this),this.updateDistance(this.distance,this.minDistance),this.setSource(t.source||null)}clear(t){this.features.length=0,super.clear(t)}getDistance(){return this.distance}getSource(){return this.source}loadFeatures(t,e,i){this.source?.loadFeatures(t,e,i),e!==this.resolution&&(this.resolution=e,this.refresh())}setDistance(t){this.updateDistance(t,this.minDistance)}setMinDistance(t){this.updateDistance(this.distance,t)}getMinDistance(){return this.minDistance}setSource(t){this.source&&this.source.removeEventListener(n,this.boundRefresh_),this.source=t,t&&t.addEventListener(n,this.boundRefresh_),this.refresh()}refresh(){this.clear(),this.cluster(),this.addFeatures(this.features)}updateDistance(t,e){const i=0===t?0:Math.min(e,t)/t,n=t!==this.distance||this.interpolationRatio!==i;this.distance=t,this.minDistance=e,this.interpolationRatio=i,n&&this.refresh()}cluster(){if(void 0===this.resolution||!this.source)return;const t=[1/0,1/0,-1/0,-1/0],e=this.distance*this.resolution,i=this.source.getFeatures(),n={};for(let r=0,s=i.length;r=0;--e){const n=this.geometryFunction(t[e]);n?Qe(i,n.getCoordinates()):t.splice(e,1)}oi(i,1/t.length);const n=de(e),r=this.interpolationRatio,s=new Wr([i[0]*(1-r)+n[0]*r,i[1]*(1-r)+n[1]*r]);return this.createCustomCluster_?this.createCustomCluster_(s,t):new At({geometry:s,features:t})}},bP.source.DataTile=dg,bP.source.GeoTIFF=Cg,bP.source.GeoZarr=class extends dg{constructor(t){super({state:"loading",tileGrid:null,projection:t.projection||null,transition:t.transition,wrapX:t.wrapX}),this.url_=t.url,this.group_=t.group,this.error_=null,this.root_=null,this.consolidatedMetadata_=null,this.bands_=t.bands,this.bandsByLevel_=null,this.fillValue_,this.resampleMethod_=t.resample||"linear",this.bandCount=this.bands_.length,this.setLoader(this.loadTile_.bind(this)),this.tileGrid,this.configure_().then((()=>{this.setState("ready")})).catch((t=>{this.error_=t,this.setState("error")}))}async configure_(){const t=new zarr.FetchStore(this.url_);this.root_=await zarr.open(t,{kind:"group"});try{this.consolidatedMetadata_=JSON.parse((new TextDecoder).decode(await t.get(this.root_.resolve("zarr.json").path))).consolidated_metadata.metadata}catch{}const e=(await zarr.open(this.root_.resolve(this.group_),{kind:"group"})).attrs;if("zarr_conventions"in e&&Array.isArray(e.zarr_conventions)&&r_.every((t=>e.zarr_conventions.find((e=>e.uuid===t))))&&"layout"in e.multiscales){const{tileGrid:t,projection:i,bandsByLevel:n,fillValue:r}=function(t,e,i,n){const r=t.multiscales,s=t["spatial:bbox"],o=En(t["proj:code"]),a=[],l=e?{}:null;let h;for(const t of r.layout){const r=t["spatial:transform"],s=r[0],o=[r[2],r[5]],c=t.asset;if(a.push({matrixId:c,resolution:s,origin:o}),e){const t=[];for(const r of n){const n=e[`${i}/${c}/${r}`];n&&(t.push(r),void 0===h&&(h=n.fill_value))}l[c]=t}}a.sort(((t,e)=>e.resolution-t.resolution));const c=new $u({extent:s,origins:a.map((t=>t.origin)),resolutions:a.map((t=>t.resolution)),matrixIds:a.map((t=>t.matrixId))});return{tileGrid:c,projection:o,bandsByLevel:l,fillValue:h}}(e,this.consolidatedMetadata_,this.group_,this.bands_);this.bandsByLevel_=n,this.tileGrid=t,this.projection=i,this.fillValue_=r}if("tile_matrix_set"in e.multiscales){const{tileGrid:t,projection:i}=function(t){const e=t.multiscales,i=e.tile_matrix_set,n=e.tile_matrix_limits,r=i.tileMatrices.length,s=new Array(r);let o=!1;for(let t=0;t512||e.tileHeight>512)&&(o=!0),s[t]=n[r]}const a=_f({},i,void 0,s);let l=a.grid;o&&(l=new $u({tileSize:512,extent:l.getExtent(),origins:l.getOrigins(),resolutions:l.getResolutions(),matrixIds:l.getMatrixIds()}));return{tileGrid:l,projection:a.projection}}(e);this.tileGrid=t,this.projection||(this.projection=i)}if(!this.tileGrid)throw new Error("Could not determine tile grid");const i=this.tileGrid.getExtent();setTimeout((()=>{this.viewResolver({showFullExtent:!0,projection:this.projection,resolutions:this.tileGrid.getResolutions(),center:jn(de(i),this.projection),extent:Bn(i,this.projection),zoom:1})}))}async loadTile_(t,e,i,n){const r=this.tileGrid.getResolutions(),s=this.tileGrid.getResolution(t),o=this.tileGrid.getTileCoordExtent([t,e,i]),a=[],l=[];for(const e of this.bands_){let i,n,h=0;if(this.bandsByLevel_)for(let t=0;tthis.createSession_()),c),this.setAttributions(this.fetchAttributions_.bind(this)),this.setState("ready")}async fetchAttributions_(t){if(t.viewHints[co]||t.viewHints[uo]||t.animate)return this.previousViewportAttribution_;const[e,i]=In(ce(t.extent),t.viewState.projection),[n,r]=In(xe(t.extent),t.viewState.projection),s=`zoom=${this.getTileGrid().getZForResolution(t.viewState.resolution,this.zDirection)}&north=${r}&south=${i}&east=${n}&west=${e}`;if(this.previousViewportExtent_==s)return this.previousViewportAttribution_;this.previousViewportExtent_=s;const o=this.sessionTokenValue_,a=this.apiKey_,l=`${this.attributionUrl_}?session=${o}&key=${a}&${s}`;return this.previousViewportAttribution_=await fetch(l).then((t=>t.json())).then((t=>t.copyright)),this.previousViewportAttribution_}disposeInternal(){clearTimeout(this.sessionRefreshId_),super.disposeInternal()}},bP.source.IIIF=class extends wd{constructor(t){const e=t||{};let i=e.url||"";i+=i.lastIndexOf("/")===i.length-1||""===i?"":"/";const n=e.version||Rg,r=e.sizes||[],s=e.size;Mt(null!=s&&Array.isArray(s)&&2==s.length&&!isNaN(s[0])&&s[0]>0&&!isNaN(s[1])&&s[1]>0,"Missing or invalid `size`");const o=s[0],a=s[1],l=e.tileSize,h=e.tilePixelRatio||1,c=e.format||"jpg",u=e.quality||(e.version==bg?"native":"default");let d=e.resolutions||[];const g=e.supports||[],f=e.extent||[0,-a,o,0],p=null!=r&&Array.isArray(r)&&r.length>0,_=void 0!==l&&("number"==typeof l&&Number.isInteger(l)&&l>0||Array.isArray(l)&&l.length>0),m=null!=g&&Array.isArray(g)&&(g.includes("regionByPx")||g.includes("regionByPct"))&&(g.includes("sizeByWh")||g.includes("sizeByH")||g.includes("sizeByW")||g.includes("sizeByPct"));let y,x,v;if(d.sort((function(t,e){return e-t})),_||m)if(null!=l&&("number"==typeof l&&Number.isInteger(l)&&l>0?(y=l,x=l):Array.isArray(l)&&l.length>0&&((1==l.length||null==l[1]&&Number.isInteger(l[0]))&&(y=l[0],x=l[0]),2==l.length&&(Number.isInteger(l[0])&&Number.isInteger(l[1])?(y=l[0],x=l[1]):null==l[0]&&Number.isInteger(l[1])&&(y=l[1],x=l[1])))),void 0!==y&&void 0!==x||(y=Co,x=Co),0==d.length){v=Math.max(Math.ceil(Math.log(o/y)/Math.LN2),Math.ceil(Math.log(a/x)/Math.LN2));for(let t=v;t>=0;t--)d.push(Math.pow(2,t))}else{const t=Math.max(...d);v=Math.round(Math.log(t)/Math.LN2)}else if(y=o,x=a,d=[],p){r.sort((function(t,e){return t[0]-e[0]})),v=-1;const t=[];for(let e=0;e0&&d[d.length-1]==i?t.push(e):(d.push(i),v++)}if(t.length>0)for(let e=0;ev)return;const S=t[1],E=t[2],w=d[f];if(!(void 0===S||void 0===E||void 0===w||S<0||Math.ceil(o/w/y)<=S||E<0||Math.ceil(a/w/x)<=E)){if(m||_){const t=S*y*w,e=E*x*w;let i=y*w,r=x*w,s=y,c=x;if(t+i>o&&(i=o-t),e+r>a&&(r=a-e),t+y*w>o&&(s=Math.floor((o-t+w-1)/w)),e+x*w>a&&(c=Math.floor((a-e+w-1)/w)),0==t&&i==o&&0==e&&r==a)l="full";else if(!m||g.includes("regionByPx"))l=t+","+e+","+i+","+r;else if(g.includes("regionByPct")){l="pct:"+Dg(t/o*100)+","+Dg(e/a*100)+","+Dg(i/o*100)+","+Dg(r/a*100)}n!=Pg||m&&!g.includes("sizeByWh")?!m||g.includes("sizeByW")?h=s+",":g.includes("sizeByH")?h=","+c:g.includes("sizeByWh")?h=s+","+c:g.includes("sizeByPct")&&(h="pct:"+Dg(100/w)):h=s+","+c}else if(l="full",p){const t=r[f][0],e=r[f][1];h=n==Pg?t==o&&e==a?"max":t+","+e:t==o?"full":t+","}else h=n==Pg?"max":"full";return i+l+"/"+h+"/0/"+u+"."+c}},transition:e.transition}),this.zDirection=e.zDirection}},bP.source.Image=Bg,bP.source.Image.ImageSourceEvent=Ug,bP.source.Image.defaultImageLoadFunction=zg,bP.source.Image.getRequestExtent=Xg,bP.source.ImageArcGISRest=class extends Bg{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions}),this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null,this.referrerPolicy_=t.referrerPolicy,this.hidpi_=void 0===t.hidpi||t.hidpi,this.url_=t.url,this.imageLoadFunction_=void 0!==t.imageLoadFunction?t.imageLoadFunction:zg,this.params_=Object.assign({},t.params),this.imageSize_=[0,0],this.renderedRevision_=0,this.ratio_=void 0!==t.ratio?t.ratio:1.5,this.loaderProjection_=null}getParams(){return this.params_}getImageInternal(t,e,i,n){return void 0===this.url_?null:(this.loader&&this.loaderProjection_===n||(this.loaderProjection_=n,this.loader=$g({crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,params:this.params_,projection:n,hidpi:this.hidpi_,url:this.url_,ratio:this.ratio_,load:(t,e)=>(this.image.setImage(t),this.imageLoadFunction_(this.image,e),js(t))})),super.getImageInternal(t,e,i,n))}getImageLoadFunction(){return this.imageLoadFunction_}getUrl(){return this.url_}setImageLoadFunction(t){this.imageLoadFunction_=t,this.changed()}setUrl(t){t!=this.url_&&(this.url_=t,this.loader=null,this.changed())}setParams(t){this.params_=Object.assign({},t),this.changed()}updateParams(t){Object.assign(this.params_,t),this.changed()}changed(){this.image=null,super.changed()}},bP.source.ImageCanvas=class extends Bg{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions,state:t.state}),this.canvasFunction_=t.canvasFunction,this.canvas_=null,this.renderedRevision_=0,this.ratio_=void 0!==t.ratio?t.ratio:1.5}getImageInternal(t,e,i,n){e=this.findNearestResolution(e);let r=this.canvas_;if(r&&this.renderedRevision_==this.getRevision()&&r.getResolution()==e&&r.getPixelRatio()==i&&Wt(r.getExtent(),t))return r;Te(t=t.slice(),this.ratio_);const s=[ve(t)/e*i,_e(t)/e*i],o=this.canvasFunction_.call(this,t,e,i,s,n);return o&&(r=new Us(t,e,i,o)),this.canvas_=r,this.renderedRevision_=this.getRevision(),r}},bP.source.ImageMapGuide=class extends Bg{constructor(t){super({interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions}),this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null,this.referrerPolicy_=t.referrerPolicy,this.displayDpi_=void 0!==t.displayDpi?t.displayDpi:96,this.params_=Object.assign({},t.params),this.url_=t.url,this.imageLoadFunction_=void 0!==t.imageLoadFunction?t.imageLoadFunction:zg,this.hidpi_=void 0===t.hidpi||t.hidpi,this.metersPerUnit_=void 0!==t.metersPerUnit?t.metersPerUnit:1,this.ratio_=void 0!==t.ratio?t.ratio:1,this.useOverlay_=void 0!==t.useOverlay&&t.useOverlay,this.renderedRevision_=0,this.loaderProjection_=null}getParams(){return this.params_}getImageInternal(t,e,i,n){return void 0===this.url_?null:(this.loader&&this.loaderProjection_===n||(this.loaderProjection_=n,this.loader=Zg({crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,params:this.params_,hidpi:this.hidpi_,metersPerUnit:this.metersPerUnit_,url:this.url_,useOverlay:this.useOverlay_,ratio:this.ratio_,load:(t,e)=>(this.image.setImage(t),this.imageLoadFunction_(this.image,e),js(t))})),super.getImageInternal(t,e,i,n))}getImageLoadFunction(){return this.imageLoadFunction_}setParams(t){this.params_=Object.assign({},t),this.changed()}updateParams(t){Object.assign(this.params_,t),this.changed()}setImageLoadFunction(t){this.imageLoadFunction_=t,this.changed()}changed(){this.image=null,super.changed()}},bP.source.ImageStatic=class extends Bg{constructor(t){const e=void 0!==t.crossOrigin?t.crossOrigin:null,i=void 0!==t.imageLoadFunction?t.imageLoadFunction:zg;super({attributions:t.attributions,interpolate:t.interpolate,projection:En(t.projection)}),this.url_=t.url,this.imageExtent_=t.imageExtent,this.image=null,this.image=new Ds(this.imageExtent_,void 0,1,Yg({url:t.url,imageExtent:t.imageExtent,crossOrigin:e,referrerPolicy:t.referrerPolicy,load:(t,e)=>(this.image.setImage(t),i(this.image,e),js(t))})),this.image.addEventListener(n,this.handleImageChange.bind(this))}getImageExtent(){return this.imageExtent_}getImageInternal(t,e,i,n){return Se(t,this.image.getExtent())?this.image:null}getUrl(){return this.url_}},bP.source.ImageTile=ef,bP.source.ImageWMS=class extends Bg{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions}),this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null,this.referrerPolicy_=t.referrerPolicy,this.url_=t.url,this.imageLoadFunction_=void 0!==t.imageLoadFunction?t.imageLoadFunction:zg,this.params_=Object.assign({},t.params),this.serverType_=t.serverType,this.hidpi_=void 0===t.hidpi||t.hidpi,this.renderedRevision_=0,this.ratio_=void 0!==t.ratio?t.ratio:1.5,this.loaderProjection_=null}getFeatureInfoUrl(t,e,i,n){const r=En(i),s=this.getProjection();s&&s!==r&&(e=Lu(s,r,t,e),t=On(t,r,s));return hf({url:this.url_,params:{...this.params_,...n},projection:s||r},t,e)}getLegendUrl(t,e){return cf({url:this.url_,params:{...this.params_,...e}},t)}getParams(){return this.params_}getImageInternal(t,e,i,n){return void 0===this.url_?null:(this.loader&&this.loaderProjection_===n||(this.loaderProjection_=n,this.loader=lf({crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,params:this.params_,projection:n,serverType:this.serverType_,hidpi:this.hidpi_,url:this.url_,ratio:this.ratio_,load:(t,e)=>(this.image.setImage(t),this.imageLoadFunction_(this.image,e),js(t))})),super.getImageInternal(t,e,i,n))}getImageLoadFunction(){return this.imageLoadFunction_}getUrl(){return this.url_}setImageLoadFunction(t){this.imageLoadFunction_=t,this.changed()}setUrl(t){t!=this.url_&&(this.url_=t,this.loader=null,this.changed())}setParams(t){this.params_=Object.assign({},t),this.loader=null,this.changed()}updateParams(t){Object.assign(this.params_,t),this.changed()}changed(){this.image=null,super.changed()}},bP.source.OGCMap=class extends Bg{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions}),this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null,this.referrerPolicy_=t.referrerPolicy,this.url_=t.url,this.imageLoadFunction_=void 0!==t.imageLoadFunction?t.imageLoadFunction:zg,this.params_=Object.assign({},t.params),this.hidpi_=void 0===t.hidpi||t.hidpi,this.renderedRevision_=0,this.ratio_=void 0!==t.ratio?t.ratio:1.5,this.loaderProjection_=null}getParams(){return this.params_}getImageInternal(t,e,i,n){return void 0===this.url_?null:(this.loader&&this.loaderProjection_===n||(this.loaderProjection_=n,this.loader=a_({crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,params:this.params_,projection:n,hidpi:this.hidpi_,url:this.url_,ratio:this.ratio_,load:(t,e)=>(this.image.setImage(t),this.imageLoadFunction_(this.image,e),js(t))})),super.getImageInternal(t,e,i,n))}getImageLoadFunction(){return this.imageLoadFunction_}getUrl(){return this.url_}setImageLoadFunction(t){this.imageLoadFunction_=t,this.changed()}setUrl(t){t!=this.url_&&(this.url_=t,this.loader=null,this.changed())}setParams(t){this.params_=Object.assign({},t),this.loader=null,this.changed()}updateParams(t){Object.assign(this.params_,t),this.changed()}changed(){this.image=null,super.changed()}},bP.source.OGCMapTile=class extends wd{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,state:"loading",tileLoadFunction:t.tileLoadFunction,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition});mf({url:t.url,projection:this.getProjection(),mediaType:t.mediaType,context:t.context||null,collections:t.collections}).then(this.handleTileSetInfo_.bind(this)).catch(this.handleError_.bind(this))}handleTileSetInfo_(t){this.tileGrid=t.grid,this.projection=t.projection,this.setTileUrlFunction(t.urlFunction,t.urlTemplate),this.setState("ready")}handleError_(t){Ke(t),this.setState("error")}},bP.source.OGCVectorTile=class extends yf{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,format:t.format,overlaps:t.overlaps,projection:t.projection,tileClass:t.tileClass,transition:t.transition,wrapX:t.wrapX,zDirection:t.zDirection,state:"loading"});mf({url:t.url,projection:this.getProjection(),mediaType:t.mediaType,supportedMediaTypes:t.format.supportedMediaTypes,context:t.context||null,collections:t.collections}).then(this.handleTileSetInfo_.bind(this)).catch(this.handleError_.bind(this))}handleTileSetInfo_(t){this.tileGrid=t.grid,this.projection=t.projection,this.setTileUrlFunction(t.urlFunction,t.urlTemplate),this.setState("ready")}handleError_(t){Ke(t),this.setState("error")}},bP.source.OSM=class extends bd{constructor(t){let e;e=void 0!==(t=t||{}).attributions?t.attributions:[vf];const i=void 0!==t.url?t.url:"https://tile.openstreetmap.org/{z}/{x}/{y}.png";super({attributions:e,attributionsCollapsible:!1,cacheSize:t.cacheSize,crossOrigin:void 0!==t.crossOrigin?t.crossOrigin:"anonymous",referrerPolicy:t.referrerPolicy||"origin-when-cross-origin",interpolate:t.interpolate,maxZoom:void 0!==t.maxZoom?t.maxZoom:19,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileLoadFunction:t.tileLoadFunction,transition:t.transition,url:i,wrapX:t.wrapX,zDirection:t.zDirection})}},bP.source.OSM.ATTRIBUTION=vf,bP.source.Raster=Xf,bP.source.Raster.Processor=jf,bP.source.Raster.RasterSourceEvent=zf,bP.source.SentinelHub=class extends dg{constructor(t){const e=t||{};super({state:"loading",projection:e.projection,attributionsCollapsible:e.attributionsCollapsible,interpolate:e.interpolate,tileSize:e.tileSize||l_,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition}),this.setLoader(((t,e,i)=>this.loadTile_(t,e,i,1))),this.error_=null,this.evalscript_="",this.inputData_=null,this.processUrl_=e.url||"https://services.sentinel-hub.com/api/v1/process",this.token_="",this.tokenRenewalId_,e.auth&&this.setAuth(e.auth),e.data&&this.setData(e.data),e.evalscript&&this.setEvalscript(e.evalscript)}async setAuth(t){if(clearTimeout(this.tokenRenewalId_),"string"==typeof t)return this.token_=t,void this.fireWhenReady_();let e,i;try{e=await async function(t){const e=t.tokenUrl||"https://services.sentinel-hub.com/auth/realms/main/protocol/openid-connect/token",i=new URLSearchParams;i.append("grant_type","client_credentials"),i.append("client_id",t.clientId),i.append("client_secret",t.clientSecret);const n={method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:i},r=await fetch(e,n);if(!r.ok){if(401===r.status)throw new Error("Bad client id or secret");throw new Error("Failed to get token")}return(await r.json()).access_token}(t),i=h_(e)}catch(t){return this.error_=t,void this.setState("error")}this.token_=e;const n=1e3*i.exp,r=Math.max(n-Date.now()-6e4,1);this.tokenRenewalId_=setTimeout((()=>this.setAuth(t)),r),this.fireWhenReady_()}setData(t){this.inputData_=t,this.fireWhenReady_()}setEvalscript(t){let e;if("string"==typeof t)e=t;else try{e=function(t){return`//VERSION=${t.version||"3"}\n ${u_("setup",t.setup)}\n ${u_("evaluatePixel",t.evaluatePixel)}\n ${u_("updateOutput",t.updateOutput)}\n `}(t)}catch(t){return this.error_=t,void this.setState("error")}this.evalscript_=e,this.fireWhenReady_()}fireWhenReady_(){if(!this.token_||!this.evalscript_||!this.inputData_)return;this.setKey(this.getKeyForConfig_());"ready"!==this.getState()?this.setState("ready"):this.changed()}getKeyForConfig_(){return this.token_+this.evalscript_+JSON.stringify(this.inputData_)}async loadTile_(t,e,i,n){const r=this.getTileGrid().getTileCoordExtent([t,e,i]),s=this.getTileSize(t),o={input:{bounds:{bbox:r,properties:{crs:c_(this.getProjection())}},data:this.inputData_},output:{width:s[0],height:s[1]},evalscript:this.evalscript_},a={method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.token_}`,"Access-Control-Request-Headers":"Retry-After"},body:JSON.stringify(o),credentials:"include"},l=await fetch(this.processUrl_,a);if(!l.ok){if(429===l.status&&n<9){const r=500*2**n;return await(h=r,new Promise((t=>setTimeout(t,h)))),this.loadTile_(e,i,t,n+1)}throw new Error(`Failed to get tile: ${l.statusText}`)}var h;return async function(t){const e=await t.blob();return new Promise(((t,i)=>{const n=new Image,r=URL.createObjectURL(e);n.onload=()=>{URL.revokeObjectURL(r),t(n)},n.onerror=()=>{URL.revokeObjectURL(r),i(new Error("Failed to load image"))},n.src=r}))}(l)}getError(){return this.error_}disposeInternal(){clearTimeout(this.tokenRenewalId_),super.disposeInternal()}},bP.source.SentinelHub.getProjectionIdentifier=c_,bP.source.SentinelHub.parseTokenClaims=h_,bP.source.SentinelHub.serializeFunction=u_,bP.source.Source=pd,bP.source.StadiaMaps=class extends bd{constructor(t){const e=t.layer.indexOf("-"),i=-1==e?t.layer:t.layer.slice(0,e),n=Yf[i]||{minZoom:0,maxZoom:20,retina:!0},r=Zf[t.layer],s=t.apiKey?"?api_key="+t.apiKey:"",o=n.retina&&t.retina?"@2x":"",a=void 0!==t.url?t.url:"https://tiles.stadiamaps.com/tiles/"+t.layer+"/{z}/{x}/{y}"+o+"."+r.extension+s,l=['© Stadia Maps','© OpenMapTiles',vf];t.layer.startsWith("stamen_")&&l.splice(1,0,'© Stamen Design'),super({attributions:l,cacheSize:t.cacheSize,crossOrigin:"anonymous",interpolate:t.interpolate,maxZoom:void 0!==t.maxZoom?t.maxZoom:n.maxZoom,minZoom:void 0!==t.minZoom?t.minZoom:n.minZoom,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileLoadFunction:t.tileLoadFunction,transition:t.transition,url:a,tilePixelRatio:o?2:1,wrapX:t.wrapX,zDirection:t.zDirection})}},bP.source.Tile=md,bP.source.Tile.TileSourceEvent=yd,bP.source.TileArcGISRest=class extends wd{constructor(t){super({attributions:(t=t||{}).attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.params_=Object.assign({},t.params),this.hidpi_=void 0===t.hidpi||t.hidpi,this.tmpExtent_=[1/0,1/0,-1/0,-1/0],this.setKey(this.getKeyForParams_())}getKeyForParams_(){let t=0;const e=[];for(const i in this.params_)e[t++]=i+"-"+this.params_[i];return e.join("/")}getParams(){return this.params_}getRequestUrl_(t,e,i,n,r,s){const o=this.urls;if(!o)return;let a;if(1==o.length)a=o[0];else{a=o[De(Uu(t),o.length)]}return Vg(a,i,(this.tileGrid||this.getTileGridForProjection(r)).getResolution(t[0]),n,r,s)}getTilePixelRatio(t){return this.hidpi_?t:1}setParams(t){this.params_=Object.assign({},t),this.setKey(this.getKeyForParams_())}updateParams(t){Object.assign(this.params_,t),this.setKey(this.getKeyForParams_())}tileUrlFunction(t,e,i){let n=this.getTileGrid();if(n||(n=this.getTileGridForProjection(i)),n.getResolutions().length<=t[0])return;1==e||this.hidpi_||(e=1);const r=n.getTileCoordExtent(t,this.tmpExtent_);let s=Wl(n.getTileSize(t[0]),this.tmpSize);1!=e&&(s=$l(s,e,this.tmpSize));const o={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};return Object.assign(o,this.params_),this.getRequestUrl_(t,s,r,e,i,o)}},bP.source.TileDebug=class extends ef{constructor(t){const e=(t=t||{}).template||"z:{z} x:{x} y:{y}",i=t.source,r=t.color||"grey";super({transition:0,wrapX:void 0!==t.wrapX?t.wrapX:void 0!==i?i.getWrapX():void 0});const s=()=>{this.projection=void 0!==t.projection?En(t.projection):void 0!==i?i.getProjection():this.projection,this.tileGrid=void 0!==t.tileGrid?t.tileGrid:void 0!==i?i.getTileGrid():this.tileGrid,this.zDirection=void 0!==t.zDirection?t.zDirection:void 0!==i?i.zDirection:this.zDirection,i instanceof dg&&(this.transformMatrix=i.transformMatrix?.slice()||null);const n=this.tileGrid;n&&this.setTileSizes(n.getResolutions().map(((t,e)=>Wl(n.getTileSize(e)).map((t=>Math.max(Math.floor(t),1)))))),this.setLoader(((t,i,n,s)=>{const o=sd(e,t,i,n,s.maxY),[a,l]=this.getTileSize(t),h=ft(a,l);return h.strokeStyle=r,h.strokeRect(.5,.5,a+.5,l+.5),h.fillStyle=r,h.strokeStyle="white",h.textAlign="center",h.textBaseline="middle",h.font="24px sans-serif",h.lineWidth=4,h.strokeText(o,a/2,l/2,a),h.fillText(o,a/2,l/2,a),Promise.resolve(h.canvas)})),this.setState("ready")};if(void 0===i||"ready"===i.getState())s();else{const t=()=>{"ready"===i.getState()&&(i.removeEventListener(n,t),s())};i.addEventListener(n,t)}}},bP.source.TileImage=wd,bP.source.TileImage.defaultTileLoadFunction=Td,bP.source.TileJSON=class extends wd{constructor(t){if(super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:En("EPSG:3857"),reprojectionErrorThreshold:t.reprojectionErrorThreshold,state:"loading",tileLoadFunction:t.tileLoadFunction,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.tileJSON_=null,this.tileSize_=t.tileSize,t.url)if(t.jsonp)du(t.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{const e=new XMLHttpRequest;e.addEventListener("load",this.onXHRLoad_.bind(this)),e.addEventListener("error",this.onXHRError_.bind(this)),e.open("GET",t.url),e.send()}else{if(!t.tileJSON)throw new Error("Either `url` or `tileJSON` options must be provided");this.handleTileJSONResponse(t.tileJSON)}}onXHRLoad_(t){const e=t.target;if(!e.status||e.status>=200&&e.status<300){let t;try{t=JSON.parse(e.responseText)}catch{return void this.handleTileJSONError()}this.handleTileJSONResponse(t)}else this.handleTileJSONError()}onXHRError_(t){this.handleTileJSONError()}getTileJSON(){return this.tileJSON_}handleTileJSONResponse(t){const e=En("EPSG:4326"),i=this.getProjection();let n;if(void 0!==t.bounds){const r=Ln(e,i);n=be(t.bounds,r)}const r=Qu(i),s=t.minzoom||0,o=Ku({extent:r,maxZoom:t.maxzoom||22,minZoom:s,tileSize:this.tileSize_});if(this.tileGrid=o,this.tileUrlFunction=hd(t.tiles,o),t.attribution&&!this.getAttributions()){const e=void 0!==n?n:r;this.setAttributions((function(i){return Se(e,i.extent)?[t.attribution]:null}))}this.tileJSON_=t,this.setState("ready")}handleTileJSONError(){this.setState("error")}},bP.source.TileWMS=class extends wd{constructor(t){t=t||{};const e=Object.assign({},t.params);super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:t.tileClass,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.gutter_=void 0!==t.gutter?t.gutter:0,this.params_=e,this.v13_=!0,this.serverType_=t.serverType,this.hidpi_=void 0===t.hidpi||t.hidpi,this.tmpExtent_=[1/0,1/0,-1/0,-1/0],this.updateV13_(),this.setKey(this.getKeyForParams_())}getFeatureInfoUrl(t,e,i,n){const r=En(i),s=this.getProjection()||r;let o=this.getTileGrid();o||(o=this.getTileGridForProjection(s));const a=On(t,r,s),l=Lu(s,r,t,e),h=o.getZForResolution(l,this.zDirection),c=o.getResolution(h),u=o.getTileCoordForCoordAndZ(a,h);if(o.getResolutions().length<=u[0])return;let d=o.getTileCoordExtent(u,this.tmpExtent_);const g=this.gutter_;0!==g&&(d=zt(d,c*g,d));const f={QUERY_LAYERS:this.params_.LAYERS};Object.assign(f,af(this.params_,"GetFeatureInfo"),n);const p=Math.floor((a[0]-d[0])/c),_=Math.floor((d[3]-a[1])/c);return f[this.v13_?"I":"X"]=p,f[this.v13_?"J":"Y"]=_,this.getRequestUrl_(u,d,1,s||r,f)}getLegendUrl(t,e){if(void 0===this.urls[0])return;const i={SERVICE:"WMS",VERSION:nf,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){const t=this.params_.LAYERS;if(!(!Array.isArray(t)||1===t.length))return;i.LAYER=t}if(void 0!==t){const e=this.getProjection()?this.getProjection().getMetersPerUnit():1,n=28e-5;i.SCALE=t*e/n}return Object.assign(i,e),td(this.urls[0],i)}getGutter(){return this.gutter_}getParams(){return this.params_}getRequestUrl_(t,e,i,n,r){const s=this.urls;if(!s)return;let o;if(1==s.length)o=s[0];else{o=s[De(Uu(t),s.length)]}return of(e,(this.tileGrid||this.getTileGridForProjection(n)).getResolution(t[0]),i,n,o,r,this.serverType_)}getTilePixelRatio(t){return this.hidpi_&&void 0!==this.serverType_?t:1}getKeyForParams_(){let t=0;const e=[];for(const i in this.params_)e[t++]=i+"-"+this.params_[i];return e.join("/")}setParams_(t){this.params_=t,this.updateV13_(),this.setKey(this.getKeyForParams_())}setParams(t){this.setParams_(Object.assign({},t))}updateParams(t){this.setParams_(Object.assign(this.params_,t))}updateV13_(){const t=this.params_.VERSION||nf;this.v13_=Je(t,"1.3")>=0}tileUrlFunction(t,e,i){let n=this.getTileGrid();if(n||(n=this.getTileGridForProjection(i)),n.getResolutions().length<=t[0])return;1==e||this.hidpi_&&void 0!==this.serverType_||(e=1);const r=n.getResolution(t[0]);let s=n.getTileCoordExtent(t,this.tmpExtent_);const o=this.gutter_;0!==o&&(s=zt(s,r*o,s));const a=Object.assign({},af(this.params_,"GetMap"));return this.getRequestUrl_(t,s,e,i,a)}},bP.source.UTFGrid=class extends md{constructor(t){if(super({projection:En("EPSG:3857"),state:"loading",wrapX:void 0===t.wrapX||t.wrapX,zDirection:t.zDirection}),this.preemptive_=void 0===t.preemptive||t.preemptive,this.tileUrlFunction_=ud,this.template_=void 0,this.jsonp_=t.jsonp||!1,this.tileCache_=new Du(512),t.url)if(this.jsonp_)du(t.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{const e=new XMLHttpRequest;e.addEventListener("load",this.onXHRLoad_.bind(this)),e.addEventListener("error",this.onXHRError_.bind(this)),e.open("GET",t.url),e.send()}else{if(!t.tileJSON)throw new Error("Either `url` or `tileJSON` options must be provided");this.handleTileJSONResponse(t.tileJSON)}}onXHRLoad_(t){const e=t.target;if(!e.status||e.status>=200&&e.status<300){let t;try{t=JSON.parse(e.responseText)}catch{return void this.handleTileJSONError()}this.handleTileJSONResponse(t)}else this.handleTileJSONError()}onXHRError_(t){this.handleTileJSONError()}getTemplate(){return this.template_}forDataAtCoordinateAndResolution(t,e,i,n){if(this.tileGrid){const r=this.tileGrid.getZForResolution(e,this.zDirection),s=this.tileGrid.getTileCoordForCoordAndZ(t,r),o=this.getTile(s[0],s[1],s[2],1,this.getProjection());o.getState()==Y&&o.load(),o.forDataAtCoordinate(t,i,n)}else!0===n?setTimeout((function(){i(null)}),0):i(null)}handleTileJSONError(){this.setState("error")}handleTileJSONResponse(t){const e=En("EPSG:4326"),i=this.getProjection();let n;if(void 0!==t.bounds){const r=Ln(e,i);n=be(t.bounds,r)}const r=Qu(i),s=t.minzoom||0,o=Ku({extent:r,maxZoom:t.maxzoom||22,minZoom:s});this.tileGrid=o,this.template_=t.template;const a=t.grids;if(a){if(this.tileUrlFunction_=hd(a,o),t.attribution){const e=void 0!==n?n:r;this.setAttributions((function(i){return Se(e,i.extent)?[t.attribution]:null}))}this.setState("ready")}else this.setState("error")}getTile(t,e,i,n,r){const s=[t,e,i],o=this.getTileCoordForTileUrlFunction(s,r),a=this.tileUrlFunction_(o,n,r),l=`${this.getKey()},${ku(t,e,i)}`;if(this.tileCache_.containsKey(l))return this.tileCache_.get(l);this.tileCache_.expireCache();const h=new Hf(s,void 0!==a?Y:J,void 0!==a?a:"",this.tileGrid.getTileCoordExtent(s),this.preemptive_,this.jsonp_);return this.tileCache_.set(l,h),h}},bP.source.UTFGrid.CustomTile=Hf,bP.source.UrlTile=Ed,bP.source.Vector=qd,bP.source.Vector.VectorSourceEvent=Kd,bP.source.VectorTile=yf,bP.source.VectorTile.defaultLoadFunction=xf,bP.source.WMTS=class extends wd{constructor(t){const e=void 0!==t.requestEncoding?t.requestEncoding:"KVP",i=t.tileGrid;let n=t.urls;void 0===n&&void 0!==t.url&&(n=ad(t.url)),super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:t.tileClass,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,urls:n,wrapX:void 0!==t.wrapX&&t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.version_=void 0!==t.version?t.version:"1.0.0",this.format_=void 0!==t.format?t.format:"image/jpeg",this.dimensions_=void 0!==t.dimensions?t.dimensions:{},this.layer_=t.layer,this.matrixSet_=t.matrixSet,this.style_=t.style,this.requestEncoding_=e,this.setKey(this.getKeyForDimensions_()),n&&n.length>0&&(this.tileUrlFunction=cd(n.map(this.createFromWMTSTemplate.bind(this))))}setUrls(t){this.urls=t;const e=t.join("\n");this.setTileUrlFunction(cd(t.map(this.createFromWMTSTemplate.bind(this))),e)}getDimensions(){return this.dimensions_}getFormat(){return this.format_}getLayer(){return this.layer_}getMatrixSet(){return this.matrixSet_}getRequestEncoding(){return this.requestEncoding_}getStyle(){return this.style_}getVersion(){return this.version_}getKeyForDimensions_(){const t=this.urls?this.urls.slice(0):[];for(const e in this.dimensions_)t.push(e+"-"+this.dimensions_[e]);return t.join("/")}updateDimensions(t){Object.assign(this.dimensions_,t),this.setKey(this.getKeyForDimensions_())}createFromWMTSTemplate(t){const e=this.requestEncoding_,i={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};"KVP"==e&&Object.assign(i,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_}),t="KVP"==e?td(t,i):t.replace(/\{(\w+?)\}/g,(function(t,e){return e.toLowerCase()in i?i[e.toLowerCase()]:t}));const n=this.tileGrid,r=this.dimensions_;return function(i,s,o){if(!i)return;const a={TileMatrix:n.getMatrixId(i[0]),TileCol:i[1],TileRow:i[2]};Object.assign(a,r);let l=t;return l="KVP"==e?td(l,a):l.replace(/\{(\w+?)\}/g,(function(t,e){return encodeURIComponent(a[e])})),l}}},bP.source.WMTS.optionsFromCapabilities=function(t,e){const i=t.Contents.Layer,n=i?.find((function(t){return t.Identifier==e.layer}));if(!n)return null;const r=t.Contents.TileMatrixSet;let s;s=n.TileMatrixSetLink.length>1?"projection"in e?n.TileMatrixSetLink.findIndex((function(t){const i=r.find((function(e){return e.Identifier==t.TileMatrixSet})).SupportedCRS,n=En(i),s=En(e.projection);return n&&s?Fn(n,s):i==e.projection})):n.TileMatrixSetLink.findIndex((function(t){return t.TileMatrixSet==e.matrixSet})):0,s<0&&(s=0);const o=n.TileMatrixSetLink[s].TileMatrixSet,a=n.TileMatrixSetLink[s].TileMatrixSetLimits;let l=n.Format[0];"format"in e&&(l=e.format),s=n.Style.findIndex((function(t){return"style"in e?t.Title==e.style:t.isDefault})),s<0&&(s=0);const h=n.Style[s].Identifier,c={};"Dimension"in n&&n.Dimension.forEach((function(t,e,i){const n=t.Identifier;let r=t.Default;void 0===r&&(r=t.Value[0]),c[n]=r}));const u=t.Contents.TileMatrixSet.find((function(t){return t.Identifier==o}));let d;const g=u.SupportedCRS;if(g&&(d=En(g)),"projection"in e){const t=En(e.projection);t&&(d&&!Fn(t,d)||(d=t))}let f=!1;const p=d.getAxisOrientation().startsWith("ne");let _=u.TileMatrix[0],m={MinTileCol:0,MinTileRow:0,MaxTileCol:_.MatrixWidth-1,MaxTileRow:_.MatrixHeight-1};if(a){m=a[a.length-1];const t=u.TileMatrix.find((t=>t.Identifier===m.TileMatrix||u.Identifier+":"+t.Identifier===m.TileMatrix));t&&(_=t)}const y=n.BoundingBox?.find((t=>En(t.crs)&&Fn(En(t.crs),d))),x=28e-5*_.ScaleDenominator/d.getMetersPerUnit(),v=p?[_.TopLeftCorner[1],_.TopLeftCorner[0]]:_.TopLeftCorner,S=_.TileWidth*x,E=_.TileHeight*x;let w=y?.extent??u.BoundingBox;w&&p&&(w=[w[1],w[0],w[3],w[2]]);let T=[v[0]+S*m.MinTileCol,v[1]-E*(1+m.MaxTileRow),v[0]+S*(1+m.MaxTileCol),v[1]-E*m.MinTileRow];if(void 0!==w&&!Wt(w,T)){const t=n.WGS84BoundingBox,e=En("EPSG:4326").getExtent();if(T=w,t)f=t[0]===e[0]&&t[2]===e[2];else{const t=Dn(w,u.SupportedCRS,"EPSG:4326");f=t[0]-1e-10<=e[0]&&t[2]+1e-10>=e[2]}}const C=Wu(u,T,a),b=[];let R=e.requestEncoding;if(R=void 0!==R?R:"","OperationsMetadata"in t&&"GetTile"in t.OperationsMetadata){const e=t.OperationsMetadata.GetTile.DCP.HTTP.Get;for(let t=0,i=e.length;tl||s>l;)o.push([Math.ceil(r/l),Math.ceil(s/l)]),l+=l;break;case"truncated":let t=r,e=s;for(;t>l||e>l;)o.push([Math.ceil(t/l),Math.ceil(e/l)]),t>>=1,e>>=1;break;default:throw new Error("Unknown `tierSizeCalculation` configured")}o.push([1,1]),o.reverse();const h=[n],c=[0];for(let t=1,e=o.length;t{f=a,this.changed()})),y.src=m}},bP.source.Zoomify.CustomTile=Og,bP.source.arcgisRest={},bP.source.arcgisRest.createLoader=$g,bP.source.arcgisRest.getRequestUrl=Vg,bP.source.common={},bP.source.common.DECIMALS=4,bP.source.common.DEFAULT_WMS_VERSION="1.3.0",bP.source.mapguide={},bP.source.mapguide.createLoader=Zg,bP.source.mapserver={},bP.source.mapserver.createLoader=function(t){const e=t.load||js,i=t.ratio??1,n=t.crossOrigin??null;return function(r,s,o){const a=new Image;a.crossOrigin=n,void 0!==t.referrerPolicy&&(a.referrerPolicy=t.referrerPolicy);const l=ve(r=Xg(r,s,o,i))/s,h=_e(r)/s,c=[l*o,h*o],u=function(t,e,i,n){const r=Math.round(n[0]),s=Math.round(n[1]),o=`${r} ${s}`,a=`${i[0]} ${i[1]} ${i[2]} ${i[3]}`,l={mode:"map",map_imagetype:"png",mapext:a,imgext:a,map_size:o,imgx:r/2,imgy:s/2,imgxy:o};return Object.assign(l,e),td(t,l)}(t.url,t.params,r,c);return e(a,u).then((t=>({image:t,extent:r,pixelRatio:o})))}},bP.source.ogcMapUtil={},bP.source.ogcMapUtil.createLoader=a_,bP.source.ogcMapUtil.getImageSrc=o_,bP.source.ogcMapUtil.getRequestUrl=s_,bP.source.ogcTileUtil={},bP.source.ogcTileUtil.appendCollectionsQueryParam=gf,bP.source.ogcTileUtil.getMapTileUrlTemplate=ff,bP.source.ogcTileUtil.getTileSetInfo=mf,bP.source.ogcTileUtil.getVectorTileUrlTemplate=pf,bP.source.ogcTileUtil.parseTileMatrixSet=_f,bP.source.sourcesFromTileGrid=function(t,e){const i=new Du(32),n=t.getExtent();return function(r,s){i.expireCache(),n&&(r=me(n,r));const o=t.getZForResolution(s),a=[];return t.forEachTileCoord(r,o,(t=>{const n=t.toString();if(!i.containsKey(n)){const r=e(t);i.set(n,r)}a.push(i.get(n))})),a}},bP.source.static={},bP.source.static.createLoader=Yg,bP.source.wms={},bP.source.wms.DEFAULT_VERSION=nf,bP.source.wms.createLoader=lf,bP.source.wms.getFeatureInfoUrl=hf,bP.source.wms.getImageSrc=of,bP.source.wms.getLegendUrl=cf,bP.source.wms.getRequestParams=af,bP.source.wms.getRequestUrl=sf,bP.sphere={},bP.sphere.DEFAULT_RADIUS=ze,bP.sphere.getArea=function t(e,i){const n=(i=i||{}).radius||ze,r=i.projection||"EPSG:3857",s=e.getType();"GeometryCollection"!==s&&(e=e.clone().transform(r,"EPSG:4326"));let o,a,l,h,c,u,d=0;switch(s){case"Point":case"MultiPoint":case"LineString":case"MultiLineString":case"LinearRing":break;case"Polygon":for(o=e.getCoordinates(),d=Math.abs($e(o[0],n)),l=1,h=o.length;l} haystack Items to search through.\n * @param {*} needle The item to look for.\n * @param {Function} [comparator] Comparator function.\n * @return {number} The index of the item if found, -1 if not.\n */\nexport function binarySearch(haystack, needle, comparator) {\n let mid, cmp;\n comparator = comparator || ascending;\n let low = 0;\n let high = haystack.length;\n let found = false;\n\n while (low < high) {\n /* Note that \"(low + high) >>> 1\" may overflow, and results in a typecast\n * to double (which gives the wrong results). */\n mid = low + ((high - low) >> 1);\n cmp = +comparator(haystack[mid], needle);\n\n if (cmp < 0.0) {\n /* Too low. */\n low = mid + 1;\n } else {\n /* Key found or too high */\n high = mid;\n found = !cmp;\n }\n }\n\n /* Key not found. */\n return found ? low : ~low;\n}\n\n/**\n * Compare function sorting arrays in ascending order. Safe to use for numeric values.\n * @param {*} a The first object to be compared.\n * @param {*} b The second object to be compared.\n * @return {number} A negative number, zero, or a positive number as the first\n * argument is less than, equal to, or greater than the second.\n */\nexport function ascending(a, b) {\n return a > b ? 1 : a < b ? -1 : 0;\n}\n\n/**\n * Compare function sorting arrays in descending order. Safe to use for numeric values.\n * @param {*} a The first object to be compared.\n * @param {*} b The second object to be compared.\n * @return {number} A negative number, zero, or a positive number as the first\n * argument is greater than, equal to, or less than the second.\n */\nexport function descending(a, b) {\n return a < b ? 1 : a > b ? -1 : 0;\n}\n\n/**\n * {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution} can use a function\n * of this type to determine which nearest resolution to use.\n *\n * This function takes a `{number}` representing a value between two array entries,\n * a `{number}` representing the value of the nearest higher entry and\n * a `{number}` representing the value of the nearest lower entry\n * as arguments and returns a `{number}`. If a negative number or zero is returned\n * the lower value will be used, if a positive number is returned the higher value\n * will be used.\n * @typedef {function(number, number, number): number} NearestDirectionFunction\n * @api\n */\n\n/**\n * @param {Array} arr Array in descending order.\n * @param {number} target Target.\n * @param {number|NearestDirectionFunction} direction\n * 0 means return the nearest,\n * > 0 means return the largest nearest,\n * < 0 means return the smallest nearest.\n * @return {number} Index.\n */\nexport function linearFindNearest(arr, target, direction) {\n if (arr[0] <= target) {\n return 0;\n }\n\n const n = arr.length;\n if (target <= arr[n - 1]) {\n return n - 1;\n }\n\n if (typeof direction === 'function') {\n for (let i = 1; i < n; ++i) {\n const candidate = arr[i];\n if (candidate === target) {\n return i;\n }\n if (candidate < target) {\n if (direction(target, arr[i - 1], candidate) > 0) {\n return i - 1;\n }\n return i;\n }\n }\n return n - 1;\n }\n\n if (direction > 0) {\n for (let i = 1; i < n; ++i) {\n if (arr[i] < target) {\n return i - 1;\n }\n }\n return n - 1;\n }\n\n if (direction < 0) {\n for (let i = 1; i < n; ++i) {\n if (arr[i] <= target) {\n return i;\n }\n }\n return n - 1;\n }\n\n for (let i = 1; i < n; ++i) {\n if (arr[i] == target) {\n return i;\n }\n if (arr[i] < target) {\n if (arr[i - 1] - target < target - arr[i]) {\n return i - 1;\n }\n return i;\n }\n }\n return n - 1;\n}\n\n/**\n * @param {Array<*>} arr Array.\n * @param {number} begin Begin index.\n * @param {number} end End index.\n */\nexport function reverseSubArray(arr, begin, end) {\n while (begin < end) {\n const tmp = arr[begin];\n arr[begin] = arr[end];\n arr[end] = tmp;\n ++begin;\n --end;\n }\n}\n\n/**\n * @param {Array} arr The array to modify.\n * @param {!Array|VALUE} data The elements or arrays of elements to add to arr.\n * @template VALUE\n */\nexport function extend(arr, data) {\n const extension = Array.isArray(data) ? data : [data];\n const length = extension.length;\n for (let i = 0; i < length; i++) {\n arr[arr.length] = extension[i];\n }\n}\n\n/**\n * @param {Array} arr The array to modify.\n * @param {VALUE} obj The element to remove.\n * @template VALUE\n * @return {boolean} If the element was removed.\n */\nexport function remove(arr, obj) {\n const i = arr.indexOf(obj);\n const found = i > -1;\n if (found) {\n arr.splice(i, 1);\n }\n return found;\n}\n\n/**\n * @param {Array|Uint8ClampedArray} arr1 The first array to compare.\n * @param {Array|Uint8ClampedArray} arr2 The second array to compare.\n * @return {boolean} Whether the two arrays are equal.\n */\nexport function equals(arr1, arr2) {\n const len1 = arr1.length;\n if (len1 !== arr2.length) {\n return false;\n }\n for (let i = 0; i < len1; i++) {\n if (arr1[i] !== arr2[i]) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Sort the passed array such that the relative order of equal elements is preserved.\n * See https://en.wikipedia.org/wiki/Sorting_algorithm#Stability for details.\n * @param {Array<*>} arr The array to sort (modifies original).\n * @param {!function(*, *): number} compareFnc Comparison function.\n * @api\n * @deprecated\n */\nexport function stableSort(arr, compareFnc) {\n const length = arr.length;\n const tmp = Array(arr.length);\n let i;\n for (i = 0; i < length; i++) {\n tmp[i] = {index: i, value: arr[i]};\n }\n tmp.sort(function (a, b) {\n return compareFnc(a.value, b.value) || a.index - b.index;\n });\n for (i = 0; i < arr.length; i++) {\n arr[i] = tmp[i].value;\n }\n}\n\n/**\n * @param {Array<*>} arr The array to test.\n * @param {Function} [func] Comparison function.\n * @param {boolean} [strict] Strictly sorted (default false).\n * @return {boolean} Return index.\n */\nexport function isSorted(arr, func, strict) {\n const compare = func || ascending;\n return arr.every(function (currentVal, index) {\n if (index === 0) {\n return true;\n }\n const res = compare(arr[index - 1], currentVal);\n return !(res > 0 || (strict && res === 0));\n });\n}\n","/**\n * @module ol/functions\n */\n\nimport {equals as arrayEquals} from './array.js';\n\n/**\n * Always returns true.\n * @return {boolean} true.\n */\nexport function TRUE() {\n return true;\n}\n\n/**\n * Always returns false.\n * @return {boolean} false.\n */\nexport function FALSE() {\n return false;\n}\n\n/**\n * A reusable function, used e.g. as a default for callbacks.\n *\n * @return {void} Nothing.\n */\nexport function VOID() {}\n\n/**\n * Wrap a function in another function that remembers the last return. If the\n * returned function is called twice in a row with the same arguments and the same\n * this object, it will return the value from the first call in the second call.\n *\n * @param {function(...any): ReturnType} fn The function to memoize.\n * @return {function(...any): ReturnType} The memoized function.\n * @template ReturnType\n */\nexport function memoizeOne(fn) {\n /** @type {ReturnType} */\n let lastResult;\n\n /** @type {Array|undefined} */\n let lastArgs;\n\n let lastThis;\n\n /**\n * @this {*} Only need to know if `this` changed, don't care what type\n * @return {ReturnType} Memoized value\n */\n return function () {\n const nextArgs = Array.prototype.slice.call(arguments);\n if (!lastArgs || this !== lastThis || !arrayEquals(nextArgs, lastArgs)) {\n lastThis = this;\n lastArgs = nextArgs;\n lastResult = fn.apply(this, arguments);\n }\n return lastResult;\n };\n}\n\n/**\n * @template T\n * @param {function(): (T | Promise)} getter A function that returns a value or a promise for a value.\n * @return {Promise} A promise for the value.\n */\nexport function toPromise(getter) {\n function promiseGetter() {\n let value;\n try {\n value = getter();\n } catch (err) {\n return Promise.reject(err);\n }\n if (value instanceof Promise) {\n return value;\n }\n return Promise.resolve(value);\n }\n return promiseGetter();\n}\n","/**\n * @module ol/obj\n */\n\n/**\n * Removes all properties from an object.\n * @param {Object} object The object to clear.\n */\nexport function clear(object) {\n for (const property in object) {\n delete object[property];\n }\n}\n\n/**\n * Determine if an object has any properties.\n * @param {Object} object The object to check.\n * @return {boolean} The object is empty.\n */\nexport function isEmpty(object) {\n let property;\n for (property in object) {\n return false;\n }\n return !property;\n}\n","/**\n * @module ol/events/Event\n */\n\n/**\n * @classdesc\n * Stripped down implementation of the W3C DOM Level 2 Event interface.\n * See https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-interface.\n *\n * This implementation only provides `type` and `target` properties, and\n * `stopPropagation` and `preventDefault` methods. It is meant as base class\n * for higher level events defined in the library, and works with\n * {@link module:ol/events/Target~Target}.\n */\nclass BaseEvent {\n /**\n * @param {string} type Type.\n */\n constructor(type) {\n /**\n * @type {boolean}\n */\n this.propagationStopped;\n\n /**\n * @type {boolean}\n */\n this.defaultPrevented;\n\n /**\n * The event type.\n * @type {string}\n * @api\n */\n this.type = type;\n\n /**\n * The event target.\n * @type {Object}\n * @api\n */\n this.target = null;\n }\n\n /**\n * Prevent default. This means that no emulated `click`, `singleclick` or `doubleclick` events\n * will be fired.\n * @api\n */\n preventDefault() {\n this.defaultPrevented = true;\n }\n\n /**\n * Stop event propagation.\n * @api\n */\n stopPropagation() {\n this.propagationStopped = true;\n }\n}\n\n/**\n * @param {Event|import(\"./Event.js\").default} evt Event\n */\nexport function stopPropagation(evt) {\n evt.stopPropagation();\n}\n\n/**\n * @param {Event|import(\"./Event.js\").default} evt Event\n */\nexport function preventDefault(evt) {\n evt.preventDefault();\n}\n\nexport default BaseEvent;\n","/**\n * @module ol/events/Target\n */\nimport Disposable from '../Disposable.js';\nimport {VOID} from '../functions.js';\nimport {clear} from '../obj.js';\nimport Event from './Event.js';\n\n/**\n * @typedef {EventTarget|Target} EventTargetLike\n */\n\n/**\n * @classdesc\n * A simplified implementation of the W3C DOM Level 2 EventTarget interface.\n * See https://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-EventTarget.\n *\n * There are two important simplifications compared to the specification:\n *\n * 1. The handling of `useCapture` in `addEventListener` and\n * `removeEventListener`. There is no real capture model.\n * 2. The handling of `stopPropagation` and `preventDefault` on `dispatchEvent`.\n * There is no event target hierarchy. When a listener calls\n * `stopPropagation` or `preventDefault` on an event object, it means that no\n * more listeners after this one will be called. Same as when the listener\n * returns false.\n */\nclass Target extends Disposable {\n /**\n * @param {*} [target] Default event target for dispatched events.\n */\n constructor(target) {\n super();\n\n /**\n * @private\n * @type {*}\n */\n this.eventTarget_ = target;\n\n /**\n * @private\n * @type {Object|null}\n */\n this.pendingRemovals_ = null;\n\n /**\n * @private\n * @type {Object|null}\n */\n this.dispatching_ = null;\n\n /**\n * @private\n * @type {Object>|null}\n */\n this.listeners_ = null;\n }\n\n /**\n * @param {string} type Type.\n * @param {import(\"../events.js\").Listener} listener Listener.\n */\n addEventListener(type, listener) {\n if (!type || !listener) {\n return;\n }\n const listeners = this.listeners_ || (this.listeners_ = {});\n const listenersForType = listeners[type] || (listeners[type] = []);\n if (!listenersForType.includes(listener)) {\n listenersForType.push(listener);\n }\n }\n\n /**\n * Dispatches an event and calls all listeners listening for events\n * of this type. The event parameter can either be a string or an\n * Object with a `type` property.\n *\n * @param {import(\"./Event.js\").default|string} event Event object.\n * @return {boolean|undefined} `false` if anyone called preventDefault on the\n * event object or if any of the listeners returned false.\n * @api\n */\n dispatchEvent(event) {\n const isString = typeof event === 'string';\n const type = isString ? event : event.type;\n const listeners = this.listeners_ && this.listeners_[type];\n if (!listeners) {\n return;\n }\n\n const evt = isString ? new Event(event) : /** @type {Event} */ (event);\n if (!evt.target) {\n evt.target = this.eventTarget_ || this;\n }\n const dispatching = this.dispatching_ || (this.dispatching_ = {});\n const pendingRemovals =\n this.pendingRemovals_ || (this.pendingRemovals_ = {});\n if (!(type in dispatching)) {\n dispatching[type] = 0;\n pendingRemovals[type] = 0;\n }\n ++dispatching[type];\n let propagate;\n for (let i = 0, ii = listeners.length; i < ii; ++i) {\n if ('handleEvent' in listeners[i]) {\n propagate = /** @type {import(\"../events.js\").ListenerObject} */ (\n listeners[i]\n ).handleEvent(evt);\n } else {\n propagate = /** @type {import(\"../events.js\").ListenerFunction} */ (\n listeners[i]\n ).call(this, evt);\n }\n if (propagate === false || evt.propagationStopped) {\n propagate = false;\n break;\n }\n }\n if (--dispatching[type] === 0) {\n let pr = pendingRemovals[type];\n delete pendingRemovals[type];\n while (pr--) {\n this.removeEventListener(type, VOID);\n }\n delete dispatching[type];\n }\n return propagate;\n }\n\n /**\n * Clean up.\n * @override\n */\n disposeInternal() {\n this.listeners_ && clear(this.listeners_);\n }\n\n /**\n * Get the listeners for a specified event type. Listeners are returned in the\n * order that they will be called in.\n *\n * @param {string} type Type.\n * @return {Array|undefined} Listeners.\n */\n getListeners(type) {\n return (this.listeners_ && this.listeners_[type]) || undefined;\n }\n\n /**\n * @param {string} [type] Type. If not provided,\n * `true` will be returned if this event target has any listeners.\n * @return {boolean} Has listeners.\n */\n hasListener(type) {\n if (!this.listeners_) {\n return false;\n }\n return type\n ? type in this.listeners_\n : Object.keys(this.listeners_).length > 0;\n }\n\n /**\n * @param {string} type Type.\n * @param {import(\"../events.js\").Listener} listener Listener.\n */\n removeEventListener(type, listener) {\n if (!this.listeners_) {\n return;\n }\n const listeners = this.listeners_[type];\n if (!listeners) {\n return;\n }\n const index = listeners.indexOf(listener);\n if (index !== -1) {\n if (this.pendingRemovals_ && type in this.pendingRemovals_) {\n // make listener a no-op, and remove later in #dispatchEvent()\n listeners[index] = VOID;\n ++this.pendingRemovals_[type];\n } else {\n listeners.splice(index, 1);\n if (listeners.length === 0) {\n delete this.listeners_[type];\n }\n }\n }\n }\n}\n\nexport default Target;\n","/**\n * @module ol/events\n */\nimport {clear} from './obj.js';\n\n/**\n * Key to use with {@link module:ol/Observable.unByKey}.\n * @typedef {Object} EventsKey\n * @property {ListenerFunction} listener Listener.\n * @property {import(\"./events/Target.js\").EventTargetLike} target Target.\n * @property {string} type Type.\n * @api\n */\n\n/**\n * Listener function. This function is called with an event object as argument.\n * When the function returns `false`, event propagation will stop.\n *\n * @typedef {function((Event|import(\"./events/Event.js\").default)): (void|boolean)} ListenerFunction\n * @api\n */\n\n/**\n * @typedef {Object} ListenerObject\n * @property {ListenerFunction} handleEvent HandleEvent listener function.\n */\n\n/**\n * @typedef {ListenerFunction|ListenerObject} Listener\n */\n\n/**\n * Registers an event listener on an event target. Inspired by\n * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html\n *\n * This function efficiently binds a `listener` to a `this` object, and returns\n * a key for use with {@link module:ol/events.unlistenByKey}.\n *\n * @param {import(\"./events/Target.js\").EventTargetLike} target Event target.\n * @param {string} type Event type.\n * @param {ListenerFunction} listener Listener.\n * @param {Object} [thisArg] Object referenced by the `this` keyword in the\n * listener. Default is the `target`.\n * @param {boolean} [once] If true, add the listener as one-off listener.\n * @return {EventsKey} Unique key for the listener.\n */\nexport function listen(target, type, listener, thisArg, once) {\n if (once) {\n const originalListener = listener;\n /**\n * @param {Event|import('./events/Event.js').default} event The event\n * @return {void|boolean} When the function returns `false`, event propagation will stop.\n * @this {typeof target}\n */\n listener = function (event) {\n target.removeEventListener(type, listener);\n return originalListener.call(thisArg ?? this, event);\n };\n } else if (thisArg && thisArg !== target) {\n listener = listener.bind(thisArg);\n }\n const eventsKey = {\n target: target,\n type: type,\n listener: listener,\n };\n target.addEventListener(type, listener);\n return eventsKey;\n}\n\n/**\n * Registers a one-off event listener on an event target. Inspired by\n * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html\n *\n * This function efficiently binds a `listener` as self-unregistering listener\n * to a `this` object, and returns a key for use with\n * {@link module:ol/events.unlistenByKey} in case the listener needs to be\n * unregistered before it is called.\n *\n * When {@link module:ol/events.listen} is called with the same arguments after this\n * function, the self-unregistering listener will be turned into a permanent\n * listener.\n *\n * @param {import(\"./events/Target.js\").EventTargetLike} target Event target.\n * @param {string} type Event type.\n * @param {ListenerFunction} listener Listener.\n * @param {Object} [thisArg] Object referenced by the `this` keyword in the\n * listener. Default is the `target`.\n * @return {EventsKey} Key for unlistenByKey.\n */\nexport function listenOnce(target, type, listener, thisArg) {\n return listen(target, type, listener, thisArg, true);\n}\n\n/**\n * Unregisters event listeners on an event target. Inspired by\n * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html\n *\n * The argument passed to this function is the key returned from\n * {@link module:ol/events.listen} or {@link module:ol/events.listenOnce}.\n *\n * @param {EventsKey} key The key.\n */\nexport function unlistenByKey(key) {\n if (key && key.target) {\n key.target.removeEventListener(key.type, key.listener);\n clear(key);\n }\n}\n","/**\n * @module ol/Observable\n */\nimport EventType from './events/EventType.js';\nimport EventTarget from './events/Target.js';\nimport {listen, listenOnce, unlistenByKey} from './events.js';\n\n/***\n * @template {string} Type\n * @template {Event|import(\"./events/Event.js\").default} EventClass\n * @template Return\n * @typedef {(type: Type, listener: (event: EventClass) => ?) => Return} OnSignature\n */\n\n/***\n * @template {string} Type\n * @template Return\n * @typedef {(type: Type[], listener: (event: Event|import(\"./events/Event\").default) => ?) => Return extends void ? void : Return[]} CombinedOnSignature\n */\n\n/**\n * @typedef {'change'|'error'} EventTypes\n */\n\n/***\n * @template Return\n * @typedef {OnSignature & CombinedOnSignature} ObservableOnSignature\n */\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * An event target providing convenient methods for listener registration\n * and unregistration. A generic `change` event is always available through\n * {@link module:ol/Observable~Observable#changed}.\n *\n * @fires import(\"./events/Event.js\").default\n * @api\n */\nclass Observable extends EventTarget {\n constructor() {\n super();\n\n this.on =\n /** @type {ObservableOnSignature} */ (\n this.onInternal\n );\n\n this.once =\n /** @type {ObservableOnSignature} */ (\n this.onceInternal\n );\n\n this.un = /** @type {ObservableOnSignature} */ (this.unInternal);\n\n /**\n * @private\n * @type {number}\n */\n this.revision_ = 0;\n }\n\n /**\n * Increases the revision counter and dispatches a 'change' event.\n * @api\n */\n changed() {\n ++this.revision_;\n this.dispatchEvent(EventType.CHANGE);\n }\n\n /**\n * Get the version number for this object. Each time the object is modified,\n * its version number will be incremented.\n * @return {number} Revision.\n * @api\n */\n getRevision() {\n return this.revision_;\n }\n\n /**\n * @param {string|Array} type Type.\n * @param {function((Event|import(\"./events/Event\").default)): ?} listener Listener.\n * @return {import(\"./events.js\").EventsKey|Array} Event key.\n * @protected\n */\n onInternal(type, listener) {\n if (Array.isArray(type)) {\n const len = type.length;\n const keys = new Array(len);\n for (let i = 0; i < len; ++i) {\n keys[i] = listen(this, type[i], listener);\n }\n return keys;\n }\n return listen(this, /** @type {string} */ (type), listener);\n }\n\n /**\n * @param {string|Array} type Type.\n * @param {function((Event|import(\"./events/Event\").default)): ?} listener Listener.\n * @return {import(\"./events.js\").EventsKey|Array} Event key.\n * @protected\n */\n onceInternal(type, listener) {\n let key;\n if (Array.isArray(type)) {\n const len = type.length;\n key = new Array(len);\n for (let i = 0; i < len; ++i) {\n key[i] = listenOnce(this, type[i], listener);\n }\n } else {\n key = listenOnce(this, /** @type {string} */ (type), listener);\n }\n /** @type {Object} */ (listener).ol_key = key;\n return key;\n }\n\n /**\n * Unlisten for a certain type of event.\n * @param {string|Array} type Type.\n * @param {function((Event|import(\"./events/Event\").default)): ?} listener Listener.\n * @protected\n */\n unInternal(type, listener) {\n const key = /** @type {Object} */ (listener).ol_key;\n if (key) {\n unByKey(key);\n } else if (Array.isArray(type)) {\n for (let i = 0, ii = type.length; i < ii; ++i) {\n this.removeEventListener(type[i], listener);\n }\n } else {\n this.removeEventListener(type, listener);\n }\n }\n}\n\n/**\n * Listen for a certain type of event.\n * @function\n * @param {string|Array} type The event type or array of event types.\n * @param {function((Event|import(\"./events/Event\").default)): ?} listener The listener function.\n * @return {import(\"./events.js\").EventsKey|Array} Unique key for the listener. If\n * called with an array of event types as the first argument, the return\n * will be an array of keys.\n * @api\n */\nObservable.prototype.on;\n\n/**\n * Listen once for a certain type of event.\n * @function\n * @param {string|Array} type The event type or array of event types.\n * @param {function((Event|import(\"./events/Event\").default)): ?} listener The listener function.\n * @return {import(\"./events.js\").EventsKey|Array} Unique key for the listener. If\n * called with an array of event types as the first argument, the return\n * will be an array of keys.\n * @api\n */\nObservable.prototype.once;\n\n/**\n * Unlisten for a certain type of event.\n * @function\n * @param {string|Array} type The event type or array of event types.\n * @param {function((Event|import(\"./events/Event\").default)): ?} listener The listener function.\n * @api\n */\nObservable.prototype.un;\n\n/**\n * Removes an event listener using the key returned by `on()` or `once()`.\n * @param {import(\"./events.js\").EventsKey|Array} key The key returned by `on()`\n * or `once()` (or an array of keys).\n * @api\n */\nexport function unByKey(key) {\n if (Array.isArray(key)) {\n for (let i = 0, ii = key.length; i < ii; ++i) {\n unlistenByKey(key[i]);\n }\n } else {\n unlistenByKey(/** @type {import(\"./events.js\").EventsKey} */ (key));\n }\n}\n\nexport default Observable;\n","/**\n * @module ol/util\n */\n\n/**\n * @return {never} Any return.\n */\nexport function abstract() {\n throw new Error('Unimplemented abstract method.');\n}\n\n/**\n * Counter for getUid.\n * @type {number}\n * @private\n */\nlet uidCounter_ = 0;\n\n/**\n * Gets a unique ID for an object. This mutates the object so that further calls\n * with the same object as a parameter returns the same value. Unique IDs are generated\n * as a strictly increasing sequence. Adapted from goog.getUid.\n *\n * @param {Object} obj The object to get the unique ID for.\n * @return {string} The unique ID for the object.\n * @api\n */\nexport function getUid(obj) {\n return obj.ol_uid || (obj.ol_uid = String(++uidCounter_));\n}\n\n/**\n * OpenLayers version.\n * @type {string}\n */\nexport const VERSION = '10.8.0';\n","/**\n * @module ol/Object\n */\nimport ObjectEventType from './ObjectEventType.js';\nimport Observable from './Observable.js';\nimport Event from './events/Event.js';\nimport {isEmpty} from './obj.js';\nimport {getUid} from './util.js';\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/Object~BaseObject} instances are instances of this type.\n */\nexport class ObjectEvent extends Event {\n /**\n * @param {string} type The event type.\n * @param {string} key The property name.\n * @param {*} oldValue The old value for `key`.\n */\n constructor(type, key, oldValue) {\n super(type);\n\n /**\n * The name of the property whose value is changing.\n * @type {string}\n * @api\n */\n this.key = key;\n\n /**\n * The old value. To get the new value use `e.target.get(e.key)` where\n * `e` is the event object.\n * @type {*}\n * @api\n */\n this.oldValue = oldValue;\n }\n}\n\n/***\n * @template Return\n * @typedef {import(\"./Observable\").OnSignature &\n * import(\"./Observable\").OnSignature &\n * import(\"./Observable\").CombinedOnSignature} ObjectOnSignature\n */\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * Most non-trivial classes inherit from this.\n *\n * This extends {@link module:ol/Observable~Observable} with observable\n * properties, where each property is observable as well as the object as a\n * whole.\n *\n * Classes that inherit from this have pre-defined properties, to which you can\n * add your owns. The pre-defined properties are listed in this documentation as\n * 'Observable Properties', and have their own accessors; for example,\n * {@link module:ol/Map~Map} has a `target` property, accessed with\n * `getTarget()` and changed with `setTarget()`. Not all properties are however\n * settable. There are also general-purpose accessors `get()` and `set()`. For\n * example, `get('target')` is equivalent to `getTarget()`.\n *\n * The `set` accessors trigger a change event, and you can monitor this by\n * registering a listener. For example, {@link module:ol/View~View} has a\n * `center` property, so `view.on('change:center', function(evt) {...});` would\n * call the function whenever the value of the center property changes. Within\n * the function, `evt.target` would be the view, so `evt.target.getCenter()`\n * would return the new center.\n *\n * You can add your own observable properties with\n * `object.set('prop', 'value')`, and retrieve that with `object.get('prop')`.\n * You can listen for changes on that property value with\n * `object.on('change:prop', listener)`. You can get a list of all\n * properties with {@link module:ol/Object~BaseObject#getProperties}.\n *\n * Note that the observable properties are separate from standard JS properties.\n * You can, for example, give your map object a title with\n * `map.title='New title'` and with `map.set('title', 'Another title')`. The\n * first will be a `hasOwnProperty`; the second will appear in\n * `getProperties()`. Only the second is observable.\n *\n * Properties can be deleted by using the unset method. E.g.\n * object.unset('foo').\n *\n * @fires ObjectEvent\n * @template {Object} [Properties=Object]\n * @api\n */\nclass BaseObject extends Observable {\n /**\n * @param {NoInfer} [values] An object with key-value pairs.\n */\n constructor(values) {\n super();\n\n /***\n * @type {ObjectOnSignature}\n */\n this.on;\n\n /***\n * @type {ObjectOnSignature}\n */\n this.once;\n\n /***\n * @type {ObjectOnSignature}\n */\n this.un;\n\n // Call {@link module:ol/util.getUid} to ensure that the order of objects' ids is\n // the same as the order in which they were created. This also helps to\n // ensure that object properties are always added in the same order, which\n // helps many JavaScript engines generate faster code.\n getUid(this);\n\n /**\n * @private\n * @type {Partial>|null}\n */\n this.values_ = null;\n\n if (values !== undefined) {\n this.setProperties(values);\n }\n }\n\n /**\n * Gets a value.\n * @param {string} key Key name.\n * @return {*} Value.\n * @api\n */\n get(key) {\n let value;\n if (this.values_ && this.values_.hasOwnProperty(key)) {\n value = this.values_[key];\n }\n return value;\n }\n\n /**\n * Get a list of object property names.\n * @return {Array} List of property names.\n * @api\n */\n getKeys() {\n return (this.values_ && Object.keys(this.values_)) || [];\n }\n\n /**\n * Get an object of all property names and values.\n * @return {NoInfer} Object.\n * @api\n */\n getProperties() {\n return /** @type {NoInfer} */ (\n (this.values_ && Object.assign({}, this.values_)) || {}\n );\n }\n\n /**\n * Get an object of all property names and values.\n * @return {Partial>?} Object.\n */\n getPropertiesInternal() {\n return this.values_;\n }\n\n /**\n * @return {boolean} The object has properties.\n */\n hasProperties() {\n return !!this.values_;\n }\n\n /**\n * @param {string} key Key name.\n * @param {*} oldValue Old value.\n */\n notify(key, oldValue) {\n let eventType;\n eventType = `change:${key}`;\n if (this.hasListener(eventType)) {\n this.dispatchEvent(new ObjectEvent(eventType, key, oldValue));\n }\n eventType = ObjectEventType.PROPERTYCHANGE;\n if (this.hasListener(eventType)) {\n this.dispatchEvent(new ObjectEvent(eventType, key, oldValue));\n }\n }\n\n /**\n * @param {string} key Key name.\n * @param {import(\"./events.js\").Listener} listener Listener.\n */\n addChangeListener(key, listener) {\n this.addEventListener(`change:${key}`, listener);\n }\n\n /**\n * @param {string} key Key name.\n * @param {import(\"./events.js\").Listener} listener Listener.\n */\n removeChangeListener(key, listener) {\n this.removeEventListener(`change:${key}`, listener);\n }\n\n /**\n * Sets a value.\n * @param {string} key Key name.\n * @param {*} value Value.\n * @param {boolean} [silent] Update without triggering an event.\n * @api\n */\n set(key, value, silent) {\n const values = this.values_ || (this.values_ = {});\n if (silent) {\n values[key] = value;\n } else {\n const oldValue = values[key];\n values[key] = value;\n if (oldValue !== value) {\n this.notify(key, oldValue);\n }\n }\n }\n\n /**\n * Sets a collection of key-value pairs. Note that this changes any existing\n * properties and adds new ones (it does not remove any existing properties).\n * @param {Partial>} values Values.\n * @param {boolean} [silent] Update without triggering an event.\n * @api\n */\n setProperties(values, silent) {\n for (const key in values) {\n this.set(key, values[key], silent);\n }\n }\n\n /**\n * Apply any properties from another object without triggering events.\n * @param {BaseObject} source The source object.\n * @protected\n */\n applyProperties(source) {\n if (!source.values_) {\n return;\n }\n Object.assign(this.values_ || (this.values_ = {}), source.values_);\n }\n\n /**\n * Unsets a property.\n * @param {string} key Key name.\n * @param {boolean} [silent] Unset without triggering an event.\n * @api\n */\n unset(key, silent) {\n if (this.values_ && key in this.values_) {\n const oldValue = this.values_[key];\n delete this.values_[key];\n if (isEmpty(this.values_)) {\n this.values_ = null;\n }\n if (!silent) {\n this.notify(key, oldValue);\n }\n }\n }\n}\n\nexport default BaseObject;\n","/**\n * @module ol/Collection\n */\nimport CollectionEventType from './CollectionEventType.js';\nimport BaseObject from './Object.js';\nimport Event from './events/Event.js';\n\n/**\n * @enum {string}\n * @private\n */\nconst Property = {\n LENGTH: 'length',\n};\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/Collection~Collection} instances are instances of this\n * type.\n * @template T\n */\nexport class CollectionEvent extends Event {\n /**\n * @param {import(\"./CollectionEventType.js\").default} type Type.\n * @param {T} element Element.\n * @param {number} index The index of the added or removed element.\n */\n constructor(type, element, index) {\n super(type);\n\n /**\n * The element that is added to or removed from the collection.\n * @type {T}\n * @api\n */\n this.element = element;\n\n /**\n * The index of the added or removed element.\n * @type {number}\n * @api\n */\n this.index = index;\n }\n}\n\n/***\n * @template T\n * @template Return\n * @typedef {import(\"./Observable\").OnSignature &\n * import(\"./Observable\").OnSignature &\n * import(\"./Observable\").OnSignature<'add'|'remove', CollectionEvent, Return> &\n * import(\"./Observable\").CombinedOnSignature} CollectionOnSignature\n */\n\n/**\n * @typedef {Object} Options\n * @property {boolean} [unique=false] Disallow the same item from being added to\n * the collection twice.\n */\n\n/**\n * @classdesc\n * An expanded version of standard JS Array, adding convenience methods for\n * manipulation. Add and remove changes to the Collection trigger a Collection\n * event. Note that this does not cover changes to the objects _within_ the\n * Collection; they trigger events on the appropriate object, not on the\n * Collection as a whole.\n *\n * @fires CollectionEvent\n *\n * @template T\n * @api\n */\nclass Collection extends BaseObject {\n /**\n * @param {Array} [array] Array.\n * @param {Options} [options] Collection options.\n */\n constructor(array, options) {\n super();\n\n /***\n * @type {CollectionOnSignature}\n */\n this.on;\n\n /***\n * @type {CollectionOnSignature}\n */\n this.once;\n\n /***\n * @type {CollectionOnSignature}\n */\n this.un;\n\n options = options || {};\n\n /**\n * @private\n * @type {boolean}\n */\n this.unique_ = !!options.unique;\n\n /**\n * @private\n * @type {!Array}\n */\n this.array_ = array ?? [];\n\n if (this.unique_) {\n for (let i = 1, ii = this.array_.length; i < ii; ++i) {\n this.assertUnique_(this.array_[i], i);\n }\n }\n\n this.updateLength_();\n }\n\n /**\n * Remove all elements from the collection.\n * @api\n */\n clear() {\n while (this.getLength() > 0) {\n this.pop();\n }\n }\n\n /**\n * Add elements to the collection. This pushes each item in the provided array\n * to the end of the collection.\n * @param {!Array} arr Array.\n * @return {Collection} This collection.\n * @api\n */\n extend(arr) {\n for (let i = 0, ii = arr.length; i < ii; ++i) {\n this.push(arr[i]);\n }\n return this;\n }\n\n /**\n * Iterate over each element, calling the provided callback.\n * @param {function(T, number, Array): *} f The function to call\n * for every element. This function takes 3 arguments (the element, the\n * index and the array). The return value is ignored.\n * @api\n */\n forEach(f) {\n const array = this.array_;\n for (let i = 0, ii = array.length; i < ii; ++i) {\n f(array[i], i, array);\n }\n }\n\n /**\n * Get a reference to the underlying Array object. Warning: if the array\n * is mutated, no events will be dispatched by the collection, and the\n * collection's \"length\" property won't be in sync with the actual length\n * of the array.\n * @return {!Array} Array.\n * @api\n */\n getArray() {\n return this.array_;\n }\n\n /**\n * Get the element at the provided index.\n * @param {number} index Index.\n * @return {T} Element.\n * @api\n */\n item(index) {\n return this.array_[index];\n }\n\n /**\n * Get the length of this collection.\n * @return {number} The length of the array.\n * @observable\n * @api\n */\n getLength() {\n return this.get(Property.LENGTH);\n }\n\n /**\n * Insert an element at the provided index.\n * @param {number} index Index.\n * @param {T} elem Element.\n * @api\n */\n insertAt(index, elem) {\n if (index < 0 || index > this.getLength()) {\n throw new Error('Index out of bounds: ' + index);\n }\n if (this.unique_) {\n this.assertUnique_(elem);\n }\n this.array_.splice(index, 0, elem);\n this.updateLength_();\n this.dispatchEvent(\n new CollectionEvent(CollectionEventType.ADD, elem, index),\n );\n }\n\n /**\n * Remove the last element of the collection and return it.\n * Return `undefined` if the collection is empty.\n * @return {T|undefined} Element.\n * @api\n */\n pop() {\n return this.removeAt(this.getLength() - 1);\n }\n\n /**\n * Insert the provided element at the end of the collection.\n * @param {T} elem Element.\n * @return {number} New length of the collection.\n * @api\n */\n push(elem) {\n const n = this.getLength();\n this.insertAt(n, elem);\n return this.getLength();\n }\n\n /**\n * Remove the first occurrence of an element from the collection.\n * @param {T} elem Element.\n * @return {T|undefined} The removed element or undefined if none found.\n * @api\n */\n remove(elem) {\n const arr = this.array_;\n for (let i = 0, ii = arr.length; i < ii; ++i) {\n if (arr[i] === elem) {\n return this.removeAt(i);\n }\n }\n return undefined;\n }\n\n /**\n * Remove the element at the provided index and return it.\n * Return `undefined` if the collection does not contain this index.\n * @param {number} index Index.\n * @return {T|undefined} Value.\n * @api\n */\n removeAt(index) {\n if (index < 0 || index >= this.getLength()) {\n return undefined;\n }\n const prev = this.array_[index];\n this.array_.splice(index, 1);\n this.updateLength_();\n this.dispatchEvent(\n /** @type {CollectionEvent} */ (\n new CollectionEvent(CollectionEventType.REMOVE, prev, index)\n ),\n );\n return prev;\n }\n\n /**\n * Set the element at the provided index.\n * @param {number} index Index.\n * @param {T} elem Element.\n * @api\n */\n setAt(index, elem) {\n const n = this.getLength();\n if (index >= n) {\n this.insertAt(index, elem);\n return;\n }\n if (index < 0) {\n throw new Error('Index out of bounds: ' + index);\n }\n if (this.unique_) {\n this.assertUnique_(elem, index);\n }\n const prev = this.array_[index];\n this.array_[index] = elem;\n this.dispatchEvent(\n /** @type {CollectionEvent} */ (\n new CollectionEvent(CollectionEventType.REMOVE, prev, index)\n ),\n );\n this.dispatchEvent(\n /** @type {CollectionEvent} */ (\n new CollectionEvent(CollectionEventType.ADD, elem, index)\n ),\n );\n }\n\n /**\n * @private\n */\n updateLength_() {\n this.set(Property.LENGTH, this.array_.length);\n }\n\n /**\n * @private\n * @param {T} elem Element.\n * @param {number} [except] Optional index to ignore.\n */\n assertUnique_(elem, except) {\n const array = this.array_;\n for (let i = 0, ii = array.length; i < ii; ++i) {\n if (array[i] === elem && i !== except) {\n throw new Error('Duplicate item added to a unique collection');\n }\n }\n }\n}\n\nexport default Collection;\n","/**\n * @module ol/TileState\n */\n\n/**\n * @enum {number}\n */\nexport default {\n IDLE: 0,\n LOADING: 1,\n LOADED: 2,\n /**\n * Indicates that tile loading failed\n * @type {number}\n */\n ERROR: 3,\n EMPTY: 4,\n};\n","/**\n * @module ol/easing\n */\n\n/**\n * Start slow and speed up.\n * @param {number} t Input between 0 and 1.\n * @return {number} Output between 0 and 1.\n * @api\n */\nexport function easeIn(t) {\n return Math.pow(t, 3);\n}\n\n/**\n * Start fast and slow down.\n * @param {number} t Input between 0 and 1.\n * @return {number} Output between 0 and 1.\n * @api\n */\nexport function easeOut(t) {\n return 1 - easeIn(1 - t);\n}\n\n/**\n * Start slow, speed up, and then slow down again.\n * @param {number} t Input between 0 and 1.\n * @return {number} Output between 0 and 1.\n * @api\n */\nexport function inAndOut(t) {\n return 3 * t * t - 2 * t * t * t;\n}\n\n/**\n * Maintain a constant speed over time.\n * @param {number} t Input between 0 and 1.\n * @return {number} Output between 0 and 1.\n * @api\n */\nexport function linear(t) {\n return t;\n}\n\n/**\n * Start slow, speed up, and at the very end slow down again. This has the\n * same general behavior as {@link module:ol/easing.inAndOut}, but the final\n * slowdown is delayed.\n * @param {number} t Input between 0 and 1.\n * @return {number} Output between 0 and 1.\n * @api\n */\nexport function upAndDown(t) {\n if (t < 0.5) {\n return inAndOut(2 * t);\n }\n return 1 - inAndOut(2 * (t - 0.5));\n}\n","/**\n * @module ol/Tile\n */\nimport TileState from './TileState.js';\nimport {easeIn} from './easing.js';\nimport EventType from './events/EventType.js';\nimport EventTarget from './events/Target.js';\nimport {abstract} from './util.js';\n\n/**\n * A function that takes a {@link module:ol/Tile~Tile} for the tile and a\n * `{string}` for the url as arguments. The default is\n * ```js\n * source.setTileLoadFunction(function(tile, src) {\n * tile.getImage().src = src;\n * });\n * ```\n * For more fine grained control, the load function can use fetch or XMLHttpRequest and involve\n * error handling:\n *\n * ```js\n * import TileState from 'ol/TileState.js';\n *\n * source.setTileLoadFunction(function(tile, src) {\n * const xhr = new XMLHttpRequest();\n * xhr.responseType = 'blob';\n * xhr.addEventListener('loadend', function (evt) {\n * const data = this.response;\n * if (data !== undefined) {\n * tile.getImage().src = URL.createObjectURL(data);\n * } else {\n * tile.setState(TileState.ERROR);\n * }\n * });\n * xhr.addEventListener('error', function () {\n * tile.setState(TileState.ERROR);\n * });\n * xhr.open('GET', src);\n * xhr.send();\n * });\n * ```\n *\n * @typedef {function(Tile, string): void} LoadFunction\n * @api\n */\n\n/**\n * {@link module:ol/source/Tile~TileSource} sources use a function of this type to get\n * the url that provides a tile for a given tile coordinate.\n *\n * This function takes a {@link module:ol/tilecoord~TileCoord} for the tile\n * coordinate, a `{number}` representing the pixel ratio and a\n * {@link module:ol/proj/Projection~Projection} for the projection as arguments\n * and returns a `{string}` representing the tile URL, or undefined if no tile\n * should be requested for the passed tile coordinate.\n *\n * @typedef {function(import(\"./tilecoord.js\").TileCoord, number,\n * import(\"./proj/Projection.js\").default): (string|undefined)} UrlFunction\n * @api\n */\n\n/**\n * @typedef {Object} Options\n * @property {number} [transition=250] A duration for tile opacity\n * transitions in milliseconds. A duration of 0 disables the opacity transition.\n * @property {boolean} [interpolate=false] Use interpolated values when resampling. By default,\n * the nearest neighbor is used when resampling.\n * @api\n */\n\n/**\n * @classdesc\n * Base class for tiles.\n *\n * @abstract\n */\nclass Tile extends EventTarget {\n /**\n * @param {import(\"./tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {import(\"./TileState.js\").default} state State.\n * @param {Options} [options] Tile options.\n */\n constructor(tileCoord, state, options) {\n super();\n\n options = options ? options : {};\n\n /**\n * @type {import(\"./tilecoord.js\").TileCoord}\n */\n this.tileCoord = tileCoord;\n\n /**\n * @protected\n * @type {import(\"./TileState.js\").default}\n */\n this.state = state;\n\n /**\n * A key assigned to the tile. This is used in conjunction with a source key\n * to determine if a cached version of this tile may be used by the renderer.\n * @type {string}\n */\n this.key = '';\n\n /**\n * The duration for the opacity transition.\n * @private\n * @type {number}\n */\n this.transition_ =\n options.transition === undefined ? 250 : options.transition;\n\n /**\n * Lookup of start times for rendering transitions. If the start time is\n * equal to -1, the transition is complete.\n * @private\n * @type {Object}\n */\n this.transitionStarts_ = {};\n\n /**\n * @type {boolean}\n */\n this.interpolate = !!options.interpolate;\n }\n\n /**\n * @protected\n */\n changed() {\n this.dispatchEvent(EventType.CHANGE);\n }\n\n /**\n * Called by the tile cache when the tile is removed from the cache due to expiry\n */\n release() {\n // to remove the `change` listener on this tile in `ol/TileQueue#handleTileChange`\n this.setState(TileState.EMPTY);\n }\n\n /**\n * @return {string} Key.\n */\n getKey() {\n return this.key + '/' + this.tileCoord;\n }\n\n /**\n * Get the tile coordinate for this tile.\n * @return {import(\"./tilecoord.js\").TileCoord} The tile coordinate.\n * @api\n */\n getTileCoord() {\n return this.tileCoord;\n }\n\n /**\n * @return {import(\"./TileState.js\").default} State.\n */\n getState() {\n return this.state;\n }\n\n /**\n * Sets the state of this tile. If you write your own {@link module:ol/Tile~LoadFunction tileLoadFunction} ,\n * it is important to set the state correctly to {@link module:ol/TileState~ERROR}\n * when the tile cannot be loaded. Otherwise the tile cannot be removed from\n * the tile queue and will block other requests.\n * @param {import(\"./TileState.js\").default} state State.\n * @api\n */\n setState(state) {\n if (this.state === TileState.EMPTY) {\n // no more state changes\n return;\n }\n if (this.state !== TileState.ERROR && this.state > state) {\n throw new Error('Tile load sequence violation');\n }\n this.state = state;\n this.changed();\n }\n\n /**\n * Load the image or retry if loading previously failed.\n * Loading is taken care of by the tile queue, and calling this method is\n * only needed for preloading or for reloading in case of an error.\n * @abstract\n * @api\n */\n load() {\n abstract();\n }\n\n /**\n * Get the alpha value for rendering.\n * @param {string} id An id for the renderer.\n * @param {number} time The render frame time.\n * @return {number} A number between 0 and 1.\n */\n getAlpha(id, time) {\n if (!this.transition_) {\n return 1;\n }\n\n let start = this.transitionStarts_[id];\n if (!start) {\n start = time;\n this.transitionStarts_[id] = start;\n } else if (start === -1) {\n return 1;\n }\n\n const delta = time - start + 1000 / 60; // avoid rendering at 0\n if (delta >= this.transition_) {\n return 1;\n }\n return easeIn(delta / this.transition_);\n }\n\n /**\n * Determine if a tile is in an alpha transition. A tile is considered in\n * transition if tile.getAlpha() has not yet been called or has been called\n * and returned 1.\n * @param {string} id An id for the renderer.\n * @return {boolean} The tile is in transition.\n */\n inTransition(id) {\n if (!this.transition_) {\n return false;\n }\n return this.transitionStarts_[id] !== -1;\n }\n\n /**\n * Mark a transition as complete.\n * @param {string} id An id for the renderer.\n */\n endTransition(id) {\n if (this.transition_) {\n this.transitionStarts_[id] = -1;\n }\n }\n\n /**\n * @override\n */\n disposeInternal() {\n this.release();\n super.disposeInternal();\n }\n}\n\nexport default Tile;\n","/**\n * @module ol/has\n */\n\nconst ua =\n typeof navigator !== 'undefined' && typeof navigator.userAgent !== 'undefined'\n ? navigator.userAgent.toLowerCase()\n : '';\n\n/**\n * User agent string says we are dealing with Safari as browser.\n * @type {boolean}\n */\nexport const SAFARI = ua.includes('safari') && !ua.includes('chrom');\n\n/**\n * https://bugs.webkit.org/show_bug.cgi?id=237906\n * @type {boolean}\n */\nexport const SAFARI_BUG_237906 =\n SAFARI &&\n (ua.includes('version/15.4') ||\n /cpu (os|iphone os) 15_4 like mac os x/.test(ua));\n\n/**\n * User agent string says we are dealing with a WebKit engine.\n * @type {boolean}\n */\nexport const WEBKIT = ua.includes('webkit') && !ua.includes('edge');\n\n/**\n * User agent string says we are dealing with a Mac as platform.\n * @type {boolean}\n */\nexport const MAC = ua.includes('macintosh');\n\n/**\n * The ratio between physical pixels and device-independent pixels\n * (dips) on the device (`window.devicePixelRatio`).\n * @const\n * @type {number}\n * @api\n */\nexport const DEVICE_PIXEL_RATIO =\n typeof devicePixelRatio !== 'undefined' ? devicePixelRatio : 1;\n\n/**\n * The execution context is a worker with OffscreenCanvas available.\n * @const\n * @type {boolean}\n */\nexport const WORKER_OFFSCREEN_CANVAS =\n typeof WorkerGlobalScope !== 'undefined' &&\n typeof OffscreenCanvas !== 'undefined' &&\n self instanceof WorkerGlobalScope; //eslint-disable-line\n\n/**\n * Image.prototype.decode() is supported.\n * @type {boolean}\n */\nexport const IMAGE_DECODE =\n typeof Image !== 'undefined' && Image.prototype.decode;\n\n/**\n * createImageBitmap() is supported.\n * @type {boolean}\n */\nexport const CREATE_IMAGE_BITMAP = typeof createImageBitmap === 'function';\n\n/**\n * @type {boolean}\n */\nexport const PASSIVE_EVENT_LISTENERS = (function () {\n let passive = false;\n try {\n const options = Object.defineProperty({}, 'passive', {\n get: function () {\n passive = true;\n },\n });\n\n // @ts-ignore Ignore invalid event type '_'\n window.addEventListener('_', null, options);\n // @ts-ignore Ignore invalid event type '_'\n window.removeEventListener('_', null, options);\n } catch {\n // passive not supported\n }\n return passive;\n})();\n","import {WORKER_OFFSCREEN_CANVAS} from './has.js';\n\n/**\n * @module ol/dom\n */\n\n/**\n * @typedef {Object} ImageAttributes\n * @property {string|null} [crossOrigin] Cross origin.\n * @property {ReferrerPolicy} [referrerPolicy] Referrer policy.\n */\n\n//FIXME Move this function to the canvas module\n/**\n * Create an html canvas element and returns its 2d context.\n * @param {number} [width] Canvas width.\n * @param {number} [height] Canvas height.\n * @param {Array} [canvasPool] Canvas pool to take existing canvas from.\n * @param {CanvasRenderingContext2DSettings} [settings] CanvasRenderingContext2DSettings\n * @return {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} The context.\n */\nexport function createCanvasContext2D(width, height, canvasPool, settings) {\n /** @type {HTMLCanvasElement|OffscreenCanvas} */\n let canvas;\n if (canvasPool && canvasPool.length) {\n canvas = /** @type {HTMLCanvasElement} */ (canvasPool.shift());\n } else if (WORKER_OFFSCREEN_CANVAS) {\n canvas = new (class extends OffscreenCanvas {\n style = {};\n })(width ?? 300, height ?? 150);\n } else {\n canvas = document.createElement('canvas');\n }\n if (width) {\n canvas.width = width;\n }\n if (height) {\n canvas.height = height;\n }\n return /** @type {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} */ (\n canvas.getContext('2d', settings)\n );\n}\n\n/**\n * @type {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D}\n */\nlet sharedCanvasContext;\n\n/**\n * @return {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} Shared canvas context.\n */\nexport function getSharedCanvasContext2D() {\n if (!sharedCanvasContext) {\n sharedCanvasContext = createCanvasContext2D(1, 1);\n }\n return sharedCanvasContext;\n}\n\n/**\n * Releases canvas memory to avoid exceeding memory limits in Safari.\n * See https://pqina.nl/blog/total-canvas-memory-use-exceeds-the-maximum-limit/\n * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} context Context.\n */\nexport function releaseCanvas(context) {\n const canvas = context.canvas;\n canvas.width = 1;\n canvas.height = 1;\n context.clearRect(0, 0, 1, 1);\n}\n\n/**\n * Get the current computed width for the given element including margin,\n * padding and border.\n * Equivalent to jQuery's `$(el).outerWidth(true)`.\n * @param {!HTMLElement} element Element.\n * @return {number} The width.\n */\nexport function outerWidth(element) {\n let width = element.offsetWidth;\n const style = getComputedStyle(element);\n width += parseInt(style.marginLeft, 10) + parseInt(style.marginRight, 10);\n\n return width;\n}\n\n/**\n * Get the current computed height for the given element including margin,\n * padding and border.\n * Equivalent to jQuery's `$(el).outerHeight(true)`.\n * @param {!HTMLElement} element Element.\n * @return {number} The height.\n */\nexport function outerHeight(element) {\n let height = element.offsetHeight;\n const style = getComputedStyle(element);\n height += parseInt(style.marginTop, 10) + parseInt(style.marginBottom, 10);\n\n return height;\n}\n\n/**\n * @param {Node} newNode Node to replace old node\n * @param {Node} oldNode The node to be replaced\n */\nexport function replaceNode(newNode, oldNode) {\n const parent = oldNode.parentNode;\n if (parent) {\n parent.replaceChild(newNode, oldNode);\n }\n}\n\n/**\n * @param {Node} node The node to remove the children from.\n */\nexport function removeChildren(node) {\n while (node.lastChild) {\n node.lastChild.remove();\n }\n}\n\n/**\n * Transform the children of a parent node so they match the\n * provided list of children. This function aims to efficiently\n * remove, add, and reorder child nodes while maintaining a simple\n * implementation (it is not guaranteed to minimize DOM operations).\n * @param {Node} node The parent node whose children need reworking.\n * @param {Array} children The desired children.\n */\nexport function replaceChildren(node, children) {\n const oldChildren = node.childNodes;\n\n for (let i = 0; true; ++i) {\n const oldChild = oldChildren[i];\n const newChild = children[i];\n\n // check if our work is done\n if (!oldChild && !newChild) {\n break;\n }\n\n // check if children match\n if (oldChild === newChild) {\n continue;\n }\n\n // check if a new child needs to be added\n if (!oldChild) {\n node.appendChild(newChild);\n continue;\n }\n\n // check if an old child needs to be removed\n if (!newChild) {\n node.removeChild(oldChild);\n --i;\n continue;\n }\n\n // reorder\n node.insertBefore(newChild, oldChild);\n }\n}\n\n/**\n * Creates a minimal structure that mocks a DIV to be used by the composite and\n * layer renderer in a worker environment\n * @return {HTMLDivElement} mocked DIV\n */\nexport function createMockDiv() {\n const mockedDiv = new Proxy(\n {\n /**\n * @type {Array}\n */\n childNodes: [],\n /**\n * @param {HTMLElement} node html node.\n * @return {HTMLElement} html node.\n */\n appendChild: function (node) {\n this.childNodes.push(node);\n return node;\n },\n /**\n * dummy function, as this structure is not supposed to have a parent.\n */\n remove: function () {},\n /**\n * @param {HTMLElement} node html node.\n * @return {HTMLElement} html node.\n */\n removeChild: function (node) {\n const index = this.childNodes.indexOf(node);\n if (index === -1) {\n throw new Error('Node to remove was not found');\n }\n this.childNodes.splice(index, 1);\n return node;\n },\n /**\n * @param {HTMLElement} newNode new html node.\n * @param {HTMLElement} referenceNode reference html node.\n * @return {HTMLElement} new html node.\n */\n insertBefore: function (newNode, referenceNode) {\n const index = this.childNodes.indexOf(referenceNode);\n if (index === -1) {\n throw new Error('Reference node not found');\n }\n this.childNodes.splice(index, 0, newNode);\n return newNode;\n },\n style: {},\n },\n {\n get(target, prop, receiver) {\n if (prop === 'firstElementChild') {\n return target.childNodes.length > 0 ? target.childNodes[0] : null;\n }\n return Reflect.get(target, prop, receiver);\n },\n },\n );\n return /** @type {HTMLDivElement} */ (/** @type {*} */ (mockedDiv));\n}\n\n/***\n * @param {*} obj The object to check.\n * @return {obj is (HTMLCanvasElement | OffscreenCanvas)} The object is a canvas.\n */\nexport function isCanvas(obj) {\n return (\n (typeof HTMLCanvasElement !== 'undefined' &&\n obj instanceof HTMLCanvasElement) ||\n (typeof OffscreenCanvas !== 'undefined' && obj instanceof OffscreenCanvas)\n );\n}\n","/**\n * @module ol/DataTile\n */\nimport Tile from './Tile.js';\nimport TileState from './TileState.js';\nimport {createCanvasContext2D} from './dom.js';\n\n/**\n * @typedef {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas|HTMLVideoElement|ImageBitmap} ImageLike\n */\n\n/**\n * @typedef {Uint8Array|Uint8ClampedArray|Float32Array|DataView} ArrayLike\n */\n\n/**\n * Data that can be used with a DataTile.\n * @typedef {ArrayLike|ImageLike} Data\n */\n\n/**\n * @param {Data} data Tile data.\n * @return {ImageLike|null} The image-like data.\n */\nexport function asImageLike(data) {\n return data instanceof Image ||\n data instanceof HTMLCanvasElement ||\n data instanceof HTMLVideoElement ||\n data instanceof ImageBitmap\n ? data\n : null;\n}\n\n/**\n * @param {Data} data Tile data.\n * @return {ArrayLike|null} The array-like data.\n */\nexport function asArrayLike(data) {\n return data instanceof Uint8Array ||\n data instanceof Uint8ClampedArray ||\n data instanceof Float32Array ||\n data instanceof DataView\n ? data\n : null;\n}\n\n/**\n * This is set as the cancellation reason when a tile is disposed.\n */\nexport const disposedError = new Error('disposed');\n\n/**\n * @type {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D|null}\n */\nlet sharedContext = null;\n\n/**\n * @param {ImageLike} image The image.\n * @return {Uint8ClampedArray} The data.\n */\nexport function toArray(image) {\n if (!sharedContext) {\n sharedContext = createCanvasContext2D(\n image.width,\n image.height,\n undefined,\n {willReadFrequently: true},\n );\n }\n const canvas = sharedContext.canvas;\n const width = image.width;\n if (canvas.width !== width) {\n canvas.width = width;\n }\n const height = image.height;\n if (canvas.height !== height) {\n canvas.height = height;\n }\n sharedContext.clearRect(0, 0, width, height);\n sharedContext.drawImage(image, 0, 0);\n return sharedContext.getImageData(0, 0, width, height).data;\n}\n\n/**\n * @type {import('./size.js').Size}\n */\nconst defaultSize = [256, 256];\n\n/**\n * @typedef {Object} Options\n * @property {import(\"./tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @property {function(): Promise} loader Data loader. For loaders that generate images,\n * the promise should not resolve until the image is loaded.\n * @property {number} [transition=250] A duration for tile opacity\n * transitions in milliseconds. A duration of 0 disables the opacity transition.\n * @property {boolean} [interpolate=false] Use interpolated values when resampling. By default,\n * the nearest neighbor is used when resampling.\n * @property {import('./size.js').Size} [size=[256, 256]] Tile size.\n * @property {AbortController} [controller] An abort controller.\n * @api\n */\n\nclass DataTile extends Tile {\n /**\n * @param {Options} options Tile options.\n */\n constructor(options) {\n const state = TileState.IDLE;\n\n super(options.tileCoord, state, {\n transition: options.transition,\n interpolate: options.interpolate,\n });\n\n /**\n * @type {function(): Promise}\n * @private\n */\n this.loader_ = options.loader;\n\n /**\n * @type {Data}\n * @private\n */\n this.data_ = null;\n\n /**\n * @type {Error}\n * @private\n */\n this.error_ = null;\n\n /**\n * @type {import('./size.js').Size|null}\n * @private\n */\n this.size_ = options.size || null;\n\n /**\n * @type {AbortController|null}\n * @private\n */\n this.controller_ = options.controller || null;\n }\n\n /**\n * Get the tile size.\n * @return {import('./size.js').Size} Tile size.\n */\n getSize() {\n if (this.size_) {\n return this.size_;\n }\n const imageData = asImageLike(this.data_);\n if (imageData) {\n return [imageData.width, imageData.height];\n }\n return defaultSize;\n }\n\n /**\n * Get the data for the tile.\n * @return {Data} Tile data.\n * @api\n */\n getData() {\n return this.data_;\n }\n\n /**\n * Get any loading error.\n * @return {Error} Loading error.\n * @api\n */\n getError() {\n return this.error_;\n }\n\n /**\n * Load the tile data.\n * @api\n * @override\n */\n load() {\n if (this.state !== TileState.IDLE && this.state !== TileState.ERROR) {\n return;\n }\n this.state = TileState.LOADING;\n this.changed();\n\n const self = this;\n this.loader_()\n .then(function (data) {\n self.data_ = data;\n self.state = TileState.LOADED;\n self.changed();\n })\n .catch(function (error) {\n self.error_ = error;\n self.state = TileState.ERROR;\n self.changed();\n });\n }\n\n /**\n * Clean up.\n * @override\n */\n disposeInternal() {\n if (this.controller_) {\n this.controller_.abort(disposedError);\n this.controller_ = null;\n }\n super.disposeInternal();\n }\n}\n\nexport default DataTile;\n","/**\n * @module ol/asserts\n */\n\n/**\n * @param {*} assertion Assertion we expected to be truthy.\n * @param {string} errorMessage Error message.\n */\nexport function assert(assertion, errorMessage) {\n if (!assertion) {\n throw new Error(errorMessage);\n }\n}\n","/**\n * @module ol/Feature\n */\nimport BaseObject from './Object.js';\nimport {assert} from './asserts.js';\nimport EventType from './events/EventType.js';\nimport {listen, unlistenByKey} from './events.js';\n\n/**\n * @typedef {typeof Feature|typeof import(\"./render/Feature.js\").default} FeatureClass\n */\n\n/**\n * @typedef {Feature|import(\"./render/Feature.js\").default} FeatureLike\n */\n\n/***\n * @template Return\n * @typedef {import(\"./Observable\").OnSignature &\n * import(\"./Observable\").OnSignature &\n * import(\"./Observable\").CombinedOnSignature} FeatureOnSignature\n */\n\n/***\n * @template {import(\"./geom/Geometry.js\").default} [Geometry=import(\"./geom/Geometry.js\").default]\n * @template {Object} [Properties=Object]\n * @typedef {Properties & { geometry?: Geometry }} ObjectWithGeometry\n */\n\n/**\n * @classdesc\n * A vector object for geographic features with a geometry and other\n * attribute properties, similar to the features in vector file formats like\n * GeoJSON.\n *\n * Features can be styled individually with `setStyle`; otherwise they use the\n * style of their vector layer.\n *\n * Note that attribute properties are set as {@link module:ol/Object~BaseObject} properties on\n * the feature object, so they are observable, and have get/set accessors.\n *\n * Typically, a feature has a single geometry property. You can set the\n * geometry using the `setGeometry` method and get it with `getGeometry`.\n * It is possible to store more than one geometry on a feature using attribute\n * properties. By default, the geometry used for rendering is identified by\n * the property name `geometry`. If you want to use another geometry property\n * for rendering, use the `setGeometryName` method to change the attribute\n * property associated with the geometry for the feature. For example:\n *\n * ```js\n *\n * import Feature from 'ol/Feature.js';\n * import Polygon from 'ol/geom/Polygon.js';\n * import Point from 'ol/geom/Point.js';\n *\n * const feature = new Feature({\n * geometry: new Polygon(polyCoords),\n * labelPoint: new Point(labelCoords),\n * name: 'My Polygon',\n * });\n *\n * // get the polygon geometry\n * const poly = feature.getGeometry();\n *\n * // Render the feature as a point using the coordinates from labelPoint\n * feature.setGeometryName('labelPoint');\n *\n * // get the point geometry\n * const point = feature.getGeometry();\n * ```\n *\n * @api\n * @template {import(\"./geom/Geometry.js\").default} [Geometry=import(\"./geom/Geometry.js\").default]\n * @template {Object} [Properties=Object]\n * @extends {BaseObject>}\n */\nclass Feature extends BaseObject {\n /**\n * @param {Geometry|ObjectWithGeometry>} [geometryOrProperties]\n * You may pass a Geometry object directly, or an object literal containing\n * properties. If you pass an object literal, you may include a Geometry\n * associated with a `geometry` key.\n */\n constructor(geometryOrProperties) {\n super();\n\n /***\n * @type {FeatureOnSignature}\n */\n this.on;\n\n /***\n * @type {FeatureOnSignature}\n */\n this.once;\n\n /***\n * @type {FeatureOnSignature}\n */\n this.un;\n\n /**\n * @private\n * @type {number|string|undefined}\n */\n this.id_ = undefined;\n\n /**\n * @type {string}\n * @private\n */\n this.geometryName_ = 'geometry';\n\n /**\n * User provided style.\n * @private\n * @type {import(\"./style/Style.js\").StyleLike}\n */\n this.style_ = null;\n\n /**\n * @private\n * @type {import(\"./style/Style.js\").StyleFunction|undefined}\n */\n this.styleFunction_ = undefined;\n\n /**\n * @private\n * @type {?import(\"./events.js\").EventsKey}\n */\n this.geometryChangeKey_ = null;\n\n this.addChangeListener(this.geometryName_, this.handleGeometryChanged_);\n\n if (geometryOrProperties) {\n if (\n typeof (\n /** @type {?} */ (geometryOrProperties).getSimplifiedGeometry\n ) === 'function'\n ) {\n const geometry = /** @type {Geometry} */ (geometryOrProperties);\n this.setGeometry(geometry);\n } else {\n /** @type {?} */\n const properties = geometryOrProperties;\n this.setProperties(properties);\n }\n }\n }\n\n /**\n * Clone this feature. If the original feature has a geometry it\n * is also cloned. The feature id is not set in the clone.\n * @return {Feature} The clone.\n * @api\n */\n clone() {\n const clone = /** @type {Feature} */ (\n new Feature(this.hasProperties() ? this.getProperties() : null)\n );\n clone.setGeometryName(this.getGeometryName());\n const geometry = this.getGeometry();\n if (geometry) {\n clone.setGeometry(/** @type {Geometry} */ (geometry.clone()));\n }\n const style = this.getStyle();\n if (style) {\n clone.setStyle(style);\n }\n return clone;\n }\n\n /**\n * Get the feature's default geometry. A feature may have any number of named\n * geometries. The \"default\" geometry (the one that is rendered by default) is\n * set when calling {@link module:ol/Feature~Feature#setGeometry}.\n * @return {Geometry|undefined} The default geometry for the feature.\n * @api\n * @observable\n */\n getGeometry() {\n return /** @type {Geometry|undefined} */ (this.get(this.geometryName_));\n }\n\n /**\n * Get the feature identifier. This is a stable identifier for the feature and\n * is either set when reading data from a remote source or set explicitly by\n * calling {@link module:ol/Feature~Feature#setId}.\n * @return {number|string|undefined} Id.\n * @api\n */\n getId() {\n return this.id_;\n }\n\n /**\n * Get the name of the feature's default geometry. By default, the default\n * geometry is named `geometry`.\n * @return {string} Get the property name associated with the default geometry\n * for this feature.\n * @api\n */\n getGeometryName() {\n return this.geometryName_;\n }\n\n /**\n * Get the feature's style. Will return what was provided to the\n * {@link module:ol/Feature~Feature#setStyle} method.\n * @return {import(\"./style/Style.js\").StyleLike|undefined} The feature style.\n * @api\n */\n getStyle() {\n return this.style_;\n }\n\n /**\n * Get the feature's style function.\n * @return {import(\"./style/Style.js\").StyleFunction|undefined} Return a function\n * representing the current style of this feature.\n * @api\n */\n getStyleFunction() {\n return this.styleFunction_;\n }\n\n /**\n * @private\n */\n handleGeometryChange_() {\n this.changed();\n }\n\n /**\n * @private\n */\n handleGeometryChanged_() {\n if (this.geometryChangeKey_) {\n unlistenByKey(this.geometryChangeKey_);\n this.geometryChangeKey_ = null;\n }\n const geometry = this.getGeometry();\n if (geometry) {\n this.geometryChangeKey_ = listen(\n geometry,\n EventType.CHANGE,\n this.handleGeometryChange_,\n this,\n );\n }\n this.changed();\n }\n\n /**\n * Set the default geometry for the feature. This will update the property\n * with the name returned by {@link module:ol/Feature~Feature#getGeometryName}.\n * @param {Geometry|undefined} geometry The new geometry.\n * @api\n * @observable\n */\n setGeometry(geometry) {\n this.set(this.geometryName_, geometry);\n }\n\n /**\n * Set the style for the feature to override the layer style. This can be a\n * single style object, an array of styles, or a function that takes a\n * resolution and returns an array of styles. To unset the feature style, call\n * `setStyle()` without arguments or a falsey value.\n * @param {import(\"./style/Style.js\").StyleLike} [style] Style for this feature.\n * @api\n * @fires module:ol/events/Event~BaseEvent#event:change\n */\n setStyle(style) {\n this.style_ = style;\n this.styleFunction_ = !style ? undefined : createStyleFunction(style);\n this.changed();\n }\n\n /**\n * Set the feature id. The feature id is considered stable and may be used when\n * requesting features or comparing identifiers returned from a remote source.\n * The feature id can be used with the\n * {@link module:ol/source/Vector~VectorSource#getFeatureById} method.\n * @param {number|string|undefined} id The feature id.\n * @api\n * @fires module:ol/events/Event~BaseEvent#event:change\n */\n setId(id) {\n this.id_ = id;\n this.changed();\n }\n\n /**\n * Set the property name to be used when getting the feature's default geometry.\n * When calling {@link module:ol/Feature~Feature#getGeometry}, the value of the property with\n * this name will be returned.\n * @param {string} name The property name of the default geometry.\n * @api\n */\n setGeometryName(name) {\n this.removeChangeListener(this.geometryName_, this.handleGeometryChanged_);\n this.geometryName_ = name;\n this.addChangeListener(this.geometryName_, this.handleGeometryChanged_);\n this.handleGeometryChanged_();\n }\n}\n\n/**\n * Convert the provided object into a feature style function. Functions passed\n * through unchanged. Arrays of Style or single style objects wrapped\n * in a new feature style function.\n * @param {!import(\"./style/Style.js\").StyleFunction|!Array|!import(\"./style/Style.js\").default} obj\n * A feature style function, a single style, or an array of styles.\n * @return {import(\"./style/Style.js\").StyleFunction} A style function.\n */\nexport function createStyleFunction(obj) {\n if (typeof obj === 'function') {\n return obj;\n }\n /**\n * @type {Array}\n */\n let styles;\n if (Array.isArray(obj)) {\n styles = obj;\n } else {\n assert(\n typeof (/** @type {?} */ (obj).getZIndex) === 'function',\n 'Expected an `ol/style/Style` or an array of `ol/style/Style.js`',\n );\n const style = /** @type {import(\"./style/Style.js\").default} */ (obj);\n styles = [style];\n }\n return function () {\n return styles;\n };\n}\nexport default Feature;\n","/**\n * @module ol/extent/Relationship\n */\n\n/**\n * Relationship to an extent.\n * @enum {number}\n */\nexport default {\n UNKNOWN: 0,\n INTERSECTING: 1,\n ABOVE: 2,\n RIGHT: 4,\n BELOW: 8,\n LEFT: 16,\n};\n","/**\n * @module ol/extent\n */\nimport Relationship from './extent/Relationship.js';\n\n/**\n * An array of numbers representing an extent: `[minx, miny, maxx, maxy]`.\n * @typedef {Array} Extent\n * @api\n */\n\n/**\n * Extent corner.\n * @typedef {'bottom-left' | 'bottom-right' | 'top-left' | 'top-right'} Corner\n */\n\n/**\n * Build an extent that includes all given coordinates.\n *\n * @param {Array} coordinates Coordinates.\n * @return {Extent} Bounding extent.\n * @api\n */\nexport function boundingExtent(coordinates) {\n const extent = createEmpty();\n for (let i = 0, ii = coordinates.length; i < ii; ++i) {\n extendCoordinate(extent, coordinates[i]);\n }\n return extent;\n}\n\n/**\n * @param {Array} xs Xs.\n * @param {Array} ys Ys.\n * @param {Extent} [dest] Destination extent.\n * @private\n * @return {Extent} Extent.\n */\nfunction _boundingExtentXYs(xs, ys, dest) {\n const minX = Math.min.apply(null, xs);\n const minY = Math.min.apply(null, ys);\n const maxX = Math.max.apply(null, xs);\n const maxY = Math.max.apply(null, ys);\n return createOrUpdate(minX, minY, maxX, maxY, dest);\n}\n\n/**\n * Return extent increased by the provided value.\n * @param {Extent} extent Extent.\n * @param {number} value The amount by which the extent should be buffered.\n * @param {Extent} [dest] Extent.\n * @return {Extent} Extent.\n * @api\n */\nexport function buffer(extent, value, dest) {\n if (dest) {\n dest[0] = extent[0] - value;\n dest[1] = extent[1] - value;\n dest[2] = extent[2] + value;\n dest[3] = extent[3] + value;\n return dest;\n }\n return [\n extent[0] - value,\n extent[1] - value,\n extent[2] + value,\n extent[3] + value,\n ];\n}\n\n/**\n * Creates a clone of an extent.\n *\n * @param {Extent} extent Extent to clone.\n * @param {Extent} [dest] Extent.\n * @return {Extent} The clone.\n */\nexport function clone(extent, dest) {\n if (dest) {\n dest[0] = extent[0];\n dest[1] = extent[1];\n dest[2] = extent[2];\n dest[3] = extent[3];\n return dest;\n }\n return extent.slice();\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {number} x X.\n * @param {number} y Y.\n * @return {number} Closest squared distance.\n */\nexport function closestSquaredDistanceXY(extent, x, y) {\n let dx, dy;\n if (x < extent[0]) {\n dx = extent[0] - x;\n } else if (extent[2] < x) {\n dx = x - extent[2];\n } else {\n dx = 0;\n }\n if (y < extent[1]) {\n dy = extent[1] - y;\n } else if (extent[3] < y) {\n dy = y - extent[3];\n } else {\n dy = 0;\n }\n return dx * dx + dy * dy;\n}\n\n/**\n * Check if the passed coordinate is contained or on the edge of the extent.\n *\n * @param {Extent} extent Extent.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n * @return {boolean} The coordinate is contained in the extent.\n * @api\n */\nexport function containsCoordinate(extent, coordinate) {\n return containsXY(extent, coordinate[0], coordinate[1]);\n}\n\n/**\n * Check if one extent contains another.\n *\n * An extent is deemed contained if it lies completely within the other extent,\n * including if they share one or more edges.\n *\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @return {boolean} The second extent is contained by or on the edge of the\n * first.\n * @api\n */\nexport function containsExtent(extent1, extent2) {\n return (\n extent1[0] <= extent2[0] &&\n extent2[2] <= extent1[2] &&\n extent1[1] <= extent2[1] &&\n extent2[3] <= extent1[3]\n );\n}\n\n/**\n * Check if the passed coordinate is contained or on the edge of the extent.\n *\n * @param {Extent} extent Extent.\n * @param {number} x X coordinate.\n * @param {number} y Y coordinate.\n * @return {boolean} The x, y values are contained in the extent.\n * @api\n */\nexport function containsXY(extent, x, y) {\n return extent[0] <= x && x <= extent[2] && extent[1] <= y && y <= extent[3];\n}\n\n/**\n * Get the relationship between a coordinate and extent.\n * @param {Extent} extent The extent.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate The coordinate.\n * @return {import(\"./extent/Relationship.js\").default} The relationship (bitwise compare with\n * import(\"./extent/Relationship.js\").Relationship).\n */\nexport function coordinateRelationship(extent, coordinate) {\n const minX = extent[0];\n const minY = extent[1];\n const maxX = extent[2];\n const maxY = extent[3];\n const x = coordinate[0];\n const y = coordinate[1];\n let relationship = Relationship.UNKNOWN;\n if (x < minX) {\n relationship = relationship | Relationship.LEFT;\n } else if (x > maxX) {\n relationship = relationship | Relationship.RIGHT;\n }\n if (y < minY) {\n relationship = relationship | Relationship.BELOW;\n } else if (y > maxY) {\n relationship = relationship | Relationship.ABOVE;\n }\n if (relationship === Relationship.UNKNOWN) {\n relationship = Relationship.INTERSECTING;\n }\n return relationship;\n}\n\n/**\n * Create an empty extent.\n * @return {Extent} Empty extent.\n * @api\n */\nexport function createEmpty() {\n return [Infinity, Infinity, -Infinity, -Infinity];\n}\n\n/**\n * Create a new extent or update the provided extent.\n * @param {number} minX Minimum X.\n * @param {number} minY Minimum Y.\n * @param {number} maxX Maximum X.\n * @param {number} maxY Maximum Y.\n * @param {Extent} [dest] Destination extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdate(minX, minY, maxX, maxY, dest) {\n if (dest) {\n dest[0] = minX;\n dest[1] = minY;\n dest[2] = maxX;\n dest[3] = maxY;\n return dest;\n }\n return [minX, minY, maxX, maxY];\n}\n\n/**\n * Create a new empty extent or make the provided one empty.\n * @param {Extent} [dest] Extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdateEmpty(dest) {\n return createOrUpdate(Infinity, Infinity, -Infinity, -Infinity, dest);\n}\n\n/**\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {Extent} [dest] Extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdateFromCoordinate(coordinate, dest) {\n const x = coordinate[0];\n const y = coordinate[1];\n return createOrUpdate(x, y, x, y, dest);\n}\n\n/**\n * @param {Array} coordinates Coordinates.\n * @param {Extent} [dest] Extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdateFromCoordinates(coordinates, dest) {\n const extent = createOrUpdateEmpty(dest);\n return extendCoordinates(extent, coordinates);\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {Extent} [dest] Extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdateFromFlatCoordinates(\n flatCoordinates,\n offset,\n end,\n stride,\n dest,\n) {\n const extent = createOrUpdateEmpty(dest);\n return extendFlatCoordinates(extent, flatCoordinates, offset, end, stride);\n}\n\n/**\n * @param {Array>} rings Rings.\n * @param {Extent} [dest] Extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdateFromRings(rings, dest) {\n const extent = createOrUpdateEmpty(dest);\n return extendRings(extent, rings);\n}\n\n/**\n * Determine if two extents are equivalent.\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @return {boolean} The two extents are equivalent.\n * @api\n */\nexport function equals(extent1, extent2) {\n return (\n extent1[0] == extent2[0] &&\n extent1[2] == extent2[2] &&\n extent1[1] == extent2[1] &&\n extent1[3] == extent2[3]\n );\n}\n\n/**\n * Determine if two extents are approximately equivalent.\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @param {number} tolerance Tolerance in extent coordinate units.\n * @return {boolean} The two extents differ by less than the tolerance.\n */\nexport function approximatelyEquals(extent1, extent2, tolerance) {\n return (\n Math.abs(extent1[0] - extent2[0]) < tolerance &&\n Math.abs(extent1[2] - extent2[2]) < tolerance &&\n Math.abs(extent1[1] - extent2[1]) < tolerance &&\n Math.abs(extent1[3] - extent2[3]) < tolerance\n );\n}\n\n/**\n * Modify an extent to include another extent.\n * @param {Extent} extent1 The extent to be modified.\n * @param {Extent} extent2 The extent that will be included in the first.\n * @return {Extent} A reference to the first (extended) extent.\n * @api\n */\nexport function extend(extent1, extent2) {\n if (extent2[0] < extent1[0]) {\n extent1[0] = extent2[0];\n }\n if (extent2[2] > extent1[2]) {\n extent1[2] = extent2[2];\n }\n if (extent2[1] < extent1[1]) {\n extent1[1] = extent2[1];\n }\n if (extent2[3] > extent1[3]) {\n extent1[3] = extent2[3];\n }\n return extent1;\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n */\nexport function extendCoordinate(extent, coordinate) {\n if (coordinate[0] < extent[0]) {\n extent[0] = coordinate[0];\n }\n if (coordinate[0] > extent[2]) {\n extent[2] = coordinate[0];\n }\n if (coordinate[1] < extent[1]) {\n extent[1] = coordinate[1];\n }\n if (coordinate[1] > extent[3]) {\n extent[3] = coordinate[1];\n }\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {Array} coordinates Coordinates.\n * @return {Extent} Extent.\n */\nexport function extendCoordinates(extent, coordinates) {\n for (let i = 0, ii = coordinates.length; i < ii; ++i) {\n extendCoordinate(extent, coordinates[i]);\n }\n return extent;\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @return {Extent} Extent.\n */\nexport function extendFlatCoordinates(\n extent,\n flatCoordinates,\n offset,\n end,\n stride,\n) {\n for (; offset < end; offset += stride) {\n extendXY(extent, flatCoordinates[offset], flatCoordinates[offset + 1]);\n }\n return extent;\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {Array>} rings Rings.\n * @return {Extent} Extent.\n */\nexport function extendRings(extent, rings) {\n for (let i = 0, ii = rings.length; i < ii; ++i) {\n extendCoordinates(extent, rings[i]);\n }\n return extent;\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {number} x X.\n * @param {number} y Y.\n */\nexport function extendXY(extent, x, y) {\n extent[0] = Math.min(extent[0], x);\n extent[1] = Math.min(extent[1], y);\n extent[2] = Math.max(extent[2], x);\n extent[3] = Math.max(extent[3], y);\n}\n\n/**\n * This function calls `callback` for each corner of the extent. If the\n * callback returns a truthy value the function returns that value\n * immediately. Otherwise the function returns `false`.\n * @param {Extent} extent Extent.\n * @param {function(import(\"./coordinate.js\").Coordinate): S} callback Callback.\n * @return {S|boolean} Value.\n * @template S\n */\nexport function forEachCorner(extent, callback) {\n let val;\n val = callback(getBottomLeft(extent));\n if (val) {\n return val;\n }\n val = callback(getBottomRight(extent));\n if (val) {\n return val;\n }\n val = callback(getTopRight(extent));\n if (val) {\n return val;\n }\n val = callback(getTopLeft(extent));\n if (val) {\n return val;\n }\n return false;\n}\n\n/**\n * Get the size of an extent.\n * @param {Extent} extent Extent.\n * @return {number} Area.\n * @api\n */\nexport function getArea(extent) {\n let area = 0;\n if (!isEmpty(extent)) {\n area = getWidth(extent) * getHeight(extent);\n }\n return area;\n}\n\n/**\n * Get the bottom left coordinate of an extent.\n * @param {Extent} extent Extent.\n * @return {import(\"./coordinate.js\").Coordinate} Bottom left coordinate.\n * @api\n */\nexport function getBottomLeft(extent) {\n return [extent[0], extent[1]];\n}\n\n/**\n * Get the bottom right coordinate of an extent.\n * @param {Extent} extent Extent.\n * @return {import(\"./coordinate.js\").Coordinate} Bottom right coordinate.\n * @api\n */\nexport function getBottomRight(extent) {\n return [extent[2], extent[1]];\n}\n\n/**\n * Get the center coordinate of an extent.\n * @param {Extent} extent Extent.\n * @return {import(\"./coordinate.js\").Coordinate} Center.\n * @api\n */\nexport function getCenter(extent) {\n return [(extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2];\n}\n\n/**\n * Get a corner coordinate of an extent.\n * @param {Extent} extent Extent.\n * @param {Corner} corner Corner.\n * @return {import(\"./coordinate.js\").Coordinate} Corner coordinate.\n */\nexport function getCorner(extent, corner) {\n let coordinate;\n if (corner === 'bottom-left') {\n coordinate = getBottomLeft(extent);\n } else if (corner === 'bottom-right') {\n coordinate = getBottomRight(extent);\n } else if (corner === 'top-left') {\n coordinate = getTopLeft(extent);\n } else if (corner === 'top-right') {\n coordinate = getTopRight(extent);\n } else {\n throw new Error('Invalid corner');\n }\n return coordinate;\n}\n\n/**\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @return {number} Enlarged area.\n */\nexport function getEnlargedArea(extent1, extent2) {\n const minX = Math.min(extent1[0], extent2[0]);\n const minY = Math.min(extent1[1], extent2[1]);\n const maxX = Math.max(extent1[2], extent2[2]);\n const maxY = Math.max(extent1[3], extent2[3]);\n return (maxX - minX) * (maxY - minY);\n}\n\n/**\n * @param {import(\"./coordinate.js\").Coordinate} center Center.\n * @param {number} resolution Resolution.\n * @param {number} rotation Rotation.\n * @param {import(\"./size.js\").Size} size Size.\n * @param {Extent} [dest] Destination extent.\n * @return {Extent} Extent.\n */\nexport function getForViewAndSize(center, resolution, rotation, size, dest) {\n const [x0, y0, x1, y1, x2, y2, x3, y3] = getRotatedViewport(\n center,\n resolution,\n rotation,\n size,\n );\n return createOrUpdate(\n Math.min(x0, x1, x2, x3),\n Math.min(y0, y1, y2, y3),\n Math.max(x0, x1, x2, x3),\n Math.max(y0, y1, y2, y3),\n dest,\n );\n}\n\n/**\n * @param {import(\"./coordinate.js\").Coordinate} center Center.\n * @param {number} resolution Resolution.\n * @param {number} rotation Rotation.\n * @param {import(\"./size.js\").Size} size Size.\n * @return {Array} Linear ring representing the viewport.\n */\nexport function getRotatedViewport(center, resolution, rotation, size) {\n const dx = (resolution * size[0]) / 2;\n const dy = (resolution * size[1]) / 2;\n const cosRotation = Math.cos(rotation);\n const sinRotation = Math.sin(rotation);\n const xCos = dx * cosRotation;\n const xSin = dx * sinRotation;\n const yCos = dy * cosRotation;\n const ySin = dy * sinRotation;\n const x = center[0];\n const y = center[1];\n return [\n x - xCos + ySin,\n y - xSin - yCos,\n x - xCos - ySin,\n y - xSin + yCos,\n x + xCos - ySin,\n y + xSin + yCos,\n x + xCos + ySin,\n y + xSin - yCos,\n x - xCos + ySin,\n y - xSin - yCos,\n ];\n}\n\n/**\n * Get the height of an extent.\n * @param {Extent} extent Extent.\n * @return {number} Height.\n * @api\n */\nexport function getHeight(extent) {\n return extent[3] - extent[1];\n}\n\n/**\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @return {number} Intersection area.\n */\nexport function getIntersectionArea(extent1, extent2) {\n const intersection = getIntersection(extent1, extent2);\n return getArea(intersection);\n}\n\n/**\n * Get the intersection of two extents.\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @param {Extent} [dest] Optional extent to populate with intersection.\n * @return {Extent} Intersecting extent.\n * @api\n */\nexport function getIntersection(extent1, extent2, dest) {\n const intersection = dest ? dest : createEmpty();\n if (intersects(extent1, extent2)) {\n if (extent1[0] > extent2[0]) {\n intersection[0] = extent1[0];\n } else {\n intersection[0] = extent2[0];\n }\n if (extent1[1] > extent2[1]) {\n intersection[1] = extent1[1];\n } else {\n intersection[1] = extent2[1];\n }\n if (extent1[2] < extent2[2]) {\n intersection[2] = extent1[2];\n } else {\n intersection[2] = extent2[2];\n }\n if (extent1[3] < extent2[3]) {\n intersection[3] = extent1[3];\n } else {\n intersection[3] = extent2[3];\n }\n } else {\n createOrUpdateEmpty(intersection);\n }\n return intersection;\n}\n\n/**\n * @param {Extent} extent Extent.\n * @return {number} Margin.\n */\nexport function getMargin(extent) {\n return getWidth(extent) + getHeight(extent);\n}\n\n/**\n * Get the size (width, height) of an extent.\n * @param {Extent} extent The extent.\n * @return {import(\"./size.js\").Size} The extent size.\n * @api\n */\nexport function getSize(extent) {\n return [extent[2] - extent[0], extent[3] - extent[1]];\n}\n\n/**\n * Get the top left coordinate of an extent.\n * @param {Extent} extent Extent.\n * @return {import(\"./coordinate.js\").Coordinate} Top left coordinate.\n * @api\n */\nexport function getTopLeft(extent) {\n return [extent[0], extent[3]];\n}\n\n/**\n * Get the top right coordinate of an extent.\n * @param {Extent} extent Extent.\n * @return {import(\"./coordinate.js\").Coordinate} Top right coordinate.\n * @api\n */\nexport function getTopRight(extent) {\n return [extent[2], extent[3]];\n}\n\n/**\n * Get the width of an extent.\n * @param {Extent} extent Extent.\n * @return {number} Width.\n * @api\n */\nexport function getWidth(extent) {\n return extent[2] - extent[0];\n}\n\n/**\n * Determine if one extent intersects another.\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent.\n * @return {boolean} The two extents intersect.\n * @api\n */\nexport function intersects(extent1, extent2) {\n return (\n extent1[0] <= extent2[2] &&\n extent1[2] >= extent2[0] &&\n extent1[1] <= extent2[3] &&\n extent1[3] >= extent2[1]\n );\n}\n\n/**\n * Determine if an extent is empty.\n * @param {Extent} extent Extent.\n * @return {boolean} Is empty.\n * @api\n */\nexport function isEmpty(extent) {\n return extent[2] < extent[0] || extent[3] < extent[1];\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {Extent} [dest] Extent.\n * @return {Extent} Extent.\n */\nexport function returnOrUpdate(extent, dest) {\n if (dest) {\n dest[0] = extent[0];\n dest[1] = extent[1];\n dest[2] = extent[2];\n dest[3] = extent[3];\n return dest;\n }\n return extent;\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {number} value Value.\n */\nexport function scaleFromCenter(extent, value) {\n const deltaX = ((extent[2] - extent[0]) / 2) * (value - 1);\n const deltaY = ((extent[3] - extent[1]) / 2) * (value - 1);\n extent[0] -= deltaX;\n extent[2] += deltaX;\n extent[1] -= deltaY;\n extent[3] += deltaY;\n}\n\n/**\n * Determine if the segment between two coordinates intersects (crosses,\n * touches, or is contained by) the provided extent.\n * @param {Extent} extent The extent.\n * @param {import(\"./coordinate.js\").Coordinate} start Segment start coordinate.\n * @param {import(\"./coordinate.js\").Coordinate} end Segment end coordinate.\n * @return {boolean} The segment intersects the extent.\n */\nexport function intersectsSegment(extent, start, end) {\n let intersects = false;\n const startRel = coordinateRelationship(extent, start);\n const endRel = coordinateRelationship(extent, end);\n if (\n startRel === Relationship.INTERSECTING ||\n endRel === Relationship.INTERSECTING\n ) {\n intersects = true;\n } else {\n const minX = extent[0];\n const minY = extent[1];\n const maxX = extent[2];\n const maxY = extent[3];\n const startX = start[0];\n const startY = start[1];\n const endX = end[0];\n const endY = end[1];\n const slope = (endY - startY) / (endX - startX);\n let x, y;\n if (!!(endRel & Relationship.ABOVE) && !(startRel & Relationship.ABOVE)) {\n // potentially intersects top\n x = endX - (endY - maxY) / slope;\n intersects = x >= minX && x <= maxX;\n }\n if (\n !intersects &&\n !!(endRel & Relationship.RIGHT) &&\n !(startRel & Relationship.RIGHT)\n ) {\n // potentially intersects right\n y = endY - (endX - maxX) * slope;\n intersects = y >= minY && y <= maxY;\n }\n if (\n !intersects &&\n !!(endRel & Relationship.BELOW) &&\n !(startRel & Relationship.BELOW)\n ) {\n // potentially intersects bottom\n x = endX - (endY - minY) / slope;\n intersects = x >= minX && x <= maxX;\n }\n if (\n !intersects &&\n !!(endRel & Relationship.LEFT) &&\n !(startRel & Relationship.LEFT)\n ) {\n // potentially intersects left\n y = endY - (endX - minX) * slope;\n intersects = y >= minY && y <= maxY;\n }\n }\n return intersects;\n}\n\n/**\n * Apply a transform function to the extent.\n * @param {Extent} extent Extent.\n * @param {import(\"./proj.js\").TransformFunction} transformFn Transform function.\n * Called with `[minX, minY, maxX, maxY]` extent coordinates.\n * @param {Extent} [dest] Destination extent.\n * @param {number} [stops] Number of stops per side used for the transform.\n * By default only the corners are used.\n * @return {Extent} Extent.\n * @api\n */\nexport function applyTransform(extent, transformFn, dest, stops) {\n if (isEmpty(extent)) {\n return createOrUpdateEmpty(dest);\n }\n let coordinates = [];\n if (stops > 1) {\n const width = extent[2] - extent[0];\n const height = extent[3] - extent[1];\n for (let i = 0; i < stops; ++i) {\n coordinates.push(\n extent[0] + (width * i) / stops,\n extent[1],\n extent[2],\n extent[1] + (height * i) / stops,\n extent[2] - (width * i) / stops,\n extent[3],\n extent[0],\n extent[3] - (height * i) / stops,\n );\n }\n } else {\n coordinates = [\n extent[0],\n extent[1],\n extent[2],\n extent[1],\n extent[2],\n extent[3],\n extent[0],\n extent[3],\n ];\n }\n transformFn(coordinates, coordinates, 2);\n const xs = [];\n const ys = [];\n for (let i = 0, l = coordinates.length; i < l; i += 2) {\n xs.push(coordinates[i]);\n ys.push(coordinates[i + 1]);\n }\n return _boundingExtentXYs(xs, ys, dest);\n}\n\n/**\n * Modifies the provided extent in-place to be within the real world\n * extent.\n *\n * @param {Extent} extent Extent.\n * @param {import(\"./proj/Projection.js\").default} projection Projection\n * @return {Extent} The extent within the real world extent.\n */\nexport function wrapX(extent, projection) {\n const projectionExtent = projection.getExtent();\n const center = getCenter(extent);\n if (\n projection.canWrapX() &&\n (center[0] < projectionExtent[0] || center[0] >= projectionExtent[2])\n ) {\n const worldWidth = getWidth(projectionExtent);\n const worldsAway = Math.floor(\n (center[0] - projectionExtent[0]) / worldWidth,\n );\n const offset = worldsAway * worldWidth;\n extent[0] -= offset;\n extent[2] -= offset;\n }\n return extent;\n}\n\n/**\n * Fits the extent to the real world\n *\n * If the extent does not cross the anti meridian, this will return the extent in an array\n * If the extent crosses the anti meridian, the extent will be sliced, so each part fits within the\n * real world\n *\n *\n * @param {Extent} extent Extent.\n * @param {import(\"./proj/Projection.js\").default} projection Projection\n * @param {boolean} [multiWorld] Return all worlds\n * @return {Array} The extent within the real world extent.\n */\nexport function wrapAndSliceX(extent, projection, multiWorld) {\n if (projection.canWrapX()) {\n const projectionExtent = projection.getExtent();\n\n if (!isFinite(extent[0]) || !isFinite(extent[2])) {\n return [[projectionExtent[0], extent[1], projectionExtent[2], extent[3]]];\n }\n\n wrapX(extent, projection);\n const worldWidth = getWidth(projectionExtent);\n\n if (getWidth(extent) > worldWidth && !multiWorld) {\n // the extent wraps around on itself\n return [[projectionExtent[0], extent[1], projectionExtent[2], extent[3]]];\n }\n if (extent[0] < projectionExtent[0]) {\n // the extent crosses the anti meridian, so it needs to be sliced\n return [\n [extent[0] + worldWidth, extent[1], projectionExtent[2], extent[3]],\n [projectionExtent[0], extent[1], extent[2], extent[3]],\n ];\n }\n if (extent[2] > projectionExtent[2]) {\n // the extent crosses the anti meridian, so it needs to be sliced\n return [\n [extent[0], extent[1], projectionExtent[2], extent[3]],\n [projectionExtent[0], extent[1], extent[2] - worldWidth, extent[3]],\n ];\n }\n }\n\n return [extent];\n}\n","/**\n * @module ol/math\n */\n\n/**\n * Takes a number and clamps it to within the provided bounds.\n * @param {number} value The input number.\n * @param {number} min The minimum value to return.\n * @param {number} max The maximum value to return.\n * @return {number} The input number if it is within bounds, or the nearest\n * number within the bounds.\n */\nexport function clamp(value, min, max) {\n return Math.min(Math.max(value, min), max);\n}\n\n/**\n * Returns the square of the closest distance between the point (x, y) and the\n * line segment (x1, y1) to (x2, y2).\n * @param {number} x X.\n * @param {number} y Y.\n * @param {number} x1 X1.\n * @param {number} y1 Y1.\n * @param {number} x2 X2.\n * @param {number} y2 Y2.\n * @return {number} Squared distance.\n */\nexport function squaredSegmentDistance(x, y, x1, y1, x2, y2) {\n const dx = x2 - x1;\n const dy = y2 - y1;\n if (dx !== 0 || dy !== 0) {\n const t = ((x - x1) * dx + (y - y1) * dy) / (dx * dx + dy * dy);\n if (t > 1) {\n x1 = x2;\n y1 = y2;\n } else if (t > 0) {\n x1 += dx * t;\n y1 += dy * t;\n }\n }\n return squaredDistance(x, y, x1, y1);\n}\n\n/**\n * Returns the square of the distance between the points (x1, y1) and (x2, y2).\n * @param {number} x1 X1.\n * @param {number} y1 Y1.\n * @param {number} x2 X2.\n * @param {number} y2 Y2.\n * @return {number} Squared distance.\n */\nexport function squaredDistance(x1, y1, x2, y2) {\n const dx = x2 - x1;\n const dy = y2 - y1;\n return dx * dx + dy * dy;\n}\n\n/**\n * Solves system of linear equations using Gaussian elimination method.\n *\n * @param {Array>} mat Augmented matrix (n x n + 1 column)\n * in row-major order.\n * @return {Array|null} The resulting vector.\n */\nexport function solveLinearSystem(mat) {\n const n = mat.length;\n\n for (let i = 0; i < n; i++) {\n // Find max in the i-th column (ignoring i - 1 first rows)\n let maxRow = i;\n let maxEl = Math.abs(mat[i][i]);\n for (let r = i + 1; r < n; r++) {\n const absValue = Math.abs(mat[r][i]);\n if (absValue > maxEl) {\n maxEl = absValue;\n maxRow = r;\n }\n }\n\n if (maxEl === 0) {\n return null; // matrix is singular\n }\n\n // Swap max row with i-th (current) row\n const tmp = mat[maxRow];\n mat[maxRow] = mat[i];\n mat[i] = tmp;\n\n // Subtract the i-th row to make all the remaining rows 0 in the i-th column\n for (let j = i + 1; j < n; j++) {\n const coef = -mat[j][i] / mat[i][i];\n for (let k = i; k < n + 1; k++) {\n if (i == k) {\n mat[j][k] = 0;\n } else {\n mat[j][k] += coef * mat[i][k];\n }\n }\n }\n }\n\n // Solve Ax=b for upper triangular matrix A (mat)\n const x = new Array(n);\n for (let l = n - 1; l >= 0; l--) {\n x[l] = mat[l][n] / mat[l][l];\n for (let m = l - 1; m >= 0; m--) {\n mat[m][n] -= mat[m][l] * x[l];\n }\n }\n return x;\n}\n\n/**\n * Converts radians to to degrees.\n *\n * @param {number} angleInRadians Angle in radians.\n * @return {number} Angle in degrees.\n */\nexport function toDegrees(angleInRadians) {\n return (angleInRadians * 180) / Math.PI;\n}\n\n/**\n * Converts degrees to radians.\n *\n * @param {number} angleInDegrees Angle in degrees.\n * @return {number} Angle in radians.\n */\nexport function toRadians(angleInDegrees) {\n return (angleInDegrees * Math.PI) / 180;\n}\n\n/**\n * Returns the modulo of a / b, depending on the sign of b.\n *\n * @param {number} a Dividend.\n * @param {number} b Divisor.\n * @return {number} Modulo.\n */\nexport function modulo(a, b) {\n const r = a % b;\n return r * b < 0 ? r + b : r;\n}\n\n/**\n * Calculates the linearly interpolated value of x between a and b.\n *\n * @param {number} a Number\n * @param {number} b Number\n * @param {number} x Value to be interpolated.\n * @return {number} Interpolated value.\n */\nexport function lerp(a, b, x) {\n return a + x * (b - a);\n}\n\n/**\n * Returns a number with a limited number of decimal digits.\n * @param {number} n The input number.\n * @param {number} decimals The maximum number of decimal digits.\n * @return {number} The input number with a limited number of decimal digits.\n */\nexport function toFixed(n, decimals) {\n const factor = Math.pow(10, decimals);\n return Math.round(n * factor) / factor;\n}\n\n/**\n * Rounds a number to the nearest integer value considering only the given number\n * of decimal digits (with rounding on the final digit).\n * @param {number} n The input number.\n * @param {number} decimals The maximum number of decimal digits.\n * @return {number} The nearest integer.\n */\nexport function round(n, decimals) {\n return Math.round(toFixed(n, decimals));\n}\n\n/**\n * Rounds a number to the next smaller integer considering only the given number\n * of decimal digits (with rounding on the final digit).\n * @param {number} n The input number.\n * @param {number} decimals The maximum number of decimal digits.\n * @return {number} The next smaller integer.\n */\nexport function floor(n, decimals) {\n return Math.floor(toFixed(n, decimals));\n}\n\n/**\n * Rounds a number to the next bigger integer considering only the given number\n * of decimal digits (with rounding on the final digit).\n * @param {number} n The input number.\n * @param {number} decimals The maximum number of decimal digits.\n * @return {number} The next bigger integer.\n */\nexport function ceil(n, decimals) {\n return Math.ceil(toFixed(n, decimals));\n}\n\n/**\n * Wraps a number between some minimum and maximum values.\n * @param {number} n The number to wrap.\n * @param {number} min The minimum of the range (inclusive).\n * @param {number} max The maximum of the range (exclusive).\n * @return {number} The wrapped number.\n */\nexport function wrap(n, min, max) {\n if (n >= min && n < max) {\n return n;\n }\n const range = max - min;\n return ((((n - min) % range) + range) % range) + min;\n}\n","/**\n * @module ol/sphere\n */\nimport {toDegrees, toRadians} from './math.js';\n\n/**\n * Object literal with options for the {@link getLength} or {@link getArea}\n * functions.\n * @typedef {Object} SphereMetricOptions\n * @property {import(\"./proj.js\").ProjectionLike} [projection='EPSG:3857']\n * Projection of the geometry. By default, the geometry is assumed to be in\n * Web Mercator.\n * @property {number} [radius=6371008.8] Sphere radius. By default, the\n * [mean Earth radius](https://en.wikipedia.org/wiki/Earth_radius#Mean_radius)\n * for the WGS84 ellipsoid is used.\n */\n\n/**\n * The mean Earth radius (1/3 * (2a + b)) for the WGS84 ellipsoid.\n * https://en.wikipedia.org/wiki/Earth_radius#Mean_radius\n * @type {number}\n */\nexport const DEFAULT_RADIUS = 6371008.8;\n\n/**\n * Get the great circle distance (in meters) between two geographic coordinates.\n * @param {Array} c1 Starting coordinate.\n * @param {Array} c2 Ending coordinate.\n * @param {number} [radius] The sphere radius to use. Defaults to the Earth's\n * mean radius using the WGS84 ellipsoid.\n * @return {number} The great circle distance between the points (in meters).\n * @api\n */\nexport function getDistance(c1, c2, radius) {\n radius = radius || DEFAULT_RADIUS;\n const lat1 = toRadians(c1[1]);\n const lat2 = toRadians(c2[1]);\n const deltaLatBy2 = (lat2 - lat1) / 2;\n const deltaLonBy2 = toRadians(c2[0] - c1[0]) / 2;\n const a =\n Math.sin(deltaLatBy2) * Math.sin(deltaLatBy2) +\n Math.sin(deltaLonBy2) *\n Math.sin(deltaLonBy2) *\n Math.cos(lat1) *\n Math.cos(lat2);\n return 2 * radius * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n}\n\n/**\n * Get the cumulative great circle length of linestring coordinates (geographic).\n * @param {Array} coordinates Linestring coordinates.\n * @param {number} radius The sphere radius to use.\n * @return {number} The length (in meters).\n */\nfunction getLengthInternal(coordinates, radius) {\n let length = 0;\n for (let i = 0, ii = coordinates.length; i < ii - 1; ++i) {\n length += getDistance(coordinates[i], coordinates[i + 1], radius);\n }\n return length;\n}\n\n/**\n * Get the spherical length of a geometry. This length is the sum of the\n * great circle distances between coordinates. For polygons, the length is\n * the sum of all rings. For points, the length is zero. For multi-part\n * geometries, the length is the sum of the length of each part.\n * @param {import(\"./geom/Geometry.js\").default} geometry A geometry.\n * @param {SphereMetricOptions} [options] Options for the\n * length calculation. By default, geometries are assumed to be in 'EPSG:3857'.\n * You can change this by providing a `projection` option.\n * @return {number} The spherical length (in meters).\n * @api\n */\nexport function getLength(geometry, options) {\n options = options || {};\n const radius = options.radius || DEFAULT_RADIUS;\n const projection = options.projection || 'EPSG:3857';\n const type = geometry.getType();\n if (type !== 'GeometryCollection') {\n geometry = geometry.clone().transform(projection, 'EPSG:4326');\n }\n let length = 0;\n let coordinates, coords, i, ii, j, jj;\n switch (type) {\n case 'Point':\n case 'MultiPoint': {\n break;\n }\n case 'LineString':\n case 'LinearRing': {\n coordinates = /** @type {import(\"./geom/SimpleGeometry.js\").default} */ (\n geometry\n ).getCoordinates();\n length = getLengthInternal(coordinates, radius);\n break;\n }\n case 'MultiLineString':\n case 'Polygon': {\n coordinates = /** @type {import(\"./geom/SimpleGeometry.js\").default} */ (\n geometry\n ).getCoordinates();\n for (i = 0, ii = coordinates.length; i < ii; ++i) {\n length += getLengthInternal(coordinates[i], radius);\n }\n break;\n }\n case 'MultiPolygon': {\n coordinates = /** @type {import(\"./geom/SimpleGeometry.js\").default} */ (\n geometry\n ).getCoordinates();\n for (i = 0, ii = coordinates.length; i < ii; ++i) {\n coords = coordinates[i];\n for (j = 0, jj = coords.length; j < jj; ++j) {\n length += getLengthInternal(coords[j], radius);\n }\n }\n break;\n }\n case 'GeometryCollection': {\n const geometries =\n /** @type {import(\"./geom/GeometryCollection.js\").default} */ (\n geometry\n ).getGeometries();\n for (i = 0, ii = geometries.length; i < ii; ++i) {\n length += getLength(geometries[i], options);\n }\n break;\n }\n default: {\n throw new Error('Unsupported geometry type: ' + type);\n }\n }\n return length;\n}\n\n/**\n * Returns the spherical area for a list of coordinates.\n *\n * [Reference](https://trs.jpl.nasa.gov/handle/2014/40409)\n * Robert. G. Chamberlain and William H. Duquette, \"Some Algorithms for\n * Polygons on a Sphere\", JPL Publication 07-03, Jet Propulsion\n * Laboratory, Pasadena, CA, June 2007\n *\n * @param {Array} coordinates List of coordinates of a linear\n * ring. If the ring is oriented clockwise, the area will be positive,\n * otherwise it will be negative.\n * @param {number} radius The sphere radius.\n * @return {number} Area (in square meters).\n */\nfunction getAreaInternal(coordinates, radius) {\n let area = 0;\n const len = coordinates.length;\n let x1 = coordinates[len - 1][0];\n let y1 = coordinates[len - 1][1];\n for (let i = 0; i < len; i++) {\n const x2 = coordinates[i][0];\n const y2 = coordinates[i][1];\n area +=\n toRadians(x2 - x1) *\n (2 + Math.sin(toRadians(y1)) + Math.sin(toRadians(y2)));\n x1 = x2;\n y1 = y2;\n }\n return (area * radius * radius) / 2.0;\n}\n\n/**\n * Get the spherical area of a geometry. This is the area (in meters) assuming\n * that polygon edges are segments of great circles on a sphere.\n * @param {import(\"./geom/Geometry.js\").default} geometry A geometry.\n * @param {SphereMetricOptions} [options] Options for the area\n * calculation. By default, geometries are assumed to be in 'EPSG:3857'.\n * You can change this by providing a `projection` option.\n * @return {number} The spherical area (in square meters).\n * @api\n */\nexport function getArea(geometry, options) {\n options = options || {};\n const radius = options.radius || DEFAULT_RADIUS;\n const projection = options.projection || 'EPSG:3857';\n const type = geometry.getType();\n if (type !== 'GeometryCollection') {\n geometry = geometry.clone().transform(projection, 'EPSG:4326');\n }\n let area = 0;\n let coordinates, coords, i, ii, j, jj;\n switch (type) {\n case 'Point':\n case 'MultiPoint':\n case 'LineString':\n case 'MultiLineString':\n case 'LinearRing': {\n break;\n }\n case 'Polygon': {\n coordinates = /** @type {import(\"./geom/Polygon.js\").default} */ (\n geometry\n ).getCoordinates();\n area = Math.abs(getAreaInternal(coordinates[0], radius));\n for (i = 1, ii = coordinates.length; i < ii; ++i) {\n area -= Math.abs(getAreaInternal(coordinates[i], radius));\n }\n break;\n }\n case 'MultiPolygon': {\n coordinates = /** @type {import(\"./geom/SimpleGeometry.js\").default} */ (\n geometry\n ).getCoordinates();\n for (i = 0, ii = coordinates.length; i < ii; ++i) {\n coords = coordinates[i];\n area += Math.abs(getAreaInternal(coords[0], radius));\n for (j = 1, jj = coords.length; j < jj; ++j) {\n area -= Math.abs(getAreaInternal(coords[j], radius));\n }\n }\n break;\n }\n case 'GeometryCollection': {\n const geometries =\n /** @type {import(\"./geom/GeometryCollection.js\").default} */ (\n geometry\n ).getGeometries();\n for (i = 0, ii = geometries.length; i < ii; ++i) {\n area += getArea(geometries[i], options);\n }\n break;\n }\n default: {\n throw new Error('Unsupported geometry type: ' + type);\n }\n }\n return area;\n}\n\n/**\n * Returns the coordinate at the given distance and bearing from `c1`.\n *\n * @param {import(\"./coordinate.js\").Coordinate} c1 The origin point (`[lon, lat]` in degrees).\n * @param {number} distance The great-circle distance between the origin\n * point and the target point.\n * @param {number} bearing The bearing (in radians).\n * @param {number} [radius] The sphere radius to use. Defaults to the Earth's\n * mean radius using the WGS84 ellipsoid.\n * @return {import(\"./coordinate.js\").Coordinate} The target point.\n */\nexport function offset(c1, distance, bearing, radius) {\n radius = radius || DEFAULT_RADIUS;\n const lat1 = toRadians(c1[1]);\n const lon1 = toRadians(c1[0]);\n const dByR = distance / radius;\n const lat = Math.asin(\n Math.sin(lat1) * Math.cos(dByR) +\n Math.cos(lat1) * Math.sin(dByR) * Math.cos(bearing),\n );\n const lon =\n lon1 +\n Math.atan2(\n Math.sin(bearing) * Math.sin(dByR) * Math.cos(lat1),\n Math.cos(dByR) - Math.sin(lat1) * Math.sin(lat),\n );\n return [toDegrees(lon), toDegrees(lat)];\n}\n","/**\n * @module ol/console\n */\n\n/**\n * @typedef {'info'|'warn'|'error'|'none'} Level\n */\n\n/**\n * @type {Object}\n */\nconst levels = {\n info: 1,\n warn: 2,\n error: 3,\n none: 4,\n};\n\n/**\n * @type {number}\n */\nlet level = levels.info;\n\n/**\n * Set the logging level. By default, the level is set to 'info' and all\n * messages will be logged. Set to 'warn' to only display warnings and errors.\n * Set to 'error' to only display errors. Set to 'none' to silence all messages.\n *\n * @param {Level} l The new level.\n */\nexport function setLevel(l) {\n level = levels[l];\n}\n\n/**\n * @param {...any} args Arguments to log\n */\nexport function log(...args) {\n if (level > levels.info) {\n return;\n }\n console.log(...args); // eslint-disable-line no-console\n}\n\n/**\n * @param {...any} args Arguments to log\n */\nexport function warn(...args) {\n if (level > levels.warn) {\n return;\n }\n console.warn(...args); // eslint-disable-line no-console\n}\n\n/**\n * @param {...any} args Arguments to log\n */\nexport function error(...args) {\n if (level > levels.error) {\n return;\n }\n console.error(...args); // eslint-disable-line no-console\n}\n","/**\n * @module ol/string\n */\n\n/**\n * @param {number} number Number to be formatted\n * @param {number} width The desired width\n * @param {number} [precision] Precision of the output string (i.e. number of decimal places)\n * @return {string} Formatted string\n */\nexport function padNumber(number, width, precision) {\n const numberString =\n precision !== undefined ? number.toFixed(precision) : '' + number;\n let decimal = numberString.indexOf('.');\n decimal = decimal === -1 ? numberString.length : decimal;\n return decimal > width\n ? numberString\n : new Array(1 + width - decimal).join('0') + numberString;\n}\n\n/**\n * Adapted from https://github.com/omichelsen/compare-versions/blob/master/index.js\n * @param {string|number} v1 First version\n * @param {string|number} v2 Second version\n * @return {number} Value\n */\nexport function compareVersions(v1, v2) {\n const s1 = ('' + v1).split('.');\n const s2 = ('' + v2).split('.');\n\n for (let i = 0; i < Math.max(s1.length, s2.length); i++) {\n const n1 = parseInt(s1[i] || '0', 10);\n const n2 = parseInt(s2[i] || '0', 10);\n\n if (n1 > n2) {\n return 1;\n }\n if (n2 > n1) {\n return -1;\n }\n }\n\n return 0;\n}\n","/**\n * @module ol/coordinate\n */\nimport {getWidth} from './extent.js';\nimport {clamp, modulo, toFixed} from './math.js';\nimport {padNumber} from './string.js';\n\n/**\n * An array of numbers representing an `xy`, `xyz` or `xyzm` coordinate.\n * Example: `[16, 48]`.\n * @typedef {Array} Coordinate\n * @api\n */\n\n/**\n * A function that takes a {@link module:ol/coordinate~Coordinate} and\n * transforms it into a `{string}`.\n *\n * @typedef {function((Coordinate|undefined)): string} CoordinateFormat\n * @api\n */\n\n/**\n * Add `delta` to `coordinate`. `coordinate` is modified in place and returned\n * by the function.\n *\n * Example:\n *\n * import {add} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * add(coord, [-2, 4]);\n * // coord is now [5.85, 51.983333]\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {Coordinate} delta Delta.\n * @return {Coordinate} The input coordinate adjusted by\n * the given delta.\n * @api\n */\nexport function add(coordinate, delta) {\n coordinate[0] += +delta[0];\n coordinate[1] += +delta[1];\n return coordinate;\n}\n\n/**\n * Calculates the point closest to the passed coordinate on the passed circle.\n *\n * @param {Coordinate} coordinate The coordinate.\n * @param {import(\"./geom/Circle.js\").default} circle The circle.\n * @return {Coordinate} Closest point on the circumference.\n */\nexport function closestOnCircle(coordinate, circle) {\n const r = circle.getRadius();\n const center = circle.getCenter();\n const x0 = center[0];\n const y0 = center[1];\n const x1 = coordinate[0];\n const y1 = coordinate[1];\n\n let dx = x1 - x0;\n const dy = y1 - y0;\n if (dx === 0 && dy === 0) {\n dx = 1;\n }\n const d = Math.sqrt(dx * dx + dy * dy);\n\n const x = x0 + (r * dx) / d;\n const y = y0 + (r * dy) / d;\n\n return [x, y];\n}\n\n/**\n * Calculates the point closest to the passed coordinate on the passed segment.\n * This is the foot of the perpendicular of the coordinate to the segment when\n * the foot is on the segment, or the closest segment coordinate when the foot\n * is outside the segment.\n *\n * @param {Coordinate} coordinate The coordinate.\n * @param {Array} segment The two coordinates\n * of the segment.\n * @return {Coordinate} The foot of the perpendicular of\n * the coordinate to the segment.\n */\nexport function closestOnSegment(coordinate, segment) {\n const x0 = coordinate[0];\n const y0 = coordinate[1];\n const start = segment[0];\n const end = segment[1];\n const x1 = start[0];\n const y1 = start[1];\n const x2 = end[0];\n const y2 = end[1];\n const dx = x2 - x1;\n const dy = y2 - y1;\n const along =\n dx === 0 && dy === 0\n ? 0\n : (dx * (x0 - x1) + dy * (y0 - y1)) / (dx * dx + dy * dy || 0);\n let x, y;\n if (along <= 0) {\n x = x1;\n y = y1;\n } else if (along >= 1) {\n x = x2;\n y = y2;\n } else {\n x = x1 + along * dx;\n y = y1 + along * dy;\n }\n return [x, y];\n}\n\n/**\n * Returns a {@link module:ol/coordinate~CoordinateFormat} function that can be\n * used to format\n * a {Coordinate} to a string.\n *\n * Example without specifying the fractional digits:\n *\n * import {createStringXY} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const stringifyFunc = createStringXY();\n * const out = stringifyFunc(coord);\n * // out is now '8, 48'\n *\n * Example with explicitly specifying 2 fractional digits:\n *\n * import {createStringXY} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const stringifyFunc = createStringXY(2);\n * const out = stringifyFunc(coord);\n * // out is now '7.85, 47.98'\n *\n * @param {number} [fractionDigits] The number of digits to include\n * after the decimal point. Default is `0`.\n * @return {CoordinateFormat} Coordinate format.\n * @api\n */\nexport function createStringXY(fractionDigits) {\n return (\n /**\n * @param {Coordinate} coordinate Coordinate.\n * @return {string} String XY.\n */\n function (coordinate) {\n return toStringXY(coordinate, fractionDigits);\n }\n );\n}\n\n/**\n * @param {string} hemispheres Hemispheres.\n * @param {number} degrees Degrees.\n * @param {number} [fractionDigits] The number of digits to include\n * after the decimal point. Default is `0`.\n * @return {string} String.\n */\nexport function degreesToStringHDMS(hemispheres, degrees, fractionDigits) {\n const normalizedDegrees = modulo(degrees + 180, 360) - 180;\n const x = Math.abs(3600 * normalizedDegrees);\n const decimals = fractionDigits || 0;\n\n let deg = Math.floor(x / 3600);\n let min = Math.floor((x - deg * 3600) / 60);\n let sec = toFixed(x - deg * 3600 - min * 60, decimals);\n\n if (sec >= 60) {\n sec = 0;\n min += 1;\n }\n\n if (min >= 60) {\n min = 0;\n deg += 1;\n }\n\n let hdms = deg + '\\u00b0';\n if (min !== 0 || sec !== 0) {\n hdms += ' ' + padNumber(min, 2) + '\\u2032';\n }\n if (sec !== 0) {\n hdms += ' ' + padNumber(sec, 2, decimals) + '\\u2033';\n }\n if (normalizedDegrees !== 0) {\n hdms += ' ' + hemispheres.charAt(normalizedDegrees < 0 ? 1 : 0);\n }\n\n return hdms;\n}\n\n/**\n * Transforms the given {@link module:ol/coordinate~Coordinate} to a string\n * using the given string template. The strings `{x}` and `{y}` in the template\n * will be replaced with the first and second coordinate values respectively.\n *\n * Example without specifying the fractional digits:\n *\n * import {format} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const template = 'Coordinate is ({x}|{y}).';\n * const out = format(coord, template);\n * // out is now 'Coordinate is (8|48).'\n *\n * Example explicitly specifying the fractional digits:\n *\n * import {format} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const template = 'Coordinate is ({x}|{y}).';\n * const out = format(coord, template, 2);\n * // out is now 'Coordinate is (7.85|47.98).'\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {string} template A template string with `{x}` and `{y}` placeholders\n * that will be replaced by first and second coordinate values.\n * @param {number} [fractionDigits] The number of digits to include\n * after the decimal point. Default is `0`.\n * @return {string} Formatted coordinate.\n * @api\n */\nexport function format(coordinate, template, fractionDigits) {\n if (coordinate) {\n return template\n .replace('{x}', coordinate[0].toFixed(fractionDigits))\n .replace('{y}', coordinate[1].toFixed(fractionDigits));\n }\n return '';\n}\n\n/**\n * @param {Coordinate} coordinate1 First coordinate.\n * @param {Coordinate} coordinate2 Second coordinate.\n * @return {boolean} The two coordinates are equal.\n */\nexport function equals(coordinate1, coordinate2) {\n let equals = true;\n for (let i = coordinate1.length - 1; i >= 0; --i) {\n if (coordinate1[i] != coordinate2[i]) {\n equals = false;\n break;\n }\n }\n return equals;\n}\n\n/**\n * Rotate `coordinate` by `angle`. `coordinate` is modified in place and\n * returned by the function.\n *\n * Example:\n *\n * import {rotate} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const rotateRadians = Math.PI / 2; // 90 degrees\n * rotate(coord, rotateRadians);\n * // coord is now [-47.983333, 7.85]\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {number} angle Angle in radian.\n * @return {Coordinate} Coordinate.\n * @api\n */\nexport function rotate(coordinate, angle) {\n const cosAngle = Math.cos(angle);\n const sinAngle = Math.sin(angle);\n const x = coordinate[0] * cosAngle - coordinate[1] * sinAngle;\n const y = coordinate[1] * cosAngle + coordinate[0] * sinAngle;\n coordinate[0] = x;\n coordinate[1] = y;\n return coordinate;\n}\n\n/**\n * Scale `coordinate` by `scale`. `coordinate` is modified in place and returned\n * by the function.\n *\n * Example:\n *\n * import {scale as scaleCoordinate} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const scale = 1.2;\n * scaleCoordinate(coord, scale);\n * // coord is now [9.42, 57.5799996]\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {number} scale Scale factor.\n * @return {Coordinate} Coordinate.\n */\nexport function scale(coordinate, scale) {\n coordinate[0] *= scale;\n coordinate[1] *= scale;\n return coordinate;\n}\n\n/**\n * @param {Coordinate} coord1 First coordinate.\n * @param {Coordinate} coord2 Second coordinate.\n * @return {number} Squared distance between coord1 and coord2.\n */\nexport function squaredDistance(coord1, coord2) {\n const dx = coord1[0] - coord2[0];\n const dy = coord1[1] - coord2[1];\n return dx * dx + dy * dy;\n}\n\n/**\n * @param {Coordinate} coord1 First coordinate.\n * @param {Coordinate} coord2 Second coordinate.\n * @return {number} Distance between coord1 and coord2.\n */\nexport function distance(coord1, coord2) {\n return Math.sqrt(squaredDistance(coord1, coord2));\n}\n\n/**\n * Calculate the squared distance from a coordinate to a line segment.\n *\n * @param {Coordinate} coordinate Coordinate of the point.\n * @param {Array} segment Line segment (2\n * coordinates).\n * @return {number} Squared distance from the point to the line segment.\n */\nexport function squaredDistanceToSegment(coordinate, segment) {\n return squaredDistance(coordinate, closestOnSegment(coordinate, segment));\n}\n\n/**\n * Format a geographic coordinate with the hemisphere, degrees, minutes, and\n * seconds.\n *\n * Example without specifying fractional digits:\n *\n * import {toStringHDMS} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const out = toStringHDMS(coord);\n * // out is now '47° 58′ 60″ N 7° 50′ 60″ E'\n *\n * Example explicitly specifying 1 fractional digit:\n *\n * import {toStringHDMS} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const out = toStringHDMS(coord, 1);\n * // out is now '47° 58′ 60.0″ N 7° 50′ 60.0″ E'\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {number} [fractionDigits] The number of digits to include\n * after the decimal point. Default is `0`.\n * @return {string} Hemisphere, degrees, minutes and seconds.\n * @api\n */\nexport function toStringHDMS(coordinate, fractionDigits) {\n if (coordinate) {\n return (\n degreesToStringHDMS('NS', coordinate[1], fractionDigits) +\n ' ' +\n degreesToStringHDMS('EW', coordinate[0], fractionDigits)\n );\n }\n return '';\n}\n\n/**\n * Format a coordinate as a comma delimited string.\n *\n * Example without specifying fractional digits:\n *\n * import {toStringXY} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const out = toStringXY(coord);\n * // out is now '8, 48'\n *\n * Example explicitly specifying 1 fractional digit:\n *\n * import {toStringXY} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const out = toStringXY(coord, 1);\n * // out is now '7.8, 48.0'\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {number} [fractionDigits] The number of digits to include\n * after the decimal point. Default is `0`.\n * @return {string} XY.\n * @api\n */\nexport function toStringXY(coordinate, fractionDigits) {\n return format(coordinate, '{x}, {y}', fractionDigits);\n}\n\n/**\n * Modifies the provided coordinate in-place to be within the real world\n * extent. The lower projection extent boundary is inclusive, the upper one\n * exclusive.\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {import(\"./proj/Projection.js\").default} projection Projection.\n * @return {Coordinate} The coordinate within the real world extent.\n */\nexport function wrapX(coordinate, projection) {\n if (projection.canWrapX()) {\n const worldWidth = getWidth(projection.getExtent());\n const worldsAway = getWorldsAway(coordinate, projection, worldWidth);\n if (worldsAway) {\n coordinate[0] -= worldsAway * worldWidth;\n }\n }\n return coordinate;\n}\n/**\n * @param {Coordinate} coordinate Coordinate.\n * @param {import(\"./proj/Projection.js\").default} projection Projection.\n * @param {number} [sourceExtentWidth] Width of the source extent.\n * @return {number} Offset in world widths.\n */\nexport function getWorldsAway(coordinate, projection, sourceExtentWidth) {\n const projectionExtent = projection.getExtent();\n let worldsAway = 0;\n if (\n projection.canWrapX() &&\n (coordinate[0] < projectionExtent[0] || coordinate[0] > projectionExtent[2])\n ) {\n sourceExtentWidth = sourceExtentWidth || getWidth(projectionExtent);\n worldsAway = Math.floor(\n (coordinate[0] - projectionExtent[0]) / sourceExtentWidth,\n );\n }\n return worldsAway;\n}\n\n/**\n * Compute the angle between p0pA and p0pB\n * @param {Coordinate} p0 Point 0\n * @param {Coordinate} pA Point A\n * @param {Coordinate} pB Point B\n * @return {number} a value in [0, 2PI]\n */\nexport function angleBetween(p0, pA, pB) {\n const lenA = Math.sqrt(\n (pA[0] - p0[0]) * (pA[0] - p0[0]) + (pA[1] - p0[1]) * (pA[1] - p0[1]),\n );\n const tangentA = [(pA[0] - p0[0]) / lenA, (pA[1] - p0[1]) / lenA];\n const orthoA = [-tangentA[1], tangentA[0]];\n const lenB = Math.sqrt(\n (pB[0] - p0[0]) * (pB[0] - p0[0]) + (pB[1] - p0[1]) * (pB[1] - p0[1]),\n );\n const tangentB = [(pB[0] - p0[0]) / lenB, (pB[1] - p0[1]) / lenB];\n\n // this angle can be clockwise or anticlockwise; hence the computation afterwards\n let angle =\n lenA === 0 || lenB === 0\n ? 0\n : Math.acos(\n clamp(tangentB[0] * tangentA[0] + tangentB[1] * tangentA[1], -1, 1),\n );\n angle = Math.max(angle, 0.00001); // avoid a zero angle otherwise this is detected as a line cap\n const isClockwise = tangentB[0] * orthoA[0] + tangentB[1] * orthoA[1] > 0;\n return !isClockwise ? Math.PI * 2 - angle : angle;\n}\n","/**\n * @module ol/proj/Units\n */\n\n/**\n * @typedef {'radians' | 'degrees' | 'ft' | 'm' | 'pixels' | 'tile-pixels' | 'us-ft'} Units\n * Projection units.\n */\n\n/**\n * See http://duff.ess.washington.edu/data/raster/drg/docs/geotiff.txt\n * @type {Object}\n */\nconst unitByCode = {\n '9001': 'm',\n '9002': 'ft',\n '9003': 'us-ft',\n '9101': 'radians',\n '9102': 'degrees',\n};\n\n/**\n * @param {number} code Unit code.\n * @return {Units} Units.\n */\nexport function fromCode(code) {\n return unitByCode[code];\n}\n\n/**\n * @typedef {Object} MetersPerUnitLookup\n * @property {number} radians Radians\n * @property {number} degrees Degrees\n * @property {number} ft Feet\n * @property {number} m Meters\n * @property {number} us-ft US feet\n */\n\n/**\n * Meters per unit lookup table.\n * @const\n * @type {MetersPerUnitLookup}\n * @api\n */\nexport const METERS_PER_UNIT = {\n // use the radius of the Normal sphere\n 'radians': 6370997 / (2 * Math.PI),\n 'degrees': (2 * Math.PI * 6370997) / 360,\n 'ft': 0.3048,\n 'm': 1,\n 'us-ft': 1200 / 3937,\n};\n","/**\n * @module ol/proj/Projection\n */\nimport {METERS_PER_UNIT} from './Units.js';\n\n/**\n * The function is called with a `number` view resolution and a\n * {@link module:ol/coordinate~Coordinate} as arguments, and returns the `number` resolution\n * in projection units at the passed coordinate.\n * @typedef {function(number, import(\"../coordinate.js\").Coordinate):number} GetPointResolution\n * @api\n */\n\n/**\n * @typedef {Object} Options\n * @property {string} code The SRS identifier code, e.g. `EPSG:4326`.\n * @property {import(\"./Units.js\").Units} [units] Units. Required unless a\n * proj4 projection is defined for `code`.\n * @property {import(\"../extent.js\").Extent} [extent] The validity extent for the SRS.\n * @property {string} [axisOrientation='enu'] The axis orientation as specified in Proj4.\n * @property {boolean} [global=false] Whether the projection is valid for the whole globe.\n * @property {number} [metersPerUnit] The meters per unit for the SRS.\n * If not provided, the `units` are used to get the meters per unit from the {@link METERS_PER_UNIT}\n * lookup table.\n * @property {import(\"../extent.js\").Extent} [worldExtent] The world extent for the SRS.\n * @property {GetPointResolution} [getPointResolution]\n * Function to determine resolution at a point. The function is called with a\n * `number` view resolution and a {@link module:ol/coordinate~Coordinate} as arguments, and returns\n * the `number` resolution in projection units at the passed coordinate. If this is `undefined`,\n * the default {@link module:ol/proj.getPointResolution} function will be used.\n */\n\n/**\n * @classdesc\n * In most cases, you should not need to create instances of this class.\n * Instead, where projection information is required, you can use a string\n * projection code or identifier (e.g. `EPSG:4326`) instead of a projection\n * instance.\n *\n * The library includes support for transforming coordinates between the following\n * projections:\n *\n * WGS 84 / Geographic - Using codes `EPSG:4326`, `CRS:84`, `urn:ogc:def:crs:EPSG:6.6:4326`,\n * `urn:ogc:def:crs:OGC:1.3:CRS84`, `urn:ogc:def:crs:OGC:2:84`, `http://www.opengis.net/gml/srs/epsg.xml#4326`,\n * or `urn:x-ogc:def:crs:EPSG:4326`\n * WGS 84 / Spherical Mercator - Using codes `EPSG:3857`, `EPSG:102100`, `EPSG:102113`, `EPSG:900913`,\n * `urn:ogc:def:crs:EPSG:6.18:3:3857`, or `http://www.opengis.net/gml/srs/epsg.xml#3857`\n * WGS 84 / UTM zones - Using codes `EPSG:32601` through `EPSG:32660` for northern zones\n * and `EPSG:32701` through `EPSG:32760` for southern zones. Note that the built-in UTM transforms\n * are lower accuracy (with errors on the order of 0.1 m) than those that you might get in a\n * library like [proj4js](https://github.com/proj4js/proj4js).\n *\n * For additional projection support, or to use higher accuracy transforms than the built-in ones, you can use\n * the [proj4js](https://github.com/proj4js/proj4js) library. With `proj4js`, after adding any new projection\n * definitions, call the {@link module:ol/proj/proj4.register} function.\n *\n * You can use the {@link module:ol/proj.get} function to retrieve a projection instance\n * for one of the registered projections.\n *\n * @api\n */\nclass Projection {\n /**\n * @param {Options} options Projection options.\n */\n constructor(options) {\n /**\n * @private\n * @type {string}\n */\n this.code_ = options.code;\n\n /**\n * Units of projected coordinates. When set to `TILE_PIXELS`, a\n * `this.extent_` and `this.worldExtent_` must be configured properly for each\n * tile.\n * @private\n * @type {import(\"./Units.js\").Units}\n */\n this.units_ = /** @type {import(\"./Units.js\").Units} */ (options.units);\n\n /**\n * Validity extent of the projection in projected coordinates. For projections\n * with `TILE_PIXELS` units, this is the extent of the tile in\n * tile pixel space.\n * @private\n * @type {import(\"../extent.js\").Extent}\n */\n this.extent_ = options.extent !== undefined ? options.extent : null;\n\n /**\n * Extent of the world in EPSG:4326. For projections with\n * `TILE_PIXELS` units, this is the extent of the tile in\n * projected coordinate space.\n * @private\n * @type {import(\"../extent.js\").Extent}\n */\n this.worldExtent_ =\n options.worldExtent !== undefined ? options.worldExtent : null;\n\n /**\n * @private\n * @type {string}\n */\n this.axisOrientation_ =\n options.axisOrientation !== undefined ? options.axisOrientation : 'enu';\n\n /**\n * @private\n * @type {boolean}\n */\n this.global_ = options.global !== undefined ? options.global : false;\n\n /**\n * @private\n * @type {boolean}\n */\n this.canWrapX_ = !!(this.global_ && this.extent_);\n\n /**\n * @private\n * @type {GetPointResolution|undefined}\n */\n this.getPointResolutionFunc_ = options.getPointResolution;\n\n /**\n * @private\n * @type {import(\"../tilegrid/TileGrid.js\").default}\n */\n this.defaultTileGrid_ = null;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.metersPerUnit_ = options.metersPerUnit;\n }\n\n /**\n * @return {boolean} The projection is suitable for wrapping the x-axis\n */\n canWrapX() {\n return this.canWrapX_;\n }\n\n /**\n * Get the code for this projection, e.g. 'EPSG:4326'.\n * @return {string} Code.\n * @api\n */\n getCode() {\n return this.code_;\n }\n\n /**\n * Get the validity extent for this projection.\n * @return {import(\"../extent.js\").Extent} Extent.\n * @api\n */\n getExtent() {\n return this.extent_;\n }\n\n /**\n * Get the units of this projection.\n * @return {import(\"./Units.js\").Units} Units.\n * @api\n */\n getUnits() {\n return this.units_;\n }\n\n /**\n * Get the amount of meters per unit of this projection. If the projection is\n * not configured with `metersPerUnit` or a units identifier, the return is\n * `undefined`.\n * @return {number|undefined} Meters.\n * @api\n */\n getMetersPerUnit() {\n return this.metersPerUnit_ || METERS_PER_UNIT[this.units_];\n }\n\n /**\n * Get the world extent for this projection.\n * @return {import(\"../extent.js\").Extent} Extent.\n * @api\n */\n getWorldExtent() {\n return this.worldExtent_;\n }\n\n /**\n * Get the axis orientation of this projection.\n * Example values are:\n * enu - the default easting, northing, elevation.\n * neu - northing, easting, up - useful for \"lat/long\" geographic coordinates,\n * or south orientated transverse mercator.\n * wnu - westing, northing, up - some planetary coordinate systems have\n * \"west positive\" coordinate systems\n * @return {string} Axis orientation.\n * @api\n */\n getAxisOrientation() {\n return this.axisOrientation_;\n }\n\n /**\n * Is this projection a global projection which spans the whole world?\n * @return {boolean} Whether the projection is global.\n * @api\n */\n isGlobal() {\n return this.global_;\n }\n\n /**\n * Set if the projection is a global projection which spans the whole world\n * @param {boolean} global Whether the projection is global.\n * @api\n */\n setGlobal(global) {\n this.global_ = global;\n this.canWrapX_ = !!(global && this.extent_);\n }\n\n /**\n * @return {import(\"../tilegrid/TileGrid.js\").default} The default tile grid.\n */\n getDefaultTileGrid() {\n return this.defaultTileGrid_;\n }\n\n /**\n * @param {import(\"../tilegrid/TileGrid.js\").default} tileGrid The default tile grid.\n */\n setDefaultTileGrid(tileGrid) {\n this.defaultTileGrid_ = tileGrid;\n }\n\n /**\n * Set the validity extent for this projection.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @api\n */\n setExtent(extent) {\n this.extent_ = extent;\n this.canWrapX_ = !!(this.global_ && extent);\n }\n\n /**\n * Set the world extent for this projection.\n * @param {import(\"../extent.js\").Extent} worldExtent World extent\n * [minlon, minlat, maxlon, maxlat].\n * @api\n */\n setWorldExtent(worldExtent) {\n this.worldExtent_ = worldExtent;\n }\n\n /**\n * Set the getPointResolution function (see {@link module:ol/proj.getPointResolution}\n * for this projection.\n * @param {function(number, import(\"../coordinate.js\").Coordinate):number} func Function\n * @api\n */\n setGetPointResolution(func) {\n this.getPointResolutionFunc_ = func;\n }\n\n /**\n * Get the custom point resolution function for this projection (if set).\n * @return {GetPointResolution|undefined} The custom point\n * resolution function (if set).\n */\n getPointResolutionFunc() {\n return this.getPointResolutionFunc_;\n }\n}\n\nexport default Projection;\n","/**\n * @module ol/proj/epsg3857\n */\nimport Projection from './Projection.js';\n\n/**\n * Radius of WGS84 sphere\n *\n * @const\n * @type {number}\n */\nexport const RADIUS = 6378137;\n\n/**\n * @const\n * @type {number}\n */\nexport const HALF_SIZE = Math.PI * RADIUS;\n\n/**\n * @const\n * @type {import(\"../extent.js\").Extent}\n */\nexport const EXTENT = [-HALF_SIZE, -HALF_SIZE, HALF_SIZE, HALF_SIZE];\n\n/**\n * @const\n * @type {import(\"../extent.js\").Extent}\n */\nexport const WORLD_EXTENT = [-180, -85, 180, 85];\n\n/**\n * Maximum safe value in y direction\n * @const\n * @type {number}\n */\nexport const MAX_SAFE_Y = RADIUS * Math.log(Math.tan(Math.PI / 2));\n\n/**\n * @classdesc\n * Projection object for web/spherical Mercator (EPSG:3857).\n */\nclass EPSG3857Projection extends Projection {\n /**\n * @param {string} code Code.\n */\n constructor(code) {\n super({\n code: code,\n units: 'm',\n extent: EXTENT,\n global: true,\n worldExtent: WORLD_EXTENT,\n getPointResolution: function (resolution, point) {\n return resolution / Math.cosh(point[1] / RADIUS);\n },\n });\n }\n}\n\n/**\n * Projections equal to EPSG:3857.\n *\n * @const\n * @type {Array}\n */\nexport const PROJECTIONS = [\n new EPSG3857Projection('EPSG:3857'),\n new EPSG3857Projection('EPSG:102100'),\n new EPSG3857Projection('EPSG:102113'),\n new EPSG3857Projection('EPSG:900913'),\n new EPSG3857Projection('http://www.opengis.net/def/crs/EPSG/0/3857'),\n new EPSG3857Projection('http://www.opengis.net/gml/srs/epsg.xml#3857'),\n];\n\n/**\n * Transformation from EPSG:4326 to EPSG:3857.\n *\n * @param {Array} input Input array of coordinate values.\n * @param {Array} [output] Output array of coordinate values.\n * @param {number} [dimension] Dimension (default is `2`).\n * @param {number} [stride] Stride (default is `dimension`).\n * @return {Array} Output array of coordinate values.\n */\nexport function fromEPSG4326(input, output, dimension, stride) {\n const length = input.length;\n dimension = dimension > 1 ? dimension : 2;\n stride = stride ?? dimension;\n if (output === undefined) {\n if (dimension > 2) {\n // preserve values beyond second dimension\n output = input.slice();\n } else {\n output = new Array(length);\n }\n }\n for (let i = 0; i < length; i += stride) {\n output[i] = (HALF_SIZE * input[i]) / 180;\n let y = RADIUS * Math.log(Math.tan((Math.PI * (+input[i + 1] + 90)) / 360));\n if (y > MAX_SAFE_Y) {\n y = MAX_SAFE_Y;\n } else if (y < -MAX_SAFE_Y) {\n y = -MAX_SAFE_Y;\n }\n output[i + 1] = y;\n }\n return output;\n}\n\n/**\n * Transformation from EPSG:3857 to EPSG:4326.\n *\n * @param {Array} input Input array of coordinate values.\n * @param {Array} [output] Output array of coordinate values.\n * @param {number} [dimension] Dimension (default is `2`).\n * @param {number} [stride] Stride (default is `dimension`).\n * @return {Array} Output array of coordinate values.\n */\nexport function toEPSG4326(input, output, dimension, stride) {\n const length = input.length;\n dimension = dimension > 1 ? dimension : 2;\n stride = stride ?? dimension;\n if (output === undefined) {\n if (dimension > 2) {\n // preserve values beyond second dimension\n output = input.slice();\n } else {\n output = new Array(length);\n }\n }\n for (let i = 0; i < length; i += stride) {\n output[i] = (180 * input[i]) / HALF_SIZE;\n output[i + 1] =\n (360 * Math.atan(Math.exp(input[i + 1] / RADIUS))) / Math.PI - 90;\n }\n return output;\n}\n","/**\n * @module ol/proj/epsg4326\n */\nimport Projection from './Projection.js';\n\n/**\n * Semi-major radius of the WGS84 ellipsoid.\n *\n * @const\n * @type {number}\n */\nexport const RADIUS = 6378137;\n\n/**\n * Extent of the EPSG:4326 projection which is the whole world.\n *\n * @const\n * @type {import(\"../extent.js\").Extent}\n */\nexport const EXTENT = [-180, -90, 180, 90];\n\n/**\n * @const\n * @type {number}\n */\nexport const METERS_PER_UNIT = (Math.PI * RADIUS) / 180;\n\n/**\n * @classdesc\n * Projection object for WGS84 geographic coordinates (EPSG:4326).\n *\n * Note that OpenLayers does not strictly comply with the EPSG definition.\n * The EPSG registry defines 4326 as a CRS for Latitude,Longitude (y,x).\n * OpenLayers treats EPSG:4326 as a pseudo-projection, with x,y coordinates.\n */\nclass EPSG4326Projection extends Projection {\n /**\n * @param {string} code Code.\n * @param {string} [axisOrientation] Axis orientation.\n */\n constructor(code, axisOrientation) {\n super({\n code: code,\n units: 'degrees',\n extent: EXTENT,\n axisOrientation: axisOrientation,\n global: true,\n metersPerUnit: METERS_PER_UNIT,\n worldExtent: EXTENT,\n });\n }\n}\n\n/**\n * Projections equal to EPSG:4326.\n *\n * @const\n * @type {Array}\n */\nexport const PROJECTIONS = [\n new EPSG4326Projection('CRS:84'),\n new EPSG4326Projection('EPSG:4326', 'neu'),\n new EPSG4326Projection('urn:ogc:def:crs:OGC:1.3:CRS84'),\n new EPSG4326Projection('urn:ogc:def:crs:OGC:2:84'),\n new EPSG4326Projection('http://www.opengis.net/def/crs/OGC/1.3/CRS84'),\n new EPSG4326Projection('http://www.opengis.net/gml/srs/epsg.xml#4326', 'neu'),\n new EPSG4326Projection('http://www.opengis.net/def/crs/EPSG/0/4326', 'neu'),\n];\n","/**\n * @module ol/proj/projections\n */\n\n/**\n * @type {Object}\n */\nlet cache = {};\n\n/**\n * Clear the projections cache.\n */\nexport function clear() {\n cache = {};\n}\n\n/**\n * Get a cached projection by code.\n * @param {string} code The code for the projection.\n * @return {import(\"./Projection.js\").default|null} The projection (if cached).\n */\nexport function get(code) {\n return (\n cache[code] ||\n cache[code.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\\w+)$/, 'EPSG:$3')] ||\n null\n );\n}\n\n/**\n * Add a projection to the cache.\n * @param {string} code The projection code.\n * @param {import(\"./Projection.js\").default} projection The projection to cache.\n */\nexport function add(code, projection) {\n cache[code] = projection;\n}\n","/**\n * @module ol/proj/transforms\n */\nimport {isEmpty} from '../obj.js';\n\n/**\n * @private\n * @type {!Object>}\n */\nlet transforms = {};\n\n/**\n * Clear the transform cache.\n */\nexport function clear() {\n transforms = {};\n}\n\n/**\n * Registers a conversion function to convert coordinates from the source\n * projection to the destination projection.\n *\n * @param {import(\"./Projection.js\").default} source Source.\n * @param {import(\"./Projection.js\").default} destination Destination.\n * @param {import(\"../proj.js\").TransformFunction} transformFn Transform.\n */\nexport function add(source, destination, transformFn) {\n const sourceCode = source.getCode();\n const destinationCode = destination.getCode();\n if (!(sourceCode in transforms)) {\n transforms[sourceCode] = {};\n }\n transforms[sourceCode][destinationCode] = transformFn;\n}\n\n/**\n * Unregisters the conversion function to convert coordinates from the source\n * projection to the destination projection. This method is used to clean up\n * cached transforms during testing.\n *\n * @param {import(\"./Projection.js\").default} source Source projection.\n * @param {import(\"./Projection.js\").default} destination Destination projection.\n * @return {import(\"../proj.js\").TransformFunction} transformFn The unregistered transform.\n */\nexport function remove(source, destination) {\n const sourceCode = source.getCode();\n const destinationCode = destination.getCode();\n const transform = transforms[sourceCode][destinationCode];\n delete transforms[sourceCode][destinationCode];\n if (isEmpty(transforms[sourceCode])) {\n delete transforms[sourceCode];\n }\n return transform;\n}\n\n/**\n * Get a transform given a source code and a destination code.\n * @param {string} sourceCode The code for the source projection.\n * @param {string} destinationCode The code for the destination projection.\n * @return {import(\"../proj.js\").TransformFunction|null} The transform function (if found).\n */\nexport function get(sourceCode, destinationCode) {\n if (sourceCode in transforms && destinationCode in transforms[sourceCode]) {\n return transforms[sourceCode][destinationCode];\n }\n return null;\n}\n","/**\n * @module ol/proj/utm\n */\n\n/**\n * Adapted from https://github.com/Turbo87/utm\n * Copyright (c) 2012-2017 Tobias Bieniek\n *\n * The functions here provide approximate transforms to and from UTM.\n * They are not appropriate for use beyond the validity extend of a UTM\n * zone, and the accuracy of the transform decreases toward the zone\n * edges.\n */\n\nimport {toDegrees, toRadians, wrap} from '../math.js';\nimport Projection from './Projection.js';\n\n/**\n * @typedef {Object} UTMZone\n * @property {number} number The zone number (1 - 60).\n * @property {boolean} north The northern hemisphere.\n */\n\nconst K0 = 0.9996;\n\nconst E = 0.00669438;\nconst E2 = E * E;\nconst E3 = E2 * E;\nconst E_P2 = E / (1 - E);\n\nconst SQRT_E = Math.sqrt(1 - E);\nconst _E = (1 - SQRT_E) / (1 + SQRT_E);\nconst _E2 = _E * _E;\nconst _E3 = _E2 * _E;\nconst _E4 = _E3 * _E;\nconst _E5 = _E4 * _E;\n\nconst M1 = 1 - E / 4 - (3 * E2) / 64 - (5 * E3) / 256;\nconst M2 = (3 * E) / 8 + (3 * E2) / 32 + (45 * E3) / 1024;\nconst M3 = (15 * E2) / 256 + (45 * E3) / 1024;\nconst M4 = (35 * E3) / 3072;\n\nconst P2 = (3 / 2) * _E - (27 / 32) * _E3 + (269 / 512) * _E5;\nconst P3 = (21 / 16) * _E2 - (55 / 32) * _E4;\nconst P4 = (151 / 96) * _E3 - (417 / 128) * _E5;\nconst P5 = (1097 / 512) * _E4;\n\nconst R = 6378137;\n\n/**\n * @param {number} easting Easting value of coordinate.\n * @param {number} northing Northing value of coordinate.\n * @param {UTMZone} zone The UTM zone.\n * @return {import(\"../coordinate.js\").Coordinate} The transformed coordinate.\n */\nfunction toLonLat(easting, northing, zone) {\n const x = easting - 500000;\n const y = zone.north ? northing : northing - 10000000;\n\n const m = y / K0;\n const mu = m / (R * M1);\n\n const pRad =\n mu +\n P2 * Math.sin(2 * mu) +\n P3 * Math.sin(4 * mu) +\n P4 * Math.sin(6 * mu) +\n P5 * Math.sin(8 * mu);\n\n const pSin = Math.sin(pRad);\n const pSin2 = pSin * pSin;\n\n const pCos = Math.cos(pRad);\n\n const pTan = pSin / pCos;\n const pTan2 = pTan * pTan;\n const pTan4 = pTan2 * pTan2;\n\n const epSin = 1 - E * pSin2;\n const epSinSqrt = Math.sqrt(1 - E * pSin2);\n\n const n = R / epSinSqrt;\n const r = (1 - E) / epSin;\n\n const c = E_P2 * pCos ** 2;\n const c2 = c * c;\n\n const d = x / (n * K0);\n const d2 = d * d;\n const d3 = d2 * d;\n const d4 = d3 * d;\n const d5 = d4 * d;\n const d6 = d5 * d;\n\n const latitude =\n pRad -\n (pTan / r) *\n (d2 / 2 - (d4 / 24) * (5 + 3 * pTan2 + 10 * c - 4 * c2 - 9 * E_P2)) +\n (d6 / 720) * (61 + 90 * pTan2 + 298 * c + 45 * pTan4 - 252 * E_P2 - 3 * c2);\n\n let longitude =\n (d -\n (d3 / 6) * (1 + 2 * pTan2 + c) +\n (d5 / 120) * (5 - 2 * c + 28 * pTan2 - 3 * c2 + 8 * E_P2 + 24 * pTan4)) /\n pCos;\n\n longitude = wrap(\n longitude + toRadians(zoneToCentralLongitude(zone.number)),\n -Math.PI,\n Math.PI,\n );\n\n return [toDegrees(longitude), toDegrees(latitude)];\n}\n\nconst MIN_LATITUDE = -80;\nconst MAX_LATITUDE = 84;\nconst MIN_LONGITUDE = -180;\nconst MAX_LONGITUDE = 180;\n\n/**\n * @param {number} longitude The longitude.\n * @param {number} latitude The latitude.\n * @param {UTMZone} zone The UTM zone.\n * @return {import('../coordinate.js').Coordinate} The UTM coordinate.\n */\nfunction fromLonLat(longitude, latitude, zone) {\n longitude = wrap(longitude, MIN_LONGITUDE, MAX_LONGITUDE);\n\n if (latitude < MIN_LATITUDE) {\n latitude = MIN_LATITUDE;\n } else if (latitude > MAX_LATITUDE) {\n latitude = MAX_LATITUDE;\n }\n\n const latRad = toRadians(latitude);\n const latSin = Math.sin(latRad);\n const latCos = Math.cos(latRad);\n\n const latTan = latSin / latCos;\n const latTan2 = latTan * latTan;\n const latTan4 = latTan2 * latTan2;\n\n const lonRad = toRadians(longitude);\n const centralLon = zoneToCentralLongitude(zone.number);\n const centralLonRad = toRadians(centralLon);\n\n const n = R / Math.sqrt(1 - E * latSin ** 2);\n const c = E_P2 * latCos ** 2;\n\n const a = latCos * wrap(lonRad - centralLonRad, -Math.PI, Math.PI);\n const a2 = a * a;\n const a3 = a2 * a;\n const a4 = a3 * a;\n const a5 = a4 * a;\n const a6 = a5 * a;\n\n const m =\n R *\n (M1 * latRad -\n M2 * Math.sin(2 * latRad) +\n M3 * Math.sin(4 * latRad) -\n M4 * Math.sin(6 * latRad));\n\n const easting =\n K0 *\n n *\n (a +\n (a3 / 6) * (1 - latTan2 + c) +\n (a5 / 120) * (5 - 18 * latTan2 + latTan4 + 72 * c - 58 * E_P2)) +\n 500000;\n\n let northing =\n K0 *\n (m +\n n *\n latTan *\n (a2 / 2 +\n (a4 / 24) * (5 - latTan2 + 9 * c + 4 * c ** 2) +\n (a6 / 720) * (61 - 58 * latTan2 + latTan4 + 600 * c - 330 * E_P2)));\n\n if (!zone.north) {\n northing += 10000000;\n }\n\n return [easting, northing];\n}\n\n/**\n * @param {number} zone The zone number.\n * @return {number} The central longitude in degrees.\n */\nfunction zoneToCentralLongitude(zone) {\n return (zone - 1) * 6 - 180 + 3;\n}\n\n/**\n * @type {Array}\n */\nconst epsgRegExes = [\n /^EPSG:(\\d+)$/,\n /^urn:ogc:def:crs:EPSG::(\\d+)$/,\n /^http:\\/\\/www\\.opengis\\.net\\/def\\/crs\\/EPSG\\/0\\/(\\d+)$/,\n];\n\n/**\n * @param {string} code The projection code.\n * @return {UTMZone|null} The UTM zone info (or null if not UTM).\n */\nexport function zoneFromCode(code) {\n let epsgId = 0;\n for (const re of epsgRegExes) {\n const match = code.match(re);\n if (match) {\n epsgId = parseInt(match[1]);\n break;\n }\n }\n if (!epsgId) {\n return null;\n }\n\n let number = 0;\n let north = false;\n if (epsgId > 32700 && epsgId < 32761) {\n number = epsgId - 32700;\n } else if (epsgId > 32600 && epsgId < 32661) {\n north = true;\n number = epsgId - 32600;\n }\n if (!number) {\n return null;\n }\n\n return {number, north};\n}\n\n/**\n * @param {function(number, number, UTMZone): import('../coordinate.js').Coordinate} transformer The transformer.\n * @param {UTMZone} zone The UTM zone.\n * @return {import('../proj.js').TransformFunction} The transform function.\n */\nfunction makeTransformFunction(transformer, zone) {\n return function (input, output, dimension, stride) {\n const length = input.length;\n dimension = dimension > 1 ? dimension : 2;\n stride = stride ?? dimension;\n if (!output) {\n if (dimension > 2) {\n output = input.slice();\n } else {\n output = new Array(length);\n }\n }\n for (let i = 0; i < length; i += stride) {\n const x = input[i];\n const y = input[i + 1];\n const coord = transformer(x, y, zone);\n output[i] = coord[0];\n output[i + 1] = coord[1];\n }\n return output;\n };\n}\n\n/**\n * @param {string} code The projection code.\n * @return {import('./Projection.js').default|null} A projection or null if unable to create one.\n */\nexport function makeProjection(code) {\n const zone = zoneFromCode(code);\n if (!zone) {\n return null;\n }\n return new Projection({code, units: 'm'});\n}\n\n/**\n * @param {import('./Projection.js').default} projection The projection.\n * @return {import('../proj.js').Transforms|null} The transforms lookup or null if unable to handle projection.\n */\nexport function makeTransforms(projection) {\n const zone = zoneFromCode(projection.getCode());\n if (!zone) {\n return null;\n }\n\n return {\n forward: makeTransformFunction(fromLonLat, zone),\n inverse: makeTransformFunction(toLonLat, zone),\n };\n}\n","/**\n * @module ol/proj\n */\n\n/**\n * The ol/proj module stores:\n * a list of {@link module:ol/proj/Projection~Projection}\n * objects, one for each projection supported by the application\n * a list of transform functions needed to convert coordinates in one projection\n * into another.\n *\n * The static functions are the methods used to maintain these.\n * Each transform function can handle not only simple coordinate pairs, but also\n * large arrays of coordinates such as vector geometries.\n *\n * When loaded, the library adds projection objects for EPSG:4326 (WGS84\n * geographic coordinates) and EPSG:3857 (Web or Spherical Mercator, as used\n * for example by Bing Maps or OpenStreetMap), together with the relevant\n * transform functions.\n *\n * Additional transforms may be added by using the http://proj4js.org/\n * library (version 2.2 or later). You can use the full build supplied by\n * Proj4js, or create a custom build to support those projections you need; see\n * the Proj4js website for how to do this. You also need the Proj4js definitions\n * for the required projections. These definitions can be obtained from\n * https://spatialreference.org/, and are a JS function, so can be loaded in a\n * script tag (as in the examples) or pasted into your application.\n *\n * After all required projection definitions are added to proj4's registry (by\n * using `proj4.defs()`), simply call `register(proj4)` from the `ol/proj/proj4`\n * package. Existing transforms are not changed by this function. See\n * examples/wms-image-custom-proj for an example of this.\n *\n * Additional projection definitions can be registered with `proj4.defs()` any\n * time. Just make sure to call `register(proj4)` again; for example, with user-supplied data where you don't\n * know in advance what projections are needed, you can initially load minimal\n * support and then load whichever are requested.\n *\n * Note that Proj4js does not support projection extents. If you want to add\n * one for creating default tile grids, you can add it after the Projection\n * object has been created with `setExtent`, for example,\n * `get('EPSG:1234').setExtent(extent)`.\n *\n * In addition to Proj4js support, any transform functions can be added with\n * {@link module:ol/proj.addCoordinateTransforms}. To use this, you must first create\n * a {@link module:ol/proj/Projection~Projection} object for the new projection and add it with\n * {@link module:ol/proj.addProjection}. You can then add the forward and inverse\n * functions with {@link module:ol/proj.addCoordinateTransforms}. See\n * examples/wms-custom-proj for an example of this.\n *\n * Note that if no transforms are needed and you only need to define the\n * projection, just add a {@link module:ol/proj/Projection~Projection} with\n * {@link module:ol/proj.addProjection}. See examples/wms-no-proj for an example of\n * this.\n */\nimport {warn} from './console.js';\nimport {equals, getWorldsAway} from './coordinate.js';\nimport {applyTransform, getWidth} from './extent.js';\nimport {clamp, modulo} from './math.js';\nimport Projection from './proj/Projection.js';\nimport {METERS_PER_UNIT} from './proj/Units.js';\nimport {\n PROJECTIONS as EPSG3857_PROJECTIONS,\n fromEPSG4326,\n toEPSG4326,\n} from './proj/epsg3857.js';\nimport {PROJECTIONS as EPSG4326_PROJECTIONS} from './proj/epsg4326.js';\nimport {\n add as addProj,\n clear as clearProj,\n get as getProj,\n} from './proj/projections.js';\nimport {\n add as addTransformFunc,\n clear as clearTransformFuncs,\n get as getTransformFunc,\n} from './proj/transforms.js';\nimport {\n makeProjection as makeUTMProjection,\n makeTransforms as makeUTMTransforms,\n} from './proj/utm.js';\nimport {getDistance} from './sphere.js';\n\n/**\n * A projection as {@link module:ol/proj/Projection~Projection}, SRS identifier\n * string or undefined.\n * @typedef {Projection|string|undefined} ProjectionLike\n * @api\n */\n\n/**\n * @typedef {Object} Transforms\n * @property {TransformFunction} forward The forward transform (from geographic).\n * @property {TransformFunction} inverse The inverse transform (to geographic).\n */\n\n/**\n * @type {Array}\n */\nconst transformFactories = [makeUTMTransforms];\n\n/**\n * @type {Array}\n */\nconst projectionFactories = [makeUTMProjection];\n\n/**\n * A transform function accepts an array of input coordinate values, an optional\n * output array, and an optional dimension (default should be 2). The function\n * transforms the input coordinate values, populates the output array, and\n * returns the output array.\n *\n * @callback TransformFunction\n * @param {Array} input\n * @param {Array} [output]\n * @param {number} [dimension]\n * @param {number} [stride]\n * @return {Array}\n *\n * @api\n */\n\nexport {METERS_PER_UNIT};\n\nexport {Projection};\n\nlet showCoordinateWarning = true;\n\n/**\n * @param {boolean} [disable] Disable console info about `useGeographic()`\n */\nexport function disableCoordinateWarning(disable) {\n const hide = disable === undefined ? true : disable;\n showCoordinateWarning = !hide;\n}\n\n/**\n * @param {Array} input Input coordinate array.\n * @param {Array} [output] Output array of coordinate values.\n * @return {Array} Output coordinate array (new array, same coordinate\n * values).\n */\nexport function cloneTransform(input, output) {\n if (output !== undefined) {\n for (let i = 0, ii = input.length; i < ii; ++i) {\n output[i] = input[i];\n }\n output = output;\n } else {\n output = input.slice();\n }\n return output;\n}\n\n/**\n * @param {Array} input Input coordinate array.\n * @param {Array} [output] Output array of coordinate values.\n * @return {Array} Input coordinate array (same array as input).\n */\nexport function identityTransform(input, output) {\n if (output !== undefined && input !== output) {\n for (let i = 0, ii = input.length; i < ii; ++i) {\n output[i] = input[i];\n }\n input = output;\n }\n return input;\n}\n\n/**\n * Add a Projection object to the list of supported projections that can be\n * looked up by their code.\n *\n * @param {Projection} projection Projection instance.\n * @api\n */\nexport function addProjection(projection) {\n addProj(projection.getCode(), projection);\n addTransformFunc(projection, projection, cloneTransform);\n}\n\n/**\n * @param {Array} projections Projections.\n */\nexport function addProjections(projections) {\n projections.forEach(addProjection);\n}\n\n/**\n * Fetches a Projection object for the code specified.\n *\n * @param {ProjectionLike} projectionLike Either a code string which is\n * a combination of authority and identifier such as \"EPSG:4326\", or an\n * existing projection object, or undefined.\n * @return {Projection|null} Projection object, or null if not in list.\n * @api\n */\nexport function get(projectionLike) {\n if (!(typeof projectionLike === 'string')) {\n return projectionLike;\n }\n const projection = getProj(projectionLike);\n if (projection) {\n return projection;\n }\n for (const makeProjection of projectionFactories) {\n const projection = makeProjection(projectionLike);\n if (projection) {\n return projection;\n }\n }\n return null;\n}\n\n/**\n * Get the resolution of the point in degrees or distance units.\n * For projections with degrees as the unit this will simply return the\n * provided resolution. For other projections the point resolution is\n * by default estimated by transforming the `point` pixel to EPSG:4326,\n * measuring its width and height on the normal sphere,\n * and taking the average of the width and height.\n * A custom function can be provided for a specific projection, either\n * by setting the `getPointResolution` option in the\n * {@link module:ol/proj/Projection~Projection} constructor or by using\n * {@link module:ol/proj/Projection~Projection#setGetPointResolution} to change an existing\n * projection object.\n * @param {ProjectionLike} projection The projection.\n * @param {number} resolution Nominal resolution in projection units.\n * @param {import(\"./coordinate.js\").Coordinate} point Point to find adjusted resolution at.\n * @param {import(\"./proj/Units.js\").Units} [units] Units to get the point resolution in.\n * Default is the projection's units.\n * @return {number} Point resolution.\n * @api\n */\nexport function getPointResolution(projection, resolution, point, units) {\n projection = get(projection);\n let pointResolution;\n const getter = projection.getPointResolutionFunc();\n if (getter) {\n pointResolution = getter(resolution, point);\n if (units && units !== projection.getUnits()) {\n const metersPerUnit = projection.getMetersPerUnit();\n if (metersPerUnit) {\n pointResolution =\n (pointResolution * metersPerUnit) / METERS_PER_UNIT[units];\n }\n }\n } else {\n const projUnits = projection.getUnits();\n if ((projUnits == 'degrees' && !units) || units == 'degrees') {\n pointResolution = resolution;\n } else {\n // Estimate point resolution by transforming the center pixel to EPSG:4326,\n // measuring its width and height on the normal sphere, and taking the\n // average of the width and height.\n const toEPSG4326 = getTransformFromProjections(\n projection,\n get('EPSG:4326'),\n );\n if (!toEPSG4326 && projUnits !== 'degrees') {\n // no transform is available\n pointResolution = resolution * projection.getMetersPerUnit();\n } else {\n let vertices = [\n point[0] - resolution / 2,\n point[1],\n point[0] + resolution / 2,\n point[1],\n point[0],\n point[1] - resolution / 2,\n point[0],\n point[1] + resolution / 2,\n ];\n vertices = toEPSG4326(vertices, vertices, 2);\n const width = getDistance(vertices.slice(0, 2), vertices.slice(2, 4));\n const height = getDistance(vertices.slice(4, 6), vertices.slice(6, 8));\n pointResolution = (width + height) / 2;\n }\n const metersPerUnit = units\n ? METERS_PER_UNIT[units]\n : projection.getMetersPerUnit();\n if (metersPerUnit !== undefined) {\n pointResolution /= metersPerUnit;\n }\n }\n }\n return pointResolution;\n}\n\n/**\n * Registers transformation functions that don't alter coordinates. Those allow\n * to transform between projections with equal meaning.\n *\n * @param {Array} projections Projections.\n * @api\n */\nexport function addEquivalentProjections(projections) {\n addProjections(projections);\n projections.forEach(function (source) {\n projections.forEach(function (destination) {\n if (source !== destination) {\n addTransformFunc(source, destination, cloneTransform);\n }\n });\n });\n}\n\n/**\n * Registers transformation functions to convert coordinates in any projection\n * in projection1 to any projection in projection2.\n *\n * @param {Array} projections1 Projections with equal\n * meaning.\n * @param {Array} projections2 Projections with equal\n * meaning.\n * @param {TransformFunction} forwardTransform Transformation from any\n * projection in projection1 to any projection in projection2.\n * @param {TransformFunction} inverseTransform Transform from any projection\n * in projection2 to any projection in projection1..\n */\nexport function addEquivalentTransforms(\n projections1,\n projections2,\n forwardTransform,\n inverseTransform,\n) {\n projections1.forEach(function (projection1) {\n projections2.forEach(function (projection2) {\n addTransformFunc(projection1, projection2, forwardTransform);\n addTransformFunc(projection2, projection1, inverseTransform);\n });\n });\n}\n\n/**\n * Clear all cached projections and transforms.\n */\nexport function clearAllProjections() {\n clearProj();\n clearTransformFuncs();\n}\n\n/**\n * @param {Projection|string|undefined} projection Projection.\n * @param {string} defaultCode Default code.\n * @return {Projection} Projection.\n */\nexport function createProjection(projection, defaultCode) {\n if (!projection) {\n return get(defaultCode);\n }\n if (typeof projection === 'string') {\n return get(projection);\n }\n return /** @type {Projection} */ (projection);\n}\n\n/**\n * Creates a {@link module:ol/proj~TransformFunction} from a simple 2D coordinate transform\n * function.\n * @param {function(import(\"./coordinate.js\").Coordinate): import(\"./coordinate.js\").Coordinate} coordTransform Coordinate\n * transform.\n * @return {TransformFunction} Transform function.\n */\nexport function createTransformFromCoordinateTransform(coordTransform) {\n return (\n /**\n * @param {Array} input Input.\n * @param {Array} [output] Output.\n * @param {number} [dimension] Dimensions that should be transformed.\n * @param {number} [stride] Stride.\n * @return {Array} Output.\n */\n function (input, output, dimension, stride) {\n const length = input.length;\n dimension = dimension !== undefined ? dimension : 2;\n stride = stride ?? dimension;\n output = output !== undefined ? output : new Array(length);\n for (let i = 0; i < length; i += stride) {\n const point = coordTransform(input.slice(i, i + dimension));\n const pointLength = point.length;\n for (let j = 0, jj = stride; j < jj; ++j) {\n output[i + j] = j >= pointLength ? input[i + j] : point[j];\n }\n }\n return output;\n }\n );\n}\n\n/**\n * Registers coordinate transform functions to convert coordinates between the\n * source projection and the destination projection.\n * The forward and inverse functions convert coordinate pairs; this function\n * converts these into the functions used internally which also handle\n * extents and coordinate arrays.\n *\n * @param {ProjectionLike} source Source projection.\n * @param {ProjectionLike} destination Destination projection.\n * @param {function(import(\"./coordinate.js\").Coordinate): import(\"./coordinate.js\").Coordinate} forward The forward transform\n * function (that is, from the source projection to the destination\n * projection) that takes a {@link module:ol/coordinate~Coordinate} as argument and returns\n * the transformed {@link module:ol/coordinate~Coordinate}.\n * @param {function(import(\"./coordinate.js\").Coordinate): import(\"./coordinate.js\").Coordinate} inverse The inverse transform\n * function (that is, from the destination projection to the source\n * projection) that takes a {@link module:ol/coordinate~Coordinate} as argument and returns\n * the transformed {@link module:ol/coordinate~Coordinate}. If the transform function can only\n * transform less dimensions than the input coordinate, it is supposeed to return a coordinate\n * with only the length it can transform. The other dimensions will be taken unchanged from the\n * source.\n * @api\n */\nexport function addCoordinateTransforms(source, destination, forward, inverse) {\n const sourceProj = get(source);\n const destProj = get(destination);\n addTransformFunc(\n sourceProj,\n destProj,\n createTransformFromCoordinateTransform(forward),\n );\n addTransformFunc(\n destProj,\n sourceProj,\n createTransformFromCoordinateTransform(inverse),\n );\n}\n\n/**\n * Transforms a coordinate from longitude/latitude to a different projection.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate as longitude and latitude, i.e.\n * an array with longitude as 1st and latitude as 2nd element.\n * @param {ProjectionLike} [projection] Target projection. The\n * default is Web Mercator, i.e. 'EPSG:3857'.\n * @return {import(\"./coordinate.js\").Coordinate} Coordinate projected to the target projection.\n * @api\n */\nexport function fromLonLat(coordinate, projection) {\n disableCoordinateWarning();\n return transform(\n coordinate,\n 'EPSG:4326',\n projection !== undefined ? projection : 'EPSG:3857',\n );\n}\n\n/**\n * Transforms a coordinate to longitude/latitude.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Projected coordinate.\n * @param {ProjectionLike} [projection] Projection of the coordinate.\n * The default is Web Mercator, i.e. 'EPSG:3857'.\n * @return {import(\"./coordinate.js\").Coordinate} Coordinate as longitude and latitude, i.e. an array\n * with longitude as 1st and latitude as 2nd element.\n * @api\n */\nexport function toLonLat(coordinate, projection) {\n const lonLat = transform(\n coordinate,\n projection !== undefined ? projection : 'EPSG:3857',\n 'EPSG:4326',\n );\n const lon = lonLat[0];\n if (lon < -180 || lon > 180) {\n lonLat[0] = modulo(lon + 180, 360) - 180;\n }\n return lonLat;\n}\n\n/**\n * Checks if two projections are the same, that is every coordinate in one\n * projection does represent the same geographic point as the same coordinate in\n * the other projection.\n *\n * @param {Projection} projection1 Projection 1.\n * @param {Projection} projection2 Projection 2.\n * @return {boolean} Equivalent.\n * @api\n */\nexport function equivalent(projection1, projection2) {\n if (projection1 === projection2) {\n return true;\n }\n const equalUnits = projection1.getUnits() === projection2.getUnits();\n if (projection1.getCode() === projection2.getCode()) {\n return equalUnits;\n }\n const transformFunc = getTransformFromProjections(projection1, projection2);\n return transformFunc === cloneTransform && equalUnits;\n}\n\n/**\n * Searches in the list of transform functions for the function for converting\n * coordinates from the source projection to the destination projection.\n *\n * @param {Projection} source Source Projection object.\n * @param {Projection} destination Destination Projection\n * object.\n * @return {TransformFunction|null} Transform function.\n */\nexport function getTransformFromProjections(source, destination) {\n const sourceCode = source.getCode();\n const destinationCode = destination.getCode();\n let transformFunc = getTransformFunc(sourceCode, destinationCode);\n if (transformFunc) {\n return transformFunc;\n }\n\n /**\n * @type {Transforms|null}\n */\n let sourceTransforms = null;\n\n /**\n * @type {Transforms|null}\n */\n let destinationTransforms = null;\n\n // lazily add projections if we have supported transforms\n for (const makeTransforms of transformFactories) {\n if (!sourceTransforms) {\n sourceTransforms = makeTransforms(source);\n }\n if (!destinationTransforms) {\n destinationTransforms = makeTransforms(destination);\n }\n }\n\n if (!sourceTransforms && !destinationTransforms) {\n return null;\n }\n\n const intermediateCode = 'EPSG:4326';\n if (!destinationTransforms) {\n const toDestination = getTransformFunc(intermediateCode, destinationCode);\n if (toDestination) {\n transformFunc = composeTransformFuncs(\n sourceTransforms.inverse,\n toDestination,\n );\n }\n } else if (!sourceTransforms) {\n const fromSource = getTransformFunc(sourceCode, intermediateCode);\n if (fromSource) {\n transformFunc = composeTransformFuncs(\n fromSource,\n destinationTransforms.forward,\n );\n }\n } else {\n transformFunc = composeTransformFuncs(\n sourceTransforms.inverse,\n destinationTransforms.forward,\n );\n }\n\n if (transformFunc) {\n addProjection(source);\n addProjection(destination);\n addTransformFunc(source, destination, transformFunc);\n }\n\n return transformFunc;\n}\n\n/**\n * @param {TransformFunction} t1 The first transform function.\n * @param {TransformFunction} t2 The second transform function.\n * @return {TransformFunction} The composed transform function.\n */\nfunction composeTransformFuncs(t1, t2) {\n return function (input, output, dimensions, stride) {\n output = t1(input, output, dimensions, stride);\n return t2(output, output, dimensions, stride);\n };\n}\n\n/**\n * Given the projection-like objects, searches for a transformation\n * function to convert a coordinates array from the source projection to the\n * destination projection.\n *\n * @param {ProjectionLike} source Source.\n * @param {ProjectionLike} destination Destination.\n * @return {TransformFunction} Transform function.\n * @api\n */\nexport function getTransform(source, destination) {\n const sourceProjection = get(source);\n const destinationProjection = get(destination);\n return getTransformFromProjections(sourceProjection, destinationProjection);\n}\n\n/**\n * Transforms a coordinate from source projection to destination projection.\n * This returns a new coordinate (and does not modify the original). If there\n * is no available transform between the two projection, the function will throw\n * an error.\n *\n * See {@link module:ol/proj.transformExtent} for extent transformation.\n * See the transform method of {@link module:ol/geom/Geometry~Geometry} and its\n * subclasses for geometry transforms.\n *\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {ProjectionLike} source Source projection-like.\n * @param {ProjectionLike} destination Destination projection-like.\n * @return {import(\"./coordinate.js\").Coordinate} Coordinate.\n * @api\n */\nexport function transform(coordinate, source, destination) {\n const transformFunc = getTransform(source, destination);\n if (!transformFunc) {\n const sourceCode = get(source).getCode();\n const destinationCode = get(destination).getCode();\n throw new Error(\n `No transform available between ${sourceCode} and ${destinationCode}`,\n );\n }\n return transformFunc(coordinate, undefined, coordinate.length);\n}\n\n/**\n * Transforms an extent from source projection to destination projection. This\n * returns a new extent (and does not modify the original).\n *\n * @param {import(\"./extent.js\").Extent} extent The extent to transform.\n * @param {ProjectionLike} source Source projection-like.\n * @param {ProjectionLike} destination Destination projection-like.\n * @param {number} [stops] Number of stops per side used for the transform.\n * By default only the corners are used.\n * @return {import(\"./extent.js\").Extent} The transformed extent.\n * @api\n */\nexport function transformExtent(extent, source, destination, stops) {\n const transformFunc = getTransform(source, destination);\n return applyTransform(extent, transformFunc, undefined, stops);\n}\n\n/**\n * Transforms the given point to the destination projection.\n *\n * @param {import(\"./coordinate.js\").Coordinate} point Point.\n * @param {Projection} sourceProjection Source projection.\n * @param {Projection} destinationProjection Destination projection.\n * @return {import(\"./coordinate.js\").Coordinate} Point.\n */\nexport function transformWithProjections(\n point,\n sourceProjection,\n destinationProjection,\n) {\n const transformFunc = getTransformFromProjections(\n sourceProjection,\n destinationProjection,\n );\n return transformFunc(point);\n}\n\n/**\n * @type {Projection|null}\n */\nlet userProjection = null;\n\n/**\n * Set the projection for coordinates supplied from and returned by API methods.\n * This includes all API methods except for those interacting with tile grids,\n * plus {@link import(\"./Map.js\").FrameState} and {@link import(\"./View.js\").State}.\n * @param {ProjectionLike} projection The user projection.\n * @api\n */\nexport function setUserProjection(projection) {\n userProjection = get(projection);\n}\n\n/**\n * Clear the user projection if set.\n * @api\n */\nexport function clearUserProjection() {\n userProjection = null;\n}\n\n/**\n * Get the projection for coordinates supplied from and returned by API methods.\n * @return {Projection|null} The user projection (or null if not set).\n * @api\n */\nexport function getUserProjection() {\n return userProjection;\n}\n\n/**\n * Use geographic coordinates (WGS-84 datum) in API methods.\n * This includes all API methods except for those interacting with tile grids,\n * plus {@link import(\"./Map.js\").FrameState} and {@link import(\"./View.js\").State}.\n * @api\n */\nexport function useGeographic() {\n setUserProjection('EPSG:4326');\n}\n\n/**\n * Return a coordinate transformed into the user projection. If no user projection\n * is set, the original coordinate is returned.\n * @param {Array} coordinate Input coordinate.\n * @param {ProjectionLike} sourceProjection The input coordinate projection.\n * @return {Array} The input coordinate in the user projection.\n */\nexport function toUserCoordinate(coordinate, sourceProjection) {\n if (!userProjection) {\n return coordinate;\n }\n return transform(coordinate, sourceProjection, userProjection);\n}\n\n/**\n * Return a coordinate transformed from the user projection. If no user projection\n * is set, the original coordinate is returned.\n * @param {Array} coordinate Input coordinate.\n * @param {ProjectionLike} destProjection The destination projection.\n * @return {Array} The input coordinate transformed.\n */\nexport function fromUserCoordinate(coordinate, destProjection) {\n if (!userProjection) {\n if (\n showCoordinateWarning &&\n !equals(coordinate, [0, 0]) &&\n coordinate[0] >= -180 &&\n coordinate[0] <= 180 &&\n coordinate[1] >= -90 &&\n coordinate[1] <= 90\n ) {\n showCoordinateWarning = false;\n warn(\n 'Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.',\n );\n }\n return coordinate;\n }\n return transform(coordinate, userProjection, destProjection);\n}\n\n/**\n * Return an extent transformed into the user projection. If no user projection\n * is set, the original extent is returned.\n * @param {import(\"./extent.js\").Extent} extent Input extent.\n * @param {ProjectionLike} sourceProjection The input extent projection.\n * @return {import(\"./extent.js\").Extent} The input extent in the user projection.\n */\nexport function toUserExtent(extent, sourceProjection) {\n if (!userProjection) {\n return extent;\n }\n return transformExtent(extent, sourceProjection, userProjection);\n}\n\n/**\n * Return an extent transformed from the user projection. If no user projection\n * is set, the original extent is returned.\n * @param {import(\"./extent.js\").Extent} extent Input extent.\n * @param {ProjectionLike} destProjection The destination projection.\n * @return {import(\"./extent.js\").Extent} The input extent transformed.\n */\nexport function fromUserExtent(extent, destProjection) {\n if (!userProjection) {\n return extent;\n }\n return transformExtent(extent, userProjection, destProjection);\n}\n\n/**\n * Return the resolution in user projection units per pixel. If no user projection\n * is set, or source or user projection are missing units, the original resolution\n * is returned.\n * @param {number} resolution Resolution in input projection units per pixel.\n * @param {ProjectionLike} sourceProjection The input projection.\n * @return {number} Resolution in user projection units per pixel.\n */\nexport function toUserResolution(resolution, sourceProjection) {\n if (!userProjection) {\n return resolution;\n }\n const sourceMetersPerUnit = get(sourceProjection).getMetersPerUnit();\n const userMetersPerUnit = userProjection.getMetersPerUnit();\n return sourceMetersPerUnit && userMetersPerUnit\n ? (resolution * sourceMetersPerUnit) / userMetersPerUnit\n : resolution;\n}\n\n/**\n * Return the resolution in user projection units per pixel. If no user projection\n * is set, or source or user projection are missing units, the original resolution\n * is returned.\n * @param {number} resolution Resolution in user projection units per pixel.\n * @param {ProjectionLike} destProjection The destination projection.\n * @return {number} Resolution in destination projection units per pixel.\n */\nexport function fromUserResolution(resolution, destProjection) {\n if (!userProjection) {\n return resolution;\n }\n const destMetersPerUnit = get(destProjection).getMetersPerUnit();\n const userMetersPerUnit = userProjection.getMetersPerUnit();\n return destMetersPerUnit && userMetersPerUnit\n ? (resolution * userMetersPerUnit) / destMetersPerUnit\n : resolution;\n}\n\n/**\n * Creates a safe coordinate transform function from a coordinate transform function.\n * \"Safe\" means that it can handle wrapping of x-coordinates for global projections,\n * and that coordinates exceeding the source projection validity extent's range will be\n * clamped to the validity range.\n * @param {Projection} sourceProj Source projection.\n * @param {Projection} destProj Destination projection.\n * @param {function(import(\"./coordinate.js\").Coordinate): import(\"./coordinate.js\").Coordinate} transform Transform function (source to destination).\n * @return {function(import(\"./coordinate.js\").Coordinate): import(\"./coordinate.js\").Coordinate} Safe transform function (source to destination).\n */\nexport function createSafeCoordinateTransform(sourceProj, destProj, transform) {\n return function (coord) {\n let transformed, worldsAway;\n if (sourceProj.canWrapX()) {\n const sourceExtent = sourceProj.getExtent();\n const sourceExtentWidth = getWidth(sourceExtent);\n coord = coord.slice(0);\n worldsAway = getWorldsAway(coord, sourceProj, sourceExtentWidth);\n if (worldsAway) {\n // Move x to the real world\n coord[0] = coord[0] - worldsAway * sourceExtentWidth;\n }\n coord[0] = clamp(coord[0], sourceExtent[0], sourceExtent[2]);\n coord[1] = clamp(coord[1], sourceExtent[1], sourceExtent[3]);\n transformed = transform(coord);\n } else {\n transformed = transform(coord);\n }\n if (worldsAway && destProj.canWrapX()) {\n // Move transformed coordinate back to the offset world\n transformed[0] += worldsAway * getWidth(destProj.getExtent());\n }\n return transformed;\n };\n}\n\n/**\n * Add transforms to and from EPSG:4326 and EPSG:3857. This function is called\n * by when this module is executed and should only need to be called again after\n * `clearAllProjections()` is called (e.g. in tests).\n */\nexport function addCommon() {\n // Add transformations that don't alter coordinates to convert within set of\n // projections with equal meaning.\n addEquivalentProjections(EPSG3857_PROJECTIONS);\n addEquivalentProjections(EPSG4326_PROJECTIONS);\n // Add transformations to convert EPSG:4326 like coordinates to EPSG:3857 like\n // coordinates and back.\n addEquivalentTransforms(\n EPSG4326_PROJECTIONS,\n EPSG3857_PROJECTIONS,\n fromEPSG4326,\n toEPSG4326,\n );\n}\n\naddCommon();\n","/**\n * @module ol/transform\n */\nimport {assert} from './asserts.js';\n\n/**\n * An array representing an affine 2d transformation for use with\n * {@link module:ol/transform} functions. The array has 6 elements.\n * @typedef {!Array} Transform\n * @api\n */\n\n/**\n * Collection of affine 2d transformation functions. The functions work on an\n * array of 6 elements. The element order is compatible with the [SVGMatrix\n * interface](https://developer.mozilla.org/en-US/docs/Web/API/SVGMatrix) and is\n * a subset (elements a to f) of a 3×3 matrix:\n * ```\n * [ a c e ]\n * [ b d f ]\n * [ 0 0 1 ]\n * ```\n */\n\n/**\n * @private\n * @type {Transform}\n */\nconst tmp_ = new Array(6);\n\n/**\n * Create an identity transform.\n * @return {!Transform} Identity transform.\n */\nexport function create() {\n return [1, 0, 0, 1, 0, 0];\n}\n\n/**\n * Resets the given transform to an identity transform.\n * @param {!Transform} transform Transform.\n * @return {!Transform} Transform.\n */\nexport function reset(transform) {\n return set(transform, 1, 0, 0, 1, 0, 0);\n}\n\n/**\n * Multiply the underlying matrices of two transforms and return the result in\n * the first transform.\n * @param {!Transform} transform1 Transform parameters of matrix 1.\n * @param {!Transform} transform2 Transform parameters of matrix 2.\n * @return {!Transform} transform1 multiplied with transform2.\n */\nexport function multiply(transform1, transform2) {\n const a1 = transform1[0];\n const b1 = transform1[1];\n const c1 = transform1[2];\n const d1 = transform1[3];\n const e1 = transform1[4];\n const f1 = transform1[5];\n const a2 = transform2[0];\n const b2 = transform2[1];\n const c2 = transform2[2];\n const d2 = transform2[3];\n const e2 = transform2[4];\n const f2 = transform2[5];\n\n transform1[0] = a1 * a2 + c1 * b2;\n transform1[1] = b1 * a2 + d1 * b2;\n transform1[2] = a1 * c2 + c1 * d2;\n transform1[3] = b1 * c2 + d1 * d2;\n transform1[4] = a1 * e2 + c1 * f2 + e1;\n transform1[5] = b1 * e2 + d1 * f2 + f1;\n\n return transform1;\n}\n\n/**\n * Set the transform components a-f on a given transform.\n * @param {!Transform} transform Transform.\n * @param {number} a The a component of the transform.\n * @param {number} b The b component of the transform.\n * @param {number} c The c component of the transform.\n * @param {number} d The d component of the transform.\n * @param {number} e The e component of the transform.\n * @param {number} f The f component of the transform.\n * @return {!Transform} Matrix with transform applied.\n */\nexport function set(transform, a, b, c, d, e, f) {\n transform[0] = a;\n transform[1] = b;\n transform[2] = c;\n transform[3] = d;\n transform[4] = e;\n transform[5] = f;\n return transform;\n}\n\n/**\n * Set transform on one matrix from another matrix.\n * @param {!Transform} transform1 Matrix to set transform to.\n * @param {!Transform} transform2 Matrix to set transform from.\n * @return {!Transform} transform1 with transform from transform2 applied.\n */\nexport function setFromArray(transform1, transform2) {\n transform1[0] = transform2[0];\n transform1[1] = transform2[1];\n transform1[2] = transform2[2];\n transform1[3] = transform2[3];\n transform1[4] = transform2[4];\n transform1[5] = transform2[5];\n return transform1;\n}\n\n/**\n * Transforms the given coordinate with the given transform returning the\n * resulting, transformed coordinate. The coordinate will be modified in-place.\n *\n * @param {Transform} transform The transformation.\n * @param {import(\"./coordinate.js\").Coordinate|import(\"./pixel.js\").Pixel} coordinate The coordinate to transform.\n * @return {import(\"./coordinate.js\").Coordinate|import(\"./pixel.js\").Pixel} return coordinate so that operations can be\n * chained together.\n */\nexport function apply(transform, coordinate) {\n const x = coordinate[0];\n const y = coordinate[1];\n coordinate[0] = transform[0] * x + transform[2] * y + transform[4];\n coordinate[1] = transform[1] * x + transform[3] * y + transform[5];\n return coordinate;\n}\n\n/**\n * Applies rotation to the given transform.\n * @param {!Transform} transform Transform.\n * @param {number} angle Angle in radians.\n * @return {!Transform} The rotated transform.\n */\nexport function rotate(transform, angle) {\n const cos = Math.cos(angle);\n const sin = Math.sin(angle);\n return multiply(transform, set(tmp_, cos, sin, -sin, cos, 0, 0));\n}\n\n/**\n * Applies scale to a given transform.\n * @param {!Transform} transform Transform.\n * @param {number} x Scale factor x.\n * @param {number} y Scale factor y.\n * @return {!Transform} The scaled transform.\n */\nexport function scale(transform, x, y) {\n return multiply(transform, set(tmp_, x, 0, 0, y, 0, 0));\n}\n\n/**\n * Creates a scale transform.\n * @param {!Transform} target Transform to overwrite.\n * @param {number} x Scale factor x.\n * @param {number} y Scale factor y.\n * @return {!Transform} The scale transform.\n */\nexport function makeScale(target, x, y) {\n return set(target, x, 0, 0, y, 0, 0);\n}\n\n/**\n * Applies translation to the given transform.\n * @param {!Transform} transform Transform.\n * @param {number} dx Translation x.\n * @param {number} dy Translation y.\n * @return {!Transform} The translated transform.\n */\nexport function translate(transform, dx, dy) {\n return multiply(transform, set(tmp_, 1, 0, 0, 1, dx, dy));\n}\n\n/**\n * Creates a composite transform given an initial translation, scale, rotation, and\n * final translation (in that order only, not commutative).\n * @param {!Transform} transform The transform (will be modified in place).\n * @param {number} dx1 Initial translation x.\n * @param {number} dy1 Initial translation y.\n * @param {number} sx Scale factor x.\n * @param {number} sy Scale factor y.\n * @param {number} angle Rotation (in counter-clockwise radians).\n * @param {number} dx2 Final translation x.\n * @param {number} dy2 Final translation y.\n * @return {!Transform} The composite transform.\n */\nexport function compose(transform, dx1, dy1, sx, sy, angle, dx2, dy2) {\n const sin = Math.sin(angle);\n const cos = Math.cos(angle);\n transform[0] = sx * cos;\n transform[1] = sy * sin;\n transform[2] = -sx * sin;\n transform[3] = sy * cos;\n transform[4] = dx2 * sx * cos - dy2 * sx * sin + dx1;\n transform[5] = dx2 * sy * sin + dy2 * sy * cos + dy1;\n return transform;\n}\n\n/**\n * Creates a composite transform given an initial translation, scale, rotation, and\n * final translation (in that order only, not commutative). The resulting transform\n * string can be applied as `transform` property of an HTMLElement's style.\n * @param {number} dx1 Initial translation x.\n * @param {number} dy1 Initial translation y.\n * @param {number} sx Scale factor x.\n * @param {number} sy Scale factor y.\n * @param {number} angle Rotation (in counter-clockwise radians).\n * @param {number} dx2 Final translation x.\n * @param {number} dy2 Final translation y.\n * @return {string} The composite css transform.\n * @api\n */\nexport function composeCssTransform(dx1, dy1, sx, sy, angle, dx2, dy2) {\n return toString(compose(create(), dx1, dy1, sx, sy, angle, dx2, dy2));\n}\n\n/**\n * Invert the given transform.\n * @param {!Transform} source The source transform to invert.\n * @return {!Transform} The inverted (source) transform.\n */\nexport function invert(source) {\n return makeInverse(source, source);\n}\n\n/**\n * Invert the given transform.\n * @param {!Transform} target Transform to be set as the inverse of\n * the source transform.\n * @param {!Transform} source The source transform to invert.\n * @return {!Transform} The inverted (target) transform.\n */\nexport function makeInverse(target, source) {\n const det = determinant(source);\n assert(det !== 0, 'Transformation matrix cannot be inverted');\n\n const a = source[0];\n const b = source[1];\n const c = source[2];\n const d = source[3];\n const e = source[4];\n const f = source[5];\n\n target[0] = d / det;\n target[1] = -b / det;\n target[2] = -c / det;\n target[3] = a / det;\n target[4] = (c * f - d * e) / det;\n target[5] = -(a * f - b * e) / det;\n\n return target;\n}\n\n/**\n * Returns the determinant of the given matrix.\n * @param {!Transform} mat Matrix.\n * @return {number} Determinant.\n */\nexport function determinant(mat) {\n return mat[0] * mat[3] - mat[1] * mat[2];\n}\n\n/**\n * @type {Array}\n */\nconst matrixPrecision = [1e5, 1e5, 1e5, 1e5, 2, 2];\n\n/**\n * A matrix string version of the transform. This can be used\n * for CSS transforms.\n * @param {!Transform} mat Matrix.\n * @return {string} The transform as a string.\n */\nexport function toString(mat) {\n const transformString = 'matrix(' + mat.join(', ') + ')';\n return transformString;\n}\n\n/**\n * Create a transform from a CSS transform matrix string.\n * @param {string} cssTransform The CSS string to parse.\n * @return {!Transform} The transform.\n */\nexport function fromString(cssTransform) {\n const values = cssTransform.substring(7, cssTransform.length - 1).split(',');\n return values.map(parseFloat);\n}\n\n/**\n * Compare two matrices for equality.\n * @param {!string} cssTransform1 A CSS transform matrix string.\n * @param {!string} cssTransform2 A CSS transform matrix string.\n * @return {boolean} The two matrices are equal.\n */\nexport function equivalent(cssTransform1, cssTransform2) {\n const mat1 = fromString(cssTransform1);\n const mat2 = fromString(cssTransform2);\n for (let i = 0; i < 6; ++i) {\n if (Math.round((mat1[i] - mat2[i]) * matrixPrecision[i]) !== 0) {\n return false;\n }\n }\n return true;\n}\n","/**\n * @module ol/geom/flat/transform\n */\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {import(\"../../transform.js\").Transform} transform Transform.\n * @param {Array} [dest] Destination.\n * @param {number} [destinationStride] Stride of destination coordinates; if unspecified, assumed to be 2.\n * @return {Array} Transformed coordinates.\n */\nexport function transform2D(\n flatCoordinates,\n offset,\n end,\n stride,\n transform,\n dest,\n destinationStride,\n) {\n dest = dest ? dest : [];\n destinationStride = destinationStride ? destinationStride : 2;\n let i = 0;\n for (let j = offset; j < end; j += stride) {\n const x = flatCoordinates[j];\n const y = flatCoordinates[j + 1];\n dest[i++] = transform[0] * x + transform[2] * y + transform[4];\n dest[i++] = transform[1] * x + transform[3] * y + transform[5];\n\n for (let k = 2; k < destinationStride; k++) {\n dest[i++] = flatCoordinates[j + k];\n }\n }\n\n if (dest && dest.length != i) {\n dest.length = i;\n }\n return dest;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} angle Angle.\n * @param {Array} anchor Rotation anchor point.\n * @param {Array} [dest] Destination.\n * @return {Array} Transformed coordinates.\n */\nexport function rotate(\n flatCoordinates,\n offset,\n end,\n stride,\n angle,\n anchor,\n dest,\n) {\n dest = dest ? dest : [];\n const cos = Math.cos(angle);\n const sin = Math.sin(angle);\n const anchorX = anchor[0];\n const anchorY = anchor[1];\n let i = 0;\n for (let j = offset; j < end; j += stride) {\n const deltaX = flatCoordinates[j] - anchorX;\n const deltaY = flatCoordinates[j + 1] - anchorY;\n dest[i++] = anchorX + deltaX * cos - deltaY * sin;\n dest[i++] = anchorY + deltaX * sin + deltaY * cos;\n for (let k = j + 2; k < j + stride; ++k) {\n dest[i++] = flatCoordinates[k];\n }\n }\n if (dest && dest.length != i) {\n dest.length = i;\n }\n return dest;\n}\n\n/**\n * Scale the coordinates.\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} sx Scale factor in the x-direction.\n * @param {number} sy Scale factor in the y-direction.\n * @param {Array} anchor Scale anchor point.\n * @param {Array} [dest] Destination.\n * @return {Array} Transformed coordinates.\n */\nexport function scale(\n flatCoordinates,\n offset,\n end,\n stride,\n sx,\n sy,\n anchor,\n dest,\n) {\n dest = dest ? dest : [];\n const anchorX = anchor[0];\n const anchorY = anchor[1];\n let i = 0;\n for (let j = offset; j < end; j += stride) {\n const deltaX = flatCoordinates[j] - anchorX;\n const deltaY = flatCoordinates[j + 1] - anchorY;\n dest[i++] = anchorX + sx * deltaX;\n dest[i++] = anchorY + sy * deltaY;\n for (let k = j + 2; k < j + stride; ++k) {\n dest[i++] = flatCoordinates[k];\n }\n }\n if (dest && dest.length != i) {\n dest.length = i;\n }\n return dest;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} deltaX Delta X.\n * @param {number} deltaY Delta Y.\n * @param {Array} [dest] Destination.\n * @return {Array} Transformed coordinates.\n */\nexport function translate(\n flatCoordinates,\n offset,\n end,\n stride,\n deltaX,\n deltaY,\n dest,\n) {\n dest = dest ? dest : [];\n let i = 0;\n for (let j = offset; j < end; j += stride) {\n dest[i++] = flatCoordinates[j] + deltaX;\n dest[i++] = flatCoordinates[j + 1] + deltaY;\n for (let k = j + 2; k < j + stride; ++k) {\n dest[i++] = flatCoordinates[k];\n }\n }\n if (dest && dest.length != i) {\n dest.length = i;\n }\n return dest;\n}\n","/**\n * @module ol/geom/Geometry\n */\nimport BaseObject from '../Object.js';\nimport {\n createEmpty,\n createOrUpdateEmpty,\n getHeight,\n returnOrUpdate,\n} from '../extent.js';\nimport {memoizeOne} from '../functions.js';\nimport {get as getProjection, getTransform} from '../proj.js';\nimport {\n compose as composeTransform,\n create as createTransform,\n} from '../transform.js';\nimport {abstract} from '../util.js';\nimport {transform2D} from './flat/transform.js';\n\n/**\n * @typedef {'XY' | 'XYZ' | 'XYM' | 'XYZM'} GeometryLayout\n * The coordinate layout for geometries, indicating whether a 3rd or 4th z ('Z')\n * or measure ('M') coordinate is available.\n */\n\n/**\n * @typedef {'Point' | 'LineString' | 'LinearRing' | 'Polygon' | 'MultiPoint' | 'MultiLineString' | 'MultiPolygon' | 'GeometryCollection' | 'Circle'} Type\n * The geometry type. One of `'Point'`, `'LineString'`, `'LinearRing'`,\n * `'Polygon'`, `'MultiPoint'`, `'MultiLineString'`, `'MultiPolygon'`,\n * `'GeometryCollection'`, or `'Circle'`.\n */\n\n/**\n * @type {import(\"../transform.js\").Transform}\n */\nconst tmpTransform = createTransform();\n\n/** @type {import('../coordinate.js').Coordinate} */\nconst tmpPoint = [NaN, NaN];\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * Base class for vector geometries.\n *\n * To get notified of changes to the geometry, register a listener for the\n * generic `change` event on your geometry instance.\n *\n * @abstract\n * @api\n */\nclass Geometry extends BaseObject {\n constructor() {\n super();\n\n /**\n * @private\n * @type {import(\"../extent.js\").Extent}\n */\n this.extent_ = createEmpty();\n\n /**\n * @private\n * @type {number}\n */\n this.extentRevision_ = -1;\n\n /**\n * @protected\n * @type {number}\n */\n this.simplifiedGeometryMaxMinSquaredTolerance = 0;\n\n /**\n * @protected\n * @type {number}\n */\n this.simplifiedGeometryRevision = 0;\n\n /**\n * Get a transformed and simplified version of the geometry.\n * @abstract\n * @param {number} revision The geometry revision.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {import(\"../proj.js\").TransformFunction} [transform] Optional transform function.\n * @return {Geometry} Simplified geometry.\n */\n this.simplifyTransformedInternal = memoizeOne(\n (revision, squaredTolerance, transform) => {\n if (!transform) {\n return this.getSimplifiedGeometry(squaredTolerance);\n }\n const clone = this.clone();\n clone.applyTransform(transform);\n return clone.getSimplifiedGeometry(squaredTolerance);\n },\n );\n }\n\n /**\n * Get a transformed and simplified version of the geometry.\n * @abstract\n * @param {number} squaredTolerance Squared tolerance.\n * @param {import(\"../proj.js\").TransformFunction} [transform] Optional transform function.\n * @return {Geometry} Simplified geometry.\n */\n simplifyTransformed(squaredTolerance, transform) {\n return this.simplifyTransformedInternal(\n this.getRevision(),\n squaredTolerance,\n transform,\n );\n }\n\n /**\n * Make a complete copy of the geometry.\n * @abstract\n * @return {!Geometry} Clone.\n */\n clone() {\n return abstract();\n }\n\n /**\n * @abstract\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n return abstract();\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n */\n containsXY(x, y) {\n return this.closestPointXY(x, y, tmpPoint, Number.MIN_VALUE) === 0;\n }\n\n /**\n * Return the closest point of the geometry to the passed point as\n * {@link module:ol/coordinate~Coordinate coordinate}.\n * @param {import(\"../coordinate.js\").Coordinate} point Point.\n * @param {import(\"../coordinate.js\").Coordinate} [closestPoint] Closest point.\n * @return {import(\"../coordinate.js\").Coordinate} Closest point.\n * @api\n */\n getClosestPoint(point, closestPoint) {\n closestPoint = closestPoint ? closestPoint : [NaN, NaN];\n this.closestPointXY(point[0], point[1], closestPoint, Infinity);\n return closestPoint;\n }\n\n /**\n * Returns true if this geometry includes the specified coordinate. If the\n * coordinate is on the boundary of the geometry, returns false.\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @return {boolean} Contains coordinate.\n * @api\n */\n intersectsCoordinate(coordinate) {\n return this.containsXY(coordinate[0], coordinate[1]);\n }\n\n /**\n * @abstract\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @protected\n * @return {import(\"../extent.js\").Extent} extent Extent.\n */\n computeExtent(extent) {\n return abstract();\n }\n\n /**\n * Get the extent of the geometry.\n * @param {import(\"../extent.js\").Extent} [extent] Extent.\n * @return {import(\"../extent.js\").Extent} extent Extent.\n * @api\n */\n getExtent(extent) {\n if (this.extentRevision_ != this.getRevision()) {\n const extent = this.computeExtent(this.extent_);\n if (isNaN(extent[0]) || isNaN(extent[1])) {\n createOrUpdateEmpty(extent);\n }\n this.extentRevision_ = this.getRevision();\n }\n return returnOrUpdate(this.extent_, extent);\n }\n\n /**\n * Rotate the geometry around a given coordinate. This modifies the geometry\n * coordinates in place.\n * @abstract\n * @param {number} angle Rotation angle in radians.\n * @param {import(\"../coordinate.js\").Coordinate} anchor The rotation center.\n * @api\n */\n rotate(angle, anchor) {\n abstract();\n }\n\n /**\n * Scale the geometry (with an optional origin). This modifies the geometry\n * coordinates in place.\n * @abstract\n * @param {number} sx The scaling factor in the x-direction.\n * @param {number} [sy] The scaling factor in the y-direction (defaults to sx).\n * @param {import(\"../coordinate.js\").Coordinate} [anchor] The scale origin (defaults to the center\n * of the geometry extent).\n * @api\n */\n scale(sx, sy, anchor) {\n abstract();\n }\n\n /**\n * Create a simplified version of this geometry. For linestrings, this uses\n * the [Douglas Peucker](https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm)\n * algorithm. For polygons, a quantization-based\n * simplification is used to preserve topology.\n * @param {number} tolerance The tolerance distance for simplification.\n * @return {Geometry} A new, simplified version of the original geometry.\n * @api\n */\n simplify(tolerance) {\n return this.getSimplifiedGeometry(tolerance * tolerance);\n }\n\n /**\n * Create a simplified version of this geometry using the Douglas Peucker\n * algorithm.\n * See https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm.\n * @abstract\n * @param {number} squaredTolerance Squared tolerance.\n * @return {Geometry} Simplified geometry.\n */\n getSimplifiedGeometry(squaredTolerance) {\n return abstract();\n }\n\n /**\n * Get the type of this geometry.\n * @abstract\n * @return {Type} Geometry type.\n */\n getType() {\n return abstract();\n }\n\n /**\n * Apply a transform function to the coordinates of the geometry.\n * The geometry is modified in place.\n * If you do not want the geometry modified in place, first `clone()` it and\n * then use this function on the clone.\n * @abstract\n * @param {import(\"../proj.js\").TransformFunction} transformFn Transform function.\n * Called with a flat array of geometry coordinates.\n */\n applyTransform(transformFn) {\n abstract();\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @abstract\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n */\n intersectsExtent(extent) {\n return abstract();\n }\n\n /**\n * Translate the geometry. This modifies the geometry coordinates in place. If\n * instead you want a new geometry, first `clone()` this geometry.\n * @abstract\n * @param {number} deltaX Delta X.\n * @param {number} deltaY Delta Y.\n * @api\n */\n translate(deltaX, deltaY) {\n abstract();\n }\n\n /**\n * Transform each coordinate of the geometry from one coordinate reference\n * system to another. The geometry is modified in place.\n * For example, a line will be transformed to a line and a circle to a circle.\n * If you do not want the geometry modified in place, first `clone()` it and\n * then use this function on the clone.\n *\n * @param {import(\"../proj.js\").ProjectionLike} source The current projection. Can be a\n * string identifier or a {@link module:ol/proj/Projection~Projection} object.\n * @param {import(\"../proj.js\").ProjectionLike} destination The desired projection. Can be a\n * string identifier or a {@link module:ol/proj/Projection~Projection} object.\n * @return {this} This geometry. Note that original geometry is\n * modified in place.\n * @api\n */\n transform(source, destination) {\n /** @type {import(\"../proj/Projection.js\").default} */\n const sourceProj = getProjection(source);\n const transformFn =\n sourceProj.getUnits() == 'tile-pixels'\n ? function (inCoordinates, outCoordinates, stride) {\n const pixelExtent = sourceProj.getExtent();\n const projectedExtent = sourceProj.getWorldExtent();\n const scale = getHeight(projectedExtent) / getHeight(pixelExtent);\n composeTransform(\n tmpTransform,\n projectedExtent[0],\n projectedExtent[3],\n scale,\n -scale,\n 0,\n 0,\n 0,\n );\n const transformed = transform2D(\n inCoordinates,\n 0,\n inCoordinates.length,\n stride,\n tmpTransform,\n outCoordinates,\n );\n const projTransform = getTransform(sourceProj, destination);\n if (projTransform) {\n return projTransform(transformed, transformed, stride);\n }\n return transformed;\n }\n : getTransform(sourceProj, destination);\n this.applyTransform(transformFn);\n return this;\n }\n}\n\nexport default Geometry;\n","/**\n * @module ol/geom/SimpleGeometry\n */\nimport {createOrUpdateFromFlatCoordinates, getCenter} from '../extent.js';\nimport {abstract} from '../util.js';\nimport Geometry from './Geometry.js';\nimport {rotate, scale, transform2D, translate} from './flat/transform.js';\n\n/**\n * @classdesc\n * Abstract base class; only used for creating subclasses; do not instantiate\n * in apps, as cannot be rendered.\n *\n * @abstract\n * @api\n */\nclass SimpleGeometry extends Geometry {\n constructor() {\n super();\n\n /**\n * @protected\n * @type {import(\"./Geometry.js\").GeometryLayout}\n */\n this.layout = 'XY';\n\n /**\n * @protected\n * @type {number}\n */\n this.stride = 2;\n\n /**\n * @protected\n * @type {Array}\n */\n this.flatCoordinates;\n }\n\n /**\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @protected\n * @return {import(\"../extent.js\").Extent} extent Extent.\n * @override\n */\n computeExtent(extent) {\n return createOrUpdateFromFlatCoordinates(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n extent,\n );\n }\n\n /**\n * @abstract\n * @return {Array<*> | null} Coordinates.\n */\n getCoordinates() {\n return abstract();\n }\n\n /**\n * Return the first coordinate of the geometry.\n * @return {import(\"../coordinate.js\").Coordinate} First coordinate.\n * @api\n */\n getFirstCoordinate() {\n return this.flatCoordinates.slice(0, this.stride);\n }\n\n /**\n * @return {Array} Flat coordinates.\n */\n getFlatCoordinates() {\n return this.flatCoordinates;\n }\n\n /**\n * Return the last coordinate of the geometry.\n * @return {import(\"../coordinate.js\").Coordinate} Last point.\n * @api\n */\n getLastCoordinate() {\n return this.flatCoordinates.slice(\n this.flatCoordinates.length - this.stride,\n );\n }\n\n /**\n * Return the {@link import(\"./Geometry.js\").GeometryLayout layout} of the geometry.\n * @return {import(\"./Geometry.js\").GeometryLayout} Layout.\n * @api\n */\n getLayout() {\n return this.layout;\n }\n\n /**\n * Create a simplified version of this geometry using the Douglas Peucker algorithm.\n * @param {number} squaredTolerance Squared tolerance.\n * @return {SimpleGeometry} Simplified geometry.\n * @override\n */\n getSimplifiedGeometry(squaredTolerance) {\n if (this.simplifiedGeometryRevision !== this.getRevision()) {\n this.simplifiedGeometryMaxMinSquaredTolerance = 0;\n this.simplifiedGeometryRevision = this.getRevision();\n }\n // If squaredTolerance is negative or if we know that simplification will not\n // have any effect then just return this.\n if (\n squaredTolerance < 0 ||\n (this.simplifiedGeometryMaxMinSquaredTolerance !== 0 &&\n squaredTolerance <= this.simplifiedGeometryMaxMinSquaredTolerance)\n ) {\n return this;\n }\n\n const simplifiedGeometry =\n this.getSimplifiedGeometryInternal(squaredTolerance);\n const simplifiedFlatCoordinates = simplifiedGeometry.getFlatCoordinates();\n if (simplifiedFlatCoordinates.length < this.flatCoordinates.length) {\n return simplifiedGeometry;\n }\n // Simplification did not actually remove any coordinates. We now know\n // that any calls to getSimplifiedGeometry with a squaredTolerance less\n // than or equal to the current squaredTolerance will also not have any\n // effect. This allows us to short circuit simplification (saving CPU\n // cycles) and prevents the cache of simplified geometries from filling\n // up with useless identical copies of this geometry (saving memory).\n this.simplifiedGeometryMaxMinSquaredTolerance = squaredTolerance;\n return this;\n }\n\n /**\n * @param {number} squaredTolerance Squared tolerance.\n * @return {SimpleGeometry} Simplified geometry.\n * @protected\n */\n getSimplifiedGeometryInternal(squaredTolerance) {\n return this;\n }\n\n /**\n * @return {number} Stride.\n */\n getStride() {\n return this.stride;\n }\n\n /**\n * @param {import(\"./Geometry.js\").GeometryLayout} layout Layout.\n * @param {Array} flatCoordinates Flat coordinates.\n */\n setFlatCoordinates(layout, flatCoordinates) {\n this.stride = getStrideForLayout(layout);\n this.layout = layout;\n this.flatCoordinates = flatCoordinates;\n }\n\n /**\n * @abstract\n * @param {!Array<*>} coordinates Coordinates.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n */\n setCoordinates(coordinates, layout) {\n abstract();\n }\n\n /**\n * @param {import(\"./Geometry.js\").GeometryLayout|undefined} layout Layout.\n * @param {Array<*>} coordinates Coordinates.\n * @param {number} nesting Nesting.\n * @protected\n */\n setLayout(layout, coordinates, nesting) {\n let stride;\n if (layout) {\n stride = getStrideForLayout(layout);\n } else {\n for (let i = 0; i < nesting; ++i) {\n if (coordinates.length === 0) {\n this.layout = 'XY';\n this.stride = 2;\n return;\n }\n coordinates = /** @type {Array} */ (coordinates[0]);\n }\n stride = coordinates.length;\n layout = getLayoutForStride(stride);\n }\n this.layout = layout;\n this.stride = stride;\n }\n\n /**\n * Apply a transform function to the coordinates of the geometry.\n * The geometry is modified in place.\n * If you do not want the geometry modified in place, first `clone()` it and\n * then use this function on the clone.\n * @param {import(\"../proj.js\").TransformFunction} transformFn Transform function.\n * Called with a flat array of geometry coordinates.\n * @api\n * @override\n */\n applyTransform(transformFn) {\n if (this.flatCoordinates) {\n transformFn(\n this.flatCoordinates,\n this.flatCoordinates,\n this.layout.startsWith('XYZ') ? 3 : 2,\n this.stride,\n );\n this.changed();\n }\n }\n\n /**\n * Rotate the geometry around a given coordinate. This modifies the geometry\n * coordinates in place.\n * @param {number} angle Rotation angle in counter-clockwise radians.\n * @param {import(\"../coordinate.js\").Coordinate} anchor The rotation center.\n * @api\n * @override\n */\n rotate(angle, anchor) {\n const flatCoordinates = this.getFlatCoordinates();\n if (flatCoordinates) {\n const stride = this.getStride();\n rotate(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n stride,\n angle,\n anchor,\n flatCoordinates,\n );\n this.changed();\n }\n }\n\n /**\n * Scale the geometry (with an optional origin). This modifies the geometry\n * coordinates in place.\n * @param {number} sx The scaling factor in the x-direction.\n * @param {number} [sy] The scaling factor in the y-direction (defaults to sx).\n * @param {import(\"../coordinate.js\").Coordinate} [anchor] The scale origin (defaults to the center\n * of the geometry extent).\n * @api\n * @override\n */\n scale(sx, sy, anchor) {\n if (sy === undefined) {\n sy = sx;\n }\n if (!anchor) {\n anchor = getCenter(this.getExtent());\n }\n const flatCoordinates = this.getFlatCoordinates();\n if (flatCoordinates) {\n const stride = this.getStride();\n scale(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n stride,\n sx,\n sy,\n anchor,\n flatCoordinates,\n );\n this.changed();\n }\n }\n\n /**\n * Translate the geometry. This modifies the geometry coordinates in place. If\n * instead you want a new geometry, first `clone()` this geometry.\n * @param {number} deltaX Delta X.\n * @param {number} deltaY Delta Y.\n * @api\n * @override\n */\n translate(deltaX, deltaY) {\n const flatCoordinates = this.getFlatCoordinates();\n if (flatCoordinates) {\n const stride = this.getStride();\n translate(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n stride,\n deltaX,\n deltaY,\n flatCoordinates,\n );\n this.changed();\n }\n }\n}\n\n/**\n * @param {number} stride Stride.\n * @return {import(\"./Geometry.js\").GeometryLayout} layout Layout.\n */\nexport function getLayoutForStride(stride) {\n let layout;\n if (stride == 2) {\n layout = 'XY';\n } else if (stride == 3) {\n layout = 'XYZ';\n } else if (stride == 4) {\n layout = 'XYZM';\n }\n return /** @type {import(\"./Geometry.js\").GeometryLayout} */ (layout);\n}\n\n/**\n * @param {import(\"./Geometry.js\").GeometryLayout} layout Layout.\n * @return {number} Stride.\n */\nexport function getStrideForLayout(layout) {\n let stride;\n if (layout == 'XY') {\n stride = 2;\n } else if (layout == 'XYZ' || layout == 'XYM') {\n stride = 3;\n } else if (layout == 'XYZM') {\n stride = 4;\n }\n return /** @type {number} */ (stride);\n}\n\n/**\n * @param {SimpleGeometry} simpleGeometry Simple geometry.\n * @param {import(\"../transform.js\").Transform} transform Transform.\n * @param {Array} [dest] Destination.\n * @return {Array} Transformed flat coordinates.\n */\nexport function transformGeom2D(simpleGeometry, transform, dest) {\n const flatCoordinates = simpleGeometry.getFlatCoordinates();\n if (!flatCoordinates) {\n return null;\n }\n const stride = simpleGeometry.getStride();\n return transform2D(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n stride,\n transform,\n dest,\n );\n}\n\nexport default SimpleGeometry;\n","/**\n * @module ol/geom/flat/area\n */\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @return {number} Area.\n */\nexport function linearRing(flatCoordinates, offset, end, stride) {\n let twiceArea = 0;\n const x0 = flatCoordinates[end - stride];\n const y0 = flatCoordinates[end - stride + 1];\n let dx1 = 0;\n let dy1 = 0;\n for (; offset < end; offset += stride) {\n const dx2 = flatCoordinates[offset] - x0;\n const dy2 = flatCoordinates[offset + 1] - y0;\n twiceArea += dy1 * dx2 - dx1 * dy2;\n dx1 = dx2;\n dy1 = dy2;\n }\n return twiceArea / 2;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @return {number} Area.\n */\nexport function linearRings(flatCoordinates, offset, ends, stride) {\n let area = 0;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n area += linearRing(flatCoordinates, offset, end, stride);\n offset = end;\n }\n return area;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Endss.\n * @param {number} stride Stride.\n * @return {number} Area.\n */\nexport function linearRingss(flatCoordinates, offset, endss, stride) {\n let area = 0;\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n area += linearRings(flatCoordinates, offset, ends, stride);\n offset = ends[ends.length - 1];\n }\n return area;\n}\n","/**\n * @module ol/geom/flat/closest\n */\nimport {lerp, squaredDistance as squaredDx} from '../../math.js';\n\n/**\n * Returns the point on the 2D line segment flatCoordinates[offset1] to\n * flatCoordinates[offset2] that is closest to the point (x, y). Extra\n * dimensions are linearly interpolated.\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset1 Offset 1.\n * @param {number} offset2 Offset 2.\n * @param {number} stride Stride.\n * @param {number} x X.\n * @param {number} y Y.\n * @param {Array} closestPoint Closest point.\n */\nfunction assignClosest(\n flatCoordinates,\n offset1,\n offset2,\n stride,\n x,\n y,\n closestPoint,\n) {\n const x1 = flatCoordinates[offset1];\n const y1 = flatCoordinates[offset1 + 1];\n const dx = flatCoordinates[offset2] - x1;\n const dy = flatCoordinates[offset2 + 1] - y1;\n let offset;\n if (dx === 0 && dy === 0) {\n offset = offset1;\n } else {\n const t = ((x - x1) * dx + (y - y1) * dy) / (dx * dx + dy * dy);\n if (t > 1) {\n offset = offset2;\n } else if (t > 0) {\n for (let i = 0; i < stride; ++i) {\n closestPoint[i] = lerp(\n flatCoordinates[offset1 + i],\n flatCoordinates[offset2 + i],\n t,\n );\n }\n closestPoint.length = stride;\n return;\n } else {\n offset = offset1;\n }\n }\n for (let i = 0; i < stride; ++i) {\n closestPoint[i] = flatCoordinates[offset + i];\n }\n closestPoint.length = stride;\n}\n\n/**\n * Return the squared of the largest distance between any pair of consecutive\n * coordinates.\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} max Max squared delta.\n * @return {number} Max squared delta.\n */\nexport function maxSquaredDelta(flatCoordinates, offset, end, stride, max) {\n let x1 = flatCoordinates[offset];\n let y1 = flatCoordinates[offset + 1];\n for (offset += stride; offset < end; offset += stride) {\n const x2 = flatCoordinates[offset];\n const y2 = flatCoordinates[offset + 1];\n const squaredDelta = squaredDx(x1, y1, x2, y2);\n if (squaredDelta > max) {\n max = squaredDelta;\n }\n x1 = x2;\n y1 = y2;\n }\n return max;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @param {number} max Max squared delta.\n * @return {number} Max squared delta.\n */\nexport function arrayMaxSquaredDelta(\n flatCoordinates,\n offset,\n ends,\n stride,\n max,\n) {\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n max = maxSquaredDelta(flatCoordinates, offset, end, stride, max);\n offset = end;\n }\n return max;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Endss.\n * @param {number} stride Stride.\n * @param {number} max Max squared delta.\n * @return {number} Max squared delta.\n */\nexport function multiArrayMaxSquaredDelta(\n flatCoordinates,\n offset,\n endss,\n stride,\n max,\n) {\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n max = arrayMaxSquaredDelta(flatCoordinates, offset, ends, stride, max);\n offset = ends[ends.length - 1];\n }\n return max;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} maxDelta Max delta.\n * @param {boolean} isRing Is ring.\n * @param {number} x X.\n * @param {number} y Y.\n * @param {Array} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @param {Array} [tmpPoint] Temporary point object.\n * @return {number} Minimum squared distance.\n */\nexport function assignClosestPoint(\n flatCoordinates,\n offset,\n end,\n stride,\n maxDelta,\n isRing,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n tmpPoint,\n) {\n if (offset == end) {\n return minSquaredDistance;\n }\n let i, squaredDistance;\n if (maxDelta === 0) {\n // All points are identical, so just test the first point.\n squaredDistance = squaredDx(\n x,\n y,\n flatCoordinates[offset],\n flatCoordinates[offset + 1],\n );\n if (squaredDistance < minSquaredDistance) {\n for (i = 0; i < stride; ++i) {\n closestPoint[i] = flatCoordinates[offset + i];\n }\n closestPoint.length = stride;\n return squaredDistance;\n }\n return minSquaredDistance;\n }\n tmpPoint = tmpPoint ? tmpPoint : [NaN, NaN];\n let index = offset + stride;\n while (index < end) {\n assignClosest(\n flatCoordinates,\n index - stride,\n index,\n stride,\n x,\n y,\n tmpPoint,\n );\n squaredDistance = squaredDx(x, y, tmpPoint[0], tmpPoint[1]);\n if (squaredDistance < minSquaredDistance) {\n minSquaredDistance = squaredDistance;\n for (i = 0; i < stride; ++i) {\n closestPoint[i] = tmpPoint[i];\n }\n closestPoint.length = stride;\n index += stride;\n } else {\n // Skip ahead multiple points, because we know that all the skipped\n // points cannot be any closer than the closest point we have found so\n // far. We know this because we know how close the current point is, how\n // close the closest point we have found so far is, and the maximum\n // distance between consecutive points. For example, if we're currently\n // at distance 10, the best we've found so far is 3, and that the maximum\n // distance between consecutive points is 2, then we'll need to skip at\n // least (10 - 3) / 2 == 3 (rounded down) points to have any chance of\n // finding a closer point. We use Math.max(..., 1) to ensure that we\n // always advance at least one point, to avoid an infinite loop.\n index +=\n stride *\n Math.max(\n ((Math.sqrt(squaredDistance) - Math.sqrt(minSquaredDistance)) /\n maxDelta) |\n 0,\n 1,\n );\n }\n }\n if (isRing) {\n // Check the closing segment.\n assignClosest(\n flatCoordinates,\n end - stride,\n offset,\n stride,\n x,\n y,\n tmpPoint,\n );\n squaredDistance = squaredDx(x, y, tmpPoint[0], tmpPoint[1]);\n if (squaredDistance < minSquaredDistance) {\n minSquaredDistance = squaredDistance;\n for (i = 0; i < stride; ++i) {\n closestPoint[i] = tmpPoint[i];\n }\n closestPoint.length = stride;\n }\n }\n return minSquaredDistance;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @param {number} maxDelta Max delta.\n * @param {boolean} isRing Is ring.\n * @param {number} x X.\n * @param {number} y Y.\n * @param {Array} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @param {Array} [tmpPoint] Temporary point object.\n * @return {number} Minimum squared distance.\n */\nexport function assignClosestArrayPoint(\n flatCoordinates,\n offset,\n ends,\n stride,\n maxDelta,\n isRing,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n tmpPoint,\n) {\n tmpPoint = tmpPoint ? tmpPoint : [NaN, NaN];\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n minSquaredDistance = assignClosestPoint(\n flatCoordinates,\n offset,\n end,\n stride,\n maxDelta,\n isRing,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n tmpPoint,\n );\n offset = end;\n }\n return minSquaredDistance;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Endss.\n * @param {number} stride Stride.\n * @param {number} maxDelta Max delta.\n * @param {boolean} isRing Is ring.\n * @param {number} x X.\n * @param {number} y Y.\n * @param {Array} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @param {Array} [tmpPoint] Temporary point object.\n * @return {number} Minimum squared distance.\n */\nexport function assignClosestMultiArrayPoint(\n flatCoordinates,\n offset,\n endss,\n stride,\n maxDelta,\n isRing,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n tmpPoint,\n) {\n tmpPoint = tmpPoint ? tmpPoint : [NaN, NaN];\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n minSquaredDistance = assignClosestArrayPoint(\n flatCoordinates,\n offset,\n ends,\n stride,\n maxDelta,\n isRing,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n tmpPoint,\n );\n offset = ends[ends.length - 1];\n }\n return minSquaredDistance;\n}\n","/**\n * @module ol/geom/flat/deflate\n */\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {import(\"../../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {number} stride Stride.\n * @return {number} offset Offset.\n */\nexport function deflateCoordinate(flatCoordinates, offset, coordinate, stride) {\n for (let i = 0, ii = coordinate.length; i < ii; ++i) {\n flatCoordinates[offset++] = coordinate[i];\n }\n return offset;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} coordinates Coordinates.\n * @param {number} stride Stride.\n * @return {number} offset Offset.\n */\nexport function deflateCoordinates(\n flatCoordinates,\n offset,\n coordinates,\n stride,\n) {\n for (let i = 0, ii = coordinates.length; i < ii; ++i) {\n const coordinate = coordinates[i];\n for (let j = 0; j < stride; ++j) {\n flatCoordinates[offset++] = coordinate[j];\n }\n }\n return offset;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} coordinatess Coordinatess.\n * @param {number} stride Stride.\n * @param {Array} [ends] Ends.\n * @return {Array} Ends.\n */\nexport function deflateCoordinatesArray(\n flatCoordinates,\n offset,\n coordinatess,\n stride,\n ends,\n) {\n ends = ends ? ends : [];\n let i = 0;\n for (let j = 0, jj = coordinatess.length; j < jj; ++j) {\n const end = deflateCoordinates(\n flatCoordinates,\n offset,\n coordinatess[j],\n stride,\n );\n ends[i++] = end;\n offset = end;\n }\n ends.length = i;\n return ends;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>>} coordinatesss Coordinatesss.\n * @param {number} stride Stride.\n * @param {Array>} [endss] Endss.\n * @return {Array>} Endss.\n */\nexport function deflateMultiCoordinatesArray(\n flatCoordinates,\n offset,\n coordinatesss,\n stride,\n endss,\n) {\n endss = endss ? endss : [];\n let i = 0;\n for (let j = 0, jj = coordinatesss.length; j < jj; ++j) {\n const ends = deflateCoordinatesArray(\n flatCoordinates,\n offset,\n coordinatesss[j],\n stride,\n endss[i],\n );\n if (ends.length === 0) {\n ends[0] = offset;\n }\n endss[i++] = ends;\n offset = ends[ends.length - 1];\n }\n endss.length = i;\n return endss;\n}\n","/**\n * @module ol/geom/flat/inflate\n */\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {Array} [coordinates] Coordinates.\n * @return {Array} Coordinates.\n */\nexport function inflateCoordinates(\n flatCoordinates,\n offset,\n end,\n stride,\n coordinates,\n) {\n coordinates = coordinates !== undefined ? coordinates : [];\n let i = 0;\n for (let j = offset; j < end; j += stride) {\n coordinates[i++] = flatCoordinates.slice(j, j + stride);\n }\n coordinates.length = i;\n return coordinates;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @param {Array>} [coordinatess] Coordinatess.\n * @return {Array>} Coordinatess.\n */\nexport function inflateCoordinatesArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n coordinatess,\n) {\n coordinatess = coordinatess !== undefined ? coordinatess : [];\n let i = 0;\n for (let j = 0, jj = ends.length; j < jj; ++j) {\n const end = ends[j];\n coordinatess[i++] = inflateCoordinates(\n flatCoordinates,\n offset,\n end,\n stride,\n coordinatess[i],\n );\n offset = end;\n }\n coordinatess.length = i;\n return coordinatess;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Endss.\n * @param {number} stride Stride.\n * @param {Array>>} [coordinatesss]\n * Coordinatesss.\n * @return {Array>>} Coordinatesss.\n */\nexport function inflateMultiCoordinatesArray(\n flatCoordinates,\n offset,\n endss,\n stride,\n coordinatesss,\n) {\n coordinatesss = coordinatesss !== undefined ? coordinatesss : [];\n let i = 0;\n for (let j = 0, jj = endss.length; j < jj; ++j) {\n const ends = endss[j];\n coordinatesss[i++] =\n ends.length === 1 && ends[0] === offset\n ? []\n : inflateCoordinatesArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n coordinatesss[i],\n );\n offset = ends[ends.length - 1];\n }\n coordinatesss.length = i;\n return coordinatesss;\n}\n","/**\n * @module ol/geom/flat/simplify\n */\n// Based on simplify-js https://github.com/mourner/simplify-js\n// Copyright (c) 2012, Vladimir Agafonkin\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are met:\n//\n// 1. Redistributions of source code must retain the above copyright notice,\n// this list of conditions and the following disclaimer.\n//\n// 2. Redistributions in binary form must reproduce the above copyright\n// notice, this list of conditions and the following disclaimer in the\n// documentation and/or other materials provided with the distribution.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n// POSSIBILITY OF SUCH DAMAGE.\n\nimport {squaredDistance, squaredSegmentDistance} from '../../math.js';\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {boolean} highQuality Highest quality.\n * @param {Array} [simplifiedFlatCoordinates] Simplified flat\n * coordinates.\n * @return {Array} Simplified line string.\n */\nexport function simplifyLineString(\n flatCoordinates,\n offset,\n end,\n stride,\n squaredTolerance,\n highQuality,\n simplifiedFlatCoordinates,\n) {\n simplifiedFlatCoordinates =\n simplifiedFlatCoordinates !== undefined ? simplifiedFlatCoordinates : [];\n if (!highQuality) {\n end = radialDistance(\n flatCoordinates,\n offset,\n end,\n stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n 0,\n );\n flatCoordinates = simplifiedFlatCoordinates;\n offset = 0;\n stride = 2;\n }\n simplifiedFlatCoordinates.length = douglasPeucker(\n flatCoordinates,\n offset,\n end,\n stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n 0,\n );\n return simplifiedFlatCoordinates;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {Array} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @return {number} Simplified offset.\n */\nexport function douglasPeucker(\n flatCoordinates,\n offset,\n end,\n stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n) {\n const n = (end - offset) / stride;\n if (n < 3) {\n for (; offset < end; offset += stride) {\n simplifiedFlatCoordinates[simplifiedOffset++] = flatCoordinates[offset];\n simplifiedFlatCoordinates[simplifiedOffset++] =\n flatCoordinates[offset + 1];\n }\n return simplifiedOffset;\n }\n /** @type {Array} */\n const markers = new Array(n);\n markers[0] = 1;\n markers[n - 1] = 1;\n /** @type {Array} */\n const stack = [offset, end - stride];\n let index = 0;\n while (stack.length > 0) {\n const last = stack.pop();\n const first = stack.pop();\n let maxSquaredDistance = 0;\n const x1 = flatCoordinates[first];\n const y1 = flatCoordinates[first + 1];\n const x2 = flatCoordinates[last];\n const y2 = flatCoordinates[last + 1];\n for (let i = first + stride; i < last; i += stride) {\n const x = flatCoordinates[i];\n const y = flatCoordinates[i + 1];\n const squaredDistance = squaredSegmentDistance(x, y, x1, y1, x2, y2);\n if (squaredDistance > maxSquaredDistance) {\n index = i;\n maxSquaredDistance = squaredDistance;\n }\n }\n if (maxSquaredDistance > squaredTolerance) {\n markers[(index - offset) / stride] = 1;\n if (first + stride < index) {\n stack.push(first, index);\n }\n if (index + stride < last) {\n stack.push(index, last);\n }\n }\n }\n for (let i = 0; i < n; ++i) {\n if (markers[i]) {\n simplifiedFlatCoordinates[simplifiedOffset++] =\n flatCoordinates[offset + i * stride];\n simplifiedFlatCoordinates[simplifiedOffset++] =\n flatCoordinates[offset + i * stride + 1];\n }\n }\n return simplifiedOffset;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {Array} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @param {Array} simplifiedEnds Simplified ends.\n * @return {number} Simplified offset.\n */\nexport function douglasPeuckerArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n simplifiedEnds,\n) {\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n simplifiedOffset = douglasPeucker(\n flatCoordinates,\n offset,\n end,\n stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n );\n simplifiedEnds.push(simplifiedOffset);\n offset = end;\n }\n return simplifiedOffset;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Endss.\n * @param {number} stride Stride.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {Array} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @param {Array>} simplifiedEndss Simplified endss.\n * @return {number} Simplified offset.\n */\nexport function douglasPeuckerMultiArray(\n flatCoordinates,\n offset,\n endss,\n stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n simplifiedEndss,\n) {\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n /** @type {Array} */\n const simplifiedEnds = [];\n simplifiedOffset = douglasPeuckerArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n simplifiedEnds,\n );\n simplifiedEndss.push(simplifiedEnds);\n offset = ends[ends.length - 1];\n }\n return simplifiedOffset;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {Array} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @return {number} Simplified offset.\n */\nexport function radialDistance(\n flatCoordinates,\n offset,\n end,\n stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n) {\n if (end <= offset + stride) {\n // zero or one point, no simplification possible, so copy and return\n for (; offset < end; offset += stride) {\n simplifiedFlatCoordinates[simplifiedOffset++] = flatCoordinates[offset];\n simplifiedFlatCoordinates[simplifiedOffset++] =\n flatCoordinates[offset + 1];\n }\n return simplifiedOffset;\n }\n let x1 = flatCoordinates[offset];\n let y1 = flatCoordinates[offset + 1];\n // copy first point\n simplifiedFlatCoordinates[simplifiedOffset++] = x1;\n simplifiedFlatCoordinates[simplifiedOffset++] = y1;\n let x2 = x1;\n let y2 = y1;\n for (offset += stride; offset < end; offset += stride) {\n x2 = flatCoordinates[offset];\n y2 = flatCoordinates[offset + 1];\n if (squaredDistance(x1, y1, x2, y2) > squaredTolerance) {\n // copy point at offset\n simplifiedFlatCoordinates[simplifiedOffset++] = x2;\n simplifiedFlatCoordinates[simplifiedOffset++] = y2;\n x1 = x2;\n y1 = y2;\n }\n }\n if (x2 != x1 || y2 != y1) {\n // copy last point\n simplifiedFlatCoordinates[simplifiedOffset++] = x2;\n simplifiedFlatCoordinates[simplifiedOffset++] = y2;\n }\n return simplifiedOffset;\n}\n\n/**\n * @param {number} value Value.\n * @param {number} tolerance Tolerance.\n * @return {number} Rounded value.\n */\nexport function snap(value, tolerance) {\n return tolerance * Math.round(value / tolerance);\n}\n\n/**\n * Simplifies a line string using an algorithm designed by Tim Schaub.\n * Coordinates are snapped to the nearest value in a virtual grid and\n * consecutive duplicate coordinates are discarded. This effectively preserves\n * topology as the simplification of any subsection of a line string is\n * independent of the rest of the line string. This means that, for examples,\n * the common edge between two polygons will be simplified to the same line\n * string independently in both polygons. This implementation uses a single\n * pass over the coordinates and eliminates intermediate collinear points.\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} tolerance Tolerance.\n * @param {Array} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @return {number} Simplified offset.\n */\nexport function quantize(\n flatCoordinates,\n offset,\n end,\n stride,\n tolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n) {\n // do nothing if the line is empty\n if (offset == end) {\n return simplifiedOffset;\n }\n // snap the first coordinate (P1)\n let x1 = snap(flatCoordinates[offset], tolerance);\n let y1 = snap(flatCoordinates[offset + 1], tolerance);\n offset += stride;\n // add the first coordinate to the output\n simplifiedFlatCoordinates[simplifiedOffset++] = x1;\n simplifiedFlatCoordinates[simplifiedOffset++] = y1;\n // find the next coordinate that does not snap to the same value as the first\n // coordinate (P2)\n let x2, y2;\n do {\n x2 = snap(flatCoordinates[offset], tolerance);\n y2 = snap(flatCoordinates[offset + 1], tolerance);\n offset += stride;\n if (offset == end) {\n // all coordinates snap to the same value, the line collapses to a point\n // push the last snapped value anyway to ensure that the output contains\n // at least two points\n // FIXME should we really return at least two points anyway?\n simplifiedFlatCoordinates[simplifiedOffset++] = x2;\n simplifiedFlatCoordinates[simplifiedOffset++] = y2;\n return simplifiedOffset;\n }\n } while (x2 == x1 && y2 == y1);\n while (offset < end) {\n // snap the next coordinate (P3)\n const x3 = snap(flatCoordinates[offset], tolerance);\n const y3 = snap(flatCoordinates[offset + 1], tolerance);\n offset += stride;\n // skip P3 if it is equal to P2\n if (x3 == x2 && y3 == y2) {\n continue;\n }\n // calculate the delta between P1 and P2\n const dx1 = x2 - x1;\n const dy1 = y2 - y1;\n // calculate the delta between P3 and P1\n const dx2 = x3 - x1;\n const dy2 = y3 - y1;\n // if P1, P2, and P3 are colinear and P3 is further from P1 than P2 is from\n // P1 in the same direction then P2 is on the straight line between P1 and\n // P3\n if (\n dx1 * dy2 == dy1 * dx2 &&\n ((dx1 < 0 && dx2 < dx1) || dx1 == dx2 || (dx1 > 0 && dx2 > dx1)) &&\n ((dy1 < 0 && dy2 < dy1) || dy1 == dy2 || (dy1 > 0 && dy2 > dy1))\n ) {\n // discard P2 and set P2 = P3\n x2 = x3;\n y2 = y3;\n continue;\n }\n // either P1, P2, and P3 are not colinear, or they are colinear but P3 is\n // between P3 and P1 or on the opposite half of the line to P2. add P2,\n // and continue with P1 = P2 and P2 = P3\n simplifiedFlatCoordinates[simplifiedOffset++] = x2;\n simplifiedFlatCoordinates[simplifiedOffset++] = y2;\n x1 = x2;\n y1 = y2;\n x2 = x3;\n y2 = y3;\n }\n // add the last point (P2)\n simplifiedFlatCoordinates[simplifiedOffset++] = x2;\n simplifiedFlatCoordinates[simplifiedOffset++] = y2;\n return simplifiedOffset;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @param {number} tolerance Tolerance.\n * @param {Array} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @param {Array} simplifiedEnds Simplified ends.\n * @return {number} Simplified offset.\n */\nexport function quantizeArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n tolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n simplifiedEnds,\n) {\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n simplifiedOffset = quantize(\n flatCoordinates,\n offset,\n end,\n stride,\n tolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n );\n simplifiedEnds.push(simplifiedOffset);\n offset = end;\n }\n return simplifiedOffset;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Endss.\n * @param {number} stride Stride.\n * @param {number} tolerance Tolerance.\n * @param {Array} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @param {Array>} simplifiedEndss Simplified endss.\n * @return {number} Simplified offset.\n */\nexport function quantizeMultiArray(\n flatCoordinates,\n offset,\n endss,\n stride,\n tolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n simplifiedEndss,\n) {\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n /** @type {Array} */\n const simplifiedEnds = [];\n simplifiedOffset = quantizeArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n tolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n simplifiedEnds,\n );\n simplifiedEndss.push(simplifiedEnds);\n offset = ends[ends.length - 1];\n }\n return simplifiedOffset;\n}\n","/**\n * @module ol/geom/LinearRing\n */\nimport {closestSquaredDistanceXY} from '../extent.js';\nimport SimpleGeometry from './SimpleGeometry.js';\nimport {linearRing as linearRingArea} from './flat/area.js';\nimport {assignClosestPoint, maxSquaredDelta} from './flat/closest.js';\nimport {deflateCoordinates} from './flat/deflate.js';\nimport {inflateCoordinates} from './flat/inflate.js';\nimport {douglasPeucker} from './flat/simplify.js';\n\n/**\n * @classdesc\n * Linear ring geometry. Only used as part of polygon; cannot be rendered\n * on its own.\n *\n * @api\n */\nclass LinearRing extends SimpleGeometry {\n /**\n * @param {Array|Array} coordinates Coordinates.\n * For internal use, flat coordinates in combination with `layout` are also accepted.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n */\n constructor(coordinates, layout) {\n super();\n\n /**\n * @private\n * @type {number}\n */\n this.maxDelta_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDeltaRevision_ = -1;\n\n if (layout !== undefined && !Array.isArray(coordinates[0])) {\n this.setFlatCoordinates(\n layout,\n /** @type {Array} */ (coordinates),\n );\n } else {\n this.setCoordinates(\n /** @type {Array} */ (\n coordinates\n ),\n layout,\n );\n }\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!LinearRing} Clone.\n * @api\n * @override\n */\n clone() {\n return new LinearRing(this.flatCoordinates.slice(), this.layout);\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n * @override\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {\n return minSquaredDistance;\n }\n if (this.maxDeltaRevision_ != this.getRevision()) {\n this.maxDelta_ = Math.sqrt(\n maxSquaredDelta(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n 0,\n ),\n );\n this.maxDeltaRevision_ = this.getRevision();\n }\n return assignClosestPoint(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n this.maxDelta_,\n true,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n );\n }\n\n /**\n * Return the area of the linear ring on projected plane.\n * @return {number} Area (on projected plane).\n * @api\n */\n getArea() {\n return linearRingArea(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n );\n }\n\n /**\n * Return the coordinates of the linear ring.\n * @return {Array} Coordinates.\n * @api\n * @override\n */\n getCoordinates() {\n return inflateCoordinates(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n );\n }\n\n /**\n * @param {number} squaredTolerance Squared tolerance.\n * @return {LinearRing} Simplified LinearRing.\n * @protected\n * @override\n */\n getSimplifiedGeometryInternal(squaredTolerance) {\n /** @type {Array} */\n const simplifiedFlatCoordinates = [];\n simplifiedFlatCoordinates.length = douglasPeucker(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n 0,\n );\n return new LinearRing(simplifiedFlatCoordinates, 'XY');\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./Geometry.js\").Type} Geometry type.\n * @api\n * @override\n */\n getType() {\n return 'LinearRing';\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n * @override\n */\n intersectsExtent(extent) {\n return false;\n }\n\n /**\n * Set the coordinates of the linear ring.\n * @param {!Array} coordinates Coordinates.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n * @api\n * @override\n */\n setCoordinates(coordinates, layout) {\n this.setLayout(layout, coordinates, 1);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n this.flatCoordinates.length = deflateCoordinates(\n this.flatCoordinates,\n 0,\n coordinates,\n this.stride,\n );\n this.changed();\n }\n}\n\nexport default LinearRing;\n","/**\n * @module ol/geom/Point\n */\nimport {containsXY, createOrUpdateFromCoordinate} from '../extent.js';\nimport {squaredDistance as squaredDx} from '../math.js';\nimport SimpleGeometry from './SimpleGeometry.js';\nimport {deflateCoordinate} from './flat/deflate.js';\n\n/**\n * @classdesc\n * Point geometry.\n *\n * @api\n */\nclass Point extends SimpleGeometry {\n /**\n * @param {import(\"../coordinate.js\").Coordinate} coordinates Coordinates.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n */\n constructor(coordinates, layout) {\n super();\n this.setCoordinates(coordinates, layout);\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!Point} Clone.\n * @api\n * @override\n */\n clone() {\n const point = new Point(this.flatCoordinates.slice(), this.layout);\n point.applyProperties(this);\n return point;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n * @override\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n const flatCoordinates = this.flatCoordinates;\n const squaredDistance = squaredDx(\n x,\n y,\n flatCoordinates[0],\n flatCoordinates[1],\n );\n if (squaredDistance < minSquaredDistance) {\n const stride = this.stride;\n for (let i = 0; i < stride; ++i) {\n closestPoint[i] = flatCoordinates[i];\n }\n closestPoint.length = stride;\n return squaredDistance;\n }\n return minSquaredDistance;\n }\n\n /**\n * Return the coordinate of the point.\n * @return {import(\"../coordinate.js\").Coordinate} Coordinates.\n * @api\n * @override\n */\n getCoordinates() {\n return this.flatCoordinates.slice();\n }\n\n /**\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @protected\n * @return {import(\"../extent.js\").Extent} extent Extent.\n * @override\n */\n computeExtent(extent) {\n return createOrUpdateFromCoordinate(this.flatCoordinates, extent);\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./Geometry.js\").Type} Geometry type.\n * @api\n * @override\n */\n getType() {\n return 'Point';\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n * @override\n */\n intersectsExtent(extent) {\n return containsXY(extent, this.flatCoordinates[0], this.flatCoordinates[1]);\n }\n\n /**\n * @param {!Array<*>} coordinates Coordinates.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n * @api\n * @override\n */\n setCoordinates(coordinates, layout) {\n this.setLayout(layout, coordinates, 0);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n this.flatCoordinates.length = deflateCoordinate(\n this.flatCoordinates,\n 0,\n coordinates,\n this.stride,\n );\n this.changed();\n }\n}\n\nexport default Point;\n","/**\n * @module ol/geom/flat/contains\n */\nimport {forEachCorner} from '../../extent.js';\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @return {boolean} Contains extent.\n */\nexport function linearRingContainsExtent(\n flatCoordinates,\n offset,\n end,\n stride,\n extent,\n) {\n const outside = forEachCorner(\n extent,\n /**\n * @param {import(\"../../coordinate.js\").Coordinate} coordinate Coordinate.\n * @return {boolean} Contains (x, y).\n */\n function (coordinate) {\n return !linearRingContainsXY(\n flatCoordinates,\n offset,\n end,\n stride,\n coordinate[0],\n coordinate[1],\n );\n },\n );\n return !outside;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n */\nexport function linearRingContainsXY(\n flatCoordinates,\n offset,\n end,\n stride,\n x,\n y,\n) {\n // https://web.archive.org/web/20210504233957/http://geomalgorithms.com/a03-_inclusion.html\n // Copyright 2000 softSurfer, 2012 Dan Sunday\n // This code may be freely used and modified for any purpose\n // providing that this copyright notice is included with it.\n // SoftSurfer makes no warranty for this code, and cannot be held\n // liable for any real or imagined damage resulting from its use.\n // Users of this code must verify correctness for their application.\n let wn = 0;\n let x1 = flatCoordinates[end - stride];\n let y1 = flatCoordinates[end - stride + 1];\n for (; offset < end; offset += stride) {\n const x2 = flatCoordinates[offset];\n const y2 = flatCoordinates[offset + 1];\n if (y1 <= y) {\n if (y2 > y && (x2 - x1) * (y - y1) - (x - x1) * (y2 - y1) > 0) {\n wn++;\n }\n } else if (y2 <= y && (x2 - x1) * (y - y1) - (x - x1) * (y2 - y1) < 0) {\n wn--;\n }\n x1 = x2;\n y1 = y2;\n }\n return wn !== 0;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n */\nexport function linearRingsContainsXY(\n flatCoordinates,\n offset,\n ends,\n stride,\n x,\n y,\n) {\n if (ends.length === 0) {\n return false;\n }\n if (!linearRingContainsXY(flatCoordinates, offset, ends[0], stride, x, y)) {\n return false;\n }\n for (let i = 1, ii = ends.length; i < ii; ++i) {\n if (\n linearRingContainsXY(flatCoordinates, ends[i - 1], ends[i], stride, x, y)\n ) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Endss.\n * @param {number} stride Stride.\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n */\nexport function linearRingssContainsXY(\n flatCoordinates,\n offset,\n endss,\n stride,\n x,\n y,\n) {\n if (endss.length === 0) {\n return false;\n }\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n if (linearRingsContainsXY(flatCoordinates, offset, ends, stride, x, y)) {\n return true;\n }\n offset = ends[ends.length - 1];\n }\n return false;\n}\n","/**\n * @module ol/geom/flat/interiorpoint\n */\nimport {ascending} from '../../array.js';\nimport {linearRingsContainsXY} from './contains.js';\n\n/**\n * Calculates a point that is likely to lie in the interior of the linear rings.\n * Inspired by JTS's com.vividsolutions.jts.geom.Geometry#getInteriorPoint.\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @param {Array} flatCenters Flat centers.\n * @param {number} flatCentersOffset Flat center offset.\n * @param {Array} [dest] Destination.\n * @return {Array} Destination point as XYM coordinate, where M is the\n * length of the horizontal intersection that the point belongs to.\n */\nexport function getInteriorPointOfArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n flatCenters,\n flatCentersOffset,\n dest,\n) {\n let i, ii, x, x1, x2, y1, y2;\n const y = flatCenters[flatCentersOffset + 1];\n /** @type {Array} */\n const intersections = [];\n // Calculate intersections with the horizontal line\n for (let r = 0, rr = ends.length; r < rr; ++r) {\n const end = ends[r];\n x1 = flatCoordinates[end - stride];\n y1 = flatCoordinates[end - stride + 1];\n for (i = offset; i < end; i += stride) {\n x2 = flatCoordinates[i];\n y2 = flatCoordinates[i + 1];\n if ((y <= y1 && y2 <= y) || (y1 <= y && y <= y2)) {\n x = ((y - y1) / (y2 - y1)) * (x2 - x1) + x1;\n intersections.push(x);\n }\n x1 = x2;\n y1 = y2;\n }\n }\n // Find the longest segment of the horizontal line that has its center point\n // inside the linear ring.\n let pointX = NaN;\n let maxSegmentLength = -Infinity;\n intersections.sort(ascending);\n x1 = intersections[0];\n for (i = 1, ii = intersections.length; i < ii; ++i) {\n x2 = intersections[i];\n const segmentLength = Math.abs(x2 - x1);\n if (segmentLength > maxSegmentLength) {\n x = (x1 + x2) / 2;\n if (linearRingsContainsXY(flatCoordinates, offset, ends, stride, x, y)) {\n pointX = x;\n maxSegmentLength = segmentLength;\n }\n }\n x1 = x2;\n }\n if (isNaN(pointX)) {\n // There is no horizontal line that has its center point inside the linear\n // ring. Use the center of the the linear ring's extent.\n pointX = flatCenters[flatCentersOffset];\n }\n if (dest) {\n dest.push(pointX, y, maxSegmentLength);\n return dest;\n }\n return [pointX, y, maxSegmentLength];\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Endss.\n * @param {number} stride Stride.\n * @param {Array} flatCenters Flat centers.\n * @return {Array} Interior points as XYM coordinates, where M is the\n * length of the horizontal intersection that the point belongs to.\n */\nexport function getInteriorPointsOfMultiArray(\n flatCoordinates,\n offset,\n endss,\n stride,\n flatCenters,\n) {\n /** @type {Array} */\n let interiorPoints = [];\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n interiorPoints = getInteriorPointOfArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n flatCenters,\n 2 * i,\n interiorPoints,\n );\n offset = ends[ends.length - 1];\n }\n return interiorPoints;\n}\n","/**\n * @module ol/geom/flat/segments\n */\n\n/**\n * This function calls `callback` for each segment of the flat coordinates\n * array. If the callback returns a truthy value the function returns that\n * value immediately. Otherwise the function returns `false`.\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {function(import(\"../../coordinate.js\").Coordinate, import(\"../../coordinate.js\").Coordinate): T} callback Function\n * called for each segment.\n * @return {T|boolean} Value.\n * @template T\n */\nexport function forEach(flatCoordinates, offset, end, stride, callback) {\n let ret;\n offset += stride;\n for (; offset < end; offset += stride) {\n ret = callback(\n flatCoordinates.slice(offset - stride, offset),\n flatCoordinates.slice(offset, offset + stride),\n );\n if (ret) {\n return ret;\n }\n }\n return false;\n}\n\n/**\n * Calculate the intersection point of two line segments.\n * Reference: https://stackoverflow.com/a/72474223/2389327\n * @param {Array} segment1 The first line segment as an array of two points.\n * @param {Array} segment2 The second line segment as an array of two points.\n * @return {import(\"../../coordinate.js\").Coordinate|undefined} The intersection point or `undefined` if no intersection.\n */\nexport function getIntersectionPoint(segment1, segment2) {\n const [a, b] = segment1;\n const [c, d] = segment2;\n const t =\n ((a[0] - c[0]) * (c[1] - d[1]) - (a[1] - c[1]) * (c[0] - d[0])) /\n ((a[0] - b[0]) * (c[1] - d[1]) - (a[1] - b[1]) * (c[0] - d[0]));\n const u =\n ((a[0] - c[0]) * (a[1] - b[1]) - (a[1] - c[1]) * (a[0] - b[0])) /\n ((a[0] - b[0]) * (c[1] - d[1]) - (a[1] - b[1]) * (c[0] - d[0]));\n\n // Check if lines actually intersect\n if (0 <= t && t <= 1 && 0 <= u && u <= 1) {\n return [a[0] + t * (b[0] - a[0]), a[1] + t * (b[1] - a[1])];\n }\n return undefined;\n}\n","/**\n * @module ol/geom/flat/intersectsextent\n */\nimport {\n createEmpty,\n extendFlatCoordinates,\n intersects,\n intersectsSegment,\n} from '../../extent.js';\nimport {linearRingContainsExtent, linearRingContainsXY} from './contains.js';\nimport {forEach as forEachSegment} from './segments.js';\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @param {import('../../extent.js').Extent} [coordinatesExtent] Coordinates extent\n * @return {boolean} True if the geometry and the extent intersect.\n */\nexport function intersectsLineString(\n flatCoordinates,\n offset,\n end,\n stride,\n extent,\n coordinatesExtent,\n) {\n coordinatesExtent =\n coordinatesExtent ??\n extendFlatCoordinates(createEmpty(), flatCoordinates, offset, end, stride);\n if (!intersects(extent, coordinatesExtent)) {\n return false;\n }\n if (\n (coordinatesExtent[0] >= extent[0] && coordinatesExtent[2] <= extent[2]) ||\n (coordinatesExtent[1] >= extent[1] && coordinatesExtent[3] <= extent[3])\n ) {\n return true;\n }\n return forEachSegment(\n flatCoordinates,\n offset,\n end,\n stride,\n /**\n * @param {import(\"../../coordinate.js\").Coordinate} point1 Start point.\n * @param {import(\"../../coordinate.js\").Coordinate} point2 End point.\n * @return {boolean} `true` if the segment and the extent intersect,\n * `false` otherwise.\n */\n function (point1, point2) {\n return intersectsSegment(extent, point1, point2);\n },\n );\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @return {boolean} True if the geometry and the extent intersect.\n */\nexport function intersectsLineStringArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n extent,\n) {\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n if (\n intersectsLineString(flatCoordinates, offset, ends[i], stride, extent)\n ) {\n return true;\n }\n offset = ends[i];\n }\n return false;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @return {boolean} True if the geometry and the extent intersect.\n */\nexport function intersectsLinearRing(\n flatCoordinates,\n offset,\n end,\n stride,\n extent,\n) {\n if (intersectsLineString(flatCoordinates, offset, end, stride, extent)) {\n return true;\n }\n if (\n linearRingContainsXY(\n flatCoordinates,\n offset,\n end,\n stride,\n extent[0],\n extent[1],\n )\n ) {\n return true;\n }\n if (\n linearRingContainsXY(\n flatCoordinates,\n offset,\n end,\n stride,\n extent[0],\n extent[3],\n )\n ) {\n return true;\n }\n if (\n linearRingContainsXY(\n flatCoordinates,\n offset,\n end,\n stride,\n extent[2],\n extent[1],\n )\n ) {\n return true;\n }\n if (\n linearRingContainsXY(\n flatCoordinates,\n offset,\n end,\n stride,\n extent[2],\n extent[3],\n )\n ) {\n return true;\n }\n return false;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @return {boolean} True if the geometry and the extent intersect.\n */\nexport function intersectsLinearRingArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n extent,\n) {\n if (!intersectsLinearRing(flatCoordinates, offset, ends[0], stride, extent)) {\n return false;\n }\n if (ends.length === 1) {\n return true;\n }\n for (let i = 1, ii = ends.length; i < ii; ++i) {\n if (\n linearRingContainsExtent(\n flatCoordinates,\n ends[i - 1],\n ends[i],\n stride,\n extent,\n )\n ) {\n if (\n !intersectsLineString(\n flatCoordinates,\n ends[i - 1],\n ends[i],\n stride,\n extent,\n )\n ) {\n return false;\n }\n }\n }\n return true;\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Endss.\n * @param {number} stride Stride.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @return {boolean} True if the geometry and the extent intersect.\n */\nexport function intersectsLinearRingMultiArray(\n flatCoordinates,\n offset,\n endss,\n stride,\n extent,\n) {\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n if (\n intersectsLinearRingArray(flatCoordinates, offset, ends, stride, extent)\n ) {\n return true;\n }\n offset = ends[ends.length - 1];\n }\n return false;\n}\n","/**\n * @module ol/geom/flat/reverse\n */\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n */\nexport function coordinates(flatCoordinates, offset, end, stride) {\n while (offset < end - stride) {\n for (let i = 0; i < stride; ++i) {\n const tmp = flatCoordinates[offset + i];\n flatCoordinates[offset + i] = flatCoordinates[end - stride + i];\n flatCoordinates[end - stride + i] = tmp;\n }\n offset += stride;\n end -= stride;\n }\n}\n","/**\n * @module ol/geom/flat/orient\n */\nimport {coordinates as reverseCoordinates} from './reverse.js';\n\n/**\n * Is the linear ring oriented clockwise in a coordinate system with a bottom-left\n * coordinate origin? For a coordinate system with a top-left coordinate origin,\n * the ring's orientation is clockwise when this function returns false.\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @return {boolean|undefined} Is clockwise.\n */\nexport function linearRingIsClockwise(flatCoordinates, offset, end, stride) {\n // https://stackoverflow.com/q/1165647/clockwise-method#1165943\n // https://github.com/OSGeo/gdal/blob/master/gdal/ogr/ogrlinearring.cpp\n let edge = 0;\n let x1 = flatCoordinates[end - stride];\n let y1 = flatCoordinates[end - stride + 1];\n for (; offset < end; offset += stride) {\n const x2 = flatCoordinates[offset];\n const y2 = flatCoordinates[offset + 1];\n edge += (x2 - x1) * (y2 + y1);\n x1 = x2;\n y1 = y2;\n }\n return edge === 0 ? undefined : edge > 0;\n}\n\n/**\n * Determines if linear rings are oriented. By default, left-hand orientation\n * is tested (first ring must be clockwise, remaining rings counter-clockwise).\n * To test for right-hand orientation, use the `right` argument.\n *\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Array of end indexes.\n * @param {number} stride Stride.\n * @param {boolean} [right] Test for right-hand orientation\n * (counter-clockwise exterior ring and clockwise interior rings).\n * @return {boolean} Rings are correctly oriented.\n */\nexport function linearRingsAreOriented(\n flatCoordinates,\n offset,\n ends,\n stride,\n right,\n) {\n right = right !== undefined ? right : false;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n const isClockwise = linearRingIsClockwise(\n flatCoordinates,\n offset,\n end,\n stride,\n );\n if (i === 0) {\n if ((right && isClockwise) || (!right && !isClockwise)) {\n return false;\n }\n } else {\n if ((right && !isClockwise) || (!right && isClockwise)) {\n return false;\n }\n }\n offset = end;\n }\n return true;\n}\n\n/**\n * Determines if linear rings are oriented. By default, left-hand orientation\n * is tested (first ring must be clockwise, remaining rings counter-clockwise).\n * To test for right-hand orientation, use the `right` argument.\n *\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Array of array of end indexes.\n * @param {number} stride Stride.\n * @param {boolean} [right] Test for right-hand orientation\n * (counter-clockwise exterior ring and clockwise interior rings).\n * @return {boolean} Rings are correctly oriented.\n */\nexport function linearRingssAreOriented(\n flatCoordinates,\n offset,\n endss,\n stride,\n right,\n) {\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n if (!linearRingsAreOriented(flatCoordinates, offset, ends, stride, right)) {\n return false;\n }\n if (ends.length) {\n offset = ends[ends.length - 1];\n }\n }\n return true;\n}\n\n/**\n * Orient coordinates in a flat array of linear rings. By default, rings\n * are oriented following the left-hand rule (clockwise for exterior and\n * counter-clockwise for interior rings). To orient according to the\n * right-hand rule, use the `right` argument.\n *\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array} ends Ends.\n * @param {number} stride Stride.\n * @param {boolean} [right] Follow the right-hand rule for orientation.\n * @return {number} End.\n */\nexport function orientLinearRings(\n flatCoordinates,\n offset,\n ends,\n stride,\n right,\n) {\n right = right !== undefined ? right : false;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n const isClockwise = linearRingIsClockwise(\n flatCoordinates,\n offset,\n end,\n stride,\n );\n const reverse =\n i === 0\n ? (right && isClockwise) || (!right && !isClockwise)\n : (right && !isClockwise) || (!right && isClockwise);\n if (reverse) {\n reverseCoordinates(flatCoordinates, offset, end, stride);\n }\n offset = end;\n }\n return offset;\n}\n\n/**\n * Orient coordinates in a flat array of linear rings. By default, rings\n * are oriented following the left-hand rule (clockwise for exterior and\n * counter-clockwise for interior rings). To orient according to the\n * right-hand rule, use the `right` argument.\n *\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array>} endss Array of array of end indexes.\n * @param {number} stride Stride.\n * @param {boolean} [right] Follow the right-hand rule for orientation.\n * @return {number} End.\n */\nexport function orientLinearRingsArray(\n flatCoordinates,\n offset,\n endss,\n stride,\n right,\n) {\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n offset = orientLinearRings(\n flatCoordinates,\n offset,\n endss[i],\n stride,\n right,\n );\n }\n return offset;\n}\n\n/**\n * Return a two-dimensional endss\n * @param {Array} flatCoordinates Flat coordinates\n * @param {Array} ends Linear ring end indexes\n * @return {Array>} Two dimensional endss array that can\n * be used to construct a MultiPolygon\n */\nexport function inflateEnds(flatCoordinates, ends) {\n const endss = [];\n let offset = 0;\n let prevEndIndex = 0;\n let startOrientation;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n // classifies an array of rings into polygons with outer rings and holes\n const orientation = linearRingIsClockwise(flatCoordinates, offset, end, 2);\n if (startOrientation === undefined) {\n startOrientation = orientation;\n }\n if (orientation === startOrientation) {\n endss.push(ends.slice(prevEndIndex, i + 1));\n } else {\n if (endss.length === 0) {\n continue;\n }\n endss[endss.length - 1].push(ends[prevEndIndex]);\n }\n prevEndIndex = i + 1;\n offset = end;\n }\n return endss;\n}\n","/**\n * @module ol/geom/Polygon\n */\nimport {extend} from '../array.js';\nimport {closestSquaredDistanceXY, getCenter, isEmpty} from '../extent.js';\nimport {modulo} from '../math.js';\nimport {offset as sphereOffset} from '../sphere.js';\nimport LinearRing from './LinearRing.js';\nimport Point from './Point.js';\nimport SimpleGeometry from './SimpleGeometry.js';\nimport {linearRings as linearRingsArea} from './flat/area.js';\nimport {arrayMaxSquaredDelta, assignClosestArrayPoint} from './flat/closest.js';\nimport {linearRingsContainsXY} from './flat/contains.js';\nimport {deflateCoordinatesArray} from './flat/deflate.js';\nimport {inflateCoordinatesArray} from './flat/inflate.js';\nimport {getInteriorPointOfArray} from './flat/interiorpoint.js';\nimport {intersectsLinearRingArray} from './flat/intersectsextent.js';\nimport {linearRingsAreOriented, orientLinearRings} from './flat/orient.js';\nimport {quantizeArray} from './flat/simplify.js';\n\n/**\n * @classdesc\n * Polygon geometry.\n *\n * @api\n */\nclass Polygon extends SimpleGeometry {\n /**\n * @param {!Array>|!Array} coordinates\n * Array of linear rings that define the polygon. The first linear ring of the\n * array defines the outer-boundary or surface of the polygon. Each subsequent\n * linear ring defines a hole in the surface of the polygon. A linear ring is\n * an array of vertices' coordinates where the first coordinate and the last are\n * equivalent. (For internal use, flat coordinates in combination with\n * `layout` and `ends` are also accepted.)\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n * @param {Array} [ends] Ends (for internal use with flat coordinates).\n */\n constructor(coordinates, layout, ends) {\n super();\n\n /**\n * @type {Array}\n * @private\n */\n this.ends_ = [];\n\n /**\n * @private\n * @type {number}\n */\n this.flatInteriorPointRevision_ = -1;\n\n /**\n * @private\n * @type {import(\"../coordinate.js\").Coordinate|null}\n */\n this.flatInteriorPoint_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDelta_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDeltaRevision_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.orientedRevision_ = -1;\n\n /**\n * @private\n * @type {Array|null}\n */\n this.orientedFlatCoordinates_ = null;\n\n if (layout !== undefined && ends) {\n this.setFlatCoordinates(\n layout,\n /** @type {Array} */ (coordinates),\n );\n this.ends_ = ends;\n } else {\n this.setCoordinates(\n /** @type {Array>} */ (\n coordinates\n ),\n layout,\n );\n }\n }\n\n /**\n * Append the passed linear ring to this polygon.\n * @param {LinearRing} linearRing Linear ring.\n * @api\n */\n appendLinearRing(linearRing) {\n if (!this.flatCoordinates) {\n this.flatCoordinates = linearRing.getFlatCoordinates().slice();\n } else {\n extend(this.flatCoordinates, linearRing.getFlatCoordinates());\n }\n this.ends_.push(this.flatCoordinates.length);\n this.changed();\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!Polygon} Clone.\n * @api\n * @override\n */\n clone() {\n const polygon = new Polygon(\n this.flatCoordinates.slice(),\n this.layout,\n this.ends_.slice(),\n );\n polygon.applyProperties(this);\n return polygon;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n * @override\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {\n return minSquaredDistance;\n }\n if (this.maxDeltaRevision_ != this.getRevision()) {\n this.maxDelta_ = Math.sqrt(\n arrayMaxSquaredDelta(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n 0,\n ),\n );\n this.maxDeltaRevision_ = this.getRevision();\n }\n return assignClosestArrayPoint(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n this.maxDelta_,\n true,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n );\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n * @override\n */\n containsXY(x, y) {\n return linearRingsContainsXY(\n this.getOrientedFlatCoordinates(),\n 0,\n this.ends_,\n this.stride,\n x,\n y,\n );\n }\n\n /**\n * Return the area of the polygon on projected plane.\n * @return {number} Area (on projected plane).\n * @api\n */\n getArea() {\n return linearRingsArea(\n this.getOrientedFlatCoordinates(),\n 0,\n this.ends_,\n this.stride,\n );\n }\n\n /**\n * Get the coordinate array for this geometry. This array has the structure\n * of a GeoJSON coordinate array for polygons.\n *\n * @param {boolean} [right] Orient coordinates according to the right-hand\n * rule (counter-clockwise for exterior and clockwise for interior rings).\n * If `false`, coordinates will be oriented according to the left-hand rule\n * (clockwise for exterior and counter-clockwise for interior rings).\n * By default, coordinate orientation will depend on how the geometry was\n * constructed.\n * @return {Array>} Coordinates.\n * @api\n * @override\n */\n getCoordinates(right) {\n let flatCoordinates;\n if (right !== undefined) {\n flatCoordinates = this.getOrientedFlatCoordinates().slice();\n orientLinearRings(flatCoordinates, 0, this.ends_, this.stride, right);\n } else {\n flatCoordinates = this.flatCoordinates;\n }\n\n return inflateCoordinatesArray(flatCoordinates, 0, this.ends_, this.stride);\n }\n\n /**\n * @return {Array} Ends.\n */\n getEnds() {\n return this.ends_;\n }\n\n /**\n * @return {Array} Interior point.\n */\n getFlatInteriorPoint() {\n if (this.flatInteriorPointRevision_ != this.getRevision()) {\n const flatCenter = getCenter(this.getExtent());\n this.flatInteriorPoint_ = getInteriorPointOfArray(\n this.getOrientedFlatCoordinates(),\n 0,\n this.ends_,\n this.stride,\n flatCenter,\n 0,\n );\n this.flatInteriorPointRevision_ = this.getRevision();\n }\n return /** @type {import(\"../coordinate.js\").Coordinate} */ (\n this.flatInteriorPoint_\n );\n }\n\n /**\n * Return an interior point of the polygon.\n * @return {Point} Interior point as XYM coordinate, where M is the\n * length of the horizontal intersection that the point belongs to.\n * @api\n */\n getInteriorPoint() {\n return new Point(this.getFlatInteriorPoint(), 'XYM');\n }\n\n /**\n * Return the number of rings of the polygon, this includes the exterior\n * ring and any interior rings.\n *\n * @return {number} Number of rings.\n * @api\n */\n getLinearRingCount() {\n return this.ends_.length;\n }\n\n /**\n * Return the Nth linear ring of the polygon geometry. Return `null` if the\n * given index is out of range.\n * The exterior linear ring is available at index `0` and the interior rings\n * at index `1` and beyond.\n *\n * @param {number} index Index.\n * @return {LinearRing|null} Linear ring.\n * @api\n */\n getLinearRing(index) {\n if (index < 0 || this.ends_.length <= index) {\n return null;\n }\n return new LinearRing(\n this.flatCoordinates.slice(\n index === 0 ? 0 : this.ends_[index - 1],\n this.ends_[index],\n ),\n this.layout,\n );\n }\n\n /**\n * Return the linear rings of the polygon.\n * @return {Array} Linear rings.\n * @api\n */\n getLinearRings() {\n const layout = this.layout;\n const flatCoordinates = this.flatCoordinates;\n const ends = this.ends_;\n const linearRings = [];\n let offset = 0;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n const linearRing = new LinearRing(\n flatCoordinates.slice(offset, end),\n layout,\n );\n linearRings.push(linearRing);\n offset = end;\n }\n return linearRings;\n }\n\n /**\n * @return {Array} Oriented flat coordinates.\n */\n getOrientedFlatCoordinates() {\n if (this.orientedRevision_ != this.getRevision()) {\n const flatCoordinates = this.flatCoordinates;\n if (linearRingsAreOriented(flatCoordinates, 0, this.ends_, this.stride)) {\n this.orientedFlatCoordinates_ = flatCoordinates;\n } else {\n this.orientedFlatCoordinates_ = flatCoordinates.slice();\n this.orientedFlatCoordinates_.length = orientLinearRings(\n this.orientedFlatCoordinates_,\n 0,\n this.ends_,\n this.stride,\n );\n }\n this.orientedRevision_ = this.getRevision();\n }\n return /** @type {Array} */ (this.orientedFlatCoordinates_);\n }\n\n /**\n * @param {number} squaredTolerance Squared tolerance.\n * @return {Polygon} Simplified Polygon.\n * @protected\n * @override\n */\n getSimplifiedGeometryInternal(squaredTolerance) {\n /** @type {Array} */\n const simplifiedFlatCoordinates = [];\n /** @type {Array} */\n const simplifiedEnds = [];\n simplifiedFlatCoordinates.length = quantizeArray(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n Math.sqrt(squaredTolerance),\n simplifiedFlatCoordinates,\n 0,\n simplifiedEnds,\n );\n return new Polygon(simplifiedFlatCoordinates, 'XY', simplifiedEnds);\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./Geometry.js\").Type} Geometry type.\n * @api\n * @override\n */\n getType() {\n return 'Polygon';\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n * @override\n */\n intersectsExtent(extent) {\n return intersectsLinearRingArray(\n this.getOrientedFlatCoordinates(),\n 0,\n this.ends_,\n this.stride,\n extent,\n );\n }\n\n /**\n * Set the coordinates of the polygon.\n * @param {!Array>} coordinates Coordinates.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n * @api\n * @override\n */\n setCoordinates(coordinates, layout) {\n this.setLayout(layout, coordinates, 2);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n const ends = deflateCoordinatesArray(\n this.flatCoordinates,\n 0,\n coordinates,\n this.stride,\n this.ends_,\n );\n this.flatCoordinates.length = ends.length === 0 ? 0 : ends[ends.length - 1];\n this.changed();\n }\n}\n\nexport default Polygon;\n\n/**\n * Create an approximation of a circle on the surface of a sphere.\n * @param {import(\"../coordinate.js\").Coordinate} center Center (`[lon, lat]` in degrees).\n * @param {number} radius The great-circle distance from the center to\n * the polygon vertices in meters.\n * @param {number} [n] Optional number of vertices for the resulting\n * polygon. Default is `32`.\n * @param {number} [sphereRadius] Optional radius for the sphere (defaults to\n * the Earth's mean radius using the WGS84 ellipsoid).\n * @return {Polygon} The \"circular\" polygon.\n * @api\n */\nexport function circular(center, radius, n, sphereRadius) {\n n = n ? n : 32;\n /** @type {Array} */\n const flatCoordinates = [];\n for (let i = 0; i < n; ++i) {\n extend(\n flatCoordinates,\n sphereOffset(center, radius, (2 * Math.PI * i) / n, sphereRadius),\n );\n }\n flatCoordinates.push(flatCoordinates[0], flatCoordinates[1]);\n return new Polygon(flatCoordinates, 'XY', [flatCoordinates.length]);\n}\n\n/**\n * Create a polygon from an extent. The layout used is `XY`.\n * @param {import(\"../extent.js\").Extent} extent The extent.\n * @return {Polygon} The polygon.\n * @api\n */\nexport function fromExtent(extent) {\n if (isEmpty(extent)) {\n throw new Error('Cannot create polygon from empty extent');\n }\n const minX = extent[0];\n const minY = extent[1];\n const maxX = extent[2];\n const maxY = extent[3];\n const flatCoordinates = [\n minX,\n minY,\n minX,\n maxY,\n maxX,\n maxY,\n maxX,\n minY,\n minX,\n minY,\n ];\n return new Polygon(flatCoordinates, 'XY', [flatCoordinates.length]);\n}\n\n/**\n * Create a regular polygon from a circle.\n * @param {import(\"./Circle.js\").default} circle Circle geometry.\n * @param {number} [sides] Number of sides of the polygon. Default is 32.\n * @param {number} [angle] Start angle for the first vertex of the polygon in\n * counter-clockwise radians. 0 means East. Default is 0.\n * @return {Polygon} Polygon geometry.\n * @api\n */\nexport function fromCircle(circle, sides, angle) {\n sides = sides ? sides : 32;\n const stride = circle.getStride();\n const layout = circle.getLayout();\n const center = circle.getCenter();\n const arrayLength = stride * (sides + 1);\n const flatCoordinates = new Array(arrayLength);\n for (let i = 0; i < arrayLength; i += stride) {\n flatCoordinates[i] = 0;\n flatCoordinates[i + 1] = 0;\n for (let j = 2; j < stride; j++) {\n flatCoordinates[i + j] = center[j];\n }\n }\n const ends = [flatCoordinates.length];\n const polygon = new Polygon(flatCoordinates, layout, ends);\n makeRegular(polygon, center, circle.getRadius(), angle);\n return polygon;\n}\n\n/**\n * Modify the coordinates of a polygon to make it a regular polygon.\n * @param {Polygon} polygon Polygon geometry.\n * @param {import(\"../coordinate.js\").Coordinate} center Center of the regular polygon.\n * @param {number} radius Radius of the regular polygon.\n * @param {number} [angle] Start angle for the first vertex of the polygon in\n * counter-clockwise radians. 0 means East. Default is 0.\n */\nexport function makeRegular(polygon, center, radius, angle) {\n const flatCoordinates = polygon.getFlatCoordinates();\n const stride = polygon.getStride();\n const sides = flatCoordinates.length / stride - 1;\n const startAngle = angle ? angle : 0;\n for (let i = 0; i <= sides; ++i) {\n const offset = i * stride;\n const angle = startAngle + (modulo(i, sides) * 2 * Math.PI) / sides;\n flatCoordinates[offset] = center[0] + radius * Math.cos(angle);\n flatCoordinates[offset + 1] = center[1] + radius * Math.sin(angle);\n }\n polygon.changed();\n}\n","/**\n * @module ol/Geolocation\n */\nimport BaseObject from './Object.js';\nimport BaseEvent from './events/Event.js';\nimport {circular as circularPolygon} from './geom/Polygon.js';\nimport {toRadians} from './math.js';\nimport {\n get as getProjection,\n getTransformFromProjections,\n identityTransform,\n} from './proj.js';\n\n/**\n * @enum {string}\n */\nconst Property = {\n ACCURACY: 'accuracy',\n ACCURACY_GEOMETRY: 'accuracyGeometry',\n ALTITUDE: 'altitude',\n ALTITUDE_ACCURACY: 'altitudeAccuracy',\n HEADING: 'heading',\n POSITION: 'position',\n PROJECTION: 'projection',\n SPEED: 'speed',\n TRACKING: 'tracking',\n TRACKING_OPTIONS: 'trackingOptions',\n};\n\n/**\n * @enum string\n */\nconst GeolocationErrorType = {\n /**\n * Triggered when a `GeolocationPositionError` occurs.\n * @event module:ol/Geolocation.GeolocationError#error\n * @api\n */\n ERROR: 'error',\n};\n\n/**\n * @classdesc\n * Events emitted on [GeolocationPositionError](https://developer.mozilla.org/en-US/docs/Web/API/GeolocationPositionError).\n */\nexport class GeolocationError extends BaseEvent {\n /**\n * @param {GeolocationPositionError} error error object.\n */\n constructor(error) {\n super(GeolocationErrorType.ERROR);\n\n /**\n * Code of the underlying `GeolocationPositionError`.\n * @type {number}\n * @api\n */\n this.code = error.code;\n\n /**\n * Message of the underlying `GeolocationPositionError`.\n * @type {string}\n * @api\n */\n this.message = error.message;\n }\n}\n\n/**\n * @typedef {Object} Options\n * @property {boolean} [tracking=false] Start Tracking right after\n * instantiation.\n * @property {PositionOptions} [trackingOptions] Tracking options.\n * See https://www.w3.org/TR/geolocation-API/#position_options_interface.\n * @property {import(\"./proj.js\").ProjectionLike} [projection] The projection the position\n * is reported in.\n */\n\n/**\n * @typedef {import(\"./ObjectEventType\").Types|'change:accuracy'|'change:accuracyGeometry'|'change:altitude'|\n * 'change:altitudeAccuracy'|'change:heading'|'change:position'|'change:projection'|'change:speed'|'change:tracking'|\n * 'change:trackingOptions'} GeolocationObjectEventTypes\n */\n\n/***\n * @template Return\n * @typedef {import(\"./Observable\").OnSignature &\n * import(\"./Observable\").OnSignature<'error', GeolocationError, Return> &\n * import(\"./Observable\").CombinedOnSignature &\n * import(\"./Observable\").OnSignature} GeolocationOnSignature\n */\n\n/**\n * @classdesc\n * Helper class for providing HTML5 Geolocation capabilities.\n * The [Geolocation API](https://www.w3.org/TR/geolocation-API/)\n * is used to locate a user's position.\n *\n * To get notified of position changes and errors, register listeners for the generic\n * `change` event and the `error` event on your instance of {@link module:ol/Geolocation~Geolocation}.\n *\n * Example:\n *\n * const geolocation = new Geolocation({\n * // take the projection to use from the map's view\n * projection: view.getProjection()\n * });\n * // listen to changes in position\n * geolocation.on('change', function(evt) {\n * console.log(geolocation.getPosition());\n * });\n * // listen to error\n * geolocation.on('error', function(evt) {\n * window.console.log(evt.message);\n * });\n *\n * @fires GeolocationError\n * @api\n */\nclass Geolocation extends BaseObject {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n super();\n\n /***\n * @type {GeolocationOnSignature}\n */\n this.on;\n\n /***\n * @type {GeolocationOnSignature}\n */\n this.once;\n\n /***\n * @type {GeolocationOnSignature}\n */\n this.un;\n\n options = options || {};\n\n /**\n * The unprojected (EPSG:4326) device position.\n * @private\n * @type {?import(\"./coordinate.js\").Coordinate}\n */\n this.position_ = null;\n\n /**\n * @private\n * @type {import(\"./proj.js\").TransformFunction}\n */\n this.transform_ = identityTransform;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.watchId_ = undefined;\n\n this.addChangeListener(Property.PROJECTION, this.handleProjectionChanged_);\n this.addChangeListener(Property.TRACKING, this.handleTrackingChanged_);\n\n if (options.projection !== undefined) {\n this.setProjection(options.projection);\n }\n if (options.trackingOptions !== undefined) {\n this.setTrackingOptions(options.trackingOptions);\n }\n\n this.setTracking(options.tracking !== undefined ? options.tracking : false);\n }\n\n /**\n * Clean up.\n * @override\n */\n disposeInternal() {\n this.setTracking(false);\n super.disposeInternal();\n }\n\n /**\n * @private\n */\n handleProjectionChanged_() {\n const projection = this.getProjection();\n if (projection) {\n this.transform_ = getTransformFromProjections(\n getProjection('EPSG:4326'),\n projection,\n );\n if (this.position_) {\n this.set(Property.POSITION, this.transform_(this.position_));\n }\n }\n }\n\n /**\n * @private\n */\n handleTrackingChanged_() {\n if ('geolocation' in navigator) {\n const tracking = this.getTracking();\n if (tracking && this.watchId_ === undefined) {\n this.watchId_ = navigator.geolocation.watchPosition(\n this.positionChange_.bind(this),\n this.positionError_.bind(this),\n this.getTrackingOptions(),\n );\n } else if (!tracking && this.watchId_ !== undefined) {\n navigator.geolocation.clearWatch(this.watchId_);\n this.watchId_ = undefined;\n }\n }\n }\n\n /**\n * @private\n * @param {GeolocationPosition} position position event.\n */\n positionChange_(position) {\n const coords = position.coords;\n this.set(Property.ACCURACY, coords.accuracy);\n this.set(\n Property.ALTITUDE,\n coords.altitude === null ? undefined : coords.altitude,\n );\n this.set(\n Property.ALTITUDE_ACCURACY,\n coords.altitudeAccuracy === null ? undefined : coords.altitudeAccuracy,\n );\n this.set(\n Property.HEADING,\n coords.heading === null ? undefined : toRadians(coords.heading),\n );\n if (!this.position_) {\n this.position_ = [coords.longitude, coords.latitude];\n } else {\n this.position_[0] = coords.longitude;\n this.position_[1] = coords.latitude;\n }\n const projectedPosition = this.transform_(this.position_);\n this.set(Property.POSITION, projectedPosition.slice());\n this.set(Property.SPEED, coords.speed === null ? undefined : coords.speed);\n const geometry = circularPolygon(this.position_, coords.accuracy);\n geometry.applyTransform(this.transform_);\n this.set(Property.ACCURACY_GEOMETRY, geometry);\n this.changed();\n }\n\n /**\n * @private\n * @param {GeolocationPositionError} error error object.\n */\n positionError_(error) {\n this.dispatchEvent(new GeolocationError(error));\n }\n\n /**\n * Get the accuracy of the position in meters.\n * @return {number|undefined} The accuracy of the position measurement in\n * meters.\n * @observable\n * @api\n */\n getAccuracy() {\n return /** @type {number|undefined} */ (this.get(Property.ACCURACY));\n }\n\n /**\n * Get a geometry of the position accuracy.\n * @return {?import(\"./geom/Polygon.js\").default} A geometry of the position accuracy.\n * @observable\n * @api\n */\n getAccuracyGeometry() {\n return /** @type {?import(\"./geom/Polygon.js\").default} */ (\n this.get(Property.ACCURACY_GEOMETRY) || null\n );\n }\n\n /**\n * Get the altitude associated with the position.\n * @return {number|undefined} The altitude of the position in meters above mean\n * sea level.\n * @observable\n * @api\n */\n getAltitude() {\n return /** @type {number|undefined} */ (this.get(Property.ALTITUDE));\n }\n\n /**\n * Get the altitude accuracy of the position.\n * @return {number|undefined} The accuracy of the altitude measurement in\n * meters.\n * @observable\n * @api\n */\n getAltitudeAccuracy() {\n return /** @type {number|undefined} */ (\n this.get(Property.ALTITUDE_ACCURACY)\n );\n }\n\n /**\n * Get the heading as radians clockwise from North.\n * Note: depending on the browser, the heading is only defined if the `enableHighAccuracy`\n * is set to `true` in the tracking options.\n * @return {number|undefined} The heading of the device in radians from north.\n * @observable\n * @api\n */\n getHeading() {\n return /** @type {number|undefined} */ (this.get(Property.HEADING));\n }\n\n /**\n * Get the position of the device.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} The current position of the device reported\n * in the current projection.\n * @observable\n * @api\n */\n getPosition() {\n return /** @type {import(\"./coordinate.js\").Coordinate|undefined} */ (\n this.get(Property.POSITION)\n );\n }\n\n /**\n * Get the projection associated with the position.\n * @return {import(\"./proj/Projection.js\").default|undefined} The projection the position is\n * reported in.\n * @observable\n * @api\n */\n getProjection() {\n return /** @type {import(\"./proj/Projection.js\").default|undefined} */ (\n this.get(Property.PROJECTION)\n );\n }\n\n /**\n * Get the speed in meters per second.\n * @return {number|undefined} The instantaneous speed of the device in meters\n * per second.\n * @observable\n * @api\n */\n getSpeed() {\n return /** @type {number|undefined} */ (this.get(Property.SPEED));\n }\n\n /**\n * Determine if the device location is being tracked.\n * @return {boolean} The device location is being tracked.\n * @observable\n * @api\n */\n getTracking() {\n return /** @type {boolean} */ (this.get(Property.TRACKING));\n }\n\n /**\n * Get the tracking options.\n * See https://www.w3.org/TR/geolocation-API/#position-options.\n * @return {PositionOptions|undefined} PositionOptions as defined by\n * the [HTML5 Geolocation spec\n * ](https://www.w3.org/TR/geolocation-API/#position_options_interface).\n * @observable\n * @api\n */\n getTrackingOptions() {\n return /** @type {PositionOptions|undefined} */ (\n this.get(Property.TRACKING_OPTIONS)\n );\n }\n\n /**\n * Set the projection to use for transforming the coordinates.\n * @param {import(\"./proj.js\").ProjectionLike} projection The projection the position is\n * reported in.\n * @observable\n * @api\n */\n setProjection(projection) {\n this.set(Property.PROJECTION, getProjection(projection));\n }\n\n /**\n * Enable or disable tracking.\n * @param {boolean} tracking Enable tracking.\n * @observable\n * @api\n */\n setTracking(tracking) {\n this.set(Property.TRACKING, tracking);\n }\n\n /**\n * Set the tracking options.\n * See http://www.w3.org/TR/geolocation-API/#position-options.\n * @param {PositionOptions} options PositionOptions as defined by the\n * [HTML5 Geolocation spec\n * ](http://www.w3.org/TR/geolocation-API/#position_options_interface).\n * @observable\n * @api\n */\n setTrackingOptions(options) {\n this.set(Property.TRACKING_OPTIONS, options);\n }\n}\n\nexport default Geolocation;\n","/**\n * @module ol/ImageState\n */\n\n/**\n * @enum {number}\n */\nexport default {\n IDLE: 0,\n LOADING: 1,\n LOADED: 2,\n ERROR: 3,\n EMPTY: 4,\n};\n","/**\n * @module ol/Image\n */\nimport ImageState from './ImageState.js';\nimport EventType from './events/EventType.js';\nimport EventTarget from './events/Target.js';\nimport {listenOnce, unlistenByKey} from './events.js';\nimport {toPromise} from './functions.js';\nimport {CREATE_IMAGE_BITMAP, IMAGE_DECODE} from './has.js';\n\n/**\n * A function that takes an {@link module:ol/Image~ImageWrapper} for the image and a\n * `{string}` for the src as arguments. It is supposed to make it so the\n * underlying image {@link module:ol/Image~ImageWrapper#getImage} is assigned the\n * content specified by the src. If not specified, the default is\n *\n * function(image, src) {\n * image.getImage().src = src;\n * }\n *\n * Providing a custom `imageLoadFunction` can be useful to load images with\n * post requests or - in general - through XHR requests, where the src of the\n * image element would be set to a data URI when the content is loaded.\n *\n * @typedef {function(import(\"./Image.js\").default, string): void} LoadFunction\n * @api\n */\n\n/**\n * @typedef {Object} ImageObject\n * @property {import(\"./extent.js\").Extent} [extent] Extent, if different from the requested one.\n * @property {import(\"./resolution.js\").ResolutionLike} [resolution] Resolution, if different from the requested one.\n * When x and y resolution are different, use the array type (`[xResolution, yResolution]`).\n * @property {number} [pixelRatio] Pixel ratio, if different from the requested one.\n * @property {import('./DataTile.js').ImageLike} image Image.\n */\n\n/**\n * Loader function used for image sources. Receives extent, resolution and pixel ratio as arguments.\n * For images that cover any extent and resolution (static images), the loader function should not accept\n * any arguments. The function returns an {@link import(\"./DataTile.js\").ImageLike image}, an\n * {@link import(\"./Image.js\").ImageObject image object}, or a promise for the same.\n * For loaders that generate images, the promise should not resolve until the image is loaded.\n * If the returned image does not match the extent, resolution or pixel ratio passed to the loader,\n * it has to return an {@link import(\"./Image.js\").ImageObject image object} with the `image` and the\n * correct `extent`, `resolution` and `pixelRatio`.\n *\n * @typedef {function(import(\"./extent.js\").Extent, number, number, (function(HTMLImageElement, string): void)=): import(\"./DataTile.js\").ImageLike|ImageObject|Promise} Loader\n * @api\n */\n\n/**\n * Loader function used for image sources. Receives extent, resolution and pixel ratio as arguments.\n * The function returns a promise for an {@link import(\"./Image.js\").ImageObject image object}.\n *\n * @typedef {function(import(\"./extent.js\").Extent, number, number, (function(HTMLImageElement, string): void)=): Promise} ImageObjectPromiseLoader\n */\n\nclass ImageWrapper extends EventTarget {\n /**\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number|Array|undefined} resolution Resolution. If provided as array, x and y\n * resolution will be assumed.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"./ImageState.js\").default|Loader} stateOrLoader State.\n */\n constructor(extent, resolution, pixelRatio, stateOrLoader) {\n super();\n\n /**\n * @protected\n * @type {import(\"./extent.js\").Extent}\n */\n this.extent = extent;\n\n /**\n * @private\n * @type {number}\n */\n this.pixelRatio_ = pixelRatio;\n\n /**\n * @protected\n * @type {number|Array|undefined}\n */\n this.resolution = resolution;\n\n /**\n * @protected\n * @type {import(\"./ImageState.js\").default}\n */\n this.state =\n typeof stateOrLoader === 'function' ? ImageState.IDLE : stateOrLoader;\n\n /**\n * @private\n * @type {import('./DataTile.js').ImageLike|null}\n */\n this.image_ = null;\n\n /**\n * @protected\n * @type {Loader|null}\n */\n this.loader = typeof stateOrLoader === 'function' ? stateOrLoader : null;\n }\n\n /**\n * @protected\n */\n changed() {\n this.dispatchEvent(EventType.CHANGE);\n }\n\n /**\n * @return {import(\"./extent.js\").Extent} Extent.\n */\n getExtent() {\n return this.extent;\n }\n\n /**\n * @return {import('./DataTile.js').ImageLike} Image.\n */\n getImage() {\n return this.image_;\n }\n\n /**\n * @return {number} PixelRatio.\n */\n getPixelRatio() {\n return this.pixelRatio_;\n }\n\n /**\n * @return {number|Array} Resolution.\n */\n getResolution() {\n return /** @type {number} */ (this.resolution);\n }\n\n /**\n * @return {import(\"./ImageState.js\").default} State.\n */\n getState() {\n return this.state;\n }\n\n /**\n * Load not yet loaded URI.\n */\n load() {\n if (this.state == ImageState.IDLE) {\n if (this.loader) {\n this.state = ImageState.LOADING;\n this.changed();\n const resolution = this.getResolution();\n const requestResolution = Array.isArray(resolution)\n ? resolution[0]\n : resolution;\n toPromise(() =>\n this.loader(\n this.getExtent(),\n requestResolution,\n this.getPixelRatio(),\n ),\n )\n .then((image) => {\n if ('image' in image) {\n this.image_ = image.image;\n }\n if ('extent' in image) {\n this.extent = image.extent;\n }\n if ('resolution' in image) {\n this.resolution = image.resolution;\n }\n if ('pixelRatio' in image) {\n this.pixelRatio_ = image.pixelRatio;\n }\n if (\n image instanceof HTMLImageElement ||\n (CREATE_IMAGE_BITMAP && image instanceof ImageBitmap) ||\n image instanceof HTMLCanvasElement ||\n image instanceof HTMLVideoElement\n ) {\n this.image_ = image;\n }\n this.state = ImageState.LOADED;\n })\n .catch((error) => {\n this.state = ImageState.ERROR;\n console.error(error); // eslint-disable-line no-console\n })\n .finally(() => this.changed());\n }\n }\n }\n\n /**\n * @param {import('./DataTile.js').ImageLike} image The image.\n */\n setImage(image) {\n this.image_ = image;\n }\n\n /**\n * @param {number|Array} resolution Resolution.\n */\n setResolution(resolution) {\n this.resolution = resolution;\n }\n}\n\n/**\n * @param {import('./DataTile.js').ImageLike} image Image element.\n * @param {function():any} loadHandler Load callback function.\n * @param {function():any} errorHandler Error callback function.\n * @return {function():void} Callback to stop listening.\n */\nexport function listenImage(image, loadHandler, errorHandler) {\n const img = /** @type {HTMLImageElement} */ (image);\n let listening = true;\n let decoding = false;\n let loaded = false;\n\n const listenerKeys = [\n listenOnce(img, EventType.LOAD, function () {\n loaded = true;\n if (!decoding) {\n loadHandler();\n }\n }),\n ];\n\n if (img.src && IMAGE_DECODE) {\n decoding = true;\n img\n .decode()\n .then(function () {\n if (listening) {\n loadHandler();\n }\n })\n .catch(function (error) {\n if (listening) {\n if (loaded) {\n loadHandler();\n } else {\n errorHandler();\n }\n }\n });\n } else {\n listenerKeys.push(listenOnce(img, EventType.ERROR, errorHandler));\n }\n\n return function unlisten() {\n listening = false;\n listenerKeys.forEach(unlistenByKey);\n };\n}\n\n/**\n * Loads an image.\n * @param {HTMLImageElement} image Image, not yet loaded.\n * @param {string} [src] `src` attribute of the image. Optional, not required if already present.\n * @return {Promise} Promise resolving to an `HTMLImageElement`.\n * @api\n */\nexport function load(image, src) {\n return new Promise((resolve, reject) => {\n function handleLoad() {\n unlisten();\n resolve(image);\n }\n function handleError() {\n unlisten();\n reject(new Error('Image load error'));\n }\n function unlisten() {\n image.removeEventListener('load', handleLoad);\n image.removeEventListener('error', handleError);\n }\n image.addEventListener('load', handleLoad);\n image.addEventListener('error', handleError);\n if (src) {\n image.src = src;\n }\n });\n}\n\n/**\n * @param {HTMLImageElement} image Image, not yet loaded.\n * @param {string} [src] `src` attribute of the image. Optional, not required if already present.\n * @return {Promise} Promise resolving to an `HTMLImageElement`.\n */\nexport function decodeFallback(image, src) {\n if (src) {\n image.src = src;\n }\n return image.src && IMAGE_DECODE\n ? new Promise((resolve, reject) =>\n image\n .decode()\n .then(() => resolve(image))\n .catch((e) =>\n image.complete && image.width ? resolve(image) : reject(e),\n ),\n )\n : load(image);\n}\n\n/**\n * Loads an image and decodes it to an `ImageBitmap` if `createImageBitmap()` is supported. Returns\n * the loaded image otherwise.\n * @param {HTMLImageElement} image Image, not yet loaded.\n * @param {string} [src] `src` attribute of the image. Optional, not required if already present.\n * @return {Promise} Promise resolving to an `ImageBitmap` or an\n * `HTMLImageElement` if `createImageBitmap()` is not supported.\n * @api\n */\nexport function decode(image, src) {\n if (src) {\n image.src = src;\n }\n return image.src && IMAGE_DECODE && CREATE_IMAGE_BITMAP\n ? image\n .decode()\n .then(() => createImageBitmap(image))\n .catch((e) => {\n if (image.complete && image.width) {\n return image;\n }\n throw e;\n })\n : decodeFallback(image);\n}\n\nexport default ImageWrapper;\n","/**\n * @module ol/ImageCanvas\n */\nimport ImageWrapper from './Image.js';\nimport ImageState from './ImageState.js';\n\n/**\n * A function that is called to trigger asynchronous canvas drawing. It is\n * called with a \"done\" callback that should be called when drawing is done.\n * If any error occurs during drawing, the \"done\" callback should be called with\n * that error.\n *\n * @typedef {function(function(Error=): void): void} Loader\n */\n\nclass ImageCanvas extends ImageWrapper {\n /**\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n * @param {HTMLCanvasElement|OffscreenCanvas} canvas Canvas.\n * @param {Loader} [loader] Optional loader function to\n * support asynchronous canvas drawing.\n */\n constructor(extent, resolution, pixelRatio, canvas, loader) {\n const state = loader !== undefined ? ImageState.IDLE : ImageState.LOADED;\n\n super(extent, resolution, pixelRatio, state);\n\n /**\n * Optional canvas loader function.\n * @type {?Loader}\n * @private\n */\n this.loader_ = loader !== undefined ? loader : null;\n\n /**\n * @private\n * @type {HTMLCanvasElement|OffscreenCanvas}\n */\n this.canvas_ = canvas;\n\n /**\n * @private\n * @type {?Error}\n */\n this.error_ = null;\n }\n\n /**\n * Get any error associated with asynchronous rendering.\n * @return {?Error} Any error that occurred during rendering.\n */\n getError() {\n return this.error_;\n }\n\n /**\n * Handle async drawing complete.\n * @param {Error} [err] Any error during drawing.\n * @private\n */\n handleLoad_(err) {\n if (err) {\n this.error_ = err;\n this.state = ImageState.ERROR;\n } else {\n this.state = ImageState.LOADED;\n }\n this.changed();\n }\n\n /**\n * Load not yet loaded URI.\n * @override\n */\n load() {\n if (this.state == ImageState.IDLE) {\n this.state = ImageState.LOADING;\n this.changed();\n this.loader_(this.handleLoad_.bind(this));\n }\n }\n\n /**\n * @return {HTMLCanvasElement|OffscreenCanvas} Canvas element.\n * @override\n */\n getImage() {\n return this.canvas_;\n }\n}\n\nexport default ImageCanvas;\n","/**\n * @module ol/ImageTile\n */\nimport {listenImage} from './Image.js';\nimport Tile from './Tile.js';\nimport TileState from './TileState.js';\nimport {createCanvasContext2D} from './dom.js';\nimport {WORKER_OFFSCREEN_CANVAS} from './has.js';\n\nclass ImageTile extends Tile {\n /**\n * @param {import(\"./tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {import(\"./TileState.js\").default} state State.\n * @param {string} src Image source URI.\n * @param {import('./dom.js').ImageAttributes} imageAttributes Image attributes options.\n * @param {import(\"./Tile.js\").LoadFunction} tileLoadFunction Tile load function.\n * @param {import(\"./Tile.js\").Options} [options] Tile options.\n */\n constructor(\n tileCoord,\n state,\n src,\n imageAttributes,\n tileLoadFunction,\n options,\n ) {\n super(tileCoord, state, options);\n\n /**\n * @private\n * @type {?string}\n */\n this.crossOrigin_ = imageAttributes?.crossOrigin;\n\n /**\n * @private\n * @type {ReferrerPolicy}\n */\n this.referrerPolicy_ = imageAttributes?.referrerPolicy;\n\n /**\n * Image URI\n *\n * @private\n * @type {string}\n */\n this.src_ = src;\n\n this.key = src;\n\n /**\n * @private\n * @type {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas}\n */\n this.image_;\n\n if (WORKER_OFFSCREEN_CANVAS) {\n this.image_ = new OffscreenCanvas(1, 1);\n } else {\n this.image_ = new Image();\n if (this.crossOrigin_ !== null) {\n this.image_.crossOrigin = this.crossOrigin_;\n }\n if (this.referrerPolicy_ !== undefined) {\n this.image_.referrerPolicy = this.referrerPolicy_;\n }\n }\n\n /**\n * @private\n * @type {?function():void}\n */\n this.unlisten_ = null;\n\n /**\n * @private\n * @type {import(\"./Tile.js\").LoadFunction}\n */\n this.tileLoadFunction_ = tileLoadFunction;\n }\n\n /**\n * Get the HTML image element for this tile (may be a Canvas, OffscreenCanvas, Image, or Video).\n * @return {HTMLCanvasElement|OffscreenCanvas|HTMLImageElement|HTMLVideoElement} Image.\n * @api\n */\n getImage() {\n return this.image_;\n }\n\n /**\n * Sets an HTML image element for this tile (may be a Canvas or preloaded Image).\n * @param {HTMLCanvasElement|OffscreenCanvas|HTMLImageElement} element Element.\n */\n setImage(element) {\n this.image_ = element;\n this.state = TileState.LOADED;\n this.unlistenImage_();\n this.changed();\n }\n\n /**\n * Get the cross origin of the ImageTile.\n * @return {string} Cross origin.\n */\n getCrossOrigin() {\n return this.crossOrigin_;\n }\n\n /**\n * Get the referrer policy of the ImageTile.\n * @return {ReferrerPolicy} Referrer policy.\n */\n getReferrerPolicy() {\n return this.referrerPolicy_;\n }\n\n /**\n * Tracks loading or read errors.\n *\n * @private\n */\n handleImageError_() {\n this.state = TileState.ERROR;\n this.unlistenImage_();\n this.image_ = getBlankImage();\n this.changed();\n }\n\n /**\n * Tracks successful image load.\n *\n * @private\n */\n handleImageLoad_() {\n if (WORKER_OFFSCREEN_CANVAS) {\n // OffscreenCanvas does not have naturalWidth and naturalHeight\n this.state = TileState.LOADED;\n } else {\n const image = /** @type {HTMLImageElement} */ (this.image_);\n if (image.naturalWidth && image.naturalHeight) {\n this.state = TileState.LOADED;\n } else {\n this.state = TileState.EMPTY;\n }\n }\n this.unlistenImage_();\n this.changed();\n }\n\n /**\n * Load the image or retry if loading previously failed.\n * Loading is taken care of by the tile queue, and calling this method is\n * only needed for preloading or for reloading in case of an error.\n *\n * To retry loading tiles on failed requests, use a custom `tileLoadFunction`\n * that checks for error status codes and reloads only when the status code is\n * 408, 429, 500, 502, 503 and 504, and only when not too many retries have been\n * made already:\n *\n * ```js\n * const retryCodes = [408, 429, 500, 502, 503, 504];\n * const retries = {};\n * source.setTileLoadFunction((tile, src) => {\n * const image = tile.getImage();\n * fetch(src)\n * .then((response) => {\n * if (retryCodes.includes(response.status)) {\n * retries[src] = (retries[src] || 0) + 1;\n * if (retries[src] <= 3) {\n * setTimeout(() => tile.load(), retries[src] * 1000);\n * }\n * return Promise.reject();\n * }\n * return response.blob();\n * })\n * .then((blob) => {\n * const imageUrl = URL.createObjectURL(blob);\n * image.src = imageUrl;\n * setTimeout(() => URL.revokeObjectURL(imageUrl), 5000);\n * })\n * .catch(() => tile.setState(3)); // error\n * });\n * ```\n * @api\n * @override\n */\n load() {\n if (this.state == TileState.ERROR) {\n this.state = TileState.IDLE;\n this.image_ = new Image();\n if (this.crossOrigin_ !== null) {\n this.image_.crossOrigin = this.crossOrigin_;\n }\n if (this.referrerPolicy_ !== undefined) {\n this.image_.referrerPolicy = this.referrerPolicy_;\n }\n }\n if (this.state == TileState.IDLE) {\n this.state = TileState.LOADING;\n this.changed();\n this.tileLoadFunction_(this, this.src_);\n this.unlisten_ = listenImage(\n this.image_,\n this.handleImageLoad_.bind(this),\n this.handleImageError_.bind(this),\n );\n }\n }\n\n /**\n * Discards event handlers which listen for load completion or errors.\n *\n * @private\n */\n unlistenImage_() {\n if (this.unlisten_) {\n this.unlisten_();\n this.unlisten_ = null;\n }\n }\n\n /**\n * @override\n */\n disposeInternal() {\n this.unlistenImage_();\n this.image_ = null;\n super.disposeInternal();\n }\n}\n\n/**\n * Get a 1-pixel blank image.\n * @return {HTMLCanvasElement|OffscreenCanvas} Blank image.\n */\nfunction getBlankImage() {\n const ctx = createCanvasContext2D(1, 1);\n ctx.fillStyle = 'rgba(0,0,0,0)';\n ctx.fillRect(0, 0, 1, 1);\n return ctx.canvas;\n}\n\nexport default ImageTile;\n","/**\n * @module ol/Kinetic\n */\n\n/**\n * @classdesc\n * Implementation of inertial deceleration for map movement.\n *\n * @api\n */\nclass Kinetic {\n /**\n * @param {number} decay Rate of decay (must be negative).\n * @param {number} minVelocity Minimum velocity (pixels/millisecond).\n * @param {number} delay Delay to consider to calculate the kinetic\n * initial values (milliseconds).\n */\n constructor(decay, minVelocity, delay) {\n /**\n * @private\n * @type {number}\n */\n this.decay_ = decay;\n\n /**\n * @private\n * @type {number}\n */\n this.minVelocity_ = minVelocity;\n\n /**\n * @private\n * @type {number}\n */\n this.delay_ = delay;\n\n /**\n * @private\n * @type {Array}\n */\n this.points_ = [];\n\n /**\n * @private\n * @type {number}\n */\n this.angle_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.initialVelocity_ = 0;\n }\n\n /**\n * FIXME empty description for jsdoc\n */\n begin() {\n this.points_.length = 0;\n this.angle_ = 0;\n this.initialVelocity_ = 0;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n */\n update(x, y) {\n this.points_.push(x, y, Date.now());\n }\n\n /**\n * @return {boolean} Whether we should do kinetic animation.\n */\n end() {\n if (this.points_.length < 6) {\n // at least 2 points are required (i.e. there must be at least 6 elements\n // in the array)\n return false;\n }\n const delay = Date.now() - this.delay_;\n const lastIndex = this.points_.length - 3;\n if (this.points_[lastIndex + 2] < delay) {\n // the last tracked point is too old, which means that the user stopped\n // panning before releasing the map\n return false;\n }\n\n // get the first point which still falls into the delay time\n let firstIndex = lastIndex - 3;\n while (firstIndex > 0 && this.points_[firstIndex + 2] > delay) {\n firstIndex -= 3;\n }\n\n const duration = this.points_[lastIndex + 2] - this.points_[firstIndex + 2];\n // we don't want a duration of 0 (divide by zero)\n // we also make sure the user panned for a duration of at least one frame\n // (1/60s) to compute sane displacement values\n if (duration < 1000 / 60) {\n return false;\n }\n\n const dx = this.points_[lastIndex] - this.points_[firstIndex];\n const dy = this.points_[lastIndex + 1] - this.points_[firstIndex + 1];\n this.angle_ = Math.atan2(dy, dx);\n this.initialVelocity_ = Math.sqrt(dx * dx + dy * dy) / duration;\n return this.initialVelocity_ > this.minVelocity_;\n }\n\n /**\n * @return {number} Total distance travelled (pixels).\n */\n getDistance() {\n return (this.minVelocity_ - this.initialVelocity_) / this.decay_;\n }\n\n /**\n * @return {number} Angle of the kinetic panning animation (radians).\n */\n getAngle() {\n return this.angle_;\n }\n}\n\nexport default Kinetic;\n","/**\n * @module ol/MapEvent\n */\nimport Event from './events/Event.js';\n\n/**\n * @classdesc\n * Events emitted as map events are instances of this type.\n * See {@link module:ol/Map~Map} for which events trigger a map event.\n */\nclass MapEvent extends Event {\n /**\n * @param {string} type Event type.\n * @param {import(\"./Map.js\").default} map Map.\n * @param {?import(\"./Map.js\").FrameState} [frameState] Frame state.\n */\n constructor(type, map, frameState) {\n super(type);\n\n /**\n * The map where the event occurred.\n * @type {import(\"./Map.js\").default}\n * @api\n */\n this.map = map;\n\n /**\n * The frame state at the time of the event.\n * @type {?import(\"./Map.js\").FrameState}\n * @api\n */\n this.frameState = frameState !== undefined ? frameState : null;\n }\n}\n\nexport default MapEvent;\n","/**\n * @module ol/MapBrowserEvent\n */\nimport MapEvent from './MapEvent.js';\n\n/**\n * @classdesc\n * Events emitted as map browser events are instances of this type.\n * See {@link module:ol/Map~Map} for which events trigger a map browser event.\n * @template {PointerEvent|KeyboardEvent|WheelEvent} [EVENT=PointerEvent|KeyboardEvent|WheelEvent]\n */\nclass MapBrowserEvent extends MapEvent {\n /**\n * @param {string} type Event type.\n * @param {import(\"./Map.js\").default} map Map.\n * @param {EVENT} originalEvent Original event.\n * @param {boolean} [dragging] Is the map currently being dragged?\n * @param {import(\"./Map.js\").FrameState} [frameState] Frame state.\n * @param {Array} [activePointers] Active pointers.\n */\n constructor(type, map, originalEvent, dragging, frameState, activePointers) {\n super(type, map, frameState);\n\n /**\n * The original browser event.\n * @const\n * @type {EVENT}\n * @api\n */\n this.originalEvent = originalEvent;\n\n /**\n * The map pixel relative to the viewport corresponding to the original browser event.\n * @type {?import(\"./pixel.js\").Pixel}\n * @private\n */\n this.pixel_ = null;\n\n /**\n * The coordinate in the user projection corresponding to the original browser event.\n * @type {?import(\"./coordinate.js\").Coordinate}\n * @private\n */\n this.coordinate_ = null;\n\n /**\n * Indicates if the map is currently being dragged. Only set for\n * `POINTERDRAG` and `POINTERMOVE` events. Default is `false`.\n *\n * @type {boolean}\n * @api\n */\n this.dragging = dragging !== undefined ? dragging : false;\n\n /**\n * @type {Array|undefined}\n */\n this.activePointers = activePointers;\n }\n\n /**\n * The map pixel relative to the viewport corresponding to the original event.\n * @type {import(\"./pixel.js\").Pixel}\n * @api\n */\n get pixel() {\n if (!this.pixel_) {\n this.pixel_ = this.map.getEventPixel(this.originalEvent);\n }\n return this.pixel_;\n }\n set pixel(pixel) {\n this.pixel_ = pixel;\n }\n\n /**\n * The coordinate corresponding to the original browser event. This will be in the user\n * projection if one is set. Otherwise it will be in the view projection.\n * @type {import(\"./coordinate.js\").Coordinate}\n * @api\n */\n get coordinate() {\n if (!this.coordinate_) {\n this.coordinate_ = this.map.getCoordinateFromPixel(this.pixel);\n }\n return this.coordinate_;\n }\n set coordinate(coordinate) {\n this.coordinate_ = coordinate;\n }\n\n /**\n * Prevents the default browser action.\n * See https://developer.mozilla.org/en-US/docs/Web/API/event.preventDefault.\n * @api\n * @override\n */\n preventDefault() {\n super.preventDefault();\n if ('preventDefault' in this.originalEvent) {\n /** @type {UIEvent} */ (this.originalEvent).preventDefault();\n }\n }\n\n /**\n * Prevents further propagation of the current event.\n * See https://developer.mozilla.org/en-US/docs/Web/API/event.stopPropagation.\n * @api\n * @override\n */\n stopPropagation() {\n super.stopPropagation();\n if ('stopPropagation' in this.originalEvent) {\n /** @type {UIEvent} */ (this.originalEvent).stopPropagation();\n }\n }\n}\n\nexport default MapBrowserEvent;\n","/**\n * @module ol/MapBrowserEventType\n */\nimport EventType from './events/EventType.js';\n\n/**\n * Constants for event names.\n * @enum {string}\n */\nexport default {\n /**\n * A true single click with no dragging and no double click. Note that this\n * event is delayed by 250 ms to ensure that it is not a double click.\n * @event module:ol/MapBrowserEvent~MapBrowserEvent#singleclick\n * @api\n */\n SINGLECLICK: 'singleclick',\n\n /**\n * A click with no dragging. A double click will fire two of this.\n * @event module:ol/MapBrowserEvent~MapBrowserEvent#click\n * @api\n */\n CLICK: EventType.CLICK,\n\n /**\n * A true double click, with no dragging.\n * @event module:ol/MapBrowserEvent~MapBrowserEvent#dblclick\n * @api\n */\n DBLCLICK: EventType.DBLCLICK,\n\n /**\n * Triggered when a pointer is dragged.\n * @event module:ol/MapBrowserEvent~MapBrowserEvent#pointerdrag\n * @api\n */\n POINTERDRAG: 'pointerdrag',\n\n /**\n * Triggered when a pointer is moved. Note that on touch devices this is\n * triggered when the map is panned, so is not the same as mousemove.\n * @event module:ol/MapBrowserEvent~MapBrowserEvent#pointermove\n * @api\n */\n POINTERMOVE: 'pointermove',\n\n POINTERDOWN: 'pointerdown',\n POINTERUP: 'pointerup',\n POINTEROVER: 'pointerover',\n POINTEROUT: 'pointerout',\n POINTERENTER: 'pointerenter',\n POINTERLEAVE: 'pointerleave',\n POINTERCANCEL: 'pointercancel',\n};\n\n/***\n * @typedef {'singleclick'|'click'|'dblclick'|'pointerdrag'|'pointermove'} Types\n */\n","/**\n * @module ol/pointer/EventType\n */\n\n/**\n * Constants for event names.\n * @enum {string}\n */\nexport default {\n POINTERMOVE: 'pointermove',\n POINTERDOWN: 'pointerdown',\n POINTERUP: 'pointerup',\n POINTEROVER: 'pointerover',\n POINTEROUT: 'pointerout',\n POINTERENTER: 'pointerenter',\n POINTERLEAVE: 'pointerleave',\n POINTERCANCEL: 'pointercancel',\n};\n","/**\n * @module ol/MapBrowserEventHandler\n */\n\nimport MapBrowserEvent from './MapBrowserEvent.js';\nimport MapBrowserEventType from './MapBrowserEventType.js';\nimport EventType from './events/EventType.js';\nimport Target from './events/Target.js';\nimport {listen, unlistenByKey} from './events.js';\nimport {PASSIVE_EVENT_LISTENERS} from './has.js';\nimport PointerEventType from './pointer/EventType.js';\n\nclass MapBrowserEventHandler extends Target {\n /**\n * @param {import(\"./Map.js\").default} map The map with the viewport to listen to events on.\n * @param {number} [moveTolerance] The minimal distance the pointer must travel to trigger a move.\n */\n constructor(map, moveTolerance) {\n super(map);\n\n /**\n * This is the element that we will listen to the real events on.\n * @type {import(\"./Map.js\").default}\n * @private\n */\n this.map_ = map;\n\n /**\n * @type {ReturnType}\n * @private\n */\n this.clickTimeoutId_;\n\n /**\n * Emulate dblclick and singleclick. Will be true when only one pointer is active.\n * @type {boolean}\n */\n this.emulateClicks_ = false;\n\n /**\n * @type {boolean}\n * @private\n */\n this.dragging_ = false;\n\n /**\n * @type {!Array}\n * @private\n */\n this.dragListenerKeys_ = [];\n\n /**\n * @type {number}\n * @private\n */\n this.moveTolerance_ = moveTolerance === undefined ? 1 : moveTolerance;\n\n /**\n * The most recent \"down\" type event (or null if none have occurred).\n * Set on pointerdown.\n * @type {PointerEvent|null}\n * @private\n */\n this.down_ = null;\n\n const element = this.map_.getViewport();\n\n /**\n * @type {Array}\n * @private\n */\n this.activePointers_ = [];\n\n /**\n * @type {!Object}\n * @private\n */\n this.trackedTouches_ = {};\n\n /**\n * @private\n */\n this.element_ = element;\n\n /**\n * @type {?import(\"./events.js\").EventsKey}\n * @private\n */\n this.pointerdownListenerKey_ = listen(\n element,\n PointerEventType.POINTERDOWN,\n this.handlePointerDown_,\n this,\n );\n\n /**\n * @type {PointerEvent}\n * @private\n */\n this.originalPointerMoveEvent_;\n\n /**\n * @type {?import(\"./events.js\").EventsKey}\n * @private\n */\n this.relayedListenerKey_ = listen(\n element,\n PointerEventType.POINTERMOVE,\n this.relayMoveEvent_,\n this,\n );\n\n /**\n * @private\n */\n this.boundHandleTouchMove_ = this.handleTouchMove_.bind(this);\n\n this.element_.addEventListener(\n EventType.TOUCHMOVE,\n this.boundHandleTouchMove_,\n PASSIVE_EVENT_LISTENERS ? {passive: false} : false,\n );\n }\n\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n emulateClick_(pointerEvent) {\n let newEvent = new MapBrowserEvent(\n MapBrowserEventType.CLICK,\n this.map_,\n pointerEvent,\n );\n this.dispatchEvent(newEvent);\n if (this.clickTimeoutId_ !== undefined) {\n // double-click\n clearTimeout(this.clickTimeoutId_);\n this.clickTimeoutId_ = undefined;\n newEvent = new MapBrowserEvent(\n MapBrowserEventType.DBLCLICK,\n this.map_,\n pointerEvent,\n );\n this.dispatchEvent(newEvent);\n } else {\n // click\n this.clickTimeoutId_ = setTimeout(() => {\n this.clickTimeoutId_ = undefined;\n const newEvent = new MapBrowserEvent(\n MapBrowserEventType.SINGLECLICK,\n this.map_,\n pointerEvent,\n );\n this.dispatchEvent(newEvent);\n }, 250);\n }\n }\n\n /**\n * Keeps track on how many pointers are currently active.\n *\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n updateActivePointers_(pointerEvent) {\n const event = pointerEvent;\n const id = event.pointerId;\n\n if (\n event.type == MapBrowserEventType.POINTERUP ||\n event.type == MapBrowserEventType.POINTERCANCEL\n ) {\n delete this.trackedTouches_[id];\n for (const pointerId in this.trackedTouches_) {\n if (this.trackedTouches_[pointerId].target !== event.target) {\n // Some platforms assign a new pointerId when the target changes.\n // If this happens, delete one tracked pointer. If there is more\n // than one tracked pointer for the old target, it will be cleared\n // by subsequent POINTERUP events from other pointers.\n delete this.trackedTouches_[pointerId];\n break;\n }\n }\n } else if (\n event.type == MapBrowserEventType.POINTERDOWN ||\n event.type == MapBrowserEventType.POINTERMOVE\n ) {\n this.trackedTouches_[id] = event;\n }\n this.activePointers_ = Object.values(this.trackedTouches_);\n }\n\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n handlePointerUp_(pointerEvent) {\n this.updateActivePointers_(pointerEvent);\n const newEvent = new MapBrowserEvent(\n MapBrowserEventType.POINTERUP,\n this.map_,\n pointerEvent,\n undefined,\n undefined,\n this.activePointers_,\n );\n this.dispatchEvent(newEvent);\n\n // We emulate click events on left mouse button click, touch contact, and pen\n // contact. isMouseActionButton returns true in these cases (evt.button is set\n // to 0).\n // See http://www.w3.org/TR/pointerevents/#button-states\n // We only fire click, singleclick, and doubleclick if nobody has called\n // event.preventDefault().\n if (\n this.emulateClicks_ &&\n !newEvent.defaultPrevented &&\n !this.dragging_ &&\n this.isMouseActionButton_(pointerEvent)\n ) {\n this.emulateClick_(this.down_);\n }\n\n if (this.activePointers_.length === 0) {\n this.dragListenerKeys_.forEach(unlistenByKey);\n this.dragListenerKeys_.length = 0;\n this.dragging_ = false;\n this.down_ = null;\n }\n }\n\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @return {boolean} If the left mouse button was pressed.\n * @private\n */\n isMouseActionButton_(pointerEvent) {\n return pointerEvent.button === 0;\n }\n\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n handlePointerDown_(pointerEvent) {\n this.emulateClicks_ = this.activePointers_.length === 0;\n this.updateActivePointers_(pointerEvent);\n const newEvent = new MapBrowserEvent(\n MapBrowserEventType.POINTERDOWN,\n this.map_,\n pointerEvent,\n undefined,\n undefined,\n this.activePointers_,\n );\n this.dispatchEvent(newEvent);\n\n this.down_ = new PointerEvent(pointerEvent.type, pointerEvent);\n Object.defineProperty(this.down_, 'target', {\n writable: false,\n value: pointerEvent.target,\n });\n\n if (this.dragListenerKeys_.length === 0) {\n const doc = this.map_.getOwnerDocument();\n this.dragListenerKeys_.push(\n listen(\n doc,\n MapBrowserEventType.POINTERMOVE,\n this.handlePointerMove_,\n this,\n ),\n listen(doc, MapBrowserEventType.POINTERUP, this.handlePointerUp_, this),\n /* Note that the listener for `pointercancel is set up on\n * `pointerEventHandler_` and not `documentPointerEventHandler_` like\n * the `pointerup` and `pointermove` listeners.\n *\n * The reason for this is the following: `TouchSource.vacuumTouches_()`\n * issues `pointercancel` events, when there was no `touchend` for a\n * `touchstart`. Now, let's say a first `touchstart` is registered on\n * `pointerEventHandler_`. The `documentPointerEventHandler_` is set up.\n * But `documentPointerEventHandler_` doesn't know about the first\n * `touchstart`. If there is no `touchend` for the `touchstart`, we can\n * only receive a `touchcancel` from `pointerEventHandler_`, because it is\n * only registered there.\n */\n listen(\n this.element_,\n MapBrowserEventType.POINTERCANCEL,\n this.handlePointerUp_,\n this,\n ),\n );\n if (this.element_.getRootNode && this.element_.getRootNode() !== doc) {\n this.dragListenerKeys_.push(\n listen(\n this.element_.getRootNode(),\n MapBrowserEventType.POINTERUP,\n this.handlePointerUp_,\n this,\n ),\n );\n }\n }\n }\n\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n handlePointerMove_(pointerEvent) {\n // Between pointerdown and pointerup, pointermove events are triggered.\n // To avoid a 'false' touchmove event to be dispatched, we test if the pointer\n // moved a significant distance.\n if (this.isMoving_(pointerEvent)) {\n this.updateActivePointers_(pointerEvent);\n this.dragging_ = true;\n const newEvent = new MapBrowserEvent(\n MapBrowserEventType.POINTERDRAG,\n this.map_,\n pointerEvent,\n this.dragging_,\n undefined,\n this.activePointers_,\n );\n this.dispatchEvent(newEvent);\n }\n }\n\n /**\n * Wrap and relay a pointermove event.\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n relayMoveEvent_(pointerEvent) {\n this.originalPointerMoveEvent_ = pointerEvent;\n const dragging = !!(this.down_ && this.isMoving_(pointerEvent));\n this.dispatchEvent(\n new MapBrowserEvent(\n MapBrowserEventType.POINTERMOVE,\n this.map_,\n pointerEvent,\n dragging,\n ),\n );\n }\n\n /**\n * Flexible handling of a `touch-action: none` css equivalent: because calling\n * `preventDefault()` on a `pointermove` event does not stop native page scrolling\n * and zooming, we also listen for `touchmove` and call `preventDefault()` on it\n * when an interaction (currently `DragPan` handles the event.\n * @param {TouchEvent} event Event.\n * @private\n */\n handleTouchMove_(event) {\n // Due to https://github.com/mpizenberg/elm-pep/issues/2, `this.originalPointerMoveEvent_`\n // may not be initialized yet when we get here on a platform without native pointer events,\n // when elm-pep is used as pointer events polyfill.\n const originalEvent = this.originalPointerMoveEvent_;\n if (\n (!originalEvent || originalEvent.defaultPrevented) &&\n (typeof event.cancelable !== 'boolean' || event.cancelable === true)\n ) {\n event.preventDefault();\n }\n }\n\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @return {boolean} Is moving.\n * @private\n */\n isMoving_(pointerEvent) {\n return (\n this.dragging_ ||\n Math.abs(pointerEvent.clientX - this.down_.clientX) >\n this.moveTolerance_ ||\n Math.abs(pointerEvent.clientY - this.down_.clientY) > this.moveTolerance_\n );\n }\n\n /**\n * Clean up.\n * @override\n */\n disposeInternal() {\n if (this.relayedListenerKey_) {\n unlistenByKey(this.relayedListenerKey_);\n this.relayedListenerKey_ = null;\n }\n this.element_.removeEventListener(\n EventType.TOUCHMOVE,\n this.boundHandleTouchMove_,\n );\n\n if (this.pointerdownListenerKey_) {\n unlistenByKey(this.pointerdownListenerKey_);\n this.pointerdownListenerKey_ = null;\n }\n\n this.dragListenerKeys_.forEach(unlistenByKey);\n this.dragListenerKeys_.length = 0;\n\n this.element_ = null;\n super.disposeInternal();\n }\n}\n\nexport default MapBrowserEventHandler;\n","/**\n * @module ol/MapEventType\n */\n\n/**\n * @enum {string}\n */\nexport default {\n /**\n * Triggered after a map frame is rendered.\n * @event module:ol/MapEvent~MapEvent#postrender\n * @api\n */\n POSTRENDER: 'postrender',\n\n /**\n * Triggered when the map starts moving.\n * @event module:ol/MapEvent~MapEvent#movestart\n * @api\n */\n MOVESTART: 'movestart',\n\n /**\n * Triggered after the map is moved.\n * @event module:ol/MapEvent~MapEvent#moveend\n * @api\n */\n MOVEEND: 'moveend',\n\n /**\n * Triggered when loading of additional map data (tiles, images, features) starts.\n * @event module:ol/MapEvent~MapEvent#loadstart\n * @api\n */\n LOADSTART: 'loadstart',\n\n /**\n * Triggered when loading of additional map data has completed.\n * @event module:ol/MapEvent~MapEvent#loadend\n * @api\n */\n LOADEND: 'loadend',\n};\n\n/***\n * @typedef {'postrender'|'movestart'|'moveend'|'loadstart'|'loadend'} Types\n */\n","/**\n * @module ol/MapProperty\n */\n\n/**\n * @enum {string}\n */\nexport default {\n LAYERGROUP: 'layergroup',\n SIZE: 'size',\n TARGET: 'target',\n VIEW: 'view',\n};\n","/**\n * @module ol/structs/PriorityQueue\n */\nimport {assert} from '../asserts.js';\nimport {clear} from '../obj.js';\n\n/**\n * @type {number}\n */\nexport const DROP = Infinity;\n\n/**\n * @classdesc\n * Priority queue.\n *\n * The implementation is inspired from the Closure Library's Heap class and\n * Python's heapq module.\n *\n * See https://github.com/google/closure-library/blob/master/closure/goog/structs/heap.js\n * and https://hg.python.org/cpython/file/2.7/Lib/heapq.py.\n *\n * @template T\n */\nclass PriorityQueue {\n /**\n * @param {function(T): number} priorityFunction Priority function.\n * @param {function(T): string} keyFunction Key function.\n */\n constructor(priorityFunction, keyFunction) {\n /**\n * @type {function(T): number}\n * @private\n */\n this.priorityFunction_ = priorityFunction;\n\n /**\n * @type {function(T): string}\n * @private\n */\n this.keyFunction_ = keyFunction;\n\n /**\n * @type {Array}\n * @private\n */\n this.elements_ = [];\n\n /**\n * @type {Array}\n * @private\n */\n this.priorities_ = [];\n\n /**\n * @type {!Object}\n * @private\n */\n this.queuedElements_ = {};\n }\n\n /**\n * FIXME empty description for jsdoc\n */\n clear() {\n this.elements_.length = 0;\n this.priorities_.length = 0;\n clear(this.queuedElements_);\n }\n\n /**\n * Remove and return the highest-priority element. O(log N).\n * @return {T} Element.\n */\n dequeue() {\n const elements = this.elements_;\n const priorities = this.priorities_;\n const element = elements[0];\n if (elements.length == 1) {\n elements.length = 0;\n priorities.length = 0;\n } else {\n elements[0] = /** @type {T} */ (elements.pop());\n priorities[0] = /** @type {number} */ (priorities.pop());\n this.siftUp_(0);\n }\n const elementKey = this.keyFunction_(element);\n delete this.queuedElements_[elementKey];\n return element;\n }\n\n /**\n * Enqueue an element. O(log N).\n * @param {T} element Element.\n * @return {boolean} The element was added to the queue.\n */\n enqueue(element) {\n assert(\n !(this.keyFunction_(element) in this.queuedElements_),\n 'Tried to enqueue an `element` that was already added to the queue',\n );\n const priority = this.priorityFunction_(element);\n if (priority != DROP) {\n this.elements_.push(element);\n this.priorities_.push(priority);\n this.queuedElements_[this.keyFunction_(element)] = true;\n this.siftDown_(0, this.elements_.length - 1);\n return true;\n }\n return false;\n }\n\n /**\n * @return {number} Count.\n */\n getCount() {\n return this.elements_.length;\n }\n\n /**\n * Gets the index of the left child of the node at the given index.\n * @param {number} index The index of the node to get the left child for.\n * @return {number} The index of the left child.\n * @private\n */\n getLeftChildIndex_(index) {\n return index * 2 + 1;\n }\n\n /**\n * Gets the index of the right child of the node at the given index.\n * @param {number} index The index of the node to get the right child for.\n * @return {number} The index of the right child.\n * @private\n */\n getRightChildIndex_(index) {\n return index * 2 + 2;\n }\n\n /**\n * Gets the index of the parent of the node at the given index.\n * @param {number} index The index of the node to get the parent for.\n * @return {number} The index of the parent.\n * @private\n */\n getParentIndex_(index) {\n return (index - 1) >> 1;\n }\n\n /**\n * Make this a heap. O(N).\n * @private\n */\n heapify_() {\n let i;\n for (i = (this.elements_.length >> 1) - 1; i >= 0; i--) {\n this.siftUp_(i);\n }\n }\n\n /**\n * @return {boolean} Is empty.\n */\n isEmpty() {\n return this.elements_.length === 0;\n }\n\n /**\n * @param {string} key Key.\n * @return {boolean} Is key queued.\n */\n isKeyQueued(key) {\n return key in this.queuedElements_;\n }\n\n /**\n * @param {T} element Element.\n * @return {boolean} Is queued.\n */\n isQueued(element) {\n return this.isKeyQueued(this.keyFunction_(element));\n }\n\n /**\n * @param {number} index The index of the node to move down.\n * @private\n */\n siftUp_(index) {\n const elements = this.elements_;\n const priorities = this.priorities_;\n const count = elements.length;\n const element = elements[index];\n const priority = priorities[index];\n const startIndex = index;\n\n while (index < count >> 1) {\n const lIndex = this.getLeftChildIndex_(index);\n const rIndex = this.getRightChildIndex_(index);\n\n const smallerChildIndex =\n rIndex < count && priorities[rIndex] < priorities[lIndex]\n ? rIndex\n : lIndex;\n\n elements[index] = elements[smallerChildIndex];\n priorities[index] = priorities[smallerChildIndex];\n index = smallerChildIndex;\n }\n\n elements[index] = element;\n priorities[index] = priority;\n this.siftDown_(startIndex, index);\n }\n\n /**\n * @param {number} startIndex The index of the root.\n * @param {number} index The index of the node to move up.\n * @private\n */\n siftDown_(startIndex, index) {\n const elements = this.elements_;\n const priorities = this.priorities_;\n const element = elements[index];\n const priority = priorities[index];\n\n while (index > startIndex) {\n const parentIndex = this.getParentIndex_(index);\n if (priorities[parentIndex] > priority) {\n elements[index] = elements[parentIndex];\n priorities[index] = priorities[parentIndex];\n index = parentIndex;\n } else {\n break;\n }\n }\n elements[index] = element;\n priorities[index] = priority;\n }\n\n /**\n * FIXME empty description for jsdoc\n */\n reprioritize() {\n const priorityFunction = this.priorityFunction_;\n const elements = this.elements_;\n const priorities = this.priorities_;\n let index = 0;\n const n = elements.length;\n let element, i, priority;\n for (i = 0; i < n; ++i) {\n element = elements[i];\n priority = priorityFunction(element);\n if (priority == DROP) {\n delete this.queuedElements_[this.keyFunction_(element)];\n } else {\n priorities[index] = priority;\n elements[index++] = element;\n }\n }\n elements.length = index;\n priorities.length = index;\n this.heapify_();\n }\n}\n\nexport default PriorityQueue;\n","/**\n * @module ol/TileQueue\n */\nimport TileState from './TileState.js';\nimport EventType from './events/EventType.js';\nimport PriorityQueue, {DROP} from './structs/PriorityQueue.js';\n\n/**\n * @typedef {function(import(\"./Tile.js\").default, string, import('./tilecoord.js').TileCoord, number): number} PriorityFunction\n */\n\n/**\n * @typedef {[import('./Tile.js').default, string, import('./tilecoord.js').TileCoord, number]} TileQueueElement\n */\n\n/**\n * @extends PriorityQueue}\n */\nclass TileQueue extends PriorityQueue {\n /**\n * @param {PriorityFunction} tilePriorityFunction Tile priority function.\n * @param {function(): ?} tileChangeCallback Function called on each tile change event.\n */\n constructor(tilePriorityFunction, tileChangeCallback) {\n super(\n (element) => tilePriorityFunction.apply(null, element),\n (element) => element[0].getKey(),\n );\n\n /** @private */\n this.boundHandleTileChange_ = this.handleTileChange.bind(this);\n\n /**\n * @private\n * @type {function(): ?}\n */\n this.tileChangeCallback_ = tileChangeCallback;\n\n /**\n * @private\n * @type {number}\n */\n this.tilesLoading_ = 0;\n\n /**\n * @private\n * @type {!Object}\n */\n this.tilesLoadingKeys_ = {};\n }\n\n /**\n * @param {TileQueueElement} element Element.\n * @return {boolean} The element was added to the queue.\n * @override\n */\n enqueue(element) {\n const added = super.enqueue(element);\n if (added) {\n const tile = element[0];\n tile.addEventListener(EventType.CHANGE, this.boundHandleTileChange_);\n }\n return added;\n }\n\n /**\n * @return {number} Number of tiles loading.\n */\n getTilesLoading() {\n return this.tilesLoading_;\n }\n\n /**\n * @param {import(\"./events/Event.js\").default} event Event.\n * @protected\n */\n handleTileChange(event) {\n const tile = /** @type {import(\"./Tile.js\").default} */ (event.target);\n const state = tile.getState();\n if (\n state === TileState.LOADED ||\n state === TileState.ERROR ||\n state === TileState.EMPTY\n ) {\n if (state !== TileState.ERROR) {\n tile.removeEventListener(EventType.CHANGE, this.boundHandleTileChange_);\n }\n const tileKey = tile.getKey();\n if (tileKey in this.tilesLoadingKeys_) {\n delete this.tilesLoadingKeys_[tileKey];\n --this.tilesLoading_;\n }\n this.tileChangeCallback_();\n }\n }\n\n /**\n * @param {number} maxTotalLoading Maximum number tiles to load simultaneously.\n * @param {number} maxNewLoads Maximum number of new tiles to load.\n */\n loadMoreTiles(maxTotalLoading, maxNewLoads) {\n let newLoads = 0;\n while (\n this.tilesLoading_ < maxTotalLoading &&\n newLoads < maxNewLoads &&\n this.getCount() > 0\n ) {\n const tile = this.dequeue()[0];\n const tileKey = tile.getKey();\n const state = tile.getState();\n if (state === TileState.IDLE && !(tileKey in this.tilesLoadingKeys_)) {\n this.tilesLoadingKeys_[tileKey] = true;\n ++this.tilesLoading_;\n ++newLoads;\n tile.load();\n }\n }\n }\n}\n\nexport default TileQueue;\n\n/**\n * @param {import('./Map.js').FrameState} frameState Frame state.\n * @param {import(\"./Tile.js\").default} tile Tile.\n * @param {string} tileSourceKey Tile source key.\n * @param {import(\"./coordinate.js\").Coordinate} tileCenter Tile center.\n * @param {number} tileResolution Tile resolution.\n * @return {number} Tile priority.\n */\nexport function getTilePriority(\n frameState,\n tile,\n tileSourceKey,\n tileCenter,\n tileResolution,\n) {\n // Filter out tiles at higher zoom levels than the current zoom level, or that\n // are outside the visible extent.\n if (!frameState || !(tileSourceKey in frameState.wantedTiles)) {\n return DROP;\n }\n if (!frameState.wantedTiles[tileSourceKey][tile.getKey()]) {\n return DROP;\n }\n // Prioritize the highest zoom level tiles closest to the focus.\n // Tiles at higher zoom levels are prioritized using Math.log(tileResolution).\n // Within a zoom level, tiles are prioritized by the distance in pixels between\n // the center of the tile and the center of the viewport. The factor of 65536\n // means that the prioritization should behave as desired for tiles up to\n // 65536 * Math.log(2) = 45426 pixels from the focus.\n const center = frameState.viewState.center;\n const deltaX = tileCenter[0] - center[0];\n const deltaY = tileCenter[1] - center[1];\n return (\n 65536 * Math.log(tileResolution) +\n Math.sqrt(deltaX * deltaX + deltaY * deltaY) / tileResolution\n );\n}\n","/**\n * @module ol/ViewHint\n */\n\n/**\n * @enum {number}\n */\nexport default {\n ANIMATING: 0,\n INTERACTING: 1,\n};\n","/**\n * @module ol/ViewProperty\n */\n\n/**\n * @enum {string}\n */\nexport default {\n CENTER: 'center',\n RESOLUTION: 'resolution',\n ROTATION: 'rotation',\n};\n","/**\n * @module ol/centerconstraint\n */\nimport {clamp} from './math.js';\n\n/**\n * @typedef {function((import(\"./coordinate.js\").Coordinate|undefined), number, import(\"./size.js\").Size, boolean=, Array=): (import(\"./coordinate.js\").Coordinate|undefined)} Type\n */\n\n/**\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {boolean} onlyCenter If true, the constraint will only apply to the view center.\n * @param {boolean} smooth If true, the view will be able to go slightly out of the given extent\n * (only during interaction and animation).\n * @return {Type} The constraint.\n */\nexport function createExtent(extent, onlyCenter, smooth) {\n return (\n /**\n * @param {import(\"./coordinate.js\").Coordinate|undefined} center Center.\n * @param {number|undefined} resolution Resolution.\n * @param {import(\"./size.js\").Size} size Viewport size; unused if `onlyCenter` was specified.\n * @param {boolean} [isMoving] True if an interaction or animation is in progress.\n * @param {Array} [centerShift] Shift between map center and viewport center.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} Center.\n */\n function (center, resolution, size, isMoving, centerShift) {\n if (!center) {\n return undefined;\n }\n if (!resolution && !onlyCenter) {\n return center;\n }\n const viewWidth = onlyCenter ? 0 : size[0] * resolution;\n const viewHeight = onlyCenter ? 0 : size[1] * resolution;\n const shiftX = centerShift ? centerShift[0] : 0;\n const shiftY = centerShift ? centerShift[1] : 0;\n let minX = extent[0] + viewWidth / 2 + shiftX;\n let maxX = extent[2] - viewWidth / 2 + shiftX;\n let minY = extent[1] + viewHeight / 2 + shiftY;\n let maxY = extent[3] - viewHeight / 2 + shiftY;\n\n // note: when zooming out of bounds, min and max values for x and y may\n // end up inverted (min > max); this has to be accounted for\n if (minX > maxX) {\n minX = (maxX + minX) / 2;\n maxX = minX;\n }\n if (minY > maxY) {\n minY = (maxY + minY) / 2;\n maxY = minY;\n }\n\n let x = clamp(center[0], minX, maxX);\n let y = clamp(center[1], minY, maxY);\n\n // during an interaction, allow some overscroll\n if (isMoving && smooth && resolution) {\n const ratio = 30 * resolution;\n x +=\n -ratio * Math.log(1 + Math.max(0, minX - center[0]) / ratio) +\n ratio * Math.log(1 + Math.max(0, center[0] - maxX) / ratio);\n y +=\n -ratio * Math.log(1 + Math.max(0, minY - center[1]) / ratio) +\n ratio * Math.log(1 + Math.max(0, center[1] - maxY) / ratio);\n }\n\n return [x, y];\n }\n );\n}\n\n/**\n * @param {import(\"./coordinate.js\").Coordinate} [center] Center.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} Center.\n */\nexport function none(center) {\n return center;\n}\n","/**\n * @module ol/resolutionconstraint\n */\nimport {linearFindNearest} from './array.js';\nimport {getHeight, getWidth} from './extent.js';\nimport {clamp} from './math.js';\n\n/**\n * @typedef {function((number|undefined), number, import(\"./size.js\").Size, boolean=): (number|undefined)} Type\n */\n\n/**\n * Returns a modified resolution taking into account the viewport size and maximum\n * allowed extent.\n * @param {number} resolution Resolution\n * @param {import(\"./extent.js\").Extent} maxExtent Maximum allowed extent.\n * @param {import(\"./size.js\").Size} viewportSize Viewport size.\n * @param {boolean} showFullExtent Whether to show the full extent.\n * @return {number} Capped resolution.\n */\nfunction getViewportClampedResolution(\n resolution,\n maxExtent,\n viewportSize,\n showFullExtent,\n) {\n const xResolution = getWidth(maxExtent) / viewportSize[0];\n const yResolution = getHeight(maxExtent) / viewportSize[1];\n\n if (showFullExtent) {\n return Math.min(resolution, Math.max(xResolution, yResolution));\n }\n return Math.min(resolution, Math.min(xResolution, yResolution));\n}\n\n/**\n * Returns a modified resolution to be between maxResolution and minResolution while\n * still allowing the value to be slightly out of bounds.\n * Note: the computation is based on the logarithm function (ln):\n * - at 1, ln(x) is 0\n * - above 1, ln(x) keeps increasing but at a much slower pace than x\n * The final result is clamped to prevent getting too far away from bounds.\n * @param {number} resolution Resolution.\n * @param {number} maxResolution Max resolution.\n * @param {number} minResolution Min resolution.\n * @return {number} Smoothed resolution.\n */\nfunction getSmoothClampedResolution(resolution, maxResolution, minResolution) {\n let result = Math.min(resolution, maxResolution);\n const ratio = 50;\n\n result *=\n Math.log(1 + ratio * Math.max(0, resolution / maxResolution - 1)) / ratio +\n 1;\n if (minResolution) {\n result = Math.max(result, minResolution);\n result /=\n Math.log(1 + ratio * Math.max(0, minResolution / resolution - 1)) /\n ratio +\n 1;\n }\n return clamp(result, minResolution / 2, maxResolution * 2);\n}\n\n/**\n * @param {Array} resolutions Resolutions.\n * @param {boolean} [smooth] If true, the view will be able to slightly exceed resolution limits. Default: true.\n * @param {import(\"./extent.js\").Extent} [maxExtent] Maximum allowed extent.\n * @param {boolean} [showFullExtent] If true, allows us to show the full extent. Default: false.\n * @return {Type} Zoom function.\n */\nexport function createSnapToResolutions(\n resolutions,\n smooth,\n maxExtent,\n showFullExtent,\n) {\n smooth = smooth !== undefined ? smooth : true;\n return (\n /**\n * @param {number|undefined} resolution Resolution.\n * @param {number} direction Direction.\n * @param {import(\"./size.js\").Size} size Viewport size.\n * @param {boolean} [isMoving] True if an interaction or animation is in progress.\n * @return {number|undefined} Resolution.\n */\n function (resolution, direction, size, isMoving) {\n if (resolution !== undefined) {\n const maxResolution = resolutions[0];\n const minResolution = resolutions[resolutions.length - 1];\n const cappedMaxRes = maxExtent\n ? getViewportClampedResolution(\n maxResolution,\n maxExtent,\n size,\n showFullExtent,\n )\n : maxResolution;\n\n // during interacting or animating, allow intermediary values\n if (isMoving) {\n if (!smooth) {\n return clamp(resolution, minResolution, cappedMaxRes);\n }\n return getSmoothClampedResolution(\n resolution,\n cappedMaxRes,\n minResolution,\n );\n }\n\n const capped = Math.min(cappedMaxRes, resolution);\n const z = Math.floor(linearFindNearest(resolutions, capped, direction));\n if (resolutions[z] > cappedMaxRes && z < resolutions.length - 1) {\n return resolutions[z + 1];\n }\n return resolutions[z];\n }\n return undefined;\n }\n );\n}\n\n/**\n * @param {number} power Power.\n * @param {number} maxResolution Maximum resolution.\n * @param {number} [minResolution] Minimum resolution.\n * @param {boolean} [smooth] If true, the view will be able to slightly exceed resolution limits. Default: true.\n * @param {import(\"./extent.js\").Extent} [maxExtent] Maximum allowed extent.\n * @param {boolean} [showFullExtent] If true, allows us to show the full extent. Default: false.\n * @return {Type} Zoom function.\n */\nexport function createSnapToPower(\n power,\n maxResolution,\n minResolution,\n smooth,\n maxExtent,\n showFullExtent,\n) {\n smooth = smooth !== undefined ? smooth : true;\n minResolution = minResolution !== undefined ? minResolution : 0;\n\n return (\n /**\n * @param {number|undefined} resolution Resolution.\n * @param {number} direction Direction.\n * @param {import(\"./size.js\").Size} size Viewport size.\n * @param {boolean} [isMoving] True if an interaction or animation is in progress.\n * @return {number|undefined} Resolution.\n */\n function (resolution, direction, size, isMoving) {\n if (resolution !== undefined) {\n const cappedMaxRes = maxExtent\n ? getViewportClampedResolution(\n maxResolution,\n maxExtent,\n size,\n showFullExtent,\n )\n : maxResolution;\n\n // during interacting or animating, allow intermediary values\n if (isMoving) {\n if (!smooth) {\n return clamp(resolution, minResolution, cappedMaxRes);\n }\n return getSmoothClampedResolution(\n resolution,\n cappedMaxRes,\n minResolution,\n );\n }\n\n const tolerance = 1e-9;\n const minZoomLevel = Math.ceil(\n Math.log(maxResolution / cappedMaxRes) / Math.log(power) - tolerance,\n );\n const offset = -direction * (0.5 - tolerance) + 0.5;\n const capped = Math.min(cappedMaxRes, resolution);\n const cappedZoomLevel = Math.floor(\n Math.log(maxResolution / capped) / Math.log(power) + offset,\n );\n const zoomLevel = Math.max(minZoomLevel, cappedZoomLevel);\n const newResolution = maxResolution / Math.pow(power, zoomLevel);\n return clamp(newResolution, minResolution, cappedMaxRes);\n }\n return undefined;\n }\n );\n}\n\n/**\n * @param {number} maxResolution Max resolution.\n * @param {number} minResolution Min resolution.\n * @param {boolean} [smooth] If true, the view will be able to slightly exceed resolution limits. Default: true.\n * @param {import(\"./extent.js\").Extent} [maxExtent] Maximum allowed extent.\n * @param {boolean} [showFullExtent] If true, allows us to show the full extent. Default: false.\n * @return {Type} Zoom function.\n */\nexport function createMinMaxResolution(\n maxResolution,\n minResolution,\n smooth,\n maxExtent,\n showFullExtent,\n) {\n smooth = smooth !== undefined ? smooth : true;\n\n return (\n /**\n * @param {number|undefined} resolution Resolution.\n * @param {number} direction Direction.\n * @param {import(\"./size.js\").Size} size Viewport size.\n * @param {boolean} [isMoving] True if an interaction or animation is in progress.\n * @return {number|undefined} Resolution.\n */\n function (resolution, direction, size, isMoving) {\n if (resolution !== undefined) {\n const cappedMaxRes = maxExtent\n ? getViewportClampedResolution(\n maxResolution,\n maxExtent,\n size,\n showFullExtent,\n )\n : maxResolution;\n\n if (!smooth || !isMoving) {\n return clamp(resolution, minResolution, cappedMaxRes);\n }\n return getSmoothClampedResolution(\n resolution,\n cappedMaxRes,\n minResolution,\n );\n }\n return undefined;\n }\n );\n}\n","/**\n * @module ol/rotationconstraint\n */\nimport {toRadians} from './math.js';\n\n/**\n * @typedef {function((number|undefined), boolean=): (number|undefined)} Type\n */\n\n/**\n * @param {number|undefined} rotation Rotation.\n * @return {number|undefined} Rotation.\n */\nexport function disable(rotation) {\n if (rotation !== undefined) {\n return 0;\n }\n return undefined;\n}\n\n/**\n * @param {number|undefined} rotation Rotation.\n * @return {number|undefined} Rotation.\n */\nexport function none(rotation) {\n if (rotation !== undefined) {\n return rotation;\n }\n return undefined;\n}\n\n/**\n * @param {number} n N.\n * @return {Type} Rotation constraint.\n */\nexport function createSnapToN(n) {\n const theta = (2 * Math.PI) / n;\n return (\n /**\n * @param {number|undefined} rotation Rotation.\n * @param {boolean} [isMoving] True if an interaction or animation is in progress.\n * @return {number|undefined} Rotation.\n */\n function (rotation, isMoving) {\n if (isMoving) {\n return rotation;\n }\n\n if (rotation !== undefined) {\n rotation = Math.floor(rotation / theta + 0.5) * theta;\n return rotation;\n }\n return undefined;\n }\n );\n}\n\n/**\n * @param {number} [tolerance] Tolerance.\n * @return {Type} Rotation constraint.\n */\nexport function createSnapToZero(tolerance) {\n const t = tolerance === undefined ? toRadians(5) : tolerance;\n return (\n /**\n * @param {number|undefined} rotation Rotation.\n * @param {boolean} [isMoving] True if an interaction or animation is in progress.\n * @return {number|undefined} Rotation.\n */\n function (rotation, isMoving) {\n if (isMoving || rotation === undefined) {\n return rotation;\n }\n\n if (Math.abs(rotation) <= t) {\n return 0;\n }\n return rotation;\n }\n );\n}\n","/**\n * @module ol/tilegrid/common\n */\n\n/**\n * Default maximum zoom for default tile grids.\n * @type {number}\n */\nexport const DEFAULT_MAX_ZOOM = 42;\n\n/**\n * Default tile size.\n * @type {number}\n */\nexport const DEFAULT_TILE_SIZE = 256;\n","/**\n * @module ol/View\n */\nimport BaseObject from './Object.js';\nimport ViewHint from './ViewHint.js';\nimport ViewProperty from './ViewProperty.js';\nimport {linearFindNearest} from './array.js';\nimport {assert} from './asserts.js';\nimport {createExtent, none as centerNone} from './centerconstraint.js';\nimport {\n add as addCoordinate,\n equals,\n equals as coordinatesEqual,\n rotate as rotateCoordinate,\n} from './coordinate.js';\nimport {easeOut, inAndOut} from './easing.js';\nimport {\n getCenter,\n getForViewAndSize,\n getHeight,\n getWidth,\n isEmpty,\n} from './extent.js';\nimport {VOID} from './functions.js';\nimport {fromExtent as polygonFromExtent} from './geom/Polygon.js';\nimport {clamp, modulo} from './math.js';\nimport {\n METERS_PER_UNIT,\n createProjection,\n disableCoordinateWarning,\n fromUserCoordinate,\n fromUserExtent,\n getUserProjection,\n toUserCoordinate,\n toUserExtent,\n} from './proj.js';\nimport {\n createMinMaxResolution,\n createSnapToPower,\n createSnapToResolutions,\n} from './resolutionconstraint.js';\nimport {\n createSnapToN,\n createSnapToZero,\n disable,\n none as rotationNone,\n} from './rotationconstraint.js';\nimport {DEFAULT_TILE_SIZE} from './tilegrid/common.js';\n\n/**\n * An animation configuration\n *\n * @typedef {Object} Animation\n * @property {import(\"./coordinate.js\").Coordinate} [sourceCenter] Source center.\n * @property {import(\"./coordinate.js\").Coordinate} [targetCenter] Target center.\n * @property {number} [sourceResolution] Source resolution.\n * @property {number} [targetResolution] Target resolution.\n * @property {number} [sourceRotation] Source rotation.\n * @property {number} [targetRotation] Target rotation.\n * @property {import(\"./coordinate.js\").Coordinate} [anchor] Anchor.\n * @property {number} start Start.\n * @property {number} duration Duration.\n * @property {boolean} complete Complete.\n * @property {function(number):number} easing Easing.\n * @property {function(boolean):void} callback Callback.\n */\n\n/**\n * @typedef {Object} Constraints\n * @property {import(\"./centerconstraint.js\").Type} center Center.\n * @property {import(\"./resolutionconstraint.js\").Type} resolution Resolution.\n * @property {import(\"./rotationconstraint.js\").Type} rotation Rotation.\n */\n\n/**\n * @typedef {Object} FitOptions\n * @property {import(\"./size.js\").Size} [size] The size in pixels of the box to\n * fit the extent into. Defaults to the size of the map the view is associated with.\n * If no map or multiple maps are connected to the view, provide the desired box size\n * (e.g. `map.getSize()`).\n * @property {!Array} [padding=[0, 0, 0, 0]] Padding (in pixels) to be\n * cleared inside the view. Values in the array are top, right, bottom and left\n * padding.\n * @property {boolean} [nearest=false] If the view `constrainResolution` option is `true`,\n * get the nearest extent instead of the closest that actually fits the view.\n * @property {number} [minResolution=0] Minimum resolution that we zoom to.\n * @property {number} [maxZoom] Maximum zoom level that we zoom to. If\n * `minResolution` is given, this property is ignored.\n * @property {number} [duration] The duration of the animation in milliseconds.\n * By default, there is no animation to the target extent.\n * @property {function(number):number} [easing] The easing function used during\n * the animation (defaults to {@link module:ol/easing.inAndOut}).\n * The function will be called for each frame with a number representing a\n * fraction of the animation's duration. The function should return a number\n * between 0 and 1 representing the progress toward the destination state.\n * @property {function(boolean):void} [callback] Function called when the view is in\n * its final position. The callback will be called with `true` if the animation\n * series completed on its own or `false` if it was cancelled.\n */\n\n/**\n * @typedef {Object} ViewOptions\n * @property {import(\"./coordinate.js\").Coordinate} [center] The initial center for\n * the view. If a user projection is not set, the coordinate system for the center is\n * specified with the `projection` option. Layer sources will not be fetched if this\n * is not set, but the center can be set later with {@link #setCenter}.\n * @property {boolean|number} [constrainRotation=true] Rotation constraint.\n * `false` means no constraint. `true` means no constraint, but snap to zero\n * near zero. A number constrains the rotation to that number of values. For\n * example, `4` will constrain the rotation to 0, 90, 180, and 270 degrees.\n * @property {boolean} [enableRotation=true] Enable rotation.\n * If `false`, a rotation constraint that always sets the rotation to zero is\n * used. The `constrainRotation` option has no effect if `enableRotation` is\n * `false`.\n * @property {import(\"./extent.js\").Extent} [extent] The extent that constrains the\n * view, in other words, nothing outside of this extent can be visible on the map.\n * @property {boolean} [constrainOnlyCenter=false] If true, the extent\n * constraint will only apply to the view center and not the whole extent.\n * @property {boolean} [smoothExtentConstraint=true] If true, the extent\n * constraint will be applied smoothly, i.e. allow the view to go slightly outside\n * of the given `extent`.\n * @property {number} [maxResolution] The maximum resolution used to determine\n * the resolution constraint. It is used together with `minResolution` (or\n * `maxZoom`) and `zoomFactor`. If unspecified it is calculated in such a way\n * that the projection's validity extent fits in a 256x256 px tile. If the\n * projection is Spherical Mercator (the default) then `maxResolution` defaults\n * to `40075016.68557849 / 256 = 156543.03392804097`.\n * @property {number} [minResolution] The minimum resolution used to determine\n * the resolution constraint. It is used together with `maxResolution` (or\n * `minZoom`) and `zoomFactor`. If unspecified it is calculated assuming 29\n * zoom levels (with a factor of 2). If the projection is Spherical Mercator\n * (the default) then `minResolution` defaults to\n * `40075016.68557849 / 256 / Math.pow(2, 28) = 0.0005831682455839253`.\n * @property {number} [maxZoom=28] The maximum zoom level used to determine the\n * resolution constraint. It is used together with `minZoom` (or\n * `maxResolution`) and `zoomFactor`. Note that if `minResolution` is also\n * provided, it is given precedence over `maxZoom`.\n * @property {number} [minZoom=0] The minimum zoom level used to determine the\n * resolution constraint. It is used together with `maxZoom` (or\n * `minResolution`) and `zoomFactor`. Note that if `maxResolution` is also\n * provided, it is given precedence over `minZoom`.\n * @property {boolean} [multiWorld=false] If `false` the view is constrained so\n * only one world is visible, and you cannot pan off the edge. If `true` the map\n * may show multiple worlds at low zoom levels. Only used if the `projection` is\n * global. Note that if `extent` is also provided it is given precedence.\n * @property {boolean} [constrainResolution=false] If true, the view will always\n * animate to the closest zoom level after an interaction; false means\n * intermediary zoom levels are allowed.\n * @property {boolean} [smoothResolutionConstraint=true] If true, the resolution\n * min/max values will be applied smoothly, i. e. allow the view to exceed slightly\n * the given resolution or zoom bounds.\n * @property {boolean} [showFullExtent=false] Allow the view to be zoomed out to\n * show the full configured extent. By default, when a view is configured with an\n * extent, users will not be able to zoom out so the viewport exceeds the extent in\n * either dimension. This means the full extent may not be visible if the viewport\n * is taller or wider than the aspect ratio of the configured extent. If\n * showFullExtent is true, the user will be able to zoom out so that the viewport\n * exceeds the height or width of the configured extent, but not both, allowing the\n * full extent to be shown.\n * @property {import(\"./proj.js\").ProjectionLike} [projection='EPSG:3857'] The\n * projection. The default is Spherical Mercator.\n * @property {number} [resolution] The initial resolution for the view. The\n * units are `projection` units per pixel (e.g. meters per pixel). An\n * alternative to setting this is to set `zoom`. Layer sources will not be\n * fetched if neither this nor `zoom` are defined, but they can be set later\n * with {@link #setZoom} or {@link #setResolution}.\n * @property {Array} [resolutions] Resolutions that determine the\n * zoom levels if specified. The index in the array corresponds to the zoom level,\n * therefore the resolution values have to be in descending order. It also constrains\n * the resolution by the minimum and maximum value. If set the `maxResolution`,\n * `minResolution`, `minZoom`, `maxZoom`, and `zoomFactor` options are ignored.\n * @property {number} [rotation=0] The initial rotation for the view in radians\n * (positive rotation clockwise, 0 means North).\n * @property {number} [zoom] Only used if `resolution` is not defined. Zoom\n * level used to calculate the initial resolution for the view.\n * @property {number} [zoomFactor=2] The zoom factor used to compute the\n * corresponding resolution.\n * @property {!Array} [padding=[0, 0, 0, 0]] Padding (in css pixels).\n * If the map viewport is partially covered with other content (overlays) along\n * its edges, this setting allows to shift the center of the viewport away from\n * that content. The order of the values is top, right, bottom, left.\n */\n\n/**\n * @typedef {Object} AnimationOptions\n * @property {import(\"./coordinate.js\").Coordinate} [center] The center of the view at the end of\n * the animation.\n * @property {number} [zoom] The zoom level of the view at the end of the\n * animation. This takes precedence over `resolution`.\n * @property {number} [resolution] The resolution of the view at the end\n * of the animation. If `zoom` is also provided, this option will be ignored.\n * @property {number} [rotation] The rotation of the view at the end of\n * the animation.\n * @property {import(\"./coordinate.js\").Coordinate} [anchor] Optional anchor to remain fixed\n * during a rotation or resolution animation.\n * @property {number} [duration=1000] The duration of the animation in milliseconds.\n * @property {function(number):number} [easing] The easing function used\n * during the animation (defaults to {@link module:ol/easing.inAndOut}).\n * The function will be called for each frame with a number representing a\n * fraction of the animation's duration. The function should return a number\n * between 0 and 1 representing the progress toward the destination state.\n */\n\n/**\n * @typedef {Object} State\n * @property {import(\"./coordinate.js\").Coordinate} center Center (in view projection coordinates).\n * @property {import(\"./proj/Projection.js\").default} projection Projection.\n * @property {number} resolution Resolution.\n * @property {import(\"./coordinate.js\").Coordinate} [nextCenter] The next center during an animation series.\n * @property {number} [nextResolution] The next resolution during an animation series.\n * @property {number} [nextRotation] The next rotation during an animation series.\n * @property {number} rotation Rotation.\n * @property {number} zoom Zoom.\n */\n\n/**\n * Like {@link import(\"./Map.js\").FrameState}, but just `viewState` and `extent`.\n * @typedef {Object} ViewStateLayerStateExtent\n * @property {State} viewState View state.\n * @property {import(\"./extent.js\").Extent} extent Extent (in user projection coordinates).\n * @property {Array} [layerStatesArray] Layer states.\n */\n\n/**\n * Default min zoom level for the map view.\n * @type {number}\n */\nconst DEFAULT_MIN_ZOOM = 0;\n\n/**\n * @typedef {import(\"./ObjectEventType\").Types|'change:center'|'change:resolution'|'change:rotation'} ViewObjectEventTypes\n */\n\n/***\n * @template Return\n * @typedef {import(\"./Observable\").OnSignature &\n * import(\"./Observable\").OnSignature &\n * import(\"./Observable\").CombinedOnSignature} ViewOnSignature\n */\n\n/**\n * @classdesc\n * A View object represents a simple 2D view of the map.\n *\n * This is the object to act upon to change the center, resolution,\n * and rotation of the map.\n *\n * A View has a `projection`. The projection determines the\n * coordinate system of the center, and its units determine the units of the\n * resolution (projection units per pixel). The default projection is\n * Web Mercator (EPSG:3857).\n *\n * ### The view states\n *\n * A View is determined by three states: `center`, `resolution`,\n * and `rotation`. Each state has a corresponding getter and setter, e.g.\n * `getCenter` and `setCenter` for the `center` state.\n *\n * The `zoom` state is actually not saved on the view: all computations\n * internally use the `resolution` state. Still, the `setZoom` and `getZoom`\n * methods are available, as well as `getResolutionForZoom` and\n * `getZoomForResolution` to switch from one system to the other.\n *\n * ### The constraints\n *\n * `setCenter`, `setResolution` and `setRotation` can be used to change the\n * states of the view, but any constraint defined in the constructor will\n * be applied along the way.\n *\n * A View object can have a *resolution constraint*, a *rotation constraint*\n * and a *center constraint*.\n *\n * The *resolution constraint* typically restricts min/max values and\n * snaps to specific resolutions. It is determined by the following\n * options: `resolutions`, `maxResolution`, `maxZoom` and `zoomFactor`.\n * If `resolutions` is set, the other three options are ignored. See\n * documentation for each option for more information. By default, the view\n * only has a min/max restriction and allow intermediary zoom levels when\n * pinch-zooming for example.\n *\n * The *rotation constraint* snaps to specific angles. It is determined\n * by the following options: `enableRotation` and `constrainRotation`.\n * By default rotation is allowed and its value is snapped to zero when approaching the\n * horizontal.\n *\n * The *center constraint* is determined by the `extent` option. By\n * default the view center is not constrained at all.\n *\n * ### Changing the view state\n *\n * It is important to note that `setZoom`, `setResolution`, `setCenter` and\n * `setRotation` are subject to the above mentioned constraints. As such, it\n * may sometimes not be possible to know in advance the resulting state of the\n * View. For example, calling `setResolution(10)` does not guarantee that\n * `getResolution()` will return `10`.\n *\n * A consequence of this is that, when applying a delta on the view state, one\n * should use `adjustCenter`, `adjustRotation`, `adjustZoom` and `adjustResolution`\n * rather than the corresponding setters. This will let view do its internal\n * computations. Besides, the `adjust*` methods also take an `anchor`\n * argument which allows specifying an origin for the transformation.\n *\n * ### Interacting with the view\n *\n * View constraints are usually only applied when the view is *at rest*, meaning that\n * no interaction or animation is ongoing. As such, if the user puts the view in a\n * state that is not equivalent to a constrained one (e.g. rotating the view when\n * the snap angle is 0), an animation will be triggered at the interaction end to\n * put back the view to a stable state;\n *\n * @api\n * @extends {BaseObject}\n */\nclass View extends BaseObject {\n /**\n * @param {ViewOptions} [options] View options.\n */\n constructor(options) {\n super();\n\n /***\n * @type {ViewOnSignature}\n */\n this.on;\n\n /***\n * @type {ViewOnSignature}\n */\n this.once;\n\n /***\n * @type {ViewOnSignature}\n */\n this.un;\n\n options = Object.assign({}, options);\n\n /**\n * @private\n * @type {Array}\n */\n this.hints_ = [0, 0];\n\n /**\n * @private\n * @type {Array>}\n */\n this.animations_ = [];\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.updateAnimationKey_;\n\n /**\n * @private\n * @const\n * @type {import(\"./proj/Projection.js\").default}\n */\n this.projection_ = createProjection(options.projection, 'EPSG:3857');\n\n /**\n * @private\n * @type {import(\"./size.js\").Size}\n */\n this.viewportSize_ = [100, 100];\n\n /**\n * @private\n * @type {import(\"./coordinate.js\").Coordinate|undefined}\n */\n this.targetCenter_ = null;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.targetResolution_;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.targetRotation_;\n\n /**\n * @private\n * @type {import(\"./coordinate.js\").Coordinate}\n */\n this.nextCenter_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.nextResolution_;\n\n /**\n * @private\n * @type {number}\n */\n this.nextRotation_;\n\n /**\n * @private\n * @type {import(\"./coordinate.js\").Coordinate|undefined}\n */\n this.cancelAnchor_ = undefined;\n\n if (options.projection) {\n disableCoordinateWarning();\n }\n if (options.center) {\n options.center = fromUserCoordinate(options.center, this.projection_);\n }\n if (options.extent) {\n options.extent = fromUserExtent(options.extent, this.projection_);\n }\n\n this.applyOptions_(options);\n }\n\n /**\n * Set up the view with the given options.\n * @param {ViewOptions} options View options.\n */\n applyOptions_(options) {\n const properties = Object.assign({}, options);\n for (const key in ViewProperty) {\n delete properties[key];\n }\n this.setProperties(properties, true);\n\n const resolutionConstraintInfo = createResolutionConstraint(options);\n\n /**\n * @private\n * @type {number}\n */\n this.maxResolution_ = resolutionConstraintInfo.maxResolution;\n\n /**\n * @private\n * @type {number}\n */\n this.minResolution_ = resolutionConstraintInfo.minResolution;\n\n /**\n * @private\n * @type {number}\n */\n this.zoomFactor_ = resolutionConstraintInfo.zoomFactor;\n\n /**\n * @private\n * @type {Array|undefined}\n */\n this.resolutions_ = options.resolutions;\n\n /**\n * @type {Array|undefined}\n * @private\n */\n this.padding_ = options.padding;\n\n /**\n * @private\n * @type {number}\n */\n this.minZoom_ = resolutionConstraintInfo.minZoom;\n\n const centerConstraint = createCenterConstraint(options);\n const resolutionConstraint = resolutionConstraintInfo.constraint;\n const rotationConstraint = createRotationConstraint(options);\n\n /**\n * @private\n * @type {Constraints}\n */\n this.constraints_ = {\n center: centerConstraint,\n resolution: resolutionConstraint,\n rotation: rotationConstraint,\n };\n\n this.setRotation(options.rotation !== undefined ? options.rotation : 0);\n this.setCenterInternal(\n options.center !== undefined ? options.center : null,\n );\n if (options.resolution !== undefined) {\n this.setResolution(options.resolution);\n } else if (options.zoom !== undefined) {\n this.setZoom(options.zoom);\n }\n }\n\n /**\n * Padding (in css pixels).\n * If the map viewport is partially covered with other content (overlays) along\n * its edges, this setting allows to shift the center of the viewport away from that\n * content. The order of the values in the array is top, right, bottom, left.\n * The default is no padding, which is equivalent to `[0, 0, 0, 0]`.\n * @type {Array|undefined}\n * @api\n */\n get padding() {\n return this.padding_;\n }\n set padding(padding) {\n let oldPadding = this.padding_;\n this.padding_ = padding;\n const center = this.getCenterInternal();\n if (center) {\n const newPadding = padding || [0, 0, 0, 0];\n oldPadding = oldPadding || [0, 0, 0, 0];\n const resolution = this.getResolution();\n const offsetX =\n (resolution / 2) *\n (newPadding[3] - oldPadding[3] + oldPadding[1] - newPadding[1]);\n const offsetY =\n (resolution / 2) *\n (newPadding[0] - oldPadding[0] + oldPadding[2] - newPadding[2]);\n this.setCenterInternal([center[0] + offsetX, center[1] - offsetY]);\n }\n }\n\n /**\n * Get an updated version of the view options used to construct the view. The\n * current resolution (or zoom), center, and rotation are applied to any stored\n * options. The provided options can be used to apply new min/max zoom or\n * resolution limits.\n * @param {ViewOptions} newOptions New options to be applied.\n * @return {ViewOptions} New options updated with the current view state.\n */\n getUpdatedOptions_(newOptions) {\n const options = this.getProperties();\n\n // preserve resolution (or zoom)\n if (options.resolution !== undefined) {\n options.resolution = this.getResolution();\n } else {\n options.zoom = this.getZoom();\n }\n\n // preserve center\n options.center = this.getCenterInternal();\n\n // preserve rotation\n options.rotation = this.getRotation();\n\n return Object.assign({}, options, newOptions);\n }\n\n /**\n * Animate the view. The view's center, zoom (or resolution), and rotation\n * can be animated for smooth transitions between view states. For example,\n * to animate the view to a new zoom level:\n *\n * view.animate({zoom: view.getZoom() + 1});\n *\n * By default, the animation lasts one second and uses in-and-out easing. You\n * can customize this behavior by including `duration` (in milliseconds) and\n * `easing` options (see {@link module:ol/easing}).\n *\n * To chain together multiple animations, call the method with multiple\n * animation objects. For example, to first zoom and then pan:\n *\n * view.animate({zoom: 10}, {center: [0, 0]});\n *\n * If you provide a function as the last argument to the animate method, it\n * will get called at the end of an animation series. The callback will be\n * called with `true` if the animation series completed on its own or `false`\n * if it was cancelled.\n *\n * Animations are cancelled by user interactions (e.g. dragging the map) or by\n * calling `view.setCenter()`, `view.setResolution()`, or `view.setRotation()`\n * (or another method that calls one of these).\n *\n * @param {...(AnimationOptions|function(boolean): void)} var_args Animation\n * options. Multiple animations can be run in series by passing multiple\n * options objects. To run multiple animations in parallel, call the method\n * multiple times. An optional callback can be provided as a final\n * argument. The callback will be called with a boolean indicating whether\n * the animation completed without being cancelled.\n * @api\n */\n animate(var_args) {\n if (this.isDef() && !this.getAnimating()) {\n this.resolveConstraints(0);\n }\n const args = new Array(arguments.length);\n for (let i = 0; i < args.length; ++i) {\n let options = arguments[i];\n if (options.center) {\n options = Object.assign({}, options);\n options.center = fromUserCoordinate(\n options.center,\n this.getProjection(),\n );\n }\n if (options.anchor) {\n options = Object.assign({}, options);\n options.anchor = fromUserCoordinate(\n options.anchor,\n this.getProjection(),\n );\n }\n args[i] = options;\n }\n this.animateInternal.apply(this, args);\n }\n\n /**\n * @param {...(AnimationOptions|function(boolean): void)} var_args Animation options.\n */\n animateInternal(var_args) {\n let animationCount = arguments.length;\n let callback;\n if (\n animationCount > 1 &&\n typeof arguments[animationCount - 1] === 'function'\n ) {\n callback = arguments[animationCount - 1];\n --animationCount;\n }\n\n let i = 0;\n for (; i < animationCount && !this.isDef(); ++i) {\n // if view properties are not yet set, shortcut to the final state\n const state = arguments[i];\n if (state.center) {\n this.setCenterInternal(state.center);\n }\n if (state.zoom !== undefined) {\n this.setZoom(state.zoom);\n } else if (state.resolution) {\n this.setResolution(state.resolution);\n }\n if (state.rotation !== undefined) {\n this.setRotation(state.rotation);\n }\n }\n if (i === animationCount) {\n if (callback) {\n animationCallback(callback, true);\n }\n return;\n }\n\n let start = Date.now();\n let center = this.targetCenter_.slice();\n let resolution = this.targetResolution_;\n let rotation = this.targetRotation_;\n const series = [];\n for (; i < animationCount; ++i) {\n const options = /** @type {AnimationOptions} */ (arguments[i]);\n\n const animation = {\n start: start,\n complete: false,\n anchor: options.anchor,\n duration: options.duration !== undefined ? options.duration : 1000,\n easing: options.easing || inAndOut,\n callback: callback,\n };\n\n if (options.center) {\n animation.sourceCenter = center;\n animation.targetCenter = options.center.slice();\n center = animation.targetCenter;\n }\n\n if (options.zoom !== undefined) {\n animation.sourceResolution = resolution;\n animation.targetResolution = this.getResolutionForZoom(options.zoom);\n resolution = animation.targetResolution;\n } else if (options.resolution) {\n animation.sourceResolution = resolution;\n animation.targetResolution = options.resolution;\n resolution = animation.targetResolution;\n }\n\n if (options.rotation !== undefined) {\n animation.sourceRotation = rotation;\n const delta =\n modulo(options.rotation - rotation + Math.PI, 2 * Math.PI) - Math.PI;\n animation.targetRotation = rotation + delta;\n rotation = animation.targetRotation;\n }\n\n // check if animation is a no-op\n if (isNoopAnimation(animation)) {\n animation.complete = true;\n // we still push it onto the series for callback handling\n } else {\n start += animation.duration;\n }\n series.push(animation);\n }\n this.animations_.push(series);\n this.setHint(ViewHint.ANIMATING, 1);\n this.updateAnimations_();\n }\n\n /**\n * Determine if the view is being animated.\n * @return {boolean} The view is being animated.\n * @api\n */\n getAnimating() {\n return this.hints_[ViewHint.ANIMATING] > 0;\n }\n\n /**\n * Determine if the user is interacting with the view, such as panning or zooming.\n * @return {boolean} The view is being interacted with.\n * @api\n */\n getInteracting() {\n return this.hints_[ViewHint.INTERACTING] > 0;\n }\n\n /**\n * Cancel any ongoing animations.\n * @api\n */\n cancelAnimations() {\n this.setHint(ViewHint.ANIMATING, -this.hints_[ViewHint.ANIMATING]);\n let anchor;\n for (let i = 0, ii = this.animations_.length; i < ii; ++i) {\n const series = this.animations_[i];\n if (series[0].callback) {\n animationCallback(series[0].callback, false);\n }\n if (!anchor) {\n for (let j = 0, jj = series.length; j < jj; ++j) {\n const animation = series[j];\n if (!animation.complete) {\n anchor = animation.anchor;\n break;\n }\n }\n }\n }\n this.animations_.length = 0;\n this.cancelAnchor_ = anchor;\n this.nextCenter_ = null;\n this.nextResolution_ = NaN;\n this.nextRotation_ = NaN;\n }\n\n /**\n * Update all animations.\n */\n updateAnimations_() {\n if (this.updateAnimationKey_ !== undefined) {\n cancelAnimationFrame(this.updateAnimationKey_);\n this.updateAnimationKey_ = undefined;\n }\n if (!this.getAnimating()) {\n return;\n }\n const now = Date.now();\n let more = false;\n for (let i = this.animations_.length - 1; i >= 0; --i) {\n const series = this.animations_[i];\n let seriesComplete = true;\n for (let j = 0, jj = series.length; j < jj; ++j) {\n const animation = series[j];\n if (animation.complete) {\n continue;\n }\n const elapsed = now - animation.start;\n let fraction =\n animation.duration > 0 ? elapsed / animation.duration : 1;\n if (fraction >= 1) {\n animation.complete = true;\n fraction = 1;\n } else {\n seriesComplete = false;\n }\n const progress = animation.easing(fraction);\n if (animation.sourceCenter) {\n const x0 = animation.sourceCenter[0];\n const y0 = animation.sourceCenter[1];\n const x1 = animation.targetCenter[0];\n const y1 = animation.targetCenter[1];\n this.nextCenter_ = animation.targetCenter;\n const x = x0 + progress * (x1 - x0);\n const y = y0 + progress * (y1 - y0);\n this.targetCenter_ = [x, y];\n }\n if (animation.sourceResolution && animation.targetResolution) {\n const resolution =\n progress === 1\n ? animation.targetResolution\n : animation.sourceResolution +\n progress *\n (animation.targetResolution - animation.sourceResolution);\n if (animation.anchor) {\n const size = this.getViewportSize_(this.getRotation());\n const constrainedResolution = this.constraints_.resolution(\n resolution,\n 0,\n size,\n true,\n );\n this.targetCenter_ = this.calculateCenterZoom(\n constrainedResolution,\n animation.anchor,\n );\n }\n this.nextResolution_ = animation.targetResolution;\n this.targetResolution_ = resolution;\n this.applyTargetState_(true);\n }\n if (\n animation.sourceRotation !== undefined &&\n animation.targetRotation !== undefined\n ) {\n const rotation =\n progress === 1\n ? modulo(animation.targetRotation + Math.PI, 2 * Math.PI) -\n Math.PI\n : animation.sourceRotation +\n progress *\n (animation.targetRotation - animation.sourceRotation);\n if (animation.anchor) {\n const constrainedRotation = this.constraints_.rotation(\n rotation,\n true,\n );\n this.targetCenter_ = this.calculateCenterRotate(\n constrainedRotation,\n animation.anchor,\n );\n }\n this.nextRotation_ = animation.targetRotation;\n this.targetRotation_ = rotation;\n }\n this.applyTargetState_(true);\n more = true;\n if (!animation.complete) {\n break;\n }\n }\n if (seriesComplete) {\n this.animations_[i] = null;\n this.setHint(ViewHint.ANIMATING, -1);\n this.nextCenter_ = null;\n this.nextResolution_ = NaN;\n this.nextRotation_ = NaN;\n const callback = series[0].callback;\n if (callback) {\n animationCallback(callback, true);\n }\n }\n }\n // prune completed series\n this.animations_ = this.animations_.filter(Boolean);\n if (more && this.updateAnimationKey_ === undefined) {\n this.updateAnimationKey_ = requestAnimationFrame(\n this.updateAnimations_.bind(this),\n );\n }\n }\n\n /**\n * @param {number} rotation Target rotation.\n * @param {import(\"./coordinate.js\").Coordinate} anchor Rotation anchor.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} Center for rotation and anchor.\n */\n calculateCenterRotate(rotation, anchor) {\n let center;\n const currentCenter = this.getCenterInternal();\n if (currentCenter !== undefined) {\n center = [currentCenter[0] - anchor[0], currentCenter[1] - anchor[1]];\n rotateCoordinate(center, rotation - this.getRotation());\n addCoordinate(center, anchor);\n }\n return center;\n }\n\n /**\n * @param {number} resolution Target resolution.\n * @param {import(\"./coordinate.js\").Coordinate} anchor Zoom anchor.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} Center for resolution and anchor.\n */\n calculateCenterZoom(resolution, anchor) {\n let center;\n const currentCenter = this.getCenterInternal();\n const currentResolution = this.getResolution();\n if (currentCenter !== undefined && currentResolution !== undefined) {\n const x =\n anchor[0] -\n (resolution * (anchor[0] - currentCenter[0])) / currentResolution;\n const y =\n anchor[1] -\n (resolution * (anchor[1] - currentCenter[1])) / currentResolution;\n center = [x, y];\n }\n return center;\n }\n\n /**\n * Returns the current viewport size.\n * @private\n * @param {number} [rotation] Take into account the rotation of the viewport when giving the size\n * @return {import(\"./size.js\").Size} Viewport size or `[100, 100]` when no viewport is found.\n */\n getViewportSize_(rotation) {\n const size = this.viewportSize_;\n if (rotation) {\n const w = size[0];\n const h = size[1];\n return [\n Math.abs(w * Math.cos(rotation)) + Math.abs(h * Math.sin(rotation)),\n Math.abs(w * Math.sin(rotation)) + Math.abs(h * Math.cos(rotation)),\n ];\n }\n return size;\n }\n\n /**\n * Stores the viewport size on the view. The viewport size is not read every time from the DOM\n * to avoid performance hit and layout reflow.\n * This should be done on map size change.\n * Note: the constraints are not resolved during an animation to avoid stopping it\n * @param {import(\"./size.js\").Size} [size] Viewport size; if undefined, [100, 100] is assumed\n */\n setViewportSize(size) {\n this.viewportSize_ = Array.isArray(size) ? size.slice() : [100, 100];\n if (!this.getAnimating()) {\n this.resolveConstraints(0);\n }\n }\n\n /**\n * Get the view center.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} The center of the view.\n * @observable\n * @api\n */\n getCenter() {\n const center = this.getCenterInternal();\n if (!center) {\n return center;\n }\n return toUserCoordinate(center, this.getProjection());\n }\n\n /**\n * Get the view center without transforming to user projection.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} The center of the view.\n */\n getCenterInternal() {\n return /** @type {import(\"./coordinate.js\").Coordinate|undefined} */ (\n this.get(ViewProperty.CENTER)\n );\n }\n\n /**\n * @return {Constraints} Constraints.\n */\n getConstraints() {\n return this.constraints_;\n }\n\n /**\n * @return {boolean} Resolution constraint is set\n */\n getConstrainResolution() {\n return this.get('constrainResolution');\n }\n\n /**\n * @param {Array} [hints] Destination array.\n * @return {Array} Hint.\n */\n getHints(hints) {\n if (hints !== undefined) {\n hints[0] = this.hints_[0];\n hints[1] = this.hints_[1];\n return hints;\n }\n return this.hints_.slice();\n }\n\n /**\n * Calculate the extent for the current view state and the passed box size.\n * @param {import(\"./size.js\").Size} [size] The pixel dimensions of the box\n * into which the calculated extent should fit. Defaults to the size of the\n * map the view is associated with.\n * If no map or multiple maps are connected to the view, provide the desired\n * box size (e.g. `map.getSize()`).\n * @return {import(\"./extent.js\").Extent} Extent.\n * @api\n */\n calculateExtent(size) {\n const extent = this.calculateExtentInternal(size);\n return toUserExtent(extent, this.getProjection());\n }\n\n /**\n * @param {import(\"./size.js\").Size} [size] Box pixel size. If not provided,\n * the map's last known viewport size will be used.\n * @return {import(\"./extent.js\").Extent} Extent.\n */\n calculateExtentInternal(size) {\n size = size || this.getViewportSizeMinusPadding_();\n const center = /** @type {!import(\"./coordinate.js\").Coordinate} */ (\n this.getCenterInternal()\n );\n assert(center, 'The view center is not defined');\n const resolution = /** @type {!number} */ (this.getResolution());\n assert(resolution !== undefined, 'The view resolution is not defined');\n const rotation = /** @type {!number} */ (this.getRotation());\n assert(rotation !== undefined, 'The view rotation is not defined');\n\n return getForViewAndSize(center, resolution, rotation, size);\n }\n\n /**\n * Get the maximum resolution of the view.\n * @return {number} The maximum resolution of the view.\n * @api\n */\n getMaxResolution() {\n return this.maxResolution_;\n }\n\n /**\n * Get the minimum resolution of the view.\n * @return {number} The minimum resolution of the view.\n * @api\n */\n getMinResolution() {\n return this.minResolution_;\n }\n\n /**\n * Get the maximum zoom level for the view.\n * @return {number} The maximum zoom level.\n * @api\n */\n getMaxZoom() {\n return /** @type {number} */ (\n this.getZoomForResolution(this.minResolution_)\n );\n }\n\n /**\n * Set a new maximum zoom level for the view.\n * @param {number} zoom The maximum zoom level.\n * @api\n */\n setMaxZoom(zoom) {\n this.applyOptions_(this.getUpdatedOptions_({maxZoom: zoom}));\n }\n\n /**\n * Get the minimum zoom level for the view.\n * @return {number} The minimum zoom level.\n * @api\n */\n getMinZoom() {\n return /** @type {number} */ (\n this.getZoomForResolution(this.maxResolution_)\n );\n }\n\n /**\n * Set a new minimum zoom level for the view.\n * @param {number} zoom The minimum zoom level.\n * @api\n */\n setMinZoom(zoom) {\n this.applyOptions_(this.getUpdatedOptions_({minZoom: zoom}));\n }\n\n /**\n * Set whether the view should allow intermediary zoom levels.\n * @param {boolean} enabled Whether the resolution is constrained.\n * @api\n */\n setConstrainResolution(enabled) {\n this.applyOptions_(this.getUpdatedOptions_({constrainResolution: enabled}));\n }\n\n /**\n * Get the view projection.\n * @return {import(\"./proj/Projection.js\").default} The projection of the view.\n * @api\n */\n getProjection() {\n return this.projection_;\n }\n\n /**\n * Get the view resolution.\n * @return {number|undefined} The resolution of the view.\n * @observable\n * @api\n */\n getResolution() {\n return /** @type {number|undefined} */ (this.get(ViewProperty.RESOLUTION));\n }\n\n /**\n * Get the resolutions for the view. This returns the array of resolutions\n * passed to the constructor of the View, or undefined if none were given.\n * @return {Array|undefined} The resolutions of the view.\n * @api\n */\n getResolutions() {\n return this.resolutions_;\n }\n\n /**\n * Get the resolution for a provided extent (in map units) and size (in pixels).\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {import(\"./size.js\").Size} [size] Box pixel size.\n * @return {number} The resolution at which the provided extent will render at\n * the given size.\n * @api\n */\n getResolutionForExtent(extent, size) {\n return this.getResolutionForExtentInternal(\n fromUserExtent(extent, this.getProjection()),\n size,\n );\n }\n\n /**\n * Get the resolution for a provided extent (in map units) and size (in pixels).\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {import(\"./size.js\").Size} [size] Box pixel size.\n * @return {number} The resolution at which the provided extent will render at\n * the given size.\n */\n getResolutionForExtentInternal(extent, size) {\n size = size || this.getViewportSizeMinusPadding_();\n const xResolution = getWidth(extent) / size[0];\n const yResolution = getHeight(extent) / size[1];\n return Math.max(xResolution, yResolution);\n }\n\n /**\n * Return a function that returns a value between 0 and 1 for a\n * resolution. Exponential scaling is assumed.\n * @param {number} [power] Power.\n * @return {function(number): number} Resolution for value function.\n */\n getResolutionForValueFunction(power) {\n power = power || 2;\n const maxResolution = this.getConstrainedResolution(this.maxResolution_);\n const minResolution = this.minResolution_;\n const max = Math.log(maxResolution / minResolution) / Math.log(power);\n return (\n /**\n * @param {number} value Value.\n * @return {number} Resolution.\n */\n function (value) {\n const resolution = maxResolution / Math.pow(power, value * max);\n return resolution;\n }\n );\n }\n\n /**\n * Get the view rotation.\n * @return {number} The rotation of the view in radians.\n * @observable\n * @api\n */\n getRotation() {\n return /** @type {number} */ (this.get(ViewProperty.ROTATION));\n }\n\n /**\n * Return a function that returns a resolution for a value between\n * 0 and 1. Exponential scaling is assumed.\n * @param {number} [power] Power.\n * @return {function(number): number} Value for resolution function.\n */\n getValueForResolutionFunction(power) {\n const logPower = Math.log(power || 2);\n const maxResolution = this.getConstrainedResolution(this.maxResolution_);\n const minResolution = this.minResolution_;\n const max = Math.log(maxResolution / minResolution) / logPower;\n return (\n /**\n * @param {number} resolution Resolution.\n * @return {number} Value.\n */\n function (resolution) {\n const value = Math.log(maxResolution / resolution) / logPower / max;\n return value;\n }\n );\n }\n\n /**\n * Returns the size of the viewport minus padding.\n * @private\n * @param {number} [rotation] Take into account the rotation of the viewport when giving the size\n * @return {import(\"./size.js\").Size} Viewport size reduced by the padding.\n */\n getViewportSizeMinusPadding_(rotation) {\n let size = this.getViewportSize_(rotation);\n const padding = this.padding_;\n if (padding) {\n size = [\n size[0] - padding[1] - padding[3],\n size[1] - padding[0] - padding[2],\n ];\n }\n return size;\n }\n\n /**\n * @return {State} View state.\n */\n getState() {\n const projection = this.getProjection();\n const resolution = this.getResolution();\n const rotation = this.getRotation();\n let center = /** @type {import(\"./coordinate.js\").Coordinate} */ (\n this.getCenterInternal()\n );\n const padding = this.padding_;\n if (padding) {\n const reducedSize = this.getViewportSizeMinusPadding_();\n center = calculateCenterOn(\n center,\n this.getViewportSize_(),\n [reducedSize[0] / 2 + padding[3], reducedSize[1] / 2 + padding[0]],\n resolution,\n rotation,\n );\n }\n return {\n center: center.slice(0),\n projection: projection !== undefined ? projection : null,\n resolution: resolution,\n nextCenter: this.nextCenter_,\n nextResolution: this.nextResolution_,\n nextRotation: this.nextRotation_,\n rotation: rotation,\n zoom: this.getZoom(),\n };\n }\n\n /**\n * @return {ViewStateLayerStateExtent} Like `FrameState`, but just `viewState` and `extent`.\n */\n getViewStateAndExtent() {\n return {\n viewState: this.getState(),\n extent: this.calculateExtent(),\n };\n }\n\n /**\n * Get the current zoom level. This method may return non-integer zoom levels\n * if the view does not constrain the resolution, or if an interaction or\n * animation is underway.\n * @return {number|undefined} Zoom.\n * @api\n */\n getZoom() {\n let zoom;\n const resolution = this.getResolution();\n if (resolution !== undefined) {\n zoom = this.getZoomForResolution(resolution);\n }\n return zoom;\n }\n\n /**\n * Get the zoom level for a resolution.\n * @param {number} resolution The resolution.\n * @return {number|undefined} The zoom level for the provided resolution.\n * @api\n */\n getZoomForResolution(resolution) {\n let offset = this.minZoom_ || 0;\n let max, zoomFactor;\n if (this.resolutions_) {\n const nearest = linearFindNearest(this.resolutions_, resolution, 1);\n offset = nearest;\n max = this.resolutions_[nearest];\n if (nearest == this.resolutions_.length - 1) {\n zoomFactor = 2;\n } else {\n zoomFactor = max / this.resolutions_[nearest + 1];\n }\n } else {\n max = this.maxResolution_;\n zoomFactor = this.zoomFactor_;\n }\n return offset + Math.log(max / resolution) / Math.log(zoomFactor);\n }\n\n /**\n * Get the resolution for a zoom level.\n * @param {number} zoom Zoom level.\n * @return {number} The view resolution for the provided zoom level.\n * @api\n */\n getResolutionForZoom(zoom) {\n if (this.resolutions_?.length) {\n if (this.resolutions_.length === 1) {\n return this.resolutions_[0];\n }\n const baseLevel = clamp(\n Math.floor(zoom),\n 0,\n this.resolutions_.length - 2,\n );\n const zoomFactor =\n this.resolutions_[baseLevel] / this.resolutions_[baseLevel + 1];\n return (\n this.resolutions_[baseLevel] /\n Math.pow(zoomFactor, clamp(zoom - baseLevel, 0, 1))\n );\n }\n return (\n this.maxResolution_ / Math.pow(this.zoomFactor_, zoom - this.minZoom_)\n );\n }\n\n /**\n * Fit the given geometry or extent based on the given map size and border.\n * The size is pixel dimensions of the box to fit the extent into.\n * In most cases you will want to use the map size, that is `map.getSize()`.\n * Takes care of the map angle.\n * @param {import(\"./geom/SimpleGeometry.js\").default|import(\"./extent.js\").Extent} geometryOrExtent The geometry or\n * extent to fit the view to.\n * @param {FitOptions} [options] Options.\n * @api\n */\n fit(geometryOrExtent, options) {\n /** @type {import(\"./geom/SimpleGeometry.js\").default} */\n let geometry;\n assert(\n Array.isArray(geometryOrExtent) ||\n typeof (/** @type {?} */ (geometryOrExtent).getSimplifiedGeometry) ===\n 'function',\n 'Invalid extent or geometry provided as `geometry`',\n );\n if (Array.isArray(geometryOrExtent)) {\n assert(\n !isEmpty(geometryOrExtent),\n 'Cannot fit empty extent provided as `geometry`',\n );\n const extent = fromUserExtent(geometryOrExtent, this.getProjection());\n geometry = polygonFromExtent(extent);\n } else if (geometryOrExtent.getType() === 'Circle') {\n const extent = fromUserExtent(\n geometryOrExtent.getExtent(),\n this.getProjection(),\n );\n geometry = polygonFromExtent(extent);\n geometry.rotate(this.getRotation(), getCenter(extent));\n } else {\n const userProjection = getUserProjection();\n if (userProjection) {\n geometry = /** @type {import(\"./geom/SimpleGeometry.js\").default} */ (\n geometryOrExtent\n .clone()\n .transform(userProjection, this.getProjection())\n );\n } else {\n geometry = geometryOrExtent;\n }\n }\n\n this.fitInternal(geometry, options);\n }\n\n /**\n * Calculate rotated extent\n * @param {import(\"./geom/SimpleGeometry.js\").default} geometry The geometry.\n * @return {import(\"./extent\").Extent} The rotated extent for the geometry.\n */\n rotatedExtentForGeometry(geometry) {\n const rotation = this.getRotation();\n const cosAngle = Math.cos(rotation);\n const sinAngle = Math.sin(-rotation);\n const coords = geometry.getFlatCoordinates();\n const stride = geometry.getStride();\n let minRotX = +Infinity;\n let minRotY = +Infinity;\n let maxRotX = -Infinity;\n let maxRotY = -Infinity;\n for (let i = 0, ii = coords.length; i < ii; i += stride) {\n const rotX = coords[i] * cosAngle - coords[i + 1] * sinAngle;\n const rotY = coords[i] * sinAngle + coords[i + 1] * cosAngle;\n minRotX = Math.min(minRotX, rotX);\n minRotY = Math.min(minRotY, rotY);\n maxRotX = Math.max(maxRotX, rotX);\n maxRotY = Math.max(maxRotY, rotY);\n }\n return [minRotX, minRotY, maxRotX, maxRotY];\n }\n\n /**\n * @param {import(\"./geom/SimpleGeometry.js\").default} geometry The geometry.\n * @param {FitOptions} [options] Options.\n */\n fitInternal(geometry, options) {\n options = options || {};\n let size = options.size;\n if (!size) {\n size = this.getViewportSizeMinusPadding_();\n }\n const padding =\n options.padding !== undefined ? options.padding : [0, 0, 0, 0];\n const nearest = options.nearest !== undefined ? options.nearest : false;\n let minResolution;\n if (options.minResolution !== undefined) {\n minResolution = options.minResolution;\n } else if (options.maxZoom !== undefined) {\n minResolution = this.getResolutionForZoom(options.maxZoom);\n } else {\n minResolution = 0;\n }\n\n const rotatedExtent = this.rotatedExtentForGeometry(geometry);\n\n // calculate resolution\n let resolution = this.getResolutionForExtentInternal(rotatedExtent, [\n size[0] - padding[1] - padding[3],\n size[1] - padding[0] - padding[2],\n ]);\n resolution = isNaN(resolution)\n ? minResolution\n : Math.max(resolution, minResolution);\n resolution = this.getConstrainedResolution(resolution, nearest ? 0 : 1);\n\n // calculate center\n const rotation = this.getRotation();\n const sinAngle = Math.sin(rotation);\n const cosAngle = Math.cos(rotation);\n const centerRot = getCenter(rotatedExtent);\n centerRot[0] += ((padding[1] - padding[3]) / 2) * resolution;\n centerRot[1] += ((padding[0] - padding[2]) / 2) * resolution;\n const centerX = centerRot[0] * cosAngle - centerRot[1] * sinAngle;\n const centerY = centerRot[1] * cosAngle + centerRot[0] * sinAngle;\n const center = this.getConstrainedCenter([centerX, centerY], resolution);\n const callback = options.callback ? options.callback : VOID;\n\n if (options.duration !== undefined) {\n this.animateInternal(\n {\n resolution: resolution,\n center: center,\n duration: options.duration,\n easing: options.easing,\n },\n callback,\n );\n } else {\n this.targetResolution_ = resolution;\n this.targetCenter_ = center;\n this.applyTargetState_(false, true);\n animationCallback(callback, true);\n }\n }\n\n /**\n * Center on coordinate and view position.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"./size.js\").Size} size Box pixel size.\n * @param {import(\"./pixel.js\").Pixel} position Position on the view to center on.\n * @api\n */\n centerOn(coordinate, size, position) {\n this.centerOnInternal(\n fromUserCoordinate(coordinate, this.getProjection()),\n size,\n position,\n );\n }\n\n /**\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"./size.js\").Size} size Box pixel size.\n * @param {import(\"./pixel.js\").Pixel} position Position on the view to center on.\n */\n centerOnInternal(coordinate, size, position) {\n this.setCenterInternal(\n calculateCenterOn(\n coordinate,\n size,\n position,\n this.getResolution(),\n this.getRotation(),\n ),\n );\n }\n\n /**\n * Calculates the shift between map and viewport center.\n * @param {import(\"./coordinate.js\").Coordinate} center Center.\n * @param {number} resolution Resolution.\n * @param {number} rotation Rotation.\n * @param {import(\"./size.js\").Size} size Size.\n * @return {Array|undefined} Center shift.\n */\n calculateCenterShift(center, resolution, rotation, size) {\n let centerShift;\n const padding = this.padding_;\n if (padding && center) {\n const reducedSize = this.getViewportSizeMinusPadding_(-rotation);\n const shiftedCenter = calculateCenterOn(\n center,\n size,\n [reducedSize[0] / 2 + padding[3], reducedSize[1] / 2 + padding[0]],\n resolution,\n rotation,\n );\n centerShift = [\n center[0] - shiftedCenter[0],\n center[1] - shiftedCenter[1],\n ];\n }\n return centerShift;\n }\n\n /**\n * @return {boolean} Is defined.\n */\n isDef() {\n return !!this.getCenterInternal() && this.getResolution() !== undefined;\n }\n\n /**\n * Adds relative coordinates to the center of the view. Any extent constraint will apply.\n * @param {import(\"./coordinate.js\").Coordinate} deltaCoordinates Relative value to add.\n * @api\n */\n adjustCenter(deltaCoordinates) {\n const center = toUserCoordinate(this.targetCenter_, this.getProjection());\n this.setCenter([\n center[0] + deltaCoordinates[0],\n center[1] + deltaCoordinates[1],\n ]);\n }\n\n /**\n * Adds relative coordinates to the center of the view. Any extent constraint will apply.\n * @param {import(\"./coordinate.js\").Coordinate} deltaCoordinates Relative value to add.\n */\n adjustCenterInternal(deltaCoordinates) {\n const center = this.targetCenter_;\n this.setCenterInternal([\n center[0] + deltaCoordinates[0],\n center[1] + deltaCoordinates[1],\n ]);\n }\n\n /**\n * Multiply the view resolution by a ratio, optionally using an anchor. Any resolution\n * constraint will apply.\n * @param {number} ratio The ratio to apply on the view resolution.\n * @param {import(\"./coordinate.js\").Coordinate} [anchor] The origin of the transformation.\n * @api\n */\n adjustResolution(ratio, anchor) {\n anchor = anchor && fromUserCoordinate(anchor, this.getProjection());\n this.adjustResolutionInternal(ratio, anchor);\n }\n\n /**\n * Multiply the view resolution by a ratio, optionally using an anchor. Any resolution\n * constraint will apply.\n * @param {number} ratio The ratio to apply on the view resolution.\n * @param {import(\"./coordinate.js\").Coordinate} [anchor] The origin of the transformation.\n */\n adjustResolutionInternal(ratio, anchor) {\n const isMoving = this.getAnimating() || this.getInteracting();\n const size = this.getViewportSize_(this.getRotation());\n const newResolution = this.constraints_.resolution(\n this.targetResolution_ * ratio,\n 0,\n size,\n isMoving,\n );\n\n if (anchor) {\n this.targetCenter_ = this.calculateCenterZoom(newResolution, anchor);\n }\n\n this.targetResolution_ *= ratio;\n this.applyTargetState_();\n }\n\n /**\n * Adds a value to the view zoom level, optionally using an anchor. Any resolution\n * constraint will apply.\n * @param {number} delta Relative value to add to the zoom level.\n * @param {import(\"./coordinate.js\").Coordinate} [anchor] The origin of the transformation.\n * @api\n */\n adjustZoom(delta, anchor) {\n this.adjustResolution(Math.pow(this.zoomFactor_, -delta), anchor);\n }\n\n /**\n * Adds a value to the view rotation, optionally using an anchor. Any rotation\n * constraint will apply.\n * @param {number} delta Relative value to add to the zoom rotation, in radians.\n * @param {import(\"./coordinate.js\").Coordinate} [anchor] The rotation center.\n * @api\n */\n adjustRotation(delta, anchor) {\n if (anchor) {\n anchor = fromUserCoordinate(anchor, this.getProjection());\n }\n this.adjustRotationInternal(delta, anchor);\n }\n\n /**\n * @param {number} delta Relative value to add to the zoom rotation, in radians.\n * @param {import(\"./coordinate.js\").Coordinate} [anchor] The rotation center.\n */\n adjustRotationInternal(delta, anchor) {\n const isMoving = this.getAnimating() || this.getInteracting();\n const newRotation = this.constraints_.rotation(\n this.targetRotation_ + delta,\n isMoving,\n );\n if (anchor) {\n this.targetCenter_ = this.calculateCenterRotate(newRotation, anchor);\n }\n this.targetRotation_ += delta;\n this.applyTargetState_();\n }\n\n /**\n * Set the center of the current view. Any extent constraint will apply.\n * @param {import(\"./coordinate.js\").Coordinate|undefined} center The center of the view.\n * @observable\n * @api\n */\n setCenter(center) {\n this.setCenterInternal(\n center ? fromUserCoordinate(center, this.getProjection()) : center,\n );\n }\n\n /**\n * Set the center using the view projection (not the user projection).\n * @param {import(\"./coordinate.js\").Coordinate|undefined} center The center of the view.\n */\n setCenterInternal(center) {\n this.targetCenter_ = center;\n this.applyTargetState_();\n }\n\n /**\n * @param {import(\"./ViewHint.js\").default} hint Hint.\n * @param {number} delta Delta.\n * @return {number} New value.\n */\n setHint(hint, delta) {\n this.hints_[hint] += delta;\n this.changed();\n return this.hints_[hint];\n }\n\n /**\n * Set the resolution for this view. Any resolution constraint will apply.\n * @param {number|undefined} resolution The resolution of the view.\n * @observable\n * @api\n */\n setResolution(resolution) {\n this.targetResolution_ = resolution;\n this.applyTargetState_();\n }\n\n /**\n * Set the rotation for this view. Any rotation constraint will apply.\n * @param {number} rotation The rotation of the view in radians.\n * @observable\n * @api\n */\n setRotation(rotation) {\n this.targetRotation_ = rotation;\n this.applyTargetState_();\n }\n\n /**\n * Zoom to a specific zoom level. Any resolution constrain will apply.\n * @param {number} zoom Zoom level.\n * @api\n */\n setZoom(zoom) {\n this.setResolution(this.getResolutionForZoom(zoom));\n }\n\n /**\n * Recompute rotation/resolution/center based on target values.\n * Note: we have to compute rotation first, then resolution and center considering that\n * parameters can influence one another in case a view extent constraint is present.\n * @param {boolean} [doNotCancelAnims] Do not cancel animations.\n * @param {boolean} [forceMoving] Apply constraints as if the view is moving.\n * @private\n */\n applyTargetState_(doNotCancelAnims, forceMoving) {\n const isMoving =\n this.getAnimating() || this.getInteracting() || forceMoving;\n\n // compute rotation\n const newRotation = this.constraints_.rotation(\n this.targetRotation_,\n isMoving,\n );\n const size = this.getViewportSize_(newRotation);\n const newResolution = this.constraints_.resolution(\n this.targetResolution_,\n 0,\n size,\n isMoving,\n );\n const newCenter = this.constraints_.center(\n this.targetCenter_,\n newResolution,\n size,\n isMoving,\n this.calculateCenterShift(\n this.targetCenter_,\n newResolution,\n newRotation,\n size,\n ),\n );\n\n if (this.get(ViewProperty.ROTATION) !== newRotation) {\n this.set(ViewProperty.ROTATION, newRotation);\n }\n if (this.get(ViewProperty.RESOLUTION) !== newResolution) {\n this.set(ViewProperty.RESOLUTION, newResolution);\n this.set('zoom', this.getZoom(), true);\n }\n if (\n !newCenter ||\n !this.get(ViewProperty.CENTER) ||\n !equals(this.get(ViewProperty.CENTER), newCenter)\n ) {\n this.set(ViewProperty.CENTER, newCenter);\n }\n\n if (this.getAnimating() && !doNotCancelAnims) {\n this.cancelAnimations();\n }\n this.cancelAnchor_ = undefined;\n }\n\n /**\n * If any constraints need to be applied, an animation will be triggered.\n * This is typically done on interaction end.\n * Note: calling this with a duration of 0 will apply the constrained values straight away,\n * without animation.\n * @param {number} [duration] The animation duration in ms.\n * @param {number} [resolutionDirection] Which direction to zoom.\n * @param {import(\"./coordinate.js\").Coordinate} [anchor] The origin of the transformation.\n */\n resolveConstraints(duration, resolutionDirection, anchor) {\n duration = duration !== undefined ? duration : 200;\n const direction = resolutionDirection || 0;\n\n const newRotation = this.constraints_.rotation(this.targetRotation_);\n const size = this.getViewportSize_(newRotation);\n const newResolution = this.constraints_.resolution(\n this.targetResolution_,\n direction,\n size,\n );\n const newCenter = this.constraints_.center(\n this.targetCenter_,\n newResolution,\n size,\n false,\n this.calculateCenterShift(\n this.targetCenter_,\n newResolution,\n newRotation,\n size,\n ),\n );\n\n if (duration === 0 && !this.cancelAnchor_) {\n this.targetResolution_ = newResolution;\n this.targetRotation_ = newRotation;\n this.targetCenter_ = newCenter;\n this.applyTargetState_();\n return;\n }\n\n anchor = anchor || (duration === 0 ? this.cancelAnchor_ : undefined);\n this.cancelAnchor_ = undefined;\n\n if (\n this.getResolution() !== newResolution ||\n this.getRotation() !== newRotation ||\n !this.getCenterInternal() ||\n !equals(this.getCenterInternal(), newCenter)\n ) {\n if (this.getAnimating()) {\n this.cancelAnimations();\n }\n\n this.animateInternal({\n rotation: newRotation,\n center: newCenter,\n resolution: newResolution,\n duration: duration,\n easing: easeOut,\n anchor: anchor,\n });\n }\n }\n\n /**\n * Notify the View that an interaction has started.\n * The view state will be resolved to a stable one if needed\n * (depending on its constraints).\n * @api\n */\n beginInteraction() {\n this.resolveConstraints(0);\n\n this.setHint(ViewHint.INTERACTING, 1);\n }\n\n /**\n * Notify the View that an interaction has ended. The view state will be resolved\n * to a stable one if needed (depending on its constraints).\n * @param {number} [duration] Animation duration in ms.\n * @param {number} [resolutionDirection] Which direction to zoom.\n * @param {import(\"./coordinate.js\").Coordinate} [anchor] The origin of the transformation.\n * @api\n */\n endInteraction(duration, resolutionDirection, anchor) {\n anchor = anchor && fromUserCoordinate(anchor, this.getProjection());\n this.endInteractionInternal(duration, resolutionDirection, anchor);\n }\n\n /**\n * Notify the View that an interaction has ended. The view state will be resolved\n * to a stable one if needed (depending on its constraints).\n * @param {number} [duration] Animation duration in ms.\n * @param {number} [resolutionDirection] Which direction to zoom.\n * @param {import(\"./coordinate.js\").Coordinate} [anchor] The origin of the transformation.\n */\n endInteractionInternal(duration, resolutionDirection, anchor) {\n if (!this.getInteracting()) {\n return;\n }\n this.setHint(ViewHint.INTERACTING, -1);\n this.resolveConstraints(duration, resolutionDirection, anchor);\n }\n\n /**\n * Get a valid position for the view center according to the current constraints.\n * @param {import(\"./coordinate.js\").Coordinate|undefined} targetCenter Target center position.\n * @param {number} [targetResolution] Target resolution. If not supplied, the current one will be used.\n * This is useful to guess a valid center position at a different zoom level.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} Valid center position.\n */\n getConstrainedCenter(targetCenter, targetResolution) {\n const size = this.getViewportSize_(this.getRotation());\n return this.constraints_.center(\n targetCenter,\n targetResolution || this.getResolution(),\n size,\n );\n }\n\n /**\n * Get a valid zoom level according to the current view constraints.\n * @param {number|undefined} targetZoom Target zoom.\n * @param {number} [direction] Indicate which resolution should be used\n * by a renderer if the view resolution does not match any resolution of the tile source.\n * If 0, the nearest resolution will be used. If 1, the nearest lower resolution\n * will be used. If -1, the nearest higher resolution will be used.\n * @return {number|undefined} Valid zoom level.\n */\n getConstrainedZoom(targetZoom, direction) {\n const targetRes = this.getResolutionForZoom(targetZoom);\n return this.getZoomForResolution(\n this.getConstrainedResolution(targetRes, direction),\n );\n }\n\n /**\n * Get a valid resolution according to the current view constraints.\n * @param {number|undefined} targetResolution Target resolution.\n * @param {number} [direction] Indicate which resolution should be used\n * by a renderer if the view resolution does not match any resolution of the tile source.\n * If 0, the nearest resolution will be used. If 1, the nearest lower resolution\n * will be used. If -1, the nearest higher resolution will be used.\n * @return {number|undefined} Valid resolution.\n */\n getConstrainedResolution(targetResolution, direction) {\n direction = direction || 0;\n const size = this.getViewportSize_(this.getRotation());\n\n return this.constraints_.resolution(targetResolution, direction, size);\n }\n}\n\n/**\n * @param {Function} callback Callback.\n * @param {*} returnValue Return value.\n */\nfunction animationCallback(callback, returnValue) {\n setTimeout(function () {\n callback(returnValue);\n }, 0);\n}\n\n/**\n * @param {ViewOptions} options View options.\n * @return {import(\"./centerconstraint.js\").Type} The constraint.\n */\nexport function createCenterConstraint(options) {\n if (options.extent !== undefined) {\n const smooth =\n options.smoothExtentConstraint !== undefined\n ? options.smoothExtentConstraint\n : true;\n return createExtent(options.extent, options.constrainOnlyCenter, smooth);\n }\n\n const projection = createProjection(options.projection, 'EPSG:3857');\n if (options.multiWorld !== true && projection.isGlobal()) {\n const extent = projection.getExtent().slice();\n extent[0] = -Infinity;\n extent[2] = Infinity;\n return createExtent(extent, false, false);\n }\n\n return centerNone;\n}\n\n/**\n * @param {ViewOptions} options View options.\n * @return {{constraint: import(\"./resolutionconstraint.js\").Type, maxResolution: number,\n * minResolution: number, minZoom: number, zoomFactor: number}} The constraint.\n */\nexport function createResolutionConstraint(options) {\n let resolutionConstraint;\n let maxResolution;\n let minResolution;\n\n // TODO: move these to be ol constants\n // see https://github.com/openlayers/openlayers/issues/2076\n const defaultMaxZoom = 28;\n const defaultZoomFactor = 2;\n\n let minZoom =\n options.minZoom !== undefined ? options.minZoom : DEFAULT_MIN_ZOOM;\n\n let maxZoom =\n options.maxZoom !== undefined ? options.maxZoom : defaultMaxZoom;\n\n const zoomFactor =\n options.zoomFactor !== undefined ? options.zoomFactor : defaultZoomFactor;\n\n const multiWorld =\n options.multiWorld !== undefined ? options.multiWorld : false;\n\n const smooth =\n options.smoothResolutionConstraint !== undefined\n ? options.smoothResolutionConstraint\n : true;\n\n const showFullExtent =\n options.showFullExtent !== undefined ? options.showFullExtent : false;\n\n const projection = createProjection(options.projection, 'EPSG:3857');\n const projExtent = projection.getExtent();\n let constrainOnlyCenter = options.constrainOnlyCenter;\n let extent = options.extent;\n if (!multiWorld && !extent && projection.isGlobal()) {\n constrainOnlyCenter = false;\n extent = projExtent;\n }\n\n if (options.resolutions !== undefined) {\n const resolutions = options.resolutions;\n maxResolution = resolutions[minZoom];\n minResolution =\n resolutions[maxZoom] !== undefined\n ? resolutions[maxZoom]\n : resolutions[resolutions.length - 1];\n\n if (options.constrainResolution) {\n resolutionConstraint = createSnapToResolutions(\n resolutions,\n smooth,\n !constrainOnlyCenter && extent,\n showFullExtent,\n );\n } else {\n resolutionConstraint = createMinMaxResolution(\n maxResolution,\n minResolution,\n smooth,\n !constrainOnlyCenter && extent,\n showFullExtent,\n );\n }\n } else {\n // calculate the default min and max resolution\n const size = !projExtent\n ? // use an extent that can fit the whole world if need be\n (360 * METERS_PER_UNIT.degrees) / projection.getMetersPerUnit()\n : Math.max(getWidth(projExtent), getHeight(projExtent));\n\n const defaultMaxResolution =\n size / DEFAULT_TILE_SIZE / Math.pow(defaultZoomFactor, DEFAULT_MIN_ZOOM);\n\n const defaultMinResolution =\n defaultMaxResolution /\n Math.pow(defaultZoomFactor, defaultMaxZoom - DEFAULT_MIN_ZOOM);\n\n // user provided maxResolution takes precedence\n maxResolution = options.maxResolution;\n if (maxResolution !== undefined) {\n minZoom = 0;\n } else {\n maxResolution = defaultMaxResolution / Math.pow(zoomFactor, minZoom);\n }\n\n // user provided minResolution takes precedence\n minResolution = options.minResolution;\n if (minResolution === undefined) {\n if (options.maxZoom !== undefined) {\n if (options.maxResolution !== undefined) {\n minResolution = maxResolution / Math.pow(zoomFactor, maxZoom);\n } else {\n minResolution = defaultMaxResolution / Math.pow(zoomFactor, maxZoom);\n }\n } else {\n minResolution = defaultMinResolution;\n }\n }\n\n // given discrete zoom levels, minResolution may be different than provided\n maxZoom =\n minZoom +\n Math.floor(\n Math.log(maxResolution / minResolution) / Math.log(zoomFactor),\n );\n minResolution = maxResolution / Math.pow(zoomFactor, maxZoom - minZoom);\n\n if (options.constrainResolution) {\n resolutionConstraint = createSnapToPower(\n zoomFactor,\n maxResolution,\n minResolution,\n smooth,\n !constrainOnlyCenter && extent,\n showFullExtent,\n );\n } else {\n resolutionConstraint = createMinMaxResolution(\n maxResolution,\n minResolution,\n smooth,\n !constrainOnlyCenter && extent,\n showFullExtent,\n );\n }\n }\n return {\n constraint: resolutionConstraint,\n maxResolution: maxResolution,\n minResolution: minResolution,\n minZoom: minZoom,\n zoomFactor: zoomFactor,\n };\n}\n\n/**\n * @param {ViewOptions} options View options.\n * @return {import(\"./rotationconstraint.js\").Type} Rotation constraint.\n */\nexport function createRotationConstraint(options) {\n const enableRotation =\n options.enableRotation !== undefined ? options.enableRotation : true;\n if (enableRotation) {\n const constrainRotation = options.constrainRotation;\n if (constrainRotation === undefined || constrainRotation === true) {\n return createSnapToZero();\n }\n if (constrainRotation === false) {\n return rotationNone;\n }\n if (typeof constrainRotation === 'number') {\n return createSnapToN(constrainRotation);\n }\n return rotationNone;\n }\n return disable;\n}\n\n/**\n * Determine if an animation involves no view change.\n * @param {Animation} animation The animation.\n * @return {boolean} The animation involves no view change.\n */\nexport function isNoopAnimation(animation) {\n if (animation.sourceCenter && animation.targetCenter) {\n if (!coordinatesEqual(animation.sourceCenter, animation.targetCenter)) {\n return false;\n }\n }\n if (animation.sourceResolution !== animation.targetResolution) {\n return false;\n }\n if (animation.sourceRotation !== animation.targetRotation) {\n return false;\n }\n return true;\n}\n\n/**\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"./size.js\").Size} size Box pixel size.\n * @param {import(\"./pixel.js\").Pixel} position Position on the view to center on.\n * @param {number} resolution Resolution.\n * @param {number} rotation Rotation.\n * @return {import(\"./coordinate.js\").Coordinate} Shifted center.\n */\nfunction calculateCenterOn(coordinate, size, position, resolution, rotation) {\n // calculate rotated position\n const cosAngle = Math.cos(-rotation);\n let sinAngle = Math.sin(-rotation);\n let rotX = coordinate[0] * cosAngle - coordinate[1] * sinAngle;\n let rotY = coordinate[1] * cosAngle + coordinate[0] * sinAngle;\n rotX += (size[0] / 2 - position[0]) * resolution;\n rotY += (position[1] - size[1] / 2) * resolution;\n\n // go back to original angle\n sinAngle = -sinAngle; // go back to original rotation\n const centerX = rotX * cosAngle - rotY * sinAngle;\n const centerY = rotY * cosAngle + rotX * sinAngle;\n\n return [centerX, centerY];\n}\n\nexport default View;\n\n/**\n * @typedef {function(ViewOptions):ViewOptions} ViewTransform\n */\n\n/**\n * Adds higher resolutions.\n * @param {number} num The number of higher resolution levels to use.\n * @return {ViewTransform} A view transform.\n */\nexport function withHigherResolutions(num) {\n return function (options) {\n if (!options.resolutions) {\n return options;\n }\n const resolutions = [...options.resolutions];\n const highest = resolutions[resolutions.length - 1];\n for (let i = 0; i < num; ++i) {\n resolutions.push(highest / Math.pow(2, i + 1));\n }\n return {\n ...options,\n resolutions,\n };\n };\n}\n\n/**\n * Adds lower resolutions.\n * @param {number} num The number of lower resolution levels to use.\n * @return {ViewTransform} A view transform.\n * @api\n */\nexport function withLowerResolutions(num) {\n return function (options) {\n if (!options.resolutions) {\n return options;\n }\n const resolutions = [...options.resolutions];\n const lowest = resolutions[0];\n for (let i = 0; i < num; ++i) {\n resolutions.unshift(lowest * Math.pow(2, i + 1));\n }\n return {\n ...options,\n resolutions,\n };\n };\n}\n\n/**\n * Applies a center based on the extent.\n * @return {ViewTransform} A view transform.\n * @api\n */\nexport function withExtentCenter() {\n return function (options) {\n if (!options.extent) {\n return options;\n }\n const center = getCenter(options.extent);\n const newOptions = {...options, center};\n delete newOptions.extent;\n return newOptions;\n };\n}\n\n/**\n * Applies a zoom level.\n * @param {number} z The zoom level.\n * @return {ViewTransform} A view transform.\n * @api\n */\nexport function withZoom(z) {\n return function (options) {\n return {...options, zoom: z};\n };\n}\n\n/**\n * Applies a series of transforms to a view that is resolved from a source.\n * @param {import(\"./source/Source.js\").default} source The source.\n * @param {...ViewTransform} transforms The transforms to apply.\n * @return {Promise} The view options.\n * @api\n */\nexport async function getView(source, ...transforms) {\n let config = await source.getView();\n for (const transform of transforms) {\n config = transform(config);\n }\n return config;\n}\n","/**\n * @module ol/css\n */\n\n/**\n * @typedef {Object} FontParameters\n * @property {string} style Style.\n * @property {string} variant Variant.\n * @property {string} weight Weight.\n * @property {string} size Size.\n * @property {string} lineHeight LineHeight.\n * @property {string} family Family.\n * @property {Array} families Families.\n */\n\n/**\n * The CSS class for hidden feature.\n *\n * @const\n * @type {string}\n */\nexport const CLASS_HIDDEN = 'ol-hidden';\n\n/**\n * The CSS class that we'll give the DOM elements to have them selectable.\n *\n * @const\n * @type {string}\n */\nexport const CLASS_SELECTABLE = 'ol-selectable';\n\n/**\n * The CSS class that we'll give the DOM elements to have them unselectable.\n *\n * @const\n * @type {string}\n */\nexport const CLASS_UNSELECTABLE = 'ol-unselectable';\n\n/**\n * The CSS class for unsupported feature.\n *\n * @const\n * @type {string}\n */\nexport const CLASS_UNSUPPORTED = 'ol-unsupported';\n\n/**\n * The CSS class for controls.\n *\n * @const\n * @type {string}\n */\nexport const CLASS_CONTROL = 'ol-control';\n\n/**\n * The CSS class that we'll give the DOM elements that are collapsed, i.e.\n * to those elements which usually can be expanded.\n *\n * @const\n * @type {string}\n */\nexport const CLASS_COLLAPSED = 'ol-collapsed';\n\n/**\n * From https://stackoverflow.com/questions/10135697/regex-to-parse-any-css-font\n * @type {RegExp}\n */\nconst fontRegEx = new RegExp(\n [\n '^\\\\s*(?=(?:(?:[-a-z]+\\\\s*){0,2}(italic|oblique))?)',\n '(?=(?:(?:[-a-z]+\\\\s*){0,2}(small-caps))?)',\n '(?=(?:(?:[-a-z]+\\\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)',\n '(?:(?:normal|\\\\1|\\\\2|\\\\3)\\\\s*){0,3}((?:xx?-)?',\n '(?:small|large)|medium|smaller|larger|[\\\\.\\\\d]+(?:\\\\%|in|[cem]m|ex|p[ctx]))',\n '(?:\\\\s*\\\\/\\\\s*(normal|[\\\\.\\\\d]+(?:\\\\%|in|[cem]m|ex|p[ctx])?))',\n '?\\\\s*([-,\\\\\"\\\\\\'\\\\sa-z0-9]+?)\\\\s*$',\n ].join(''),\n 'i',\n);\n/** @type {Array<'style'|'variant'|'weight'|'size'|'lineHeight'|'family'>} */\nconst fontRegExMatchIndex = [\n 'style',\n 'variant',\n 'weight',\n 'size',\n 'lineHeight',\n 'family',\n];\n\n/** @type {Object} */\nexport const fontWeights = {\n normal: 400,\n bold: 700,\n};\n\n/**\n * Get the list of font families from a font spec. Note that this doesn't work\n * for font families that have commas in them.\n * @param {string} fontSpec The CSS font property.\n * @return {FontParameters|null} The font parameters (or null if the input spec is invalid).\n */\nexport const getFontParameters = function (fontSpec) {\n const match = fontSpec.match(fontRegEx);\n if (!match) {\n return null;\n }\n const style = /** @type {FontParameters} */ ({\n lineHeight: 'normal',\n size: '1.2em',\n style: 'normal',\n weight: '400',\n variant: 'normal',\n });\n for (let i = 0, ii = fontRegExMatchIndex.length; i < ii; ++i) {\n const value = match[i + 1];\n if (value !== undefined) {\n style[fontRegExMatchIndex[i]] =\n typeof value === 'string' ? value.trim() : value;\n }\n }\n if (isNaN(Number(style.weight)) && style.weight in fontWeights) {\n style.weight = fontWeights[style.weight];\n }\n style.families = style.family\n .split(/,\\s?/)\n .map((f) => f.trim().replace(/^['\"]|['\"]$/g, ''));\n return style;\n};\n","/**\n * @module ol/control/Control\n */\nimport MapEventType from '../MapEventType.js';\nimport BaseObject from '../Object.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport {VOID} from '../functions.js';\n\n/**\n * @typedef {Object} Options\n * @property {HTMLElement} [element] The element is the control's\n * container element. This only needs to be specified if you're developing\n * a custom control.\n * @property {function(import(\"../MapEvent.js\").default):void} [render] Function called when\n * the control should be re-rendered. This is called in a `requestAnimationFrame`\n * callback.\n * @property {HTMLElement|string} [target] Specify a target if you want\n * the control to be rendered outside of the map's viewport.\n */\n\n/**\n * @classdesc\n * A control is a visible widget with a DOM element in a fixed position on the\n * screen. They can involve user input (buttons), or be informational only;\n * the position is determined using CSS. By default these are placed in the\n * container with CSS class name `ol-overlaycontainer-stopevent`, but can use\n * any outside DOM element.\n *\n * This is the base class for controls. You can use it for simple custom\n * controls by creating the element with listeners, creating an instance:\n * ```js\n * const myControl = new Control({element: myElement});\n * ```\n * and then adding this to the map.\n *\n * The main advantage of having this as a control rather than a simple separate\n * DOM element is that preventing propagation is handled for you. Controls\n * will also be objects in a {@link module:ol/Collection~Collection}, so you can use their methods.\n *\n * You can also extend this base for your own control class. See\n * examples/custom-controls for an example of how to do this.\n *\n * @api\n */\nclass Control extends BaseObject {\n /**\n * @param {Options} options Control options.\n */\n constructor(options) {\n super();\n\n const element = options.element;\n if (element && !options.target && !element.style.pointerEvents) {\n element.style.pointerEvents = 'auto';\n }\n\n /**\n * @protected\n * @type {HTMLElement}\n */\n this.element = element ? element : null;\n\n /**\n * @private\n * @type {HTMLElement}\n */\n this.target_ = null;\n\n /**\n * @private\n * @type {import(\"../Map.js\").default|null}\n */\n this.map_ = null;\n\n /**\n * @protected\n * @type {!Array}\n */\n this.listenerKeys = [];\n\n if (options.render) {\n this.render = options.render;\n }\n\n if (options.target) {\n this.setTarget(options.target);\n }\n }\n\n /**\n * Clean up.\n * @override\n */\n disposeInternal() {\n this.element?.remove();\n super.disposeInternal();\n }\n\n /**\n * Get the map associated with this control.\n * @return {import(\"../Map.js\").default|null} Map.\n * @api\n */\n getMap() {\n return this.map_;\n }\n\n /**\n * Remove the control from its current map and attach it to the new map.\n * Pass `null` to just remove the control from the current map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../Map.js\").default|null} map Map.\n * @api\n */\n setMap(map) {\n if (this.map_) {\n this.element?.remove();\n }\n for (let i = 0, ii = this.listenerKeys.length; i < ii; ++i) {\n unlistenByKey(this.listenerKeys[i]);\n }\n this.listenerKeys.length = 0;\n this.map_ = map;\n if (map) {\n const target = this.target_ ?? map.getOverlayContainerStopEvent();\n if (this.element) {\n target.appendChild(this.element);\n }\n if (this.render !== VOID) {\n this.listenerKeys.push(\n listen(map, MapEventType.POSTRENDER, this.render, this),\n );\n }\n map.render();\n }\n }\n\n /**\n * Renders the control.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @api\n */\n render(mapEvent) {}\n\n /**\n * This function is used to set a target element for the control. It has no\n * effect if it is called after the control has been added to the map (i.e.\n * after `setMap` is called on the control). If no `target` is set in the\n * options passed to the control constructor and if `setTarget` is not called\n * then the control is added to the map's overlay container.\n * @param {HTMLElement|string} target Target.\n * @api\n */\n setTarget(target) {\n this.target_ =\n typeof target === 'string' ? document.getElementById(target) : target;\n }\n}\n\nexport default Control;\n","/**\n * @module ol/control/Attribution\n */\nimport {equals} from '../array.js';\nimport {CLASS_COLLAPSED, CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js';\nimport {removeChildren, replaceNode} from '../dom.js';\nimport EventType from '../events/EventType.js';\nimport {toPromise} from '../functions.js';\nimport Control from './Control.js';\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-attribution'] CSS class name.\n * @property {HTMLElement|string} [target] Specify a target if you\n * want the control to be rendered outside of the map's\n * viewport.\n * @property {boolean} [collapsible] Specify if attributions can\n * be collapsed. If not specified, sources control this behavior with their\n * `attributionsCollapsible` setting.\n * @property {boolean} [collapsed=true] Specify if attributions should\n * be collapsed at startup.\n * @property {string} [tipLabel='Attributions'] Text label to use for the button tip.\n * @property {string|HTMLElement} [label='i'] Text label to use for the\n * collapsed attributions button.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string} [expandClassName=className + '-expand'] CSS class name for the\n * collapsed attributions button.\n * @property {string|HTMLElement} [collapseLabel='›'] Text label to use\n * for the expanded attributions button.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string} [collapseClassName=className + '-collapse'] CSS class name for the\n * expanded attributions button.\n * @property {function(import(\"../MapEvent.js\").default):void} [render] Function called when\n * the control should be re-rendered. This is called in a `requestAnimationFrame`\n * callback.\n * @property {string|Array|undefined} [attributions] Optional attribution(s) that will always be\n * displayed regardless of the layers rendered.\n * **Caution:** Attributions are rendered dynamically using `innerHTML`, which can lead to potential\n * [**XSS (Cross-Site Scripting)**](https://en.wikipedia.org/wiki/Cross-site_scripting) vulnerabilities.\n * Use this feature only for trusted content\n * or ensure that the content is properly sanitized before inserting it.\n */\n\n/**\n * @classdesc\n * Control to show all the attributions associated with the layer sources\n * in the map. This control is one of the default controls included in maps.\n * By default it will show in the bottom right portion of the map, but this can\n * be changed by using a css selector for `.ol-attribution`.\n *\n * @api\n */\nclass Attribution extends Control {\n /**\n * @param {Options} [options] Attribution options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n element: document.createElement('div'),\n render: options.render,\n target: options.target,\n });\n\n /**\n * @private\n * @type {HTMLElement}\n */\n this.ulElement_ = document.createElement('ul');\n\n /**\n * @private\n * @type {boolean}\n */\n this.collapsed_ =\n options.collapsed !== undefined ? options.collapsed : true;\n\n /**\n * @private\n * @type {boolean}\n */\n this.userCollapsed_ = this.collapsed_;\n\n /**\n * @private\n * @type {boolean}\n */\n this.overrideCollapsible_ = options.collapsible !== undefined;\n\n /**\n * @private\n * @type {boolean}\n */\n this.collapsible_ =\n options.collapsible !== undefined ? options.collapsible : true;\n\n if (!this.collapsible_) {\n this.collapsed_ = false;\n }\n\n /**\n * @private\n * @type {string | Array | undefined}\n */\n this.attributions_ = options.attributions;\n\n const className =\n options.className !== undefined ? options.className : 'ol-attribution';\n\n const tipLabel =\n options.tipLabel !== undefined ? options.tipLabel : 'Attributions';\n\n const expandClassName =\n options.expandClassName !== undefined\n ? options.expandClassName\n : className + '-expand';\n\n const collapseLabel =\n options.collapseLabel !== undefined ? options.collapseLabel : '\\u203A';\n\n const collapseClassName =\n options.collapseClassName !== undefined\n ? options.collapseClassName\n : className + '-collapse';\n\n if (typeof collapseLabel === 'string') {\n /**\n * @private\n * @type {HTMLElement}\n */\n this.collapseLabel_ = document.createElement('span');\n this.collapseLabel_.textContent = collapseLabel;\n this.collapseLabel_.className = collapseClassName;\n } else {\n this.collapseLabel_ = collapseLabel;\n }\n\n const label = options.label !== undefined ? options.label : 'i';\n\n if (typeof label === 'string') {\n /**\n * @private\n * @type {HTMLElement}\n */\n this.label_ = document.createElement('span');\n this.label_.textContent = label;\n this.label_.className = expandClassName;\n } else {\n this.label_ = label;\n }\n\n const activeLabel =\n this.collapsible_ && !this.collapsed_ ? this.collapseLabel_ : this.label_;\n\n /**\n * @private\n * @type {HTMLElement}\n */\n this.toggleButton_ = document.createElement('button');\n this.toggleButton_.setAttribute('type', 'button');\n this.toggleButton_.setAttribute('aria-expanded', String(!this.collapsed_));\n this.toggleButton_.title = tipLabel;\n this.toggleButton_.appendChild(activeLabel);\n\n this.toggleButton_.addEventListener(\n EventType.CLICK,\n this.handleClick_.bind(this),\n false,\n );\n\n const cssClasses =\n className +\n ' ' +\n CLASS_UNSELECTABLE +\n ' ' +\n CLASS_CONTROL +\n (this.collapsed_ && this.collapsible_ ? ' ' + CLASS_COLLAPSED : '') +\n (this.collapsible_ ? '' : ' ol-uncollapsible');\n const element = this.element;\n element.className = cssClasses;\n element.appendChild(this.toggleButton_);\n element.appendChild(this.ulElement_);\n\n /**\n * A list of currently rendered resolutions.\n * @type {Array}\n * @private\n */\n this.renderedAttributions_ = [];\n\n /**\n * @private\n * @type {boolean}\n */\n this.renderedVisible_ = true;\n }\n\n /**\n * Collect a list of visible attributions and set the collapsible state.\n * @param {import(\"../Map.js\").FrameState} frameState Frame state.\n * @return {Array} Attributions.\n * @private\n */\n collectSourceAttributions_(frameState) {\n const layers = this.getMap().getAllLayers();\n const visibleAttributions = new Set(\n layers.flatMap((layer) => layer.getAttributions(frameState)),\n );\n if (this.attributions_ !== undefined) {\n Array.isArray(this.attributions_)\n ? this.attributions_.forEach((item) => visibleAttributions.add(item))\n : visibleAttributions.add(this.attributions_);\n }\n\n if (!this.overrideCollapsible_) {\n const collapsible = !layers.some(\n (layer) => layer.getSource()?.getAttributionsCollapsible() === false,\n );\n this.setCollapsible(collapsible);\n }\n return Array.from(visibleAttributions);\n }\n\n /**\n * @private\n * @param {?import(\"../Map.js\").FrameState} frameState Frame state.\n */\n async updateElement_(frameState) {\n if (!frameState) {\n if (this.renderedVisible_) {\n this.element.style.display = 'none';\n this.renderedVisible_ = false;\n }\n return;\n }\n\n const attributions = await Promise.all(\n this.collectSourceAttributions_(frameState).map((attribution) =>\n toPromise(() => attribution),\n ),\n );\n\n const visible = attributions.length > 0;\n if (this.renderedVisible_ != visible) {\n this.element.style.display = visible ? '' : 'none';\n this.renderedVisible_ = visible;\n }\n\n if (equals(attributions, this.renderedAttributions_)) {\n return;\n }\n\n removeChildren(this.ulElement_);\n\n // append the attributions\n for (let i = 0, ii = attributions.length; i < ii; ++i) {\n const element = document.createElement('li');\n element.innerHTML = attributions[i];\n this.ulElement_.appendChild(element);\n }\n\n this.renderedAttributions_ = attributions;\n }\n\n /**\n * @param {MouseEvent} event The event to handle\n * @private\n */\n handleClick_(event) {\n event.preventDefault();\n this.handleToggle_();\n this.userCollapsed_ = this.collapsed_;\n }\n\n /**\n * @private\n */\n handleToggle_() {\n this.element.classList.toggle(CLASS_COLLAPSED);\n if (this.collapsed_) {\n replaceNode(this.collapseLabel_, this.label_);\n } else {\n replaceNode(this.label_, this.collapseLabel_);\n }\n this.collapsed_ = !this.collapsed_;\n this.toggleButton_.setAttribute('aria-expanded', String(!this.collapsed_));\n }\n\n /**\n * Return `true` if the attribution is collapsible, `false` otherwise.\n * @return {boolean} True if the widget is collapsible.\n * @api\n */\n getCollapsible() {\n return this.collapsible_;\n }\n\n /**\n * Set whether the attribution should be collapsible.\n * @param {boolean} collapsible True if the widget is collapsible.\n * @api\n */\n setCollapsible(collapsible) {\n if (this.collapsible_ === collapsible) {\n return;\n }\n this.collapsible_ = collapsible;\n this.element.classList.toggle('ol-uncollapsible');\n if (this.userCollapsed_) {\n this.handleToggle_();\n }\n }\n\n /**\n * Collapse or expand the attribution according to the passed parameter. Will\n * not do anything if the attribution isn't collapsible or if the current\n * collapsed state is already the one requested.\n * @param {boolean} collapsed True if the widget is collapsed.\n * @api\n */\n setCollapsed(collapsed) {\n this.userCollapsed_ = collapsed;\n if (!this.collapsible_ || this.collapsed_ === collapsed) {\n return;\n }\n this.handleToggle_();\n }\n\n /**\n * Return `true` when the attribution is currently collapsed or `false`\n * otherwise.\n * @return {boolean} True if the widget is collapsed.\n * @api\n */\n getCollapsed() {\n return this.collapsed_;\n }\n\n /**\n * Update the attribution element.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @override\n */\n render(mapEvent) {\n this.updateElement_(mapEvent.frameState);\n }\n}\n\nexport default Attribution;\n","/**\n * @module ol/control/Rotate\n */\nimport {CLASS_CONTROL, CLASS_HIDDEN, CLASS_UNSELECTABLE} from '../css.js';\nimport {easeOut} from '../easing.js';\nimport EventType from '../events/EventType.js';\nimport Control from './Control.js';\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-rotate'] CSS class name.\n * @property {string|HTMLElement} [label='⇧'] Text label to use for the rotate button.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string} [tipLabel='Reset rotation'] Text label to use for the rotate tip.\n * @property {string} [compassClassName='ol-compass'] CSS class name for the compass.\n * @property {number} [duration=250] Animation duration in milliseconds.\n * @property {boolean} [autoHide=true] Hide the control when rotation is 0.\n * @property {function(import(\"../MapEvent.js\").default):void} [render] Function called when the control should\n * be re-rendered. This is called in a `requestAnimationFrame` callback.\n * @property {function():void} [resetNorth] Function called when the control is clicked.\n * This will override the default `resetNorth`.\n * @property {HTMLElement|string} [target] Specify a target if you want the control to be\n * rendered outside of the map's viewport.\n */\n\n/**\n * @classdesc\n * A button control to reset rotation to 0.\n * To style this control use css selector `.ol-rotate`. A `.ol-hidden` css\n * selector is added to the button when the rotation is 0.\n *\n * @api\n */\nclass Rotate extends Control {\n /**\n * @param {Options} [options] Rotate options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n element: document.createElement('div'),\n render: options.render,\n target: options.target,\n });\n\n const className =\n options.className !== undefined ? options.className : 'ol-rotate';\n\n const label = options.label !== undefined ? options.label : '\\u21E7';\n\n const compassClassName =\n options.compassClassName !== undefined\n ? options.compassClassName\n : 'ol-compass';\n\n /**\n * @type {HTMLElement}\n * @private\n */\n this.label_ = null;\n\n if (typeof label === 'string') {\n this.label_ = document.createElement('span');\n this.label_.className = compassClassName;\n this.label_.textContent = label;\n } else {\n this.label_ = label;\n this.label_.classList.add(compassClassName);\n }\n\n const tipLabel = options.tipLabel ? options.tipLabel : 'Reset rotation';\n\n const button = document.createElement('button');\n button.className = className + '-reset';\n button.setAttribute('type', 'button');\n button.title = tipLabel;\n button.appendChild(this.label_);\n\n button.addEventListener(\n EventType.CLICK,\n this.handleClick_.bind(this),\n false,\n );\n\n const cssClasses =\n className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL;\n const element = this.element;\n element.className = cssClasses;\n element.appendChild(button);\n\n /**\n * @private\n */\n this.callResetNorth_ = options.resetNorth ? options.resetNorth : undefined;\n\n /**\n * @type {number}\n * @private\n */\n this.duration_ = options.duration !== undefined ? options.duration : 250;\n\n /**\n * @type {boolean}\n * @private\n */\n this.autoHide_ = options.autoHide !== undefined ? options.autoHide : true;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.rotation_ = undefined;\n\n if (this.autoHide_) {\n this.element.classList.add(CLASS_HIDDEN);\n }\n }\n\n /**\n * @param {MouseEvent} event The event to handle\n * @private\n */\n handleClick_(event) {\n event.preventDefault();\n if (this.callResetNorth_ !== undefined) {\n this.callResetNorth_();\n } else {\n this.resetNorth_();\n }\n }\n\n /**\n * @private\n */\n resetNorth_() {\n const map = this.getMap();\n const view = map.getView();\n if (!view) {\n // the map does not have a view, so we can't act\n // upon it\n return;\n }\n const rotation = view.getRotation();\n if (rotation !== undefined) {\n if (this.duration_ > 0 && rotation % (2 * Math.PI) !== 0) {\n view.animate({\n rotation: 0,\n duration: this.duration_,\n easing: easeOut,\n });\n } else {\n view.setRotation(0);\n }\n }\n }\n\n /**\n * Update the rotate control element.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @override\n */\n render(mapEvent) {\n const frameState = mapEvent.frameState;\n if (!frameState) {\n return;\n }\n const rotation = frameState.viewState.rotation;\n if (rotation != this.rotation_) {\n const transform = 'rotate(' + rotation + 'rad)';\n if (this.autoHide_) {\n const contains = this.element.classList.contains(CLASS_HIDDEN);\n if (!contains && rotation === 0) {\n this.element.classList.add(CLASS_HIDDEN);\n } else if (contains && rotation !== 0) {\n this.element.classList.remove(CLASS_HIDDEN);\n }\n }\n this.label_.style.transform = transform;\n }\n this.rotation_ = rotation;\n }\n}\n\nexport default Rotate;\n","/**\n * @module ol/control/Zoom\n */\nimport {CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js';\nimport {easeOut} from '../easing.js';\nimport EventType from '../events/EventType.js';\nimport Control from './Control.js';\n\n/**\n * @typedef {Object} Options\n * @property {number} [duration=250] Animation duration in milliseconds.\n * @property {string} [className='ol-zoom'] CSS class name.\n * @property {string} [zoomInClassName=className + '-in'] CSS class name for the zoom-in button.\n * @property {string} [zoomOutClassName=className + '-out'] CSS class name for the zoom-out button.\n * @property {string|HTMLElement} [zoomInLabel='+'] Text label to use for the zoom-in\n * button. Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string|HTMLElement} [zoomOutLabel='–'] Text label to use for the zoom-out button.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string} [zoomInTipLabel='Zoom in'] Text label to use for the button tip.\n * @property {string} [zoomOutTipLabel='Zoom out'] Text label to use for the button tip.\n * @property {number} [delta=1] The zoom delta applied on each click.\n * @property {HTMLElement|string} [target] Specify a target if you want the control to be\n * rendered outside of the map's viewport.\n */\n\n/**\n * @classdesc\n * A control with 2 buttons, one for zoom in and one for zoom out.\n * This control is one of the default controls of a map. To style this control\n * use css selectors `.ol-zoom-in` and `.ol-zoom-out`.\n *\n * @api\n */\nclass Zoom extends Control {\n /**\n * @param {Options} [options] Zoom options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n element: document.createElement('div'),\n target: options.target,\n });\n\n const className =\n options.className !== undefined ? options.className : 'ol-zoom';\n\n const delta = options.delta !== undefined ? options.delta : 1;\n\n const zoomInClassName =\n options.zoomInClassName !== undefined\n ? options.zoomInClassName\n : className + '-in';\n\n const zoomOutClassName =\n options.zoomOutClassName !== undefined\n ? options.zoomOutClassName\n : className + '-out';\n\n const zoomInLabel =\n options.zoomInLabel !== undefined ? options.zoomInLabel : '+';\n const zoomOutLabel =\n options.zoomOutLabel !== undefined ? options.zoomOutLabel : '\\u2013';\n\n const zoomInTipLabel =\n options.zoomInTipLabel !== undefined ? options.zoomInTipLabel : 'Zoom in';\n const zoomOutTipLabel =\n options.zoomOutTipLabel !== undefined\n ? options.zoomOutTipLabel\n : 'Zoom out';\n\n const inElement = document.createElement('button');\n inElement.className = zoomInClassName;\n inElement.setAttribute('type', 'button');\n inElement.title = zoomInTipLabel;\n inElement.appendChild(\n typeof zoomInLabel === 'string'\n ? document.createTextNode(zoomInLabel)\n : zoomInLabel,\n );\n\n inElement.addEventListener(\n EventType.CLICK,\n this.handleClick_.bind(this, delta),\n false,\n );\n\n const outElement = document.createElement('button');\n outElement.className = zoomOutClassName;\n outElement.setAttribute('type', 'button');\n outElement.title = zoomOutTipLabel;\n outElement.appendChild(\n typeof zoomOutLabel === 'string'\n ? document.createTextNode(zoomOutLabel)\n : zoomOutLabel,\n );\n\n outElement.addEventListener(\n EventType.CLICK,\n this.handleClick_.bind(this, -delta),\n false,\n );\n\n const cssClasses =\n className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL;\n const element = this.element;\n element.className = cssClasses;\n element.appendChild(inElement);\n element.appendChild(outElement);\n\n /**\n * @type {number}\n * @private\n */\n this.duration_ = options.duration !== undefined ? options.duration : 250;\n }\n\n /**\n * @param {number} delta Zoom delta.\n * @param {MouseEvent} event The event to handle\n * @private\n */\n handleClick_(delta, event) {\n event.preventDefault();\n this.zoomByDelta_(delta);\n }\n\n /**\n * @param {number} delta Zoom delta.\n * @private\n */\n zoomByDelta_(delta) {\n const map = this.getMap();\n const view = map.getView();\n if (!view) {\n // the map does not have a view, so we can't act\n // upon it\n return;\n }\n const currentZoom = view.getZoom();\n if (currentZoom !== undefined) {\n const newZoom = view.getConstrainedZoom(currentZoom + delta);\n if (this.duration_ > 0) {\n if (view.getAnimating()) {\n view.cancelAnimations();\n }\n view.animate({\n zoom: newZoom,\n duration: this.duration_,\n easing: easeOut,\n });\n } else {\n view.setZoom(newZoom);\n }\n }\n }\n}\n\nexport default Zoom;\n","/**\n * @module ol/control/defaults\n */\nimport Collection from '../Collection.js';\nimport Attribution from './Attribution.js';\nimport Rotate from './Rotate.js';\nimport Zoom from './Zoom.js';\n\n/**\n * @typedef {Object} DefaultsOptions\n * @property {boolean} [attribution=true] Include\n * {@link module:ol/control/Attribution~Attribution}.\n * @property {import(\"./Attribution.js\").Options} [attributionOptions]\n * Options for {@link module:ol/control/Attribution~Attribution}.\n * @property {boolean} [rotate=true] Include\n * {@link module:ol/control/Rotate~Rotate}.\n * @property {import(\"./Rotate.js\").Options} [rotateOptions] Options\n * for {@link module:ol/control/Rotate~Rotate}.\n * @property {boolean} [zoom] Include {@link module:ol/control/Zoom~Zoom}.\n * @property {import(\"./Zoom.js\").Options} [zoomOptions] Options for\n * {@link module:ol/control/Zoom~Zoom}.\n */\n\n/**\n * Set of controls included in maps by default. Unless configured otherwise,\n * this returns a collection containing an instance of each of the following\n * controls:\n * {@link module:ol/control/Zoom~Zoom}\n * {@link module:ol/control/Rotate~Rotate}\n * {@link module:ol/control/Attribution~Attribution}\n *\n * @param {DefaultsOptions} [options] Options for the default controls.\n * @return {Collection} A collection of controls\n * to be used with the {@link module:ol/Map~Map} constructor's `controls` option.\n * @api\n */\nexport function defaults(options) {\n options = options ? options : {};\n\n /** @type {Collection} */\n const controls = new Collection();\n\n const zoomControl = options.zoom !== undefined ? options.zoom : true;\n if (zoomControl) {\n controls.push(new Zoom(options.zoomOptions));\n }\n\n const rotateControl = options.rotate !== undefined ? options.rotate : true;\n if (rotateControl) {\n controls.push(new Rotate(options.rotateOptions));\n }\n\n const attributionControl =\n options.attribution !== undefined ? options.attribution : true;\n if (attributionControl) {\n controls.push(new Attribution(options.attributionOptions));\n }\n\n return controls;\n}\n","/**\n * @module ol/interaction/Property\n */\n\n/**\n * @enum {string}\n */\nexport default {\n ACTIVE: 'active',\n};\n","/**\n * @module ol/interaction/Interaction\n */\nimport BaseObject from '../Object.js';\nimport {easeOut, linear} from '../easing.js';\nimport InteractionProperty from './Property.js';\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature &\n * import(\"../Observable\").OnSignature &\n * import(\"../Observable\").CombinedOnSignature} InteractionOnSignature\n */\n\n/**\n * Object literal with config options for interactions.\n * @typedef {Object} InteractionOptions\n * @property {function(import(\"../MapBrowserEvent.js\").default):boolean} [handleEvent]\n * Method called by the map to notify the interaction that a browser event was\n * dispatched to the map. If the function returns a falsy value, propagation of\n * the event to other interactions in the map's interactions chain will be\n * prevented (this includes functions with no explicit return). The interactions\n * are traversed in reverse order of the interactions collection of the map.\n */\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * User actions that change the state of the map. Some are similar to controls,\n * but are not associated with a DOM element.\n * For example, {@link module:ol/interaction/KeyboardZoom~KeyboardZoom} is\n * functionally the same as {@link module:ol/control/Zoom~Zoom}, but triggered\n * by a keyboard event not a button element event.\n * Although interactions do not have a DOM element, some of them do render\n * vectors and so are visible on the screen.\n * @api\n */\nclass Interaction extends BaseObject {\n /**\n * @param {InteractionOptions} [options] Options.\n */\n constructor(options) {\n super();\n\n /***\n * @type {InteractionOnSignature}\n */\n this.on;\n\n /***\n * @type {InteractionOnSignature}\n */\n this.once;\n\n /***\n * @type {InteractionOnSignature}\n */\n this.un;\n\n if (options && options.handleEvent) {\n this.handleEvent = options.handleEvent;\n }\n\n /**\n * @private\n * @type {import(\"../Map.js\").default|null}\n */\n this.map_ = null;\n\n this.setActive(true);\n }\n\n /**\n * Return whether the interaction is currently active.\n * @return {boolean} `true` if the interaction is active, `false` otherwise.\n * @observable\n * @api\n */\n getActive() {\n return /** @type {boolean} */ (this.get(InteractionProperty.ACTIVE));\n }\n\n /**\n * Get the map associated with this interaction.\n * @return {import(\"../Map.js\").default|null} Map.\n * @api\n */\n getMap() {\n return this.map_;\n }\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event}.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @api\n */\n handleEvent(mapBrowserEvent) {\n return true;\n }\n\n /**\n * Activate or deactivate the interaction.\n * @param {boolean} active Active.\n * @observable\n * @api\n */\n setActive(active) {\n this.set(InteractionProperty.ACTIVE, active);\n }\n\n /**\n * Remove the interaction from its current map and attach it to the new map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../Map.js\").default|null} map Map.\n */\n setMap(map) {\n this.map_ = map;\n }\n}\n\n/**\n * @param {import(\"../View.js\").default} view View.\n * @param {import(\"../coordinate.js\").Coordinate} delta Delta.\n * @param {number} [duration] Duration.\n */\nexport function pan(view, delta, duration) {\n const currentCenter = view.getCenterInternal();\n if (currentCenter) {\n const center = [currentCenter[0] + delta[0], currentCenter[1] + delta[1]];\n view.animateInternal({\n duration: duration !== undefined ? duration : 250,\n easing: linear,\n center: view.getConstrainedCenter(center),\n });\n }\n}\n\n/**\n * @param {import(\"../View.js\").default} view View.\n * @param {number} delta Delta from previous zoom level.\n * @param {import(\"../coordinate.js\").Coordinate} [anchor] Anchor coordinate in the user projection.\n * @param {number} [duration] Duration.\n */\nexport function zoomByDelta(view, delta, anchor, duration) {\n const currentZoom = view.getZoom();\n\n if (currentZoom === undefined) {\n return;\n }\n\n const newZoom = view.getConstrainedZoom(currentZoom + delta);\n const newResolution = view.getResolutionForZoom(newZoom);\n\n if (view.getAnimating()) {\n view.cancelAnimations();\n }\n view.animate({\n resolution: newResolution,\n anchor: anchor,\n duration: duration !== undefined ? duration : 250,\n easing: easeOut,\n });\n}\n\nexport default Interaction;\n","/**\n * @module ol/interaction/DoubleClickZoom\n */\nimport MapBrowserEventType from '../MapBrowserEventType.js';\nimport Interaction, {zoomByDelta} from './Interaction.js';\n\n/**\n * @typedef {Object} Options\n * @property {number} [duration=250] Animation duration in milliseconds.\n * @property {number} [delta=1] The zoom delta applied on each double click.\n */\n\n/**\n * @classdesc\n * Allows the user to zoom by double-clicking on the map.\n * @api\n */\nclass DoubleClickZoom extends Interaction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n super();\n\n options = options ? options : {};\n\n /**\n * @private\n * @type {number}\n */\n this.delta_ = options.delta ? options.delta : 1;\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 250;\n }\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} (if it was a\n * doubleclick) and eventually zooms the map.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @override\n */\n handleEvent(mapBrowserEvent) {\n let stopEvent = false;\n if (mapBrowserEvent.type == MapBrowserEventType.DBLCLICK) {\n const browserEvent = /** @type {MouseEvent} */ (\n mapBrowserEvent.originalEvent\n );\n const map = mapBrowserEvent.map;\n const anchor = mapBrowserEvent.coordinate;\n const delta = browserEvent.shiftKey ? -this.delta_ : this.delta_;\n const view = map.getView();\n zoomByDelta(view, delta, anchor, this.duration_);\n browserEvent.preventDefault();\n stopEvent = true;\n }\n return !stopEvent;\n }\n}\n\nexport default DoubleClickZoom;\n","/**\n * @module ol/events/condition\n */\nimport MapBrowserEventType from '../MapBrowserEventType.js';\nimport {FALSE, TRUE} from '../functions.js';\nimport {MAC, WEBKIT} from '../has.js';\n\n/**\n * A function that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * `{boolean}`. If the condition is met, true should be returned.\n *\n * @typedef {function(this: ?, import(\"../MapBrowserEvent.js\").default): boolean} Condition\n */\n\n/**\n * Creates a condition function that passes when all provided conditions pass.\n * @param {...Condition} var_args Conditions to check.\n * @return {Condition} Condition function.\n */\nexport function all(var_args) {\n const conditions = arguments;\n /**\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n * @return {boolean} All conditions passed.\n */\n return function (event) {\n let pass = true;\n for (let i = 0, ii = conditions.length; i < ii; ++i) {\n pass = pass && conditions[i](event);\n if (!pass) {\n break;\n }\n }\n return pass;\n };\n}\n\n/**\n * Return `true` if only the alt-key is pressed, `false` otherwise (e.g. when\n * additionally the shift-key is pressed).\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if only the alt key is pressed.\n * @api\n */\nexport const altKeyOnly = function (mapBrowserEvent) {\n const originalEvent = mapBrowserEvent.originalEvent;\n return (\n originalEvent.altKey &&\n !(originalEvent.metaKey || originalEvent.ctrlKey) &&\n !originalEvent.shiftKey\n );\n};\n\n/**\n * Return `true` if only the alt-key and shift-key is pressed, `false` otherwise\n * (e.g. when additionally the platform-modifier-key is pressed).\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if only the alt and shift keys are pressed.\n * @api\n */\nexport const altShiftKeysOnly = function (mapBrowserEvent) {\n const originalEvent = mapBrowserEvent.originalEvent;\n return (\n originalEvent.altKey &&\n !(originalEvent.metaKey || originalEvent.ctrlKey) &&\n originalEvent.shiftKey\n );\n};\n\n/**\n * Return `true` if the map has the focus. This condition requires a map target\n * element with a `tabindex` attribute, e.g. `
`.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} event Map browser event.\n * @return {boolean} The map has the focus.\n * @api\n */\nexport const focus = function (event) {\n const targetElement = event.map.getTargetElement();\n const rootNode = targetElement.getRootNode();\n const activeElement = event.map.getOwnerDocument().activeElement;\n\n return rootNode instanceof ShadowRoot\n ? rootNode.host.contains(activeElement)\n : targetElement.contains(activeElement);\n};\n\n/**\n * Return `true` if the map has the focus or no 'tabindex' attribute set.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} event Map browser event.\n * @return {boolean} The map container has the focus or no 'tabindex' attribute.\n */\nexport const focusWithTabindex = function (event) {\n const targetElement = event.map.getTargetElement();\n const rootNode = targetElement.getRootNode();\n const tabIndexCandidate =\n rootNode instanceof ShadowRoot ? rootNode.host : targetElement;\n\n return tabIndexCandidate.hasAttribute('tabindex') ? focus(event) : true;\n};\n\n/**\n * Return always true.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True.\n * @api\n */\nexport const always = TRUE;\n\n/**\n * Return `true` if the event is a `click` event, `false` otherwise.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event is a map `click` event.\n * @api\n */\nexport const click = function (mapBrowserEvent) {\n return mapBrowserEvent.type == MapBrowserEventType.CLICK;\n};\n\n/**\n * Return `true` if the event has an \"action\"-producing mouse button.\n *\n * By definition, this includes left-click on windows/linux, and left-click\n * without the ctrl key on Macs.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} The result.\n */\nexport const mouseActionButton = function (mapBrowserEvent) {\n const originalEvent = mapBrowserEvent.originalEvent;\n return (\n 'pointerId' in originalEvent &&\n originalEvent.button == 0 &&\n !(WEBKIT && MAC && originalEvent.ctrlKey)\n );\n};\n\n/**\n * Return always false.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} False.\n * @api\n */\nexport const never = FALSE;\n\n/**\n * Return `true` if the browser event is a `pointermove` event, `false`\n * otherwise.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the browser event is a `pointermove` event.\n * @api\n */\nexport const pointerMove = function (mapBrowserEvent) {\n return mapBrowserEvent.type == 'pointermove';\n};\n\n/**\n * Return `true` if the event is a map `singleclick` event, `false` otherwise.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event is a map `singleclick` event.\n * @api\n */\nexport const singleClick = function (mapBrowserEvent) {\n return mapBrowserEvent.type == MapBrowserEventType.SINGLECLICK;\n};\n\n/**\n * Return `true` if the event is a map `dblclick` event, `false` otherwise.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event is a map `dblclick` event.\n * @api\n */\nexport const doubleClick = function (mapBrowserEvent) {\n return mapBrowserEvent.type == MapBrowserEventType.DBLCLICK;\n};\n\n/**\n * Return `true` if no modifier key (alt-, shift- or platform-modifier-key) is\n * pressed.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True only if there no modifier keys are pressed.\n * @api\n */\nexport const noModifierKeys = function (mapBrowserEvent) {\n const originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (\n mapBrowserEvent.originalEvent\n );\n return (\n !originalEvent.altKey &&\n !(originalEvent.metaKey || originalEvent.ctrlKey) &&\n !originalEvent.shiftKey\n );\n};\n\n/**\n * Return `true` if only the platform-modifier-key (the meta-key on Mac,\n * ctrl-key otherwise) is pressed, `false` otherwise (e.g. when additionally\n * the shift-key is pressed).\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if only the platform modifier key is pressed.\n * @api\n */\nexport const platformModifierKeyOnly = function (mapBrowserEvent) {\n const originalEvent = mapBrowserEvent.originalEvent;\n return (\n !originalEvent.altKey &&\n (MAC ? originalEvent.metaKey : originalEvent.ctrlKey) &&\n !originalEvent.shiftKey\n );\n};\n\n/**\n * Return `true` if the platform-modifier-key (the meta-key on Mac,\n * ctrl-key otherwise) is pressed.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the platform modifier key is pressed.\n * @api\n */\nexport const platformModifierKey = function (mapBrowserEvent) {\n const originalEvent = mapBrowserEvent.originalEvent;\n return MAC ? originalEvent.metaKey : originalEvent.ctrlKey;\n};\n\n/**\n * Return `true` if only the shift-key is pressed, `false` otherwise (e.g. when\n * additionally the alt-key is pressed).\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if only the shift key is pressed.\n * @api\n */\nexport const shiftKeyOnly = function (mapBrowserEvent) {\n const originalEvent = mapBrowserEvent.originalEvent;\n return (\n !originalEvent.altKey &&\n !(originalEvent.metaKey || originalEvent.ctrlKey) &&\n originalEvent.shiftKey\n );\n};\n\n/**\n * Return `true` if the target element is not editable, i.e. not an `input`,\n * `select`, or `textarea` element and no `contenteditable` attribute is\n * set or inherited, `false` otherwise.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True only if the target element is not editable.\n * @api\n */\nexport const targetNotEditable = function (mapBrowserEvent) {\n const originalEvent = mapBrowserEvent.originalEvent;\n const tagName = /** @type {Element} */ (originalEvent.target).tagName;\n return (\n tagName !== 'INPUT' &&\n tagName !== 'SELECT' &&\n tagName !== 'TEXTAREA' &&\n // `isContentEditable` is only available on `HTMLElement`, but it may also be a\n // different type like `SVGElement`.\n // @ts-ignore\n !originalEvent.target.isContentEditable\n );\n};\n\n/**\n * Return `true` if the event originates from a mouse device.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event originates from a mouse device.\n * @api\n */\nexport const mouseOnly = function (mapBrowserEvent) {\n const pointerEvent = mapBrowserEvent.originalEvent;\n // see https://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType\n return 'pointerId' in pointerEvent && pointerEvent.pointerType == 'mouse';\n};\n\n/**\n * Return `true` if the event originates from a touchable device.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event originates from a touchable device.\n * @api\n */\nexport const touchOnly = function (mapBrowserEvent) {\n const pointerEvt = mapBrowserEvent.originalEvent;\n // see https://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType\n return 'pointerId' in pointerEvt && pointerEvt.pointerType === 'touch';\n};\n\n/**\n * Return `true` if the event originates from a digital pen.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event originates from a digital pen.\n * @api\n */\nexport const penOnly = function (mapBrowserEvent) {\n const pointerEvt = mapBrowserEvent.originalEvent;\n // see https://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType\n return 'pointerId' in pointerEvt && pointerEvt.pointerType === 'pen';\n};\n\n/**\n * Return `true` if the event originates from a primary pointer in\n * contact with the surface or if the left mouse button is pressed.\n * See https://www.w3.org/TR/pointerevents/#button-states.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event originates from a primary pointer.\n * @api\n */\nexport const primaryAction = function (mapBrowserEvent) {\n const pointerEvent = mapBrowserEvent.originalEvent;\n return (\n 'pointerId' in pointerEvent &&\n pointerEvent.isPrimary &&\n pointerEvent.button === 0\n );\n};\n","/**\n * @module ol/interaction/Pointer\n */\nimport MapBrowserEventType from '../MapBrowserEventType.js';\nimport Interaction from './Interaction.js';\n\n/**\n * @typedef {Object} Options\n * @property {function(import(\"../MapBrowserEvent.js\").default):boolean} [handleDownEvent]\n * Function handling \"down\" events. If the function returns `true` then a drag\n * sequence is started.\n * @property {function(import(\"../MapBrowserEvent.js\").default):void} [handleDragEvent]\n * Function handling \"drag\" events. This function is called on \"move\" events\n * during a drag sequence.\n * @property {function(import(\"../MapBrowserEvent.js\").default):boolean} [handleEvent]\n * Method called by the map to notify the interaction that a browser event was\n * dispatched to the map. The function may return `false` to prevent the\n * propagation of the event to other interactions in the map's interactions\n * chain.\n * @property {function(import(\"../MapBrowserEvent.js\").default):void} [handleMoveEvent]\n * Function handling \"move\" events. This function is called on \"move\" events.\n * This functions is also called during a drag sequence, so during a drag\n * sequence both the `handleDragEvent` function and this function are called.\n * If `handleDownEvent` is defined and it returns true this function will not\n * be called during a drag sequence.\n * @property {function(import(\"../MapBrowserEvent.js\").default):boolean} [handleUpEvent]\n * Function handling \"up\" events. If the function returns `false` then the\n * current drag sequence is stopped.\n * @property {function(boolean):boolean} [stopDown]\n * Should the down event be propagated to other interactions, or should be\n * stopped?\n */\n\n/**\n * @classdesc\n * Base class that calls user-defined functions on `down`, `move` and `up`\n * events. This class also manages \"drag sequences\".\n *\n * When the `handleDownEvent` user function returns `true` a drag sequence is\n * started. During a drag sequence the `handleDragEvent` user function is\n * called on `move` events. The drag sequence ends when the `handleUpEvent`\n * user function is called and returns `false`.\n * @api\n */\nclass PointerInteraction extends Interaction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super(\n /** @type {import(\"./Interaction.js\").InteractionOptions} */ (options),\n );\n\n if (options.handleDownEvent) {\n this.handleDownEvent = options.handleDownEvent;\n }\n\n if (options.handleDragEvent) {\n this.handleDragEvent = options.handleDragEvent;\n }\n\n if (options.handleMoveEvent) {\n this.handleMoveEvent = options.handleMoveEvent;\n }\n\n if (options.handleUpEvent) {\n this.handleUpEvent = options.handleUpEvent;\n }\n\n if (options.stopDown) {\n this.stopDown = options.stopDown;\n }\n\n /**\n * @type {boolean}\n * @protected\n */\n this.handlingDownUpSequence = false;\n\n /**\n * @type {Array}\n * @protected\n */\n this.targetPointers = [];\n }\n\n /**\n * Returns the current number of pointers involved in the interaction,\n * e.g. `2` when two fingers are used.\n * @return {number} The number of pointers.\n * @api\n */\n getPointerCount() {\n return this.targetPointers.length;\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @protected\n */\n handleDownEvent(mapBrowserEvent) {\n return false;\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @protected\n */\n handleDragEvent(mapBrowserEvent) {}\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} and may call into\n * other functions, if event sequences like e.g. 'drag' or 'down-up' etc. are\n * detected.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @api\n * @override\n */\n handleEvent(mapBrowserEvent) {\n if (!mapBrowserEvent.originalEvent) {\n return true;\n }\n\n let stopEvent = false;\n this.updateTrackedPointers_(mapBrowserEvent);\n if (this.handlingDownUpSequence) {\n if (mapBrowserEvent.type == MapBrowserEventType.POINTERDRAG) {\n this.handleDragEvent(mapBrowserEvent);\n // prevent page scrolling during dragging\n mapBrowserEvent.originalEvent.preventDefault();\n } else if (mapBrowserEvent.type == MapBrowserEventType.POINTERUP) {\n const handledUp = this.handleUpEvent(mapBrowserEvent);\n this.handlingDownUpSequence =\n handledUp && this.targetPointers.length > 0;\n }\n } else {\n if (mapBrowserEvent.type == MapBrowserEventType.POINTERDOWN) {\n const handled = this.handleDownEvent(mapBrowserEvent);\n this.handlingDownUpSequence = handled;\n stopEvent = this.stopDown(handled);\n } else if (mapBrowserEvent.type == MapBrowserEventType.POINTERMOVE) {\n this.handleMoveEvent(mapBrowserEvent);\n }\n }\n return !stopEvent;\n }\n\n /**\n * Handle pointer move events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @protected\n */\n handleMoveEvent(mapBrowserEvent) {}\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @protected\n */\n handleUpEvent(mapBrowserEvent) {\n return false;\n }\n\n /**\n * This function is used to determine if \"down\" events should be propagated\n * to other interactions or should be stopped.\n * @param {boolean} handled Was the event handled by the interaction?\n * @return {boolean} Should the `down` event be stopped?\n */\n stopDown(handled) {\n return handled;\n }\n\n /**\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @private\n */\n updateTrackedPointers_(mapBrowserEvent) {\n if (mapBrowserEvent.activePointers) {\n this.targetPointers = mapBrowserEvent.activePointers;\n }\n }\n}\n\n/**\n * @param {Array} pointerEvents List of events.\n * @return {{clientX: number, clientY: number}} Centroid pixel.\n */\nexport function centroid(pointerEvents) {\n const length = pointerEvents.length;\n let clientX = 0;\n let clientY = 0;\n for (let i = 0; i < length; i++) {\n clientX += pointerEvents[i].clientX;\n clientY += pointerEvents[i].clientY;\n }\n return {clientX: clientX / length, clientY: clientY / length};\n}\n\nexport default PointerInteraction;\n","/**\n * @module ol/interaction/DragPan\n */\nimport {\n rotate as rotateCoordinate,\n scale as scaleCoordinate,\n} from '../coordinate.js';\nimport {easeOut} from '../easing.js';\nimport {\n all,\n focusWithTabindex,\n noModifierKeys,\n primaryAction,\n} from '../events/condition.js';\nimport {FALSE} from '../functions.js';\nimport PointerInteraction, {\n centroid as centroidFromPointers,\n} from './Pointer.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean\n * to indicate whether that event should be handled.\n * Default is {@link module:ol/events/condition.noModifierKeys} and {@link module:ol/events/condition.primaryAction}.\n * @property {boolean} [onFocusOnly=false] When the map's target has a `tabindex` attribute set,\n * the interaction will only handle events when the map has the focus.\n * @property {import(\"../Kinetic.js\").default} [kinetic] Kinetic inertia to apply to the pan.\n */\n\n/**\n * @classdesc\n * Allows the user to pan the map by dragging the map.\n * @api\n */\nclass DragPan extends PointerInteraction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n super({\n stopDown: FALSE,\n });\n\n options = options ? options : {};\n\n /**\n * @private\n * @type {import(\"../Kinetic.js\").default|undefined}\n */\n this.kinetic_ = options.kinetic;\n\n /**\n * @type {import(\"../pixel.js\").Pixel}\n */\n this.lastCentroid = null;\n\n /**\n * @type {number}\n * @private\n */\n this.lastPointersCount_;\n\n /**\n * @type {boolean}\n * @private\n */\n this.panning_ = false;\n\n const condition = options.condition\n ? options.condition\n : all(noModifierKeys, primaryAction);\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.onFocusOnly\n ? all(focusWithTabindex, condition)\n : condition;\n\n /**\n * @private\n * @type {boolean}\n */\n this.noKinetic_ = false;\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @override\n */\n handleDragEvent(mapBrowserEvent) {\n const map = mapBrowserEvent.map;\n if (!this.panning_) {\n this.panning_ = true;\n map.getView().beginInteraction();\n }\n const targetPointers = this.targetPointers;\n const centroid = map.getEventPixel(centroidFromPointers(targetPointers));\n if (targetPointers.length == this.lastPointersCount_) {\n if (this.kinetic_) {\n this.kinetic_.update(centroid[0], centroid[1]);\n }\n if (this.lastCentroid) {\n const delta = [\n this.lastCentroid[0] - centroid[0],\n centroid[1] - this.lastCentroid[1],\n ];\n const map = mapBrowserEvent.map;\n const view = map.getView();\n scaleCoordinate(delta, view.getResolution());\n rotateCoordinate(delta, view.getRotation());\n view.adjustCenterInternal(delta);\n }\n } else if (this.kinetic_) {\n // reset so we don't overestimate the kinetic energy after\n // after one finger down, tiny drag, second finger down\n this.kinetic_.begin();\n }\n this.lastCentroid = centroid;\n this.lastPointersCount_ = targetPointers.length;\n mapBrowserEvent.originalEvent.preventDefault();\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleUpEvent(mapBrowserEvent) {\n const map = mapBrowserEvent.map;\n const view = map.getView();\n if (this.targetPointers.length === 0) {\n if (!this.noKinetic_ && this.kinetic_ && this.kinetic_.end()) {\n const distance = this.kinetic_.getDistance();\n const angle = this.kinetic_.getAngle();\n const center = view.getCenterInternal();\n const centerpx = map.getPixelFromCoordinateInternal(center);\n const dest = map.getCoordinateFromPixelInternal([\n centerpx[0] - distance * Math.cos(angle),\n centerpx[1] - distance * Math.sin(angle),\n ]);\n view.animateInternal({\n center: view.getConstrainedCenter(dest),\n duration: 500,\n easing: easeOut,\n });\n }\n if (this.panning_) {\n this.panning_ = false;\n view.endInteraction();\n }\n return false;\n }\n if (this.kinetic_) {\n // reset so we don't overestimate the kinetic energy after\n // after one finger up, tiny drag, second finger up\n this.kinetic_.begin();\n }\n this.lastCentroid = null;\n return true;\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleDownEvent(mapBrowserEvent) {\n if (this.targetPointers.length > 0 && this.condition_(mapBrowserEvent)) {\n const map = mapBrowserEvent.map;\n const view = map.getView();\n this.lastCentroid = null;\n // stop any current animation\n if (view.getAnimating()) {\n view.cancelAnimations();\n }\n if (this.kinetic_) {\n this.kinetic_.begin();\n }\n // No kinetic as soon as more than one pointer on the screen is\n // detected. This is to prevent nasty pans after pinch.\n this.noKinetic_ = this.targetPointers.length > 1;\n return true;\n }\n return false;\n }\n}\n\nexport default DragPan;\n","/**\n * @module ol/interaction/DragRotate\n */\nimport {\n altShiftKeysOnly,\n mouseActionButton,\n mouseOnly,\n} from '../events/condition.js';\nimport {FALSE} from '../functions.js';\nimport {disable} from '../rotationconstraint.js';\nimport PointerInteraction from './Pointer.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that takes a\n * {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean\n * to indicate whether that event should be handled.\n * Default is {@link module:ol/events/condition.altShiftKeysOnly}.\n * @property {number} [duration=250] Animation duration in milliseconds.\n */\n\n/**\n * @classdesc\n * Allows the user to rotate the map by clicking and dragging on the map,\n * normally combined with a {@link module:ol/events/condition} that limits\n * it to when the alt and shift keys are held down.\n *\n * This interaction is only supported for mouse devices.\n * @api\n */\nclass DragRotate extends PointerInteraction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n stopDown: FALSE,\n });\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.condition ? options.condition : altShiftKeysOnly;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.lastAngle_ = undefined;\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 250;\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @override\n */\n handleDragEvent(mapBrowserEvent) {\n if (!mouseOnly(mapBrowserEvent)) {\n return;\n }\n\n const map = mapBrowserEvent.map;\n const view = map.getView();\n if (view.getConstraints().rotation === disable) {\n return;\n }\n const size = map.getSize();\n const offset = mapBrowserEvent.pixel;\n const theta = Math.atan2(size[1] / 2 - offset[1], offset[0] - size[0] / 2);\n if (this.lastAngle_ !== undefined) {\n const delta = theta - this.lastAngle_;\n view.adjustRotationInternal(-delta);\n }\n this.lastAngle_ = theta;\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleUpEvent(mapBrowserEvent) {\n if (!mouseOnly(mapBrowserEvent)) {\n return true;\n }\n\n const map = mapBrowserEvent.map;\n const view = map.getView();\n view.endInteraction(this.duration_);\n return false;\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleDownEvent(mapBrowserEvent) {\n if (!mouseOnly(mapBrowserEvent)) {\n return false;\n }\n\n if (\n mouseActionButton(mapBrowserEvent) &&\n this.condition_(mapBrowserEvent)\n ) {\n const map = mapBrowserEvent.map;\n map.getView().beginInteraction();\n this.lastAngle_ = undefined;\n return true;\n }\n return false;\n }\n}\n\nexport default DragRotate;\n","/**\n * @module ol/render/Box\n */\n\nimport Disposable from '../Disposable.js';\nimport Polygon from '../geom/Polygon.js';\n\nclass RenderBox extends Disposable {\n /**\n * @param {string} className CSS class name.\n */\n constructor(className) {\n super();\n\n /**\n * @type {import(\"../geom/Polygon.js\").default}\n * @private\n */\n this.geometry_ = null;\n\n /**\n * @type {HTMLDivElement}\n * @private\n */\n this.element_ = document.createElement('div');\n this.element_.style.position = 'absolute';\n this.element_.style.pointerEvents = 'auto';\n this.element_.className = 'ol-box ' + className;\n\n /**\n * @private\n * @type {import(\"../Map.js\").default|null}\n */\n this.map_ = null;\n\n /**\n * @private\n * @type {import(\"../pixel.js\").Pixel}\n */\n this.startPixel_ = null;\n\n /**\n * @private\n * @type {import(\"../pixel.js\").Pixel}\n */\n this.endPixel_ = null;\n }\n\n /**\n * Clean up.\n * @override\n */\n disposeInternal() {\n this.setMap(null);\n }\n\n /**\n * @private\n */\n render_() {\n const startPixel = this.startPixel_;\n const endPixel = this.endPixel_;\n const px = 'px';\n const style = this.element_.style;\n style.left = Math.min(startPixel[0], endPixel[0]) + px;\n style.top = Math.min(startPixel[1], endPixel[1]) + px;\n style.width = Math.abs(endPixel[0] - startPixel[0]) + px;\n style.height = Math.abs(endPixel[1] - startPixel[1]) + px;\n }\n\n /**\n * @param {import(\"../Map.js\").default|null} map Map.\n */\n setMap(map) {\n if (this.map_) {\n this.map_.getOverlayContainer().removeChild(this.element_);\n const style = this.element_.style;\n style.left = 'inherit';\n style.top = 'inherit';\n style.width = 'inherit';\n style.height = 'inherit';\n }\n this.map_ = map;\n if (this.map_) {\n this.map_.getOverlayContainer().appendChild(this.element_);\n }\n }\n\n /**\n * @param {import(\"../pixel.js\").Pixel} startPixel Start pixel.\n * @param {import(\"../pixel.js\").Pixel} endPixel End pixel.\n */\n setPixels(startPixel, endPixel) {\n this.startPixel_ = startPixel;\n this.endPixel_ = endPixel;\n this.createOrUpdateGeometry();\n this.render_();\n }\n\n /**\n * Creates or updates the cached geometry.\n */\n createOrUpdateGeometry() {\n if (!this.map_) {\n return;\n }\n\n const startPixel = this.startPixel_;\n const endPixel = this.endPixel_;\n const pixels = [\n startPixel,\n [startPixel[0], endPixel[1]],\n endPixel,\n [endPixel[0], startPixel[1]],\n ];\n const coordinates = pixels.map(\n this.map_.getCoordinateFromPixelInternal,\n this.map_,\n );\n // close the polygon\n coordinates[4] = coordinates[0].slice();\n if (!this.geometry_) {\n this.geometry_ = new Polygon([coordinates]);\n } else {\n this.geometry_.setCoordinates([coordinates]);\n }\n }\n\n /**\n * @return {import(\"../geom/Polygon.js\").default} Geometry.\n */\n getGeometry() {\n return this.geometry_;\n }\n}\n\nexport default RenderBox;\n","/**\n * @module ol/interaction/DragBox\n */\n// FIXME draw drag box\nimport Event from '../events/Event.js';\nimport {mouseActionButton} from '../events/condition.js';\nimport RenderBox from '../render/Box.js';\nimport PointerInteraction from './Pointer.js';\n\n/**\n * A function that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and two\n * {@link module:ol/pixel~Pixel}s and returns a `{boolean}`. If the condition is met,\n * true should be returned.\n * @typedef {function(this: ?, import(\"../MapBrowserEvent.js\").default, import(\"../pixel.js\").Pixel, import(\"../pixel.js\").Pixel):boolean} EndCondition\n */\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-dragbox'] CSS class name for styling the box.\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean\n * to indicate whether that event should be handled.\n * Default is {@link ol/events/condition~mouseActionButton}.\n * @property {number} [minArea=64] The minimum area of the box in pixel, this value is used by the default\n * `boxEndCondition` function.\n * @property {EndCondition} [boxEndCondition] A function that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and two\n * {@link module:ol/pixel~Pixel}s to indicate whether a `boxend` event should be fired.\n * Default is `true` if the area of the box is bigger than the `minArea` option.\n * @property {function(this:DragBox, import(\"../MapBrowserEvent.js\").default):void} [onBoxEnd] Code to execute just\n * before `boxend` is fired.\n */\n\n/**\n * @enum {string}\n */\nconst DragBoxEventType = {\n /**\n * Triggered upon drag box start.\n * @event DragBoxEvent#boxstart\n * @api\n */\n BOXSTART: 'boxstart',\n\n /**\n * Triggered on drag when box is active.\n * @event DragBoxEvent#boxdrag\n * @api\n */\n BOXDRAG: 'boxdrag',\n\n /**\n * Triggered upon drag box end.\n * @event DragBoxEvent#boxend\n * @api\n */\n BOXEND: 'boxend',\n\n /**\n * Triggered upon drag box canceled.\n * @event DragBoxEvent#boxcancel\n * @api\n */\n BOXCANCEL: 'boxcancel',\n};\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/interaction/DragBox~DragBox} instances are instances of\n * this type.\n */\nexport class DragBoxEvent extends Event {\n /**\n * @param {string} type The event type.\n * @param {import(\"../coordinate.js\").Coordinate} coordinate The event coordinate.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Originating event.\n */\n constructor(type, coordinate, mapBrowserEvent) {\n super(type);\n\n /**\n * The coordinate of the drag event.\n * @const\n * @type {import(\"../coordinate.js\").Coordinate}\n * @api\n */\n this.coordinate = coordinate;\n\n /**\n * @const\n * @type {import(\"../MapBrowserEvent.js\").default}\n * @api\n */\n this.mapBrowserEvent = mapBrowserEvent;\n }\n}\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature &\n * import(\"../Observable\").OnSignature &\n * import(\"../Observable\").OnSignature<'boxcancel'|'boxdrag'|'boxend'|'boxstart', DragBoxEvent, Return> &\n * import(\"../Observable\").CombinedOnSignature} DragBoxOnSignature\n */\n\n/**\n * @classdesc\n * Allows the user to draw a vector box by clicking and dragging on the map,\n * normally combined with a {@link module:ol/events/condition} that limits\n * it to when the shift or other key is held down. This is used, for example,\n * for zooming to a specific area of the map\n * (see {@link module:ol/interaction/DragZoom~DragZoom} and\n * {@link module:ol/interaction/DragRotateAndZoom~DragRotateAndZoom}).\n *\n * @fires DragBoxEvent\n * @api\n */\nclass DragBox extends PointerInteraction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n super();\n\n /***\n * @type {DragBoxOnSignature}\n */\n this.on;\n\n /***\n * @type {DragBoxOnSignature}\n */\n this.once;\n\n /***\n * @type {DragBoxOnSignature}\n */\n this.un;\n\n options = options ?? {};\n\n /**\n * @type {import(\"../render/Box.js\").default}\n * @private\n */\n this.box_ = new RenderBox(options.className || 'ol-dragbox');\n\n /**\n * @type {number}\n * @private\n */\n this.minArea_ = options.minArea ?? 64;\n\n if (options.onBoxEnd) {\n this.onBoxEnd = options.onBoxEnd;\n }\n\n /**\n * @type {import(\"../pixel.js\").Pixel}\n * @private\n */\n this.startPixel_ = null;\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.condition ?? mouseActionButton;\n\n /**\n * @private\n * @type {EndCondition}\n */\n this.boxEndCondition_ =\n options.boxEndCondition ?? this.defaultBoxEndCondition;\n }\n\n /**\n * The default condition for determining whether the boxend event\n * should fire.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent The originating MapBrowserEvent\n * leading to the box end.\n * @param {import(\"../pixel.js\").Pixel} startPixel The starting pixel of the box.\n * @param {import(\"../pixel.js\").Pixel} endPixel The end pixel of the box.\n * @return {boolean} Whether or not the boxend condition should be fired.\n */\n defaultBoxEndCondition(mapBrowserEvent, startPixel, endPixel) {\n const width = endPixel[0] - startPixel[0];\n const height = endPixel[1] - startPixel[1];\n return width * width + height * height >= this.minArea_;\n }\n\n /**\n * Returns geometry of last drawn box.\n * @return {import(\"../geom/Polygon.js\").default} Geometry.\n * @api\n */\n getGeometry() {\n return this.box_.getGeometry();\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @override\n */\n handleDragEvent(mapBrowserEvent) {\n if (!this.startPixel_) {\n return;\n }\n\n this.box_.setPixels(this.startPixel_, mapBrowserEvent.pixel);\n\n this.dispatchEvent(\n new DragBoxEvent(\n DragBoxEventType.BOXDRAG,\n mapBrowserEvent.coordinate,\n mapBrowserEvent,\n ),\n );\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleUpEvent(mapBrowserEvent) {\n if (!this.startPixel_) {\n return false;\n }\n\n const completeBox = this.boxEndCondition_(\n mapBrowserEvent,\n this.startPixel_,\n mapBrowserEvent.pixel,\n );\n if (completeBox) {\n this.onBoxEnd(mapBrowserEvent);\n }\n this.dispatchEvent(\n new DragBoxEvent(\n completeBox ? DragBoxEventType.BOXEND : DragBoxEventType.BOXCANCEL,\n mapBrowserEvent.coordinate,\n mapBrowserEvent,\n ),\n );\n\n this.box_.setMap(null);\n this.startPixel_ = null;\n\n return false;\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleDownEvent(mapBrowserEvent) {\n if (this.condition_(mapBrowserEvent)) {\n this.startPixel_ = mapBrowserEvent.pixel;\n this.box_.setMap(mapBrowserEvent.map);\n this.box_.setPixels(this.startPixel_, this.startPixel_);\n this.dispatchEvent(\n new DragBoxEvent(\n DragBoxEventType.BOXSTART,\n mapBrowserEvent.coordinate,\n mapBrowserEvent,\n ),\n );\n return true;\n }\n return false;\n }\n\n /**\n * Function to execute just before `onboxend` is fired\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n */\n onBoxEnd(event) {}\n\n /**\n * Activate or deactivate the interaction.\n * @param {boolean} active Active.\n * @observable\n * @api\n * @override\n */\n setActive(active) {\n if (!active) {\n this.box_.setMap(null);\n if (this.startPixel_) {\n this.dispatchEvent(\n new DragBoxEvent(DragBoxEventType.BOXCANCEL, this.startPixel_, null),\n );\n this.startPixel_ = null;\n }\n }\n\n super.setActive(active);\n }\n\n /**\n * @param {import(\"../Map.js\").default|null} map Map.\n * @override\n */\n setMap(map) {\n const oldMap = this.getMap();\n\n if (oldMap) {\n this.box_.setMap(null);\n\n if (this.startPixel_) {\n this.dispatchEvent(\n new DragBoxEvent(DragBoxEventType.BOXCANCEL, this.startPixel_, null),\n );\n this.startPixel_ = null;\n }\n }\n\n super.setMap(map);\n }\n}\n\nexport default DragBox;\n","/**\n * @module ol/interaction/DragZoom\n */\nimport {easeOut} from '../easing.js';\nimport {shiftKeyOnly} from '../events/condition.js';\nimport DragBox from './DragBox.js';\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-dragzoom'] CSS class name for styling the\n * box.\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that\n * takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled.\n * Default is {@link module:ol/events/condition.shiftKeyOnly}.\n * @property {number} [duration=200] Animation duration in milliseconds.\n * @property {boolean} [out=false] Use interaction for zooming out.\n * @property {number} [minArea=64] The minimum area of the box in pixel, this value is used by the parent default\n * `boxEndCondition` function.\n */\n\n/**\n * @classdesc\n * Allows the user to zoom the map by clicking and dragging on the map,\n * normally combined with a {@link module:ol/events/condition} that limits\n * it to when a key, shift by default, is held down.\n *\n * To change the style of the box, use CSS and the `.ol-dragzoom` selector, or\n * your custom one configured with `className`.\n * @api\n */\nclass DragZoom extends DragBox {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n const condition = options.condition ? options.condition : shiftKeyOnly;\n\n super({\n condition: condition,\n className: options.className || 'ol-dragzoom',\n minArea: options.minArea,\n });\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 200;\n\n /**\n * @private\n * @type {boolean}\n */\n this.out_ = options.out !== undefined ? options.out : false;\n }\n\n /**\n * Function to execute just before `onboxend` is fired\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n * @override\n */\n onBoxEnd(event) {\n const map = this.getMap();\n const view = /** @type {!import(\"../View.js\").default} */ (map.getView());\n let geometry = this.getGeometry();\n\n if (this.out_) {\n const rotatedExtent = view.rotatedExtentForGeometry(geometry);\n const resolution = view.getResolutionForExtentInternal(rotatedExtent);\n const factor = view.getResolution() / resolution;\n geometry = geometry.clone();\n geometry.scale(factor * factor);\n }\n\n view.fitInternal(geometry, {\n duration: this.duration_,\n easing: easeOut,\n });\n }\n}\n\nexport default DragZoom;\n","/**\n * @module ol/events/Key\n */\n\n/**\n * @enum {string}\n * @const\n */\nexport default {\n LEFT: 'ArrowLeft',\n UP: 'ArrowUp',\n RIGHT: 'ArrowRight',\n DOWN: 'ArrowDown',\n};\n","/**\n * @module ol/interaction/KeyboardPan\n */\nimport {rotate as rotateCoordinate} from '../coordinate.js';\nimport EventType from '../events/EventType.js';\nimport Key from '../events/Key.js';\nimport {noModifierKeys, targetNotEditable} from '../events/condition.js';\nimport Interaction, {pan} from './Interaction.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that\n * takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled. Default is\n * {@link module:ol/events/condition.noModifierKeys} and\n * {@link module:ol/events/condition.targetNotEditable}.\n * @property {number} [duration=100] Animation duration in milliseconds.\n * @property {number} [pixelDelta=128] The amount of pixels to pan on each key\n * press.\n */\n\n/**\n * @classdesc\n * Allows the user to pan the map using keyboard arrows.\n * Note that, although this interaction is by default included in maps,\n * the keys can only be used when browser focus is on the element to which\n * the keyboard events are attached. By default, this is the map div,\n * though you can change this with the `keyboardEventTarget` in\n * {@link module:ol/Map~Map}. `document` never loses focus but, for any other\n * element, focus will have to be on, and returned to, this element if the keys\n * are to function.\n * See also {@link module:ol/interaction/KeyboardZoom~KeyboardZoom}.\n * @api\n */\nclass KeyboardPan extends Interaction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n super();\n\n options = options || {};\n\n /**\n * @private\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Browser event.\n * @return {boolean} Combined condition result.\n */\n this.defaultCondition_ = function (mapBrowserEvent) {\n return (\n noModifierKeys(mapBrowserEvent) && targetNotEditable(mapBrowserEvent)\n );\n };\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ =\n options.condition !== undefined\n ? options.condition\n : this.defaultCondition_;\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 100;\n\n /**\n * @private\n * @type {number}\n */\n this.pixelDelta_ =\n options.pixelDelta !== undefined ? options.pixelDelta : 128;\n }\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} if it was a\n * `KeyEvent`, and decides the direction to pan to (if an arrow key was\n * pressed).\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @override\n */\n handleEvent(mapBrowserEvent) {\n let stopEvent = false;\n if (mapBrowserEvent.type == EventType.KEYDOWN) {\n const keyEvent = /** @type {KeyboardEvent} */ (\n mapBrowserEvent.originalEvent\n );\n const key = keyEvent.key;\n if (\n this.condition_(mapBrowserEvent) &&\n (key == Key.DOWN ||\n key == Key.LEFT ||\n key == Key.RIGHT ||\n key == Key.UP)\n ) {\n const map = mapBrowserEvent.map;\n const view = map.getView();\n const mapUnitsDelta = view.getResolution() * this.pixelDelta_;\n let deltaX = 0,\n deltaY = 0;\n if (key == Key.DOWN) {\n deltaY = -mapUnitsDelta;\n } else if (key == Key.LEFT) {\n deltaX = -mapUnitsDelta;\n } else if (key == Key.RIGHT) {\n deltaX = mapUnitsDelta;\n } else {\n deltaY = mapUnitsDelta;\n }\n const delta = [deltaX, deltaY];\n rotateCoordinate(delta, view.getRotation());\n pan(view, delta, this.duration_);\n keyEvent.preventDefault();\n stopEvent = true;\n }\n }\n return !stopEvent;\n }\n}\n\nexport default KeyboardPan;\n","/**\n * @module ol/interaction/KeyboardZoom\n */\nimport EventType from '../events/EventType.js';\nimport {platformModifierKey, targetNotEditable} from '../events/condition.js';\nimport Interaction, {zoomByDelta} from './Interaction.js';\n\n/**\n * @typedef {Object} Options\n * @property {number} [duration=100] Animation duration in milliseconds.\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that\n * takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled. The default condition is\n * that {@link module:ol/events/condition.targetNotEditable} is fulfilled and that\n * the platform modifier key isn't pressed\n * (!{@link module:ol/events/condition.platformModifierKey}).\n * @property {number} [delta=1] The zoom level delta on each key press.\n */\n\n/**\n * @classdesc\n * Allows the user to zoom the map using keyboard + and -.\n * Note that, although this interaction is by default included in maps,\n * the keys can only be used when browser focus is on the element to which\n * the keyboard events are attached. By default, this is the map div,\n * though you can change this with the `keyboardEventTarget` in\n * {@link module:ol/Map~Map}. `document` never loses focus but, for any other\n * element, focus will have to be on, and returned to, this element if the keys\n * are to function.\n * See also {@link module:ol/interaction/KeyboardPan~KeyboardPan}.\n * @api\n */\nclass KeyboardZoom extends Interaction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n super();\n\n options = options ? options : {};\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.condition\n ? options.condition\n : function (mapBrowserEvent) {\n return (\n !platformModifierKey(mapBrowserEvent) &&\n targetNotEditable(mapBrowserEvent)\n );\n };\n\n /**\n * @private\n * @type {number}\n */\n this.delta_ = options.delta ? options.delta : 1;\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 100;\n }\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} if it was a\n * `KeyEvent`, and decides whether to zoom in or out (depending on whether the\n * key pressed was '+' or '-').\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @override\n */\n handleEvent(mapBrowserEvent) {\n let stopEvent = false;\n if (\n mapBrowserEvent.type == EventType.KEYDOWN ||\n mapBrowserEvent.type == EventType.KEYPRESS\n ) {\n const keyEvent = /** @type {KeyboardEvent} */ (\n mapBrowserEvent.originalEvent\n );\n const key = keyEvent.key;\n if (this.condition_(mapBrowserEvent) && (key === '+' || key === '-')) {\n const map = mapBrowserEvent.map;\n const delta = key === '+' ? this.delta_ : -this.delta_;\n const view = map.getView();\n zoomByDelta(view, delta, undefined, this.duration_);\n keyEvent.preventDefault();\n stopEvent = true;\n }\n }\n return !stopEvent;\n }\n}\n\nexport default KeyboardZoom;\n","/**\n * @module ol/interaction/MouseWheelZoom\n */\nimport EventType from '../events/EventType.js';\nimport {all, always, focusWithTabindex} from '../events/condition.js';\nimport {clamp} from '../math.js';\nimport Interaction, {zoomByDelta} from './Interaction.js';\n\n/**\n * @typedef {'trackpad' | 'wheel'} Mode\n */\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that\n * takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled. Default is\n * {@link module:ol/events/condition.always}.\n * @property {boolean} [onFocusOnly=false] When the map's target has a `tabindex` attribute set,\n * the interaction will only handle events when the map has the focus.\n * @property {number} [maxDelta=1] Maximum mouse wheel delta.\n * @property {number} [duration=250] Animation duration in milliseconds.\n * @property {number} [timeout=80] Mouse wheel timeout duration in milliseconds.\n * @property {boolean} [useAnchor=true] Enable zooming using the mouse's\n * location as the anchor. When set to `false`, zooming in and out will zoom to\n * the center of the screen instead of zooming on the mouse's location.\n * @property {boolean} [constrainResolution=false] If true, the mouse wheel zoom\n * event will always animate to the closest zoom level after an interaction;\n * false means intermediary zoom levels are allowed.\n */\n\n/**\n * Mutliplier for the DOM_DELTA_LINE delta value.\n * @type {number}\n */\nconst DELTA_LINE_MULTIPLIER = 40;\n\n/**\n * Mutliplier for the DOM_DELTA_PAGE delta value.\n * @type {number}\n */\nconst DELTA_PAGE_MULTIPLIER = 300;\n\n/**\n * @classdesc\n * Allows the user to zoom the map by scrolling the mouse wheel.\n * @api\n */\nclass MouseWheelZoom extends Interaction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super(\n /** @type {import(\"./Interaction.js\").InteractionOptions} */ (options),\n );\n\n /**\n * @private\n * @type {number}\n */\n this.totalDelta_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.lastDelta_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDelta_ = options.maxDelta !== undefined ? options.maxDelta : 1;\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 250;\n\n /**\n * @private\n * @type {number}\n */\n this.timeout_ = options.timeout !== undefined ? options.timeout : 80;\n\n /**\n * @private\n * @type {boolean}\n */\n this.useAnchor_ =\n options.useAnchor !== undefined ? options.useAnchor : true;\n\n /**\n * @private\n * @type {boolean}\n */\n this.constrainResolution_ =\n options.constrainResolution !== undefined\n ? options.constrainResolution\n : false;\n\n const condition = options.condition ? options.condition : always;\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.onFocusOnly\n ? all(focusWithTabindex, condition)\n : condition;\n\n /**\n * @private\n * @type {?import(\"../pixel.js\").Pixel}\n */\n this.lastAnchor_ = null;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.startTime_ = undefined;\n\n /**\n * @private\n * @type {ReturnType}\n */\n this.timeoutId_;\n\n /**\n * @private\n * @type {Mode|undefined}\n */\n this.mode_ = undefined;\n\n /**\n * Trackpad events separated by this delay will be considered separate\n * interactions.\n * @private\n * @type {number}\n */\n this.trackpadEventGap_ = 400;\n\n /**\n * @private\n * @type {ReturnType}\n */\n this.trackpadTimeoutId_;\n\n /**\n * The number of delta values per zoom level\n * @private\n * @type {number}\n */\n this.deltaPerZoom_ = 300;\n }\n\n /**\n * @private\n */\n endInteraction_() {\n this.trackpadTimeoutId_ = undefined;\n const map = this.getMap();\n if (!map) {\n return;\n }\n const view = map.getView();\n view.endInteraction(\n undefined,\n this.lastDelta_ ? (this.lastDelta_ > 0 ? 1 : -1) : 0,\n this.lastAnchor_ ? map.getCoordinateFromPixel(this.lastAnchor_) : null,\n );\n }\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} (if it was a mousewheel-event) and eventually\n * zooms the map.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @override\n */\n handleEvent(mapBrowserEvent) {\n if (!this.condition_(mapBrowserEvent)) {\n return true;\n }\n const type = mapBrowserEvent.type;\n if (type !== EventType.WHEEL) {\n return true;\n }\n\n const map = mapBrowserEvent.map;\n const wheelEvent = /** @type {WheelEvent} */ (\n mapBrowserEvent.originalEvent\n );\n wheelEvent.preventDefault();\n\n if (this.useAnchor_) {\n this.lastAnchor_ = mapBrowserEvent.pixel;\n }\n\n // Delta normalisation inspired by\n // https://github.com/mapbox/mapbox-gl-js/blob/001c7b9/js/ui/handler/scroll_zoom.js\n let delta = wheelEvent.deltaY;\n\n switch (wheelEvent.deltaMode) {\n case WheelEvent.DOM_DELTA_LINE:\n delta *= DELTA_LINE_MULTIPLIER;\n break;\n case WheelEvent.DOM_DELTA_PAGE:\n delta *= DELTA_PAGE_MULTIPLIER;\n break;\n default:\n // pass\n }\n\n if (delta === 0) {\n return false;\n }\n this.lastDelta_ = delta;\n\n const now = Date.now();\n\n if (this.startTime_ === undefined) {\n this.startTime_ = now;\n }\n\n if (!this.mode_ || now - this.startTime_ > this.trackpadEventGap_) {\n this.mode_ = Math.abs(delta) < 4 ? 'trackpad' : 'wheel';\n }\n\n const view = map.getView();\n if (\n this.mode_ === 'trackpad' &&\n !(view.getConstrainResolution() || this.constrainResolution_)\n ) {\n if (this.trackpadTimeoutId_) {\n clearTimeout(this.trackpadTimeoutId_);\n } else {\n if (view.getAnimating()) {\n view.cancelAnimations();\n }\n view.beginInteraction();\n }\n this.trackpadTimeoutId_ = setTimeout(\n this.endInteraction_.bind(this),\n this.timeout_,\n );\n view.adjustZoom(\n -delta / this.deltaPerZoom_,\n this.lastAnchor_ ? map.getCoordinateFromPixel(this.lastAnchor_) : null,\n );\n this.startTime_ = now;\n return false;\n }\n\n this.totalDelta_ += delta;\n\n const timeLeft = Math.max(this.timeout_ - (now - this.startTime_), 0);\n\n clearTimeout(this.timeoutId_);\n this.timeoutId_ = setTimeout(\n this.handleWheelZoom_.bind(this, map),\n timeLeft,\n );\n\n return false;\n }\n\n /**\n * @private\n * @param {import(\"../Map.js\").default} map Map.\n */\n handleWheelZoom_(map) {\n const view = map.getView();\n if (view.getAnimating()) {\n view.cancelAnimations();\n }\n let delta =\n -clamp(\n this.totalDelta_,\n -this.maxDelta_ * this.deltaPerZoom_,\n this.maxDelta_ * this.deltaPerZoom_,\n ) / this.deltaPerZoom_;\n if (view.getConstrainResolution() || this.constrainResolution_) {\n // view has a zoom constraint, zoom by 1\n delta = delta ? (delta > 0 ? 1 : -1) : 0;\n }\n zoomByDelta(\n view,\n delta,\n this.lastAnchor_ ? map.getCoordinateFromPixel(this.lastAnchor_) : null,\n this.duration_,\n );\n\n this.mode_ = undefined;\n this.totalDelta_ = 0;\n this.lastAnchor_ = null;\n this.startTime_ = undefined;\n this.timeoutId_ = undefined;\n }\n\n /**\n * Enable or disable using the mouse's location as an anchor when zooming\n * @param {boolean} useAnchor true to zoom to the mouse's location, false\n * to zoom to the center of the map\n * @api\n */\n setMouseAnchor(useAnchor) {\n this.useAnchor_ = useAnchor;\n if (!useAnchor) {\n this.lastAnchor_ = null;\n }\n }\n}\n\nexport default MouseWheelZoom;\n","/**\n * @module ol/interaction/PinchRotate\n */\nimport {FALSE} from '../functions.js';\nimport {disable} from '../rotationconstraint.js';\nimport PointerInteraction, {\n centroid as centroidFromPointers,\n} from './Pointer.js';\n\n/**\n * @typedef {Object} Options\n * @property {number} [duration=250] The duration of the animation in\n * milliseconds.\n * @property {number} [threshold=0.3] Minimal angle in radians to start a rotation.\n */\n\n/**\n * @classdesc\n * Allows the user to rotate the map by twisting with two fingers\n * on a touch screen.\n * @api\n */\nclass PinchRotate extends PointerInteraction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n const pointerOptions = /** @type {import(\"./Pointer.js\").Options} */ (\n options\n );\n\n if (!pointerOptions.stopDown) {\n pointerOptions.stopDown = FALSE;\n }\n\n super(pointerOptions);\n\n /**\n * @private\n * @type {import(\"../coordinate.js\").Coordinate}\n */\n this.anchor_ = null;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.lastAngle_ = undefined;\n\n /**\n * @private\n * @type {boolean}\n */\n this.rotating_ = false;\n\n /**\n * @private\n * @type {number}\n */\n this.rotationDelta_ = 0.0;\n\n /**\n * @private\n * @type {number}\n */\n this.threshold_ = options.threshold !== undefined ? options.threshold : 0.3;\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 250;\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @override\n */\n handleDragEvent(mapBrowserEvent) {\n let rotationDelta = 0.0;\n\n const touch0 = this.targetPointers[0];\n const touch1 = this.targetPointers[1];\n\n // angle between touches\n const angle = Math.atan2(\n touch1.clientY - touch0.clientY,\n touch1.clientX - touch0.clientX,\n );\n\n if (this.lastAngle_ !== undefined) {\n const delta = angle - this.lastAngle_;\n this.rotationDelta_ += delta;\n if (!this.rotating_ && Math.abs(this.rotationDelta_) > this.threshold_) {\n this.rotating_ = true;\n }\n rotationDelta = delta;\n }\n this.lastAngle_ = angle;\n\n const map = mapBrowserEvent.map;\n const view = map.getView();\n if (view.getConstraints().rotation === disable) {\n return;\n }\n\n // rotate anchor point.\n // FIXME: should be the intersection point between the lines:\n // touch0,touch1 and previousTouch0,previousTouch1\n this.anchor_ = map.getCoordinateFromPixelInternal(\n map.getEventPixel(centroidFromPointers(this.targetPointers)),\n );\n\n // rotate\n if (this.rotating_) {\n map.render();\n view.adjustRotationInternal(rotationDelta, this.anchor_);\n }\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleUpEvent(mapBrowserEvent) {\n if (this.targetPointers.length < 2) {\n const map = mapBrowserEvent.map;\n const view = map.getView();\n view.endInteraction(this.duration_);\n return false;\n }\n return true;\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleDownEvent(mapBrowserEvent) {\n if (this.targetPointers.length >= 2) {\n const map = mapBrowserEvent.map;\n this.anchor_ = null;\n this.lastAngle_ = undefined;\n this.rotating_ = false;\n this.rotationDelta_ = 0.0;\n if (!this.handlingDownUpSequence) {\n map.getView().beginInteraction();\n }\n return true;\n }\n return false;\n }\n}\n\nexport default PinchRotate;\n","/**\n * @module ol/interaction/PinchZoom\n */\nimport {FALSE} from '../functions.js';\nimport PointerInteraction, {\n centroid as centroidFromPointers,\n} from './Pointer.js';\n\n/**\n * @typedef {Object} Options\n * @property {number} [duration=400] Animation duration in milliseconds.\n */\n\n/**\n * @classdesc\n * Allows the user to zoom the map by pinching with two fingers\n * on a touch screen.\n * @api\n */\nclass PinchZoom extends PointerInteraction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n const pointerOptions = /** @type {import(\"./Pointer.js\").Options} */ (\n options\n );\n\n if (!pointerOptions.stopDown) {\n pointerOptions.stopDown = FALSE;\n }\n\n super(pointerOptions);\n\n /**\n * @private\n * @type {import(\"../coordinate.js\").Coordinate}\n */\n this.anchor_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 400;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.lastDistance_ = undefined;\n\n /**\n * @private\n * @type {number}\n */\n this.lastScaleDelta_ = 1;\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @override\n */\n handleDragEvent(mapBrowserEvent) {\n let scaleDelta = 1.0;\n\n const touch0 = this.targetPointers[0];\n const touch1 = this.targetPointers[1];\n const dx = touch0.clientX - touch1.clientX;\n const dy = touch0.clientY - touch1.clientY;\n\n // distance between touches\n const distance = Math.sqrt(dx * dx + dy * dy);\n\n if (this.lastDistance_ !== undefined) {\n scaleDelta = this.lastDistance_ / distance;\n }\n this.lastDistance_ = distance;\n\n const map = mapBrowserEvent.map;\n const view = map.getView();\n\n if (scaleDelta != 1.0) {\n this.lastScaleDelta_ = scaleDelta;\n }\n\n // scale anchor point.\n this.anchor_ = map.getCoordinateFromPixelInternal(\n map.getEventPixel(centroidFromPointers(this.targetPointers)),\n );\n\n // scale, bypass the resolution constraint\n map.render();\n view.adjustResolutionInternal(scaleDelta, this.anchor_);\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleUpEvent(mapBrowserEvent) {\n if (this.targetPointers.length < 2) {\n const map = mapBrowserEvent.map;\n const view = map.getView();\n const direction = this.lastScaleDelta_ > 1 ? 1 : -1;\n view.endInteraction(this.duration_, direction);\n return false;\n }\n return true;\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleDownEvent(mapBrowserEvent) {\n if (this.targetPointers.length >= 2) {\n const map = mapBrowserEvent.map;\n this.anchor_ = null;\n this.lastDistance_ = undefined;\n this.lastScaleDelta_ = 1;\n if (!this.handlingDownUpSequence) {\n map.getView().beginInteraction();\n }\n return true;\n }\n return false;\n }\n}\n\nexport default PinchZoom;\n","/**\n * @module ol/interaction/defaults\n */\nimport Collection from '../Collection.js';\nimport Kinetic from '../Kinetic.js';\nimport DoubleClickZoom from './DoubleClickZoom.js';\nimport DragPan from './DragPan.js';\nimport DragRotate from './DragRotate.js';\nimport DragZoom from './DragZoom.js';\nimport KeyboardPan from './KeyboardPan.js';\nimport KeyboardZoom from './KeyboardZoom.js';\nimport MouseWheelZoom from './MouseWheelZoom.js';\nimport PinchRotate from './PinchRotate.js';\nimport PinchZoom from './PinchZoom.js';\n\n/**\n * @typedef {Object} DefaultsOptions\n * @property {boolean} [altShiftDragRotate=true] Whether Alt-Shift-drag rotate is\n * desired.\n * @property {boolean} [onFocusOnly=false] Interact only when the map has the\n * focus. This affects the `MouseWheelZoom` and `DragPan` interactions and is\n * useful when page scroll is desired for maps that do not have the browser's\n * focus.\n * @property {boolean} [doubleClickZoom=true] Whether double click zoom is\n * desired.\n * @property {boolean} [keyboard=true] Whether keyboard interaction is desired.\n * @property {boolean} [mouseWheelZoom=true] Whether mousewheel zoom is desired.\n * @property {boolean} [shiftDragZoom=true] Whether Shift-drag zoom is desired.\n * @property {boolean} [dragPan=true] Whether drag pan is desired.\n * @property {boolean} [pinchRotate=true] Whether pinch rotate is desired.\n * @property {boolean} [pinchZoom=true] Whether pinch zoom is desired.\n * @property {number} [zoomDelta] Zoom level delta when using keyboard or double click zoom.\n * @property {number} [zoomDuration] Duration of the zoom animation in\n * milliseconds.\n */\n\n/**\n * Set of interactions included in maps by default. Specific interactions can be\n * excluded by setting the appropriate option to false in the constructor\n * options, but the order of the interactions is fixed. If you want to specify\n * a different order for interactions, you will need to create your own\n * {@link module:ol/interaction/Interaction~Interaction} instances and insert\n * them into a {@link module:ol/Collection~Collection} in the order you want\n * before creating your {@link module:ol/Map~Map} instance. Changing the order can\n * be of interest if the event propagation needs to be stopped at a point.\n * The default set of interactions, in sequence, is:\n * {@link module:ol/interaction/DragRotate~DragRotate}\n * {@link module:ol/interaction/DoubleClickZoom~DoubleClickZoom}\n * {@link module:ol/interaction/DragPan~DragPan}\n * {@link module:ol/interaction/PinchRotate~PinchRotate}\n * {@link module:ol/interaction/PinchZoom~PinchZoom}\n * {@link module:ol/interaction/KeyboardPan~KeyboardPan}\n * {@link module:ol/interaction/KeyboardZoom~KeyboardZoom}\n * {@link module:ol/interaction/MouseWheelZoom~MouseWheelZoom}\n * {@link module:ol/interaction/DragZoom~DragZoom}\n *\n * @param {DefaultsOptions} [options] Defaults options.\n * @return {Collection}\n * A collection of interactions to be used with the {@link module:ol/Map~Map}\n * constructor's `interactions` option.\n * @api\n */\nexport function defaults(options) {\n options = options ? options : {};\n\n /** @type {Collection} */\n const interactions = new Collection();\n\n const kinetic = new Kinetic(-0.005, 0.05, 100);\n\n const altShiftDragRotate =\n options.altShiftDragRotate !== undefined\n ? options.altShiftDragRotate\n : true;\n if (altShiftDragRotate) {\n interactions.push(new DragRotate());\n }\n\n const doubleClickZoom =\n options.doubleClickZoom !== undefined ? options.doubleClickZoom : true;\n if (doubleClickZoom) {\n interactions.push(\n new DoubleClickZoom({\n delta: options.zoomDelta,\n duration: options.zoomDuration,\n }),\n );\n }\n\n const dragPan = options.dragPan !== undefined ? options.dragPan : true;\n if (dragPan) {\n interactions.push(\n new DragPan({\n onFocusOnly: options.onFocusOnly,\n kinetic: kinetic,\n }),\n );\n }\n\n const pinchRotate =\n options.pinchRotate !== undefined ? options.pinchRotate : true;\n if (pinchRotate) {\n interactions.push(new PinchRotate());\n }\n\n const pinchZoom = options.pinchZoom !== undefined ? options.pinchZoom : true;\n if (pinchZoom) {\n interactions.push(\n new PinchZoom({\n duration: options.zoomDuration,\n }),\n );\n }\n\n const keyboard = options.keyboard !== undefined ? options.keyboard : true;\n if (keyboard) {\n interactions.push(new KeyboardPan());\n interactions.push(\n new KeyboardZoom({\n delta: options.zoomDelta,\n duration: options.zoomDuration,\n }),\n );\n }\n\n const mouseWheelZoom =\n options.mouseWheelZoom !== undefined ? options.mouseWheelZoom : true;\n if (mouseWheelZoom) {\n interactions.push(\n new MouseWheelZoom({\n onFocusOnly: options.onFocusOnly,\n duration: options.zoomDuration,\n }),\n );\n }\n\n const shiftDragZoom =\n options.shiftDragZoom !== undefined ? options.shiftDragZoom : true;\n if (shiftDragZoom) {\n interactions.push(\n new DragZoom({\n duration: options.zoomDuration,\n }),\n );\n }\n\n return interactions;\n}\n","/**\n * @module ol/layer/Property\n */\n\n/**\n * @enum {string}\n */\nexport default {\n OPACITY: 'opacity',\n VISIBLE: 'visible',\n EXTENT: 'extent',\n Z_INDEX: 'zIndex',\n MAX_RESOLUTION: 'maxResolution',\n MIN_RESOLUTION: 'minResolution',\n MAX_ZOOM: 'maxZoom',\n MIN_ZOOM: 'minZoom',\n SOURCE: 'source',\n MAP: 'map',\n};\n","/**\n * @module ol/layer/Base\n */\nimport BaseObject from '../Object.js';\nimport {assert} from '../asserts.js';\nimport {clamp} from '../math.js';\nimport {abstract} from '../util.js';\nimport LayerProperty from './Property.js';\n\n/**\n * A css color, or a function called with a view resolution returning a css color.\n *\n * @typedef {string|function(number):string} BackgroundColor\n * @api\n */\n\n/**\n * @typedef {import(\"../ObjectEventType\").Types|'change:extent'|'change:maxResolution'|'change:maxZoom'|\n * 'change:minResolution'|'change:minZoom'|'change:opacity'|'change:visible'|'change:zIndex'} BaseLayerObjectEventTypes\n */\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature &\n * import(\"../Observable\").OnSignature &\n * import(\"../Observable\").CombinedOnSignature} BaseLayerOnSignature\n */\n\n/**\n * @template {Object} [Properties=Object]\n * @typedef {Object} Options\n * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number | undefined} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {BackgroundColor} [background] Background color for the layer. If not specified, no background\n * will be rendered.\n * @property {Properties} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.\n */\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * Note that with {@link module:ol/layer/Base~BaseLayer} and all its subclasses, any property set in\n * the options is set as a {@link module:ol/Object~BaseObject} property on the layer object, so\n * is observable, and has get/set accessors.\n *\n * @api\n * @template {Object} [Properties=Object]\n * @extends {BaseObject & Object>}\n */\nclass BaseLayer extends BaseObject {\n /**\n * @param {Options>} options Layer options.\n */\n constructor(options) {\n super();\n\n /***\n * @type {BaseLayerOnSignature}\n */\n this.on;\n\n /***\n * @type {BaseLayerOnSignature}\n */\n this.once;\n\n /***\n * @type {BaseLayerOnSignature}\n */\n this.un;\n\n /**\n * @type {BackgroundColor|false}\n * @private\n */\n this.background_ = options.background;\n\n /**\n * @type {?}\n */\n const properties = Object.assign({}, options);\n if (typeof options.properties === 'object') {\n delete properties.properties;\n Object.assign(properties, options.properties);\n }\n\n properties[LayerProperty.OPACITY] =\n options.opacity !== undefined ? options.opacity : 1;\n assert(\n typeof properties[LayerProperty.OPACITY] === 'number',\n 'Layer opacity must be a number',\n );\n\n properties[LayerProperty.VISIBLE] =\n options.visible !== undefined ? options.visible : true;\n properties[LayerProperty.Z_INDEX] = options.zIndex;\n properties[LayerProperty.MAX_RESOLUTION] =\n options.maxResolution !== undefined ? options.maxResolution : Infinity;\n properties[LayerProperty.MIN_RESOLUTION] =\n options.minResolution !== undefined ? options.minResolution : 0;\n properties[LayerProperty.MIN_ZOOM] =\n options.minZoom !== undefined ? options.minZoom : -Infinity;\n properties[LayerProperty.MAX_ZOOM] =\n options.maxZoom !== undefined ? options.maxZoom : Infinity;\n\n /**\n * @type {string}\n * @private\n */\n this.className_ =\n properties.className !== undefined ? properties.className : 'ol-layer';\n delete properties.className;\n\n this.setProperties(properties);\n\n /**\n * @type {import(\"./Layer.js\").State}\n * @private\n */\n this.state_ = null;\n }\n\n /**\n * Get the background for this layer.\n * @return {BackgroundColor|false} Layer background.\n */\n getBackground() {\n return this.background_;\n }\n\n /**\n * @return {string} CSS class name.\n */\n getClassName() {\n return this.className_;\n }\n\n /**\n * This method is not meant to be called by layers or layer renderers because the state\n * is incorrect if the layer is included in a layer group.\n *\n * @param {boolean} [managed] Layer is managed.\n * @return {import(\"./Layer.js\").State} Layer state.\n */\n getLayerState(managed) {\n /** @type {import(\"./Layer.js\").State} */\n const state =\n this.state_ ||\n /** @type {?} */ ({\n layer: this,\n managed: managed === undefined ? true : managed,\n });\n const zIndex = this.getZIndex();\n state.opacity = clamp(Math.round(this.getOpacity() * 100) / 100, 0, 1);\n state.visible = this.getVisible();\n state.extent = this.getExtent();\n state.zIndex = zIndex === undefined && !state.managed ? Infinity : zIndex;\n state.maxResolution = this.getMaxResolution();\n state.minResolution = Math.max(this.getMinResolution(), 0);\n state.minZoom = this.getMinZoom();\n state.maxZoom = this.getMaxZoom();\n this.state_ = state;\n\n return state;\n }\n\n /**\n * @abstract\n * @param {Array} [array] Array of layers (to be\n * modified in place).\n * @return {Array} Array of layers.\n */\n getLayersArray(array) {\n return abstract();\n }\n\n /**\n * @abstract\n * @param {Array} [states] Optional list of layer\n * states (to be modified in place).\n * @return {Array} List of layer states.\n */\n getLayerStatesArray(states) {\n return abstract();\n }\n\n /**\n * Return the {@link module:ol/extent~Extent extent} of the layer or `undefined` if it\n * will be visible regardless of extent.\n * @return {import(\"../extent.js\").Extent|undefined} The layer extent.\n * @observable\n * @api\n */\n getExtent() {\n return /** @type {import(\"../extent.js\").Extent|undefined} */ (\n this.get(LayerProperty.EXTENT)\n );\n }\n\n /**\n * Return the maximum resolution of the layer. Returns Infinity if\n * the layer has no maximum resolution set.\n * @return {number} The maximum resolution of the layer.\n * @observable\n * @api\n */\n getMaxResolution() {\n return /** @type {number} */ (this.get(LayerProperty.MAX_RESOLUTION));\n }\n\n /**\n * Return the minimum resolution of the layer. Returns 0 if\n * the layer has no minimum resolution set.\n * @return {number} The minimum resolution of the layer.\n * @observable\n * @api\n */\n getMinResolution() {\n return /** @type {number} */ (this.get(LayerProperty.MIN_RESOLUTION));\n }\n\n /**\n * Return the minimum zoom level of the layer. Returns -Infinity if\n * the layer has no minimum zoom set.\n * @return {number} The minimum zoom level of the layer.\n * @observable\n * @api\n */\n getMinZoom() {\n return /** @type {number} */ (this.get(LayerProperty.MIN_ZOOM));\n }\n\n /**\n * Return the maximum zoom level of the layer. Returns Infinity if\n * the layer has no maximum zoom set.\n * @return {number} The maximum zoom level of the layer.\n * @observable\n * @api\n */\n getMaxZoom() {\n return /** @type {number} */ (this.get(LayerProperty.MAX_ZOOM));\n }\n\n /**\n * Return the opacity of the layer (between 0 and 1).\n * @return {number} The opacity of the layer.\n * @observable\n * @api\n */\n getOpacity() {\n return /** @type {number} */ (this.get(LayerProperty.OPACITY));\n }\n\n /**\n * @abstract\n * @return {import(\"../source/Source.js\").State} Source state.\n */\n getSourceState() {\n return abstract();\n }\n\n /**\n * Return the value of this layer's `visible` property. To find out whether the layer\n * is visible on a map, use `isVisible()` instead.\n * @return {boolean} The value of the `visible` property of the layer.\n * @observable\n * @api\n */\n getVisible() {\n return /** @type {boolean} */ (this.get(LayerProperty.VISIBLE));\n }\n\n /**\n * Return the Z-index of the layer, which is used to order layers before\n * rendering. Returns undefined if the layer is unmanaged.\n * @return {number|undefined} The Z-index of the layer.\n * @observable\n * @api\n */\n getZIndex() {\n return /** @type {number|undefined} */ (this.get(LayerProperty.Z_INDEX));\n }\n\n /**\n * Sets the background color.\n * @param {BackgroundColor} [background] Background color.\n */\n setBackground(background) {\n this.background_ = background;\n this.changed();\n }\n\n /**\n * Set the extent at which the layer is visible. If `undefined`, the layer\n * will be visible at all extents.\n * @param {import(\"../extent.js\").Extent|undefined} extent The extent of the layer.\n * @observable\n * @api\n */\n setExtent(extent) {\n this.set(LayerProperty.EXTENT, extent);\n }\n\n /**\n * Set the maximum resolution at which the layer is visible.\n * @param {number} maxResolution The maximum resolution of the layer.\n * @observable\n * @api\n */\n setMaxResolution(maxResolution) {\n this.set(LayerProperty.MAX_RESOLUTION, maxResolution);\n }\n\n /**\n * Set the minimum resolution at which the layer is visible.\n * @param {number} minResolution The minimum resolution of the layer.\n * @observable\n * @api\n */\n setMinResolution(minResolution) {\n this.set(LayerProperty.MIN_RESOLUTION, minResolution);\n }\n\n /**\n * Set the maximum zoom (exclusive) at which the layer is visible.\n * Note that the zoom levels for layer visibility are based on the\n * view zoom level, which may be different from a tile source zoom level.\n * @param {number} maxZoom The maximum zoom of the layer.\n * @observable\n * @api\n */\n setMaxZoom(maxZoom) {\n this.set(LayerProperty.MAX_ZOOM, maxZoom);\n }\n\n /**\n * Set the minimum zoom (inclusive) at which the layer is visible.\n * Note that the zoom levels for layer visibility are based on the\n * view zoom level, which may be different from a tile source zoom level.\n * @param {number} minZoom The minimum zoom of the layer.\n * @observable\n * @api\n */\n setMinZoom(minZoom) {\n this.set(LayerProperty.MIN_ZOOM, minZoom);\n }\n\n /**\n * Set the opacity of the layer, allowed values range from 0 to 1.\n * @param {number} opacity The opacity of the layer.\n * @observable\n * @api\n */\n setOpacity(opacity) {\n assert(typeof opacity === 'number', 'Layer opacity must be a number');\n this.set(LayerProperty.OPACITY, opacity);\n }\n\n /**\n * Set the visibility of the layer (`true` or `false`).\n * @param {boolean} visible The visibility of the layer.\n * @observable\n * @api\n */\n setVisible(visible) {\n this.set(LayerProperty.VISIBLE, visible);\n }\n\n /**\n * Set Z-index of the layer, which is used to order layers before rendering.\n * The default Z-index is 0.\n * @param {number} zindex The z-index of the layer.\n * @observable\n * @api\n */\n setZIndex(zindex) {\n this.set(LayerProperty.Z_INDEX, zindex);\n }\n\n /**\n * Clean up.\n * @override\n */\n disposeInternal() {\n if (this.state_) {\n this.state_.layer = null;\n this.state_ = null;\n }\n super.disposeInternal();\n }\n}\n\nexport default BaseLayer;\n","/**\n * @module ol/layer/Group\n */\nimport Collection from '../Collection.js';\nimport CollectionEventType from '../CollectionEventType.js';\nimport ObjectEventType from '../ObjectEventType.js';\nimport {assert} from '../asserts.js';\nimport Event from '../events/Event.js';\nimport EventType from '../events/EventType.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport {getIntersection} from '../extent.js';\nimport {clear} from '../obj.js';\nimport {getUid} from '../util.js';\nimport BaseLayer from './Base.js';\n\n/**\n * @enum {string}\n */\nconst GroupEventType = {\n /**\n * Triggered when a layer is added\n * @event GroupEvent#addlayer\n * @api\n */\n ADDLAYER: 'addlayer',\n /**\n * Triggered when a layer is removed\n * @event GroupEvent#removelayer\n * @api\n */\n REMOVELAYER: 'removelayer',\n};\n\n/**\n * @classdesc\n * A layer group triggers 'addlayer' and 'removelayer' events when layers are added to or removed from\n * the group or one of its child groups. When a layer group is added to or removed from another layer group,\n * a single event will be triggered (instead of one per layer in the group added or removed).\n */\nexport class GroupEvent extends Event {\n /**\n * @param {GroupEventType} type The event type.\n * @param {BaseLayer} layer The layer.\n */\n constructor(type, layer) {\n super(type);\n\n /**\n * The added or removed layer.\n * @type {BaseLayer}\n * @api\n */\n this.layer = layer;\n }\n}\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature &\n * import(\"../Observable\").OnSignature &\n * import(\"../Observable\").OnSignature<'addlayer'|'removelayer', GroupEvent, Return> &\n * import(\"../Observable\").CombinedOnSignature} GroupOnSignature\n */\n\n/**\n * @typedef {Object} Options\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {Array|Collection} [layers] Child layers.\n * @property {Object} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.\n */\n\n/**\n * @enum {string}\n * @private\n */\nconst Property = {\n LAYERS: 'layers',\n};\n\n/**\n * @classdesc\n * A {@link module:ol/Collection~Collection} of layers that are handled together.\n *\n * A generic `change` event is triggered when the group/Collection changes.\n *\n * @fires GroupEvent\n * @api\n */\nclass LayerGroup extends BaseLayer {\n /**\n * @param {Options} [options] Layer options.\n */\n constructor(options) {\n options = options || {};\n const baseOptions = /** @type {Options} */ (Object.assign({}, options));\n delete baseOptions.layers;\n\n let layers = options.layers;\n\n super(baseOptions);\n\n /***\n * @type {GroupOnSignature}\n */\n this.on;\n\n /***\n * @type {GroupOnSignature}\n */\n this.once;\n\n /***\n * @type {GroupOnSignature}\n */\n this.un;\n\n /**\n * @private\n * @type {Array}\n */\n this.layersListenerKeys_ = [];\n\n /**\n * @private\n * @type {Object>}\n */\n this.listenerKeys_ = {};\n\n this.addChangeListener(Property.LAYERS, this.handleLayersChanged_);\n\n if (layers) {\n if (Array.isArray(layers)) {\n layers = new Collection(layers.slice(), {unique: true});\n } else {\n assert(\n typeof (/** @type {?} */ (layers).getArray) === 'function',\n 'Expected `layers` to be an array or a `Collection`',\n );\n }\n } else {\n layers = new Collection(undefined, {unique: true});\n }\n\n this.setLayers(layers);\n }\n\n /**\n * @private\n */\n handleLayerChange_() {\n this.changed();\n }\n\n /**\n * @private\n */\n handleLayersChanged_() {\n this.layersListenerKeys_.forEach(unlistenByKey);\n this.layersListenerKeys_.length = 0;\n\n const layers = this.getLayers();\n this.layersListenerKeys_.push(\n listen(layers, CollectionEventType.ADD, this.handleLayersAdd_, this),\n listen(\n layers,\n CollectionEventType.REMOVE,\n this.handleLayersRemove_,\n this,\n ),\n );\n\n for (const id in this.listenerKeys_) {\n this.listenerKeys_[id].forEach(unlistenByKey);\n }\n clear(this.listenerKeys_);\n\n const layersArray = layers.getArray();\n for (let i = 0, ii = layersArray.length; i < ii; i++) {\n const layer = layersArray[i];\n this.registerLayerListeners_(layer);\n this.dispatchEvent(new GroupEvent(GroupEventType.ADDLAYER, layer));\n }\n this.changed();\n }\n\n /**\n * @param {BaseLayer} layer The layer.\n */\n registerLayerListeners_(layer) {\n const listenerKeys = [\n listen(\n layer,\n ObjectEventType.PROPERTYCHANGE,\n this.handleLayerChange_,\n this,\n ),\n listen(layer, EventType.CHANGE, this.handleLayerChange_, this),\n ];\n\n if (layer instanceof LayerGroup) {\n listenerKeys.push(\n listen(layer, GroupEventType.ADDLAYER, this.handleLayerGroupAdd_, this),\n listen(\n layer,\n GroupEventType.REMOVELAYER,\n this.handleLayerGroupRemove_,\n this,\n ),\n );\n }\n\n this.listenerKeys_[getUid(layer)] = listenerKeys;\n }\n\n /**\n * @param {GroupEvent} event The layer group event.\n */\n handleLayerGroupAdd_(event) {\n this.dispatchEvent(new GroupEvent(GroupEventType.ADDLAYER, event.layer));\n }\n\n /**\n * @param {GroupEvent} event The layer group event.\n */\n handleLayerGroupRemove_(event) {\n this.dispatchEvent(new GroupEvent(GroupEventType.REMOVELAYER, event.layer));\n }\n\n /**\n * @param {import(\"../Collection.js\").CollectionEvent} collectionEvent CollectionEvent.\n * @private\n */\n handleLayersAdd_(collectionEvent) {\n const layer = collectionEvent.element;\n this.registerLayerListeners_(layer);\n this.dispatchEvent(new GroupEvent(GroupEventType.ADDLAYER, layer));\n this.changed();\n }\n\n /**\n * @param {import(\"../Collection.js\").CollectionEvent} collectionEvent CollectionEvent.\n * @private\n */\n handleLayersRemove_(collectionEvent) {\n const layer = collectionEvent.element;\n const key = getUid(layer);\n this.listenerKeys_[key].forEach(unlistenByKey);\n delete this.listenerKeys_[key];\n this.dispatchEvent(new GroupEvent(GroupEventType.REMOVELAYER, layer));\n this.changed();\n }\n\n /**\n * Returns the {@link module:ol/Collection~Collection collection} of {@link module:ol/layer/Layer~Layer layers}\n * in this group.\n * @return {!Collection} Collection of\n * {@link module:ol/layer/Base~BaseLayer layers} that are part of this group.\n * @observable\n * @api\n */\n getLayers() {\n return /** @type {!Collection} */ (\n this.get(Property.LAYERS)\n );\n }\n\n /**\n * Set the {@link module:ol/Collection~Collection collection} of {@link module:ol/layer/Layer~Layer layers}\n * in this group.\n * @param {!Collection} layers Collection of\n * {@link module:ol/layer/Base~BaseLayer layers} that are part of this group.\n * @observable\n * @api\n */\n setLayers(layers) {\n const collection = this.getLayers();\n if (collection) {\n const currentLayers = collection.getArray();\n for (let i = 0, ii = currentLayers.length; i < ii; ++i) {\n this.dispatchEvent(\n new GroupEvent(GroupEventType.REMOVELAYER, currentLayers[i]),\n );\n }\n }\n\n this.set(Property.LAYERS, layers);\n }\n\n /**\n * @param {Array} [array] Array of layers (to be modified in place).\n * @return {Array} Array of layers.\n * @override\n */\n getLayersArray(array) {\n array = array !== undefined ? array : [];\n this.getLayers().forEach(function (layer) {\n layer.getLayersArray(array);\n });\n return array;\n }\n\n /**\n * Get the layer states list and use this groups z-index as the default\n * for all layers in this and nested groups, if it is unset at this point.\n * If dest is not provided and this group's z-index is undefined\n * 0 is used a the default z-index.\n * @param {Array} [dest] Optional list\n * of layer states (to be modified in place).\n * @return {Array} List of layer states.\n * @override\n */\n getLayerStatesArray(dest) {\n const states = dest !== undefined ? dest : [];\n const pos = states.length;\n\n this.getLayers().forEach(function (layer) {\n layer.getLayerStatesArray(states);\n });\n\n const ownLayerState = this.getLayerState();\n let defaultZIndex = ownLayerState.zIndex;\n if (!dest && ownLayerState.zIndex === undefined) {\n defaultZIndex = 0;\n }\n for (let i = pos, ii = states.length; i < ii; i++) {\n const layerState = states[i];\n layerState.opacity *= ownLayerState.opacity;\n layerState.visible = layerState.visible && ownLayerState.visible;\n layerState.maxResolution = Math.min(\n layerState.maxResolution,\n ownLayerState.maxResolution,\n );\n layerState.minResolution = Math.max(\n layerState.minResolution,\n ownLayerState.minResolution,\n );\n layerState.minZoom = Math.max(layerState.minZoom, ownLayerState.minZoom);\n layerState.maxZoom = Math.min(layerState.maxZoom, ownLayerState.maxZoom);\n if (ownLayerState.extent !== undefined) {\n if (layerState.extent !== undefined) {\n layerState.extent = getIntersection(\n layerState.extent,\n ownLayerState.extent,\n );\n } else {\n layerState.extent = ownLayerState.extent;\n }\n }\n if (layerState.zIndex === undefined) {\n layerState.zIndex = defaultZIndex;\n }\n }\n\n return states;\n }\n\n /**\n * @return {import(\"../source/Source.js\").State} Source state.\n * @override\n */\n getSourceState() {\n return 'ready';\n }\n}\n\nexport default LayerGroup;\n","/**\n * @module ol/render/EventType\n */\n\n/**\n * @enum {string}\n */\nexport default {\n /**\n * Triggered before a layer is rendered.\n * @event module:ol/render/Event~RenderEvent#prerender\n * @api\n */\n PRERENDER: 'prerender',\n\n /**\n * Triggered after a layer is rendered.\n * @event module:ol/render/Event~RenderEvent#postrender\n * @api\n */\n POSTRENDER: 'postrender',\n\n /**\n * Triggered before layers are composed. When dispatched by the map, the event object will not have\n * a `context` set. When dispatched by a layer, the event object will have a `context` set. Only\n * WebGL layers currently dispatch this event.\n * @event module:ol/render/Event~RenderEvent#precompose\n * @api\n */\n PRECOMPOSE: 'precompose',\n\n /**\n * Triggered after layers are composed. When dispatched by the map, the event object will not have\n * a `context` set. When dispatched by a layer, the event object will have a `context` set. Only\n * WebGL layers currently dispatch this event.\n * @event module:ol/render/Event~RenderEvent#postcompose\n * @api\n */\n POSTCOMPOSE: 'postcompose',\n\n /**\n * Triggered when rendering is complete, i.e. all sources and tiles have\n * finished loading for the current viewport, and all tiles are faded in.\n * The event object will not have a `context` set.\n * @event module:ol/render/Event~RenderEvent#rendercomplete\n * @api\n */\n RENDERCOMPLETE: 'rendercomplete',\n};\n\n/**\n * @typedef {'postrender'|'precompose'|'postcompose'|'rendercomplete'} MapRenderEventTypes\n */\n\n/**\n * @typedef {'postrender'|'prerender'} LayerRenderEventTypes\n */\n","/**\n * @module ol/layer/Layer\n */\nimport View from '../View.js';\nimport {assert} from '../asserts.js';\nimport EventType from '../events/EventType.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport {intersects} from '../extent.js';\nimport RenderEventType from '../render/EventType.js';\nimport BaseLayer from './Base.js';\nimport LayerProperty from './Property.js';\n\n/**\n * @typedef {function(import(\"../Map.js\").FrameState):HTMLElement} RenderFunction\n */\n\n/**\n * @typedef {'sourceready'|'change:source'} LayerEventType\n */\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature &\n * import(\"../Observable\").OnSignature &\n * import(\"../Observable\").OnSignature &\n * import(\"../Observable\").CombinedOnSignature} LayerOnSignature\n */\n\n/**\n * @template {import(\"../source/Source.js\").default} [SourceType=import(\"../source/Source.js\").default]\n * @template {Object} [Properties=Object]\n * @typedef {Object} Options\n * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {SourceType} [source] Source for this layer. If not provided to the constructor,\n * the source can be set by calling {@link module:ol/layer/Layer~Layer#setSource layer.setSource(source)} after\n * construction.\n * @property {import(\"../Map.js\").default|null} [map] Map.\n * @property {RenderFunction} [render] Render function. Takes the frame state as input and is expected to return an\n * HTML element. Will overwrite the default rendering for the layer.\n * @property {Properties} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.\n */\n\n/**\n * @typedef {Object} State\n * @property {import(\"./Layer.js\").default} layer Layer.\n * @property {number} opacity Opacity, the value is rounded to two digits to appear after the decimal point.\n * @property {boolean} visible Visible.\n * @property {boolean} managed Managed.\n * @property {import(\"../extent.js\").Extent} [extent] Extent.\n * @property {number} zIndex ZIndex.\n * @property {number} maxResolution Maximum resolution.\n * @property {number} minResolution Minimum resolution.\n * @property {number} minZoom Minimum zoom.\n * @property {number} maxZoom Maximum zoom.\n */\n\n/**\n * @classdesc\n * Base class from which all layer types are derived. This should only be instantiated\n * in the case where a custom layer is added to the map with a custom `render` function.\n * Such a function can be specified in the `options` object, and is expected to return an HTML element.\n *\n * A visual representation of raster or vector map data.\n * Layers group together those properties that pertain to how the data is to be\n * displayed, irrespective of the source of that data.\n *\n * Layers are usually added to a map with [map.addLayer()]{@link import(\"../Map.js\").default#addLayer}.\n * Components like {@link module:ol/interaction/Draw~Draw} use unmanaged layers\n * internally. These unmanaged layers are associated with the map using\n * [layer.setMap()]{@link module:ol/layer/Layer~Layer#setMap} instead.\n *\n * A generic `change` event is fired when the state of the source changes.\n * A `sourceready` event is fired when the layer's source is ready.\n *\n * @fires import(\"../render/Event.js\").RenderEvent#prerender\n * @fires import(\"../render/Event.js\").RenderEvent#postrender\n * @fires import(\"../events/Event.js\").BaseEvent#sourceready\n *\n * @template {import(\"../source/Source.js\").default} [SourceType=import(\"../source/Source.js\").default]\n * @template {import(\"../renderer/Layer.js\").default} [RendererType=import(\"../renderer/Layer.js\").default]\n * @template {Object} [Properties=Object]\n * @extends {BaseLayer>}\n * @api\n */\nclass Layer extends BaseLayer {\n /**\n * @param {Options>} options Layer options.\n */\n constructor(options) {\n const baseOptions = Object.assign({}, options);\n delete baseOptions.source;\n\n super(baseOptions);\n\n /***\n * @type {LayerOnSignature}\n */\n this.on;\n\n /***\n * @type {LayerOnSignature}\n */\n this.once;\n\n /***\n * @type {LayerOnSignature}\n */\n this.un;\n\n /**\n * @private\n * @type {?import(\"../events.js\").EventsKey}\n */\n this.mapPrecomposeKey_ = null;\n\n /**\n * @private\n * @type {?import(\"../events.js\").EventsKey}\n */\n this.mapRenderKey_ = null;\n\n /**\n * @private\n * @type {?import(\"../events.js\").EventsKey}\n */\n this.sourceChangeKey_ = null;\n\n /**\n * @private\n * @type {RendererType}\n */\n this.renderer_ = null;\n\n /**\n * @private\n * @type {boolean}\n */\n this.sourceReady_ = false;\n\n /**\n * @protected\n * @type {boolean}\n */\n this.rendered = false;\n\n // Overwrite default render method with a custom one\n if (options.render) {\n this.render = options.render;\n }\n\n if (options.map) {\n this.setMap(options.map);\n }\n\n this.addChangeListener(\n LayerProperty.SOURCE,\n this.handleSourcePropertyChange_,\n );\n\n const source = options.source\n ? /** @type {SourceType} */ (options.source)\n : null;\n this.setSource(source);\n }\n\n /**\n * @param {Array} [array] Array of layers (to be modified in place).\n * @return {Array} Array of layers.\n * @override\n */\n getLayersArray(array) {\n array = array ? array : [];\n array.push(this);\n return array;\n }\n\n /**\n * @param {Array} [states] Optional list of layer states (to be modified in place).\n * @return {Array} List of layer states.\n * @override\n */\n getLayerStatesArray(states) {\n states = states ? states : [];\n states.push(this.getLayerState());\n return states;\n }\n\n /**\n * Get the layer source.\n * @return {SourceType|null} The layer source (or `null` if not yet set).\n * @observable\n * @api\n */\n getSource() {\n return /** @type {SourceType} */ (this.get(LayerProperty.SOURCE)) || null;\n }\n\n /**\n * @return {SourceType|null} The source being rendered.\n */\n getRenderSource() {\n return this.getSource();\n }\n\n /**\n * @return {import(\"../source/Source.js\").State} Source state.\n * @override\n */\n getSourceState() {\n const source = this.getSource();\n return !source ? 'undefined' : source.getState();\n }\n\n /**\n * @private\n */\n handleSourceChange_() {\n this.changed();\n if (this.sourceReady_ || this.getSource().getState() !== 'ready') {\n return;\n }\n this.sourceReady_ = true;\n this.dispatchEvent('sourceready');\n }\n\n /**\n * @private\n */\n handleSourcePropertyChange_() {\n if (this.sourceChangeKey_) {\n unlistenByKey(this.sourceChangeKey_);\n this.sourceChangeKey_ = null;\n }\n this.sourceReady_ = false;\n const source = this.getSource();\n if (source) {\n this.sourceChangeKey_ = listen(\n source,\n EventType.CHANGE,\n this.handleSourceChange_,\n this,\n );\n if (source.getState() === 'ready') {\n this.sourceReady_ = true;\n setTimeout(() => {\n this.dispatchEvent('sourceready');\n }, 0);\n }\n }\n this.changed();\n }\n\n /**\n * @param {import(\"../pixel\").Pixel} pixel Pixel.\n * @return {Promise>} Promise that resolves with\n * an array of features.\n */\n getFeatures(pixel) {\n if (!this.renderer_) {\n return Promise.resolve([]);\n }\n return this.renderer_.getFeatures(pixel);\n }\n\n /**\n * @param {import(\"../pixel\").Pixel} pixel Pixel.\n * @return {Uint8ClampedArray|Uint8Array|Float32Array|DataView|null} Pixel data.\n */\n getData(pixel) {\n if (!this.renderer_ || !this.rendered) {\n return null;\n }\n return this.renderer_.getData(pixel);\n }\n\n /**\n * The layer is visible on the map view, i.e. within its min/max resolution or zoom and\n * extent, not set to `visible: false`, and not inside a layer group that is set\n * to `visible: false`.\n * @param {View|import(\"../View.js\").ViewStateLayerStateExtent} [view] View or {@link import(\"../Map.js\").FrameState}.\n * Only required when the layer is not added to a map.\n * @return {boolean} The layer is visible in the map view.\n * @api\n */\n isVisible(view) {\n let frameState;\n const map = this.getMapInternal();\n if (!view && map) {\n view = map.getView();\n }\n if (view instanceof View) {\n frameState = {\n viewState: view.getState(),\n extent: view.calculateExtent(),\n };\n } else {\n frameState = view;\n }\n if (!frameState.layerStatesArray && map) {\n frameState.layerStatesArray = map.getLayerGroup().getLayerStatesArray();\n }\n let layerState;\n if (frameState.layerStatesArray) {\n layerState = frameState.layerStatesArray.find(\n (layerState) => layerState.layer === this,\n );\n if (!layerState) {\n return false;\n }\n } else {\n layerState = this.getLayerState();\n }\n\n const layerExtent = this.getExtent();\n\n return (\n inView(layerState, frameState.viewState) &&\n (!layerExtent || intersects(layerExtent, frameState.extent))\n );\n }\n\n /**\n * Get the attributions of the source of this layer for the given view.\n * @param {View|import(\"../View.js\").ViewStateLayerStateExtent} [view] View or {@link import(\"../Map.js\").FrameState}.\n * Only required when the layer is not added to a map.\n * @return {Array} Attributions for this layer at the given view.\n * @api\n */\n getAttributions(view) {\n if (!this.isVisible(view)) {\n return [];\n }\n const getAttributions = this.getSource()?.getAttributions();\n if (!getAttributions) {\n return [];\n }\n const frameState =\n view instanceof View ? view.getViewStateAndExtent() : view;\n let attributions = getAttributions(frameState);\n if (!Array.isArray(attributions)) {\n attributions = [attributions];\n }\n return attributions;\n }\n\n /**\n * In charge to manage the rendering of the layer. One layer type is\n * bounded with one layer renderer.\n * @param {?import(\"../Map.js\").FrameState} frameState Frame state.\n * @param {HTMLElement} target Target which the renderer may (but need not) use\n * for rendering its content.\n * @return {HTMLElement|null} The rendered element.\n */\n render(frameState, target) {\n const layerRenderer = this.getRenderer();\n\n if (layerRenderer.prepareFrame(frameState)) {\n this.rendered = true;\n return layerRenderer.renderFrame(frameState, target);\n }\n return null;\n }\n\n /**\n * Called when a layer is not visible during a map render.\n */\n unrender() {\n this.rendered = false;\n }\n\n /** @return {string} Declutter */\n getDeclutter() {\n return undefined;\n }\n\n /**\n * @param {import(\"../Map.js\").FrameState} frameState Frame state.\n * @param {import(\"../layer/Layer.js\").State} layerState Layer state.\n */\n renderDeclutter(frameState, layerState) {}\n\n /**\n * When the renderer follows a layout -> render approach, do the final rendering here.\n * @param {import('../Map.js').FrameState} frameState Frame state\n */\n renderDeferred(frameState) {\n const layerRenderer = this.getRenderer();\n if (!layerRenderer) {\n return;\n }\n layerRenderer.renderDeferred(frameState);\n }\n\n /**\n * For use inside the library only.\n * @param {import(\"../Map.js\").default|null} map Map.\n */\n setMapInternal(map) {\n if (!map) {\n this.unrender();\n }\n this.set(LayerProperty.MAP, map);\n }\n\n /**\n * For use inside the library only.\n * @return {import(\"../Map.js\").default|null} Map.\n */\n getMapInternal() {\n return this.get(LayerProperty.MAP);\n }\n\n /**\n * Sets the layer to be rendered on top of other layers on a map. The map will\n * not manage this layer in its layers collection. This\n * is useful for temporary layers. To remove an unmanaged layer from the map,\n * use `#setMap(null)`.\n *\n * To add the layer to a map and have it managed by the map, use\n * {@link module:ol/Map~Map#addLayer} instead.\n * @param {import(\"../Map.js\").default|null} map Map.\n * @api\n */\n setMap(map) {\n if (this.mapPrecomposeKey_) {\n unlistenByKey(this.mapPrecomposeKey_);\n this.mapPrecomposeKey_ = null;\n }\n if (!map) {\n this.changed();\n }\n if (this.mapRenderKey_) {\n unlistenByKey(this.mapRenderKey_);\n this.mapRenderKey_ = null;\n }\n if (map) {\n this.mapPrecomposeKey_ = listen(\n map,\n RenderEventType.PRECOMPOSE,\n this.handlePrecompose_,\n this,\n );\n this.mapRenderKey_ = listen(this, EventType.CHANGE, map.render, map);\n this.changed();\n }\n }\n\n /**\n * @param {import(\"../events/Event.js\").default} renderEvent Render event\n * @private\n */\n handlePrecompose_(renderEvent) {\n const layerStatesArray =\n /** @type {import(\"../render/Event.js\").default} */ (renderEvent)\n .frameState.layerStatesArray;\n const layerState = this.getLayerState(false);\n assert(\n !layerStatesArray.some(\n (arrayLayerState) => arrayLayerState.layer === layerState.layer,\n ),\n 'A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both.',\n );\n layerStatesArray.push(layerState);\n }\n\n /**\n * Set the layer source.\n * @param {SourceType|null} source The layer source.\n * @observable\n * @api\n */\n setSource(source) {\n this.set(LayerProperty.SOURCE, source);\n }\n\n /**\n * Get the renderer for this layer.\n * @return {RendererType|null} The layer renderer.\n */\n getRenderer() {\n if (!this.renderer_) {\n this.renderer_ = this.createRenderer();\n }\n return this.renderer_;\n }\n\n /**\n * @return {boolean} The layer has a renderer.\n */\n hasRenderer() {\n return !!this.renderer_;\n }\n\n /**\n * Create a renderer for this layer.\n * @return {RendererType} A layer renderer.\n * @protected\n */\n createRenderer() {\n return null;\n }\n\n /**\n * This will clear the renderer so that a new one can be created next time it is needed\n */\n clearRenderer() {\n if (this.renderer_) {\n this.renderer_.dispose();\n delete this.renderer_;\n }\n }\n\n /**\n * Clean up.\n * @override\n */\n disposeInternal() {\n this.clearRenderer();\n this.setSource(null);\n super.disposeInternal();\n }\n}\n\n/**\n * Return `true` if the layer is visible and if the provided view state\n * has resolution and zoom levels that are in range of the layer's min/max.\n * @param {State} layerState Layer state.\n * @param {import(\"../View.js\").State} viewState View state.\n * @return {boolean} The layer is visible at the given view state.\n */\nexport function inView(layerState, viewState) {\n if (!layerState.visible) {\n return false;\n }\n const resolution = viewState.resolution;\n if (\n resolution < layerState.minResolution ||\n resolution >= layerState.maxResolution\n ) {\n return false;\n }\n const zoom = viewState.zoom;\n return zoom > layerState.minZoom && zoom <= layerState.maxZoom;\n}\n\nexport default Layer;\n","\n/**\n * Rearranges items so that all items in the [left, k] are the smallest.\n * The k-th element will have the (k - left + 1)-th smallest value in [left, right].\n *\n * @template T\n * @param {T[]} arr the array to partially sort (in place)\n * @param {number} k middle index for partial sorting (as defined above)\n * @param {number} [left=0] left index of the range to sort\n * @param {number} [right=arr.length-1] right index\n * @param {(a: T, b: T) => number} [compare = (a, b) => a - b] compare function\n */\nexport default function quickselect(arr, k, left = 0, right = arr.length - 1, compare = defaultCompare) {\n\n while (right > left) {\n if (right - left > 600) {\n const n = right - left + 1;\n const m = k - left + 1;\n const z = Math.log(n);\n const s = 0.5 * Math.exp(2 * z / 3);\n const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);\n const newLeft = Math.max(left, Math.floor(k - m * s / n + sd));\n const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));\n quickselect(arr, k, newLeft, newRight, compare);\n }\n\n const t = arr[k];\n let i = left;\n /** @type {number} */\n let j = right;\n\n swap(arr, left, k);\n if (compare(arr[right], t) > 0) swap(arr, left, right);\n\n while (i < j) {\n swap(arr, i, j);\n i++;\n j--;\n while (compare(arr[i], t) < 0) i++;\n while (compare(arr[j], t) > 0) j--;\n }\n\n if (compare(arr[left], t) === 0) swap(arr, left, j);\n else {\n j++;\n swap(arr, j, right);\n }\n\n if (j <= k) left = j + 1;\n if (k <= j) right = j - 1;\n }\n}\n\n/**\n * @template T\n * @param {T[]} arr\n * @param {number} i\n * @param {number} j\n */\nfunction swap(arr, i, j) {\n const tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n}\n\n/**\n * @template T\n * @param {T} a\n * @param {T} b\n * @returns {number}\n */\nfunction defaultCompare(a, b) {\n return a < b ? -1 : a > b ? 1 : 0;\n}\n","import quickselect from 'quickselect';\n\nexport default class RBush {\n constructor(maxEntries = 9) {\n // max entries in a node is 9 by default; min node fill is 40% for best performance\n this._maxEntries = Math.max(4, maxEntries);\n this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));\n this.clear();\n }\n\n all() {\n return this._all(this.data, []);\n }\n\n search(bbox) {\n let node = this.data;\n const result = [];\n\n if (!intersects(bbox, node)) return result;\n\n const toBBox = this.toBBox;\n const nodesToSearch = [];\n\n while (node) {\n for (let i = 0; i < node.children.length; i++) {\n const child = node.children[i];\n const childBBox = node.leaf ? toBBox(child) : child;\n\n if (intersects(bbox, childBBox)) {\n if (node.leaf) result.push(child);\n else if (contains(bbox, childBBox)) this._all(child, result);\n else nodesToSearch.push(child);\n }\n }\n node = nodesToSearch.pop();\n }\n\n return result;\n }\n\n collides(bbox) {\n let node = this.data;\n\n if (!intersects(bbox, node)) return false;\n\n const nodesToSearch = [];\n while (node) {\n for (let i = 0; i < node.children.length; i++) {\n const child = node.children[i];\n const childBBox = node.leaf ? this.toBBox(child) : child;\n\n if (intersects(bbox, childBBox)) {\n if (node.leaf || contains(bbox, childBBox)) return true;\n nodesToSearch.push(child);\n }\n }\n node = nodesToSearch.pop();\n }\n\n return false;\n }\n\n load(data) {\n if (!(data && data.length)) return this;\n\n if (data.length < this._minEntries) {\n for (let i = 0; i < data.length; i++) {\n this.insert(data[i]);\n }\n return this;\n }\n\n // recursively build the tree with the given data from scratch using OMT algorithm\n let node = this._build(data.slice(), 0, data.length - 1, 0);\n\n if (!this.data.children.length) {\n // save as is if tree is empty\n this.data = node;\n\n } else if (this.data.height === node.height) {\n // split root if trees have the same height\n this._splitRoot(this.data, node);\n\n } else {\n if (this.data.height < node.height) {\n // swap trees if inserted one is bigger\n const tmpNode = this.data;\n this.data = node;\n node = tmpNode;\n }\n\n // insert the small tree into the large tree at appropriate level\n this._insert(node, this.data.height - node.height - 1, true);\n }\n\n return this;\n }\n\n insert(item) {\n if (item) this._insert(item, this.data.height - 1);\n return this;\n }\n\n clear() {\n this.data = createNode([]);\n return this;\n }\n\n remove(item, equalsFn) {\n if (!item) return this;\n\n let node = this.data;\n const bbox = this.toBBox(item);\n const path = [];\n const indexes = [];\n let i, parent, goingUp;\n\n // depth-first iterative tree traversal\n while (node || path.length) {\n\n if (!node) { // go up\n node = path.pop();\n parent = path[path.length - 1];\n i = indexes.pop();\n goingUp = true;\n }\n\n if (node.leaf) { // check current node\n const index = findItem(item, node.children, equalsFn);\n\n if (index !== -1) {\n // item found, remove the item and condense tree upwards\n node.children.splice(index, 1);\n path.push(node);\n this._condense(path);\n return this;\n }\n }\n\n if (!goingUp && !node.leaf && contains(node, bbox)) { // go down\n path.push(node);\n indexes.push(i);\n i = 0;\n parent = node;\n node = node.children[0];\n\n } else if (parent) { // go right\n i++;\n node = parent.children[i];\n goingUp = false;\n\n } else node = null; // nothing found\n }\n\n return this;\n }\n\n toBBox(item) { return item; }\n\n compareMinX(a, b) { return a.minX - b.minX; }\n compareMinY(a, b) { return a.minY - b.minY; }\n\n toJSON() { return this.data; }\n\n fromJSON(data) {\n this.data = data;\n return this;\n }\n\n _all(node, result) {\n const nodesToSearch = [];\n while (node) {\n if (node.leaf) result.push(...node.children);\n else nodesToSearch.push(...node.children);\n\n node = nodesToSearch.pop();\n }\n return result;\n }\n\n _build(items, left, right, height) {\n\n const N = right - left + 1;\n let M = this._maxEntries;\n let node;\n\n if (N <= M) {\n // reached leaf level; return leaf\n node = createNode(items.slice(left, right + 1));\n calcBBox(node, this.toBBox);\n return node;\n }\n\n if (!height) {\n // target height of the bulk-loaded tree\n height = Math.ceil(Math.log(N) / Math.log(M));\n\n // target number of root entries to maximize storage utilization\n M = Math.ceil(N / Math.pow(M, height - 1));\n }\n\n node = createNode([]);\n node.leaf = false;\n node.height = height;\n\n // split the items into M mostly square tiles\n\n const N2 = Math.ceil(N / M);\n const N1 = N2 * Math.ceil(Math.sqrt(M));\n\n multiSelect(items, left, right, N1, this.compareMinX);\n\n for (let i = left; i <= right; i += N1) {\n\n const right2 = Math.min(i + N1 - 1, right);\n\n multiSelect(items, i, right2, N2, this.compareMinY);\n\n for (let j = i; j <= right2; j += N2) {\n\n const right3 = Math.min(j + N2 - 1, right2);\n\n // pack each entry recursively\n node.children.push(this._build(items, j, right3, height - 1));\n }\n }\n\n calcBBox(node, this.toBBox);\n\n return node;\n }\n\n _chooseSubtree(bbox, node, level, path) {\n while (true) {\n path.push(node);\n\n if (node.leaf || path.length - 1 === level) break;\n\n let minArea = Infinity;\n let minEnlargement = Infinity;\n let targetNode;\n\n for (let i = 0; i < node.children.length; i++) {\n const child = node.children[i];\n const area = bboxArea(child);\n const enlargement = enlargedArea(bbox, child) - area;\n\n // choose entry with the least area enlargement\n if (enlargement < minEnlargement) {\n minEnlargement = enlargement;\n minArea = area < minArea ? area : minArea;\n targetNode = child;\n\n } else if (enlargement === minEnlargement) {\n // otherwise choose one with the smallest area\n if (area < minArea) {\n minArea = area;\n targetNode = child;\n }\n }\n }\n\n node = targetNode || node.children[0];\n }\n\n return node;\n }\n\n _insert(item, level, isNode) {\n const bbox = isNode ? item : this.toBBox(item);\n const insertPath = [];\n\n // find the best node for accommodating the item, saving all nodes along the path too\n const node = this._chooseSubtree(bbox, this.data, level, insertPath);\n\n // put the item into the node\n node.children.push(item);\n extend(node, bbox);\n\n // split on node overflow; propagate upwards if necessary\n while (level >= 0) {\n if (insertPath[level].children.length > this._maxEntries) {\n this._split(insertPath, level);\n level--;\n } else break;\n }\n\n // adjust bboxes along the insertion path\n this._adjustParentBBoxes(bbox, insertPath, level);\n }\n\n // split overflowed node into two\n _split(insertPath, level) {\n const node = insertPath[level];\n const M = node.children.length;\n const m = this._minEntries;\n\n this._chooseSplitAxis(node, m, M);\n\n const splitIndex = this._chooseSplitIndex(node, m, M);\n\n const newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));\n newNode.height = node.height;\n newNode.leaf = node.leaf;\n\n calcBBox(node, this.toBBox);\n calcBBox(newNode, this.toBBox);\n\n if (level) insertPath[level - 1].children.push(newNode);\n else this._splitRoot(node, newNode);\n }\n\n _splitRoot(node, newNode) {\n // split root node\n this.data = createNode([node, newNode]);\n this.data.height = node.height + 1;\n this.data.leaf = false;\n calcBBox(this.data, this.toBBox);\n }\n\n _chooseSplitIndex(node, m, M) {\n let index;\n let minOverlap = Infinity;\n let minArea = Infinity;\n\n for (let i = m; i <= M - m; i++) {\n const bbox1 = distBBox(node, 0, i, this.toBBox);\n const bbox2 = distBBox(node, i, M, this.toBBox);\n\n const overlap = intersectionArea(bbox1, bbox2);\n const area = bboxArea(bbox1) + bboxArea(bbox2);\n\n // choose distribution with minimum overlap\n if (overlap < minOverlap) {\n minOverlap = overlap;\n index = i;\n\n minArea = area < minArea ? area : minArea;\n\n } else if (overlap === minOverlap) {\n // otherwise choose distribution with minimum area\n if (area < minArea) {\n minArea = area;\n index = i;\n }\n }\n }\n\n return index || M - m;\n }\n\n // sorts node children by the best axis for split\n _chooseSplitAxis(node, m, M) {\n const compareMinX = node.leaf ? this.compareMinX : compareNodeMinX;\n const compareMinY = node.leaf ? this.compareMinY : compareNodeMinY;\n const xMargin = this._allDistMargin(node, m, M, compareMinX);\n const yMargin = this._allDistMargin(node, m, M, compareMinY);\n\n // if total distributions margin value is minimal for x, sort by minX,\n // otherwise it's already sorted by minY\n if (xMargin < yMargin) node.children.sort(compareMinX);\n }\n\n // total margin of all possible split distributions where each node is at least m full\n _allDistMargin(node, m, M, compare) {\n node.children.sort(compare);\n\n const toBBox = this.toBBox;\n const leftBBox = distBBox(node, 0, m, toBBox);\n const rightBBox = distBBox(node, M - m, M, toBBox);\n let margin = bboxMargin(leftBBox) + bboxMargin(rightBBox);\n\n for (let i = m; i < M - m; i++) {\n const child = node.children[i];\n extend(leftBBox, node.leaf ? toBBox(child) : child);\n margin += bboxMargin(leftBBox);\n }\n\n for (let i = M - m - 1; i >= m; i--) {\n const child = node.children[i];\n extend(rightBBox, node.leaf ? toBBox(child) : child);\n margin += bboxMargin(rightBBox);\n }\n\n return margin;\n }\n\n _adjustParentBBoxes(bbox, path, level) {\n // adjust bboxes along the given tree path\n for (let i = level; i >= 0; i--) {\n extend(path[i], bbox);\n }\n }\n\n _condense(path) {\n // go through the path, removing empty nodes and updating bboxes\n for (let i = path.length - 1, siblings; i >= 0; i--) {\n if (path[i].children.length === 0) {\n if (i > 0) {\n siblings = path[i - 1].children;\n siblings.splice(siblings.indexOf(path[i]), 1);\n\n } else this.clear();\n\n } else calcBBox(path[i], this.toBBox);\n }\n }\n}\n\nfunction findItem(item, items, equalsFn) {\n if (!equalsFn) return items.indexOf(item);\n\n for (let i = 0; i < items.length; i++) {\n if (equalsFn(item, items[i])) return i;\n }\n return -1;\n}\n\n// calculate node's bbox from bboxes of its children\nfunction calcBBox(node, toBBox) {\n distBBox(node, 0, node.children.length, toBBox, node);\n}\n\n// min bounding rectangle of node children from k to p-1\nfunction distBBox(node, k, p, toBBox, destNode) {\n if (!destNode) destNode = createNode(null);\n destNode.minX = Infinity;\n destNode.minY = Infinity;\n destNode.maxX = -Infinity;\n destNode.maxY = -Infinity;\n\n for (let i = k; i < p; i++) {\n const child = node.children[i];\n extend(destNode, node.leaf ? toBBox(child) : child);\n }\n\n return destNode;\n}\n\nfunction extend(a, b) {\n a.minX = Math.min(a.minX, b.minX);\n a.minY = Math.min(a.minY, b.minY);\n a.maxX = Math.max(a.maxX, b.maxX);\n a.maxY = Math.max(a.maxY, b.maxY);\n return a;\n}\n\nfunction compareNodeMinX(a, b) { return a.minX - b.minX; }\nfunction compareNodeMinY(a, b) { return a.minY - b.minY; }\n\nfunction bboxArea(a) { return (a.maxX - a.minX) * (a.maxY - a.minY); }\nfunction bboxMargin(a) { return (a.maxX - a.minX) + (a.maxY - a.minY); }\n\nfunction enlargedArea(a, b) {\n return (Math.max(b.maxX, a.maxX) - Math.min(b.minX, a.minX)) *\n (Math.max(b.maxY, a.maxY) - Math.min(b.minY, a.minY));\n}\n\nfunction intersectionArea(a, b) {\n const minX = Math.max(a.minX, b.minX);\n const minY = Math.max(a.minY, b.minY);\n const maxX = Math.min(a.maxX, b.maxX);\n const maxY = Math.min(a.maxY, b.maxY);\n\n return Math.max(0, maxX - minX) *\n Math.max(0, maxY - minY);\n}\n\nfunction contains(a, b) {\n return a.minX <= b.minX &&\n a.minY <= b.minY &&\n b.maxX <= a.maxX &&\n b.maxY <= a.maxY;\n}\n\nfunction intersects(a, b) {\n return b.minX <= a.maxX &&\n b.minY <= a.maxY &&\n b.maxX >= a.minX &&\n b.maxY >= a.minY;\n}\n\nfunction createNode(children) {\n return {\n children,\n height: 1,\n leaf: true,\n minX: Infinity,\n minY: Infinity,\n maxX: -Infinity,\n maxY: -Infinity\n };\n}\n\n// sort an array so that items come in groups of n unsorted items, with groups sorted between each other;\n// combines selection algorithm with binary divide & conquer approach\n\nfunction multiSelect(arr, left, right, n, compare) {\n const stack = [left, right];\n\n while (stack.length) {\n right = stack.pop();\n left = stack.pop();\n\n if (right - left <= n) continue;\n\n const mid = left + Math.ceil((right - left) / n / 2) * n;\n quickselect(arr, mid, left, right, compare);\n\n stack.push(left, mid, mid, right);\n }\n}\n","/**\n * @module ol/color\n */\nimport {createCanvasContext2D} from './dom.js';\nimport {clamp, toFixed} from './math.js';\n\n/**\n * A color represented as a short array [red, green, blue, alpha].\n * red, green, and blue should be integers in the range 0..255 inclusive.\n * alpha should be a float in the range 0..1 inclusive. If no alpha value is\n * given then `1` will be used.\n * @typedef {Array} Color\n * @api\n */\n\n/**\n * Color to indicate that no color should be rendered. This is meant to be used for per-reference\n * comparisons only.\n * @type {Color}\n */\nexport const NO_COLOR = [NaN, NaN, NaN, 0];\n\nlet colorParseContext;\n/**\n * @return {CanvasRenderingContext2D} The color parse context\n */\nfunction getColorParseContext() {\n if (!colorParseContext) {\n colorParseContext = createCanvasContext2D(1, 1, undefined, {\n willReadFrequently: true,\n desynchronized: true,\n });\n }\n return colorParseContext;\n}\n\nconst rgbModernRegEx =\n /^rgba?\\(\\s*(\\d+%?)\\s+(\\d+%?)\\s+(\\d+%?)(?:\\s*\\/\\s*(\\d+%|\\d*\\.\\d+|[01]))?\\s*\\)$/i;\nconst rgbLegacyAbsoluteRegEx =\n /^rgba?\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)(?:\\s*,\\s*(\\d+%|\\d*\\.\\d+|[01]))?\\s*\\)$/i;\nconst rgbLegacyPercentageRegEx =\n /^rgba?\\(\\s*(\\d+%)\\s*,\\s*(\\d+%)\\s*,\\s*(\\d+%)(?:\\s*,\\s*(\\d+%|\\d*\\.\\d+|[01]))?\\s*\\)$/i;\nconst hexRegEx = /^#([\\da-f]{3,4}|[\\da-f]{6}|[\\da-f]{8})$/i;\n\n/**\n * @param {string} s Color component as number or percentage.\n * @param {number} divider Divider for percentage.\n * @return {number} Color component.\n */\nfunction toColorComponent(s, divider) {\n return s.endsWith('%')\n ? Number(s.substring(0, s.length - 1)) / divider\n : Number(s);\n}\n\n/**\n * @param {string} color Color string.\n */\nfunction throwInvalidColor(color) {\n throw new Error('failed to parse \"' + color + '\" as color');\n}\n\n/**\n * @param {string} color Color string.\n * @return {Color} RGBa color array.\n */\nfunction parseRgba(color) {\n // Fast lane for rgb(a) colors\n if (color.toLowerCase().startsWith('rgb')) {\n const rgb =\n color.match(rgbLegacyAbsoluteRegEx) ||\n color.match(rgbModernRegEx) ||\n color.match(rgbLegacyPercentageRegEx);\n if (rgb) {\n const alpha = rgb[4];\n const rgbDivider = 100 / 255;\n return [\n clamp((toColorComponent(rgb[1], rgbDivider) + 0.5) | 0, 0, 255),\n clamp((toColorComponent(rgb[2], rgbDivider) + 0.5) | 0, 0, 255),\n clamp((toColorComponent(rgb[3], rgbDivider) + 0.5) | 0, 0, 255),\n alpha !== undefined ? clamp(toColorComponent(alpha, 100), 0, 1) : 1,\n ];\n }\n throwInvalidColor(color);\n }\n // Fast lane for hex colors (also with alpha)\n if (color.startsWith('#')) {\n if (hexRegEx.test(color)) {\n const hex = color.substring(1);\n const step = hex.length <= 4 ? 1 : 2;\n const colorFromHex = [0, 0, 0, 255];\n for (let i = 0, ii = hex.length; i < ii; i += step) {\n let colorComponent = parseInt(hex.substring(i, i + step), 16);\n if (step === 1) {\n colorComponent += colorComponent << 4;\n }\n colorFromHex[i / step] = colorComponent;\n }\n colorFromHex[3] = colorFromHex[3] / 255;\n return colorFromHex;\n }\n throwInvalidColor(color);\n }\n // Use canvas color serialization to parse the color into hex or rgba\n // See https://www.w3.org/TR/2021/SPSD-2dcontext-20210128/#serialization-of-a-color\n const context = getColorParseContext();\n context.fillStyle = '#abcdef';\n let invalidCheckFillStyle = context.fillStyle;\n context.fillStyle = color;\n if (context.fillStyle === invalidCheckFillStyle) {\n context.fillStyle = '#fedcba';\n invalidCheckFillStyle = context.fillStyle;\n context.fillStyle = color;\n if (context.fillStyle === invalidCheckFillStyle) {\n throwInvalidColor(color);\n }\n }\n const colorString = context.fillStyle;\n if (colorString.startsWith('#') || colorString.startsWith('rgba')) {\n return parseRgba(colorString);\n }\n context.clearRect(0, 0, 1, 1);\n context.fillRect(0, 0, 1, 1);\n const colorFromImage = Array.from(context.getImageData(0, 0, 1, 1).data);\n colorFromImage[3] = toFixed(colorFromImage[3] / 255, 3);\n return colorFromImage;\n}\n\n/**\n * Return the color as an rgba string.\n * @param {Color|string} color Color.\n * @return {string} Rgba string.\n * @api\n */\nexport function asString(color) {\n if (typeof color === 'string') {\n return color;\n }\n return toString(color);\n}\n\n/**\n * @type {number}\n */\nconst MAX_CACHE_SIZE = 1024;\n\n/**\n * We maintain a small cache of parsed strings. Whenever the cache grows too large,\n * we delete an arbitrary set of the entries.\n *\n * @type {Object}\n */\nconst cache = {};\n\n/**\n * @type {number}\n */\nlet cacheSize = 0;\n\n/**\n * @param {Color} color A color that may or may not have an alpha channel.\n * @return {Color} The input color with an alpha channel. If the input color has\n * an alpha channel, the input color will be returned unchanged. Otherwise, a new\n * array will be returned with the input color and an alpha channel of 1.\n */\nexport function withAlpha(color) {\n if (color.length === 4) {\n return color;\n }\n const output = color.slice();\n output[3] = 1;\n return output;\n}\n\n// The functions b1, b2, a1, a2, rgbaToLcha and lchaToRgba below are adapted from\n// https://stackoverflow.com/a/67219995/2389327\n\n/**\n * @param {number} v Input value.\n * @return {number} Output value.\n */\nfunction b1(v) {\n return v > 0.0031308 ? Math.pow(v, 1 / 2.4) * 269.025 - 14.025 : v * 3294.6;\n}\n\n/**\n * @param {number} v Input value.\n * @return {number} Output value.\n */\nfunction b2(v) {\n return v > 0.2068965 ? Math.pow(v, 3) : (v - 4 / 29) * (108 / 841);\n}\n\n/**\n * @param {number} v Input value.\n * @return {number} Output value.\n */\nfunction a1(v) {\n return v > 10.314724 ? Math.pow((v + 14.025) / 269.025, 2.4) : v / 3294.6;\n}\n\n/**\n * @param {number} v Input value.\n * @return {number} Output value.\n */\nfunction a2(v) {\n return v > 0.0088564 ? Math.pow(v, 1 / 3) : v / (108 / 841) + 4 / 29;\n}\n\n/**\n * @param {Color} color RGBA color.\n * @return {Color} LCHuv color with alpha.\n */\nexport function rgbaToLcha(color) {\n const r = a1(color[0]);\n const g = a1(color[1]);\n const b = a1(color[2]);\n const y = a2(r * 0.222488403 + g * 0.716873169 + b * 0.06060791);\n const l = 500 * (a2(r * 0.452247074 + g * 0.399439023 + b * 0.148375274) - y);\n const q = 200 * (y - a2(r * 0.016863605 + g * 0.117638439 + b * 0.865350722));\n const h = Math.atan2(q, l) * (180 / Math.PI);\n return [\n 116 * y - 16,\n Math.sqrt(l * l + q * q),\n h < 0 ? h + 360 : h,\n color[3],\n ];\n}\n\n/**\n * @param {Color} color LCHuv color with alpha.\n * @return {Color} RGBA color.\n */\nexport function lchaToRgba(color) {\n const l = (color[0] + 16) / 116;\n const c = color[1];\n const h = (color[2] * Math.PI) / 180;\n const y = b2(l);\n const x = b2(l + (c / 500) * Math.cos(h));\n const z = b2(l - (c / 200) * Math.sin(h));\n const r = b1(x * 3.021973625 - y * 1.617392459 - z * 0.404875592);\n const g = b1(x * -0.943766287 + y * 1.916279586 + z * 0.027607165);\n const b = b1(x * 0.069407491 - y * 0.22898585 + z * 1.159737864);\n return [\n clamp((r + 0.5) | 0, 0, 255),\n clamp((g + 0.5) | 0, 0, 255),\n clamp((b + 0.5) | 0, 0, 255),\n color[3],\n ];\n}\n\n/**\n * @param {string} s String.\n * @return {Color} Color.\n */\nexport function fromString(s) {\n if (s === 'none') {\n return NO_COLOR;\n }\n if (cache.hasOwnProperty(s)) {\n return cache[s];\n }\n if (cacheSize >= MAX_CACHE_SIZE) {\n let i = 0;\n for (const key in cache) {\n if ((i++ & 3) === 0) {\n delete cache[key];\n --cacheSize;\n }\n }\n }\n\n const color = parseRgba(s);\n if (color.length !== 4) {\n throwInvalidColor(s);\n }\n for (const c of color) {\n if (isNaN(c)) {\n throwInvalidColor(s);\n }\n }\n cache[s] = color;\n ++cacheSize;\n return color;\n}\n\n/**\n * Return the color as an array. This function maintains a cache of calculated\n * arrays which means the result should not be modified.\n * @param {Color|string} color Color.\n * @return {Color} Color.\n * @api\n */\nexport function asArray(color) {\n if (Array.isArray(color)) {\n return color;\n }\n return fromString(color);\n}\n\n/**\n * @param {Color} color Color.\n * @return {string} String.\n */\nexport function toString(color) {\n let r = color[0];\n if (r != (r | 0)) {\n r = (r + 0.5) | 0;\n }\n let g = color[1];\n if (g != (g | 0)) {\n g = (g + 0.5) | 0;\n }\n let b = color[2];\n if (b != (b | 0)) {\n b = (b + 0.5) | 0;\n }\n const a = color[3] === undefined ? 1 : Math.round(color[3] * 1000) / 1000;\n return 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')';\n}\n\n/**\n * @param {string} s String.\n * @return {boolean} Whether the string is actually a valid color\n */\nexport function isStringColor(s) {\n try {\n fromString(s);\n return true;\n } catch {\n return false;\n }\n}\n","/**\n * @module ol/size\n */\n\n/**\n * An array of numbers representing a size: `[width, height]`.\n * @typedef {Array} Size\n * @api\n */\n\n/**\n * Returns a buffered size.\n * @param {Size} size Size.\n * @param {number} num The amount by which to buffer.\n * @param {Size} [dest] Optional reusable size array.\n * @return {Size} The buffered size.\n */\nexport function buffer(size, num, dest) {\n if (dest === undefined) {\n dest = [0, 0];\n }\n dest[0] = size[0] + 2 * num;\n dest[1] = size[1] + 2 * num;\n return dest;\n}\n\n/**\n * Determines if a size has a positive area.\n * @param {Size} size The size to test.\n * @return {boolean} The size has a positive area.\n */\nexport function hasArea(size) {\n return size[0] > 0 && size[1] > 0;\n}\n\n/**\n * Returns a size scaled by a ratio. The result will be an array of integers.\n * @param {Size} size Size.\n * @param {number} ratio Ratio.\n * @param {Size} [dest] Optional reusable size array.\n * @return {Size} The scaled size.\n */\nexport function scale(size, ratio, dest) {\n if (dest === undefined) {\n dest = [0, 0];\n }\n dest[0] = (size[0] * ratio + 0.5) | 0;\n dest[1] = (size[1] * ratio + 0.5) | 0;\n return dest;\n}\n\n/**\n * Returns an `Size` array for the passed in number (meaning: square) or\n * `Size` array.\n * (meaning: non-square),\n * @param {number|Size} size Width and height.\n * @param {Size} [dest] Optional reusable size array.\n * @return {Size} Size.\n * @api\n */\nexport function toSize(size, dest) {\n if (Array.isArray(size)) {\n return size;\n }\n if (dest === undefined) {\n dest = [size, size];\n } else {\n dest[0] = size;\n dest[1] = size;\n }\n return dest;\n}\n","/**\n * @module ol/expr/expression\n */\nimport {ascending} from '../array.js';\nimport {fromString as colorFromString} from '../color.js';\nimport {toSize} from '../size.js';\n\n/**\n * @fileoverview This module includes types and functions for parsing array encoded expressions.\n * The result of parsing an encoded expression is one of the specific expression classes.\n * During parsing, information is added to the parsing context about the data accessed by the\n * expression.\n */\n\n/**\n * Base type used for literal style parameters; can be a number literal or the output of an operator,\n * which in turns takes {@link import(\"./expression.js\").ExpressionValue} arguments.\n *\n * See below for details on the available operators (with notes for those that are WebGL or Canvas only).\n *\n * Reading operators:\n * * `['band', bandIndex, xOffset, yOffset]` For tile layers only. Fetches pixel values from band\n * `bandIndex` of the source's data. The first `bandIndex` of the source data is `1`. Fetched values\n * are in the 0..1 range. {@link import(\"../source/TileImage.js\").default} sources have 4 bands: red,\n * green, blue and alpha. {@link import(\"../source/DataTile.js\").default} sources can have any number\n * of bands, depending on the underlying data source and\n * {@link import(\"../source/GeoTIFF.js\").Options configuration}. `xOffset` and `yOffset` are optional\n * and allow specifying pixel offsets for x and y. This is used for sampling data from neighboring pixels (WebGL only).\n * * `['get', attributeName]` fetches a feature property value, similar to `feature.get('attributeName')`.\n * * `['get', attributeName, keyOrArrayIndex, ...]` (Canvas only) Access nested properties and array items of a\n * feature property. The result is `undefined` when there is nothing at the specified key or index.\n * * `['geometry-type']` returns a feature's geometry type as string, either: 'LineString', 'Point' or 'Polygon'\n * `Multi*` values are returned as their singular equivalent\n * `Circle` geometries are returned as 'Polygon'\n * `GeometryCollection` geometries are returned as the type of the first geometry found in the collection (WebGL only).\n * * `['resolution']` returns the current resolution\n * * `['time']` The time in seconds since the creation of the layer (WebGL only).\n * * `['var', 'varName']` fetches a value from the style variables; will throw an error if that variable is undefined\n * * `['zoom']` The current zoom level (WebGL only).\n * * `['line-metric']` returns the M component of the current point on a line (WebGL only); in case where the geometry layout of the line\n * does not contain an M component (e.g. XY or XYZ), 0 is returned; 0 is also returned for geometries other than lines.\n * Please note that the M component will be linearly interpolated between the two points composing a segment.\n *\n * Math operators:\n * * `['*', value1, value2, ...]` multiplies the values (either numbers or colors)\n * * `['/', value1, value2]` divides `value1` by `value2`\n * * `['+', value1, value2, ...]` adds the values\n * * `['-', value1, value2]` subtracts `value2` from `value1`\n * * `['clamp', value, low, high]` clamps `value` between `low` and `high`\n * * `['%', value1, value2]` returns the result of `value1 % value2` (modulo)\n * * `['^', value1, value2]` returns the value of `value1` raised to the `value2` power\n * * `['abs', value1]` returns the absolute value of `value1`\n * * `['floor', value1]` returns the nearest integer less than or equal to `value1`\n * * `['round', value1]` returns the nearest integer to `value1`\n * * `['ceil', value1]` returns the nearest integer greater than or equal to `value1`\n * * `['sin', value1]` returns the sine of `value1`\n * * `['cos', value1]` returns the cosine of `value1`\n * * `['atan', value1, value2]` returns `atan2(value1, value2)`. If `value2` is not provided, returns `atan(value1)`\n * * `['sqrt', value1]` returns the square root of `value1`\n *\n * * Transform operators:\n * * `['case', condition1, output1, ...conditionN, outputN, fallback]` selects the first output whose corresponding\n * condition evaluates to `true`. If no match is found, returns the `fallback` value.\n * All conditions should be `boolean`, output and fallback can be any kind.\n * * `['match', input, match1, output1, ...matchN, outputN, fallback]` compares the `input` value against all\n * provided `matchX` values, returning the output associated with the first valid match. If no match is found,\n * returns the `fallback` value.\n * `input` and `matchX` values must all be of the same type, and can be `number` or `string`. `outputX` and\n * `fallback` values must be of the same type, and can be of any kind.\n * * `['interpolate', interpolation, input, stop1, output1, ...stopN, outputN]` returns a value by interpolating between\n * pairs of inputs and outputs; `interpolation` can either be `['linear']` or `['exponential', base]` where `base` is\n * the rate of increase from stop A to stop B (i.e. power to which the interpolation ratio is raised); a value\n * of 1 is equivalent to `['linear']`.\n * `input` and `stopX` values must all be of type `number`. `outputX` values can be `number` or `color` values.\n * Note: `input` will be clamped between `stop1` and `stopN`, meaning that all output values will be comprised\n * between `output1` and `outputN`.\n * * `['string', value1, value2, ...]` returns the first value in the list that evaluates to a string.\n * An example would be to provide a default value for get: `['string', ['get', 'propertyname'], 'default value']]`\n * (Canvas only).\n * * `['number', value1, value2, ...]` returns the first value in the list that evaluates to a number.\n * An example would be to provide a default value for get: `['string', ['get', 'propertyname'], 42]]`\n * (Canvas only).\n * * `['coalesce', value1, value2, ...]` returns the first value in the list which is not null or undefined.\n * An example would be to provide a default value for get: `['coalesce', ['get','propertyname'], 'default value']]`\n * (Canvas only).\n *\n * * Logical operators:\n * * `['<', value1, value2]` returns `true` if `value1` is strictly lower than `value2`, or `false` otherwise.\n * * `['<=', value1, value2]` returns `true` if `value1` is lower than or equals `value2`, or `false` otherwise.\n * * `['>', value1, value2]` returns `true` if `value1` is strictly greater than `value2`, or `false` otherwise.\n * * `['>=', value1, value2]` returns `true` if `value1` is greater than or equals `value2`, or `false` otherwise.\n * * `['==', value1, value2]` returns `true` if `value1` equals `value2`, or `false` otherwise.\n * * `['!=', value1, value2]` returns `true` if `value1` does not equal `value2`, or `false` otherwise.\n * * `['!', value1]` returns `false` if `value1` is `true` or greater than `0`, or `true` otherwise.\n * * `['all', value1, value2, ...]` returns `true` if all the inputs are `true`, `false` otherwise.\n * * `['any', value1, value2, ...]` returns `true` if any of the inputs are `true`, `false` otherwise.\n * * `['has', attributeName, keyOrArrayIndex, ...]` returns `true` if feature properties include the (nested) key `attributeName`,\n * `false` otherwise.\n * Note that for WebGL layers, the hardcoded value `-9999999` is used to distinguish when a property is not defined.\n * * `['between', value1, value2, value3]` returns `true` if `value1` is contained between `value2` and `value3`\n * (inclusively), or `false` otherwise.\n * * `['in', needle, haystack]` returns `true` if `needle` is found in `haystack`, and\n * `false` otherwise.\n * This operator has the following limitations:\n * * `haystack` has to be an array of numbers or strings (searching for a substring in a string is not supported yet)\n * * Only literal arrays are supported as `haystack` for now; this means that `haystack` cannot be the result of an\n * expression. If `haystack` is an array of strings, use the `literal` operator to disambiguate from an expression:\n * `['literal', ['abc', 'def', 'ghi']]`\n *\n * * Conversion operators:\n * * `['array', value1, ...valueN]` creates a numerical array from `number` values; please note that the amount of\n * values can currently only be 2, 3 or 4 (WebGL only).\n * * `['color', red, green, blue, alpha]` or `['color', shade, alpha]` creates a `color` value from `number` values;\n * the `alpha` parameter is optional; if not specified, it will be set to 1 (WebGL only).\n * Note: `red`, `green` and `blue` or `shade` components must be values between 0 and 255; `alpha` between 0 and 1.\n * * `['palette', index, colors]` picks a `color` value from an array of colors using the given index; the `index`\n * expression must evaluate to a number; the items in the `colors` array must be strings with hex colors\n * (e.g. `'#86A136'`), colors using the rgba[a] functional notation (e.g. `'rgb(134, 161, 54)'` or `'rgba(134, 161, 54, 1)'`),\n * named colors (e.g. `'red'`), or array literals with 3 ([r, g, b]) or 4 ([r, g, b, a]) values (with r, g, and b\n * in the 0-255 range and a in the 0-1 range) (WebGL only).\n * * `['to-string', value]` converts the input value to a string. If the input is a boolean, the result is \"true\" or \"false\".\n * If the input is a number, it is converted to a string as specified by the \"NumberToString\" algorithm of the ECMAScript\n * Language Specification. If the input is a color, it is converted to a string of the form \"rgba(r,g,b,a)\". (Canvas only)\n *\n * Values can either be literals or another operator, as they will be evaluated recursively.\n * Literal values can be of the following types:\n * * `boolean`\n * * `number`\n * * `number[]` (number arrays can only have a length of 2, 3 or 4)\n * * `string`\n * * {@link module:ol/color~Color}\n *\n * @typedef {Array<*>|import(\"../color.js\").Color|string|number|boolean} ExpressionValue\n * @api\n */\n\nlet numTypes = 0;\nexport const NoneType = 0;\nexport const BooleanType = 1 << numTypes++;\nexport const NumberType = 1 << numTypes++;\nexport const StringType = 1 << numTypes++;\nexport const ColorType = 1 << numTypes++;\nexport const NumberArrayType = 1 << numTypes++;\nexport const SizeType = 1 << numTypes++;\nexport const AnyType = Math.pow(2, numTypes) - 1;\n\nconst typeNames = {\n [BooleanType]: 'boolean',\n [NumberType]: 'number',\n [StringType]: 'string',\n [ColorType]: 'color',\n [NumberArrayType]: 'number[]',\n [SizeType]: 'size',\n};\n\nconst namedTypes = Object.keys(typeNames).map(Number).sort(ascending);\n\n/**\n * @param {number} type The type.\n * @return {boolean} The type is one of the specific types (not any or a union type).\n */\nfunction isSpecific(type) {\n return type in typeNames;\n}\n\n/**\n * Get a string representation for a type.\n * @param {number} type The type.\n * @return {string} The type name.\n */\nexport function typeName(type) {\n const names = [];\n for (const namedType of namedTypes) {\n if (includesType(type, namedType)) {\n names.push(typeNames[namedType]);\n }\n }\n if (names.length === 0) {\n return 'untyped';\n }\n if (names.length < 3) {\n return names.join(' or ');\n }\n return names.slice(0, -1).join(', ') + ', or ' + names[names.length - 1];\n}\n\n/**\n * @param {number} broad The broad type.\n * @param {number} specific The specific type.\n * @return {boolean} The broad type includes the specific type.\n */\nexport function includesType(broad, specific) {\n return (broad & specific) === specific;\n}\n\n/**\n * @param {number} oneType One type.\n * @param {number} otherType Another type.\n * @return {boolean} The set of types overlap (share a common specific type)\n */\nexport function overlapsType(oneType, otherType) {\n return !!(oneType & otherType);\n}\n\n/**\n * @param {number} type The type.\n * @param {number} expected The expected type.\n * @return {boolean} The given type is exactly the expected type.\n */\nexport function isType(type, expected) {\n return type === expected;\n}\n\n/**\n * @typedef {boolean|number|string|Array} LiteralValue\n */\n\nexport class LiteralExpression {\n /**\n * @param {number} type The value type.\n * @param {LiteralValue} value The literal value.\n */\n constructor(type, value) {\n if (!isSpecific(type)) {\n throw new Error(\n `literal expressions must have a specific type, got ${typeName(type)}`,\n );\n }\n this.type = type;\n this.value = value;\n }\n}\n\nexport class CallExpression {\n /**\n * @param {number} type The return type.\n * @param {string} operator The operator.\n * @param {...Expression} args The arguments.\n */\n constructor(type, operator, ...args) {\n this.type = type;\n this.operator = operator;\n this.args = args;\n }\n}\n\n/**\n * @typedef {LiteralExpression|CallExpression} Expression\n */\n\n/**\n * @typedef {Object} ParsingContext\n * @property {Set} variables Variables referenced with the 'var' operator.\n * @property {Set} properties Properties referenced with the 'get' operator.\n * @property {boolean} featureId The style uses the feature id.\n * @property {boolean} geometryType The style uses the feature geometry type.\n * @property {boolean} mapState The style uses the map state (view state or time elapsed).\n */\n\n/**\n * @return {ParsingContext} A new parsing context.\n */\nexport function newParsingContext() {\n return {\n variables: new Set(),\n properties: new Set(),\n featureId: false,\n geometryType: false,\n mapState: false,\n };\n}\n\n/**\n * @typedef {LiteralValue|Array} EncodedExpression\n */\n\n/**\n * @param {EncodedExpression} encoded The encoded expression.\n * @param {number} expectedType The expected type.\n * @param {ParsingContext} context The parsing context.\n * @return {Expression} The parsed expression result.\n */\nexport function parse(encoded, expectedType, context) {\n switch (typeof encoded) {\n case 'boolean': {\n if (isType(expectedType, StringType)) {\n return new LiteralExpression(StringType, encoded ? 'true' : 'false');\n }\n if (!includesType(expectedType, BooleanType)) {\n throw new Error(\n `got a boolean, but expected ${typeName(expectedType)}`,\n );\n }\n return new LiteralExpression(BooleanType, encoded);\n }\n case 'number': {\n if (isType(expectedType, SizeType)) {\n return new LiteralExpression(SizeType, toSize(encoded));\n }\n if (isType(expectedType, BooleanType)) {\n return new LiteralExpression(BooleanType, !!encoded);\n }\n if (isType(expectedType, StringType)) {\n return new LiteralExpression(StringType, encoded.toString());\n }\n if (!includesType(expectedType, NumberType)) {\n throw new Error(`got a number, but expected ${typeName(expectedType)}`);\n }\n return new LiteralExpression(NumberType, encoded);\n }\n case 'string': {\n if (isType(expectedType, ColorType)) {\n return new LiteralExpression(ColorType, colorFromString(encoded));\n }\n if (isType(expectedType, BooleanType)) {\n return new LiteralExpression(BooleanType, !!encoded);\n }\n if (!includesType(expectedType, StringType)) {\n throw new Error(`got a string, but expected ${typeName(expectedType)}`);\n }\n return new LiteralExpression(StringType, encoded);\n }\n default: {\n // pass\n }\n }\n\n if (!Array.isArray(encoded)) {\n throw new Error('expression must be an array or a primitive value');\n }\n\n if (encoded.length === 0) {\n throw new Error('empty expression');\n }\n\n if (typeof encoded[0] === 'string') {\n return parseCallExpression(encoded, expectedType, context);\n }\n\n for (const item of encoded) {\n if (typeof item !== 'number') {\n throw new Error('expected an array of numbers');\n }\n }\n\n if (isType(expectedType, SizeType)) {\n if (encoded.length !== 2) {\n throw new Error(\n `expected an array of two values for a size, got ${encoded.length}`,\n );\n }\n return new LiteralExpression(SizeType, encoded);\n }\n\n if (isType(expectedType, ColorType)) {\n if (encoded.length === 3) {\n return new LiteralExpression(ColorType, [...encoded, 1]);\n }\n if (encoded.length === 4) {\n return new LiteralExpression(ColorType, encoded);\n }\n throw new Error(\n `expected an array of 3 or 4 values for a color, got ${encoded.length}`,\n );\n }\n\n if (!includesType(expectedType, NumberArrayType)) {\n throw new Error(\n `got an array of numbers, but expected ${typeName(expectedType)}`,\n );\n }\n\n return new LiteralExpression(NumberArrayType, encoded);\n}\n\n/**\n * @type {Object}\n */\nexport const Ops = {\n Get: 'get',\n Var: 'var',\n Concat: 'concat',\n GeometryType: 'geometry-type',\n LineMetric: 'line-metric',\n Any: 'any',\n All: 'all',\n Not: '!',\n Resolution: 'resolution',\n Zoom: 'zoom',\n Time: 'time',\n Equal: '==',\n NotEqual: '!=',\n GreaterThan: '>',\n GreaterThanOrEqualTo: '>=',\n LessThan: '<',\n LessThanOrEqualTo: '<=',\n Multiply: '*',\n Divide: '/',\n Add: '+',\n Subtract: '-',\n Clamp: 'clamp',\n Mod: '%',\n Pow: '^',\n Abs: 'abs',\n Floor: 'floor',\n Ceil: 'ceil',\n Round: 'round',\n Sin: 'sin',\n Cos: 'cos',\n Atan: 'atan',\n Sqrt: 'sqrt',\n Match: 'match',\n Between: 'between',\n Interpolate: 'interpolate',\n Coalesce: 'coalesce',\n Case: 'case',\n In: 'in',\n Number: 'number',\n String: 'string',\n Array: 'array',\n Color: 'color',\n Id: 'id',\n Band: 'band',\n Palette: 'palette',\n ToString: 'to-string',\n Has: 'has',\n};\n\n/**\n * @typedef {function(Array, number, ParsingContext):Expression} Parser\n *\n * Second argument is the expected type.\n */\n\n/**\n * @type {Object}\n */\nconst parsers = {\n [Ops.Get]: createCallExpressionParser(hasArgsCount(1, Infinity), withGetArgs),\n [Ops.Var]: createCallExpressionParser(hasArgsCount(1, 1), withVarArgs),\n [Ops.Has]: createCallExpressionParser(hasArgsCount(1, Infinity), withGetArgs),\n [Ops.Id]: createCallExpressionParser(usesFeatureId, withNoArgs),\n [Ops.Concat]: createCallExpressionParser(\n hasArgsCount(2, Infinity),\n withArgsOfType(StringType),\n ),\n [Ops.GeometryType]: createCallExpressionParser(usesGeometryType, withNoArgs),\n [Ops.LineMetric]: createCallExpressionParser(withNoArgs),\n [Ops.Resolution]: createCallExpressionParser(usesMapState, withNoArgs),\n [Ops.Zoom]: createCallExpressionParser(usesMapState, withNoArgs),\n [Ops.Time]: createCallExpressionParser(usesMapState, withNoArgs),\n [Ops.Any]: createCallExpressionParser(\n hasArgsCount(2, Infinity),\n withArgsOfType(BooleanType),\n ),\n [Ops.All]: createCallExpressionParser(\n hasArgsCount(2, Infinity),\n withArgsOfType(BooleanType),\n ),\n [Ops.Not]: createCallExpressionParser(\n hasArgsCount(1, 1),\n withArgsOfType(BooleanType),\n ),\n [Ops.Equal]: createCallExpressionParser(\n hasArgsCount(2, 2),\n withArgsOfType(AnyType),\n ),\n [Ops.NotEqual]: createCallExpressionParser(\n hasArgsCount(2, 2),\n withArgsOfType(AnyType),\n ),\n [Ops.GreaterThan]: createCallExpressionParser(\n hasArgsCount(2, 2),\n withArgsOfType(NumberType),\n ),\n [Ops.GreaterThanOrEqualTo]: createCallExpressionParser(\n hasArgsCount(2, 2),\n withArgsOfType(NumberType),\n ),\n [Ops.LessThan]: createCallExpressionParser(\n hasArgsCount(2, 2),\n withArgsOfType(NumberType),\n ),\n [Ops.LessThanOrEqualTo]: createCallExpressionParser(\n hasArgsCount(2, 2),\n withArgsOfType(NumberType),\n ),\n [Ops.Multiply]: createCallExpressionParser(\n hasArgsCount(2, Infinity),\n withArgsOfReturnType,\n ),\n [Ops.Coalesce]: createCallExpressionParser(\n hasArgsCount(2, Infinity),\n withArgsOfReturnType,\n ),\n [Ops.Divide]: createCallExpressionParser(\n hasArgsCount(2, 2),\n withArgsOfType(NumberType),\n ),\n [Ops.Add]: createCallExpressionParser(\n hasArgsCount(2, Infinity),\n withArgsOfType(NumberType),\n ),\n [Ops.Subtract]: createCallExpressionParser(\n hasArgsCount(2, 2),\n withArgsOfType(NumberType),\n ),\n [Ops.Clamp]: createCallExpressionParser(\n hasArgsCount(3, 3),\n withArgsOfType(NumberType),\n ),\n [Ops.Mod]: createCallExpressionParser(\n hasArgsCount(2, 2),\n withArgsOfType(NumberType),\n ),\n [Ops.Pow]: createCallExpressionParser(\n hasArgsCount(2, 2),\n withArgsOfType(NumberType),\n ),\n [Ops.Abs]: createCallExpressionParser(\n hasArgsCount(1, 1),\n withArgsOfType(NumberType),\n ),\n [Ops.Floor]: createCallExpressionParser(\n hasArgsCount(1, 1),\n withArgsOfType(NumberType),\n ),\n [Ops.Ceil]: createCallExpressionParser(\n hasArgsCount(1, 1),\n withArgsOfType(NumberType),\n ),\n [Ops.Round]: createCallExpressionParser(\n hasArgsCount(1, 1),\n withArgsOfType(NumberType),\n ),\n [Ops.Sin]: createCallExpressionParser(\n hasArgsCount(1, 1),\n withArgsOfType(NumberType),\n ),\n [Ops.Cos]: createCallExpressionParser(\n hasArgsCount(1, 1),\n withArgsOfType(NumberType),\n ),\n [Ops.Atan]: createCallExpressionParser(\n hasArgsCount(1, 2),\n withArgsOfType(NumberType),\n ),\n [Ops.Sqrt]: createCallExpressionParser(\n hasArgsCount(1, 1),\n withArgsOfType(NumberType),\n ),\n [Ops.Match]: createCallExpressionParser(\n hasArgsCount(4, Infinity),\n hasEvenArgs,\n withMatchArgs,\n ),\n [Ops.Between]: createCallExpressionParser(\n hasArgsCount(3, 3),\n withArgsOfType(NumberType),\n ),\n [Ops.Interpolate]: createCallExpressionParser(\n hasArgsCount(6, Infinity),\n hasEvenArgs,\n withInterpolateArgs,\n ),\n [Ops.Case]: createCallExpressionParser(\n hasArgsCount(3, Infinity),\n hasOddArgs,\n withCaseArgs,\n ),\n [Ops.In]: createCallExpressionParser(hasArgsCount(2, 2), withInArgs),\n [Ops.Number]: createCallExpressionParser(\n hasArgsCount(1, Infinity),\n withArgsOfType(AnyType),\n ),\n [Ops.String]: createCallExpressionParser(\n hasArgsCount(1, Infinity),\n withArgsOfType(AnyType),\n ),\n [Ops.Array]: createCallExpressionParser(\n hasArgsCount(1, Infinity),\n withArgsOfType(NumberType),\n ),\n [Ops.Color]: createCallExpressionParser(\n hasArgsCount(1, 4),\n withArgsOfType(NumberType),\n ),\n [Ops.Band]: createCallExpressionParser(\n hasArgsCount(1, 3),\n withArgsOfType(NumberType),\n ),\n [Ops.Palette]: createCallExpressionParser(\n hasArgsCount(2, 2),\n withPaletteArgs,\n ),\n [Ops.ToString]: createCallExpressionParser(\n hasArgsCount(1, 1),\n withArgsOfType(BooleanType | NumberType | StringType | ColorType),\n ),\n};\n\n/**\n * @typedef {function(Array, number, ParsingContext):Array|void} ArgValidator\n *\n * An argument validator applies various checks to an encoded expression arguments and\n * returns the parsed arguments if any. The second argument is the return type of the call expression.\n */\n\n/**\n * @type {ArgValidator}\n */\nfunction withGetArgs(encoded, returnType, context) {\n const argsCount = encoded.length - 1;\n const args = new Array(argsCount);\n for (let i = 0; i < argsCount; ++i) {\n const key = encoded[i + 1];\n switch (typeof key) {\n case 'number': {\n args[i] = new LiteralExpression(NumberType, key);\n break;\n }\n case 'string': {\n args[i] = new LiteralExpression(StringType, key);\n break;\n }\n default: {\n throw new Error(\n `expected a string key or numeric array index for a get operation, got ${key}`,\n );\n }\n }\n if (i === 0) {\n context.properties.add(String(key));\n }\n }\n return args;\n}\n\n/**\n * @type {ArgValidator}\n */\nfunction withVarArgs(encoded, returnType, context) {\n const name = encoded[1];\n if (typeof name !== 'string') {\n throw new Error('expected a string argument for var operation');\n }\n context.variables.add(name);\n\n return [new LiteralExpression(StringType, name)];\n}\n\n/**\n * @type {ArgValidator}\n */\nfunction usesFeatureId(encoded, returnType, context) {\n context.featureId = true;\n}\n\n/**\n * @type {ArgValidator}\n */\nfunction usesGeometryType(encoded, returnType, context) {\n context.geometryType = true;\n}\n\n/**\n * @type {ArgValidator}\n */\nfunction usesMapState(encoded, returnType, context) {\n context.mapState = true;\n}\n\n/**\n * @type {ArgValidator}\n */\nfunction withNoArgs(encoded, returnType, context) {\n const operation = encoded[0];\n if (encoded.length !== 1) {\n throw new Error(`expected no arguments for ${operation} operation`);\n }\n return [];\n}\n\n/**\n * @param {number} minArgs The minimum number of arguments.\n * @param {number} maxArgs The maximum number of arguments.\n * @return {ArgValidator} The argument validator\n */\nfunction hasArgsCount(minArgs, maxArgs) {\n return function (encoded, returnType, context) {\n const operation = encoded[0];\n const argCount = encoded.length - 1;\n if (minArgs === maxArgs) {\n if (argCount !== minArgs) {\n const plural = minArgs === 1 ? '' : 's';\n throw new Error(\n `expected ${minArgs} argument${plural} for ${operation}, got ${argCount}`,\n );\n }\n } else if (argCount < minArgs || argCount > maxArgs) {\n const range =\n maxArgs === Infinity\n ? `${minArgs} or more`\n : `${minArgs} to ${maxArgs}`;\n throw new Error(\n `expected ${range} arguments for ${operation}, got ${argCount}`,\n );\n }\n };\n}\n\n/**\n * @type {ArgValidator}\n */\nfunction withArgsOfReturnType(encoded, returnType, context) {\n const argCount = encoded.length - 1;\n /**\n * @type {Array}\n */\n const args = new Array(argCount);\n for (let i = 0; i < argCount; ++i) {\n const expression = parse(encoded[i + 1], returnType, context);\n args[i] = expression;\n }\n return args;\n}\n\n/**\n * @param {number} argType The argument type.\n * @return {ArgValidator} The argument validator\n */\nfunction withArgsOfType(argType) {\n return function (encoded, returnType, context) {\n const argCount = encoded.length - 1;\n /**\n * @type {Array}\n */\n const args = new Array(argCount);\n for (let i = 0; i < argCount; ++i) {\n const expression = parse(encoded[i + 1], argType, context);\n args[i] = expression;\n }\n return args;\n };\n}\n\n/**\n * @type {ArgValidator}\n */\nfunction hasOddArgs(encoded, returnType, context) {\n const operation = encoded[0];\n const argCount = encoded.length - 1;\n if (argCount % 2 === 0) {\n throw new Error(\n `expected an odd number of arguments for ${operation}, got ${argCount} instead`,\n );\n }\n}\n\n/**\n * @type {ArgValidator}\n */\nfunction hasEvenArgs(encoded, returnType, context) {\n const operation = encoded[0];\n const argCount = encoded.length - 1;\n if (argCount % 2 === 1) {\n throw new Error(\n `expected an even number of arguments for operation ${operation}, got ${argCount} instead`,\n );\n }\n}\n\n/**\n * @type {ArgValidator}\n */\nfunction withMatchArgs(encoded, returnType, context) {\n const argsCount = encoded.length - 1;\n\n const inputType = StringType | NumberType | BooleanType;\n\n const input = parse(encoded[1], inputType, context);\n\n const fallback = parse(encoded[encoded.length - 1], returnType, context);\n\n const args = new Array(argsCount - 2);\n for (let i = 0; i < argsCount - 2; i += 2) {\n try {\n const match = parse(encoded[i + 2], input.type, context);\n args[i] = match;\n } catch (err) {\n throw new Error(\n `failed to parse argument ${i + 1} of match expression: ${err.message}`,\n );\n }\n try {\n const output = parse(encoded[i + 3], fallback.type, context);\n args[i + 1] = output;\n } catch (err) {\n throw new Error(\n `failed to parse argument ${i + 2} of match expression: ${err.message}`,\n );\n }\n }\n\n return [input, ...args, fallback];\n}\n\n/**\n * @type {ArgValidator}\n */\nfunction withInterpolateArgs(encoded, returnType, context) {\n const interpolationType = encoded[1];\n /**\n * @type {number}\n */\n let base;\n switch (interpolationType[0]) {\n case 'linear':\n base = 1;\n break;\n case 'exponential':\n const b = interpolationType[1];\n if (typeof b !== 'number' || b <= 0) {\n throw new Error(\n `expected a number base for exponential interpolation` +\n `, got ${JSON.stringify(b)} instead`,\n );\n }\n base = b;\n break;\n default:\n throw new Error(\n `invalid interpolation type: ${JSON.stringify(interpolationType)}`,\n );\n }\n\n const interpolation = new LiteralExpression(NumberType, base);\n\n let input;\n try {\n input = parse(encoded[2], NumberType, context);\n } catch (err) {\n throw new Error(\n `failed to parse argument 1 in interpolate expression: ${err.message}`,\n );\n }\n\n const args = new Array(encoded.length - 3);\n for (let i = 0; i < args.length; i += 2) {\n try {\n const stop = parse(encoded[i + 3], NumberType, context);\n args[i] = stop;\n } catch (err) {\n throw new Error(\n `failed to parse argument ${i + 2} for interpolate expression: ${err.message}`,\n );\n }\n try {\n const output = parse(encoded[i + 4], returnType, context);\n args[i + 1] = output;\n } catch (err) {\n throw new Error(\n `failed to parse argument ${i + 3} for interpolate expression: ${err.message}`,\n );\n }\n }\n\n return [interpolation, input, ...args];\n}\n\n/**\n * @type {ArgValidator}\n */\nfunction withCaseArgs(encoded, returnType, context) {\n const fallback = parse(encoded[encoded.length - 1], returnType, context);\n\n const args = new Array(encoded.length - 1);\n for (let i = 0; i < args.length - 1; i += 2) {\n try {\n const condition = parse(encoded[i + 1], BooleanType, context);\n args[i] = condition;\n } catch (err) {\n throw new Error(\n `failed to parse argument ${i} of case expression: ${err.message}`,\n );\n }\n try {\n const output = parse(encoded[i + 2], fallback.type, context);\n args[i + 1] = output;\n } catch (err) {\n throw new Error(\n `failed to parse argument ${i + 1} of case expression: ${err.message}`,\n );\n }\n }\n\n args[args.length - 1] = fallback;\n return args;\n}\n\n/**\n * @type {ArgValidator}\n */\nfunction withInArgs(encoded, returnType, context) {\n let haystack = encoded[2];\n if (!Array.isArray(haystack)) {\n throw new Error(\n `the second argument for the \"in\" operator must be an array`,\n );\n }\n /**\n * @type {number}\n */\n let needleType;\n if (typeof haystack[0] === 'string') {\n if (haystack[0] !== 'literal') {\n throw new Error(\n `for the \"in\" operator, a string array should be wrapped in a \"literal\" operator to disambiguate from expressions`,\n );\n }\n if (!Array.isArray(haystack[1])) {\n throw new Error(\n `failed to parse \"in\" expression: the literal operator must be followed by an array`,\n );\n }\n haystack = haystack[1];\n needleType = StringType;\n } else {\n needleType = NumberType;\n }\n\n const args = new Array(haystack.length);\n for (let i = 0; i < args.length; i++) {\n try {\n const arg = parse(haystack[i], needleType, context);\n args[i] = arg;\n } catch (err) {\n throw new Error(\n `failed to parse haystack item ${i} for \"in\" expression: ${err.message}`,\n );\n }\n }\n\n const needle = parse(encoded[1], needleType, context);\n return [needle, ...args];\n}\n\n/**\n * @type {ArgValidator}\n */\nfunction withPaletteArgs(encoded, returnType, context) {\n let index;\n try {\n index = parse(encoded[1], NumberType, context);\n } catch (err) {\n throw new Error(\n `failed to parse first argument in palette expression: ${err.message}`,\n );\n }\n const colors = encoded[2];\n if (!Array.isArray(colors)) {\n throw new Error('the second argument of palette must be an array');\n }\n const parsedColors = new Array(colors.length);\n for (let i = 0; i < parsedColors.length; i++) {\n let color;\n try {\n color = parse(colors[i], ColorType, context);\n } catch (err) {\n throw new Error(\n `failed to parse color at index ${i} in palette expression: ${err.message}`,\n );\n }\n if (!(color instanceof LiteralExpression)) {\n throw new Error(\n `the palette color at index ${i} must be a literal value`,\n );\n }\n parsedColors[i] = color;\n }\n return [index, ...parsedColors];\n}\n\n/**\n * @param {Array} validators A chain of argument validators. The last validator is expected\n * to return the parsed arguments.\n * @return {Parser} The parser.\n */\nfunction createCallExpressionParser(...validators) {\n return function (encoded, returnType, context) {\n const operator = encoded[0];\n\n /**\n * @type {Array}\n */\n let args;\n for (let i = 0; i < validators.length; i++) {\n const parsed = validators[i](encoded, returnType, context);\n if (i == validators.length - 1) {\n if (!parsed) {\n throw new Error(\n 'expected last argument validator to return the parsed args',\n );\n }\n args = parsed;\n }\n }\n return new CallExpression(returnType, operator, ...args);\n };\n}\n\n/**\n * @param {Array} encoded The encoded expression.\n * @param {number} returnType The expected return type of the call expression.\n * @param {ParsingContext} context The parsing context.\n * @return {Expression} The parsed expression.\n */\nfunction parseCallExpression(encoded, returnType, context) {\n const operator = encoded[0];\n\n const parser = parsers[operator];\n if (!parser) {\n throw new Error(`unknown operator: ${operator}`);\n }\n return parser(encoded, returnType, context);\n}\n\n/**\n * Returns a simplified geometry type suited for the `geometry-type` operator\n * @param {import('../geom/Geometry.js').default|import('../render/Feature.js').default} geometry Geometry object\n * @return {'Point'|'LineString'|'Polygon'|''} Simplified geometry type; empty string of no geometry found\n */\nexport function computeGeometryType(geometry) {\n if (!geometry) {\n return '';\n }\n const type = geometry.getType();\n switch (type) {\n case 'Point':\n case 'LineString':\n case 'Polygon':\n return type;\n case 'MultiPoint':\n case 'MultiLineString':\n case 'MultiPolygon':\n return /** @type {'Point'|'LineString'|'Polygon'} */ (type.substring(5));\n case 'Circle':\n return 'Polygon';\n case 'GeometryCollection':\n return computeGeometryType(\n /** @type {import(\"../geom/GeometryCollection.js\").default} */ (\n geometry\n ).getGeometries()[0],\n );\n default:\n return '';\n }\n}\n","/**\n * @module ol/expr/cpu\n */\n\nimport {\n fromString,\n lchaToRgba,\n rgbaToLcha,\n toString,\n withAlpha,\n} from '../color.js';\nimport {ColorType, LiteralExpression, Ops, parse} from './expression.js';\n\n/**\n * @fileoverview This module includes functions to build expressions for evaluation on the CPU.\n * Building is composed of two steps: parsing and compiling. The parsing step takes an encoded\n * expression and returns an instance of one of the expression classes. The compiling step takes\n * the expression instance and returns a function that can be evaluated in to return a literal\n * value. The evaluator function should do as little allocation and work as possible.\n */\n\n/**\n * @typedef {Object} EvaluationContext\n * @property {Object} properties The values for properties used in 'get' expressions.\n * @property {Object} variables The values for variables used in 'var' expressions.\n * @property {number} resolution The map resolution.\n * @property {string|number|null} featureId The feature id.\n * @property {string} geometryType Geometry type of the current object.\n */\n\n/**\n * @return {EvaluationContext} A new evaluation context.\n */\nexport function newEvaluationContext() {\n return {\n variables: {},\n properties: {},\n resolution: NaN,\n featureId: null,\n geometryType: '',\n };\n}\n\n/**\n * @typedef {function(EvaluationContext):import(\"./expression.js\").LiteralValue} ExpressionEvaluator\n */\n\n/**\n * @typedef {function(EvaluationContext):boolean} BooleanEvaluator\n */\n\n/**\n * @typedef {function(EvaluationContext):number} NumberEvaluator\n */\n\n/**\n * @typedef {function(EvaluationContext):string} StringEvaluator\n */\n\n/**\n * @typedef {function(EvaluationContext):(Array|string)} ColorLikeEvaluator\n */\n\n/**\n * @typedef {function(EvaluationContext):Array} NumberArrayEvaluator\n */\n\n/**\n * @typedef {function(EvaluationContext):Array} CoordinateEvaluator\n */\n\n/**\n * @typedef {function(EvaluationContext):(Array)} SizeEvaluator\n */\n\n/**\n * @typedef {function(EvaluationContext):(Array|number)} SizeLikeEvaluator\n */\n\n/**\n * @param {import('./expression.js').EncodedExpression} encoded The encoded expression.\n * @param {number} type The expected type.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {ExpressionEvaluator} The expression evaluator.\n */\nexport function buildExpression(encoded, type, context) {\n const expression = parse(encoded, type, context);\n return compileExpression(expression, context);\n}\n\n/**\n * @param {import(\"./expression.js\").Expression} expression The expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {ExpressionEvaluator} The evaluator function.\n */\nfunction compileExpression(expression, context) {\n if (expression instanceof LiteralExpression) {\n // convert colors to array if possible\n if (expression.type === ColorType && typeof expression.value === 'string') {\n const colorValue = fromString(expression.value);\n return function () {\n return colorValue;\n };\n }\n return function () {\n return expression.value;\n };\n }\n const operator = expression.operator;\n switch (operator) {\n case Ops.Number:\n case Ops.String:\n case Ops.Coalesce: {\n return compileAssertionExpression(expression, context);\n }\n case Ops.Get:\n case Ops.Var:\n case Ops.Has: {\n return compileAccessorExpression(expression, context);\n }\n case Ops.Id: {\n return (context) => context.featureId;\n }\n case Ops.GeometryType: {\n return (context) => context.geometryType;\n }\n case Ops.Concat: {\n const args = expression.args.map((e) => compileExpression(e, context));\n return (context) =>\n ''.concat(...args.map((arg) => arg(context).toString()));\n }\n case Ops.Resolution: {\n return (context) => context.resolution;\n }\n case Ops.Any:\n case Ops.All:\n case Ops.Between:\n case Ops.In:\n case Ops.Not: {\n return compileLogicalExpression(expression, context);\n }\n case Ops.Equal:\n case Ops.NotEqual:\n case Ops.LessThan:\n case Ops.LessThanOrEqualTo:\n case Ops.GreaterThan:\n case Ops.GreaterThanOrEqualTo: {\n return compileComparisonExpression(expression, context);\n }\n case Ops.Multiply:\n case Ops.Divide:\n case Ops.Add:\n case Ops.Subtract:\n case Ops.Clamp:\n case Ops.Mod:\n case Ops.Pow:\n case Ops.Abs:\n case Ops.Floor:\n case Ops.Ceil:\n case Ops.Round:\n case Ops.Sin:\n case Ops.Cos:\n case Ops.Atan:\n case Ops.Sqrt: {\n return compileNumericExpression(expression, context);\n }\n case Ops.Case: {\n return compileCaseExpression(expression, context);\n }\n case Ops.Match: {\n return compileMatchExpression(expression, context);\n }\n case Ops.Interpolate: {\n return compileInterpolateExpression(expression, context);\n }\n case Ops.ToString: {\n return compileConvertExpression(expression, context);\n }\n default: {\n throw new Error(`Unsupported operator ${operator}`);\n }\n // TODO: unimplemented\n // Ops.Zoom\n // Ops.Time\n // Ops.Array\n // Ops.Color\n // Ops.Band\n // Ops.Palette\n }\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {ExpressionEvaluator} The evaluator function.\n */\nfunction compileAssertionExpression(expression, context) {\n const type = expression.operator;\n const length = expression.args.length;\n\n const args = new Array(length);\n for (let i = 0; i < length; ++i) {\n args[i] = compileExpression(expression.args[i], context);\n }\n switch (type) {\n case Ops.Coalesce: {\n return (context) => {\n for (let i = 0; i < length; ++i) {\n const value = args[i](context);\n if (typeof value !== 'undefined' && value !== null) {\n return value;\n }\n }\n throw new Error('Expected one of the values to be non-null');\n };\n }\n case Ops.Number:\n case Ops.String: {\n return (context) => {\n for (let i = 0; i < length; ++i) {\n const value = args[i](context);\n if (typeof value === type) {\n return value;\n }\n }\n throw new Error(`Expected one of the values to be a ${type}`);\n };\n }\n default: {\n throw new Error(`Unsupported assertion operator ${type}`);\n }\n }\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {ExpressionEvaluator} The evaluator function.\n */\nfunction compileAccessorExpression(expression, context) {\n const nameExpression = /** @type {LiteralExpression} */ (expression.args[0]);\n const name = /** @type {string} */ (nameExpression.value);\n switch (expression.operator) {\n case Ops.Get: {\n return (context) => {\n const args = expression.args;\n let value = context.properties[name];\n for (let i = 1, ii = args.length; i < ii; ++i) {\n const keyExpression = /** @type {LiteralExpression} */ (args[i]);\n const key = /** @type {string|number} */ (keyExpression.value);\n value = value[key];\n }\n return value;\n };\n }\n case Ops.Var: {\n return (context) => context.variables[name];\n }\n case Ops.Has: {\n return (context) => {\n const args = expression.args;\n if (!(name in context.properties)) {\n return false;\n }\n let value = context.properties[name];\n for (let i = 1, ii = args.length; i < ii; ++i) {\n const keyExpression = /** @type {LiteralExpression} */ (args[i]);\n const key = /** @type {string|number} */ (keyExpression.value);\n if (!value || !Object.hasOwn(value, key)) {\n return false;\n }\n value = value[key];\n }\n return true;\n };\n }\n default: {\n throw new Error(`Unsupported accessor operator ${expression.operator}`);\n }\n }\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {BooleanEvaluator} The evaluator function.\n */\nfunction compileComparisonExpression(expression, context) {\n const op = expression.operator;\n const left = compileExpression(expression.args[0], context);\n const right = compileExpression(expression.args[1], context);\n switch (op) {\n case Ops.Equal: {\n return (context) => left(context) === right(context);\n }\n case Ops.NotEqual: {\n return (context) => left(context) !== right(context);\n }\n case Ops.LessThan: {\n return (context) => left(context) < right(context);\n }\n case Ops.LessThanOrEqualTo: {\n return (context) => left(context) <= right(context);\n }\n case Ops.GreaterThan: {\n return (context) => left(context) > right(context);\n }\n case Ops.GreaterThanOrEqualTo: {\n return (context) => left(context) >= right(context);\n }\n default: {\n throw new Error(`Unsupported comparison operator ${op}`);\n }\n }\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {BooleanEvaluator} The evaluator function.\n */\nfunction compileLogicalExpression(expression, context) {\n const op = expression.operator;\n const length = expression.args.length;\n\n const args = new Array(length);\n for (let i = 0; i < length; ++i) {\n args[i] = compileExpression(expression.args[i], context);\n }\n switch (op) {\n case Ops.Any: {\n return (context) => {\n for (let i = 0; i < length; ++i) {\n if (args[i](context)) {\n return true;\n }\n }\n return false;\n };\n }\n case Ops.All: {\n return (context) => {\n for (let i = 0; i < length; ++i) {\n if (!args[i](context)) {\n return false;\n }\n }\n return true;\n };\n }\n case Ops.Between: {\n return (context) => {\n const value = args[0](context);\n const min = args[1](context);\n const max = args[2](context);\n return value >= min && value <= max;\n };\n }\n case Ops.In: {\n return (context) => {\n const value = args[0](context);\n for (let i = 1; i < length; ++i) {\n if (value === args[i](context)) {\n return true;\n }\n }\n return false;\n };\n }\n case Ops.Not: {\n return (context) => !args[0](context);\n }\n default: {\n throw new Error(`Unsupported logical operator ${op}`);\n }\n }\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {NumberEvaluator} The evaluator function.\n */\nfunction compileNumericExpression(expression, context) {\n const op = expression.operator;\n const length = expression.args.length;\n\n const args = new Array(length);\n for (let i = 0; i < length; ++i) {\n args[i] = compileExpression(expression.args[i], context);\n }\n switch (op) {\n case Ops.Multiply: {\n return (context) => {\n let value = 1;\n for (let i = 0; i < length; ++i) {\n value *= args[i](context);\n }\n return value;\n };\n }\n case Ops.Divide: {\n return (context) => args[0](context) / args[1](context);\n }\n case Ops.Add: {\n return (context) => {\n let value = 0;\n for (let i = 0; i < length; ++i) {\n value += args[i](context);\n }\n return value;\n };\n }\n case Ops.Subtract: {\n return (context) => args[0](context) - args[1](context);\n }\n case Ops.Clamp: {\n return (context) => {\n const value = args[0](context);\n const min = args[1](context);\n if (value < min) {\n return min;\n }\n const max = args[2](context);\n if (value > max) {\n return max;\n }\n return value;\n };\n }\n case Ops.Mod: {\n return (context) => args[0](context) % args[1](context);\n }\n case Ops.Pow: {\n return (context) => Math.pow(args[0](context), args[1](context));\n }\n case Ops.Abs: {\n return (context) => Math.abs(args[0](context));\n }\n case Ops.Floor: {\n return (context) => Math.floor(args[0](context));\n }\n case Ops.Ceil: {\n return (context) => Math.ceil(args[0](context));\n }\n case Ops.Round: {\n return (context) => Math.round(args[0](context));\n }\n case Ops.Sin: {\n return (context) => Math.sin(args[0](context));\n }\n case Ops.Cos: {\n return (context) => Math.cos(args[0](context));\n }\n case Ops.Atan: {\n if (length === 2) {\n return (context) => Math.atan2(args[0](context), args[1](context));\n }\n return (context) => Math.atan(args[0](context));\n }\n case Ops.Sqrt: {\n return (context) => Math.sqrt(args[0](context));\n }\n default: {\n throw new Error(`Unsupported numeric operator ${op}`);\n }\n }\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {ExpressionEvaluator} The evaluator function.\n */\nfunction compileCaseExpression(expression, context) {\n const length = expression.args.length;\n const args = new Array(length);\n for (let i = 0; i < length; ++i) {\n args[i] = compileExpression(expression.args[i], context);\n }\n return (context) => {\n for (let i = 0; i < length - 1; i += 2) {\n const condition = args[i](context);\n if (condition) {\n return args[i + 1](context);\n }\n }\n return args[length - 1](context);\n };\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {ExpressionEvaluator} The evaluator function.\n */\nfunction compileMatchExpression(expression, context) {\n const length = expression.args.length;\n const args = new Array(length);\n for (let i = 0; i < length; ++i) {\n args[i] = compileExpression(expression.args[i], context);\n }\n return (context) => {\n const value = args[0](context);\n for (let i = 1; i < length - 1; i += 2) {\n if (value === args[i](context)) {\n return args[i + 1](context);\n }\n }\n return args[length - 1](context);\n };\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {ExpressionEvaluator} The evaluator function.\n */\nfunction compileInterpolateExpression(expression, context) {\n const length = expression.args.length;\n const args = new Array(length);\n for (let i = 0; i < length; ++i) {\n args[i] = compileExpression(expression.args[i], context);\n }\n return (context) => {\n const base = args[0](context);\n const value = args[1](context);\n\n let previousInput;\n let previousOutput;\n for (let i = 2; i < length; i += 2) {\n const input = args[i](context);\n let output = args[i + 1](context);\n const isColor = Array.isArray(output);\n if (isColor) {\n output = withAlpha(output);\n }\n if (input >= value) {\n if (i === 2) {\n return output;\n }\n if (isColor) {\n return interpolateColor(\n base,\n value,\n previousInput,\n previousOutput,\n input,\n output,\n );\n }\n return interpolateNumber(\n base,\n value,\n previousInput,\n previousOutput,\n input,\n output,\n );\n }\n previousInput = input;\n previousOutput = output;\n }\n return previousOutput;\n };\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {ExpressionEvaluator} The evaluator function.\n */\nfunction compileConvertExpression(expression, context) {\n const op = expression.operator;\n const length = expression.args.length;\n\n const args = new Array(length);\n for (let i = 0; i < length; ++i) {\n args[i] = compileExpression(expression.args[i], context);\n }\n switch (op) {\n case Ops.ToString: {\n return (context) => {\n const value = args[0](context);\n if (expression.args[0].type === ColorType) {\n return toString(value);\n }\n return value.toString();\n };\n }\n default: {\n throw new Error(`Unsupported convert operator ${op}`);\n }\n }\n}\n\n/**\n * @param {number} base The base.\n * @param {number} value The value.\n * @param {number} input1 The first input value.\n * @param {number} output1 The first output value.\n * @param {number} input2 The second input value.\n * @param {number} output2 The second output value.\n * @return {number} The interpolated value.\n */\nfunction interpolateNumber(base, value, input1, output1, input2, output2) {\n const delta = input2 - input1;\n if (delta === 0) {\n return output1;\n }\n const along = value - input1;\n const factor =\n base === 1\n ? along / delta\n : (Math.pow(base, along) - 1) / (Math.pow(base, delta) - 1);\n return output1 + factor * (output2 - output1);\n}\n\n/**\n * @param {number} base The base.\n * @param {number} value The value.\n * @param {number} input1 The first input value.\n * @param {import('../color.js').Color} rgba1 The first output value.\n * @param {number} input2 The second input value.\n * @param {import('../color.js').Color} rgba2 The second output value.\n * @return {import('../color.js').Color} The interpolated color.\n */\nfunction interpolateColor(base, value, input1, rgba1, input2, rgba2) {\n const delta = input2 - input1;\n if (delta === 0) {\n return rgba1;\n }\n const lcha1 = rgbaToLcha(rgba1);\n const lcha2 = rgbaToLcha(rgba2);\n let deltaHue = lcha2[2] - lcha1[2];\n if (deltaHue > 180) {\n deltaHue -= 360;\n } else if (deltaHue < -180) {\n deltaHue += 360;\n }\n\n const lcha = [\n interpolateNumber(base, value, input1, lcha1[0], input2, lcha2[0]),\n interpolateNumber(base, value, input1, lcha1[1], input2, lcha2[1]),\n lcha1[2] + interpolateNumber(base, value, input1, 0, input2, deltaHue),\n interpolateNumber(base, value, input1, rgba1[3], input2, rgba2[3]),\n ];\n return lchaToRgba(lcha);\n}\n","/**\n * @module ol/style/IconImageCache\n */\nimport ImageState from '../ImageState.js';\nimport {asArray} from '../color.js';\nimport {getSharedCanvasContext2D} from '../dom.js';\n\n/**\n * @classdesc\n * Singleton class. Available through {@link module:ol/style/IconImageCache.shared}.\n */\nclass IconImageCache {\n constructor() {\n /**\n * @type {!Object}\n * @private\n */\n this.cache_ = {};\n\n /**\n * @type {!Object}\n * @private\n */\n this.patternCache_ = {};\n\n /**\n * @type {number}\n * @private\n */\n this.cacheSize_ = 0;\n\n /**\n * @type {number}\n * @private\n */\n this.maxCacheSize_ = 1024;\n }\n\n /**\n * FIXME empty description for jsdoc\n */\n clear() {\n this.cache_ = {};\n this.patternCache_ = {};\n this.cacheSize_ = 0;\n }\n\n /**\n * @return {boolean} Can expire cache.\n */\n canExpireCache() {\n return this.cacheSize_ > this.maxCacheSize_;\n }\n\n /**\n * FIXME empty description for jsdoc\n */\n expire() {\n if (this.canExpireCache()) {\n let i = 0;\n for (const key in this.cache_) {\n const iconImage = this.cache_[key];\n if ((i++ & 3) === 0 && !iconImage.hasListener()) {\n delete this.cache_[key];\n delete this.patternCache_[key];\n --this.cacheSize_;\n }\n }\n }\n }\n\n /**\n * @param {string} src Src.\n * @param {import(\"../color.js\").Color|string|null} color Color.\n * @return {import(\"./IconImage.js\").default} Icon image.\n */\n get(src, color) {\n const key = getCacheKey(src, color);\n\n const icon = key in this.cache_ ? this.cache_[key] : null;\n return icon;\n }\n\n /**\n * @param {string} src Src.\n * @param {import(\"../color.js\").Color|string|null} color Color.\n * @return {CanvasPattern} Icon image.\n */\n getPattern(src, color) {\n const key = getCacheKey(src, color);\n return key in this.patternCache_ ? this.patternCache_[key] : null;\n }\n\n /**\n * @param {string} src Src.\n * @param {import(\"../color.js\").Color|string|null} color Color.\n * @param {import(\"./IconImage.js\").default|null} iconImage Icon image.\n * @param {boolean} [pattern] Also cache a `'repeat'` pattern with this `iconImage`.\n */\n set(src, color, iconImage, pattern) {\n const key = getCacheKey(src, color);\n const update = key in this.cache_;\n this.cache_[key] = iconImage;\n if (pattern) {\n if (iconImage.getImageState() === ImageState.IDLE) {\n iconImage.load();\n }\n if (iconImage.getImageState() === ImageState.LOADING) {\n iconImage.ready().then(() => {\n this.patternCache_[key] = getSharedCanvasContext2D().createPattern(\n iconImage.getImage(1),\n 'repeat',\n );\n });\n } else {\n this.patternCache_[key] = getSharedCanvasContext2D().createPattern(\n iconImage.getImage(1),\n 'repeat',\n );\n }\n }\n if (!update) {\n ++this.cacheSize_;\n }\n }\n\n /**\n * Set the cache size of the icon cache. Default is `1024`. Change this value when\n * your map uses more than 1024 different icon images and you are not caching icon\n * styles on the application level.\n * @param {number} maxCacheSize Cache max size.\n * @api\n */\n setSize(maxCacheSize) {\n this.maxCacheSize_ = maxCacheSize;\n this.expire();\n }\n}\n\n/**\n * @param {string} src Src.\n * @param {import(\"../color.js\").Color|string|null} color Color.\n * @return {string} Cache key.\n */\nexport function getCacheKey(src, color) {\n const colorString = color ? asArray(color) : 'null';\n return src + ':' + colorString;\n}\n\nexport default IconImageCache;\n\n/**\n * The {@link module:ol/style/IconImageCache~IconImageCache} for\n * {@link module:ol/style/Icon~Icon} images.\n * @api\n */\nexport const shared = new IconImageCache();\n","/**\n * @module ol/style/IconImage\n */\n\nimport {decodeFallback} from '../Image.js';\nimport ImageState from '../ImageState.js';\nimport {asString} from '../color.js';\nimport {createCanvasContext2D} from '../dom.js';\nimport EventType from '../events/EventType.js';\nimport EventTarget from '../events/Target.js';\nimport {shared as iconImageCache} from './IconImageCache.js';\n\n/**\n * @type {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D}\n */\nlet taintedTestContext = null;\n\nclass IconImage extends EventTarget {\n /**\n * @param {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas|ImageBitmap|null} image Image.\n * @param {string|undefined} src Src.\n * @param {import('../dom').ImageAttributes} imageAttributes Image attributes options.\n * @param {import(\"../ImageState.js\").default|undefined} imageState Image state.\n * @param {import(\"../color.js\").Color|string|null} color Color.\n */\n constructor(image, src, imageAttributes, imageState, color) {\n super();\n\n /**\n * @private\n * @type {HTMLImageElement|OffscreenCanvas|HTMLCanvasElement|ImageBitmap}\n */\n this.hitDetectionImage_ = null;\n\n /**\n * @private\n * @type {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas|ImageBitmap|null}\n */\n this.image_ = image;\n\n /**\n * @private\n * @type {string|null}\n */\n this.crossOrigin_ = imageAttributes?.crossOrigin;\n\n /**\n * @private\n * @type {ReferrerPolicy}\n */\n this.referrerPolicy_ = imageAttributes?.referrerPolicy;\n\n /**\n * @private\n * @type {Object}\n */\n this.canvas_ = {};\n\n /**\n * @private\n * @type {import(\"../color.js\").Color|string|null}\n */\n this.color_ = color;\n\n /**\n * @private\n * @type {import(\"../ImageState.js\").default}\n */\n this.imageState_ = imageState === undefined ? ImageState.IDLE : imageState;\n\n /**\n * @private\n * @type {import(\"../size.js\").Size|null}\n */\n this.size_ =\n image && image.width && image.height ? [image.width, image.height] : null;\n\n /**\n * @private\n * @type {string|undefined}\n */\n this.src_ = src;\n\n /**\n * @private\n */\n this.tainted_;\n\n /**\n * @private\n * @type {Promise|null}\n */\n this.ready_ = null;\n }\n\n /**\n * @private\n */\n initializeImage_() {\n this.image_ = new Image();\n if (this.crossOrigin_ !== null) {\n this.image_.crossOrigin = this.crossOrigin_;\n }\n if (this.referrerPolicy_ !== undefined) {\n this.image_.referrerPolicy = this.referrerPolicy_;\n }\n }\n\n /**\n * @private\n * @return {boolean} The image canvas is tainted.\n */\n isTainted_() {\n if (this.tainted_ === undefined && this.imageState_ === ImageState.LOADED) {\n if (!taintedTestContext) {\n taintedTestContext = createCanvasContext2D(1, 1, undefined, {\n willReadFrequently: true,\n });\n }\n taintedTestContext.drawImage(this.image_, 0, 0);\n try {\n taintedTestContext.getImageData(0, 0, 1, 1);\n this.tainted_ = false;\n } catch {\n taintedTestContext = null;\n this.tainted_ = true;\n }\n }\n return this.tainted_ === true;\n }\n\n /**\n * @private\n */\n dispatchChangeEvent_() {\n this.dispatchEvent(EventType.CHANGE);\n }\n\n /**\n * @private\n */\n handleImageError_() {\n this.imageState_ = ImageState.ERROR;\n this.dispatchChangeEvent_();\n }\n\n /**\n * @private\n */\n handleImageLoad_() {\n this.imageState_ = ImageState.LOADED;\n this.size_ = [this.image_.width, this.image_.height];\n this.dispatchChangeEvent_();\n }\n\n /**\n * @param {number} pixelRatio Pixel ratio.\n * @return {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas|ImageBitmap} Image or Canvas element or image bitmap.\n */\n getImage(pixelRatio) {\n if (!this.image_) {\n this.initializeImage_();\n }\n this.replaceColor_(pixelRatio);\n return this.canvas_[pixelRatio] ? this.canvas_[pixelRatio] : this.image_;\n }\n\n /**\n * @param {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas|ImageBitmap} image Image.\n */\n setImage(image) {\n this.image_ = image;\n }\n\n /**\n * @param {number} pixelRatio Pixel ratio.\n * @return {number} Image or Canvas element.\n */\n getPixelRatio(pixelRatio) {\n this.replaceColor_(pixelRatio);\n return this.canvas_[pixelRatio] ? pixelRatio : 1;\n }\n\n /**\n * @return {import(\"../ImageState.js\").default} Image state.\n */\n getImageState() {\n return this.imageState_;\n }\n\n /**\n * @return {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas|ImageBitmap} Image element.\n */\n getHitDetectionImage() {\n if (!this.image_) {\n this.initializeImage_();\n }\n if (!this.hitDetectionImage_) {\n if (this.isTainted_()) {\n const width = this.size_[0];\n const height = this.size_[1];\n const context = createCanvasContext2D(width, height);\n context.fillRect(0, 0, width, height);\n this.hitDetectionImage_ = context.canvas;\n } else {\n this.hitDetectionImage_ = this.image_;\n }\n }\n return this.hitDetectionImage_;\n }\n\n /**\n * Get the size of the icon (in pixels).\n * @return {import(\"../size.js\").Size} Image size.\n */\n getSize() {\n return this.size_;\n }\n\n /**\n * @return {string|undefined} Image src.\n */\n getSrc() {\n return this.src_;\n }\n\n /**\n * Load not yet loaded URI.\n */\n load() {\n if (this.imageState_ !== ImageState.IDLE) {\n return;\n }\n if (!this.image_) {\n this.initializeImage_();\n }\n\n this.imageState_ = ImageState.LOADING;\n try {\n if (this.src_ !== undefined) {\n /** @type {HTMLImageElement} */ (this.image_).src = this.src_;\n }\n } catch {\n this.handleImageError_();\n }\n if (this.image_ instanceof HTMLImageElement) {\n decodeFallback(this.image_, this.src_)\n .then((image) => {\n this.image_ = image;\n this.handleImageLoad_();\n })\n .catch(this.handleImageError_.bind(this));\n }\n }\n\n /**\n * @param {number} pixelRatio Pixel ratio.\n * @private\n */\n replaceColor_(pixelRatio) {\n if (\n !this.color_ ||\n this.canvas_[pixelRatio] ||\n this.imageState_ !== ImageState.LOADED\n ) {\n return;\n }\n\n const image = this.image_;\n const ctx = createCanvasContext2D(\n Math.ceil(image.width * pixelRatio),\n Math.ceil(image.height * pixelRatio),\n );\n const canvas = ctx.canvas;\n\n ctx.scale(pixelRatio, pixelRatio);\n ctx.drawImage(image, 0, 0);\n\n ctx.globalCompositeOperation = 'multiply';\n ctx.fillStyle = asString(this.color_);\n ctx.fillRect(0, 0, canvas.width / pixelRatio, canvas.height / pixelRatio);\n\n ctx.globalCompositeOperation = 'destination-in';\n ctx.drawImage(image, 0, 0);\n\n this.canvas_[pixelRatio] = canvas;\n }\n\n /**\n * @return {Promise} Promise that resolves when the image is loaded.\n */\n ready() {\n if (!this.ready_) {\n this.ready_ = new Promise((resolve) => {\n if (\n this.imageState_ === ImageState.LOADED ||\n this.imageState_ === ImageState.ERROR\n ) {\n resolve();\n } else {\n const onChange = () => {\n if (\n this.imageState_ === ImageState.LOADED ||\n this.imageState_ === ImageState.ERROR\n ) {\n this.removeEventListener(EventType.CHANGE, onChange);\n resolve();\n }\n };\n this.addEventListener(EventType.CHANGE, onChange);\n }\n });\n }\n return this.ready_;\n }\n}\n\n/**\n * @param {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas|ImageBitmap|null} image Image.\n * @param {string|undefined} src Src.\n * @param {import('../dom.js').ImageAttributes} imageAttributes Image attributes options.\n * @param {import(\"../ImageState.js\").default|undefined} imageState Image state.\n * @param {import(\"../color.js\").Color|string|null} color Color.\n * @param {boolean} [pattern] Also cache a `repeat` pattern with the icon image.\n * @return {IconImage} Icon image.\n */\nexport function get(image, src, imageAttributes, imageState, color, pattern) {\n let iconImage =\n src === undefined ? undefined : iconImageCache.get(src, color);\n if (!iconImage) {\n iconImage = new IconImage(\n image,\n image && 'src' in image ? image.src || undefined : src,\n imageAttributes,\n imageState,\n color,\n );\n iconImageCache.set(src, color, iconImage, pattern);\n }\n if (pattern && iconImage && !iconImageCache.getPattern(src, color)) {\n iconImageCache.set(src, color, iconImage, pattern);\n }\n return iconImage;\n}\n\nexport default IconImage;\n","/**\n * @module ol/colorlike\n */\nimport ImageState from './ImageState.js';\nimport {toString} from './color.js';\nimport {createCanvasContext2D} from './dom.js';\nimport {get as getIconImage} from './style/IconImage.js';\nimport {shared as iconCache} from './style/IconImageCache.js';\n\n/**\n * @typedef {Object} PatternDescriptor\n * @property {string} src Pattern image URL\n * @property {import(\"./color.js\").Color|string} [color] Color to tint the pattern with.\n * @property {import(\"./size.js\").Size} [size] Size of the desired slice from the pattern image.\n * Use this together with `offset` when the pattern image is a sprite sheet.\n * @property {import(\"./size.js\").Size} [offset] Offset of the desired slice from the pattern image.\n * Use this together with `size` when the pattern image is a sprite sheet.\n */\n\n/**\n * A type accepted by CanvasRenderingContext2D.fillStyle\n * or CanvasRenderingContext2D.strokeStyle.\n * Represents a color, [CanvasPattern](https://developer.mozilla.org/en-US/docs/Web/API/CanvasPattern),\n * or [CanvasGradient](https://developer.mozilla.org/en-US/docs/Web/API/CanvasGradient). The origin for\n * patterns and gradients as fill style is an increment of 512 css pixels from map coordinate\n * `[0, 0]`. For seamless repeat patterns, width and height of the pattern image\n * must be a factor of two (2, 4, 8, ..., 512).\n *\n * @typedef {string|CanvasPattern|CanvasGradient} ColorLike\n * @api\n */\n\n/**\n * @param {import(\"./color.js\").Color|ColorLike|PatternDescriptor|null} color Color.\n * @return {ColorLike|null} The color as an {@link ol/colorlike~ColorLike}.\n * @api\n */\nexport function asColorLike(color) {\n if (!color) {\n return null;\n }\n if (Array.isArray(color)) {\n return toString(color);\n }\n if (typeof color === 'object' && 'src' in color) {\n return asCanvasPattern(color);\n }\n return color;\n}\n\n/**\n * @param {PatternDescriptor} pattern Pattern descriptor.\n * @return {CanvasPattern|null} Canvas pattern or null if the pattern referenced in the\n * PatternDescriptor was not found in the icon image cache.\n */\nfunction asCanvasPattern(pattern) {\n if (!pattern.offset || !pattern.size) {\n return iconCache.getPattern(pattern.src, pattern.color);\n }\n\n const cacheKey = pattern.src + ':' + pattern.offset;\n\n const canvasPattern = iconCache.getPattern(cacheKey, pattern.color);\n if (canvasPattern) {\n return canvasPattern;\n }\n\n const iconImage = iconCache.get(pattern.src, null);\n if (iconImage.getImageState() !== ImageState.LOADED) {\n return null;\n }\n const patternCanvasContext = createCanvasContext2D(\n pattern.size[0],\n pattern.size[1],\n );\n patternCanvasContext.drawImage(\n iconImage.getImage(1),\n pattern.offset[0],\n pattern.offset[1],\n pattern.size[0],\n pattern.size[1],\n 0,\n 0,\n pattern.size[0],\n pattern.size[1],\n );\n getIconImage(\n patternCanvasContext.canvas,\n cacheKey,\n undefined,\n ImageState.LOADED,\n pattern.color,\n true,\n );\n return iconCache.getPattern(cacheKey, pattern.color);\n}\n","/**\n * @module ol/render/canvas\n */\nimport BaseObject from '../Object.js';\nimport {fontWeights, getFontParameters} from '../css.js';\nimport {createCanvasContext2D} from '../dom.js';\nimport {WORKER_OFFSCREEN_CANVAS} from '../has.js';\nimport {clear} from '../obj.js';\n\n/**\n * @typedef {'Circle' | 'Image' | 'LineString' | 'Polygon' | 'Text' | 'Default'} BuilderType\n */\n\n/**\n * @typedef {Object} FillState\n * @property {import(\"../colorlike.js\").ColorLike} fillStyle FillStyle.\n */\n\n/**\n * @typedef Label\n * @property {number} width Width.\n * @property {number} height Height.\n * @property {Array} contextInstructions ContextInstructions.\n */\n\n/**\n * @typedef {Object} FillStrokeState\n * @property {import(\"../colorlike.js\").ColorLike} [currentFillStyle] Current FillStyle.\n * @property {import(\"../colorlike.js\").ColorLike} [currentStrokeStyle] Current StrokeStyle.\n * @property {CanvasLineCap} [currentLineCap] Current LineCap.\n * @property {Array} currentLineDash Current LineDash.\n * @property {number} [currentLineDashOffset] Current LineDashOffset.\n * @property {CanvasLineJoin} [currentLineJoin] Current LineJoin.\n * @property {number} [currentLineWidth] Current LineWidth.\n * @property {number} [currentMiterLimit] Current MiterLimit.\n * @property {number} [currentStrokeOffset] Current StrokeOffset.\n * @property {number} [lastStroke] Last stroke.\n * @property {import(\"../colorlike.js\").ColorLike} [fillStyle] FillStyle.\n * @property {import(\"../colorlike.js\").ColorLike} [strokeStyle] StrokeStyle.\n * @property {CanvasLineCap} [lineCap] LineCap.\n * @property {Array} lineDash LineDash.\n * @property {number} [lineDashOffset] LineDashOffset.\n * @property {CanvasLineJoin} [lineJoin] LineJoin.\n * @property {number} [lineWidth] LineWidth.\n * @property {number} [miterLimit] MiterLimit.\n * @property {number} [strokeOffset] StrokeOffset.\n * @property {number} [fillPatternScale] Fill pattern scale.\n */\n\n/**\n * @typedef {Object} StrokeState\n * @property {CanvasLineCap} lineCap LineCap.\n * @property {Array} lineDash LineDash.\n * @property {number} lineDashOffset LineDashOffset.\n * @property {CanvasLineJoin} lineJoin LineJoin.\n * @property {number} lineWidth LineWidth.\n * @property {number} miterLimit MiterLimit.\n * @property {number} [strokeOffset] StrokeOffset.\n * @property {import(\"../colorlike.js\").ColorLike} strokeStyle StrokeStyle.\n */\n\n/**\n * @typedef {Object} TextState\n * @property {string} font Font.\n * @property {CanvasTextAlign} [textAlign] TextAlign.\n * @property {number} [repeat] Repeat.\n * @property {import(\"../style/Text.js\").TextJustify} [justify] Justify.\n * @property {CanvasTextBaseline} textBaseline TextBaseline.\n * @property {import(\"../style/Text.js\").TextPlacement} [placement] Placement.\n * @property {number} [maxAngle] MaxAngle.\n * @property {boolean} [overflow] Overflow.\n * @property {import(\"../style/Fill.js\").default} [backgroundFill] BackgroundFill.\n * @property {import(\"../style/Stroke.js\").default} [backgroundStroke] BackgroundStroke.\n * @property {import(\"../size.js\").Size} [scale] Scale.\n * @property {Array} [padding] Padding.\n */\n\n/**\n * @typedef {Object} SerializableInstructions\n * @property {Array<*>} instructions The rendering instructions.\n * @property {Array<*>} hitDetectionInstructions The rendering hit detection instructions.\n * @property {Array} coordinates The array of all coordinates.\n * @property {!Object} [textStates] The text states (decluttering).\n * @property {!Object} [fillStates] The fill states (decluttering).\n * @property {!Object} [strokeStates] The stroke states (decluttering).\n */\n\n/**\n * @typedef {Object} DeclutterImageWithText\n */\n\n/**\n * @const\n * @type {string}\n */\nexport const defaultFont = '10px sans-serif';\n\n/**\n * @const\n * @type {string}\n */\nexport const defaultFillStyle = '#000';\n\n/**\n * @const\n * @type {CanvasLineCap}\n */\nexport const defaultLineCap = 'round';\n\n/**\n * @const\n * @type {Array}\n */\nexport const defaultLineDash = [];\n\n/**\n * @const\n * @type {number}\n */\nexport const defaultLineDashOffset = 0;\n\n/**\n * @const\n * @type {CanvasLineJoin}\n */\nexport const defaultLineJoin = 'round';\n\n/**\n * @const\n * @type {number}\n */\nexport const defaultMiterLimit = 10;\n\n/**\n * @const\n * @type {number}\n */\nexport const defaultStrokeOffset = 0;\n\n/**\n * @const\n * @type {import(\"../colorlike.js\").ColorLike}\n */\nexport const defaultStrokeStyle = '#000';\n\n/**\n * @const\n * @type {CanvasTextAlign}\n */\nexport const defaultTextAlign = 'center';\n\n/**\n * @const\n * @type {CanvasTextBaseline}\n */\nexport const defaultTextBaseline = 'middle';\n\n/**\n * @const\n * @type {Array}\n */\nexport const defaultPadding = [0, 0, 0, 0];\n\n/**\n * @const\n * @type {number}\n */\nexport const defaultLineWidth = 1;\n\n/**\n * @type {BaseObject}\n */\nexport const checkedFonts = new BaseObject();\n\n/**\n * @type {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D}\n */\nlet measureContext = null;\n\n/**\n * @type {string}\n */\nlet measureFont;\n\n/**\n * @type {!Object}\n */\nexport const textHeights = {};\n\nconst genericFontFamilies = new Set([\n 'serif',\n 'sans-serif',\n 'monospace',\n 'cursive',\n 'fantasy',\n 'system-ui',\n 'ui-serif',\n 'ui-sans-serif',\n 'ui-monospace',\n 'ui-rounded',\n 'emoji',\n 'math',\n 'fangsong',\n]);\n\n/**\n * @param {string} style Css font-style\n * @param {string} weight Css font-weight\n * @param {string} family Css font-family\n * @return {string} Font key.\n */\nfunction getFontKey(style, weight, family) {\n return `${style} ${weight} 16px \"${family}\"`;\n}\n\n/**\n * Clears the label cache when a font becomes available.\n * @param {string} fontSpec CSS font spec.\n */\nexport const registerFont = (function () {\n const retries = 100;\n let timeout, fontFaceSet;\n\n /**\n * @param {string} fontSpec Css font spec\n * @return {Promise} Font with style and weight is available\n */\n async function isAvailable(fontSpec) {\n await fontFaceSet.ready;\n const fontFaces = await fontFaceSet.load(fontSpec);\n if (fontFaces.length === 0) {\n return false;\n }\n const font = getFontParameters(fontSpec);\n const checkFamily = font.families[0].toLowerCase();\n const checkWeight = font.weight;\n return fontFaces.some(\n /**\n * @param {import('../css.js').FontParameters} f Font.\n * @return {boolean} Font matches.\n */\n (f) => {\n const family = f.family.replace(/^['\"]|['\"]$/g, '').toLowerCase();\n const weight = fontWeights[f.weight] || f.weight;\n return (\n family === checkFamily &&\n f.style === font.style &&\n weight == checkWeight\n );\n },\n );\n }\n\n async function check() {\n await fontFaceSet.ready;\n let done = true;\n const checkedFontsProperties = checkedFonts.getProperties();\n const fonts = Object.keys(checkedFontsProperties).filter(\n (key) => checkedFontsProperties[key] < retries,\n );\n for (let i = fonts.length - 1; i >= 0; --i) {\n const font = fonts[i];\n let currentRetries = checkedFontsProperties[font];\n if (currentRetries < retries) {\n if (await isAvailable(font)) {\n clear(textHeights);\n checkedFonts.set(font, retries);\n } else {\n currentRetries += 10;\n checkedFonts.set(font, currentRetries, true);\n if (currentRetries < retries) {\n done = false;\n }\n }\n }\n }\n timeout = undefined;\n if (!done) {\n timeout = setTimeout(check, 100);\n }\n }\n\n return async function (fontSpec) {\n if (!fontFaceSet) {\n fontFaceSet = WORKER_OFFSCREEN_CANVAS ? self.fonts : document.fonts;\n }\n const font = getFontParameters(fontSpec);\n if (!font) {\n return;\n }\n const families = font.families;\n let needCheck = false;\n for (const family of families) {\n if (genericFontFamilies.has(family)) {\n continue;\n }\n const key = getFontKey(font.style, font.weight, family);\n if (checkedFonts.get(key) !== undefined) {\n continue;\n }\n checkedFonts.set(key, 0, true);\n needCheck = true;\n }\n if (needCheck) {\n clearTimeout(timeout);\n timeout = setTimeout(check, 100);\n }\n };\n})();\n\n/**\n * @param {string} font Font to use for measuring.\n * @return {import(\"../size.js\").Size} Measurement.\n */\nexport const measureTextHeight = (function () {\n /**\n * @type {HTMLDivElement}\n */\n let measureElement;\n return function (fontSpec) {\n let height = textHeights[fontSpec];\n if (height == undefined) {\n if (WORKER_OFFSCREEN_CANVAS) {\n const font = getFontParameters(fontSpec);\n const metrics = measureText(fontSpec, 'Žg');\n const lineHeight = isNaN(Number(font.lineHeight))\n ? 1.2\n : Number(font.lineHeight);\n height =\n lineHeight *\n (metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent);\n } else {\n if (!measureElement) {\n measureElement = document.createElement('div');\n measureElement.innerHTML = 'M';\n measureElement.style.minHeight = '0';\n measureElement.style.maxHeight = 'none';\n measureElement.style.height = 'auto';\n measureElement.style.padding = '0';\n measureElement.style.border = 'none';\n measureElement.style.position = 'absolute';\n measureElement.style.display = 'block';\n measureElement.style.left = '-99999px';\n }\n measureElement.style.font = fontSpec;\n document.body.appendChild(measureElement);\n height = measureElement.offsetHeight;\n document.body.removeChild(measureElement);\n }\n textHeights[fontSpec] = height;\n }\n return height;\n };\n})();\n\n/**\n * @param {string} font Font.\n * @param {string} text Text.\n * @return {TextMetrics} Text metrics.\n */\nfunction measureText(font, text) {\n if (!measureContext) {\n measureContext = createCanvasContext2D(1, 1);\n }\n if (font != measureFont) {\n measureContext.font = font;\n measureFont = measureContext.font;\n }\n return measureContext.measureText(text);\n}\n\n/**\n * @param {string} font Font.\n * @param {string} text Text.\n * @return {number} Width.\n */\nexport function measureTextWidth(font, text) {\n return measureText(font, text).width;\n}\n\n/**\n * Measure text width using a cache.\n * @param {string} font The font.\n * @param {string} text The text to measure.\n * @param {Object} cache A lookup of cached widths by text.\n * @return {number} The text width.\n */\nexport function measureAndCacheTextWidth(font, text, cache) {\n if (text in cache) {\n return cache[text];\n }\n const width = text\n .split('\\n')\n .reduce((prev, curr) => Math.max(prev, measureTextWidth(font, curr)), 0);\n cache[text] = width;\n return width;\n}\n\n/**\n * @param {TextState} baseStyle Base style.\n * @param {Array} chunks Text chunks to measure.\n * @return {{width: number, height: number, widths: Array, heights: Array, lineWidths: Array}}} Text metrics.\n */\nexport function getTextDimensions(baseStyle, chunks) {\n const widths = [];\n const heights = [];\n const lineWidths = [];\n let width = 0;\n let lineWidth = 0;\n let height = 0;\n let lineHeight = 0;\n for (let i = 0, ii = chunks.length; i <= ii; i += 2) {\n const text = chunks[i];\n if (text === '\\n' || i === ii) {\n width = Math.max(width, lineWidth);\n lineWidths.push(lineWidth);\n lineWidth = 0;\n height += lineHeight;\n lineHeight = 0;\n continue;\n }\n const font = chunks[i + 1] || baseStyle.font;\n const currentWidth = measureTextWidth(font, text);\n widths.push(currentWidth);\n lineWidth += currentWidth;\n const currentHeight = measureTextHeight(font);\n heights.push(currentHeight);\n lineHeight = Math.max(lineHeight, currentHeight);\n }\n return {width, height, widths, heights, lineWidths};\n}\n\n/**\n * @param {CanvasRenderingContext2D} context Context.\n * @param {number} rotation Rotation.\n * @param {number} offsetX X offset.\n * @param {number} offsetY Y offset.\n */\nexport function rotateAtOffset(context, rotation, offsetX, offsetY) {\n if (rotation !== 0) {\n context.translate(offsetX, offsetY);\n context.rotate(rotation);\n context.translate(-offsetX, -offsetY);\n }\n}\n\n/**\n * @param {CanvasRenderingContext2D|import(\"../render/canvas/ZIndexContext.js\").ZIndexContextProxy} context Context.\n * @param {import(\"../transform.js\").Transform|null} transform Transform.\n * @param {number} opacity Opacity.\n * @param {Label|HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} labelOrImage Label.\n * @param {number} originX Origin X.\n * @param {number} originY Origin Y.\n * @param {number} w Width.\n * @param {number} h Height.\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../size.js\").Size} scale Scale.\n */\nexport function drawImageOrLabel(\n context,\n transform,\n opacity,\n labelOrImage,\n originX,\n originY,\n w,\n h,\n x,\n y,\n scale,\n) {\n context.save();\n\n if (opacity !== 1) {\n if (context.globalAlpha === undefined) {\n context.globalAlpha = (context) => (context.globalAlpha *= opacity);\n } else {\n context.globalAlpha *= opacity;\n }\n }\n if (transform) {\n context.transform.apply(context, transform);\n }\n\n if (/** @type {*} */ (labelOrImage).contextInstructions) {\n // label\n context.translate(x, y);\n context.scale(scale[0], scale[1]);\n executeLabelInstructions(/** @type {Label} */ (labelOrImage), context);\n } else if (scale[0] < 0 || scale[1] < 0) {\n // flipped image\n context.translate(x, y);\n context.scale(scale[0], scale[1]);\n context.drawImage(\n /** @type {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} */ (\n labelOrImage\n ),\n originX,\n originY,\n w,\n h,\n 0,\n 0,\n w,\n h,\n );\n } else {\n // if image not flipped translate and scale can be avoided\n context.drawImage(\n /** @type {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} */ (\n labelOrImage\n ),\n originX,\n originY,\n w,\n h,\n x,\n y,\n w * scale[0],\n h * scale[1],\n );\n }\n\n context.restore();\n}\n\n/**\n * @param {Label} label Label.\n * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} context Context.\n */\nfunction executeLabelInstructions(label, context) {\n const contextInstructions = label.contextInstructions;\n for (let i = 0, ii = contextInstructions.length; i < ii; i += 2) {\n if (Array.isArray(contextInstructions[i + 1])) {\n context[contextInstructions[i]].apply(\n context,\n contextInstructions[i + 1],\n );\n } else {\n context[contextInstructions[i]] = contextInstructions[i + 1];\n }\n }\n}\n","/**\n * @module ol/style/Image\n */\nimport {toSize} from '../size.js';\nimport {abstract} from '../util.js';\n\n/**\n * @typedef {Object} Options\n * @property {number} opacity Opacity.\n * @property {boolean} rotateWithView If the image should get rotated with the view.\n * @property {number} rotation Rotation.\n * @property {number|import(\"../size.js\").Size} scale Scale.\n * @property {Array} displacement Displacement.\n * @property {import('../style/Style.js').DeclutterMode} declutterMode Declutter mode: `declutter`, `obstacle`, `none`.\n */\n\n/**\n * @classdesc\n * A base class used for creating subclasses and not instantiated in\n * apps. Base class for {@link module:ol/style/Icon~Icon}, {@link module:ol/style/Circle~CircleStyle} and\n * {@link module:ol/style/RegularShape~RegularShape}.\n * @abstract\n * @api\n */\nclass ImageStyle {\n /**\n * @param {Options} options Options.\n */\n constructor(options) {\n /**\n * @private\n * @type {number}\n */\n this.opacity_ = options.opacity;\n\n /**\n * @private\n * @type {boolean}\n */\n this.rotateWithView_ = options.rotateWithView;\n\n /**\n * @private\n * @type {number}\n */\n this.rotation_ = options.rotation;\n\n /**\n * @private\n * @type {number|import(\"../size.js\").Size}\n */\n this.scale_ = options.scale;\n\n /**\n * @private\n * @type {import(\"../size.js\").Size}\n */\n this.scaleArray_ = toSize(options.scale);\n\n /**\n * @private\n * @type {Array}\n */\n this.displacement_ = options.displacement;\n\n /**\n * @private\n * @type {import('../style/Style.js').DeclutterMode}\n */\n this.declutterMode_ = options.declutterMode;\n }\n\n /**\n * Clones the style.\n * @return {ImageStyle} The cloned style.\n * @api\n */\n clone() {\n const scale = this.getScale();\n return new ImageStyle({\n opacity: this.getOpacity(),\n scale: Array.isArray(scale) ? scale.slice() : scale,\n rotation: this.getRotation(),\n rotateWithView: this.getRotateWithView(),\n displacement: this.getDisplacement().slice(),\n declutterMode: this.getDeclutterMode(),\n });\n }\n\n /**\n * Get the symbolizer opacity.\n * @return {number} Opacity.\n * @api\n */\n getOpacity() {\n return this.opacity_;\n }\n\n /**\n * Determine whether the symbolizer rotates with the map.\n * @return {boolean} Rotate with map.\n * @api\n */\n getRotateWithView() {\n return this.rotateWithView_;\n }\n\n /**\n * Get the symoblizer rotation.\n * @return {number} Rotation.\n * @api\n */\n getRotation() {\n return this.rotation_;\n }\n\n /**\n * Get the symbolizer scale.\n * @return {number|import(\"../size.js\").Size} Scale.\n * @api\n */\n getScale() {\n return this.scale_;\n }\n\n /**\n * Get the symbolizer scale array.\n * @return {import(\"../size.js\").Size} Scale array.\n */\n getScaleArray() {\n return this.scaleArray_;\n }\n\n /**\n * Get the displacement of the shape\n * @return {Array} Shape's center displacement\n * @api\n */\n getDisplacement() {\n return this.displacement_;\n }\n\n /**\n * Get the declutter mode of the shape\n * @return {import(\"./Style.js\").DeclutterMode} Shape's declutter mode\n * @api\n */\n getDeclutterMode() {\n return this.declutterMode_;\n }\n\n /**\n * Get the anchor point in pixels. The anchor determines the center point for the\n * symbolizer.\n * @abstract\n * @return {Array} Anchor.\n */\n getAnchor() {\n return abstract();\n }\n\n /**\n * Get the image element for the symbolizer.\n * @abstract\n * @param {number} pixelRatio Pixel ratio.\n * @return {import('../DataTile.js').ImageLike} Image element.\n */\n getImage(pixelRatio) {\n return abstract();\n }\n\n /**\n * @abstract\n * @return {import('../DataTile.js').ImageLike} Image element.\n */\n getHitDetectionImage() {\n return abstract();\n }\n\n /**\n * Get the image pixel ratio.\n * @param {number} pixelRatio Pixel ratio.\n * @return {number} Pixel ratio.\n */\n getPixelRatio(pixelRatio) {\n return 1;\n }\n\n /**\n * @abstract\n * @return {import(\"../ImageState.js\").default} Image state.\n */\n getImageState() {\n return abstract();\n }\n\n /**\n * @abstract\n * @return {import(\"../size.js\").Size} Image size.\n */\n getImageSize() {\n return abstract();\n }\n\n /**\n * Get the origin of the symbolizer.\n * @abstract\n * @return {Array} Origin.\n */\n getOrigin() {\n return abstract();\n }\n\n /**\n * Get the size of the symbolizer (in pixels).\n * @abstract\n * @return {import(\"../size.js\").Size} Size.\n */\n getSize() {\n return abstract();\n }\n\n /**\n * Set the displacement.\n *\n * @param {Array} displacement Displacement.\n * @api\n */\n setDisplacement(displacement) {\n this.displacement_ = displacement;\n }\n\n /**\n * Set the opacity.\n *\n * @param {number} opacity Opacity.\n * @api\n */\n setOpacity(opacity) {\n this.opacity_ = opacity;\n }\n\n /**\n * Set whether to rotate the style with the view.\n *\n * @param {boolean} rotateWithView Rotate with map.\n * @api\n */\n setRotateWithView(rotateWithView) {\n this.rotateWithView_ = rotateWithView;\n }\n\n /**\n * Set the rotation.\n *\n * @param {number} rotation Rotation.\n * @api\n */\n setRotation(rotation) {\n this.rotation_ = rotation;\n }\n\n /**\n * Set the scale.\n *\n * @param {number|import(\"../size.js\").Size} scale Scale.\n * @api\n */\n setScale(scale) {\n this.scale_ = scale;\n this.scaleArray_ = toSize(scale);\n }\n\n /**\n * @abstract\n * @param {function(import(\"../events/Event.js\").default): void} listener Listener function.\n */\n listenImageChange(listener) {\n abstract();\n }\n\n /**\n * Load not yet loaded URI.\n * @abstract\n */\n load() {\n abstract();\n }\n\n /**\n * @abstract\n * @param {function(import(\"../events/Event.js\").default): void} listener Listener function.\n */\n unlistenImageChange(listener) {\n abstract();\n }\n\n /**\n * @return {Promise} `false` or Promise that resolves when the style is ready to use.\n */\n ready() {\n return Promise.resolve();\n }\n}\n\nexport default ImageStyle;\n","/**\n * @module ol/style/RegularShape\n */\n\nimport ImageState from '../ImageState.js';\nimport {asArray} from '../color.js';\nimport {asColorLike} from '../colorlike.js';\nimport {createCanvasContext2D} from '../dom.js';\nimport {\n defaultFillStyle,\n defaultLineCap,\n defaultLineJoin,\n defaultLineWidth,\n defaultMiterLimit,\n defaultStrokeStyle,\n} from '../render/canvas.js';\nimport IconImage from './IconImage.js';\nimport {shared as iconImageCache} from './IconImageCache.js';\nimport ImageStyle from './Image.js';\n\n/**\n * Specify radius for regular polygons, or both radius and radius2 for stars.\n * @typedef {Object} Options\n * @property {import(\"./Fill.js\").default} [fill] Fill style.\n * @property {number} points Number of points for stars and regular polygons. In case of a polygon, the number of points\n * is the number of sides.\n * @property {number} radius Radius of a regular polygon.\n * @property {number} [radius2] Second radius to make a star instead of a regular polygon.\n * @property {number} [angle=0] Shape's angle in radians. A value of 0 will have one of the shape's points facing up.\n * @property {Array} [displacement=[0, 0]] Displacement of the shape in pixels.\n * Positive values will shift the shape right and up.\n * @property {import(\"./Stroke.js\").default} [stroke] Stroke style.\n * @property {number} [rotation=0] Rotation in radians (positive rotation clockwise).\n * @property {boolean} [rotateWithView=false] Whether to rotate the shape with the view.\n * @property {number|import(\"../size.js\").Size} [scale=1] Scale. Unless two dimensional scaling is required a better\n * result may be obtained with appropriate settings for `radius` and `radius2`.\n * @property {import('./Style.js').DeclutterMode} [declutterMode] Declutter mode.\n */\n\n/**\n * @typedef {Object} RenderOptions\n * @property {import(\"../colorlike.js\").ColorLike|undefined} strokeStyle StrokeStyle.\n * @property {number} strokeWidth StrokeWidth.\n * @property {number} size Size.\n * @property {CanvasLineCap} lineCap LineCap.\n * @property {Array|null} lineDash LineDash.\n * @property {number} lineDashOffset LineDashOffset.\n * @property {CanvasLineJoin} lineJoin LineJoin.\n * @property {number} miterLimit MiterLimit.\n */\n\n/**\n * @classdesc\n * Set regular shape style for vector features. The resulting shape will be\n * a regular polygon when `radius` is provided, or a star when both `radius` and\n * `radius2` are provided.\n * @api\n */\nclass RegularShape extends ImageStyle {\n /**\n * @param {Options} options Options.\n */\n constructor(options) {\n super({\n opacity: 1,\n rotateWithView:\n options.rotateWithView !== undefined ? options.rotateWithView : false,\n rotation: options.rotation !== undefined ? options.rotation : 0,\n scale: options.scale !== undefined ? options.scale : 1,\n displacement:\n options.displacement !== undefined ? options.displacement : [0, 0],\n declutterMode: options.declutterMode,\n });\n\n /**\n * @private\n * @type {HTMLCanvasElement|OffscreenCanvas|null}\n */\n this.hitDetectionCanvas_ = null;\n\n /**\n * @private\n * @type {import(\"./Fill.js\").default|null}\n */\n this.fill_ = options.fill !== undefined ? options.fill : null;\n\n /**\n * @private\n * @type {Array}\n */\n this.origin_ = [0, 0];\n\n /**\n * @private\n * @type {number}\n */\n this.points_ = options.points;\n\n /**\n * @protected\n * @type {number}\n */\n this.radius = options.radius;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.radius2_ = options.radius2;\n\n /**\n * @private\n * @type {number}\n */\n this.angle_ = options.angle !== undefined ? options.angle : 0;\n\n /**\n * @private\n * @type {import(\"./Stroke.js\").default|null}\n */\n this.stroke_ = options.stroke !== undefined ? options.stroke : null;\n\n /**\n * @private\n * @type {import(\"../size.js\").Size}\n */\n this.size_;\n\n /**\n * @private\n * @type {RenderOptions}\n */\n this.renderOptions_;\n\n /**\n * @private\n */\n this.imageState_ =\n this.fill_ && this.fill_.loading()\n ? ImageState.LOADING\n : ImageState.LOADED;\n if (this.imageState_ === ImageState.LOADING) {\n this.ready().then(() => (this.imageState_ = ImageState.LOADED));\n }\n this.render();\n }\n\n /**\n * Clones the style.\n * @return {RegularShape} The cloned style.\n * @api\n * @override\n */\n clone() {\n const scale = this.getScale();\n const style = new RegularShape({\n fill: this.getFill() ? this.getFill().clone() : undefined,\n points: this.getPoints(),\n radius: this.getRadius(),\n radius2: this.getRadius2(),\n angle: this.getAngle(),\n stroke: this.getStroke() ? this.getStroke().clone() : undefined,\n rotation: this.getRotation(),\n rotateWithView: this.getRotateWithView(),\n scale: Array.isArray(scale) ? scale.slice() : scale,\n displacement: this.getDisplacement().slice(),\n declutterMode: this.getDeclutterMode(),\n });\n style.setOpacity(this.getOpacity());\n return style;\n }\n\n /**\n * Get the anchor point in pixels. The anchor determines the center point for the\n * symbolizer.\n * @return {Array} Anchor.\n * @api\n * @override\n */\n getAnchor() {\n const size = this.size_;\n const displacement = this.getDisplacement();\n const scale = this.getScaleArray();\n // anchor is scaled by renderer but displacement should not be scaled\n // so divide by scale here\n return [\n size[0] / 2 - displacement[0] / scale[0],\n size[1] / 2 + displacement[1] / scale[1],\n ];\n }\n\n /**\n * Get the angle used in generating the shape.\n * @return {number} Shape's rotation in radians.\n * @api\n */\n getAngle() {\n return this.angle_;\n }\n\n /**\n * Get the fill style for the shape.\n * @return {import(\"./Fill.js\").default|null} Fill style.\n * @api\n */\n getFill() {\n return this.fill_;\n }\n\n /**\n * Set the fill style.\n * @param {import(\"./Fill.js\").default|null} fill Fill style.\n * @api\n */\n setFill(fill) {\n this.fill_ = fill;\n this.render();\n }\n\n /**\n * @return {HTMLCanvasElement|OffscreenCanvas} Image element.\n * @override\n */\n getHitDetectionImage() {\n if (!this.hitDetectionCanvas_) {\n this.hitDetectionCanvas_ = this.createHitDetectionCanvas_(\n this.renderOptions_,\n );\n }\n return this.hitDetectionCanvas_;\n }\n\n /**\n * Get the image icon.\n * @param {number} pixelRatio Pixel ratio.\n * @return {HTMLCanvasElement|OffscreenCanvas} Image or Canvas element.\n * @api\n * @override\n */\n getImage(pixelRatio) {\n const fillKey = this.fill_?.getKey();\n const cacheKey =\n `${pixelRatio},${this.angle_},${this.radius},${this.radius2_},${this.points_},${fillKey}` +\n Object.values(this.renderOptions_).join(',');\n let image = /** @type {HTMLCanvasElement|OffscreenCanvas} */ (\n iconImageCache.get(cacheKey, null)?.getImage(1)\n );\n if (!image) {\n const renderOptions = this.renderOptions_;\n const size = Math.ceil(renderOptions.size * pixelRatio);\n const context = createCanvasContext2D(size, size);\n this.draw_(renderOptions, context, pixelRatio);\n\n image = context.canvas;\n const iconImage = new IconImage(\n image,\n undefined,\n null,\n ImageState.LOADED,\n null,\n );\n iconImageCache.set(cacheKey, null, iconImage);\n // Update the image in place to an ImageBitmap for better performance and lower memory usage\n createImageBitmap(image).then((imageBitmap) => {\n iconImage.setImage(imageBitmap);\n });\n }\n return image;\n }\n\n /**\n * Get the image pixel ratio.\n * @param {number} pixelRatio Pixel ratio.\n * @return {number} Pixel ratio.\n * @override\n */\n getPixelRatio(pixelRatio) {\n return pixelRatio;\n }\n\n /**\n * @return {import(\"../size.js\").Size} Image size.\n * @override\n */\n getImageSize() {\n return this.size_;\n }\n\n /**\n * @return {import(\"../ImageState.js\").default} Image state.\n * @override\n */\n getImageState() {\n return this.imageState_;\n }\n\n /**\n * Get the origin of the symbolizer.\n * @return {Array} Origin.\n * @api\n * @override\n */\n getOrigin() {\n return this.origin_;\n }\n\n /**\n * Get the number of points for generating the shape.\n * @return {number} Number of points for stars and regular polygons.\n * @api\n */\n getPoints() {\n return this.points_;\n }\n\n /**\n * Get the (primary) radius for the shape.\n * @return {number} Radius.\n * @api\n */\n getRadius() {\n return this.radius;\n }\n\n /**\n * Set the (primary) radius for the shape.\n * @param {number} radius Radius.\n * @api\n */\n setRadius(radius) {\n if (this.radius === radius) {\n return;\n }\n this.radius = radius;\n this.render();\n }\n\n /**\n * Get the secondary radius for the shape.\n * @return {number|undefined} Radius2.\n * @api\n */\n getRadius2() {\n return this.radius2_;\n }\n\n /**\n * Set the secondary radius for the shape.\n * @param {number|undefined} radius2 Radius2.\n * @api\n */\n setRadius2(radius2) {\n if (this.radius2_ === radius2) {\n return;\n }\n this.radius2_ = radius2;\n this.render();\n }\n\n /**\n * Get the size of the symbolizer (in pixels).\n * @return {import(\"../size.js\").Size} Size.\n * @api\n * @override\n */\n getSize() {\n return this.size_;\n }\n\n /**\n * Get the stroke style for the shape.\n * @return {import(\"./Stroke.js\").default|null} Stroke style.\n * @api\n */\n getStroke() {\n return this.stroke_;\n }\n\n /**\n * Set the stroke style.\n * @param {import(\"./Stroke.js\").default|null} stroke Stroke style.\n * @api\n */\n setStroke(stroke) {\n this.stroke_ = stroke;\n this.render();\n }\n\n /**\n * @param {function(import(\"../events/Event.js\").default): void} listener Listener function.\n * @override\n */\n listenImageChange(listener) {}\n\n /**\n * Load not yet loaded URI.\n * @override\n */\n load() {}\n\n /**\n * @param {function(import(\"../events/Event.js\").default): void} listener Listener function.\n * @override\n */\n unlistenImageChange(listener) {}\n\n /**\n * Calculate additional canvas size needed for the miter.\n * @param {string} lineJoin Line join\n * @param {number} strokeWidth Stroke width\n * @param {number} miterLimit Miter limit\n * @return {number} Additional canvas size needed\n * @private\n */\n calculateLineJoinSize_(lineJoin, strokeWidth, miterLimit) {\n if (\n strokeWidth === 0 ||\n this.points_ === Infinity ||\n (lineJoin !== 'bevel' && lineJoin !== 'miter')\n ) {\n return strokeWidth;\n }\n // m | ^\n // i | |\\ .\n // t >| #\\\n // e | |\\ \\ .\n // r \\s\\\n // | \\t\\ . .\n // \\r\\ . .\n // | \\o\\ . . . . .\n // e \\k\\ . . . .\n // | \\e\\ . . . . .\n // d \\ \\ . . . .\n // | _ _a_ _\\# . . .\n // r1 / ` . .\n // | . .\n // b / . .\n // | . .\n // / r2 . .\n // | . .\n // / . .\n // |α . .\n // / . .\n // ° center\n let r1 = this.radius;\n let r2 = this.radius2_ === undefined ? r1 : this.radius2_;\n if (r1 < r2) {\n const tmp = r1;\n r1 = r2;\n r2 = tmp;\n }\n const points =\n this.radius2_ === undefined ? this.points_ : this.points_ * 2;\n const alpha = (2 * Math.PI) / points;\n const a = r2 * Math.sin(alpha);\n const b = Math.sqrt(r2 * r2 - a * a);\n const d = r1 - b;\n const e = Math.sqrt(a * a + d * d);\n const miterRatio = e / a;\n if (lineJoin === 'miter' && miterRatio <= miterLimit) {\n return miterRatio * strokeWidth;\n }\n // Calculate the distance from center to the stroke corner where\n // it was cut short because of the miter limit.\n // l\n // ----+---- <= distance from center to here is maxr\n // /####|k ##\\\n // /#####^#####\\\n // /#### /+\\# s #\\\n // /### h/+++\\# t #\\\n // /### t/+++++\\# r #\\\n // /### a/+++++++\\# o #\\\n // /### p/++ fill +\\# k #\\\n ///#### /+++++^+++++\\# e #\\\n //#####/+++++/+\\+++++\\#####\\\n const k = strokeWidth / 2 / miterRatio;\n const l = (strokeWidth / 2) * (d / e);\n const maxr = Math.sqrt((r1 + k) * (r1 + k) + l * l);\n const bevelAdd = maxr - r1;\n if (this.radius2_ === undefined || lineJoin === 'bevel') {\n return bevelAdd * 2;\n }\n // If outer miter is over the miter limit the inner miter may reach through the\n // center and be longer than the bevel, same calculation as above but swap r1 / r2.\n const aa = r1 * Math.sin(alpha);\n const bb = Math.sqrt(r1 * r1 - aa * aa);\n const dd = r2 - bb;\n const ee = Math.sqrt(aa * aa + dd * dd);\n const innerMiterRatio = ee / aa;\n if (innerMiterRatio <= miterLimit) {\n const innerLength = (innerMiterRatio * strokeWidth) / 2 - r2 - r1;\n return 2 * Math.max(bevelAdd, innerLength);\n }\n return bevelAdd * 2;\n }\n\n /**\n * @return {RenderOptions} The render options\n * @protected\n */\n createRenderOptions() {\n let lineCap = defaultLineCap;\n let lineJoin = defaultLineJoin;\n let miterLimit = 0;\n let lineDash = null;\n let lineDashOffset = 0;\n let strokeStyle;\n let strokeWidth = 0;\n\n if (this.stroke_) {\n strokeStyle = asColorLike(this.stroke_.getColor() ?? defaultStrokeStyle);\n strokeWidth = this.stroke_.getWidth() ?? defaultLineWidth;\n lineDash = this.stroke_.getLineDash();\n lineDashOffset = this.stroke_.getLineDashOffset() ?? 0;\n lineJoin = this.stroke_.getLineJoin() ?? defaultLineJoin;\n lineCap = this.stroke_.getLineCap() ?? defaultLineCap;\n miterLimit = this.stroke_.getMiterLimit() ?? defaultMiterLimit;\n }\n\n const add = this.calculateLineJoinSize_(lineJoin, strokeWidth, miterLimit);\n const maxRadius = Math.max(this.radius, this.radius2_ || 0);\n const size = Math.ceil(2 * maxRadius + add);\n\n return {\n strokeStyle: strokeStyle,\n strokeWidth: strokeWidth,\n size: size,\n lineCap: lineCap,\n lineDash: lineDash,\n lineDashOffset: lineDashOffset,\n lineJoin: lineJoin,\n miterLimit: miterLimit,\n };\n }\n\n /**\n * @protected\n */\n render() {\n this.renderOptions_ = this.createRenderOptions();\n const size = this.renderOptions_.size;\n this.hitDetectionCanvas_ = null;\n this.size_ = [size, size];\n }\n\n /**\n * @private\n * @param {RenderOptions} renderOptions Render options.\n * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} context The rendering context.\n * @param {number} pixelRatio The pixel ratio.\n */\n draw_(renderOptions, context, pixelRatio) {\n context.scale(pixelRatio, pixelRatio);\n // set origin to canvas center\n context.translate(renderOptions.size / 2, renderOptions.size / 2);\n\n this.createPath_(context);\n\n if (this.fill_) {\n let color = this.fill_.getColor();\n if (color === null) {\n color = defaultFillStyle;\n }\n context.fillStyle = asColorLike(color);\n context.fill();\n }\n if (renderOptions.strokeStyle) {\n context.strokeStyle = renderOptions.strokeStyle;\n context.lineWidth = renderOptions.strokeWidth;\n if (renderOptions.lineDash) {\n context.setLineDash(renderOptions.lineDash);\n context.lineDashOffset = renderOptions.lineDashOffset;\n }\n context.lineCap = renderOptions.lineCap;\n context.lineJoin = renderOptions.lineJoin;\n context.miterLimit = renderOptions.miterLimit;\n context.stroke();\n }\n }\n\n /**\n * @private\n * @param {RenderOptions} renderOptions Render options.\n * @return {HTMLCanvasElement|OffscreenCanvas} Canvas containing the icon\n */\n createHitDetectionCanvas_(renderOptions) {\n let context;\n if (this.fill_) {\n let color = this.fill_.getColor();\n\n // determine if fill is transparent (or pattern or gradient)\n let opacity = 0;\n if (typeof color === 'string') {\n color = asArray(color);\n }\n if (color === null) {\n opacity = 1;\n } else if (Array.isArray(color)) {\n opacity = color.length === 4 ? color[3] : 1;\n }\n if (opacity === 0) {\n // if a transparent fill style is set, create an extra hit-detection image\n // with a default fill style\n context = createCanvasContext2D(renderOptions.size, renderOptions.size);\n this.drawHitDetectionCanvas_(renderOptions, context);\n }\n }\n return context ? context.canvas : this.getImage(1);\n }\n\n /**\n * @private\n * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} context The context to draw in.\n */\n createPath_(context) {\n let points = this.points_;\n const radius = this.radius;\n if (points === Infinity) {\n context.arc(0, 0, radius, 0, 2 * Math.PI);\n } else {\n const radius2 = this.radius2_ === undefined ? radius : this.radius2_;\n if (this.radius2_ !== undefined) {\n points *= 2;\n }\n const startAngle = this.angle_ - Math.PI / 2;\n const step = (2 * Math.PI) / points;\n for (let i = 0; i < points; i++) {\n const angle0 = startAngle + i * step;\n const radiusC = i % 2 === 0 ? radius : radius2;\n context.lineTo(radiusC * Math.cos(angle0), radiusC * Math.sin(angle0));\n }\n context.closePath();\n }\n }\n\n /**\n * @private\n * @param {RenderOptions} renderOptions Render options.\n * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} context The context.\n */\n drawHitDetectionCanvas_(renderOptions, context) {\n // set origin to canvas center\n context.translate(renderOptions.size / 2, renderOptions.size / 2);\n\n this.createPath_(context);\n\n context.fillStyle = defaultFillStyle;\n context.fill();\n if (renderOptions.strokeStyle) {\n context.strokeStyle = renderOptions.strokeStyle;\n context.lineWidth = renderOptions.strokeWidth;\n if (renderOptions.lineDash) {\n context.setLineDash(renderOptions.lineDash);\n context.lineDashOffset = renderOptions.lineDashOffset;\n }\n context.lineJoin = renderOptions.lineJoin;\n context.miterLimit = renderOptions.miterLimit;\n context.stroke();\n }\n }\n\n /**\n * @override\n */\n ready() {\n return this.fill_ ? this.fill_.ready() : Promise.resolve();\n }\n}\n\nexport default RegularShape;\n","/**\n * @module ol/style/Circle\n */\n\nimport RegularShape from './RegularShape.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"./Fill.js\").default} [fill] Fill style.\n * @property {number} radius Circle radius.\n * @property {import(\"./Stroke.js\").default} [stroke] Stroke style.\n * @property {Array} [displacement=[0,0]] displacement\n * @property {number|import(\"../size.js\").Size} [scale=1] Scale. A two dimensional scale will produce an ellipse.\n * Unless two dimensional scaling is required a better result may be obtained with an appropriate setting for `radius`.\n * @property {number} [rotation=0] Rotation in radians\n * (positive rotation clockwise, meaningful only when used in conjunction with a two dimensional scale).\n * @property {boolean} [rotateWithView=false] Whether to rotate the shape with the view\n * (meaningful only when used in conjunction with a two dimensional scale).\n * @property {import('./Style.js').DeclutterMode} [declutterMode] Declutter mode\n */\n\n/**\n * @classdesc\n * Set circle style for vector features.\n * @api\n */\nclass CircleStyle extends RegularShape {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {radius: 5};\n\n super({\n points: Infinity,\n fill: options.fill,\n radius: options.radius,\n stroke: options.stroke,\n scale: options.scale !== undefined ? options.scale : 1,\n rotation: options.rotation !== undefined ? options.rotation : 0,\n rotateWithView:\n options.rotateWithView !== undefined ? options.rotateWithView : false,\n displacement:\n options.displacement !== undefined ? options.displacement : [0, 0],\n declutterMode: options.declutterMode,\n });\n }\n\n /**\n * Clones the style.\n * @return {CircleStyle} The cloned style.\n * @api\n * @override\n */\n clone() {\n const scale = this.getScale();\n const style = new CircleStyle({\n fill: this.getFill() ? this.getFill().clone() : undefined,\n stroke: this.getStroke() ? this.getStroke().clone() : undefined,\n radius: this.getRadius(),\n scale: Array.isArray(scale) ? scale.slice() : scale,\n rotation: this.getRotation(),\n rotateWithView: this.getRotateWithView(),\n displacement: this.getDisplacement().slice(),\n declutterMode: this.getDeclutterMode(),\n });\n style.setOpacity(this.getOpacity());\n return style;\n }\n}\n\nexport default CircleStyle;\n","/**\n * @module ol/style/Fill\n */\n\nimport ImageState from '../ImageState.js';\nimport {asArray} from '../color.js';\nimport {getUid} from '../util.js';\nimport {get as getIconImage} from './IconImage.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../color.js\").Color|import(\"../colorlike.js\").ColorLike|import('../colorlike.js').PatternDescriptor|null} [color=null] A color,\n * gradient or pattern.\n * See {@link module:ol/color~Color} and {@link module:ol/colorlike~ColorLike} for possible formats. For polygon fills (not for {@link import(\"./RegularShape.js\").default} fills),\n * a pattern can also be provided as {@link module:ol/colorlike~PatternDescriptor}.\n * Default null; if null, the Canvas/renderer default black will be used.\n */\n\n/**\n * @classdesc\n * Set fill style for vector features.\n * @api\n */\nclass Fill {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options || {};\n\n /**\n * @private\n * @type {import(\"./IconImage.js\").default|null}\n */\n this.patternImage_ = null;\n\n /**\n * @private\n * @type {import(\"../color.js\").Color|import(\"../colorlike.js\").ColorLike|import('../colorlike.js').PatternDescriptor|null}\n */\n this.color_ = null;\n if (options.color !== undefined) {\n this.setColor(options.color);\n }\n }\n\n /**\n * Clones the style. The color is not cloned if it is a {@link module:ol/colorlike~ColorLike}.\n * @return {Fill} The cloned style.\n * @api\n */\n clone() {\n const color = this.getColor();\n return new Fill({\n color: Array.isArray(color) ? color.slice() : color || undefined,\n });\n }\n\n /**\n * Get the fill color.\n * @return {import(\"../color.js\").Color|import(\"../colorlike.js\").ColorLike|import('../colorlike.js').PatternDescriptor|null} Color.\n * @api\n */\n getColor() {\n return this.color_;\n }\n\n /**\n * Set the color.\n *\n * @param {import(\"../color.js\").Color|import(\"../colorlike.js\").ColorLike|import('../colorlike.js').PatternDescriptor|null} color Color.\n * @api\n */\n setColor(color) {\n if (color !== null && typeof color === 'object' && 'src' in color) {\n const patternImage = getIconImage(\n null,\n color.src,\n {crossOrigin: 'anonymous'},\n undefined,\n color.offset ? null : color.color ? color.color : null,\n !(color.offset && color.size),\n );\n patternImage.ready().then(() => {\n this.patternImage_ = null;\n });\n if (patternImage.getImageState() === ImageState.IDLE) {\n patternImage.load();\n }\n if (patternImage.getImageState() === ImageState.LOADING) {\n this.patternImage_ = patternImage;\n }\n }\n this.color_ = color;\n }\n\n /**\n * @return {string} Key of the fill for cache lookup.\n */\n getKey() {\n const fill = this.getColor();\n if (!fill) {\n return '';\n }\n return fill instanceof CanvasPattern || fill instanceof CanvasGradient\n ? getUid(fill)\n : typeof fill === 'object' && 'src' in fill\n ? fill.src + ':' + fill.offset\n : asArray(fill).toString();\n }\n\n /**\n * @return {boolean} The fill style is loading an image pattern.\n */\n loading() {\n return !!this.patternImage_;\n }\n\n /**\n * @return {Promise} `false` or a promise that resolves when the style is ready to use.\n */\n ready() {\n return this.patternImage_ ? this.patternImage_.ready() : Promise.resolve();\n }\n}\n\nexport default Fill;\n","/**\n * @module ol/style/Icon\n */\nimport ImageState from '../ImageState.js';\nimport {assert} from '../asserts.js';\nimport {asArray} from '../color.js';\nimport EventType from '../events/EventType.js';\nimport {getUid} from '../util.js';\nimport {get as getIconImage} from './IconImage.js';\nimport ImageStyle from './Image.js';\n\n/**\n * @typedef {'fraction' | 'pixels'} IconAnchorUnits\n * Anchor unit can be either a fraction of the icon size or in pixels.\n */\n\n/**\n * @typedef {'bottom-left' | 'bottom-right' | 'top-left' | 'top-right'} IconOrigin\n * Icon origin. One of 'bottom-left', 'bottom-right', 'top-left', 'top-right'.\n */\n\n/**\n * @typedef {Object} Options\n * @property {Array} [anchor=[0.5, 0.5]] Anchor. Default value is the icon center.\n * @property {IconOrigin} [anchorOrigin='top-left'] Origin of the anchor: `bottom-left`, `bottom-right`,\n * `top-left` or `top-right`.\n * @property {IconAnchorUnits} [anchorXUnits='fraction'] Units in which the anchor x value is\n * specified. A value of `'fraction'` indicates the x value is a fraction of the icon. A value of `'pixels'` indicates\n * the x value in pixels.\n * @property {IconAnchorUnits} [anchorYUnits='fraction'] Units in which the anchor y value is\n * specified. A value of `'fraction'` indicates the y value is a fraction of the icon. A value of `'pixels'` indicates\n * the y value in pixels.\n * @property {import(\"../color.js\").Color|string} [color] Color to tint the icon. If not specified,\n * the icon will be left as is.\n * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that you must provide a\n * `crossOrigin` value if you want to access pixel data with the Canvas renderer.\n * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.\n * @property {ReferrerPolicy} [referrerPolicy] The `referrerPolicy` property for loaded images.\n * @property {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas|ImageBitmap} [img] Image object for the icon.\n * @property {Array} [displacement=[0, 0]] Displacement of the icon in pixels.\n * Positive values will shift the icon right and up.\n * @property {number} [opacity=1] Opacity of the icon.\n * @property {number} [width] The width of the icon in pixels. This can't be used together with `scale`.\n * @property {number} [height] The height of the icon in pixels. This can't be used together with `scale`.\n * @property {number|import(\"../size.js\").Size} [scale=1] Scale.\n * @property {boolean} [rotateWithView=false] Whether to rotate the icon with the view.\n * @property {number} [rotation=0] Rotation in radians (positive rotation clockwise).\n * @property {Array} [offset=[0, 0]] Offset which, together with `size` and `offsetOrigin`, defines the\n * sub-rectangle to use from the original (sprite) image.\n * @property {IconOrigin} [offsetOrigin='top-left'] Origin of the offset: `bottom-left`, `bottom-right`,\n * `top-left` or `top-right`.\n * @property {import(\"../size.js\").Size} [size] Icon size in pixels. Used together with `offset` to define the\n * sub-rectangle to use from the original (sprite) image.\n * @property {string} [src] Image source URI.\n * @property {import(\"./Style.js\").DeclutterMode} [declutterMode] Declutter mode.\n */\n\n/**\n * @param {number} width The width.\n * @param {number} height The height.\n * @param {number|undefined} wantedWidth The wanted width.\n * @param {number|undefined} wantedHeight The wanted height.\n * @return {number|Array} The scale.\n */\nfunction calculateScale(width, height, wantedWidth, wantedHeight) {\n if (wantedWidth !== undefined && wantedHeight !== undefined) {\n return [wantedWidth / width, wantedHeight / height];\n }\n if (wantedWidth !== undefined) {\n return wantedWidth / width;\n }\n if (wantedHeight !== undefined) {\n return wantedHeight / height;\n }\n return 1;\n}\n\n/**\n * @classdesc\n * Set icon style for vector features.\n * @api\n */\nclass Icon extends ImageStyle {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options || {};\n\n /**\n * @type {number}\n */\n const opacity = options.opacity !== undefined ? options.opacity : 1;\n\n /**\n * @type {number}\n */\n const rotation = options.rotation !== undefined ? options.rotation : 0;\n\n /**\n * @type {number|import(\"../size.js\").Size}\n */\n const scale = options.scale !== undefined ? options.scale : 1;\n\n /**\n * @type {boolean}\n */\n const rotateWithView =\n options.rotateWithView !== undefined ? options.rotateWithView : false;\n\n super({\n opacity: opacity,\n rotation: rotation,\n scale: scale,\n displacement:\n options.displacement !== undefined ? options.displacement : [0, 0],\n rotateWithView: rotateWithView,\n declutterMode: options.declutterMode,\n });\n\n /**\n * @private\n * @type {Array}\n */\n this.anchor_ = options.anchor !== undefined ? options.anchor : [0.5, 0.5];\n\n /**\n * @private\n * @type {Array}\n */\n this.normalizedAnchor_ = null;\n\n /**\n * @private\n * @type {IconOrigin}\n */\n this.anchorOrigin_ =\n options.anchorOrigin !== undefined ? options.anchorOrigin : 'top-left';\n\n /**\n * @private\n * @type {IconAnchorUnits}\n */\n this.anchorXUnits_ =\n options.anchorXUnits !== undefined ? options.anchorXUnits : 'fraction';\n\n /**\n * @private\n * @type {IconAnchorUnits}\n */\n this.anchorYUnits_ =\n options.anchorYUnits !== undefined ? options.anchorYUnits : 'fraction';\n\n /**\n * @private\n * @type {?string}\n */\n this.crossOrigin_ =\n options.crossOrigin !== undefined ? options.crossOrigin : null;\n\n /**\n * @private\n * @type {ReferrerPolicy}\n */\n this.referrerPolicy_ = options.referrerPolicy;\n\n const image = options.img !== undefined ? options.img : null;\n\n let cacheKey = options.src;\n\n assert(\n !(cacheKey !== undefined && image),\n '`image` and `src` cannot be provided at the same time',\n );\n\n if ((cacheKey === undefined || cacheKey.length === 0) && image) {\n cacheKey = /** @type {HTMLImageElement} */ (image).src || getUid(image);\n }\n assert(\n cacheKey !== undefined && cacheKey.length > 0,\n 'A defined and non-empty `src` or `image` must be provided',\n );\n\n assert(\n !(\n (options.width !== undefined || options.height !== undefined) &&\n options.scale !== undefined\n ),\n '`width` or `height` cannot be provided together with `scale`',\n );\n\n let imageState;\n if (options.src !== undefined) {\n imageState = ImageState.IDLE;\n } else if (image !== undefined) {\n if ('complete' in image) {\n if (image.complete) {\n imageState = image.src ? ImageState.LOADED : ImageState.IDLE;\n } else {\n imageState = ImageState.LOADING;\n }\n } else {\n imageState = ImageState.LOADED;\n }\n }\n\n /**\n * @private\n * @type {import(\"../color.js\").Color}\n */\n this.color_ = options.color !== undefined ? asArray(options.color) : null;\n\n /**\n * @private\n * @type {import(\"./IconImage.js\").default}\n */\n this.iconImage_ = getIconImage(\n image,\n /** @type {string} */ (cacheKey),\n {\n crossOrigin: this.crossOrigin_,\n referrerPolicy: this.referrerPolicy_,\n },\n imageState,\n this.color_,\n );\n\n /**\n * @private\n * @type {Array}\n */\n this.offset_ = options.offset !== undefined ? options.offset : [0, 0];\n /**\n * @private\n * @type {IconOrigin}\n */\n this.offsetOrigin_ =\n options.offsetOrigin !== undefined ? options.offsetOrigin : 'top-left';\n\n /**\n * @private\n * @type {Array}\n */\n this.origin_ = null;\n\n /**\n * @private\n * @type {import(\"../size.js\").Size}\n */\n this.size_ = options.size !== undefined ? options.size : null;\n\n /**\n * @private\n */\n this.initialOptions_;\n\n /**\n * Calculate the scale if width or height were given.\n */\n if (options.width !== undefined || options.height !== undefined) {\n let width, height;\n if (options.size) {\n [width, height] = options.size;\n } else {\n const image = this.getImage(1);\n if (image.width && image.height) {\n width = image.width;\n height = image.height;\n } else if (image instanceof HTMLImageElement) {\n this.initialOptions_ = options;\n const onload = () => {\n this.unlistenImageChange(onload);\n if (!this.initialOptions_) {\n return;\n }\n const imageSize = this.iconImage_.getSize();\n this.setScale(\n calculateScale(\n imageSize[0],\n imageSize[1],\n options.width,\n options.height,\n ),\n );\n };\n this.listenImageChange(onload);\n return;\n }\n }\n if (width !== undefined) {\n this.setScale(\n calculateScale(width, height, options.width, options.height),\n );\n }\n }\n }\n\n /**\n * Clones the style. The underlying Image/HTMLCanvasElement is not cloned.\n * @return {Icon} The cloned style.\n * @api\n * @override\n */\n clone() {\n let scale, width, height;\n if (this.initialOptions_) {\n width = this.initialOptions_.width;\n height = this.initialOptions_.height;\n } else {\n scale = this.getScale();\n scale = Array.isArray(scale) ? scale.slice() : scale;\n }\n return new Icon({\n anchor: this.anchor_.slice(),\n anchorOrigin: this.anchorOrigin_,\n anchorXUnits: this.anchorXUnits_,\n anchorYUnits: this.anchorYUnits_,\n color:\n this.color_ && this.color_.slice\n ? this.color_.slice()\n : this.color_ || undefined,\n crossOrigin: this.crossOrigin_,\n referrerPolicy: this.referrerPolicy_,\n offset: this.offset_.slice(),\n offsetOrigin: this.offsetOrigin_,\n opacity: this.getOpacity(),\n rotateWithView: this.getRotateWithView(),\n rotation: this.getRotation(),\n scale,\n width,\n height,\n size: this.size_ !== null ? this.size_.slice() : undefined,\n src: this.getSrc(),\n displacement: this.getDisplacement().slice(),\n declutterMode: this.getDeclutterMode(),\n });\n }\n\n /**\n * Get the anchor point in pixels. The anchor determines the center point for the\n * symbolizer.\n * @return {Array} Anchor.\n * @api\n * @override\n */\n getAnchor() {\n let anchor = this.normalizedAnchor_;\n if (!anchor) {\n anchor = this.anchor_;\n const size = this.getSize();\n if (\n this.anchorXUnits_ == 'fraction' ||\n this.anchorYUnits_ == 'fraction'\n ) {\n if (!size) {\n return null;\n }\n anchor = this.anchor_.slice();\n if (this.anchorXUnits_ == 'fraction') {\n anchor[0] *= size[0];\n }\n if (this.anchorYUnits_ == 'fraction') {\n anchor[1] *= size[1];\n }\n }\n\n if (this.anchorOrigin_ != 'top-left') {\n if (!size) {\n return null;\n }\n if (anchor === this.anchor_) {\n anchor = this.anchor_.slice();\n }\n if (\n this.anchorOrigin_ == 'top-right' ||\n this.anchorOrigin_ == 'bottom-right'\n ) {\n anchor[0] = -anchor[0] + size[0];\n }\n if (\n this.anchorOrigin_ == 'bottom-left' ||\n this.anchorOrigin_ == 'bottom-right'\n ) {\n anchor[1] = -anchor[1] + size[1];\n }\n }\n this.normalizedAnchor_ = anchor;\n }\n const displacement = this.getDisplacement();\n const scale = this.getScaleArray();\n // anchor is scaled by renderer but displacement should not be scaled\n // so divide by scale here\n return [\n anchor[0] - displacement[0] / scale[0],\n anchor[1] + displacement[1] / scale[1],\n ];\n }\n\n /**\n * Set the anchor point. The anchor determines the center point for the\n * symbolizer.\n *\n * @param {Array} anchor Anchor.\n * @api\n */\n setAnchor(anchor) {\n this.anchor_ = anchor;\n this.normalizedAnchor_ = null;\n }\n\n /**\n * Get the icon color.\n * @return {import(\"../color.js\").Color} Color.\n * @api\n */\n getColor() {\n return this.color_;\n }\n\n /**\n * Set the icon color.\n *\n * Warning: Repeatedly setting the color on an icon style\n * causes the icon image to be re-created each time. This can have a\n * severe performance impact.\n *\n * @param {import(\"../color.js\").Color|string|null|undefined} color Color.\n */\n setColor(color) {\n const nextColor = color ? asArray(color) : null;\n if (\n this.color_ === nextColor ||\n (this.color_ &&\n nextColor &&\n this.color_.length === nextColor.length &&\n this.color_.every((value, index) => value === nextColor[index]))\n ) {\n // Discard if the color hasn't changed.\n return;\n }\n\n this.color_ = nextColor;\n const src = this.getSrc();\n const image = src !== undefined ? null : this.getHitDetectionImage();\n const imageState =\n src !== undefined ? ImageState.IDLE : this.iconImage_.getImageState();\n this.iconImage_ = getIconImage(\n image,\n src,\n {\n crossOrigin: this.crossOrigin_,\n referrerPolicy: this.referrerPolicy_,\n },\n imageState,\n this.color_,\n );\n }\n\n /**\n * Get the image icon.\n * @param {number} pixelRatio Pixel ratio.\n * @return {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas|ImageBitmap} Image or Canvas element. If the Icon\n * style was configured with `src` or with a not let loaded `img`, an `ImageBitmap` will be returned.\n * @api\n * @override\n */\n getImage(pixelRatio) {\n return this.iconImage_.getImage(pixelRatio);\n }\n\n /**\n * Get the pixel ratio.\n * @param {number} pixelRatio Pixel ratio.\n * @return {number} The pixel ratio of the image.\n * @api\n * @override\n */\n getPixelRatio(pixelRatio) {\n return this.iconImage_.getPixelRatio(pixelRatio);\n }\n\n /**\n * @return {import(\"../size.js\").Size} Image size.\n * @override\n */\n getImageSize() {\n return this.iconImage_.getSize();\n }\n\n /**\n * @return {import(\"../ImageState.js\").default} Image state.\n * @override\n */\n getImageState() {\n return this.iconImage_.getImageState();\n }\n\n /**\n * @return {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas|ImageBitmap} Image element.\n * @override\n */\n getHitDetectionImage() {\n return this.iconImage_.getHitDetectionImage();\n }\n\n /**\n * Get the origin of the symbolizer.\n * @return {Array} Origin.\n * @api\n * @override\n */\n getOrigin() {\n if (this.origin_) {\n return this.origin_;\n }\n let offset = this.offset_;\n\n if (this.offsetOrigin_ != 'top-left') {\n const size = this.getSize();\n const iconImageSize = this.iconImage_.getSize();\n if (!size || !iconImageSize) {\n return null;\n }\n offset = offset.slice();\n if (\n this.offsetOrigin_ == 'top-right' ||\n this.offsetOrigin_ == 'bottom-right'\n ) {\n offset[0] = iconImageSize[0] - size[0] - offset[0];\n }\n if (\n this.offsetOrigin_ == 'bottom-left' ||\n this.offsetOrigin_ == 'bottom-right'\n ) {\n offset[1] = iconImageSize[1] - size[1] - offset[1];\n }\n }\n this.origin_ = offset;\n return this.origin_;\n }\n\n /**\n * Get the image URL.\n * @return {string|undefined} Image src.\n * @api\n */\n getSrc() {\n return this.iconImage_.getSrc();\n }\n\n /**\n * Set the image URI\n * @param {string} src Image source URI\n * @api\n */\n setSrc(src) {\n this.iconImage_ = getIconImage(\n null,\n src,\n {\n crossOrigin: this.crossOrigin_,\n referrerPolicy: this.referrerPolicy_,\n },\n ImageState.IDLE,\n this.color_,\n );\n }\n\n /**\n * Get the size of the icon (in pixels).\n * @return {import(\"../size.js\").Size} Image size.\n * @api\n * @override\n */\n getSize() {\n return !this.size_ ? this.iconImage_.getSize() : this.size_;\n }\n\n /**\n * Get the width of the icon (in pixels). Will return undefined when the icon image is not yet loaded.\n * @return {number} Icon width (in pixels).\n * @api\n */\n getWidth() {\n const scale = this.getScaleArray();\n if (this.size_) {\n return this.size_[0] * scale[0];\n }\n if (this.iconImage_.getImageState() == ImageState.LOADED) {\n return this.iconImage_.getSize()[0] * scale[0];\n }\n return undefined;\n }\n\n /**\n * Get the height of the icon (in pixels). Will return undefined when the icon image is not yet loaded.\n * @return {number} Icon height (in pixels).\n * @api\n */\n getHeight() {\n const scale = this.getScaleArray();\n if (this.size_) {\n return this.size_[1] * scale[1];\n }\n if (this.iconImage_.getImageState() == ImageState.LOADED) {\n return this.iconImage_.getSize()[1] * scale[1];\n }\n return undefined;\n }\n\n /**\n * Set the scale.\n *\n * @param {number|import(\"../size.js\").Size} scale Scale.\n * @api\n * @override\n */\n setScale(scale) {\n delete this.initialOptions_;\n super.setScale(scale);\n }\n\n /**\n * @param {function(import(\"../events/Event.js\").default): void} listener Listener function.\n * @override\n */\n listenImageChange(listener) {\n this.iconImage_.addEventListener(EventType.CHANGE, listener);\n }\n\n /**\n * Load not yet loaded URI.\n * When rendering a feature with an icon style, the vector renderer will\n * automatically call this method. However, you might want to call this\n * method yourself for preloading or other purposes.\n * @api\n * @override\n */\n load() {\n this.iconImage_.load();\n }\n\n /**\n * @param {function(import(\"../events/Event.js\").default): void} listener Listener function.\n * @override\n */\n unlistenImageChange(listener) {\n this.iconImage_.removeEventListener(EventType.CHANGE, listener);\n }\n\n /**\n * @override\n */\n ready() {\n return this.iconImage_.ready();\n }\n}\n\nexport default Icon;\n","/**\n * @module ol/style/Stroke\n */\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../color.js\").Color|import(\"../colorlike.js\").ColorLike} [color] A color, gradient or pattern.\n * See {@link module:ol/color~Color} and {@link module:ol/colorlike~ColorLike} for possible formats.\n * Default null; if null, the Canvas/renderer default black will be used.\n * @property {CanvasLineCap} [lineCap='round'] Line cap style: `butt`, `round`, or `square`.\n * @property {CanvasLineJoin} [lineJoin='round'] Line join style: `bevel`, `round`, or `miter`.\n * @property {Array} [lineDash] Line dash pattern. Default is `null` (no dash).\n * @property {number} [lineDashOffset=0] Line dash offset.\n * @property {number} [miterLimit=10] Miter limit.\n * @property {number} [offset] Line offset in pixels along the normal. A positive value offsets the line to the right,\n * relative to the direction of the line. Default is `null` (no offset).\n * @property {number} [width] Width.\n */\n\n/**\n * @classdesc\n * Set stroke style for vector features.\n * Note that the defaults given are the Canvas defaults, which will be used if\n * option is not defined. The `get` functions return whatever was entered in\n * the options; they will not return the default.\n * @api\n */\nclass Stroke {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options || {};\n\n /**\n * @private\n * @type {import(\"../color.js\").Color|import(\"../colorlike.js\").ColorLike}\n */\n this.color_ = options.color !== undefined ? options.color : null;\n\n /**\n * @private\n * @type {CanvasLineCap|undefined}\n */\n this.lineCap_ = options.lineCap;\n\n /**\n * @private\n * @type {Array|null}\n */\n this.lineDash_ = options.lineDash !== undefined ? options.lineDash : null;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.lineDashOffset_ = options.lineDashOffset;\n\n /**\n * @private\n * @type {CanvasLineJoin|undefined}\n */\n this.lineJoin_ = options.lineJoin;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.miterLimit_ = options.miterLimit;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.offset_ = options.offset;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.width_ = options.width;\n }\n\n /**\n * Clones the style.\n * @return {Stroke} The cloned style.\n * @api\n */\n clone() {\n const color = this.getColor();\n return new Stroke({\n color: Array.isArray(color) ? color.slice() : color || undefined,\n lineCap: this.getLineCap(),\n lineDash: this.getLineDash() ? this.getLineDash().slice() : undefined,\n lineDashOffset: this.getLineDashOffset(),\n lineJoin: this.getLineJoin(),\n miterLimit: this.getMiterLimit(),\n offset: this.getOffset(),\n width: this.getWidth(),\n });\n }\n\n /**\n * Get the stroke color.\n * @return {import(\"../color.js\").Color|import(\"../colorlike.js\").ColorLike} Color.\n * @api\n */\n getColor() {\n return this.color_;\n }\n\n /**\n * Get the line cap type for the stroke.\n * @return {CanvasLineCap|undefined} Line cap.\n * @api\n */\n getLineCap() {\n return this.lineCap_;\n }\n\n /**\n * Get the line dash style for the stroke.\n * @return {Array|null} Line dash.\n * @api\n */\n getLineDash() {\n return this.lineDash_;\n }\n\n /**\n * Get the line dash offset for the stroke.\n * @return {number|undefined} Line dash offset.\n * @api\n */\n getLineDashOffset() {\n return this.lineDashOffset_;\n }\n\n /**\n * Get the line join type for the stroke.\n * @return {CanvasLineJoin|undefined} Line join.\n * @api\n */\n getLineJoin() {\n return this.lineJoin_;\n }\n\n /**\n * Get the miter limit for the stroke.\n * @return {number|undefined} Miter limit.\n * @api\n */\n getMiterLimit() {\n return this.miterLimit_;\n }\n\n /**\n * Get the line offset in pixels.\n * @return {number|undefined} Offset.\n * @api\n */\n getOffset() {\n return this.offset_;\n }\n\n /**\n * Get the stroke width.\n * @return {number|undefined} Width.\n * @api\n */\n getWidth() {\n return this.width_;\n }\n\n /**\n * Set the color.\n *\n * @param {import(\"../color.js\").Color|import(\"../colorlike.js\").ColorLike} color Color.\n * @api\n */\n setColor(color) {\n this.color_ = color;\n }\n\n /**\n * Set the line cap.\n *\n * @param {CanvasLineCap|undefined} lineCap Line cap.\n * @api\n */\n setLineCap(lineCap) {\n this.lineCap_ = lineCap;\n }\n\n /**\n * Set the line dash.\n *\n * @param {Array|null} lineDash Line dash.\n * @api\n */\n setLineDash(lineDash) {\n this.lineDash_ = lineDash;\n }\n\n /**\n * Set the line dash offset.\n *\n * @param {number|undefined} lineDashOffset Line dash offset.\n * @api\n */\n setLineDashOffset(lineDashOffset) {\n this.lineDashOffset_ = lineDashOffset;\n }\n\n /**\n * Set the line join.\n *\n * @param {CanvasLineJoin|undefined} lineJoin Line join.\n * @api\n */\n setLineJoin(lineJoin) {\n this.lineJoin_ = lineJoin;\n }\n\n /**\n * Set the miter limit.\n *\n * @param {number|undefined} miterLimit Miter limit.\n * @api\n */\n setMiterLimit(miterLimit) {\n this.miterLimit_ = miterLimit;\n }\n\n /**\n * Set the line offset in pixels.\n *\n * @param {number|undefined} offset Offset.\n * @api\n */\n setOffset(offset) {\n this.offset_ = offset;\n }\n\n /**\n * Set the width.\n *\n * @param {number|undefined} width Width.\n * @api\n */\n setWidth(width) {\n this.width_ = width;\n }\n}\n\nexport default Stroke;\n","/**\n * @module ol/style/Style\n */\n\nimport {assert} from '../asserts.js';\nimport CircleStyle from './Circle.js';\nimport Fill from './Fill.js';\nimport Stroke from './Stroke.js';\n\n/**\n * Defines how symbols and text are decluttered on layers ith `declutter` set to `true`\n * **declutter**: Overlapping symbols and text are decluttered.\n * **obstacle**: Symbols and text are rendered, but serve as obstacle for subsequent attempts\n * to place a symbol or text at the same location.\n * **none**: No decluttering is done.\n *\n * @typedef {\"declutter\"|\"obstacle\"|\"none\"} DeclutterMode\n */\n\n/**\n * A function that takes a {@link module:ol/Feature~Feature} and a `{number}`\n * representing the view's resolution. The function should return a\n * {@link module:ol/style/Style~Style} or an array of them. This way e.g. a\n * vector layer can be styled. If the function returns `undefined`, the\n * feature will not be rendered.\n *\n * @typedef {function(import(\"../Feature.js\").FeatureLike, number):(Style|Array