@maptiler/sdk 3.10.0 → 3.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eslint.mjs +133 -0
- package/dist/maptiler-sdk.d.ts +2 -0
- package/dist/maptiler-sdk.mjs +14235 -0
- package/dist/maptiler-sdk.mjs.map +1 -0
- package/dist/src/ColorRamp.d.ts +359 -0
- package/dist/src/ImageViewer/ImageViewer.d.ts +408 -0
- package/dist/src/ImageViewer/ImageViewerMarker.d.ts +236 -0
- package/dist/src/ImageViewer/events.d.ts +47 -0
- package/dist/src/ImageViewer/index.d.ts +5 -0
- package/dist/src/ImageViewer/monkeyPatchML.d.ts +10 -0
- package/dist/src/ImageViewer/symbols.d.ts +2 -0
- package/dist/src/MLAdapters/AttributionControl.d.ts +5 -0
- package/dist/src/MLAdapters/BoxZoomHandler.d.ts +7 -0
- package/dist/src/MLAdapters/CanvasSource.d.ts +5 -0
- package/dist/src/MLAdapters/CooperativeGesturesHandler.d.ts +5 -0
- package/dist/src/MLAdapters/FullscreenControl.d.ts +5 -0
- package/dist/src/MLAdapters/GeoJSONSource.d.ts +5 -0
- package/dist/src/MLAdapters/GeolocateControl.d.ts +5 -0
- package/dist/src/MLAdapters/ImageSource.d.ts +5 -0
- package/dist/src/MLAdapters/KeyboardHandler.d.ts +5 -0
- package/dist/src/MLAdapters/LogoControl.d.ts +5 -0
- package/dist/src/MLAdapters/MapMouseEvent.d.ts +5 -0
- package/dist/src/MLAdapters/MapTouchEvent.d.ts +5 -0
- package/dist/src/MLAdapters/MapWheelEvent.d.ts +5 -0
- package/dist/src/MLAdapters/Marker.d.ts +5 -0
- package/dist/src/MLAdapters/NavigationControl.d.ts +5 -0
- package/dist/src/MLAdapters/Popup.d.ts +5 -0
- package/dist/src/MLAdapters/RasterDEMTileSource.d.ts +5 -0
- package/dist/src/MLAdapters/RasterTileSource.d.ts +5 -0
- package/dist/src/MLAdapters/ScaleControl.d.ts +5 -0
- package/dist/src/MLAdapters/ScrollZoomHandler.d.ts +5 -0
- package/dist/src/MLAdapters/Style.d.ts +5 -0
- package/dist/src/MLAdapters/TerrainControl.d.ts +5 -0
- package/dist/src/MLAdapters/TwoFingersTouchPitchHandler.d.ts +5 -0
- package/dist/src/MLAdapters/VectorTileSource.d.ts +5 -0
- package/dist/src/MLAdapters/VideoSource.d.ts +5 -0
- package/dist/src/Map.d.ts +480 -0
- package/dist/src/Point.d.ts +177 -0
- package/dist/src/Telemetry.d.ts +23 -0
- package/dist/src/caching.d.ts +4 -0
- package/dist/src/config.d.ts +85 -0
- package/dist/src/constants/defaults.d.ts +15 -0
- package/dist/src/controls/ImageViewerFitImageToBoundsControl.d.ts +13 -0
- package/dist/src/controls/MaptilerCustomControl.d.ts +17 -0
- package/dist/src/controls/MaptilerExternalControl.d.ts +25 -0
- package/dist/src/controls/MaptilerGeolocateControl.d.ts +21 -0
- package/dist/src/controls/MaptilerLogoControl.d.ts +19 -0
- package/dist/src/controls/MaptilerNavigationControl.d.ts +17 -0
- package/dist/src/controls/MaptilerProjectionControl.d.ts +15 -0
- package/dist/src/controls/MaptilerTerrainControl.d.ts +17 -0
- package/dist/src/controls/Minimap.d.ts +57 -0
- package/dist/src/controls/index.d.ts +8 -0
- package/dist/src/converters/index.d.ts +1 -0
- package/dist/src/converters/xml.d.ts +54 -0
- package/dist/src/custom-layers/CubemapLayer/CubemapLayer.d.ts +239 -0
- package/dist/src/custom-layers/CubemapLayer/constants.d.ts +3 -0
- package/dist/src/custom-layers/CubemapLayer/index.d.ts +2 -0
- package/dist/src/custom-layers/CubemapLayer/loadCubemapTexture.d.ts +43 -0
- package/dist/src/custom-layers/CubemapLayer/types.d.ts +67 -0
- package/dist/src/custom-layers/RadialGradientLayer/RadialGradientLayer.d.ts +149 -0
- package/dist/src/custom-layers/RadialGradientLayer/index.d.ts +2 -0
- package/dist/src/custom-layers/RadialGradientLayer/types.d.ts +50 -0
- package/dist/src/custom-layers/extractCustomLayerStyle.d.ts +17 -0
- package/dist/src/custom-layers/index.d.ts +6 -0
- package/dist/src/helpers/index.d.ts +5 -0
- package/dist/src/helpers/screenshot.d.ts +18 -0
- package/dist/src/helpers/stylehelper.d.ts +28 -0
- package/dist/src/helpers/vectorlayerhelpers.d.ts +508 -0
- package/dist/src/index.d.ts +100 -0
- package/dist/src/language.d.ts +107 -0
- package/dist/src/mapstyle.d.ts +18 -0
- package/dist/src/ml-types.d.ts +634 -0
- package/dist/src/tools.d.ts +84 -0
- package/dist/src/types.d.ts +1 -0
- package/dist/src/utils/dom.d.ts +2 -0
- package/dist/src/utils/errors.d.ts +5 -0
- package/dist/src/utils/geo-utils.d.ts +6 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/logSDKVersion.d.ts +1 -0
- package/dist/src/utils/math-utils.d.ts +8 -0
- package/dist/src/utils/object.d.ts +1 -0
- package/dist/src/utils/webgl-utils.d.ts +49 -0
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maptiler-sdk.mjs","sources":["../src/MLAdapters/Marker.ts","../src/MLAdapters/Popup.ts","../src/MLAdapters/Style.ts","../src/MLAdapters/CanvasSource.ts","../src/MLAdapters/GeoJSONSource.ts","../src/MLAdapters/ImageSource.ts","../src/MLAdapters/RasterTileSource.ts","../src/MLAdapters/RasterDEMTileSource.ts","../src/MLAdapters/VectorTileSource.ts","../src/MLAdapters/VideoSource.ts","../src/MLAdapters/NavigationControl.ts","../src/MLAdapters/GeolocateControl.ts","../src/MLAdapters/AttributionControl.ts","../src/MLAdapters/LogoControl.ts","../src/MLAdapters/ScaleControl.ts","../src/MLAdapters/FullscreenControl.ts","../src/MLAdapters/TerrainControl.ts","../src/MLAdapters/BoxZoomHandler.ts","../src/MLAdapters/ScrollZoomHandler.ts","../src/MLAdapters/CooperativeGesturesHandler.ts","../src/MLAdapters/KeyboardHandler.ts","../src/MLAdapters/TwoFingersTouchPitchHandler.ts","../src/MLAdapters/MapWheelEvent.ts","../src/MLAdapters/MapTouchEvent.ts","../src/MLAdapters/MapMouseEvent.ts","../src/language.ts","../src/constants/defaults.ts","../src/config.ts","../src/controls/MaptilerLogoControl.ts","../src/caching.ts","../src/tools.ts","../node_modules/@maplibre/maplibre-gl-style-spec/dist/index.mjs","../src/mapstyle.ts","../src/utils/dom.ts","../src/controls/MaptilerTerrainControl.ts","../src/controls/MaptilerNavigationControl.ts","../src/controls/MaptilerGeolocateControl.ts","../src/controls/MaptilerCustomControl.ts","../src/controls/MaptilerProjectionControl.ts","../src/controls/MaptilerExternalControl.ts","../src/controls/Minimap.ts","../src/Telemetry.ts","../node_modules/gl-matrix/esm/common.js","../node_modules/gl-matrix/esm/mat4.js","../node_modules/gl-matrix/esm/vec3.js","../node_modules/color-name/index.js","../node_modules/color-convert/conversions.js","../node_modules/color-convert/route.js","../node_modules/color-convert/index.js","../src/utils/webgl-utils.ts","../src/custom-layers/CubemapLayer/constants.ts","../src/custom-layers/CubemapLayer/cubemap.vert.glsl?raw","../src/custom-layers/CubemapLayer/cubemap.frag.glsl?raw","../src/custom-layers/CubemapLayer/types.ts","../src/custom-layers/CubemapLayer/loadCubemapTexture.ts","../src/utils/math-utils.ts","../src/utils/object.ts","../src/custom-layers/CubemapLayer/CubemapLayer.ts","../src/custom-layers/RadialGradientLayer/radialGradient.vert.glsl?raw","../src/custom-layers/RadialGradientLayer/radialGradient.frag.glsl?raw","../src/custom-layers/RadialGradientLayer/RadialGradientLayer.ts","../src/utils/logSDKVersion.ts","../src/Map.ts","../src/ImageViewer/events.ts","../src/utils/errors.ts","../src/ImageViewer/monkeyPatchML.ts","../src/controls/ImageViewerFitImageToBoundsControl.ts","../src/ImageViewer/symbols.ts","../src/ImageViewer/ImageViewer.ts","../src/ImageViewer/ImageViewerMarker.ts","../src/converters/xml.ts","../src/helpers/screenshot.ts","../src/helpers/stylehelper.ts","../src/ColorRamp.ts","../src/helpers/vectorlayerhelpers.ts","../src/index.ts"],"sourcesContent":["/**\n * This is an extension of MapLibre Marker to make it fully type compatible with the SDK\n */\n\nimport maplibregl from \"maplibre-gl\";\nimport type { Map as MapMLGL } from \"maplibre-gl\";\nimport type { Map as SDKMap } from \"../Map\";\n\nexport class Marker extends maplibregl.Marker {\n addTo(map: SDKMap | MapMLGL): this {\n return super.addTo(map as MapMLGL);\n }\n}\n","/**\n * This is an extension of MapLibre Popup to make it fully type compatible with the SDK\n */\n\nimport maplibregl from \"maplibre-gl\";\nimport type { Map as MapMLGL } from \"maplibre-gl\";\nimport type { Map as SDKMap } from \"../Map\";\n\nexport class Popup extends maplibregl.Popup {\n addTo(map: SDKMap | MapMLGL): this {\n return super.addTo(map as MapMLGL);\n }\n}\n","/**\n * This is an extension of MapLibre Style to make it fully type compatible with the SDK\n */\n\nimport maplibregl from \"maplibre-gl\";\nimport type { Map as MapMLGL, StyleOptions } from \"maplibre-gl\";\nimport type { Map as SDKMap } from \"../Map\";\n\nexport class Style extends maplibregl.Style {\n constructor(map: SDKMap, options: StyleOptions = {}) {\n super(map as MapMLGL, options);\n }\n}\n","/**\n * This is an extension of MapLibre CanvasSource to make it fully type compatible with the SDK\n */\n\nimport maplibregl from \"maplibre-gl\";\nimport type { Map as MapMLGL } from \"maplibre-gl\";\nimport type { Map as SDKMap } from \"../Map\";\n\nexport class CanvasSource extends maplibregl.CanvasSource {\n onAdd(map: SDKMap | MapMLGL) {\n super.onAdd(map as MapMLGL);\n }\n}\n","/**\n * This is an extension of MapLibre GeoJSONSource to make it fully type compatible with the SDK\n */\n\nimport maplibregl from \"maplibre-gl\";\nimport type { Map as MapMLGL } from \"maplibre-gl\";\nimport type { Map as SDKMap } from \"../Map\";\n\nexport class GeoJSONSource extends maplibregl.GeoJSONSource {\n onAdd(map: SDKMap | MapMLGL) {\n super.onAdd(map as MapMLGL);\n }\n}\n","/**\n * This is an extension of MapLibre ImageSource to make it fully type compatible with the SDK\n */\n\nimport maplibregl from \"maplibre-gl\";\nimport type { Map as MapMLGL } from \"maplibre-gl\";\nimport type { Map as SDKMap } from \"../Map\";\n\nexport class ImageSource extends maplibregl.ImageSource {\n onAdd(map: SDKMap | MapMLGL) {\n super.onAdd(map as MapMLGL);\n }\n}\n","/**\n * This is an extension of MapLibre RasterTileSource to make it fully type compatible with the SDK\n */\n\nimport maplibregl from \"maplibre-gl\";\nimport type { Map as MapMLGL } from \"maplibre-gl\";\nimport type { Map as SDKMap } from \"../Map\";\n\nexport class RasterTileSource extends maplibregl.RasterTileSource {\n onAdd(map: SDKMap | MapMLGL) {\n super.onAdd(map as MapMLGL);\n }\n}\n","/**\n * This is an extension of MapLibre RasterDEMTileSource to make it fully type compatible with the SDK\n */\n\nimport maplibregl from \"maplibre-gl\";\nimport type { Map as MapMLGL } from \"maplibre-gl\";\nimport type { Map as SDKMap } from \"../Map\";\n\nexport class RasterDEMTileSource extends maplibregl.RasterDEMTileSource {\n onAdd(map: SDKMap | MapMLGL) {\n super.onAdd(map as MapMLGL);\n }\n}\n","/**\n * This is an extension of MapLibre VectorTileSource to make it fully type compatible with the SDK\n */\n\nimport maplibregl from \"maplibre-gl\";\nimport type { Map as MapMLGL } from \"maplibre-gl\";\nimport type { Map as SDKMap } from \"../Map\";\n\nexport class VectorTileSource extends maplibregl.VectorTileSource {\n onAdd(map: SDKMap | MapMLGL) {\n super.onAdd(map as MapMLGL);\n }\n}\n","/**\n * This is an extension of MapLibre VideoSource to make it fully type compatible with the SDK\n */\n\nimport maplibregl from \"maplibre-gl\";\nimport type { Map as MapMLGL } from \"maplibre-gl\";\nimport type { Map as SDKMap } from \"../Map\";\n\nexport class VideoSource extends maplibregl.VideoSource {\n onAdd(map: SDKMap | MapMLGL) {\n super.onAdd(map as MapMLGL);\n }\n}\n","/**\n * This is an extension of MapLibre NavigationControl to make it fully type compatible with the SDK\n */\n\nimport maplibregl from \"maplibre-gl\";\nimport type { Map as MapMLGL } from \"maplibre-gl\";\nimport type { Map as SDKMap } from \"../Map\";\n\nexport class NavigationControl extends maplibregl.NavigationControl {\n onAdd(map: SDKMap | MapMLGL) {\n return super.onAdd(map as MapMLGL);\n }\n}\n","/**\n * This is an extension of MapLibre GeolocateControl to make it fully type compatible with the SDK\n */\n\nimport maplibregl from \"maplibre-gl\";\nimport type { Map as MapMLGL } from \"maplibre-gl\";\nimport type { Map as SDKMap } from \"../Map\";\n\nexport class GeolocateControl extends maplibregl.GeolocateControl {\n onAdd(map: SDKMap | MapMLGL) {\n return super.onAdd(map as MapMLGL);\n }\n}\n","/**\n * This is an extension of MapLibre AttributionControl to make it fully type compatible with the SDK\n */\n\nimport maplibregl from \"maplibre-gl\";\nimport type { Map as MapMLGL } from \"maplibre-gl\";\nimport type { Map as SDKMap } from \"../Map\";\n\nexport class AttributionControl extends maplibregl.AttributionControl {\n onAdd(map: SDKMap | MapMLGL) {\n return super.onAdd(map as MapMLGL);\n }\n}\n","/**\n * This is an extension of MapLibre LogoControl to make it fully type compatible with the SDK\n */\n\nimport maplibregl from \"maplibre-gl\";\nimport type { Map as MapMLGL } from \"maplibre-gl\";\nimport type { Map as SDKMap } from \"../Map\";\n\nexport class LogoControl extends maplibregl.LogoControl {\n onAdd(map: SDKMap | MapMLGL) {\n return super.onAdd(map as MapMLGL);\n }\n}\n","/**\n * This is an extension of MapLibre ScaleControl to make it fully type compatible with the SDK\n */\n\nimport maplibregl from \"maplibre-gl\";\nimport type { Map as MapMLGL } from \"maplibre-gl\";\nimport type { Map as SDKMap } from \"../Map\";\n\nexport class ScaleControl extends maplibregl.ScaleControl {\n onAdd(map: SDKMap | MapMLGL) {\n return super.onAdd(map as MapMLGL);\n }\n}\n","/**\n * This is an extension of MapLibre FullscreenControl to make it fully type compatible with the SDK\n */\n\nimport maplibregl from \"maplibre-gl\";\nimport type { Map as MapMLGL } from \"maplibre-gl\";\nimport type { Map as SDKMap } from \"../Map\";\n\nexport class FullscreenControl extends maplibregl.FullscreenControl {\n onAdd(map: SDKMap | MapMLGL) {\n return super.onAdd(map as MapMLGL);\n }\n}\n","/**\n * This is an extension of MapLibre TerrainControl to make it fully type compatible with the SDK\n */\n\nimport maplibregl from \"maplibre-gl\";\nimport type { Map as MapMLGL } from \"maplibre-gl\";\nimport type { Map as SDKMap } from \"../Map\";\n\nexport class TerrainControl extends maplibregl.TerrainControl {\n onAdd(map: SDKMap | MapMLGL) {\n return super.onAdd(map as MapMLGL);\n }\n}\n","/**\n * This is an extension of MapLibre BoxZoomHandler to make it fully type compatible with the SDK\n */\n\nimport maplibregl from \"maplibre-gl\";\nimport type { Map as MapMLGL } from \"maplibre-gl\";\nimport type { Map as SDKMap } from \"../Map\";\n\nexport class BoxZoomHandler extends maplibregl.BoxZoomHandler {\n constructor(\n map: SDKMap | MapMLGL,\n options: {\n clickTolerance: number;\n },\n ) {\n super(map as MapMLGL, options);\n }\n}\n","/**\n * This is an extension of MapLibre BoxZoomHandler to make it fully type compatible with the SDK\n */\n\nimport maplibregl from \"maplibre-gl\";\nimport type { Map as MapMLGL } from \"maplibre-gl\";\nimport type { Map as SDKMap } from \"../Map\";\n\nexport class ScrollZoomHandler extends maplibregl.ScrollZoomHandler {\n constructor(map: SDKMap | MapMLGL, triggerRenderFrame: () => void) {\n super(map as MapMLGL, triggerRenderFrame);\n }\n}\n","/**\n * This is an extension of MapLibre BoxZoomHandler to make it fully type compatible with the SDK\n */\n\nimport maplibregl from \"maplibre-gl\";\nimport type { GestureOptions, Map as MapMLGL } from \"maplibre-gl\";\nimport type { Map as SDKMap } from \"../Map\";\n\nexport class CooperativeGesturesHandler extends maplibregl.CooperativeGesturesHandler {\n constructor(map: SDKMap | MapMLGL, options: GestureOptions) {\n super(map as MapMLGL, options);\n }\n}\n","/**\n * This is an extension of MapLibre BoxZoomHandler to make it fully type compatible with the SDK\n */\n\nimport maplibregl from \"maplibre-gl\";\nimport type { Map as MapMLGL } from \"maplibre-gl\";\nimport type { Map as SDKMap } from \"../Map\";\n\nexport class KeyboardHandler extends maplibregl.KeyboardHandler {\n constructor(map: SDKMap | MapMLGL) {\n super(map as MapMLGL);\n }\n}\n","/**\n * This is an extension of MapLibre BoxZoomHandler to make it fully type compatible with the SDK\n */\n\nimport maplibregl from \"maplibre-gl\";\nimport type { Map as MapMLGL } from \"maplibre-gl\";\nimport type { Map as SDKMap } from \"../Map\";\n\nexport class TwoFingersTouchPitchHandler extends maplibregl.TwoFingersTouchPitchHandler {\n constructor(map: SDKMap | MapMLGL) {\n super(map as MapMLGL);\n }\n}\n","/**\n * This is an extension of MapLibre BoxZoomHandler to make it fully type compatible with the SDK\n */\n\nimport maplibregl from \"maplibre-gl\";\nimport type { Map as MapMLGL } from \"maplibre-gl\";\nimport type { Map as SDKMap } from \"../Map\";\n\nexport class MapWheelEvent extends maplibregl.MapWheelEvent {\n constructor(type: string, map: SDKMap | MapMLGL, originalEvent: WheelEvent) {\n super(type, map as MapMLGL, originalEvent);\n }\n}\n","/**\n * This is an extension of MapLibre BoxZoomHandler to make it fully type compatible with the SDK\n */\n\nimport maplibregl from \"maplibre-gl\";\nimport type { Map as MapMLGL } from \"maplibre-gl\";\nimport type { Map as SDKMap } from \"../Map\";\n\nexport class MapTouchEvent extends maplibregl.MapTouchEvent {\n constructor(type: string, map: SDKMap | MapMLGL, originalEvent: TouchEvent) {\n super(type, map as MapMLGL, originalEvent);\n }\n}\n","/**\n * This is an extension of MapLibre BoxZoomHandler to make it fully type compatible with the SDK\n */\n\nimport maplibregl from \"maplibre-gl\";\nimport type { Map as MapMLGL } from \"maplibre-gl\";\nimport type { Map as SDKMap } from \"../Map\";\n\nexport class MapMouseEvent extends maplibregl.MapMouseEvent {\n constructor(type: string, map: SDKMap | MapMLGL, originalEvent: MouseEvent, data: Record<string, unknown> = {}) {\n super(type, map as MapMLGL, originalEvent, data);\n }\n}\n","import { Language as LanguageFromClient, getLanguageInfoFromCode, type LanguageInfo } from \"@maptiler/client\";\n\n// Adding some language entries that are specific to the SDK\nconst Language = {\n /**\n * Language mode to display labels in both the local language and the language of the visitor's device, concatenated.\n * Note that if those two languages are the same, labels won't be duplicated.\n */\n VISITOR: {\n code: null,\n flag: \"visitor\",\n name: \"Visitor\",\n latin: true,\n isMode: true,\n geocoding: false,\n } as LanguageInfo,\n\n /**\n * Language mode to display labels in both the local language and English, concatenated.\n * Note that if those two languages are the same, labels won't be duplicated.\n */\n VISITOR_ENGLISH: {\n code: null,\n flag: \"visitor_en\",\n name: \"Visitor English\",\n latin: true,\n isMode: true,\n geocoding: false,\n } as LanguageInfo,\n\n /**\n * Language mode to display labels in a language enforced in the style.\n */\n STYLE: {\n code: null,\n flag: \"style\",\n name: \"Style\",\n latin: false,\n isMode: true,\n geocoding: false,\n } as LanguageInfo,\n\n /**\n * Language mode to display labels in a language enforced in the style. The language cannot be further modified.\n */\n STYLE_LOCK: {\n code: null,\n flag: \"style_lock\",\n name: \"Style Lock\",\n latin: false,\n isMode: true,\n geocoding: false,\n } as LanguageInfo,\n\n ...LanguageFromClient,\n} as const;\n\n/**\n * Get the browser language\n */\nexport function getBrowserLanguage(): LanguageInfo {\n if (typeof navigator === \"undefined\") {\n const code = Intl.DateTimeFormat().resolvedOptions().locale.split(\"-\")[0];\n\n const langInfo = getLanguageInfoFromCode(code);\n\n if (langInfo) return langInfo;\n return Language.ENGLISH;\n }\n\n const canditatelangs = Array.from(new Set(navigator.languages.map((l) => l.split(\"-\")[0])))\n .map((code) => getLanguageInfoFromCode(code))\n .filter((li) => li);\n\n return canditatelangs[0] ?? Language.LOCAL;\n}\n\nexport { Language, type LanguageInfo };\n","import { Language } from \"../language\";\n\n/**\n * Some default settings for the SDK\n */\nconst defaults = {\n maptilerLogoURL: \"https://api.maptiler.com/resources/logo.svg\",\n maptilerURL: \"https://www.maptiler.com/\",\n maptilerApiHost: \"api.maptiler.com\",\n telemetryURL: \"https://api.maptiler.com/metrics\",\n rtlPluginURL: \"https://cdn.maptiler.com/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.min.js\",\n primaryLanguage: Language.STYLE,\n secondaryLanguage: Language.LOCAL,\n terrainSourceURL: \"https://api.maptiler.com/tiles/terrain-rgb-v2/tiles.json\",\n terrainSourceId: \"maptiler-terrain\",\n};\n\nObject.freeze(defaults);\n\nexport { defaults };\n","import EventEmitter from \"events\";\nimport type { LanguageInfo } from \"./language\";\nimport { config as clientConfig, type FetchFunction } from \"@maptiler/client\";\nimport { v4 as uuidv4 } from \"uuid\";\nimport type { Unit } from \"./types\";\nimport { defaults } from \"./constants/defaults\";\n\nexport const MAPTILER_SESSION_ID = uuidv4();\n\n/**\n * Configuration class for the SDK\n */\nclass SdkConfig extends EventEmitter {\n /**\n * The primary language. By default, the language of the web browser is used.\n */\n primaryLanguage: LanguageInfo = defaults.primaryLanguage;\n\n /**\n * The secondary language, to overwrite the default language defined in the map style.\n * This settings is highly dependant on the style compatibility and may not work in most cases.\n */\n secondaryLanguage?: LanguageInfo;\n\n /**\n * Setting on whether of not the SDK runs with a session logic.\n * A \"session\" is started at the initialization of the SDK and finished when the browser\n * page is being refreshed.\n * When `session` is enabled (default: true), the extra URL param `mtsid` is added to queries\n * on the MapTiler Cloud API. This allows MapTiler to enable \"session based billing\".\n */\n session = true;\n\n /**\n * Enables client-side caching of requests for tiles and fonts.\n * The cached requests persist multiple browser sessions and will be reused when possible.\n * Works only for requests to the MapTiler Cloud API when sessions are enabled.\n */\n caching = true;\n\n /**\n * Telemetry is enabled by default but can be opted-out by setting this value to `false`.\n * The telemetry is very valuable to the team at MapTiler because it shares information\n * about where to add the extra effort. It also helps spotting some incompatibility issues\n * that may arise between the SDK and a specific version of a module.\n *\n * It consists in sending metrics about usage of the following features:\n * - SDK version [string]\n * - API key [string]\n * - MapTiler sesion ID (if opted-in) [string]\n * - if tile caching is enabled [boolean]\n * - if language specified at initialization [boolean]\n * - if terrain is activated at initialization [boolean]\n * - if globe projection is activated at initialization [boolean]\n *\n * In addition, each official module will be added to a list, alongside its version number.\n */\n telemetry = true;\n\n /**\n * Unit to be used\n */\n private _unit: Unit = \"metric\";\n\n /**\n * MapTiler Cloud API key\n */\n private _apiKey = \"\";\n\n /**\n * Set the unit system\n */\n set unit(u: Unit) {\n this._unit = u;\n this.emit(\"unit\", u);\n }\n\n /**\n * Get the unit system\n */\n get unit(): Unit {\n return this._unit;\n }\n\n /**\n * Set the MapTiler Cloud API key\n */\n set apiKey(k: string) {\n this._apiKey = k;\n clientConfig.apiKey = k;\n this.emit(\"apiKey\", k);\n }\n\n /**\n * Get the MapTiler Cloud API key\n */\n get apiKey(): string {\n return this._apiKey;\n }\n\n /**\n * Set a the custom fetch function to replace the default one\n */\n set fetch(f: FetchFunction) {\n clientConfig.fetch = f;\n }\n\n /**\n * Get the fetch fucntion\n */\n get fetch(): FetchFunction | null {\n return clientConfig.fetch;\n }\n}\n\nconst config = new SdkConfig();\n\nexport { config, SdkConfig };\n","import type { LogoControlOptions as LogoControlOptionsML } from \"maplibre-gl\";\nimport { defaults } from \"../constants/defaults\";\nimport { LogoControl } from \"../MLAdapters/LogoControl\";\nimport type { Map as SDKMap } from \"../Map\";\n\ntype LogoControlOptions = LogoControlOptionsML & {\n logoURL?: string;\n linkURL?: string;\n};\n\n/**\n * This LogoControl extends the MapLibre LogoControl but instead can use any image URL and\n * any link URL. By default this is using MapTiler logo and URL.\n */\nexport class MaptilerLogoControl extends LogoControl {\n declare _compact: boolean;\n private logoURL = \"\";\n private linkURL = \"\";\n\n constructor(options: LogoControlOptions = {}) {\n super(options);\n\n this.logoURL = options.logoURL ?? defaults.maptilerLogoURL;\n this.linkURL = options.linkURL ?? defaults.maptilerURL;\n }\n\n onAdd(map: SDKMap): HTMLElement {\n this._map = map;\n this._compact = this.options.compact ?? false;\n this._container = window.document.createElement(\"div\");\n this._container.className = \"maplibregl-ctrl\";\n const anchor = window.document.createElement(\"a\");\n anchor.style.backgroundRepeat = \"no-repeat\";\n anchor.style.cursor = \"pointer\";\n anchor.style.display = \"block\";\n anchor.style.height = \"23px\";\n anchor.style.margin = \"0 0 -4px -4px\";\n anchor.style.overflow = \"hidden\";\n anchor.style.width = \"88px\";\n anchor.style.backgroundImage = `url(${this.logoURL})`;\n anchor.style.backgroundSize = \"100px 30px\";\n anchor.style.width = \"100px\";\n anchor.style.height = \"30px\";\n\n anchor.target = \"_blank\";\n anchor.rel = \"noopener\";\n anchor.href = this.linkURL;\n anchor.setAttribute(\"aria-label\", \"MapTiler logo\");\n anchor.setAttribute(\"rel\", \"noopener\");\n this._container.appendChild(anchor);\n this._container.style.display = \"block\";\n\n this._map.on(\"resize\", this._updateCompact);\n this._updateCompact();\n\n return this._container;\n }\n}\n","import type { GetResourceResponse, RequestParameters, ResourceType } from \"maplibre-gl\";\n\nimport { config } from \"./config\";\n\nimport maplibregl from \"maplibre-gl\";\n\nimport { defaults } from \"./constants/defaults\";\n\nconst LOCAL_CACHE_PROTOCOL_SOURCE = \"localcache_source\";\nconst LOCAL_CACHE_PROTOCOL_DATA = \"localcache\";\nconst LOCAL_CACHE_NAME = \"maptiler_sdk\";\n\nconst CACHE_LIMIT_ITEMS = 1000;\nconst CACHE_LIMIT_CHECK_INTERVAL = 100;\nexport const CACHE_API_AVAILABLE = typeof caches !== \"undefined\";\n\nconst { addProtocol } = maplibregl;\n\nexport function localCacheTransformRequest(reqUrl: URL, resourceType?: ResourceType): string {\n if (CACHE_API_AVAILABLE && config.caching && config.session && reqUrl.host === defaults.maptilerApiHost) {\n if (resourceType === \"Source\" && reqUrl.href.includes(\"tiles.json\")) {\n return reqUrl.href.replace(\"https://\", `${LOCAL_CACHE_PROTOCOL_SOURCE}://`);\n }\n\n if (resourceType === \"Tile\" || resourceType === \"Glyphs\") {\n return reqUrl.href.replace(\"https://\", `${LOCAL_CACHE_PROTOCOL_DATA}://`);\n }\n }\n return reqUrl.href;\n}\n\nlet cacheInstance: Cache;\n\nasync function getCache() {\n if (!cacheInstance) {\n cacheInstance = await caches.open(LOCAL_CACHE_NAME);\n }\n return cacheInstance;\n}\n\nlet cachePutCounter = 0;\nasync function limitCache() {\n const cache = await getCache();\n const keys = await cache.keys();\n const toPurge = keys.slice(0, Math.max(keys.length - CACHE_LIMIT_ITEMS, 0));\n for (const key of toPurge) {\n cache.delete(key);\n }\n}\n\nexport function registerLocalCacheProtocol() {\n addProtocol(\n LOCAL_CACHE_PROTOCOL_SOURCE,\n async (\n params: RequestParameters,\n abortController: AbortController,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): Promise<GetResourceResponse<any>> => {\n if (!params.url) throw new Error(\"\");\n\n params.url = params.url.replace(`${LOCAL_CACHE_PROTOCOL_SOURCE}://`, \"https://\");\n\n const requestInit: RequestInit = params;\n requestInit.signal = abortController.signal;\n const response = await fetch(params.url, requestInit);\n const json = await response.json();\n\n if (json.tiles && json.tiles.length > 0) {\n // move `Last-Modified` to query so it propagates to tile URLs\n json.tiles[0] += `&last-modified=${response.headers.get(\"Last-Modified\")}`;\n }\n\n return {\n data: json,\n cacheControl: response.headers.get(\"Cache-Control\"),\n expires: response.headers.get(\"Expires\"),\n };\n },\n );\n addProtocol(LOCAL_CACHE_PROTOCOL_DATA, async (params: RequestParameters, abortController: AbortController): Promise<GetResourceResponse<any>> => {\n if (!params.url) throw new Error(\"\");\n\n params.url = params.url.replace(`${LOCAL_CACHE_PROTOCOL_DATA}://`, \"https://\");\n\n const url = new URL(params.url);\n\n const cacheableUrl = new URL(url);\n cacheableUrl.searchParams.delete(\"mtsid\");\n cacheableUrl.searchParams.delete(\"key\");\n const cacheKey = cacheableUrl.toString();\n\n const fetchableUrl = new URL(url);\n fetchableUrl.searchParams.delete(\"last-modified\");\n const fetchUrl = fetchableUrl.toString();\n\n const respond = async (response: Response): Promise<GetResourceResponse<any>> => {\n return {\n data: await response.arrayBuffer(),\n cacheControl: response.headers.get(\"Cache-Control\"),\n expires: response.headers.get(\"Expires\"),\n };\n };\n\n const cache = await getCache();\n const cacheMatch = await cache.match(cacheKey);\n\n if (cacheMatch) {\n return respond(cacheMatch);\n }\n\n const requestInit: RequestInit = params;\n requestInit.signal = abortController.signal;\n const response = await fetch(fetchUrl, requestInit);\n if (response.status >= 200 && response.status < 300) {\n cache.put(cacheKey, response.clone()).catch(() => {\n // \"DOMException: Cache.put() was aborted\"\n // can happen here because the response is not done streaming yet\n });\n if (++cachePutCounter > CACHE_LIMIT_CHECK_INTERVAL) {\n limitCache();\n cachePutCounter = 0;\n }\n }\n return respond(response);\n });\n}\n","import maplibregl from \"maplibre-gl\";\nimport type { RequestParameters, ResourceType, RequestTransformFunction, SymbolLayerSpecification } from \"maplibre-gl\";\nimport { defaults } from \"./constants/defaults\";\nimport { config } from \"./config\";\nimport { MAPTILER_SESSION_ID } from \"./config\";\nimport { localCacheTransformRequest } from \"./caching\";\nimport type { Map as MapSDK } from \"./Map\";\n\n// TODO These function should gradually be moved to\n// to utils directory\n\nexport async function enableRTL(customPluginURL?: string) {\n // Prevent this from running server side\n if (typeof window === \"undefined\") return;\n\n const status = maplibregl.getRTLTextPluginStatus();\n\n if (status === \"unavailable\" || status === \"requested\") {\n try {\n await maplibregl.setRTLTextPlugin(customPluginURL ?? defaults.rtlPluginURL, true);\n } catch (_e) {\n console.error(\"Error enabling RTL plugin. It is enabled by default and cannot be unset after. Are you attempting to enable it twice?\", _e);\n }\n }\n}\n\n// This comes from:\n// https://github.com/maplibre/maplibre-gl-js/blob/v2.4.0/src/util/util.ts#L223\nexport function bindAll(fns: Array<string>, context: any): void {\n for (const fn of fns) {\n if (typeof context[fn] !== \"function\") continue;\n context[fn] = context[fn].bind(context);\n }\n}\n\n/**\n * This function is meant to be used as transformRequest by any Map instance created.\n * It adds the session ID as well as the MapTiler Cloud key from the config to all the requests\n * performed on MapTiler Cloud servers.\n */\nexport function maptilerCloudTransformRequest(url: string, resourceType?: ResourceType): RequestParameters {\n let reqUrl = null;\n\n try {\n // The URL is expected to be absolute.\n // Yet, if it's local we just return it without assuming a 'base' url (in the URL constructor)\n // and we let the URL be locally resolved with a potential base path.\n reqUrl = new URL(url);\n } catch (_e) {\n return {\n url,\n };\n }\n\n if (reqUrl.host === defaults.maptilerApiHost) {\n if (!reqUrl.searchParams.has(\"key\")) {\n reqUrl.searchParams.append(\"key\", config.apiKey);\n }\n\n if (config.session) {\n reqUrl.searchParams.append(\"mtsid\", MAPTILER_SESSION_ID);\n }\n }\n\n const localCacheTransformedReq = localCacheTransformRequest(reqUrl, resourceType);\n\n return {\n url: localCacheTransformedReq,\n };\n}\n\n/**\n * This combines a user-defined tranformRequest function (optionnal)\n * with the MapTiler Cloud-specific one: maptilerCloudTransformRequest\n */\nexport function combineTransformRequest(userDefinedRTF?: RequestTransformFunction | null): RequestTransformFunction {\n return (url: string, resourceType?: ResourceType): RequestParameters => {\n if (userDefinedRTF !== undefined && userDefinedRTF !== null) {\n const rp = userDefinedRTF(url, resourceType);\n const rp2 = maptilerCloudTransformRequest(rp?.url ?? \"\", resourceType);\n\n return {\n ...rp,\n ...rp2,\n };\n }\n\n return maptilerCloudTransformRequest(url, resourceType);\n };\n}\n\n/**\n * Generate a random string. Handy to create random IDs\n */\nexport function generateRandomString(): string {\n return Math.random().toString(36).substring(2);\n}\n\n/**\n * Check if a given string is in a uuid format\n */\nexport function isUUID(s: string): boolean {\n // Regular expression to check if string is a valid UUID\n const regexExp = /^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/gi;\n return regexExp.test(s);\n}\n\n/**\n * Attempt a JSON parse of a string but does not throw if the string is not valid JSON, returns `null` instead.\n */\nexport function jsonParseNoThrow<T>(doc: string): T | null {\n try {\n return JSON.parse(doc);\n } catch (_e) {\n // pass\n }\n\n return null;\n}\n\n/**\n * Simple function to check if an object is a GeoJSON\n */\nexport function isValidGeoJSON<T>(obj: T & { type: string }): boolean {\n if (typeof obj !== \"object\" || Array.isArray(obj) || obj === null) return false;\n if (!(\"type\" in obj)) return false;\n\n const validTypes = [\"Feature\", \"FeatureCollection\", \"Point\", \"MultiPoint\", \"LineString\", \"MultiLineString\", \"Polygon\", \"MultiPolygon\", \"GeometryCollection\"];\n\n if (validTypes.includes(obj.type)) return true;\n return false;\n}\n\n/**\n * This function tests if WebGL2 is supported. Since it can be for a different reasons that WebGL2 is\n * not supported but we do not have an action to take based on the reason, this function return null\n * if there is no error (WebGL is supported), or returns a string with the error message if WebGL2 is\n * not supported.\n */\nexport function getWebGLSupportError(): string | null {\n const gl = document.createElement(\"canvas\").getContext(\"webgl2\");\n if (!gl) {\n if (typeof WebGL2RenderingContext !== \"undefined\") {\n return \"Graphic rendering with WebGL2 has been disabled or is not supported by your graphic card. The map cannot be displayed.\";\n }\n return \"Your browser does not support graphic rendering with WebGL2. The map cannot be displayed.\";\n }\n return null;\n}\n\n/**\n * Display an error message in the Map div if WebGL2 is not supported\n */\nexport function displayNoWebGlWarning(container: HTMLElement | string) {\n const webglError = getWebGLSupportError();\n\n if (!webglError) return;\n\n let actualContainer: HTMLElement | null = null;\n\n if (typeof container === \"string\") {\n actualContainer = document.getElementById(container);\n } else if (container instanceof HTMLElement) {\n actualContainer = container;\n }\n\n if (!actualContainer) {\n throw new Error(\"The Map container must be provided.\");\n }\n\n const errorMessageDiv = document.createElement(\"div\");\n errorMessageDiv.innerHTML = webglError;\n errorMessageDiv.classList.add(\"webgl-warning-div\");\n actualContainer.appendChild(errorMessageDiv);\n throw new Error(webglError);\n}\n\n/**\n * Display a warning message in the Map div if the WebGL context was lost\n */\nexport function displayWebGLContextLostWarning(map: MapSDK) {\n const webglError = \"The WebGL context was lost.\";\n const container: HTMLElement = map.getContainer();\n const errorMessageDiv = document.createElement(\"div\");\n errorMessageDiv.innerHTML = webglError;\n errorMessageDiv.classList.add(\"webgl-warning-div\");\n container.appendChild(errorMessageDiv);\n}\n\n/**\n * Return true if the provided piece of style expression has the form [\"get\", \"name:XX\"]\n * with XX being a 2-letter is code for languages\n */\nfunction isGetNameLanguage(subExpr: unknown, localized: boolean): boolean {\n if (!Array.isArray(subExpr)) return false;\n if (subExpr.length !== 2) return false;\n if (subExpr[0] !== \"get\") return false;\n if (typeof subExpr[1] !== \"string\") return false;\n if (localized && !subExpr[1].startsWith(\"name:\")) return false;\n if (!localized && subExpr[1] !== \"name\") return false;\n\n return true;\n}\n\n/**\n * In a text-field style property (as an object, not a string) the languages that are specified as\n * [\"get\", \"name:XX\"] are replaced by the proved replacer (also an object).\n * This replacement happened regardless of how deep in the object the flag is.\n * Note that it does not replace the occurences of [\"get\", \"name\"] (local names)\n */\nexport function changeFirstLanguage(\n origExpr: maplibregl.ExpressionSpecification,\n replacer: maplibregl.ExpressionSpecification,\n localized: boolean,\n): maplibregl.ExpressionSpecification {\n const expr = structuredClone(origExpr) as maplibregl.ExpressionSpecification;\n\n const exploreNode = (subExpr: maplibregl.ExpressionSpecification | string) => {\n if (typeof subExpr === \"string\") return;\n\n for (let i = 0; i < subExpr.length; i += 1) {\n if (isGetNameLanguage(subExpr[i], localized)) {\n subExpr[i] = structuredClone(replacer);\n } else {\n exploreNode(subExpr[i] as maplibregl.ExpressionSpecification | string);\n }\n }\n };\n\n // The provided expression could be directly a [\"get\", \"name:xx\"]\n if (isGetNameLanguage(expr, localized)) {\n return replacer;\n }\n\n exploreNode(expr);\n return expr;\n}\n\n/**\n * If `localized` is `true`, it checks for the pattern \"{name:xx}\" (with \"xx\" being a language iso string).\n * If `localized` is `false`, it check for {name}.\n * In a exact way or is a loose way (such as \"foo {name:xx}\" or \"foo {name} bar\")\n */\nexport function checkNamePattern(str: string, localized: boolean): { contains: boolean; exactMatch: boolean } {\n const regex = localized ? /\\{name:\\S+\\}/ : /\\{name\\}/;\n return {\n contains: regex.test(str),\n exactMatch: new RegExp(`^${regex.source}$`).test(str),\n };\n}\n\n/**\n * Replaces the occurences of {name:xx} in a string by a provided object-expression to return a concat object expression\n */\nexport function replaceLanguage(origLang: string, newLang: maplibregl.ExpressionSpecification, localized: boolean): maplibregl.ExpressionSpecification {\n const regex = localized ? /\\{name:\\S+\\}/ : /\\{name\\}/;\n const elementsToConcat = origLang.split(regex);\n\n const allElements = elementsToConcat.flatMap((item, i) => (i === elementsToConcat.length - 1 ? [item] : [item, newLang]));\n\n const expr = [\"concat\", ...allElements] as maplibregl.ExpressionSpecification;\n return expr;\n}\n\n/**\n * Find languages used in string label definition.\n * The returned array contains languages such as \"en\", \"fr\" but\n * can also contain null that stand for the use of {name}\n */\nexport function findLanguageStr(str: string): Array<string | null> {\n const regex = /\\{name(?::(?<language>\\S+))?\\}/g;\n const languageUsed = [] as Array<string | null>;\n\n while (true) {\n const match = regex.exec(str);\n if (!match) break;\n\n // The is a match\n const language = match.groups?.language ?? null;\n\n // The language is non-null if provided {name:xx}\n // but if provided {name} then language will be null\n languageUsed.push(language);\n }\n return languageUsed;\n}\n\nfunction isGetNameLanguageAndFind(subExpr: unknown): { isLanguage: boolean; localization: string | null } | null {\n // Not language expression\n if (!Array.isArray(subExpr)) return null;\n if (subExpr.length !== 2) return null;\n if (subExpr[0] !== \"get\") return null;\n if (typeof subExpr[1] !== \"string\") return null;\n\n // Is non localized language\n if (subExpr[1].trim() === \"name\") {\n return {\n isLanguage: true,\n localization: null,\n };\n }\n\n // Is a localized language\n if (subExpr[1].trim().startsWith(\"name:\")) {\n return {\n isLanguage: true,\n localization: subExpr[1].trim().split(\":\").pop()!,\n };\n }\n\n return null;\n}\n\n/**\n * Find languages used in object label definition.\n * The returned array contains languages such as \"en\", \"fr\" but\n * can also contain null that stand for the use of {name}\n */\nexport function findLanguageObj(origExpr: maplibregl.ExpressionSpecification): Array<string | null> {\n const languageUsed = [] as Array<string | null>;\n const expr = structuredClone(origExpr) as maplibregl.ExpressionSpecification;\n\n const exploreNode = (subExpr: maplibregl.ExpressionSpecification | string | Array<maplibregl.ExpressionSpecification | string>) => {\n if (typeof subExpr === \"string\") return;\n\n for (let i = 0; i < subExpr.length; i += 1) {\n const result = isGetNameLanguageAndFind(subExpr[i]);\n if (result) {\n languageUsed.push(result.localization);\n } else {\n exploreNode(subExpr[i] as maplibregl.ExpressionSpecification | string);\n }\n }\n };\n\n exploreNode([expr]);\n return languageUsed;\n}\n\nexport function computeLabelsLocalizationMetrics(layers: maplibregl.LayerSpecification[], map: MapSDK): { unlocalized: number; localized: Record<string, number> } {\n const languages: Array<string | null>[] = [];\n\n for (const genericLayer of layers) {\n // Only symbole layer can have a layout with text-field\n if (genericLayer.type !== \"symbol\") {\n continue;\n }\n\n const layer = genericLayer as SymbolLayerSpecification;\n const { id, layout } = layer;\n\n if (!layout) {\n continue;\n }\n\n if (!(\"text-field\" in layout)) {\n continue;\n }\n\n const textFieldLayoutProp: string | maplibregl.ExpressionSpecification = map.getLayoutProperty(id, \"text-field\");\n\n if (!textFieldLayoutProp) {\n continue;\n }\n\n if (typeof textFieldLayoutProp === \"string\") {\n const l = findLanguageStr(textFieldLayoutProp);\n languages.push(l);\n } else {\n const l = findLanguageObj(textFieldLayoutProp);\n languages.push(l);\n }\n }\n\n const flatLanguages = languages.flat();\n const localizationMetrics: {\n unlocalized: number;\n localized: Record<string, number>;\n } = {\n unlocalized: 0,\n localized: {},\n };\n\n for (const lang of flatLanguages) {\n if (lang === null) {\n localizationMetrics.unlocalized += 1;\n } else {\n if (!(lang in localizationMetrics.localized)) {\n localizationMetrics.localized[lang] = 0;\n }\n localizationMetrics.localized[lang] += 1;\n }\n }\n return localizationMetrics;\n}\n","var $version = 8;\nvar $root = {\n\tversion: {\n\t\trequired: true,\n\t\ttype: \"enum\",\n\t\tvalues: [\n\t\t\t8\n\t\t]\n\t},\n\tname: {\n\t\ttype: \"string\"\n\t},\n\tmetadata: {\n\t\ttype: \"*\"\n\t},\n\tcenter: {\n\t\ttype: \"array\",\n\t\tvalue: \"number\"\n\t},\n\tcenterAltitude: {\n\t\ttype: \"number\"\n\t},\n\tzoom: {\n\t\ttype: \"number\"\n\t},\n\tbearing: {\n\t\ttype: \"number\",\n\t\t\"default\": 0,\n\t\tperiod: 360,\n\t\tunits: \"degrees\"\n\t},\n\tpitch: {\n\t\ttype: \"number\",\n\t\t\"default\": 0,\n\t\tunits: \"degrees\"\n\t},\n\troll: {\n\t\ttype: \"number\",\n\t\t\"default\": 0,\n\t\tunits: \"degrees\"\n\t},\n\tstate: {\n\t\ttype: \"state\",\n\t\t\"default\": {\n\t\t}\n\t},\n\tlight: {\n\t\ttype: \"light\"\n\t},\n\tsky: {\n\t\ttype: \"sky\"\n\t},\n\tprojection: {\n\t\ttype: \"projection\"\n\t},\n\tterrain: {\n\t\ttype: \"terrain\"\n\t},\n\tsources: {\n\t\trequired: true,\n\t\ttype: \"sources\"\n\t},\n\tsprite: {\n\t\ttype: \"sprite\"\n\t},\n\tglyphs: {\n\t\ttype: \"string\"\n\t},\n\t\"font-faces\": {\n\t\ttype: \"array\",\n\t\tvalue: \"fontFaces\"\n\t},\n\ttransition: {\n\t\ttype: \"transition\"\n\t},\n\tlayers: {\n\t\trequired: true,\n\t\ttype: \"array\",\n\t\tvalue: \"layer\"\n\t}\n};\nvar sources = {\n\t\"*\": {\n\t\ttype: \"source\"\n\t}\n};\nvar source = [\n\t\"source_vector\",\n\t\"source_raster\",\n\t\"source_raster_dem\",\n\t\"source_geojson\",\n\t\"source_video\",\n\t\"source_image\"\n];\nvar source_vector = {\n\ttype: {\n\t\trequired: true,\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tvector: {\n\t\t\t}\n\t\t}\n\t},\n\turl: {\n\t\ttype: \"string\"\n\t},\n\ttiles: {\n\t\ttype: \"array\",\n\t\tvalue: \"string\"\n\t},\n\tbounds: {\n\t\ttype: \"array\",\n\t\tvalue: \"number\",\n\t\tlength: 4,\n\t\t\"default\": [\n\t\t\t-180,\n\t\t\t-85.051129,\n\t\t\t180,\n\t\t\t85.051129\n\t\t]\n\t},\n\tscheme: {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\txyz: {\n\t\t\t},\n\t\t\ttms: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"xyz\"\n\t},\n\tminzoom: {\n\t\ttype: \"number\",\n\t\t\"default\": 0\n\t},\n\tmaxzoom: {\n\t\ttype: \"number\",\n\t\t\"default\": 22\n\t},\n\tattribution: {\n\t\ttype: \"string\"\n\t},\n\tpromoteId: {\n\t\ttype: \"promoteId\"\n\t},\n\tvolatile: {\n\t\ttype: \"boolean\",\n\t\t\"default\": false\n\t},\n\tencoding: {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tmvt: {\n\t\t\t},\n\t\t\tmlt: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"mvt\"\n\t},\n\t\"*\": {\n\t\ttype: \"*\"\n\t}\n};\nvar source_raster = {\n\ttype: {\n\t\trequired: true,\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\traster: {\n\t\t\t}\n\t\t}\n\t},\n\turl: {\n\t\ttype: \"string\"\n\t},\n\ttiles: {\n\t\ttype: \"array\",\n\t\tvalue: \"string\"\n\t},\n\tbounds: {\n\t\ttype: \"array\",\n\t\tvalue: \"number\",\n\t\tlength: 4,\n\t\t\"default\": [\n\t\t\t-180,\n\t\t\t-85.051129,\n\t\t\t180,\n\t\t\t85.051129\n\t\t]\n\t},\n\tminzoom: {\n\t\ttype: \"number\",\n\t\t\"default\": 0\n\t},\n\tmaxzoom: {\n\t\ttype: \"number\",\n\t\t\"default\": 22\n\t},\n\ttileSize: {\n\t\ttype: \"number\",\n\t\t\"default\": 512,\n\t\tunits: \"pixels\"\n\t},\n\tscheme: {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\txyz: {\n\t\t\t},\n\t\t\ttms: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"xyz\"\n\t},\n\tattribution: {\n\t\ttype: \"string\"\n\t},\n\tvolatile: {\n\t\ttype: \"boolean\",\n\t\t\"default\": false\n\t},\n\t\"*\": {\n\t\ttype: \"*\"\n\t}\n};\nvar source_raster_dem = {\n\ttype: {\n\t\trequired: true,\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\t\"raster-dem\": {\n\t\t\t}\n\t\t}\n\t},\n\turl: {\n\t\ttype: \"string\"\n\t},\n\ttiles: {\n\t\ttype: \"array\",\n\t\tvalue: \"string\"\n\t},\n\tbounds: {\n\t\ttype: \"array\",\n\t\tvalue: \"number\",\n\t\tlength: 4,\n\t\t\"default\": [\n\t\t\t-180,\n\t\t\t-85.051129,\n\t\t\t180,\n\t\t\t85.051129\n\t\t]\n\t},\n\tminzoom: {\n\t\ttype: \"number\",\n\t\t\"default\": 0\n\t},\n\tmaxzoom: {\n\t\ttype: \"number\",\n\t\t\"default\": 22\n\t},\n\ttileSize: {\n\t\ttype: \"number\",\n\t\t\"default\": 512,\n\t\tunits: \"pixels\"\n\t},\n\tattribution: {\n\t\ttype: \"string\"\n\t},\n\tencoding: {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tterrarium: {\n\t\t\t},\n\t\t\tmapbox: {\n\t\t\t},\n\t\t\tcustom: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"mapbox\"\n\t},\n\tredFactor: {\n\t\ttype: \"number\",\n\t\t\"default\": 1\n\t},\n\tblueFactor: {\n\t\ttype: \"number\",\n\t\t\"default\": 1\n\t},\n\tgreenFactor: {\n\t\ttype: \"number\",\n\t\t\"default\": 1\n\t},\n\tbaseShift: {\n\t\ttype: \"number\",\n\t\t\"default\": 0\n\t},\n\tvolatile: {\n\t\ttype: \"boolean\",\n\t\t\"default\": false\n\t},\n\t\"*\": {\n\t\ttype: \"*\"\n\t}\n};\nvar source_geojson = {\n\ttype: {\n\t\trequired: true,\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tgeojson: {\n\t\t\t}\n\t\t}\n\t},\n\tdata: {\n\t\trequired: true,\n\t\ttype: \"*\"\n\t},\n\tmaxzoom: {\n\t\ttype: \"number\",\n\t\t\"default\": 18\n\t},\n\tattribution: {\n\t\ttype: \"string\"\n\t},\n\tbuffer: {\n\t\ttype: \"number\",\n\t\t\"default\": 128,\n\t\tmaximum: 512,\n\t\tminimum: 0\n\t},\n\tfilter: {\n\t\ttype: \"*\"\n\t},\n\ttolerance: {\n\t\ttype: \"number\",\n\t\t\"default\": 0.375\n\t},\n\tcluster: {\n\t\ttype: \"boolean\",\n\t\t\"default\": false\n\t},\n\tclusterRadius: {\n\t\ttype: \"number\",\n\t\t\"default\": 50,\n\t\tminimum: 0\n\t},\n\tclusterMaxZoom: {\n\t\ttype: \"number\"\n\t},\n\tclusterMinPoints: {\n\t\ttype: \"number\"\n\t},\n\tclusterProperties: {\n\t\ttype: \"*\"\n\t},\n\tlineMetrics: {\n\t\ttype: \"boolean\",\n\t\t\"default\": false\n\t},\n\tgenerateId: {\n\t\ttype: \"boolean\",\n\t\t\"default\": false\n\t},\n\tpromoteId: {\n\t\ttype: \"promoteId\"\n\t}\n};\nvar source_video = {\n\ttype: {\n\t\trequired: true,\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tvideo: {\n\t\t\t}\n\t\t}\n\t},\n\turls: {\n\t\trequired: true,\n\t\ttype: \"array\",\n\t\tvalue: \"string\"\n\t},\n\tcoordinates: {\n\t\trequired: true,\n\t\ttype: \"array\",\n\t\tlength: 4,\n\t\tvalue: {\n\t\t\ttype: \"array\",\n\t\t\tlength: 2,\n\t\t\tvalue: \"number\"\n\t\t}\n\t}\n};\nvar source_image = {\n\ttype: {\n\t\trequired: true,\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\timage: {\n\t\t\t}\n\t\t}\n\t},\n\turl: {\n\t\trequired: true,\n\t\ttype: \"string\"\n\t},\n\tcoordinates: {\n\t\trequired: true,\n\t\ttype: \"array\",\n\t\tlength: 4,\n\t\tvalue: {\n\t\t\ttype: \"array\",\n\t\t\tlength: 2,\n\t\t\tvalue: \"number\"\n\t\t}\n\t}\n};\nvar layer = {\n\tid: {\n\t\ttype: \"string\",\n\t\trequired: true\n\t},\n\ttype: {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tfill: {\n\t\t\t},\n\t\t\tline: {\n\t\t\t},\n\t\t\tsymbol: {\n\t\t\t},\n\t\t\tcircle: {\n\t\t\t},\n\t\t\theatmap: {\n\t\t\t},\n\t\t\t\"fill-extrusion\": {\n\t\t\t},\n\t\t\traster: {\n\t\t\t},\n\t\t\thillshade: {\n\t\t\t},\n\t\t\t\"color-relief\": {\n\t\t\t},\n\t\t\tbackground: {\n\t\t\t}\n\t\t},\n\t\trequired: true\n\t},\n\tmetadata: {\n\t\ttype: \"*\"\n\t},\n\tsource: {\n\t\ttype: \"string\"\n\t},\n\t\"source-layer\": {\n\t\ttype: \"string\"\n\t},\n\tminzoom: {\n\t\ttype: \"number\",\n\t\tminimum: 0,\n\t\tmaximum: 24\n\t},\n\tmaxzoom: {\n\t\ttype: \"number\",\n\t\tminimum: 0,\n\t\tmaximum: 24\n\t},\n\tfilter: {\n\t\ttype: \"filter\"\n\t},\n\tlayout: {\n\t\ttype: \"layout\"\n\t},\n\tpaint: {\n\t\ttype: \"paint\"\n\t}\n};\nvar layout = [\n\t\"layout_fill\",\n\t\"layout_line\",\n\t\"layout_circle\",\n\t\"layout_heatmap\",\n\t\"layout_fill-extrusion\",\n\t\"layout_symbol\",\n\t\"layout_raster\",\n\t\"layout_hillshade\",\n\t\"layout_color-relief\",\n\t\"layout_background\"\n];\nvar layout_background = {\n\tvisibility: {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tvisible: {\n\t\t\t},\n\t\t\tnone: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"visible\",\n\t\t\"property-type\": \"constant\"\n\t}\n};\nvar layout_fill = {\n\t\"fill-sort-key\": {\n\t\ttype: \"number\",\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\tvisibility: {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tvisible: {\n\t\t\t},\n\t\t\tnone: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"visible\",\n\t\t\"property-type\": \"constant\"\n\t}\n};\nvar layout_circle = {\n\t\"circle-sort-key\": {\n\t\ttype: \"number\",\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\tvisibility: {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tvisible: {\n\t\t\t},\n\t\t\tnone: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"visible\",\n\t\t\"property-type\": \"constant\"\n\t}\n};\nvar layout_heatmap = {\n\tvisibility: {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tvisible: {\n\t\t\t},\n\t\t\tnone: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"visible\",\n\t\t\"property-type\": \"constant\"\n\t}\n};\nvar layout_line = {\n\t\"line-cap\": {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tbutt: {\n\t\t\t},\n\t\t\tround: {\n\t\t\t},\n\t\t\tsquare: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"butt\",\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"line-join\": {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tbevel: {\n\t\t\t},\n\t\t\tround: {\n\t\t\t},\n\t\t\tmiter: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"miter\",\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"line-miter-limit\": {\n\t\ttype: \"number\",\n\t\t\"default\": 2,\n\t\trequires: [\n\t\t\t{\n\t\t\t\t\"line-join\": \"miter\"\n\t\t\t}\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"line-round-limit\": {\n\t\ttype: \"number\",\n\t\t\"default\": 1.05,\n\t\trequires: [\n\t\t\t{\n\t\t\t\t\"line-join\": \"round\"\n\t\t\t}\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"line-sort-key\": {\n\t\ttype: \"number\",\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\tvisibility: {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tvisible: {\n\t\t\t},\n\t\t\tnone: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"visible\",\n\t\t\"property-type\": \"constant\"\n\t}\n};\nvar layout_symbol = {\n\t\"symbol-placement\": {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tpoint: {\n\t\t\t},\n\t\t\tline: {\n\t\t\t},\n\t\t\t\"line-center\": {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"point\",\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"symbol-spacing\": {\n\t\ttype: \"number\",\n\t\t\"default\": 250,\n\t\tminimum: 1,\n\t\tunits: \"pixels\",\n\t\trequires: [\n\t\t\t{\n\t\t\t\t\"symbol-placement\": \"line\"\n\t\t\t}\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"symbol-avoid-edges\": {\n\t\ttype: \"boolean\",\n\t\t\"default\": false,\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"symbol-sort-key\": {\n\t\ttype: \"number\",\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"symbol-z-order\": {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tauto: {\n\t\t\t},\n\t\t\t\"viewport-y\": {\n\t\t\t},\n\t\t\tsource: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"auto\",\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"icon-allow-overlap\": {\n\t\ttype: \"boolean\",\n\t\t\"default\": false,\n\t\trequires: [\n\t\t\t\"icon-image\",\n\t\t\t{\n\t\t\t\t\"!\": \"icon-overlap\"\n\t\t\t}\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"icon-overlap\": {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tnever: {\n\t\t\t},\n\t\t\talways: {\n\t\t\t},\n\t\t\tcooperative: {\n\t\t\t}\n\t\t},\n\t\trequires: [\n\t\t\t\"icon-image\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"icon-ignore-placement\": {\n\t\ttype: \"boolean\",\n\t\t\"default\": false,\n\t\trequires: [\n\t\t\t\"icon-image\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"icon-optional\": {\n\t\ttype: \"boolean\",\n\t\t\"default\": false,\n\t\trequires: [\n\t\t\t\"icon-image\",\n\t\t\t\"text-field\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"icon-rotation-alignment\": {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tmap: {\n\t\t\t},\n\t\t\tviewport: {\n\t\t\t},\n\t\t\tauto: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"auto\",\n\t\trequires: [\n\t\t\t\"icon-image\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"icon-size\": {\n\t\ttype: \"number\",\n\t\t\"default\": 1,\n\t\tminimum: 0,\n\t\tunits: \"factor of the original icon size\",\n\t\trequires: [\n\t\t\t\"icon-image\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"icon-text-fit\": {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tnone: {\n\t\t\t},\n\t\t\twidth: {\n\t\t\t},\n\t\t\theight: {\n\t\t\t},\n\t\t\tboth: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"none\",\n\t\trequires: [\n\t\t\t\"icon-image\",\n\t\t\t\"text-field\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"icon-text-fit-padding\": {\n\t\ttype: \"array\",\n\t\tvalue: \"number\",\n\t\tlength: 4,\n\t\t\"default\": [\n\t\t\t0,\n\t\t\t0,\n\t\t\t0,\n\t\t\t0\n\t\t],\n\t\tunits: \"pixels\",\n\t\trequires: [\n\t\t\t\"icon-image\",\n\t\t\t\"text-field\",\n\t\t\t{\n\t\t\t\t\"icon-text-fit\": [\n\t\t\t\t\t\"both\",\n\t\t\t\t\t\"width\",\n\t\t\t\t\t\"height\"\n\t\t\t\t]\n\t\t\t}\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"icon-image\": {\n\t\ttype: \"resolvedImage\",\n\t\ttokens: true,\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"icon-rotate\": {\n\t\ttype: \"number\",\n\t\t\"default\": 0,\n\t\tperiod: 360,\n\t\tunits: \"degrees\",\n\t\trequires: [\n\t\t\t\"icon-image\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"icon-padding\": {\n\t\ttype: \"padding\",\n\t\t\"default\": [\n\t\t\t2\n\t\t],\n\t\tunits: \"pixels\",\n\t\trequires: [\n\t\t\t\"icon-image\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"icon-keep-upright\": {\n\t\ttype: \"boolean\",\n\t\t\"default\": false,\n\t\trequires: [\n\t\t\t\"icon-image\",\n\t\t\t{\n\t\t\t\t\"icon-rotation-alignment\": \"map\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"symbol-placement\": [\n\t\t\t\t\t\"line\",\n\t\t\t\t\t\"line-center\"\n\t\t\t\t]\n\t\t\t}\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"icon-offset\": {\n\t\ttype: \"array\",\n\t\tvalue: \"number\",\n\t\tlength: 2,\n\t\t\"default\": [\n\t\t\t0,\n\t\t\t0\n\t\t],\n\t\trequires: [\n\t\t\t\"icon-image\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"icon-anchor\": {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tcenter: {\n\t\t\t},\n\t\t\tleft: {\n\t\t\t},\n\t\t\tright: {\n\t\t\t},\n\t\t\ttop: {\n\t\t\t},\n\t\t\tbottom: {\n\t\t\t},\n\t\t\t\"top-left\": {\n\t\t\t},\n\t\t\t\"top-right\": {\n\t\t\t},\n\t\t\t\"bottom-left\": {\n\t\t\t},\n\t\t\t\"bottom-right\": {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"center\",\n\t\trequires: [\n\t\t\t\"icon-image\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"icon-pitch-alignment\": {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tmap: {\n\t\t\t},\n\t\t\tviewport: {\n\t\t\t},\n\t\t\tauto: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"auto\",\n\t\trequires: [\n\t\t\t\"icon-image\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"text-pitch-alignment\": {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tmap: {\n\t\t\t},\n\t\t\tviewport: {\n\t\t\t},\n\t\t\tauto: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"auto\",\n\t\trequires: [\n\t\t\t\"text-field\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"text-rotation-alignment\": {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tmap: {\n\t\t\t},\n\t\t\tviewport: {\n\t\t\t},\n\t\t\t\"viewport-glyph\": {\n\t\t\t},\n\t\t\tauto: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"auto\",\n\t\trequires: [\n\t\t\t\"text-field\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"text-field\": {\n\t\ttype: \"formatted\",\n\t\t\"default\": \"\",\n\t\ttokens: true,\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"text-font\": {\n\t\ttype: \"array\",\n\t\tvalue: \"string\",\n\t\t\"default\": [\n\t\t\t\"Open Sans Regular\",\n\t\t\t\"Arial Unicode MS Regular\"\n\t\t],\n\t\trequires: [\n\t\t\t\"text-field\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"text-size\": {\n\t\ttype: \"number\",\n\t\t\"default\": 16,\n\t\tminimum: 0,\n\t\tunits: \"pixels\",\n\t\trequires: [\n\t\t\t\"text-field\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"text-max-width\": {\n\t\ttype: \"number\",\n\t\t\"default\": 10,\n\t\tminimum: 0,\n\t\tunits: \"ems\",\n\t\trequires: [\n\t\t\t\"text-field\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"text-line-height\": {\n\t\ttype: \"number\",\n\t\t\"default\": 1.2,\n\t\tunits: \"ems\",\n\t\trequires: [\n\t\t\t\"text-field\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"text-letter-spacing\": {\n\t\ttype: \"number\",\n\t\t\"default\": 0,\n\t\tunits: \"ems\",\n\t\trequires: [\n\t\t\t\"text-field\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"text-justify\": {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tauto: {\n\t\t\t},\n\t\t\tleft: {\n\t\t\t},\n\t\t\tcenter: {\n\t\t\t},\n\t\t\tright: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"center\",\n\t\trequires: [\n\t\t\t\"text-field\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"text-radial-offset\": {\n\t\ttype: \"number\",\n\t\tunits: \"ems\",\n\t\t\"default\": 0,\n\t\trequires: [\n\t\t\t\"text-field\"\n\t\t],\n\t\t\"property-type\": \"data-driven\",\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\"\n\t\t\t]\n\t\t}\n\t},\n\t\"text-variable-anchor\": {\n\t\ttype: \"array\",\n\t\tvalue: \"enum\",\n\t\tvalues: {\n\t\t\tcenter: {\n\t\t\t},\n\t\t\tleft: {\n\t\t\t},\n\t\t\tright: {\n\t\t\t},\n\t\t\ttop: {\n\t\t\t},\n\t\t\tbottom: {\n\t\t\t},\n\t\t\t\"top-left\": {\n\t\t\t},\n\t\t\t\"top-right\": {\n\t\t\t},\n\t\t\t\"bottom-left\": {\n\t\t\t},\n\t\t\t\"bottom-right\": {\n\t\t\t}\n\t\t},\n\t\trequires: [\n\t\t\t\"text-field\",\n\t\t\t{\n\t\t\t\t\"symbol-placement\": [\n\t\t\t\t\t\"point\"\n\t\t\t\t]\n\t\t\t}\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"text-variable-anchor-offset\": {\n\t\ttype: \"variableAnchorOffsetCollection\",\n\t\trequires: [\n\t\t\t\"text-field\",\n\t\t\t{\n\t\t\t\t\"symbol-placement\": [\n\t\t\t\t\t\"point\"\n\t\t\t\t]\n\t\t\t}\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"text-anchor\": {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tcenter: {\n\t\t\t},\n\t\t\tleft: {\n\t\t\t},\n\t\t\tright: {\n\t\t\t},\n\t\t\ttop: {\n\t\t\t},\n\t\t\tbottom: {\n\t\t\t},\n\t\t\t\"top-left\": {\n\t\t\t},\n\t\t\t\"top-right\": {\n\t\t\t},\n\t\t\t\"bottom-left\": {\n\t\t\t},\n\t\t\t\"bottom-right\": {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"center\",\n\t\trequires: [\n\t\t\t\"text-field\",\n\t\t\t{\n\t\t\t\t\"!\": \"text-variable-anchor\"\n\t\t\t}\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"text-max-angle\": {\n\t\ttype: \"number\",\n\t\t\"default\": 45,\n\t\tunits: \"degrees\",\n\t\trequires: [\n\t\t\t\"text-field\",\n\t\t\t{\n\t\t\t\t\"symbol-placement\": [\n\t\t\t\t\t\"line\",\n\t\t\t\t\t\"line-center\"\n\t\t\t\t]\n\t\t\t}\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"text-writing-mode\": {\n\t\ttype: \"array\",\n\t\tvalue: \"enum\",\n\t\tvalues: {\n\t\t\thorizontal: {\n\t\t\t},\n\t\t\tvertical: {\n\t\t\t}\n\t\t},\n\t\trequires: [\n\t\t\t\"text-field\",\n\t\t\t{\n\t\t\t\t\"symbol-placement\": [\n\t\t\t\t\t\"point\"\n\t\t\t\t]\n\t\t\t}\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"text-rotate\": {\n\t\ttype: \"number\",\n\t\t\"default\": 0,\n\t\tperiod: 360,\n\t\tunits: \"degrees\",\n\t\trequires: [\n\t\t\t\"text-field\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"text-padding\": {\n\t\ttype: \"number\",\n\t\t\"default\": 2,\n\t\tminimum: 0,\n\t\tunits: \"pixels\",\n\t\trequires: [\n\t\t\t\"text-field\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"text-keep-upright\": {\n\t\ttype: \"boolean\",\n\t\t\"default\": true,\n\t\trequires: [\n\t\t\t\"text-field\",\n\t\t\t{\n\t\t\t\t\"text-rotation-alignment\": \"map\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"symbol-placement\": [\n\t\t\t\t\t\"line\",\n\t\t\t\t\t\"line-center\"\n\t\t\t\t]\n\t\t\t}\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"text-transform\": {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tnone: {\n\t\t\t},\n\t\t\tuppercase: {\n\t\t\t},\n\t\t\tlowercase: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"none\",\n\t\trequires: [\n\t\t\t\"text-field\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"text-offset\": {\n\t\ttype: \"array\",\n\t\tvalue: \"number\",\n\t\tunits: \"ems\",\n\t\tlength: 2,\n\t\t\"default\": [\n\t\t\t0,\n\t\t\t0\n\t\t],\n\t\trequires: [\n\t\t\t\"text-field\",\n\t\t\t{\n\t\t\t\t\"!\": \"text-radial-offset\"\n\t\t\t}\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"text-allow-overlap\": {\n\t\ttype: \"boolean\",\n\t\t\"default\": false,\n\t\trequires: [\n\t\t\t\"text-field\",\n\t\t\t{\n\t\t\t\t\"!\": \"text-overlap\"\n\t\t\t}\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"text-overlap\": {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tnever: {\n\t\t\t},\n\t\t\talways: {\n\t\t\t},\n\t\t\tcooperative: {\n\t\t\t}\n\t\t},\n\t\trequires: [\n\t\t\t\"text-field\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"text-ignore-placement\": {\n\t\ttype: \"boolean\",\n\t\t\"default\": false,\n\t\trequires: [\n\t\t\t\"text-field\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"text-optional\": {\n\t\ttype: \"boolean\",\n\t\t\"default\": false,\n\t\trequires: [\n\t\t\t\"text-field\",\n\t\t\t\"icon-image\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\tvisibility: {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tvisible: {\n\t\t\t},\n\t\t\tnone: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"visible\",\n\t\t\"property-type\": \"constant\"\n\t}\n};\nvar layout_raster = {\n\tvisibility: {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tvisible: {\n\t\t\t},\n\t\t\tnone: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"visible\",\n\t\t\"property-type\": \"constant\"\n\t}\n};\nvar layout_hillshade = {\n\tvisibility: {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tvisible: {\n\t\t\t},\n\t\t\tnone: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"visible\",\n\t\t\"property-type\": \"constant\"\n\t}\n};\nvar filter = {\n\ttype: \"array\",\n\tvalue: \"*\"\n};\nvar filter_operator = {\n\ttype: \"enum\",\n\tvalues: {\n\t\t\"==\": {\n\t\t},\n\t\t\"!=\": {\n\t\t},\n\t\t\">\": {\n\t\t},\n\t\t\">=\": {\n\t\t},\n\t\t\"<\": {\n\t\t},\n\t\t\"<=\": {\n\t\t},\n\t\t\"in\": {\n\t\t},\n\t\t\"!in\": {\n\t\t},\n\t\tall: {\n\t\t},\n\t\tany: {\n\t\t},\n\t\tnone: {\n\t\t},\n\t\thas: {\n\t\t},\n\t\t\"!has\": {\n\t\t}\n\t}\n};\nvar geometry_type = {\n\ttype: \"enum\",\n\tvalues: {\n\t\tPoint: {\n\t\t},\n\t\tLineString: {\n\t\t},\n\t\tPolygon: {\n\t\t}\n\t}\n};\nvar function_stop = {\n\ttype: \"array\",\n\tminimum: 0,\n\tmaximum: 24,\n\tvalue: [\n\t\t\"number\",\n\t\t\"color\"\n\t],\n\tlength: 2\n};\nvar expression$1 = {\n\ttype: \"array\",\n\tvalue: \"*\",\n\tminimum: 1\n};\nvar light = {\n\tanchor: {\n\t\ttype: \"enum\",\n\t\t\"default\": \"viewport\",\n\t\tvalues: {\n\t\t\tmap: {\n\t\t\t},\n\t\t\tviewport: {\n\t\t\t}\n\t\t},\n\t\t\"property-type\": \"data-constant\",\n\t\ttransition: false,\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t}\n\t},\n\tposition: {\n\t\ttype: \"array\",\n\t\t\"default\": [\n\t\t\t1.15,\n\t\t\t210,\n\t\t\t30\n\t\t],\n\t\tlength: 3,\n\t\tvalue: \"number\",\n\t\t\"property-type\": \"data-constant\",\n\t\ttransition: true,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t}\n\t},\n\tcolor: {\n\t\ttype: \"color\",\n\t\t\"property-type\": \"data-constant\",\n\t\t\"default\": \"#ffffff\",\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\ttransition: true\n\t},\n\tintensity: {\n\t\ttype: \"number\",\n\t\t\"property-type\": \"data-constant\",\n\t\t\"default\": 0.5,\n\t\tminimum: 0,\n\t\tmaximum: 1,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\ttransition: true\n\t}\n};\nvar sky = {\n\t\"sky-color\": {\n\t\ttype: \"color\",\n\t\t\"property-type\": \"data-constant\",\n\t\t\"default\": \"#88C6FC\",\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\ttransition: true\n\t},\n\t\"horizon-color\": {\n\t\ttype: \"color\",\n\t\t\"property-type\": \"data-constant\",\n\t\t\"default\": \"#ffffff\",\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\ttransition: true\n\t},\n\t\"fog-color\": {\n\t\ttype: \"color\",\n\t\t\"property-type\": \"data-constant\",\n\t\t\"default\": \"#ffffff\",\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\ttransition: true\n\t},\n\t\"fog-ground-blend\": {\n\t\ttype: \"number\",\n\t\t\"property-type\": \"data-constant\",\n\t\t\"default\": 0.5,\n\t\tminimum: 0,\n\t\tmaximum: 1,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\ttransition: true\n\t},\n\t\"horizon-fog-blend\": {\n\t\ttype: \"number\",\n\t\t\"property-type\": \"data-constant\",\n\t\t\"default\": 0.8,\n\t\tminimum: 0,\n\t\tmaximum: 1,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\ttransition: true\n\t},\n\t\"sky-horizon-blend\": {\n\t\ttype: \"number\",\n\t\t\"property-type\": \"data-constant\",\n\t\t\"default\": 0.8,\n\t\tminimum: 0,\n\t\tmaximum: 1,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\ttransition: true\n\t},\n\t\"atmosphere-blend\": {\n\t\ttype: \"number\",\n\t\t\"property-type\": \"data-constant\",\n\t\t\"default\": 0.8,\n\t\tminimum: 0,\n\t\tmaximum: 1,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\ttransition: true\n\t}\n};\nvar terrain = {\n\tsource: {\n\t\ttype: \"string\",\n\t\trequired: true\n\t},\n\texaggeration: {\n\t\ttype: \"number\",\n\t\tminimum: 0,\n\t\t\"default\": 1\n\t}\n};\nvar projection = {\n\ttype: {\n\t\ttype: \"projectionDefinition\",\n\t\t\"default\": \"mercator\",\n\t\t\"property-type\": \"data-constant\",\n\t\ttransition: false,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t}\n\t}\n};\nvar paint = [\n\t\"paint_fill\",\n\t\"paint_line\",\n\t\"paint_circle\",\n\t\"paint_heatmap\",\n\t\"paint_fill-extrusion\",\n\t\"paint_symbol\",\n\t\"paint_raster\",\n\t\"paint_hillshade\",\n\t\"paint_color-relief\",\n\t\"paint_background\"\n];\nvar paint_fill = {\n\t\"fill-antialias\": {\n\t\ttype: \"boolean\",\n\t\t\"default\": true,\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"fill-opacity\": {\n\t\ttype: \"number\",\n\t\t\"default\": 1,\n\t\tminimum: 0,\n\t\tmaximum: 1,\n\t\ttransition: true,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\",\n\t\t\t\t\"feature-state\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"fill-color\": {\n\t\ttype: \"color\",\n\t\t\"default\": \"#000000\",\n\t\ttransition: true,\n\t\trequires: [\n\t\t\t{\n\t\t\t\t\"!\": \"fill-pattern\"\n\t\t\t}\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\",\n\t\t\t\t\"feature-state\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"fill-outline-color\": {\n\t\ttype: \"color\",\n\t\ttransition: true,\n\t\trequires: [\n\t\t\t{\n\t\t\t\t\"!\": \"fill-pattern\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"fill-antialias\": true\n\t\t\t}\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\",\n\t\t\t\t\"feature-state\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"fill-translate\": {\n\t\ttype: \"array\",\n\t\tvalue: \"number\",\n\t\tlength: 2,\n\t\t\"default\": [\n\t\t\t0,\n\t\t\t0\n\t\t],\n\t\ttransition: true,\n\t\tunits: \"pixels\",\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"fill-translate-anchor\": {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tmap: {\n\t\t\t},\n\t\t\tviewport: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"map\",\n\t\trequires: [\n\t\t\t\"fill-translate\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"fill-pattern\": {\n\t\ttype: \"resolvedImage\",\n\t\ttransition: true,\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"cross-faded-data-driven\"\n\t}\n};\nvar paint_line = {\n\t\"line-opacity\": {\n\t\ttype: \"number\",\n\t\t\"default\": 1,\n\t\tminimum: 0,\n\t\tmaximum: 1,\n\t\ttransition: true,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\",\n\t\t\t\t\"feature-state\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"line-color\": {\n\t\ttype: \"color\",\n\t\t\"default\": \"#000000\",\n\t\ttransition: true,\n\t\trequires: [\n\t\t\t{\n\t\t\t\t\"!\": \"line-pattern\"\n\t\t\t}\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\",\n\t\t\t\t\"feature-state\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"line-translate\": {\n\t\ttype: \"array\",\n\t\tvalue: \"number\",\n\t\tlength: 2,\n\t\t\"default\": [\n\t\t\t0,\n\t\t\t0\n\t\t],\n\t\ttransition: true,\n\t\tunits: \"pixels\",\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"line-translate-anchor\": {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tmap: {\n\t\t\t},\n\t\t\tviewport: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"map\",\n\t\trequires: [\n\t\t\t\"line-translate\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"line-width\": {\n\t\ttype: \"number\",\n\t\t\"default\": 1,\n\t\tminimum: 0,\n\t\ttransition: true,\n\t\tunits: \"pixels\",\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\",\n\t\t\t\t\"feature-state\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"line-gap-width\": {\n\t\ttype: \"number\",\n\t\t\"default\": 0,\n\t\tminimum: 0,\n\t\ttransition: true,\n\t\tunits: \"pixels\",\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\",\n\t\t\t\t\"feature-state\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"line-offset\": {\n\t\ttype: \"number\",\n\t\t\"default\": 0,\n\t\ttransition: true,\n\t\tunits: \"pixels\",\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\",\n\t\t\t\t\"feature-state\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"line-blur\": {\n\t\ttype: \"number\",\n\t\t\"default\": 0,\n\t\tminimum: 0,\n\t\ttransition: true,\n\t\tunits: \"pixels\",\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\",\n\t\t\t\t\"feature-state\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"line-dasharray\": {\n\t\ttype: \"array\",\n\t\tvalue: \"number\",\n\t\tminimum: 0,\n\t\ttransition: true,\n\t\tunits: \"line widths\",\n\t\trequires: [\n\t\t\t{\n\t\t\t\t\"!\": \"line-pattern\"\n\t\t\t}\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"cross-faded-data-driven\"\n\t},\n\t\"line-pattern\": {\n\t\ttype: \"resolvedImage\",\n\t\ttransition: true,\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"cross-faded-data-driven\"\n\t},\n\t\"line-gradient\": {\n\t\ttype: \"color\",\n\t\ttransition: false,\n\t\trequires: [\n\t\t\t{\n\t\t\t\t\"!\": \"line-dasharray\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"!\": \"line-pattern\"\n\t\t\t},\n\t\t\t{\n\t\t\t\tsource: \"geojson\",\n\t\t\t\thas: {\n\t\t\t\t\tlineMetrics: true\n\t\t\t\t}\n\t\t\t}\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"line-progress\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"color-ramp\"\n\t}\n};\nvar paint_circle = {\n\t\"circle-radius\": {\n\t\ttype: \"number\",\n\t\t\"default\": 5,\n\t\tminimum: 0,\n\t\ttransition: true,\n\t\tunits: \"pixels\",\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\",\n\t\t\t\t\"feature-state\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"circle-color\": {\n\t\ttype: \"color\",\n\t\t\"default\": \"#000000\",\n\t\ttransition: true,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\",\n\t\t\t\t\"feature-state\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"circle-blur\": {\n\t\ttype: \"number\",\n\t\t\"default\": 0,\n\t\ttransition: true,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\",\n\t\t\t\t\"feature-state\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"circle-opacity\": {\n\t\ttype: \"number\",\n\t\t\"default\": 1,\n\t\tminimum: 0,\n\t\tmaximum: 1,\n\t\ttransition: true,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\",\n\t\t\t\t\"feature-state\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"circle-translate\": {\n\t\ttype: \"array\",\n\t\tvalue: \"number\",\n\t\tlength: 2,\n\t\t\"default\": [\n\t\t\t0,\n\t\t\t0\n\t\t],\n\t\ttransition: true,\n\t\tunits: \"pixels\",\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"circle-translate-anchor\": {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tmap: {\n\t\t\t},\n\t\t\tviewport: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"map\",\n\t\trequires: [\n\t\t\t\"circle-translate\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"circle-pitch-scale\": {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tmap: {\n\t\t\t},\n\t\t\tviewport: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"map\",\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"circle-pitch-alignment\": {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tmap: {\n\t\t\t},\n\t\t\tviewport: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"viewport\",\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"circle-stroke-width\": {\n\t\ttype: \"number\",\n\t\t\"default\": 0,\n\t\tminimum: 0,\n\t\ttransition: true,\n\t\tunits: \"pixels\",\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\",\n\t\t\t\t\"feature-state\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"circle-stroke-color\": {\n\t\ttype: \"color\",\n\t\t\"default\": \"#000000\",\n\t\ttransition: true,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\",\n\t\t\t\t\"feature-state\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"circle-stroke-opacity\": {\n\t\ttype: \"number\",\n\t\t\"default\": 1,\n\t\tminimum: 0,\n\t\tmaximum: 1,\n\t\ttransition: true,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\",\n\t\t\t\t\"feature-state\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t}\n};\nvar paint_heatmap = {\n\t\"heatmap-radius\": {\n\t\ttype: \"number\",\n\t\t\"default\": 30,\n\t\tminimum: 1,\n\t\ttransition: true,\n\t\tunits: \"pixels\",\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\",\n\t\t\t\t\"feature-state\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"heatmap-weight\": {\n\t\ttype: \"number\",\n\t\t\"default\": 1,\n\t\tminimum: 0,\n\t\ttransition: false,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\",\n\t\t\t\t\"feature-state\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"heatmap-intensity\": {\n\t\ttype: \"number\",\n\t\t\"default\": 1,\n\t\tminimum: 0,\n\t\ttransition: true,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"heatmap-color\": {\n\t\ttype: \"color\",\n\t\t\"default\": [\n\t\t\t\"interpolate\",\n\t\t\t[\n\t\t\t\t\"linear\"\n\t\t\t],\n\t\t\t[\n\t\t\t\t\"heatmap-density\"\n\t\t\t],\n\t\t\t0,\n\t\t\t\"rgba(0, 0, 255, 0)\",\n\t\t\t0.1,\n\t\t\t\"royalblue\",\n\t\t\t0.3,\n\t\t\t\"cyan\",\n\t\t\t0.5,\n\t\t\t\"lime\",\n\t\t\t0.7,\n\t\t\t\"yellow\",\n\t\t\t1,\n\t\t\t\"red\"\n\t\t],\n\t\ttransition: false,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"heatmap-density\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"color-ramp\"\n\t},\n\t\"heatmap-opacity\": {\n\t\ttype: \"number\",\n\t\t\"default\": 1,\n\t\tminimum: 0,\n\t\tmaximum: 1,\n\t\ttransition: true,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t}\n};\nvar paint_symbol = {\n\t\"icon-opacity\": {\n\t\ttype: \"number\",\n\t\t\"default\": 1,\n\t\tminimum: 0,\n\t\tmaximum: 1,\n\t\ttransition: true,\n\t\trequires: [\n\t\t\t\"icon-image\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\",\n\t\t\t\t\"feature-state\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"icon-color\": {\n\t\ttype: \"color\",\n\t\t\"default\": \"#000000\",\n\t\ttransition: true,\n\t\trequires: [\n\t\t\t\"icon-image\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\",\n\t\t\t\t\"feature-state\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"icon-halo-color\": {\n\t\ttype: \"color\",\n\t\t\"default\": \"rgba(0, 0, 0, 0)\",\n\t\ttransition: true,\n\t\trequires: [\n\t\t\t\"icon-image\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\",\n\t\t\t\t\"feature-state\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"icon-halo-width\": {\n\t\ttype: \"number\",\n\t\t\"default\": 0,\n\t\tminimum: 0,\n\t\ttransition: true,\n\t\tunits: \"pixels\",\n\t\trequires: [\n\t\t\t\"icon-image\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\",\n\t\t\t\t\"feature-state\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"icon-halo-blur\": {\n\t\ttype: \"number\",\n\t\t\"default\": 0,\n\t\tminimum: 0,\n\t\ttransition: true,\n\t\tunits: \"pixels\",\n\t\trequires: [\n\t\t\t\"icon-image\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\",\n\t\t\t\t\"feature-state\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"icon-translate\": {\n\t\ttype: \"array\",\n\t\tvalue: \"number\",\n\t\tlength: 2,\n\t\t\"default\": [\n\t\t\t0,\n\t\t\t0\n\t\t],\n\t\ttransition: true,\n\t\tunits: \"pixels\",\n\t\trequires: [\n\t\t\t\"icon-image\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"icon-translate-anchor\": {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tmap: {\n\t\t\t},\n\t\t\tviewport: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"map\",\n\t\trequires: [\n\t\t\t\"icon-image\",\n\t\t\t\"icon-translate\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"text-opacity\": {\n\t\ttype: \"number\",\n\t\t\"default\": 1,\n\t\tminimum: 0,\n\t\tmaximum: 1,\n\t\ttransition: true,\n\t\trequires: [\n\t\t\t\"text-field\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\",\n\t\t\t\t\"feature-state\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"text-color\": {\n\t\ttype: \"color\",\n\t\t\"default\": \"#000000\",\n\t\ttransition: true,\n\t\toverridable: true,\n\t\trequires: [\n\t\t\t\"text-field\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\",\n\t\t\t\t\"feature-state\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"text-halo-color\": {\n\t\ttype: \"color\",\n\t\t\"default\": \"rgba(0, 0, 0, 0)\",\n\t\ttransition: true,\n\t\trequires: [\n\t\t\t\"text-field\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\",\n\t\t\t\t\"feature-state\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"text-halo-width\": {\n\t\ttype: \"number\",\n\t\t\"default\": 0,\n\t\tminimum: 0,\n\t\ttransition: true,\n\t\tunits: \"pixels\",\n\t\trequires: [\n\t\t\t\"text-field\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\",\n\t\t\t\t\"feature-state\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"text-halo-blur\": {\n\t\ttype: \"number\",\n\t\t\"default\": 0,\n\t\tminimum: 0,\n\t\ttransition: true,\n\t\tunits: \"pixels\",\n\t\trequires: [\n\t\t\t\"text-field\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\",\n\t\t\t\t\"feature-state\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"text-translate\": {\n\t\ttype: \"array\",\n\t\tvalue: \"number\",\n\t\tlength: 2,\n\t\t\"default\": [\n\t\t\t0,\n\t\t\t0\n\t\t],\n\t\ttransition: true,\n\t\tunits: \"pixels\",\n\t\trequires: [\n\t\t\t\"text-field\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"text-translate-anchor\": {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tmap: {\n\t\t\t},\n\t\t\tviewport: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"map\",\n\t\trequires: [\n\t\t\t\"text-field\",\n\t\t\t\"text-translate\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t}\n};\nvar paint_raster = {\n\t\"raster-opacity\": {\n\t\ttype: \"number\",\n\t\t\"default\": 1,\n\t\tminimum: 0,\n\t\tmaximum: 1,\n\t\ttransition: true,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"raster-hue-rotate\": {\n\t\ttype: \"number\",\n\t\t\"default\": 0,\n\t\tperiod: 360,\n\t\ttransition: true,\n\t\tunits: \"degrees\",\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"raster-brightness-min\": {\n\t\ttype: \"number\",\n\t\t\"default\": 0,\n\t\tminimum: 0,\n\t\tmaximum: 1,\n\t\ttransition: true,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"raster-brightness-max\": {\n\t\ttype: \"number\",\n\t\t\"default\": 1,\n\t\tminimum: 0,\n\t\tmaximum: 1,\n\t\ttransition: true,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"raster-saturation\": {\n\t\ttype: \"number\",\n\t\t\"default\": 0,\n\t\tminimum: -1,\n\t\tmaximum: 1,\n\t\ttransition: true,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"raster-contrast\": {\n\t\ttype: \"number\",\n\t\t\"default\": 0,\n\t\tminimum: -1,\n\t\tmaximum: 1,\n\t\ttransition: true,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"raster-resampling\": {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tlinear: {\n\t\t\t},\n\t\t\tnearest: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"linear\",\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"raster-fade-duration\": {\n\t\ttype: \"number\",\n\t\t\"default\": 300,\n\t\tminimum: 0,\n\t\ttransition: false,\n\t\tunits: \"milliseconds\",\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t}\n};\nvar paint_hillshade = {\n\t\"hillshade-illumination-direction\": {\n\t\ttype: \"numberArray\",\n\t\t\"default\": 335,\n\t\tminimum: 0,\n\t\tmaximum: 359,\n\t\ttransition: false,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"hillshade-illumination-altitude\": {\n\t\ttype: \"numberArray\",\n\t\t\"default\": 45,\n\t\tminimum: 0,\n\t\tmaximum: 90,\n\t\ttransition: false,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"hillshade-illumination-anchor\": {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tmap: {\n\t\t\t},\n\t\t\tviewport: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"viewport\",\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"hillshade-exaggeration\": {\n\t\ttype: \"number\",\n\t\t\"default\": 0.5,\n\t\tminimum: 0,\n\t\tmaximum: 1,\n\t\ttransition: true,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"hillshade-shadow-color\": {\n\t\ttype: \"colorArray\",\n\t\t\"default\": \"#000000\",\n\t\ttransition: true,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"hillshade-highlight-color\": {\n\t\ttype: \"colorArray\",\n\t\t\"default\": \"#FFFFFF\",\n\t\ttransition: true,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"hillshade-accent-color\": {\n\t\ttype: \"color\",\n\t\t\"default\": \"#000000\",\n\t\ttransition: true,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"hillshade-method\": {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tstandard: {\n\t\t\t},\n\t\t\tbasic: {\n\t\t\t},\n\t\t\tcombined: {\n\t\t\t},\n\t\t\tigor: {\n\t\t\t},\n\t\t\tmultidirectional: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"standard\",\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t}\n};\nvar paint_background = {\n\t\"background-color\": {\n\t\ttype: \"color\",\n\t\t\"default\": \"#000000\",\n\t\ttransition: true,\n\t\trequires: [\n\t\t\t{\n\t\t\t\t\"!\": \"background-pattern\"\n\t\t\t}\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"background-pattern\": {\n\t\ttype: \"resolvedImage\",\n\t\ttransition: true,\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"cross-faded\"\n\t},\n\t\"background-opacity\": {\n\t\ttype: \"number\",\n\t\t\"default\": 1,\n\t\tminimum: 0,\n\t\tmaximum: 1,\n\t\ttransition: true,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t}\n};\nvar transition = {\n\tduration: {\n\t\ttype: \"number\",\n\t\t\"default\": 300,\n\t\tminimum: 0,\n\t\tunits: \"milliseconds\"\n\t},\n\tdelay: {\n\t\ttype: \"number\",\n\t\t\"default\": 0,\n\t\tminimum: 0,\n\t\tunits: \"milliseconds\"\n\t}\n};\nvar promoteId = {\n\t\"*\": {\n\t\ttype: \"string\"\n\t}\n};\nvar v8Spec = {\n\t$version: $version,\n\t$root: $root,\n\tsources: sources,\n\tsource: source,\n\tsource_vector: source_vector,\n\tsource_raster: source_raster,\n\tsource_raster_dem: source_raster_dem,\n\tsource_geojson: source_geojson,\n\tsource_video: source_video,\n\tsource_image: source_image,\n\tlayer: layer,\n\tlayout: layout,\n\tlayout_background: layout_background,\n\tlayout_fill: layout_fill,\n\tlayout_circle: layout_circle,\n\tlayout_heatmap: layout_heatmap,\n\t\"layout_fill-extrusion\": {\n\tvisibility: {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tvisible: {\n\t\t\t},\n\t\t\tnone: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"visible\",\n\t\t\"property-type\": \"constant\"\n\t}\n},\n\tlayout_line: layout_line,\n\tlayout_symbol: layout_symbol,\n\tlayout_raster: layout_raster,\n\tlayout_hillshade: layout_hillshade,\n\t\"layout_color-relief\": {\n\tvisibility: {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tvisible: {\n\t\t\t},\n\t\t\tnone: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"visible\",\n\t\t\"property-type\": \"constant\"\n\t}\n},\n\tfilter: filter,\n\tfilter_operator: filter_operator,\n\tgeometry_type: geometry_type,\n\t\"function\": {\n\texpression: {\n\t\ttype: \"expression\"\n\t},\n\tstops: {\n\t\ttype: \"array\",\n\t\tvalue: \"function_stop\"\n\t},\n\tbase: {\n\t\ttype: \"number\",\n\t\t\"default\": 1,\n\t\tminimum: 0\n\t},\n\tproperty: {\n\t\ttype: \"string\",\n\t\t\"default\": \"$zoom\"\n\t},\n\ttype: {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tidentity: {\n\t\t\t},\n\t\t\texponential: {\n\t\t\t},\n\t\t\tinterval: {\n\t\t\t},\n\t\t\tcategorical: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"exponential\"\n\t},\n\tcolorSpace: {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\trgb: {\n\t\t\t},\n\t\t\tlab: {\n\t\t\t},\n\t\t\thcl: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"rgb\"\n\t},\n\t\"default\": {\n\t\ttype: \"*\",\n\t\trequired: false\n\t}\n},\n\tfunction_stop: function_stop,\n\texpression: expression$1,\n\tlight: light,\n\tsky: sky,\n\tterrain: terrain,\n\tprojection: projection,\n\tpaint: paint,\n\tpaint_fill: paint_fill,\n\t\"paint_fill-extrusion\": {\n\t\"fill-extrusion-opacity\": {\n\t\ttype: \"number\",\n\t\t\"default\": 1,\n\t\tminimum: 0,\n\t\tmaximum: 1,\n\t\ttransition: true,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"fill-extrusion-color\": {\n\t\ttype: \"color\",\n\t\t\"default\": \"#000000\",\n\t\ttransition: true,\n\t\trequires: [\n\t\t\t{\n\t\t\t\t\"!\": \"fill-extrusion-pattern\"\n\t\t\t}\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\",\n\t\t\t\t\"feature-state\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"fill-extrusion-translate\": {\n\t\ttype: \"array\",\n\t\tvalue: \"number\",\n\t\tlength: 2,\n\t\t\"default\": [\n\t\t\t0,\n\t\t\t0\n\t\t],\n\t\ttransition: true,\n\t\tunits: \"pixels\",\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"fill-extrusion-translate-anchor\": {\n\t\ttype: \"enum\",\n\t\tvalues: {\n\t\t\tmap: {\n\t\t\t},\n\t\t\tviewport: {\n\t\t\t}\n\t\t},\n\t\t\"default\": \"map\",\n\t\trequires: [\n\t\t\t\"fill-extrusion-translate\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"fill-extrusion-pattern\": {\n\t\ttype: \"resolvedImage\",\n\t\ttransition: true,\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"cross-faded-data-driven\"\n\t},\n\t\"fill-extrusion-height\": {\n\t\ttype: \"number\",\n\t\t\"default\": 0,\n\t\tminimum: 0,\n\t\tunits: \"meters\",\n\t\ttransition: true,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\",\n\t\t\t\t\"feature-state\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"fill-extrusion-base\": {\n\t\ttype: \"number\",\n\t\t\"default\": 0,\n\t\tminimum: 0,\n\t\tunits: \"meters\",\n\t\ttransition: true,\n\t\trequires: [\n\t\t\t\"fill-extrusion-height\"\n\t\t],\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\",\n\t\t\t\t\"feature\",\n\t\t\t\t\"feature-state\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-driven\"\n\t},\n\t\"fill-extrusion-vertical-gradient\": {\n\t\ttype: \"boolean\",\n\t\t\"default\": true,\n\t\ttransition: false,\n\t\texpression: {\n\t\t\tinterpolated: false,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t}\n},\n\tpaint_line: paint_line,\n\tpaint_circle: paint_circle,\n\tpaint_heatmap: paint_heatmap,\n\tpaint_symbol: paint_symbol,\n\tpaint_raster: paint_raster,\n\tpaint_hillshade: paint_hillshade,\n\t\"paint_color-relief\": {\n\t\"color-relief-opacity\": {\n\t\ttype: \"number\",\n\t\t\"default\": 1,\n\t\tminimum: 0,\n\t\tmaximum: 1,\n\t\ttransition: true,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"zoom\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"data-constant\"\n\t},\n\t\"color-relief-color\": {\n\t\ttype: \"color\",\n\t\ttransition: false,\n\t\texpression: {\n\t\t\tinterpolated: true,\n\t\t\tparameters: [\n\t\t\t\t\"elevation\"\n\t\t\t]\n\t\t},\n\t\t\"property-type\": \"color-ramp\"\n\t}\n},\n\tpaint_background: paint_background,\n\ttransition: transition,\n\t\"property-type\": {\n\t\"data-driven\": {\n\t\ttype: \"property-type\"\n\t},\n\t\"cross-faded\": {\n\t\ttype: \"property-type\"\n\t},\n\t\"cross-faded-data-driven\": {\n\t\ttype: \"property-type\"\n\t},\n\t\"color-ramp\": {\n\t\ttype: \"property-type\"\n\t},\n\t\"data-constant\": {\n\t\ttype: \"property-type\"\n\t},\n\tconstant: {\n\t\ttype: \"property-type\"\n\t}\n},\n\tpromoteId: promoteId\n};\n\nconst refProperties = ['type', 'source', 'source-layer', 'minzoom', 'maxzoom', 'filter', 'layout'];\n\nfunction deref(layer, parent) {\n const result = {};\n for (const k in layer) {\n if (k !== 'ref') {\n result[k] = layer[k];\n }\n }\n refProperties.forEach((k) => {\n if (k in parent) {\n result[k] = parent[k];\n }\n });\n return result;\n}\n/**\n *\n * The input is not modified. The output may contain references to portions\n * of the input.\n *\n * @param layers - array of layers, some of which may contain `ref` properties\n * whose value is the `id` of another property\n * @returns a new array where such layers have been augmented with the 'type', 'source', etc. properties\n * from the parent layer, and the `ref` property has been removed.\n */\nfunction derefLayers(layers) {\n layers = layers.slice();\n const map = Object.create(null);\n for (let i = 0; i < layers.length; i++) {\n map[layers[i].id] = layers[i];\n }\n for (let i = 0; i < layers.length; i++) {\n if ('ref' in layers[i]) {\n layers[i] = deref(layers[i], map[layers[i].ref]);\n }\n }\n return layers;\n}\n\n/**\n * Deeply compares two object literals.\n *\n * @private\n */\nfunction deepEqual(a, b) {\n if (Array.isArray(a)) {\n if (!Array.isArray(b) || a.length !== b.length)\n return false;\n for (let i = 0; i < a.length; i++) {\n if (!deepEqual(a[i], b[i]))\n return false;\n }\n return true;\n }\n if (typeof a === 'object' && a !== null && b !== null) {\n if (!(typeof b === 'object'))\n return false;\n const keys = Object.keys(a);\n if (keys.length !== Object.keys(b).length)\n return false;\n for (const key in a) {\n if (!deepEqual(a[key], b[key]))\n return false;\n }\n return true;\n }\n return a === b;\n}\n\n/**\n * The main reason for this method is to allow type check when adding a command to the array.\n * @param commands - The commands array to add to\n * @param command - The command to add\n */\nfunction addCommand(commands, command) {\n commands.push(command);\n}\nfunction addSource(sourceId, after, commands) {\n addCommand(commands, { command: 'addSource', args: [sourceId, after[sourceId]] });\n}\nfunction removeSource(sourceId, commands, sourcesRemoved) {\n addCommand(commands, { command: 'removeSource', args: [sourceId] });\n sourcesRemoved[sourceId] = true;\n}\nfunction updateSource(sourceId, after, commands, sourcesRemoved) {\n removeSource(sourceId, commands, sourcesRemoved);\n addSource(sourceId, after, commands);\n}\nfunction canUpdateGeoJSON(before, after, sourceId) {\n let prop;\n for (prop in before[sourceId]) {\n if (!Object.prototype.hasOwnProperty.call(before[sourceId], prop))\n continue;\n if (prop !== 'data' && !deepEqual(before[sourceId][prop], after[sourceId][prop])) {\n return false;\n }\n }\n for (prop in after[sourceId]) {\n if (!Object.prototype.hasOwnProperty.call(after[sourceId], prop))\n continue;\n if (prop !== 'data' && !deepEqual(before[sourceId][prop], after[sourceId][prop])) {\n return false;\n }\n }\n return true;\n}\nfunction diffSources(before, after, commands, sourcesRemoved) {\n before = before || {};\n after = after || {};\n let sourceId;\n // look for sources to remove\n for (sourceId in before) {\n if (!Object.prototype.hasOwnProperty.call(before, sourceId))\n continue;\n if (!Object.prototype.hasOwnProperty.call(after, sourceId)) {\n removeSource(sourceId, commands, sourcesRemoved);\n }\n }\n // look for sources to add/update\n for (sourceId in after) {\n if (!Object.prototype.hasOwnProperty.call(after, sourceId))\n continue;\n if (!Object.prototype.hasOwnProperty.call(before, sourceId)) {\n addSource(sourceId, after, commands);\n }\n else if (!deepEqual(before[sourceId], after[sourceId])) {\n if (before[sourceId].type === 'geojson' && after[sourceId].type === 'geojson' && canUpdateGeoJSON(before, after, sourceId)) {\n addCommand(commands, { command: 'setGeoJSONSourceData', args: [sourceId, after[sourceId].data] });\n }\n else {\n // no update command, must remove then add\n updateSource(sourceId, after, commands, sourcesRemoved);\n }\n }\n }\n}\nfunction diffLayerPropertyChanges(before, after, commands, layerId, klass, command) {\n before = before || {};\n after = after || {};\n for (const prop in before) {\n if (!Object.prototype.hasOwnProperty.call(before, prop))\n continue;\n if (!deepEqual(before[prop], after[prop])) {\n commands.push({ command, args: [layerId, prop, after[prop], klass] });\n }\n }\n for (const prop in after) {\n if (!Object.prototype.hasOwnProperty.call(after, prop) || Object.prototype.hasOwnProperty.call(before, prop))\n continue;\n if (!deepEqual(before[prop], after[prop])) {\n commands.push({ command, args: [layerId, prop, after[prop], klass] });\n }\n }\n}\nfunction pluckId(layer) {\n return layer.id;\n}\nfunction indexById(group, layer) {\n group[layer.id] = layer;\n return group;\n}\nfunction diffLayers(before, after, commands) {\n before = before || [];\n after = after || [];\n // order of layers by id\n const beforeOrder = before.map(pluckId);\n const afterOrder = after.map(pluckId);\n // index of layer by id\n const beforeIndex = before.reduce(indexById, {});\n const afterIndex = after.reduce(indexById, {});\n // track order of layers as if they have been mutated\n const tracker = beforeOrder.slice();\n // layers that have been added do not need to be diffed\n const clean = Object.create(null);\n let layerId;\n let beforeLayer;\n let afterLayer;\n let insertBeforeLayerId;\n let prop;\n // remove layers\n for (let i = 0, d = 0; i < beforeOrder.length; i++) {\n layerId = beforeOrder[i];\n if (!Object.prototype.hasOwnProperty.call(afterIndex, layerId)) {\n addCommand(commands, { command: 'removeLayer', args: [layerId] });\n tracker.splice(tracker.indexOf(layerId, d), 1);\n }\n else {\n // limit where in tracker we need to look for a match\n d++;\n }\n }\n // add/reorder layers\n for (let i = 0, d = 0; i < afterOrder.length; i++) {\n // work backwards as insert is before an existing layer\n layerId = afterOrder[afterOrder.length - 1 - i];\n if (tracker[tracker.length - 1 - i] === layerId)\n continue;\n if (Object.prototype.hasOwnProperty.call(beforeIndex, layerId)) {\n // remove the layer before we insert at the correct position\n addCommand(commands, { command: 'removeLayer', args: [layerId] });\n tracker.splice(tracker.lastIndexOf(layerId, tracker.length - d), 1);\n }\n else {\n // limit where in tracker we need to look for a match\n d++;\n }\n // add layer at correct position\n insertBeforeLayerId = tracker[tracker.length - i];\n addCommand(commands, { command: 'addLayer', args: [afterIndex[layerId], insertBeforeLayerId] });\n tracker.splice(tracker.length - i, 0, layerId);\n clean[layerId] = true;\n }\n // update layers\n for (let i = 0; i < afterOrder.length; i++) {\n layerId = afterOrder[i];\n beforeLayer = beforeIndex[layerId];\n afterLayer = afterIndex[layerId];\n // no need to update if previously added (new or moved)\n if (clean[layerId] || deepEqual(beforeLayer, afterLayer))\n continue;\n // If source, source-layer, or type have changes, then remove the layer\n // and add it back 'from scratch'.\n if (!deepEqual(beforeLayer.source, afterLayer.source) || !deepEqual(beforeLayer['source-layer'], afterLayer['source-layer']) || !deepEqual(beforeLayer.type, afterLayer.type)) {\n addCommand(commands, { command: 'removeLayer', args: [layerId] });\n // we add the layer back at the same position it was already in, so\n // there's no need to update the `tracker`\n insertBeforeLayerId = tracker[tracker.lastIndexOf(layerId) + 1];\n addCommand(commands, { command: 'addLayer', args: [afterLayer, insertBeforeLayerId] });\n continue;\n }\n // layout, paint, filter, minzoom, maxzoom\n diffLayerPropertyChanges(beforeLayer.layout, afterLayer.layout, commands, layerId, null, 'setLayoutProperty');\n diffLayerPropertyChanges(beforeLayer.paint, afterLayer.paint, commands, layerId, null, 'setPaintProperty');\n if (!deepEqual(beforeLayer.filter, afterLayer.filter)) {\n addCommand(commands, { command: 'setFilter', args: [layerId, afterLayer.filter] });\n }\n if (!deepEqual(beforeLayer.minzoom, afterLayer.minzoom) || !deepEqual(beforeLayer.maxzoom, afterLayer.maxzoom)) {\n addCommand(commands, { command: 'setLayerZoomRange', args: [layerId, afterLayer.minzoom, afterLayer.maxzoom] });\n }\n // handle all other layer props, including paint.*\n for (prop in beforeLayer) {\n if (!Object.prototype.hasOwnProperty.call(beforeLayer, prop))\n continue;\n if (prop === 'layout' || prop === 'paint' || prop === 'filter' ||\n prop === 'metadata' || prop === 'minzoom' || prop === 'maxzoom')\n continue;\n if (prop.indexOf('paint.') === 0) {\n diffLayerPropertyChanges(beforeLayer[prop], afterLayer[prop], commands, layerId, prop.slice(6), 'setPaintProperty');\n }\n else if (!deepEqual(beforeLayer[prop], afterLayer[prop])) {\n addCommand(commands, { command: 'setLayerProperty', args: [layerId, prop, afterLayer[prop]] });\n }\n }\n for (prop in afterLayer) {\n if (!Object.prototype.hasOwnProperty.call(afterLayer, prop) || Object.prototype.hasOwnProperty.call(beforeLayer, prop))\n continue;\n if (prop === 'layout' || prop === 'paint' || prop === 'filter' ||\n prop === 'metadata' || prop === 'minzoom' || prop === 'maxzoom')\n continue;\n if (prop.indexOf('paint.') === 0) {\n diffLayerPropertyChanges(beforeLayer[prop], afterLayer[prop], commands, layerId, prop.slice(6), 'setPaintProperty');\n }\n else if (!deepEqual(beforeLayer[prop], afterLayer[prop])) {\n addCommand(commands, { command: 'setLayerProperty', args: [layerId, prop, afterLayer[prop]] });\n }\n }\n }\n}\n/**\n * Diff two stylesheet\n *\n * Creates semanticly aware diffs that can easily be applied at runtime.\n * Operations produced by the diff closely resemble the maplibre-gl-js API. Any\n * error creating the diff will fall back to the 'setStyle' operation.\n *\n * Example diff:\n * [\n * { command: 'setConstant', args: ['@water', '#0000FF'] },\n * { command: 'setPaintProperty', args: ['background', 'background-color', 'black'] }\n * ]\n *\n * @private\n * @param {*} [before] stylesheet to compare from\n * @param {*} after stylesheet to compare to\n * @returns Array list of changes\n */\nfunction diff(before, after) {\n if (!before)\n return [{ command: 'setStyle', args: [after] }];\n let commands = [];\n try {\n // Handle changes to top-level properties\n if (!deepEqual(before.version, after.version)) {\n return [{ command: 'setStyle', args: [after] }];\n }\n if (!deepEqual(before.center, after.center)) {\n commands.push({ command: 'setCenter', args: [after.center] });\n }\n if (!deepEqual(before.state, after.state)) {\n commands.push({ command: 'setGlobalState', args: [after.state] });\n }\n if (!deepEqual(before.centerAltitude, after.centerAltitude)) {\n commands.push({ command: 'setCenterAltitude', args: [after.centerAltitude] });\n }\n if (!deepEqual(before.zoom, after.zoom)) {\n commands.push({ command: 'setZoom', args: [after.zoom] });\n }\n if (!deepEqual(before.bearing, after.bearing)) {\n commands.push({ command: 'setBearing', args: [after.bearing] });\n }\n if (!deepEqual(before.pitch, after.pitch)) {\n commands.push({ command: 'setPitch', args: [after.pitch] });\n }\n if (!deepEqual(before.roll, after.roll)) {\n commands.push({ command: 'setRoll', args: [after.roll] });\n }\n if (!deepEqual(before.sprite, after.sprite)) {\n commands.push({ command: 'setSprite', args: [after.sprite] });\n }\n if (!deepEqual(before.glyphs, after.glyphs)) {\n commands.push({ command: 'setGlyphs', args: [after.glyphs] });\n }\n if (!deepEqual(before.transition, after.transition)) {\n commands.push({ command: 'setTransition', args: [after.transition] });\n }\n if (!deepEqual(before.light, after.light)) {\n commands.push({ command: 'setLight', args: [after.light] });\n }\n if (!deepEqual(before.terrain, after.terrain)) {\n commands.push({ command: 'setTerrain', args: [after.terrain] });\n }\n if (!deepEqual(before.sky, after.sky)) {\n commands.push({ command: 'setSky', args: [after.sky] });\n }\n if (!deepEqual(before.projection, after.projection)) {\n commands.push({ command: 'setProjection', args: [after.projection] });\n }\n // Handle changes to `sources`\n // If a source is to be removed, we also--before the removeSource\n // command--need to remove all the style layers that depend on it.\n const sourcesRemoved = {};\n // First collect the {add,remove}Source commands\n const removeOrAddSourceCommands = [];\n diffSources(before.sources, after.sources, removeOrAddSourceCommands, sourcesRemoved);\n // Push a removeLayer command for each style layer that depends on a\n // source that's being removed.\n // Also, exclude any such layers them from the input to `diffLayers`\n // below, so that diffLayers produces the appropriate `addLayers`\n // command\n const beforeLayers = [];\n if (before.layers) {\n before.layers.forEach((layer) => {\n if ('source' in layer && sourcesRemoved[layer.source]) {\n commands.push({ command: 'removeLayer', args: [layer.id] });\n }\n else {\n beforeLayers.push(layer);\n }\n });\n }\n commands = commands.concat(removeOrAddSourceCommands);\n // Handle changes to `layers`\n diffLayers(beforeLayers, after.layers, commands);\n }\n catch (e) {\n // fall back to setStyle\n console.warn('Unable to compute style diff:', e);\n commands = [{ command: 'setStyle', args: [after] }];\n }\n return commands;\n}\n\n// Note: Do not inherit from Error. It breaks when transpiling to ES5.\nclass ValidationError {\n constructor(key, value, message, identifier) {\n this.message = (key ? `${key}: ` : '') + message;\n if (identifier)\n this.identifier = identifier;\n if (value !== null && value !== undefined && value.__line__) {\n this.line = value.__line__;\n }\n }\n}\n\n// Note: Do not inherit from Error. It breaks when transpiling to ES5.\nclass ParsingError {\n constructor(error) {\n this.error = error;\n this.message = error.message;\n const match = error.message.match(/line (\\d+)/);\n this.line = match ? parseInt(match[1], 10) : 0;\n }\n}\n\nfunction extendBy(output, ...inputs) {\n for (const input of inputs) {\n for (const k in input) {\n output[k] = input[k];\n }\n }\n return output;\n}\n\nclass ExpressionParsingError extends Error {\n constructor(key, message) {\n super(message);\n this.message = message;\n this.key = key;\n }\n}\n\n/**\n * Tracks `let` bindings during expression parsing.\n * @private\n */\nclass Scope {\n constructor(parent, bindings = []) {\n this.parent = parent;\n this.bindings = {};\n for (const [name, expression] of bindings) {\n this.bindings[name] = expression;\n }\n }\n concat(bindings) {\n return new Scope(this, bindings);\n }\n get(name) {\n if (this.bindings[name]) {\n return this.bindings[name];\n }\n if (this.parent) {\n return this.parent.get(name);\n }\n throw new Error(`${name} not found in scope.`);\n }\n has(name) {\n if (this.bindings[name])\n return true;\n return this.parent ? this.parent.has(name) : false;\n }\n}\n\nconst NullType = { kind: 'null' };\nconst NumberType = { kind: 'number' };\nconst StringType = { kind: 'string' };\nconst BooleanType = { kind: 'boolean' };\nconst ColorType = { kind: 'color' };\nconst ProjectionDefinitionType = { kind: 'projectionDefinition' };\nconst ObjectType = { kind: 'object' };\nconst ValueType = { kind: 'value' };\nconst ErrorType = { kind: 'error' };\nconst CollatorType = { kind: 'collator' };\nconst FormattedType = { kind: 'formatted' };\nconst PaddingType = { kind: 'padding' };\nconst ColorArrayType = { kind: 'colorArray' };\nconst NumberArrayType = { kind: 'numberArray' };\nconst ResolvedImageType = { kind: 'resolvedImage' };\nconst VariableAnchorOffsetCollectionType = { kind: 'variableAnchorOffsetCollection' };\nfunction array(itemType, N) {\n return {\n kind: 'array',\n itemType,\n N\n };\n}\nfunction typeToString(type) {\n if (type.kind === 'array') {\n const itemType = typeToString(type.itemType);\n return typeof type.N === 'number' ?\n `array<${itemType}, ${type.N}>` :\n type.itemType.kind === 'value' ? 'array' : `array<${itemType}>`;\n }\n else {\n return type.kind;\n }\n}\nconst valueMemberTypes = [\n NullType,\n NumberType,\n StringType,\n BooleanType,\n ColorType,\n ProjectionDefinitionType,\n FormattedType,\n ObjectType,\n array(ValueType),\n PaddingType,\n NumberArrayType,\n ColorArrayType,\n ResolvedImageType,\n VariableAnchorOffsetCollectionType\n];\n/**\n * Returns null if `t` is a subtype of `expected`; otherwise returns an\n * error message.\n * @private\n */\nfunction checkSubtype(expected, t) {\n if (t.kind === 'error') {\n // Error is a subtype of every type\n return null;\n }\n else if (expected.kind === 'array') {\n if (t.kind === 'array' &&\n ((t.N === 0 && t.itemType.kind === 'value') || !checkSubtype(expected.itemType, t.itemType)) &&\n (typeof expected.N !== 'number' || expected.N === t.N)) {\n return null;\n }\n }\n else if (expected.kind === t.kind) {\n return null;\n }\n else if (expected.kind === 'value') {\n for (const memberType of valueMemberTypes) {\n if (!checkSubtype(memberType, t)) {\n return null;\n }\n }\n }\n return `Expected ${typeToString(expected)} but found ${typeToString(t)} instead.`;\n}\nfunction isValidType(provided, allowedTypes) {\n return allowedTypes.some(t => t.kind === provided.kind);\n}\nfunction isValidNativeType(provided, allowedTypes) {\n return allowedTypes.some(t => {\n if (t === 'null') {\n return provided === null;\n }\n else if (t === 'array') {\n return Array.isArray(provided);\n }\n else if (t === 'object') {\n return provided && !Array.isArray(provided) && typeof provided === 'object';\n }\n else {\n return t === typeof provided;\n }\n });\n}\n/**\n * Verify whether the specified type is of the same type as the specified sample.\n *\n * @param provided Type to verify\n * @param sample Sample type to reference\n * @returns `true` if both objects are of the same type, `false` otherwise\n * @example basic types\n * if (verifyType(outputType, ValueType)) {\n * // type narrowed to:\n * outputType.kind; // 'value'\n * }\n * @example array types\n * if (verifyType(outputType, array(NumberType))) {\n * // type narrowed to:\n * outputType.kind; // 'array'\n * outputType.itemType; // NumberTypeT\n * outputType.itemType.kind; // 'number'\n * }\n */\nfunction verifyType(provided, sample) {\n if (provided.kind === 'array' && sample.kind === 'array') {\n return provided.itemType.kind === sample.itemType.kind && typeof provided.N === 'number';\n }\n return provided.kind === sample.kind;\n}\n\n// See https://observablehq.com/@mbostock/lab-and-rgb\nconst Xn = 0.96422, Yn = 1, Zn = 0.82521, t0 = 4 / 29, t1 = 6 / 29, t2 = 3 * t1 * t1, t3 = t1 * t1 * t1, deg2rad = Math.PI / 180, rad2deg = 180 / Math.PI;\nfunction constrainAngle(angle) {\n angle = angle % 360;\n if (angle < 0) {\n angle += 360;\n }\n return angle;\n}\nfunction rgbToLab([r, g, b, alpha]) {\n r = rgb2xyz(r);\n g = rgb2xyz(g);\n b = rgb2xyz(b);\n let x, z;\n const y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn);\n if (r === g && g === b) {\n x = z = y;\n }\n else {\n x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn);\n z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn);\n }\n const l = 116 * y - 16;\n return [(l < 0) ? 0 : l, 500 * (x - y), 200 * (y - z), alpha];\n}\nfunction rgb2xyz(x) {\n return (x <= 0.04045) ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);\n}\nfunction xyz2lab(t) {\n return (t > t3) ? Math.pow(t, 1 / 3) : t / t2 + t0;\n}\nfunction labToRgb([l, a, b, alpha]) {\n let y = (l + 16) / 116, x = isNaN(a) ? y : y + a / 500, z = isNaN(b) ? y : y - b / 200;\n y = Yn * lab2xyz(y);\n x = Xn * lab2xyz(x);\n z = Zn * lab2xyz(z);\n return [\n xyz2rgb(3.1338561 * x - 1.6168667 * y - 0.4906146 * z), // D50 -> sRGB\n xyz2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z),\n xyz2rgb(0.0719453 * x - 0.2289914 * y + 1.4052427 * z),\n alpha,\n ];\n}\nfunction xyz2rgb(x) {\n x = (x <= 0.00304) ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055;\n return (x < 0) ? 0 : (x > 1) ? 1 : x; // clip to 0..1 range\n}\nfunction lab2xyz(t) {\n return (t > t1) ? t * t * t : t2 * (t - t0);\n}\nfunction rgbToHcl(rgbColor) {\n const [l, a, b, alpha] = rgbToLab(rgbColor);\n const c = Math.sqrt(a * a + b * b);\n const h = Math.round(c * 10000) ? constrainAngle(Math.atan2(b, a) * rad2deg) : NaN;\n return [h, c, l, alpha];\n}\nfunction hclToRgb([h, c, l, alpha]) {\n h = isNaN(h) ? 0 : h * deg2rad;\n return labToRgb([l, Math.cos(h) * c, Math.sin(h) * c, alpha]);\n}\n// https://drafts.csswg.org/css-color-4/#hsl-to-rgb\nfunction hslToRgb([h, s, l, alpha]) {\n h = constrainAngle(h);\n s /= 100;\n l /= 100;\n function f(n) {\n const k = (n + h / 30) % 12;\n const a = s * Math.min(l, 1 - l);\n return l - a * Math.max(-1, Math.min(k - 3, 9 - k, 1));\n }\n return [f(0), f(8), f(4), alpha];\n}\n\n// polyfill for Object.hasOwn\nconst hasOwnProperty = Object.hasOwn ||\n function hasOwnProperty(object, key) {\n return Object.prototype.hasOwnProperty.call(object, key);\n };\nfunction getOwn(object, key) {\n return hasOwnProperty(object, key) ? object[key] : undefined;\n}\n\n/**\n * CSS color parser compliant with CSS Color 4 Specification.\n * Supports: named colors, `transparent` keyword, all rgb hex notations,\n * rgb(), rgba(), hsl() and hsla() functions.\n * Does not round the parsed values to integers from the range 0..255.\n *\n * Syntax:\n *\n * <alpha-value> = <number> | <percentage>\n * <hue> = <number> | <angle>\n *\n * rgb() = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <number>{3} [ / <alpha-value> ]? )\n * rgb() = rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <number>#{3} , <alpha-value>? )\n *\n * hsl() = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? )\n * hsl() = hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )\n *\n * Caveats:\n * - <angle> - <number> with optional `deg` suffix; `grad`, `rad`, `turn` are not supported\n * - `none` keyword is not supported\n * - comments inside rgb()/hsl() are not supported\n * - legacy color syntax rgba() is supported with an identical grammar and behavior to rgb()\n * - legacy color syntax hsla() is supported with an identical grammar and behavior to hsl()\n *\n * @param input CSS color string to parse.\n * @returns Color in sRGB color space, with `red`, `green`, `blue`\n * and `alpha` channels normalized to the range 0..1,\n * or `undefined` if the input is not a valid color string.\n */\nfunction parseCssColor(input) {\n input = input.toLowerCase().trim();\n if (input === 'transparent') {\n return [0, 0, 0, 0];\n }\n // 'white', 'black', 'blue'\n const namedColorsMatch = getOwn(namedColors, input);\n if (namedColorsMatch) {\n const [r, g, b] = namedColorsMatch;\n return [r / 255, g / 255, b / 255, 1];\n }\n // #f0c, #f0cf, #ff00cc, #ff00ccff\n if (input.startsWith('#')) {\n const hexRegexp = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/;\n if (hexRegexp.test(input)) {\n const step = input.length < 6 ? 1 : 2;\n let i = 1;\n return [\n parseHex(input.slice(i, i += step)),\n parseHex(input.slice(i, i += step)),\n parseHex(input.slice(i, i += step)),\n parseHex(input.slice(i, i + step) || 'ff'),\n ];\n }\n }\n // rgb(128 0 0), rgb(50% 0% 0%), rgba(255,0,255,0.6), rgb(255 0 255 / 60%), rgb(100% 0% 100% /.6)\n if (input.startsWith('rgb')) {\n const rgbRegExp = /^rgba?\\(\\s*([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/;\n const rgbMatch = input.match(rgbRegExp);\n if (rgbMatch) {\n const [_, // eslint-disable-line @typescript-eslint/no-unused-vars\n r, // <numeric>\n rp, // % (optional)\n f1, // , (optional)\n g, // <numeric>\n gp, // % (optional)\n f2, // , (optional)\n b, // <numeric>\n bp, // % (optional)\n f3, // ,|/ (optional)\n a, // <numeric> (optional)\n ap, // % (optional)\n ] = rgbMatch;\n const argFormat = [f1 || ' ', f2 || ' ', f3].join('');\n if (argFormat === ' ' ||\n argFormat === ' /' ||\n argFormat === ',,' ||\n argFormat === ',,,') {\n const valFormat = [rp, gp, bp].join('');\n const maxValue = (valFormat === '%%%') ? 100 :\n (valFormat === '') ? 255 : 0;\n if (maxValue) {\n const rgba = [\n clamp(+r / maxValue, 0, 1),\n clamp(+g / maxValue, 0, 1),\n clamp(+b / maxValue, 0, 1),\n a ? parseAlpha(+a, ap) : 1,\n ];\n if (validateNumbers(rgba)) {\n return rgba;\n }\n // invalid numbers\n }\n // values must be all numbers or all percentages\n }\n return; // comma optional syntax requires no commas at all\n }\n }\n // hsl(120 50% 80%), hsla(120deg,50%,80%,.9), hsl(12e1 50% 80% / 90%)\n const hslRegExp = /^hsla?\\(\\s*([\\de.+-]+)(?:deg)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/;\n const hslMatch = input.match(hslRegExp);\n if (hslMatch) {\n const [_, // eslint-disable-line @typescript-eslint/no-unused-vars\n h, // <numeric>\n f1, // , (optional)\n s, // <numeric>\n f2, // , (optional)\n l, // <numeric>\n f3, // ,|/ (optional)\n a, // <numeric> (optional)\n ap, // % (optional)\n ] = hslMatch;\n const argFormat = [f1 || ' ', f2 || ' ', f3].join('');\n if (argFormat === ' ' ||\n argFormat === ' /' ||\n argFormat === ',,' ||\n argFormat === ',,,') {\n const hsla = [\n +h,\n clamp(+s, 0, 100),\n clamp(+l, 0, 100),\n a ? parseAlpha(+a, ap) : 1,\n ];\n if (validateNumbers(hsla)) {\n return hslToRgb(hsla);\n }\n // invalid numbers\n }\n // comma optional syntax requires no commas at all\n }\n}\nfunction parseHex(hex) {\n return parseInt(hex.padEnd(2, hex), 16) / 255;\n}\nfunction parseAlpha(a, asPercentage) {\n return clamp(asPercentage ? (a / 100) : a, 0, 1);\n}\nfunction clamp(n, min, max) {\n return Math.min(Math.max(min, n), max);\n}\n/**\n * The regular expression for numeric values is not super specific, and it may\n * happen that it will accept a value that is not a valid number. In order to\n * detect and eliminate such values this function exists.\n *\n * @param array Array of uncertain numbers.\n * @returns `true` if the specified array contains only valid numbers, `false` otherwise.\n */\nfunction validateNumbers(array) {\n return !array.some(Number.isNaN);\n}\n/**\n * To generate:\n * - visit {@link https://www.w3.org/TR/css-color-4/#named-colors}\n * - run in the console:\n * @example\n * copy(`{\\n${[...document.querySelector('.named-color-table tbody').children].map((tr) => `${tr.cells[2].textContent.trim()}: [${tr.cells[4].textContent.trim().split(/\\s+/).join(', ')}],`).join('\\n')}\\n}`);\n */\nconst namedColors = {\n aliceblue: [240, 248, 255],\n antiquewhite: [250, 235, 215],\n aqua: [0, 255, 255],\n aquamarine: [127, 255, 212],\n azure: [240, 255, 255],\n beige: [245, 245, 220],\n bisque: [255, 228, 196],\n black: [0, 0, 0],\n blanchedalmond: [255, 235, 205],\n blue: [0, 0, 255],\n blueviolet: [138, 43, 226],\n brown: [165, 42, 42],\n burlywood: [222, 184, 135],\n cadetblue: [95, 158, 160],\n chartreuse: [127, 255, 0],\n chocolate: [210, 105, 30],\n coral: [255, 127, 80],\n cornflowerblue: [100, 149, 237],\n cornsilk: [255, 248, 220],\n crimson: [220, 20, 60],\n cyan: [0, 255, 255],\n darkblue: [0, 0, 139],\n darkcyan: [0, 139, 139],\n darkgoldenrod: [184, 134, 11],\n darkgray: [169, 169, 169],\n darkgreen: [0, 100, 0],\n darkgrey: [169, 169, 169],\n darkkhaki: [189, 183, 107],\n darkmagenta: [139, 0, 139],\n darkolivegreen: [85, 107, 47],\n darkorange: [255, 140, 0],\n darkorchid: [153, 50, 204],\n darkred: [139, 0, 0],\n darksalmon: [233, 150, 122],\n darkseagreen: [143, 188, 143],\n darkslateblue: [72, 61, 139],\n darkslategray: [47, 79, 79],\n darkslategrey: [47, 79, 79],\n darkturquoise: [0, 206, 209],\n darkviolet: [148, 0, 211],\n deeppink: [255, 20, 147],\n deepskyblue: [0, 191, 255],\n dimgray: [105, 105, 105],\n dimgrey: [105, 105, 105],\n dodgerblue: [30, 144, 255],\n firebrick: [178, 34, 34],\n floralwhite: [255, 250, 240],\n forestgreen: [34, 139, 34],\n fuchsia: [255, 0, 255],\n gainsboro: [220, 220, 220],\n ghostwhite: [248, 248, 255],\n gold: [255, 215, 0],\n goldenrod: [218, 165, 32],\n gray: [128, 128, 128],\n green: [0, 128, 0],\n greenyellow: [173, 255, 47],\n grey: [128, 128, 128],\n honeydew: [240, 255, 240],\n hotpink: [255, 105, 180],\n indianred: [205, 92, 92],\n indigo: [75, 0, 130],\n ivory: [255, 255, 240],\n khaki: [240, 230, 140],\n lavender: [230, 230, 250],\n lavenderblush: [255, 240, 245],\n lawngreen: [124, 252, 0],\n lemonchiffon: [255, 250, 205],\n lightblue: [173, 216, 230],\n lightcoral: [240, 128, 128],\n lightcyan: [224, 255, 255],\n lightgoldenrodyellow: [250, 250, 210],\n lightgray: [211, 211, 211],\n lightgreen: [144, 238, 144],\n lightgrey: [211, 211, 211],\n lightpink: [255, 182, 193],\n lightsalmon: [255, 160, 122],\n lightseagreen: [32, 178, 170],\n lightskyblue: [135, 206, 250],\n lightslategray: [119, 136, 153],\n lightslategrey: [119, 136, 153],\n lightsteelblue: [176, 196, 222],\n lightyellow: [255, 255, 224],\n lime: [0, 255, 0],\n limegreen: [50, 205, 50],\n linen: [250, 240, 230],\n magenta: [255, 0, 255],\n maroon: [128, 0, 0],\n mediumaquamarine: [102, 205, 170],\n mediumblue: [0, 0, 205],\n mediumorchid: [186, 85, 211],\n mediumpurple: [147, 112, 219],\n mediumseagreen: [60, 179, 113],\n mediumslateblue: [123, 104, 238],\n mediumspringgreen: [0, 250, 154],\n mediumturquoise: [72, 209, 204],\n mediumvioletred: [199, 21, 133],\n midnightblue: [25, 25, 112],\n mintcream: [245, 255, 250],\n mistyrose: [255, 228, 225],\n moccasin: [255, 228, 181],\n navajowhite: [255, 222, 173],\n navy: [0, 0, 128],\n oldlace: [253, 245, 230],\n olive: [128, 128, 0],\n olivedrab: [107, 142, 35],\n orange: [255, 165, 0],\n orangered: [255, 69, 0],\n orchid: [218, 112, 214],\n palegoldenrod: [238, 232, 170],\n palegreen: [152, 251, 152],\n paleturquoise: [175, 238, 238],\n palevioletred: [219, 112, 147],\n papayawhip: [255, 239, 213],\n peachpuff: [255, 218, 185],\n peru: [205, 133, 63],\n pink: [255, 192, 203],\n plum: [221, 160, 221],\n powderblue: [176, 224, 230],\n purple: [128, 0, 128],\n rebeccapurple: [102, 51, 153],\n red: [255, 0, 0],\n rosybrown: [188, 143, 143],\n royalblue: [65, 105, 225],\n saddlebrown: [139, 69, 19],\n salmon: [250, 128, 114],\n sandybrown: [244, 164, 96],\n seagreen: [46, 139, 87],\n seashell: [255, 245, 238],\n sienna: [160, 82, 45],\n silver: [192, 192, 192],\n skyblue: [135, 206, 235],\n slateblue: [106, 90, 205],\n slategray: [112, 128, 144],\n slategrey: [112, 128, 144],\n snow: [255, 250, 250],\n springgreen: [0, 255, 127],\n steelblue: [70, 130, 180],\n tan: [210, 180, 140],\n teal: [0, 128, 128],\n thistle: [216, 191, 216],\n tomato: [255, 99, 71],\n turquoise: [64, 224, 208],\n violet: [238, 130, 238],\n wheat: [245, 222, 179],\n white: [255, 255, 255],\n whitesmoke: [245, 245, 245],\n yellow: [255, 255, 0],\n yellowgreen: [154, 205, 50],\n};\n\nfunction interpolateNumber(from, to, t) {\n return from + t * (to - from);\n}\nfunction interpolateArray(from, to, t) {\n return from.map((d, i) => {\n return interpolateNumber(d, to[i], t);\n });\n}\n\n/**\n * Checks whether the specified color space is one of the supported interpolation color spaces.\n *\n * @param colorSpace Color space key to verify.\n * @returns `true` if the specified color space is one of the supported\n * interpolation color spaces, `false` otherwise\n */\nfunction isSupportedInterpolationColorSpace(colorSpace) {\n return colorSpace === 'rgb' || colorSpace === 'hcl' || colorSpace === 'lab';\n}\n/**\n * Color representation used by WebGL.\n * Defined in sRGB color space and pre-blended with alpha.\n * @private\n */\nclass Color {\n /**\n * @param r Red component premultiplied by `alpha` 0..1\n * @param g Green component premultiplied by `alpha` 0..1\n * @param b Blue component premultiplied by `alpha` 0..1\n * @param [alpha=1] Alpha component 0..1\n * @param [premultiplied=true] Whether the `r`, `g` and `b` values have already\n * been multiplied by alpha. If `true` nothing happens if `false` then they will\n * be multiplied automatically.\n */\n constructor(r, g, b, alpha = 1, premultiplied = true) {\n this.r = r;\n this.g = g;\n this.b = b;\n this.a = alpha;\n if (!premultiplied) {\n this.r *= alpha;\n this.g *= alpha;\n this.b *= alpha;\n if (!alpha) {\n // alpha = 0 erases completely rgb channels. This behavior is not desirable\n // if this particular color is later used in color interpolation.\n // Because of that, a reference to original color is saved.\n this.overwriteGetter('rgb', [r, g, b, alpha]);\n }\n }\n }\n /**\n * Parses CSS color strings and converts colors to sRGB color space if needed.\n * Officially supported color formats:\n * - keyword, e.g. 'aquamarine' or 'steelblue'\n * - hex (with 3, 4, 6 or 8 digits), e.g. '#f0f' or '#e9bebea9'\n * - rgb and rgba, e.g. 'rgb(0,240,120)' or 'rgba(0%,94%,47%,0.1)' or 'rgb(0 240 120 / .3)'\n * - hsl and hsla, e.g. 'hsl(0,0%,83%)' or 'hsla(0,0%,83%,.5)' or 'hsl(0 0% 83% / 20%)'\n *\n * @param input CSS color string to parse.\n * @returns A `Color` instance, or `undefined` if the input is not a valid color string.\n */\n static parse(input) {\n // in zoom-and-property function input could be an instance of Color class\n if (input instanceof Color) {\n return input;\n }\n if (typeof input !== 'string') {\n return;\n }\n const rgba = parseCssColor(input);\n if (rgba) {\n return new Color(...rgba, false);\n }\n }\n /**\n * Used in color interpolation and by 'to-rgba' expression.\n *\n * @returns Gien color, with reversed alpha blending, in sRGB color space.\n */\n get rgb() {\n const { r, g, b, a } = this;\n const f = a || Infinity; // reverse alpha blending factor\n return this.overwriteGetter('rgb', [r / f, g / f, b / f, a]);\n }\n /**\n * Used in color interpolation.\n *\n * @returns Gien color, with reversed alpha blending, in HCL color space.\n */\n get hcl() {\n return this.overwriteGetter('hcl', rgbToHcl(this.rgb));\n }\n /**\n * Used in color interpolation.\n *\n * @returns Gien color, with reversed alpha blending, in LAB color space.\n */\n get lab() {\n return this.overwriteGetter('lab', rgbToLab(this.rgb));\n }\n /**\n * Lazy getter pattern. When getter is called for the first time lazy value\n * is calculated and then overwrites getter function in given object instance.\n *\n * @example:\n * const redColor = Color.parse('red');\n * let x = redColor.hcl; // this will invoke `get hcl()`, which will calculate\n * // the value of red in HCL space and invoke this `overwriteGetter` function\n * // which in turn will set a field with a key 'hcl' in the `redColor` object.\n * // In other words it will override `get hcl()` from its `Color` prototype\n * // with its own property: hcl = [calculated red value in hcl].\n * let y = redColor.hcl; // next call will no longer invoke getter but simply\n * // return the previously calculated value\n * x === y; // true - `x` is exactly the same object as `y`\n *\n * @param getterKey Getter key\n * @param lazyValue Lazily calculated value to be memoized by current instance\n * @private\n */\n overwriteGetter(getterKey, lazyValue) {\n Object.defineProperty(this, getterKey, { value: lazyValue });\n return lazyValue;\n }\n /**\n * Used by 'to-string' expression.\n *\n * @returns Serialized color in format `rgba(r,g,b,a)`\n * where r,g,b are numbers within 0..255 and alpha is number within 1..0\n *\n * @example\n * var purple = new Color.parse('purple');\n * purple.toString; // = \"rgba(128,0,128,1)\"\n * var translucentGreen = new Color.parse('rgba(26, 207, 26, .73)');\n * translucentGreen.toString(); // = \"rgba(26,207,26,0.73)\"\n */\n toString() {\n const [r, g, b, a] = this.rgb;\n return `rgba(${[r, g, b].map(n => Math.round(n * 255)).join(',')},${a})`;\n }\n static interpolate(from, to, t, spaceKey = 'rgb') {\n switch (spaceKey) {\n case 'rgb': {\n const [r, g, b, alpha] = interpolateArray(from.rgb, to.rgb, t);\n return new Color(r, g, b, alpha, false);\n }\n case 'hcl': {\n const [hue0, chroma0, light0, alphaF] = from.hcl;\n const [hue1, chroma1, light1, alphaT] = to.hcl;\n // https://github.com/gka/chroma.js/blob/cd1b3c0926c7a85cbdc3b1453b3a94006de91a92/src/interpolator/_hsx.js\n let hue, chroma;\n if (!isNaN(hue0) && !isNaN(hue1)) {\n let dh = hue1 - hue0;\n if (hue1 > hue0 && dh > 180) {\n dh -= 360;\n }\n else if (hue1 < hue0 && hue0 - hue1 > 180) {\n dh += 360;\n }\n hue = hue0 + t * dh;\n }\n else if (!isNaN(hue0)) {\n hue = hue0;\n if (light1 === 1 || light1 === 0)\n chroma = chroma0;\n }\n else if (!isNaN(hue1)) {\n hue = hue1;\n if (light0 === 1 || light0 === 0)\n chroma = chroma1;\n }\n else {\n hue = NaN;\n }\n const [r, g, b, alpha] = hclToRgb([\n hue,\n chroma !== null && chroma !== void 0 ? chroma : interpolateNumber(chroma0, chroma1, t),\n interpolateNumber(light0, light1, t),\n interpolateNumber(alphaF, alphaT, t),\n ]);\n return new Color(r, g, b, alpha, false);\n }\n case 'lab': {\n const [r, g, b, alpha] = labToRgb(interpolateArray(from.lab, to.lab, t));\n return new Color(r, g, b, alpha, false);\n }\n }\n }\n}\nColor.black = new Color(0, 0, 0, 1);\nColor.white = new Color(1, 1, 1, 1);\nColor.transparent = new Color(0, 0, 0, 0);\nColor.red = new Color(1, 0, 0, 1);\n\nclass Collator {\n constructor(caseSensitive, diacriticSensitive, locale) {\n if (caseSensitive)\n this.sensitivity = diacriticSensitive ? 'variant' : 'case';\n else\n this.sensitivity = diacriticSensitive ? 'accent' : 'base';\n this.locale = locale;\n this.collator = new Intl.Collator(this.locale ? this.locale : [], { sensitivity: this.sensitivity, usage: 'search' });\n }\n compare(lhs, rhs) {\n return this.collator.compare(lhs, rhs);\n }\n resolvedLocale() {\n // We create a Collator without \"usage: search\" because we don't want\n // the search options encoded in our result (e.g. \"en-u-co-search\")\n return new Intl.Collator(this.locale ? this.locale : [])\n .resolvedOptions().locale;\n }\n}\n\nconst VERTICAL_ALIGN_OPTIONS = ['bottom', 'center', 'top'];\nclass FormattedSection {\n constructor(text, image, scale, fontStack, textColor, verticalAlign) {\n this.text = text;\n this.image = image;\n this.scale = scale;\n this.fontStack = fontStack;\n this.textColor = textColor;\n this.verticalAlign = verticalAlign;\n }\n}\nclass Formatted {\n constructor(sections) {\n this.sections = sections;\n }\n static fromString(unformatted) {\n return new Formatted([new FormattedSection(unformatted, null, null, null, null, null)]);\n }\n isEmpty() {\n if (this.sections.length === 0)\n return true;\n return !this.sections.some(section => section.text.length !== 0 ||\n (section.image && section.image.name.length !== 0));\n }\n static factory(text) {\n if (text instanceof Formatted) {\n return text;\n }\n else {\n return Formatted.fromString(text);\n }\n }\n toString() {\n if (this.sections.length === 0)\n return '';\n return this.sections.map(section => section.text).join('');\n }\n}\n\n/**\n * A set of four numbers representing padding around a box. Create instances from\n * bare arrays or numeric values using the static method `Padding.parse`.\n * @private\n */\nclass Padding {\n constructor(values) {\n this.values = values.slice();\n }\n /**\n * Numeric padding values\n * @param input A padding value\n * @returns A `Padding` instance, or `undefined` if the input is not a valid padding value.\n */\n static parse(input) {\n if (input instanceof Padding) {\n return input;\n }\n // Backwards compatibility: bare number is treated the same as array with single value.\n // Padding applies to all four sides.\n if (typeof input === 'number') {\n return new Padding([input, input, input, input]);\n }\n if (!Array.isArray(input)) {\n return undefined;\n }\n if (input.length < 1 || input.length > 4) {\n return undefined;\n }\n for (const val of input) {\n if (typeof val !== 'number') {\n return undefined;\n }\n }\n // Expand shortcut properties into explicit 4-sided values\n switch (input.length) {\n case 1:\n input = [input[0], input[0], input[0], input[0]];\n break;\n case 2:\n input = [input[0], input[1], input[0], input[1]];\n break;\n case 3:\n input = [input[0], input[1], input[2], input[1]];\n break;\n }\n return new Padding(input);\n }\n toString() {\n return JSON.stringify(this.values);\n }\n static interpolate(from, to, t) {\n return new Padding(interpolateArray(from.values, to.values, t));\n }\n}\n\n/**\n * An array of numbers. Create instances from\n * bare arrays or numeric values using the static method `NumberArray.parse`.\n * @private\n */\nclass NumberArray {\n constructor(values) {\n this.values = values.slice();\n }\n /**\n * Numeric NumberArray values\n * @param input A NumberArray value\n * @returns A `NumberArray` instance, or `undefined` if the input is not a valid NumberArray value.\n */\n static parse(input) {\n if (input instanceof NumberArray) {\n return input;\n }\n // Backwards compatibility (e.g. hillshade-illumination-direction): bare number is treated the same as array with single value.\n if (typeof input === 'number') {\n return new NumberArray([input]);\n }\n if (!Array.isArray(input)) {\n return undefined;\n }\n for (const val of input) {\n if (typeof val !== 'number') {\n return undefined;\n }\n }\n return new NumberArray(input);\n }\n toString() {\n return JSON.stringify(this.values);\n }\n static interpolate(from, to, t) {\n return new NumberArray(interpolateArray(from.values, to.values, t));\n }\n}\n\n/**\n * An array of colors. Create instances from\n * bare arrays or strings using the static method `ColorArray.parse`.\n * @private\n */\nclass ColorArray {\n constructor(values) {\n this.values = values.slice();\n }\n /**\n * ColorArray values\n * @param input A ColorArray value\n * @returns A `ColorArray` instance, or `undefined` if the input is not a valid ColorArray value.\n */\n static parse(input) {\n if (input instanceof ColorArray) {\n return input;\n }\n // Backwards compatibility (e.g. hillshade-shadow-color): bare Color is treated the same as array with single value.\n if (typeof input === 'string') {\n const parsed_val = Color.parse(input);\n if (!parsed_val) {\n return undefined;\n }\n return new ColorArray([parsed_val]);\n }\n if (!Array.isArray(input)) {\n return undefined;\n }\n const colors = [];\n for (const val of input) {\n if (typeof val !== 'string') {\n return undefined;\n }\n const parsed_val = Color.parse(val);\n if (!parsed_val) {\n return undefined;\n }\n colors.push(parsed_val);\n }\n return new ColorArray(colors);\n }\n toString() {\n return JSON.stringify(this.values);\n }\n static interpolate(from, to, t, spaceKey = 'rgb') {\n const colors = [];\n if (from.values.length != to.values.length) {\n throw new Error(`colorArray: Arrays have mismatched length (${from.values.length} vs. ${to.values.length}), cannot interpolate.`);\n }\n for (let i = 0; i < from.values.length; i++) {\n colors.push(Color.interpolate(from.values[i], to.values[i], t, spaceKey));\n }\n return new ColorArray(colors);\n }\n}\n\nclass RuntimeError extends Error {\n constructor(message) {\n super(message);\n this.name = 'RuntimeError';\n }\n toJSON() {\n return this.message;\n }\n}\n\n/** Set of valid anchor positions, as a set for validation */\nconst anchors = new Set(['center', 'left', 'right', 'top', 'bottom', 'top-left', 'top-right', 'bottom-left', 'bottom-right']);\n/**\n * Utility class to assist managing values for text-variable-anchor-offset property. Create instances from\n * bare arrays using the static method `VariableAnchorOffsetCollection.parse`.\n * @private\n */\nclass VariableAnchorOffsetCollection {\n constructor(values) {\n this.values = values.slice();\n }\n static parse(input) {\n if (input instanceof VariableAnchorOffsetCollection) {\n return input;\n }\n if (!Array.isArray(input) ||\n input.length < 1 ||\n input.length % 2 !== 0) {\n return undefined;\n }\n for (let i = 0; i < input.length; i += 2) {\n // Elements in even positions should be anchor positions; Elements in odd positions should be offset values\n const anchorValue = input[i];\n const offsetValue = input[i + 1];\n if (typeof anchorValue !== 'string' || !anchors.has(anchorValue)) {\n return undefined;\n }\n if (!Array.isArray(offsetValue) || offsetValue.length !== 2 || typeof offsetValue[0] !== 'number' || typeof offsetValue[1] !== 'number') {\n return undefined;\n }\n }\n return new VariableAnchorOffsetCollection(input);\n }\n toString() {\n return JSON.stringify(this.values);\n }\n static interpolate(from, to, t) {\n const fromValues = from.values;\n const toValues = to.values;\n if (fromValues.length !== toValues.length) {\n throw new RuntimeError(`Cannot interpolate values of different length. from: ${from.toString()}, to: ${to.toString()}`);\n }\n const output = [];\n for (let i = 0; i < fromValues.length; i += 2) {\n // Anchor entries must match\n if (fromValues[i] !== toValues[i]) {\n throw new RuntimeError(`Cannot interpolate values containing mismatched anchors. from[${i}]: ${fromValues[i]}, to[${i}]: ${toValues[i]}`);\n }\n output.push(fromValues[i]);\n // Interpolate the offset values for each anchor\n const [fx, fy] = fromValues[i + 1];\n const [tx, ty] = toValues[i + 1];\n output.push([interpolateNumber(fx, tx, t), interpolateNumber(fy, ty, t)]);\n }\n return new VariableAnchorOffsetCollection(output);\n }\n}\n\nclass ResolvedImage {\n constructor(options) {\n this.name = options.name;\n this.available = options.available;\n }\n toString() {\n return this.name;\n }\n static fromString(name) {\n if (!name)\n return null; // treat empty values as no image\n return new ResolvedImage({ name, available: false });\n }\n}\n\nclass ProjectionDefinition {\n constructor(from, to, transition) {\n this.from = from;\n this.to = to;\n this.transition = transition;\n }\n static interpolate(from, to, t) {\n return new ProjectionDefinition(from, to, t);\n }\n static parse(input) {\n if (input instanceof ProjectionDefinition) {\n return input;\n }\n if (Array.isArray(input) && input.length === 3 && typeof input[0] === 'string' && typeof input[1] === 'string' && typeof input[2] === 'number') {\n return new ProjectionDefinition(input[0], input[1], input[2]);\n }\n if (typeof input === 'object' && typeof input.from === 'string' && typeof input.to === 'string' && typeof input.transition === 'number') {\n return new ProjectionDefinition(input.from, input.to, input.transition);\n }\n if (typeof input === 'string') {\n return new ProjectionDefinition(input, input, 1);\n }\n return undefined;\n }\n}\n\nfunction validateRGBA(r, g, b, a) {\n if (!(typeof r === 'number' && r >= 0 && r <= 255 &&\n typeof g === 'number' && g >= 0 && g <= 255 &&\n typeof b === 'number' && b >= 0 && b <= 255)) {\n const value = typeof a === 'number' ? [r, g, b, a] : [r, g, b];\n return `Invalid rgba value [${value.join(', ')}]: 'r', 'g', and 'b' must be between 0 and 255.`;\n }\n if (!(typeof a === 'undefined' || (typeof a === 'number' && a >= 0 && a <= 1))) {\n return `Invalid rgba value [${[r, g, b, a].join(', ')}]: 'a' must be between 0 and 1.`;\n }\n return null;\n}\nfunction isValue(mixed) {\n if (mixed === null ||\n typeof mixed === 'string' ||\n typeof mixed === 'boolean' ||\n typeof mixed === 'number' ||\n mixed instanceof ProjectionDefinition ||\n mixed instanceof Color ||\n mixed instanceof Collator ||\n mixed instanceof Formatted ||\n mixed instanceof Padding ||\n mixed instanceof NumberArray ||\n mixed instanceof ColorArray ||\n mixed instanceof VariableAnchorOffsetCollection ||\n mixed instanceof ResolvedImage) {\n return true;\n }\n else if (Array.isArray(mixed)) {\n for (const item of mixed) {\n if (!isValue(item)) {\n return false;\n }\n }\n return true;\n }\n else if (typeof mixed === 'object') {\n for (const key in mixed) {\n if (!isValue(mixed[key])) {\n return false;\n }\n }\n return true;\n }\n else {\n return false;\n }\n}\nfunction typeOf(value) {\n if (value === null) {\n return NullType;\n }\n else if (typeof value === 'string') {\n return StringType;\n }\n else if (typeof value === 'boolean') {\n return BooleanType;\n }\n else if (typeof value === 'number') {\n return NumberType;\n }\n else if (value instanceof Color) {\n return ColorType;\n }\n else if (value instanceof ProjectionDefinition) {\n return ProjectionDefinitionType;\n }\n else if (value instanceof Collator) {\n return CollatorType;\n }\n else if (value instanceof Formatted) {\n return FormattedType;\n }\n else if (value instanceof Padding) {\n return PaddingType;\n }\n else if (value instanceof NumberArray) {\n return NumberArrayType;\n }\n else if (value instanceof ColorArray) {\n return ColorArrayType;\n }\n else if (value instanceof VariableAnchorOffsetCollection) {\n return VariableAnchorOffsetCollectionType;\n }\n else if (value instanceof ResolvedImage) {\n return ResolvedImageType;\n }\n else if (Array.isArray(value)) {\n const length = value.length;\n let itemType;\n for (const item of value) {\n const t = typeOf(item);\n if (!itemType) {\n itemType = t;\n }\n else if (itemType === t) {\n continue;\n }\n else {\n itemType = ValueType;\n break;\n }\n }\n return array(itemType || ValueType, length);\n }\n else {\n return ObjectType;\n }\n}\nfunction valueToString(value) {\n const type = typeof value;\n if (value === null) {\n return '';\n }\n else if (type === 'string' || type === 'number' || type === 'boolean') {\n return String(value);\n }\n else if (value instanceof Color || value instanceof ProjectionDefinition || value instanceof Formatted || value instanceof Padding || value instanceof NumberArray || value instanceof ColorArray || value instanceof VariableAnchorOffsetCollection || value instanceof ResolvedImage) {\n return value.toString();\n }\n else {\n return JSON.stringify(value);\n }\n}\n\nclass Literal {\n constructor(type, value) {\n this.type = type;\n this.value = value;\n }\n static parse(args, context) {\n if (args.length !== 2)\n return context.error(`'literal' expression requires exactly one argument, but found ${args.length - 1} instead.`);\n if (!isValue(args[1]))\n return context.error('invalid value');\n const value = args[1];\n let type = typeOf(value);\n // special case: infer the item type if possible for zero-length arrays\n const expected = context.expectedType;\n if (type.kind === 'array' &&\n type.N === 0 &&\n expected &&\n expected.kind === 'array' &&\n (typeof expected.N !== 'number' || expected.N === 0)) {\n type = expected;\n }\n return new Literal(type, value);\n }\n evaluate() {\n return this.value;\n }\n eachChild() { }\n outputDefined() {\n return true;\n }\n}\n\nconst types$1 = {\n string: StringType,\n number: NumberType,\n boolean: BooleanType,\n object: ObjectType\n};\nclass Assertion {\n constructor(type, args) {\n this.type = type;\n this.args = args;\n }\n static parse(args, context) {\n if (args.length < 2)\n return context.error('Expected at least one argument.');\n let i = 1;\n let type;\n const name = args[0];\n if (name === 'array') {\n let itemType;\n if (args.length > 2) {\n const type = args[1];\n if (typeof type !== 'string' || !(type in types$1) || type === 'object')\n return context.error('The item type argument of \"array\" must be one of string, number, boolean', 1);\n itemType = types$1[type];\n i++;\n }\n else {\n itemType = ValueType;\n }\n let N;\n if (args.length > 3) {\n if (args[2] !== null &&\n (typeof args[2] !== 'number' ||\n args[2] < 0 ||\n args[2] !== Math.floor(args[2]))) {\n return context.error('The length argument to \"array\" must be a positive integer literal', 2);\n }\n N = args[2];\n i++;\n }\n type = array(itemType, N);\n }\n else {\n if (!types$1[name])\n throw new Error(`Types doesn't contain name = ${name}`);\n type = types$1[name];\n }\n const parsed = [];\n for (; i < args.length; i++) {\n const input = context.parse(args[i], i, ValueType);\n if (!input)\n return null;\n parsed.push(input);\n }\n return new Assertion(type, parsed);\n }\n evaluate(ctx) {\n for (let i = 0; i < this.args.length; i++) {\n const value = this.args[i].evaluate(ctx);\n const error = checkSubtype(this.type, typeOf(value));\n if (!error) {\n return value;\n }\n else if (i === this.args.length - 1) {\n throw new RuntimeError(`Expected value to be of type ${typeToString(this.type)}, but found ${typeToString(typeOf(value))} instead.`);\n }\n }\n throw new Error();\n }\n eachChild(fn) {\n this.args.forEach(fn);\n }\n outputDefined() {\n return this.args.every(arg => arg.outputDefined());\n }\n}\n\nconst types = {\n 'to-boolean': BooleanType,\n 'to-color': ColorType,\n 'to-number': NumberType,\n 'to-string': StringType\n};\n/**\n * Special form for error-coalescing coercion expressions \"to-number\",\n * \"to-color\". Since these coercions can fail at runtime, they accept multiple\n * arguments, only evaluating one at a time until one succeeds.\n *\n * @private\n */\nclass Coercion {\n constructor(type, args) {\n this.type = type;\n this.args = args;\n }\n static parse(args, context) {\n if (args.length < 2)\n return context.error('Expected at least one argument.');\n const name = args[0];\n if (!types[name])\n throw new Error(`Can't parse ${name} as it is not part of the known types`);\n if ((name === 'to-boolean' || name === 'to-string') && args.length !== 2)\n return context.error('Expected one argument.');\n const type = types[name];\n const parsed = [];\n for (let i = 1; i < args.length; i++) {\n const input = context.parse(args[i], i, ValueType);\n if (!input)\n return null;\n parsed.push(input);\n }\n return new Coercion(type, parsed);\n }\n evaluate(ctx) {\n switch (this.type.kind) {\n case 'boolean':\n return Boolean(this.args[0].evaluate(ctx));\n case 'color': {\n let input;\n let error;\n for (const arg of this.args) {\n input = arg.evaluate(ctx);\n error = null;\n if (input instanceof Color) {\n return input;\n }\n else if (typeof input === 'string') {\n const c = ctx.parseColor(input);\n if (c)\n return c;\n }\n else if (Array.isArray(input)) {\n if (input.length < 3 || input.length > 4) {\n error = `Invalid rgba value ${JSON.stringify(input)}: expected an array containing either three or four numeric values.`;\n }\n else {\n error = validateRGBA(input[0], input[1], input[2], input[3]);\n }\n if (!error) {\n return new Color(input[0] / 255, input[1] / 255, input[2] / 255, input[3]);\n }\n }\n }\n throw new RuntimeError(error || `Could not parse color from value '${typeof input === 'string' ? input : JSON.stringify(input)}'`);\n }\n case 'padding': {\n let input;\n for (const arg of this.args) {\n input = arg.evaluate(ctx);\n const pad = Padding.parse(input);\n if (pad) {\n return pad;\n }\n }\n throw new RuntimeError(`Could not parse padding from value '${typeof input === 'string' ? input : JSON.stringify(input)}'`);\n }\n case 'numberArray': {\n let input;\n for (const arg of this.args) {\n input = arg.evaluate(ctx);\n const val = NumberArray.parse(input);\n if (val) {\n return val;\n }\n }\n throw new RuntimeError(`Could not parse numberArray from value '${typeof input === 'string' ? input : JSON.stringify(input)}'`);\n }\n case 'colorArray': {\n let input;\n for (const arg of this.args) {\n input = arg.evaluate(ctx);\n const val = ColorArray.parse(input);\n if (val) {\n return val;\n }\n }\n throw new RuntimeError(`Could not parse colorArray from value '${typeof input === 'string' ? input : JSON.stringify(input)}'`);\n }\n case 'variableAnchorOffsetCollection': {\n let input;\n for (const arg of this.args) {\n input = arg.evaluate(ctx);\n const coll = VariableAnchorOffsetCollection.parse(input);\n if (coll) {\n return coll;\n }\n }\n throw new RuntimeError(`Could not parse variableAnchorOffsetCollection from value '${typeof input === 'string' ? input : JSON.stringify(input)}'`);\n }\n case 'number': {\n let value = null;\n for (const arg of this.args) {\n value = arg.evaluate(ctx);\n if (value === null)\n return 0;\n const num = Number(value);\n if (isNaN(num))\n continue;\n return num;\n }\n throw new RuntimeError(`Could not convert ${JSON.stringify(value)} to number.`);\n }\n case 'formatted':\n // There is no explicit 'to-formatted' but this coercion can be implicitly\n // created by properties that expect the 'formatted' type.\n return Formatted.fromString(valueToString(this.args[0].evaluate(ctx)));\n case 'resolvedImage':\n return ResolvedImage.fromString(valueToString(this.args[0].evaluate(ctx)));\n case 'projectionDefinition':\n return this.args[0].evaluate(ctx);\n default:\n return valueToString(this.args[0].evaluate(ctx));\n }\n }\n eachChild(fn) {\n this.args.forEach(fn);\n }\n outputDefined() {\n return this.args.every(arg => arg.outputDefined());\n }\n}\n\nconst geometryTypes = ['Unknown', 'Point', 'LineString', 'Polygon'];\nclass EvaluationContext {\n constructor() {\n this.globals = null;\n this.feature = null;\n this.featureState = null;\n this.formattedSection = null;\n this._parseColorCache = new Map();\n this.availableImages = null;\n this.canonical = null;\n }\n id() {\n return this.feature && 'id' in this.feature ? this.feature.id : null;\n }\n geometryType() {\n return this.feature ? typeof this.feature.type === 'number' ? geometryTypes[this.feature.type] : this.feature.type : null;\n }\n geometry() {\n return this.feature && 'geometry' in this.feature ? this.feature.geometry : null;\n }\n canonicalID() {\n return this.canonical;\n }\n properties() {\n return this.feature && this.feature.properties || {};\n }\n parseColor(input) {\n let cached = this._parseColorCache.get(input);\n if (!cached) {\n cached = Color.parse(input);\n this._parseColorCache.set(input, cached);\n }\n return cached;\n }\n}\n\n/**\n * State associated parsing at a given point in an expression tree.\n * @private\n */\nclass ParsingContext {\n constructor(registry, isConstantFunc, path = [], expectedType, scope = new Scope(), errors = []) {\n this.registry = registry;\n this.path = path;\n this.key = path.map(part => `[${part}]`).join('');\n this.scope = scope;\n this.errors = errors;\n this.expectedType = expectedType;\n this._isConstant = isConstantFunc;\n }\n /**\n * @param expr the JSON expression to parse\n * @param index the optional argument index if this expression is an argument of a parent expression that's being parsed\n * @param options\n * @param options.omitTypeAnnotations set true to omit inferred type annotations. Caller beware: with this option set, the parsed expression's type will NOT satisfy `expectedType` if it would normally be wrapped in an inferred annotation.\n * @private\n */\n parse(expr, index, expectedType, bindings, options = {}) {\n if (index) {\n return this.concat(index, expectedType, bindings)._parse(expr, options);\n }\n return this._parse(expr, options);\n }\n _parse(expr, options) {\n if (expr === null || typeof expr === 'string' || typeof expr === 'boolean' || typeof expr === 'number') {\n expr = ['literal', expr];\n }\n function annotate(parsed, type, typeAnnotation) {\n if (typeAnnotation === 'assert') {\n return new Assertion(type, [parsed]);\n }\n else if (typeAnnotation === 'coerce') {\n return new Coercion(type, [parsed]);\n }\n else {\n return parsed;\n }\n }\n if (Array.isArray(expr)) {\n if (expr.length === 0) {\n return this.error('Expected an array with at least one element. If you wanted a literal array, use [\"literal\", []].');\n }\n const op = expr[0];\n if (typeof op !== 'string') {\n this.error(`Expression name must be a string, but found ${typeof op} instead. If you wanted a literal array, use [\"literal\", [...]].`, 0);\n return null;\n }\n const Expr = this.registry[op];\n if (Expr) {\n let parsed = Expr.parse(expr, this);\n if (!parsed)\n return null;\n if (this.expectedType) {\n const expected = this.expectedType;\n const actual = parsed.type;\n // When we expect a number, string, boolean, or array but have a value, wrap it in an assertion.\n // When we expect a color or formatted string, but have a string or value, wrap it in a coercion.\n // Otherwise, we do static type-checking.\n //\n // These behaviors are overridable for:\n // * The \"coalesce\" operator, which needs to omit type annotations.\n // * String-valued properties (e.g. `text-field`), where coercion is more convenient than assertion.\n //\n if ((expected.kind === 'string' || expected.kind === 'number' || expected.kind === 'boolean' || expected.kind === 'object' || expected.kind === 'array') && actual.kind === 'value') {\n parsed = annotate(parsed, expected, options.typeAnnotation || 'assert');\n }\n else if (('projectionDefinition' === expected.kind && ['string', 'array'].includes(actual.kind)) ||\n ((['color', 'formatted', 'resolvedImage'].includes(expected.kind)) && ['value', 'string'].includes(actual.kind)) ||\n ((['padding', 'numberArray'].includes(expected.kind)) && ['value', 'number', 'array'].includes(actual.kind)) ||\n ('colorArray' === expected.kind && ['value', 'string', 'array'].includes(actual.kind)) ||\n ('variableAnchorOffsetCollection' === expected.kind && ['value', 'array'].includes(actual.kind))) {\n parsed = annotate(parsed, expected, options.typeAnnotation || 'coerce');\n }\n else if (this.checkSubtype(expected, actual)) {\n return null;\n }\n }\n // If an expression's arguments are all literals, we can evaluate\n // it immediately and replace it with a literal value in the\n // parsed/compiled result. Expressions that expect an image should\n // not be resolved here so we can later get the available images.\n if (!(parsed instanceof Literal) && (parsed.type.kind !== 'resolvedImage') && this._isConstant(parsed)) {\n const ec = new EvaluationContext();\n try {\n parsed = new Literal(parsed.type, parsed.evaluate(ec));\n }\n catch (e) {\n this.error(e.message);\n return null;\n }\n }\n return parsed;\n }\n return this.error(`Unknown expression \"${op}\". If you wanted a literal array, use [\"literal\", [...]].`, 0);\n }\n else if (typeof expr === 'undefined') {\n return this.error('\\'undefined\\' value invalid. Use null instead.');\n }\n else if (typeof expr === 'object') {\n return this.error('Bare objects invalid. Use [\"literal\", {...}] instead.');\n }\n else {\n return this.error(`Expected an array, but found ${typeof expr} instead.`);\n }\n }\n /**\n * Returns a copy of this context suitable for parsing the subexpression at\n * index `index`, optionally appending to 'let' binding map.\n *\n * Note that `errors` property, intended for collecting errors while\n * parsing, is copied by reference rather than cloned.\n * @private\n */\n concat(index, expectedType, bindings) {\n const path = typeof index === 'number' ? this.path.concat(index) : this.path;\n const scope = bindings ? this.scope.concat(bindings) : this.scope;\n return new ParsingContext(this.registry, this._isConstant, path, expectedType || null, scope, this.errors);\n }\n /**\n * Push a parsing (or type checking) error into the `this.errors`\n * @param error The message\n * @param keys Optionally specify the source of the error at a child\n * of the current expression at `this.key`.\n * @private\n */\n error(error, ...keys) {\n const key = `${this.key}${keys.map(k => `[${k}]`).join('')}`;\n this.errors.push(new ExpressionParsingError(key, error));\n }\n /**\n * Returns null if `t` is a subtype of `expected`; otherwise returns an\n * error message and also pushes it to `this.errors`.\n * @param expected The expected type\n * @param t The actual type\n * @returns null if `t` is a subtype of `expected`; otherwise returns an error message\n */\n checkSubtype(expected, t) {\n const error = checkSubtype(expected, t);\n if (error)\n this.error(error);\n return error;\n }\n}\n\nclass Let {\n constructor(bindings, result) {\n this.type = result.type;\n this.bindings = [].concat(bindings);\n this.result = result;\n }\n evaluate(ctx) {\n return this.result.evaluate(ctx);\n }\n eachChild(fn) {\n for (const binding of this.bindings) {\n fn(binding[1]);\n }\n fn(this.result);\n }\n static parse(args, context) {\n if (args.length < 4)\n return context.error(`Expected at least 3 arguments, but found ${args.length - 1} instead.`);\n const bindings = [];\n for (let i = 1; i < args.length - 1; i += 2) {\n const name = args[i];\n if (typeof name !== 'string') {\n return context.error(`Expected string, but found ${typeof name} instead.`, i);\n }\n if (/[^a-zA-Z0-9_]/.test(name)) {\n return context.error('Variable names must contain only alphanumeric characters or \\'_\\'.', i);\n }\n const value = context.parse(args[i + 1], i + 1);\n if (!value)\n return null;\n bindings.push([name, value]);\n }\n const result = context.parse(args[args.length - 1], args.length - 1, context.expectedType, bindings);\n if (!result)\n return null;\n return new Let(bindings, result);\n }\n outputDefined() {\n return this.result.outputDefined();\n }\n}\n\nclass Var {\n constructor(name, boundExpression) {\n this.type = boundExpression.type;\n this.name = name;\n this.boundExpression = boundExpression;\n }\n static parse(args, context) {\n if (args.length !== 2 || typeof args[1] !== 'string')\n return context.error('\\'var\\' expression requires exactly one string literal argument.');\n const name = args[1];\n if (!context.scope.has(name)) {\n return context.error(`Unknown variable \"${name}\". Make sure \"${name}\" has been bound in an enclosing \"let\" expression before using it.`, 1);\n }\n return new Var(name, context.scope.get(name));\n }\n evaluate(ctx) {\n return this.boundExpression.evaluate(ctx);\n }\n eachChild() { }\n outputDefined() {\n return false;\n }\n}\n\nclass At {\n constructor(type, index, input) {\n this.type = type;\n this.index = index;\n this.input = input;\n }\n static parse(args, context) {\n if (args.length !== 3)\n return context.error(`Expected 2 arguments, but found ${args.length - 1} instead.`);\n const index = context.parse(args[1], 1, NumberType);\n const input = context.parse(args[2], 2, array(context.expectedType || ValueType));\n if (!index || !input)\n return null;\n const t = input.type;\n return new At(t.itemType, index, input);\n }\n evaluate(ctx) {\n const index = this.index.evaluate(ctx);\n const array = this.input.evaluate(ctx);\n if (index < 0) {\n throw new RuntimeError(`Array index out of bounds: ${index} < 0.`);\n }\n if (index >= array.length) {\n throw new RuntimeError(`Array index out of bounds: ${index} > ${array.length - 1}.`);\n }\n if (index !== Math.floor(index)) {\n throw new RuntimeError(`Array index must be an integer, but found ${index} instead.`);\n }\n return array[index];\n }\n eachChild(fn) {\n fn(this.index);\n fn(this.input);\n }\n outputDefined() {\n return false;\n }\n}\n\nclass In {\n constructor(needle, haystack) {\n this.type = BooleanType;\n this.needle = needle;\n this.haystack = haystack;\n }\n static parse(args, context) {\n if (args.length !== 3) {\n return context.error(`Expected 2 arguments, but found ${args.length - 1} instead.`);\n }\n const needle = context.parse(args[1], 1, ValueType);\n const haystack = context.parse(args[2], 2, ValueType);\n if (!needle || !haystack)\n return null;\n if (!isValidType(needle.type, [BooleanType, StringType, NumberType, NullType, ValueType])) {\n return context.error(`Expected first argument to be of type boolean, string, number or null, but found ${typeToString(needle.type)} instead`);\n }\n return new In(needle, haystack);\n }\n evaluate(ctx) {\n const needle = this.needle.evaluate(ctx);\n const haystack = this.haystack.evaluate(ctx);\n if (!haystack)\n return false;\n if (!isValidNativeType(needle, ['boolean', 'string', 'number', 'null'])) {\n throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${typeToString(typeOf(needle))} instead.`);\n }\n if (!isValidNativeType(haystack, ['string', 'array'])) {\n throw new RuntimeError(`Expected second argument to be of type array or string, but found ${typeToString(typeOf(haystack))} instead.`);\n }\n return haystack.indexOf(needle) >= 0;\n }\n eachChild(fn) {\n fn(this.needle);\n fn(this.haystack);\n }\n outputDefined() {\n return true;\n }\n}\n\nclass IndexOf {\n constructor(needle, haystack, fromIndex) {\n this.type = NumberType;\n this.needle = needle;\n this.haystack = haystack;\n this.fromIndex = fromIndex;\n }\n static parse(args, context) {\n if (args.length <= 2 || args.length >= 5) {\n return context.error(`Expected 2 or 3 arguments, but found ${args.length - 1} instead.`);\n }\n const needle = context.parse(args[1], 1, ValueType);\n const haystack = context.parse(args[2], 2, ValueType);\n if (!needle || !haystack)\n return null;\n if (!isValidType(needle.type, [BooleanType, StringType, NumberType, NullType, ValueType])) {\n return context.error(`Expected first argument to be of type boolean, string, number or null, but found ${typeToString(needle.type)} instead`);\n }\n if (args.length === 4) {\n const fromIndex = context.parse(args[3], 3, NumberType);\n if (!fromIndex)\n return null;\n return new IndexOf(needle, haystack, fromIndex);\n }\n else {\n return new IndexOf(needle, haystack);\n }\n }\n evaluate(ctx) {\n const needle = this.needle.evaluate(ctx);\n const haystack = this.haystack.evaluate(ctx);\n if (!isValidNativeType(needle, ['boolean', 'string', 'number', 'null'])) {\n throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${typeToString(typeOf(needle))} instead.`);\n }\n let fromIndex;\n if (this.fromIndex) {\n fromIndex = this.fromIndex.evaluate(ctx);\n }\n if (isValidNativeType(haystack, ['string'])) {\n const rawIndex = haystack.indexOf(needle, fromIndex);\n if (rawIndex === -1) {\n return -1;\n }\n else {\n // The index may be affected by surrogate pairs, so get the length of the preceding substring.\n return [...haystack.slice(0, rawIndex)].length;\n }\n }\n else if (isValidNativeType(haystack, ['array'])) {\n return haystack.indexOf(needle, fromIndex);\n }\n else {\n throw new RuntimeError(`Expected second argument to be of type array or string, but found ${typeToString(typeOf(haystack))} instead.`);\n }\n }\n eachChild(fn) {\n fn(this.needle);\n fn(this.haystack);\n if (this.fromIndex) {\n fn(this.fromIndex);\n }\n }\n outputDefined() {\n return false;\n }\n}\n\nclass Match {\n constructor(inputType, outputType, input, cases, outputs, otherwise) {\n this.inputType = inputType;\n this.type = outputType;\n this.input = input;\n this.cases = cases;\n this.outputs = outputs;\n this.otherwise = otherwise;\n }\n static parse(args, context) {\n if (args.length < 5)\n return context.error(`Expected at least 4 arguments, but found only ${args.length - 1}.`);\n if (args.length % 2 !== 1)\n return context.error('Expected an even number of arguments.');\n let inputType;\n let outputType;\n if (context.expectedType && context.expectedType.kind !== 'value') {\n outputType = context.expectedType;\n }\n const cases = {};\n const outputs = [];\n for (let i = 2; i < args.length - 1; i += 2) {\n let labels = args[i];\n const value = args[i + 1];\n if (!Array.isArray(labels)) {\n labels = [labels];\n }\n const labelContext = context.concat(i);\n if (labels.length === 0) {\n return labelContext.error('Expected at least one branch label.');\n }\n for (const label of labels) {\n if (typeof label !== 'number' && typeof label !== 'string') {\n return labelContext.error('Branch labels must be numbers or strings.');\n }\n else if (typeof label === 'number' && Math.abs(label) > Number.MAX_SAFE_INTEGER) {\n return labelContext.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);\n }\n else if (typeof label === 'number' && Math.floor(label) !== label) {\n return labelContext.error('Numeric branch labels must be integer values.');\n }\n else if (!inputType) {\n inputType = typeOf(label);\n }\n else if (labelContext.checkSubtype(inputType, typeOf(label))) {\n return null;\n }\n if (typeof cases[String(label)] !== 'undefined') {\n return labelContext.error('Branch labels must be unique.');\n }\n cases[String(label)] = outputs.length;\n }\n const result = context.parse(value, i, outputType);\n if (!result)\n return null;\n outputType = outputType || result.type;\n outputs.push(result);\n }\n const input = context.parse(args[1], 1, ValueType);\n if (!input)\n return null;\n const otherwise = context.parse(args[args.length - 1], args.length - 1, outputType);\n if (!otherwise)\n return null;\n if (input.type.kind !== 'value' && context.concat(1).checkSubtype(inputType, input.type)) {\n return null;\n }\n return new Match(inputType, outputType, input, cases, outputs, otherwise);\n }\n evaluate(ctx) {\n const input = this.input.evaluate(ctx);\n const output = (typeOf(input) === this.inputType && this.outputs[this.cases[input]]) || this.otherwise;\n return output.evaluate(ctx);\n }\n eachChild(fn) {\n fn(this.input);\n this.outputs.forEach(fn);\n fn(this.otherwise);\n }\n outputDefined() {\n return this.outputs.every(out => out.outputDefined()) && this.otherwise.outputDefined();\n }\n}\n\nclass Case {\n constructor(type, branches, otherwise) {\n this.type = type;\n this.branches = branches;\n this.otherwise = otherwise;\n }\n static parse(args, context) {\n if (args.length < 4)\n return context.error(`Expected at least 3 arguments, but found only ${args.length - 1}.`);\n if (args.length % 2 !== 0)\n return context.error('Expected an odd number of arguments.');\n let outputType;\n if (context.expectedType && context.expectedType.kind !== 'value') {\n outputType = context.expectedType;\n }\n const branches = [];\n for (let i = 1; i < args.length - 1; i += 2) {\n const test = context.parse(args[i], i, BooleanType);\n if (!test)\n return null;\n const result = context.parse(args[i + 1], i + 1, outputType);\n if (!result)\n return null;\n branches.push([test, result]);\n outputType = outputType || result.type;\n }\n const otherwise = context.parse(args[args.length - 1], args.length - 1, outputType);\n if (!otherwise)\n return null;\n if (!outputType)\n throw new Error('Can\\'t infer output type');\n return new Case(outputType, branches, otherwise);\n }\n evaluate(ctx) {\n for (const [test, expression] of this.branches) {\n if (test.evaluate(ctx)) {\n return expression.evaluate(ctx);\n }\n }\n return this.otherwise.evaluate(ctx);\n }\n eachChild(fn) {\n for (const [test, expression] of this.branches) {\n fn(test);\n fn(expression);\n }\n fn(this.otherwise);\n }\n outputDefined() {\n return this.branches.every(([_, out]) => out.outputDefined()) && this.otherwise.outputDefined();\n }\n}\n\nclass Slice {\n constructor(type, input, beginIndex, endIndex) {\n this.type = type;\n this.input = input;\n this.beginIndex = beginIndex;\n this.endIndex = endIndex;\n }\n static parse(args, context) {\n if (args.length <= 2 || args.length >= 5) {\n return context.error(`Expected 2 or 3 arguments, but found ${args.length - 1} instead.`);\n }\n const input = context.parse(args[1], 1, ValueType);\n const beginIndex = context.parse(args[2], 2, NumberType);\n if (!input || !beginIndex)\n return null;\n if (!isValidType(input.type, [array(ValueType), StringType, ValueType])) {\n return context.error(`Expected first argument to be of type array or string, but found ${typeToString(input.type)} instead`);\n }\n if (args.length === 4) {\n const endIndex = context.parse(args[3], 3, NumberType);\n if (!endIndex)\n return null;\n return new Slice(input.type, input, beginIndex, endIndex);\n }\n else {\n return new Slice(input.type, input, beginIndex);\n }\n }\n evaluate(ctx) {\n const input = this.input.evaluate(ctx);\n const beginIndex = this.beginIndex.evaluate(ctx);\n let endIndex;\n if (this.endIndex) {\n endIndex = this.endIndex.evaluate(ctx);\n }\n if (isValidNativeType(input, ['string'])) {\n // Indices may be affected by surrogate pairs.\n return [...input].slice(beginIndex, endIndex).join('');\n }\n else if (isValidNativeType(input, ['array'])) {\n return input.slice(beginIndex, endIndex);\n }\n else {\n throw new RuntimeError(`Expected first argument to be of type array or string, but found ${typeToString(typeOf(input))} instead.`);\n }\n }\n eachChild(fn) {\n fn(this.input);\n fn(this.beginIndex);\n if (this.endIndex) {\n fn(this.endIndex);\n }\n }\n outputDefined() {\n return false;\n }\n}\n\n/**\n * Returns the index of the last stop <= input, or 0 if it doesn't exist.\n * @private\n */\nfunction findStopLessThanOrEqualTo(stops, input) {\n const lastIndex = stops.length - 1;\n let lowerIndex = 0;\n let upperIndex = lastIndex;\n let currentIndex = 0;\n let currentValue, nextValue;\n while (lowerIndex <= upperIndex) {\n currentIndex = Math.floor((lowerIndex + upperIndex) / 2);\n currentValue = stops[currentIndex];\n nextValue = stops[currentIndex + 1];\n if (currentValue <= input) {\n if (currentIndex === lastIndex || input < nextValue) { // Search complete\n return currentIndex;\n }\n lowerIndex = currentIndex + 1;\n }\n else if (currentValue > input) {\n upperIndex = currentIndex - 1;\n }\n else {\n throw new RuntimeError('Input is not a number.');\n }\n }\n return 0;\n}\n\nclass Step {\n constructor(type, input, stops) {\n this.type = type;\n this.input = input;\n this.labels = [];\n this.outputs = [];\n for (const [label, expression] of stops) {\n this.labels.push(label);\n this.outputs.push(expression);\n }\n }\n static parse(args, context) {\n if (args.length - 1 < 4) {\n return context.error(`Expected at least 4 arguments, but found only ${args.length - 1}.`);\n }\n if ((args.length - 1) % 2 !== 0) {\n return context.error('Expected an even number of arguments.');\n }\n const input = context.parse(args[1], 1, NumberType);\n if (!input)\n return null;\n const stops = [];\n let outputType = null;\n if (context.expectedType && context.expectedType.kind !== 'value') {\n outputType = context.expectedType;\n }\n for (let i = 1; i < args.length; i += 2) {\n const label = i === 1 ? -Infinity : args[i];\n const value = args[i + 1];\n const labelKey = i;\n const valueKey = i + 1;\n if (typeof label !== 'number') {\n return context.error('Input/output pairs for \"step\" expressions must be defined using literal numeric values (not computed expressions) for the input values.', labelKey);\n }\n if (stops.length && stops[stops.length - 1][0] >= label) {\n return context.error('Input/output pairs for \"step\" expressions must be arranged with input values in strictly ascending order.', labelKey);\n }\n const parsed = context.parse(value, valueKey, outputType);\n if (!parsed)\n return null;\n outputType = outputType || parsed.type;\n stops.push([label, parsed]);\n }\n return new Step(outputType, input, stops);\n }\n evaluate(ctx) {\n const labels = this.labels;\n const outputs = this.outputs;\n if (labels.length === 1) {\n return outputs[0].evaluate(ctx);\n }\n const value = this.input.evaluate(ctx);\n if (value <= labels[0]) {\n return outputs[0].evaluate(ctx);\n }\n const stopCount = labels.length;\n if (value >= labels[stopCount - 1]) {\n return outputs[stopCount - 1].evaluate(ctx);\n }\n const index = findStopLessThanOrEqualTo(labels, value);\n return outputs[index].evaluate(ctx);\n }\n eachChild(fn) {\n fn(this.input);\n for (const expression of this.outputs) {\n fn(expression);\n }\n }\n outputDefined() {\n return this.outputs.every(out => out.outputDefined());\n }\n}\n\nfunction getDefaultExportFromCjs (x) {\n\treturn x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;\n}\n\nvar unitbezier;\nvar hasRequiredUnitbezier;\n\nfunction requireUnitbezier () {\n\tif (hasRequiredUnitbezier) return unitbezier;\n\thasRequiredUnitbezier = 1;\n\n\tunitbezier = UnitBezier;\n\n\tfunction UnitBezier(p1x, p1y, p2x, p2y) {\n\t // Calculate the polynomial coefficients, implicit first and last control points are (0,0) and (1,1).\n\t this.cx = 3.0 * p1x;\n\t this.bx = 3.0 * (p2x - p1x) - this.cx;\n\t this.ax = 1.0 - this.cx - this.bx;\n\n\t this.cy = 3.0 * p1y;\n\t this.by = 3.0 * (p2y - p1y) - this.cy;\n\t this.ay = 1.0 - this.cy - this.by;\n\n\t this.p1x = p1x;\n\t this.p1y = p1y;\n\t this.p2x = p2x;\n\t this.p2y = p2y;\n\t}\n\n\tUnitBezier.prototype = {\n\t sampleCurveX: function (t) {\n\t // `ax t^3 + bx t^2 + cx t' expanded using Horner's rule.\n\t return ((this.ax * t + this.bx) * t + this.cx) * t;\n\t },\n\n\t sampleCurveY: function (t) {\n\t return ((this.ay * t + this.by) * t + this.cy) * t;\n\t },\n\n\t sampleCurveDerivativeX: function (t) {\n\t return (3.0 * this.ax * t + 2.0 * this.bx) * t + this.cx;\n\t },\n\n\t solveCurveX: function (x, epsilon) {\n\t if (epsilon === undefined) epsilon = 1e-6;\n\n\t if (x < 0.0) return 0.0;\n\t if (x > 1.0) return 1.0;\n\n\t var t = x;\n\n\t // First try a few iterations of Newton's method - normally very fast.\n\t for (var i = 0; i < 8; i++) {\n\t var x2 = this.sampleCurveX(t) - x;\n\t if (Math.abs(x2) < epsilon) return t;\n\n\t var d2 = this.sampleCurveDerivativeX(t);\n\t if (Math.abs(d2) < 1e-6) break;\n\n\t t = t - x2 / d2;\n\t }\n\n\t // Fall back to the bisection method for reliability.\n\t var t0 = 0.0;\n\t var t1 = 1.0;\n\t t = x;\n\n\t for (i = 0; i < 20; i++) {\n\t x2 = this.sampleCurveX(t);\n\t if (Math.abs(x2 - x) < epsilon) break;\n\n\t if (x > x2) {\n\t t0 = t;\n\t } else {\n\t t1 = t;\n\t }\n\n\t t = (t1 - t0) * 0.5 + t0;\n\t }\n\n\t return t;\n\t },\n\n\t solve: function (x, epsilon) {\n\t return this.sampleCurveY(this.solveCurveX(x, epsilon));\n\t }\n\t};\n\treturn unitbezier;\n}\n\nvar unitbezierExports = requireUnitbezier();\nvar UnitBezier = /*@__PURE__*/getDefaultExportFromCjs(unitbezierExports);\n\nclass Interpolate {\n constructor(type, operator, interpolation, input, stops) {\n this.type = type;\n this.operator = operator;\n this.interpolation = interpolation;\n this.input = input;\n this.labels = [];\n this.outputs = [];\n for (const [label, expression] of stops) {\n this.labels.push(label);\n this.outputs.push(expression);\n }\n }\n static interpolationFactor(interpolation, input, lower, upper) {\n let t = 0;\n if (interpolation.name === 'exponential') {\n t = exponentialInterpolation(input, interpolation.base, lower, upper);\n }\n else if (interpolation.name === 'linear') {\n t = exponentialInterpolation(input, 1, lower, upper);\n }\n else if (interpolation.name === 'cubic-bezier') {\n const c = interpolation.controlPoints;\n const ub = new UnitBezier(c[0], c[1], c[2], c[3]);\n t = ub.solve(exponentialInterpolation(input, 1, lower, upper));\n }\n return t;\n }\n static parse(args, context) {\n let [operator, interpolation, input, ...rest] = args;\n if (!Array.isArray(interpolation) || interpolation.length === 0) {\n return context.error('Expected an interpolation type expression.', 1);\n }\n if (interpolation[0] === 'linear') {\n interpolation = { name: 'linear' };\n }\n else if (interpolation[0] === 'exponential') {\n const base = interpolation[1];\n if (typeof base !== 'number')\n return context.error('Exponential interpolation requires a numeric base.', 1, 1);\n interpolation = {\n name: 'exponential',\n base\n };\n }\n else if (interpolation[0] === 'cubic-bezier') {\n const controlPoints = interpolation.slice(1);\n if (controlPoints.length !== 4 ||\n controlPoints.some(t => typeof t !== 'number' || t < 0 || t > 1)) {\n return context.error('Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.', 1);\n }\n interpolation = {\n name: 'cubic-bezier',\n controlPoints: controlPoints\n };\n }\n else {\n return context.error(`Unknown interpolation type ${String(interpolation[0])}`, 1, 0);\n }\n if (args.length - 1 < 4) {\n return context.error(`Expected at least 4 arguments, but found only ${args.length - 1}.`);\n }\n if ((args.length - 1) % 2 !== 0) {\n return context.error('Expected an even number of arguments.');\n }\n input = context.parse(input, 2, NumberType);\n if (!input)\n return null;\n const stops = [];\n let outputType = null;\n if ((operator === 'interpolate-hcl' || operator === 'interpolate-lab') && context.expectedType != ColorArrayType) {\n outputType = ColorType;\n }\n else if (context.expectedType && context.expectedType.kind !== 'value') {\n outputType = context.expectedType;\n }\n for (let i = 0; i < rest.length; i += 2) {\n const label = rest[i];\n const value = rest[i + 1];\n const labelKey = i + 3;\n const valueKey = i + 4;\n if (typeof label !== 'number') {\n return context.error('Input/output pairs for \"interpolate\" expressions must be defined using literal numeric values (not computed expressions) for the input values.', labelKey);\n }\n if (stops.length && stops[stops.length - 1][0] >= label) {\n return context.error('Input/output pairs for \"interpolate\" expressions must be arranged with input values in strictly ascending order.', labelKey);\n }\n const parsed = context.parse(value, valueKey, outputType);\n if (!parsed)\n return null;\n outputType = outputType || parsed.type;\n stops.push([label, parsed]);\n }\n if (!verifyType(outputType, NumberType) &&\n !verifyType(outputType, ProjectionDefinitionType) &&\n !verifyType(outputType, ColorType) &&\n !verifyType(outputType, PaddingType) &&\n !verifyType(outputType, NumberArrayType) &&\n !verifyType(outputType, ColorArrayType) &&\n !verifyType(outputType, VariableAnchorOffsetCollectionType) &&\n !verifyType(outputType, array(NumberType))) {\n return context.error(`Type ${typeToString(outputType)} is not interpolatable.`);\n }\n return new Interpolate(outputType, operator, interpolation, input, stops);\n }\n evaluate(ctx) {\n const labels = this.labels;\n const outputs = this.outputs;\n if (labels.length === 1) {\n return outputs[0].evaluate(ctx);\n }\n const value = this.input.evaluate(ctx);\n if (value <= labels[0]) {\n return outputs[0].evaluate(ctx);\n }\n const stopCount = labels.length;\n if (value >= labels[stopCount - 1]) {\n return outputs[stopCount - 1].evaluate(ctx);\n }\n const index = findStopLessThanOrEqualTo(labels, value);\n const lower = labels[index];\n const upper = labels[index + 1];\n const t = Interpolate.interpolationFactor(this.interpolation, value, lower, upper);\n const outputLower = outputs[index].evaluate(ctx);\n const outputUpper = outputs[index + 1].evaluate(ctx);\n switch (this.operator) {\n case 'interpolate':\n switch (this.type.kind) {\n case 'number':\n return interpolateNumber(outputLower, outputUpper, t);\n case 'color':\n return Color.interpolate(outputLower, outputUpper, t);\n case 'padding':\n return Padding.interpolate(outputLower, outputUpper, t);\n case 'colorArray':\n return ColorArray.interpolate(outputLower, outputUpper, t);\n case 'numberArray':\n return NumberArray.interpolate(outputLower, outputUpper, t);\n case 'variableAnchorOffsetCollection':\n return VariableAnchorOffsetCollection.interpolate(outputLower, outputUpper, t);\n case 'array':\n return interpolateArray(outputLower, outputUpper, t);\n case 'projectionDefinition':\n return ProjectionDefinition.interpolate(outputLower, outputUpper, t);\n }\n case 'interpolate-hcl':\n switch (this.type.kind) {\n case 'color':\n return Color.interpolate(outputLower, outputUpper, t, 'hcl');\n case 'colorArray':\n return ColorArray.interpolate(outputLower, outputUpper, t, 'hcl');\n }\n case 'interpolate-lab':\n switch (this.type.kind) {\n case 'color':\n return Color.interpolate(outputLower, outputUpper, t, 'lab');\n case 'colorArray':\n return ColorArray.interpolate(outputLower, outputUpper, t, 'lab');\n }\n }\n }\n eachChild(fn) {\n fn(this.input);\n for (const expression of this.outputs) {\n fn(expression);\n }\n }\n outputDefined() {\n return this.outputs.every(out => out.outputDefined());\n }\n}\n/**\n * Returns a ratio that can be used to interpolate between exponential function\n * stops.\n * How it works: Two consecutive stop values define a (scaled and shifted) exponential function `f(x) = a * base^x + b`, where `base` is the user-specified base,\n * and `a` and `b` are constants affording sufficient degrees of freedom to fit\n * the function to the given stops.\n *\n * Here's a bit of algebra that lets us compute `f(x)` directly from the stop\n * values without explicitly solving for `a` and `b`:\n *\n * First stop value: `f(x0) = y0 = a * base^x0 + b`\n * Second stop value: `f(x1) = y1 = a * base^x1 + b`\n * => `y1 - y0 = a(base^x1 - base^x0)`\n * => `a = (y1 - y0)/(base^x1 - base^x0)`\n *\n * Desired value: `f(x) = y = a * base^x + b`\n * => `f(x) = y0 + a * (base^x - base^x0)`\n *\n * From the above, we can replace the `a` in `a * (base^x - base^x0)` and do a\n * little algebra:\n * ```\n * a * (base^x - base^x0) = (y1 - y0)/(base^x1 - base^x0) * (base^x - base^x0)\n * = (y1 - y0) * (base^x - base^x0) / (base^x1 - base^x0)\n * ```\n *\n * If we let `(base^x - base^x0) / (base^x1 base^x0)`, then we have\n * `f(x) = y0 + (y1 - y0) * ratio`. In other words, `ratio` may be treated as\n * an interpolation factor between the two stops' output values.\n *\n * (Note: a slightly different form for `ratio`,\n * `(base^(x-x0) - 1) / (base^(x1-x0) - 1) `, is equivalent, but requires fewer\n * expensive `Math.pow()` operations.)\n *\n * @private\n*/\nfunction exponentialInterpolation(input, base, lowerValue, upperValue) {\n const difference = upperValue - lowerValue;\n const progress = input - lowerValue;\n if (difference === 0) {\n return 0;\n }\n else if (base === 1) {\n return progress / difference;\n }\n else {\n return (Math.pow(base, progress) - 1) / (Math.pow(base, difference) - 1);\n }\n}\nconst interpolateFactory = {\n color: Color.interpolate,\n number: interpolateNumber,\n padding: Padding.interpolate,\n numberArray: NumberArray.interpolate,\n colorArray: ColorArray.interpolate,\n variableAnchorOffsetCollection: VariableAnchorOffsetCollection.interpolate,\n array: interpolateArray\n};\n\nclass Coalesce {\n constructor(type, args) {\n this.type = type;\n this.args = args;\n }\n static parse(args, context) {\n if (args.length < 2) {\n return context.error('Expected at least one argument.');\n }\n let outputType = null;\n const expectedType = context.expectedType;\n if (expectedType && expectedType.kind !== 'value') {\n outputType = expectedType;\n }\n const parsedArgs = [];\n for (const arg of args.slice(1)) {\n const parsed = context.parse(arg, 1 + parsedArgs.length, outputType, undefined, { typeAnnotation: 'omit' });\n if (!parsed)\n return null;\n outputType = outputType || parsed.type;\n parsedArgs.push(parsed);\n }\n if (!outputType)\n throw new Error('No output type');\n // Above, we parse arguments without inferred type annotation so that\n // they don't produce a runtime error for `null` input, which would\n // preempt the desired null-coalescing behavior.\n // Thus, if any of our arguments would have needed an annotation, we\n // need to wrap the enclosing coalesce expression with it instead.\n const needsAnnotation = expectedType &&\n parsedArgs.some(arg => checkSubtype(expectedType, arg.type));\n return needsAnnotation ?\n new Coalesce(ValueType, parsedArgs) :\n new Coalesce(outputType, parsedArgs);\n }\n evaluate(ctx) {\n let result = null;\n let argCount = 0;\n let requestedImageName;\n for (const arg of this.args) {\n argCount++;\n result = arg.evaluate(ctx);\n // we need to keep track of the first requested image in a coalesce statement\n // if coalesce can't find a valid image, we return the first image name so styleimagemissing can fire\n if (result && result instanceof ResolvedImage && !result.available) {\n if (!requestedImageName) {\n requestedImageName = result.name;\n }\n result = null;\n if (argCount === this.args.length) {\n result = requestedImageName;\n }\n }\n if (result !== null)\n break;\n }\n return result;\n }\n eachChild(fn) {\n this.args.forEach(fn);\n }\n outputDefined() {\n return this.args.every(arg => arg.outputDefined());\n }\n}\n\nfunction isComparableType(op, type) {\n if (op === '==' || op === '!=') {\n // equality operator\n return type.kind === 'boolean' ||\n type.kind === 'string' ||\n type.kind === 'number' ||\n type.kind === 'null' ||\n type.kind === 'value';\n }\n else {\n // ordering operator\n return type.kind === 'string' ||\n type.kind === 'number' ||\n type.kind === 'value';\n }\n}\nfunction eq(ctx, a, b) { return a === b; }\nfunction neq(ctx, a, b) { return a !== b; }\nfunction lt(ctx, a, b) { return a < b; }\nfunction gt(ctx, a, b) { return a > b; }\nfunction lteq(ctx, a, b) { return a <= b; }\nfunction gteq(ctx, a, b) { return a >= b; }\nfunction eqCollate(ctx, a, b, c) { return c.compare(a, b) === 0; }\nfunction neqCollate(ctx, a, b, c) { return !eqCollate(ctx, a, b, c); }\nfunction ltCollate(ctx, a, b, c) { return c.compare(a, b) < 0; }\nfunction gtCollate(ctx, a, b, c) { return c.compare(a, b) > 0; }\nfunction lteqCollate(ctx, a, b, c) { return c.compare(a, b) <= 0; }\nfunction gteqCollate(ctx, a, b, c) { return c.compare(a, b) >= 0; }\n/**\n * Special form for comparison operators, implementing the signatures:\n * - (T, T, ?Collator) => boolean\n * - (T, value, ?Collator) => boolean\n * - (value, T, ?Collator) => boolean\n *\n * For inequalities, T must be either value, string, or number. For ==/!=, it\n * can also be boolean or null.\n *\n * Equality semantics are equivalent to Javascript's strict equality (===/!==)\n * -- i.e., when the arguments' types don't match, == evaluates to false, != to\n * true.\n *\n * When types don't match in an ordering comparison, a runtime error is thrown.\n *\n * @private\n */\nfunction makeComparison(op, compareBasic, compareWithCollator) {\n const isOrderComparison = op !== '==' && op !== '!=';\n return class Comparison {\n constructor(lhs, rhs, collator) {\n this.type = BooleanType;\n this.lhs = lhs;\n this.rhs = rhs;\n this.collator = collator;\n this.hasUntypedArgument = lhs.type.kind === 'value' || rhs.type.kind === 'value';\n }\n static parse(args, context) {\n if (args.length !== 3 && args.length !== 4)\n return context.error('Expected two or three arguments.');\n const op = args[0];\n let lhs = context.parse(args[1], 1, ValueType);\n if (!lhs)\n return null;\n if (!isComparableType(op, lhs.type)) {\n return context.concat(1).error(`\"${op}\" comparisons are not supported for type '${typeToString(lhs.type)}'.`);\n }\n let rhs = context.parse(args[2], 2, ValueType);\n if (!rhs)\n return null;\n if (!isComparableType(op, rhs.type)) {\n return context.concat(2).error(`\"${op}\" comparisons are not supported for type '${typeToString(rhs.type)}'.`);\n }\n if (lhs.type.kind !== rhs.type.kind &&\n lhs.type.kind !== 'value' &&\n rhs.type.kind !== 'value') {\n return context.error(`Cannot compare types '${typeToString(lhs.type)}' and '${typeToString(rhs.type)}'.`);\n }\n if (isOrderComparison) {\n // typing rules specific to less/greater than operators\n if (lhs.type.kind === 'value' && rhs.type.kind !== 'value') {\n // (value, T)\n lhs = new Assertion(rhs.type, [lhs]);\n }\n else if (lhs.type.kind !== 'value' && rhs.type.kind === 'value') {\n // (T, value)\n rhs = new Assertion(lhs.type, [rhs]);\n }\n }\n let collator = null;\n if (args.length === 4) {\n if (lhs.type.kind !== 'string' &&\n rhs.type.kind !== 'string' &&\n lhs.type.kind !== 'value' &&\n rhs.type.kind !== 'value') {\n return context.error('Cannot use collator to compare non-string types.');\n }\n collator = context.parse(args[3], 3, CollatorType);\n if (!collator)\n return null;\n }\n return new Comparison(lhs, rhs, collator);\n }\n evaluate(ctx) {\n const lhs = this.lhs.evaluate(ctx);\n const rhs = this.rhs.evaluate(ctx);\n if (isOrderComparison && this.hasUntypedArgument) {\n const lt = typeOf(lhs);\n const rt = typeOf(rhs);\n // check that type is string or number, and equal\n if (lt.kind !== rt.kind || !(lt.kind === 'string' || lt.kind === 'number')) {\n throw new RuntimeError(`Expected arguments for \"${op}\" to be (string, string) or (number, number), but found (${lt.kind}, ${rt.kind}) instead.`);\n }\n }\n if (this.collator && !isOrderComparison && this.hasUntypedArgument) {\n const lt = typeOf(lhs);\n const rt = typeOf(rhs);\n if (lt.kind !== 'string' || rt.kind !== 'string') {\n return compareBasic(ctx, lhs, rhs);\n }\n }\n return this.collator ?\n compareWithCollator(ctx, lhs, rhs, this.collator.evaluate(ctx)) :\n compareBasic(ctx, lhs, rhs);\n }\n eachChild(fn) {\n fn(this.lhs);\n fn(this.rhs);\n if (this.collator) {\n fn(this.collator);\n }\n }\n outputDefined() {\n return true;\n }\n };\n}\nconst Equals = makeComparison('==', eq, eqCollate);\nconst NotEquals = makeComparison('!=', neq, neqCollate);\nconst LessThan = makeComparison('<', lt, ltCollate);\nconst GreaterThan = makeComparison('>', gt, gtCollate);\nconst LessThanOrEqual = makeComparison('<=', lteq, lteqCollate);\nconst GreaterThanOrEqual = makeComparison('>=', gteq, gteqCollate);\n\nclass CollatorExpression {\n constructor(caseSensitive, diacriticSensitive, locale) {\n this.type = CollatorType;\n this.locale = locale;\n this.caseSensitive = caseSensitive;\n this.diacriticSensitive = diacriticSensitive;\n }\n static parse(args, context) {\n if (args.length !== 2)\n return context.error('Expected one argument.');\n const options = args[1];\n if (typeof options !== 'object' || Array.isArray(options))\n return context.error('Collator options argument must be an object.');\n const caseSensitive = context.parse(options['case-sensitive'] === undefined ? false : options['case-sensitive'], 1, BooleanType);\n if (!caseSensitive)\n return null;\n const diacriticSensitive = context.parse(options['diacritic-sensitive'] === undefined ? false : options['diacritic-sensitive'], 1, BooleanType);\n if (!diacriticSensitive)\n return null;\n let locale = null;\n if (options['locale']) {\n locale = context.parse(options['locale'], 1, StringType);\n if (!locale)\n return null;\n }\n return new CollatorExpression(caseSensitive, diacriticSensitive, locale);\n }\n evaluate(ctx) {\n return new Collator(this.caseSensitive.evaluate(ctx), this.diacriticSensitive.evaluate(ctx), this.locale ? this.locale.evaluate(ctx) : null);\n }\n eachChild(fn) {\n fn(this.caseSensitive);\n fn(this.diacriticSensitive);\n if (this.locale) {\n fn(this.locale);\n }\n }\n outputDefined() {\n // Technically the set of possible outputs is the combinatoric set of Collators produced\n // by all possible outputs of locale/caseSensitive/diacriticSensitive\n // But for the primary use of Collators in comparison operators, we ignore the Collator's\n // possible outputs anyway, so we can get away with leaving this false for now.\n return false;\n }\n}\n\nclass NumberFormat {\n constructor(number, locale, currency, minFractionDigits, maxFractionDigits) {\n this.type = StringType;\n this.number = number;\n this.locale = locale;\n this.currency = currency;\n this.minFractionDigits = minFractionDigits;\n this.maxFractionDigits = maxFractionDigits;\n }\n static parse(args, context) {\n if (args.length !== 3)\n return context.error('Expected two arguments.');\n const number = context.parse(args[1], 1, NumberType);\n if (!number)\n return null;\n const options = args[2];\n if (typeof options !== 'object' || Array.isArray(options))\n return context.error('NumberFormat options argument must be an object.');\n let locale = null;\n if (options['locale']) {\n locale = context.parse(options['locale'], 1, StringType);\n if (!locale)\n return null;\n }\n let currency = null;\n if (options['currency']) {\n currency = context.parse(options['currency'], 1, StringType);\n if (!currency)\n return null;\n }\n let minFractionDigits = null;\n if (options['min-fraction-digits']) {\n minFractionDigits = context.parse(options['min-fraction-digits'], 1, NumberType);\n if (!minFractionDigits)\n return null;\n }\n let maxFractionDigits = null;\n if (options['max-fraction-digits']) {\n maxFractionDigits = context.parse(options['max-fraction-digits'], 1, NumberType);\n if (!maxFractionDigits)\n return null;\n }\n return new NumberFormat(number, locale, currency, minFractionDigits, maxFractionDigits);\n }\n evaluate(ctx) {\n return new Intl.NumberFormat(this.locale ? this.locale.evaluate(ctx) : [], {\n style: this.currency ? 'currency' : 'decimal',\n currency: this.currency ? this.currency.evaluate(ctx) : undefined,\n minimumFractionDigits: this.minFractionDigits ? this.minFractionDigits.evaluate(ctx) : undefined,\n maximumFractionDigits: this.maxFractionDigits ? this.maxFractionDigits.evaluate(ctx) : undefined,\n }).format(this.number.evaluate(ctx));\n }\n eachChild(fn) {\n fn(this.number);\n if (this.locale) {\n fn(this.locale);\n }\n if (this.currency) {\n fn(this.currency);\n }\n if (this.minFractionDigits) {\n fn(this.minFractionDigits);\n }\n if (this.maxFractionDigits) {\n fn(this.maxFractionDigits);\n }\n }\n outputDefined() {\n return false;\n }\n}\n\nclass FormatExpression {\n constructor(sections) {\n this.type = FormattedType;\n this.sections = sections;\n }\n static parse(args, context) {\n if (args.length < 2) {\n return context.error('Expected at least one argument.');\n }\n const firstArg = args[1];\n if (!Array.isArray(firstArg) && typeof firstArg === 'object') {\n return context.error('First argument must be an image or text section.');\n }\n const sections = [];\n let nextTokenMayBeObject = false;\n for (let i = 1; i <= args.length - 1; ++i) {\n const arg = args[i];\n if (nextTokenMayBeObject && typeof arg === 'object' && !Array.isArray(arg)) {\n nextTokenMayBeObject = false;\n let scale = null;\n if (arg['font-scale']) {\n scale = context.parse(arg['font-scale'], 1, NumberType);\n if (!scale)\n return null;\n }\n let font = null;\n if (arg['text-font']) {\n font = context.parse(arg['text-font'], 1, array(StringType));\n if (!font)\n return null;\n }\n let textColor = null;\n if (arg['text-color']) {\n textColor = context.parse(arg['text-color'], 1, ColorType);\n if (!textColor)\n return null;\n }\n let verticalAlign = null;\n if (arg['vertical-align']) {\n if (typeof arg['vertical-align'] === 'string' && !VERTICAL_ALIGN_OPTIONS.includes(arg['vertical-align'])) {\n return context.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${arg['vertical-align']}' instead.`);\n }\n verticalAlign = context.parse(arg['vertical-align'], 1, StringType);\n if (!verticalAlign)\n return null;\n }\n const lastExpression = sections[sections.length - 1];\n lastExpression.scale = scale;\n lastExpression.font = font;\n lastExpression.textColor = textColor;\n lastExpression.verticalAlign = verticalAlign;\n }\n else {\n const content = context.parse(args[i], 1, ValueType);\n if (!content)\n return null;\n const kind = content.type.kind;\n if (kind !== 'string' && kind !== 'value' && kind !== 'null' && kind !== 'resolvedImage')\n return context.error('Formatted text type must be \\'string\\', \\'value\\', \\'image\\' or \\'null\\'.');\n nextTokenMayBeObject = true;\n sections.push({ content, scale: null, font: null, textColor: null, verticalAlign: null });\n }\n }\n return new FormatExpression(sections);\n }\n evaluate(ctx) {\n const evaluateSection = section => {\n const evaluatedContent = section.content.evaluate(ctx);\n if (typeOf(evaluatedContent) === ResolvedImageType) {\n return new FormattedSection('', evaluatedContent, null, null, null, section.verticalAlign ? section.verticalAlign.evaluate(ctx) : null);\n }\n return new FormattedSection(valueToString(evaluatedContent), null, section.scale ? section.scale.evaluate(ctx) : null, section.font ? section.font.evaluate(ctx).join(',') : null, section.textColor ? section.textColor.evaluate(ctx) : null, section.verticalAlign ? section.verticalAlign.evaluate(ctx) : null);\n };\n return new Formatted(this.sections.map(evaluateSection));\n }\n eachChild(fn) {\n for (const section of this.sections) {\n fn(section.content);\n if (section.scale) {\n fn(section.scale);\n }\n if (section.font) {\n fn(section.font);\n }\n if (section.textColor) {\n fn(section.textColor);\n }\n if (section.verticalAlign) {\n fn(section.verticalAlign);\n }\n }\n }\n outputDefined() {\n // Technically the combinatoric set of all children\n // Usually, this.text will be undefined anyway\n return false;\n }\n}\n\nclass ImageExpression {\n constructor(input) {\n this.type = ResolvedImageType;\n this.input = input;\n }\n static parse(args, context) {\n if (args.length !== 2) {\n return context.error('Expected two arguments.');\n }\n const name = context.parse(args[1], 1, StringType);\n if (!name)\n return context.error('No image name provided.');\n return new ImageExpression(name);\n }\n evaluate(ctx) {\n const evaluatedImageName = this.input.evaluate(ctx);\n const value = ResolvedImage.fromString(evaluatedImageName);\n if (value && ctx.availableImages)\n value.available = ctx.availableImages.indexOf(evaluatedImageName) > -1;\n return value;\n }\n eachChild(fn) {\n fn(this.input);\n }\n outputDefined() {\n // The output of image is determined by the list of available images in the evaluation context\n return false;\n }\n}\n\nclass Length {\n constructor(input) {\n this.type = NumberType;\n this.input = input;\n }\n static parse(args, context) {\n if (args.length !== 2)\n return context.error(`Expected 1 argument, but found ${args.length - 1} instead.`);\n const input = context.parse(args[1], 1);\n if (!input)\n return null;\n if (input.type.kind !== 'array' && input.type.kind !== 'string' && input.type.kind !== 'value')\n return context.error(`Expected argument of type string or array, but found ${typeToString(input.type)} instead.`);\n return new Length(input);\n }\n evaluate(ctx) {\n const input = this.input.evaluate(ctx);\n if (typeof input === 'string') {\n // The length may be affected by surrogate pairs.\n return [...input].length;\n }\n else if (Array.isArray(input)) {\n return input.length;\n }\n else {\n throw new RuntimeError(`Expected value to be of type string or array, but found ${typeToString(typeOf(input))} instead.`);\n }\n }\n eachChild(fn) {\n fn(this.input);\n }\n outputDefined() {\n return false;\n }\n}\n\nconst EXTENT = 8192;\nfunction getTileCoordinates(p, canonical) {\n const x = mercatorXfromLng(p[0]);\n const y = mercatorYfromLat(p[1]);\n const tilesAtZoom = Math.pow(2, canonical.z);\n return [Math.round(x * tilesAtZoom * EXTENT), Math.round(y * tilesAtZoom * EXTENT)];\n}\nfunction getLngLatFromTileCoord(coord, canonical) {\n const tilesAtZoom = Math.pow(2, canonical.z);\n const x = (coord[0] / EXTENT + canonical.x) / tilesAtZoom;\n const y = (coord[1] / EXTENT + canonical.y) / tilesAtZoom;\n return [lngFromMercatorXfromLng(x), latFromMercatorY(y)];\n}\nfunction mercatorXfromLng(lng) {\n return (180 + lng) / 360;\n}\nfunction lngFromMercatorXfromLng(mercatorX) {\n return mercatorX * 360 - 180;\n}\nfunction mercatorYfromLat(lat) {\n return (180 - (180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + lat * Math.PI / 360)))) / 360;\n}\nfunction latFromMercatorY(mercatorY) {\n return 360 / Math.PI * Math.atan(Math.exp((180 - mercatorY * 360) * Math.PI / 180)) - 90;\n}\nfunction updateBBox(bbox, coord) {\n bbox[0] = Math.min(bbox[0], coord[0]);\n bbox[1] = Math.min(bbox[1], coord[1]);\n bbox[2] = Math.max(bbox[2], coord[0]);\n bbox[3] = Math.max(bbox[3], coord[1]);\n}\nfunction boxWithinBox(bbox1, bbox2) {\n if (bbox1[0] <= bbox2[0])\n return false;\n if (bbox1[2] >= bbox2[2])\n return false;\n if (bbox1[1] <= bbox2[1])\n return false;\n if (bbox1[3] >= bbox2[3])\n return false;\n return true;\n}\nfunction rayIntersect(p, p1, p2) {\n return ((p1[1] > p[1]) !== (p2[1] > p[1])) && (p[0] < (p2[0] - p1[0]) * (p[1] - p1[1]) / (p2[1] - p1[1]) + p1[0]);\n}\nfunction pointOnBoundary(p, p1, p2) {\n const x1 = p[0] - p1[0];\n const y1 = p[1] - p1[1];\n const x2 = p[0] - p2[0];\n const y2 = p[1] - p2[1];\n return (x1 * y2 - x2 * y1 === 0) && (x1 * x2 <= 0) && (y1 * y2 <= 0);\n}\n// a, b are end points for line segment1, c and d are end points for line segment2\nfunction segmentIntersectSegment(a, b, c, d) {\n // check if two segments are parallel or not\n // precondition is end point a, b is inside polygon, if line a->b is\n // parallel to polygon edge c->d, then a->b won't intersect with c->d\n const vectorP = [b[0] - a[0], b[1] - a[1]];\n const vectorQ = [d[0] - c[0], d[1] - c[1]];\n if (perp(vectorQ, vectorP) === 0)\n return false;\n // If lines are intersecting with each other, the relative location should be:\n // a and b lie in different sides of segment c->d\n // c and d lie in different sides of segment a->b\n if (twoSided(a, b, c, d) && twoSided(c, d, a, b))\n return true;\n return false;\n}\nfunction lineIntersectPolygon(p1, p2, polygon) {\n for (const ring of polygon) {\n // loop through every edge of the ring\n for (let j = 0; j < ring.length - 1; ++j) {\n if (segmentIntersectSegment(p1, p2, ring[j], ring[j + 1])) {\n return true;\n }\n }\n }\n return false;\n}\n// ray casting algorithm for detecting if point is in polygon\nfunction pointWithinPolygon(point, rings, trueIfOnBoundary = false) {\n let inside = false;\n for (const ring of rings) {\n for (let j = 0; j < ring.length - 1; j++) {\n if (pointOnBoundary(point, ring[j], ring[j + 1]))\n return trueIfOnBoundary;\n if (rayIntersect(point, ring[j], ring[j + 1]))\n inside = !inside;\n }\n }\n return inside;\n}\nfunction pointWithinPolygons(point, polygons) {\n for (const polygon of polygons) {\n if (pointWithinPolygon(point, polygon))\n return true;\n }\n return false;\n}\nfunction lineStringWithinPolygon(line, polygon) {\n // First, check if geometry points of line segments are all inside polygon\n for (const point of line) {\n if (!pointWithinPolygon(point, polygon)) {\n return false;\n }\n }\n // Second, check if there is line segment intersecting polygon edge\n for (let i = 0; i < line.length - 1; ++i) {\n if (lineIntersectPolygon(line[i], line[i + 1], polygon)) {\n return false;\n }\n }\n return true;\n}\nfunction lineStringWithinPolygons(line, polygons) {\n for (const polygon of polygons) {\n if (lineStringWithinPolygon(line, polygon))\n return true;\n }\n return false;\n}\nfunction perp(v1, v2) {\n return (v1[0] * v2[1] - v1[1] * v2[0]);\n}\n// check if p1 and p2 are in different sides of line segment q1->q2\nfunction twoSided(p1, p2, q1, q2) {\n // q1->p1 (x1, y1), q1->p2 (x2, y2), q1->q2 (x3, y3)\n const x1 = p1[0] - q1[0];\n const y1 = p1[1] - q1[1];\n const x2 = p2[0] - q1[0];\n const y2 = p2[1] - q1[1];\n const x3 = q2[0] - q1[0];\n const y3 = q2[1] - q1[1];\n const det1 = (x1 * y3 - x3 * y1);\n const det2 = (x2 * y3 - x3 * y2);\n if ((det1 > 0 && det2 < 0) || (det1 < 0 && det2 > 0))\n return true;\n return false;\n}\n\nfunction getTilePolygon(coordinates, bbox, canonical) {\n const polygon = [];\n for (let i = 0; i < coordinates.length; i++) {\n const ring = [];\n for (let j = 0; j < coordinates[i].length; j++) {\n const coord = getTileCoordinates(coordinates[i][j], canonical);\n updateBBox(bbox, coord);\n ring.push(coord);\n }\n polygon.push(ring);\n }\n return polygon;\n}\nfunction getTilePolygons(coordinates, bbox, canonical) {\n const polygons = [];\n for (let i = 0; i < coordinates.length; i++) {\n const polygon = getTilePolygon(coordinates[i], bbox, canonical);\n polygons.push(polygon);\n }\n return polygons;\n}\nfunction updatePoint(p, bbox, polyBBox, worldSize) {\n if (p[0] < polyBBox[0] || p[0] > polyBBox[2]) {\n const halfWorldSize = worldSize * 0.5;\n let shift = (p[0] - polyBBox[0] > halfWorldSize) ? -worldSize : (polyBBox[0] - p[0] > halfWorldSize) ? worldSize : 0;\n if (shift === 0) {\n shift = (p[0] - polyBBox[2] > halfWorldSize) ? -worldSize : (polyBBox[2] - p[0] > halfWorldSize) ? worldSize : 0;\n }\n p[0] += shift;\n }\n updateBBox(bbox, p);\n}\nfunction resetBBox(bbox) {\n bbox[0] = bbox[1] = Infinity;\n bbox[2] = bbox[3] = -Infinity;\n}\nfunction getTilePoints(geometry, pointBBox, polyBBox, canonical) {\n const worldSize = Math.pow(2, canonical.z) * EXTENT;\n const shifts = [canonical.x * EXTENT, canonical.y * EXTENT];\n const tilePoints = [];\n for (const points of geometry) {\n for (const point of points) {\n const p = [point.x + shifts[0], point.y + shifts[1]];\n updatePoint(p, pointBBox, polyBBox, worldSize);\n tilePoints.push(p);\n }\n }\n return tilePoints;\n}\nfunction getTileLines(geometry, lineBBox, polyBBox, canonical) {\n const worldSize = Math.pow(2, canonical.z) * EXTENT;\n const shifts = [canonical.x * EXTENT, canonical.y * EXTENT];\n const tileLines = [];\n for (const line of geometry) {\n const tileLine = [];\n for (const point of line) {\n const p = [point.x + shifts[0], point.y + shifts[1]];\n updateBBox(lineBBox, p);\n tileLine.push(p);\n }\n tileLines.push(tileLine);\n }\n if (lineBBox[2] - lineBBox[0] <= worldSize / 2) {\n resetBBox(lineBBox);\n for (const line of tileLines) {\n for (const p of line) {\n updatePoint(p, lineBBox, polyBBox, worldSize);\n }\n }\n }\n return tileLines;\n}\nfunction pointsWithinPolygons(ctx, polygonGeometry) {\n const pointBBox = [Infinity, Infinity, -Infinity, -Infinity];\n const polyBBox = [Infinity, Infinity, -Infinity, -Infinity];\n const canonical = ctx.canonicalID();\n if (polygonGeometry.type === 'Polygon') {\n const tilePolygon = getTilePolygon(polygonGeometry.coordinates, polyBBox, canonical);\n const tilePoints = getTilePoints(ctx.geometry(), pointBBox, polyBBox, canonical);\n if (!boxWithinBox(pointBBox, polyBBox))\n return false;\n for (const point of tilePoints) {\n if (!pointWithinPolygon(point, tilePolygon))\n return false;\n }\n }\n if (polygonGeometry.type === 'MultiPolygon') {\n const tilePolygons = getTilePolygons(polygonGeometry.coordinates, polyBBox, canonical);\n const tilePoints = getTilePoints(ctx.geometry(), pointBBox, polyBBox, canonical);\n if (!boxWithinBox(pointBBox, polyBBox))\n return false;\n for (const point of tilePoints) {\n if (!pointWithinPolygons(point, tilePolygons))\n return false;\n }\n }\n return true;\n}\nfunction linesWithinPolygons(ctx, polygonGeometry) {\n const lineBBox = [Infinity, Infinity, -Infinity, -Infinity];\n const polyBBox = [Infinity, Infinity, -Infinity, -Infinity];\n const canonical = ctx.canonicalID();\n if (polygonGeometry.type === 'Polygon') {\n const tilePolygon = getTilePolygon(polygonGeometry.coordinates, polyBBox, canonical);\n const tileLines = getTileLines(ctx.geometry(), lineBBox, polyBBox, canonical);\n if (!boxWithinBox(lineBBox, polyBBox))\n return false;\n for (const line of tileLines) {\n if (!lineStringWithinPolygon(line, tilePolygon))\n return false;\n }\n }\n if (polygonGeometry.type === 'MultiPolygon') {\n const tilePolygons = getTilePolygons(polygonGeometry.coordinates, polyBBox, canonical);\n const tileLines = getTileLines(ctx.geometry(), lineBBox, polyBBox, canonical);\n if (!boxWithinBox(lineBBox, polyBBox))\n return false;\n for (const line of tileLines) {\n if (!lineStringWithinPolygons(line, tilePolygons))\n return false;\n }\n }\n return true;\n}\nclass Within {\n constructor(geojson, geometries) {\n this.type = BooleanType;\n this.geojson = geojson;\n this.geometries = geometries;\n }\n static parse(args, context) {\n if (args.length !== 2)\n return context.error(`'within' expression requires exactly one argument, but found ${args.length - 1} instead.`);\n if (isValue(args[1])) {\n const geojson = args[1];\n if (geojson.type === 'FeatureCollection') {\n const polygonsCoords = [];\n for (const polygon of geojson.features) {\n const { type, coordinates } = polygon.geometry;\n if (type === 'Polygon') {\n polygonsCoords.push(coordinates);\n }\n if (type === 'MultiPolygon') {\n polygonsCoords.push(...coordinates);\n }\n }\n if (polygonsCoords.length) {\n const multipolygonWrapper = {\n type: 'MultiPolygon',\n coordinates: polygonsCoords\n };\n return new Within(geojson, multipolygonWrapper);\n }\n }\n else if (geojson.type === 'Feature') {\n const type = geojson.geometry.type;\n if (type === 'Polygon' || type === 'MultiPolygon') {\n return new Within(geojson, geojson.geometry);\n }\n }\n else if (geojson.type === 'Polygon' || geojson.type === 'MultiPolygon') {\n return new Within(geojson, geojson);\n }\n }\n return context.error('\\'within\\' expression requires valid geojson object that contains polygon geometry type.');\n }\n evaluate(ctx) {\n if (ctx.geometry() != null && ctx.canonicalID() != null) {\n if (ctx.geometryType() === 'Point') {\n return pointsWithinPolygons(ctx, this.geometries);\n }\n else if (ctx.geometryType() === 'LineString') {\n return linesWithinPolygons(ctx, this.geometries);\n }\n }\n return false;\n }\n eachChild() { }\n outputDefined() {\n return true;\n }\n}\n\nclass TinyQueue {\n constructor(data = [], compare = (a, b) => (a < b ? -1 : a > b ? 1 : 0)) {\n this.data = data;\n this.length = this.data.length;\n this.compare = compare;\n\n if (this.length > 0) {\n for (let i = (this.length >> 1) - 1; i >= 0; i--) this._down(i);\n }\n }\n\n push(item) {\n this.data.push(item);\n this._up(this.length++);\n }\n\n pop() {\n if (this.length === 0) return undefined;\n\n const top = this.data[0];\n const bottom = this.data.pop();\n\n if (--this.length > 0) {\n this.data[0] = bottom;\n this._down(0);\n }\n\n return top;\n }\n\n peek() {\n return this.data[0];\n }\n\n _up(pos) {\n const {data, compare} = this;\n const item = data[pos];\n\n while (pos > 0) {\n const parent = (pos - 1) >> 1;\n const current = data[parent];\n if (compare(item, current) >= 0) break;\n data[pos] = current;\n pos = parent;\n }\n\n data[pos] = item;\n }\n\n _down(pos) {\n const {data, compare} = this;\n const halfLength = this.length >> 1;\n const item = data[pos];\n\n while (pos < halfLength) {\n let bestChild = (pos << 1) + 1; // initially it is the left child\n const right = bestChild + 1;\n\n if (right < this.length && compare(data[right], data[bestChild]) < 0) {\n bestChild = right;\n }\n if (compare(data[bestChild], item) >= 0) break;\n\n data[pos] = data[bestChild];\n pos = bestChild;\n }\n\n data[pos] = item;\n }\n}\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 */\nfunction 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\n/**\n * Classifies an array of rings into polygons with outer rings and holes\n * @param rings - the rings to classify\n * @param maxRings - the maximum number of rings to include in a polygon, use 0 to include all rings\n * @returns an array of polygons with internal rings as holes\n */\nfunction classifyRings(rings, maxRings) {\n const len = rings.length;\n if (len <= 1)\n return [rings];\n const polygons = [];\n let polygon;\n let ccw;\n for (const ring of rings) {\n const area = calculateSignedArea(ring);\n if (area === 0)\n continue;\n ring.area = Math.abs(area);\n if (ccw === undefined)\n ccw = area < 0;\n if (ccw === area < 0) {\n if (polygon)\n polygons.push(polygon);\n polygon = [ring];\n }\n else {\n polygon.push(ring);\n }\n }\n if (polygon)\n polygons.push(polygon);\n // Earcut performance degrades with the # of rings in a polygon. For this\n // reason, we limit strip out all but the `maxRings` largest rings.\n if (maxRings > 1) {\n for (let j = 0; j < polygons.length; j++) {\n if (polygons[j].length <= maxRings)\n continue;\n quickselect(polygons[j], maxRings, 1, polygons[j].length - 1, compareAreas);\n polygons[j] = polygons[j].slice(0, maxRings);\n }\n }\n return polygons;\n}\nfunction compareAreas(a, b) {\n return b.area - a.area;\n}\n/**\n * Returns the signed area for the polygon ring. Positive areas are exterior rings and\n * have a clockwise winding. Negative areas are interior rings and have a counter clockwise\n * ordering.\n *\n * @param ring - Exterior or interior ring\n * @returns Signed area\n */\nfunction calculateSignedArea(ring) {\n let sum = 0;\n for (let i = 0, len = ring.length, j = len - 1, p1, p2; i < len; j = i++) {\n p1 = ring[i];\n p2 = ring[j];\n sum += (p2.x - p1.x) * (p1.y + p2.y);\n }\n return sum;\n}\n\n// This is taken from https://github.com/mapbox/cheap-ruler/ in order to take only the relevant parts\n// Values that define WGS84 ellipsoid model of the Earth\nconst RE = 6378.137; // equatorial radius\nconst FE = 1 / 298.257223563; // flattening\nconst E2 = FE * (2 - FE);\nconst RAD = Math.PI / 180;\nclass CheapRuler {\n constructor(lat) {\n // Curvature formulas from https://en.wikipedia.org/wiki/Earth_radius#Meridional\n const m = RAD * RE * 1000;\n const coslat = Math.cos(lat * RAD);\n const w2 = 1 / (1 - E2 * (1 - coslat * coslat));\n const w = Math.sqrt(w2);\n // multipliers for converting longitude and latitude degrees into distance\n this.kx = m * w * coslat; // based on normal radius of curvature\n this.ky = m * w * w2 * (1 - E2); // based on meridional radius of curvature\n }\n /**\n * Given two points of the form [longitude, latitude], returns the distance.\n *\n * @param a - point [longitude, latitude]\n * @param b - point [longitude, latitude]\n * @returns distance\n * @example\n * const distance = ruler.distance([30.5, 50.5], [30.51, 50.49]);\n * //=distance\n */\n distance(a, b) {\n const dx = this.wrap(a[0] - b[0]) * this.kx;\n const dy = (a[1] - b[1]) * this.ky;\n return Math.sqrt(dx * dx + dy * dy);\n }\n /**\n * Returns an object of the form {point, index, t}, where point is closest point on the line\n * from the given point, index is the start index of the segment with the closest point,\n * and t is a parameter from 0 to 1 that indicates where the closest point is on that segment.\n *\n * @param line - an array of points that form the line\n * @param p - point [longitude, latitude]\n * @returns the nearest point, its index in the array and the proportion along the line\n * @example\n * const point = ruler.pointOnLine(line, [-67.04, 50.5]).point;\n * //=point\n */\n pointOnLine(line, p) {\n let minDist = Infinity;\n let minX, minY, minI, minT;\n for (let i = 0; i < line.length - 1; i++) {\n let x = line[i][0];\n let y = line[i][1];\n let dx = this.wrap(line[i + 1][0] - x) * this.kx;\n let dy = (line[i + 1][1] - y) * this.ky;\n let t = 0;\n if (dx !== 0 || dy !== 0) {\n t = (this.wrap(p[0] - x) * this.kx * dx + (p[1] - y) * this.ky * dy) / (dx * dx + dy * dy);\n if (t > 1) {\n x = line[i + 1][0];\n y = line[i + 1][1];\n }\n else if (t > 0) {\n x += (dx / this.kx) * t;\n y += (dy / this.ky) * t;\n }\n }\n dx = this.wrap(p[0] - x) * this.kx;\n dy = (p[1] - y) * this.ky;\n const sqDist = dx * dx + dy * dy;\n if (sqDist < minDist) {\n minDist = sqDist;\n minX = x;\n minY = y;\n minI = i;\n minT = t;\n }\n }\n return {\n point: [minX, minY],\n index: minI,\n t: Math.max(0, Math.min(1, minT))\n };\n }\n wrap(deg) {\n while (deg < -180)\n deg += 360;\n while (deg > 180)\n deg -= 360;\n return deg;\n }\n}\n\nconst MinPointsSize = 100;\nconst MinLinePointsSize = 50;\nfunction compareDistPair(a, b) {\n return b[0] - a[0];\n}\nfunction getRangeSize(range) {\n return range[1] - range[0] + 1;\n}\nfunction isRangeSafe(range, threshold) {\n return range[1] >= range[0] && range[1] < threshold;\n}\nfunction splitRange(range, isLine) {\n if (range[0] > range[1]) {\n return [null, null];\n }\n const size = getRangeSize(range);\n if (isLine) {\n if (size === 2) {\n return [range, null];\n }\n const size1 = Math.floor(size / 2);\n return [[range[0], range[0] + size1],\n [range[0] + size1, range[1]]];\n }\n if (size === 1) {\n return [range, null];\n }\n const size1 = Math.floor(size / 2) - 1;\n return [[range[0], range[0] + size1],\n [range[0] + size1 + 1, range[1]]];\n}\nfunction getBBox(coords, range) {\n if (!isRangeSafe(range, coords.length)) {\n return [Infinity, Infinity, -Infinity, -Infinity];\n }\n const bbox = [Infinity, Infinity, -Infinity, -Infinity];\n for (let i = range[0]; i <= range[1]; ++i) {\n updateBBox(bbox, coords[i]);\n }\n return bbox;\n}\nfunction getPolygonBBox(polygon) {\n const bbox = [Infinity, Infinity, -Infinity, -Infinity];\n for (const ring of polygon) {\n for (const coord of ring) {\n updateBBox(bbox, coord);\n }\n }\n return bbox;\n}\nfunction isValidBBox(bbox) {\n return bbox[0] !== -Infinity && bbox[1] !== -Infinity && bbox[2] !== Infinity && bbox[3] !== Infinity;\n}\n// Calculate the distance between two bounding boxes.\n// Calculate the delta in x and y direction, and use two fake points {0.0, 0.0}\n// and {dx, dy} to calculate the distance. Distance will be 0.0 if bounding box are overlapping.\nfunction bboxToBBoxDistance(bbox1, bbox2, ruler) {\n if (!isValidBBox(bbox1) || !isValidBBox(bbox2)) {\n return NaN;\n }\n let dx = 0.0;\n let dy = 0.0;\n // bbox1 in left side\n if (bbox1[2] < bbox2[0]) {\n dx = bbox2[0] - bbox1[2];\n }\n // bbox1 in right side\n if (bbox1[0] > bbox2[2]) {\n dx = bbox1[0] - bbox2[2];\n }\n // bbox1 in above side\n if (bbox1[1] > bbox2[3]) {\n dy = bbox1[1] - bbox2[3];\n }\n // bbox1 in down side\n if (bbox1[3] < bbox2[1]) {\n dy = bbox2[1] - bbox1[3];\n }\n return ruler.distance([0.0, 0.0], [dx, dy]);\n}\nfunction pointToLineDistance(point, line, ruler) {\n const nearestPoint = ruler.pointOnLine(line, point);\n return ruler.distance(point, nearestPoint.point);\n}\nfunction segmentToSegmentDistance(p1, p2, q1, q2, ruler) {\n const dist1 = Math.min(pointToLineDistance(p1, [q1, q2], ruler), pointToLineDistance(p2, [q1, q2], ruler));\n const dist2 = Math.min(pointToLineDistance(q1, [p1, p2], ruler), pointToLineDistance(q2, [p1, p2], ruler));\n return Math.min(dist1, dist2);\n}\nfunction lineToLineDistance(line1, range1, line2, range2, ruler) {\n const rangeSafe = isRangeSafe(range1, line1.length) && isRangeSafe(range2, line2.length);\n if (!rangeSafe) {\n return Infinity;\n }\n let dist = Infinity;\n for (let i = range1[0]; i < range1[1]; ++i) {\n const p1 = line1[i];\n const p2 = line1[i + 1];\n for (let j = range2[0]; j < range2[1]; ++j) {\n const q1 = line2[j];\n const q2 = line2[j + 1];\n if (segmentIntersectSegment(p1, p2, q1, q2)) {\n return 0.0;\n }\n dist = Math.min(dist, segmentToSegmentDistance(p1, p2, q1, q2, ruler));\n }\n }\n return dist;\n}\nfunction pointsToPointsDistance(points1, range1, points2, range2, ruler) {\n const rangeSafe = isRangeSafe(range1, points1.length) && isRangeSafe(range2, points2.length);\n if (!rangeSafe) {\n return NaN;\n }\n let dist = Infinity;\n for (let i = range1[0]; i <= range1[1]; ++i) {\n for (let j = range2[0]; j <= range2[1]; ++j) {\n dist = Math.min(dist, ruler.distance(points1[i], points2[j]));\n if (dist === 0.0) {\n return dist;\n }\n }\n }\n return dist;\n}\nfunction pointToPolygonDistance(point, polygon, ruler) {\n if (pointWithinPolygon(point, polygon, true)) {\n return 0.0;\n }\n let dist = Infinity;\n for (const ring of polygon) {\n const front = ring[0];\n const back = ring[ring.length - 1];\n if (front !== back) {\n dist = Math.min(dist, pointToLineDistance(point, [back, front], ruler));\n if (dist === 0.0) {\n return dist;\n }\n }\n const nearestPoint = ruler.pointOnLine(ring, point);\n dist = Math.min(dist, ruler.distance(point, nearestPoint.point));\n if (dist === 0.0) {\n return dist;\n }\n }\n return dist;\n}\nfunction lineToPolygonDistance(line, range, polygon, ruler) {\n if (!isRangeSafe(range, line.length)) {\n return NaN;\n }\n for (let i = range[0]; i <= range[1]; ++i) {\n if (pointWithinPolygon(line[i], polygon, true)) {\n return 0.0;\n }\n }\n let dist = Infinity;\n for (let i = range[0]; i < range[1]; ++i) {\n const p1 = line[i];\n const p2 = line[i + 1];\n for (const ring of polygon) {\n for (let j = 0, len = ring.length, k = len - 1; j < len; k = j++) {\n const q1 = ring[k];\n const q2 = ring[j];\n if (segmentIntersectSegment(p1, p2, q1, q2)) {\n return 0.0;\n }\n dist = Math.min(dist, segmentToSegmentDistance(p1, p2, q1, q2, ruler));\n }\n }\n }\n return dist;\n}\nfunction polygonIntersect(poly1, poly2) {\n for (const ring of poly1) {\n for (const point of ring) {\n if (pointWithinPolygon(point, poly2, true)) {\n return true;\n }\n }\n }\n return false;\n}\nfunction polygonToPolygonDistance(polygon1, polygon2, ruler, currentMiniDist = Infinity) {\n const bbox1 = getPolygonBBox(polygon1);\n const bbox2 = getPolygonBBox(polygon2);\n if (currentMiniDist !== Infinity && bboxToBBoxDistance(bbox1, bbox2, ruler) >= currentMiniDist) {\n return currentMiniDist;\n }\n if (boxWithinBox(bbox1, bbox2)) {\n if (polygonIntersect(polygon1, polygon2)) {\n return 0.0;\n }\n }\n else if (polygonIntersect(polygon2, polygon1)) {\n return 0.0;\n }\n let dist = Infinity;\n for (const ring1 of polygon1) {\n for (let i = 0, len1 = ring1.length, l = len1 - 1; i < len1; l = i++) {\n const p1 = ring1[l];\n const p2 = ring1[i];\n for (const ring2 of polygon2) {\n for (let j = 0, len2 = ring2.length, k = len2 - 1; j < len2; k = j++) {\n const q1 = ring2[k];\n const q2 = ring2[j];\n if (segmentIntersectSegment(p1, p2, q1, q2)) {\n return 0.0;\n }\n dist = Math.min(dist, segmentToSegmentDistance(p1, p2, q1, q2, ruler));\n }\n }\n }\n }\n return dist;\n}\nfunction updateQueue(distQueue, miniDist, ruler, points, polyBBox, rangeA) {\n if (!rangeA) {\n return;\n }\n const tempDist = bboxToBBoxDistance(getBBox(points, rangeA), polyBBox, ruler);\n // Insert new pair to the queue if the bbox distance is less than\n // miniDist, The pair with biggest distance will be at the top\n if (tempDist < miniDist) {\n distQueue.push([tempDist, rangeA, [0, 0]]);\n }\n}\nfunction updateQueueTwoSets(distQueue, miniDist, ruler, pointSet1, pointSet2, range1, range2) {\n if (!range1 || !range2) {\n return;\n }\n const tempDist = bboxToBBoxDistance(getBBox(pointSet1, range1), getBBox(pointSet2, range2), ruler);\n // Insert new pair to the queue if the bbox distance is less than\n // miniDist, The pair with biggest distance will be at the top\n if (tempDist < miniDist) {\n distQueue.push([tempDist, range1, range2]);\n }\n}\n// Divide and conquer, the time complexity is O(n*lgn), faster than Brute force\n// O(n*n) Most of the time, use index for in-place processing.\nfunction pointsToPolygonDistance(points, isLine, polygon, ruler, currentMiniDist = Infinity) {\n let miniDist = Math.min(ruler.distance(points[0], polygon[0][0]), currentMiniDist);\n if (miniDist === 0.0) {\n return miniDist;\n }\n const distQueue = new TinyQueue([[0, [0, points.length - 1], [0, 0]]], compareDistPair);\n const polyBBox = getPolygonBBox(polygon);\n while (distQueue.length > 0) {\n const distPair = distQueue.pop();\n if (distPair[0] >= miniDist) {\n continue;\n }\n const range = distPair[1];\n // In case the set size are relatively small, we could use brute-force directly\n const threshold = isLine ? MinLinePointsSize : MinPointsSize;\n if (getRangeSize(range) <= threshold) {\n if (!isRangeSafe(range, points.length)) {\n return NaN;\n }\n if (isLine) {\n const tempDist = lineToPolygonDistance(points, range, polygon, ruler);\n if (isNaN(tempDist) || tempDist === 0.0) {\n return tempDist;\n }\n miniDist = Math.min(miniDist, tempDist);\n }\n else {\n for (let i = range[0]; i <= range[1]; ++i) {\n const tempDist = pointToPolygonDistance(points[i], polygon, ruler);\n miniDist = Math.min(miniDist, tempDist);\n if (miniDist === 0.0) {\n return 0.0;\n }\n }\n }\n }\n else {\n const newRangesA = splitRange(range, isLine);\n updateQueue(distQueue, miniDist, ruler, points, polyBBox, newRangesA[0]);\n updateQueue(distQueue, miniDist, ruler, points, polyBBox, newRangesA[1]);\n }\n }\n return miniDist;\n}\nfunction pointSetToPointSetDistance(pointSet1, isLine1, pointSet2, isLine2, ruler, currentMiniDist = Infinity) {\n let miniDist = Math.min(currentMiniDist, ruler.distance(pointSet1[0], pointSet2[0]));\n if (miniDist === 0.0) {\n return miniDist;\n }\n const distQueue = new TinyQueue([[0, [0, pointSet1.length - 1], [0, pointSet2.length - 1]]], compareDistPair);\n while (distQueue.length > 0) {\n const distPair = distQueue.pop();\n if (distPair[0] >= miniDist) {\n continue;\n }\n const rangeA = distPair[1];\n const rangeB = distPair[2];\n const threshold1 = isLine1 ? MinLinePointsSize : MinPointsSize;\n const threshold2 = isLine2 ? MinLinePointsSize : MinPointsSize;\n // In case the set size are relatively small, we could use brute-force directly\n if (getRangeSize(rangeA) <= threshold1 && getRangeSize(rangeB) <= threshold2) {\n if (!isRangeSafe(rangeA, pointSet1.length) && isRangeSafe(rangeB, pointSet2.length)) {\n return NaN;\n }\n let tempDist;\n if (isLine1 && isLine2) {\n tempDist = lineToLineDistance(pointSet1, rangeA, pointSet2, rangeB, ruler);\n miniDist = Math.min(miniDist, tempDist);\n }\n else if (isLine1 && !isLine2) {\n const sublibe = pointSet1.slice(rangeA[0], rangeA[1] + 1);\n for (let i = rangeB[0]; i <= rangeB[1]; ++i) {\n tempDist = pointToLineDistance(pointSet2[i], sublibe, ruler);\n miniDist = Math.min(miniDist, tempDist);\n if (miniDist === 0.0) {\n return miniDist;\n }\n }\n }\n else if (!isLine1 && isLine2) {\n const sublibe = pointSet2.slice(rangeB[0], rangeB[1] + 1);\n for (let i = rangeA[0]; i <= rangeA[1]; ++i) {\n tempDist = pointToLineDistance(pointSet1[i], sublibe, ruler);\n miniDist = Math.min(miniDist, tempDist);\n if (miniDist === 0.0) {\n return miniDist;\n }\n }\n }\n else {\n tempDist = pointsToPointsDistance(pointSet1, rangeA, pointSet2, rangeB, ruler);\n miniDist = Math.min(miniDist, tempDist);\n }\n }\n else {\n const newRangesA = splitRange(rangeA, isLine1);\n const newRangesB = splitRange(rangeB, isLine2);\n updateQueueTwoSets(distQueue, miniDist, ruler, pointSet1, pointSet2, newRangesA[0], newRangesB[0]);\n updateQueueTwoSets(distQueue, miniDist, ruler, pointSet1, pointSet2, newRangesA[0], newRangesB[1]);\n updateQueueTwoSets(distQueue, miniDist, ruler, pointSet1, pointSet2, newRangesA[1], newRangesB[0]);\n updateQueueTwoSets(distQueue, miniDist, ruler, pointSet1, pointSet2, newRangesA[1], newRangesB[1]);\n }\n }\n return miniDist;\n}\nfunction pointToGeometryDistance(ctx, geometries) {\n const tilePoints = ctx.geometry();\n const pointPosition = tilePoints.flat().map(p => getLngLatFromTileCoord([p.x, p.y], ctx.canonical));\n if (tilePoints.length === 0) {\n return NaN;\n }\n const ruler = new CheapRuler(pointPosition[0][1]);\n let dist = Infinity;\n for (const geometry of geometries) {\n switch (geometry.type) {\n case 'Point':\n dist = Math.min(dist, pointSetToPointSetDistance(pointPosition, false, [geometry.coordinates], false, ruler, dist));\n break;\n case 'LineString':\n dist = Math.min(dist, pointSetToPointSetDistance(pointPosition, false, geometry.coordinates, true, ruler, dist));\n break;\n case 'Polygon':\n dist = Math.min(dist, pointsToPolygonDistance(pointPosition, false, geometry.coordinates, ruler, dist));\n break;\n }\n if (dist === 0.0) {\n return dist;\n }\n }\n return dist;\n}\nfunction lineStringToGeometryDistance(ctx, geometries) {\n const tileLine = ctx.geometry();\n const linePositions = tileLine.flat().map(p => getLngLatFromTileCoord([p.x, p.y], ctx.canonical));\n if (tileLine.length === 0) {\n return NaN;\n }\n const ruler = new CheapRuler(linePositions[0][1]);\n let dist = Infinity;\n for (const geometry of geometries) {\n switch (geometry.type) {\n case 'Point':\n dist = Math.min(dist, pointSetToPointSetDistance(linePositions, true, [geometry.coordinates], false, ruler, dist));\n break;\n case 'LineString':\n dist = Math.min(dist, pointSetToPointSetDistance(linePositions, true, geometry.coordinates, true, ruler, dist));\n break;\n case 'Polygon':\n dist = Math.min(dist, pointsToPolygonDistance(linePositions, true, geometry.coordinates, ruler, dist));\n break;\n }\n if (dist === 0.0) {\n return dist;\n }\n }\n return dist;\n}\nfunction polygonToGeometryDistance(ctx, geometries) {\n const tilePolygon = ctx.geometry();\n if (tilePolygon.length === 0 || tilePolygon[0].length === 0) {\n return NaN;\n }\n const polygons = classifyRings(tilePolygon, 0).map(polygon => {\n return polygon.map(ring => {\n return ring.map(p => getLngLatFromTileCoord([p.x, p.y], ctx.canonical));\n });\n });\n const ruler = new CheapRuler(polygons[0][0][0][1]);\n let dist = Infinity;\n for (const geometry of geometries) {\n for (const polygon of polygons) {\n switch (geometry.type) {\n case 'Point':\n dist = Math.min(dist, pointsToPolygonDistance([geometry.coordinates], false, polygon, ruler, dist));\n break;\n case 'LineString':\n dist = Math.min(dist, pointsToPolygonDistance(geometry.coordinates, true, polygon, ruler, dist));\n break;\n case 'Polygon':\n dist = Math.min(dist, polygonToPolygonDistance(polygon, geometry.coordinates, ruler, dist));\n break;\n }\n if (dist === 0.0) {\n return dist;\n }\n }\n }\n return dist;\n}\nfunction toSimpleGeometry(geometry) {\n if (geometry.type === 'MultiPolygon') {\n return geometry.coordinates.map(polygon => {\n return {\n type: 'Polygon',\n coordinates: polygon\n };\n });\n }\n if (geometry.type === 'MultiLineString') {\n return geometry.coordinates.map(lineString => {\n return {\n type: 'LineString',\n coordinates: lineString\n };\n });\n }\n if (geometry.type === 'MultiPoint') {\n return geometry.coordinates.map(point => {\n return {\n type: 'Point',\n coordinates: point\n };\n });\n }\n return [geometry];\n}\nclass Distance {\n constructor(geojson, geometries) {\n this.type = NumberType;\n this.geojson = geojson;\n this.geometries = geometries;\n }\n static parse(args, context) {\n if (args.length !== 2)\n return context.error(`'distance' expression requires exactly one argument, but found ${args.length - 1} instead.`);\n if (isValue(args[1])) {\n const geojson = args[1];\n if (geojson.type === 'FeatureCollection') {\n return new Distance(geojson, geojson.features.map(feature => toSimpleGeometry(feature.geometry)).flat());\n }\n else if (geojson.type === 'Feature') {\n return new Distance(geojson, toSimpleGeometry(geojson.geometry));\n }\n else if ('type' in geojson && 'coordinates' in geojson) {\n return new Distance(geojson, toSimpleGeometry(geojson));\n }\n }\n return context.error('\\'distance\\' expression requires valid geojson object that contains polygon geometry type.');\n }\n evaluate(ctx) {\n if (ctx.geometry() != null && ctx.canonicalID() != null) {\n if (ctx.geometryType() === 'Point') {\n return pointToGeometryDistance(ctx, this.geometries);\n }\n else if (ctx.geometryType() === 'LineString') {\n return lineStringToGeometryDistance(ctx, this.geometries);\n }\n else if (ctx.geometryType() === 'Polygon') {\n return polygonToGeometryDistance(ctx, this.geometries);\n }\n }\n return NaN;\n }\n eachChild() { }\n outputDefined() {\n return true;\n }\n}\n\nclass GlobalState {\n constructor(key) {\n this.type = ValueType;\n this.key = key;\n }\n static parse(args, context) {\n if (args.length !== 2) {\n return context.error(`Expected 1 argument, but found ${args.length - 1} instead.`);\n }\n const key = args[1];\n if (key === undefined || key === null) {\n return context.error('Global state property must be defined.');\n }\n if (typeof key !== 'string') {\n return context.error(`Global state property must be string, but found ${typeof args[1]} instead.`);\n }\n return new GlobalState(key);\n }\n evaluate(ctx) {\n var _a;\n const globalState = (_a = ctx.globals) === null || _a === void 0 ? void 0 : _a.globalState;\n if (!globalState || Object.keys(globalState).length === 0)\n return null;\n return getOwn(globalState, this.key);\n }\n eachChild() { }\n outputDefined() {\n return false;\n }\n}\n\nconst expressions$1 = {\n // special forms\n '==': Equals,\n '!=': NotEquals,\n '>': GreaterThan,\n '<': LessThan,\n '>=': GreaterThanOrEqual,\n '<=': LessThanOrEqual,\n 'array': Assertion,\n 'at': At,\n 'boolean': Assertion,\n 'case': Case,\n 'coalesce': Coalesce,\n 'collator': CollatorExpression,\n 'format': FormatExpression,\n 'image': ImageExpression,\n 'in': In,\n 'index-of': IndexOf,\n 'interpolate': Interpolate,\n 'interpolate-hcl': Interpolate,\n 'interpolate-lab': Interpolate,\n 'length': Length,\n 'let': Let,\n 'literal': Literal,\n 'match': Match,\n 'number': Assertion,\n 'number-format': NumberFormat,\n 'object': Assertion,\n 'slice': Slice,\n 'step': Step,\n 'string': Assertion,\n 'to-boolean': Coercion,\n 'to-color': Coercion,\n 'to-number': Coercion,\n 'to-string': Coercion,\n 'var': Var,\n 'within': Within,\n 'distance': Distance,\n 'global-state': GlobalState\n};\n\nclass CompoundExpression {\n constructor(name, type, evaluate, args) {\n this.name = name;\n this.type = type;\n this._evaluate = evaluate;\n this.args = args;\n }\n evaluate(ctx) {\n return this._evaluate(ctx, this.args);\n }\n eachChild(fn) {\n this.args.forEach(fn);\n }\n outputDefined() {\n return false;\n }\n static parse(args, context) {\n const op = args[0];\n const definition = CompoundExpression.definitions[op];\n if (!definition) {\n return context.error(`Unknown expression \"${op}\". If you wanted a literal array, use [\"literal\", [...]].`, 0);\n }\n // Now check argument types against each signature\n const type = Array.isArray(definition) ?\n definition[0] : definition.type;\n const availableOverloads = Array.isArray(definition) ?\n [[definition[1], definition[2]]] :\n definition.overloads;\n const overloads = availableOverloads.filter(([signature]) => (!Array.isArray(signature) || // varags\n signature.length === args.length - 1 // correct param count\n ));\n let signatureContext = null;\n for (const [params, evaluate] of overloads) {\n // Use a fresh context for each attempted signature so that, if\n // we eventually succeed, we haven't polluted `context.errors`.\n signatureContext = new ParsingContext(context.registry, isExpressionConstant, context.path, null, context.scope);\n // First parse all the args, potentially coercing to the\n // types expected by this overload.\n const parsedArgs = [];\n let argParseFailed = false;\n for (let i = 1; i < args.length; i++) {\n const arg = args[i];\n const expectedType = Array.isArray(params) ?\n params[i - 1] :\n params.type;\n const parsed = signatureContext.parse(arg, 1 + parsedArgs.length, expectedType);\n if (!parsed) {\n argParseFailed = true;\n break;\n }\n parsedArgs.push(parsed);\n }\n if (argParseFailed) {\n // Couldn't coerce args of this overload to expected type, move\n // on to next one.\n continue;\n }\n if (Array.isArray(params)) {\n if (params.length !== parsedArgs.length) {\n signatureContext.error(`Expected ${params.length} arguments, but found ${parsedArgs.length} instead.`);\n continue;\n }\n }\n for (let i = 0; i < parsedArgs.length; i++) {\n const expected = Array.isArray(params) ? params[i] : params.type;\n const arg = parsedArgs[i];\n signatureContext.concat(i + 1).checkSubtype(expected, arg.type);\n }\n if (signatureContext.errors.length === 0) {\n return new CompoundExpression(op, type, evaluate, parsedArgs);\n }\n }\n if (overloads.length === 1) {\n context.errors.push(...signatureContext.errors);\n }\n else {\n const expected = overloads.length ? overloads : availableOverloads;\n const signatures = expected\n .map(([params]) => stringifySignature(params))\n .join(' | ');\n const actualTypes = [];\n // For error message, re-parse arguments without trying to\n // apply any coercions\n for (let i = 1; i < args.length; i++) {\n const parsed = context.parse(args[i], 1 + actualTypes.length);\n if (!parsed)\n return null;\n actualTypes.push(typeToString(parsed.type));\n }\n context.error(`Expected arguments of type ${signatures}, but found (${actualTypes.join(', ')}) instead.`);\n }\n return null;\n }\n static register(registry, definitions) {\n CompoundExpression.definitions = definitions;\n for (const name in definitions) {\n registry[name] = CompoundExpression;\n }\n }\n}\nfunction rgba(ctx, [r, g, b, a]) {\n r = r.evaluate(ctx);\n g = g.evaluate(ctx);\n b = b.evaluate(ctx);\n const alpha = a ? a.evaluate(ctx) : 1;\n const error = validateRGBA(r, g, b, alpha);\n if (error)\n throw new RuntimeError(error);\n return new Color(r / 255, g / 255, b / 255, alpha, false);\n}\nfunction has(key, obj) {\n return key in obj;\n}\nfunction get(key, obj) {\n const v = obj[key];\n return typeof v === 'undefined' ? null : v;\n}\nfunction binarySearch(v, a, i, j) {\n while (i <= j) {\n const m = (i + j) >> 1;\n if (a[m] === v)\n return true;\n if (a[m] > v)\n j = m - 1;\n else\n i = m + 1;\n }\n return false;\n}\nfunction varargs(type) {\n return { type };\n}\nCompoundExpression.register(expressions$1, {\n 'error': [\n ErrorType,\n [StringType],\n (ctx, [v]) => { throw new RuntimeError(v.evaluate(ctx)); }\n ],\n 'typeof': [\n StringType,\n [ValueType],\n (ctx, [v]) => typeToString(typeOf(v.evaluate(ctx)))\n ],\n 'to-rgba': [\n array(NumberType, 4),\n [ColorType],\n (ctx, [v]) => {\n const [r, g, b, a] = v.evaluate(ctx).rgb;\n return [r * 255, g * 255, b * 255, a];\n },\n ],\n 'rgb': [\n ColorType,\n [NumberType, NumberType, NumberType],\n rgba\n ],\n 'rgba': [\n ColorType,\n [NumberType, NumberType, NumberType, NumberType],\n rgba\n ],\n 'has': {\n type: BooleanType,\n overloads: [\n [\n [StringType],\n (ctx, [key]) => has(key.evaluate(ctx), ctx.properties())\n ], [\n [StringType, ObjectType],\n (ctx, [key, obj]) => has(key.evaluate(ctx), obj.evaluate(ctx))\n ]\n ]\n },\n 'get': {\n type: ValueType,\n overloads: [\n [\n [StringType],\n (ctx, [key]) => get(key.evaluate(ctx), ctx.properties())\n ], [\n [StringType, ObjectType],\n (ctx, [key, obj]) => get(key.evaluate(ctx), obj.evaluate(ctx))\n ]\n ]\n },\n 'feature-state': [\n ValueType,\n [StringType],\n (ctx, [key]) => get(key.evaluate(ctx), ctx.featureState || {})\n ],\n 'properties': [\n ObjectType,\n [],\n (ctx) => ctx.properties()\n ],\n 'geometry-type': [\n StringType,\n [],\n (ctx) => ctx.geometryType()\n ],\n 'id': [\n ValueType,\n [],\n (ctx) => ctx.id()\n ],\n 'zoom': [\n NumberType,\n [],\n (ctx) => ctx.globals.zoom\n ],\n 'heatmap-density': [\n NumberType,\n [],\n (ctx) => ctx.globals.heatmapDensity || 0\n ],\n 'elevation': [\n NumberType,\n [],\n (ctx) => ctx.globals.elevation || 0\n ],\n 'line-progress': [\n NumberType,\n [],\n (ctx) => ctx.globals.lineProgress || 0\n ],\n 'accumulated': [\n ValueType,\n [],\n (ctx) => ctx.globals.accumulated === undefined ? null : ctx.globals.accumulated\n ],\n '+': [\n NumberType,\n varargs(NumberType),\n (ctx, args) => {\n let result = 0;\n for (const arg of args) {\n result += arg.evaluate(ctx);\n }\n return result;\n }\n ],\n '*': [\n NumberType,\n varargs(NumberType),\n (ctx, args) => {\n let result = 1;\n for (const arg of args) {\n result *= arg.evaluate(ctx);\n }\n return result;\n }\n ],\n '-': {\n type: NumberType,\n overloads: [\n [\n [NumberType, NumberType],\n (ctx, [a, b]) => a.evaluate(ctx) - b.evaluate(ctx)\n ], [\n [NumberType],\n (ctx, [a]) => -a.evaluate(ctx)\n ]\n ]\n },\n '/': [\n NumberType,\n [NumberType, NumberType],\n (ctx, [a, b]) => a.evaluate(ctx) / b.evaluate(ctx)\n ],\n '%': [\n NumberType,\n [NumberType, NumberType],\n (ctx, [a, b]) => a.evaluate(ctx) % b.evaluate(ctx)\n ],\n 'ln2': [\n NumberType,\n [],\n () => Math.LN2\n ],\n 'pi': [\n NumberType,\n [],\n () => Math.PI\n ],\n 'e': [\n NumberType,\n [],\n () => Math.E\n ],\n '^': [\n NumberType,\n [NumberType, NumberType],\n (ctx, [b, e]) => Math.pow(b.evaluate(ctx), e.evaluate(ctx))\n ],\n 'sqrt': [\n NumberType,\n [NumberType],\n (ctx, [x]) => Math.sqrt(x.evaluate(ctx))\n ],\n 'log10': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.log(n.evaluate(ctx)) / Math.LN10\n ],\n 'ln': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.log(n.evaluate(ctx))\n ],\n 'log2': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.log(n.evaluate(ctx)) / Math.LN2\n ],\n 'sin': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.sin(n.evaluate(ctx))\n ],\n 'cos': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.cos(n.evaluate(ctx))\n ],\n 'tan': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.tan(n.evaluate(ctx))\n ],\n 'asin': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.asin(n.evaluate(ctx))\n ],\n 'acos': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.acos(n.evaluate(ctx))\n ],\n 'atan': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.atan(n.evaluate(ctx))\n ],\n 'min': [\n NumberType,\n varargs(NumberType),\n (ctx, args) => Math.min(...args.map(arg => arg.evaluate(ctx)))\n ],\n 'max': [\n NumberType,\n varargs(NumberType),\n (ctx, args) => Math.max(...args.map(arg => arg.evaluate(ctx)))\n ],\n 'abs': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.abs(n.evaluate(ctx))\n ],\n 'round': [\n NumberType,\n [NumberType],\n (ctx, [n]) => {\n const v = n.evaluate(ctx);\n // Javascript's Math.round() rounds towards +Infinity for halfway\n // values, even when they're negative. It's more common to round\n // away from 0 (e.g., this is what python and C++ do)\n return v < 0 ? -Math.round(-v) : Math.round(v);\n }\n ],\n 'floor': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.floor(n.evaluate(ctx))\n ],\n 'ceil': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.ceil(n.evaluate(ctx))\n ],\n 'filter-==': [\n BooleanType,\n [StringType, ValueType],\n (ctx, [k, v]) => ctx.properties()[k.value] === v.value\n ],\n 'filter-id-==': [\n BooleanType,\n [ValueType],\n (ctx, [v]) => ctx.id() === v.value\n ],\n 'filter-type-==': [\n BooleanType,\n [StringType],\n (ctx, [v]) => ctx.geometryType() === v.value\n ],\n 'filter-<': [\n BooleanType,\n [StringType, ValueType],\n (ctx, [k, v]) => {\n const a = ctx.properties()[k.value];\n const b = v.value;\n return typeof a === typeof b && a < b;\n }\n ],\n 'filter-id-<': [\n BooleanType,\n [ValueType],\n (ctx, [v]) => {\n const a = ctx.id();\n const b = v.value;\n return typeof a === typeof b && a < b;\n }\n ],\n 'filter->': [\n BooleanType,\n [StringType, ValueType],\n (ctx, [k, v]) => {\n const a = ctx.properties()[k.value];\n const b = v.value;\n return typeof a === typeof b && a > b;\n }\n ],\n 'filter-id->': [\n BooleanType,\n [ValueType],\n (ctx, [v]) => {\n const a = ctx.id();\n const b = v.value;\n return typeof a === typeof b && a > b;\n }\n ],\n 'filter-<=': [\n BooleanType,\n [StringType, ValueType],\n (ctx, [k, v]) => {\n const a = ctx.properties()[k.value];\n const b = v.value;\n return typeof a === typeof b && a <= b;\n }\n ],\n 'filter-id-<=': [\n BooleanType,\n [ValueType],\n (ctx, [v]) => {\n const a = ctx.id();\n const b = v.value;\n return typeof a === typeof b && a <= b;\n }\n ],\n 'filter->=': [\n BooleanType,\n [StringType, ValueType],\n (ctx, [k, v]) => {\n const a = ctx.properties()[k.value];\n const b = v.value;\n return typeof a === typeof b && a >= b;\n }\n ],\n 'filter-id->=': [\n BooleanType,\n [ValueType],\n (ctx, [v]) => {\n const a = ctx.id();\n const b = v.value;\n return typeof a === typeof b && a >= b;\n }\n ],\n 'filter-has': [\n BooleanType,\n [ValueType],\n (ctx, [k]) => k.value in ctx.properties()\n ],\n 'filter-has-id': [\n BooleanType,\n [],\n (ctx) => (ctx.id() !== null && ctx.id() !== undefined)\n ],\n 'filter-type-in': [\n BooleanType,\n [array(StringType)],\n (ctx, [v]) => v.value.indexOf(ctx.geometryType()) >= 0\n ],\n 'filter-id-in': [\n BooleanType,\n [array(ValueType)],\n (ctx, [v]) => v.value.indexOf(ctx.id()) >= 0\n ],\n 'filter-in-small': [\n BooleanType,\n [StringType, array(ValueType)],\n // assumes v is an array literal\n (ctx, [k, v]) => v.value.indexOf(ctx.properties()[k.value]) >= 0\n ],\n 'filter-in-large': [\n BooleanType,\n [StringType, array(ValueType)],\n // assumes v is a array literal with values sorted in ascending order and of a single type\n (ctx, [k, v]) => binarySearch(ctx.properties()[k.value], v.value, 0, v.value.length - 1)\n ],\n 'all': {\n type: BooleanType,\n overloads: [\n [\n [BooleanType, BooleanType],\n (ctx, [a, b]) => a.evaluate(ctx) && b.evaluate(ctx)\n ],\n [\n varargs(BooleanType),\n (ctx, args) => {\n for (const arg of args) {\n if (!arg.evaluate(ctx))\n return false;\n }\n return true;\n }\n ]\n ]\n },\n 'any': {\n type: BooleanType,\n overloads: [\n [\n [BooleanType, BooleanType],\n (ctx, [a, b]) => a.evaluate(ctx) || b.evaluate(ctx)\n ],\n [\n varargs(BooleanType),\n (ctx, args) => {\n for (const arg of args) {\n if (arg.evaluate(ctx))\n return true;\n }\n return false;\n }\n ]\n ]\n },\n '!': [\n BooleanType,\n [BooleanType],\n (ctx, [b]) => !b.evaluate(ctx)\n ],\n 'is-supported-script': [\n BooleanType,\n [StringType],\n // At parse time this will always return true, so we need to exclude this expression with isGlobalPropertyConstant\n (ctx, [s]) => {\n const isSupportedScript = ctx.globals && ctx.globals.isSupportedScript;\n if (isSupportedScript) {\n return isSupportedScript(s.evaluate(ctx));\n }\n return true;\n }\n ],\n 'upcase': [\n StringType,\n [StringType],\n (ctx, [s]) => s.evaluate(ctx).toUpperCase()\n ],\n 'downcase': [\n StringType,\n [StringType],\n (ctx, [s]) => s.evaluate(ctx).toLowerCase()\n ],\n 'concat': [\n StringType,\n varargs(ValueType),\n (ctx, args) => args.map(arg => valueToString(arg.evaluate(ctx))).join('')\n ],\n 'resolved-locale': [\n StringType,\n [CollatorType],\n (ctx, [collator]) => collator.evaluate(ctx).resolvedLocale()\n ]\n});\nfunction stringifySignature(signature) {\n if (Array.isArray(signature)) {\n return `(${signature.map(typeToString).join(', ')})`;\n }\n else {\n return `(${typeToString(signature.type)}...)`;\n }\n}\nfunction isExpressionConstant(expression) {\n if (expression instanceof Var) {\n return isExpressionConstant(expression.boundExpression);\n }\n else if (expression instanceof CompoundExpression && expression.name === 'error') {\n return false;\n }\n else if (expression instanceof CollatorExpression) {\n // Although the results of a Collator expression with fixed arguments\n // generally shouldn't change between executions, we can't serialize them\n // as constant expressions because results change based on environment.\n return false;\n }\n else if (expression instanceof Within) {\n return false;\n }\n else if (expression instanceof Distance) {\n return false;\n }\n else if (expression instanceof GlobalState) {\n return false;\n }\n const isTypeAnnotation = expression instanceof Coercion ||\n expression instanceof Assertion;\n let childrenConstant = true;\n expression.eachChild(child => {\n // We can _almost_ assume that if `expressions` children are constant,\n // they would already have been evaluated to Literal values when they\n // were parsed. Type annotations are the exception, because they might\n // have been inferred and added after a child was parsed.\n // So we recurse into isConstant() for the children of type annotations,\n // but otherwise simply check whether they are Literals.\n if (isTypeAnnotation) {\n childrenConstant = childrenConstant && isExpressionConstant(child);\n }\n else {\n childrenConstant = childrenConstant && child instanceof Literal;\n }\n });\n if (!childrenConstant) {\n return false;\n }\n return isFeatureConstant(expression) &&\n isGlobalPropertyConstant(expression, ['zoom', 'heatmap-density', 'elevation', 'line-progress', 'accumulated', 'is-supported-script']);\n}\nfunction isFeatureConstant(e) {\n if (e instanceof CompoundExpression) {\n if (e.name === 'get' && e.args.length === 1) {\n return false;\n }\n else if (e.name === 'feature-state') {\n return false;\n }\n else if (e.name === 'has' && e.args.length === 1) {\n return false;\n }\n else if (e.name === 'properties' ||\n e.name === 'geometry-type' ||\n e.name === 'id') {\n return false;\n }\n else if (/^filter-/.test(e.name)) {\n return false;\n }\n }\n if (e instanceof Within) {\n return false;\n }\n if (e instanceof Distance) {\n return false;\n }\n let result = true;\n e.eachChild(arg => {\n if (result && !isFeatureConstant(arg)) {\n result = false;\n }\n });\n return result;\n}\nfunction isStateConstant(e) {\n if (e instanceof CompoundExpression) {\n if (e.name === 'feature-state') {\n return false;\n }\n }\n let result = true;\n e.eachChild(arg => {\n if (result && !isStateConstant(arg)) {\n result = false;\n }\n });\n return result;\n}\nfunction isGlobalPropertyConstant(e, properties) {\n if (e instanceof CompoundExpression && properties.indexOf(e.name) >= 0) {\n return false;\n }\n let result = true;\n e.eachChild((arg) => {\n if (result && !isGlobalPropertyConstant(arg, properties)) {\n result = false;\n }\n });\n return result;\n}\n\nfunction success(value) {\n return { result: 'success', value };\n}\nfunction error(value) {\n return { result: 'error', value };\n}\n\nfunction supportsPropertyExpression(spec) {\n return spec['property-type'] === 'data-driven' || spec['property-type'] === 'cross-faded-data-driven';\n}\nfunction supportsZoomExpression(spec) {\n return !!spec.expression && spec.expression.parameters.indexOf('zoom') > -1;\n}\nfunction supportsInterpolation(spec) {\n return !!spec.expression && spec.expression.interpolated;\n}\n\nfunction getType(val) {\n if (val instanceof Number) {\n return 'number';\n }\n else if (val instanceof String) {\n return 'string';\n }\n else if (val instanceof Boolean) {\n return 'boolean';\n }\n else if (Array.isArray(val)) {\n return 'array';\n }\n else if (val === null) {\n return 'null';\n }\n else {\n return typeof val;\n }\n}\n\nfunction isFunction$1(value) {\n return typeof value === 'object' && value !== null && !Array.isArray(value) && typeOf(value) === ObjectType;\n}\nfunction identityFunction(x) {\n return x;\n}\nfunction getParseFunction(propertySpec) {\n switch (propertySpec.type) {\n case 'color':\n return Color.parse;\n case 'padding':\n return Padding.parse;\n case 'numberArray':\n return NumberArray.parse;\n case 'colorArray':\n return ColorArray.parse;\n default:\n return null;\n }\n}\nfunction getInnerFunction(type) {\n switch (type) {\n case 'exponential':\n return evaluateExponentialFunction;\n case 'interval':\n return evaluateIntervalFunction;\n case 'categorical':\n return evaluateCategoricalFunction;\n case 'identity':\n return evaluateIdentityFunction;\n default:\n throw new Error(`Unknown function type \"${type}\"`);\n }\n}\nfunction createFunction(parameters, propertySpec) {\n const zoomAndFeatureDependent = parameters.stops && typeof parameters.stops[0][0] === 'object';\n const featureDependent = zoomAndFeatureDependent || parameters.property !== undefined;\n const zoomDependent = zoomAndFeatureDependent || !featureDependent;\n const type = parameters.type || (supportsInterpolation(propertySpec) ? 'exponential' : 'interval');\n const parseFn = getParseFunction(propertySpec);\n if (parseFn) {\n parameters = extendBy({}, parameters);\n if (parameters.stops) {\n parameters.stops = parameters.stops.map((stop) => {\n return [stop[0], parseFn(stop[1])];\n });\n }\n if (parameters.default) {\n parameters.default = parseFn(parameters.default);\n }\n else {\n parameters.default = parseFn(propertySpec.default);\n }\n }\n if (parameters.colorSpace && !isSupportedInterpolationColorSpace(parameters.colorSpace)) {\n throw new Error(`Unknown color space: \"${parameters.colorSpace}\"`);\n }\n const innerFun = getInnerFunction(type);\n let hashedStops;\n let categoricalKeyType;\n if (type === 'categorical') {\n // For categorical functions, generate an Object as a hashmap of the stops for fast searching\n hashedStops = Object.create(null);\n for (const stop of parameters.stops) {\n hashedStops[stop[0]] = stop[1];\n }\n // Infer key type based on first stop key-- used to encforce strict type checking later\n categoricalKeyType = typeof parameters.stops[0][0];\n }\n if (zoomAndFeatureDependent) {\n const featureFunctions = {};\n const zoomStops = [];\n for (let s = 0; s < parameters.stops.length; s++) {\n const stop = parameters.stops[s];\n const zoom = stop[0].zoom;\n if (featureFunctions[zoom] === undefined) {\n featureFunctions[zoom] = {\n zoom,\n type: parameters.type,\n property: parameters.property,\n default: parameters.default,\n stops: []\n };\n zoomStops.push(zoom);\n }\n featureFunctions[zoom].stops.push([stop[0].value, stop[1]]);\n }\n const featureFunctionStops = [];\n for (const z of zoomStops) {\n featureFunctionStops.push([featureFunctions[z].zoom, createFunction(featureFunctions[z], propertySpec)]);\n }\n const interpolationType = { name: 'linear' };\n return {\n kind: 'composite',\n interpolationType,\n interpolationFactor: Interpolate.interpolationFactor.bind(undefined, interpolationType),\n zoomStops: featureFunctionStops.map(s => s[0]),\n evaluate({ zoom }, properties) {\n return evaluateExponentialFunction({\n stops: featureFunctionStops,\n base: parameters.base\n }, propertySpec, zoom).evaluate(zoom, properties);\n }\n };\n }\n else if (zoomDependent) {\n const interpolationType = type === 'exponential' ?\n { name: 'exponential', base: parameters.base !== undefined ? parameters.base : 1 } : null;\n return {\n kind: 'camera',\n interpolationType,\n interpolationFactor: Interpolate.interpolationFactor.bind(undefined, interpolationType),\n zoomStops: parameters.stops.map(s => s[0]),\n evaluate: ({ zoom }) => innerFun(parameters, propertySpec, zoom, hashedStops, categoricalKeyType)\n };\n }\n else {\n return {\n kind: 'source',\n evaluate(_, feature) {\n const value = feature && feature.properties ? feature.properties[parameters.property] : undefined;\n if (value === undefined) {\n return coalesce$1(parameters.default, propertySpec.default);\n }\n return innerFun(parameters, propertySpec, value, hashedStops, categoricalKeyType);\n }\n };\n }\n}\nfunction coalesce$1(a, b, c) {\n if (a !== undefined)\n return a;\n if (b !== undefined)\n return b;\n if (c !== undefined)\n return c;\n}\nfunction evaluateCategoricalFunction(parameters, propertySpec, input, hashedStops, keyType) {\n const evaluated = typeof input === keyType ? hashedStops[input] : undefined; // Enforce strict typing on input\n return coalesce$1(evaluated, parameters.default, propertySpec.default);\n}\nfunction evaluateIntervalFunction(parameters, propertySpec, input) {\n // Edge cases\n if (getType(input) !== 'number')\n return coalesce$1(parameters.default, propertySpec.default);\n const n = parameters.stops.length;\n if (n === 1)\n return parameters.stops[0][1];\n if (input <= parameters.stops[0][0])\n return parameters.stops[0][1];\n if (input >= parameters.stops[n - 1][0])\n return parameters.stops[n - 1][1];\n const index = findStopLessThanOrEqualTo(parameters.stops.map((stop) => stop[0]), input);\n return parameters.stops[index][1];\n}\nfunction evaluateExponentialFunction(parameters, propertySpec, input) {\n const base = parameters.base !== undefined ? parameters.base : 1;\n // Edge cases\n if (getType(input) !== 'number')\n return coalesce$1(parameters.default, propertySpec.default);\n const n = parameters.stops.length;\n if (n === 1)\n return parameters.stops[0][1];\n if (input <= parameters.stops[0][0])\n return parameters.stops[0][1];\n if (input >= parameters.stops[n - 1][0])\n return parameters.stops[n - 1][1];\n const index = findStopLessThanOrEqualTo(parameters.stops.map((stop) => stop[0]), input);\n const t = interpolationFactor(input, base, parameters.stops[index][0], parameters.stops[index + 1][0]);\n const outputLower = parameters.stops[index][1];\n const outputUpper = parameters.stops[index + 1][1];\n const interp = interpolateFactory[propertySpec.type] || identityFunction;\n if (typeof outputLower.evaluate === 'function') {\n return {\n evaluate(...args) {\n const evaluatedLower = outputLower.evaluate.apply(undefined, args);\n const evaluatedUpper = outputUpper.evaluate.apply(undefined, args);\n // Special case for fill-outline-color, which has no spec default.\n if (evaluatedLower === undefined || evaluatedUpper === undefined) {\n return undefined;\n }\n return interp(evaluatedLower, evaluatedUpper, t, parameters.colorSpace);\n }\n };\n }\n return interp(outputLower, outputUpper, t, parameters.colorSpace);\n}\nfunction evaluateIdentityFunction(parameters, propertySpec, input) {\n switch (propertySpec.type) {\n case 'color':\n input = Color.parse(input);\n break;\n case 'formatted':\n input = Formatted.fromString(input.toString());\n break;\n case 'resolvedImage':\n input = ResolvedImage.fromString(input.toString());\n break;\n case 'padding':\n input = Padding.parse(input);\n break;\n case 'colorArray':\n input = ColorArray.parse(input);\n break;\n case 'numberArray':\n input = NumberArray.parse(input);\n break;\n default:\n if (getType(input) !== propertySpec.type && (propertySpec.type !== 'enum' || !propertySpec.values[input])) {\n input = undefined;\n }\n }\n return coalesce$1(input, parameters.default, propertySpec.default);\n}\n/**\n * Returns a ratio that can be used to interpolate between exponential function\n * stops.\n *\n * How it works:\n * Two consecutive stop values define a (scaled and shifted) exponential\n * function `f(x) = a * base^x + b`, where `base` is the user-specified base,\n * and `a` and `b` are constants affording sufficient degrees of freedom to fit\n * the function to the given stops.\n *\n * Here's a bit of algebra that lets us compute `f(x)` directly from the stop\n * values without explicitly solving for `a` and `b`:\n *\n * First stop value: `f(x0) = y0 = a * base^x0 + b`\n * Second stop value: `f(x1) = y1 = a * base^x1 + b`\n * => `y1 - y0 = a(base^x1 - base^x0)`\n * => `a = (y1 - y0)/(base^x1 - base^x0)`\n *\n * Desired value: `f(x) = y = a * base^x + b`\n * => `f(x) = y0 + a * (base^x - base^x0)`\n *\n * From the above, we can replace the `a` in `a * (base^x - base^x0)` and do a\n * little algebra:\n * ```\n * a * (base^x - base^x0) = (y1 - y0)/(base^x1 - base^x0) * (base^x - base^x0)\n * = (y1 - y0) * (base^x - base^x0) / (base^x1 - base^x0)\n * ```\n *\n * If we let `(base^x - base^x0) / (base^x1 base^x0)`, then we have\n * `f(x) = y0 + (y1 - y0) * ratio`. In other words, `ratio` may be treated as\n * an interpolation factor between the two stops' output values.\n *\n * (Note: a slightly different form for `ratio`,\n * `(base^(x-x0) - 1) / (base^(x1-x0) - 1) `, is equivalent, but requires fewer\n * expensive `Math.pow()` operations.)\n *\n * @private\n */\nfunction interpolationFactor(input, base, lowerValue, upperValue) {\n const difference = upperValue - lowerValue;\n const progress = input - lowerValue;\n if (difference === 0) {\n return 0;\n }\n else if (base === 1) {\n return progress / difference;\n }\n else {\n return (Math.pow(base, progress) - 1) / (Math.pow(base, difference) - 1);\n }\n}\n\nclass StyleExpression {\n constructor(expression, propertySpec, globalState) {\n this.expression = expression;\n this._warningHistory = {};\n this._evaluator = new EvaluationContext();\n this._defaultValue = propertySpec ? getDefaultValue(propertySpec) : null;\n this._enumValues = propertySpec && propertySpec.type === 'enum' ? propertySpec.values : null;\n this._globalState = globalState;\n }\n evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection) {\n if (this._globalState) {\n globals = addGlobalState(globals, this._globalState);\n }\n this._evaluator.globals = globals;\n this._evaluator.feature = feature;\n this._evaluator.featureState = featureState;\n this._evaluator.canonical = canonical;\n this._evaluator.availableImages = availableImages || null;\n this._evaluator.formattedSection = formattedSection;\n return this.expression.evaluate(this._evaluator);\n }\n evaluate(globals, feature, featureState, canonical, availableImages, formattedSection) {\n if (this._globalState) {\n globals = addGlobalState(globals, this._globalState);\n }\n this._evaluator.globals = globals;\n this._evaluator.feature = feature || null;\n this._evaluator.featureState = featureState || null;\n this._evaluator.canonical = canonical;\n this._evaluator.availableImages = availableImages || null;\n this._evaluator.formattedSection = formattedSection || null;\n try {\n const val = this.expression.evaluate(this._evaluator);\n if (val === null || val === undefined || (typeof val === 'number' && val !== val)) {\n return this._defaultValue;\n }\n if (this._enumValues && !(val in this._enumValues)) {\n throw new RuntimeError(`Expected value to be one of ${Object.keys(this._enumValues).map(v => JSON.stringify(v)).join(', ')}, but found ${JSON.stringify(val)} instead.`);\n }\n return val;\n }\n catch (e) {\n if (!this._warningHistory[e.message]) {\n this._warningHistory[e.message] = true;\n if (typeof console !== 'undefined') {\n console.warn(e.message);\n }\n }\n return this._defaultValue;\n }\n }\n}\nfunction isExpression(expression) {\n return Array.isArray(expression) && expression.length > 0 &&\n typeof expression[0] === 'string' && expression[0] in expressions$1;\n}\n/**\n * Parse and typecheck the given style spec JSON expression. If\n * options.defaultValue is provided, then the resulting StyleExpression's\n * `evaluate()` method will handle errors by logging a warning (once per\n * message) and returning the default value. Otherwise, it will throw\n * evaluation errors.\n *\n * @private\n */\nfunction createExpression(expression, propertySpec, globalState) {\n const parser = new ParsingContext(expressions$1, isExpressionConstant, [], propertySpec ? getExpectedType(propertySpec) : undefined);\n // For string-valued properties, coerce to string at the top level rather than asserting.\n const parsed = parser.parse(expression, undefined, undefined, undefined, propertySpec && propertySpec.type === 'string' ? { typeAnnotation: 'coerce' } : undefined);\n if (!parsed) {\n return error(parser.errors);\n }\n return success(new StyleExpression(parsed, propertySpec, globalState));\n}\nclass ZoomConstantExpression {\n constructor(kind, expression, globalState) {\n this.kind = kind;\n this._styleExpression = expression;\n this.isStateDependent = kind !== 'constant' && !isStateConstant(expression.expression);\n this.globalStateRefs = findGlobalStateRefs(expression.expression);\n this._globalState = globalState;\n }\n evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection) {\n if (this._globalState) {\n globals = addGlobalState(globals, this._globalState);\n }\n return this._styleExpression.evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection);\n }\n evaluate(globals, feature, featureState, canonical, availableImages, formattedSection) {\n if (this._globalState) {\n globals = addGlobalState(globals, this._globalState);\n }\n return this._styleExpression.evaluate(globals, feature, featureState, canonical, availableImages, formattedSection);\n }\n}\nclass ZoomDependentExpression {\n constructor(kind, expression, zoomStops, interpolationType, globalState) {\n this.kind = kind;\n this.zoomStops = zoomStops;\n this._styleExpression = expression;\n this.isStateDependent = kind !== 'camera' && !isStateConstant(expression.expression);\n this.globalStateRefs = findGlobalStateRefs(expression.expression);\n this.interpolationType = interpolationType;\n this._globalState = globalState;\n }\n evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection) {\n if (this._globalState) {\n globals = addGlobalState(globals, this._globalState);\n }\n return this._styleExpression.evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection);\n }\n evaluate(globals, feature, featureState, canonical, availableImages, formattedSection) {\n if (this._globalState) {\n globals = addGlobalState(globals, this._globalState);\n }\n return this._styleExpression.evaluate(globals, feature, featureState, canonical, availableImages, formattedSection);\n }\n interpolationFactor(input, lower, upper) {\n if (this.interpolationType) {\n return Interpolate.interpolationFactor(this.interpolationType, input, lower, upper);\n }\n else {\n return 0;\n }\n }\n}\nfunction isZoomExpression(expression) {\n return expression._styleExpression !== undefined;\n}\nfunction createPropertyExpression(expressionInput, propertySpec, globalState) {\n const expression = createExpression(expressionInput, propertySpec, globalState);\n if (expression.result === 'error') {\n return expression;\n }\n const parsed = expression.value.expression;\n const isFeatureConstantResult = isFeatureConstant(parsed);\n if (!isFeatureConstantResult && !supportsPropertyExpression(propertySpec)) {\n return error([new ExpressionParsingError('', 'data expressions not supported')]);\n }\n const isZoomConstant = isGlobalPropertyConstant(parsed, ['zoom']);\n if (!isZoomConstant && !supportsZoomExpression(propertySpec)) {\n return error([new ExpressionParsingError('', 'zoom expressions not supported')]);\n }\n const zoomCurve = findZoomCurve(parsed);\n if (!zoomCurve && !isZoomConstant) {\n return error([new ExpressionParsingError('', '\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression.')]);\n }\n else if (zoomCurve instanceof ExpressionParsingError) {\n return error([zoomCurve]);\n }\n else if (zoomCurve instanceof Interpolate && !supportsInterpolation(propertySpec)) {\n return error([new ExpressionParsingError('', '\"interpolate\" expressions cannot be used with this property')]);\n }\n if (!zoomCurve) {\n return success(isFeatureConstantResult ?\n new ZoomConstantExpression('constant', expression.value, globalState) :\n new ZoomConstantExpression('source', expression.value, globalState));\n }\n const interpolationType = zoomCurve instanceof Interpolate ? zoomCurve.interpolation : undefined;\n return success(isFeatureConstantResult ?\n new ZoomDependentExpression('camera', expression.value, zoomCurve.labels, interpolationType, globalState) :\n new ZoomDependentExpression('composite', expression.value, zoomCurve.labels, interpolationType, globalState));\n}\n// serialization wrapper for old-style stop functions normalized to the\n// expression interface\nclass StylePropertyFunction {\n constructor(parameters, specification) {\n this._parameters = parameters;\n this._specification = specification;\n extendBy(this, createFunction(this._parameters, this._specification));\n }\n static deserialize(serialized) {\n return new StylePropertyFunction(serialized._parameters, serialized._specification);\n }\n static serialize(input) {\n return {\n _parameters: input._parameters,\n _specification: input._specification\n };\n }\n}\nfunction normalizePropertyExpression(value, specification, globalState) {\n if (isFunction$1(value)) {\n return new StylePropertyFunction(value, specification);\n }\n else if (isExpression(value)) {\n const expression = createPropertyExpression(value, specification, globalState);\n if (expression.result === 'error') {\n // this should have been caught in validation\n throw new Error(expression.value.map(err => `${err.key}: ${err.message}`).join(', '));\n }\n return expression.value;\n }\n else {\n let constant = value;\n if (specification.type === 'color' && typeof value === 'string') {\n constant = Color.parse(value);\n }\n else if (specification.type === 'padding' && (typeof value === 'number' || Array.isArray(value))) {\n constant = Padding.parse(value);\n }\n else if (specification.type === 'numberArray' && (typeof value === 'number' || Array.isArray(value))) {\n constant = NumberArray.parse(value);\n }\n else if (specification.type === 'colorArray' && (typeof value === 'string' || Array.isArray(value))) {\n constant = ColorArray.parse(value);\n }\n else if (specification.type === 'variableAnchorOffsetCollection' && Array.isArray(value)) {\n constant = VariableAnchorOffsetCollection.parse(value);\n }\n else if (specification.type === 'projectionDefinition' && typeof value === 'string') {\n constant = ProjectionDefinition.parse(value);\n }\n return {\n globalStateRefs: new Set(),\n _globalState: null,\n kind: 'constant',\n evaluate: () => constant\n };\n }\n}\n// Zoom-dependent expressions may only use [\"zoom\"] as the input to a top-level \"step\" or \"interpolate\"\n// expression (collectively referred to as a \"curve\"). The curve may be wrapped in one or more \"let\" or\n// \"coalesce\" expressions.\nfunction findZoomCurve(expression) {\n let result = null;\n if (expression instanceof Let) {\n result = findZoomCurve(expression.result);\n }\n else if (expression instanceof Coalesce) {\n for (const arg of expression.args) {\n result = findZoomCurve(arg);\n if (result) {\n break;\n }\n }\n }\n else if ((expression instanceof Step || expression instanceof Interpolate) &&\n expression.input instanceof CompoundExpression &&\n expression.input.name === 'zoom') {\n result = expression;\n }\n if (result instanceof ExpressionParsingError) {\n return result;\n }\n expression.eachChild((child) => {\n const childResult = findZoomCurve(child);\n if (childResult instanceof ExpressionParsingError) {\n result = childResult;\n }\n else if (!result && childResult) {\n result = new ExpressionParsingError('', '\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression.');\n }\n else if (result && childResult && result !== childResult) {\n result = new ExpressionParsingError('', 'Only one zoom-based \"step\" or \"interpolate\" subexpression may be used in an expression.');\n }\n });\n return result;\n}\nfunction findGlobalStateRefs(expression, results = new Set()) {\n if (expression instanceof GlobalState) {\n results.add(expression.key);\n }\n expression.eachChild(childExpression => {\n findGlobalStateRefs(childExpression, results);\n });\n return results;\n}\nfunction getExpectedType(spec) {\n const types = {\n color: ColorType,\n string: StringType,\n number: NumberType,\n enum: StringType,\n boolean: BooleanType,\n formatted: FormattedType,\n padding: PaddingType,\n numberArray: NumberArrayType,\n colorArray: ColorArrayType,\n projectionDefinition: ProjectionDefinitionType,\n resolvedImage: ResolvedImageType,\n variableAnchorOffsetCollection: VariableAnchorOffsetCollectionType\n };\n if (spec.type === 'array') {\n return array(types[spec.value] || ValueType, spec.length);\n }\n return types[spec.type];\n}\nfunction getDefaultValue(spec) {\n if (spec.type === 'color' && isFunction$1(spec.default)) {\n // Special case for heatmap-color: it uses the 'default:' to define a\n // default color ramp, but createExpression expects a simple value to fall\n // back to in case of runtime errors\n return new Color(0, 0, 0, 0);\n }\n switch (spec.type) {\n case 'color':\n return Color.parse(spec.default) || null;\n case 'padding':\n return Padding.parse(spec.default) || null;\n case 'numberArray':\n return NumberArray.parse(spec.default) || null;\n case 'colorArray':\n return ColorArray.parse(spec.default) || null;\n case 'variableAnchorOffsetCollection':\n return VariableAnchorOffsetCollection.parse(spec.default) || null;\n case 'projectionDefinition':\n return ProjectionDefinition.parse(spec.default) || null;\n default:\n return (spec.default === undefined ? null : spec.default);\n }\n}\nfunction addGlobalState(globals, globalState) {\n const { zoom, heatmapDensity, elevation, lineProgress, isSupportedScript, accumulated } = globals !== null && globals !== void 0 ? globals : {};\n return {\n zoom,\n heatmapDensity,\n elevation,\n lineProgress,\n isSupportedScript,\n accumulated,\n globalState\n };\n}\n\nfunction isExpressionFilter(filter) {\n if (filter === true || filter === false) {\n return true;\n }\n if (!Array.isArray(filter) || filter.length === 0) {\n return false;\n }\n switch (filter[0]) {\n case 'has':\n return filter.length >= 2 && filter[1] !== '$id' && filter[1] !== '$type';\n case 'in':\n return filter.length >= 3 && (typeof filter[1] !== 'string' || Array.isArray(filter[2]));\n case '!in':\n case '!has':\n case 'none':\n return false;\n case '==':\n case '!=':\n case '>':\n case '>=':\n case '<':\n case '<=':\n return filter.length !== 3 || (Array.isArray(filter[1]) || Array.isArray(filter[2]));\n case 'any':\n case 'all':\n for (const f of filter.slice(1)) {\n if (!isExpressionFilter(f) && typeof f !== 'boolean') {\n return false;\n }\n }\n return true;\n default:\n return true;\n }\n}\nconst filterSpec = {\n 'type': 'boolean',\n 'default': false,\n 'transition': false,\n 'property-type': 'data-driven',\n 'expression': {\n 'interpolated': false,\n 'parameters': ['zoom', 'feature']\n }\n};\n/**\n * Given a filter expressed as nested arrays, return a new function\n * that evaluates whether a given feature (with a .properties or .tags property)\n * passes its test.\n *\n * @private\n * @param filter MapLibre filter\n * @param [globalState] Global state object to be used for evaluating 'global-state' expressions\n * @returns filter-evaluating function\n */\nfunction featureFilter(filter, globalState) {\n if (filter === null || filter === undefined) {\n return { filter: () => true, needGeometry: false, getGlobalStateRefs: () => new Set() };\n }\n if (!isExpressionFilter(filter)) {\n filter = convertFilter$1(filter);\n }\n const compiled = createExpression(filter, filterSpec, globalState);\n if (compiled.result === 'error') {\n throw new Error(compiled.value.map(err => `${err.key}: ${err.message}`).join(', '));\n }\n else {\n const needGeometry = geometryNeeded(filter);\n return {\n filter: (globalProperties, feature, canonical) => compiled.value.evaluate(globalProperties, feature, {}, canonical),\n needGeometry,\n getGlobalStateRefs: () => findGlobalStateRefs(compiled.value.expression)\n };\n }\n}\n// Comparison function to sort numbers and strings\nfunction compare(a, b) {\n return a < b ? -1 : a > b ? 1 : 0;\n}\nfunction geometryNeeded(filter) {\n if (!Array.isArray(filter))\n return false;\n if (filter[0] === 'within' || filter[0] === 'distance')\n return true;\n for (let index = 1; index < filter.length; index++) {\n if (geometryNeeded(filter[index]))\n return true;\n }\n return false;\n}\nfunction convertFilter$1(filter) {\n if (!filter)\n return true;\n const op = filter[0];\n if (filter.length <= 1)\n return (op !== 'any');\n const converted = op === '==' ? convertComparisonOp$1(filter[1], filter[2], '==') :\n op === '!=' ? convertNegation(convertComparisonOp$1(filter[1], filter[2], '==')) :\n op === '<' ||\n op === '>' ||\n op === '<=' ||\n op === '>=' ? convertComparisonOp$1(filter[1], filter[2], op) :\n op === 'any' ? convertDisjunctionOp(filter.slice(1)) :\n op === 'all' ? ['all'].concat(filter.slice(1).map(convertFilter$1)) :\n op === 'none' ? ['all'].concat(filter.slice(1).map(convertFilter$1).map(convertNegation)) :\n op === 'in' ? convertInOp$1(filter[1], filter.slice(2)) :\n op === '!in' ? convertNegation(convertInOp$1(filter[1], filter.slice(2))) :\n op === 'has' ? convertHasOp$1(filter[1]) :\n op === '!has' ? convertNegation(convertHasOp$1(filter[1])) :\n true;\n return converted;\n}\nfunction convertComparisonOp$1(property, value, op) {\n switch (property) {\n case '$type':\n return [`filter-type-${op}`, value];\n case '$id':\n return [`filter-id-${op}`, value];\n default:\n return [`filter-${op}`, property, value];\n }\n}\nfunction convertDisjunctionOp(filters) {\n return ['any'].concat(filters.map(convertFilter$1));\n}\nfunction convertInOp$1(property, values) {\n if (values.length === 0) {\n return false;\n }\n switch (property) {\n case '$type':\n return ['filter-type-in', ['literal', values]];\n case '$id':\n return ['filter-id-in', ['literal', values]];\n default:\n if (values.length > 200 && !values.some(v => typeof v !== typeof values[0])) {\n return ['filter-in-large', property, ['literal', values.sort(compare)]];\n }\n else {\n return ['filter-in-small', property, ['literal', values]];\n }\n }\n}\nfunction convertHasOp$1(property) {\n switch (property) {\n case '$type':\n return true;\n case '$id':\n return ['filter-has-id'];\n default:\n return ['filter-has', property];\n }\n}\nfunction convertNegation(filter) {\n return ['!', filter];\n}\n\n/*\n * Convert the given filter to an expression, storing the expected types for\n * any feature properties referenced in expectedTypes.\n *\n * These expected types are needed in order to construct preflight type checks\n * needed for handling 'any' filters. A preflight type check is necessary in\n * order to mimic legacy filters' semantics around expected type mismatches.\n * For example, consider the legacy filter:\n *\n * [\"any\", [\"all\", [\">\", \"y\", 0], [\">\", \"y\", 0]], [\">\", \"x\", 0]]\n *\n * Naively, we might convert this to the expression:\n *\n * [\"any\", [\"all\", [\">\", [\"get\", \"y\"], 0], [\">\", [\"get\", \"z\"], 0]], [\">\", [\"get\", \"x\"], 0]]\n *\n * But if we tried to evaluate this against, say `{x: 1, y: null, z: 0}`, the\n * [\">\", [\"get\", \"y\"], 0] would cause an evaluation error, leading to the\n * entire filter returning false. Legacy filter semantics, though, ask for\n * [\">\", \"y\", 0] to simply return `false` when `y` is of the wrong type,\n * allowing the subsequent terms of the outer \"any\" expression to be evaluated\n * (resulting, in this case, in a `true` value, because x > 0).\n *\n * We account for this by inserting a preflight type-checking expression before\n * each \"any\" term, allowing us to avoid evaluating the actual converted filter\n * if any type mismatches would cause it to produce an evaluation error:\n *\n * [\"any\",\n * [\"case\",\n * [\"all\", [\"==\", [\"typeof\", [\"get\", \"y\"]], \"number\"], [\"==\", [\"typeof\", [\"get\", \"z\"], \"number]],\n * [\"all\", [\">\", [\"get\", \"y\"], 0], [\">\", [\"get\", \"z\"], 0]],\n * false\n * ],\n * [\"case\",\n * [\"==\", [\"typeof\", [\"get\", \"x\"], \"number\"]],\n * [\">\", [\"get\", \"x\"], 0],\n * false\n * ]\n * ]\n *\n * An alternative, possibly more direct approach would be to use type checks\n * in the conversion of each comparison operator, so that the converted version\n * of each individual ==, >=, etc. would mimic the legacy filter semantics. The\n * downside of this approach is that it can lead to many more type checks than\n * would otherwise be necessary: outside the context of an \"any\" expression,\n * bailing out due to a runtime type error (expression semantics) and returning\n * false (legacy filter semantics) are equivalent: they cause the filter to\n * produce a `false` result.\n */\nfunction convertFilter(filter, expectedTypes = {}) {\n if (isExpressionFilter(filter))\n return filter;\n if (!filter)\n return true;\n const legacyFilter = filter;\n const legacyOp = legacyFilter[0];\n if (filter.length <= 1)\n return (legacyOp !== 'any');\n switch (legacyOp) {\n case '==':\n case '!=':\n case '<':\n case '>':\n case '<=':\n case '>=': {\n const [, property, value] = filter;\n return convertComparisonOp(property, value, legacyOp, expectedTypes);\n }\n case 'any': {\n const [, ...conditions] = legacyFilter;\n const children = conditions.map((f) => {\n const types = {};\n const child = convertFilter(f, types);\n const typechecks = runtimeTypeChecks(types);\n return typechecks === true ? child : ['case', typechecks, child, false];\n });\n return ['any', ...children];\n }\n case 'all': {\n const [, ...conditions] = legacyFilter;\n const children = conditions.map(f => convertFilter(f, expectedTypes));\n return children.length > 1 ? ['all', ...children] : children[0];\n }\n case 'none': {\n const [, ...conditions] = legacyFilter;\n return ['!', convertFilter(['any', ...conditions], {})];\n }\n case 'in': {\n const [, property, ...values] = legacyFilter;\n return convertInOp(property, values);\n }\n case '!in': {\n const [, property, ...values] = legacyFilter;\n return convertInOp(property, values, true);\n }\n case 'has':\n return convertHasOp(legacyFilter[1]);\n case '!has':\n return ['!', convertHasOp(legacyFilter[1])];\n default:\n return true;\n }\n}\n// Given a set of feature properties and an expected type for each one,\n// construct an boolean expression that tests whether each property has the\n// right type.\n// E.g.: for {name: 'string', population: 'number'}, return\n// [ 'all',\n// ['==', ['typeof', ['get', 'name'], 'string']],\n// ['==', ['typeof', ['get', 'population'], 'number]]\n// ]\nfunction runtimeTypeChecks(expectedTypes) {\n const conditions = [];\n for (const property in expectedTypes) {\n const get = property === '$id' ? ['id'] : ['get', property];\n conditions.push(['==', ['typeof', get], expectedTypes[property]]);\n }\n if (conditions.length === 0)\n return true;\n if (conditions.length === 1)\n return conditions[0];\n return ['all', ...conditions];\n}\nfunction convertComparisonOp(property, value, op, expectedTypes) {\n let get;\n if (property === '$type') {\n return [op, ['geometry-type'], value];\n }\n else if (property === '$id') {\n get = ['id'];\n }\n else {\n get = ['get', property];\n }\n if (expectedTypes && value !== null) {\n const type = typeof value;\n expectedTypes[property] = type;\n }\n if (op === '==' && property !== '$id' && value === null) {\n return [\n 'all',\n ['has', property], // missing property != null for legacy filters\n ['==', get, null]\n ];\n }\n else if (op === '!=' && property !== '$id' && value === null) {\n return [\n 'any',\n ['!', ['has', property]], // missing property != null for legacy filters\n ['!=', get, null]\n ];\n }\n return [op, get, value];\n}\nfunction convertInOp(property, values, negate = false) {\n if (values.length === 0)\n return negate;\n let get;\n if (property === '$type') {\n get = ['geometry-type'];\n }\n else if (property === '$id') {\n get = ['id'];\n }\n else {\n get = ['get', property];\n }\n // Determine if the list of values to be searched is homogenously typed.\n // If so (and if the type is string or number), then we can use a\n // [match, input, [...values], true, false] construction rather than a\n // bunch of `==` tests.\n let uniformTypes = true;\n const type = typeof values[0];\n for (const value of values) {\n if (typeof value !== type) {\n uniformTypes = false;\n break;\n }\n }\n if (uniformTypes && (type === 'string' || type === 'number')) {\n // Match expressions must have unique values.\n const uniqueValues = values.sort().filter((v, i) => i === 0 || values[i - 1] !== v);\n return ['match', get, uniqueValues, !negate, negate];\n }\n if (negate) {\n return ['all', ...values.map(v => ['!=', get, v])];\n }\n else {\n return ['any', ...values.map(v => ['==', get, v])];\n }\n}\nfunction convertHasOp(property) {\n if (property === '$type') {\n return true;\n }\n else if (property === '$id') {\n return ['!=', ['id'], null];\n }\n else {\n return ['has', property];\n }\n}\n\nfunction convertLiteral(value) {\n return typeof value === 'object' ? ['literal', value] : value;\n}\nfunction convertFunction(parameters, propertySpec) {\n let stops = parameters.stops;\n if (!stops) {\n // identity function\n return convertIdentityFunction(parameters, propertySpec);\n }\n const zoomAndFeatureDependent = stops && typeof stops[0][0] === 'object';\n const featureDependent = zoomAndFeatureDependent || parameters.property !== undefined;\n const zoomDependent = zoomAndFeatureDependent || !featureDependent;\n stops = stops.map((stop) => {\n if (!featureDependent && propertySpec.tokens && typeof stop[1] === 'string') {\n return [stop[0], convertTokenString(stop[1])];\n }\n return [stop[0], convertLiteral(stop[1])];\n });\n if (zoomAndFeatureDependent) {\n return convertZoomAndPropertyFunction(parameters, propertySpec, stops);\n }\n else if (zoomDependent) {\n return convertZoomFunction(parameters, propertySpec, stops);\n }\n else {\n return convertPropertyFunction(parameters, propertySpec, stops);\n }\n}\nfunction convertIdentityFunction(parameters, propertySpec) {\n const get = ['get', parameters.property];\n if (parameters.default === undefined) {\n // By default, expressions for string-valued properties get coerced. To preserve\n // legacy function semantics, insert an explicit assertion instead.\n return propertySpec.type === 'string' ? ['string', get] : get;\n }\n else if (propertySpec.type === 'enum') {\n return [\n 'match',\n get,\n Object.keys(propertySpec.values),\n get,\n parameters.default\n ];\n }\n else {\n const expression = [propertySpec.type === 'color' ? 'to-color' : propertySpec.type, get, convertLiteral(parameters.default)];\n if (propertySpec.type === 'array') {\n expression.splice(1, 0, propertySpec.value, propertySpec.length || null);\n }\n return expression;\n }\n}\nfunction getInterpolateOperator(parameters) {\n switch (parameters.colorSpace) {\n case 'hcl': return 'interpolate-hcl';\n case 'lab': return 'interpolate-lab';\n default: return 'interpolate';\n }\n}\nfunction convertZoomAndPropertyFunction(parameters, propertySpec, stops) {\n const featureFunctionParameters = {};\n const featureFunctionStops = {};\n const zoomStops = [];\n for (let s = 0; s < stops.length; s++) {\n const stop = stops[s];\n const zoom = stop[0].zoom;\n if (featureFunctionParameters[zoom] === undefined) {\n featureFunctionParameters[zoom] = {\n zoom,\n type: parameters.type,\n property: parameters.property,\n default: parameters.default,\n };\n featureFunctionStops[zoom] = [];\n zoomStops.push(zoom);\n }\n featureFunctionStops[zoom].push([stop[0].value, stop[1]]);\n }\n // the interpolation type for the zoom dimension of a zoom-and-property\n // function is determined directly from the style property specification\n // for which it's being used: linear for interpolatable properties, step\n // otherwise.\n const functionType = getFunctionType({}, propertySpec);\n if (functionType === 'exponential') {\n const expression = [getInterpolateOperator(parameters), ['linear'], ['zoom']];\n for (const z of zoomStops) {\n const output = convertPropertyFunction(featureFunctionParameters[z], propertySpec, featureFunctionStops[z]);\n appendStopPair(expression, z, output, false);\n }\n return expression;\n }\n else {\n const expression = ['step', ['zoom']];\n for (const z of zoomStops) {\n const output = convertPropertyFunction(featureFunctionParameters[z], propertySpec, featureFunctionStops[z]);\n appendStopPair(expression, z, output, true);\n }\n fixupDegenerateStepCurve(expression);\n return expression;\n }\n}\nfunction coalesce(a, b) {\n if (a !== undefined)\n return a;\n if (b !== undefined)\n return b;\n}\nfunction getFallback(parameters, propertySpec) {\n const defaultValue = convertLiteral(coalesce(parameters.default, propertySpec.default));\n /*\n * Some fields with type: resolvedImage have an undefined default.\n * Because undefined is an invalid value for resolvedImage, set fallback to\n * an empty string instead of undefined to ensure output\n * passes validation.\n */\n if (defaultValue === undefined && propertySpec.type === 'resolvedImage') {\n return '';\n }\n return defaultValue;\n}\nfunction convertPropertyFunction(parameters, propertySpec, stops) {\n const type = getFunctionType(parameters, propertySpec);\n const get = ['get', parameters.property];\n if (type === 'categorical' && typeof stops[0][0] === 'boolean') {\n const expression = ['case'];\n for (const stop of stops) {\n expression.push(['==', get, stop[0]], stop[1]);\n }\n expression.push(getFallback(parameters, propertySpec));\n return expression;\n }\n else if (type === 'categorical') {\n const expression = ['match', get];\n for (const stop of stops) {\n appendStopPair(expression, stop[0], stop[1], false);\n }\n expression.push(getFallback(parameters, propertySpec));\n return expression;\n }\n else if (type === 'interval') {\n const expression = ['step', ['number', get]];\n for (const stop of stops) {\n appendStopPair(expression, stop[0], stop[1], true);\n }\n fixupDegenerateStepCurve(expression);\n return parameters.default === undefined ? expression : [\n 'case',\n ['==', ['typeof', get], 'number'],\n expression,\n convertLiteral(parameters.default)\n ];\n }\n else if (type === 'exponential') {\n const base = parameters.base !== undefined ? parameters.base : 1;\n const expression = [\n getInterpolateOperator(parameters),\n base === 1 ? ['linear'] : ['exponential', base],\n ['number', get]\n ];\n for (const stop of stops) {\n appendStopPair(expression, stop[0], stop[1], false);\n }\n return parameters.default === undefined ? expression : [\n 'case',\n ['==', ['typeof', get], 'number'],\n expression,\n convertLiteral(parameters.default)\n ];\n }\n else {\n throw new Error(`Unknown property function type ${type}`);\n }\n}\nfunction convertZoomFunction(parameters, propertySpec, stops, input = ['zoom']) {\n const type = getFunctionType(parameters, propertySpec);\n let expression;\n let isStep = false;\n if (type === 'interval') {\n expression = ['step', input];\n isStep = true;\n }\n else if (type === 'exponential') {\n const base = parameters.base !== undefined ? parameters.base : 1;\n expression = [getInterpolateOperator(parameters), base === 1 ? ['linear'] : ['exponential', base], input];\n }\n else {\n throw new Error(`Unknown zoom function type \"${type}\"`);\n }\n for (const stop of stops) {\n appendStopPair(expression, stop[0], stop[1], isStep);\n }\n fixupDegenerateStepCurve(expression);\n return expression;\n}\nfunction fixupDegenerateStepCurve(expression) {\n // degenerate step curve (i.e. a constant function): add a noop stop\n if (expression[0] === 'step' && expression.length === 3) {\n expression.push(0);\n expression.push(expression[3]);\n }\n}\nfunction appendStopPair(curve, input, output, isStep) {\n // Skip duplicate stop values. They were not validated for functions, but they are for expressions.\n // https://github.com/mapbox/mapbox-gl-js/issues/4107\n if (curve.length > 3 && input === curve[curve.length - 2]) {\n return;\n }\n // step curves don't get the first input value, as it is redundant.\n if (!(isStep && curve.length === 2)) {\n curve.push(input);\n }\n curve.push(output);\n}\nfunction getFunctionType(parameters, propertySpec) {\n if (parameters.type) {\n return parameters.type;\n }\n else {\n return propertySpec.expression.interpolated ? 'exponential' : 'interval';\n }\n}\n// \"String with {name} token\" => [\"concat\", \"String with \", [\"get\", \"name\"], \" token\"]\nfunction convertTokenString(s) {\n const result = ['concat'];\n const re = /{([^{}]+)}/g;\n let pos = 0;\n for (let match = re.exec(s); match !== null; match = re.exec(s)) {\n const literal = s.slice(pos, re.lastIndex - match[0].length);\n pos = re.lastIndex;\n if (literal.length > 0)\n result.push(literal);\n result.push(['get', match[1]]);\n }\n if (result.length === 1) {\n return s;\n }\n if (pos < s.length) {\n result.push(s.slice(pos));\n }\n else if (result.length === 2) {\n return ['to-string', result[1]];\n }\n return result;\n}\n\nfunction getPropertyReference(propertyName) {\n for (let i = 0; i < v8Spec.layout.length; i++) {\n for (const key in v8Spec[v8Spec.layout[i]]) {\n if (key === propertyName)\n return v8Spec[v8Spec.layout[i]][key];\n }\n }\n for (let i = 0; i < v8Spec.paint.length; i++) {\n for (const key in v8Spec[v8Spec.paint[i]]) {\n if (key === propertyName)\n return v8Spec[v8Spec.paint[i]][key];\n }\n }\n return null;\n}\nfunction eachSource(style, callback) {\n for (const k in style.sources) {\n callback(style.sources[k]);\n }\n}\nfunction eachLayer(style, callback) {\n for (const layer of style.layers) {\n callback(layer);\n }\n}\nfunction eachProperty(style, options, callback) {\n function inner(layer, propertyType) {\n const properties = layer[propertyType];\n if (!properties)\n return;\n Object.keys(properties).forEach((key) => {\n callback({\n path: [layer.id, propertyType, key],\n key,\n value: properties[key],\n reference: getPropertyReference(key),\n set(x) {\n properties[key] = x;\n }\n });\n });\n }\n eachLayer(style, (layer) => {\n if (options.paint) {\n inner(layer, 'paint');\n }\n if (options.layout) {\n inner(layer, 'layout');\n }\n });\n}\n\nfunction stringify$1(obj) {\n const type = typeof obj;\n if (type === 'number' || type === 'boolean' || type === 'string' || obj === undefined || obj === null)\n return JSON.stringify(obj);\n if (Array.isArray(obj)) {\n let str = '[';\n for (const val of obj) {\n str += `${stringify$1(val)},`;\n }\n return `${str}]`;\n }\n const keys = Object.keys(obj).sort();\n let str = '{';\n for (let i = 0; i < keys.length; i++) {\n str += `${JSON.stringify(keys[i])}:${stringify$1(obj[keys[i]])},`;\n }\n return `${str}}`;\n}\nfunction getKey(layer) {\n let key = '';\n for (const k of refProperties) {\n key += `/${stringify$1(layer[k])}`;\n }\n return key;\n}\n/**\n * Groups layers by their layout-affecting properties.\n * These are the properties that were formerly used by explicit `ref` mechanism\n * for layers: 'type', 'source', 'source-layer', 'minzoom', 'maxzoom',\n * 'filter', and 'layout'.\n *\n * The input is not modified. The output layers are references to the\n * input layers.\n *\n * @param layers - an array of {@link LayerSpecification}.\n * @param cachedKeys - an object to keep already calculated keys.\n * @returns an array of arrays of {@link LayerSpecification} objects, where each inner array\n * contains layers that share the same layout-affecting properties.\n */\nfunction groupByLayout(layers, cachedKeys) {\n const groups = {};\n for (let i = 0; i < layers.length; i++) {\n const k = (cachedKeys && cachedKeys[layers[i].id]) || getKey(layers[i]);\n // update the cache if there is one\n if (cachedKeys)\n cachedKeys[layers[i].id] = k;\n let group = groups[k];\n if (!group) {\n group = groups[k] = [];\n }\n group.push(layers[i]);\n }\n const result = [];\n for (const k in groups) {\n result.push(groups[k]);\n }\n return result;\n}\n\nfunction emptyStyle() {\n const style = {};\n const version = v8Spec['$version'];\n for (const styleKey in v8Spec['$root']) {\n const specification = v8Spec['$root'][styleKey];\n if (specification.required) {\n let value = null;\n if (styleKey === 'version') {\n value = version;\n }\n else {\n if (specification.type === 'array') {\n value = [];\n }\n else {\n value = {};\n }\n }\n if (value != null) {\n style[styleKey] = value;\n }\n }\n }\n return style;\n}\n\nfunction validateConstants(options) {\n const key = options.key;\n const constants = options.value;\n if (constants) {\n return [new ValidationError(key, constants, 'constants have been deprecated as of v8')];\n }\n else {\n return [];\n }\n}\n\n// Turn jsonlint-lines-primitives objects into primitive objects\nfunction unbundle(value) {\n if (value instanceof Number || value instanceof String || value instanceof Boolean) {\n return value.valueOf();\n }\n else {\n return value;\n }\n}\nfunction deepUnbundle(value) {\n if (Array.isArray(value)) {\n return value.map(deepUnbundle);\n }\n else if (value instanceof Object && !(value instanceof Number || value instanceof String || value instanceof Boolean)) {\n const unbundledValue = {};\n for (const key in value) {\n unbundledValue[key] = deepUnbundle(value[key]);\n }\n return unbundledValue;\n }\n return unbundle(value);\n}\n\nfunction validateObject(options) {\n const key = options.key;\n const object = options.value;\n const elementSpecs = options.valueSpec || {};\n const elementValidators = options.objectElementValidators || {};\n const style = options.style;\n const styleSpec = options.styleSpec;\n const validateSpec = options.validateSpec;\n let errors = [];\n const type = getType(object);\n if (type !== 'object') {\n return [new ValidationError(key, object, `object expected, ${type} found`)];\n }\n for (const objectKey in object) {\n const elementSpecKey = objectKey.split('.')[0]; // treat 'paint.*' as 'paint'\n // objectKey comes from the user controlled style input, so elementSpecKey may be e.g. \"__proto__\"\n const elementSpec = getOwn(elementSpecs, elementSpecKey) || elementSpecs['*'];\n let validateElement;\n if (getOwn(elementValidators, elementSpecKey)) {\n validateElement = elementValidators[elementSpecKey];\n }\n else if (getOwn(elementSpecs, elementSpecKey)) {\n validateElement = validateSpec;\n }\n else if (elementValidators['*']) {\n validateElement = elementValidators['*'];\n }\n else if (elementSpecs['*']) {\n validateElement = validateSpec;\n }\n else {\n errors.push(new ValidationError(key, object[objectKey], `unknown property \"${objectKey}\"`));\n continue;\n }\n errors = errors.concat(validateElement({\n key: (key ? `${key}.` : key) + objectKey,\n value: object[objectKey],\n valueSpec: elementSpec,\n style,\n styleSpec,\n object,\n objectKey,\n validateSpec,\n }, object));\n }\n for (const elementSpecKey in elementSpecs) {\n // Don't check `required` when there's a custom validator for that property.\n if (elementValidators[elementSpecKey]) {\n continue;\n }\n if (elementSpecs[elementSpecKey].required && elementSpecs[elementSpecKey]['default'] === undefined && object[elementSpecKey] === undefined) {\n errors.push(new ValidationError(key, object, `missing required property \"${elementSpecKey}\"`));\n }\n }\n return errors;\n}\n\nfunction validateArray(options) {\n const array = options.value;\n const arraySpec = options.valueSpec;\n const validateSpec = options.validateSpec;\n const style = options.style;\n const styleSpec = options.styleSpec;\n const key = options.key;\n const validateArrayElement = options.arrayElementValidator || validateSpec;\n if (getType(array) !== 'array') {\n return [new ValidationError(key, array, `array expected, ${getType(array)} found`)];\n }\n if (arraySpec.length && array.length !== arraySpec.length) {\n return [new ValidationError(key, array, `array length ${arraySpec.length} expected, length ${array.length} found`)];\n }\n if (arraySpec['min-length'] && array.length < arraySpec['min-length']) {\n return [new ValidationError(key, array, `array length at least ${arraySpec['min-length']} expected, length ${array.length} found`)];\n }\n let arrayElementSpec = {\n 'type': arraySpec.value,\n 'values': arraySpec.values\n };\n if (styleSpec.$version < 7) {\n arrayElementSpec['function'] = arraySpec.function;\n }\n if (getType(arraySpec.value) === 'object') {\n arrayElementSpec = arraySpec.value;\n }\n let errors = [];\n for (let i = 0; i < array.length; i++) {\n errors = errors.concat(validateArrayElement({\n array,\n arrayIndex: i,\n value: array[i],\n valueSpec: arrayElementSpec,\n validateSpec: options.validateSpec,\n style,\n styleSpec,\n key: `${key}[${i}]`\n }));\n }\n return errors;\n}\n\nfunction validateNumber(options) {\n const key = options.key;\n const value = options.value;\n const valueSpec = options.valueSpec;\n let type = getType(value);\n if (type === 'number' && value !== value) {\n type = 'NaN';\n }\n if (type !== 'number') {\n return [new ValidationError(key, value, `number expected, ${type} found`)];\n }\n if ('minimum' in valueSpec && value < valueSpec.minimum) {\n return [new ValidationError(key, value, `${value} is less than the minimum value ${valueSpec.minimum}`)];\n }\n if ('maximum' in valueSpec && value > valueSpec.maximum) {\n return [new ValidationError(key, value, `${value} is greater than the maximum value ${valueSpec.maximum}`)];\n }\n return [];\n}\n\nfunction validateFunction(options) {\n const functionValueSpec = options.valueSpec;\n const functionType = unbundle(options.value.type);\n let stopKeyType;\n let stopDomainValues = {};\n let previousStopDomainValue;\n let previousStopDomainZoom;\n const isZoomFunction = functionType !== 'categorical' && options.value.property === undefined;\n const isPropertyFunction = !isZoomFunction;\n const isZoomAndPropertyFunction = getType(options.value.stops) === 'array' &&\n getType(options.value.stops[0]) === 'array' &&\n getType(options.value.stops[0][0]) === 'object';\n const errors = validateObject({\n key: options.key,\n value: options.value,\n valueSpec: options.styleSpec.function,\n validateSpec: options.validateSpec,\n style: options.style,\n styleSpec: options.styleSpec,\n objectElementValidators: {\n stops: validateFunctionStops,\n default: validateFunctionDefault\n }\n });\n if (functionType === 'identity' && isZoomFunction) {\n errors.push(new ValidationError(options.key, options.value, 'missing required property \"property\"'));\n }\n if (functionType !== 'identity' && !options.value.stops) {\n errors.push(new ValidationError(options.key, options.value, 'missing required property \"stops\"'));\n }\n if (functionType === 'exponential' && options.valueSpec.expression && !supportsInterpolation(options.valueSpec)) {\n errors.push(new ValidationError(options.key, options.value, 'exponential functions not supported'));\n }\n if (options.styleSpec.$version >= 8) {\n if (isPropertyFunction && !supportsPropertyExpression(options.valueSpec)) {\n errors.push(new ValidationError(options.key, options.value, 'property functions not supported'));\n }\n else if (isZoomFunction && !supportsZoomExpression(options.valueSpec)) {\n errors.push(new ValidationError(options.key, options.value, 'zoom functions not supported'));\n }\n }\n if ((functionType === 'categorical' || isZoomAndPropertyFunction) && options.value.property === undefined) {\n errors.push(new ValidationError(options.key, options.value, '\"property\" property is required'));\n }\n return errors;\n function validateFunctionStops(options) {\n if (functionType === 'identity') {\n return [new ValidationError(options.key, options.value, 'identity function may not have a \"stops\" property')];\n }\n let errors = [];\n const value = options.value;\n errors = errors.concat(validateArray({\n key: options.key,\n value,\n valueSpec: options.valueSpec,\n validateSpec: options.validateSpec,\n style: options.style,\n styleSpec: options.styleSpec,\n arrayElementValidator: validateFunctionStop\n }));\n if (getType(value) === 'array' && value.length === 0) {\n errors.push(new ValidationError(options.key, value, 'array must have at least one stop'));\n }\n return errors;\n }\n function validateFunctionStop(options) {\n let errors = [];\n const value = options.value;\n const key = options.key;\n if (getType(value) !== 'array') {\n return [new ValidationError(key, value, `array expected, ${getType(value)} found`)];\n }\n if (value.length !== 2) {\n return [new ValidationError(key, value, `array length 2 expected, length ${value.length} found`)];\n }\n if (isZoomAndPropertyFunction) {\n if (getType(value[0]) !== 'object') {\n return [new ValidationError(key, value, `object expected, ${getType(value[0])} found`)];\n }\n if (value[0].zoom === undefined) {\n return [new ValidationError(key, value, 'object stop key must have zoom')];\n }\n if (value[0].value === undefined) {\n return [new ValidationError(key, value, 'object stop key must have value')];\n }\n if (previousStopDomainZoom && previousStopDomainZoom > unbundle(value[0].zoom)) {\n return [new ValidationError(key, value[0].zoom, 'stop zoom values must appear in ascending order')];\n }\n if (unbundle(value[0].zoom) !== previousStopDomainZoom) {\n previousStopDomainZoom = unbundle(value[0].zoom);\n previousStopDomainValue = undefined;\n stopDomainValues = {};\n }\n errors = errors.concat(validateObject({\n key: `${key}[0]`,\n value: value[0],\n valueSpec: { zoom: {} },\n validateSpec: options.validateSpec,\n style: options.style,\n styleSpec: options.styleSpec,\n objectElementValidators: { zoom: validateNumber, value: validateStopDomainValue }\n }));\n }\n else {\n errors = errors.concat(validateStopDomainValue({\n key: `${key}[0]`,\n value: value[0],\n validateSpec: options.validateSpec,\n style: options.style,\n styleSpec: options.styleSpec\n }, value));\n }\n if (isExpression(deepUnbundle(value[1]))) {\n return errors.concat([new ValidationError(`${key}[1]`, value[1], 'expressions are not allowed in function stops.')]);\n }\n return errors.concat(options.validateSpec({\n key: `${key}[1]`,\n value: value[1],\n valueSpec: functionValueSpec,\n validateSpec: options.validateSpec,\n style: options.style,\n styleSpec: options.styleSpec\n }));\n }\n function validateStopDomainValue(options, stop) {\n const type = getType(options.value);\n const value = unbundle(options.value);\n const reportValue = options.value !== null ? options.value : stop;\n if (!stopKeyType) {\n stopKeyType = type;\n }\n else if (type !== stopKeyType) {\n return [new ValidationError(options.key, reportValue, `${type} stop domain type must match previous stop domain type ${stopKeyType}`)];\n }\n if (type !== 'number' && type !== 'string' && type !== 'boolean') {\n return [new ValidationError(options.key, reportValue, 'stop domain value must be a number, string, or boolean')];\n }\n if (type !== 'number' && functionType !== 'categorical') {\n let message = `number expected, ${type} found`;\n if (supportsPropertyExpression(functionValueSpec) && functionType === undefined) {\n message += '\\nIf you intended to use a categorical function, specify `\"type\": \"categorical\"`.';\n }\n return [new ValidationError(options.key, reportValue, message)];\n }\n if (functionType === 'categorical' && type === 'number' && (!isFinite(value) || Math.floor(value) !== value)) {\n return [new ValidationError(options.key, reportValue, `integer expected, found ${value}`)];\n }\n if (functionType !== 'categorical' && type === 'number' && previousStopDomainValue !== undefined && value < previousStopDomainValue) {\n return [new ValidationError(options.key, reportValue, 'stop domain values must appear in ascending order')];\n }\n else {\n previousStopDomainValue = value;\n }\n if (functionType === 'categorical' && value in stopDomainValues) {\n return [new ValidationError(options.key, reportValue, 'stop domain values must be unique')];\n }\n else {\n stopDomainValues[value] = true;\n }\n return [];\n }\n function validateFunctionDefault(options) {\n return options.validateSpec({\n key: options.key,\n value: options.value,\n valueSpec: functionValueSpec,\n validateSpec: options.validateSpec,\n style: options.style,\n styleSpec: options.styleSpec\n });\n }\n}\n\nfunction validateExpression(options) {\n const expression = (options.expressionContext === 'property' ? createPropertyExpression : createExpression)(deepUnbundle(options.value), options.valueSpec);\n if (expression.result === 'error') {\n return expression.value.map((error) => {\n return new ValidationError(`${options.key}${error.key}`, options.value, error.message);\n });\n }\n const expressionObj = expression.value.expression || expression.value._styleExpression.expression;\n if (options.expressionContext === 'property' && (options.propertyKey === 'text-font') &&\n !expressionObj.outputDefined()) {\n return [new ValidationError(options.key, options.value, `Invalid data expression for \"${options.propertyKey}\". Output values must be contained as literals within the expression.`)];\n }\n if (options.expressionContext === 'property' && options.propertyType === 'layout' &&\n (!isStateConstant(expressionObj))) {\n return [new ValidationError(options.key, options.value, '\"feature-state\" data expressions are not supported with layout properties.')];\n }\n if (options.expressionContext === 'filter' && !isStateConstant(expressionObj)) {\n return [new ValidationError(options.key, options.value, '\"feature-state\" data expressions are not supported with filters.')];\n }\n if (options.expressionContext && options.expressionContext.indexOf('cluster') === 0) {\n if (!isGlobalPropertyConstant(expressionObj, ['zoom', 'feature-state'])) {\n return [new ValidationError(options.key, options.value, '\"zoom\" and \"feature-state\" expressions are not supported with cluster properties.')];\n }\n if (options.expressionContext === 'cluster-initial' && !isFeatureConstant(expressionObj)) {\n return [new ValidationError(options.key, options.value, 'Feature data expressions are not supported with initial expression part of cluster properties.')];\n }\n }\n return [];\n}\n\nfunction validateBoolean(options) {\n const value = options.value;\n const key = options.key;\n const type = getType(value);\n if (type !== 'boolean') {\n return [new ValidationError(key, value, `boolean expected, ${type} found`)];\n }\n return [];\n}\n\nfunction validateColor(options) {\n const key = options.key;\n const value = options.value;\n const type = getType(value);\n if (type !== 'string') {\n return [new ValidationError(key, value, `color expected, ${type} found`)];\n }\n if (!Color.parse(String(value))) { // cast String object to string primitive\n return [new ValidationError(key, value, `color expected, \"${value}\" found`)];\n }\n return [];\n}\n\nfunction validateEnum(options) {\n const key = options.key;\n const value = options.value;\n const valueSpec = options.valueSpec;\n const errors = [];\n if (Array.isArray(valueSpec.values)) { // <=v7\n if (valueSpec.values.indexOf(unbundle(value)) === -1) {\n errors.push(new ValidationError(key, value, `expected one of [${valueSpec.values.join(', ')}], ${JSON.stringify(value)} found`));\n }\n }\n else { // >=v8\n if (Object.keys(valueSpec.values).indexOf(unbundle(value)) === -1) {\n errors.push(new ValidationError(key, value, `expected one of [${Object.keys(valueSpec.values).join(', ')}], ${JSON.stringify(value)} found`));\n }\n }\n return errors;\n}\n\nfunction validateFilter(options) {\n if (isExpressionFilter(deepUnbundle(options.value))) {\n return validateExpression(extendBy({}, options, {\n expressionContext: 'filter',\n valueSpec: { value: 'boolean' }\n }));\n }\n else {\n return validateNonExpressionFilter(options);\n }\n}\nfunction validateNonExpressionFilter(options) {\n const value = options.value;\n const key = options.key;\n if (getType(value) !== 'array') {\n return [new ValidationError(key, value, `array expected, ${getType(value)} found`)];\n }\n const styleSpec = options.styleSpec;\n let type;\n let errors = [];\n if (value.length < 1) {\n return [new ValidationError(key, value, 'filter array must have at least 1 element')];\n }\n errors = errors.concat(validateEnum({\n key: `${key}[0]`,\n value: value[0],\n valueSpec: styleSpec.filter_operator,\n style: options.style,\n styleSpec: options.styleSpec\n }));\n switch (unbundle(value[0])) {\n case '<':\n case '<=':\n case '>':\n case '>=':\n if (value.length >= 2 && unbundle(value[1]) === '$type') {\n errors.push(new ValidationError(key, value, `\"$type\" cannot be use with operator \"${value[0]}\"`));\n }\n /* falls through */\n case '==':\n case '!=':\n if (value.length !== 3) {\n errors.push(new ValidationError(key, value, `filter array for operator \"${value[0]}\" must have 3 elements`));\n }\n /* falls through */\n case 'in':\n case '!in':\n if (value.length >= 2) {\n type = getType(value[1]);\n if (type !== 'string') {\n errors.push(new ValidationError(`${key}[1]`, value[1], `string expected, ${type} found`));\n }\n }\n for (let i = 2; i < value.length; i++) {\n type = getType(value[i]);\n if (unbundle(value[1]) === '$type') {\n errors = errors.concat(validateEnum({\n key: `${key}[${i}]`,\n value: value[i],\n valueSpec: styleSpec.geometry_type,\n style: options.style,\n styleSpec: options.styleSpec\n }));\n }\n else if (type !== 'string' && type !== 'number' && type !== 'boolean') {\n errors.push(new ValidationError(`${key}[${i}]`, value[i], `string, number, or boolean expected, ${type} found`));\n }\n }\n break;\n case 'any':\n case 'all':\n case 'none':\n for (let i = 1; i < value.length; i++) {\n errors = errors.concat(validateNonExpressionFilter({\n key: `${key}[${i}]`,\n value: value[i],\n style: options.style,\n styleSpec: options.styleSpec\n }));\n }\n break;\n case 'has':\n case '!has':\n type = getType(value[1]);\n if (value.length !== 2) {\n errors.push(new ValidationError(key, value, `filter array for \"${value[0]}\" operator must have 2 elements`));\n }\n else if (type !== 'string') {\n errors.push(new ValidationError(`${key}[1]`, value[1], `string expected, ${type} found`));\n }\n break;\n }\n return errors;\n}\n\nfunction validateProperty(options, propertyType) {\n const key = options.key;\n const validateSpec = options.validateSpec;\n const style = options.style;\n const styleSpec = options.styleSpec;\n const value = options.value;\n const propertyKey = options.objectKey;\n const layerSpec = styleSpec[`${propertyType}_${options.layerType}`];\n if (!layerSpec)\n return [];\n const transitionMatch = propertyKey.match(/^(.*)-transition$/);\n if (propertyType === 'paint' && transitionMatch && layerSpec[transitionMatch[1]] && layerSpec[transitionMatch[1]].transition) {\n return validateSpec({\n key,\n value,\n valueSpec: styleSpec.transition,\n style,\n styleSpec\n });\n }\n const valueSpec = options.valueSpec || layerSpec[propertyKey];\n if (!valueSpec) {\n return [new ValidationError(key, value, `unknown property \"${propertyKey}\"`)];\n }\n let tokenMatch;\n if (getType(value) === 'string' && supportsPropertyExpression(valueSpec) && !valueSpec.tokens && (tokenMatch = /^{([^}]+)}$/.exec(value))) {\n return [new ValidationError(key, value, `\"${propertyKey}\" does not support interpolation syntax\\n` +\n `Use an identity property function instead: \\`{ \"type\": \"identity\", \"property\": ${JSON.stringify(tokenMatch[1])} }\\`.`)];\n }\n const errors = [];\n if (options.layerType === 'symbol') {\n if (propertyKey === 'text-font' && isFunction$1(deepUnbundle(value)) && unbundle(value.type) === 'identity') {\n errors.push(new ValidationError(key, value, '\"text-font\" does not support identity functions'));\n }\n }\n return errors.concat(validateSpec({\n key: options.key,\n value,\n valueSpec,\n style,\n styleSpec,\n expressionContext: 'property',\n propertyType,\n propertyKey\n }));\n}\n\nfunction validatePaintProperty(options) {\n return validateProperty(options, 'paint');\n}\n\nfunction validateLayoutProperty(options) {\n return validateProperty(options, 'layout');\n}\n\nfunction validateLayer(options) {\n let errors = [];\n const layer = options.value;\n const key = options.key;\n const style = options.style;\n const styleSpec = options.styleSpec;\n if (getType(layer) !== 'object') {\n return [new ValidationError(key, layer, `object expected, ${getType(layer)} found`)];\n }\n if (!layer.type && !layer.ref) {\n errors.push(new ValidationError(key, layer, 'either \"type\" or \"ref\" is required'));\n }\n let type = unbundle(layer.type);\n const ref = unbundle(layer.ref);\n if (layer.id) {\n const layerId = unbundle(layer.id);\n for (let i = 0; i < options.arrayIndex; i++) {\n const otherLayer = style.layers[i];\n if (unbundle(otherLayer.id) === layerId) {\n errors.push(new ValidationError(key, layer.id, `duplicate layer id \"${layer.id}\", previously used at line ${otherLayer.id.__line__}`));\n }\n }\n }\n if ('ref' in layer) {\n ['type', 'source', 'source-layer', 'filter', 'layout'].forEach((p) => {\n if (p in layer) {\n errors.push(new ValidationError(key, layer[p], `\"${p}\" is prohibited for ref layers`));\n }\n });\n let parent;\n style.layers.forEach((layer) => {\n if (unbundle(layer.id) === ref)\n parent = layer;\n });\n if (!parent) {\n errors.push(new ValidationError(key, layer.ref, `ref layer \"${ref}\" not found`));\n }\n else if (parent.ref) {\n errors.push(new ValidationError(key, layer.ref, 'ref cannot reference another ref layer'));\n }\n else {\n type = unbundle(parent.type);\n }\n }\n else if (type !== 'background') {\n if (!layer.source) {\n errors.push(new ValidationError(key, layer, 'missing required property \"source\"'));\n }\n else {\n const source = style.sources && style.sources[layer.source];\n const sourceType = source && unbundle(source.type);\n if (!source) {\n errors.push(new ValidationError(key, layer.source, `source \"${layer.source}\" not found`));\n }\n else if (sourceType === 'vector' && type === 'raster') {\n errors.push(new ValidationError(key, layer.source, `layer \"${layer.id}\" requires a raster source`));\n }\n else if (sourceType !== 'raster-dem' && type === 'hillshade') {\n errors.push(new ValidationError(key, layer.source, `layer \"${layer.id}\" requires a raster-dem source`));\n }\n else if (sourceType !== 'raster-dem' && type === 'color-relief') {\n errors.push(new ValidationError(key, layer.source, `layer \"${layer.id}\" requires a raster-dem source`));\n }\n else if (sourceType === 'raster' && type !== 'raster') {\n errors.push(new ValidationError(key, layer.source, `layer \"${layer.id}\" requires a vector source`));\n }\n else if (sourceType === 'vector' && !layer['source-layer']) {\n errors.push(new ValidationError(key, layer, `layer \"${layer.id}\" must specify a \"source-layer\"`));\n }\n else if (sourceType === 'raster-dem' && (type !== 'hillshade' && type !== 'color-relief')) {\n errors.push(new ValidationError(key, layer.source, 'raster-dem source can only be used with layer type \\'hillshade\\' or \\'color-relief\\'.'));\n }\n else if (type === 'line' && layer.paint && layer.paint['line-gradient'] &&\n (sourceType !== 'geojson' || !source.lineMetrics)) {\n errors.push(new ValidationError(key, layer, `layer \"${layer.id}\" specifies a line-gradient, which requires a GeoJSON source with \\`lineMetrics\\` enabled.`));\n }\n }\n }\n errors = errors.concat(validateObject({\n key,\n value: layer,\n valueSpec: styleSpec.layer,\n style: options.style,\n styleSpec: options.styleSpec,\n validateSpec: options.validateSpec,\n objectElementValidators: {\n '*'() {\n return [];\n },\n // We don't want to enforce the spec's `\"requires\": true` for backward compatibility with refs;\n // the actual requirement is validated above. See https://github.com/mapbox/mapbox-gl-js/issues/5772.\n type() {\n return options.validateSpec({\n key: `${key}.type`,\n value: layer.type,\n valueSpec: styleSpec.layer.type,\n style: options.style,\n styleSpec: options.styleSpec,\n validateSpec: options.validateSpec,\n object: layer,\n objectKey: 'type'\n });\n },\n filter: validateFilter,\n layout(options) {\n return validateObject({\n layer,\n key: options.key,\n value: options.value,\n style: options.style,\n styleSpec: options.styleSpec,\n validateSpec: options.validateSpec,\n objectElementValidators: {\n '*'(options) {\n return validateLayoutProperty(extendBy({ layerType: type }, options));\n }\n }\n });\n },\n paint(options) {\n return validateObject({\n layer,\n key: options.key,\n value: options.value,\n style: options.style,\n styleSpec: options.styleSpec,\n validateSpec: options.validateSpec,\n objectElementValidators: {\n '*'(options) {\n return validatePaintProperty(extendBy({ layerType: type }, options));\n }\n }\n });\n }\n }\n }));\n return errors;\n}\n\nfunction validateString(options) {\n const value = options.value;\n const key = options.key;\n const type = getType(value);\n if (type !== 'string') {\n return [new ValidationError(key, value, `string expected, ${type} found`)];\n }\n return [];\n}\n\nfunction validateRasterDEMSource(options) {\n var _a;\n const sourceName = (_a = options.sourceName) !== null && _a !== void 0 ? _a : '';\n const rasterDEM = options.value;\n const styleSpec = options.styleSpec;\n const rasterDEMSpec = styleSpec.source_raster_dem;\n const style = options.style;\n let errors = [];\n const rootType = getType(rasterDEM);\n if (rasterDEM === undefined) {\n return errors;\n }\n else if (rootType !== 'object') {\n errors.push(new ValidationError('source_raster_dem', rasterDEM, `object expected, ${rootType} found`));\n return errors;\n }\n const encoding = unbundle(rasterDEM.encoding);\n const isCustomEncoding = encoding === 'custom';\n const customEncodingKeys = ['redFactor', 'greenFactor', 'blueFactor', 'baseShift'];\n const encodingName = options.value.encoding ? `\"${options.value.encoding}\"` : 'Default';\n for (const key in rasterDEM) {\n if (!isCustomEncoding && customEncodingKeys.includes(key)) {\n errors.push(new ValidationError(key, rasterDEM[key], `In \"${sourceName}\": \"${key}\" is only valid when \"encoding\" is set to \"custom\". ${encodingName} encoding found`));\n }\n else if (rasterDEMSpec[key]) {\n errors = errors.concat(options.validateSpec({\n key,\n value: rasterDEM[key],\n valueSpec: rasterDEMSpec[key],\n validateSpec: options.validateSpec,\n style,\n styleSpec\n }));\n }\n else {\n errors.push(new ValidationError(key, rasterDEM[key], `unknown property \"${key}\"`));\n }\n }\n return errors;\n}\n\nconst objectElementValidators = {\n promoteId: validatePromoteId\n};\nfunction validateSource(options) {\n const value = options.value;\n const key = options.key;\n const styleSpec = options.styleSpec;\n const style = options.style;\n const validateSpec = options.validateSpec;\n if (!value.type) {\n return [new ValidationError(key, value, '\"type\" is required')];\n }\n const type = unbundle(value.type);\n let errors;\n switch (type) {\n case 'vector':\n case 'raster':\n errors = validateObject({\n key,\n value,\n valueSpec: styleSpec[`source_${type.replace('-', '_')}`],\n style: options.style,\n styleSpec,\n objectElementValidators,\n validateSpec,\n });\n return errors;\n case 'raster-dem':\n errors = validateRasterDEMSource({\n sourceName: key,\n value,\n style: options.style,\n styleSpec,\n validateSpec,\n });\n return errors;\n case 'geojson':\n errors = validateObject({\n key,\n value,\n valueSpec: styleSpec.source_geojson,\n style,\n styleSpec,\n validateSpec,\n objectElementValidators\n });\n if (value.cluster) {\n for (const prop in value.clusterProperties) {\n const [operator, mapExpr] = value.clusterProperties[prop];\n const reduceExpr = typeof operator === 'string' ? [operator, ['accumulated'], ['get', prop]] : operator;\n errors.push(...validateExpression({\n key: `${key}.${prop}.map`,\n value: mapExpr,\n expressionContext: 'cluster-map'\n }));\n errors.push(...validateExpression({\n key: `${key}.${prop}.reduce`,\n value: reduceExpr,\n expressionContext: 'cluster-reduce'\n }));\n }\n }\n return errors;\n case 'video':\n return validateObject({\n key,\n value,\n valueSpec: styleSpec.source_video,\n style,\n validateSpec,\n styleSpec\n });\n case 'image':\n return validateObject({\n key,\n value,\n valueSpec: styleSpec.source_image,\n style,\n validateSpec,\n styleSpec\n });\n case 'canvas':\n return [new ValidationError(key, null, 'Please use runtime APIs to add canvas sources, rather than including them in stylesheets.', 'source.canvas')];\n default:\n return validateEnum({\n key: `${key}.type`,\n value: value.type,\n valueSpec: { values: ['vector', 'raster', 'raster-dem', 'geojson', 'video', 'image'] }});\n }\n}\nfunction validatePromoteId({ key, value }) {\n if (getType(value) === 'string') {\n return validateString({ key, value });\n }\n else {\n const errors = [];\n for (const prop in value) {\n errors.push(...validateString({ key: `${key}.${prop}`, value: value[prop] }));\n }\n return errors;\n }\n}\n\nfunction validateLight(options) {\n const light = options.value;\n const styleSpec = options.styleSpec;\n const lightSpec = styleSpec.light;\n const style = options.style;\n let errors = [];\n const rootType = getType(light);\n if (light === undefined) {\n return errors;\n }\n else if (rootType !== 'object') {\n errors = errors.concat([new ValidationError('light', light, `object expected, ${rootType} found`)]);\n return errors;\n }\n for (const key in light) {\n const transitionMatch = key.match(/^(.*)-transition$/);\n if (transitionMatch && lightSpec[transitionMatch[1]] && lightSpec[transitionMatch[1]].transition) {\n errors = errors.concat(options.validateSpec({\n key,\n value: light[key],\n valueSpec: styleSpec.transition,\n validateSpec: options.validateSpec,\n style,\n styleSpec\n }));\n }\n else if (lightSpec[key]) {\n errors = errors.concat(options.validateSpec({\n key,\n value: light[key],\n valueSpec: lightSpec[key],\n validateSpec: options.validateSpec,\n style,\n styleSpec\n }));\n }\n else {\n errors = errors.concat([new ValidationError(key, light[key], `unknown property \"${key}\"`)]);\n }\n }\n return errors;\n}\n\nfunction validateSky(options) {\n const sky = options.value;\n const styleSpec = options.styleSpec;\n const skySpec = styleSpec.sky;\n const style = options.style;\n const rootType = getType(sky);\n if (sky === undefined) {\n return [];\n }\n else if (rootType !== 'object') {\n return [new ValidationError('sky', sky, `object expected, ${rootType} found`)];\n }\n let errors = [];\n for (const key in sky) {\n if (skySpec[key]) {\n errors = errors.concat(options.validateSpec({\n key,\n value: sky[key],\n valueSpec: skySpec[key],\n style,\n styleSpec\n }));\n }\n else {\n errors = errors.concat([new ValidationError(key, sky[key], `unknown property \"${key}\"`)]);\n }\n }\n return errors;\n}\n\nfunction validateTerrain(options) {\n const terrain = options.value;\n const styleSpec = options.styleSpec;\n const terrainSpec = styleSpec.terrain;\n const style = options.style;\n let errors = [];\n const rootType = getType(terrain);\n if (terrain === undefined) {\n return errors;\n }\n else if (rootType !== 'object') {\n errors = errors.concat([new ValidationError('terrain', terrain, `object expected, ${rootType} found`)]);\n return errors;\n }\n for (const key in terrain) {\n if (terrainSpec[key]) {\n errors = errors.concat(options.validateSpec({\n key,\n value: terrain[key],\n valueSpec: terrainSpec[key],\n validateSpec: options.validateSpec,\n style,\n styleSpec\n }));\n }\n else {\n errors = errors.concat([new ValidationError(key, terrain[key], `unknown property \"${key}\"`)]);\n }\n }\n return errors;\n}\n\nfunction validateFormatted(options) {\n if (validateString(options).length === 0) {\n return [];\n }\n return validateExpression(options);\n}\n\nfunction validateImage(options) {\n if (validateString(options).length === 0) {\n return [];\n }\n return validateExpression(options);\n}\n\nfunction validatePadding(options) {\n const key = options.key;\n const value = options.value;\n const type = getType(value);\n if (type === 'array') {\n if (value.length < 1 || value.length > 4) {\n return [new ValidationError(key, value, `padding requires 1 to 4 values; ${value.length} values found`)];\n }\n const arrayElementSpec = {\n type: 'number'\n };\n let errors = [];\n for (let i = 0; i < value.length; i++) {\n errors = errors.concat(options.validateSpec({\n key: `${key}[${i}]`,\n value: value[i],\n validateSpec: options.validateSpec,\n valueSpec: arrayElementSpec\n }));\n }\n return errors;\n }\n else {\n return validateNumber({\n key,\n value,\n valueSpec: {}\n });\n }\n}\n\nfunction validateNumberArray(options) {\n const key = options.key;\n const value = options.value;\n const type = getType(value);\n if (type === 'array') {\n const arrayElementSpec = {\n type: 'number'\n };\n if (value.length < 1) {\n return [new ValidationError(key, value, 'array length at least 1 expected, length 0 found')];\n }\n let errors = [];\n for (let i = 0; i < value.length; i++) {\n errors = errors.concat(options.validateSpec({\n key: `${key}[${i}]`,\n value: value[i],\n validateSpec: options.validateSpec,\n valueSpec: arrayElementSpec\n }));\n }\n return errors;\n }\n else {\n return validateNumber({\n key,\n value,\n valueSpec: {}\n });\n }\n}\n\nfunction validateColorArray(options) {\n const key = options.key;\n const value = options.value;\n const type = getType(value);\n if (type === 'array') {\n if (value.length < 1) {\n return [new ValidationError(key, value, 'array length at least 1 expected, length 0 found')];\n }\n let errors = [];\n for (let i = 0; i < value.length; i++) {\n errors = errors.concat(validateColor({\n key: `${key}[${i}]`,\n value: value[i]}));\n }\n return errors;\n }\n else {\n return validateColor({\n key,\n value});\n }\n}\n\nfunction validateVariableAnchorOffsetCollection(options) {\n const key = options.key;\n const value = options.value;\n const type = getType(value);\n const styleSpec = options.styleSpec;\n if (type !== 'array' || value.length < 1 || value.length % 2 !== 0) {\n return [new ValidationError(key, value, 'variableAnchorOffsetCollection requires a non-empty array of even length')];\n }\n let errors = [];\n for (let i = 0; i < value.length; i += 2) {\n // Elements in even positions should be values from text-anchor enum\n errors = errors.concat(validateEnum({\n key: `${key}[${i}]`,\n value: value[i],\n valueSpec: styleSpec['layout_symbol']['text-anchor']\n }));\n // Elements in odd positions should be points (2-element numeric arrays)\n errors = errors.concat(validateArray({\n key: `${key}[${i + 1}]`,\n value: value[i + 1],\n valueSpec: {\n length: 2,\n value: 'number'\n },\n validateSpec: options.validateSpec,\n style: options.style,\n styleSpec\n }));\n }\n return errors;\n}\n\nfunction validateSprite(options) {\n let errors = [];\n const sprite = options.value;\n const key = options.key;\n if (!Array.isArray(sprite)) {\n return validateString({\n key,\n value: sprite\n });\n }\n else {\n const allSpriteIds = [];\n const allSpriteURLs = [];\n for (const i in sprite) {\n if (sprite[i].id && allSpriteIds.includes(sprite[i].id))\n errors.push(new ValidationError(key, sprite, `all the sprites' ids must be unique, but ${sprite[i].id} is duplicated`));\n allSpriteIds.push(sprite[i].id);\n if (sprite[i].url && allSpriteURLs.includes(sprite[i].url))\n errors.push(new ValidationError(key, sprite, `all the sprites' URLs must be unique, but ${sprite[i].url} is duplicated`));\n allSpriteURLs.push(sprite[i].url);\n const pairSpec = {\n id: {\n type: 'string',\n required: true,\n },\n url: {\n type: 'string',\n required: true,\n }\n };\n errors = errors.concat(validateObject({\n key: `${key}[${i}]`,\n value: sprite[i],\n valueSpec: pairSpec,\n validateSpec: options.validateSpec,\n }));\n }\n return errors;\n }\n}\n\nfunction validateProjection(options) {\n const projection = options.value;\n const styleSpec = options.styleSpec;\n const projectionSpec = styleSpec.projection;\n const style = options.style;\n const rootType = getType(projection);\n if (projection === undefined) {\n return [];\n }\n else if (rootType !== 'object') {\n return [new ValidationError('projection', projection, `object expected, ${rootType} found`)];\n }\n let errors = [];\n for (const key in projection) {\n if (projectionSpec[key]) {\n errors = errors.concat(options.validateSpec({\n key,\n value: projection[key],\n valueSpec: projectionSpec[key],\n style,\n styleSpec\n }));\n }\n else {\n errors = errors.concat([new ValidationError(key, projection[key], `unknown property \"${key}\"`)]);\n }\n }\n return errors;\n}\n\nfunction validateProjectionDefinition(options) {\n const key = options.key;\n let value = options.value;\n value = value instanceof String ? value.valueOf() : value;\n const type = getType(value);\n if (type === 'array' && !isProjectionDefinitionValue(value) && !isPropertyValueSpecification(value)) {\n return [new ValidationError(key, value, `projection expected, invalid array ${JSON.stringify(value)} found`)];\n }\n else if (!['array', 'string'].includes(type)) {\n return [new ValidationError(key, value, `projection expected, invalid type \"${type}\" found`)];\n }\n return [];\n}\nfunction isPropertyValueSpecification(value) {\n if (['interpolate', 'step', 'literal'].includes(value[0])) {\n return true;\n }\n return false;\n}\nfunction isProjectionDefinitionValue(value) {\n return Array.isArray(value) &&\n value.length === 3 &&\n typeof value[0] === 'string' &&\n typeof value[1] === 'string' &&\n typeof value[2] === 'number';\n}\n\nfunction isObjectLiteral(anything) {\n return Boolean(anything) && anything.constructor === Object;\n}\n\nfunction validateState(options) {\n if (!isObjectLiteral(options.value)) {\n return [\n new ValidationError(options.key, options.value, `object expected, ${getType(options.value)} found`),\n ];\n }\n return [];\n}\n\nconst VALIDATORS = {\n '*'() {\n return [];\n },\n 'array': validateArray,\n 'boolean': validateBoolean,\n 'number': validateNumber,\n 'color': validateColor,\n 'constants': validateConstants,\n 'enum': validateEnum,\n 'filter': validateFilter,\n 'function': validateFunction,\n 'layer': validateLayer,\n 'object': validateObject,\n 'source': validateSource,\n 'light': validateLight,\n 'sky': validateSky,\n 'terrain': validateTerrain,\n 'projection': validateProjection,\n 'projectionDefinition': validateProjectionDefinition,\n 'string': validateString,\n 'formatted': validateFormatted,\n 'resolvedImage': validateImage,\n 'padding': validatePadding,\n 'numberArray': validateNumberArray,\n 'colorArray': validateColorArray,\n 'variableAnchorOffsetCollection': validateVariableAnchorOffsetCollection,\n 'sprite': validateSprite,\n 'state': validateState\n};\n/**\n * Main recursive validation function used internally.\n * You should use `validateStyleMin` in the browser or `validateStyle` in node env.\n * @param options - the options object\n * @param options.key - string representing location of validation in style tree. Used only\n * for more informative error reporting.\n * @param options.value - current value from style being evaluated. May be anything from a\n * high level object that needs to be descended into deeper or a simple\n * scalar value.\n * @param options.valueSpec - current spec being evaluated. Tracks value.\n * @param options.styleSpec - current full spec being evaluated.\n * @param options.validateSpec - the validate function itself\n * @param options.style - the style object\n * @param options.objectElementValidators - optional object of functions that will be called\n * @returns an array of errors, or an empty array if no errors are found.\n */\nfunction validate(options) {\n const value = options.value;\n const valueSpec = options.valueSpec;\n const styleSpec = options.styleSpec;\n options.validateSpec = validate;\n if (valueSpec.expression && isFunction$1(unbundle(value))) {\n return validateFunction(options);\n }\n else if (valueSpec.expression && isExpression(deepUnbundle(value))) {\n return validateExpression(options);\n }\n else if (valueSpec.type && VALIDATORS[valueSpec.type]) {\n return VALIDATORS[valueSpec.type](options);\n }\n else {\n const valid = validateObject(extendBy({}, options, {\n valueSpec: valueSpec.type ? styleSpec[valueSpec.type] : valueSpec\n }));\n return valid;\n }\n}\n\nfunction validateGlyphsUrl(options) {\n const value = options.value;\n const key = options.key;\n const errors = validateString(options);\n if (errors.length)\n return errors;\n if (value.indexOf('{fontstack}') === -1) {\n errors.push(new ValidationError(key, value, '\"glyphs\" url must include a \"{fontstack}\" token'));\n }\n if (value.indexOf('{range}') === -1) {\n errors.push(new ValidationError(key, value, '\"glyphs\" url must include a \"{range}\" token'));\n }\n return errors;\n}\n\n/**\n * Validate a MapLibre style against the style specification.\n * Use this when running in the browser.\n *\n * @param style - The style to be validated.\n * @param styleSpec - The style specification to validate against.\n * If omitted, the latest style spec is used.\n * @returns an array of errors, or an empty array if no errors are found.\n * @example\n * const validate = require('@maplibre/maplibre-gl-style-spec/').validateStyleMin;\n * const errors = validate(style);\n */\nfunction validateStyleMin(style, styleSpec = v8Spec) {\n let errors = [];\n errors = errors.concat(validate({\n key: '',\n value: style,\n valueSpec: styleSpec.$root,\n styleSpec,\n style,\n validateSpec: validate,\n objectElementValidators: {\n glyphs: validateGlyphsUrl,\n '*'() {\n return [];\n }\n }\n }));\n if (style['constants']) {\n errors = errors.concat(validateConstants({\n key: 'constants',\n value: style['constants']}));\n }\n return sortErrors(errors);\n}\nvalidateStyleMin.source = wrapCleanErrors(injectValidateSpec(validateSource));\nvalidateStyleMin.sprite = wrapCleanErrors(injectValidateSpec(validateSprite));\nvalidateStyleMin.glyphs = wrapCleanErrors(injectValidateSpec(validateGlyphsUrl));\nvalidateStyleMin.light = wrapCleanErrors(injectValidateSpec(validateLight));\nvalidateStyleMin.sky = wrapCleanErrors(injectValidateSpec(validateSky));\nvalidateStyleMin.terrain = wrapCleanErrors(injectValidateSpec(validateTerrain));\nvalidateStyleMin.state = wrapCleanErrors(injectValidateSpec(validateState));\nvalidateStyleMin.layer = wrapCleanErrors(injectValidateSpec(validateLayer));\nvalidateStyleMin.filter = wrapCleanErrors(injectValidateSpec(validateFilter));\nvalidateStyleMin.paintProperty = wrapCleanErrors(injectValidateSpec(validatePaintProperty));\nvalidateStyleMin.layoutProperty = wrapCleanErrors(injectValidateSpec(validateLayoutProperty));\nfunction injectValidateSpec(validator) {\n return function (options) {\n return validator(Object.assign({}, options, { validateSpec: validate }));\n };\n}\nfunction sortErrors(errors) {\n return [].concat(errors).sort((a, b) => {\n return a.line - b.line;\n });\n}\nfunction wrapCleanErrors(inner) {\n return function (...args) {\n return sortErrors(inner.apply(this, args));\n };\n}\n\n// Note: This regex matches even invalid JSON strings, but since we’re\n// working on the output of `JSON.stringify` we know that only valid strings\n// are present (unless the user supplied a weird `options.indent` but in\n// that case we don’t care since the output would be invalid anyway).\nconst stringOrChar = /(\"(?:[^\\\\\"]|\\\\.)*\")|[:,]/g;\n\nfunction stringify(passedObj, options = {}) {\n const indent = JSON.stringify(\n [1],\n undefined,\n options.indent === undefined ? 2 : options.indent\n ).slice(2, -3);\n\n const maxLength =\n indent === \"\"\n ? Infinity\n : options.maxLength === undefined\n ? 80\n : options.maxLength;\n\n let { replacer } = options;\n\n return (function _stringify(obj, currentIndent, reserved) {\n if (obj && typeof obj.toJSON === \"function\") {\n obj = obj.toJSON();\n }\n\n const string = JSON.stringify(obj, replacer);\n\n if (string === undefined) {\n return string;\n }\n\n const length = maxLength - currentIndent.length - reserved;\n\n if (string.length <= length) {\n const prettified = string.replace(\n stringOrChar,\n (match, stringLiteral) => {\n return stringLiteral || `${match} `;\n }\n );\n if (prettified.length <= length) {\n return prettified;\n }\n }\n\n if (replacer != null) {\n obj = JSON.parse(string);\n replacer = undefined;\n }\n\n if (typeof obj === \"object\" && obj !== null) {\n const nextIndent = currentIndent + indent;\n const items = [];\n let index = 0;\n let start;\n let end;\n\n if (Array.isArray(obj)) {\n start = \"[\";\n end = \"]\";\n const { length } = obj;\n for (; index < length; index++) {\n items.push(\n _stringify(obj[index], nextIndent, index === length - 1 ? 0 : 1) ||\n \"null\"\n );\n }\n } else {\n start = \"{\";\n end = \"}\";\n const keys = Object.keys(obj);\n const { length } = keys;\n for (; index < length; index++) {\n const key = keys[index];\n const keyPart = `${JSON.stringify(key)}: `;\n const value = _stringify(\n obj[key],\n nextIndent,\n keyPart.length + (index === length - 1 ? 0 : 1)\n );\n if (value !== undefined) {\n items.push(keyPart + value);\n }\n }\n }\n\n if (items.length > 0) {\n return [start, indent + items.join(`,\\n${nextIndent}`), end].join(\n `\\n${currentIndent}`\n );\n }\n }\n\n return string;\n })(passedObj, \"\", 0);\n}\n\nfunction sortKeysBy(obj, reference) {\n const result = {};\n for (const key in reference) {\n if (obj[key] !== undefined) {\n result[key] = obj[key];\n }\n }\n for (const key in obj) {\n if (result[key] === undefined) {\n result[key] = obj[key];\n }\n }\n return result;\n}\n/**\n * Format a MapLibre Style. Returns a stringified style with its keys\n * sorted in the same order as the reference style.\n *\n * The optional `space` argument is passed to\n * [`JSON.stringify`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify)\n * to generate formatted output.\n *\n * If `space` is unspecified, a default of `2` spaces will be used.\n *\n * @private\n * @param {Object} style a MapLibre Style\n * @param {number} [space] space argument to pass to `JSON.stringify`\n * @returns {string} stringified formatted JSON\n * @example\n * var fs = require('fs');\n * var format = require('maplibre-gl-style-spec').format;\n * var style = fs.readFileSync('./source.json', 'utf8');\n * fs.writeFileSync('./dest.json', format(style));\n * fs.writeFileSync('./dest.min.json', format(style, 0));\n */\nfunction format(style, space = 2) {\n style = sortKeysBy(style, v8Spec.$root);\n if (style.layers) {\n style.layers = style.layers.map((layer) => sortKeysBy(layer, v8Spec.layer));\n }\n return stringify(style, { indent: space });\n}\n\nfunction eachLayout(layer, callback) {\n for (const k in layer) {\n if (k.indexOf('layout') === 0) {\n callback(layer[k], k);\n }\n }\n}\nfunction eachPaint(layer, callback) {\n for (const k in layer) {\n if (k.indexOf('paint') === 0) {\n callback(layer[k], k);\n }\n }\n}\nfunction resolveConstant(style, value) {\n if (typeof value === 'string' && value[0] === '@') {\n return resolveConstant(style, style.constants[value]);\n }\n else {\n return value;\n }\n}\nfunction isFunction(value) {\n return Array.isArray(value.stops);\n}\nfunction renameProperty(obj, from, to) {\n obj[to] = obj[from];\n delete obj[from];\n}\nfunction migrateV8(style) {\n style.version = 8;\n // Rename properties, reverse coordinates in source and layers\n eachSource(style, (source) => {\n if (source.type === 'video' && source['url'] !== undefined) {\n renameProperty(source, 'url', 'urls');\n }\n if (source.type === 'video') {\n source.coordinates.forEach((coord) => {\n return coord.reverse();\n });\n }\n });\n eachLayer(style, (layer) => {\n eachLayout(layer, (layout) => {\n if (layout['symbol-min-distance'] !== undefined) {\n renameProperty(layout, 'symbol-min-distance', 'symbol-spacing');\n }\n });\n eachPaint(layer, (paint) => {\n if (paint['background-image'] !== undefined) {\n renameProperty(paint, 'background-image', 'background-pattern');\n }\n if (paint['line-image'] !== undefined) {\n renameProperty(paint, 'line-image', 'line-pattern');\n }\n if (paint['fill-image'] !== undefined) {\n renameProperty(paint, 'fill-image', 'fill-pattern');\n }\n });\n });\n // Inline Constants\n eachProperty(style, { paint: true, layout: true }, (property) => {\n const value = resolveConstant(style, property.value);\n if (isFunction(value)) {\n value.stops.forEach((stop) => {\n stop[1] = resolveConstant(style, stop[1]);\n });\n }\n property.set(value);\n });\n delete style['constants'];\n eachLayer(style, (layer) => {\n // get rid of text-max-size, icon-max-size\n // turn text-size, icon-size into layout properties\n // https://github.com/mapbox/mapbox-gl-style-spec/issues/255\n eachLayout(layer, (layout) => {\n delete layout['text-max-size'];\n delete layout['icon-max-size'];\n });\n eachPaint(layer, (paint) => {\n if (paint['text-size']) {\n if (!layer.layout)\n layer.layout = {};\n layer.layout['text-size'] = paint['text-size'];\n delete paint['text-size'];\n }\n if (paint['icon-size']) {\n if (!layer.layout)\n layer.layout = {};\n layer.layout['icon-size'] = paint['icon-size'];\n delete paint['icon-size'];\n }\n });\n });\n function migrateFontStack(font) {\n function splitAndTrim(string) {\n return string.split(',').map((s) => {\n return s.trim();\n });\n }\n if (Array.isArray(font)) {\n // Assume it's a previously migrated font-array.\n return font;\n }\n else if (typeof font === 'string') {\n return splitAndTrim(font);\n }\n else if (typeof font === 'object') {\n font.stops.forEach((stop) => {\n stop[1] = splitAndTrim(stop[1]);\n });\n return font;\n }\n else {\n throw new Error('unexpected font value');\n }\n }\n eachLayer(style, (layer) => {\n eachLayout(layer, (layout) => {\n if (layout['text-font']) {\n layout['text-font'] = migrateFontStack(layout['text-font']);\n }\n });\n });\n // Reverse order of symbol layers. This is an imperfect migration.\n //\n // The order of a symbol layer in the layers list affects two things:\n // - how it is drawn relative to other layers (like oneway arrows below bridges)\n // - the placement priority compared to other layers\n //\n // It's impossible to reverse the placement priority without breaking the draw order\n // in some cases. This migration only reverses the order of symbol layers that\n // are above all other types of layers.\n //\n // Symbol layers that are at the top of the map preserve their priority.\n // Symbol layers that are below another type (line, fill) of layer preserve their draw order.\n let firstSymbolLayer = 0;\n for (let i = style.layers.length - 1; i >= 0; i--) {\n const layer = style.layers[i];\n if (layer.type !== 'symbol') {\n firstSymbolLayer = i + 1;\n break;\n }\n }\n const symbolLayers = style.layers.splice(firstSymbolLayer);\n symbolLayers.reverse();\n style.layers = style.layers.concat(symbolLayers);\n return style;\n}\n\n/**\n * Migrate the given style object in place to use expressions. Specifically,\n * this will convert (a) \"stop\" functions, and (b) legacy filters to their\n * expression equivalents.\n * @param style The style object to migrate.\n * @returns The migrated style object.\n */\nfunction expressions(style) {\n const converted = [];\n eachLayer(style, (layer) => {\n if (layer.filter) {\n layer.filter = convertFilter(layer.filter);\n }\n });\n eachProperty(style, { paint: true, layout: true }, ({ path, key, value, reference, set }) => {\n if (isExpression(value) || key.endsWith('-transition') || reference === null)\n return;\n if (typeof value === 'object' && !Array.isArray(value)) {\n set(convertFunction(value, reference));\n converted.push(path.join('.'));\n }\n else if (reference.tokens && typeof value === 'string') {\n set(convertTokenString(value));\n }\n });\n return style;\n}\n\n/**\n * Migrate color style values to supported format.\n *\n * @param colorToMigrate Color value to migrate, could be a string or an expression.\n * @returns Color style value in supported format.\n */\nfunction migrateColors(colorToMigrate) {\n return JSON.parse(migrateHslColors(JSON.stringify(colorToMigrate)));\n}\n/**\n * Created to migrate from colors supported by the former CSS color parsing\n * library `csscolorparser` but not compliant with the CSS Color specification,\n * like `hsl(900, 0.15, 90%)`.\n *\n * @param colorToMigrate Serialized color style value.\n * @returns A serialized color style value in which all non-standard hsl color values\n * have been converted to a format that complies with the CSS Color specification.\n *\n * @example\n * migrateHslColors('\"hsl(900, 0.15, 90%)\"'); // returns '\"hsl(900, 15%, 90%)\"'\n * migrateHslColors('\"hsla(900, .15, .9)\"'); // returns '\"hsl(900, 15%, 90%)\"'\n * migrateHslColors('\"hsl(900, 15%, 90%)\"'); // returns '\"hsl(900, 15%, 90%)\"' - no changes\n */\nfunction migrateHslColors(colorToMigrate) {\n return colorToMigrate.replace(/\"hsla?\\((.+?)\\)\"/gi, (match, hslArgs) => {\n const argsMatch = hslArgs.match(/^(.+?)\\s*,\\s*(.+?)\\s*,\\s*(.+?)(?:\\s*,\\s*(.+))?$/i);\n if (argsMatch) {\n let [h, s, l, a] = argsMatch.slice(1);\n [s, l] = [s, l].map(v => v.endsWith('%') ? v : `${parseFloat(v) * 100}%`);\n return `\"hsl${typeof a === 'string' ? 'a' : ''}(${[h, s, l, a].filter(Boolean).join(',')})\"`;\n }\n return match;\n });\n}\n\n/**\n * Migrate a Mapbox/MapLibre GL Style to the latest version.\n *\n * @param style - a MapLibre Style\n * @returns a migrated style\n * @example\n * const fs = require('fs');\n * const migrate = require('@maplibre/maplibre-gl-style-spec').migrate;\n * const style = fs.readFileSync('./style.json', 'utf8');\n * fs.writeFileSync('./style.json', JSON.stringify(migrate(style)));\n */\nfunction migrate(style) {\n let migrated = false;\n if (style.version === 7) {\n style = migrateV8(style);\n migrated = true;\n }\n if (style.version === 8) {\n migrated = !!expressions(style);\n migrated = true;\n }\n eachProperty(style, { paint: true, layout: true }, ({ value, reference, set }) => {\n if ((reference === null || reference === void 0 ? void 0 : reference.type) === 'color') {\n set(migrateColors(value));\n }\n });\n if (!migrated) {\n throw new Error(`Cannot migrate from ${style.version}`);\n }\n return style;\n}\n\nconst v8 = v8Spec;\nconst expression = {\n StyleExpression,\n StylePropertyFunction,\n ZoomConstantExpression,\n ZoomDependentExpression,\n createExpression,\n createPropertyExpression,\n isExpression,\n isExpressionFilter,\n isZoomExpression,\n normalizePropertyExpression,\n};\nconst styleFunction = {\n convertFunction,\n createFunction,\n isFunction: isFunction$1\n};\nconst visit = { eachLayer, eachProperty, eachSource };\n\nexport { Color, ColorArray, ColorType, CompoundExpression, EvaluationContext, FormatExpression, Formatted, FormattedSection, FormattedType, Interpolate, Literal, NullType, NumberArray, Padding, ParsingError, ProjectionDefinition, ProjectionDefinitionType, ResolvedImage, Step, StyleExpression, StylePropertyFunction, ValidationError, VariableAnchorOffsetCollection, ZoomConstantExpression, ZoomDependentExpression, classifyRings, convertFilter, convertFunction, createExpression, createFunction, createPropertyExpression, derefLayers, diff, emptyStyle, expression, expressions$1 as expressions, featureFilter, format, styleFunction as function, groupByLayout, interpolateFactory as interpolates, isExpression, isFunction$1 as isFunction, isZoomExpression, v8Spec as latest, migrate, normalizePropertyExpression, supportsPropertyExpression, typeToString as toString, typeOf, v8, validate, validateStyleMin, visit };\n//# sourceMappingURL=index.mjs.map\n","import { validateStyleMin } from \"@maplibre/maplibre-gl-style-spec\";\nimport { MapStyle, ReferenceMapStyle, MapStyleVariant, mapStylePresetList, expandMapStyle } from \"@maptiler/client\";\n\nexport function styleToStyle(style: string | ReferenceMapStyle | MapStyleVariant | maplibregl.StyleSpecification | null | undefined): {\n style: string | maplibregl.StyleSpecification;\n requiresUrlMonitoring: boolean;\n isFallback: boolean;\n isJSON?: boolean;\n} {\n if (!style) {\n return {\n style: MapStyle[mapStylePresetList[0].referenceStyleID as keyof typeof MapStyle].getDefaultVariant().getExpandedStyleURL(),\n requiresUrlMonitoring: false, // default styles don't require URL monitoring\n isFallback: true,\n };\n }\n\n // If the provided style is a shorthand (eg. \"streets-v2\") or a full style URL\n if (typeof style === \"string\") {\n // The string could be a JSON valid style spec\n const styleValidationReport = convertStringToStyleSpecification(style);\n\n // The string is a valid JSON style that validates against the StyleSpecification spec:\n // Let's use this style\n if (styleValidationReport.isValidStyle) {\n return {\n style: styleValidationReport.styleObject!,\n requiresUrlMonitoring: false,\n isFallback: false,\n };\n }\n\n // The string is a valid JSON but not of an object that validates the StyleSpecification spec:\n // Fallback to the default style\n if (styleValidationReport.isValidJSON) {\n return {\n style: MapStyle[mapStylePresetList[0].referenceStyleID as keyof typeof MapStyle].getDefaultVariant().getExpandedStyleURL(),\n requiresUrlMonitoring: false, // default styles don't require URL monitoring\n isFallback: true,\n };\n }\n\n // The style is an absolute URL\n if (style.startsWith(\"http\")) {\n return { style: style, requiresUrlMonitoring: true, isFallback: false };\n }\n\n // The style is a relative URL\n if (style.toLowerCase().includes(\".json\")) {\n return {\n style: urlToAbsoluteUrl(style),\n requiresUrlMonitoring: true,\n isFallback: false,\n };\n }\n\n // The style is a shorthand like \"streets-v2\" or a MapTiler Style ID (UUID)\n return {\n style: expandMapStyle(style),\n requiresUrlMonitoring: true,\n isFallback: false,\n };\n }\n\n if (style instanceof MapStyleVariant) {\n // Built-in style variants don't require URL monitoring\n return {\n style: style.getExpandedStyleURL(),\n requiresUrlMonitoring: false,\n isFallback: false,\n };\n }\n\n if (style instanceof ReferenceMapStyle) {\n // Built-in reference map styles don't require URL monitoring\n return {\n style: (style.getDefaultVariant() as MapStyleVariant).getExpandedStyleURL(),\n requiresUrlMonitoring: false,\n isFallback: false,\n };\n }\n\n // If the style validates as a StyleSpecification object, we use it\n if (validateStyleMin(style).length === 0) {\n return {\n style: style as maplibregl.StyleSpecification,\n requiresUrlMonitoring: false,\n isFallback: false,\n isJSON: true,\n };\n }\n // If none of the previous attempts to detect a valid style failed => fallback to default style\n const fallbackStyle = MapStyle[mapStylePresetList[0].referenceStyleID as keyof typeof MapStyle].getDefaultVariant();\n return {\n style: fallbackStyle.getExpandedStyleURL(),\n requiresUrlMonitoring: false, // default styles don't require URL monitoring\n isFallback: true,\n };\n}\n\n/**\n * makes sure a URL is absolute\n */\nexport function urlToAbsoluteUrl(url: string): string {\n // Trying to make a URL instance only works with absolute URL or when a base is provided\n try {\n const u = new URL(url);\n return u.href;\n } catch (_e) {\n // nothing to raise\n }\n\n // Absolute URL did not work, we are building it using the current domain\n const u = new URL(url, location.origin);\n return u.href;\n}\n\ntype StyleValidationReport = {\n isValidJSON: boolean;\n isValidStyle: boolean;\n styleObject: maplibregl.StyleSpecification | null;\n};\n\nexport function convertStringToStyleSpecification(str: string): StyleValidationReport {\n try {\n const styleObj = JSON.parse(str);\n const styleErrs = validateStyleMin(styleObj);\n\n return {\n isValidJSON: true,\n isValidStyle: styleErrs.length === 0,\n styleObject: styleErrs.length === 0 ? (styleObj as maplibregl.StyleSpecification) : null,\n };\n } catch (_e) {\n return {\n isValidJSON: false,\n isValidStyle: false,\n styleObject: null,\n };\n }\n}\n","// This comes from:\n// https://github.com/maplibre/maplibre-gl-js/blob/v2.4.0/src/util/dom.ts#L22\nexport function DOMcreate<K extends keyof HTMLElementTagNameMap>(tagName: K, className?: string, container?: HTMLElement): HTMLElementTagNameMap[K] {\n const el = window.document.createElement(tagName);\n if (className !== undefined) el.className = className;\n if (container) container.appendChild(el);\n return el;\n}\n\n// This comes from:\n// https://github.com/maplibre/maplibre-gl-js/blob/v2.4.0/src/util/dom.ts#L111\nexport function DOMremove(node: HTMLElement) {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n}\n","import { DOMcreate, DOMremove } from \"../utils/dom\";\n\nimport type { Map as SDKMap } from \"../Map\";\nimport type { IControl } from \"maplibre-gl\";\nimport { bindAll } from \"../tools\";\n\n/**\n * A `MaptilerTerrainControl` control adds a button to turn terrain on and off\n * by triggering the terrain logic that is already deployed in the Map object.\n */\nexport class MaptilerTerrainControl implements IControl {\n _map!: SDKMap;\n _container!: HTMLElement;\n _terrainButton!: HTMLButtonElement;\n\n constructor() {\n bindAll([\"_toggleTerrain\", \"_updateTerrainIcon\"], this);\n }\n\n onAdd(map: SDKMap): HTMLElement {\n this._map = map;\n this._container = DOMcreate(\"div\", \"maplibregl-ctrl maplibregl-ctrl-group\");\n this._terrainButton = DOMcreate(\"button\", \"maplibregl-ctrl-terrain\", this._container);\n DOMcreate(\"span\", \"maplibregl-ctrl-icon\", this._terrainButton).setAttribute(\"aria-hidden\", \"true\");\n this._terrainButton.type = \"button\";\n this._terrainButton.addEventListener(\"click\", this._toggleTerrain);\n\n this._updateTerrainIcon();\n this._map.on(\"terrain\", this._updateTerrainIcon);\n return this._container;\n }\n\n onRemove(): void {\n DOMremove(this._container);\n this._map.off(\"terrain\", this._updateTerrainIcon);\n // @ts-expect-error: map will only be undefined on remove\n this._map = undefined;\n }\n\n _toggleTerrain(): void {\n toggleTerrain(this._map);\n this._updateTerrainIcon();\n }\n\n _updateTerrainIcon(): void {\n this._terrainButton.classList.remove(\"maplibregl-ctrl-terrain\");\n this._terrainButton.classList.remove(\"maplibregl-ctrl-terrain-enabled\");\n // if (this._map.terrain) {\n if (this._map.hasTerrain()) {\n this._terrainButton.classList.add(\"maplibregl-ctrl-terrain-enabled\");\n this._terrainButton.title = this._map._getUIString(\"TerrainControl.Disable\");\n } else {\n this._terrainButton.classList.add(\"maplibregl-ctrl-terrain\");\n this._terrainButton.title = this._map._getUIString(\"TerrainControl.Enable\");\n }\n }\n}\n\nexport function toggleTerrain(map: SDKMap): void {\n if (map.hasTerrain()) {\n map.disableTerrain();\n } else {\n map.enableTerrain();\n }\n}\n","import type { NavigationControlOptions } from \"maplibre-gl\";\nimport { NavigationControl } from \"../MLAdapters/NavigationControl\";\n\ntype HTMLButtonElementPlus = HTMLButtonElement & {\n clickFunction: (e?: Event) => unknown;\n};\n\nexport class MaptilerNavigationControl extends NavigationControl {\n constructor(options: NavigationControlOptions = {}) {\n super({\n showCompass: options.showCompass ?? true,\n showZoom: options.showZoom ?? true,\n visualizePitch: options.visualizePitch ?? true,\n });\n\n // Removing the default click event\n if (this._compass) {\n this._compass.removeEventListener(\"click\", (this._compass as HTMLButtonElementPlus).clickFunction);\n\n // Adding custom click event\n this._compass.addEventListener(\"click\", (e) => {\n {\n const currentPitch = this._map.getPitch();\n if (currentPitch === 0) {\n this._map.easeTo({ pitch: Math.min(this._map.getMaxPitch(), 80) });\n } else {\n if (this.options.visualizePitch) {\n this._map.resetNorthPitch({}, { originalEvent: e });\n } else {\n this._map.resetNorth({}, { originalEvent: e });\n }\n }\n }\n });\n }\n }\n\n /**\n * Overloading: the button now stores its click callback so that we can later on delete it and replace it\n */\n _createButton(className: string, fn: (e?: Event) => unknown): HTMLButtonElementPlus {\n const button = super._createButton(className, fn) as HTMLButtonElementPlus;\n button.clickFunction = fn;\n return button;\n }\n\n /**\n * Overloading: Limit how flat the compass icon can get\n */\n _rotateCompassArrow = () => {\n const angle = this._map.getBearing();\n const pitch = this._map.getPitch();\n\n const rotate = this.options.visualizePitch\n ? `scale(${Math.min(1.5, 1 / Math.cos(pitch * (Math.PI / 180)) ** 0.5)}) rotateX(${Math.min(70, pitch)}deg) rotateZ(${-angle}deg)`\n : `rotate(${-angle}deg)`;\n\n this._compassIcon.style.transform = rotate;\n };\n}\n","import type { LngLatLike, MapLibreEvent } from \"maplibre-gl\";\nimport maplibregl from \"maplibre-gl\";\nimport { GeolocateControl } from \"../MLAdapters/GeolocateControl\";\nimport { DOMcreate } from \"../utils/dom\";\n\nconst Marker = maplibregl.Marker;\nconst LngLat = maplibregl.LngLat;\nconst LngLatBounds = maplibregl.LngLatBounds;\n\ntype MoveEndEvent = MapLibreEvent<MouseEvent | TouchEvent | WheelEvent | undefined> & { geolocateSource?: boolean };\n\n/**\n * The MaptilerGeolocateControl is an extension of the original GeolocateControl\n * with a few changes. In this version, the active mode persists as long as the\n * location is still centered. This means it's robust to rotation, pitch and zoom.\n *\n */\nexport class MaptilerGeolocateControl extends GeolocateControl {\n private lastUpdatedCenter = new LngLat(0, 0);\n\n /**\n * Update the camera location to center on the current position\n *\n * @param {Position} position the Geolocation API Position\n * @private\n */\n _updateCamera = (position: GeolocationPosition) => {\n const center = new LngLat(position.coords.longitude, position.coords.latitude);\n const radius = position.coords.accuracy;\n const bearing = this._map.getBearing();\n const options = {\n bearing,\n ...this.options.fitBoundsOptions,\n linear: true,\n };\n\n const currentMapZoom = this._map.getZoom();\n\n if (currentMapZoom > (this.options.fitBoundsOptions?.maxZoom ?? 30)) {\n options.zoom = currentMapZoom;\n }\n\n this._map.fitBounds(LngLatBounds.fromLngLat(center, radius), options, {\n geolocateSource: true, // tag this camera change so it won't cause the control to change to background state\n });\n\n let hasFittingBeenDisrupted = false;\n\n const flagFittingDisruption = () => {\n hasFittingBeenDisrupted = true;\n };\n\n this._map.once(\"click\", flagFittingDisruption);\n this._map.once(\"dblclick\", flagFittingDisruption);\n this._map.once(\"dragstart\", flagFittingDisruption);\n this._map.once(\"mousedown\", flagFittingDisruption);\n this._map.once(\"touchstart\", flagFittingDisruption);\n this._map.once(\"wheel\", flagFittingDisruption);\n\n this._map.once(\"moveend\", () => {\n // Removing the events if not used\n this._map.off(\"click\", flagFittingDisruption);\n this._map.off(\"dblclick\", flagFittingDisruption);\n this._map.off(\"dragstart\", flagFittingDisruption);\n this._map.off(\"mousedown\", flagFittingDisruption);\n this._map.off(\"touchstart\", flagFittingDisruption);\n this._map.off(\"wheel\", flagFittingDisruption);\n\n if (hasFittingBeenDisrupted) {\n return;\n }\n\n this.lastUpdatedCenter = this._map.getCenter();\n });\n };\n\n _finishSetupUI = (supported: boolean) => {\n // this method is called asynchronously during onAdd\n if (!this._map) {\n // control has since been removed\n return;\n }\n\n if (supported === false) {\n // warnOnce('Geolocation support is not available so the GeolocateControl will be disabled.');\n const title = this._map._getUIString(\"GeolocateControl.LocationNotAvailable\");\n this._geolocateButton.disabled = true;\n this._geolocateButton.title = title;\n this._geolocateButton.setAttribute(\"aria-label\", title);\n } else {\n const title = this._map._getUIString(\"GeolocateControl.FindMyLocation\");\n this._geolocateButton.disabled = false;\n this._geolocateButton.title = title;\n this._geolocateButton.setAttribute(\"aria-label\", title);\n }\n\n if (this.options.trackUserLocation) {\n this._geolocateButton.setAttribute(\"aria-pressed\", \"false\");\n this._watchState = \"OFF\";\n }\n\n // when showUserLocation is enabled, keep the Geolocate button disabled until the device location marker is setup on the map\n if (this.options.showUserLocation) {\n this._dotElement = DOMcreate(\"div\", \"maplibregl-user-location-dot\");\n this._userLocationDotMarker = new Marker({ element: this._dotElement });\n\n this._circleElement = DOMcreate(\"div\", \"maplibregl-user-location-accuracy-circle\");\n this._accuracyCircleMarker = new Marker({\n element: this._circleElement,\n pitchAlignment: \"map\",\n });\n\n if (this.options.trackUserLocation) this._watchState = \"OFF\";\n\n this._map.on(\"move\", this._onZoom);\n }\n\n this._geolocateButton.addEventListener(\"click\", this.trigger.bind(this));\n\n this._setup = true;\n\n // when the camera is changed (and it's not as a result of the Geolocation Control) change\n // the watch mode to background watch, so that the marker is updated but not the camera.\n // Addition: Yet the status change does not occur if the ditance it has moved to is less than\n // one meter from the last auto-updated position. This is to guarrantee that if the move\n // is a zoom, rotation or pitch (where the center stays the same) then we can keep the ACTIVE_LOCK\n // mode ON.\n if (this.options.trackUserLocation) {\n this._map.on(\"moveend\", (event: MoveEndEvent) => {\n const fromResize = event.originalEvent && event.originalEvent.type === \"resize\";\n const movingDistance = this.lastUpdatedCenter.distanceTo(this._map.getCenter());\n\n if (!event.geolocateSource && this._watchState === \"ACTIVE_LOCK\" && !fromResize && movingDistance > 1) {\n this._watchState = \"BACKGROUND\";\n this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-background\");\n this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active\");\n\n this.fire(new Event(\"trackuserlocationend\"));\n }\n });\n }\n };\n\n _updateCircleRadius() {\n if (this._watchState !== \"BACKGROUND\" && this._watchState !== \"ACTIVE_LOCK\") {\n return;\n }\n\n const lastKnownLocation: LngLatLike = [this._lastKnownPosition.coords.longitude, this._lastKnownPosition.coords.latitude];\n\n const projectedLocation = this._map.project(lastKnownLocation);\n const a = this._map.unproject([projectedLocation.x, projectedLocation.y]);\n const b = this._map.unproject([projectedLocation.x + 20, projectedLocation.y]);\n const metersPerPixel = a.distanceTo(b) / 20;\n\n const circleDiameter = Math.ceil((2.0 * this._accuracy) / metersPerPixel);\n this._circleElement.style.width = `${circleDiameter}px`;\n this._circleElement.style.height = `${circleDiameter}px`;\n }\n\n _onZoom = () => {\n if (this.options.showUserLocation && this.options.showAccuracyCircle) {\n this._updateCircleRadius();\n }\n };\n\n // We are overwriting the method _setErrorState from Maplibre's GeolocateControl because the\n // case BACKGROUND_ERROR is not dealt with in the original function and yields an error.\n // Related issue: https://github.com/maplibre/maplibre-gl-js/issues/2294\n _setErrorState() {\n switch (this._watchState) {\n case \"WAITING_ACTIVE\":\n this._watchState = \"ACTIVE_ERROR\";\n this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active\");\n this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-active-error\");\n break;\n case \"ACTIVE_LOCK\":\n this._watchState = \"ACTIVE_ERROR\";\n this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active\");\n this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-active-error\");\n this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-waiting\");\n // turn marker grey\n break;\n case \"BACKGROUND\":\n this._watchState = \"BACKGROUND_ERROR\";\n this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-background\");\n this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-background-error\");\n this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-waiting\");\n // turn marker grey\n break;\n case \"ACTIVE_ERROR\":\n break;\n case \"BACKGROUND_ERROR\":\n break;\n default:\n throw new Error(`Unexpected watchState ${this._watchState}`);\n }\n }\n}\n","import { DOMremove } from \"../utils/dom\";\nimport type { Map as SDKMap } from \"../Map\";\nimport type { IControl, MapLibreEvent } from \"maplibre-gl\";\n\nexport type MaptilerCustomControlCallback<E> = (map: SDKMap, element: HTMLElement, event: E) => void;\n\n/**\n * The MaptilerCustomControl allows any existing element to become a map control.\n */\nexport class MaptilerCustomControl implements IControl {\n #map!: SDKMap;\n #element!: HTMLElement;\n #onClickFn?: (event: Event) => void;\n #onRenderFn?: (event: MapLibreEvent) => void;\n #originalParent: HTMLElement | null;\n\n /**\n * @param selectorOrElement Element to be used as control, specified as either reference to element itself or a CSS selector to find the element in DOM\n * @param onClick Function called when the element is clicked\n * @param onRender Function called every time the underlying map renders a new state\n */\n constructor(selectorOrElement: string | HTMLElement, onClick?: MaptilerCustomControlCallback<Event>, onRender?: MaptilerCustomControlCallback<MapLibreEvent>) {\n if (typeof selectorOrElement === \"string\") {\n const element = document.querySelector(selectorOrElement) as HTMLElement | null;\n if (!element) throw new Error(`No element has been found with selector \"${selectorOrElement}\" when creating an external control.`);\n this.#element = element;\n } else {\n this.#element = selectorOrElement;\n }\n\n if (onClick) {\n this.#onClickFn = (event: Event) => {\n onClick(this.#map, this.#element, event);\n };\n }\n if (onRender) {\n this.#onRenderFn = (event: MapLibreEvent) => {\n onRender(this.#map, this.#element, event);\n };\n }\n\n this.#originalParent = this.#element.parentElement;\n }\n\n onAdd(map: SDKMap): HTMLElement {\n this.#map = map;\n\n if (this.#onClickFn) {\n this.#element.addEventListener(\"click\", this.#onClickFn);\n }\n if (this.#onRenderFn) {\n this.#map.on(\"render\", this.#onRenderFn);\n }\n\n DOMremove(this.#element);\n return this.#element;\n }\n\n onRemove(): void {\n if (this.#onClickFn) {\n this.#element.removeEventListener(\"click\", this.#onClickFn);\n }\n if (this.#onRenderFn) {\n this.#map.off(\"render\", this.#onRenderFn);\n }\n\n if (this.#originalParent) {\n this.#originalParent.appendChild(this.#element);\n } else {\n DOMremove(this.#element);\n }\n }\n}\n","import { DOMcreate, DOMremove } from \"../utils/dom\";\nimport type { Map as SDKMap } from \"../Map\";\nimport type { IControl } from \"maplibre-gl\";\n\n/**\n * A `MaptilerProjectionControl` control adds a button to switch from Mercator to Globe projection.\n */\nexport class MaptilerProjectionControl implements IControl {\n map!: SDKMap;\n container!: HTMLElement;\n projectionButton!: HTMLButtonElement;\n\n onAdd(map: SDKMap): HTMLElement {\n this.map = map;\n this.container = DOMcreate(\"div\", \"maplibregl-ctrl maplibregl-ctrl-group\");\n this.projectionButton = DOMcreate(\"button\", \"maplibregl-ctrl-projection\", this.container);\n DOMcreate(\"span\", \"maplibregl-ctrl-icon\", this.projectionButton).setAttribute(\"aria-hidden\", \"true\");\n this.projectionButton.type = \"button\";\n this.projectionButton.addEventListener(\"click\", this.toggleProjection.bind(this));\n\n map.on(\"projectiontransition\", this.updateProjectionIcon.bind(this));\n\n this.updateProjectionIcon();\n return this.container;\n }\n\n onRemove(): void {\n DOMremove(this.container);\n this.map.off(\"projectiontransition\", this.updateProjectionIcon);\n // @ts-expect-error: map will only be undefined on remove\n this.map = undefined;\n }\n\n private toggleProjection(): void {\n toggleProjection(this.map);\n this.updateProjectionIcon();\n }\n\n private updateProjectionIcon(): void {\n this.projectionButton.classList.remove(\"maplibregl-ctrl-projection-globe\");\n this.projectionButton.classList.remove(\"maplibregl-ctrl-projection-mercator\");\n if (this.map.isGlobeProjection()) {\n this.projectionButton.classList.add(\"maplibregl-ctrl-projection-mercator\");\n this.projectionButton.title = \"Enable Mercator projection\";\n } else {\n this.projectionButton.classList.add(\"maplibregl-ctrl-projection-globe\");\n this.projectionButton.title = \"Enable Globe projection\";\n }\n }\n}\n\nexport function toggleProjection(map: SDKMap): void {\n if (map.getProjection() === undefined) {\n map.setProjection({ type: \"mercator\" });\n }\n if (map.isGlobeProjection()) {\n map.enableMercatorProjection();\n } else {\n map.enableGlobeProjection();\n }\n}\n","import type { Map as SDKMap } from \"../Map\";\nimport type { IControl } from \"maplibre-gl\";\nimport { MaptilerCustomControl, MaptilerCustomControlCallback } from \"./MaptilerCustomControl\";\nimport { toggleProjection } from \"./MaptilerProjectionControl\";\nimport { toggleTerrain } from \"./MaptilerTerrainControl\";\n\nexport type MaptilerExternalControlType = \"zoom-in\" | \"zoom-out\" | \"toggle-projection\" | \"toggle-terrain\" | \"reset-view\" | \"reset-bearing\" | \"reset-pitch\" | \"reset-roll\";\n\nconst controlCallbacks: Record<MaptilerExternalControlType, MaptilerCustomControlCallback<Event>> = {\n \"zoom-in\": (map) => map.zoomIn(),\n \"zoom-out\": (map) => map.zoomOut(),\n \"toggle-projection\": toggleProjection,\n \"toggle-terrain\": toggleTerrain,\n \"reset-view\": (map) => {\n const currentPitch = map.getPitch();\n if (currentPitch === 0) {\n map.easeTo({ pitch: Math.min(map.getMaxPitch(), 80) });\n } else {\n map.resetNorthPitch();\n }\n },\n \"reset-bearing\": (map) => {\n map.rotateTo(0);\n },\n \"reset-pitch\": (map) => {\n map.setPitch(0);\n },\n \"reset-roll\": (map) => {\n map.setRoll(0);\n },\n};\n\n/**\n * The MaptilerExternalControl allows any existing element to automatically become a map control. Used for detected controls if `customControls` config is turned on.\n */\nexport class MaptilerExternalControl extends MaptilerCustomControl implements IControl {\n static controlCallbacks = controlCallbacks;\n\n #map!: SDKMap;\n #groupItemEvents = new Map<WeakRef<HTMLElement>, (event: Event) => void>();\n\n /**\n * Constructs an instance of External Control to have a predefined functionality\n * @param controlElement Element to be used as control, specified as reference to element itself\n * @param controlType One of the predefined types of functionality\n */\n constructor(controlElement: HTMLElement, controlType?: MaptilerExternalControlType) {\n if (controlType && !(controlType in controlCallbacks)) throw new Error(`data-maptiler-control value \"${controlType}\" is invalid.`);\n super(controlElement, controlType && controlCallbacks[controlType]);\n }\n\n onAdd(map: SDKMap): HTMLElement {\n this.#map = map;\n\n return super.onAdd(map);\n }\n\n onRemove(): void {\n for (const [elementRef, onClickFn] of this.#groupItemEvents) {\n const element = elementRef.deref();\n if (element) {\n element.removeEventListener(\"click\", onClickFn);\n }\n }\n this.#groupItemEvents.clear();\n\n super.onRemove();\n }\n\n /**\n * Configure a child element to be part of this control and to have a predefined functionality added\n * @param controlElement Element that is a descendant of the control element and that optionally should have some functionality\n * @param controlType One of the predefined types of functionality\n */\n configureGroupItem(controlElement: HTMLElement, controlType: MaptilerExternalControlType | undefined): void {\n if (!controlType) return;\n if (!(controlType in controlCallbacks)) throw new Error(`data-maptiler-control value \"${controlType}\" is invalid.`);\n const onClickFn = (event: Event) => {\n controlCallbacks[controlType](this.#map, controlElement, event);\n };\n controlElement.addEventListener(\"click\", onClickFn);\n this.#groupItemEvents.set(new WeakRef(controlElement), onClickFn);\n }\n}\n","/**\n * This is an extension adds support for adding a minimap to one of the map's control containers.\n */\n\nimport { Map as SDKMap } from \"../Map\";\nimport { DOMcreate, DOMremove } from \"../utils/dom\";\n\nimport type {\n ControlPosition,\n CustomLayerInterface,\n FillLayerSpecification,\n FilterSpecification,\n GeoJSONSource,\n IControl,\n LayerSpecification,\n LineLayerSpecification,\n SourceSpecification,\n StyleOptions,\n StyleSetterOptions,\n StyleSpecification,\n StyleSwapOptions,\n} from \"maplibre-gl\";\nimport type { MapOptions } from \"../Map\";\nimport type { MapStyleVariant, ReferenceMapStyle } from \"@maptiler/client\";\n\nexport interface ParentRect {\n lineLayout: LineLayerSpecification[\"layout\"];\n linePaint: LineLayerSpecification[\"paint\"];\n fillPaint: FillLayerSpecification[\"paint\"];\n}\n\nexport interface MinimapOptionsInput {\n /**\n * Style of the map. Can be:\n * - a full style URL (possibly with API key)\n * - a shorthand with only the MapTIler style name (eg. `\"streets-v2\"`)\n * - a longer form with the prefix `\"maptiler://\"` (eg. `\"maptiler://streets-v2\"`)\n */\n style?: ReferenceMapStyle | MapStyleVariant | StyleSpecification | string;\n\n /**\n * Set the zoom difference between the parent and the minimap\n * If the parent is zoomed to 10 and the minimap is zoomed to 8, the zoomAdjust should be 2\n * Default: -4\n */\n zoomAdjust?: number;\n\n /** Set a zoom of the minimap and don't allow any future changes */\n lockZoom?: number;\n\n /** Adjust the pitch only if the user requests */\n pitchAdjust?: boolean;\n\n /** Set CSS properties of the container using object key-values */\n containerStyle?: Record<string, string>;\n\n /** Set the position of the minimap at either \"top-left\", \"top-right\", \"bottom-left\", or \"bottom-right\" */\n position?: ControlPosition;\n\n /** Set the parentRect fill and/or line options */\n parentRect?: ParentRect;\n}\n\nexport interface MinimapOptions extends Omit<MapOptions, \"space\" | \"halo\"> {\n zoomAdjust: number;\n pitchAdjust: boolean;\n containerStyle: Record<string, string>;\n parentRect?: ParentRect;\n}\n\nexport default class Minimap implements IControl {\n #options: MinimapOptions;\n map!: SDKMap;\n #parentMap!: SDKMap;\n #container!: HTMLElement;\n #parentRect?: GeoJSON.Feature<GeoJSON.Polygon>;\n #differentStyle = false;\n #desync?: () => void;\n constructor(options: MinimapOptionsInput, mapOptions: MapOptions) {\n // check if the style is different\n if (options.style !== undefined) this.#differentStyle = true;\n // set options\n this.#options = {\n // set defaults\n zoomAdjust: -4,\n position: \"top-right\",\n // inherit map options\n ...mapOptions,\n // override any lingering control options\n forceNoAttributionControl: true,\n attributionControl: false,\n navigationControl: false,\n geolocateControl: false,\n maptilerLogo: false,\n minimap: false,\n hash: false,\n pitchAdjust: false,\n // override map options with new user defined minimap options\n ...options,\n containerStyle: {\n border: \"1px solid #000\",\n width: \"400px\",\n height: \"300px\",\n ...(options.containerStyle ?? {}),\n },\n };\n if (options.lockZoom !== undefined) {\n this.#options.minZoom = options.lockZoom;\n this.#options.maxZoom = options.lockZoom;\n }\n }\n\n setStyle(style: null | ReferenceMapStyle | MapStyleVariant | StyleSpecification | string, options?: StyleSwapOptions & StyleOptions): void {\n if (!this.#differentStyle) this.map.setStyle(style, options);\n this.#setParentBounds();\n }\n\n addLayer(\n layer:\n | (LayerSpecification & {\n source?: string | SourceSpecification;\n })\n | CustomLayerInterface,\n beforeId?: string,\n ): SDKMap {\n if (!this.#differentStyle) this.map.addLayer(layer, beforeId);\n this.#setParentBounds();\n return this.map;\n }\n\n moveLayer(id: string, beforeId?: string): SDKMap {\n if (!this.#differentStyle) this.map.moveLayer(id, beforeId);\n this.#setParentBounds();\n return this.map;\n }\n\n removeLayer(id: string): this {\n if (!this.#differentStyle) this.map.removeLayer(id);\n this.#setParentBounds();\n return this;\n }\n\n setLayerZoomRange(layerId: string, minzoom: number, maxzoom: number): this {\n if (!this.#differentStyle) this.map.setLayerZoomRange(layerId, minzoom, maxzoom);\n this.#setParentBounds();\n return this;\n }\n\n setFilter(layerId: string, filter?: FilterSpecification | null, options?: StyleSetterOptions): this {\n if (!this.#differentStyle) this.map.setFilter(layerId, filter, options);\n this.#setParentBounds();\n return this;\n }\n\n setPaintProperty(\n layerId: string,\n name: string,\n // maplibre controlled types\n value: any,\n options?: StyleSetterOptions,\n ): this {\n if (!this.#differentStyle) this.map.setPaintProperty(layerId, name, value, options);\n this.#setParentBounds();\n return this;\n }\n\n setLayoutProperty(\n layerId: string,\n name: string,\n // maplibre controlled types\n value: any,\n options?: StyleSetterOptions,\n ): this {\n if (!this.#differentStyle) this.map.setLayoutProperty(layerId, name, value, options);\n this.#setParentBounds();\n return this;\n }\n\n setGlyphs(glyphsUrl: string | null, options?: StyleSetterOptions): this {\n if (!this.#differentStyle) this.map.setGlyphs(glyphsUrl, options);\n this.#setParentBounds();\n return this;\n }\n\n onAdd(parentMap: SDKMap): HTMLElement {\n this.#parentMap = parentMap;\n //prep the container\n this.#container = DOMcreate(\"div\", \"maplibregl-ctrl maplibregl-ctrl-group\");\n // adjust styling\n for (const [key, value] of Object.entries(this.#options.containerStyle)) {\n this.#container.style.setProperty(key, value);\n }\n this.#options.container = this.#container;\n this.#options.zoom = parentMap.getZoom() + this.#options.zoomAdjust;\n this.map = new SDKMap(this.#options);\n\n // NOTE: For some reason the DOM doesn't properly update it's size in time\n // for the minimap to convey it's size to the canvas.\n this.map.once(\"style.load\", () => {\n this.map.resize();\n });\n\n // set options\n this.map.once(\"load\", () => {\n this.#addParentRect(this.#options.parentRect);\n this.#desync = this.#syncMaps();\n });\n\n return this.#container;\n }\n\n onRemove(): void {\n this.#desync?.();\n DOMremove(this.#container);\n }\n\n #addParentRect(rect?: ParentRect): void {\n if (rect === undefined || (rect.linePaint === undefined && rect.fillPaint === undefined)) {\n return;\n }\n this.#parentRect = {\n type: \"Feature\",\n properties: {\n name: \"parentRect\",\n },\n geometry: {\n type: \"Polygon\",\n coordinates: [[[], [], [], [], []]],\n },\n };\n\n this.map.addSource(\"parentRect\", {\n type: \"geojson\",\n data: this.#parentRect,\n });\n if (rect.lineLayout !== undefined || rect.linePaint !== undefined) {\n this.map.addLayer({\n id: \"parentRectOutline\",\n type: \"line\",\n source: \"parentRect\",\n layout: {\n ...rect.lineLayout,\n },\n paint: {\n \"line-color\": \"#FFF\",\n \"line-width\": 1,\n \"line-opacity\": 0.85,\n ...rect.linePaint,\n },\n });\n }\n if (rect.fillPaint !== undefined) {\n this.map.addLayer({\n id: \"parentRectFill\",\n type: \"fill\",\n source: \"parentRect\",\n layout: {},\n paint: {\n \"fill-color\": \"#08F\",\n \"fill-opacity\": 0.135,\n ...rect.fillPaint,\n },\n });\n }\n\n this.#setParentBounds();\n }\n\n #setParentBounds() {\n if (this.#parentRect === undefined) return;\n\n const { devicePixelRatio } = window;\n const canvas = this.#parentMap.getCanvas();\n const width = canvas.width / devicePixelRatio;\n const height = canvas.height / devicePixelRatio;\n\n // Get coordinates for all four corners\n const unproject = this.#parentMap.unproject.bind(this.#parentMap);\n const northWest = unproject([0, 0]);\n const northEast = unproject([width, 0]);\n const southWest = unproject([0, height]);\n const southEast = unproject([width, height]);\n\n this.#parentRect.geometry.coordinates = [[southWest.toArray(), southEast.toArray(), northEast.toArray(), northWest.toArray(), southWest.toArray()]];\n\n const source = this.map.getSource<GeoJSONSource>(\"parentRect\");\n\n if (source !== undefined) {\n source.setData(this.#parentRect);\n }\n }\n\n #syncMaps(): () => void {\n const { pitchAdjust } = this.#options;\n // syncing callbacks\n const parentCallback = () => {\n sync(\"parent\");\n };\n const minimapCallback = () => {\n sync(\"minimap\");\n };\n\n // on off functions\n const on = () => {\n this.#parentMap.on(\"move\", parentCallback);\n this.map.on(\"move\", minimapCallback);\n };\n const off = () => {\n this.#parentMap.off(\"move\", parentCallback);\n this.map.off(\"move\", minimapCallback);\n };\n\n // When one map moves, we turn off the movement listeners\n // on all the maps, move it, then turn the listeners on again\n const sync = (which: \"parent\" | \"minimap\") => {\n // OFF\n off();\n\n // MOVE\n const from = which === \"parent\" ? this.#parentMap : this.map;\n const to = which === \"parent\" ? this.map : this.#parentMap;\n const center = from.getCenter();\n const zoom = from.getZoom() + this.#options.zoomAdjust * (which === \"parent\" ? 1 : -1);\n const bearing = from.getBearing();\n const pitch = from.getPitch();\n to.jumpTo({\n center,\n zoom,\n bearing,\n pitch: pitchAdjust ? pitch : 0,\n });\n // update parent rect\n this.#setParentBounds();\n\n // ON\n on();\n };\n\n on();\n // return a desync function\n return () => {\n off();\n };\n }\n}\n","import { getVersion } from \".\";\nimport type { Map as MapSDK } from \"./Map\";\nimport { config, MAPTILER_SESSION_ID } from \"./config\";\nimport { defaults } from \"./constants/defaults\";\n\n/**\n * A Telemetry instance sends some usage and merics to a dedicated endpoint at MapTiler Cloud.\n */\nexport class Telemetry {\n private map: MapSDK;\n private registeredModules = new Set<string>();\n private viewerType: string;\n\n /**\n *\n * @param map : a Map instance\n * @param delay : a delay in milliseconds after which the payload is sent to MapTiler cloud (cannot be less than 1000ms)\n */\n constructor(map: MapSDK, delay: number = 2000) {\n this.map = map;\n\n this.viewerType = \"Map\";\n\n setTimeout(\n async () => {\n if (!config.telemetry) {\n return;\n }\n const endpointURL = this.preparePayload();\n\n try {\n const response = await fetch(endpointURL, { method: \"POST\" });\n if (!response.ok) {\n console.warn(\"The metrics could not be sent to MapTiler Cloud\");\n }\n } catch (e) {\n console.warn(\"The metrics could not be sent to MapTiler Cloud\", e);\n }\n },\n Math.max(1000, delay),\n );\n }\n\n /**\n * Register a module to the telemetry system of the SDK.\n * The arguments `name` and `version` likely come from the package.json\n * of each module.\n */\n registerModule(name: string, version: string) {\n // The telemetry is using a Set (and not an array) to avoid duplicates\n // of same module + same version. Yet we want to track is the same module\n // is being used with multiple version in a given project as this\n // could be a source of incompatibility\n this.registeredModules.add(`${name}:${version}`);\n }\n\n registerViewerType(viewerType: string = \"Map\") {\n this.viewerType = viewerType;\n }\n\n private preparePayload(): string {\n const telemetryUrl = new URL(defaults.telemetryURL);\n\n // Adding the version of the SDK\n telemetryUrl.searchParams.append(\"sdk\", getVersion());\n\n // Adding the API key\n telemetryUrl.searchParams.append(\"key\", config.apiKey);\n\n // Adding MapTiler Cloud session ID\n telemetryUrl.searchParams.append(\"mtsid\", MAPTILER_SESSION_ID);\n\n // Is the app using session?\n telemetryUrl.searchParams.append(\"session\", config.session ? \"1\" : \"0\");\n\n // Is the app using tile caching?\n telemetryUrl.searchParams.append(\"caching\", config.caching ? \"1\" : \"0\");\n\n // Is the langauge updated from the original style?\n telemetryUrl.searchParams.append(\"lang-updated\", this.map.isLanguageUpdated() ? \"1\" : \"0\");\n\n // Is terrain enabled?\n telemetryUrl.searchParams.append(\"terrain\", this.map.getTerrain() ? \"1\" : \"0\");\n\n // Is globe enabled?\n telemetryUrl.searchParams.append(\"globe\", this.map.isGlobeProjection() ? \"1\" : \"0\");\n\n // Is this a stadnard map or a different viewer?\n telemetryUrl.searchParams.append(\"viewerType\", this.viewerType);\n\n // Adding the modules\n // the list of modules are separated by a \"|\". For each module, a \":\" is used to separate the name and the version:\n // \"@maptiler/module-foo:1.1.0|@maptiler/module-bar:3.4.0|@maptiler/module-baz:9.0.3|@maptiler/module-quz:0.0.2-rc.1\"\n // then the `.append()` function is in charge of URL-encoding the argument\n if (this.registeredModules.size > 0) {\n telemetryUrl.searchParams.append(\"modules\", Array.from(this.registeredModules).join(\"|\"));\n }\n\n return telemetryUrl.href;\n }\n}\n","/**\n * Common utilities\n * @module glMatrix\n */\n\n// Configuration Constants\nexport var EPSILON = 0.000001;\nexport var ARRAY_TYPE = typeof Float32Array !== \"undefined\" ? Float32Array : Array;\nexport var RANDOM = Math.random;\nexport var ANGLE_ORDER = \"zyx\";\n\n/**\n * Symmetric round\n * see https://www.npmjs.com/package/round-half-up-symmetric#user-content-detailed-background\n *\n * @param {Number} a value to round\n */\nexport function round(a) {\n if (a >= 0) return Math.round(a);\n return a % 0.5 === 0 ? Math.floor(a) : Math.round(a);\n}\n\n/**\n * Sets the type of array used when creating new vectors and matrices\n *\n * @param {Float32ArrayConstructor | ArrayConstructor} type Array type, such as Float32Array or Array\n */\nexport function setMatrixArrayType(type) {\n ARRAY_TYPE = type;\n}\nvar degree = Math.PI / 180;\nvar radian = 180 / Math.PI;\n\n/**\n * Convert Degree To Radian\n *\n * @param {Number} a Angle in Degrees\n */\nexport function toRadian(a) {\n return a * degree;\n}\n\n/**\n * Convert Radian To Degree\n *\n * @param {Number} a Angle in Radians\n */\nexport function toDegree(a) {\n return a * radian;\n}\n\n/**\n * Tests whether or not the arguments have approximately the same value, within an absolute\n * or relative tolerance of glMatrix.EPSILON (an absolute tolerance is used for values less\n * than or equal to 1.0, and a relative tolerance is used for larger values)\n *\n * @param {Number} a The first number to test.\n * @param {Number} b The second number to test.\n * @param {Number} tolerance Absolute or relative tolerance (default glMatrix.EPSILON)\n * @returns {Boolean} True if the numbers are approximately equal, false otherwise.\n */\nexport function equals(a, b) {\n var tolerance = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : EPSILON;\n return Math.abs(a - b) <= tolerance * Math.max(1, Math.abs(a), Math.abs(b));\n}","import * as glMatrix from \"./common.js\";\n\n/**\n * 4x4 Matrix<br>Format: column-major, when typed out it looks like row-major<br>The matrices are being post multiplied.\n * @module mat4\n */\n\n/**\n * Creates a new identity mat4\n *\n * @returns {mat4} a new 4x4 matrix\n */\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(16);\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n }\n out[0] = 1;\n out[5] = 1;\n out[10] = 1;\n out[15] = 1;\n return out;\n}\n\n/**\n * Creates a new mat4 initialized with values from an existing matrix\n *\n * @param {ReadonlyMat4} a matrix to clone\n * @returns {mat4} a new 4x4 matrix\n */\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(16);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n\n/**\n * Copy the values from one mat4 to another\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the source matrix\n * @returns {mat4} out\n */\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n\n/**\n * Create a new mat4 with the given values\n *\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\n * @param {Number} m03 Component in column 0, row 3 position (index 3)\n * @param {Number} m10 Component in column 1, row 0 position (index 4)\n * @param {Number} m11 Component in column 1, row 1 position (index 5)\n * @param {Number} m12 Component in column 1, row 2 position (index 6)\n * @param {Number} m13 Component in column 1, row 3 position (index 7)\n * @param {Number} m20 Component in column 2, row 0 position (index 8)\n * @param {Number} m21 Component in column 2, row 1 position (index 9)\n * @param {Number} m22 Component in column 2, row 2 position (index 10)\n * @param {Number} m23 Component in column 2, row 3 position (index 11)\n * @param {Number} m30 Component in column 3, row 0 position (index 12)\n * @param {Number} m31 Component in column 3, row 1 position (index 13)\n * @param {Number} m32 Component in column 3, row 2 position (index 14)\n * @param {Number} m33 Component in column 3, row 3 position (index 15)\n * @returns {mat4} A new mat4\n */\nexport function fromValues(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {\n var out = new glMatrix.ARRAY_TYPE(16);\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m03;\n out[4] = m10;\n out[5] = m11;\n out[6] = m12;\n out[7] = m13;\n out[8] = m20;\n out[9] = m21;\n out[10] = m22;\n out[11] = m23;\n out[12] = m30;\n out[13] = m31;\n out[14] = m32;\n out[15] = m33;\n return out;\n}\n\n/**\n * Set the components of a mat4 to the given values\n *\n * @param {mat4} out the receiving matrix\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\n * @param {Number} m03 Component in column 0, row 3 position (index 3)\n * @param {Number} m10 Component in column 1, row 0 position (index 4)\n * @param {Number} m11 Component in column 1, row 1 position (index 5)\n * @param {Number} m12 Component in column 1, row 2 position (index 6)\n * @param {Number} m13 Component in column 1, row 3 position (index 7)\n * @param {Number} m20 Component in column 2, row 0 position (index 8)\n * @param {Number} m21 Component in column 2, row 1 position (index 9)\n * @param {Number} m22 Component in column 2, row 2 position (index 10)\n * @param {Number} m23 Component in column 2, row 3 position (index 11)\n * @param {Number} m30 Component in column 3, row 0 position (index 12)\n * @param {Number} m31 Component in column 3, row 1 position (index 13)\n * @param {Number} m32 Component in column 3, row 2 position (index 14)\n * @param {Number} m33 Component in column 3, row 3 position (index 15)\n * @returns {mat4} out\n */\nexport function set(out, m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m03;\n out[4] = m10;\n out[5] = m11;\n out[6] = m12;\n out[7] = m13;\n out[8] = m20;\n out[9] = m21;\n out[10] = m22;\n out[11] = m23;\n out[12] = m30;\n out[13] = m31;\n out[14] = m32;\n out[15] = m33;\n return out;\n}\n\n/**\n * Set a mat4 to the identity matrix\n *\n * @param {mat4} out the receiving matrix\n * @returns {mat4} out\n */\nexport function identity(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n\n/**\n * Transpose the values of a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the source matrix\n * @returns {mat4} out\n */\nexport function transpose(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a12 = a[6],\n a13 = a[7];\n var a23 = a[11];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a01;\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a02;\n out[9] = a12;\n out[11] = a[14];\n out[12] = a03;\n out[13] = a13;\n out[14] = a23;\n } else {\n out[0] = a[0];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a[1];\n out[5] = a[5];\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a[2];\n out[9] = a[6];\n out[10] = a[10];\n out[11] = a[14];\n out[12] = a[3];\n out[13] = a[7];\n out[14] = a[11];\n out[15] = a[15];\n }\n return out;\n}\n\n/**\n * Inverts a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the source matrix\n * @returns {mat4 | null} out, or null if source matrix is not invertible\n */\nexport function invert(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n var b00 = a00 * a11 - a01 * a10;\n var b01 = a00 * a12 - a02 * a10;\n var b02 = a00 * a13 - a03 * a10;\n var b03 = a01 * a12 - a02 * a11;\n var b04 = a01 * a13 - a03 * a11;\n var b05 = a02 * a13 - a03 * a12;\n var b06 = a20 * a31 - a21 * a30;\n var b07 = a20 * a32 - a22 * a30;\n var b08 = a20 * a33 - a23 * a30;\n var b09 = a21 * a32 - a22 * a31;\n var b10 = a21 * a33 - a23 * a31;\n var b11 = a22 * a33 - a23 * a32;\n\n // Calculate the determinant\n var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n return out;\n}\n\n/**\n * Calculates the adjugate of a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the source matrix\n * @returns {mat4} out\n */\nexport function adjoint(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n var b00 = a00 * a11 - a01 * a10;\n var b01 = a00 * a12 - a02 * a10;\n var b02 = a00 * a13 - a03 * a10;\n var b03 = a01 * a12 - a02 * a11;\n var b04 = a01 * a13 - a03 * a11;\n var b05 = a02 * a13 - a03 * a12;\n var b06 = a20 * a31 - a21 * a30;\n var b07 = a20 * a32 - a22 * a30;\n var b08 = a20 * a33 - a23 * a30;\n var b09 = a21 * a32 - a22 * a31;\n var b10 = a21 * a33 - a23 * a31;\n var b11 = a22 * a33 - a23 * a32;\n out[0] = a11 * b11 - a12 * b10 + a13 * b09;\n out[1] = a02 * b10 - a01 * b11 - a03 * b09;\n out[2] = a31 * b05 - a32 * b04 + a33 * b03;\n out[3] = a22 * b04 - a21 * b05 - a23 * b03;\n out[4] = a12 * b08 - a10 * b11 - a13 * b07;\n out[5] = a00 * b11 - a02 * b08 + a03 * b07;\n out[6] = a32 * b02 - a30 * b05 - a33 * b01;\n out[7] = a20 * b05 - a22 * b02 + a23 * b01;\n out[8] = a10 * b10 - a11 * b08 + a13 * b06;\n out[9] = a01 * b08 - a00 * b10 - a03 * b06;\n out[10] = a30 * b04 - a31 * b02 + a33 * b00;\n out[11] = a21 * b02 - a20 * b04 - a23 * b00;\n out[12] = a11 * b07 - a10 * b09 - a12 * b06;\n out[13] = a00 * b09 - a01 * b07 + a02 * b06;\n out[14] = a31 * b01 - a30 * b03 - a32 * b00;\n out[15] = a20 * b03 - a21 * b01 + a22 * b00;\n return out;\n}\n\n/**\n * Calculates the determinant of a mat4\n *\n * @param {ReadonlyMat4} a the source matrix\n * @returns {Number} determinant of a\n */\nexport function determinant(a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n var b0 = a00 * a11 - a01 * a10;\n var b1 = a00 * a12 - a02 * a10;\n var b2 = a01 * a12 - a02 * a11;\n var b3 = a20 * a31 - a21 * a30;\n var b4 = a20 * a32 - a22 * a30;\n var b5 = a21 * a32 - a22 * a31;\n var b6 = a00 * b5 - a01 * b4 + a02 * b3;\n var b7 = a10 * b5 - a11 * b4 + a12 * b3;\n var b8 = a20 * b2 - a21 * b1 + a22 * b0;\n var b9 = a30 * b2 - a31 * b1 + a32 * b0;\n\n // Calculate the determinant\n return a13 * b6 - a03 * b7 + a33 * b8 - a23 * b9;\n}\n\n/**\n * Multiplies two mat4s\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the first operand\n * @param {ReadonlyMat4} b the second operand\n * @returns {mat4} out\n */\nexport function multiply(out, a, b) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n\n // Cache only the current line of the second matrix\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[4];\n b1 = b[5];\n b2 = b[6];\n b3 = b[7];\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[8];\n b1 = b[9];\n b2 = b[10];\n b3 = b[11];\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[12];\n b1 = b[13];\n b2 = b[14];\n b3 = b[15];\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n return out;\n}\n\n/**\n * Translate a mat4 by the given vector\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to translate\n * @param {ReadonlyVec3} v vector to translate by\n * @returns {mat4} out\n */\nexport function translate(out, a, v) {\n var x = v[0],\n y = v[1],\n z = v[2];\n var a00, a01, a02, a03;\n var a10, a11, a12, a13;\n var a20, a21, a22, a23;\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n } else {\n a00 = a[0];\n a01 = a[1];\n a02 = a[2];\n a03 = a[3];\n a10 = a[4];\n a11 = a[5];\n a12 = a[6];\n a13 = a[7];\n a20 = a[8];\n a21 = a[9];\n a22 = a[10];\n a23 = a[11];\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n out[3] = a03;\n out[4] = a10;\n out[5] = a11;\n out[6] = a12;\n out[7] = a13;\n out[8] = a20;\n out[9] = a21;\n out[10] = a22;\n out[11] = a23;\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n return out;\n}\n\n/**\n * Scales the mat4 by the dimensions in the given vec3 not using vectorization\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to scale\n * @param {ReadonlyVec3} v the vec3 to scale the matrix by\n * @returns {mat4} out\n **/\nexport function scale(out, a, v) {\n var x = v[0],\n y = v[1],\n z = v[2];\n out[0] = a[0] * x;\n out[1] = a[1] * x;\n out[2] = a[2] * x;\n out[3] = a[3] * x;\n out[4] = a[4] * y;\n out[5] = a[5] * y;\n out[6] = a[6] * y;\n out[7] = a[7] * y;\n out[8] = a[8] * z;\n out[9] = a[9] * z;\n out[10] = a[10] * z;\n out[11] = a[11] * z;\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n\n/**\n * Rotates a mat4 by the given angle around the given axis\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @param {ReadonlyVec3} axis the axis to rotate around\n * @returns {mat4} out\n */\nexport function rotate(out, a, rad, axis) {\n var x = axis[0],\n y = axis[1],\n z = axis[2];\n var len = Math.sqrt(x * x + y * y + z * z);\n var s, c, t;\n var a00, a01, a02, a03;\n var a10, a11, a12, a13;\n var a20, a21, a22, a23;\n var b00, b01, b02;\n var b10, b11, b12;\n var b20, b21, b22;\n if (len < glMatrix.EPSILON) {\n return null;\n }\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c;\n a00 = a[0];\n a01 = a[1];\n a02 = a[2];\n a03 = a[3];\n a10 = a[4];\n a11 = a[5];\n a12 = a[6];\n a13 = a[7];\n a20 = a[8];\n a21 = a[9];\n a22 = a[10];\n a23 = a[11];\n\n // Construct the elements of the rotation matrix\n b00 = x * x * t + c;\n b01 = y * x * t + z * s;\n b02 = z * x * t - y * s;\n b10 = x * y * t - z * s;\n b11 = y * y * t + c;\n b12 = z * y * t + x * s;\n b20 = x * z * t + y * s;\n b21 = y * z * t - x * s;\n b22 = z * z * t + c;\n\n // Perform rotation-specific matrix multiplication\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\n if (a !== out) {\n // If the source and destination differ, copy the unchanged last row\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n return out;\n}\n\n/**\n * Rotates a matrix by the given angle around the X axis\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nexport function rotateX(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a10 = a[4];\n var a11 = a[5];\n var a12 = a[6];\n var a13 = a[7];\n var a20 = a[8];\n var a21 = a[9];\n var a22 = a[10];\n var a23 = a[11];\n if (a !== out) {\n // If the source and destination differ, copy the unchanged rows\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n\n // Perform axis-specific matrix multiplication\n out[4] = a10 * c + a20 * s;\n out[5] = a11 * c + a21 * s;\n out[6] = a12 * c + a22 * s;\n out[7] = a13 * c + a23 * s;\n out[8] = a20 * c - a10 * s;\n out[9] = a21 * c - a11 * s;\n out[10] = a22 * c - a12 * s;\n out[11] = a23 * c - a13 * s;\n return out;\n}\n\n/**\n * Rotates a matrix by the given angle around the Y axis\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nexport function rotateY(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a00 = a[0];\n var a01 = a[1];\n var a02 = a[2];\n var a03 = a[3];\n var a20 = a[8];\n var a21 = a[9];\n var a22 = a[10];\n var a23 = a[11];\n if (a !== out) {\n // If the source and destination differ, copy the unchanged rows\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n\n // Perform axis-specific matrix multiplication\n out[0] = a00 * c - a20 * s;\n out[1] = a01 * c - a21 * s;\n out[2] = a02 * c - a22 * s;\n out[3] = a03 * c - a23 * s;\n out[8] = a00 * s + a20 * c;\n out[9] = a01 * s + a21 * c;\n out[10] = a02 * s + a22 * c;\n out[11] = a03 * s + a23 * c;\n return out;\n}\n\n/**\n * Rotates a matrix by the given angle around the Z axis\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nexport function rotateZ(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a00 = a[0];\n var a01 = a[1];\n var a02 = a[2];\n var a03 = a[3];\n var a10 = a[4];\n var a11 = a[5];\n var a12 = a[6];\n var a13 = a[7];\n if (a !== out) {\n // If the source and destination differ, copy the unchanged last row\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n\n // Perform axis-specific matrix multiplication\n out[0] = a00 * c + a10 * s;\n out[1] = a01 * c + a11 * s;\n out[2] = a02 * c + a12 * s;\n out[3] = a03 * c + a13 * s;\n out[4] = a10 * c - a00 * s;\n out[5] = a11 * c - a01 * s;\n out[6] = a12 * c - a02 * s;\n out[7] = a13 * c - a03 * s;\n return out;\n}\n\n/**\n * Creates a matrix from a vector translation\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, dest, vec);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {ReadonlyVec3} v Translation vector\n * @returns {mat4} out\n */\nexport function fromTranslation(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n\n/**\n * Creates a matrix from a vector scaling\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.scale(dest, dest, vec);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {ReadonlyVec3} v Scaling vector\n * @returns {mat4} out\n */\nexport function fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = v[1];\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = v[2];\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n\n/**\n * Creates a matrix from a given angle around a given axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotate(dest, dest, rad, axis);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @param {ReadonlyVec3} axis the axis to rotate around\n * @returns {mat4} out\n */\nexport function fromRotation(out, rad, axis) {\n var x = axis[0],\n y = axis[1],\n z = axis[2];\n var len = Math.sqrt(x * x + y * y + z * z);\n var s, c, t;\n if (len < glMatrix.EPSILON) {\n return null;\n }\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c;\n\n // Perform rotation-specific matrix multiplication\n out[0] = x * x * t + c;\n out[1] = y * x * t + z * s;\n out[2] = z * x * t - y * s;\n out[3] = 0;\n out[4] = x * y * t - z * s;\n out[5] = y * y * t + c;\n out[6] = z * y * t + x * s;\n out[7] = 0;\n out[8] = x * z * t + y * s;\n out[9] = y * z * t - x * s;\n out[10] = z * z * t + c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n\n/**\n * Creates a matrix from the given angle around the X axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotateX(dest, dest, rad);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nexport function fromXRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n\n // Perform axis-specific matrix multiplication\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = c;\n out[6] = s;\n out[7] = 0;\n out[8] = 0;\n out[9] = -s;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n\n/**\n * Creates a matrix from the given angle around the Y axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotateY(dest, dest, rad);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nexport function fromYRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n\n // Perform axis-specific matrix multiplication\n out[0] = c;\n out[1] = 0;\n out[2] = -s;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = s;\n out[9] = 0;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n\n/**\n * Creates a matrix from the given angle around the Z axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotateZ(dest, dest, rad);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nexport function fromZRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n\n // Perform axis-specific matrix multiplication\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = 0;\n out[4] = -s;\n out[5] = c;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n\n/**\n * Creates a matrix from a quaternion rotation and vector translation\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, dest, vec);\n * let quatMat = mat4.create();\n * mat4.fromQuat(quatMat, quat);\n * mat4.multiply(dest, dest, quatMat);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {quat} q Rotation quaternion\n * @param {ReadonlyVec3} v Translation vector\n * @returns {mat4} out\n */\nexport function fromRotationTranslation(out, q, v) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n out[0] = 1 - (yy + zz);\n out[1] = xy + wz;\n out[2] = xz - wy;\n out[3] = 0;\n out[4] = xy - wz;\n out[5] = 1 - (xx + zz);\n out[6] = yz + wx;\n out[7] = 0;\n out[8] = xz + wy;\n out[9] = yz - wx;\n out[10] = 1 - (xx + yy);\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n\n/**\n * Creates a new mat4 from a dual quat.\n *\n * @param {mat4} out Matrix\n * @param {ReadonlyQuat2} a Dual Quaternion\n * @returns {mat4} mat4 receiving operation result\n */\nexport function fromQuat2(out, a) {\n var translation = new glMatrix.ARRAY_TYPE(3);\n var bx = -a[0],\n by = -a[1],\n bz = -a[2],\n bw = a[3],\n ax = a[4],\n ay = a[5],\n az = a[6],\n aw = a[7];\n var magnitude = bx * bx + by * by + bz * bz + bw * bw;\n //Only scale if it makes sense\n if (magnitude > 0) {\n translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude;\n translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude;\n translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2 / magnitude;\n } else {\n translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\n translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\n translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\n }\n fromRotationTranslation(out, a, translation);\n return out;\n}\n\n/**\n * Returns the translation vector component of a transformation\n * matrix. If a matrix is built with fromRotationTranslation,\n * the returned vector will be the same as the translation vector\n * originally supplied.\n * @param {vec3} out Vector to receive translation component\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\n * @return {vec3} out\n */\nexport function getTranslation(out, mat) {\n out[0] = mat[12];\n out[1] = mat[13];\n out[2] = mat[14];\n return out;\n}\n\n/**\n * Returns the scaling factor component of a transformation\n * matrix. If a matrix is built with fromRotationTranslationScale\n * with a normalized Quaternion parameter, the returned vector will be\n * the same as the scaling vector\n * originally supplied.\n * @param {vec3} out Vector to receive scaling factor component\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\n * @return {vec3} out\n */\nexport function getScaling(out, mat) {\n var m11 = mat[0];\n var m12 = mat[1];\n var m13 = mat[2];\n var m21 = mat[4];\n var m22 = mat[5];\n var m23 = mat[6];\n var m31 = mat[8];\n var m32 = mat[9];\n var m33 = mat[10];\n out[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\n out[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\n out[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\n return out;\n}\n\n/**\n * Returns a quaternion representing the rotational component\n * of a transformation matrix. If a matrix is built with\n * fromRotationTranslation, the returned quaternion will be the\n * same as the quaternion originally supplied.\n * @param {quat} out Quaternion to receive the rotation component\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\n * @return {quat} out\n */\nexport function getRotation(out, mat) {\n var scaling = new glMatrix.ARRAY_TYPE(3);\n getScaling(scaling, mat);\n var is1 = 1 / scaling[0];\n var is2 = 1 / scaling[1];\n var is3 = 1 / scaling[2];\n var sm11 = mat[0] * is1;\n var sm12 = mat[1] * is2;\n var sm13 = mat[2] * is3;\n var sm21 = mat[4] * is1;\n var sm22 = mat[5] * is2;\n var sm23 = mat[6] * is3;\n var sm31 = mat[8] * is1;\n var sm32 = mat[9] * is2;\n var sm33 = mat[10] * is3;\n var trace = sm11 + sm22 + sm33;\n var S = 0;\n if (trace > 0) {\n S = Math.sqrt(trace + 1.0) * 2;\n out[3] = 0.25 * S;\n out[0] = (sm23 - sm32) / S;\n out[1] = (sm31 - sm13) / S;\n out[2] = (sm12 - sm21) / S;\n } else if (sm11 > sm22 && sm11 > sm33) {\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\n out[3] = (sm23 - sm32) / S;\n out[0] = 0.25 * S;\n out[1] = (sm12 + sm21) / S;\n out[2] = (sm31 + sm13) / S;\n } else if (sm22 > sm33) {\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\n out[3] = (sm31 - sm13) / S;\n out[0] = (sm12 + sm21) / S;\n out[1] = 0.25 * S;\n out[2] = (sm23 + sm32) / S;\n } else {\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\n out[3] = (sm12 - sm21) / S;\n out[0] = (sm31 + sm13) / S;\n out[1] = (sm23 + sm32) / S;\n out[2] = 0.25 * S;\n }\n return out;\n}\n\n/**\n * Decomposes a transformation matrix into its rotation, translation\n * and scale components. Returns only the rotation component\n * @param {quat} out_r Quaternion to receive the rotation component\n * @param {vec3} out_t Vector to receive the translation vector\n * @param {vec3} out_s Vector to receive the scaling factor\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\n * @returns {quat} out_r\n */\nexport function decompose(out_r, out_t, out_s, mat) {\n out_t[0] = mat[12];\n out_t[1] = mat[13];\n out_t[2] = mat[14];\n var m11 = mat[0];\n var m12 = mat[1];\n var m13 = mat[2];\n var m21 = mat[4];\n var m22 = mat[5];\n var m23 = mat[6];\n var m31 = mat[8];\n var m32 = mat[9];\n var m33 = mat[10];\n out_s[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\n out_s[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\n out_s[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\n var is1 = 1 / out_s[0];\n var is2 = 1 / out_s[1];\n var is3 = 1 / out_s[2];\n var sm11 = m11 * is1;\n var sm12 = m12 * is2;\n var sm13 = m13 * is3;\n var sm21 = m21 * is1;\n var sm22 = m22 * is2;\n var sm23 = m23 * is3;\n var sm31 = m31 * is1;\n var sm32 = m32 * is2;\n var sm33 = m33 * is3;\n var trace = sm11 + sm22 + sm33;\n var S = 0;\n if (trace > 0) {\n S = Math.sqrt(trace + 1.0) * 2;\n out_r[3] = 0.25 * S;\n out_r[0] = (sm23 - sm32) / S;\n out_r[1] = (sm31 - sm13) / S;\n out_r[2] = (sm12 - sm21) / S;\n } else if (sm11 > sm22 && sm11 > sm33) {\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\n out_r[3] = (sm23 - sm32) / S;\n out_r[0] = 0.25 * S;\n out_r[1] = (sm12 + sm21) / S;\n out_r[2] = (sm31 + sm13) / S;\n } else if (sm22 > sm33) {\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\n out_r[3] = (sm31 - sm13) / S;\n out_r[0] = (sm12 + sm21) / S;\n out_r[1] = 0.25 * S;\n out_r[2] = (sm23 + sm32) / S;\n } else {\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\n out_r[3] = (sm12 - sm21) / S;\n out_r[0] = (sm31 + sm13) / S;\n out_r[1] = (sm23 + sm32) / S;\n out_r[2] = 0.25 * S;\n }\n return out_r;\n}\n\n/**\n * Creates a matrix from a quaternion rotation, vector translation and vector scale\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, dest, vec);\n * let quatMat = mat4.create();\n * mat4.fromQuat(quatMat, quat);\n * mat4.multiply(dest, dest, quatMat);\n * mat4.scale(dest, dest, scale)\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {quat} q Rotation quaternion\n * @param {ReadonlyVec3} v Translation vector\n * @param {ReadonlyVec3} s Scaling vector\n * @returns {mat4} out\n */\nexport function fromRotationTranslationScale(out, q, v, s) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n var sx = s[0];\n var sy = s[1];\n var sz = s[2];\n out[0] = (1 - (yy + zz)) * sx;\n out[1] = (xy + wz) * sx;\n out[2] = (xz - wy) * sx;\n out[3] = 0;\n out[4] = (xy - wz) * sy;\n out[5] = (1 - (xx + zz)) * sy;\n out[6] = (yz + wx) * sy;\n out[7] = 0;\n out[8] = (xz + wy) * sz;\n out[9] = (yz - wx) * sz;\n out[10] = (1 - (xx + yy)) * sz;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n\n/**\n * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, dest, vec);\n * mat4.translate(dest, dest, origin);\n * let quatMat = mat4.create();\n * mat4.fromQuat(quatMat, quat);\n * mat4.multiply(dest, dest, quatMat);\n * mat4.scale(dest, dest, scale)\n * mat4.translate(dest, dest, negativeOrigin);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {quat} q Rotation quaternion\n * @param {ReadonlyVec3} v Translation vector\n * @param {ReadonlyVec3} s Scaling vector\n * @param {ReadonlyVec3} o The origin vector around which to scale and rotate\n * @returns {mat4} out\n */\nexport function fromRotationTranslationScaleOrigin(out, q, v, s, o) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n var sx = s[0];\n var sy = s[1];\n var sz = s[2];\n var ox = o[0];\n var oy = o[1];\n var oz = o[2];\n var out0 = (1 - (yy + zz)) * sx;\n var out1 = (xy + wz) * sx;\n var out2 = (xz - wy) * sx;\n var out4 = (xy - wz) * sy;\n var out5 = (1 - (xx + zz)) * sy;\n var out6 = (yz + wx) * sy;\n var out8 = (xz + wy) * sz;\n var out9 = (yz - wx) * sz;\n var out10 = (1 - (xx + yy)) * sz;\n out[0] = out0;\n out[1] = out1;\n out[2] = out2;\n out[3] = 0;\n out[4] = out4;\n out[5] = out5;\n out[6] = out6;\n out[7] = 0;\n out[8] = out8;\n out[9] = out9;\n out[10] = out10;\n out[11] = 0;\n out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz);\n out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz);\n out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz);\n out[15] = 1;\n return out;\n}\n\n/**\n * Calculates a 4x4 matrix from the given quaternion\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {ReadonlyQuat} q Quaternion to create matrix from\n *\n * @returns {mat4} out\n */\nexport function fromQuat(out, q) {\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var yx = y * x2;\n var yy = y * y2;\n var zx = z * x2;\n var zy = z * y2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n out[0] = 1 - yy - zz;\n out[1] = yx + wz;\n out[2] = zx - wy;\n out[3] = 0;\n out[4] = yx - wz;\n out[5] = 1 - xx - zz;\n out[6] = zy + wx;\n out[7] = 0;\n out[8] = zx + wy;\n out[9] = zy - wx;\n out[10] = 1 - xx - yy;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n\n/**\n * Generates a frustum matrix with the given bounds\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {Number} left Left bound of the frustum\n * @param {Number} right Right bound of the frustum\n * @param {Number} bottom Bottom bound of the frustum\n * @param {Number} top Top bound of the frustum\n * @param {Number} near Near bound of the frustum\n * @param {Number} far Far bound of the frustum\n * @returns {mat4} out\n */\nexport function frustum(out, left, right, bottom, top, near, far) {\n var rl = 1 / (right - left);\n var tb = 1 / (top - bottom);\n var nf = 1 / (near - far);\n out[0] = near * 2 * rl;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = near * 2 * tb;\n out[6] = 0;\n out[7] = 0;\n out[8] = (right + left) * rl;\n out[9] = (top + bottom) * tb;\n out[10] = (far + near) * nf;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[14] = far * near * 2 * nf;\n out[15] = 0;\n return out;\n}\n\n/**\n * Generates a perspective projection matrix with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\n * which matches WebGL/OpenGL's clip volume.\n * Passing null/undefined/no value for far will generate infinite projection matrix.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} fovy Vertical field of view in radians\n * @param {number} aspect Aspect ratio. typically viewport width/height\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum, can be null or Infinity\n * @returns {mat4} out\n */\nexport function perspectiveNO(out, fovy, aspect, near, far) {\n var f = 1.0 / Math.tan(fovy / 2);\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[15] = 0;\n if (far != null && far !== Infinity) {\n var nf = 1 / (near - far);\n out[10] = (far + near) * nf;\n out[14] = 2 * far * near * nf;\n } else {\n out[10] = -1;\n out[14] = -2 * near;\n }\n return out;\n}\n\n/**\n * Alias for {@link mat4.perspectiveNO}\n * @function\n */\nexport var perspective = perspectiveNO;\n\n/**\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\n * Passing null/undefined/no value for far will generate infinite projection matrix.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} fovy Vertical field of view in radians\n * @param {number} aspect Aspect ratio. typically viewport width/height\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum, can be null or Infinity\n * @returns {mat4} out\n */\nexport function perspectiveZO(out, fovy, aspect, near, far) {\n var f = 1.0 / Math.tan(fovy / 2);\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[15] = 0;\n if (far != null && far !== Infinity) {\n var nf = 1 / (near - far);\n out[10] = far * nf;\n out[14] = far * near * nf;\n } else {\n out[10] = -1;\n out[14] = -near;\n }\n return out;\n}\n\n/**\n * Generates a perspective projection matrix with the given field of view.\n * This is primarily useful for generating projection matrices to be used\n * with the still experiemental WebVR API.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {Object} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\nexport function perspectiveFromFieldOfView(out, fov, near, far) {\n var upTan = Math.tan(fov.upDegrees * Math.PI / 180.0);\n var downTan = Math.tan(fov.downDegrees * Math.PI / 180.0);\n var leftTan = Math.tan(fov.leftDegrees * Math.PI / 180.0);\n var rightTan = Math.tan(fov.rightDegrees * Math.PI / 180.0);\n var xScale = 2.0 / (leftTan + rightTan);\n var yScale = 2.0 / (upTan + downTan);\n out[0] = xScale;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n out[4] = 0.0;\n out[5] = yScale;\n out[6] = 0.0;\n out[7] = 0.0;\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\n out[9] = (upTan - downTan) * yScale * 0.5;\n out[10] = far / (near - far);\n out[11] = -1.0;\n out[12] = 0.0;\n out[13] = 0.0;\n out[14] = far * near / (near - far);\n out[15] = 0.0;\n return out;\n}\n\n/**\n * Generates a orthogonal projection matrix with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\n * which matches WebGL/OpenGL's clip volume.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} left Left bound of the frustum\n * @param {number} right Right bound of the frustum\n * @param {number} bottom Bottom bound of the frustum\n * @param {number} top Top bound of the frustum\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\nexport function orthoNO(out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right);\n var bt = 1 / (bottom - top);\n var nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n}\n\n/**\n * Alias for {@link mat4.orthoNO}\n * @function\n */\nexport var ortho = orthoNO;\n\n/**\n * Generates a orthogonal projection matrix with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} left Left bound of the frustum\n * @param {number} right Right bound of the frustum\n * @param {number} bottom Bottom bound of the frustum\n * @param {number} top Top bound of the frustum\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\nexport function orthoZO(out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right);\n var bt = 1 / (bottom - top);\n var nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = near * nf;\n out[15] = 1;\n return out;\n}\n\n/**\n * Generates a look-at matrix with the given eye position, focal point, and up axis.\n * If you want a matrix that actually makes an object look at another object, you should use targetTo instead.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {ReadonlyVec3} eye Position of the viewer\n * @param {ReadonlyVec3} center Point the viewer is looking at\n * @param {ReadonlyVec3} up vec3 pointing up\n * @returns {mat4} out\n */\nexport function lookAt(out, eye, center, up) {\n var x0, x1, x2, y0, y1, y2, z0, z1, z2, len;\n var eyex = eye[0];\n var eyey = eye[1];\n var eyez = eye[2];\n var upx = up[0];\n var upy = up[1];\n var upz = up[2];\n var centerx = center[0];\n var centery = center[1];\n var centerz = center[2];\n if (Math.abs(eyex - centerx) < glMatrix.EPSILON && Math.abs(eyey - centery) < glMatrix.EPSILON && Math.abs(eyez - centerz) < glMatrix.EPSILON) {\n return identity(out);\n }\n z0 = eyex - centerx;\n z1 = eyey - centery;\n z2 = eyez - centerz;\n len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n x0 = upy * z2 - upz * z1;\n x1 = upz * z0 - upx * z2;\n x2 = upx * z1 - upy * z0;\n len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);\n if (!len) {\n x0 = 0;\n x1 = 0;\n x2 = 0;\n } else {\n len = 1 / len;\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n y0 = z1 * x2 - z2 * x1;\n y1 = z2 * x0 - z0 * x2;\n y2 = z0 * x1 - z1 * x0;\n len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);\n if (!len) {\n y0 = 0;\n y1 = 0;\n y2 = 0;\n } else {\n len = 1 / len;\n y0 *= len;\n y1 *= len;\n y2 *= len;\n }\n out[0] = x0;\n out[1] = y0;\n out[2] = z0;\n out[3] = 0;\n out[4] = x1;\n out[5] = y1;\n out[6] = z1;\n out[7] = 0;\n out[8] = x2;\n out[9] = y2;\n out[10] = z2;\n out[11] = 0;\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\n out[15] = 1;\n return out;\n}\n\n/**\n * Generates a matrix that makes something look at something else.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {ReadonlyVec3} eye Position of the viewer\n * @param {ReadonlyVec3} target Point the viewer is looking at\n * @param {ReadonlyVec3} up vec3 pointing up\n * @returns {mat4} out\n */\nexport function targetTo(out, eye, target, up) {\n var eyex = eye[0],\n eyey = eye[1],\n eyez = eye[2],\n upx = up[0],\n upy = up[1],\n upz = up[2];\n var z0 = eyex - target[0],\n z1 = eyey - target[1],\n z2 = eyez - target[2];\n var len = z0 * z0 + z1 * z1 + z2 * z2;\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n }\n var x0 = upy * z2 - upz * z1,\n x1 = upz * z0 - upx * z2,\n x2 = upx * z1 - upy * z0;\n len = x0 * x0 + x1 * x1 + x2 * x2;\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n out[0] = x0;\n out[1] = x1;\n out[2] = x2;\n out[3] = 0;\n out[4] = z1 * x2 - z2 * x1;\n out[5] = z2 * x0 - z0 * x2;\n out[6] = z0 * x1 - z1 * x0;\n out[7] = 0;\n out[8] = z0;\n out[9] = z1;\n out[10] = z2;\n out[11] = 0;\n out[12] = eyex;\n out[13] = eyey;\n out[14] = eyez;\n out[15] = 1;\n return out;\n}\n\n/**\n * Returns a string representation of a mat4\n *\n * @param {ReadonlyMat4} a matrix to represent as a string\n * @returns {String} string representation of the matrix\n */\nexport function str(a) {\n return \"mat4(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \", \" + a[3] + \", \" + a[4] + \", \" + a[5] + \", \" + a[6] + \", \" + a[7] + \", \" + a[8] + \", \" + a[9] + \", \" + a[10] + \", \" + a[11] + \", \" + a[12] + \", \" + a[13] + \", \" + a[14] + \", \" + a[15] + \")\";\n}\n\n/**\n * Returns Frobenius norm of a mat4\n *\n * @param {ReadonlyMat4} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\nexport function frob(a) {\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + a[6] * a[6] + a[7] * a[7] + a[8] * a[8] + a[9] * a[9] + a[10] * a[10] + a[11] * a[11] + a[12] * a[12] + a[13] * a[13] + a[14] * a[14] + a[15] * a[15]);\n}\n\n/**\n * Adds two mat4's\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the first operand\n * @param {ReadonlyMat4} b the second operand\n * @returns {mat4} out\n */\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n out[8] = a[8] + b[8];\n out[9] = a[9] + b[9];\n out[10] = a[10] + b[10];\n out[11] = a[11] + b[11];\n out[12] = a[12] + b[12];\n out[13] = a[13] + b[13];\n out[14] = a[14] + b[14];\n out[15] = a[15] + b[15];\n return out;\n}\n\n/**\n * Subtracts matrix b from matrix a\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the first operand\n * @param {ReadonlyMat4} b the second operand\n * @returns {mat4} out\n */\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n out[6] = a[6] - b[6];\n out[7] = a[7] - b[7];\n out[8] = a[8] - b[8];\n out[9] = a[9] - b[9];\n out[10] = a[10] - b[10];\n out[11] = a[11] - b[11];\n out[12] = a[12] - b[12];\n out[13] = a[13] - b[13];\n out[14] = a[14] - b[14];\n out[15] = a[15] - b[15];\n return out;\n}\n\n/**\n * Multiply each element of the matrix by a scalar.\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to scale\n * @param {Number} b amount to scale the matrix's elements by\n * @returns {mat4} out\n */\nexport function multiplyScalar(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n out[8] = a[8] * b;\n out[9] = a[9] * b;\n out[10] = a[10] * b;\n out[11] = a[11] * b;\n out[12] = a[12] * b;\n out[13] = a[13] * b;\n out[14] = a[14] * b;\n out[15] = a[15] * b;\n return out;\n}\n\n/**\n * Adds two mat4's after multiplying each element of the second operand by a scalar value.\n *\n * @param {mat4} out the receiving vector\n * @param {ReadonlyMat4} a the first operand\n * @param {ReadonlyMat4} b the second operand\n * @param {Number} scale the amount to scale b's elements by before adding\n * @returns {mat4} out\n */\nexport function multiplyScalarAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\n out[6] = a[6] + b[6] * scale;\n out[7] = a[7] + b[7] * scale;\n out[8] = a[8] + b[8] * scale;\n out[9] = a[9] + b[9] * scale;\n out[10] = a[10] + b[10] * scale;\n out[11] = a[11] + b[11] * scale;\n out[12] = a[12] + b[12] * scale;\n out[13] = a[13] + b[13] * scale;\n out[14] = a[14] + b[14] * scale;\n out[15] = a[15] + b[15] * scale;\n return out;\n}\n\n/**\n * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)\n *\n * @param {ReadonlyMat4} a The first matrix.\n * @param {ReadonlyMat4} b The second matrix.\n * @returns {Boolean} True if the matrices are equal, false otherwise.\n */\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8] && a[9] === b[9] && a[10] === b[10] && a[11] === b[11] && a[12] === b[12] && a[13] === b[13] && a[14] === b[14] && a[15] === b[15];\n}\n\n/**\n * Returns whether or not the matrices have approximately the same elements in the same position.\n *\n * @param {ReadonlyMat4} a The first matrix.\n * @param {ReadonlyMat4} b The second matrix.\n * @returns {Boolean} True if the matrices are equal, false otherwise.\n */\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var a4 = a[4],\n a5 = a[5],\n a6 = a[6],\n a7 = a[7];\n var a8 = a[8],\n a9 = a[9],\n a10 = a[10],\n a11 = a[11];\n var a12 = a[12],\n a13 = a[13],\n a14 = a[14],\n a15 = a[15];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n var b4 = b[4],\n b5 = b[5],\n b6 = b[6],\n b7 = b[7];\n var b8 = b[8],\n b9 = b[9],\n b10 = b[10],\n b11 = b[11];\n var b12 = b[12],\n b13 = b[13],\n b14 = b[14],\n b15 = b[15];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a15), Math.abs(b15));\n}\n\n/**\n * Alias for {@link mat4.multiply}\n * @function\n */\nexport var mul = multiply;\n\n/**\n * Alias for {@link mat4.subtract}\n * @function\n */\nexport var sub = subtract;","import * as glMatrix from \"./common.js\";\n\n/**\n * 3 Dimensional Vector\n * @module vec3\n */\n\n/**\n * Creates a new, empty vec3\n *\n * @returns {vec3} a new 3D vector\n */\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(3);\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n }\n return out;\n}\n\n/**\n * Creates a new vec3 initialized with values from an existing vector\n *\n * @param {ReadonlyVec3} a vector to clone\n * @returns {vec3} a new 3D vector\n */\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(3);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n}\n\n/**\n * Calculates the length of a vec3\n *\n * @param {ReadonlyVec3} a vector to calculate length of\n * @returns {Number} length of a\n */\nexport function length(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n return Math.sqrt(x * x + y * y + z * z);\n}\n\n/**\n * Creates a new vec3 initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @returns {vec3} a new 3D vector\n */\nexport function fromValues(x, y, z) {\n var out = new glMatrix.ARRAY_TYPE(3);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n}\n\n/**\n * Copy the values from one vec3 to another\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the source vector\n * @returns {vec3} out\n */\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n}\n\n/**\n * Set the components of a vec3 to the given values\n *\n * @param {vec3} out the receiving vector\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @returns {vec3} out\n */\nexport function set(out, x, y, z) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n}\n\n/**\n * Adds two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n return out;\n}\n\n/**\n * Subtracts vector b from vector a\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n return out;\n}\n\n/**\n * Multiplies two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\nexport function multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n return out;\n}\n\n/**\n * Divides two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\nexport function divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n return out;\n}\n\n/**\n * Math.ceil the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to ceil\n * @returns {vec3} out\n */\nexport function ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n out[2] = Math.ceil(a[2]);\n return out;\n}\n\n/**\n * Math.floor the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to floor\n * @returns {vec3} out\n */\nexport function floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n out[2] = Math.floor(a[2]);\n return out;\n}\n\n/**\n * Returns the minimum of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\nexport function min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n return out;\n}\n\n/**\n * Returns the maximum of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\nexport function max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n return out;\n}\n\n/**\n * symmetric round the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to round\n * @returns {vec3} out\n */\nexport function round(out, a) {\n out[0] = glMatrix.round(a[0]);\n out[1] = glMatrix.round(a[1]);\n out[2] = glMatrix.round(a[2]);\n return out;\n}\n\n/**\n * Scales a vec3 by a scalar number\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {vec3} out\n */\nexport function scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n return out;\n}\n\n/**\n * Adds two vec3's after scaling the second operand by a scalar value\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @param {Number} scale the amount to scale b by before adding\n * @returns {vec3} out\n */\nexport function scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n return out;\n}\n\n/**\n * Calculates the euclidian distance between two vec3's\n *\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {Number} distance between a and b\n */\nexport function distance(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n return Math.sqrt(x * x + y * y + z * z);\n}\n\n/**\n * Calculates the squared euclidian distance between two vec3's\n *\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {Number} squared distance between a and b\n */\nexport function squaredDistance(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n return x * x + y * y + z * z;\n}\n\n/**\n * Calculates the squared length of a vec3\n *\n * @param {ReadonlyVec3} a vector to calculate squared length of\n * @returns {Number} squared length of a\n */\nexport function squaredLength(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n return x * x + y * y + z * z;\n}\n\n/**\n * Negates the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to negate\n * @returns {vec3} out\n */\nexport function negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n return out;\n}\n\n/**\n * Returns the inverse of the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to invert\n * @returns {vec3} out\n */\nexport function inverse(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n return out;\n}\n\n/**\n * Normalize a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to normalize\n * @returns {vec3} out\n */\nexport function normalize(out, a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var len = x * x + y * y + z * z;\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n }\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n out[2] = a[2] * len;\n return out;\n}\n\n/**\n * Calculates the dot product of two vec3's\n *\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {Number} dot product of a and b\n */\nexport function dot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n}\n\n/**\n * Computes the cross product of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\nexport function cross(out, a, b) {\n var ax = a[0],\n ay = a[1],\n az = a[2];\n var bx = b[0],\n by = b[1],\n bz = b[2];\n out[0] = ay * bz - az * by;\n out[1] = az * bx - ax * bz;\n out[2] = ax * by - ay * bx;\n return out;\n}\n\n/**\n * Performs a linear interpolation between two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {vec3} out\n */\nexport function lerp(out, a, b, t) {\n var ax = a[0];\n var ay = a[1];\n var az = a[2];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n return out;\n}\n\n/**\n * Performs a spherical linear interpolation between two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {vec3} out\n */\nexport function slerp(out, a, b, t) {\n var angle = Math.acos(Math.min(Math.max(dot(a, b), -1), 1));\n var sinTotal = Math.sin(angle);\n var ratioA = Math.sin((1 - t) * angle) / sinTotal;\n var ratioB = Math.sin(t * angle) / sinTotal;\n out[0] = ratioA * a[0] + ratioB * b[0];\n out[1] = ratioA * a[1] + ratioB * b[1];\n out[2] = ratioA * a[2] + ratioB * b[2];\n return out;\n}\n\n/**\n * Performs a hermite interpolation with two control points\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @param {ReadonlyVec3} c the third operand\n * @param {ReadonlyVec3} d the fourth operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {vec3} out\n */\nexport function hermite(out, a, b, c, d, t) {\n var factorTimes2 = t * t;\n var factor1 = factorTimes2 * (2 * t - 3) + 1;\n var factor2 = factorTimes2 * (t - 2) + t;\n var factor3 = factorTimes2 * (t - 1);\n var factor4 = factorTimes2 * (3 - 2 * t);\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n return out;\n}\n\n/**\n * Performs a bezier interpolation with two control points\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @param {ReadonlyVec3} c the third operand\n * @param {ReadonlyVec3} d the fourth operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {vec3} out\n */\nexport function bezier(out, a, b, c, d, t) {\n var inverseFactor = 1 - t;\n var inverseFactorTimesTwo = inverseFactor * inverseFactor;\n var factorTimes2 = t * t;\n var factor1 = inverseFactorTimesTwo * inverseFactor;\n var factor2 = 3 * t * inverseFactorTimesTwo;\n var factor3 = 3 * factorTimes2 * inverseFactor;\n var factor4 = factorTimes2 * t;\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n return out;\n}\n\n/**\n * Generates a random vector with the given scale\n *\n * @param {vec3} out the receiving vector\n * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned\n * @returns {vec3} out\n */\nexport function random(out, scale) {\n scale = scale === undefined ? 1.0 : scale;\n var r = glMatrix.RANDOM() * 2.0 * Math.PI;\n var z = glMatrix.RANDOM() * 2.0 - 1.0;\n var zScale = Math.sqrt(1.0 - z * z) * scale;\n out[0] = Math.cos(r) * zScale;\n out[1] = Math.sin(r) * zScale;\n out[2] = z * scale;\n return out;\n}\n\n/**\n * Transforms the vec3 with a mat4.\n * 4th vector component is implicitly '1'\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the vector to transform\n * @param {ReadonlyMat4} m matrix to transform with\n * @returns {vec3} out\n */\nexport function transformMat4(out, a, m) {\n var x = a[0],\n y = a[1],\n z = a[2];\n var w = m[3] * x + m[7] * y + m[11] * z + m[15];\n w = w || 1.0;\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n return out;\n}\n\n/**\n * Transforms the vec3 with a mat3.\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the vector to transform\n * @param {ReadonlyMat3} m the 3x3 matrix to transform with\n * @returns {vec3} out\n */\nexport function transformMat3(out, a, m) {\n var x = a[0],\n y = a[1],\n z = a[2];\n out[0] = x * m[0] + y * m[3] + z * m[6];\n out[1] = x * m[1] + y * m[4] + z * m[7];\n out[2] = x * m[2] + y * m[5] + z * m[8];\n return out;\n}\n\n/**\n * Transforms the vec3 with a quat\n * Can also be used for dual quaternions. (Multiply it with the real part)\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the vector to transform\n * @param {ReadonlyQuat} q normalized quaternion to transform with\n * @returns {vec3} out\n */\nexport function transformQuat(out, a, q) {\n // Fast Vector Rotation using Quaternions by Robert Eisele\n // https://raw.org/proof/vector-rotation-using-quaternions/\n\n var qx = q[0],\n qy = q[1],\n qz = q[2],\n qw = q[3];\n var vx = a[0],\n vy = a[1],\n vz = a[2];\n\n // t = q x v\n var tx = qy * vz - qz * vy;\n var ty = qz * vx - qx * vz;\n var tz = qx * vy - qy * vx;\n\n // t = 2t\n tx = tx + tx;\n ty = ty + ty;\n tz = tz + tz;\n\n // v + w t + q x t\n out[0] = vx + qw * tx + qy * tz - qz * ty;\n out[1] = vy + qw * ty + qz * tx - qx * tz;\n out[2] = vz + qw * tz + qx * ty - qy * tx;\n return out;\n}\n\n/**\n * Rotate a 3D vector around the x-axis\n * @param {vec3} out The receiving vec3\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @returns {vec3} out\n */\nexport function rotateX(out, a, b, rad) {\n var p = [],\n r = [];\n //Translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n //perform rotation\n r[0] = p[0];\n r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad);\n r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad);\n\n //translate to correct position\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n\n/**\n * Rotate a 3D vector around the y-axis\n * @param {vec3} out The receiving vec3\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @returns {vec3} out\n */\nexport function rotateY(out, a, b, rad) {\n var p = [],\n r = [];\n //Translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n //perform rotation\n r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad);\n r[1] = p[1];\n r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad);\n\n //translate to correct position\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n\n/**\n * Rotate a 3D vector around the z-axis\n * @param {vec3} out The receiving vec3\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @returns {vec3} out\n */\nexport function rotateZ(out, a, b, rad) {\n var p = [],\n r = [];\n //Translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n //perform rotation\n r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad);\n r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad);\n r[2] = p[2];\n\n //translate to correct position\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n\n/**\n * Get the angle between two 3D vectors\n * @param {ReadonlyVec3} a The first operand\n * @param {ReadonlyVec3} b The second operand\n * @returns {Number} The angle in radians\n */\nexport function angle(a, b) {\n var ax = a[0],\n ay = a[1],\n az = a[2],\n bx = b[0],\n by = b[1],\n bz = b[2],\n mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz)),\n cosine = mag && dot(a, b) / mag;\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\n}\n\n/**\n * Set the components of a vec3 to zero\n *\n * @param {vec3} out the receiving vector\n * @returns {vec3} out\n */\nexport function zero(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n out[2] = 0.0;\n return out;\n}\n\n/**\n * Returns a string representation of a vector\n *\n * @param {ReadonlyVec3} a vector to represent as a string\n * @returns {String} string representation of the vector\n */\nexport function str(a) {\n return \"vec3(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \")\";\n}\n\n/**\n * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)\n *\n * @param {ReadonlyVec3} a The first vector.\n * @param {ReadonlyVec3} b The second vector.\n * @returns {Boolean} True if the vectors are equal, false otherwise.\n */\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n}\n\n/**\n * Returns whether or not the vectors have approximately the same elements in the same position.\n *\n * @param {ReadonlyVec3} a The first vector.\n * @param {ReadonlyVec3} b The second vector.\n * @returns {Boolean} True if the vectors are equal, false otherwise.\n */\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2));\n}\n\n/**\n * Alias for {@link vec3.subtract}\n * @function\n */\nexport var sub = subtract;\n\n/**\n * Alias for {@link vec3.multiply}\n * @function\n */\nexport var mul = multiply;\n\n/**\n * Alias for {@link vec3.divide}\n * @function\n */\nexport var div = divide;\n\n/**\n * Alias for {@link vec3.distance}\n * @function\n */\nexport var dist = distance;\n\n/**\n * Alias for {@link vec3.squaredDistance}\n * @function\n */\nexport var sqrDist = squaredDistance;\n\n/**\n * Alias for {@link vec3.length}\n * @function\n */\nexport var len = length;\n\n/**\n * Alias for {@link vec3.squaredLength}\n * @function\n */\nexport var sqrLen = squaredLength;\n\n/**\n * Perform some operation over an array of vec3s.\n *\n * @param {Array} a the array of vectors to iterate over\n * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed\n * @param {Number} offset Number of elements to skip at the beginning of the array\n * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array\n * @param {Function} fn Function to call for each vector in the array\n * @param {Object} [arg] additional argument to pass to fn\n * @returns {Array} a\n * @function\n */\nexport var forEach = function () {\n var vec = create();\n return function (a, stride, offset, count, fn, arg) {\n var i, l;\n if (!stride) {\n stride = 3;\n }\n if (!offset) {\n offset = 0;\n }\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n } else {\n l = a.length;\n }\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n vec[2] = a[i + 2];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n a[i + 2] = vec[2];\n }\n return a;\n };\n}();","'use strict'\r\n\r\nmodule.exports = {\r\n\t\"aliceblue\": [240, 248, 255],\r\n\t\"antiquewhite\": [250, 235, 215],\r\n\t\"aqua\": [0, 255, 255],\r\n\t\"aquamarine\": [127, 255, 212],\r\n\t\"azure\": [240, 255, 255],\r\n\t\"beige\": [245, 245, 220],\r\n\t\"bisque\": [255, 228, 196],\r\n\t\"black\": [0, 0, 0],\r\n\t\"blanchedalmond\": [255, 235, 205],\r\n\t\"blue\": [0, 0, 255],\r\n\t\"blueviolet\": [138, 43, 226],\r\n\t\"brown\": [165, 42, 42],\r\n\t\"burlywood\": [222, 184, 135],\r\n\t\"cadetblue\": [95, 158, 160],\r\n\t\"chartreuse\": [127, 255, 0],\r\n\t\"chocolate\": [210, 105, 30],\r\n\t\"coral\": [255, 127, 80],\r\n\t\"cornflowerblue\": [100, 149, 237],\r\n\t\"cornsilk\": [255, 248, 220],\r\n\t\"crimson\": [220, 20, 60],\r\n\t\"cyan\": [0, 255, 255],\r\n\t\"darkblue\": [0, 0, 139],\r\n\t\"darkcyan\": [0, 139, 139],\r\n\t\"darkgoldenrod\": [184, 134, 11],\r\n\t\"darkgray\": [169, 169, 169],\r\n\t\"darkgreen\": [0, 100, 0],\r\n\t\"darkgrey\": [169, 169, 169],\r\n\t\"darkkhaki\": [189, 183, 107],\r\n\t\"darkmagenta\": [139, 0, 139],\r\n\t\"darkolivegreen\": [85, 107, 47],\r\n\t\"darkorange\": [255, 140, 0],\r\n\t\"darkorchid\": [153, 50, 204],\r\n\t\"darkred\": [139, 0, 0],\r\n\t\"darksalmon\": [233, 150, 122],\r\n\t\"darkseagreen\": [143, 188, 143],\r\n\t\"darkslateblue\": [72, 61, 139],\r\n\t\"darkslategray\": [47, 79, 79],\r\n\t\"darkslategrey\": [47, 79, 79],\r\n\t\"darkturquoise\": [0, 206, 209],\r\n\t\"darkviolet\": [148, 0, 211],\r\n\t\"deeppink\": [255, 20, 147],\r\n\t\"deepskyblue\": [0, 191, 255],\r\n\t\"dimgray\": [105, 105, 105],\r\n\t\"dimgrey\": [105, 105, 105],\r\n\t\"dodgerblue\": [30, 144, 255],\r\n\t\"firebrick\": [178, 34, 34],\r\n\t\"floralwhite\": [255, 250, 240],\r\n\t\"forestgreen\": [34, 139, 34],\r\n\t\"fuchsia\": [255, 0, 255],\r\n\t\"gainsboro\": [220, 220, 220],\r\n\t\"ghostwhite\": [248, 248, 255],\r\n\t\"gold\": [255, 215, 0],\r\n\t\"goldenrod\": [218, 165, 32],\r\n\t\"gray\": [128, 128, 128],\r\n\t\"green\": [0, 128, 0],\r\n\t\"greenyellow\": [173, 255, 47],\r\n\t\"grey\": [128, 128, 128],\r\n\t\"honeydew\": [240, 255, 240],\r\n\t\"hotpink\": [255, 105, 180],\r\n\t\"indianred\": [205, 92, 92],\r\n\t\"indigo\": [75, 0, 130],\r\n\t\"ivory\": [255, 255, 240],\r\n\t\"khaki\": [240, 230, 140],\r\n\t\"lavender\": [230, 230, 250],\r\n\t\"lavenderblush\": [255, 240, 245],\r\n\t\"lawngreen\": [124, 252, 0],\r\n\t\"lemonchiffon\": [255, 250, 205],\r\n\t\"lightblue\": [173, 216, 230],\r\n\t\"lightcoral\": [240, 128, 128],\r\n\t\"lightcyan\": [224, 255, 255],\r\n\t\"lightgoldenrodyellow\": [250, 250, 210],\r\n\t\"lightgray\": [211, 211, 211],\r\n\t\"lightgreen\": [144, 238, 144],\r\n\t\"lightgrey\": [211, 211, 211],\r\n\t\"lightpink\": [255, 182, 193],\r\n\t\"lightsalmon\": [255, 160, 122],\r\n\t\"lightseagreen\": [32, 178, 170],\r\n\t\"lightskyblue\": [135, 206, 250],\r\n\t\"lightslategray\": [119, 136, 153],\r\n\t\"lightslategrey\": [119, 136, 153],\r\n\t\"lightsteelblue\": [176, 196, 222],\r\n\t\"lightyellow\": [255, 255, 224],\r\n\t\"lime\": [0, 255, 0],\r\n\t\"limegreen\": [50, 205, 50],\r\n\t\"linen\": [250, 240, 230],\r\n\t\"magenta\": [255, 0, 255],\r\n\t\"maroon\": [128, 0, 0],\r\n\t\"mediumaquamarine\": [102, 205, 170],\r\n\t\"mediumblue\": [0, 0, 205],\r\n\t\"mediumorchid\": [186, 85, 211],\r\n\t\"mediumpurple\": [147, 112, 219],\r\n\t\"mediumseagreen\": [60, 179, 113],\r\n\t\"mediumslateblue\": [123, 104, 238],\r\n\t\"mediumspringgreen\": [0, 250, 154],\r\n\t\"mediumturquoise\": [72, 209, 204],\r\n\t\"mediumvioletred\": [199, 21, 133],\r\n\t\"midnightblue\": [25, 25, 112],\r\n\t\"mintcream\": [245, 255, 250],\r\n\t\"mistyrose\": [255, 228, 225],\r\n\t\"moccasin\": [255, 228, 181],\r\n\t\"navajowhite\": [255, 222, 173],\r\n\t\"navy\": [0, 0, 128],\r\n\t\"oldlace\": [253, 245, 230],\r\n\t\"olive\": [128, 128, 0],\r\n\t\"olivedrab\": [107, 142, 35],\r\n\t\"orange\": [255, 165, 0],\r\n\t\"orangered\": [255, 69, 0],\r\n\t\"orchid\": [218, 112, 214],\r\n\t\"palegoldenrod\": [238, 232, 170],\r\n\t\"palegreen\": [152, 251, 152],\r\n\t\"paleturquoise\": [175, 238, 238],\r\n\t\"palevioletred\": [219, 112, 147],\r\n\t\"papayawhip\": [255, 239, 213],\r\n\t\"peachpuff\": [255, 218, 185],\r\n\t\"peru\": [205, 133, 63],\r\n\t\"pink\": [255, 192, 203],\r\n\t\"plum\": [221, 160, 221],\r\n\t\"powderblue\": [176, 224, 230],\r\n\t\"purple\": [128, 0, 128],\r\n\t\"rebeccapurple\": [102, 51, 153],\r\n\t\"red\": [255, 0, 0],\r\n\t\"rosybrown\": [188, 143, 143],\r\n\t\"royalblue\": [65, 105, 225],\r\n\t\"saddlebrown\": [139, 69, 19],\r\n\t\"salmon\": [250, 128, 114],\r\n\t\"sandybrown\": [244, 164, 96],\r\n\t\"seagreen\": [46, 139, 87],\r\n\t\"seashell\": [255, 245, 238],\r\n\t\"sienna\": [160, 82, 45],\r\n\t\"silver\": [192, 192, 192],\r\n\t\"skyblue\": [135, 206, 235],\r\n\t\"slateblue\": [106, 90, 205],\r\n\t\"slategray\": [112, 128, 144],\r\n\t\"slategrey\": [112, 128, 144],\r\n\t\"snow\": [255, 250, 250],\r\n\t\"springgreen\": [0, 255, 127],\r\n\t\"steelblue\": [70, 130, 180],\r\n\t\"tan\": [210, 180, 140],\r\n\t\"teal\": [0, 128, 128],\r\n\t\"thistle\": [216, 191, 216],\r\n\t\"tomato\": [255, 99, 71],\r\n\t\"turquoise\": [64, 224, 208],\r\n\t\"violet\": [238, 130, 238],\r\n\t\"wheat\": [245, 222, 179],\r\n\t\"white\": [255, 255, 255],\r\n\t\"whitesmoke\": [245, 245, 245],\r\n\t\"yellow\": [255, 255, 0],\r\n\t\"yellowgreen\": [154, 205, 50]\r\n};\r\n","/* MIT license */\n/* eslint-disable no-mixed-operators */\nconst cssKeywords = require('color-name');\n\n// NOTE: conversions should only return primitive values (i.e. arrays, or\n// values that give correct `typeof` results).\n// do not use box values types (i.e. Number(), String(), etc.)\n\nconst reverseKeywords = {};\nfor (const key of Object.keys(cssKeywords)) {\n\treverseKeywords[cssKeywords[key]] = key;\n}\n\nconst convert = {\n\trgb: {channels: 3, labels: 'rgb'},\n\thsl: {channels: 3, labels: 'hsl'},\n\thsv: {channels: 3, labels: 'hsv'},\n\thwb: {channels: 3, labels: 'hwb'},\n\tcmyk: {channels: 4, labels: 'cmyk'},\n\txyz: {channels: 3, labels: 'xyz'},\n\tlab: {channels: 3, labels: 'lab'},\n\tlch: {channels: 3, labels: 'lch'},\n\thex: {channels: 1, labels: ['hex']},\n\tkeyword: {channels: 1, labels: ['keyword']},\n\tansi16: {channels: 1, labels: ['ansi16']},\n\tansi256: {channels: 1, labels: ['ansi256']},\n\thcg: {channels: 3, labels: ['h', 'c', 'g']},\n\tapple: {channels: 3, labels: ['r16', 'g16', 'b16']},\n\tgray: {channels: 1, labels: ['gray']}\n};\n\nmodule.exports = convert;\n\n// Hide .channels and .labels properties\nfor (const model of Object.keys(convert)) {\n\tif (!('channels' in convert[model])) {\n\t\tthrow new Error('missing channels property: ' + model);\n\t}\n\n\tif (!('labels' in convert[model])) {\n\t\tthrow new Error('missing channel labels property: ' + model);\n\t}\n\n\tif (convert[model].labels.length !== convert[model].channels) {\n\t\tthrow new Error('channel and label counts mismatch: ' + model);\n\t}\n\n\tconst {channels, labels} = convert[model];\n\tdelete convert[model].channels;\n\tdelete convert[model].labels;\n\tObject.defineProperty(convert[model], 'channels', {value: channels});\n\tObject.defineProperty(convert[model], 'labels', {value: labels});\n}\n\nconvert.rgb.hsl = function (rgb) {\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\tconst min = Math.min(r, g, b);\n\tconst max = Math.max(r, g, b);\n\tconst delta = max - min;\n\tlet h;\n\tlet s;\n\n\tif (max === min) {\n\t\th = 0;\n\t} else if (r === max) {\n\t\th = (g - b) / delta;\n\t} else if (g === max) {\n\t\th = 2 + (b - r) / delta;\n\t} else if (b === max) {\n\t\th = 4 + (r - g) / delta;\n\t}\n\n\th = Math.min(h * 60, 360);\n\n\tif (h < 0) {\n\t\th += 360;\n\t}\n\n\tconst l = (min + max) / 2;\n\n\tif (max === min) {\n\t\ts = 0;\n\t} else if (l <= 0.5) {\n\t\ts = delta / (max + min);\n\t} else {\n\t\ts = delta / (2 - max - min);\n\t}\n\n\treturn [h, s * 100, l * 100];\n};\n\nconvert.rgb.hsv = function (rgb) {\n\tlet rdif;\n\tlet gdif;\n\tlet bdif;\n\tlet h;\n\tlet s;\n\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\tconst v = Math.max(r, g, b);\n\tconst diff = v - Math.min(r, g, b);\n\tconst diffc = function (c) {\n\t\treturn (v - c) / 6 / diff + 1 / 2;\n\t};\n\n\tif (diff === 0) {\n\t\th = 0;\n\t\ts = 0;\n\t} else {\n\t\ts = diff / v;\n\t\trdif = diffc(r);\n\t\tgdif = diffc(g);\n\t\tbdif = diffc(b);\n\n\t\tif (r === v) {\n\t\t\th = bdif - gdif;\n\t\t} else if (g === v) {\n\t\t\th = (1 / 3) + rdif - bdif;\n\t\t} else if (b === v) {\n\t\t\th = (2 / 3) + gdif - rdif;\n\t\t}\n\n\t\tif (h < 0) {\n\t\t\th += 1;\n\t\t} else if (h > 1) {\n\t\t\th -= 1;\n\t\t}\n\t}\n\n\treturn [\n\t\th * 360,\n\t\ts * 100,\n\t\tv * 100\n\t];\n};\n\nconvert.rgb.hwb = function (rgb) {\n\tconst r = rgb[0];\n\tconst g = rgb[1];\n\tlet b = rgb[2];\n\tconst h = convert.rgb.hsl(rgb)[0];\n\tconst w = 1 / 255 * Math.min(r, Math.min(g, b));\n\n\tb = 1 - 1 / 255 * Math.max(r, Math.max(g, b));\n\n\treturn [h, w * 100, b * 100];\n};\n\nconvert.rgb.cmyk = function (rgb) {\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\n\tconst k = Math.min(1 - r, 1 - g, 1 - b);\n\tconst c = (1 - r - k) / (1 - k) || 0;\n\tconst m = (1 - g - k) / (1 - k) || 0;\n\tconst y = (1 - b - k) / (1 - k) || 0;\n\n\treturn [c * 100, m * 100, y * 100, k * 100];\n};\n\nfunction comparativeDistance(x, y) {\n\t/*\n\t\tSee https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance\n\t*/\n\treturn (\n\t\t((x[0] - y[0]) ** 2) +\n\t\t((x[1] - y[1]) ** 2) +\n\t\t((x[2] - y[2]) ** 2)\n\t);\n}\n\nconvert.rgb.keyword = function (rgb) {\n\tconst reversed = reverseKeywords[rgb];\n\tif (reversed) {\n\t\treturn reversed;\n\t}\n\n\tlet currentClosestDistance = Infinity;\n\tlet currentClosestKeyword;\n\n\tfor (const keyword of Object.keys(cssKeywords)) {\n\t\tconst value = cssKeywords[keyword];\n\n\t\t// Compute comparative distance\n\t\tconst distance = comparativeDistance(rgb, value);\n\n\t\t// Check if its less, if so set as closest\n\t\tif (distance < currentClosestDistance) {\n\t\t\tcurrentClosestDistance = distance;\n\t\t\tcurrentClosestKeyword = keyword;\n\t\t}\n\t}\n\n\treturn currentClosestKeyword;\n};\n\nconvert.keyword.rgb = function (keyword) {\n\treturn cssKeywords[keyword];\n};\n\nconvert.rgb.xyz = function (rgb) {\n\tlet r = rgb[0] / 255;\n\tlet g = rgb[1] / 255;\n\tlet b = rgb[2] / 255;\n\n\t// Assume sRGB\n\tr = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);\n\tg = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);\n\tb = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);\n\n\tconst x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);\n\tconst y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);\n\tconst z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);\n\n\treturn [x * 100, y * 100, z * 100];\n};\n\nconvert.rgb.lab = function (rgb) {\n\tconst xyz = convert.rgb.xyz(rgb);\n\tlet x = xyz[0];\n\tlet y = xyz[1];\n\tlet z = xyz[2];\n\n\tx /= 95.047;\n\ty /= 100;\n\tz /= 108.883;\n\n\tx = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);\n\ty = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);\n\tz = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);\n\n\tconst l = (116 * y) - 16;\n\tconst a = 500 * (x - y);\n\tconst b = 200 * (y - z);\n\n\treturn [l, a, b];\n};\n\nconvert.hsl.rgb = function (hsl) {\n\tconst h = hsl[0] / 360;\n\tconst s = hsl[1] / 100;\n\tconst l = hsl[2] / 100;\n\tlet t2;\n\tlet t3;\n\tlet val;\n\n\tif (s === 0) {\n\t\tval = l * 255;\n\t\treturn [val, val, val];\n\t}\n\n\tif (l < 0.5) {\n\t\tt2 = l * (1 + s);\n\t} else {\n\t\tt2 = l + s - l * s;\n\t}\n\n\tconst t1 = 2 * l - t2;\n\n\tconst rgb = [0, 0, 0];\n\tfor (let i = 0; i < 3; i++) {\n\t\tt3 = h + 1 / 3 * -(i - 1);\n\t\tif (t3 < 0) {\n\t\t\tt3++;\n\t\t}\n\n\t\tif (t3 > 1) {\n\t\t\tt3--;\n\t\t}\n\n\t\tif (6 * t3 < 1) {\n\t\t\tval = t1 + (t2 - t1) * 6 * t3;\n\t\t} else if (2 * t3 < 1) {\n\t\t\tval = t2;\n\t\t} else if (3 * t3 < 2) {\n\t\t\tval = t1 + (t2 - t1) * (2 / 3 - t3) * 6;\n\t\t} else {\n\t\t\tval = t1;\n\t\t}\n\n\t\trgb[i] = val * 255;\n\t}\n\n\treturn rgb;\n};\n\nconvert.hsl.hsv = function (hsl) {\n\tconst h = hsl[0];\n\tlet s = hsl[1] / 100;\n\tlet l = hsl[2] / 100;\n\tlet smin = s;\n\tconst lmin = Math.max(l, 0.01);\n\n\tl *= 2;\n\ts *= (l <= 1) ? l : 2 - l;\n\tsmin *= lmin <= 1 ? lmin : 2 - lmin;\n\tconst v = (l + s) / 2;\n\tconst sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);\n\n\treturn [h, sv * 100, v * 100];\n};\n\nconvert.hsv.rgb = function (hsv) {\n\tconst h = hsv[0] / 60;\n\tconst s = hsv[1] / 100;\n\tlet v = hsv[2] / 100;\n\tconst hi = Math.floor(h) % 6;\n\n\tconst f = h - Math.floor(h);\n\tconst p = 255 * v * (1 - s);\n\tconst q = 255 * v * (1 - (s * f));\n\tconst t = 255 * v * (1 - (s * (1 - f)));\n\tv *= 255;\n\n\tswitch (hi) {\n\t\tcase 0:\n\t\t\treturn [v, t, p];\n\t\tcase 1:\n\t\t\treturn [q, v, p];\n\t\tcase 2:\n\t\t\treturn [p, v, t];\n\t\tcase 3:\n\t\t\treturn [p, q, v];\n\t\tcase 4:\n\t\t\treturn [t, p, v];\n\t\tcase 5:\n\t\t\treturn [v, p, q];\n\t}\n};\n\nconvert.hsv.hsl = function (hsv) {\n\tconst h = hsv[0];\n\tconst s = hsv[1] / 100;\n\tconst v = hsv[2] / 100;\n\tconst vmin = Math.max(v, 0.01);\n\tlet sl;\n\tlet l;\n\n\tl = (2 - s) * v;\n\tconst lmin = (2 - s) * vmin;\n\tsl = s * vmin;\n\tsl /= (lmin <= 1) ? lmin : 2 - lmin;\n\tsl = sl || 0;\n\tl /= 2;\n\n\treturn [h, sl * 100, l * 100];\n};\n\n// http://dev.w3.org/csswg/css-color/#hwb-to-rgb\nconvert.hwb.rgb = function (hwb) {\n\tconst h = hwb[0] / 360;\n\tlet wh = hwb[1] / 100;\n\tlet bl = hwb[2] / 100;\n\tconst ratio = wh + bl;\n\tlet f;\n\n\t// Wh + bl cant be > 1\n\tif (ratio > 1) {\n\t\twh /= ratio;\n\t\tbl /= ratio;\n\t}\n\n\tconst i = Math.floor(6 * h);\n\tconst v = 1 - bl;\n\tf = 6 * h - i;\n\n\tif ((i & 0x01) !== 0) {\n\t\tf = 1 - f;\n\t}\n\n\tconst n = wh + f * (v - wh); // Linear interpolation\n\n\tlet r;\n\tlet g;\n\tlet b;\n\t/* eslint-disable max-statements-per-line,no-multi-spaces */\n\tswitch (i) {\n\t\tdefault:\n\t\tcase 6:\n\t\tcase 0: r = v; g = n; b = wh; break;\n\t\tcase 1: r = n; g = v; b = wh; break;\n\t\tcase 2: r = wh; g = v; b = n; break;\n\t\tcase 3: r = wh; g = n; b = v; break;\n\t\tcase 4: r = n; g = wh; b = v; break;\n\t\tcase 5: r = v; g = wh; b = n; break;\n\t}\n\t/* eslint-enable max-statements-per-line,no-multi-spaces */\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.cmyk.rgb = function (cmyk) {\n\tconst c = cmyk[0] / 100;\n\tconst m = cmyk[1] / 100;\n\tconst y = cmyk[2] / 100;\n\tconst k = cmyk[3] / 100;\n\n\tconst r = 1 - Math.min(1, c * (1 - k) + k);\n\tconst g = 1 - Math.min(1, m * (1 - k) + k);\n\tconst b = 1 - Math.min(1, y * (1 - k) + k);\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.xyz.rgb = function (xyz) {\n\tconst x = xyz[0] / 100;\n\tconst y = xyz[1] / 100;\n\tconst z = xyz[2] / 100;\n\tlet r;\n\tlet g;\n\tlet b;\n\n\tr = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);\n\tg = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);\n\tb = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);\n\n\t// Assume sRGB\n\tr = r > 0.0031308\n\t\t? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)\n\t\t: r * 12.92;\n\n\tg = g > 0.0031308\n\t\t? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)\n\t\t: g * 12.92;\n\n\tb = b > 0.0031308\n\t\t? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)\n\t\t: b * 12.92;\n\n\tr = Math.min(Math.max(0, r), 1);\n\tg = Math.min(Math.max(0, g), 1);\n\tb = Math.min(Math.max(0, b), 1);\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.xyz.lab = function (xyz) {\n\tlet x = xyz[0];\n\tlet y = xyz[1];\n\tlet z = xyz[2];\n\n\tx /= 95.047;\n\ty /= 100;\n\tz /= 108.883;\n\n\tx = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);\n\ty = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);\n\tz = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);\n\n\tconst l = (116 * y) - 16;\n\tconst a = 500 * (x - y);\n\tconst b = 200 * (y - z);\n\n\treturn [l, a, b];\n};\n\nconvert.lab.xyz = function (lab) {\n\tconst l = lab[0];\n\tconst a = lab[1];\n\tconst b = lab[2];\n\tlet x;\n\tlet y;\n\tlet z;\n\n\ty = (l + 16) / 116;\n\tx = a / 500 + y;\n\tz = y - b / 200;\n\n\tconst y2 = y ** 3;\n\tconst x2 = x ** 3;\n\tconst z2 = z ** 3;\n\ty = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;\n\tx = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;\n\tz = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;\n\n\tx *= 95.047;\n\ty *= 100;\n\tz *= 108.883;\n\n\treturn [x, y, z];\n};\n\nconvert.lab.lch = function (lab) {\n\tconst l = lab[0];\n\tconst a = lab[1];\n\tconst b = lab[2];\n\tlet h;\n\n\tconst hr = Math.atan2(b, a);\n\th = hr * 360 / 2 / Math.PI;\n\n\tif (h < 0) {\n\t\th += 360;\n\t}\n\n\tconst c = Math.sqrt(a * a + b * b);\n\n\treturn [l, c, h];\n};\n\nconvert.lch.lab = function (lch) {\n\tconst l = lch[0];\n\tconst c = lch[1];\n\tconst h = lch[2];\n\n\tconst hr = h / 360 * 2 * Math.PI;\n\tconst a = c * Math.cos(hr);\n\tconst b = c * Math.sin(hr);\n\n\treturn [l, a, b];\n};\n\nconvert.rgb.ansi16 = function (args, saturation = null) {\n\tconst [r, g, b] = args;\n\tlet value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization\n\n\tvalue = Math.round(value / 50);\n\n\tif (value === 0) {\n\t\treturn 30;\n\t}\n\n\tlet ansi = 30\n\t\t+ ((Math.round(b / 255) << 2)\n\t\t| (Math.round(g / 255) << 1)\n\t\t| Math.round(r / 255));\n\n\tif (value === 2) {\n\t\tansi += 60;\n\t}\n\n\treturn ansi;\n};\n\nconvert.hsv.ansi16 = function (args) {\n\t// Optimization here; we already know the value and don't need to get\n\t// it converted for us.\n\treturn convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);\n};\n\nconvert.rgb.ansi256 = function (args) {\n\tconst r = args[0];\n\tconst g = args[1];\n\tconst b = args[2];\n\n\t// We use the extended greyscale palette here, with the exception of\n\t// black and white. normal palette only has 4 greyscale shades.\n\tif (r === g && g === b) {\n\t\tif (r < 8) {\n\t\t\treturn 16;\n\t\t}\n\n\t\tif (r > 248) {\n\t\t\treturn 231;\n\t\t}\n\n\t\treturn Math.round(((r - 8) / 247) * 24) + 232;\n\t}\n\n\tconst ansi = 16\n\t\t+ (36 * Math.round(r / 255 * 5))\n\t\t+ (6 * Math.round(g / 255 * 5))\n\t\t+ Math.round(b / 255 * 5);\n\n\treturn ansi;\n};\n\nconvert.ansi16.rgb = function (args) {\n\tlet color = args % 10;\n\n\t// Handle greyscale\n\tif (color === 0 || color === 7) {\n\t\tif (args > 50) {\n\t\t\tcolor += 3.5;\n\t\t}\n\n\t\tcolor = color / 10.5 * 255;\n\n\t\treturn [color, color, color];\n\t}\n\n\tconst mult = (~~(args > 50) + 1) * 0.5;\n\tconst r = ((color & 1) * mult) * 255;\n\tconst g = (((color >> 1) & 1) * mult) * 255;\n\tconst b = (((color >> 2) & 1) * mult) * 255;\n\n\treturn [r, g, b];\n};\n\nconvert.ansi256.rgb = function (args) {\n\t// Handle greyscale\n\tif (args >= 232) {\n\t\tconst c = (args - 232) * 10 + 8;\n\t\treturn [c, c, c];\n\t}\n\n\targs -= 16;\n\n\tlet rem;\n\tconst r = Math.floor(args / 36) / 5 * 255;\n\tconst g = Math.floor((rem = args % 36) / 6) / 5 * 255;\n\tconst b = (rem % 6) / 5 * 255;\n\n\treturn [r, g, b];\n};\n\nconvert.rgb.hex = function (args) {\n\tconst integer = ((Math.round(args[0]) & 0xFF) << 16)\n\t\t+ ((Math.round(args[1]) & 0xFF) << 8)\n\t\t+ (Math.round(args[2]) & 0xFF);\n\n\tconst string = integer.toString(16).toUpperCase();\n\treturn '000000'.substring(string.length) + string;\n};\n\nconvert.hex.rgb = function (args) {\n\tconst match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);\n\tif (!match) {\n\t\treturn [0, 0, 0];\n\t}\n\n\tlet colorString = match[0];\n\n\tif (match[0].length === 3) {\n\t\tcolorString = colorString.split('').map(char => {\n\t\t\treturn char + char;\n\t\t}).join('');\n\t}\n\n\tconst integer = parseInt(colorString, 16);\n\tconst r = (integer >> 16) & 0xFF;\n\tconst g = (integer >> 8) & 0xFF;\n\tconst b = integer & 0xFF;\n\n\treturn [r, g, b];\n};\n\nconvert.rgb.hcg = function (rgb) {\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\tconst max = Math.max(Math.max(r, g), b);\n\tconst min = Math.min(Math.min(r, g), b);\n\tconst chroma = (max - min);\n\tlet grayscale;\n\tlet hue;\n\n\tif (chroma < 1) {\n\t\tgrayscale = min / (1 - chroma);\n\t} else {\n\t\tgrayscale = 0;\n\t}\n\n\tif (chroma <= 0) {\n\t\thue = 0;\n\t} else\n\tif (max === r) {\n\t\thue = ((g - b) / chroma) % 6;\n\t} else\n\tif (max === g) {\n\t\thue = 2 + (b - r) / chroma;\n\t} else {\n\t\thue = 4 + (r - g) / chroma;\n\t}\n\n\thue /= 6;\n\thue %= 1;\n\n\treturn [hue * 360, chroma * 100, grayscale * 100];\n};\n\nconvert.hsl.hcg = function (hsl) {\n\tconst s = hsl[1] / 100;\n\tconst l = hsl[2] / 100;\n\n\tconst c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));\n\n\tlet f = 0;\n\tif (c < 1.0) {\n\t\tf = (l - 0.5 * c) / (1.0 - c);\n\t}\n\n\treturn [hsl[0], c * 100, f * 100];\n};\n\nconvert.hsv.hcg = function (hsv) {\n\tconst s = hsv[1] / 100;\n\tconst v = hsv[2] / 100;\n\n\tconst c = s * v;\n\tlet f = 0;\n\n\tif (c < 1.0) {\n\t\tf = (v - c) / (1 - c);\n\t}\n\n\treturn [hsv[0], c * 100, f * 100];\n};\n\nconvert.hcg.rgb = function (hcg) {\n\tconst h = hcg[0] / 360;\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\n\tif (c === 0.0) {\n\t\treturn [g * 255, g * 255, g * 255];\n\t}\n\n\tconst pure = [0, 0, 0];\n\tconst hi = (h % 1) * 6;\n\tconst v = hi % 1;\n\tconst w = 1 - v;\n\tlet mg = 0;\n\n\t/* eslint-disable max-statements-per-line */\n\tswitch (Math.floor(hi)) {\n\t\tcase 0:\n\t\t\tpure[0] = 1; pure[1] = v; pure[2] = 0; break;\n\t\tcase 1:\n\t\t\tpure[0] = w; pure[1] = 1; pure[2] = 0; break;\n\t\tcase 2:\n\t\t\tpure[0] = 0; pure[1] = 1; pure[2] = v; break;\n\t\tcase 3:\n\t\t\tpure[0] = 0; pure[1] = w; pure[2] = 1; break;\n\t\tcase 4:\n\t\t\tpure[0] = v; pure[1] = 0; pure[2] = 1; break;\n\t\tdefault:\n\t\t\tpure[0] = 1; pure[1] = 0; pure[2] = w;\n\t}\n\t/* eslint-enable max-statements-per-line */\n\n\tmg = (1.0 - c) * g;\n\n\treturn [\n\t\t(c * pure[0] + mg) * 255,\n\t\t(c * pure[1] + mg) * 255,\n\t\t(c * pure[2] + mg) * 255\n\t];\n};\n\nconvert.hcg.hsv = function (hcg) {\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\n\tconst v = c + g * (1.0 - c);\n\tlet f = 0;\n\n\tif (v > 0.0) {\n\t\tf = c / v;\n\t}\n\n\treturn [hcg[0], f * 100, v * 100];\n};\n\nconvert.hcg.hsl = function (hcg) {\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\n\tconst l = g * (1.0 - c) + 0.5 * c;\n\tlet s = 0;\n\n\tif (l > 0.0 && l < 0.5) {\n\t\ts = c / (2 * l);\n\t} else\n\tif (l >= 0.5 && l < 1.0) {\n\t\ts = c / (2 * (1 - l));\n\t}\n\n\treturn [hcg[0], s * 100, l * 100];\n};\n\nconvert.hcg.hwb = function (hcg) {\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\tconst v = c + g * (1.0 - c);\n\treturn [hcg[0], (v - c) * 100, (1 - v) * 100];\n};\n\nconvert.hwb.hcg = function (hwb) {\n\tconst w = hwb[1] / 100;\n\tconst b = hwb[2] / 100;\n\tconst v = 1 - b;\n\tconst c = v - w;\n\tlet g = 0;\n\n\tif (c < 1) {\n\t\tg = (v - c) / (1 - c);\n\t}\n\n\treturn [hwb[0], c * 100, g * 100];\n};\n\nconvert.apple.rgb = function (apple) {\n\treturn [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];\n};\n\nconvert.rgb.apple = function (rgb) {\n\treturn [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];\n};\n\nconvert.gray.rgb = function (args) {\n\treturn [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];\n};\n\nconvert.gray.hsl = function (args) {\n\treturn [0, 0, args[0]];\n};\n\nconvert.gray.hsv = convert.gray.hsl;\n\nconvert.gray.hwb = function (gray) {\n\treturn [0, 100, gray[0]];\n};\n\nconvert.gray.cmyk = function (gray) {\n\treturn [0, 0, 0, gray[0]];\n};\n\nconvert.gray.lab = function (gray) {\n\treturn [gray[0], 0, 0];\n};\n\nconvert.gray.hex = function (gray) {\n\tconst val = Math.round(gray[0] / 100 * 255) & 0xFF;\n\tconst integer = (val << 16) + (val << 8) + val;\n\n\tconst string = integer.toString(16).toUpperCase();\n\treturn '000000'.substring(string.length) + string;\n};\n\nconvert.rgb.gray = function (rgb) {\n\tconst val = (rgb[0] + rgb[1] + rgb[2]) / 3;\n\treturn [val / 255 * 100];\n};\n","const conversions = require('./conversions');\n\n/*\n\tThis function routes a model to all other models.\n\n\tall functions that are routed have a property `.conversion` attached\n\tto the returned synthetic function. This property is an array\n\tof strings, each with the steps in between the 'from' and 'to'\n\tcolor models (inclusive).\n\n\tconversions that are not possible simply are not included.\n*/\n\nfunction buildGraph() {\n\tconst graph = {};\n\t// https://jsperf.com/object-keys-vs-for-in-with-closure/3\n\tconst models = Object.keys(conversions);\n\n\tfor (let len = models.length, i = 0; i < len; i++) {\n\t\tgraph[models[i]] = {\n\t\t\t// http://jsperf.com/1-vs-infinity\n\t\t\t// micro-opt, but this is simple.\n\t\t\tdistance: -1,\n\t\t\tparent: null\n\t\t};\n\t}\n\n\treturn graph;\n}\n\n// https://en.wikipedia.org/wiki/Breadth-first_search\nfunction deriveBFS(fromModel) {\n\tconst graph = buildGraph();\n\tconst queue = [fromModel]; // Unshift -> queue -> pop\n\n\tgraph[fromModel].distance = 0;\n\n\twhile (queue.length) {\n\t\tconst current = queue.pop();\n\t\tconst adjacents = Object.keys(conversions[current]);\n\n\t\tfor (let len = adjacents.length, i = 0; i < len; i++) {\n\t\t\tconst adjacent = adjacents[i];\n\t\t\tconst node = graph[adjacent];\n\n\t\t\tif (node.distance === -1) {\n\t\t\t\tnode.distance = graph[current].distance + 1;\n\t\t\t\tnode.parent = current;\n\t\t\t\tqueue.unshift(adjacent);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn graph;\n}\n\nfunction link(from, to) {\n\treturn function (args) {\n\t\treturn to(from(args));\n\t};\n}\n\nfunction wrapConversion(toModel, graph) {\n\tconst path = [graph[toModel].parent, toModel];\n\tlet fn = conversions[graph[toModel].parent][toModel];\n\n\tlet cur = graph[toModel].parent;\n\twhile (graph[cur].parent) {\n\t\tpath.unshift(graph[cur].parent);\n\t\tfn = link(conversions[graph[cur].parent][cur], fn);\n\t\tcur = graph[cur].parent;\n\t}\n\n\tfn.conversion = path;\n\treturn fn;\n}\n\nmodule.exports = function (fromModel) {\n\tconst graph = deriveBFS(fromModel);\n\tconst conversion = {};\n\n\tconst models = Object.keys(graph);\n\tfor (let len = models.length, i = 0; i < len; i++) {\n\t\tconst toModel = models[i];\n\t\tconst node = graph[toModel];\n\n\t\tif (node.parent === null) {\n\t\t\t// No possible conversion, or this node is the source model.\n\t\t\tcontinue;\n\t\t}\n\n\t\tconversion[toModel] = wrapConversion(toModel, graph);\n\t}\n\n\treturn conversion;\n};\n\n","const conversions = require('./conversions');\nconst route = require('./route');\n\nconst convert = {};\n\nconst models = Object.keys(conversions);\n\nfunction wrapRaw(fn) {\n\tconst wrappedFn = function (...args) {\n\t\tconst arg0 = args[0];\n\t\tif (arg0 === undefined || arg0 === null) {\n\t\t\treturn arg0;\n\t\t}\n\n\t\tif (arg0.length > 1) {\n\t\t\targs = arg0;\n\t\t}\n\n\t\treturn fn(args);\n\t};\n\n\t// Preserve .conversion property if there is one\n\tif ('conversion' in fn) {\n\t\twrappedFn.conversion = fn.conversion;\n\t}\n\n\treturn wrappedFn;\n}\n\nfunction wrapRounded(fn) {\n\tconst wrappedFn = function (...args) {\n\t\tconst arg0 = args[0];\n\n\t\tif (arg0 === undefined || arg0 === null) {\n\t\t\treturn arg0;\n\t\t}\n\n\t\tif (arg0.length > 1) {\n\t\t\targs = arg0;\n\t\t}\n\n\t\tconst result = fn(args);\n\n\t\t// We're assuming the result is an array here.\n\t\t// see notice in conversions.js; don't use box types\n\t\t// in conversion functions.\n\t\tif (typeof result === 'object') {\n\t\t\tfor (let len = result.length, i = 0; i < len; i++) {\n\t\t\t\tresult[i] = Math.round(result[i]);\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t};\n\n\t// Preserve .conversion property if there is one\n\tif ('conversion' in fn) {\n\t\twrappedFn.conversion = fn.conversion;\n\t}\n\n\treturn wrappedFn;\n}\n\nmodels.forEach(fromModel => {\n\tconvert[fromModel] = {};\n\n\tObject.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});\n\tObject.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});\n\n\tconst routes = route(fromModel);\n\tconst routeModels = Object.keys(routes);\n\n\trouteModels.forEach(toModel => {\n\t\tconst fn = routes[toModel];\n\n\t\tconvert[fromModel][toModel] = wrapRounded(fn);\n\t\tconvert[fromModel][toModel].raw = wrapRaw(fn);\n\t});\n});\n\nmodule.exports = convert;\n","import colorConvert from \"color-convert\";\n// Note, we use these because they are already used by MapLibre\n// Saving us an additional dep.\n// Although treeshaking should remove the unused parts anyway.\n\nexport type WebGLContext = WebGLRenderingContext | WebGL2RenderingContext;\n\n/**\n * Load a shader from a source string\n */\nexport function loadShader({ gl, type, source }: { gl: WebGLContext; type: GLenum; source: string }) {\n const shader = gl.createShader(type);\n\n if (shader === null) {\n throw new Error(\"Cannot create shader\");\n }\n\n gl.shaderSource(shader, source);\n gl.compileShader(shader);\n\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {\n console.error(\"Shader compilation error:\", gl.getShaderInfoLog(shader));\n gl.deleteShader(shader);\n\n throw new Error(\"Cannot compile shader\");\n }\n\n return shader;\n}\n\n/**\n * Create a set of shaders (vertex and fragment) and link them into a program\n *\n * @param gl WebGL context\n * @param vertexShaderSource Vertex shader source code\n * @param fragmentShaderSource Fragment shader source code\n *\n * @returns WebGL program\n */\nexport function createShaderProgram({ gl, vertexShaderSource, fragmentShaderSource }: { gl: WebGLContext; vertexShaderSource: string; fragmentShaderSource: string }) {\n const vertexShader = loadShader({\n gl,\n type: gl.VERTEX_SHADER,\n source: vertexShaderSource,\n });\n const fragmentShader = loadShader({ gl, type: gl.FRAGMENT_SHADER, source: fragmentShaderSource });\n\n const shaderProgram = gl.createProgram();\n\n gl.attachShader(shaderProgram, vertexShader);\n gl.attachShader(shaderProgram, fragmentShader);\n gl.linkProgram(shaderProgram);\n\n if (!gl.getProgramParameter(shaderProgram, gl.LINK_STATUS)) {\n console.error(\"Error: \", gl.getProgramInfoLog(shaderProgram));\n\n throw new Error(\"Cannot link shader program\");\n }\n\n return shaderProgram;\n}\n\n/**\n * null-free version of getUniformLocation\n */\nexport function getUniformLocation(gl: WebGLRenderingContext | WebGL2RenderingContext, program: WebGLProgram, name: string): WebGLUniformLocation {\n const location = gl.getUniformLocation(program, name);\n\n if (location === null) {\n throw new Error(`Cannot get uniform location for ${name}`);\n }\n\n return location;\n}\n\nexport type Object3D<Attribute extends string, Uniform extends string> = {\n shaderProgram: WebGLProgram;\n programInfo: {\n attributesLocations: Record<Attribute, number>;\n uniformsLocations: Record<Uniform, WebGLUniformLocation>;\n };\n positionBuffer: WebGLBuffer;\n indexBuffer?: WebGLBuffer;\n indexBufferLength?: number;\n};\n\nexport function createObject3D<Attribute extends string, Uniform extends string>({\n gl,\n vertexShaderSource,\n fragmentShaderSource,\n attributesKeys,\n uniformsKeys,\n vertices,\n indices,\n}: {\n gl: WebGLContext;\n vertexShaderSource: string;\n fragmentShaderSource: string;\n attributesKeys: readonly Attribute[];\n uniformsKeys: readonly Uniform[];\n vertices: Array<number>;\n indices?: Array<number>;\n}): Object3D<Attribute, Uniform> {\n const shaderProgram = createShaderProgram({ gl, vertexShaderSource, fragmentShaderSource });\n\n const attributesLocations = attributesKeys.reduce<Record<string, number>>((acc, key) => {\n acc[key] = gl.getAttribLocation(shaderProgram, `a_${key}`);\n\n return acc;\n }, {});\n\n const uniformsLocations = uniformsKeys.reduce<Record<string, WebGLUniformLocation>>((acc, key) => {\n acc[key] = getUniformLocation(gl, shaderProgram, `u_${key}`);\n\n return acc;\n }, {});\n\n const positionBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW);\n\n let indexBuffer: WebGLBuffer | undefined;\n let indexBufferLength: number | undefined;\n\n if (indices !== undefined) {\n indexBuffer = gl.createBuffer();\n indexBufferLength = indices.length;\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer);\n gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(indices), gl.STATIC_DRAW);\n }\n\n return {\n shaderProgram,\n programInfo: {\n attributesLocations,\n uniformsLocations,\n },\n positionBuffer,\n indexBuffer,\n indexBufferLength,\n };\n}\n\nexport type Vec4 = [number, number, number, number];\n\nexport function parseColorStringToVec4(color?: string): Vec4 {\n if (!color) {\n return [1, 1, 1, 0];\n }\n\n if (color === \"transparent\") {\n return [1, 1, 1, 0];\n }\n\n try {\n const parsedColor = colorToRgbOrHex(color);\n\n const isHexColor = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})?$/i.exec(parsedColor);\n // if the color is a hex color eg #ff00ff or #ff00ff00\n if (isHexColor?.length) {\n const hasAlphaChannel = Boolean(isHexColor[4]);\n\n return [...colorConvert.hex.rgb(parsedColor).map((c) => c / 255), hasAlphaChannel ? parseInt(isHexColor[4], 16) / 255 : 1.0] as Vec4;\n }\n\n // extracts the numbers from an RGB(A) or HSL(A) color string\n const colorAsArray = parsedColor.match(/(\\d\\.\\d(\\d+)?|\\d{3}|\\d{2}|\\d{1})/gi) ?? [\"0\", \"0\", \"0\"];\n // If the color is an RGB(A) color eg rgb(255, 0, 255) or rgba(255, 0, 255, 0.5)\n if (parsedColor.includes(\"rgb\")) {\n const hasAlphaChannel = parsedColor.includes(\"rgba\");\n const rgbArray = [\n ...colorAsArray.map((c) => parseFloat(c)).map((c, i) => (i < 3 ? c / 255 : c)), // because alpha is in the range 0 - 1, not 0 - 255\n ];\n\n if (!hasAlphaChannel) {\n rgbArray.push(1.0);\n }\n\n return rgbArray as Vec4;\n }\n } catch (e) {}\n\n // Because we are not supporting HWB, HSV or CMYK at the moment.\n console.warn([`[parseColorStringToVec4]: Color ${color} is either not a valid color or its type is not supported, defaulting to black`]);\n return [0, 0, 0, 1.0];\n}\n\nexport function degreesToRadians(degrees: number) {\n return (degrees * Math.PI) / 180;\n}\n\n// to avoid recreating the ctx each time\nlet ctx: CanvasRenderingContext2D | null;\n\nfunction colorToRgbOrHex(color: string): string {\n // because canvas 2D context automagically converts\n // any valid css color to a hex string\n // or an RGBA string\n ctx = ctx ?? document.createElement(\"canvas\").getContext(\"2d\");\n\n if (!ctx) {\n return \"#000000\";\n }\n\n ctx.fillStyle = color;\n\n return ctx.fillStyle;\n}\n","const size = 1;\nconst hw = size / 2;\nconst hh = size / 2;\nconst hd = size / 2;\n\nconst frontFace = [-hw, -hh, hd, hw, -hh, hd, hw, hh, hd, -hw, hh, hd];\nconst backFace = [-hw, -hh, -hd, -hw, hh, -hd, hw, hh, -hd, hw, -hh, -hd];\nconst topFace = [-hw, hh, -hd, -hw, hh, hd, hw, hh, hd, hw, hh, -hd];\nconst bottomFace = [-hw, -hh, -hd, hw, -hh, -hd, hw, -hh, hd, -hw, -hh, hd];\nconst rightFace = [hw, -hh, -hd, hw, hh, -hd, hw, hh, hd, hw, -hh, hd];\nconst leftFace = [-hw, -hh, -hd, -hw, -hh, hd, -hw, hh, hd, -hw, hh, -hd];\n\nconst VERTICES = [...frontFace, ...backFace, ...topFace, ...bottomFace, ...rightFace, ...leftFace];\n\nconst INDICES = [\n // Front\n 0, 1, 2, 0, 2, 3,\n // Back\n 4, 5, 6, 4, 6, 7,\n // Left\n 8, 9, 10, 8, 10, 11,\n // Right\n 12, 13, 14, 12, 14, 15,\n // Up\n 16, 17, 18, 16, 18, 19,\n // Down\n 20, 21, 22, 20, 22, 23,\n];\n\nexport { VERTICES, INDICES };\n","export default \"attribute vec3 a_vertexPosition;\\nvarying vec3 vTextureCoord;\\n\\nuniform mat4 u_projectionMatrix;\\nuniform mat4 u_modelViewMatrix;\\n \\nvoid main(void) {\\n vTextureCoord = vec3(-a_vertexPosition.x, a_vertexPosition.y, a_vertexPosition.z);\\n gl_Position = u_projectionMatrix * u_modelViewMatrix * vec4(a_vertexPosition, 1.0);\\n}\\n\"","export default \"precision mediump float;\\n\\nvarying vec3 vTextureCoord;\\n\\n%USE_TEXTURE_MACRO_MARKER%\\n\\n# ifdef USE_TEXTURE\\nuniform samplerCube u_cubeSampler;\\nuniform float u_fadeOpacity;\\n# endif\\n\\nuniform vec4 u_bgColor;\\n\\nvoid main(void) {\\n #ifdef USE_TEXTURE\\n vec4 texColor = textureCube(u_cubeSampler, vTextureCoord);\\n\\n gl_FragColor = mix(\\n u_bgColor,\\n texColor,\\n min(texColor.a, u_fadeOpacity)\\n );\\n\\n gl_FragColor.a = max(gl_FragColor.a, u_fadeOpacity);\\n\\n #else\\n gl_FragColor = u_bgColor;\\n #endif\\n}\\n\"","export enum CubemapImagesPresets {\n UNIVERSE_DARK = \"universe-dark\",\n}\n\n/**\n * Constructor options for the CubemapLayer.\n * This type is equivalent to {@link CubemapDefinition} with no additional properties.\n */\nexport type CubemapLayerConstructorOptions = CubemapDefinition & {};\n\nexport const cubemapPresets: Record<string, CubemapDefinition> = {\n stars: {\n color: \"hsl(233,100%,92%)\",\n preset: \"stars\",\n },\n space: {\n color: \"hsl(210, 100%, 4%)\",\n preset: \"space\",\n },\n milkyway: {\n color: \"hsl(233,100%,92%)\",\n preset: \"milkyway\",\n },\n \"milkyway-subtle\": {\n color: \"hsl(233,100%,92%)\",\n preset: \"milkyway-subtle\",\n },\n \"milkyway-bright\": {\n color: \"hsl(233,100%,92%)\",\n preset: \"milkyway-bright\",\n },\n \"milkyway-colored\": {\n color: \"black\",\n preset: \"milkyway-colored\",\n },\n};\n\n// This is not the most elegant but it's more readable than some of the alternatives.\n// see here for additional options:\n// https://stackoverflow.com/questions/42123407/does-typescript-support-mutually-exclusive-types\n/**\n * Defines how a cubemap should be constructed from source materials.\n * This is a discriminated union type with four possible formats:\n *\n * 1. Path-based: Specify a base URL and optional format for cube face images\n * 2. Faces-based: Provide explicit URLs for each cube face\n * 3. Preset-based: Use a predefined cubemap from available presets\n * 4. Color-based: Use a single color for all faces\n *\n * Only one of `path`, `faces`, `preset`, or `color` should be provided.\n *\n * @example\n * // Path-based cubemap\n * const pathCubemap: CubemapDefinition = {\n * path: {\n * baseUrl: 'https://example.com/cubemap',\n * format: 'png'\n * }\n * };\n *\n * // Color-based cubemap\n * const colorCubemap: CubemapDefinition = {\n * color: '#ff0000'\n * };\n */\nexport type CubemapDefinition =\n | {\n path: {\n baseUrl: string;\n format?: \"png\" | \"jpg\" | \"webp\";\n };\n faces?: never;\n preset?: never;\n color?: string;\n }\n | {\n faces: CubemapFaces;\n path?: never;\n preset?: never;\n color?: string;\n }\n | {\n preset: keyof typeof cubemapPresets;\n path?: never;\n faces?: never;\n color?: string;\n }\n | {\n color: string;\n path?: never;\n faces?: never;\n preset?: never;\n };\n\nexport enum CubemapFaceNames {\n POSITIVE_X = \"pX\",\n NEGATIVE_X = \"nX\",\n POSITIVE_Y = \"pY\",\n NEGATIVE_Y = \"nY\",\n POSITIVE_Z = \"pZ\",\n NEGATIVE_Z = \"nZ\",\n}\n\nexport type CubemapFaces = Record<CubemapFaceNames, string>;\n","import { CubemapFaceNames, CubemapFaces } from \"./types\";\n\ntype WebGLCtx = WebGLRenderingContext | WebGL2RenderingContext;\n\ninterface LoadCubemapTextureOptions {\n gl: WebGLCtx;\n faces?: CubemapFaces;\n onReady: (texture: WebGLTexture, images?: HTMLImageElement[]) => void;\n forceRefresh?: boolean;\n}\n\n/**\n * Stores the result of the last successful execution of {@link loadCubemapTexture}.\n * @type {Map<WebGLCtx, WebGLTexture>}\n * @private\n */\nconst memoizedTextures = new Map<WebGLCtx, WebGLTexture>();\n\nexport function deleteMemoizedTexture(gl: WebGLCtx) {\n const tex = memoizedTextures.get(gl);\n if (tex) {\n memoizedTextures.delete(gl);\n gl.deleteTexture(tex);\n }\n}\n\nconst memoizedImages = new Map<WebGLCtx, HTMLImageElement[]>();\n/**\n * Stores the stringified content of the 'faces' object from the last successful execution.\n * Used for memoization by {@link loadCubemapTexture}.\n * @type {string | undefined}\n * @private\n */\nlet facesKey: string | undefined = undefined;\n\ninterface ImageLoadingPromiseReturnValue {\n image: HTMLImageElement;\n key: CubemapFaceNames;\n}\n\n/**\n * Loads a cubemap texture from a set of image URLs.\n *\n * This function creates and configures a WebGL cubemap texture from a set of images.\n * It memoizes the created texture to avoid redundant loading of the same faces,\n * unless the `forceRefresh` flag is set.\n *\n * @param {Object} options - The options object.\n * @param {WebGLRenderingContext | WebGL2RenderingContext} options.gl - The WebGL rendering context.\n * @param {CubemapFaces} options.faces - An object containing URLs for each face of the cubemap.\n * Must contain exactly 6 faces.\n * @param {Function} [options.onReady] - Optional callback function to be called when all faces are loaded.\n * @param {boolean} [options.forceRefresh] - If true, forces creation of a new texture instead of returning the memoized one.\n *\n * @returns {WebGLTexture | undefined} The created WebGL cubemap texture, or undefined if there was an error.\n *\n * @see {@link facesKey}\n * @see {@link memoizedReturnValue}\n * @example\n * const texture = loadCubemapTexture({\n * gl: webglContext,\n * faces: {\n * px: 'right.jpg',\n * nx: 'left.jpg',\n * py: 'top.jpg',\n * ny: 'bottom.jpg',\n * pz: 'front.jpg',\n * nz: 'back.jpg'\n * },\n * onReady: () => console.log('Cubemap loaded')\n * });\n */\nexport function loadCubemapTexture({ gl, faces, onReady, forceRefresh }: LoadCubemapTextureOptions) {\n if (memoizedTextures.get(gl) && !forceRefresh && facesKey === JSON.stringify(faces)) {\n onReady(memoizedTextures.get(gl)!, memoizedImages.get(gl)!);\n return;\n }\n\n facesKey = JSON.stringify(faces);\n\n const texture = memoizedTextures.get(gl) ?? gl.createTexture();\n gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture);\n\n if (!faces) {\n console.warn(\"[CubemapLayer][loadCubemapTexture]: Faces are null\");\n return;\n }\n\n const numFaces = Object.keys(faces).length;\n\n if (numFaces !== 6) {\n console.warn(`[CubemapLayer][loadCubemapTexture]: Faces should contain exactly 6 images, but found ${numFaces}`);\n return;\n }\n\n const imageLoadingPromises = Object.entries(faces).map(([key, face]) => {\n return new Promise<ImageLoadingPromiseReturnValue>((resolve, reject) => {\n const keyEnum = key as CubemapFaceNames;\n if (face === undefined) {\n reject(new Error(`[CubemapLayer][loadCubemapTexture]: Face ${key} is undefined`));\n return;\n }\n\n const image = new Image();\n\n image.crossOrigin = \"anonymous\";\n\n const handleLoad = () => {\n resolve({ image, key: keyEnum });\n };\n\n image.src = face;\n\n // in case the image is loaded from the cache.\n if (image.complete && image.naturalWidth > 0) {\n handleLoad();\n } else {\n image.onload = handleLoad;\n }\n\n image.onerror = () => {\n reject(new Error(`[CubemapLayer][loadCubemapTexture]: Error loading image ${face}`));\n };\n });\n });\n\n void Promise.all(imageLoadingPromises)\n .then((imagesAndFaceKeys) => {\n for (let i = 0; i < imagesAndFaceKeys.length; i++) {\n const lod = 0;\n const internalFormat = gl.RGBA;\n const format = gl.RGBA;\n const type = gl.UNSIGNED_BYTE;\n\n const { image, key } = imagesAndFaceKeys[i] ?? {};\n\n if (!image || !key) {\n console.warn(`[CubemapLayer][loadCubemapTexture]: Image or key is null`);\n continue;\n }\n\n const glCubemapTarget = getGlCubemapTarget(gl, key);\n\n gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture);\n\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n\n gl.texImage2D(glCubemapTarget, lod, internalFormat, format, type, image);\n }\n\n gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture);\n gl.generateMipmap(gl.TEXTURE_CUBE_MAP);\n\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n\n const imageElements = imagesAndFaceKeys.map((image) => image.image);\n\n onReady(texture, imageElements);\n\n memoizedImages.set(gl, imageElements);\n memoizedTextures.set(gl, texture);\n })\n .catch((error) => {\n console.error(`[CubemapLayer][loadCubemapTexture]: Error loading cubemap texture`, error);\n });\n}\n\nfunction getGlCubemapTarget(gl: WebGLRenderingContext | WebGL2RenderingContext, key: CubemapFaceNames): number {\n // Why are we being explicit here instead of dynamically creating the key?\n // The problem is that if we create a key to access the gl enum, eg key = `TEXTURE_CUBE_MAP_${imageKey}`,\n // typescript will not be able to infer the type of the key.\n // So, we need to be explicit here.\n\n if (key === CubemapFaceNames.POSITIVE_X) {\n return gl.TEXTURE_CUBE_MAP_POSITIVE_X;\n }\n\n if (key === CubemapFaceNames.NEGATIVE_X) {\n return gl.TEXTURE_CUBE_MAP_NEGATIVE_X;\n }\n\n if (key === CubemapFaceNames.POSITIVE_Y) {\n return gl.TEXTURE_CUBE_MAP_POSITIVE_Y;\n }\n\n if (key === CubemapFaceNames.NEGATIVE_Y) {\n return gl.TEXTURE_CUBE_MAP_NEGATIVE_Y;\n }\n\n if (key === CubemapFaceNames.POSITIVE_Z) {\n return gl.TEXTURE_CUBE_MAP_POSITIVE_Z;\n }\n\n if (key === CubemapFaceNames.NEGATIVE_Z) {\n return gl.TEXTURE_CUBE_MAP_NEGATIVE_Z;\n }\n\n throw new Error(`[CubemapLayer][loadCubemapTexture]: Invalid key ${key}`);\n}\n","import { Vec4 } from \"./webgl-utils\";\n\nfunction minMax(value: number, min: number, max: number): number {\n return Math.min(max, Math.max(min, value));\n}\n\nfunction normalize(value: number, min: number, max: number): number {\n return minMax((value - min) / (max - min), min, max);\n}\n\nfunction diagonalOfSquare(side: number): number {\n return Math.sqrt(2) * side;\n}\n\ntype Lerpable = [number, number, number, number] | Vec4;\n\nfunction lerpVec4(a: Lerpable, b: Lerpable, t: number): Vec4 {\n //prettier-ignore\n return [\n lerp(a[0], b[0], t),\n lerp(a[1], b[1], t),\n lerp(a[2], b[2], t),\n lerp(a[3], b[3], t),\n ];\n}\n\nfunction lerp(a: number, b: number, t: number): number {\n return a + (b - a) * t;\n}\n\nexport { minMax, normalize, diagonalOfSquare, lerpVec4, lerp };\n","export function orderObjectKeys<T extends Record<string, unknown>>(obj?: T): T {\n if (!obj) {\n return {} as T;\n }\n\n const entries = Object.keys(obj)\n .sort()\n .map((key) => [key, obj[key as keyof T]] as const);\n return Object.fromEntries(entries) as T;\n}\n","import type { CustomLayerInterface, CustomRenderMethodInput } from \"maplibre-gl\";\nimport { mat4 } from \"gl-matrix\";\n\nimport type { Map as MapSDK } from \"../../Map\";\nimport { createObject3D, type WebGLContext, type Object3D, parseColorStringToVec4, Vec4 } from \"../../utils/webgl-utils\";\n\nimport { VERTICES, INDICES } from \"./constants\";\nimport vertexShaderSource from \"./cubemap.vert.glsl?raw\";\nimport fragmentShaderSource from \"./cubemap.frag.glsl?raw\";\nimport { deleteMemoizedTexture, loadCubemapTexture } from \"./loadCubemapTexture\";\nimport { cubemapPresets, type CubemapDefinition, type CubemapFaces, type CubemapLayerConstructorOptions } from \"./types\";\nimport { lerp, lerpVec4 } from \"../../utils/math-utils\";\nimport { orderObjectKeys } from \"../../utils/object\";\n\nconst SPACE_IMAGES_BASE_URL = \"https://api.maptiler.com/resources/space\";\n\nconst ATTRIBUTES_KEYS = [\"vertexPosition\"] as const;\nconst UNIFORMS_KEYS = [\"projectionMatrix\", \"modelViewMatrix\", \"cubeSampler\", \"bgColor\", \"fadeOpacity\"] as const;\n\nconst GL_USE_TEXTURE_MACRO_MARKER = \"%USE_TEXTURE_MACRO_MARKER%\";\nconst GL_USE_TEXTURE_MACRO = \"#define USE_TEXTURE\";\n\nconst defaultConstructorOptions: CubemapLayerConstructorOptions = cubemapPresets.stars;\n/**\n * Configures options for the CubemapLayer by merging defaults with provided options.\n *\n * @param inputOptions - Options to configure the cubemap layer. Can be a configuration object or `true` to use defaults.\n * @param defaults - Default configuration options to use as a base.\n * @returns The configured options with properly resolved properties.\n *\n * @remarks\n * The function applies the following priority rules:\n * 1. If `inputOptions` is `true`, returns the default options.\n * 2. If `inputOptions.faces` is defined, it takes precedence and `preset` is removed.\n * 3. If `inputOptions.path` is defined, it takes precedence over `preset`.\n * 4. If neither `faces` nor `path` is defined, the `preset` property is used and validated.\n *\n * @throws Error if an invalid preset name is provided.\n */\nfunction configureOptions(inputOptions: CubemapLayerConstructorOptions | true, defaults: CubemapLayerConstructorOptions) {\n if (!validateSpaceSpecification(inputOptions)) {\n return {\n color: \"transparent\",\n };\n }\n\n if (inputOptions === true) {\n return defaults;\n }\n\n const outputOptions = {\n ...inputOptions,\n };\n\n // if input has faces defined, this takes precendence\n if (inputOptions.faces) {\n delete outputOptions.preset;\n return outputOptions as CubemapLayerConstructorOptions;\n }\n\n // - Use path if defined.\n // - Path takes precendence over preset.\n // - Because we would have returned faces if it was defined\n // we don't need to delete it\n if (inputOptions.path) {\n delete outputOptions.preset;\n return outputOptions as CubemapLayerConstructorOptions;\n }\n\n const presetName = inputOptions.preset!;\n\n // \"Unnecessary conditional\"\n // It _should_ be defined but we need to check anyway as the preset can come from an outside source\n const presetIsUndefined = presetName === undefined;\n\n if (!presetIsUndefined && !(presetName in cubemapPresets)) {\n throw new Error(`[CubemapLayer]: Invalid preset \"${presetName}\". Available presets: ${Object.keys(cubemapPresets).join(\", \")}`);\n }\n\n // path / faces will not be defined at this point\n // so we don't need to delete them\n return {\n ...outputOptions,\n // this _could_ be nullish_\n color: outputOptions.color ?? cubemapPresets[presetName].color ?? \"hsl(233,100%,92%)\",\n } as CubemapLayerConstructorOptions;\n}\n\nclass CubemapLayer implements CustomLayerInterface {\n public id: string = \"Cubemap Layer\";\n public type: CustomLayerInterface[\"type\"] = \"custom\";\n public renderingMode: CustomLayerInterface[\"renderingMode\"] = \"3d\";\n\n /**\n * The map instance to which this layer is added.\n * @type {MapSDK}\n * @private\n */\n private map!: MapSDK;\n /**\n * The cubemap faces definition, which can be either a preset, path, or explicit face URLs.\n * @type {CubemapFaces | null}\n * @remarks\n * This property is set during the initialization of the layer and can be updated later.\n * If no faces are defined, it will be `null`.\n */\n private faces?: CubemapFaces | null;\n /**\n * Indicates whether to use a cubemap texture for rendering.\n * @type {boolean}\n * @private\n * @default true\n */\n private useCubemapTexture: boolean = true;\n /**\n * The current opacity of the fade effect applied to the cubemap image texture, used for fading in and out.\n * @type {number}\n * @private\n * @default 0.0\n */\n private currentFadeOpacity: number = 0.0;\n /**\n * Indicates whether the cubemap needs to be updated, typically when the faces or texture changes.\n * @type {boolean}\n * @private\n * @default false\n */\n private cubeMapNeedsUpdate: boolean = false;\n /**\n * The background color of the cubemap layer, represented as a Vec4 (RGBA).\n * @type {Vec4}\n * @private\n */\n private bgColor: Vec4;\n\n /**\n * The previous background color used for transition animations.\n * @type {Vec4}\n * @private\n */\n private previousBgColor: Vec4 = [0, 0, 0, 0];\n /**\n * The target background color to which the layer will transition.\n * @type {Vec4}\n * @private\n */\n private targetBgColor: Vec4 = [0, 0, 0, 0];\n\n /**\n * The delta value used for transitioning the background color. 0 = start of transition, 1 = end of transition.\n * This value is incremented over time to create a smooth transition effect.\n * @type {number}\n * @private\n */\n private transitionDelta: number = 0.0;\n\n /**\n * The WebGL context used for rendering the cubemap layer.\n * @type {WebGLContext}\n * @private\n */\n private gl!: WebGLContext;\n\n /**\n * The cubemap object that contains the shader program, buffers and uniform locations for rendering.\n * @type {Object3D}\n * @private\n */\n private cubemap?: Object3D<(typeof ATTRIBUTES_KEYS)[number], (typeof UNIFORMS_KEYS)[number]>;\n /**\n * The WebGL texture used for the cubemap, which is created from the defined faces.\n * This texture is used to render the cubemap in the scene.\n * @type {WebGLTexture | undefined}\n * @private\n */\n private texture?: WebGLTexture;\n\n /**\n * The key representing the current faces definition, used to diff / track changes in the cubemap faces.\n * @type {string}\n */\n public currentFacesDefinitionKey: string = \"\";\n\n /**\n * The configuration options for the cubemap layer.\n * @type {CubemapLayerConstructorOptions}\n * @private\n */\n private options: CubemapLayerConstructorOptions;\n\n private animationActive: boolean = true;\n\n /**\n * Creates a new instance of CubemapLayer\n *\n * @param {CubemapLayerConstructorOptions | true} cubemapConfig - Configuration options for the cubemap layer or `true` to use default options.\n * Can specify faces, preset, path, and color properties to configure the cubemap.\n *\n * @remarks You shouldn't have to use this class directly.\n * Instead, use the `Map.setHalo` method to create and add a halo layer to the map.\n * The constructor initializes the cubemap with the provided configuration.\n * It processes the faces definition, sets up background colors, and determines\n * whether to use a cubemap texture based on the provided options.\n */\n constructor(cubemapConfig: CubemapLayerConstructorOptions | true) {\n const options = configureOptions(cubemapConfig, defaultConstructorOptions);\n this.options = options;\n this.currentFacesDefinitionKey = JSON.stringify(options.faces ?? options.preset ?? options.path);\n\n this.bgColor = [0, 0, 0, 0];\n this.targetBgColor = parseColorStringToVec4(options.color);\n\n this.faces = getCubemapFaces(options as CubemapDefinition);\n this.useCubemapTexture = this.faces !== null;\n }\n\n /**\n * Updates the cubemap object with the current faces and shader configuration.\n * This method is called when the cubemap faces change or when the layer is initialized.\n * @returns {void}\n * @remarks\n * It creates a new Object3D instance with the specified vertex and fragment shaders,\n * attributes, and uniforms. The cubemap will be rendered using this configuration.\n */\n public updateCubemap({ facesNeedUpdate }: { facesNeedUpdate: boolean } = { facesNeedUpdate: true }): void {\n this.useCubemapTexture = this.faces !== null;\n const uniformsKeys = UNIFORMS_KEYS.filter((uniformKey) => {\n if (uniformKey === \"cubeSampler\" || uniformKey === \"fadeOpacity\") {\n return this.useCubemapTexture;\n }\n\n return true;\n });\n\n this.cubemap = createObject3D({\n gl: this.gl,\n vertexShaderSource,\n // Because we only want to use the read the texture in gl if we're supposed to\n fragmentShaderSource: this.useCubemapTexture\n ? fragmentShaderSource.replace(GL_USE_TEXTURE_MACRO_MARKER, GL_USE_TEXTURE_MACRO)\n : fragmentShaderSource.replace(GL_USE_TEXTURE_MACRO_MARKER, \"\"),\n attributesKeys: ATTRIBUTES_KEYS,\n uniformsKeys,\n vertices: VERTICES,\n indices: INDICES,\n });\n\n this.cubeMapNeedsUpdate = facesNeedUpdate;\n\n if (this.useCubemapTexture) {\n this.updateTexture(this.gl, this.faces!);\n }\n\n this.animateColorChange();\n }\n\n /**\n * Called when the layer is added to the map.\n * Initializes the cubemap and sets up the WebGL context.\n *\n * @param {MapSDK} map - The map instance to which this layer is added.\n * @param {WebGLRenderingContext | WebGL2RenderingContext} gl - The WebGL context used for rendering.\n */\n public onAdd(map: MapSDK, gl: WebGLRenderingContext | WebGL2RenderingContext): void {\n this.map = map;\n\n this.gl = gl;\n this.updateCubemap();\n }\n\n /**\n * Called when the layer is removed from the map.\n * Cleans up the cubemap resources and WebGL buffers.\n *\n * @param {MapSDK} _map - The map instance from which this layer is removed.\n * @param {WebGLRenderingContext | WebGL2RenderingContext} gl - The WebGL context used for rendering.\n */\n public onRemove(_map: MapSDK, gl: WebGLRenderingContext | WebGL2RenderingContext) {\n if (this.cubemap) {\n if (this.texture) {\n deleteMemoizedTexture(gl);\n this.texture = undefined;\n }\n gl.deleteProgram(this.cubemap.shaderProgram);\n gl.deleteBuffer(this.cubemap.positionBuffer);\n }\n }\n\n /**\n * Updates the cubemap texture with the provided faces.\n * This method is called when the cubemap faces change or when the layer is initialized.\n *\n * @param {WebGLContext} gl - The WebGL context used for rendering.\n * @param {CubemapFaces} faces - The cubemap faces to be loaded into the texture.\n */\n public updateTexture(gl: WebGLContext, faces: CubemapFaces): void {\n if (this.cubeMapNeedsUpdate === true && !this.imageIsAnimating) {\n this.cubeMapNeedsUpdate = false;\n if (!this.useCubemapTexture) {\n return;\n }\n\n loadCubemapTexture({\n gl,\n faces,\n onReady: (texture) => {\n this.texture = texture;\n this.animateIn();\n },\n });\n }\n }\n\n /**\n * Called before the layer is rendered.\n * Updates the cubemap texture with the current faces.\n *\n * @param {WebGLContext} gl - The WebGL context used for rendering.\n * @param {CustomRenderMethodInput} _options - Additional options for the render method.\n */\n public prerender(_gl: WebGLContext, _options: CustomRenderMethodInput): void {\n if (this.faces) this.updateTexture(this.gl, this.faces!);\n }\n\n /**\n * Lerps the background color transition of the cubemap layer.\n * This method smoothly transitions the background color from the previous color to the target color.\n *\n * @private\n */\n private animateColorChange() {\n const animateColorChange = () => {\n if (this.transitionDelta < 1.0) {\n requestAnimationFrame(animateColorChange);\n this.bgColor = lerpVec4(this.previousBgColor, this.targetBgColor, this.transitionDelta);\n this.transitionDelta += 0.075;\n\n this.map.triggerRepaint();\n }\n };\n requestAnimationFrame(animateColorChange);\n }\n\n /**\n * Animates the cubemap image fading in.\n * This method gradually increases the opacity of the cubemap image to create a fade-in effect.\n *\n * @private\n */\n private imageIsAnimating: boolean = false;\n /**\n * The delta value used for the image fade-in animation.\n * This value is incremented over time to create a smooth fade-in effect.\n * @type {number}\n * @private\n */\n private imageFadeInDelta: number = 0.0;\n\n /**\n * Animates the cubemap image fading in.\n * This method gradually increases the opacity of the cubemap image to create a fade-in effect.\n * @private\n */\n private async animateIn() {\n if (this.imageIsAnimating) {\n return;\n }\n\n if (!this.animationActive) {\n this.currentFadeOpacity = 1.0;\n this.imageFadeInDelta = 1;\n this.map.triggerRepaint();\n return;\n }\n\n return new Promise<void>((resolve) => {\n this.imageIsAnimating = true;\n\n const animateIn = () => {\n this.imageFadeInDelta = Math.min(this.imageFadeInDelta + 0.05, 1.0);\n this.currentFadeOpacity = lerp(0.0, 1.0, this.imageFadeInDelta);\n this.map.triggerRepaint();\n\n if (this.imageFadeInDelta < 1.0) {\n requestAnimationFrame(animateIn);\n return;\n }\n this.imageIsAnimating = false;\n this.imageFadeInDelta = 0.0;\n resolve();\n };\n\n requestAnimationFrame(animateIn);\n });\n }\n\n /**\n * Animates the cubemap image fading out.\n * This method gradually decreases the opacity of the cubemap image to create a fade-out effect.\n * @returns {Promise<void>} A promise that resolves when the animation is complete.\n * @private\n */\n private async animateOut() {\n if (this.imageIsAnimating || !this.animationActive) {\n return; // If already animating, just resolve\n }\n return new Promise<void>((resolve) => {\n const animateOut = () => {\n this.imageFadeInDelta = Math.min(this.imageFadeInDelta + 0.05, 1.0);\n this.currentFadeOpacity = lerp(1.0, 0.0, this.imageFadeInDelta);\n this.map.triggerRepaint();\n\n if (this.imageFadeInDelta >= 1.0) {\n this.imageIsAnimating = false;\n this.imageFadeInDelta = 0.0;\n resolve();\n return;\n }\n\n requestAnimationFrame(animateOut);\n };\n\n requestAnimationFrame(animateOut);\n });\n }\n\n public setAnimationActive(active: boolean) {\n this.animationActive = active;\n }\n\n /**\n * Renders the cubemap layer to the WebGL context.\n * This method is called internally during the rendering phase of the map.\n *\n * @param {WebGLRenderingContext | WebGL2RenderingContext} gl - The WebGL context used for rendering.\n * @param {CustomRenderMethodInput} _options - Additional options for the render method.\n * @throws Error if the map, cubemap, or texture is undefined.\n */\n public render(gl: WebGLRenderingContext | WebGL2RenderingContext, _options: CustomRenderMethodInput): void {\n if (!this.map.isGlobeProjection()) {\n return;\n }\n\n if (this.map === undefined) {\n throw new Error(\"[CubemapLayer]: Map is undefined\");\n }\n\n if (this.cubemap === undefined) {\n throw new Error(\"[CubemapLayer]: Cubemap is undefined\");\n }\n\n if (this.texture === undefined && __MT_NODE_ENV__ === \"development\") {\n console.warn(\"[CubemapLayer]: Texture is undefined, no texture will be rendered to cubemap\");\n }\n\n gl.disable(gl.DEPTH_TEST);\n gl.enable(gl.BLEND);\n\n gl.blendFunc(gl.SRC_ALPHA, gl.DST_ALPHA);\n\n gl.useProgram(this.cubemap.shaderProgram);\n\n gl.bindBuffer(gl.ARRAY_BUFFER, this.cubemap.positionBuffer);\n gl.vertexAttribPointer(this.cubemap.programInfo.attributesLocations.vertexPosition, 3, gl.FLOAT, false, 0, 0);\n gl.enableVertexAttribArray(this.cubemap.programInfo.attributesLocations.vertexPosition);\n\n const near = 0.1;\n const far = 10000.0;\n const canvas = gl.canvas as HTMLCanvasElement;\n const aspect = canvas.clientWidth / canvas.clientHeight;\n\n const transform = this.map.transform;\n const fov = transform.fov * (Math.PI / 180);\n\n const projectionMatrix = mat4.create();\n mat4.perspective(projectionMatrix, fov, aspect, near, far);\n\n mat4.rotateZ(projectionMatrix, projectionMatrix, transform.rollInRadians);\n mat4.rotateX(projectionMatrix, projectionMatrix, -transform.pitchInRadians);\n mat4.rotateZ(projectionMatrix, projectionMatrix, transform.bearingInRadians);\n\n const latRad = (transform.center.lat * Math.PI) / 180.0;\n const lngRad = (transform.center.lng * Math.PI) / 180.0;\n\n mat4.rotateX(projectionMatrix, projectionMatrix, latRad);\n mat4.rotateY(projectionMatrix, projectionMatrix, -lngRad);\n\n gl.uniformMatrix4fv(this.cubemap.programInfo.uniformsLocations.projectionMatrix, false, projectionMatrix);\n\n const modelViewMatrix = mat4.create();\n gl.uniformMatrix4fv(this.cubemap.programInfo.uniformsLocations.modelViewMatrix, false, modelViewMatrix);\n\n /**\n * Background color\n */\n gl.uniform4fv(this.cubemap.programInfo.uniformsLocations.bgColor, new Float32Array(this.bgColor));\n\n gl.uniform1f(this.cubemap.programInfo.uniformsLocations.fadeOpacity, this.currentFadeOpacity);\n\n if (this.useCubemapTexture && this.texture) {\n gl.activeTexture(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_CUBE_MAP, this.texture);\n gl.uniform1i(this.cubemap.programInfo.uniformsLocations.cubeSampler, 0);\n }\n /* *** */\n\n /**\n * Draw\n */\n if (this.cubemap.indexBuffer === undefined) {\n throw new Error(\"Index buffer is undefined\");\n }\n\n if (this.cubemap.indexBufferLength === undefined) {\n throw new Error(\"Index buffer length is undefined\");\n }\n\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.cubemap.indexBuffer);\n gl.drawElements(gl.TRIANGLES, this.cubemap.indexBufferLength, gl.UNSIGNED_SHORT, 0);\n /* *** */\n }\n\n private setBgColor(color: Vec4): void {\n this.targetBgColor = color;\n this.previousBgColor = this.bgColor;\n this.transitionDelta = 0.0;\n }\n\n /**\n * Returns the current configuration options for the cubemap layer.\n * @returns {CubemapLayerConstructorOptions} The current configuration options.\n */\n public getConfig() {\n return this.options;\n }\n\n /**\n * Checks if the cubemap needs to be updated based on the provided specification.\n *\n * @param {CubemapDefinition} spec - The cubemap specification to compare with the current cubemap.\n * @returns {boolean} True if the cubemap needs to be updated, false otherwise.\n */\n public shouldUpdate(newSpec?: CubemapDefinition | boolean): boolean {\n const currentSpec = this.getConfig();\n\n if (newSpec === undefined && currentSpec) {\n return true;\n }\n\n const orderedNewSpec = typeof newSpec === \"boolean\" ? newSpec : orderObjectKeys(newSpec);\n const orderedCurrentSpec = orderObjectKeys(currentSpec);\n return JSON.stringify(orderedNewSpec) !== JSON.stringify(orderedCurrentSpec);\n }\n\n private async setCubemapFaces(cubemap: CubemapDefinition): Promise<void> {\n await this.animateOut();\n\n if (!cubemap.faces && !cubemap.preset && !cubemap.path) {\n this.faces = null;\n this.useCubemapTexture = false;\n this.currentFacesDefinitionKey = \"empty\";\n await this.animateIn();\n return;\n }\n\n this.faces = getCubemapFaces(cubemap);\n this.currentFacesDefinitionKey = JSON.stringify(cubemap.faces ?? cubemap.preset ?? cubemap.path);\n }\n\n /**\n * Sets the cubemap for the layer based on the provided definition.\n * This method updates the cubemap faces, background color, and triggers a repaint of the map.\n *\n * @param {CubemapDefinition} cubemap - The cubemap definition containing faces, preset, path, or color.\n * @returns {Promise<void>} A promise that resolves when the cubemap is set and the map is updated.\n * @remarks\n * This method checks if the provided cubemap definition has a color, and if so, it updates the background color.\n * It also checks if the faces definition has changed compared to the current one,\n * and if so, it updates the cubemap faces.\n * Finally, it calls `updateCubemap` to apply the changes and trigger a repaint of the map.\n */\n public async setCubemap(spec: CubemapDefinition | boolean): Promise<void> {\n const cubemap = typeof spec === \"boolean\" ? defaultConstructorOptions : spec;\n\n this.options = cubemap;\n\n const facesKey = JSON.stringify(cubemap.faces ?? cubemap.preset ?? cubemap.path);\n\n const facesNeedUpdate = this.currentFacesDefinitionKey !== facesKey;\n\n if (facesNeedUpdate) {\n await this.setCubemapFaces(cubemap);\n this.cubeMapNeedsUpdate = true;\n }\n\n const color = parseColorStringToVec4(cubemap.color);\n\n if (cubemap.color && this.targetBgColor.toString() !== color.toString()) {\n this.setBgColor(color);\n } else if (!cubemap.color && cubemap.preset && cubemap.preset in cubemapPresets) {\n const preset = cubemapPresets[cubemap.preset];\n this.setBgColor(parseColorStringToVec4(preset.color));\n }\n\n this.updateCubemap({ facesNeedUpdate });\n }\n\n /**\n * Shows the cubemap layer by setting its visibility to \"visible\".\n * This method is used to make the cubemap layer visible on the map.\n */\n public show(): void {\n // TODO in future we can ease / animate this\n this.map.setLayoutProperty(this.id, \"visibility\", \"visible\");\n }\n\n /**\n * Hides the cubemap layer by setting its visibility to \"none\".\n * This method is used to remove the cubemap layer from the map without deleting it.\n */\n public hide(): void {\n // TODO in future we can ease / animate this\n this.map.setLayoutProperty(this.id, \"visibility\", \"none\");\n }\n}\n\nexport function validateSpaceSpecification(space?: CubemapDefinition | boolean): boolean {\n if (!space) {\n return false;\n }\n\n if (typeof space === \"boolean\") {\n return true;\n }\n\n if (!space.path && !space.preset && !space.faces && !space.color) {\n return false;\n }\n\n if (space.preset && !(space.preset in cubemapPresets)) {\n return false;\n }\n\n if (space.faces && (!space.faces.pX || !space.faces.nX || !space.faces.pY || !space.faces.nY || !space.faces.pZ || !space.faces.nZ)) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Retrieves the cubemap faces based on the provided options.\n * This function checks if the faces are explicitly defined, uses a preset, or constructs the faces from a path.\n *\n * @param {CubemapDefinition} options - The cubemap definition containing faces, preset, or path.\n * @returns {CubemapFaces | null} The cubemap faces object containing URLs for each face, or null if no faces are defined.\n * @remarks\n * - If `options.faces` is defined, it returns the provided faces.\n * - If `options.preset` is defined, it constructs the faces URLs based on the preset name.\n * - If `options.path` is defined, it constructs the faces URLs based on the base URL and format.\n * - If none of the above are defined, it returns null.\n * @throws Error if an invalid preset name is provided.\n */\nfunction getCubemapFaces(options: CubemapDefinition): CubemapFaces | null {\n if (options.faces) {\n return options.faces;\n }\n\n if (options.preset) {\n return {\n pX: `${SPACE_IMAGES_BASE_URL}/${options.preset}/px.webp`,\n nX: `${SPACE_IMAGES_BASE_URL}/${options.preset}/nx.webp`,\n pY: `${SPACE_IMAGES_BASE_URL}/${options.preset}/py.webp`,\n nY: `${SPACE_IMAGES_BASE_URL}/${options.preset}/ny.webp`,\n pZ: `${SPACE_IMAGES_BASE_URL}/${options.preset}/pz.webp`,\n nZ: `${SPACE_IMAGES_BASE_URL}/${options.preset}/nz.webp`,\n };\n }\n\n if (options.path) {\n const baseUrl = options.path.baseUrl;\n const format = options.path.format ?? \"png\";\n\n return {\n pX: `${baseUrl}/px.${format}`,\n nX: `${baseUrl}/nx.${format}`,\n pY: `${baseUrl}/py.${format}`,\n nY: `${baseUrl}/ny.${format}`,\n pZ: `${baseUrl}/pz.${format}`,\n nZ: `${baseUrl}/nz.${format}`,\n };\n }\n\n return null;\n}\n\nexport { CubemapLayer };\n","export default \"attribute vec3 a_position;\\n\\nuniform mat4 u_matrix;\\nuniform mat4 u_rotationMatrix;\\n\\nuniform float u_scale;\\n\\nvarying vec2 v_pos;\\nvarying float v_scale;\\n\\nvoid main() {\\n v_scale = u_scale;\\n v_pos = a_position.xy * u_scale;\\n gl_Position = u_matrix * u_rotationMatrix * vec4(a_position, 1.0);\\n}\\n\"","export default \"precision mediump float;\\nvarying vec2 v_pos;\\n \\nuniform int u_stopsNumber;\\nuniform float u_stops[100];\\nuniform vec4 u_colors[100];\\nuniform float u_maxDistance;\\n\\nvarying float v_scale;\\n\\nconst float EPSILON = 0.000001;\\n\\nvec2 center = vec2(0.0, 0.0);\\nvoid main() {\\n float rawDistance = distance(center, v_pos);\\n float distanceFromGlobeEdge = rawDistance - 1.0;\\n\\n vec4 color = u_colors[0];\\n\\n // if we're further than the max distance, we should not render anything.\\n // This is to always render a circle, otherwise we end up rendering\\n // to the corners of the plane.\\n if (distance(center, v_pos) > u_maxDistance * v_scale) {\\n discard;\\n }\\n\\n for (int i = 1; i < 100; i++) {\\n // if we're past the last stop\\n // we should fill to the end with the last stop color\\n if (i >= u_stopsNumber) {\\n color = u_colors[i - 1];\\n break;\\n }\\n\\n float scaledStopPosition = u_stops[i] * pow(v_scale, 1.6);\\n float lastStopValue = u_stops[i - 1];\\n float thisStopValue = u_stops[i];\\n\\n // this is to avoid blending errors when the stops are the same\\n // eg when you would want a sharp edge between two stops.\\n // `numbersAreEqual` will be 1.0 if the numbers are equal, 0.0 if they are not.\\n // We then subtract EPSILON from the last stop making the stop value _almost_ equal\\n // to the next stop but not enough to cause blending issues.\\n // It's more efficient to do this than an if / else statement.\\n float numbersAreEqual = 1.0 - step(EPSILON, abs(lastStopValue - thisStopValue));\\n lastStopValue = lastStopValue - numbersAreEqual * EPSILON;\\n\\n float lastScaledStopPosition = lastStopValue * pow(v_scale, 1.6);\\n\\n if (distanceFromGlobeEdge <= scaledStopPosition) {\\n float stopBlendFactor = (distanceFromGlobeEdge - lastScaledStopPosition) / (scaledStopPosition - lastScaledStopPosition);\\n color = mix(u_colors[i - 1], u_colors[i], stopBlendFactor);\\n break;\\n }\\n }\\n \\n // gl_FragColor = color;\\n gl_FragColor = vec4(color.rgb * color.a, color.a);\\n}\\n\"","import type { CustomLayerInterface, CustomRenderMethodInput } from \"maplibre-gl\";\nimport { mat4, vec3 } from \"gl-matrix\";\n\nimport type { Map as MapSDK } from \"../../Map\";\nimport { createObject3D, parseColorStringToVec4, type Object3D } from \"../../utils/webgl-utils\";\n\nimport vertexShaderSource from \"./radialGradient.vert.glsl?raw\";\nimport fragmentShaderSource from \"./radialGradient.frag.glsl?raw\";\nimport type { GradientDefinition, RadialGradientLayerConstructorOptions } from \"./types\";\nimport { lerp } from \"../../utils/math-utils\";\nimport { orderObjectKeys } from \"../../utils/object\";\n\nconst HALO_MAX_DISTANCE = 2;\n// 1 = globe radius\n\nconst ATTRIBUTES_KEYS = [\"position\"] as const;\nconst UNIFORMS_KEYS = [\"matrix\", \"rotationMatrix\", \"stopsNumber\", \"stops\", \"colors\", \"maxDistance\", \"scale\"] as const;\nconst VERTICES = [\n -HALO_MAX_DISTANCE,\n -HALO_MAX_DISTANCE,\n 0,\n HALO_MAX_DISTANCE,\n -HALO_MAX_DISTANCE,\n 0,\n -HALO_MAX_DISTANCE,\n HALO_MAX_DISTANCE,\n 0,\n HALO_MAX_DISTANCE,\n HALO_MAX_DISTANCE,\n 0,\n];\n\nconst defaultStops: Array<[number, string]> = [\n [0.0, \"rgba(176, 208, 240, 1)\"],\n [0.1, \"rgba(98, 168, 229, 0.3)\"],\n [0.2, \"rgba(98, 168, 229, 0.0)\"],\n] as const;\n\nconst defaultScale = 0.9;\n\nconst DELTA_CHANGE = 0.06;\n\n/**\n * A custom map layer that renders a radial gradient effect, typically used as a halo around a globe.\n * This layer uses WebGL for rendering and provides animation capabilities.\n *\n * The layer is implemented as a 3D custom layer that renders a billboard quad with a radial gradient shader.\n * The gradient can be configured with multiple color stops and can be animated.\n *\n * @example\n * ```typescript\n * // Create a simple halo layer with default settings\n * const haloLayer = new RadialGradientLayer(true);\n * map.addLayer(haloLayer);\n *\n * // Create a customized halo layer\n * const customHalo = new RadialGradientLayer({\n * scale: 1.5,\n * stops: [\n * [0, \"rgba(255, 255, 255, 0.8)\"],\n * [1, \"rgba(255, 255, 255, 0)\"]\n * ]\n * });\n * map.addLayer(customHalo);\n * ```\n * @remarks You shouldn't have to use this class directly.\n * Instead, use the `Map.setHalo` method to create and add a halo layer to the map.\n */\nexport class RadialGradientLayer implements CustomLayerInterface {\n public id: string = \"Halo Layer\";\n public type: CustomLayerInterface[\"type\"] = \"custom\";\n public renderingMode: CustomLayerInterface[\"renderingMode\"] = \"3d\";\n\n /**\n * The gradient definition used by this layer.\n * It contains the stops and scale for the radial gradient.\n * @private\n * @type {GradientDefinition}\n */\n private gradient: GradientDefinition;\n /**\n * The scale of the radial gradient, which determines its size.\n * This value is animated from 0 to the target scale during the layer's appearance.\n * @private\n * @type {number}\n */\n private scale: number = 0.0;\n\n /**\n * The animation delta value used to control the progress of the gradient's appearance animation.\n * It is incremented during each frame of the animation until it reaches 1.\n * @private\n * @type {number}\n */\n private animationDelta: number = 0.0;\n\n /**\n * The MapSDK instance to which this layer is added.\n * This is set when the layer is added to the map.\n * @private\n * @type {MapSDK}\n */\n private map!: MapSDK;\n\n /**\n * The 3D object representing the radial gradient plane.\n * This object is created when the layer is added to the map and contains the shader program and buffers.\n * It is used for rendering the radial gradient effect.\n * @private\n * @type {Object3D<(typeof ATTRIBUTES_KEYS)[number], (typeof UNIFORMS_KEYS)[number]>}\n */\n private plane?: Object3D<(typeof ATTRIBUTES_KEYS)[number], (typeof UNIFORMS_KEYS)[number]>;\n\n /**\n * Whether the halo should be animated in and out.\n * @private\n * @type {boolean}\n */\n private animationActive: boolean = true;\n\n /**\n * Creates a new RadialGradientLayer instance.\n *\n * @param {RadialGradientLayerConstructorOptions | boolean} gradient - Configuration options for the radial gradient or a boolean value.\n * If a boolean is provided, default configuration options will be used.\n * If an `RadialGradientLayerConstructorOptions` is provided, it will be merged with default options.\n */\n constructor(gradient: RadialGradientLayerConstructorOptions | boolean) {\n if (typeof gradient === \"boolean\") {\n this.gradient = {\n scale: defaultScale,\n stops: defaultStops,\n };\n return;\n }\n const errors = validateHaloSpecification(gradient);\n if (errors.length > 0) {\n throw new Error(`[RadialGradientLayer]: Invalid Halo specification:\n - ${errors.join(\"\\n - \")}\n `);\n }\n\n this.gradient = {\n scale: gradient.scale ?? defaultScale,\n stops: gradient.stops ?? defaultStops,\n };\n }\n\n /**\n * Adds the radial gradient layer to the specified map.\n * This method is called by the map when the layer is added to it.\n *\n * @param {MapSDK} map - The MapSDK instance to which this layer is being added\n * @param {WebGLRenderingContext | WebGL2RenderingContext} gl - The WebGL rendering context used for rendering the layer\n * @returns void\n */\n public onAdd(map: MapSDK, gl: WebGLRenderingContext | WebGL2RenderingContext): void {\n this.map = map;\n this.plane = createObject3D({\n gl,\n vertexShaderSource,\n fragmentShaderSource,\n attributesKeys: ATTRIBUTES_KEYS,\n uniformsKeys: UNIFORMS_KEYS,\n vertices: VERTICES,\n });\n\n void this.animateIn();\n }\n\n /**\n * Returns the current gradient configuration of the radial gradient layer.\n *\n * @returns {GradientDefinition} The current gradient configuration.\n */\n public getConfig() {\n return this.gradient;\n }\n\n /**\n * Checks if the gradient needs to be updated based on the provided specification.\n *\n * @param {GradientDefinition} spec - The gradient specification to compare with the current gradient.\n * @returns {boolean} True if the gradient needs to be updated, false otherwise.\n */\n public shouldUpdate(newSpec?: GradientDefinition | boolean): boolean {\n const currentSpec = this.getConfig();\n if (newSpec === undefined && currentSpec) {\n return true;\n }\n\n const orderedNewSpec = typeof newSpec === \"boolean\" ? newSpec : orderObjectKeys(newSpec);\n const orderedCurrentSpec = orderObjectKeys(currentSpec);\n return JSON.stringify(orderedNewSpec) !== JSON.stringify(orderedCurrentSpec);\n }\n\n /**\n * Animates the radial gradient into view by gradually scaling from 0 to the target scale.\n *\n * This method uses requestAnimationFrame to create a smooth scaling animation effect.\n * During each frame, it:\n * 1. Interpolates the scale value between 0 and the target scale\n * 2. Increments the animation progress (animationDelta)\n * 3. Triggers a map repaint\n *\n * @private\n * @returns {Promise<void>} A promise that resolves when the animation completes\n */\n private async animateIn() {\n if (!this.animationActive) {\n this.scale = this.gradient.scale;\n this.animationDelta = 1;\n this.map.triggerRepaint();\n return;\n }\n\n return new Promise<void>((resolve) => {\n this.animationDelta = 0;\n const animate = () => {\n if (this.animationDelta <= 1) {\n this.scale = lerp(0, this.gradient.scale, this.animationDelta);\n this.animationDelta += DELTA_CHANGE;\n this.map.triggerRepaint();\n requestAnimationFrame(animate);\n return;\n }\n resolve();\n };\n\n requestAnimationFrame(animate);\n });\n }\n\n /**\n * Animates the radial gradient layer out by gradually reducing its scale to zero.\n *\n * This method creates a smooth transition effect by linearly interpolating the scale\n * from its current value to zero over multiple animation frames. During each frame,\n * the animation progresses by incrementing the internal animation delta value.\n *\n * The map is repainted after each animation step to reflect the updated scale.\n *\n * @private\n * @returns A Promise that resolves when the animation is complete.\n */\n private async animateOut() {\n if (!this.animationActive) {\n return;\n }\n\n this.animationDelta = 0;\n return new Promise<void>((resolve) => {\n const animate = () => {\n if (this.animationDelta < 1) {\n this.scale = lerp(this.gradient.scale, 0, this.animationDelta);\n this.animationDelta += DELTA_CHANGE;\n this.map.triggerRepaint();\n requestAnimationFrame(animate);\n return;\n }\n resolve();\n };\n animate();\n });\n }\n\n public onRemove(_map: MapSDK, gl: WebGLRenderingContext | WebGL2RenderingContext): void {\n if (this.plane !== undefined) {\n gl.deleteProgram(this.plane.shaderProgram);\n gl.deleteBuffer(this.plane.positionBuffer);\n }\n }\n\n public prerender(_gl: WebGLRenderingContext | WebGL2RenderingContext, _options: CustomRenderMethodInput): void {}\n\n public render(gl: WebGLRenderingContext | WebGL2RenderingContext, options: CustomRenderMethodInput): void {\n if (this.map === undefined) {\n throw new Error(\"[RadialGradientLayer]: Map is undefined\");\n }\n\n if (!this.map.isGlobeProjection()) {\n return;\n }\n\n if (this.plane === undefined) {\n throw new Error(\"[RadialGradientLayer]: Plane is undefined\");\n }\n\n gl.disable(gl.DEPTH_TEST);\n gl.enable(gl.BLEND);\n\n gl.useProgram(this.plane.shaderProgram);\n gl.bindBuffer(gl.ARRAY_BUFFER, this.plane.positionBuffer);\n\n const positionLocation = this.plane.programInfo.attributesLocations.position;\n gl.enableVertexAttribArray(positionLocation);\n gl.vertexAttribPointer(positionLocation, 3, gl.FLOAT, false, 0, 0);\n\n const scaleMatrix = mat4.create();\n\n // Since globe size is 1 we assume that the plane size is 2\n // This means that halo radius from origin is 3 * globe radius\n // and from the globe surface to end is 2 * globe radius\n const scale = this.scale;\n mat4.scale(scaleMatrix, scaleMatrix, [scale, scale, scale]);\n\n const matrix = mat4.create();\n mat4.multiply(matrix, options.defaultProjectionData.mainMatrix, scaleMatrix);\n\n const matrixLocation = this.plane.programInfo.uniformsLocations.matrix;\n gl.uniformMatrix4fv(matrixLocation, false, matrix);\n\n /**\n * Billboard\n */\n const rotationMatrix = mat4.create();\n const cameraPos = this.map.transform.cameraPosition;\n const forward = vec3.normalize(vec3.create(), cameraPos);\n const up = vec3.fromValues(0, 1, 0);\n const right = vec3.create();\n vec3.cross(right, up, forward);\n vec3.normalize(right, right);\n\n const billboardUp = vec3.create();\n vec3.cross(billboardUp, forward, right);\n vec3.normalize(billboardUp, billboardUp);\n\n /**\n * Rotation matrix\n *\n * Collumn 1: right\n * Collumn 2: up\n * Collumn 3: forward\n */\n mat4.set(rotationMatrix, right[0], right[1], right[2], 0, billboardUp[0], billboardUp[1], billboardUp[2], 0, forward[0], forward[1], forward[2], 0, 0, 0, 0, 1);\n\n const rotationMatrixLocation = this.plane.programInfo.uniformsLocations.rotationMatrix;\n gl.uniformMatrix4fv(rotationMatrixLocation, false, rotationMatrix);\n\n const stopsNumber = this.gradient.stops.length;\n\n const stopsArray: Array<number> = [];\n const colorsArray: Array<number> = [];\n\n for (let i = 0; i <= stopsNumber; i++) {\n if (i < stopsNumber) {\n stopsArray[i] = this.gradient.stops[i][0];\n\n const color = parseColorStringToVec4(this.gradient.stops[i][1]);\n colorsArray.push(...color);\n }\n }\n\n gl.uniform1i(this.plane.programInfo.uniformsLocations.stopsNumber, stopsNumber);\n gl.uniform1fv(this.plane.programInfo.uniformsLocations.stops, new Float32Array(stopsArray));\n gl.uniform4fv(this.plane.programInfo.uniformsLocations.colors, new Float32Array(colorsArray));\n gl.uniform1f(this.plane.programInfo.uniformsLocations.maxDistance, HALO_MAX_DISTANCE);\n gl.uniform1f(this.plane.programInfo.uniformsLocations.scale, scale);\n\n gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);\n }\n\n /**\n * Sets a new gradient for the radial gradient layer and animates the transition.\n *\n * This method first animates the current gradient out, then updates the gradient\n * property with the new gradient definition, and finally animates the new gradient in.\n *\n * @param {GradientDefinition} gradient - The new gradient definition to set for this layer.\n * @returns {Promise<void>} A promise that resolves when the new gradient is set and animated in.\n */\n public async setGradient(gradient: GradientDefinition | boolean): Promise<void> {\n if (gradient === false) {\n await this.animateOut();\n return;\n }\n\n await this.animateOut();\n\n const errors = validateHaloSpecification(gradient);\n if (errors.length > 0) {\n throw new Error(`[RadialGradientLayer]: Invalid Halo specification:\n - ${errors.join(\"\\n - \")}\n `);\n }\n\n if (gradient === true) {\n this.gradient.scale = defaultScale;\n this.gradient.stops = defaultStops;\n } else {\n this.gradient.scale = gradient.scale ?? defaultScale;\n this.gradient.stops = gradient.stops ?? defaultStops;\n }\n\n await this.animateIn();\n }\n\n public setAnimationActive(active: boolean) {\n this.animationActive = active;\n }\n\n public show(): void {\n // TODO in future we can ease / animate this\n this.map.setLayoutProperty(this.id, \"visibility\", \"visible\");\n }\n\n public hide(): void {\n // TODO in future we can ease / animate this\n this.map.setLayoutProperty(this.id, \"visibility\", \"none\");\n }\n}\n\nconst validKeys = [\"scale\", \"stops\"];\n\nexport function validateHaloSpecification(halo: RadialGradientLayerConstructorOptions | boolean): Array<string> {\n const errors: string[] = [];\n\n if (typeof halo === \"boolean\") {\n return [];\n }\n\n try {\n const additionalKeys = Object.keys(halo).filter((key) => !validKeys.includes(key));\n if (additionalKeys.length > 0) {\n errors.push(`Properties ${additionalKeys.map((key) => `\\`${key}\\``).join(\", \")} are not supported.`);\n }\n } catch {\n errors.push(\"Halo specification is not an object.\");\n }\n\n if (typeof halo.scale !== \"number\") {\n errors.push(\"Halo `scale` property is not a number.\");\n }\n\n // this is testing external data so we need to check\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!halo.stops || halo.stops.length === 0) {\n errors.push(\"Halo `stops` property is not an array.\");\n }\n\n // this is testing external data so we need to check\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (halo.stops?.some((stop) => typeof stop[0] !== \"number\" || typeof stop[1] !== \"string\")) {\n errors.push(\"Halo `stops` property is not an array of [number, string]\");\n }\n\n return errors;\n}\n","import { getVersion } from \"..\";\n\nexport function logSDKVersion() {\n const purpleCSS = \"color: #3A1888; background: white; padding: 5px 0; font-weight: bold;\";\n const yellowCSS = \"color: #FBC935; background: white; padding: 5px; font-weight: bold;\";\n const redCSS = \"color: #F1175D; background: white; padding: 5px 0; font-weight: bold;\";\n const blackCSS = \"color: #333; background: white; padding: 5px 0; font-weight: bold;\";\n\n console.info(\n `%c❖%c❖%c❖ %cMapTiler SDK JS v${getVersion()} %c❖%c❖%c❖`,\n yellowCSS + \"padding-right: 0;\",\n purpleCSS,\n redCSS,\n blackCSS,\n redCSS,\n purpleCSS,\n yellowCSS + \"padding-left: 0;\",\n );\n}\n","import maplibregl from \"maplibre-gl\";\nimport { Base64 } from \"js-base64\";\nimport type {\n StyleSpecification,\n MapOptions as MapOptionsML,\n ControlPosition,\n StyleSwapOptions,\n StyleOptions,\n MapDataEvent,\n // Tile,\n RasterDEMSourceSpecification,\n RequestTransformFunction,\n Source,\n LayerSpecification,\n SourceSpecification,\n CustomLayerInterface,\n FilterSpecification,\n StyleSetterOptions,\n ExpressionSpecification,\n SymbolLayerSpecification,\n AttributionControlOptions,\n ProjectionSpecification,\n} from \"maplibre-gl\";\nimport type { ReferenceMapStyle, MapStyleVariant } from \"@maptiler/client\";\nimport { config, MAPTILER_SESSION_ID, type SdkConfig } from \"./config\";\nimport { defaults } from \"./constants/defaults\";\nimport { MaptilerLogoControl } from \"./controls/MaptilerLogoControl\";\nimport { changeFirstLanguage, checkNamePattern, combineTransformRequest, computeLabelsLocalizationMetrics, displayNoWebGlWarning, replaceLanguage } from \"./tools\";\nimport { getBrowserLanguage, Language, type LanguageInfo } from \"./language\";\nimport { styleToStyle } from \"./mapstyle\";\nimport { MaptilerTerrainControl } from \"./controls/MaptilerTerrainControl\";\nimport { MaptilerNavigationControl } from \"./controls/MaptilerNavigationControl\";\nimport { MapStyle, geolocation, getLanguageInfoFromFlag, toLanguageInfo } from \"@maptiler/client\";\nimport { MaptilerGeolocateControl } from \"./controls/MaptilerGeolocateControl\";\nimport { ScaleControl } from \"./MLAdapters/ScaleControl\";\nimport { FullscreenControl } from \"./MLAdapters/FullscreenControl\";\nimport { MaptilerExternalControlType, MaptilerExternalControl } from \"./controls/MaptilerExternalControl\";\n\nimport Minimap from \"./controls/Minimap\";\nimport type { MinimapOptionsInput } from \"./controls/Minimap\";\nimport { CACHE_API_AVAILABLE, registerLocalCacheProtocol } from \"./caching\";\nimport { MaptilerProjectionControl } from \"./controls/MaptilerProjectionControl\";\nimport { Telemetry } from \"./Telemetry\";\nimport { CubemapDefinition, CubemapLayer, CubemapLayerConstructorOptions, validateSpaceSpecification } from \"./custom-layers/CubemapLayer\";\nimport { GradientDefinition, RadialGradientLayer, RadialGradientLayerConstructorOptions } from \"./custom-layers/RadialGradientLayer\";\nimport { StyleSpecificationWithMetaData } from \"./custom-layers/extractCustomLayerStyle\";\nimport { logSDKVersion } from \"./utils/logSDKVersion\";\n\nexport type LoadWithTerrainEvent = {\n type: \"loadWithTerrain\";\n target: Map;\n terrain: {\n source: string;\n exaggeration: number;\n };\n};\n\nexport const GeolocationType: {\n POINT: \"POINT\";\n COUNTRY: \"COUNTRY\";\n} = {\n POINT: \"POINT\",\n COUNTRY: \"COUNTRY\",\n} as const;\n\ntype MapTerrainDataEvent = MapDataEvent & {\n isSourceLoaded: boolean;\n // tile: Tile;\n sourceId: string;\n source: RasterDEMSourceSpecification;\n};\n\n/**\n * The type of projection, `undefined` means it's decided by the style and if the style does not contain any projection info,\n * if falls back to the default Mercator\n */\nexport type ProjectionTypes = \"mercator\" | \"globe\" | undefined;\n\n/**\n * Options to provide to the `Map` constructor\n */\nexport type MapOptions = Omit<MapOptionsML, \"style\" | \"maplibreLogo\"> & {\n /**\n * Style of the map. Can be:\n * - a full style URL (possibly with API key)\n * - a shorthand with only the MapTIler style name (eg. `\"streets-v2\"`)\n * - a longer form with the prefix `\"maptiler://\"` (eg. `\"maptiler://streets-v2\"`)\n */\n style?: ReferenceMapStyle | MapStyleVariant | StyleSpecification | string;\n\n /**\n * Define the language of the map. This can be done directly with a language ISO code (eg. \"en\"),\n * the ISO code prepended with the OSM flag (eg. \"name:en\" or even just \"name\"),\n * or with a built-in shorthand (eg. Language.ENGLISH).\n * Note that this is equivalent to setting the `config.primaryLanguage` and will overwrite it.\n */\n language?: LanguageInfo | string;\n\n /**\n * Define the MapTiler Cloud API key to be used. This is strictly equivalent to setting\n * `config.apiKey` and will overwrite it.\n */\n apiKey?: string;\n\n /**\n * Shows or hides the MapTiler logo in the bottom left corner (only for paid plans).\n * Default is `false` for paid plans.\n *\n * For free plans the MapTiler logo is always visible, and cannot be disabled.\n * @example\n * ```ts\n * mapTilerLogo: false // hides the logo\n * ```\n * @example\n * ```ts\n * mapTilerLogo: true // shows the logo\n * ```\n */\n maptilerLogo?: boolean;\n\n /**\n * Attribution text to show in an {@link AttributionControl}.\n */\n customAttribution?: string | Array<string>;\n\n /**\n * Enables 3D terrain if `true`. (default: `false`)\n */\n terrain?: boolean;\n\n /**\n * Exaggeration factor of the terrain. (default: `1`, no exaggeration)\n */\n terrainExaggeration?: number;\n\n /**\n * Show the navigation control. (default: `true`, will hide if `false`)\n */\n navigationControl?: boolean | ControlPosition;\n\n /**\n * Show the terrain control. (default: `false`, will show if `true`)\n */\n terrainControl?: boolean | ControlPosition;\n\n /**\n * Show the geolocate control. (default: `true`, will hide if `false`)\n */\n geolocateControl?: boolean | ControlPosition;\n\n /**\n * Show the scale control. (default: `false`, will show if `true`)\n */\n scaleControl?: boolean | ControlPosition;\n\n /**\n * Show the full screen control. (default: `false`, will show if `true`)\n */\n fullscreenControl?: boolean | ControlPosition;\n\n /**\n * Detect custom external controls. (default: `false`, will detect automatically if `true`)\n */\n customControls?: boolean | string;\n\n /**\n * Display a minimap in a user defined corner of the map. (default: `bottom-left` corner)\n * If set to true, the map will assume it is a minimap and forego the attribution control.\n */\n minimap?: boolean | ControlPosition | MinimapOptionsInput;\n\n /**\n * attributionControl\n */\n forceNoAttributionControl?: boolean;\n\n /**\n * Method to position the map at a given geolocation. Only if:\n * - `hash` is `false`\n * - `center` is not provided\n *\n * If the value is `true` of `\"POINT\"` (given by `GeolocationType.POINT`) then the positionning uses the MapTiler Cloud\n * Geolocation to find the non-GPS location point.\n * The zoom level can be provided in the `Map` constructor with the `zoom` option or will be `13` if not provided.\n *\n * If the value is `\"COUNTRY\"` (given by `GeolocationType.COUNTRY`) then the map is centered around the bounding box of the country.\n * In this case, the `zoom` option will be ignored.\n *\n * If the value is `false`, no geolocation is performed and the map centering and zooming depends on other options or on\n * the built-in defaults.\n *\n * If this option is non-false and the options `center` is also provided, then `center` prevails.\n *\n * Default: `false`\n */\n geolocate?: (typeof GeolocationType)[keyof typeof GeolocationType] | boolean;\n\n /**\n * Show the projection control. (default: `false`, will show if `true`)\n */\n projectionControl?: boolean | ControlPosition;\n\n /**\n * Whether the projection should be \"mercator\" or \"globe\".\n * If not provided, the style takes precedence. If provided, overwrite the style.\n */\n projection?: ProjectionTypes;\n\n /**\n * Turn on/off spacebox.\n *\n * Default: { color: \"#1D29F1\" }\n */\n space?: CubemapLayerConstructorOptions | boolean;\n halo?: RadialGradientLayerConstructorOptions | boolean;\n\n /**\n * Whether to log the SDK version to the console.\n * Default: Unless this is set explicitly to false, the SDK version will be logged to the console.\n */\n logSDKVersion?: boolean;\n};\n\n/**\n * The Map class can be instanciated to display a map in a `<div>`\n */\nexport class Map extends maplibregl.Map {\n public readonly telemetry: Telemetry;\n\n private space?: CubemapLayer;\n private halo?: RadialGradientLayer;\n\n public getSpace(): CubemapLayer | undefined {\n return this.space;\n }\n\n /**\n * Sets the space for the map.\n * @param {CubemapDefinition} space the `CubemapDefinition` options to set.\n * @remarks This method, at present, ** overwrites ** the current config.\n * If an option is not set it will internally revert to the default option\n * unless explicitly set when calling.\n */\n public setSpace(space: CubemapDefinition | boolean, updateOptions = true) {\n if (updateOptions) {\n this.options.space = space;\n }\n\n if (space === false) {\n this.space = undefined;\n return;\n }\n\n if (this.space) {\n void this.space.setCubemap(space);\n if (!this.getLayer(this.space.id)) {\n this.addLayer(this.space, this.getLayersOrder()[0]);\n }\n return;\n }\n\n this.space = new CubemapLayer(space);\n\n void this.once(\"load\", () => {\n const firstLayer = this.getLayersOrder()[0];\n if (this.space) {\n this.addLayer(this.space, firstLayer);\n }\n });\n }\n\n /**\n * Enables the animations for the space layer.\n */\n public enableSpaceAnimations() {\n this.setSpaceAnimationActive(true);\n }\n\n /**\n * Disables the animations for the space layer.\n */\n public disableSpaceAnimations() {\n this.setSpaceAnimationActive(false);\n }\n\n /**\n * Enables the animations for the halo layer.\n */\n public enableHaloAnimations() {\n this.setHaloAnimationActive(true);\n }\n\n /**\n * Disables the animations for the halo layer.\n */\n public disableHaloAnimations() {\n this.setHaloAnimationActive(false);\n }\n\n /**\n * Sets whether the halo layer should be animated in and out.\n * @param active - Whether the animation should be active.\n */\n public setHaloAnimationActive(active: boolean) {\n if (this.halo) {\n this.halo.setAnimationActive(active);\n } else {\n void this.once(\"load\", () => {\n this.halo?.setAnimationActive(active);\n });\n }\n }\n\n /**\n * Sets whether the space layer should be animated in and out.\n * @param active - Whether the animation should be active.\n */\n public setSpaceAnimationActive(active: boolean) {\n if (this.space) {\n this.space.setAnimationActive(active);\n } else {\n void this.once(\"load\", () => {\n this.space?.setAnimationActive(active);\n });\n }\n }\n\n private setSpaceFromStyle({ style }: { style: StyleSpecificationWithMetaData }) {\n if (this.options.space === false) {\n return;\n }\n\n // respect options over style specification.\n if (this.options.space !== true && validateSpaceSpecification(this.options.space)) {\n this.setSpace(this.options.space!);\n return;\n }\n\n const space = style.metadata?.maptiler?.space;\n\n const spaceSpecIsValid = validateSpaceSpecification(space);\n\n if (JSON.stringify(this.space?.getConfig()) === JSON.stringify(space)) {\n // because maplibre removes ALL layers when setting a new style, we need to add the space layer back\n // even if it hasn't changed\n if (this.space && !this.getLayer(this.space.id)) {\n const before = this.getLayersOrder()[0];\n this.addLayer(this.space, before);\n }\n return;\n }\n\n if (spaceSpecIsValid) {\n // validateSpaceSpecification guarantees that spec is not undefined\n this.setSpace(space!, false);\n return;\n }\n\n if (this.options.space === true) {\n this.setSpace(true);\n return;\n }\n\n const spaceExistedButNowDoesNot = this.space?.getConfig() && space === undefined;\n\n if (spaceExistedButNowDoesNot) {\n this.setSpace({ color: \"transparent\" }, false);\n this.removeLayer(this.space?.id ?? \"\");\n return;\n }\n\n if (this.space && this.isGlobeProjection()) {\n if (!this.getLayer(this.space.id)) {\n const before = this.getLayersOrder()[0];\n this.addLayer(this.space, before);\n }\n\n void this.space.setCubemap(space!);\n }\n }\n\n private setHaloFromStyle({ style }: { style: StyleSpecificationWithMetaData }) {\n if (this.options.halo === false) {\n return;\n }\n\n const maptiler = style.metadata?.maptiler;\n\n if (JSON.stringify(this.halo?.getConfig()) === JSON.stringify(maptiler?.halo)) {\n // because maplibre removes ALL layers when setting a new style, we need to add the halo layer back\n // even if it hasn't changed\n if (this.halo && !this.getLayer(this.halo.id)) {\n const beforeIndex = this.getLayersOrder().indexOf(this.space?.id ?? \"\") + 1;\n const before = this.getLayersOrder()[beforeIndex];\n this.addLayer(this.halo, before);\n }\n return;\n }\n\n if (!maptiler?.halo && !this.options.halo) {\n this.setHalo({\n stops: [\n [0, \"transparent\"],\n [0.01, \"transparent\"],\n ],\n scale: 1,\n });\n return;\n }\n\n const updateHalo = () => {\n if (this.halo) {\n if (!this.getLayer(this.halo.id)) {\n const beforeIndex = this.getLayersOrder().indexOf(this.space?.id ?? \"\") + 1;\n const before = this.getLayersOrder()[beforeIndex];\n this.addLayer(this.halo, before);\n }\n\n const spec = maptiler?.halo ?? this.options.halo;\n\n if (spec) {\n void this.halo.setGradient(spec);\n }\n }\n };\n\n updateHalo();\n }\n\n private initSpace({ options = this.options, before, spec }: { options?: MapOptions; before: string; spec?: CubemapDefinition }) {\n if (this.space) {\n if (!this.getLayer(this.space.id)) {\n // If the space layer is already initialized but not added to the map, we add it now\n this.addLayer(this.space, before);\n }\n return;\n }\n\n if (options.space === false) return;\n\n if (options.space) {\n this.space = new CubemapLayer(options.space);\n this.addLayer(this.space, before);\n return;\n }\n\n const spaceOptionsFromStyleSpec = spec;\n\n if (spaceOptionsFromStyleSpec) {\n this.space = new CubemapLayer(spaceOptionsFromStyleSpec);\n this.addLayer(this.space, before);\n }\n }\n\n private initHalo({ options = this.options, before, spec }: { options?: MapOptions; before: string; spec?: GradientDefinition }) {\n if (this.halo && this.getLayer(this.halo.id)) {\n return;\n }\n if (options.halo === false) return;\n\n const haloOptionsFromStyleSpec = spec;\n if (options.halo) {\n this.halo = new RadialGradientLayer(options.halo);\n this.addLayer(this.halo, before);\n return;\n }\n\n if (haloOptionsFromStyleSpec) {\n this.halo = new RadialGradientLayer(haloOptionsFromStyleSpec);\n this.addLayer(this.halo, before);\n }\n }\n\n public getHalo(): RadialGradientLayer | undefined {\n return this.halo;\n }\n\n public setHalo(halo: GradientDefinition) {\n this.options.halo = halo;\n if (!this.isGlobeProjection()) {\n return;\n }\n\n if (this.halo) {\n void this.halo.setGradient(halo);\n return;\n }\n\n this.halo = new RadialGradientLayer(halo);\n\n void this.once(\"load\", () => {\n const layersOrder = this.getLayersOrder();\n\n const firstLayer = layersOrder[0];\n\n const insertBeforeIndex = layersOrder.indexOf(this.space?.id ?? \"\") + 2;\n\n const insertBefore = layersOrder[insertBeforeIndex];\n if (this.halo) {\n this.addLayer(this.halo, this.space ? insertBefore : firstLayer);\n }\n });\n }\n\n private options: MapOptions;\n private isTerrainEnabled = false;\n private terrainExaggeration = 1;\n private primaryLanguage: LanguageInfo;\n private terrainGrowing = false;\n private terrainFlattening = false;\n private minimap?: Minimap;\n private forceLanguageUpdate: boolean;\n private languageAlwaysBeenStyle: boolean;\n private isReady = false;\n private terrainAnimationDuration = 1000;\n private monitoredStyleUrls!: Set<string>;\n private styleInProcess = false;\n private curentProjection: ProjectionTypes = undefined;\n private originalLabelStyle = new window.Map<string, ExpressionSpecification | string>();\n private isStyleLocalized = false;\n private languageIsUpdated = false;\n\n constructor(options: MapOptions) {\n if (options.logSDKVersion !== false) logSDKVersion();\n\n displayNoWebGlWarning(options.container);\n\n if (options.apiKey) {\n config.apiKey = options.apiKey;\n }\n\n const { style, requiresUrlMonitoring, isFallback } = styleToStyle(options.style);\n if (isFallback) {\n console.warn(\n \"Invalid style. A style must be a valid URL to a style.json, a JSON string representing a valid StyleSpecification or a valid StyleSpecification object. Fallback to default MapTiler style.\",\n );\n }\n\n if (!config.apiKey) {\n console.warn(\"MapTiler Cloud API key is not set. Visit https://maptiler.com and try Cloud for free!\");\n }\n\n const hashPreConstructor = location.hash;\n\n // default attribution control options\n let attributionControlOptions = {\n compact: false,\n } as AttributionControlOptions;\n if (options.customAttribution) {\n attributionControlOptions.customAttribution = options.customAttribution;\n } else if (options.attributionControl && typeof options.attributionControl === \"object\") {\n attributionControlOptions = {\n ...attributionControlOptions,\n ...options.attributionControl,\n };\n }\n\n const superOptions = {\n ...options,\n style,\n maplibreLogo: false,\n transformRequest: combineTransformRequest(options.transformRequest),\n attributionControl: options.forceNoAttributionControl === true ? false : attributionControlOptions,\n } as maplibregl.MapOptions;\n\n // Removing the style option from the super constructor so that we can initialize this.styleInProcess before\n // calling .setStyle(). Otherwise, if a style is provided to the super constructor, the setStyle method is called as\n // a child call of super, meaning instance attributes cannot be initialized yet.\n // The styleInProcess instance attribute is necessary to track if a style has not fall into a CORS error, for which\n // Maplibre DOES NOT throw an AJAXError (hence does not track the URL of the failed http request)\n delete superOptions.style;\n super(superOptions);\n\n this.options = options;\n\n this.setStyle(style);\n\n if (requiresUrlMonitoring) {\n this.monitorStyleUrl(style as string);\n }\n\n const applyFallbackStyle = () => {\n let warning = \"The distant style could not be loaded.\";\n // Loading a new style failed. If a style is not already in place,\n // the default one is loaded instead + warning in console\n if (!this.getStyle()) {\n this.setStyle(MapStyle.STREETS);\n warning += `Loading default MapTiler Cloud style \"${MapStyle.STREETS.getDefaultVariant().getId()}\" as a fallback.`;\n } else {\n warning += \" Leaving the style as is.\";\n }\n console.warn(warning);\n };\n\n this.on(\"style.load\", () => {\n this.styleInProcess = false;\n });\n\n // Safeguard for distant styles at non-http 2xx status URLs\n this.on(\"error\", (event) => {\n if (event.error instanceof maplibregl.AJAXError) {\n const err = event.error as maplibregl.AJAXError;\n const url = err.url;\n const cleanUrl = new URL(url);\n cleanUrl.search = \"\";\n const clearnUrlStr = cleanUrl.href;\n\n // If the URL is present in the list of monitored style URL,\n // that means this AJAXError was about a style, and we want to fallback to\n // the default style\n if (this.monitoredStyleUrls && this.monitoredStyleUrls.has(clearnUrlStr)) {\n this.monitoredStyleUrls.delete(clearnUrlStr);\n applyFallbackStyle();\n }\n return;\n }\n\n // CORS error when fetching distant URL are not detected as AJAXError by Maplibre, just as generic error with no url property\n // so we have to find a way to detect them when it comes to failing to load a style.\n if (this.styleInProcess) {\n // If this.styleInProcess is true, it very likely means the style URL has not resolved due to a CORS issue.\n // In such case, we load the default style\n applyFallbackStyle();\n return;\n }\n });\n\n if (config.caching && !CACHE_API_AVAILABLE) {\n console.warn(\"The cache API is only available in secure contexts. More info at https://developer.mozilla.org/en-US/docs/Web/API/Cache\");\n }\n\n if (config.caching && CACHE_API_AVAILABLE) {\n registerLocalCacheProtocol();\n }\n\n if (typeof options.language === \"undefined\") {\n this.primaryLanguage = config.primaryLanguage;\n } else {\n const providedlanguage = toLanguageInfo(options.language, Language);\n this.primaryLanguage = providedlanguage ?? config.primaryLanguage;\n }\n\n this.forceLanguageUpdate = this.primaryLanguage === Language.STYLE || this.primaryLanguage === Language.STYLE_LOCK ? false : true;\n this.languageAlwaysBeenStyle = this.primaryLanguage === Language.STYLE;\n this.terrainExaggeration = options.terrainExaggeration ?? this.terrainExaggeration;\n\n this.curentProjection = options.projection;\n\n // Managing the type of projection and persist if not present in style\n this.on(\"style.load\", (_e) => {\n if (this.curentProjection === \"mercator\") {\n this.setProjection({ type: \"mercator\" });\n } else if (this.curentProjection === \"globe\") {\n this.setProjection({ type: \"globe\" });\n }\n });\n // Map centering and geolocation\n this.once(\"styledata\", async () => {\n // Not using geolocation centering if...\n\n // the geolcoate option is not provided or is falsy\n if (!options.geolocate) {\n return;\n }\n\n // ... a center is provided in options\n if (options.center) {\n return;\n }\n\n // ... the hash option is enabled and a hash is present in the URL\n if (options.hash && !!hashPreConstructor) {\n return;\n }\n\n // If the geolocation is set to COUNTRY:\n try {\n if (options.geolocate === GeolocationType.COUNTRY) {\n await this.fitToIpBounds();\n return;\n }\n } catch (e) {\n // not raising\n console.warn((e as Error).message);\n }\n\n // As a fallback, we want to center the map on the visitor. First with IP geolocation...\n let ipLocatedCameraHash: string;\n try {\n await this.centerOnIpPoint(options.zoom);\n ipLocatedCameraHash = this.getCameraHash();\n } catch (e) {\n // not raising\n console.warn((e as Error).message);\n }\n\n // A more precise localization\n\n // This more advanced localization is commented out because the easeTo animation\n // triggers an error if the terrain grow is enabled (due to being nable to project the center while moving)\n\n // Then, the get a more precise location, we rely on the browser location, but only if it was already granted\n // before (we don't want to ask wih a popup at launch time)\n const locationResult = await navigator.permissions.query({\n name: \"geolocation\",\n });\n\n if (locationResult.state === \"granted\") {\n navigator.geolocation.getCurrentPosition(\n // success callback\n (data) => {\n // If the user has already moved since the ip location, then we no longer want to move the center\n if (ipLocatedCameraHash !== this.getCameraHash()) {\n return;\n }\n\n if (this.terrain) {\n this.easeTo({\n center: [data.coords.longitude, data.coords.latitude],\n zoom: options.zoom || 12,\n duration: 2000,\n });\n } else {\n this.once(\"terrain\", () => {\n this.easeTo({\n center: [data.coords.longitude, data.coords.latitude],\n zoom: options.zoom || 12,\n duration: 2000,\n });\n });\n }\n },\n\n // error callback\n null,\n\n // options\n {\n maximumAge: 24 * 3600 * 1000, // a day in millisec\n timeout: 5000, // milliseconds\n enableHighAccuracy: false,\n },\n );\n }\n });\n\n // If the config includes language changing, we must update the map language\n this.on(\"styledata\", () => {\n this.setPrimaryLanguage(this.primaryLanguage);\n });\n\n // this even is in charge of reaplying the terrain elevation after the\n // style has changed because depending on the src/tgt style,\n // the style logic is not always able to resolve the application of terrain\n this.on(\"styledata\", () => {\n // the styling resolver did no manage to reaply the terrain,\n // so let's reload it\n if (this.getTerrain() === null && this.isTerrainEnabled) {\n this.enableTerrain(this.terrainExaggeration);\n }\n });\n\n // Update logo and attibution\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n void this.once(\"load\", async () => {\n let tileJsonContent = { logo: null };\n\n try {\n const possibleSources = Object.keys(this.style.tileManagers)\n .map((sourceName) => this.getSource(sourceName))\n .filter((s: Source | undefined) => s && \"url\" in s && typeof s.url === \"string\" && s.url.includes(\"tiles.json\"));\n\n const styleUrl = new URL((possibleSources[0] as maplibregl.VectorTileSource).url);\n\n if (!styleUrl.searchParams.has(\"key\")) {\n styleUrl.searchParams.append(\"key\", config.apiKey);\n }\n\n const tileJsonRes = await fetch(styleUrl.href);\n tileJsonContent = await tileJsonRes.json();\n } catch (_e) {\n // No tiles.json found (should not happen on maintained styles)\n }\n\n if (options.customControls) {\n const groupSelector = \"[data-maptiler-control-group]\";\n const controlSelector = \"[data-maptiler-control]\";\n const getControlType = (element: HTMLElement) => {\n let type = element.dataset.maptilerControl as MaptilerExternalControlType | \"true\" | \"\" | undefined;\n // value of empty data attribute in React is string \"true\", empty string elsewhere\n if (type === \"true\" || type === \"\") type = undefined;\n return type;\n };\n const getPosition = (element: HTMLElement) => element.dataset.maptilerPosition as ControlPosition | undefined;\n\n let groupElements = [...(this._container.ownerDocument.querySelectorAll(groupSelector) as NodeListOf<HTMLElement>)];\n let controlElements = [...(this._container.ownerDocument.querySelectorAll(controlSelector) as NodeListOf<HTMLElement>)].filter(\n (controlElement) => controlElement.closest(groupSelector) === null,\n );\n\n if (typeof options.customControls === \"string\") {\n const limitingSelector = options.customControls;\n groupElements = groupElements.filter((groupElement) => groupElement.matches(limitingSelector) || groupElement.closest(limitingSelector) !== null);\n controlElements = controlElements.filter((controlElement) => controlElement.matches(limitingSelector) || controlElement.closest(limitingSelector) !== null);\n }\n\n for (const groupElement of groupElements) {\n const control = new MaptilerExternalControl(groupElement);\n this.addControl(control, getPosition(groupElement));\n\n for (const controlElement of groupElement.querySelectorAll(controlSelector) as NodeListOf<HTMLElement>) {\n control.configureGroupItem(controlElement, getControlType(controlElement));\n }\n }\n\n for (const controlElement of controlElements) {\n this.addControl(new MaptilerExternalControl(controlElement, getControlType(controlElement)), getPosition(controlElement));\n }\n\n const setStyleProps = () => {\n const { lng, lat } = this.getCenter();\n this._container.style.setProperty(\"--maptiler-center-lng\", String(lng));\n this._container.style.setProperty(\"--maptiler-center-lat\", String(lat));\n this._container.style.setProperty(\"--maptiler-zoom\", String(this.getZoom()));\n this._container.style.setProperty(\"--maptiler-bearing\", String(this.getBearing()));\n this._container.style.setProperty(\"--maptiler-pitch\", String(this.getPitch()));\n this._container.style.setProperty(\"--maptiler-roll\", String(this.getRoll()));\n this._container.style.setProperty(\"--maptiler-is-globe-projection\", String(this.isGlobeProjection()));\n this._container.style.setProperty(\"--maptiler-has-terrain\", String(this.hasTerrain()));\n };\n\n setStyleProps();\n this.on(\"render\", setStyleProps);\n }\n\n // The attribution and logo must show when required\n if (options.forceNoAttributionControl !== true) {\n if (\"logo\" in tileJsonContent && tileJsonContent.logo) {\n const logoURL: string = tileJsonContent.logo;\n\n this.addControl(new MaptilerLogoControl({ logoURL }), options.logoPosition);\n } else if (options.maptilerLogo) {\n this.addControl(new MaptilerLogoControl(), options.logoPosition);\n }\n }\n\n // the other controls at init time but be after\n // (due to the async nature of logo control)\n\n // By default, no scale control\n if (options.scaleControl) {\n // default position, if not provided, is top left corner\n const position = (options.scaleControl === true || options.scaleControl === undefined ? \"bottom-right\" : options.scaleControl) as ControlPosition;\n\n const scaleControl = new ScaleControl({ unit: config.unit });\n this.addControl(scaleControl, position);\n config.on(\"unit\", (unit) => {\n scaleControl.setUnit(unit);\n });\n }\n\n if (options.navigationControl !== false) {\n // default position, if not provided, is top left corner\n const position = (options.navigationControl === true || options.navigationControl === undefined ? \"top-right\" : options.navigationControl) as ControlPosition;\n this.addControl(new MaptilerNavigationControl(), position);\n }\n\n if (options.geolocateControl !== false) {\n // default position, if not provided, is top left corner\n const position = (options.geolocateControl === true || options.geolocateControl === undefined ? \"top-right\" : options.geolocateControl) as ControlPosition;\n\n this.addControl(\n // new maplibregl.GeolocateControl({\n new MaptilerGeolocateControl({\n positionOptions: {\n enableHighAccuracy: true,\n maximumAge: 0,\n timeout: 6000 /* 6 sec */,\n },\n fitBoundsOptions: {\n maxZoom: 15,\n },\n trackUserLocation: true,\n showAccuracyCircle: true,\n showUserLocation: true,\n }),\n position,\n );\n }\n\n if (options.terrainControl) {\n // default position, if not provided, is top left corner\n const position = (options.terrainControl === true || options.terrainControl === undefined ? \"top-right\" : options.terrainControl) as ControlPosition;\n this.addControl(new MaptilerTerrainControl(), position);\n }\n\n if (options.projectionControl) {\n // default position, if not provided, is top left corner\n const position = (options.projectionControl === true || options.projectionControl === undefined ? \"top-right\" : options.projectionControl) as ControlPosition;\n this.addControl(new MaptilerProjectionControl(), position);\n }\n\n // By default, no fullscreen control\n if (options.fullscreenControl) {\n // default position, if not provided, is top left corner\n const position = (options.fullscreenControl === true || options.fullscreenControl === undefined ? \"top-right\" : options.fullscreenControl) as ControlPosition;\n\n this.addControl(new FullscreenControl({}), position);\n }\n\n this.isReady = true;\n this.fire(\"ready\", { target: this });\n });\n\n // Creating a custom event: \"loadWithTerrain\"\n // that fires only once when both:\n // - the map has full ready (corresponds to the the \"ready\" event)\n // - the terrain has loaded (corresponds to the \"terrain\" event with terrain beion non-null)\n // This custom event is necessary to wait for when the map is instanciated with `terrain: true`\n // and some animation (flyTo, easeTo) are running from the begining.\n let loadEventTriggered = false;\n let terrainEventTriggered = false;\n let terrainEventData: LoadWithTerrainEvent;\n\n this.once(\"ready\", () => {\n loadEventTriggered = true;\n if (terrainEventTriggered) {\n this.fire(\"loadWithTerrain\", terrainEventData);\n }\n });\n\n this.once(\"style.load\", () => {\n const { minimap } = options;\n if (typeof minimap === \"object\") {\n const {\n zoom,\n center,\n style,\n language,\n apiKey,\n maptilerLogo,\n canvasContextAttributes,\n refreshExpiredTiles,\n maxBounds,\n scrollZoom,\n minZoom,\n maxZoom,\n boxZoom,\n locale,\n fadeDuration,\n crossSourceCollisions,\n clickTolerance,\n bounds,\n fitBoundsOptions,\n pixelRatio,\n validateStyle,\n } = options;\n\n this.minimap = new Minimap(minimap, {\n zoom,\n center,\n style,\n language,\n apiKey,\n container: \"null\",\n maptilerLogo,\n canvasContextAttributes,\n refreshExpiredTiles,\n maxBounds,\n scrollZoom,\n minZoom,\n maxZoom,\n boxZoom,\n locale,\n fadeDuration,\n crossSourceCollisions,\n clickTolerance,\n bounds,\n fitBoundsOptions,\n pixelRatio,\n validateStyle,\n });\n this.addControl(this.minimap, minimap.position ?? \"bottom-left\");\n } else if (minimap === true) {\n this.minimap = new Minimap({}, options);\n this.addControl(this.minimap, \"bottom-left\");\n } else if (minimap !== undefined && minimap !== false) {\n this.minimap = new Minimap({}, options);\n this.addControl(this.minimap, minimap);\n }\n });\n\n const terrainCallback = (evt: LoadWithTerrainEvent) => {\n if (!evt.terrain) return;\n terrainEventTriggered = true;\n terrainEventData = {\n type: \"loadWithTerrain\",\n target: this,\n terrain: evt.terrain,\n };\n this.off(\"terrain\", terrainCallback);\n\n if (loadEventTriggered) {\n this.fire(\"loadWithTerrain\", terrainEventData as LoadWithTerrainEvent);\n }\n };\n\n this.on(\"terrain\", terrainCallback);\n\n // enable 3D terrain if provided in options\n if (options.terrain) {\n this.enableTerrain(options.terrainExaggeration ?? this.terrainExaggeration);\n }\n\n // Display a message if WebGL context is lost\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.once(\"load\", () => {\n this.getCanvas().addEventListener(\"webglcontextlost\", (event) => {\n if (this._removed === true) {\n /**\n * https://github.com/maplibre/maplibre-gl-js/blob/main/src/ui/map.ts#L3334\n */\n console.warn(\"[webglcontextlost]\", \"WebGL context lost after map removal. This is harmless.\");\n return;\n }\n\n console.warn(\"[webglcontextlost]\", \"Unexpected loss of WebGL context!\");\n\n this.fire(\"webglContextLost\", event);\n });\n\n const firstLayer = this.getLayersOrder()[0];\n if (options.space) {\n this.initSpace({ options, before: firstLayer });\n }\n\n if (options.halo) {\n this.initHalo({ options, before: firstLayer });\n }\n });\n\n this.telemetry = new Telemetry(this);\n }\n\n /**\n * Recreates the map instance with the same options.\n * Useful for WebGL context loss.\n */\n public recreate() {\n const cameraOptions: maplibregl.CameraOptions = {\n center: this.getCenter(),\n zoom: this.getZoom(),\n bearing: this.getBearing(),\n pitch: this.getPitch(),\n };\n\n this.remove();\n\n Object.assign(this, new Map({ ...this.options }));\n\n this.once(\"load\", () => {\n this.jumpTo(cameraOptions);\n });\n }\n\n /**\n * Set the duration (millisec) of the terrain animation for growing or flattening.\n * Must be positive. (Built-in default: `1000` milliseconds)\n */\n setTerrainAnimationDuration(d: number) {\n this.terrainAnimationDuration = Math.max(d, 0);\n }\n\n /**\n * Awaits for _this_ Map instance to be \"loaded\" and returns a Promise to the Map.\n * If _this_ Map instance is already loaded, the Promise is resolved directly,\n * otherwise, it is resolved as a result of the \"load\" event.\n * @returns\n */\n async onLoadAsync() {\n return new Promise<Map>((resolve) => {\n if (this.loaded()) {\n resolve(this);\n return;\n }\n\n void this.once(\"load\", () => {\n resolve(this);\n });\n });\n }\n\n /**\n * Awaits for _this_ Map instance to be \"ready\" and returns a Promise to the Map.\n * If _this_ Map instance is already ready, the Promise is resolved directly,\n * otherwise, it is resolved as a result of the \"ready\" event.\n * A map instance is \"ready\" when all the controls that can be managed by the contructor are\n * dealt with. This happens after the \"load\" event, due to the asynchronous nature\n * of some built-in controls.\n */\n async onReadyAsync() {\n return new Promise<Map>((resolve) => {\n if (this.isReady) {\n resolve(this);\n return;\n }\n\n void this.once(\"ready\", () => {\n resolve(this);\n });\n });\n }\n\n /**\n * Awaits for _this_ Map instance to be \"loaded\" as well as with terrain being non-null for the first time\n * and returns a Promise to the Map.\n * If _this_ Map instance is already loaded with terrain, the Promise is resolved directly,\n * otherwise, it is resolved as a result of the \"loadWithTerrain\" event.\n * @returns\n */\n async onLoadWithTerrainAsync() {\n return new Promise<Map>((resolve) => {\n if (this.isReady && this.terrain) {\n resolve(this);\n return;\n }\n\n void this.once(\"loadWithTerrain\", () => {\n resolve(this);\n });\n });\n }\n\n private monitorStyleUrl(url: string) {\n // In case this was called before the super constructor could be called.\n if (typeof this.monitoredStyleUrls === \"undefined\") {\n this.monitoredStyleUrls = new Set<string>();\n }\n\n // Note: Because of the usage of urlToAbsoluteUrl() the URL of a style is always supposed to be absolute\n\n // Removing all the URL params to make it easier to later identify in the set\n const cleanUrl = new URL(url);\n cleanUrl.search = \"\";\n this.monitoredStyleUrls.add(cleanUrl.href);\n }\n\n /**\n * Update the style of the map.\n * Can be:\n * - a full style URL (possibly with API key)\n * - a shorthand with only the MapTIler style name (eg. `\"streets-v2\"`)\n * - a longer form with the prefix `\"maptiler://\"` (eg. `\"maptiler://streets-v2\"`)\n */\n override setStyle(\n style: null | ReferenceMapStyle | MapStyleVariant | StyleSpecification | StyleSpecificationWithMetaData | string,\n options?: StyleSwapOptions & StyleOptions,\n ): this {\n this.originalLabelStyle.clear();\n this.minimap?.setStyle(style);\n this.forceLanguageUpdate = true;\n this.once(\"idle\", () => {\n this.forceLanguageUpdate = false;\n });\n\n const styleInfo = styleToStyle(style);\n\n if (styleInfo.requiresUrlMonitoring) {\n this.monitorStyleUrl(styleInfo.style as string);\n }\n\n // If the style is invalid and what is returned is a fallback + the map already has a style,\n // the style remains unchanged.\n if (styleInfo.isFallback) {\n if (this.getStyle()) {\n console.warn(\n \"[Map.setStyle]: Invalid style. A style must be a valid URL to a style.json, a JSON string representing a valid StyleSpecification or a valid StyleSpecification object. Keeping the curent style instead.\",\n );\n return this;\n }\n\n console.warn(\n \"[Map.setStyle]: Invalid style. A style must be a valid URL to a style.json, a JSON string representing a valid StyleSpecification or a valid StyleSpecification object. Fallback to default MapTiler style.\",\n );\n }\n\n this.spaceboxLoadingState.styleLoadedCallbackFired = false;\n this.spaceboxLoadingState.styleLoadCallbackSet = false;\n\n // because the style must be finished loading and parsed before we can add custom layers\n // we need to check if the terrain has changed, because if it has, we also need to wait\n // for the terrain to load...\n const oldStyle = this.getStyle() as StyleSpecificationWithMetaData;\n const newStyle = styleInfo.style as StyleSpecificationWithMetaData;\n\n try {\n super.setStyle(styleInfo.style, { ...options, diff: typeof styleInfo.style !== \"string\" });\n this.styleInProcess = true;\n } catch (e) {\n this.styleInProcess = false;\n console.error(\"[Map.setStyle]: Error while setting style:\", e);\n }\n\n const setSpaceAndHaloFromStyle = () => {\n const styleSpec = styleInfo.style as StyleSpecificationWithMetaData;\n if (!styleSpec.projection || styleSpec.projection.type === \"mercator\") {\n console.warn(\"[Map.setStyle]: Neither space nor halo is supported for mercator projection. Ignoring...\");\n return;\n }\n\n this.setSpaceFromStyle({ style: styleInfo.style as StyleSpecificationWithMetaData });\n\n this.setHaloFromStyle({ style: styleInfo.style as StyleSpecificationWithMetaData });\n };\n\n const handleStyleLoad = (e?: maplibregl.MapStyleDataEvent) => {\n const styleSpec = (e?.target.getStyle() ?? styleInfo.style) as StyleSpecificationWithMetaData;\n\n if (this.spaceboxLoadingState.styleLoadedCallbackFired) {\n return;\n }\n\n this.spaceboxLoadingState.styleLoadedCallbackFired = true;\n this.spaceboxLoadingState.styleLoadCallbackSet = false;\n\n if (typeof styleSpec === \"string\") {\n return;\n }\n\n try {\n const targetBeforeLayer = this.getLayersOrder()[0];\n if (this.space) {\n this.setSpaceFromStyle({ style: styleSpec });\n } else {\n this.initSpace({ before: targetBeforeLayer, spec: styleSpec.metadata?.maptiler?.space });\n }\n\n if (this.halo) {\n this.setHaloFromStyle({ style: styleSpec });\n } else {\n this.initHalo({ before: targetBeforeLayer, spec: styleSpec.metadata?.maptiler?.halo });\n }\n } catch (e) {\n console.error(e);\n }\n };\n\n // if it's a url or a uuid, it is of no use to us\n if (typeof styleInfo.style === \"string\" || styleInfo.requiresUrlMonitoring) {\n void this.once(\"style.load\", handleStyleLoad);\n\n return this;\n }\n\n // because of the current uncertainty of the style.load event\n // we have no way of knowing if the style is loaded or not\n // which will fail internally if the style is not loaded correctly\n requestIdleCallback(() => {\n try {\n handleStyleLoad();\n } catch (e) {\n console.error(e);\n }\n });\n\n if (!this.spaceboxLoadingState.styleLoadCallbackSet) {\n // unfortunately, the style.load event is not always fired correctly when\n // the style is set from an object (generally when projection changes or when metadata changes)\n // so, in this instance, we have to double tap with both style events.\n // an issue has been raised on the maplibre github\n void this.once(\"style.load\", handleStyleLoad);\n void this.once(\"projection.change\", handleStyleLoad);\n\n this.spaceboxLoadingState.styleLoadCallbackSet = true;\n return this;\n }\n\n // the type returned from getStyle is incorrect, it can be null\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const spaceAndHaloMustAwaitTerrain = oldStyle?.terrain?.source !== newStyle?.terrain?.source || oldStyle?.terrain?.exaggeration !== newStyle?.terrain?.exaggeration;\n\n if (spaceAndHaloMustAwaitTerrain) {\n void this.once(\"terrain\", setSpaceAndHaloFromStyle);\n return this;\n }\n\n return this;\n }\n\n private spaceboxLoadingState = {\n styleLoadCallbackSet: false,\n styleLoadedCallbackFired: false,\n };\n\n /**\n * Adds a [MapLibre style layer](https://maplibre.org/maplibre-style-spec/layers)\n * to the map's style.\n *\n * A layer defines how data from a specified source will be styled. Read more about layer types\n * and available paint and layout properties in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/layers).\n *\n * @param layer - The layer to add,\n * conforming to either the MapLibre Style Specification's [layer definition](https://maplibre.org/maplibre-style-spec/layers) or,\n * less commonly, the {@link CustomLayerInterface} specification.\n * The MapLibre Style Specification's layer definition is appropriate for most layers.\n *\n * @param beforeId - The ID of an existing layer to insert the new layer before,\n * resulting in the new layer appearing visually beneath the existing layer.\n * If this argument is not specified, the layer will be appended to the end of the layers array\n * and appear visually above all other layers.\n *\n * @returns `this`\n */\n addLayer(\n layer:\n | (LayerSpecification & {\n source?: string | SourceSpecification;\n })\n | CustomLayerInterface,\n beforeId?: string,\n ): this {\n this.minimap?.addLayer(layer, beforeId);\n return super.addLayer(layer, beforeId);\n }\n\n /**\n * Moves a layer to a different z-position.\n *\n * @param id - The ID of the layer to move.\n * @param beforeId - The ID of an existing layer to insert the new layer before. When viewing the map, the `id` layer will appear beneath the `beforeId` layer. If `beforeId` is omitted, the layer will be appended to the end of the layers array and appear above all other layers on the map.\n * @returns `this`\n *\n * @example\n * Move a layer with ID 'polygon' before the layer with ID 'country-label'. The `polygon` layer will appear beneath the `country-label` layer on the map.\n * ```ts\n * map.moveLayer('polygon', 'country-label');\n * ```\n */\n moveLayer(id: string, beforeId?: string): this {\n this.minimap?.moveLayer(id, beforeId);\n return super.moveLayer(id, beforeId);\n }\n\n /**\n * Removes the layer with the given ID from the map's style.\n *\n * An {@link ErrorEvent} will be fired if the image parameter is invald.\n *\n * @param id - The ID of the layer to remove\n * @returns `this`\n *\n * @example\n * If a layer with ID 'state-data' exists, remove it.\n * ```ts\n * if (map.getLayer('state-data')) map.removeLayer('state-data');\n * ```\n */\n removeLayer(id: string): this {\n this.minimap?.removeLayer(id);\n return super.removeLayer(id);\n }\n\n /**\n * Sets the zoom extent for the specified style layer. The zoom extent includes the\n * [minimum zoom level](https://maplibre.org/maplibre-style-spec/layers/#minzoom)\n * and [maximum zoom level](https://maplibre.org/maplibre-style-spec/layers/#maxzoom))\n * at which the layer will be rendered.\n *\n * Note: For style layers using vector sources, style layers cannot be rendered at zoom levels lower than the\n * minimum zoom level of the _source layer_ because the data does not exist at those zoom levels. If the minimum\n * zoom level of the source layer is higher than the minimum zoom level defined in the style layer, the style\n * layer will not be rendered at all zoom levels in the zoom range.\n */\n setLayerZoomRange(layerId: string, minzoom: number, maxzoom: number): this {\n this.minimap?.setLayerZoomRange(layerId, minzoom, maxzoom);\n return super.setLayerZoomRange(layerId, minzoom, maxzoom);\n }\n\n /**\n * Sets the filter for the specified style layer.\n *\n * Filters control which features a style layer renders from its source.\n * Any feature for which the filter expression evaluates to `true` will be\n * rendered on the map. Those that are false will be hidden.\n *\n * Use `setFilter` to show a subset of your source data.\n *\n * To clear the filter, pass `null` or `undefined` as the second parameter.\n */\n setFilter(layerId: string, filter?: FilterSpecification | null, options?: StyleSetterOptions): this {\n this.minimap?.setFilter(layerId, filter, options);\n return super.setFilter(layerId, filter, options);\n }\n\n /**\n * Sets the value of a paint property in the specified style layer.\n *\n * @param layerId - The ID of the layer to set the paint property in.\n * @param name - The name of the paint property to set.\n * @param value - The value of the paint property to set.\n * Must be of a type appropriate for the property, as defined in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/).\n * @param options - Options object.\n * @returns `this`\n * @example\n * ```ts\n * map.setPaintProperty('my-layer', 'fill-color', '#faafee');\n * ```\n */\n setPaintProperty(layerId: string, name: string, value: any, options?: StyleSetterOptions): this {\n this.minimap?.setPaintProperty(layerId, name, value, options);\n return super.setPaintProperty(layerId, name, value, options);\n }\n\n /**\n * Sets the value of a layout property in the specified style layer.\n * Layout properties define how the layer is styled.\n * Layout properties for layers of the same type are documented together.\n * Layers of different types have different layout properties.\n * See the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/) for the complete list of layout properties.\n * @param layerId - The ID of the layer to set the layout property in.\n * @param name - The name of the layout property to set.\n * @param value - The value of the layout property to set.\n * Must be of a type appropriate for the property, as defined in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/).\n * @param options - Options object.\n * @returns `this`\n */\n setLayoutProperty(layerId: string, name: string, value: any, options?: StyleSetterOptions): this {\n this.minimap?.setLayoutProperty(layerId, name, value, options);\n return super.setLayoutProperty(layerId, name, value, options);\n }\n\n /**\n * Sets the value of the style's glyphs property.\n *\n * @param glyphsUrl - Glyph URL to set. Must conform to the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/glyphs/).\n * @param options - Options object.\n * @returns `this`\n * @example\n * ```ts\n * map.setGlyphs('https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf');\n * ```\n */\n setGlyphs(glyphsUrl: string | null, options?: StyleSetterOptions): this {\n this.minimap?.setGlyphs(glyphsUrl, options);\n return super.setGlyphs(glyphsUrl, options);\n }\n\n private getStyleLanguage(): LanguageInfo | null {\n if (!this.style || !this.style.stylesheet || !this.style.stylesheet.metadata) return null;\n if (typeof this.style.stylesheet.metadata !== \"object\") return null;\n\n if (\"maptiler:language\" in this.style.stylesheet.metadata && typeof this.style.stylesheet.metadata[\"maptiler:language\"] === \"string\") {\n return getLanguageInfoFromFlag(this.style.stylesheet.metadata[\"maptiler:language\"]);\n }\n\n return null;\n }\n\n /**\n * Define the primary language of the map. Note that not all the languages shorthands provided are available.\n */\n setLanguage(language: LanguageInfo | string): void {\n this.minimap?.map.setLanguage(language);\n this.onStyleReady(() => {\n this.setPrimaryLanguage(language);\n });\n }\n\n /**\n * Define the primary language of the map. Note that not all the languages shorthands provided are available.\n */\n\n private setPrimaryLanguage(lang: LanguageInfo | string) {\n const styleLanguage = this.getStyleLanguage();\n\n // lang could be a string and we want to manipulate a LanguageInfo object instead\n const language = toLanguageInfo(lang, Language);\n\n if (!language) {\n console.warn(`The language \"${language}\" is not supported.`);\n return;\n }\n\n // If the language is set to `STYLE` (which is the SDK default), but the language defined in\n // the style is `auto`, we need to bypass some verification and modify the languages anyway\n if (!(language.flag === Language.STYLE.flag && styleLanguage && (styleLanguage.flag === Language.AUTO.flag || styleLanguage.flag === Language.VISITOR.flag))) {\n if (language.flag !== Language.STYLE.flag) {\n this.languageAlwaysBeenStyle = false;\n }\n\n if (this.languageAlwaysBeenStyle) {\n return;\n }\n\n // No need to change the language\n if (this.primaryLanguage === language && !this.forceLanguageUpdate) {\n return;\n }\n }\n\n if (this.primaryLanguage.flag === Language.STYLE_LOCK.flag) {\n console.warn(\"The language cannot be changed because this map has been instantiated with the STYLE_LOCK language flag.\");\n return;\n }\n\n this.primaryLanguage = language;\n let languageNonStyle = language;\n\n // STYLE needs to be translated into one of the other language,\n // this is why it's addressed first\n if (language.flag === Language.STYLE.flag) {\n if (!styleLanguage) {\n console.warn(\"The style has no default languages or has an invalid one.\");\n return;\n }\n\n languageNonStyle = styleLanguage;\n }\n\n // may be overwritten below\n let langStr = Language.LOCAL.flag;\n\n // will be overwritten below\n let replacer: ExpressionSpecification = [\"get\", langStr];\n\n if (languageNonStyle.flag === Language.VISITOR.flag) {\n langStr = getBrowserLanguage().flag;\n replacer = [\n \"case\",\n [\"all\", [\"has\", langStr], [\"has\", Language.LOCAL.flag]],\n [\n \"case\",\n [\"==\", [\"get\", langStr], [\"get\", Language.LOCAL.flag]],\n [\"get\", Language.LOCAL.flag],\n\n [\"format\", [\"get\", langStr], { \"font-scale\": 0.8 }, \"\\n\", [\"get\", Language.LOCAL.flag], { \"font-scale\": 1.1 }],\n ],\n [\"get\", Language.LOCAL.flag],\n ];\n } else if (languageNonStyle.flag === Language.VISITOR_ENGLISH.flag) {\n langStr = Language.ENGLISH.flag;\n replacer = [\n \"case\",\n [\"all\", [\"has\", langStr], [\"has\", Language.LOCAL.flag]],\n [\n \"case\",\n [\"==\", [\"get\", langStr], [\"get\", Language.LOCAL.flag]],\n [\"get\", Language.LOCAL.flag],\n\n [\"format\", [\"get\", langStr], { \"font-scale\": 0.8 }, \"\\n\", [\"get\", Language.LOCAL.flag], { \"font-scale\": 1.1 }],\n ],\n [\"get\", Language.LOCAL.flag],\n ];\n } else if (languageNonStyle.flag === Language.AUTO.flag) {\n langStr = getBrowserLanguage().flag;\n replacer = [\"coalesce\", [\"get\", langStr], [\"get\", Language.LOCAL.flag]];\n }\n\n // This is for using the regular names as {name}\n else if (languageNonStyle === Language.LOCAL) {\n langStr = Language.LOCAL.flag;\n replacer = [\"get\", langStr];\n }\n\n // This section is for the regular language ISO codes\n else {\n langStr = languageNonStyle.flag;\n replacer = [\"coalesce\", [\"get\", langStr], [\"get\", Language.LOCAL.flag]];\n }\n\n const { layers } = this.getStyle();\n\n // True if it's the first time the language is updated for the current style\n const firstPassOnStyle = this.originalLabelStyle.size === 0;\n\n // Analisis on all the label layers to check the languages being used\n if (firstPassOnStyle) {\n const labelsLocalizationMetrics = computeLabelsLocalizationMetrics(layers, this);\n this.isStyleLocalized = Object.keys(labelsLocalizationMetrics.localized).length > 0;\n }\n\n for (const genericLayer of layers) {\n // Only symbole layer can have a layout with text-field\n if (genericLayer.type !== \"symbol\") {\n continue;\n }\n\n const layer = genericLayer as SymbolLayerSpecification;\n const source = this.getSource(layer.source);\n\n // Only a layer that is bound to a valid source is considered for language switching\n if (!source) {\n continue;\n }\n\n // Only source with a url are considered\n if (!(\"url\" in source && typeof source.url === \"string\")) {\n continue;\n }\n\n const sourceURL = new URL(source.url);\n\n // Only layers managed by MapTiler are considered for language switch\n if (sourceURL.host !== defaults.maptilerApiHost) {\n continue;\n }\n\n const { id, layout } = layer;\n\n if (!layout) {\n continue;\n }\n\n if (!(\"text-field\" in layout)) {\n continue;\n }\n\n let textFieldLayoutProp: string | maplibregl.ExpressionSpecification;\n\n // Keeping a copy of the text-field sub-object as it is in the original style\n if (firstPassOnStyle) {\n textFieldLayoutProp = this.getLayoutProperty(id, \"text-field\");\n this.originalLabelStyle.set(id, textFieldLayoutProp);\n } else {\n textFieldLayoutProp = this.originalLabelStyle.get(id)!;\n }\n\n // From this point, the value of textFieldLayoutProp is as in the original version of the style\n // and never a mofified version\n\n // Testing the different case where the text-field property should NOT be updated:\n if (typeof textFieldLayoutProp === \"string\") {\n // When the original style is localized (this.isStyleLocalized is true), we do not modify the {name} because they are\n // very likely to be only fallbacks.\n // When the original style is not localized (this.isStyleLocalized is false), the occurences of \"{name}\"\n // should be replaced by localized versions with fallback to local language.\n\n const { contains, exactMatch } = checkNamePattern(textFieldLayoutProp, this.isStyleLocalized);\n\n // If the current text-fiels does not contain any \"{name:xx}\" pattern\n if (!contains) continue;\n\n // In case of an exact match, we replace by an object representation of the label\n if (exactMatch) {\n this.setLayoutProperty(id, \"text-field\", replacer);\n } else {\n // In case of a non-exact match (such as \"foo {name:xx} bar\" or \"foo {name} bar\", depending on localization)\n // we create a \"concat\" object expresion composed of the original elements with new replacer\n // in-betweem\n const newReplacer = replaceLanguage(textFieldLayoutProp, replacer, this.isStyleLocalized);\n\n this.setLayoutProperty(id, \"text-field\", newReplacer);\n }\n }\n\n // The value of text-field is an object\n else {\n const newReplacer = changeFirstLanguage(textFieldLayoutProp, replacer, this.isStyleLocalized);\n this.setLayoutProperty(id, \"text-field\", newReplacer);\n }\n }\n\n this.languageIsUpdated = true;\n }\n\n /**\n * Get the primary language\n * @returns\n */\n getPrimaryLanguage(): LanguageInfo {\n return this.primaryLanguage;\n }\n\n /**\n * Get the exaggeration factor applied to the terrain\n * @returns\n */\n getTerrainExaggeration(): number {\n return this.terrainExaggeration;\n }\n\n /**\n * Know if terrian is enabled or not\n * @returns\n */\n hasTerrain(): boolean {\n return this.isTerrainEnabled;\n }\n\n private growTerrain(exaggeration: number) {\n // This method assumes the terrain is already built\n if (!this.terrain) {\n return;\n }\n\n const startTime = performance.now();\n // This is supposedly 0, but it could be something else (e.g. already in the middle of growing, or user defined other)\n const currentExaggeration = this.terrain.exaggeration;\n const deltaExaggeration = exaggeration - currentExaggeration;\n\n // This is again called in a requestAnimationFrame ~loop, until the terrain has grown enough\n // that it has reached the target\n const updateExaggeration = () => {\n if (!this.terrain) {\n return;\n }\n\n // If the flattening animation is triggered while the growing animation\n // is running, then the flattening animation is stopped\n if (this.terrainFlattening) {\n return;\n }\n\n // normalized value in interval [0, 1] of where we are currently in the animation loop\n const positionInLoop = (performance.now() - startTime) / this.terrainAnimationDuration;\n\n // The animation goes on until we reached 99% of the growing sequence duration\n if (positionInLoop < 0.99) {\n const exaggerationFactor = 1 - (1 - positionInLoop) ** 4;\n const newExaggeration = currentExaggeration + exaggerationFactor * deltaExaggeration;\n this.terrain.exaggeration = newExaggeration;\n requestAnimationFrame(updateExaggeration);\n } else {\n this.terrainGrowing = false;\n this.terrainFlattening = false;\n this.terrain.exaggeration = exaggeration;\n this.fire(\"terrainAnimationStop\", { terrain: this.terrain });\n }\n\n // When growing the terrain, this is only necessary before rendering\n this._elevationFreeze = false;\n this.triggerRepaint();\n };\n\n if (!this.terrainGrowing && !this.terrainFlattening) {\n this.fire(\"terrainAnimationStart\", { terrain: this.terrain });\n }\n\n this.terrainGrowing = true;\n this.terrainFlattening = false;\n requestAnimationFrame(updateExaggeration);\n }\n\n /**\n * Enables the 3D terrain visualization\n */\n enableTerrain(exaggeration = this.terrainExaggeration) {\n if (exaggeration < 0) {\n console.warn(\"Terrain exaggeration cannot be negative.\");\n return;\n }\n\n // This function is mapped to a map \"data\" event. It checks that the terrain\n // tiles are loaded and when so, it starts an animation to make the terrain grow\n const dataEventTerrainGrow = (evt: MapTerrainDataEvent) => {\n if (!this.terrain) {\n return;\n }\n\n if (evt.type !== \"data\" || evt.dataType !== \"source\" || !(\"source\" in evt)) {\n return;\n }\n\n if (evt.sourceId !== \"maptiler-terrain\") {\n return;\n }\n\n const source = evt.source;\n\n if (source.type !== \"raster-dem\") {\n return;\n }\n\n if (!evt.isSourceLoaded) {\n return;\n }\n\n // We shut this event off because we want it to happen only once.\n // Yet, we cannot use the \"once\" method because only the last event of the series\n // has `isSourceLoaded` true\n this.off(\"data\", dataEventTerrainGrow);\n\n this.growTerrain(exaggeration);\n };\n\n // This is put into a function so that it can be called regardless\n // of the loading state of _this_ the map instance\n const addTerrain = () => {\n // When style is changed,\n this.isTerrainEnabled = true;\n this.terrainExaggeration = exaggeration;\n\n // Mapping it to the \"data\" event so that we can check that the terrain\n // growing starts only when terrain tiles are loaded (to reduce glitching)\n this.on(\"data\", dataEventTerrainGrow);\n\n this.addSource(defaults.terrainSourceId, {\n type: \"raster-dem\",\n url: defaults.terrainSourceURL,\n });\n\n // Setting up the terrain with a 0 exaggeration factor\n // so it loads ~seamlessly and then can grow from there\n this.setTerrain({\n source: defaults.terrainSourceId,\n exaggeration: 0,\n });\n };\n\n // The terrain has already been loaded,\n // we just update the exaggeration.\n if (this.getTerrain()) {\n this.isTerrainEnabled = true;\n this.growTerrain(exaggeration);\n return;\n }\n\n if (this.loaded() || this.isTerrainEnabled) {\n addTerrain();\n } else {\n const checkSourceAndAddTerrain = () => {\n if (this.getTerrain() && this.getSource(defaults.terrainSourceId)) {\n return;\n }\n\n addTerrain();\n };\n\n this.once(\"load\", () => {\n checkSourceAndAddTerrain();\n });\n\n this.once(\"moveend\", () => {\n checkSourceAndAddTerrain();\n });\n }\n }\n\n /**\n * Disable the 3D terrain visualization\n */\n disableTerrain() {\n // It could be disabled already\n if (!this.terrain) {\n return;\n }\n\n this.isTerrainEnabled = false;\n\n const startTime = performance.now();\n // This is supposedly 0, but it could be something else (e.g. already in the middle of growing, or user defined other)\n const currentExaggeration = this.terrain.exaggeration;\n\n // This is again called in a requestAnimationFrame ~loop, until the terrain has grown enough\n // that it has reached the target\n const updateExaggeration = () => {\n if (!this.terrain) {\n return;\n }\n\n // If the growing animation is triggered while flattening is in progress.\n // We exit the flatening\n if (this.terrainGrowing) {\n return;\n }\n\n // normalized value in interval [0, 1] of where we are currently in the animation loop\n const positionInLoop = (performance.now() - startTime) / this.terrainAnimationDuration;\n\n // At disabling, this should be togled fo both the setTerrain() (at the end of the animation)\n // and also just before triggerRepain(), this is why we moved it this high\n this._elevationFreeze = false;\n\n // The animation goes on until we reached 99% of the growing sequence duration\n if (positionInLoop < 0.99) {\n const exaggerationFactor = (1 - positionInLoop) ** 4;\n const newExaggeration = currentExaggeration * exaggerationFactor;\n this.terrain.exaggeration = newExaggeration;\n requestAnimationFrame(updateExaggeration);\n } else {\n this.terrain.exaggeration = 0;\n this.terrainGrowing = false;\n this.terrainFlattening = false;\n\n // @ts-expect-error - https://github.com/maplibre/maplibre-gl-js/issues/2992\n this.setTerrain();\n if (this.getSource(defaults.terrainSourceId)) {\n this.removeSource(defaults.terrainSourceId);\n }\n this.fire(\"terrainAnimationStop\", { terrain: null });\n }\n\n this.triggerRepaint();\n };\n\n if (!this.terrainGrowing && !this.terrainFlattening) {\n this.fire(\"terrainAnimationStart\", { terrain: this.terrain });\n }\n\n this.terrainGrowing = false;\n this.terrainFlattening = true;\n requestAnimationFrame(updateExaggeration);\n }\n\n /**\n * Sets the 3D terrain exageration factor.\n * If the terrain was not enabled prior to the call of this method,\n * the method `.enableTerrain()` will be called.\n * If `animate` is `true`, the terrain transformation will be animated in the span of 1 second.\n * If `animate` is `false`, no animated transition to the newly defined exaggeration.\n */\n setTerrainExaggeration(exaggeration: number, animate = true) {\n if (!animate && this.terrain) {\n this.terrainExaggeration = exaggeration;\n this.terrain.exaggeration = exaggeration;\n this.triggerRepaint();\n } else {\n this.enableTerrain(exaggeration);\n }\n }\n\n /**\n * Perform an action when the style is ready. It could be at the moment of calling this method\n * or later.\n */\n private onStyleReady(cb: () => void) {\n if (this.isStyleLoaded()) {\n cb();\n } else {\n this.once(\"styledata\", () => {\n cb();\n });\n }\n }\n\n async fitToIpBounds() {\n const ipGeolocateResult = await geolocation.info();\n this.fitBounds(ipGeolocateResult.country_bounds as [number, number, number, number], {\n duration: 0,\n padding: 100,\n });\n }\n\n async centerOnIpPoint(zoom: number | undefined) {\n const ipGeolocateResult = await geolocation.info();\n this.jumpTo({\n center: [ipGeolocateResult.longitude ?? 0, ipGeolocateResult.latitude ?? 0],\n zoom: zoom || 11,\n });\n }\n\n getCameraHash() {\n const hashBin = new Float32Array(5);\n const center = this.getCenter();\n hashBin[0] = center.lng;\n hashBin[1] = center.lat;\n hashBin[2] = this.getZoom();\n hashBin[3] = this.getPitch();\n hashBin[4] = this.getBearing();\n return Base64.fromUint8Array(new Uint8Array(hashBin.buffer));\n }\n\n /**\n * Get the SDK config object.\n * This is convenient to dispatch the SDK configuration to externally built layers\n * that do not directly have access to the SDK configuration but do have access to a Map instance.\n */\n getSdkConfig(): SdkConfig {\n return config;\n }\n\n /**\n * Get the MapTiler session ID. Convenient to dispatch to externaly built component\n * that do not directly have access to the SDK configuration but do have access to a Map instance.\n * @returns\n */\n getMaptilerSessionId(): string {\n return MAPTILER_SESSION_ID;\n }\n\n /**\n * Updates the requestManager's transform request with a new function.\n *\n * @param transformRequest A callback run before the Map makes a request for an external URL. The callback can be used to modify the url, set headers, or set the credentials property for cross-origin requests.\n * Expected to return an object with a `url` property and optionally `headers` and `credentials` properties\n *\n * @returns {Map} `this`\n *\n * @example\n * map.setTransformRequest((url: string, resourceType: string) => {});\n */\n override setTransformRequest(transformRequest: RequestTransformFunction): this {\n super.setTransformRequest(combineTransformRequest(transformRequest));\n return this;\n }\n\n /**\n * Gets the {@link ProjectionSpecification}.\n * @returns the projection specification.\n * @example\n * ```ts\n * let projection = map.getProjection();\n * ```\n */\n override getProjection(): ProjectionSpecification {\n const projection = this.style.getProjection();\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!projection === undefined && this.style.projection) {\n return { type: this.style.projection.name };\n }\n return projection;\n }\n\n /**\n * Returns whether a globe projection is currently being used\n */\n isGlobeProjection(): boolean {\n const projection = this.getProjection();\n // this type is incorrect, `projection` can be undefined\n\n if (!projection) {\n return false;\n }\n\n return projection.type === \"globe\";\n }\n\n /**\n * Activate the globe projection.\n */\n enableGlobeProjection() {\n if (this.isGlobeProjection() === true) {\n return;\n }\n\n this.setProjection({ type: \"globe\" });\n\n this.curentProjection = \"globe\";\n }\n\n /**\n * Activate the mercator projection.\n */\n enableMercatorProjection() {\n if (this.isGlobeProjection() === false) {\n return;\n }\n\n this.setProjection({ type: \"mercator\" });\n\n this.curentProjection = \"mercator\";\n }\n\n override setProjection(projection: maplibregl.ProjectionSpecification) {\n this.fire(\"projection.change\", { target: this, projection });\n return super.setProjection(projection);\n }\n\n /**\n * Returns `true` is the language was ever updated, meaning changed\n * from what is delivered in the style.\n * Returns `false` if language in use is the language from the style\n * and has never been changed.\n */\n isLanguageUpdated(): boolean {\n return this.languageIsUpdated;\n }\n}\n","import { Map } from \"../Map\";\nimport ImageViewer from \"./ImageViewer\";\nimport type { LngLat, MapEventType } from \"maplibre-gl\";\n\nexport class ImageViewerEvent {\n readonly type: string;\n readonly target: ImageViewer;\n readonly originalEvent: MouseEvent | TouchEvent | WheelEvent | WebGLContextEvent | null;\n\n [key: string]: any;\n\n imageX!: number;\n imageY!: number;\n isOutOfBounds!: boolean;\n\n constructor(type: string, viewer: ImageViewer, originalEvent?: MouseEvent | TouchEvent | WheelEvent | WebGLContextEvent | null, data: Record<string, any> = {}) {\n this.type = type;\n this.target = viewer;\n this.originalEvent = originalEvent ?? null;\n\n Object.assign(this, data);\n }\n}\n\nconst BASE_MAP_EVENT_TYPES = [\n // pass nothing other than target (map / viewer) and type\n \"idle\",\n \"render\",\n \"load\",\n \"remove\",\n \"idle\",\n\n // these are fired on layers, not the map,\n // keeping them for reference\n // \"content\",\n // \"visibility\",\n] as const;\n\nconst ERROR_EVENTS = [\n \"error\", // ErrorEvent\n] as const;\n\nconst RESIZE_EVENTS = [\"resize\"] as const;\n\nconst WEBGL_CONTEXT_EVENTS = [\"webglcontextlost\", \"webglcontextrestored\"] as const;\n\nconst CAMERA_EVENTS = [\n \"moveend\",\n \"movestart\",\n \"move\",\n \"zoomend\",\n \"zoomstart\",\n \"zoom\",\n \"rotatestart\",\n \"rotateend\",\n \"rotate\",\n \"dragstart\",\n \"dragend\",\n \"drag\",\n \"boxzoomcancel\",\n \"boxzoomend\",\n \"boxzoomstart\",\n] as const;\n\nconst UI_EVENTS = [\"click\", \"dblclick\", \"mousedown\", \"mouseup\", \"mousemove\", \"mouseout\", \"mouseover\", \"contextmenu\", \"touchstart\", \"touchend\", \"touchmove\", \"touchcancel\"] as const;\n\nconst COOPERATIVE_GESTURE_EVENTS = [\"cooperativegestureprevented\"] as const;\n\nconst DATA_EVENTS = [\n \"data\",\n \"dataloading\",\n \"sourcedata\",\n \"sourcedataloading\",\n \"dataabort\",\n \"sourcedataabort\",\n // this is fired on layers, not the map\n // keeping it for reference\n // \"metadata\",\n] as const;\n\nexport const IMAGE_VIEWER_EVENT_TYPES = [\n ...BASE_MAP_EVENT_TYPES,\n ...ERROR_EVENTS,\n ...RESIZE_EVENTS,\n ...WEBGL_CONTEXT_EVENTS,\n ...CAMERA_EVENTS,\n ...UI_EVENTS,\n ...DATA_EVENTS,\n ...COOPERATIVE_GESTURE_EVENTS,\n];\n\ntype BaseMapEventKeys = (typeof BASE_MAP_EVENT_TYPES)[number];\ntype UiEventKeys = (typeof UI_EVENTS)[number];\ntype CameraEventKeys = (typeof CAMERA_EVENTS)[number];\ntype ErrorEventKeys = (typeof ERROR_EVENTS)[number];\ntype ResizeEventKeys = (typeof RESIZE_EVENTS)[number];\ntype WebglContextEventKeys = (typeof WEBGL_CONTEXT_EVENTS)[number];\ntype DataEventKeys = (typeof DATA_EVENTS)[number];\ntype CooperativeGestureEventKeys = (typeof COOPERATIVE_GESTURE_EVENTS)[number];\n\nexport type ImageViewerEventTypes =\n | BaseMapEventKeys\n | UiEventKeys\n | CameraEventKeys\n | ErrorEventKeys\n | ResizeEventKeys\n | WebglContextEventKeys\n | DataEventKeys\n | CooperativeGestureEventKeys\n | \"imageviewerready\"\n | \"imagevieweriniterror\"\n | \"beforeremove\";\n\n// Properties to exclude when forwarding events\nconst FORBIDDEN_EVENT_VALUES = [\"lngLat\", \"_defaultPrevented\"];\n\ntype LngLatToPixel = (lngLat: LngLat) => [number, number];\n\ninterface SetupGlobalMapEventForwarderOptions {\n map: Map;\n viewer: ImageViewer;\n lngLatToPx: LngLatToPixel;\n}\n\ntype ImageViewerEventData<T extends keyof MapEventType> = {\n isOutOfBounds: boolean;\n imageX: number;\n imageY: number;\n} & Partial<MapEventType[T]>;\n\n/**\n * Sets up event forwarding from Map to ImageViewer with proper categorization\n * @param {SetupGlobalMapEventForwarderOptions} options - The options for setting up the event forwarder.\n * @param {Map} options.map - The map to forward events from.\n * @param {ImageViewer} options.viewer - The viewer to forward events to.\n * @param {LngLatToPixel} options.lngLatToPx - A function to convert LngLat to pixel coordinates.\n * @returns {void}\n */\nexport function setupGlobalMapEventForwarder({ map, viewer, lngLatToPx }: SetupGlobalMapEventForwarderOptions): void {\n IMAGE_VIEWER_EVENT_TYPES.forEach((eventType: Exclude<ImageViewerEventTypes, \"imageviewerready\" | \"imagevieweriniterror\" | \"beforeremove\">) => {\n try {\n map.on(eventType, (e: MapEventType[Exclude<ImageViewerEventTypes, \"imageviewerready\" | \"imagevieweriniterror\" | \"beforeremove\">]) => {\n // Handle UI Events (mouse/touch interactions with coordinate transformation)\n const uiEventName = eventType as UiEventKeys;\n if (UI_EVENTS.includes(uiEventName)) {\n const event = e as MapEventType[UiEventKeys];\n const px = event.lngLat && lngLatToPx(event.lngLat);\n const imageMetadata = viewer.getImageMetadata();\n\n const isOutOfBounds = imageMetadata ? px[0] < 0 || px[0] > imageMetadata.width || px[1] < 0 || px[1] > imageMetadata.height : true;\n\n const data: ImageViewerEventData<UiEventKeys> = {\n isOutOfBounds,\n imageX: px[0],\n imageY: px[1],\n ...Object.fromEntries(Object.entries(e).filter(([key]) => !FORBIDDEN_EVENT_VALUES.includes(key))),\n };\n\n viewer.fire(new ImageViewerEvent(eventType, viewer, event.originalEvent, data));\n\n return;\n }\n\n // CAMERA_EVENTS\n const cameraEventName = eventType as CameraEventKeys;\n if (CAMERA_EVENTS.includes(cameraEventName)) {\n const event = e as MapEventType[CameraEventKeys];\n viewer.fire(new ImageViewerEvent(eventType, viewer, event.originalEvent, event));\n return;\n }\n\n // ERROR_EVENTS\n const errorEventName = eventType as ErrorEventKeys;\n if (ERROR_EVENTS.includes(errorEventName)) {\n const event = e as MapEventType[ErrorEventKeys];\n viewer.fire(new ImageViewerEvent(eventType, viewer, null, event));\n return;\n }\n\n // RESIZE_EVENTS\n const resizeEventName = eventType as ResizeEventKeys;\n if (RESIZE_EVENTS.includes(resizeEventName)) {\n const event = e as MapEventType[ResizeEventKeys];\n viewer.fire(new ImageViewerEvent(eventType, viewer, null, event));\n return;\n }\n\n // WEBGL_CONTEXT_EVENTS\n const webglContextEventName = eventType as WebglContextEventKeys;\n if (WEBGL_CONTEXT_EVENTS.includes(webglContextEventName)) {\n const event = e as MapEventType[WebglContextEventKeys];\n viewer.fire(new ImageViewerEvent(eventType, viewer, event.originalEvent, event));\n return;\n }\n\n // Data Events\n // only pass data\n const dataEventName = eventType as DataEventKeys;\n if (DATA_EVENTS.includes(dataEventName)) {\n const event = e as MapEventType[DataEventKeys];\n viewer.fire(new ImageViewerEvent(eventType, viewer, null, event));\n return;\n }\n\n // Handle Cooperative Gesture Events\n const cooperativeGestureEventName = eventType as CooperativeGestureEventKeys;\n if (COOPERATIVE_GESTURE_EVENTS.includes(cooperativeGestureEventName)) {\n const event = e as MapEventType[CooperativeGestureEventKeys];\n viewer.fire(new ImageViewerEvent(eventType, viewer, null, event));\n return;\n }\n\n // Handle Base Map Events (no additional data)\n const baseMapEventName = eventType as BaseMapEventKeys;\n if (BASE_MAP_EVENT_TYPES.includes(baseMapEventName)) {\n viewer.fire(new ImageViewerEvent(eventType, viewer));\n return;\n }\n });\n } catch (e) {\n console.error(`Error forwarding event to ImageViewer, event of type \"${eventType}\" is not supported`, e);\n }\n });\n}\n","export class FetchError extends Error {\n status: number;\n statusText: string;\n\n constructor(response: Response, resource: string, module: string) {\n const message = `[${module}]: Failed to fetch ${resource} at ${response.url}: ${response.status.toString()}: ${response.statusText}`;\n\n super(message);\n\n this.name = \"FetchError\";\n this.message = message;\n this.status = response.status;\n this.statusText = response.statusText;\n }\n}\n","import { LngLat, Marker, Point, PositionAnchor, TransformConstrainFunction } from \"../index\";\nimport { Map } from \"../Map\";\nimport { MercatorCoordinate } from \"..\";\n\n/**\n * At present there is no to overpan or underscroll in maplibre-gl.\n * This is still an ongoing discussion in the repo.\n *\n * However, thanks to https://github.com/maplibre/maplibre-gl-js/pull/5995 we can monkey patch the\n * sdk instance to add this functionality.\n *\n * This is a temporary solution until the PR is merged and released.\n */\n\nconst MAX_VALID_LATITUDE = 85.051129;\n\nexport function unprojectFromWorldCoordinates(worldSize: number, point: Point): LngLat {\n return new MercatorCoordinate(point.x / worldSize, point.y / worldSize).toLngLat();\n}\n\nfunction zoomScale(zoom: number) {\n return Math.pow(2, zoom);\n}\n\nfunction scaleZoom(scale: number) {\n return Math.log(scale) / Math.LN2;\n}\n\nfunction clamp(n: number, min: number, max: number): number {\n return Math.min(max, Math.max(min, n));\n}\n\nfunction mercatorYfromLat(lat: number) {\n return (180 - (180 / Math.PI) * Math.log(Math.tan(Math.PI / 4 + (lat * Math.PI) / 360))) / 360;\n}\n\nfunction mercatorXfromLng(lng: number) {\n return (180 + lng) / 360;\n}\n\nfunction wrap(n: number, min: number, max: number): number {\n const d = max - min;\n const w = ((((n - min) % d) + d) % d) + min;\n return w === min ? max : w;\n}\n\nfunction projectToWorldCoordinates(worldSize: number, lnglat: LngLat): Point {\n const lat = clamp(lnglat.lat, -MAX_VALID_LATITUDE, MAX_VALID_LATITUDE);\n return new Point(mercatorXfromLng(lnglat.lng) * worldSize, mercatorYfromLat(lat) * worldSize);\n}\n\nexport const overpanningUnderzoomingTransformConstrain: TransformConstrainFunction = function (\n this: Map[\"transform\"],\n lngLat: LngLat,\n zoom: number,\n): { center: LngLat; zoom: number } {\n zoom = clamp(zoom, this.minZoom, this.maxZoom);\n const result = {\n center: new LngLat(lngLat.lng, lngLat.lat),\n zoom,\n };\n\n let lngRange = this.lngRange as [number, number] | null;\n const latRange = this.latRange as [number, number] | null;\n\n if (lngRange === null) {\n const almost180 = 180 - 1e-10;\n lngRange = [-almost180, almost180];\n }\n\n const worldSize = this.tileSize * zoomScale(result.zoom); // A world size for the requested zoom level, not the current world size\n let minY = 0;\n let maxY = worldSize;\n let minX = 0;\n let maxX = worldSize;\n let scaleY = 0;\n let scaleX = 0;\n const { x: screenWidth, y: screenHeight } = this.size;\n\n const underzoom = 0.5;\n\n if (latRange) {\n minY = mercatorYfromLat(latRange[1]) * worldSize;\n maxY = mercatorYfromLat(latRange[0]) * worldSize;\n const shouldZoomIn = maxY - minY < underzoom * screenHeight;\n if (shouldZoomIn) scaleY = (underzoom * screenHeight) / (maxY - minY);\n }\n\n if (lngRange) {\n minX = wrap(mercatorXfromLng(lngRange[0]) * worldSize, 0, worldSize);\n maxX = wrap(mercatorXfromLng(lngRange[1]) * worldSize, 0, worldSize);\n\n if (maxX < minX) maxX += worldSize;\n\n const shouldZoomIn = maxX - minX < underzoom * screenWidth;\n if (shouldZoomIn) scaleX = (underzoom * screenWidth) / (maxX - minX);\n }\n\n const { x: originalX, y: originalY } = projectToWorldCoordinates(worldSize, lngLat);\n let modifiedX, modifiedY;\n\n const scale = Math.min(scaleX || 0, scaleY || 0);\n\n if (scale) {\n // zoom in to exclude all beyond the given lng/lat ranges\n result.zoom += scaleZoom(scale);\n return result;\n }\n\n // Panning up and down in latitude is externally limited by project() with MAX_VALID_LATITUDE.\n // This limit prevents panning the top and bottom bounds farther than the center of the viewport.\n // Due to the complexity and consequence of altering project() or MAX_VALID_LATITUDE, we'll simply limit\n // the overpan.\n let lngOverpan = 0.0;\n let latOverpan = 0.0;\n\n const overpan = 1.0;\n const latUnderzoomMinimumPan = 1.0 - (maxY - minY) / screenHeight;\n const lngUnderzoomMinimumPan = 1.0 - (maxX - minX) / screenWidth;\n lngOverpan = Math.max(lngUnderzoomMinimumPan, overpan);\n latOverpan = Math.max(latUnderzoomMinimumPan, overpan);\n\n const lngPanScale = 1.0 - lngOverpan;\n const latPanScale = 1.0 - latOverpan;\n\n if (latRange) {\n const h2 = (latPanScale * screenHeight) / 2;\n if (originalY - h2 < minY) modifiedY = minY + h2;\n if (originalY + h2 > maxY) modifiedY = maxY - h2;\n }\n\n if (lngRange) {\n const wrappedX = originalX;\n\n const w2 = (lngPanScale * screenWidth) / 2;\n\n if (wrappedX - w2 < minX) modifiedX = minX + w2;\n if (wrappedX + w2 > maxX) modifiedX = maxX - w2;\n }\n\n // pan the map if the screen goes off the range\n if (modifiedX !== undefined || modifiedY !== undefined) {\n const newPoint = new Point(modifiedX ?? originalX, modifiedY ?? originalY);\n result.center = unprojectFromWorldCoordinates(worldSize, newPoint).wrap();\n }\n\n return result;\n};\n\nexport const anchorTranslate: Record<PositionAnchor, string> = {\n center: \"translate(-50%,-50%)\",\n top: \"translate(-50%,0)\",\n \"top-left\": \"translate(0,0)\",\n \"top-right\": \"translate(-100%,0)\",\n bottom: \"translate(-50%,-100%)\",\n \"bottom-left\": \"translate(0,-100%)\",\n \"bottom-right\": \"translate(-100%,-100%)\",\n left: \"translate(0,-50%)\",\n right: \"translate(-100%,-50%)\",\n};\n\n/**\n * Monkey patches the Marker instance to remove wrapping. Because pixel projection does not wrap like lnglat.\n * See here https://github.com/maplibre/maplibre-gl-js/blob/14f56b00e0f08784681ef98f0731c60f3923a4a9/src/ui/marker.ts#L601\n * @param {Marker} marker - The Marker instance to patch.\n */\nexport function monkeyPatchMarkerInstanceToRemoveWrapping(marker: Marker) {\n function update(this: Marker, e?: { type: \"move\" | \"moveend\" | \"terrain\" | \"render\" }) {\n if (!this._map) return;\n\n const isFullyLoaded = this._map.loaded() && !this._map.isMoving();\n if (e?.type === \"terrain\" || (e?.type === \"render\" && !isFullyLoaded)) {\n this._map.once(\"render\", this._update);\n }\n\n this._flatPos = this._pos = this._map.project(this._lngLat)._add(this._offset);\n if (this._map.terrain) {\n this._flatPos = this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset);\n }\n\n let rotation = \"\";\n if (this._rotationAlignment === \"viewport\" || this._rotationAlignment === \"auto\") {\n rotation = `rotateZ(${this._rotation}deg)`;\n } else if (this._rotationAlignment === \"map\") {\n rotation = `rotateZ(${this._rotation - this._map.getBearing()}deg)`;\n }\n\n let pitch = \"\";\n if (this._pitchAlignment === \"viewport\" || this._pitchAlignment === \"auto\") {\n pitch = \"rotateX(0deg)\";\n } else if (this._pitchAlignment === \"map\") {\n pitch = `rotateX(${this._map.getPitch()}deg)`;\n }\n\n if (!this._subpixelPositioning && (!e || e.type === \"moveend\")) {\n this._pos = this._pos.round();\n }\n\n const transform = `${anchorTranslate[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${pitch} ${rotation}`;\n this._element.style.transform = transform;\n }\n\n marker._update = update.bind(marker);\n}\n","import type { IControl } from \"maplibre-gl\";\nimport { ImageViewer } from \"../ImageViewer\";\nimport { Map as MapSDK } from \"../Map\";\n\n// this control is only used in the ImageViewer component\n// it should not be used in the Map component\nexport class ImageViewerFitImageToBoundsControl implements IControl {\n private viewer: ImageViewer;\n private container!: HTMLElement;\n constructor({ imageViewer }: { imageViewer: ImageViewer }) {\n if (!imageViewer) {\n throw new Error(\"ImageViewerFitImageToBoundsControl: an instance of 'ImageViewer' is required\");\n }\n this.viewer = imageViewer;\n }\n\n handleClick = () => {\n this.viewer.fitImageToViewport({ ease: true });\n };\n\n onAdd(_map: MapSDK) {\n const button = document.createElement(\"button\");\n this.container = document.createElement(\"div\");\n this.container.classList.add(\"maplibregl-ctrl\", \"maplibregl-ctrl-group\");\n button.classList.add(\"maplibregl-ctrl-fit-image-to-bounds\");\n const internalSpan = document.createElement(\"span\");\n internalSpan.classList.add(\"maplibregl-ctrl-icon\");\n button.title = \"Zoom image to viewport bounds\";\n button.appendChild(internalSpan);\n button.addEventListener(\"click\", this.handleClick);\n\n this.container.appendChild(button);\n\n return this.container;\n }\n\n onRemove() {\n this.container.remove();\n }\n}\n","// these are not exposed publicly by the SDK, but are used internally (ImageViewerMarker)\nexport const lngLatToPxInternalSymbolKey = Symbol(\"MapTiler:ImageViewer:Internal:lngLatToPxInternal\");\nexport const pxToLngLatInternalSymbolKey = Symbol(\"MapTiler:ImageViewer:Internal:pxToLngLatInternal\");\n","import MaplibreGL from \"maplibre-gl\";\nimport {\n EaseToOptions,\n DoubleClickZoomHandler,\n DragPanHandler,\n TwoFingersTouchZoomRotateHandler,\n FlyToOptions,\n MapOptions,\n JumpToOptions,\n MercatorCoordinate,\n ScrollZoomHandler,\n BoxZoomHandler,\n KeyboardHandler,\n CooperativeGesturesHandler,\n LngLat,\n LngLatBounds,\n MapDataEvent,\n PointLike,\n} from \"..\";\nimport { Map } from \"../Map\";\nimport { ImageViewerEvent, setupGlobalMapEventForwarder } from \"./events\";\nimport { FetchError } from \"../utils/errors\";\nimport { config } from \"..\";\nimport { overpanningUnderzoomingTransformConstrain } from \"./monkeyPatchML\";\nimport { NavigationControl } from \"../MLAdapters/NavigationControl\";\nimport { ImageViewerFitImageToBoundsControl } from \"../controls/ImageViewerFitImageToBoundsControl\";\nimport { lngLatToPxInternalSymbolKey, pxToLngLatInternalSymbolKey } from \"./symbols\";\n\nconst { Evented } = MaplibreGL;\n\n//#region types\n\nexport type AllowedConstrcutorOptions = \"container\" | \"apiKey\" | \"maxZoom\" | \"minZoom\" | \"zoom\" | \"bearing\";\n\nexport type ImageViewerFlyToOptions = Omit<FlyToOptions, \"pitch\"> & {\n center: [number, number];\n};\n\nexport type ImageViewerJumpToOptions = Omit<JumpToOptions, \"pitch\"> & {\n center: [number, number];\n};\n\nexport type ImageViewerEaseToOptions = Omit<EaseToOptions, \"pitch\"> & {\n center: [number, number];\n};\n\n//#region ImageViewerConstructorOptions\nexport type ImageViewerConstructorOptions = Pick<MapOptions, AllowedConstrcutorOptions> & {\n /**\n * The UUID of the image.\n */\n imageUUID: string;\n /**\n * Whether to show debug information.\n */\n debug?: boolean;\n /**\n * The center of the image.\n */\n center?: [number, number];\n /**\n * Whether to show a control to fit the image to the viewport.\n */\n fitToBoundsControl?: boolean;\n\n /**\n * Whether to show a navigation control.\n */\n navigationControl?: boolean;\n};\n\n//#region ImageMetadata\n/**\n * The metadata of the image. This is the shape of the response from the API.\n * And used to convert px to lnglat and vice versa.\n */\nexport type ImageMetadata = {\n id: string;\n description: string;\n attribution: string;\n width: number;\n height: number;\n minzoom: number;\n maxzoom: number;\n tileSize: number;\n};\n\n//#region overrideOptions\n/**\n * These options cannot be changed externally and are used when creating the map instance.\n *\n * @internal\n */\nconst overrideOptions: Partial<MapOptions> = {\n style: {\n version: 8,\n sources: {},\n layers: [],\n },\n minPitch: 0,\n maxPitch: 0,\n pitch: 0,\n bearing: 0,\n projection: \"mercator\",\n geolocateControl: false,\n navigationControl: false,\n projectionControl: false,\n hash: false,\n renderWorldCopies: false,\n terrain: false,\n space: false,\n halo: false,\n transformConstrain: overpanningUnderzoomingTransformConstrain,\n};\n\n//#region imageViewerDefaultOptions\nconst imageViewerDefaultOptions: Partial<ImageViewerConstructorOptions> = {\n debug: false,\n fitToBoundsControl: true,\n navigationControl: true,\n};\n\n//#region ImageViewer\nexport default class ImageViewer extends Evented {\n /**\n * The UUID of the image.\n *\n * @internal\n */\n private imageUUID: string;\n\n /**\n * Whether to enable debug mode.\n *\n * @internal\n */\n private debug: boolean;\n\n /**\n * The metadata of the image.\n *\n */\n private imageMetadata?: ImageMetadata;\n\n /**\n * Why not extend the Map class?\n * Because ImageViewer technically operates in screen space and not in map space.\n * We wrap map and perform calculations in screen space.\n * We do not want to have to extend the Map class and give access to\n * methods and properties that operate in LngLat space. *\n */\n private sdk!: Map;\n\n /**\n * The options for the ImageViewer.\n *\n * @internal\n */\n private options: ImageViewerConstructorOptions & { center?: [number, number] };\n\n /**\n * The size of the image.\n *\n * @internal\n */\n private imageSize?: [number, number];\n\n /**\n * The padded size max.\n *\n * @internal\n */\n private paddedSizeMax?: number;\n\n /**\n * The version of the ImageViewer / SDK.\n */\n public get version() {\n return this.sdk.version;\n }\n\n /**\n * The control to fit the image to the viewport.\n */\n fitToBoundsControlInstance!: ImageViewerFitImageToBoundsControl;\n\n //#region constructor\n /**\n * The constructor for the ImageViewer.\n *\n * @param {Partial<ImageViewerConstructorOptions>} imageViewerConstructorOptions - The options for the ImageViewer.\n * @example\n * ```ts\n * import \"@maptiler/sdk/dist/maptiler-sdk.css\"; // import css\n * import { ImageViewer } from \"@maptiler/sdk\"; // import the sdk\n *\n * const imageViewer = new ImageViewer({\n * container: document.getElementById(\"map\"),\n * imageUUID: \"01986025-ceb9-7487-9ea6-7a8637dcc1a1\",\n * debug: true, // show tile boundaries, padding, collision boxes etc\n * fitToBoundsControl: true, // show a control to fit the image to the viewport\n * navigationControl: true, // show a navigation control\n * center: [0, 0], // center in pixels\n * zoom: 1, // zoom level\n * bearing: 0, // bearing\n * });\n * ```\n */\n constructor(imageViewerConstructorOptions: Partial<ImageViewerConstructorOptions>) {\n super();\n\n if (!imageViewerConstructorOptions.imageUUID) {\n throw new Error(\"[ImageViewer]: `imageUUID` is required\");\n }\n\n if (typeof imageViewerConstructorOptions.container !== \"string\" && !(imageViewerConstructorOptions.container instanceof HTMLElement)) {\n throw new Error(\"[ImageViewer]: `container` is required and must be a string or HTMLElement\");\n }\n\n this.options = {\n ...imageViewerDefaultOptions,\n ...imageViewerConstructorOptions,\n } as ImageViewerConstructorOptions & { center?: [number, number] };\n\n const sdkOptions = {\n ...this.options,\n ...overrideOptions,\n };\n\n // we don't want to pass the center to the map instance\n // because it will be in px space and not lnglat space\n // we cannot convert it lnglat space until the metadata is fetched\n delete sdkOptions.center;\n\n this.sdk = new Map(sdkOptions);\n\n this.sdk.telemetry.registerViewerType(\"ImageViewer\");\n\n const { imageUUID, debug } = imageViewerConstructorOptions;\n\n this.imageUUID = imageUUID;\n\n this.debug = debug ?? false;\n\n if (this.debug) {\n this.sdk.showTileBoundaries = this.debug;\n this.sdk.showPadding = this.debug;\n this.sdk.showCollisionBoxes = this.debug;\n this.sdk.repaint = this.debug;\n }\n\n void this.init();\n }\n\n //#region onReadyAsync\n /**\n * Waits for the ImageViewer to be ready.\n *\n * @returns {Promise<void>}\n */\n async onReadyAsync() {\n try {\n await this.sdk.onReadyAsync();\n await Promise.race([\n new Promise((resolve, reject) => {\n void this.once(\"imageviewerready\", (evt) => {\n resolve(evt);\n });\n void this.once(\"imagevieweriniterror\", (e: { error: Error }) => {\n reject(e.error);\n });\n }),\n new Promise((_, reject) => {\n setTimeout(() => {\n reject(new Error(\"Timeout waiting for image viewer to be ready\"));\n }, 5000);\n }),\n ]);\n } catch (e) {\n throw e;\n }\n }\n\n // this flag is used to determine if the image should be fit to the viewport\n // when the map is resized\n shouldFitImageToViewport = true;\n\n //#region init\n /**\n * Initializes the ImageViewer\n * - fetches the image metadata\n * - adds the image source to the sdk instance\n * - sets the center to the middle of the image (if center is not provided)\n * - monkeypatches the maplibre-gl sdk transform method to allow for overpanning and underzooming.\n * - sets up global event forwarding / intercepting from the map instance\n * - sets the center to the middle of the image (if center is not provided)\n *\n * @internal\n * @returns {Promise<void>}\n */\n private async init() {\n try {\n await this.fetchImageMetadata();\n\n this.addImageSource();\n\n if (this.options.navigationControl) {\n this.sdk.addControl(\n new NavigationControl({\n visualizePitch: false,\n visualizeRoll: false,\n }),\n );\n }\n\n this.fitToBoundsControlInstance = new ImageViewerFitImageToBoundsControl({ imageViewer: this });\n if (this.options.fitToBoundsControl) {\n this.sdk.addControl(this.fitToBoundsControlInstance);\n }\n\n // TODO return a cleanup function to remove all event listeners\n setupGlobalMapEventForwarder({\n map: this.sdk,\n viewer: this,\n lngLatToPx: (lngLat: LngLat) => this.lngLatToPx(lngLat),\n });\n\n const { center, zoom, bearing } = this.options;\n const initCenter = center ?? [(this.imageMetadata?.width ?? 0) / 2, (this.imageMetadata?.height ?? 0) / 2];\n this.setCenter(initCenter);\n\n this.setBearing(bearing ?? 0);\n\n if (!this.options.zoom) {\n this.fitImageToViewport();\n } else {\n this.setZoom(zoom ?? this.imageMetadata?.maxzoom ?? 5);\n }\n\n // we want to disable the fit image to viewport on wheel and drag\n // \"move\" and \"zoom\" are not viable as they would be fired\n // when `fitImageToViewport` is called making loop\n // so we test for UI events instead\n this.sdk.on(\"wheel\", () => {\n this.shouldFitImageToViewport = false;\n });\n\n this.sdk.on(\"touchstart\", () => {\n this.shouldFitImageToViewport = false;\n });\n\n this.sdk.on(\"drag\", () => {\n this.shouldFitImageToViewport = false;\n });\n\n // checks to see if there have been any UI events\n // if not, then we keep the image centered\n // and zoomed to fit the page.\n this.sdk.on(\"resize\", () => {\n const previousCenter = this.getCenter();\n const width = this.imageMetadata?.width ?? 0;\n const height = this.imageMetadata?.height ?? 0;\n\n if (this.shouldFitImageToViewport) {\n this.fitImageToViewport();\n }\n\n if (previousCenter[0] !== width / 2 || previousCenter[1] !== height / 2) {\n this.setCenter(previousCenter);\n }\n });\n this.fire(\"imageviewerready\", new ImageViewerEvent(\"imageviewerready\", this));\n } catch (e) {\n this.fire(\"imagevieweriniterror\", { error: e });\n }\n }\n\n //#region fitImageToViewport\n /**\n * Fits the image to the viewport.\n *\n * @param {Object} options - The options for the fit image to viewport.\n * @param {boolean} options.ease - Whether to ease to the viewport bounds.\n */\n fitImageToViewport({ ease = false }: { ease?: boolean } = {}) {\n if (!this.imageMetadata) {\n throw new Error(\"[ImageViewer]: Image metadata not found\");\n }\n\n const tl = this.pxToLngLat([0, 0]);\n const br = this.pxToLngLat([this.imageMetadata.width ?? 0, this.imageMetadata.height ?? 0]);\n\n const cameraForBounds = this.sdk.cameraForBounds([tl, br], { padding: 50 });\n if (cameraForBounds) {\n if (ease) {\n this.sdk.easeTo({ ...cameraForBounds, pitch: 0 }, null);\n } else {\n this.sdk.jumpTo({ ...cameraForBounds, pitch: 0 }, null);\n }\n }\n\n // reset the flag to true\n this.shouldFitImageToViewport = true;\n }\n\n //#region fetchImageMetadata\n /**\n * Fetches the image metadata from the API.\n *\n * @internal\n * @returns {Promise<void>}\n */\n private async fetchImageMetadata() {\n const url = buildImageMetadataURL(this.imageUUID);\n const response = await fetch(url);\n\n if (!response.ok) {\n throw new FetchError(response, \"image metadata\", \"ImageViewer\");\n }\n\n const data = (await response.json()) as ImageMetadata;\n\n this.imageMetadata = data;\n Object.freeze(this.imageMetadata);\n }\n\n //#region addImageSource\n /**\n * Adds the image source to the sdk instance.\n *\n * @internal\n * @returns {void}\n */\n private addImageSource() {\n if (!this.imageMetadata) {\n this.fire(\"error\", new ImageViewerEvent(\"error\", this, null, { error: new Error(\"[ImageViewer]: Image metadata not found\") }));\n throw new Error(\"[ImageViewer]: Image metadata not found\");\n }\n\n const url = buildImageTilesURL(this.imageUUID);\n\n const ceilToPow2 = (x: number) => Math.pow(2, Math.ceil(Math.log(x) / Math.LN2));\n\n this.imageSize = [this.imageMetadata.width, this.imageMetadata.height];\n this.paddedSizeMax = Math.max(ceilToPow2(this.imageSize[0]), ceilToPow2(this.imageSize[1]));\n\n const nw = this.pxToLngLat([0, 0]);\n const se = this.pxToLngLat(this.imageSize);\n const bounds: [number, number, number, number] = [nw.lng, se.lat, se.lng, nw.lat];\n\n this.sdk.addSource(\"image\", {\n ...this.imageMetadata,\n type: \"raster\",\n bounds,\n tiles: [url],\n });\n\n this.sdk.addLayer({\n id: \"image\",\n type: \"raster\",\n source: \"image\",\n });\n }\n\n //#region SDK mappings\n /**\n * Triggers a repaint of the ImageViewer. Same as map.triggerRepaint().\n *\n * @internal\n * @returns {void}\n */\n triggerRepaint() {\n this.sdk.triggerRepaint();\n }\n /**\n * The scroll zoom handler.\n *\n * @internal\n * @returns {ScrollZoomHandler}\n */\n get scrollZoom() {\n return this.sdk.scrollZoom;\n }\n\n /**\n * The scroll zoom handler.\n *\n * @internal\n * @param {ScrollZoomHandler} value - The scroll zoom handler.\n */\n set scrollZoom(value: ScrollZoomHandler) {\n this.sdk.scrollZoom = value;\n }\n\n /**\n * The box zoom handler.\n *\n * @internal\n * @returns {BoxZoomHandler}\n */\n get boxZoom() {\n return this.sdk.boxZoom;\n }\n\n /**\n * The box zoom handler.\n *\n * @internal\n * @param {BoxZoomHandler} value - The box zoom handler.\n */\n set boxZoom(value: BoxZoomHandler) {\n this.sdk.boxZoom = value;\n }\n\n /**\n * The drag pan handler.\n *\n * @internal\n * @returns {DragPanHandler}\n */\n get dragPan() {\n return this.sdk.dragPan;\n }\n\n /**\n * The drag pan handler.\n *\n * @internal\n * @param {DragPanHandler} value - The drag pan handler.\n */\n set dragPan(value: DragPanHandler) {\n this.sdk.dragPan = value;\n }\n\n /**\n * The keyboard handler.\n *\n * @internal\n * @returns {KeyboardHandler}\n */\n get keyboard() {\n return this.sdk.keyboard;\n }\n\n /**\n * The keyboard handler.\n *\n * @internal\n * @param {KeyboardHandler} value - The keyboard handler.\n */\n set keyboard(value: KeyboardHandler) {\n this.sdk.keyboard = value;\n }\n\n /**\n * The double click zoom handler.\n *\n * @internal\n * @returns {DoubleClickZoomHandler}\n */\n get doubleClickZoom() {\n return this.sdk.doubleClickZoom;\n }\n\n /**\n * The double click zoom handler.\n *\n * @internal\n * @param {DoubleClickZoomHandler} value - The double click zoom handler.\n */\n set doubleClickZoom(value: DoubleClickZoomHandler) {\n this.sdk.doubleClickZoom = value;\n }\n\n /**\n * The touch zoom rotate handler.\n *\n * @internal\n * @returns {TwoFingersTouchZoomRotateHandler}\n */\n get touchZoomRotate() {\n return this.sdk.touchZoomRotate;\n }\n\n /**\n * The touch zoom rotate handler.\n *\n * @internal\n * @param {TwoFingersTouchZoomRotateHandler} value - The touch zoom rotate handler.\n */\n set touchZoomRotate(value: TwoFingersTouchZoomRotateHandler) {\n this.sdk.touchZoomRotate = value;\n }\n\n /**\n * The cooperative gestures handler.\n *\n * @internal\n * @returns {CooperativeGesturesHandler}\n */\n get cooperativeGestures() {\n return this.sdk.cooperativeGestures;\n }\n\n /**\n * The cooperative gestures handler.\n *\n * @internal\n * @param {CooperativeGesturesHandler} value - The cooperative gestures handler.\n */\n set cooperativeGestures(value: CooperativeGesturesHandler) {\n this.sdk.cooperativeGestures = value;\n }\n\n //#endregion SDK Mappings\n\n //#region lngLatToPx\n /**\n * Converts a LngLat to a px coordinate, based on the image metadata.\n *\n * @internal\n * @param {LngLat} lngLat - The LngLat to convert.\n * @returns {[number, number]} The px coordinate.\n */\n private lngLatToPx(lngLat: LngLat) {\n if (!this.paddedSizeMax) {\n const msg = \"[ImageViewer]: Unable to convert LngLat to px, padded size max not set\";\n this.fire(\"error\", new ImageViewerEvent(\"error\", this, null, { error: new Error(msg) }));\n throw new Error(msg);\n }\n const merc = MercatorCoordinate.fromLngLat(lngLat);\n return [merc.x * this.paddedSizeMax, merc.y * this.paddedSizeMax] as [number, number];\n }\n\n //#region pxToLngLat\n /**\n * Converts a px coordinate to a LngLat, based on the image metadata.\n *\n * @internal\n * @param {LngLat} lngLat - The LngLat to convert.\n * @returns {[number, number]} The px coordinate.\n */\n private pxToLngLat(px: [number, number]) {\n if (!this.paddedSizeMax) {\n const msg = \"[ImageViewer]: Unable to convert px to LngLat, padded size max not set\";\n this.fire(\"error\", new ImageViewerEvent(\"error\", this, null, { error: new Error(msg) }));\n throw new Error(msg);\n }\n\n const merc = new MercatorCoordinate(px[0] / this.paddedSizeMax, px[1] / this.paddedSizeMax);\n return merc.toLngLat() as LngLat;\n }\n //#region getSDKInternal\n\n /**\n * Get the internal SDK instance.\n *\n * @returns {Map} The internal SDK instance.\n * @internal\n */\n public getSDKInternal() {\n return this.sdk;\n }\n\n /**\n * Get the canvas of the internal SDK instance.\n *\n * @returns {HTMLCanvasElement} The canvas of the internal SDK instance.\n */\n public getCanvas() {\n return this.sdk.getCanvas();\n }\n\n //#region flyTo\n /**\n * Fly to a given center.\n *\n * @param {ImageViewerFlyToOptions} options - The options for the fly to.\n * @param {MapDataEvent} eventData - The event data.\n * @returns {ImageViewer} The ImageViewer instance.\n */\n public flyTo(options: ImageViewerFlyToOptions, eventData?: MapDataEvent) {\n const lngLat = this.pxToLngLat(options.center);\n this.sdk.flyTo({ ...options, pitch: 0, center: lngLat }, eventData);\n return this;\n }\n\n //#region jumpTo\n /**\n * Jump to a given center.\n *\n * @param {ImageViewerJumpToOptions} options - The options for the jump to.\n * @param {MapDataEvent} eventData - The event data.\n * @returns {ImageViewer} The ImageViewer instance.\n */\n public jumpTo(options: ImageViewerJumpToOptions, eventData?: MapDataEvent) {\n const lngLat = this.pxToLngLat(options.center);\n this.sdk.jumpTo({ ...options, pitch: 0, center: lngLat }, eventData);\n return this;\n }\n\n //#region setZoom\n /**\n * Set the zoom level.\n *\n * @param {number} zoom - The zoom level.\n * @returns {ImageViewer} The ImageViewer instance.\n */\n public setZoom(zoom: number) {\n this.sdk.setZoom(zoom);\n return this;\n }\n\n //#region getZoom\n /**\n * Get the zoom level.\n *\n * @returns {number} The zoom level.\n */\n public getZoom() {\n return this.sdk.getZoom();\n }\n\n //#region getCenter\n /**\n * Get the center of the ImageViewer in pixels.\n *\n * @internal\n * @returns {[number, number]} The center of the ImageViewer.\n */\n public getCenter() {\n const centerLngLat = this.sdk.getCenter();\n const centerPx = this.lngLatToPx(centerLngLat);\n return centerPx;\n }\n\n //#region setCenter\n /**\n * Set the center of the ImageViewer in pixels.\n *\n * @param {number} center - The center of the ImageViewer.\n * @returns {ImageViewer} The ImageViewer instance.\n */\n public setCenter(center: [number, number]) {\n this.sdk.setCenter(this.pxToLngLat(center));\n return this;\n }\n\n //#region setBearing\n /**\n * Set the bearing of the ImageViewer in degrees.\n *\n * @param {number} bearing - The bearing of the ImageViewer.\n * @returns {ImageViewer} The ImageViewer instance.\n */\n public setBearing(bearing: number) {\n this.sdk.setBearing(bearing);\n return this;\n }\n\n //#region getBearing\n /**\n * Get the bearing of the ImageViewer in degrees.\n *\n * @returns {number} The bearing of the ImageViewer.\n */\n public getBearing() {\n return this.sdk.getBearing();\n }\n\n //#region panBy\n /**\n * Pan by a given delta in pixels.\n *\n * @param {PointLike} delta - The delta to pan by.\n * @param {ImageViewerEaseToOptions} options - The options for the pan.\n * @param {any} eventData - The event data.\n * @returns {ImageViewer} The ImageViewer instance.\n */\n public panBy(delta: PointLike, options?: ImageViewerEaseToOptions, eventData?: any) {\n this.sdk.panBy(delta, { ...options, pitch: 0 }, eventData);\n return this;\n }\n\n //#region panTo\n /**\n * Pan to a given center in pixels.\n *\n * @param {number} center - The center to pan to.\n * @param {ImageViewerEaseToOptions} options - The options for the pan.\n * @param {any} eventData - The event data.\n * @returns {ImageViewer} The ImageViewer instance.\n */\n public panTo(center: [number, number], options?: ImageViewerEaseToOptions, eventData?: any) {\n this.sdk.panTo(this.pxToLngLat(center), { ...options, pitch: 0 }, eventData);\n return this;\n }\n\n //#region getImageMetadata\n /**\n * Get the image metadata.\n *\n * @returns {ImageMetadata} The image metadata.\n */\n public getImageMetadata() {\n return this.imageMetadata;\n }\n\n //#region getImageBounds\n /**\n * Get the visible bounds of the image in the viewport in imagePixels.\n * [topLeft, bottomRight]\n *\n * @returns {[[number, number], [number, number]]} The visible bounds of the image.\n */\n public getImageBounds() {\n const mapBounds = this.sdk.getBounds().toArray();\n const boundsPx = mapBounds.map((bound) => {\n return this.lngLatToPx(LngLat.convert(bound));\n }) as [[number, number], [number, number]];\n\n // we need to rearrange the bounds to be in the correct order\n // top left and bottom right\n const tl = [boundsPx[0][0], boundsPx[1][1]];\n\n const br = [boundsPx[1][0], boundsPx[0][1]];\n return [tl, br];\n }\n\n //#region fitImageBounds\n /**\n * Set the bounds of the image.\n *\n * @param {[[number, number], [number, number]]} bounds - The bounds of the image.\n * @returns {ImageViewer} The ImageViewer instance.\n */\n public fitImageBounds([tl, br]: [[number, number], [number, number]]) {\n const tlLngLat = this.pxToLngLat(tl);\n const brLngLat = this.pxToLngLat(br);\n const bounds = LngLatBounds.convert([tlLngLat, brLngLat]);\n this.sdk.fitBounds(bounds);\n return this;\n }\n\n //#region remove\n /**\n * Destroys the ImageViewer, removes the map instance and all event listeners. Useful for cleanup.\n *\n * @returns {ImageViewer} The ImageViewer instance.\n */\n public remove() {\n this.fire(\"beforeremove\", new ImageViewerEvent(\"beforeremove\", this));\n this.sdk.remove();\n\n // the typescript type is incorrect here\n // _listeners is only defined if there are actual listeners\n if (this._listeners) {\n Object.entries(this._listeners).forEach(([event, listeners]) => {\n listeners.forEach((listener) => {\n this.off(event, listener);\n });\n });\n }\n\n // the typescript type is incorrect here too\n // _oneTimeListeners is only defined if there are actual listeners\n if (this._oneTimeListeners) {\n Object.entries(this._oneTimeListeners).forEach(([event, listeners]) => {\n listeners.forEach((listener) => {\n this.off(event, listener);\n });\n });\n }\n }\n\n public pointIsWithinImageBounds(px: [number, number]) {\n const metadata = this.getImageMetadata();\n if (!metadata) {\n return false;\n }\n\n const bounds = [\n [0, 0],\n [metadata.width, metadata.height],\n ];\n\n return px[0] >= bounds[0][0] && px[0] <= bounds[1][0] && px[1] >= bounds[0][1] && px[1] <= bounds[1][1];\n }\n\n // aliases for methods that are not exposed by the SDK\n // but used internally (ImageMarkers)\n [lngLatToPxInternalSymbolKey] = this.lngLatToPx.bind(this);\n [pxToLngLatInternalSymbolKey] = this.pxToLngLat.bind(this);\n}\n\n//#region helpers\n\nfunction buildImageMetadataURL(uuid: string) {\n return `${getAPIBasePath()}/${uuid}/image.json?key=${config.apiKey}`;\n}\n\nfunction buildImageTilesURL(uuid: string) {\n return `${getAPIBasePath()}/${uuid}/{z}/{x}/{y}?key=${config.apiKey}`;\n}\n\nfunction getAPIBasePath() {\n // @ts-expect-error this will be defined if we're in a Vite environment\n const overrideUrl = import.meta.env.VITE_IMAGE_API_BASE_URL_OVERRIDE as string | undefined;\n\n if (overrideUrl) {\n return overrideUrl;\n }\n\n return \"https://api.maptiler.com/images\";\n}\n","import { Alignment, Subscription, Marker, MarkerOptions, PointLike, Popup } from \"../index\";\nimport MapLibreGL from \"maplibre-gl\";\nimport ImageViewer from \"./ImageViewer\";\nimport { lngLatToPxInternalSymbolKey, pxToLngLatInternalSymbolKey } from \"./symbols\";\nimport { monkeyPatchMarkerInstanceToRemoveWrapping } from \"./monkeyPatchML\";\n\nconst { Evented } = MapLibreGL;\n\nexport type ImageViewerMarkerOptions = MarkerOptions & {};\n\nexport interface ImageViewerMarkerInterface {\n on(event: MarkerEventTypes, listener: (e: ImageViewerMarkerEvent) => void): Subscription;\n off(event: MarkerEventTypes, listener: (e: ImageViewerMarkerEvent) => void): void;\n fire(event: ImageViewerMarkerEvent): void;\n getPosition(): [number, number];\n getOffset(): PointLike;\n getPitchAlignment(): Alignment;\n getPopup(): Popup;\n getRotation(): number;\n getRotationAlignment(): Alignment;\n isDraggable(): boolean;\n remove(): void;\n removeClassName(className: string): void;\n setDraggable(draggable: boolean): void;\n setPosition(px: [number, number]): void;\n setOffset(offset: PointLike): void;\n setOpacity(opacity?: string, opacityWhenCovered?: string): void;\n setPitchAlignment(pitchAlignment: Alignment): void;\n setPopup(popup: Popup): void;\n setRotation(rotation: number): void;\n setRotationAlignment(rotationAlignment: Alignment): void;\n setSubpixelPositioning(subpixelPositioning: boolean): void;\n toggleClassName(className: string): void;\n togglePopup(): void;\n}\n\nexport class ImageViewerMarker extends Evented {\n private viewer!: ImageViewer;\n private readonly marker: Marker;\n private readonly position: [number, number] = [0, 0];\n\n constructor({ ...markerOptions }: ImageViewerMarkerOptions) {\n super();\n this.marker = new Marker(markerOptions as MarkerOptions);\n }\n\n /**\n * Adds the ImageViewerMarker to an instance of ImageViewer.\n *\n * @param {ImageViewer} viewer - The instance of ImageViewer to add the ImageViewerMarker to.\n * @returns {ImageViewerMarker} The ImageViewerMarker instance.\n */\n addTo(viewer: ImageViewer) {\n if (!(viewer instanceof ImageViewer)) {\n throw new Error(\"[ImageViewerMarker]: an ImageViewerMarker must be added to an instance of ImageViewer\");\n }\n\n this.viewer = viewer;\n\n setupMarkerEventForwarder(this.marker, this, this.viewer[lngLatToPxInternalSymbolKey]);\n const mapInstance = this.viewer.getSDKInternal();\n\n this.setPosition(this.position);\n\n monkeyPatchMarkerInstanceToRemoveWrapping(this.marker);\n\n this.marker.addTo(mapInstance);\n\n return this;\n }\n\n /**\n * Adds a class name to the ImageViewerMarker.\n *\n * @param {string} className - The class name to add to the ImageViewerMarker.\n * @returns {ImageViewerMarker} The ImageViewerMarker instance.\n */\n addClassName(className: string) {\n this.marker.addClassName(className);\n return this;\n }\n\n /**\n * Gets the element of the ImageViewerMarker.\n *\n * @returns {HTMLElement} The element of the ImageViewerMarker.\n */\n getElement() {\n return this.marker.getElement();\n }\n\n /**\n * Gets the position of the ImageViewerMarker.\n *\n * @returns {PointLike} The position of the ImageViewerMarker.\n * @see [PointLike](https://docs.maptiler.com/sdk-js/api/geography/#pointlike)\n *\n */\n getPosition() {\n return this.position;\n }\n\n /**\n * Gets the offset of the ImageViewerMarker.\n *\n * @returns {PointLike} The offset of the ImageViewerMarker.\n * @see [PointLike](https://docs.maptiler.com/sdk-js/api/geography/#pointlike)\n */\n getOffset() {\n return this.marker.getOffset();\n }\n\n /**\n * Gets the pitch alignment of the ImageViewerMarker.\n *\n * @returns {Alignment} The pitch alignment of the ImageViewerMarker.\n * @see [MapLibreGL.Alignment](https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/Alignment/)\n */\n getPitchAlignment() {\n return this.marker.getPitchAlignment();\n }\n\n /**\n * Gets the popup of the ImageViewerMarker.\n *\n * @returns {Popup} The popup of the ImageViewerMarker.\n * @see [Popup](https://docs.maptiler.com/sdk-js/api/markers/#popup)\n */\n getPopup() {\n return this.marker.getPopup();\n }\n\n /**\n * Gets the rotation of the ImageViewerMarker.\n *\n * @returns {number} The rotation of the ImageViewerMarker.\n */\n getRotation() {\n return this.marker.getRotation();\n }\n\n /**\n * Gets the rotation alignment of the ImageViewerMarker.\n *\n * @returns {Alignment} The rotation alignment of the ImageViewerMarker.\n * @see [MapLibreGL.Alignment](https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/Alignment/)\n */\n getRotationAlignment() {\n return this.marker.getRotationAlignment();\n }\n\n /**\n * Checks if the ImageViewerMarker is draggable.\n *\n * @returns {boolean} True if the ImageViewerMarker is draggable, false otherwise.\n */\n isDraggable() {\n return this.marker.isDraggable();\n }\n\n /**\n * Fires an event on the ImageViewerMarker.\n *\n * @param {MarkerEventTypes | Event} event - The event to fire.\n * @param {Record<string, any>} data - The data to fire the event with.\n * @returns {ImageViewerMarker} The ImageViewerMarker instance.\n */\n override fire(event: MarkerEventTypes | Event, data?: Record<string, any>) {\n super.fire(event, data);\n return this;\n }\n\n /**\n * Removes an event listener from the ImageViewerMarker.\n *\n * @param {MarkerEventTypes} event - The event to remove the listener from.\n * @param {ImageViewerMarkerEvent} listener - The listener to remove.\n * @returns {ImageViewerMarker} The ImageViewerMarker instance.\n */\n override off(event: MarkerEventTypes, listener: (e: ImageViewerMarkerEvent) => void) {\n super.off(event, listener);\n return this;\n }\n\n /**\n * Adds an event listener to the ImageViewerMarker.\n *\n * @param {MarkerEventTypes} event - The event to add the listener to.\n * @param {ImageViewerMarkerEvent} listener - The listener to add.\n * @returns {ImageViewerMarker} The ImageViewerMarker instance.\n */\n override on(event: MarkerEventTypes, listener: (e: ImageViewerMarkerEvent) => void) {\n return super.on(event, listener);\n }\n\n /**\n * Checks if the ImageViewerMarker is within the image bounds.\n *\n * @returns {boolean} True if the ImageViewerMarker is within the image bounds, false otherwise.\n */\n isWithinImageBounds() {\n return this.viewer.pointIsWithinImageBounds(this.position);\n }\n\n /**\n * Removes the ImageViewerMarker from the ImageViewer and cleans up the event listeners.\n *\n * @returns {ImageViewerMarker} The ImageViewerMarker instance.\n */\n\n remove() {\n this.marker.remove();\n // the typescript type is incorrect here\n // _listeners is only defined if there are actual listeners\n if (this.marker._listeners) {\n Object.entries(this.marker._listeners).forEach(([event, listeners]) => {\n listeners.forEach((listener) => {\n this.off(event as MarkerEventTypes, listener);\n });\n });\n }\n\n // the typescript type is incorrect here too\n // _oneTimeListeners is only defined if there are actual listeners\n if (this.marker._oneTimeListeners) {\n Object.entries(this.marker._oneTimeListeners).forEach(([event, listeners]) => {\n listeners.forEach((listener) => {\n this.off(event as MarkerEventTypes, listener);\n });\n });\n }\n return this;\n }\n\n /**\n * Removes a class name from the ImageViewerMarker dom element.\n *\n * @param {string} className - The class name to remove from the ImageViewerMarker.\n * @returns {ImageViewerMarker} The ImageViewerMarker instance.\n */\n removeClassName(className: string) {\n this.marker.removeClassName(className);\n return this;\n }\n\n /**\n * Sets the draggable state of the ImageViewerMarker.\n *\n * @param {boolean} draggable - The draggable state of the ImageViewerMarker.\n * @returns {ImageViewerMarker} The ImageViewerMarker instance.\n */\n setDraggable(draggable: boolean) {\n this.marker.setDraggable(draggable);\n return this;\n }\n\n /**\n * Sets the position of the ImageViewerMarker.\n *\n * @param {[number, number]} px - The position of the ImageViewerMarker in image pixels.\n * @returns {ImageViewerMarker} The ImageViewerMarker instance.\n */\n setPosition(px: [number, number]) {\n this.position[0] = px[0];\n this.position[1] = px[1];\n\n if (!this.viewer) {\n return this;\n }\n\n const lngLat = this.viewer[pxToLngLatInternalSymbolKey](px);\n this.marker.setLngLat(lngLat);\n return this;\n }\n\n /**\n * Sets the offset of the ImageViewerMarker.\n *\n * @param {PointLike} offset - The offset of the ImageViewerMarker.\n * @returns {ImageViewerMarker} The ImageViewerMarker instance.\n */\n setOffset(offset: PointLike) {\n this.marker.setOffset(offset);\n return this;\n }\n\n /**\n * Sets the opacity of the ImageViewerMarker.\n *\n * @param {string} opacity - The opacity of the ImageViewerMarker.\n * @param {string} opacityWhenCovered - The opacity of the ImageViewerMarker when covered.\n * @returns {ImageViewerMarker} The ImageViewerMarker instance.\n */\n setOpacity(opacity?: string, opacityWhenCovered?: string) {\n this.marker.setOpacity(opacity, opacityWhenCovered);\n return this;\n }\n\n /**\n * Sets the pitch alignment of the ImageViewerMarker.\n *\n * @param {Alignment} pitchAlignment - The pitch alignment of the ImageViewerMarker.\n * @returns {ImageViewerMarker} The ImageViewerMarker instance.\n * @see [MapLibreGL.Alignment](https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/Alignment/)\n */\n setPitchAlignment(pitchAlignment: Alignment) {\n this.marker.setPitchAlignment(pitchAlignment);\n return this;\n }\n\n /**\n * Sets the popup of the ImageViewerMarker.\n *\n * @param {Popup} popup - The popup of the ImageViewerMarker.\n * @returns {ImageViewerMarker} The ImageViewerMarker instance.\n * @see [Popup](https://docs.maptiler.com/sdk-js/api/markers/#popup)\n */\n setPopup(popup: Popup) {\n this.marker.setPopup(popup);\n return this;\n }\n\n /**\n * Sets the rotation of the ImageViewerMarker.\n *\n * @param {number} rotation - The rotation of the ImageViewerMarker.\n * @returns {ImageViewerMarker} The ImageViewerMarker instance.\n */\n setRotation(rotation: number) {\n this.marker.setRotation(rotation);\n return this;\n }\n\n /**\n * Sets the rotation alignment of the ImageViewerMarker.\n *\n * @param {Alignment} rotationAlignment - The rotation alignment of the ImageViewerMarker.\n * @returns {ImageViewerMarker} The ImageViewerMarker instance.\n * @see [MapLibreGL.Alignment](https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/Alignment/)\n */\n setRotationAlignment(rotationAlignment: Alignment) {\n this.marker.setRotationAlignment(rotationAlignment);\n return this;\n }\n\n /**\n * Sets if subpixel positioning is enabled for the ImageViewerMarker.\n *\n * @param {boolean} subpixelPositioning - The subpixel positioning of the ImageViewerMarker.\n * @returns {ImageViewerMarker} The ImageViewerMarker instance.\n */\n setSubpixelPositioning(subpixelPositioning: boolean) {\n this.marker.setSubpixelPositioning(subpixelPositioning);\n return this;\n }\n\n /**\n * Toggles a class name on the ImageViewerMarker dom element.\n *\n * @param {string} className - The class name to toggle on the ImageViewerMarker.\n * @returns {ImageViewerMarker} The ImageViewerMarker instance.\n */\n toggleClassName(className: string) {\n this.marker.toggleClassName(className);\n return this;\n }\n\n /**\n * Toggles the popup of the ImageViewerMarker.\n *\n * @returns {ImageViewerMarker} The ImageViewerMarker instance.\n */\n togglePopup() {\n this.marker.togglePopup();\n return this;\n }\n}\n\nconst MARKER_EVENT_TYPES = [\"dragstart\", \"drag\", \"dragend\"] as const;\n\ntype MarkerEventTypes = (typeof MARKER_EVENT_TYPES)[number];\n\nconst FORBIDDEN_EVENT_VALUES = [\"lngLat\", \"_defaultPrevented\", \"target\"];\n\nexport class ImageViewerMarkerEvent {\n readonly type: string;\n readonly target: ImageViewerMarker;\n\n [key: string]: any;\n\n constructor(type: MarkerEventTypes, marker: ImageViewerMarker, data: Record<string, any>) {\n this.type = type;\n this.target = marker;\n\n Object.assign(this, data);\n }\n}\n\nfunction setupMarkerEventForwarder(mapLibreMarker: Marker, imageViewerMarker: ImageViewerMarker, lngLatToPx: ImageViewer[typeof lngLatToPxInternalSymbolKey]) {\n MARKER_EVENT_TYPES.forEach((eventType) => {\n mapLibreMarker.on(eventType, (e) => {\n const lngLat = e.target?.getLngLat();\n if (lngLat) {\n const px = lngLatToPx(e.target?.getLngLat());\n imageViewerMarker.setPosition(px);\n }\n imageViewerMarker.fire(\n eventType,\n new ImageViewerMarkerEvent(eventType, imageViewerMarker, {\n ...Object.fromEntries(Object.entries(e).filter(([key]) => !FORBIDDEN_EVENT_VALUES.includes(key))),\n }),\n );\n });\n });\n}\n","// Typescript port of https://github.com/mapbox/togeojson/\n// This includes KML and GPX parsing to GeoJSON\n\nexport interface Link {\n href: string | null;\n}\n\nexport interface XMLProperties {\n links?: Link[];\n}\n\nexport interface PlacemarkProperties {\n name?: string;\n address?: string;\n styleUrl?: string;\n description?: string;\n styleHash?: string;\n styleMapHash?: Record<string, string | null>;\n timespan?: {\n begin: string;\n end: string;\n };\n timestamp?: string;\n stroke?: string;\n \"stroke-opacity\"?: number;\n \"stroke-width\"?: number;\n fill?: string;\n \"fill-opacity\"?: number;\n visibility?: string;\n icon?: string;\n coordTimes?: (string | null)[] | (string | null)[][];\n}\n\n/**\n * create a function that converts a string to XML\n * https://developer.mozilla.org/en-US/docs/Web/API/DOMParser\n */\nexport function str2xml(str: string): Document {\n if (typeof DOMParser !== \"undefined\") {\n const doc = new DOMParser().parseFromString(str, \"application/xml\");\n\n // If the input string was not valid XML\n if (doc.querySelector(\"parsererror\")) {\n throw new Error(\"The provided string is not valid XML\");\n }\n\n return doc;\n }\n\n throw new Error(\"No XML parser found\");\n}\n\n/**\n * Check one of the top level child node is of a given type (\"gpx\", \"kml\").\n * The check is not case sensitive.\n * @param doc\n * @param nodeName\n * @returns\n */\nexport function hasChildNodeWithName(doc: Document, nodeName: string): boolean {\n if (!doc.hasChildNodes()) {\n return false;\n }\n\n for (const childNode of Array.from(doc.childNodes)) {\n const currentNodeName = childNode.nodeName;\n if (typeof currentNodeName === \"string\" && currentNodeName.trim().toLowerCase() === nodeName.toLowerCase()) {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * create a function that converts a XML to a string\n * https://developer.mozilla.org/en-US/docs/Web/API/XMLSerializer\n */\nexport function xml2str(node: Node): string {\n if (typeof XMLSerializer !== \"undefined\") {\n return new XMLSerializer().serializeToString(node);\n }\n throw new Error(\"No XML serializer found\");\n}\n\n/**\n * Given a XML document using the GPX spec, return GeoJSON\n */\nexport function gpx(doc: string | Document): GeoJSON.FeatureCollection {\n const actualDoc = typeof doc === \"string\" ? str2xml(doc) : doc;\n\n // The document is valid XML but not valid GPX (at least the first node is not)\n if (!hasChildNodeWithName(actualDoc, \"gpx\")) {\n throw new Error(\"The XML document is not valid GPX\");\n }\n\n const tracks = get(actualDoc, \"trk\");\n const routes = get(actualDoc, \"rte\");\n const waypoints = get(actualDoc, \"wpt\");\n // a feature collection\n const gj: GeoJSON.FeatureCollection = {\n type: \"FeatureCollection\",\n features: [],\n };\n for (const track of Array.from(tracks)) {\n const feature = getTrack(track);\n if (feature) gj.features.push(feature);\n }\n for (const route of Array.from(routes)) {\n const feature = getRoute(route);\n if (feature) gj.features.push(feature);\n }\n for (const waypoint of Array.from(waypoints)) {\n gj.features.push(getPoint(waypoint));\n }\n return gj;\n}\n\n/**\n * Given a XML document using the KML spec, return GeoJSON\n */\nexport function kml(doc: string | Document, xml2string?: (node: Node) => string): GeoJSON.FeatureCollection {\n let actualDoc = doc;\n if (typeof actualDoc === \"string\") actualDoc = str2xml(actualDoc);\n\n // The document is valid XML but not valid KML (at leas the first node is not)\n if (!hasChildNodeWithName(actualDoc, \"kml\")) {\n throw new Error(\"The XML document is not valid KML\");\n }\n\n const gj: GeoJSON.FeatureCollection = {\n type: \"FeatureCollection\",\n features: [],\n };\n // styleindex keeps track of hashed styles in order to match features\n const styleIndex: Record<string, string> = {};\n const styleByHash: Record<string, Element> = {};\n // stylemapindex keeps track of style maps to expose in properties\n const styleMapIndex: Record<string, Record<string, string | null>> = {};\n // all root placemarks in the file\n const placemarks = get(actualDoc, \"Placemark\");\n const styles = get(actualDoc, \"Style\");\n const styleMaps = get(actualDoc, \"StyleMap\");\n\n for (const style of Array.from(styles)) {\n const hash = okhash(xml2string !== undefined ? xml2string(style) : xml2str(style)).toString(16);\n styleIndex[`#${attr(style, \"id\")}`] = hash;\n styleByHash[hash] = style;\n }\n for (const styleMap of Array.from(styleMaps)) {\n styleIndex[`#${attr(styleMap, \"id\")}`] = okhash(xml2string !== undefined ? xml2string(styleMap) : xml2str(styleMap)).toString(16);\n const pairs = get(styleMap, \"Pair\");\n const pairsMap: Record<string, string | null> = {};\n for (const pair of Array.from(pairs)) {\n pairsMap[nodeVal(get1(pair, \"key\")) ?? \"\"] = nodeVal(get1(pair, \"styleUrl\"));\n }\n styleMapIndex[`#${attr(styleMap, \"id\")}`] = pairsMap;\n }\n for (const placemark of Array.from(placemarks)) {\n gj.features = gj.features.concat(getPlacemark(placemark, styleIndex, styleByHash, styleMapIndex));\n }\n return gj;\n}\n\n// parse color string to hex string with opacity. black with 100% opacity will be returned if no data found\nfunction kmlColor(v: string | null): [string, number] {\n if (v === null) return [\"#000000\", 1];\n let color = \"\";\n let opacity = 1;\n let validV = v;\n if (validV.startsWith(\"#\")) validV = validV.substring(1);\n if (validV.length === 6 || validV.length === 3) color = validV;\n if (validV.length === 8) {\n opacity = Number.parseInt(validV.substring(0, 2), 16) / 255;\n color = `#${validV.substring(6, 8)}${validV.substring(4, 6)}${validV.substring(2, 4)}`;\n }\n return [color ?? \"#000000\", opacity ?? 1];\n}\n\nfunction gxCoord(v: string): number[] {\n return numarray(v.split(\" \"));\n}\n\n// grab coordinates and timestamps (when available) from the gx:Track extension\nfunction gxCoords(root: Document | Element): {\n coords: number[][];\n times: (string | null)[];\n} {\n let elems = get(root, \"coord\");\n const coords: number[][] = [];\n const times: (string | null)[] = [];\n if (elems.length === 0) elems = get(root, \"gx:coord\");\n for (const elem of Array.from(elems)) {\n coords.push(gxCoord(nodeVal(elem) ?? \"\"));\n }\n const timeElems = get(root, \"when\");\n for (const timeElem of Array.from(timeElems)) times.push(nodeVal(timeElem));\n return {\n coords: coords,\n times,\n };\n}\n\n// get the geometry data and coordinate timestamps if available\nfunction getGeometry(root: Element): {\n geoms: GeoJSON.Geometry[];\n coordTimes: (string | null)[][];\n} {\n // atomic geospatial types supported by KML - MultiGeometry is\n // handled separately\n const geotypes = [\"Polygon\", \"LineString\", \"Point\", \"Track\", \"gx:Track\"];\n // setup variables\n let geomNode: Element;\n let geomNodes: HTMLCollectionOf<Element>;\n let i: number;\n let j: number;\n let k: number;\n const geoms: GeoJSON.Geometry[] = [];\n const coordTimes: (string | null)[][] = [];\n // simple cases\n if (get1(root, \"MultiGeometry\") !== null) {\n return getGeometry(get1(root, \"MultiGeometry\")!);\n }\n if (get1(root, \"MultiTrack\") !== null) {\n return getGeometry(get1(root, \"MultiTrack\")!);\n }\n if (get1(root, \"gx:MultiTrack\") !== null) {\n return getGeometry(get1(root, \"gx:MultiTrack\")!);\n }\n for (i = 0; i < geotypes.length; i++) {\n geomNodes = get(root, geotypes[i]);\n if (geomNodes) {\n for (j = 0; j < geomNodes.length; j++) {\n geomNode = geomNodes[j];\n if (geotypes[i] === \"Point\") {\n geoms.push({\n type: \"Point\",\n coordinates: coord1(nodeVal(get1(geomNode, \"coordinates\")) ?? \"\"),\n });\n } else if (geotypes[i] === \"LineString\") {\n geoms.push({\n type: \"LineString\",\n coordinates: coord(nodeVal(get1(geomNode, \"coordinates\")) ?? \"\"),\n });\n } else if (geotypes[i] === \"Polygon\") {\n const rings = get(geomNode, \"LinearRing\");\n const coords = [];\n for (k = 0; k < rings.length; k++) {\n coords.push(coord(nodeVal(get1(rings[k], \"coordinates\")) ?? \"\"));\n }\n geoms.push({\n type: \"Polygon\",\n coordinates: coords,\n });\n } else if (geotypes[i] === \"Track\" || geotypes[i] === \"gx:Track\") {\n const track = gxCoords(geomNode);\n geoms.push({\n type: \"LineString\",\n coordinates: track.coords,\n });\n if (track.times.length) coordTimes.push(track.times);\n }\n }\n }\n }\n return { geoms, coordTimes };\n}\n\n// build geojson feature sets with all their attributes and property data\nfunction getPlacemark(root: Element, styleIndex: Record<string, string>, styleByHash: Record<string, Element>, styleMapIndex: Record<string, Record<string, string | null>>) {\n const geomsAndTimes = getGeometry(root);\n const properties: PlacemarkProperties & Record<string, string> = {};\n const name = nodeVal(get1(root, \"name\"));\n const address = nodeVal(get1(root, \"address\"));\n const description = nodeVal(get1(root, \"description\"));\n const timeSpan = get1(root, \"TimeSpan\");\n const timeStamp = get1(root, \"TimeStamp\");\n const extendedData = get1(root, \"ExtendedData\");\n const visibility = get1(root, \"visibility\");\n\n let i: number;\n let styleUrl = nodeVal(get1(root, \"styleUrl\"));\n let lineStyle = get1(root, \"LineStyle\");\n let polyStyle = get1(root, \"PolyStyle\");\n\n if (!geomsAndTimes.geoms.length) return [];\n if (name) properties.name = name;\n if (address) properties.address = address;\n if (styleUrl) {\n if (!styleUrl.startsWith(\"#\")) styleUrl = `#${styleUrl}`;\n\n properties.styleUrl = styleUrl;\n if (styleIndex[styleUrl]) {\n properties.styleHash = styleIndex[styleUrl];\n }\n if (styleMapIndex[styleUrl]) {\n properties.styleMapHash = styleMapIndex[styleUrl];\n properties.styleHash = styleIndex[styleMapIndex[styleUrl].normal ?? \"\"];\n }\n // Try to populate the lineStyle or polyStyle since we got the style hash\n const style = styleByHash[properties.styleHash ?? \"\"];\n if (style) {\n if (!lineStyle) lineStyle = get1(style, \"LineStyle\");\n if (!polyStyle) polyStyle = get1(style, \"PolyStyle\");\n const iconStyle = get1(style, \"IconStyle\");\n if (iconStyle) {\n const icon = get1(iconStyle, \"Icon\");\n if (icon) {\n const href = nodeVal(get1(icon, \"href\"));\n if (href) properties.icon = href;\n }\n }\n }\n }\n if (description) properties.description = description;\n if (timeSpan) {\n const begin = nodeVal(get1(timeSpan, \"begin\"));\n const end = nodeVal(get1(timeSpan, \"end\"));\n if (begin && end) properties.timespan = { begin, end };\n }\n if (timeStamp !== null) {\n properties.timestamp = nodeVal(get1(timeStamp, \"when\")) ?? new Date().toISOString();\n }\n if (lineStyle !== null) {\n const linestyles = kmlColor(nodeVal(get1(lineStyle, \"color\")));\n const color = linestyles[0];\n const opacity = linestyles[1];\n const width = Number.parseFloat(nodeVal(get1(lineStyle, \"width\")) ?? \"\");\n if (color) properties.stroke = color;\n if (!Number.isNaN(opacity)) properties[\"stroke-opacity\"] = opacity;\n if (!Number.isNaN(width)) properties[\"stroke-width\"] = width;\n }\n if (polyStyle) {\n const polystyles = kmlColor(nodeVal(get1(polyStyle, \"color\")));\n const pcolor = polystyles[0];\n const popacity = polystyles[1];\n const fill = nodeVal(get1(polyStyle, \"fill\"));\n const outline = nodeVal(get1(polyStyle, \"outline\"));\n if (pcolor) properties.fill = pcolor;\n if (!Number.isNaN(popacity)) properties[\"fill-opacity\"] = popacity;\n if (fill) properties[\"fill-opacity\"] = fill === \"1\" ? properties[\"fill-opacity\"] || 1 : 0;\n if (outline) properties[\"stroke-opacity\"] = outline === \"1\" ? properties[\"stroke-opacity\"] || 1 : 0;\n }\n if (extendedData) {\n const datas = get(extendedData, \"Data\");\n const simpleDatas = get(extendedData, \"SimpleData\");\n\n for (i = 0; i < datas.length; i++) {\n properties[datas[i].getAttribute(\"name\") ?? \"\"] = nodeVal(get1(datas[i], \"value\")) ?? \"\";\n }\n for (i = 0; i < simpleDatas.length; i++) {\n properties[simpleDatas[i].getAttribute(\"name\") ?? \"\"] = nodeVal(simpleDatas[i]) ?? \"\";\n }\n }\n if (visibility !== null) {\n properties.visibility = nodeVal(visibility) ?? \"\";\n }\n if (geomsAndTimes.coordTimes.length !== 0) {\n properties.coordTimes = geomsAndTimes.coordTimes.length === 1 ? geomsAndTimes.coordTimes[0] : geomsAndTimes.coordTimes;\n }\n const feature: GeoJSON.Feature = {\n type: \"Feature\",\n geometry:\n geomsAndTimes.geoms.length === 1\n ? geomsAndTimes.geoms[0]\n : {\n type: \"GeometryCollection\",\n geometries: geomsAndTimes.geoms,\n },\n properties: properties,\n };\n if (attr(root, \"id\")) feature.id = attr(root, \"id\") ?? undefined;\n return [feature];\n}\n\nfunction getPoints(\n node: Element,\n pointname: string,\n):\n | undefined\n | {\n line: number[][];\n times: string[];\n heartRates: (number | null)[];\n } {\n const pts = get(node, pointname);\n const line: number[][] = [];\n const times: string[] = [];\n let heartRates: (number | null)[] = [];\n const ptsLength = pts.length;\n if (ptsLength < 2) return; // Invalid line in GeoJSON\n for (let i = 0; i < ptsLength; i++) {\n const cPair = coordPair(pts[i]);\n line.push(cPair.coordinates);\n if (cPair.time) times.push(cPair.time);\n if (cPair.heartRate || heartRates.length) {\n if (heartRates.length === 0) heartRates = new Array(i).fill(null);\n heartRates.push(cPair.heartRate);\n }\n }\n return {\n line: line,\n times: times,\n heartRates,\n };\n}\n\nfunction getTrack(node: Element): undefined | GeoJSON.Feature {\n const segments = get(node, \"trkseg\");\n const track = [];\n const times = [];\n const heartRates: (number | null)[][] = [];\n let line: any;\n for (let i = 0; i < segments.length; i++) {\n line = getPoints(segments[i], \"trkpt\");\n if (line !== undefined) {\n if (line.line) track.push(line.line);\n if (line.times && line.times.length) times.push(line.times);\n if (heartRates.length || (line.heartRates && line.heartRates.length)) {\n if (!heartRates.length) {\n for (let s = 0; s < i; s++) {\n heartRates.push(new Array(track[s].length).fill(null));\n }\n }\n if (line.heartRates && line.heartRates.length) {\n heartRates.push(line.heartRates);\n } else {\n heartRates.push(new Array(line.line.length).fill(null));\n }\n }\n }\n }\n if (track.length === 0) return;\n const properties: {\n coordTimes?: string[] | string[][];\n heartRates?: (number | null)[] | (number | null)[][];\n } & XMLProperties &\n Record<string, string | number> = {\n ...getProperties(node),\n ...getLineStyle(get1(node, \"extensions\")),\n };\n if (times.length !== 0) properties.coordTimes = track.length === 1 ? times[0] : times;\n if (heartRates.length !== 0) {\n properties.heartRates = track.length === 1 ? heartRates[0] : heartRates;\n }\n if (track.length === 1) {\n return {\n type: \"Feature\",\n properties,\n geometry: {\n type: \"LineString\",\n coordinates: track[0],\n },\n };\n }\n\n return {\n type: \"Feature\",\n properties,\n geometry: {\n type: \"MultiLineString\",\n coordinates: track,\n },\n };\n}\n\nfunction getRoute(node: Element): GeoJSON.Feature | undefined {\n const line = getPoints(node, \"rtept\");\n if (line === undefined) return;\n const prop = {\n ...getProperties(node),\n ...getLineStyle(get1(node, \"extensions\")),\n };\n return {\n type: \"Feature\",\n properties: prop,\n geometry: {\n type: \"LineString\",\n coordinates: line.line,\n },\n };\n}\n\nfunction getPoint(node: Element): GeoJSON.Feature {\n const prop = { ...getProperties(node), ...getMulti(node, [\"sym\"]) };\n return {\n type: \"Feature\",\n properties: prop,\n geometry: {\n type: \"Point\",\n coordinates: coordPair(node).coordinates,\n },\n };\n}\n\nfunction getLineStyle(extensions: Element | null): Record<string, string | number> {\n const style: Record<string, string | number> = {};\n if (extensions) {\n const lineStyle = get1(extensions, \"line\");\n if (lineStyle) {\n const color = nodeVal(get1(lineStyle, \"color\"));\n const opacity = Number.parseFloat(nodeVal(get1(lineStyle, \"opacity\")) ?? \"0\");\n const width = Number.parseFloat(nodeVal(get1(lineStyle, \"width\")) ?? \"0\");\n if (color) style.stroke = color;\n if (!Number.isNaN(opacity)) style[\"stroke-opacity\"] = opacity;\n // GPX width is in mm, convert to px with 96 px per inch\n if (!Number.isNaN(width)) style[\"stroke-width\"] = (width * 96) / 25.4;\n }\n }\n return style;\n}\n\nfunction getProperties(node: Element): XMLProperties & Record<string, string> {\n const prop: XMLProperties & Record<string, string> = getMulti(node, [\"name\", \"cmt\", \"desc\", \"type\", \"time\", \"keywords\"]);\n const links = get(node, \"link\");\n if (links.length !== 0) {\n prop.links = [];\n for (const l of Array.from(links)) {\n const link = {\n href: attr(l, \"href\"),\n ...getMulti(l, [\"text\", \"type\"]),\n };\n prop.links.push(link);\n }\n }\n return prop;\n}\n\nfunction okhash(x: string): number {\n let h = 0;\n if (!x || !x.length) return h;\n for (let i = 0; i < x.length; i++) {\n h = ((h << 5) - h + x.charCodeAt(i)) | 0;\n }\n return h;\n}\n\nfunction get(x: Document | Element, y: string): HTMLCollectionOf<Element> {\n return x.getElementsByTagName(y);\n}\n\nfunction attr(x: Element, y: string): string | null {\n return x.getAttribute(y);\n}\n\nfunction attrf(x: Element, y: string): number {\n return Number.parseFloat(attr(x, y) ?? \"0\");\n}\n\nfunction get1(x: Element, y: string): Element | null {\n const n = get(x, y);\n return n.length ? n[0] : null;\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/API/Node.normalize\nfunction norm(el: Element): Element {\n if (el.normalize) el.normalize();\n return el;\n}\n\n// cast array x into numbers\nfunction numarray(x: string[]): number[] {\n return x.map(Number.parseFloat).map((n) => (Number.isNaN(n) ? null : n)) as number[];\n}\n\n// get the content of a text node, if any\nfunction nodeVal(x: Element | null): string | null {\n if (x) norm(x);\n return x && x.textContent;\n}\n\n// get the contents of multiple text nodes, if present\nfunction getMulti(x: Element, ys: string[]): Record<string, string> {\n const o: Record<string, string> = {};\n let n: Element | null;\n let k: number;\n for (k = 0; k < ys.length; k++) {\n n = get1(x, ys[k]);\n if (n) o[ys[k]] = nodeVal(n) ?? \"\";\n }\n return o;\n}\n\n// get one coordinate from a coordinate array, if any\nfunction coord1(v: string): number[] {\n return numarray(v.replace(/\\s*/g, \"\").split(\",\"));\n}\n\n// get all coordinates from a coordinate array as [[],[]]\nfunction coord(v: string): number[][] {\n const coords = v.replace(/^\\s*|\\s*$/g, \"\").split(/\\s+/);\n const out = [];\n for (const coord of coords) out.push(coord1(coord));\n return out;\n}\n\n// build a set of coordinates, timestamps, and heartrate\nfunction coordPair(x: Element): {\n coordinates: number[];\n time: string | null;\n heartRate: number | null;\n} {\n const ll = [attrf(x, \"lon\"), attrf(x, \"lat\")];\n const ele = get1(x, \"ele\");\n // handle namespaced attribute in browser\n const heartRate = get1(x, \"gpxtpx:hr\") || get1(x, \"hr\");\n const time = get1(x, \"time\");\n let e: number;\n if (ele) {\n e = Number.parseFloat(nodeVal(ele) ?? \"0\");\n if (!Number.isNaN(e)) ll.push(e);\n }\n return {\n coordinates: ll,\n time: time ? nodeVal(time) : null,\n heartRate: heartRate !== null ? Number.parseFloat(nodeVal(heartRate) ?? \"0\") : null,\n };\n}\n\nexport function gpxOrKml(doc: string | Document): GeoJSON.FeatureCollection | null {\n let actualDoc = doc;\n try {\n // Converting only once rather than in each converter\n if (typeof actualDoc === \"string\") actualDoc = str2xml(actualDoc);\n } catch (_e) {\n // The doc is a string but not valid XML\n return null;\n }\n\n try {\n const result = gpx(actualDoc);\n return result;\n } catch (_e) {\n // The doc is valid XML but not valid GPX\n }\n\n try {\n const result = kml(actualDoc);\n return result;\n } catch (_e) {\n // The doc is valid XML but not valid KML\n }\n\n // At this point, the doc is not of a compatible vector format\n return null;\n}\n","import type { Map as MapSDK } from \"../Map\";\n\n/**\n * Takes a screenshot (PNG file) of the curent map view.\n * Depending on the options, this function can automatically trigger a download of te file.\n */\nexport async function takeScreenshot(\n map: MapSDK,\n options: {\n /**\n * If `true`, this function will trigger a download in addition to returning a blob.\n * Default: `false`\n */\n download?: boolean;\n\n /**\n * Only if `options.download` is `true`. Indicates the filename under which\n * the file will be downloaded.\n * Default: `\"maptiler_screenshot.png\"`\n */\n filename?: string;\n } = {},\n): Promise<Blob> {\n const download = options.download ?? false;\n const blob = await getMapScreenshotBlob(map);\n\n if (download) {\n const filename = options.filename ?? \"maptiler_screenshot.png\";\n\n const link = document.createElement(\"a\");\n link.style.display = \"none\";\n document.body.appendChild(link);\n link.href = URL.createObjectURL(blob);\n link.download = filename;\n link.click();\n\n // Cleaning after event loop\n setTimeout(() => {\n document.body.removeChild(link);\n URL.revokeObjectURL(link.href);\n }, 0);\n }\n\n return blob;\n}\n\nfunction getMapScreenshotBlob(map: MapSDK): Promise<Blob> {\n return new Promise((resolve, reject) => {\n map.redraw();\n\n map.once(\"idle\", () => {\n map.getCanvas().toBlob((blob) => {\n if (!blob) {\n reject(Error(\"Screenshot could not be created.\"));\n return;\n }\n\n resolve(blob);\n }, \"image/png\");\n });\n });\n}\n","import type { DataDrivenPropertyValueSpecification, ExpressionSpecification } from \"maplibre-gl\";\nimport { generateRandomString } from \"../tools\";\nimport type { ColorRamp, RgbaColor } from \"../ColorRamp\";\nimport type { DataDrivenStyle, PropertyValues, ZoomNumberValues, ZoomStringValues } from \"./vectorlayerhelpers\";\n\nexport type ColorPalette = [string, string, string, string];\n\nexport const colorPalettes: Array<ColorPalette> = [\n // https://colorhunt.co/palette/1d5b79468b97ef6262f3aa60\n [\"#1D5B79\", \"#468B97\", \"#EF6262\", \"#F3AA60\"],\n\n // https://colorhunt.co/palette/614bc333bbc585e6c5c8ffe0\n [\"#614BC3\", \"#33BBC5\", \"#85E6C5\", \"#C8FFE0\"],\n\n // https://colorhunt.co/palette/4619597a316fcd6688aed8cc\n [\"#461959\", \"#7A316F\", \"#CD6688\", \"#AED8CC\"],\n\n // https://colorhunt.co/palette/0079ff00dfa2f6fa70ff0060\n [\"#0079FF\", \"#00DFA2\", \"#F6FA70\", \"#FF0060\"],\n\n //https://colorhunt.co/palette/39b5e0a31acbff78f0f5ea5a\n [\"#39B5E0\", \"#A31ACB\", \"#FF78F0\", \"#F5EA5A\"],\n\n // https://colorhunt.co/palette/37e2d5590696c70a80fbcb0a\n [\"#37E2D5\", \"#590696\", \"#C70A80\", \"#FBCB0A\"],\n\n // https://colorhunt.co/palette/ffd36efff56d99ffcd9fb4ff\n [\"#FFD36E\", \"#FFF56D\", \"#99FFCD\", \"#9FB4FF\"],\n\n // https://colorhunt.co/palette/00ead3fff5b7ff449f005f99\n [\"#00EAD3\", \"#FFF5B7\", \"#FF449F\", \"#005F99\"],\n\n // https://colorhunt.co/palette/10a19d540375ff7000ffbf00\n [\"#10A19D\", \"#540375\", \"#FF7000\", \"#FFBF00\"],\n];\n\nexport function getRandomColor(): string {\n return colorPalettes[~~(Math.random() * colorPalettes.length)][~~(Math.random() * 4)];\n}\n\nexport function generateRandomSourceName(): string {\n return `maptiler_source_${generateRandomString()}`;\n}\n\nexport function generateRandomLayerName(): string {\n return `maptiler_layer_${generateRandomString()}`;\n}\n\n/**\n * Linera interpolation to find a value at an arbitrary zoom level, given a list of tuple zoom-value\n */\nexport function lerpZoomNumberValues(znv: ZoomNumberValues, z: number): number {\n // before the range\n if (z <= znv[0].zoom) {\n return znv[0].value;\n }\n\n // after the range\n if (z >= znv[znv.length - 1].zoom) {\n return znv[znv.length - 1].value;\n }\n\n // somewhere within the range\n for (let i = 0; i < znv.length - 1; i += 1) {\n if (z >= znv[i].zoom && z < znv[i + 1].zoom) {\n const zoomRange = znv[i + 1].zoom - znv[i].zoom;\n const normalizedDistanceFromLowerBound = (z - znv[i].zoom) / zoomRange;\n return normalizedDistanceFromLowerBound * znv[i + 1].value + (1 - normalizedDistanceFromLowerBound) * znv[i].value;\n }\n }\n\n return 0;\n}\n\nexport function paintColorOptionsToPaintSpec(color: ZoomStringValues): DataDrivenPropertyValueSpecification<string> {\n return [\"interpolate\", [\"linear\"], [\"zoom\"], ...color.flatMap((el) => [el.zoom, el.value])];\n}\n\nexport function rampedOptionsToLayerPaintSpec(ramp: ZoomNumberValues): DataDrivenPropertyValueSpecification<number> {\n return [\"interpolate\", [\"linear\"], [\"zoom\"], ...ramp.flatMap((el) => [el.zoom, el.value])];\n}\n\nexport function computeRampedOutlineWidth(lineWidth: number | ZoomNumberValues, outlineWidth: number | ZoomNumberValues): number | DataDrivenPropertyValueSpecification<number> {\n // case 1: the line is fixed-width and the outline is fixed-width\n if (typeof outlineWidth === \"number\" && typeof lineWidth === \"number\") {\n return 2 * outlineWidth + lineWidth;\n }\n\n // case 2: the line is ramped-width, the outline is fixed-width\n if (typeof outlineWidth === \"number\" && Array.isArray(lineWidth)) {\n return [\"interpolate\", [\"linear\"], [\"zoom\"], ...lineWidth.flatMap((el) => [el.zoom, 2 * outlineWidth + el.value])];\n }\n\n // case 3: the line is fixed-width, the outline is ramped-width\n if (typeof lineWidth === \"number\" && Array.isArray(outlineWidth)) {\n return [\"interpolate\", [\"linear\"], [\"zoom\"], ...outlineWidth.flatMap((el) => [el.zoom, 2 * el.value + lineWidth])];\n }\n\n // case 4: the line is ramped-width, the outline is ramped-width\n if (Array.isArray(lineWidth) && Array.isArray(outlineWidth)) {\n // We must create an artificial set of zoom stops that includes all the zoom stops from both lists\n // const allStops = [...lineWidth.map(el => el.zoom), ...outlineWidth.map(el => el.zoom)].sort((a: number, b: number) => a < b ? -1 : 1);\n const allStops = Array.from(new Set([...lineWidth.map((el) => el.zoom), ...outlineWidth.map((el) => el.zoom)])).sort((a: number, b: number) => (a < b ? -1 : 1));\n\n return [\"interpolate\", [\"linear\"], [\"zoom\"], ...allStops.flatMap((z) => [z, 2 * lerpZoomNumberValues(outlineWidth, z) + lerpZoomNumberValues(lineWidth, z)])];\n }\n\n return 0;\n}\n\nexport function rampedPropertyValueWeight(ramp: PropertyValues, property: string): DataDrivenPropertyValueSpecification<number> {\n return [\"interpolate\", [\"linear\"], [\"get\", property], ...ramp.flatMap((el) => [el.propertyValue, el.value])];\n}\n\n/**\n * Create a dash array from a string pattern that uses underscore and whitespace characters\n */\nexport function dashArrayMaker(pattern: string): Array<number> {\n // if the pattern starts with whitespaces, then move them towards the end\n const startTrimmedPattern = pattern.trimStart();\n const fixedPattern = `${startTrimmedPattern}${\" \".repeat(pattern.length - startTrimmedPattern.length)}`;\n const patternArr = Array.from(fixedPattern);\n\n const isOnlyDashesAndSpaces = patternArr.every((c) => c === \" \" || c === \"_\");\n if (!isOnlyDashesAndSpaces) {\n throw new Error(\"A dash pattern must be composed only of whitespace and underscore characters.\");\n }\n\n const hasBothDashesAndWhitespaces = patternArr.some((c) => c === \"_\") && patternArr.some((c) => c === \" \");\n if (!hasBothDashesAndWhitespaces) {\n throw new Error(\"A dash pattern must contain at least one underscore and one whitespace character\");\n }\n\n const dashArray = [1];\n\n for (let i = 1; i < patternArr.length; i += 1) {\n const previous = patternArr[i - 1];\n const current = patternArr[i];\n\n if (previous === current) {\n dashArray[dashArray.length - 1] += 1;\n } else {\n dashArray.push(1);\n }\n }\n\n return dashArray;\n}\n\nexport function colorDrivenByProperty(style: DataDrivenStyle, property: string): DataDrivenPropertyValueSpecification<string> {\n return [\"interpolate\", [\"linear\"], [\"get\", property], ...style.flatMap((el) => [el.value, el.color])];\n}\n\nexport function radiusDrivenByProperty(style: DataDrivenStyle, property: string, zoomCompensation = true): DataDrivenPropertyValueSpecification<number> {\n if (!zoomCompensation) {\n return [\"interpolate\", [\"linear\"], [\"get\", property], ...style.flatMap((el) => [el.value, el.pointRadius])];\n }\n\n return [\n \"interpolate\",\n [\"linear\"],\n [\"zoom\"],\n\n 0,\n [\"interpolate\", [\"linear\"], [\"get\", property], ...style.flatMap((el) => [el.value, el.pointRadius * 0.025])],\n\n 2,\n [\"interpolate\", [\"linear\"], [\"get\", property], ...style.flatMap((el) => [el.value, el.pointRadius * 0.05])],\n\n 4,\n [\"interpolate\", [\"linear\"], [\"get\", property], ...style.flatMap((el) => [el.value, el.pointRadius * 0.1])],\n\n 8,\n [\"interpolate\", [\"linear\"], [\"get\", property], ...style.flatMap((el) => [el.value, el.pointRadius * 0.25])],\n\n 16,\n [\"interpolate\", [\"linear\"], [\"get\", property], ...style.flatMap((el) => [el.value, el.pointRadius])],\n ];\n}\n\nexport function radiusDrivenByPropertyHeatmap(style: PropertyValues, property: string, zoomCompensation = true): DataDrivenPropertyValueSpecification<number> {\n if (!zoomCompensation) {\n return [\"interpolate\", [\"linear\"], [\"get\", property], ...style.flatMap((el) => [el.propertyValue, el.value])];\n }\n\n return [\n \"interpolate\",\n [\"linear\"],\n [\"zoom\"],\n\n 0,\n [\"interpolate\", [\"linear\"], [\"get\", property], ...style.flatMap((el) => [el.propertyValue, el.value * 0.025])],\n\n 2,\n [\"interpolate\", [\"linear\"], [\"get\", property], ...style.flatMap((el) => [el.propertyValue, el.value * 0.05])],\n\n 4,\n [\"interpolate\", [\"linear\"], [\"get\", property], ...style.flatMap((el) => [el.propertyValue, el.value * 0.1])],\n\n 8,\n [\"interpolate\", [\"linear\"], [\"get\", property], ...style.flatMap((el) => [el.propertyValue, el.value * 0.25])],\n\n 16,\n [\"interpolate\", [\"linear\"], [\"get\", property], ...style.flatMap((el) => [el.propertyValue, el.value])],\n ];\n}\n\n/**\n * Turns a ColorRamp instance into a MapLibre style for ramping the opacity, driven by a property\n */\nexport function opacityDrivenByProperty(colorramp: ColorRamp, property: string): DataDrivenPropertyValueSpecification<number> {\n // If all opacities are the same, just return the number without any ramping logic\n if (colorramp.every((el) => el.color[3] === colorramp[0].color[3])) {\n return colorramp[0].color[3] ? colorramp[0].color[3] / 255 : 1;\n }\n\n return [\n \"interpolate\",\n [\"linear\"],\n [\"get\", property],\n ...colorramp.getRawColorStops().flatMap((el) => {\n const value = el.value;\n const color: RgbaColor = el.color;\n return [value, color.length === 4 ? color[3] / 255 : 1];\n }),\n ];\n}\n\nexport function heatmapIntensityFromColorRamp(colorRamp: ColorRamp, steps = 10): ExpressionSpecification {\n return [\n \"interpolate\",\n [\"linear\"],\n [\"heatmap-density\"],\n ...Array.from({ length: steps + 1 }, (_, i) => {\n const unitStep = i / steps;\n return [unitStep, colorRamp.getColorHex(unitStep)];\n }).flat(),\n ];\n}\n","export type RgbaColor = [number, number, number] | [number, number, number, number];\n\nexport type ColorStop = {\n /**\n * The \"value\" at which this ColorStop should be applied.\n */\n value: number;\n /**\n * RGB[A] - Array of 3-4 numbers. 0-255 per channel.\n */\n color: RgbaColor;\n};\n\n/**\n * A RGBA color as per the array definition\n */\nexport type ArrayColor = [number, number, number, number];\n\n/**\n * A color ramp stop as per array definition\n */\nexport type ArrayColorRampStop = [\n /**\n * Real world value in a real world unit\n */\n number,\n /**\n * Color RGBA\n */\n ArrayColor,\n];\n\n/**\n * A color ramp as per array definition\n */\nexport type ArrayColorRamp = Array<ArrayColorRampStop>;\n\nexport type ColorRampOptions = {\n /**\n * The value the colorramp starts\n */\n min?: number;\n\n /**\n * The value the colorramp ends\n */\n max?: number;\n\n /**\n * Some color stops to copy from\n */\n stops?: Array<ColorStop>;\n};\n\nfunction componentToHex(c: number): string {\n const hex = c.toString(16);\n return hex.length === 1 ? `0${hex}` : hex;\n}\n\nfunction rgbToHex(rgb: RgbaColor): string {\n return `#${componentToHex(rgb[0])}${componentToHex(rgb[1])}${componentToHex(rgb[2])}${rgb.length === 4 ? componentToHex(rgb[3]) : \"\"}`;\n}\n\nexport class ColorRamp extends Array<ColorStop> {\n /**\n * Converts a array-definition color ramp definition into a usable ColorRamp instance.\n * Note: units are not converted and may need to to be converted beforehand (eg. kelvin to centigrade)\n * @param cr\n * @returns\n */\n static fromArrayDefinition(cr: ArrayColorRamp): ColorRamp {\n return new ColorRamp({\n stops: cr.map((cs: ArrayColorRampStop) => ({\n value: cs[0],\n color: cs[1],\n })),\n });\n }\n\n private min = 0;\n private max = 1;\n\n constructor(options: ColorRampOptions = {}) {\n super();\n\n if (\"min\" in options) {\n this.min = options.min!;\n }\n\n if (\"max\" in options) {\n this.max = options.max!;\n }\n\n if (\"stops\" in options) {\n this.setStops(options.stops!, { clone: false });\n }\n }\n\n setStops(stops: Array<ColorStop>, options: { clone?: boolean } = { clone: true }): ColorRamp {\n const colorRamp = options.clone ? this.clone() : this;\n\n colorRamp.length = 0;\n\n let min = Number.POSITIVE_INFINITY;\n let max = Number.NEGATIVE_INFINITY;\n\n for (let i = 0; i < stops.length; i += 1) {\n min = Math.min(min, stops[i].value);\n max = Math.max(max, stops[i].value);\n\n colorRamp.push({\n value: stops[i].value,\n color: stops[i].color.slice(), // we want to make sure we do a deep copy and not a reference\n } as ColorStop);\n }\n\n colorRamp.sort((a: ColorStop, b: ColorStop) => (a.value < b.value ? -1 : 1));\n\n this.min = min;\n this.max = max;\n\n return colorRamp;\n }\n\n scale(min: number, max: number, options: { clone?: boolean } = { clone: true }): ColorRamp {\n const clone = options.clone;\n\n const currentMin = this[0].value;\n const currentMax = this.at(-1).value;\n const currentSpan = currentMax - currentMin;\n const newSpan = max - min;\n const stops = [];\n\n for (let i = 0; i < this.length; i += 1) {\n const currentValue = this[i].value;\n const normalizedValue = (currentValue - currentMin) / currentSpan; // putting the value in the interval [0, 1]\n const newValue = normalizedValue * newSpan + min; // putting the value in the new interval\n\n if (clone) {\n stops.push({\n value: newValue,\n color: this[i].color.slice(),\n } as ColorStop);\n } else {\n this[i].value = newValue;\n }\n }\n\n return clone ? new ColorRamp({ stops }) : this;\n }\n\n // for some reason, I had to reimplement this\n at(pos: number) {\n if (pos < 0) {\n return this[this.length + pos];\n }\n\n return this[pos];\n }\n\n clone(): ColorRamp {\n return new ColorRamp({ stops: this.getRawColorStops() });\n }\n\n getRawColorStops(): Array<ColorStop> {\n const stops = [];\n\n for (let i = 0; i < this.length; i += 1) {\n stops.push({ value: this[i].value, color: this[i].color });\n }\n\n return stops;\n }\n\n reverse(options: { clone?: boolean } = { clone: true }): ColorRamp {\n const colorRamp = options.clone ? this.clone() : this;\n\n for (let i = 0; i < ~~(colorRamp.length / 2); i += 1) {\n const c = colorRamp[i].color;\n colorRamp[i].color = colorRamp.at(-(i + 1)).color;\n colorRamp.at(-(i + 1)).color = c;\n }\n return colorRamp;\n }\n\n getBounds(): { min: number; max: number } {\n return { min: this.min, max: this.max };\n }\n\n getColor(value: number, options: { smooth?: boolean } = { smooth: true }): RgbaColor {\n if (value <= this[0].value) {\n return this[0].color;\n }\n\n if (value >= this.at(-1).value) {\n return this.at(-1).color;\n }\n\n for (let i = 0; i < this.length - 1; i += 1) {\n if (value > this[i + 1].value) {\n continue;\n }\n\n const colorBefore = this[i].color;\n\n if (!options.smooth) {\n return colorBefore.slice() as RgbaColor;\n }\n\n const valueBefore = this[i].value;\n const valueAfter = this[i + 1].value;\n const colorAfter = this[i + 1].color;\n\n const beforeRatio = (valueAfter - value) / (valueAfter - valueBefore);\n return colorBefore.map((chan, i) => Math.round(chan * beforeRatio + colorAfter[i] * (1 - beforeRatio))) as RgbaColor;\n }\n\n return [0, 0, 0] as RgbaColor;\n }\n\n /**\n * Get the color as an hexadecimal string\n */\n getColorHex(\n value: number,\n options: { smooth?: boolean; withAlpha?: boolean } = {\n smooth: true,\n withAlpha: false,\n },\n ): string {\n return rgbToHex(this.getColor(value, options));\n }\n\n /**\n * Get the color of the color ramp at a relative position in [0, 1]\n */\n getColorRelative(value: number, options: { smooth?: boolean } = { smooth: true }): RgbaColor {\n const bounds = this.getBounds();\n return this.getColor(bounds.min + value * (bounds.max - bounds.min), options);\n }\n\n getCanvasStrip(\n options: { horizontal?: boolean; size?: number; smooth?: boolean } = {\n horizontal: true,\n size: 512,\n smooth: true,\n },\n ) {\n const canvas = document.createElement(\"canvas\");\n canvas.width = options.horizontal ? options.size! : 1;\n canvas.height = options.horizontal ? 1 : options.size!;\n\n const ctx = canvas.getContext(\"2d\");\n\n if (!ctx) throw new Error(\"Canvs context is missing\");\n\n const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);\n const imageDataArray = imageData.data;\n\n const size = options.size!;\n const startValue = this[0].value;\n const endValue = this.at(-1).value;\n const valueSpan = endValue - startValue;\n const valueStep = valueSpan / size;\n\n for (let i = 0; i < size; i += 1) {\n const color = this.getColor(startValue + i * valueStep, {\n smooth: options.smooth,\n });\n imageDataArray[i * 4] = color[0];\n imageDataArray[i * 4 + 1] = color[1];\n imageDataArray[i * 4 + 2] = color[2];\n imageDataArray[i * 4 + 3] = color.length > 3 ? color[3]! : 255;\n }\n\n ctx.putImageData(imageData, 0, 0);\n return canvas;\n }\n\n /**\n * Apply a non-linear ressampling. This will create a new instance of ColorRamp with the same bounds.\n */\n resample(method: \"ease-in-square\" | \"ease-out-square\" | \"ease-in-sqrt\" | \"ease-out-sqrt\" | \"ease-in-exp\" | \"ease-out-exp\", samples = 15): ColorRamp {\n const inputBounds = this.getBounds();\n const inputNormalized = this.scale(0, 1);\n const step = 1 / (samples - 1);\n\n let stops: Array<ColorStop>;\n\n if (method === \"ease-in-square\") {\n stops = Array.from({ length: samples }, (_, i) => {\n const x = i * step;\n const y = x ** 2;\n const color = inputNormalized.getColor(y);\n return { value: x, color };\n });\n } else if (method === \"ease-out-square\") {\n stops = Array.from({ length: samples }, (_, i) => {\n const x = i * step;\n const y = 1 - (1 - x) ** 2;\n const color = inputNormalized.getColor(y);\n return { value: x, color };\n });\n } else if (method === \"ease-out-sqrt\") {\n stops = Array.from({ length: samples }, (_, i) => {\n const x = i * step;\n const y = x ** 0.5;\n const color = inputNormalized.getColor(y);\n return { value: x, color };\n });\n } else if (method === \"ease-in-sqrt\") {\n stops = Array.from({ length: samples }, (_, i) => {\n const x = i * step;\n const y = 1 - (1 - x) ** 0.5;\n const color = inputNormalized.getColor(y);\n return { value: x, color };\n });\n } else if (method === \"ease-out-exp\") {\n stops = Array.from({ length: samples }, (_, i) => {\n const x = i * step;\n const y = 1 - 2 ** (-10 * x);\n const color = inputNormalized.getColor(y);\n return { value: x, color };\n });\n } else if (method === \"ease-in-exp\") {\n stops = Array.from({ length: samples }, (_, i) => {\n const x = i * step;\n const y = 2 ** (10 * x - 10);\n const color = inputNormalized.getColor(y);\n return { value: x, color };\n });\n } else {\n throw new Error(\"Invalid ressampling method.\");\n }\n\n const outputNormalized = new ColorRamp({ stops });\n const output = outputNormalized.scale(inputBounds.min, inputBounds.max);\n return output;\n }\n\n /**\n * Makes a clone of this color ramp that is fully transparant at the begining of their range\n */\n transparentStart(): ColorRamp {\n const stops = this.getRawColorStops();\n stops.unshift({\n value: stops[0].value,\n color: stops[0].color.slice() as RgbaColor,\n });\n stops[1].value += 0.001;\n\n for (const s of stops) {\n if (s.color.length === 3) {\n s.color.push(255);\n }\n }\n\n stops[0].color[3] = 0;\n\n return new ColorRamp({ stops });\n }\n\n /**\n * Check if this color ramp has a transparent start\n */\n hasTransparentStart(): boolean {\n return this[0].color.length === 4 && this[0].color[3] === 0;\n }\n}\n\n/**\n * This is a collection of built-in color ramps. They are all defined in the range [0, 1]\n * but can be scaled or reversed to fit specific usages.\n */\nexport const ColorRampCollection = {\n /**\n * A fully transparent [0, 0, 0, 0] colorramp to hide data.\n * Defined in interval [0, 1], without unit.\n */\n NULL: new ColorRamp({\n stops: [\n { value: 0, color: [0, 0, 0, 0] },\n { value: 1, color: [0, 0, 0, 0] },\n ],\n }),\n\n GRAY: new ColorRamp({\n stops: [\n { value: 0, color: [0, 0, 0] },\n { value: 1, color: [255, 255, 255] },\n ],\n }),\n\n /**\n * Classic jet color ramp.\n * Defined in interval [0, 1], without unit.\n */\n JET: new ColorRamp({\n stops: [\n { value: 0, color: [0, 0, 131] },\n { value: 0.125, color: [0, 60, 170] },\n { value: 0.375, color: [5, 255, 255] },\n { value: 0.625, color: [255, 255, 0] },\n { value: 0.875, color: [250, 0, 0] },\n { value: 1, color: [128, 0, 0] },\n ],\n }),\n\n /**\n * Classic HSV color ramp (hue, saturation, value).\n * Defined in interval [0, 1], without unit.\n */\n HSV: new ColorRamp({\n stops: [\n { value: 0, color: [255, 0, 0] },\n { value: 0.169, color: [253, 255, 2] },\n { value: 0.173, color: [247, 255, 2] },\n { value: 0.337, color: [0, 252, 4] },\n { value: 0.341, color: [0, 252, 10] },\n { value: 0.506, color: [1, 249, 255] },\n { value: 0.671, color: [2, 0, 253] },\n { value: 0.675, color: [8, 0, 253] },\n { value: 0.839, color: [255, 0, 251] },\n { value: 0.843, color: [255, 0, 245] },\n { value: 1, color: [255, 0, 6] },\n ],\n }),\n\n /**\n * Classic hot color ramp.\n * Defined in interval [0, 1], without unit.\n */\n HOT: new ColorRamp({\n stops: [\n { value: 0, color: [0, 0, 0] },\n { value: 0.3, color: [230, 0, 0] },\n { value: 0.6, color: [255, 210, 0] },\n { value: 1, color: [255, 255, 255] },\n ],\n }),\n\n /**\n * Classic spring color ramp.\n * Defined in interval [0, 1], without unit.\n */\n SPRING: new ColorRamp({\n stops: [\n { value: 0, color: [255, 0, 255] },\n { value: 1, color: [255, 255, 0] },\n ],\n }),\n\n /**\n * Classic summer color ramp.\n * Defined in interval [0, 1], without unit.\n */\n SUMMER: new ColorRamp({\n stops: [\n { value: 0, color: [0, 128, 102] },\n { value: 1, color: [255, 255, 102] },\n ],\n }),\n\n /**\n * Classic autommn color ramp.\n * Defined in interval [0, 1], without unit.\n */\n AUTOMN: new ColorRamp({\n stops: [\n { value: 0, color: [255, 0, 0] },\n { value: 1, color: [255, 255, 0] },\n ],\n }),\n\n /**\n * Classic winter color ramp.\n * Defined in interval [0, 1], without unit.\n */\n WINTER: new ColorRamp({\n stops: [\n { value: 0, color: [0, 0, 255] },\n { value: 1, color: [0, 255, 128] },\n ],\n }),\n\n /**\n * Classic bone color ramp.\n * Defined in interval [0, 1], without unit.\n */\n BONE: new ColorRamp({\n stops: [\n { value: 0, color: [0, 0, 0] },\n { value: 0.376, color: [84, 84, 116] },\n { value: 0.753, color: [169, 200, 200] },\n { value: 1, color: [255, 255, 255] },\n ],\n }),\n\n /**\n * Classic copper color ramp.\n * Defined in interval [0, 1], without unit.\n */\n COPPER: new ColorRamp({\n stops: [\n { value: 0, color: [0, 0, 0] },\n { value: 0.804, color: [255, 160, 102] },\n { value: 1, color: [255, 199, 127] },\n ],\n }),\n\n /**\n * Classic greys color ramp.\n * Defined in interval [0, 1], without unit.\n */\n GREYS: new ColorRamp({\n stops: [\n { value: 0, color: [0, 0, 0] },\n { value: 1, color: [255, 255, 255] },\n ],\n }),\n\n /**\n * Classic yignbu color ramp (blue to light yellow).\n * Defined in interval [0, 1], without unit.\n */\n YIGNBU: new ColorRamp({\n stops: [\n { value: 0, color: [8, 29, 88] },\n { value: 0.125, color: [37, 52, 148] },\n { value: 0.25, color: [34, 94, 168] },\n { value: 0.375, color: [29, 145, 192] },\n { value: 0.5, color: [65, 182, 196] },\n { value: 0.625, color: [127, 205, 187] },\n { value: 0.75, color: [199, 233, 180] },\n { value: 0.875, color: [237, 248, 217] },\n { value: 1, color: [255, 255, 217] },\n ],\n }),\n\n /**\n * Classic greens color ramp.\n * Defined in interval [0, 1], without unit.\n */\n GREENS: new ColorRamp({\n stops: [\n { value: 0, color: [0, 68, 27] },\n { value: 0.125, color: [0, 109, 44] },\n { value: 0.25, color: [35, 139, 69] },\n { value: 0.375, color: [65, 171, 93] },\n { value: 0.5, color: [116, 196, 118] },\n { value: 0.625, color: [161, 217, 155] },\n { value: 0.75, color: [199, 233, 192] },\n { value: 0.875, color: [229, 245, 224] },\n { value: 1, color: [247, 252, 245] },\n ],\n }),\n\n /**\n * Classic yiorrd color ramp (red to light yellow).\n * Defined in interval [0, 1], without unit.\n */\n YIORRD: new ColorRamp({\n stops: [\n { value: 0, color: [128, 0, 38] },\n { value: 0.125, color: [189, 0, 38] },\n { value: 0.25, color: [227, 26, 28] },\n { value: 0.375, color: [252, 78, 42] },\n { value: 0.5, color: [253, 141, 60] },\n { value: 0.625, color: [254, 178, 76] },\n { value: 0.75, color: [254, 217, 118] },\n { value: 0.875, color: [255, 237, 160] },\n { value: 1, color: [255, 255, 204] },\n ],\n }),\n\n /**\n * Classic blue-red color ramp.\n * Defined in interval [0, 1], without unit.\n */\n BLUERED: new ColorRamp({\n stops: [\n { value: 0, color: [0, 0, 255] },\n { value: 1, color: [255, 0, 0] },\n ],\n }),\n\n /**\n * Classic rdbu color ramp.\n * Defined in interval [0, 1], without unit.\n */\n RDBU: new ColorRamp({\n stops: [\n { value: 0, color: [5, 10, 172] },\n { value: 0.35, color: [106, 137, 247] },\n { value: 0.5, color: [190, 190, 190] },\n { value: 0.6, color: [220, 170, 132] },\n { value: 0.7, color: [230, 145, 90] },\n { value: 1, color: [178, 10, 28] },\n ],\n }),\n\n /**\n * Classic picnic color ramp.\n * Defined in interval [0, 1], without unit.\n */\n PICNIC: new ColorRamp({\n stops: [\n { value: 0, color: [0, 0, 255] },\n { value: 0.1, color: [51, 153, 255] },\n { value: 0.2, color: [102, 204, 255] },\n { value: 0.3, color: [153, 204, 255] },\n { value: 0.4, color: [204, 204, 255] },\n { value: 0.5, color: [255, 255, 255] },\n { value: 0.6, color: [255, 204, 255] },\n { value: 0.7, color: [255, 153, 255] },\n { value: 0.8, color: [255, 102, 204] },\n { value: 0.9, color: [255, 102, 102] },\n { value: 1, color: [255, 0, 0] },\n ],\n }),\n\n /**\n * Classic rainbow color ramp.\n * Defined in interval [0, 1], without unit.\n */\n RAINBOW: new ColorRamp({\n stops: [\n { value: 0, color: [150, 0, 90] },\n { value: 0.125, color: [0, 0, 200] },\n { value: 0.25, color: [0, 25, 255] },\n { value: 0.375, color: [0, 152, 255] },\n { value: 0.5, color: [44, 255, 150] },\n { value: 0.625, color: [151, 255, 0] },\n { value: 0.75, color: [255, 234, 0] },\n { value: 0.875, color: [255, 111, 0] },\n { value: 1, color: [255, 0, 0] },\n ],\n }),\n\n /**\n * Classic Portland color ramp.\n * Defined in interval [0, 1], without unit.\n */\n PORTLAND: new ColorRamp({\n stops: [\n { value: 0, color: [12, 51, 131] },\n { value: 0.25, color: [10, 136, 186] },\n { value: 0.5, color: [242, 211, 56] },\n { value: 0.75, color: [242, 143, 56] },\n { value: 1, color: [217, 30, 30] },\n ],\n }),\n\n /**\n * Classic blackbody color ramp.\n * Defined in interval [0, 1], without unit.\n */\n BLACKBODY: new ColorRamp({\n stops: [\n { value: 0, color: [0, 0, 0] },\n { value: 0.2, color: [230, 0, 0] },\n { value: 0.4, color: [230, 210, 0] },\n { value: 0.7, color: [255, 255, 255] },\n { value: 1, color: [160, 200, 255] },\n ],\n }),\n\n /**\n * Classic earth color ramp.\n * Defined in interval [0, 1], without unit.\n */\n EARTH: new ColorRamp({\n stops: [\n { value: 0, color: [0, 0, 130] },\n { value: 0.1, color: [0, 180, 180] },\n { value: 0.2, color: [40, 210, 40] },\n { value: 0.4, color: [230, 230, 50] },\n { value: 0.6, color: [120, 70, 20] },\n { value: 1, color: [255, 255, 255] },\n ],\n }),\n\n /**\n * Classic electric color ramp.\n * Defined in interval [0, 1], without unit.\n */\n ELECTRIC: new ColorRamp({\n stops: [\n { value: 0, color: [0, 0, 0] },\n { value: 0.15, color: [30, 0, 100] },\n { value: 0.4, color: [120, 0, 100] },\n { value: 0.6, color: [160, 90, 0] },\n { value: 0.8, color: [230, 200, 0] },\n { value: 1, color: [255, 250, 220] },\n ],\n }),\n\n /**\n * Classic viridis color ramp.\n * Defined in interval [0, 1], without unit.\n */\n VIRIDIS: new ColorRamp({\n stops: [\n { value: 0, color: [68, 1, 84] },\n { value: 0.13, color: [71, 44, 122] },\n { value: 0.25, color: [59, 81, 139] },\n { value: 0.38, color: [44, 113, 142] },\n { value: 0.5, color: [33, 144, 141] },\n { value: 0.63, color: [39, 173, 129] },\n { value: 0.75, color: [92, 200, 99] },\n { value: 0.88, color: [170, 220, 50] },\n { value: 1, color: [253, 231, 37] },\n ],\n }),\n\n /**\n * Classic inferno color ramp.\n * Defined in interval [0, 1], without unit.\n */\n INFERNO: new ColorRamp({\n stops: [\n { value: 0, color: [0, 0, 4] },\n { value: 0.13, color: [31, 12, 72] },\n { value: 0.25, color: [85, 15, 109] },\n { value: 0.38, color: [136, 34, 106] },\n { value: 0.5, color: [186, 54, 85] },\n { value: 0.63, color: [227, 89, 51] },\n { value: 0.75, color: [249, 140, 10] },\n { value: 0.88, color: [249, 201, 50] },\n { value: 1, color: [252, 255, 164] },\n ],\n }),\n\n /**\n * Classic magma color ramp.\n * Defined in interval [0, 1], without unit.\n */\n MAGMA: new ColorRamp({\n stops: [\n { value: 0, color: [0, 0, 4] },\n { value: 0.13, color: [28, 16, 68] },\n { value: 0.25, color: [79, 18, 123] },\n { value: 0.38, color: [129, 37, 129] },\n { value: 0.5, color: [181, 54, 122] },\n { value: 0.63, color: [229, 80, 100] },\n { value: 0.75, color: [251, 135, 97] },\n { value: 0.88, color: [254, 194, 135] },\n { value: 1, color: [252, 253, 191] },\n ],\n }),\n\n /**\n * Classic plasma color ramp.\n * Defined in interval [0, 1], without unit.\n */\n PLASMA: new ColorRamp({\n stops: [\n { value: 0, color: [13, 8, 135] },\n { value: 0.13, color: [75, 3, 161] },\n { value: 0.25, color: [125, 3, 168] },\n { value: 0.38, color: [168, 34, 150] },\n { value: 0.5, color: [203, 70, 121] },\n { value: 0.63, color: [229, 107, 93] },\n { value: 0.75, color: [248, 148, 65] },\n { value: 0.88, color: [253, 195, 40] },\n { value: 1, color: [240, 249, 33] },\n ],\n }),\n\n /**\n * Classic warm color ramp.\n * Defined in interval [0, 1], without unit.\n */\n WARM: new ColorRamp({\n stops: [\n { value: 0, color: [125, 0, 179] },\n { value: 0.13, color: [172, 0, 187] },\n { value: 0.25, color: [219, 0, 170] },\n { value: 0.38, color: [255, 0, 130] },\n { value: 0.5, color: [255, 63, 74] },\n { value: 0.63, color: [255, 123, 0] },\n { value: 0.75, color: [234, 176, 0] },\n { value: 0.88, color: [190, 228, 0] },\n { value: 1, color: [147, 255, 0] },\n ],\n }),\n\n /**\n * Classic cool color ramp.\n * Defined in interval [0, 1], without unit.\n */\n COOL: new ColorRamp({\n stops: [\n { value: 0, color: [125, 0, 179] },\n { value: 0.13, color: [116, 0, 218] },\n { value: 0.25, color: [98, 74, 237] },\n { value: 0.38, color: [68, 146, 231] },\n { value: 0.5, color: [0, 204, 197] },\n { value: 0.63, color: [0, 247, 146] },\n { value: 0.75, color: [0, 255, 88] },\n { value: 0.88, color: [40, 255, 8] },\n { value: 1, color: [147, 255, 0] },\n ],\n }),\n\n /**\n * Classic rainboz soft color ramp.\n * Defined in interval [0, 1], without unit.\n */\n RAINBOW_SOFT: new ColorRamp({\n stops: [\n { value: 0, color: [125, 0, 179] },\n { value: 0.1, color: [199, 0, 180] },\n { value: 0.2, color: [255, 0, 121] },\n { value: 0.3, color: [255, 108, 0] },\n { value: 0.4, color: [222, 194, 0] },\n { value: 0.5, color: [150, 255, 0] },\n { value: 0.6, color: [0, 255, 55] },\n { value: 0.7, color: [0, 246, 150] },\n { value: 0.8, color: [50, 167, 222] },\n { value: 0.9, color: [103, 51, 235] },\n { value: 1, color: [124, 0, 186] },\n ],\n }),\n\n /**\n * Classic bathymetry color ramp.\n * Defined in interval [0, 1], without unit.\n */\n BATHYMETRY: new ColorRamp({\n stops: [\n { value: 0, color: [40, 26, 44] },\n { value: 0.13, color: [59, 49, 90] },\n { value: 0.25, color: [64, 76, 139] },\n { value: 0.38, color: [63, 110, 151] },\n { value: 0.5, color: [72, 142, 158] },\n { value: 0.63, color: [85, 174, 163] },\n { value: 0.75, color: [120, 206, 163] },\n { value: 0.88, color: [187, 230, 172] },\n { value: 1, color: [253, 254, 204] },\n ],\n }),\n\n /**\n * Classic cdom color ramp.\n * Defined in interval [0, 1], without unit.\n */\n CDOM: new ColorRamp({\n stops: [\n { value: 0, color: [47, 15, 62] },\n { value: 0.13, color: [87, 23, 86] },\n { value: 0.25, color: [130, 28, 99] },\n { value: 0.38, color: [171, 41, 96] },\n { value: 0.5, color: [206, 67, 86] },\n { value: 0.63, color: [230, 106, 84] },\n { value: 0.75, color: [242, 149, 103] },\n { value: 0.88, color: [249, 193, 135] },\n { value: 1, color: [254, 237, 176] },\n ],\n }),\n\n /**\n * Classic chlorophyll color ramp.\n * Defined in interval [0, 1], without unit.\n */\n CHLOROPHYLL: new ColorRamp({\n stops: [\n { value: 0, color: [18, 36, 20] },\n { value: 0.13, color: [25, 63, 41] },\n { value: 0.25, color: [24, 91, 59] },\n { value: 0.38, color: [13, 119, 72] },\n { value: 0.5, color: [18, 148, 80] },\n { value: 0.63, color: [80, 173, 89] },\n { value: 0.75, color: [132, 196, 122] },\n { value: 0.88, color: [175, 221, 162] },\n { value: 1, color: [215, 249, 208] },\n ],\n }),\n\n /**\n * Classic density color ramp.\n * Defined in interval [0, 1], without unit.\n */\n DENSITY: new ColorRamp({\n stops: [\n { value: 0, color: [54, 14, 36] },\n { value: 0.13, color: [89, 23, 80] },\n { value: 0.25, color: [110, 45, 132] },\n { value: 0.38, color: [120, 77, 178] },\n { value: 0.5, color: [120, 113, 213] },\n { value: 0.63, color: [115, 151, 228] },\n { value: 0.75, color: [134, 185, 227] },\n { value: 0.88, color: [177, 214, 227] },\n { value: 1, color: [230, 241, 241] },\n ],\n }),\n\n /**\n * Classic freesurface blue color ramp.\n * Defined in interval [0, 1], without unit.\n */\n FREESURFACE_BLUE: new ColorRamp({\n stops: [\n { value: 0, color: [30, 4, 110] },\n { value: 0.13, color: [47, 14, 176] },\n { value: 0.25, color: [41, 45, 236] },\n { value: 0.38, color: [25, 99, 212] },\n { value: 0.5, color: [68, 131, 200] },\n { value: 0.63, color: [114, 156, 197] },\n { value: 0.75, color: [157, 181, 203] },\n { value: 0.88, color: [200, 208, 216] },\n { value: 1, color: [241, 237, 236] },\n ],\n }),\n\n /**\n * Classic freesurface red color ramp.\n * Defined in interval [0, 1], without unit.\n */\n FREESURFACE_RED: new ColorRamp({\n stops: [\n { value: 0, color: [60, 9, 18] },\n { value: 0.13, color: [100, 17, 27] },\n { value: 0.25, color: [142, 20, 29] },\n { value: 0.38, color: [177, 43, 27] },\n { value: 0.5, color: [192, 87, 63] },\n { value: 0.63, color: [205, 125, 105] },\n { value: 0.75, color: [216, 162, 148] },\n { value: 0.88, color: [227, 199, 193] },\n { value: 1, color: [241, 237, 236] },\n ],\n }),\n\n /**\n * Classic oxygen color ramp.\n * Defined in interval [0, 1], without unit.\n */\n OXYGEN: new ColorRamp({\n stops: [\n { value: 0, color: [64, 5, 5] },\n { value: 0.13, color: [106, 6, 15] },\n { value: 0.25, color: [144, 26, 7] },\n { value: 0.38, color: [168, 64, 3] },\n { value: 0.5, color: [188, 100, 4] },\n { value: 0.63, color: [206, 136, 11] },\n { value: 0.75, color: [220, 174, 25] },\n { value: 0.88, color: [231, 215, 44] },\n { value: 1, color: [248, 254, 105] },\n ],\n }),\n\n /**\n * Classic par color ramp.\n * Defined in interval [0, 1], without unit.\n */\n PAR: new ColorRamp({\n stops: [\n { value: 0, color: [51, 20, 24] },\n { value: 0.13, color: [90, 32, 35] },\n { value: 0.25, color: [129, 44, 34] },\n { value: 0.38, color: [159, 68, 25] },\n { value: 0.5, color: [182, 99, 19] },\n { value: 0.63, color: [199, 134, 22] },\n { value: 0.75, color: [212, 171, 35] },\n { value: 0.88, color: [221, 210, 54] },\n { value: 1, color: [225, 253, 75] },\n ],\n }),\n\n /**\n * Classic phase color ramp.\n * Defined in interval [0, 1], without unit.\n */\n PHASE: new ColorRamp({\n stops: [\n { value: 0, color: [145, 105, 18] },\n { value: 0.13, color: [184, 71, 38] },\n { value: 0.25, color: [186, 58, 115] },\n { value: 0.38, color: [160, 71, 185] },\n { value: 0.5, color: [110, 97, 218] },\n { value: 0.63, color: [50, 123, 164] },\n { value: 0.75, color: [31, 131, 110] },\n { value: 0.88, color: [77, 129, 34] },\n { value: 1, color: [145, 105, 18] },\n ],\n }),\n\n /**\n * Classic salinity color ramp.\n * Defined in interval [0, 1], without unit.\n */\n SALINITY: new ColorRamp({\n stops: [\n { value: 0, color: [42, 24, 108] },\n { value: 0.13, color: [33, 50, 162] },\n { value: 0.25, color: [15, 90, 145] },\n { value: 0.38, color: [40, 118, 137] },\n { value: 0.5, color: [59, 146, 135] },\n { value: 0.63, color: [79, 175, 126] },\n { value: 0.75, color: [120, 203, 104] },\n { value: 0.88, color: [193, 221, 100] },\n { value: 1, color: [253, 239, 154] },\n ],\n }),\n\n /**\n * Classic temperature color ramp.\n * Defined in interval [0, 1], without unit.\n */\n TEMPERATURE: new ColorRamp({\n stops: [\n { value: 0, color: [4, 35, 51] },\n { value: 0.13, color: [23, 51, 122] },\n { value: 0.25, color: [85, 59, 157] },\n { value: 0.38, color: [129, 79, 143] },\n { value: 0.5, color: [175, 95, 130] },\n { value: 0.63, color: [222, 112, 101] },\n { value: 0.75, color: [249, 146, 66] },\n { value: 0.88, color: [249, 196, 65] },\n { value: 1, color: [232, 250, 91] },\n ],\n }),\n\n /**\n * Classic turbidity color ramp.\n * Defined in interval [0, 1], without unit.\n */\n TURBIDITY: new ColorRamp({\n stops: [\n { value: 0, color: [34, 31, 27] },\n { value: 0.13, color: [65, 50, 41] },\n { value: 0.25, color: [98, 69, 52] },\n { value: 0.38, color: [131, 89, 57] },\n { value: 0.5, color: [161, 112, 59] },\n { value: 0.63, color: [185, 140, 66] },\n { value: 0.75, color: [202, 174, 88] },\n { value: 0.88, color: [216, 209, 126] },\n { value: 1, color: [233, 246, 171] },\n ],\n }),\n\n /**\n * Classic velocity blue color ramp.\n * Defined in interval [0, 1], without unit.\n */\n VELOCITY_BLUE: new ColorRamp({\n stops: [\n { value: 0, color: [17, 32, 64] },\n { value: 0.13, color: [35, 52, 116] },\n { value: 0.25, color: [29, 81, 156] },\n { value: 0.38, color: [31, 113, 162] },\n { value: 0.5, color: [50, 144, 169] },\n { value: 0.63, color: [87, 173, 176] },\n { value: 0.75, color: [149, 196, 189] },\n { value: 0.88, color: [203, 221, 211] },\n { value: 1, color: [254, 251, 230] },\n ],\n }),\n\n /**\n * Classic velocity green color ramp.\n * Defined in interval [0, 1], without unit.\n */\n VELOCITY_GREEN: new ColorRamp({\n stops: [\n { value: 0, color: [23, 35, 19] },\n { value: 0.13, color: [24, 64, 38] },\n { value: 0.25, color: [11, 95, 45] },\n { value: 0.38, color: [39, 123, 35] },\n { value: 0.5, color: [95, 146, 12] },\n { value: 0.63, color: [152, 165, 18] },\n { value: 0.75, color: [201, 186, 69] },\n { value: 0.88, color: [233, 216, 137] },\n { value: 1, color: [255, 253, 205] },\n ],\n }),\n\n /**\n * Classic cube helix color ramp.\n * Defined in interval [0, 1], without unit.\n */\n CUBEHELIX: new ColorRamp({\n stops: [\n { value: 0, color: [0, 0, 0] },\n { value: 0.07, color: [22, 5, 59] },\n { value: 0.13, color: [60, 4, 105] },\n { value: 0.2, color: [109, 1, 135] },\n { value: 0.27, color: [161, 0, 147] },\n { value: 0.33, color: [210, 2, 142] },\n { value: 0.4, color: [251, 11, 123] },\n { value: 0.47, color: [255, 29, 97] },\n { value: 0.53, color: [255, 54, 69] },\n { value: 0.6, color: [255, 85, 46] },\n { value: 0.67, color: [255, 120, 34] },\n { value: 0.73, color: [255, 157, 37] },\n { value: 0.8, color: [241, 191, 57] },\n { value: 0.87, color: [224, 220, 93] },\n { value: 0.93, color: [218, 241, 142] },\n { value: 1, color: [227, 253, 198] },\n ],\n }),\n\n /**\n * The cividis color ramp is color blind friendly.\n * Read more here https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0199239\n * Defined in interval [0, 1], without unit.\n */\n CIVIDIS: new ColorRamp({\n stops: [\n { value: 0, color: [0, 32, 77, 255] },\n { value: 0.125, color: [5, 54, 110, 255] },\n { value: 0.25, color: [65, 77, 108, 255] },\n { value: 0.375, color: [97, 100, 111, 255] },\n { value: 0.5, color: [125, 124, 121, 255] },\n { value: 0.625, color: [156, 149, 120, 255] },\n { value: 0.75, color: [190, 175, 111, 255] },\n { value: 0.875, color: [225, 204, 94, 255] },\n { value: 1, color: [255, 235, 70, 255] },\n ],\n }),\n\n /**\n * Classic turbo color ramp.\n * This is a luminance-constant alternative to the jet, making it more\n * clor-blind friendly.\n * Defined in interval [0, 1], without unit.\n */\n TURBO: new ColorRamp({\n stops: [\n { value: 0, color: [48, 18, 59, 255] },\n { value: 0.125, color: [70, 107, 227, 255] },\n { value: 0.25, color: [40, 187, 236, 255] },\n { value: 0.375, color: [49, 242, 153, 255] },\n { value: 0.5, color: [162, 252, 60, 255] },\n { value: 0.625, color: [237, 208, 58, 255] },\n { value: 0.75, color: [251, 128, 34, 255] },\n { value: 0.875, color: [210, 49, 5, 255] },\n { value: 1, color: [122, 4, 3, 255] },\n ],\n }),\n\n /**\n * The rocket color ramp is perceptually uniform, which makes it more\n * color bliend friendly than the classic magma color ramp.\n * Defined in interval [0, 1], without unit.\n */\n ROCKET: new ColorRamp({\n stops: [\n { value: 0, color: [250, 235, 221, 0] },\n { value: 0.133, color: [250, 235, 221, 255] },\n { value: 0.266, color: [246, 170, 130, 255] },\n { value: 0.4, color: [240, 96, 67, 255] },\n { value: 0.533, color: [203, 27, 79, 255] },\n { value: 0.666, color: [132, 30, 90, 255] },\n { value: 0.8, color: [63, 27, 68, 255] },\n { value: 1, color: [3, 5, 26, 255] },\n ],\n }),\n\n /**\n * The mako color ramp is perceptually uniform and can be seen as\n * a color blind friendly alternative to bathymetry or yignbu.\n * Defined in interval [0, 1], without unit.\n */\n MAKO: new ColorRamp({\n stops: [\n { value: 0, color: [11, 4, 5, 255] },\n { value: 0.125, color: [43, 28, 53, 255] },\n { value: 0.25, color: [62, 53, 107, 255] },\n { value: 0.375, color: [59, 86, 152, 255] },\n { value: 0.5, color: [53, 123, 162, 255] },\n { value: 0.625, color: [53, 158, 170, 255] },\n { value: 0.75, color: [73, 193, 173, 255] },\n { value: 0.875, color: [150, 221, 181, 255] },\n { value: 1, color: [222, 245, 229, 255] },\n ],\n }),\n};\n","import type { Geometry, FeatureCollection, GeoJsonProperties } from \"geojson\";\nimport type { DataDrivenPropertyValueSpecification, GetResourceResponse, PropertyValueSpecification } from \"maplibre-gl\";\nimport type { Map as SDKMap } from \"../Map\";\nimport { config } from \"../config\";\nimport { isUUID, jsonParseNoThrow } from \"../tools\";\nimport {\n computeRampedOutlineWidth,\n generateRandomLayerName,\n generateRandomSourceName,\n getRandomColor,\n paintColorOptionsToPaintSpec,\n rampedOptionsToLayerPaintSpec,\n dashArrayMaker,\n colorDrivenByProperty,\n radiusDrivenByProperty,\n opacityDrivenByProperty,\n heatmapIntensityFromColorRamp,\n rampedPropertyValueWeight,\n radiusDrivenByPropertyHeatmap,\n} from \"./stylehelper\";\n\nimport { gpx, gpxOrKml, kml } from \"../converters\";\nimport { ColorRampCollection, type ColorRamp } from \"../ColorRamp\";\n\n/**\n * Array of string values that depend on zoom level\n */\nexport type ZoomStringValues = Array<{\n /**\n * Zoom level\n */\n zoom: number;\n\n /**\n * Value for the given zoom level\n */\n value: string;\n}>;\n\n/**\n *\n * Array of number values that depend on zoom level\n */\nexport type ZoomNumberValues = Array<{\n /**\n * Zoom level\n */\n zoom: number;\n\n /**\n * Value for the given zoom level\n */\n value: number;\n}>;\n\nexport type PropertyValues = Array<{\n /**\n * Value of the property (input)\n */\n propertyValue: number;\n\n /**\n * Value to associate it with (output)\n */\n value: number;\n}>;\n\n/**\n * Describes how to render a cluster of points\n */\nexport type DataDrivenStyle = Array<{\n /**\n * Numerical value to observe and apply the style upon.\n * In case of clusters, the value to observe is automatically the number of elements in a cluster.\n * In other cases, it can be a provided value.\n */\n value: number;\n\n /**\n * Radius of the cluster circle\n */\n pointRadius: number;\n\n /**\n * Color of the cluster\n */\n color: string;\n}>;\n\nexport type CommonShapeLayerOptions = {\n /**\n * ID to give to the layer.\n * If not provided, an auto-generated ID of the for \"maptiler-layer-xxxxxx\" will be auto-generated,\n * with \"xxxxxx\" being a random string.\n */\n layerId?: string;\n\n /**\n * ID to give to the geojson source.\n * If not provided, an auto-generated ID of the for \"maptiler-source-xxxxxx\" will be auto-generated,\n * with \"xxxxxx\" being a random string.\n */\n sourceId?: string;\n\n /**\n * A geojson Feature collection or a URL to a geojson or the UUID of a MapTiler Cloud dataset.\n */\n data: FeatureCollection | string;\n\n /**\n * The ID of an existing layer to insert the new layer before, resulting in the new layer appearing\n * visually beneath the existing layer. If this argument is not specified, the layer will be appended\n * to the end of the layers array and appear visually above all other layers.\n */\n beforeId?: string;\n\n /**\n * Zoom level at which it starts to show.\n * Default: `0`\n */\n minzoom?: number;\n\n /**\n * Zoom level after which it no longer show.\n * Default: `22`\n */\n maxzoom?: number;\n\n /**\n * Whether or not to add an outline.\n * Default: `false`\n */\n outline?: boolean;\n\n /**\n * Color of the outline. This is can be a constant color string or a definition based on zoom levels.\n * Applies only if `.outline` is `true`.\n * Default: `white`\n */\n outlineColor?: string | ZoomStringValues;\n\n /**\n * Width of the outline (relative to screen-space). This is can be a constant width or a definition based on zoom levels.\n * Applies only if `.outline` is `true`.\n * Default: `1`\n */\n outlineWidth?: number | ZoomNumberValues;\n\n /**\n * Opacity of the outline. This is can be a constant opacity in [0, 1] or a definition based on zoom levels\n * Applies only if `.outline` is `true`.\n * Default: `1`\n */\n outlineOpacity?: number | ZoomNumberValues;\n};\n\nexport type PolylineLayerOptions = CommonShapeLayerOptions & {\n /**\n * Color of the line (or polyline). This is can be a constant color string or a definition based on zoom levels.\n * Default: a color randomly pick from a list\n */\n lineColor?: string | ZoomStringValues;\n\n /**\n * Width of the line (relative to screen-space). This is can be a constant width or a definition based on zoom levels\n * Default: `3`\n */\n lineWidth?: number | ZoomNumberValues;\n\n /**\n * Opacity of the line. This is can be a constant opacity in [0, 1] or a definition based on zoom levels.\n * Default: `1`\n */\n lineOpacity?: number | ZoomNumberValues;\n\n /**\n * How blury the line is, with `0` being no blur and `10` and beyond being quite blurry.\n * Default: `0`\n */\n lineBlur?: number | ZoomNumberValues;\n\n /**\n * Draws a line casing outside of a line's actual path. Value indicates the width of the inner gap.\n * Default: `0`\n */\n lineGapWidth?: number | ZoomNumberValues;\n\n /**\n * Sequence of line and void to create a dash pattern. The unit is the line width so that\n * a dash array value of `[3, 1]` will create a segment worth 3 times the width of the line,\n * followed by a spacing worth 1 time the line width, and then repeat.\n *\n * Alternatively, this property can be a string made of underscore and whitespace characters\n * such as `\"___ _ \"` and internaly this will be translated into [3, 1, 1, 1]. Note that\n * this way of describing dash arrays with a string only works for integer values.\n *\n * Dash arrays can contain more than 2 element to create more complex patters. For instance\n * a dash array value of [3, 2, 1, 2] will create the following sequence:\n * - a segment worth 3 times the width\n * - a spacing worth 2 times the width\n * - a segment worth 1 times the width\n * - a spacing worth 2 times the width\n * - repeat\n *\n * Default: no dash pattern\n */\n lineDashArray?: Array<number> | string;\n\n /**\n * The display of line endings for both the line and the outline (if `.outline` is `true`)\n * - \"butt\": A cap with a squared-off end which is drawn to the exact endpoint of the line.\n * - \"round\": A cap with a rounded end which is drawn beyond the endpoint of the line at a radius of one-half of the line's width and centered on the endpoint of the line.\n * - \"square\": A cap with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the line's width.\n * Default: \"round\"\n */\n lineCap?: \"butt\" | \"round\" | \"square\";\n\n /**\n * The display of lines when joining for both the line and the outline (if `.outline` is `true`)\n * - \"bevel\": A join with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the line's width.\n * - \"round\": A join with a rounded end which is drawn beyond the endpoint of the line at a radius of one-half of the line's width and centered on the endpoint of the line.\n * - \"miter\": A join with a sharp, angled corner which is drawn with the outer sides beyond the endpoint of the path until they meet.\n * Default: \"round\"\n */\n lineJoin?: \"bevel\" | \"round\" | \"miter\";\n\n /**\n * How blury the outline is, with `0` being no blur and `10` and beyond being quite blurry.\n * Applies only if `.outline` is `true`.\n * Default: `0`\n */\n outlineBlur?: number | ZoomNumberValues;\n};\n\nexport type PolygonLayerOptions = CommonShapeLayerOptions & {\n /**\n * Color of the polygon. This is can be a constant color string or a definition based on zoom levels.\n * Default: a color randomly pick from a list\n */\n fillColor?: string | ZoomStringValues;\n\n /**\n * Opacity of the polygon. This is can be a constant opacity in [0, 1] or a definition based on zoom levels\n * Default: `1`\n */\n fillOpacity?: ZoomNumberValues;\n\n /**\n * Position of the outline with regard to the polygon edge (when `.outline` is `true`)\n * Default: `\"center\"`\n */\n outlinePosition: \"center\" | \"inside\" | \"outside\";\n\n /**\n * Sequence of line and void to create a dash pattern. The unit is the line width so that\n * a dash array value of `[3, 1]` will create a segment worth 3 times the width of the line,\n * followed by a spacing worth 1 time the line width, and then repeat.\n *\n * Alternatively, this property can be a string made of underscore and whitespace characters\n * such as `\"___ _ \"` and internaly this will be translated into [3, 1, 1, 1]. Note that\n * this way of describing dash arrays with a string only works for integer values.\n *\n * Dash arrays can contain more than 2 element to create more complex patters. For instance\n * a dash array value of [3, 2, 1, 2] will create the following sequence:\n * - a segment worth 3 times the width\n * - a spacing worth 2 times the width\n * - a segment worth 1 times the width\n * - a spacing worth 2 times the width\n * - repeat\n *\n * Default: no dash pattern\n */\n outlineDashArray?: Array<number> | string;\n\n /**\n * The display of line endings for both the line and the outline (if `.outline` is `true`)\n * - \"butt\": A cap with a squared-off end which is drawn to the exact endpoint of the line.\n * - \"round\": A cap with a rounded end which is drawn beyond the endpoint of the line at a radius of one-half of the line's width and centered on the endpoint of the line.\n * - \"square\": A cap with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the line's width.\n * Default: \"round\"\n */\n outlineCap?: \"butt\" | \"round\" | \"square\";\n\n /**\n * The display of lines when joining for both the line and the outline (if `.outline` is `true`)\n * - \"bevel\": A join with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the line's width.\n * - \"round\": A join with a rounded end which is drawn beyond the endpoint of the line at a radius of one-half of the line's width and centered on the endpoint of the line.\n * - \"miter\": A join with a sharp, angled corner which is drawn with the outer sides beyond the endpoint of the path until they meet.\n * Default: \"round\"\n */\n outlineJoin?: \"bevel\" | \"round\" | \"miter\";\n\n /**\n * The pattern is an image URL to be put as a repeated background pattern of the polygon.\n * Default: `null` (no pattern, `fillColor` will be used)\n */\n pattern?: string | null;\n\n /**\n * How blury the outline is, with `0` being no blur and `10` and beyond being quite blurry.\n * Applies only if `.outline` is `true`.\n * Default: `0`\n */\n outlineBlur?: number | ZoomNumberValues;\n};\n\nexport type PointLayerOptions = CommonShapeLayerOptions & {\n /**\n * Can be a unique point color as a string (CSS color such as \"#FF0000\" or \"red\").\n * Alternatively, the color can be a ColorRamp with a range.\n * In case of `.cluster` being `true`, the range of the ColorRamp will be addressed with the number of elements in\n * the cluster. If `.cluster` is `false`, the color will be addressed using the value of the `.property`.\n * If no `.property` is given but `.pointColor` is a ColorRamp, the chosen color is the one at the lower bound of the ColorRamp.\n * Default: a color randomly pick from a list\n */\n pointColor?: string | ColorRamp;\n\n /**\n * Radius of the points. Can be a fixed size or a value dependant on the zoom.\n * If `.pointRadius` is not provided, the radius will depend on the size of each cluster (if `.cluster` is `true`)\n * or on the value of each point (if `.property` is provided and `.pointColor` is a ColorRamp).\n * The radius will be between `.minPointRadius` and `.maxPointRadius`\n */\n pointRadius?: number | ZoomNumberValues;\n\n /**\n * The minimum point radius posible.\n * Default: `10`\n */\n minPointRadius?: number;\n\n /**\n * The maximum point radius posible.\n * Default: `40`\n */\n maxPointRadius?: number;\n\n /**\n * The point property to observe and apply the radius and color upon.\n * This is ignored if `.cluster` is `true` as the observed value will be fiorced to being the number\n * of elements in each cluster.\n *\n * Default: none\n */\n property?: string;\n\n /**\n * Opacity of the point or icon. This is can be a constant opacity in [0, 1] or a definition based on zoom levels.\n * Alternatively, if not provided but the `.pointColor` is a ColorRamp, the opacity will be extracted from tha alpha\n * component if present.\n * Default: `1`\n */\n pointOpacity?: number | ZoomNumberValues;\n\n /**\n * If `true`, the points will keep their circular shape align with the wiewport.\n * If `false`, the points will be like flatten on the map. This difference shows\n * when the map is tilted.\n * Default: `true`\n */\n alignOnViewport?: boolean;\n\n /**\n * Whether the points should cluster\n */\n cluster?: boolean;\n\n /**\n * Shows a label with the numerical value id `true`.\n * If `.cluster` is `true`, the value will be the numebr of elements in the cluster.\n *\n *\n * Default: `true` if `cluster` or `dataDrivenStyleProperty` are used, `false` otherwise.\n */\n showLabel?: boolean;\n\n /**\n * text color used for the number elements in each cluster.\n * Applicable only when `cluster` is `true`.\n * Default: `#000000` (black)\n */\n labelColor?: string;\n\n /**\n * text size used for the number elements in each cluster.\n * Applicable only when `cluster` is `true`.\n * Default: `12`\n */\n labelSize?: number;\n\n /**\n * Only if `.cluster` is `false`.\n * If the radius is driven by a property, then it will also scale by zoomming if `.zoomCompensation` is `true`.\n * If `false`, the radius will not adapt according to the zoom level.\n * Default: `true`\n */\n zoomCompensation?: boolean;\n};\n\nexport type HeatmapLayerOptions = {\n /**\n * ID to give to the layer.\n * If not provided, an auto-generated ID of the for \"maptiler-layer-xxxxxx\" will be auto-generated,\n * with \"xxxxxx\" being a random string.\n */\n layerId?: string;\n\n /**\n * ID to give to the geojson source.\n * If not provided, an auto-generated ID of the for \"maptiler-source-xxxxxx\" will be auto-generated,\n * with \"xxxxxx\" being a random string.\n */\n sourceId?: string;\n\n /**\n * A geojson Feature collection or a URL to a geojson or the UUID of a MapTiler Cloud dataset.\n */\n data: FeatureCollection | string;\n\n /**\n * The ID of an existing layer to insert the new layer before, resulting in the new layer appearing\n * visually beneath the existing layer. If this argument is not specified, the layer will be appended\n * to the end of the layers array and appear visually above all other layers.\n */\n beforeId?: string;\n\n /**\n * Zoom level at which it starts to show.\n * Default: `0`\n */\n minzoom?: number;\n\n /**\n * Zoom level after which it no longer show.\n * Default: `22`\n */\n maxzoom?: number;\n\n /**\n * The ColorRamp instance to use for visualization. The color ramp is expected to be defined in the\n * range `[0, 1]` or else will be forced to this range.\n * Default: `ColorRampCollection.TURBO`\n */\n colorRamp?: ColorRamp;\n\n /**\n * Use a property to apply a weight to each data point. Using a property requires also using\n * the options `.propertyValueWeight` or otherwise will be ignored.\n * Default: none, the points will all have a weight of `1`.\n */\n property?: string;\n\n /**\n * The weight to give to each data point. If of type `PropertyValueWeights`, then the options `.property`\n * must also be provided. If used a number, all data points will be weighted by the same number (which is of little interest)\n */\n weight?: PropertyValues | number;\n\n /**\n * The radius (in screenspace) can be:\n * - a fixed number that will be constant across zoom level\n * - of type `ZoomNumberValues` to be ramped accoding to zoom level (`.zoomCompensation` will then be ignored)\n * - of type `PropertyValues` to be driven by the value of a property.\n * If so, the option `.property` must be provided and will still be resized according to zoom level,\n * unless the option `.zoomCompensation` is set to `false`.\n *\n * Default:\n */\n radius?: number | ZoomNumberValues | PropertyValues;\n\n /**\n * The opacity can be a fixed value or zoom-driven.\n * Default: fades-in 0.25z after minzoom and fade-out 0.25z before maxzoom\n */\n opacity?: number | ZoomNumberValues;\n\n /**\n * The intensity is zoom-dependent. By default, the intensity is going to be scaled by zoom to preserve\n * a natural aspect or the data distribution.\n */\n intensity?: number | ZoomNumberValues;\n\n /**\n * If the radius is driven by a property, then it will also scale by zoomming if `.zoomCompensation` is `true`.\n * If `false`, the radius will not adapt according to the zoom level.\n * Default: `true`\n */\n zoomCompensation?: boolean;\n};\n\n/**\n * Add a polyline to the map from various sources and with builtin styling.\n * Compatible sources:\n * - gpx content as string\n * - gpx file from URL\n * - kml content from string\n * - kml from url\n * - geojson from url\n * - geojson content as string\n * - geojson content as JS object\n * - uuid of a MapTiler Cloud dataset\n *\n * The method also gives the possibility to add an outline layer (if `options.outline` is `true`)\n * and if so , the returned property `polylineOutlineLayerId` will be a string. As a result, two layers\n * would be added.\n *\n * The default styling creates a line layer of constant width of 3px, the color will be randomly picked\n * from a curated list of colors and the opacity will be 1.\n * If the outline is enabled, the outline width is of 1px at all zoom levels, the color is white and\n * the opacity is 1.\n *\n * Those style properties can be changed and ramped according to zoom level using an easier syntax.\n *\n */\nexport async function addPolyline(\n /**\n * Map instance to add a polyline layer to\n */\n map: SDKMap,\n /**\n * Options related to adding a polyline layer\n */\n options: PolylineLayerOptions,\n /**\n * When the polyline data is loaded from a distant source, these options are propagated to the call of `fetch`\n */\n fetchOptions: RequestInit = {},\n): Promise<{\n polylineLayerId: string;\n polylineOutlineLayerId: string;\n polylineSourceId: string;\n}> {\n // We need to have the sourceId of the sourceData\n if (!options.sourceId && !options.data) {\n throw new Error(\"Creating a polyline layer requires an existing .sourceId or a valid .data property\");\n }\n\n // We are going to evaluate the content of .data, if provided\n let data = options.data;\n\n if (typeof data === \"string\") {\n // if options.data exists and is a uuid string, we consider that it points to a MapTiler Dataset\n if (isUUID(data)) {\n data = `https://api.maptiler.com/data/${options.data}/features.json?key=${config.apiKey}`;\n }\n\n // options.data could be a url to a .gpx file\n else if (data.split(\".\").pop()?.toLowerCase().trim() === \"gpx\") {\n // fetch the file\n const res = await fetch(data, fetchOptions);\n const gpxStr = await res.text();\n // Convert it to geojson. Will throw is invalid GPX content\n data = gpx(gpxStr);\n }\n\n // options.data could be a url to a .kml file\n else if (data.split(\".\").pop()?.toLowerCase().trim() === \"kml\") {\n // fetch the file\n const res = await fetch(data, fetchOptions);\n const kmlStr = await res.text();\n // Convert it to geojson. Will throw is invalid GPX content\n data = kml(kmlStr);\n } else {\n // From this point, we consider that the string content provided could\n // be the string content of one of the compatible format (GeoJSON, KML, GPX)\n const tmpData = jsonParseNoThrow<FeatureCollection<Geometry, GeoJsonProperties>>(data) ?? gpxOrKml(data);\n if (tmpData) data = tmpData;\n }\n\n if (!data) {\n throw new Error(\"Polyline data was provided as string but is incompatible with valid formats.\");\n }\n }\n\n return addGeoJSONPolyline(map, {\n ...options,\n data,\n });\n}\n\n/**\n * Add a polyline from a GeoJSON object\n */\nfunction addGeoJSONPolyline(\n map: SDKMap,\n // The data or data source is expected to contain LineStrings or MultiLineStrings\n options: PolylineLayerOptions,\n): {\n /**\n * ID of the main line layer\n */\n polylineLayerId: string;\n\n /**\n * ID of the outline layer (will be `\"\"` if no outline)\n */\n polylineOutlineLayerId: string;\n\n /**\n * ID of the data source\n */\n polylineSourceId: string;\n} {\n if (options.layerId && map.getLayer(options.layerId)) {\n throw new Error(`A layer already exists with the layer id: ${options.layerId}`);\n }\n\n const sourceId = options.sourceId ?? generateRandomSourceName();\n const layerId = options.layerId ?? generateRandomLayerName();\n\n const returnedInfo = {\n polylineLayerId: layerId,\n polylineOutlineLayerId: \"\",\n polylineSourceId: sourceId,\n };\n\n // A new source is added if the map does not have this sourceId and the data is provided\n if (options.data && !map.getSource(sourceId)) {\n // Adding the source\n map.addSource(sourceId, {\n type: \"geojson\",\n data: options.data,\n });\n }\n\n const lineWidth = options.lineWidth ?? 3;\n const lineColor = options.lineColor ?? getRandomColor();\n const lineOpacity = options.lineOpacity ?? 1;\n const lineBlur = options.lineBlur ?? 0;\n const lineGapWidth = options.lineGapWidth ?? 0;\n let lineDashArray = options.lineDashArray ?? null;\n const outlineWidth = options.outlineWidth ?? 1;\n const outlineColor = options.outlineColor ?? \"#FFFFFF\";\n const outlineOpacity = options.outlineOpacity ?? 1;\n const outlineBlur = options.outlineBlur ?? 0;\n\n if (typeof lineDashArray === \"string\") {\n lineDashArray = dashArrayMaker(lineDashArray);\n }\n\n // We want to create an outline for this line layer\n if (options.outline === true) {\n const outlineLayerId = `${layerId}_outline`;\n returnedInfo.polylineOutlineLayerId = outlineLayerId;\n\n map.addLayer(\n {\n id: outlineLayerId,\n type: \"line\",\n source: sourceId,\n layout: {\n \"line-join\": options.lineJoin ?? \"round\",\n \"line-cap\": options.lineCap ?? \"round\",\n },\n minzoom: options.minzoom ?? 0,\n maxzoom: options.maxzoom ?? 23,\n paint: {\n \"line-opacity\": typeof outlineOpacity === \"number\" ? outlineOpacity : rampedOptionsToLayerPaintSpec(outlineOpacity),\n \"line-color\": typeof outlineColor === \"string\" ? outlineColor : paintColorOptionsToPaintSpec(outlineColor),\n \"line-width\": computeRampedOutlineWidth(lineWidth, outlineWidth),\n \"line-blur\": typeof outlineBlur === \"number\" ? outlineBlur : rampedOptionsToLayerPaintSpec(outlineBlur),\n },\n },\n options.beforeId,\n );\n }\n\n map.addLayer(\n {\n id: layerId,\n type: \"line\",\n source: sourceId,\n layout: {\n \"line-join\": options.lineJoin ?? \"round\",\n \"line-cap\": options.lineCap ?? \"round\",\n },\n minzoom: options.minzoom ?? 0,\n maxzoom: options.maxzoom ?? 23,\n paint: {\n \"line-opacity\": typeof lineOpacity === \"number\" ? lineOpacity : rampedOptionsToLayerPaintSpec(lineOpacity),\n \"line-color\": typeof lineColor === \"string\" ? lineColor : paintColorOptionsToPaintSpec(lineColor),\n \"line-width\": typeof lineWidth === \"number\" ? lineWidth : rampedOptionsToLayerPaintSpec(lineWidth),\n\n \"line-blur\": typeof lineBlur === \"number\" ? lineBlur : rampedOptionsToLayerPaintSpec(lineBlur),\n\n \"line-gap-width\": typeof lineGapWidth === \"number\" ? lineGapWidth : rampedOptionsToLayerPaintSpec(lineGapWidth),\n\n // For some reasons passing \"line-dasharray\" with the value \"undefined\"\n // results in no showing the line while it should have the same behavior\n // of not adding the property \"line-dasharray\" as all.\n // As a workaround, we are inlining the addition of the prop with a conditional\n // which is less readable.\n ...(lineDashArray && { \"line-dasharray\": lineDashArray }),\n },\n },\n options.beforeId,\n );\n\n return returnedInfo;\n}\n\n/**\n * Add a polygon with styling options.\n */\nexport function addPolygon(\n map: SDKMap,\n // this Feature collection is expected to contain on LineStrings and MultiLinestrings\n options: PolygonLayerOptions,\n): {\n /**\n * ID of the fill layer\n */\n polygonLayerId: string;\n\n /**\n * ID of the outline layer (will be `\"\"` if no outline)\n */\n polygonOutlineLayerId: string;\n\n /**\n * ID of the source that contains the data\n */\n polygonSourceId: string;\n} {\n if (options.layerId && map.getLayer(options.layerId)) {\n throw new Error(`A layer already exists with the layer id: ${options.layerId}`);\n }\n\n const sourceId = options.sourceId ?? generateRandomSourceName();\n const layerId = options.layerId ?? generateRandomLayerName();\n\n const returnedInfo = {\n polygonLayerId: layerId,\n polygonOutlineLayerId: options.outline ? `${layerId}_outline` : \"\",\n polygonSourceId: sourceId,\n };\n\n // A new source is added if the map does not have this sourceId and the data is provided\n if (options.data && !map.getSource(sourceId)) {\n let data: string | FeatureCollection = options.data;\n\n // If is a UUID, we extend it to be the URL to a MapTiler Cloud hosted dataset\n if (typeof data === \"string\" && isUUID(data)) {\n data = `https://api.maptiler.com/data/${data}/features.json?key=${config.apiKey}`;\n }\n\n // Adding the source\n map.addSource(sourceId, {\n type: \"geojson\",\n data: data,\n });\n }\n\n let outlineDashArray = options.outlineDashArray ?? null;\n const outlineWidth = options.outlineWidth ?? 1;\n const outlineColor = options.outlineColor ?? \"#FFFFFF\";\n const outlineOpacity = options.outlineOpacity ?? 1;\n const outlineBlur = options.outlineBlur ?? 0;\n const fillColor = options.fillColor ?? getRandomColor();\n const fillOpacity = options.fillOpacity ?? 1;\n const outlinePosition = options.outlinePosition ?? \"center\";\n const pattern = options.pattern ?? null;\n\n if (typeof outlineDashArray === \"string\") {\n outlineDashArray = dashArrayMaker(outlineDashArray);\n }\n\n const addLayers = (patternImageId: string | null = null) => {\n map.addLayer(\n {\n id: layerId,\n type: \"fill\",\n source: sourceId,\n minzoom: options.minzoom ?? 0,\n maxzoom: options.maxzoom ?? 23,\n paint: {\n \"fill-color\": typeof fillColor === \"string\" ? fillColor : paintColorOptionsToPaintSpec(fillColor),\n\n \"fill-opacity\": typeof fillOpacity === \"number\" ? fillOpacity : rampedOptionsToLayerPaintSpec(fillOpacity),\n\n // Adding a pattern if provided\n ...(patternImageId && { \"fill-pattern\": patternImageId }),\n },\n },\n options.beforeId,\n );\n\n // We want to create an outline for this line layer\n if (options.outline === true) {\n let computedOutlineOffset: DataDrivenPropertyValueSpecification<number> | number;\n\n if (outlinePosition === \"inside\") {\n if (typeof outlineWidth === \"number\") {\n computedOutlineOffset = 0.5 * outlineWidth;\n } else {\n computedOutlineOffset = rampedOptionsToLayerPaintSpec(\n outlineWidth.map(({ zoom, value }) => ({\n zoom,\n value: 0.5 * value,\n })),\n );\n }\n } else if (outlinePosition === \"outside\") {\n if (typeof outlineWidth === \"number\") {\n computedOutlineOffset = -0.5 * outlineWidth;\n } else {\n computedOutlineOffset = rampedOptionsToLayerPaintSpec(\n outlineWidth.map((el) => ({\n zoom: el.zoom,\n value: -0.5 * el.value,\n })),\n );\n }\n } else {\n computedOutlineOffset = 0;\n }\n\n map.addLayer(\n {\n id: returnedInfo.polygonOutlineLayerId,\n type: \"line\",\n source: sourceId,\n layout: {\n \"line-join\": options.outlineJoin ?? \"round\",\n \"line-cap\": options.outlineCap ?? \"butt\",\n },\n minzoom: options.minzoom ?? 0,\n maxzoom: options.maxzoom ?? 23,\n paint: {\n \"line-opacity\": typeof outlineOpacity === \"number\" ? outlineOpacity : rampedOptionsToLayerPaintSpec(outlineOpacity),\n \"line-color\": typeof outlineColor === \"string\" ? outlineColor : paintColorOptionsToPaintSpec(outlineColor),\n \"line-width\": typeof outlineWidth === \"number\" ? outlineWidth : rampedOptionsToLayerPaintSpec(outlineWidth),\n \"line-blur\": typeof outlineBlur === \"number\" ? outlineBlur : rampedOptionsToLayerPaintSpec(outlineBlur),\n\n \"line-offset\": computedOutlineOffset,\n\n // For some reasons passing \"line-dasharray\" with the value \"undefined\"\n // results in no showing the line while it should have the same behavior\n // of not adding the property \"line-dasharray\" as all.\n // As a workaround, we are inlining the addition of the prop with a conditional\n // which is less readable.\n ...(outlineDashArray && {\n \"line-dasharray\": outlineDashArray as PropertyValueSpecification<number[]>,\n }),\n },\n },\n options.beforeId,\n );\n }\n };\n\n if (pattern) {\n if (map.hasImage(pattern)) {\n addLayers(pattern);\n } else {\n map\n .loadImage(pattern)\n .then((value: GetResourceResponse<HTMLImageElement | ImageBitmap>) => {\n // Add the image to the map style, using the image URL as an ID\n map.addImage(pattern, value.data);\n addLayers(pattern);\n })\n .catch((err: Error) => {\n console.error(\"Could not load the pattern image.\", err.message);\n addLayers();\n });\n }\n } else {\n addLayers();\n }\n\n return returnedInfo;\n}\n\n/**\n * Add a point layer from a GeoJSON source (or an existing sourceId) with many styling options\n */\nexport function addPoint(\n /**\n * The Map instance to add a point layer to\n */\n map: SDKMap,\n // The data or data source is expected to contain LineStrings or MultiLineStrings\n options: PointLayerOptions,\n): {\n /**\n * ID of the unclustered point layer\n */\n pointLayerId: string;\n\n /**\n * ID of the clustered point layer (empty if `cluster` options id `false`)\n */\n clusterLayerId: string;\n\n /**\n * ID of the layer that shows the count of elements in each cluster (empty if `cluster` options id `false`)\n */\n labelLayerId: string;\n\n /**\n * ID of the data source\n */\n pointSourceId: string;\n} {\n if (options.layerId && map.getLayer(options.layerId)) {\n throw new Error(`A layer already exists with the layer id: ${options.layerId}`);\n }\n\n const minPointRadius = options.minPointRadius ?? 10;\n const maxPointRadius = options.maxPointRadius ?? 50;\n const cluster = options.cluster ?? false;\n const nbDefaultDataDrivenStyleSteps = 20;\n const colorramp = Array.isArray(options.pointColor) ? options.pointColor : ColorRampCollection.TURBO.scale(10, options.cluster ? 10000 : 1000).resample(\"ease-out-square\");\n const colorRampBounds = colorramp.getBounds();\n const sourceId = options.sourceId ?? generateRandomSourceName();\n const layerId = options.layerId ?? generateRandomLayerName();\n const showLabel = options.showLabel ?? cluster;\n const alignOnViewport = options.alignOnViewport ?? true;\n const outline = options.outline ?? false;\n const outlineOpacity = options.outlineOpacity ?? 1;\n const outlineWidth = options.outlineWidth ?? 1;\n const outlineColor = options.outlineColor ?? \"#FFFFFF\";\n let pointOpacity: DataDrivenPropertyValueSpecification<number> | number;\n const zoomCompensation = options.zoomCompensation ?? true;\n const minzoom = options.minzoom ?? 0;\n const maxzoom = options.maxzoom ?? 23;\n\n if (typeof options.pointOpacity === \"number\") {\n pointOpacity = options.pointOpacity;\n } else if (Array.isArray(options.pointOpacity)) {\n pointOpacity = rampedOptionsToLayerPaintSpec(options.pointOpacity);\n } else if (options.cluster) {\n pointOpacity = opacityDrivenByProperty(colorramp, \"point_count\");\n } else if (options.property) {\n pointOpacity = opacityDrivenByProperty(colorramp, options.property);\n } else {\n pointOpacity = rampedOptionsToLayerPaintSpec([\n { zoom: minzoom, value: 0 },\n { zoom: minzoom + 0.25, value: 1 },\n { zoom: maxzoom - 0.25, value: 1 },\n { zoom: maxzoom, value: 0 },\n ]);\n }\n\n const returnedInfo = {\n pointLayerId: layerId,\n clusterLayerId: \"\",\n labelLayerId: \"\",\n pointSourceId: sourceId,\n };\n\n // A new source is added if the map does not have this sourceId and the data is provided\n if (options.data && !map.getSource(sourceId)) {\n let data: string | FeatureCollection = options.data;\n\n // If is a UUID, we extend it to be the URL to a MapTiler Cloud hosted dataset\n if (typeof data === \"string\" && isUUID(data)) {\n data = `https://api.maptiler.com/data/${data}/features.json?key=${config.apiKey}`;\n }\n\n // Adding the source\n map.addSource(sourceId, {\n type: \"geojson\",\n data: data,\n cluster,\n });\n }\n\n if (cluster) {\n // If using clusters, the size and color of the circles (clusters) are driven by the\n // numbner of elements they contain and cannot be driven by the zoom level or a property\n\n returnedInfo.clusterLayerId = `${layerId}_cluster`;\n\n const clusterStyle: DataDrivenStyle = Array.from({ length: nbDefaultDataDrivenStyleSteps }, (_, i) => {\n const value = colorRampBounds.min + (i * (colorRampBounds.max - colorRampBounds.min)) / (nbDefaultDataDrivenStyleSteps - 1);\n return {\n value,\n pointRadius: minPointRadius + (maxPointRadius - minPointRadius) * (i / (nbDefaultDataDrivenStyleSteps - 1)) ** 0.5,\n color: colorramp.getColorHex(value),\n };\n });\n\n map.addLayer(\n {\n id: returnedInfo.clusterLayerId,\n type: \"circle\",\n source: sourceId,\n filter: [\"has\", \"point_count\"],\n paint: {\n // 'circle-color': options.pointColor ?? colorDrivenByProperty(clusterStyle, \"point_count\"),\n \"circle-color\": typeof options.pointColor === \"string\" ? options.pointColor : colorDrivenByProperty(clusterStyle, \"point_count\"),\n\n \"circle-radius\":\n typeof options.pointRadius === \"number\"\n ? options.pointRadius\n : Array.isArray(options.pointRadius)\n ? rampedOptionsToLayerPaintSpec(options.pointRadius)\n : radiusDrivenByProperty(clusterStyle, \"point_count\", false),\n\n \"circle-pitch-alignment\": alignOnViewport ? \"viewport\" : \"map\",\n \"circle-pitch-scale\": \"map\", // scale with camera distance regardless of viewport/biewport alignement\n \"circle-opacity\": pointOpacity,\n ...(outline && {\n \"circle-stroke-opacity\": typeof outlineOpacity === \"number\" ? outlineOpacity : rampedOptionsToLayerPaintSpec(outlineOpacity),\n\n \"circle-stroke-width\": typeof outlineWidth === \"number\" ? outlineWidth : rampedOptionsToLayerPaintSpec(outlineWidth),\n\n \"circle-stroke-color\": typeof outlineColor === \"string\" ? outlineColor : paintColorOptionsToPaintSpec(outlineColor),\n }),\n },\n minzoom,\n maxzoom,\n },\n options.beforeId,\n );\n\n // Adding the layer of unclustered point (visible only when ungrouped)\n map.addLayer(\n {\n id: returnedInfo.pointLayerId,\n type: \"circle\",\n source: sourceId,\n filter: [\"!\", [\"has\", \"point_count\"]],\n paint: {\n \"circle-pitch-alignment\": alignOnViewport ? \"viewport\" : \"map\",\n \"circle-pitch-scale\": \"map\", // scale with camera distance regardless of viewport/biewport alignement\n // 'circle-color': options.pointColor ?? clusterStyle[0].color,\n \"circle-color\": typeof options.pointColor === \"string\" ? options.pointColor : colorramp.getColorHex(colorramp.getBounds().min),\n \"circle-radius\":\n typeof options.pointRadius === \"number\"\n ? options.pointRadius\n : Array.isArray(options.pointRadius)\n ? rampedOptionsToLayerPaintSpec(options.pointRadius)\n : clusterStyle[0].pointRadius * 0.75,\n \"circle-opacity\": pointOpacity,\n ...(outline && {\n \"circle-stroke-opacity\": typeof outlineOpacity === \"number\" ? outlineOpacity : rampedOptionsToLayerPaintSpec(outlineOpacity),\n\n \"circle-stroke-width\": typeof outlineWidth === \"number\" ? outlineWidth : rampedOptionsToLayerPaintSpec(outlineWidth),\n\n \"circle-stroke-color\": typeof outlineColor === \"string\" ? outlineColor : paintColorOptionsToPaintSpec(outlineColor),\n }),\n },\n minzoom,\n maxzoom,\n },\n options.beforeId,\n );\n }\n\n // Not displaying clusters\n else {\n let pointColor: DataDrivenPropertyValueSpecification<string> =\n typeof options.pointColor === \"string\"\n ? options.pointColor\n : Array.isArray(options.pointColor)\n ? options.pointColor.getColorHex(options.pointColor.getBounds().min) // if color ramp is given, we choose the first color of it, even if the property may not be provided\n : getRandomColor();\n\n let pointRadius: DataDrivenPropertyValueSpecification<number> =\n typeof options.pointRadius === \"number\"\n ? zoomCompensation\n ? rampedOptionsToLayerPaintSpec([\n { zoom: 0, value: options.pointRadius * 0.025 },\n { zoom: 2, value: options.pointRadius * 0.05 },\n { zoom: 4, value: options.pointRadius * 0.1 },\n { zoom: 8, value: options.pointRadius * 0.25 },\n { zoom: 16, value: options.pointRadius * 1 },\n ])\n : options.pointRadius\n : Array.isArray(options.pointRadius)\n ? rampedOptionsToLayerPaintSpec(options.pointRadius)\n : zoomCompensation\n ? rampedOptionsToLayerPaintSpec([\n { zoom: 0, value: minPointRadius * 0.05 },\n { zoom: 2, value: minPointRadius * 0.1 },\n { zoom: 4, value: minPointRadius * 0.2 },\n { zoom: 8, value: minPointRadius * 0.5 },\n { zoom: 16, value: minPointRadius * 1 },\n ])\n : minPointRadius;\n\n // If the styling depends on a property, then we build a custom style\n if (options.property && Array.isArray(options.pointColor)) {\n const dataDrivenStyle: DataDrivenStyle = Array.from({ length: nbDefaultDataDrivenStyleSteps }, (_, i) => {\n const value = colorRampBounds.min + (i * (colorRampBounds.max - colorRampBounds.min)) / (nbDefaultDataDrivenStyleSteps - 1);\n return {\n value,\n pointRadius:\n typeof options.pointRadius === \"number\" ? options.pointRadius : minPointRadius + (maxPointRadius - minPointRadius) * (i / (nbDefaultDataDrivenStyleSteps - 1)) ** 0.5,\n color: typeof options.pointColor === \"string\" ? options.pointColor : colorramp.getColorHex(value),\n };\n });\n pointColor = colorDrivenByProperty(dataDrivenStyle, options.property);\n pointRadius = radiusDrivenByProperty(dataDrivenStyle, options.property, zoomCompensation);\n }\n\n // Adding the layer of unclustered point\n map.addLayer(\n {\n id: returnedInfo.pointLayerId,\n type: \"circle\",\n source: sourceId,\n layout: {\n // Contrary to labels, we want to see the small one in front. Weirdly \"circle-sort-key\" works in the opposite direction as \"symbol-sort-key\".\n \"circle-sort-key\": options.property ? [\"/\", 1, [\"get\", options.property]] : 0,\n },\n paint: {\n \"circle-pitch-alignment\": alignOnViewport ? \"viewport\" : \"map\",\n \"circle-pitch-scale\": \"map\", // scale with camera distance regardless of viewport/biewport alignement\n \"circle-color\": pointColor,\n \"circle-opacity\": pointOpacity,\n \"circle-radius\": pointRadius,\n\n ...(outline && {\n \"circle-stroke-opacity\": typeof outlineOpacity === \"number\" ? outlineOpacity : rampedOptionsToLayerPaintSpec(outlineOpacity),\n\n \"circle-stroke-width\": typeof outlineWidth === \"number\" ? outlineWidth : rampedOptionsToLayerPaintSpec(outlineWidth),\n\n \"circle-stroke-color\": typeof outlineColor === \"string\" ? outlineColor : paintColorOptionsToPaintSpec(outlineColor),\n }),\n },\n minzoom,\n maxzoom,\n },\n options.beforeId,\n );\n }\n\n if (showLabel !== false && (options.cluster || options.property)) {\n returnedInfo.labelLayerId = `${layerId}_label`;\n const labelColor = options.labelColor ?? \"#fff\";\n const labelSize = options.labelSize ?? 12;\n\n // With clusters, a layer with clouster count is also added\n map.addLayer(\n {\n id: returnedInfo.labelLayerId,\n type: \"symbol\",\n source: sourceId,\n filter: [\"has\", options.cluster ? \"point_count\" : options.property!],\n layout: {\n \"text-field\": options.cluster ? \"{point_count_abbreviated}\" : `{${options.property!}}`,\n \"text-font\": [\"Noto Sans Regular\"],\n \"text-size\": labelSize,\n \"text-pitch-alignment\": alignOnViewport ? \"viewport\" : \"map\",\n \"symbol-sort-key\": [\"/\", 1, [\"get\", options.cluster ? \"point_count\" : options.property!]], // so that the largest value goes on top\n },\n paint: {\n \"text-color\": labelColor,\n \"text-opacity\": pointOpacity,\n },\n minzoom,\n maxzoom,\n },\n options.beforeId,\n );\n }\n return returnedInfo;\n}\n\n/**\n * Add a polyline witgh optional outline from a GeoJSON object\n */\nexport function addHeatmap(\n /**\n * Map instance to add a heatmap layer to\n */\n map: SDKMap,\n // The data or data source is expected to contain LineStrings or MultiLineStrings\n options: HeatmapLayerOptions,\n): {\n /**\n * ID of the heatmap layer\n */\n heatmapLayerId: string;\n\n /**\n * ID of the data source\n */\n heatmapSourceId: string;\n} {\n if (options.layerId && map.getLayer(options.layerId)) {\n throw new Error(`A layer already exists with the layer id: ${options.layerId}`);\n }\n\n const sourceId = options.sourceId ?? generateRandomSourceName();\n const layerId = options.layerId ?? generateRandomLayerName();\n const minzoom = options.minzoom ?? 0;\n const maxzoom = options.maxzoom ?? 23;\n const zoomCompensation = options.zoomCompensation ?? true;\n\n const opacity = options.opacity ?? [\n { zoom: minzoom, value: 0 },\n { zoom: minzoom + 0.25, value: 1 },\n { zoom: maxzoom - 0.25, value: 1 },\n { zoom: maxzoom, value: 0 },\n ];\n\n // const colorRamp = \"colorRamp\" in options\n let colorRamp = Array.isArray(options.colorRamp) ? options.colorRamp : ColorRampCollection.TURBO.transparentStart();\n\n // making sure the color ramp has [0, 1] bounds\n const crBounds = colorRamp.getBounds();\n if (crBounds.min !== 0 || crBounds.max !== 1) {\n colorRamp = colorRamp.scale(0, 1);\n }\n\n // making sure the color ramp has is transparent in 0\n if (!colorRamp.hasTransparentStart()) {\n colorRamp = colorRamp.transparentStart();\n }\n\n const intensity = options.intensity ?? [\n { zoom: 0, value: 0.01 },\n { zoom: 4, value: 0.2 },\n { zoom: 16, value: 1 },\n ];\n\n const property = options.property ?? null;\n const propertyValueWeight = options.weight ?? 1;\n\n let heatmapWeight: DataDrivenPropertyValueSpecification<number> = 1; // = typeof propertyValueWeights === \"number\" ? propertyValueWeights : 1;\n\n if (property) {\n if (typeof propertyValueWeight === \"number\") {\n heatmapWeight = propertyValueWeight;\n\n // In case this numerical weight was provided by the user and not be the default value:\n if (typeof options.weight === \"number\") {\n console.warn(\"The option `.property` is ignored when `.propertyValueWeights` is not of type `PropertyValueWeights`\");\n }\n } else if (Array.isArray(propertyValueWeight)) {\n heatmapWeight = rampedPropertyValueWeight(propertyValueWeight, property);\n } else {\n console.warn(\"The option `.property` is ignored when `.propertyValueWeights` is not of type `PropertyValueWeights`\");\n }\n } else {\n if (typeof propertyValueWeight === \"number\") {\n heatmapWeight = propertyValueWeight;\n } else if (Array.isArray(propertyValueWeight)) {\n console.warn(\"The options `.propertyValueWeights` can only be used when `.property` is provided.\");\n }\n }\n\n const defaultRadiusZoomRamping = [\n { zoom: 0, value: 50 * 0.025 },\n { zoom: 2, value: 50 * 0.05 },\n { zoom: 4, value: 50 * 0.1 },\n { zoom: 8, value: 50 * 0.25 },\n { zoom: 16, value: 50 },\n ];\n\n const radius = options.radius ?? (zoomCompensation ? defaultRadiusZoomRamping : 10);\n\n let radiusHeatmap: DataDrivenPropertyValueSpecification<number> = 1;\n\n if (typeof radius === \"number\") {\n radiusHeatmap = radius;\n }\n\n // Radius is provided as a zoom-ramping array\n else if (Array.isArray(radius) && \"zoom\" in radius[0]) {\n radiusHeatmap = rampedOptionsToLayerPaintSpec(radius as ZoomNumberValues);\n }\n\n // Radius is provided as data driven\n else if (property && Array.isArray(radius) && \"propertyValue\" in radius[0]) {\n radiusHeatmap = radiusDrivenByPropertyHeatmap(radius as unknown as PropertyValues, property, zoomCompensation);\n } else if (!property && Array.isArray(radius) && \"propertyValue\" in radius[0]) {\n radiusHeatmap = rampedOptionsToLayerPaintSpec(defaultRadiusZoomRamping as ZoomNumberValues);\n console.warn(\"The option `.radius` can only be property-driven if the option `.property` is provided.\");\n } else {\n radiusHeatmap = rampedOptionsToLayerPaintSpec(defaultRadiusZoomRamping as ZoomNumberValues);\n }\n\n const returnedInfo = {\n heatmapLayerId: layerId,\n heatmapSourceId: sourceId,\n };\n\n // A new source is added if the map does not have this sourceId and the data is provided\n if (options.data && !map.getSource(sourceId)) {\n let data: string | FeatureCollection = options.data;\n\n // If is a UUID, we extend it to be the URL to a MapTiler Cloud hosted dataset\n if (typeof data === \"string\" && isUUID(data)) {\n data = `https://api.maptiler.com/data/${data}/features.json?key=${config.apiKey}`;\n }\n\n // Adding the source\n map.addSource(sourceId, {\n type: \"geojson\",\n data: data,\n });\n }\n\n map.addLayer(\n {\n id: layerId,\n type: \"heatmap\",\n source: sourceId,\n minzoom,\n maxzoom,\n paint: {\n \"heatmap-weight\": heatmapWeight,\n\n \"heatmap-intensity\": typeof intensity === \"number\" ? intensity : (rampedOptionsToLayerPaintSpec(intensity) as PropertyValueSpecification<number>),\n\n \"heatmap-color\": heatmapIntensityFromColorRamp(colorRamp),\n\n \"heatmap-radius\": radiusHeatmap,\n\n \"heatmap-opacity\": typeof opacity === \"number\" ? opacity : (rampedOptionsToLayerPaintSpec(opacity) as PropertyValueSpecification<number>),\n },\n },\n options.beforeId,\n );\n\n return returnedInfo;\n}\n","import maplibregl from \"maplibre-gl\";\n\n// Types from MapLibre are not re-exported one by one\nexport type * from \"maplibre-gl\";\n\n/**\n * Get the version of MapTiler SDK, this is declared in the vite config\n * to avoid importing the entire package.json\n */\nexport function getVersion(): string {\n return __MT_SDK_VERSION__;\n}\n\nconst MapMLGL = maplibregl.Map;\nconst MarkerMLGL = maplibregl.Marker;\nconst PopupMLGL = maplibregl.Popup;\nconst StyleMLGL = maplibregl.Style;\nconst CanvasSourceMLGL = maplibregl.CanvasSource;\nconst GeoJSONSourceMLGL = maplibregl.GeoJSONSource;\nconst ImageSourceMLGL = maplibregl.ImageSource;\nconst RasterTileSourceMLGL = maplibregl.RasterTileSource;\nconst RasterDEMTileSourceMLGL = maplibregl.RasterDEMTileSource;\nconst VectorTileSourceMLGL = maplibregl.VectorTileSource;\nconst VideoSourceMLGL = maplibregl.VideoSource;\nconst NavigationControMLGL = maplibregl.NavigationControl;\nconst GeolocateControlMLGL = maplibregl.GeolocateControl;\nconst AttributionControlMLGL = maplibregl.AttributionControl;\nconst LogoControlMLGL = maplibregl.LogoControl;\nconst ScaleControlMLGL = maplibregl.ScaleControl;\nconst FullscreenControlMLGL = maplibregl.FullscreenControl;\nconst TerrainControMLGL = maplibregl.TerrainControl;\nconst BoxZoomHandlerMLGL = maplibregl.BoxZoomHandler;\nconst ScrollZoomHandlerMLGL = maplibregl.ScrollZoomHandler;\nconst CooperativeGesturesHandlerMLGL = maplibregl.CooperativeGesturesHandler;\nconst KeyboardHandlerMLGL = maplibregl.KeyboardHandler;\nconst TwoFingersTouchPitchHandlerMLGL = maplibregl.TwoFingersTouchPitchHandler;\nconst MapWheelEventMLGL = maplibregl.MapWheelEvent;\nconst MapTouchEventMLGL = maplibregl.MapTouchEvent;\nconst MapMouseEventMLGL = maplibregl.MapMouseEvent;\nconst configMLGL = maplibregl.config;\nconst getMapLibreVersion = maplibregl.getVersion;\n\nconst {\n setRTLTextPlugin,\n getRTLTextPluginStatus,\n LngLat,\n LngLatBounds,\n MercatorCoordinate,\n Evented,\n AJAXError,\n prewarm,\n clearPrewarmedResources,\n Hash,\n Point,\n EdgeInsets,\n DragRotateHandler,\n DragPanHandler,\n TwoFingersTouchZoomRotateHandler,\n DoubleClickZoomHandler,\n TwoFingersTouchZoomHandler,\n TwoFingersTouchRotateHandler,\n getWorkerCount,\n setWorkerCount,\n getMaxParallelImageRequests,\n setMaxParallelImageRequests,\n getWorkerUrl,\n setWorkerUrl,\n addSourceType,\n importScriptInWorkers,\n addProtocol,\n removeProtocol,\n} = maplibregl;\n\nexport {\n setRTLTextPlugin,\n getRTLTextPluginStatus,\n LngLat,\n LngLatBounds,\n MercatorCoordinate,\n Evented,\n AJAXError,\n prewarm,\n clearPrewarmedResources,\n Hash,\n Point,\n EdgeInsets,\n DragRotateHandler,\n DragPanHandler,\n TwoFingersTouchZoomRotateHandler,\n DoubleClickZoomHandler,\n TwoFingersTouchZoomHandler,\n TwoFingersTouchRotateHandler,\n getWorkerCount,\n setWorkerCount,\n getMaxParallelImageRequests,\n setMaxParallelImageRequests,\n getWorkerUrl,\n setWorkerUrl,\n addSourceType,\n importScriptInWorkers,\n addProtocol,\n removeProtocol,\n // Below: Exported from MapLibre but as a different name\n // in case dev wants to use the non-overloaded versions\n getMapLibreVersion,\n MapMLGL,\n MarkerMLGL,\n PopupMLGL,\n StyleMLGL,\n CanvasSourceMLGL,\n GeoJSONSourceMLGL,\n ImageSourceMLGL,\n RasterTileSourceMLGL,\n RasterDEMTileSourceMLGL,\n VectorTileSourceMLGL,\n VideoSourceMLGL,\n NavigationControMLGL,\n GeolocateControlMLGL,\n AttributionControlMLGL,\n LogoControlMLGL,\n ScaleControlMLGL,\n FullscreenControlMLGL,\n TerrainControMLGL,\n BoxZoomHandlerMLGL,\n ScrollZoomHandlerMLGL,\n CooperativeGesturesHandlerMLGL,\n KeyboardHandlerMLGL,\n TwoFingersTouchPitchHandlerMLGL,\n MapWheelEventMLGL,\n MapTouchEventMLGL,\n MapMouseEventMLGL,\n configMLGL,\n};\n\n// Attaching the types to the\nexport type LngLat = InstanceType<typeof LngLat>;\nexport type LngLatBounds = InstanceType<typeof LngLatBounds>;\nexport type MercatorCoordinate = InstanceType<typeof MercatorCoordinate>;\nexport type Evented = InstanceType<typeof Evented>;\nexport type AJAXError = InstanceType<typeof AJAXError>;\nexport type Hash = InstanceType<typeof Hash>;\nexport type Point = InstanceType<typeof Point>;\nexport type EdgeInsets = InstanceType<typeof EdgeInsets>;\nexport type DragRotateHandler = InstanceType<typeof DragRotateHandler>;\nexport type DragPanHandler = InstanceType<typeof DragPanHandler>;\nexport type TwoFingersTouchZoomRotateHandler = InstanceType<typeof TwoFingersTouchZoomRotateHandler>;\nexport type DoubleClickZoomHandler = InstanceType<typeof DoubleClickZoomHandler>;\nexport type TwoFingersTouchZoomHandler = InstanceType<typeof TwoFingersTouchZoomHandler>;\nexport type TwoFingersTouchRotateHandler = InstanceType<typeof TwoFingersTouchRotateHandler>;\n\n// The following items are only MapLibre adapted to MapTiler SDK Map class\nexport { Marker } from \"./MLAdapters/Marker\";\nexport { Popup } from \"./MLAdapters/Popup\";\nexport { Style } from \"./MLAdapters/Style\";\nexport { CanvasSource } from \"./MLAdapters/CanvasSource\";\nexport { GeoJSONSource } from \"./MLAdapters/GeoJSONSource\";\nexport { ImageSource } from \"./MLAdapters/ImageSource\";\nexport { RasterTileSource } from \"./MLAdapters/RasterTileSource\";\nexport { RasterDEMTileSource } from \"./MLAdapters/RasterDEMTileSource\";\nexport { VectorTileSource } from \"./MLAdapters/VectorTileSource\";\nexport { VideoSource } from \"./MLAdapters/VideoSource\";\nexport { NavigationControl } from \"./MLAdapters/NavigationControl\";\nexport { GeolocateControl } from \"./MLAdapters/GeolocateControl\";\nexport { AttributionControl } from \"./MLAdapters/AttributionControl\";\nexport { LogoControl } from \"./MLAdapters/LogoControl\";\nexport { ScaleControl } from \"./MLAdapters/ScaleControl\";\nexport { FullscreenControl } from \"./MLAdapters/FullscreenControl\";\nexport { TerrainControl } from \"./MLAdapters/TerrainControl\";\nexport { BoxZoomHandler } from \"./MLAdapters/BoxZoomHandler\";\nexport { ScrollZoomHandler } from \"./MLAdapters/ScrollZoomHandler\";\nexport { CooperativeGesturesHandler } from \"./MLAdapters/CooperativeGesturesHandler\";\nexport { KeyboardHandler } from \"./MLAdapters/KeyboardHandler\";\nexport { TwoFingersTouchPitchHandler } from \"./MLAdapters/TwoFingersTouchPitchHandler\";\nexport { MapWheelEvent } from \"./MLAdapters/MapWheelEvent\";\nexport { MapTouchEvent } from \"./MLAdapters/MapTouchEvent\";\nexport { MapMouseEvent } from \"./MLAdapters/MapMouseEvent\";\n\n// types changed to internal since MapLibre 5.7.0\nexport * from \"./ml-types\";\n\n// SDK specific\nexport { Map, GeolocationType, type MapOptions, type LoadWithTerrainEvent } from \"./Map\";\nexport * from \"./controls\";\nexport {\n type AutomaticStaticMapOptions,\n type BoundedStaticMapOptions,\n type BufferToPixelDataFunction,\n type ByIdGeocodingOptions,\n type CenteredStaticMapOptions,\n type CommonForwardAndReverseGeocodingOptions,\n type CoordinateExport,\n type CoordinateGrid,\n type CoordinateId,\n type CoordinateSearch,\n type CoordinateSearchResult,\n type CoordinateTransformResult,\n type CoordinateTransformation,\n type Coordinates,\n type CoordinatesSearchOptions,\n type CoordinatesTransformOptions,\n type DefaultTransformation,\n type ElevationAtOptions,\n type ElevationBatchOptions,\n type FeatureHierarchy,\n type FetchFunction,\n type GeocodingFeature,\n type GeocodingOptions,\n type GeocodingSearchResult,\n type GeolocationInfoOptions,\n type GeolocationResult,\n type GetDataOptions,\n type LanguageGeocodingOptions,\n MapStyle,\n type MapStylePreset,\n type MapStyleType,\n MapStyleVariant,\n type PixelData,\n ReferenceMapStyle,\n type ReverseGeocodingOptions,\n ServiceError,\n type StaticMapBaseOptions,\n type StaticMapMarker,\n type TileJSON,\n type XYZ,\n bufferToPixelDataBrowser,\n circumferenceAtLatitude,\n coordinates,\n data,\n elevation,\n expandMapStyle,\n geocoding,\n geolocation,\n getBufferToPixelDataParser,\n getTileCache,\n mapStylePresetList,\n math,\n misc,\n staticMaps,\n styleToStyle,\n type LanguageInfo,\n areSameLanguages,\n toLanguageInfo,\n isLanguageInfo,\n getAutoLanguage,\n getLanguageInfoFromFlag,\n getLanguageInfoFromCode,\n getLanguageInfoFromKey,\n canParsePixelData,\n} from \"@maptiler/client\";\nexport * from \"./ImageViewer\";\nexport { getWebGLSupportError, displayWebGLContextLostWarning } from \"./tools\";\nexport { config, SdkConfig } from \"./config\";\nexport * from \"./language\";\nexport type { Unit } from \"./types\";\nexport * from \"./converters\";\nexport * as helpers from \"./helpers\";\nexport type * from \"./helpers\";\nexport * from \"./custom-layers/index\";\nexport { ColorRamp, ColorRampCollection } from \"./ColorRamp\";\nexport type { RgbaColor, ColorStop, ArrayColor, ArrayColorRampStop, ArrayColorRamp, ColorRampOptions } from \"./ColorRamp\";\nexport * from \"./utils\";\n"],"names":["Marker$1","maplibregl","map","Popup","Style","options","CanvasSource","GeoJSONSource","ImageSource","RasterTileSource","RasterDEMTileSource","VectorTileSource","VideoSource","NavigationControl","GeolocateControl","AttributionControl","LogoControl","ScaleControl","FullscreenControl","TerrainControl","BoxZoomHandler","ScrollZoomHandler","triggerRenderFrame","CooperativeGesturesHandler","KeyboardHandler","TwoFingersTouchPitchHandler","MapWheelEvent","type","originalEvent","MapTouchEvent","MapMouseEvent","data","Language","LanguageFromClient","getBrowserLanguage","code","langInfo","getLanguageInfoFromCode","l","li","defaults","MAPTILER_SESSION_ID","uuidv4","SdkConfig","EventEmitter","__publicField","u","k","clientConfig","f","config","MaptilerLogoControl","anchor","LOCAL_CACHE_PROTOCOL_SOURCE","LOCAL_CACHE_PROTOCOL_DATA","LOCAL_CACHE_NAME","CACHE_LIMIT_ITEMS","CACHE_LIMIT_CHECK_INTERVAL","CACHE_API_AVAILABLE","addProtocol","localCacheTransformRequest","reqUrl","resourceType","cacheInstance","getCache","cachePutCounter","limitCache","cache","keys","toPurge","key","registerLocalCacheProtocol","params","abortController","requestInit","response","json","url","cacheableUrl","cacheKey","fetchableUrl","fetchUrl","respond","cacheMatch","bindAll","fns","context","fn","maptilerCloudTransformRequest","combineTransformRequest","userDefinedRTF","rp","rp2","generateRandomString","isUUID","s","jsonParseNoThrow","doc","getWebGLSupportError","displayNoWebGlWarning","container","webglError","actualContainer","errorMessageDiv","displayWebGLContextLostWarning","isGetNameLanguage","subExpr","localized","changeFirstLanguage","origExpr","replacer","expr","exploreNode","checkNamePattern","str","regex","replaceLanguage","origLang","newLang","elementsToConcat","item","i","findLanguageStr","languageUsed","match","language","_a","isGetNameLanguageAndFind","findLanguageObj","result","computeLabelsLocalizationMetrics","layers","languages","genericLayer","layer","id","layout","textFieldLayoutProp","flatLanguages","localizationMetrics","lang","$version","$root","sources","source","source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image","layout_background","layout_fill","layout_circle","layout_heatmap","layout_line","layout_symbol","layout_raster","layout_hillshade","filter","filter_operator","geometry_type","function_stop","expression$1","light","sky","terrain","projection","paint","paint_fill","paint_line","paint_circle","paint_heatmap","paint_symbol","paint_raster","paint_hillshade","paint_background","transition","promoteId","v8Spec","ValidationError","value","message","identifier","extendBy","output","inputs","input","ExpressionParsingError","Scope","parent","bindings","name","expression","NullType","NumberType","StringType","BooleanType","ColorType","ProjectionDefinitionType","ObjectType","ValueType","ErrorType","CollatorType","FormattedType","PaddingType","ColorArrayType","NumberArrayType","ResolvedImageType","VariableAnchorOffsetCollectionType","array","itemType","N","typeToString","valueMemberTypes","checkSubtype","expected","t","memberType","isValidType","provided","allowedTypes","isValidNativeType","verifyType","sample","Xn","Yn","Zn","t0","t1","t2","t3","deg2rad","rad2deg","constrainAngle","angle","rgbToLab","g","b","alpha","rgb2xyz","x","z","y","xyz2lab","labToRgb","a","lab2xyz","xyz2rgb","rgbToHcl","rgbColor","c","hclToRgb","h","hslToRgb","n","hasOwnProperty","object","getOwn","parseCssColor","namedColorsMatch","namedColors","r","step","parseHex","rgbRegExp","rgbMatch","_","f1","gp","f2","bp","f3","ap","argFormat","valFormat","maxValue","rgba","clamp","parseAlpha","validateNumbers","hslRegExp","hslMatch","hsla","hex","asPercentage","min","max","interpolateNumber","from","to","interpolateArray","d","Color","premultiplied","getterKey","lazyValue","spaceKey","hue0","chroma0","light0","alphaF","hue1","chroma1","light1","alphaT","hue","chroma","dh","Collator","caseSensitive","diacriticSensitive","locale","lhs","rhs","VERTICAL_ALIGN_OPTIONS","FormattedSection","text","image","scale","fontStack","textColor","verticalAlign","Formatted","sections","unformatted","section","Padding","values","val","NumberArray","ColorArray","parsed_val","colors","RuntimeError","anchors","VariableAnchorOffsetCollection","anchorValue","offsetValue","fromValues","toValues","fx","fy","tx","ty","ResolvedImage","ProjectionDefinition","validateRGBA","isValue","mixed","typeOf","length","valueToString","Literal","args","types$1","Assertion","parsed","ctx","arg","types","Coercion","error","pad","coll","num","geometryTypes","EvaluationContext","cached","ParsingContext","registry","isConstantFunc","path","expectedType","scope","errors","part","index","annotate","typeAnnotation","op","Expr","actual","ec","e","Let","binding","Var","boundExpression","At","In","needle","haystack","IndexOf","fromIndex","rawIndex","Match","inputType","outputType","cases","outputs","otherwise","labels","labelContext","label","out","Case","branches","test","Slice","beginIndex","endIndex","findStopLessThanOrEqualTo","stops","lastIndex","lowerIndex","upperIndex","currentIndex","currentValue","nextValue","Step","labelKey","valueKey","stopCount","getDefaultExportFromCjs","unitbezier","hasRequiredUnitbezier","requireUnitbezier","UnitBezier","p1x","p1y","p2x","p2y","epsilon","x2","d2","unitbezierExports","Interpolate","operator","interpolation","lower","upper","exponentialInterpolation","rest","base","controlPoints","outputLower","outputUpper","lowerValue","upperValue","difference","progress","Coalesce","parsedArgs","argCount","requestedImageName","isComparableType","eq","neq","lt","gt","lteq","gteq","eqCollate","neqCollate","ltCollate","gtCollate","lteqCollate","gteqCollate","makeComparison","compareBasic","compareWithCollator","isOrderComparison","Comparison","collator","rt","Equals","NotEquals","LessThan","GreaterThan","LessThanOrEqual","GreaterThanOrEqual","CollatorExpression","NumberFormat","number","currency","minFractionDigits","maxFractionDigits","FormatExpression","firstArg","nextTokenMayBeObject","font","lastExpression","content","kind","evaluateSection","evaluatedContent","ImageExpression","evaluatedImageName","Length","EXTENT","getTileCoordinates","p","canonical","mercatorXfromLng","mercatorYfromLat","tilesAtZoom","getLngLatFromTileCoord","coord","lngFromMercatorXfromLng","latFromMercatorY","lng","mercatorX","lat","mercatorY","updateBBox","bbox","boxWithinBox","bbox1","bbox2","rayIntersect","p1","p2","pointOnBoundary","x1","y1","y2","segmentIntersectSegment","vectorP","vectorQ","perp","twoSided","lineIntersectPolygon","polygon","ring","j","pointWithinPolygon","point","rings","trueIfOnBoundary","inside","pointWithinPolygons","polygons","lineStringWithinPolygon","line","lineStringWithinPolygons","v1","v2","q1","q2","x3","y3","det1","det2","getTilePolygon","coordinates","getTilePolygons","updatePoint","polyBBox","worldSize","halfWorldSize","shift","resetBBox","getTilePoints","geometry","pointBBox","shifts","tilePoints","points","getTileLines","lineBBox","tileLines","tileLine","pointsWithinPolygons","polygonGeometry","tilePolygon","tilePolygons","linesWithinPolygons","Within","geojson","geometries","polygonsCoords","multipolygonWrapper","TinyQueue","compare","top","bottom","pos","current","halfLength","bestChild","right","classifyRings","maxRings","ccw","area","calculateSignedArea","sum","len","RE","FE","E2","RAD","CheapRuler","m","coslat","w2","w","dx","dy","minDist","minX","minY","minI","minT","sqDist","deg","MinPointsSize","MinLinePointsSize","compareDistPair","getRangeSize","range","isRangeSafe","threshold","splitRange","isLine","size","size1","getBBox","coords","getPolygonBBox","isValidBBox","bboxToBBoxDistance","ruler","pointToLineDistance","nearestPoint","segmentToSegmentDistance","dist1","dist2","lineToLineDistance","line1","range1","line2","range2","dist","pointsToPointsDistance","points1","points2","pointToPolygonDistance","front","back","lineToPolygonDistance","polygonIntersect","poly1","poly2","polygonToPolygonDistance","polygon1","polygon2","currentMiniDist","ring1","len1","ring2","len2","updateQueue","distQueue","miniDist","rangeA","tempDist","updateQueueTwoSets","pointSet1","pointSet2","pointsToPolygonDistance","distPair","newRangesA","pointSetToPointSetDistance","isLine1","isLine2","rangeB","threshold1","threshold2","sublibe","newRangesB","pointToGeometryDistance","pointPosition","lineStringToGeometryDistance","linePositions","polygonToGeometryDistance","toSimpleGeometry","lineString","Distance","feature","GlobalState","globalState","expressions$1","CompoundExpression","evaluate","definition","availableOverloads","overloads","signature","signatureContext","isExpressionConstant","argParseFailed","signatures","stringifySignature","actualTypes","definitions","has","obj","get","v","binarySearch","varargs","isSupportedScript","isTypeAnnotation","childrenConstant","child","isFeatureConstant","isGlobalPropertyConstant","isStateConstant","properties","success","supportsPropertyExpression","spec","supportsZoomExpression","supportsInterpolation","getType","isFunction$1","StyleExpression","propertySpec","getDefaultValue","globals","featureState","availableImages","formattedSection","addGlobalState","isExpression","createExpression","parser","getExpectedType","ZoomConstantExpression","findGlobalStateRefs","ZoomDependentExpression","zoomStops","interpolationType","createPropertyExpression","expressionInput","isFeatureConstantResult","isZoomConstant","zoomCurve","findZoomCurve","childResult","results","childExpression","zoom","heatmapDensity","elevation","lineProgress","accumulated","isExpressionFilter","validateConstants","constants","unbundle","deepUnbundle","unbundledValue","validateObject","elementSpecs","elementValidators","style","styleSpec","validateSpec","objectKey","elementSpecKey","elementSpec","validateElement","validateArray","arraySpec","validateArrayElement","arrayElementSpec","validateNumber","valueSpec","validateFunction","functionValueSpec","functionType","stopKeyType","stopDomainValues","previousStopDomainValue","previousStopDomainZoom","isZoomFunction","isPropertyFunction","isZoomAndPropertyFunction","validateFunctionStops","validateFunctionDefault","validateFunctionStop","validateStopDomainValue","stop","reportValue","validateExpression","expressionObj","validateBoolean","validateColor","validateEnum","validateFilter","validateNonExpressionFilter","validateProperty","propertyType","propertyKey","layerSpec","transitionMatch","tokenMatch","validatePaintProperty","validateLayoutProperty","validateLayer","ref","layerId","otherLayer","sourceType","validateString","validateRasterDEMSource","sourceName","rasterDEM","rasterDEMSpec","rootType","isCustomEncoding","customEncodingKeys","encodingName","objectElementValidators","validatePromoteId","validateSource","prop","mapExpr","reduceExpr","validateLight","lightSpec","validateSky","skySpec","validateTerrain","terrainSpec","validateFormatted","validateImage","validatePadding","validateNumberArray","validateColorArray","validateVariableAnchorOffsetCollection","validateSprite","sprite","allSpriteIds","allSpriteURLs","pairSpec","validateProjection","projectionSpec","validateProjectionDefinition","isProjectionDefinitionValue","isPropertyValueSpecification","isObjectLiteral","anything","validateState","VALIDATORS","validate","validateGlyphsUrl","validateStyleMin","sortErrors","wrapCleanErrors","injectValidateSpec","validator","inner","styleToStyle","MapStyle","mapStylePresetList","styleValidationReport","convertStringToStyleSpecification","urlToAbsoluteUrl","expandMapStyle","MapStyleVariant","ReferenceMapStyle","styleObj","styleErrs","DOMcreate","tagName","className","el","DOMremove","node","MaptilerTerrainControl","toggleTerrain","MaptilerNavigationControl","pitch","rotate","button","Marker","LngLat","LngLatBounds","MaptilerGeolocateControl","position","center","radius","currentMapZoom","hasFittingBeenDisrupted","flagFittingDisruption","supported","title","event","fromResize","movingDistance","lastKnownLocation","projectedLocation","metersPerPixel","circleDiameter","MaptilerCustomControl","selectorOrElement","onClick","onRender","__privateAdd","_map","_element","_onClickFn","_onRenderFn","_originalParent","element","__privateSet","__privateGet","MaptilerProjectionControl","toggleProjection","controlCallbacks","MaptilerExternalControl","controlElement","controlType","_groupItemEvents","elementRef","onClickFn","Minimap","mapOptions","_Minimap_instances","_options","_parentMap","_container","_parentRect","_differentStyle","_desync","__privateMethod","setParentBounds_fn","beforeId","minzoom","maxzoom","glyphsUrl","parentMap","SDKMap","addParentRect_fn","syncMaps_fn","rect","devicePixelRatio","canvas","width","height","unproject","northWest","northEast","southWest","southEast","pitchAdjust","parentCallback","sync","minimapCallback","on","off","which","bearing","Telemetry","delay","endpointURL","version","viewerType","telemetryUrl","getVersion","ARRAY_TYPE","create","glMatrix.ARRAY_TYPE","set","m00","m01","m02","m03","m10","m11","m12","m13","m20","m21","m22","m23","m30","m31","m32","m33","multiply","a00","a01","a02","a03","a10","a11","a12","a13","a20","a21","a22","a23","a30","a31","a32","a33","b0","b1","b2","b3","rotateX","rad","rotateY","rotateZ","perspectiveNO","fovy","aspect","near","far","nf","perspective","normalize","cross","ax","ay","az","bx","by","bz","vec","stride","offset","count","colorName","cssKeywords","require$$0","reverseKeywords","convert","conversions","model","channels","rgb","delta","rdif","gdif","bdif","diff","diffc","comparativeDistance","reversed","currentClosestDistance","currentClosestKeyword","keyword","distance","xyz","hsl","smin","lmin","sv","hsv","hi","q","vmin","sl","hwb","wh","bl","ratio","cmyk","lab","z2","lch","hr","saturation","ansi","color","mult","rem","string","colorString","char","integer","grayscale","hcg","pure","mg","apple","gray","buildGraph","graph","models","deriveBFS","fromModel","queue","adjacents","adjacent","link","wrapConversion","toModel","cur","route","conversion","require$$1","wrapRaw","wrappedFn","arg0","wrapRounded","routes","colorConvert","loadShader","gl","shader","createShaderProgram","vertexShaderSource","fragmentShaderSource","vertexShader","fragmentShader","shaderProgram","getUniformLocation","program","location","createObject3D","attributesKeys","uniformsKeys","vertices","indices","attributesLocations","acc","uniformsLocations","positionBuffer","indexBuffer","indexBufferLength","parseColorStringToVec4","parsedColor","colorToRgbOrHex","isHexColor","hasAlphaChannel","colorAsArray","rgbArray","hw","hh","hd","frontFace","backFace","topFace","bottomFace","rightFace","leftFace","VERTICES","INDICES","vertexShaderSource$1","fragmentShaderSource$1","CubemapImagesPresets","cubemapPresets","CubemapFaceNames","memoizedTextures","deleteMemoizedTexture","tex","memoizedImages","facesKey","loadCubemapTexture","faces","onReady","forceRefresh","texture","numFaces","imageLoadingPromises","face","resolve","reject","keyEnum","handleLoad","imagesAndFaceKeys","internalFormat","format","glCubemapTarget","getGlCubemapTarget","imageElements","lerpVec4","lerp","orderObjectKeys","entries","SPACE_IMAGES_BASE_URL","ATTRIBUTES_KEYS","UNIFORMS_KEYS","GL_USE_TEXTURE_MACRO_MARKER","GL_USE_TEXTURE_MACRO","defaultConstructorOptions","configureOptions","inputOptions","validateSpaceSpecification","outputOptions","presetName","CubemapLayer","cubemapConfig","getCubemapFaces","facesNeedUpdate","uniformKey","_gl","animateColorChange","animateIn","animateOut","active","transform","fov","projectionMatrix","mat4.create","mat4.perspective","mat4.rotateZ","mat4.rotateX","latRad","lngRad","mat4.rotateY","modelViewMatrix","newSpec","currentSpec","orderedNewSpec","orderedCurrentSpec","cubemap","preset","space","baseUrl","HALO_MAX_DISTANCE","defaultStops","defaultScale","DELTA_CHANGE","RadialGradientLayer","gradient","validateHaloSpecification","animate","positionLocation","scaleMatrix","mat4.scale","matrix","mat4.multiply","matrixLocation","rotationMatrix","cameraPos","forward","vec3.normalize","vec3.create","up","vec3.fromValues","vec3.cross","billboardUp","mat4.set","rotationMatrixLocation","stopsNumber","stopsArray","colorsArray","validKeys","halo","additionalKeys","logSDKVersion","purpleCSS","yellowCSS","redCSS","GeolocationType","Map$1","Map","requiresUrlMonitoring","isFallback","hashPreConstructor","attributionControlOptions","superOptions","applyFallbackStyle","warning","cleanUrl","clearnUrlStr","providedlanguage","toLanguageInfo","_e","ipLocatedCameraHash","tileJsonContent","possibleSources","styleUrl","groupSelector","controlSelector","getControlType","getPosition","groupElements","controlElements","limitingSelector","groupElement","control","setStyleProps","logoURL","scaleControl","unit","loadEventTriggered","terrainEventTriggered","terrainEventData","minimap","apiKey","maptilerLogo","canvasContextAttributes","refreshExpiredTiles","maxBounds","scrollZoom","minZoom","maxZoom","boxZoom","fadeDuration","crossSourceCollisions","clickTolerance","bounds","fitBoundsOptions","pixelRatio","validateStyle","terrainCallback","evt","firstLayer","updateOptions","_b","spaceSpecIsValid","_c","before","_d","maptiler","beforeIndex","spaceOptionsFromStyleSpec","haloOptionsFromStyleSpec","layersOrder","insertBeforeIndex","insertBefore","cameraOptions","styleInfo","oldStyle","newStyle","setSpaceAndHaloFromStyle","handleStyleLoad","targetBeforeLayer","getLanguageInfoFromFlag","styleLanguage","languageNonStyle","langStr","firstPassOnStyle","labelsLocalizationMetrics","contains","exactMatch","newReplacer","exaggeration","startTime","currentExaggeration","deltaExaggeration","updateExaggeration","positionInLoop","exaggerationFactor","newExaggeration","dataEventTerrainGrow","addTerrain","checkSourceAndAddTerrain","cb","ipGeolocateResult","geolocation","hashBin","Base64","transformRequest","ImageViewerEvent","viewer","BASE_MAP_EVENT_TYPES","ERROR_EVENTS","RESIZE_EVENTS","WEBGL_CONTEXT_EVENTS","CAMERA_EVENTS","UI_EVENTS","COOPERATIVE_GESTURE_EVENTS","DATA_EVENTS","IMAGE_VIEWER_EVENT_TYPES","FORBIDDEN_EVENT_VALUES","setupGlobalMapEventForwarder","lngLatToPx","eventType","uiEventName","px","imageMetadata","cameraEventName","errorEventName","resizeEventName","webglContextEventName","dataEventName","cooperativeGestureEventName","baseMapEventName","FetchError","resource","module","MAX_VALID_LATITUDE","unprojectFromWorldCoordinates","MercatorCoordinate","zoomScale","scaleZoom","wrap","projectToWorldCoordinates","lnglat","Point","overpanningUnderzoomingTransformConstrain","lngLat","lngRange","latRange","almost180","maxY","maxX","scaleY","scaleX","screenWidth","screenHeight","underzoom","originalX","originalY","modifiedX","modifiedY","lngOverpan","latOverpan","overpan","latUnderzoomMinimumPan","lngUnderzoomMinimumPan","lngPanScale","latPanScale","h2","wrappedX","newPoint","anchorTranslate","monkeyPatchMarkerInstanceToRemoveWrapping","marker","update","isFullyLoaded","rotation","ImageViewerFitImageToBoundsControl","imageViewer","internalSpan","lngLatToPxInternalSymbolKey","pxToLngLatInternalSymbolKey","Evented","MaplibreGL","overrideOptions","imageViewerDefaultOptions","ImageViewer","imageViewerConstructorOptions","sdkOptions","imageUUID","debug","initCenter","previousCenter","ease","tl","br","cameraForBounds","buildImageMetadataURL","buildImageTilesURL","ceilToPow2","nw","se","msg","merc","eventData","centerLngLat","boundsPx","bound","tlLngLat","brLngLat","listeners","listener","metadata","uuid","getAPIBasePath","MapLibreGL","ImageViewerMarker","markerOptions","setupMarkerEventForwarder","mapInstance","draggable","opacity","opacityWhenCovered","pitchAlignment","popup","rotationAlignment","subpixelPositioning","MARKER_EVENT_TYPES","ImageViewerMarkerEvent","mapLibreMarker","imageViewerMarker","str2xml","hasChildNodeWithName","nodeName","childNode","currentNodeName","xml2str","gpx","actualDoc","tracks","waypoints","gj","track","getTrack","getRoute","waypoint","getPoint","kml","xml2string","styleIndex","styleByHash","styleMapIndex","placemarks","styles","styleMaps","hash","okhash","attr","styleMap","pairs","pairsMap","pair","nodeVal","get1","placemark","getPlacemark","kmlColor","validV","gxCoord","numarray","gxCoords","root","elems","times","elem","timeElems","timeElem","getGeometry","geotypes","geomNode","geomNodes","geoms","coordTimes","coord1","geomsAndTimes","address","description","timeSpan","timeStamp","extendedData","visibility","lineStyle","polyStyle","iconStyle","icon","href","begin","end","linestyles","polystyles","pcolor","popacity","fill","outline","datas","simpleDatas","getPoints","pointname","pts","heartRates","ptsLength","cPair","coordPair","segments","getProperties","getLineStyle","getMulti","extensions","links","attrf","norm","ys","o","ll","ele","heartRate","time","gpxOrKml","takeScreenshot","download","blob","getMapScreenshotBlob","filename","colorPalettes","getRandomColor","generateRandomSourceName","generateRandomLayerName","lerpZoomNumberValues","znv","zoomRange","normalizedDistanceFromLowerBound","paintColorOptionsToPaintSpec","rampedOptionsToLayerPaintSpec","ramp","computeRampedOutlineWidth","lineWidth","outlineWidth","allStops","rampedPropertyValueWeight","property","dashArrayMaker","pattern","startTrimmedPattern","fixedPattern","patternArr","dashArray","previous","colorDrivenByProperty","radiusDrivenByProperty","zoomCompensation","radiusDrivenByPropertyHeatmap","opacityDrivenByProperty","colorramp","heatmapIntensityFromColorRamp","colorRamp","steps","unitStep","componentToHex","rgbToHex","ColorRamp","cr","cs","clone","currentMin","currentSpan","newSpan","newValue","colorBefore","valueBefore","valueAfter","colorAfter","beforeRatio","chan","imageData","imageDataArray","startValue","valueStep","method","samples","inputBounds","inputNormalized","ColorRampCollection","addPolyline","fetchOptions","gpxStr","kmlStr","tmpData","addGeoJSONPolyline","sourceId","returnedInfo","lineColor","lineOpacity","lineBlur","lineGapWidth","lineDashArray","outlineColor","outlineOpacity","outlineBlur","outlineLayerId","addPolygon","outlineDashArray","fillColor","fillOpacity","outlinePosition","addLayers","patternImageId","computedOutlineOffset","err","addPoint","minPointRadius","maxPointRadius","cluster","nbDefaultDataDrivenStyleSteps","colorRampBounds","showLabel","alignOnViewport","pointOpacity","clusterStyle","pointColor","pointRadius","dataDrivenStyle","labelColor","labelSize","addHeatmap","crBounds","intensity","propertyValueWeight","heatmapWeight","defaultRadiusZoomRamping","radiusHeatmap","MapMLGL","MarkerMLGL","PopupMLGL","StyleMLGL","CanvasSourceMLGL","GeoJSONSourceMLGL","ImageSourceMLGL","RasterTileSourceMLGL","RasterDEMTileSourceMLGL","VectorTileSourceMLGL","VideoSourceMLGL","NavigationControMLGL","GeolocateControlMLGL","AttributionControlMLGL","LogoControlMLGL","ScaleControlMLGL","FullscreenControlMLGL","TerrainControMLGL","BoxZoomHandlerMLGL","ScrollZoomHandlerMLGL","CooperativeGesturesHandlerMLGL","KeyboardHandlerMLGL","TwoFingersTouchPitchHandlerMLGL","MapWheelEventMLGL","MapTouchEventMLGL","MapMouseEventMLGL","configMLGL","getMapLibreVersion","setRTLTextPlugin","getRTLTextPluginStatus","AJAXError","prewarm","clearPrewarmedResources","Hash","EdgeInsets","DragRotateHandler","DragPanHandler","TwoFingersTouchZoomRotateHandler","DoubleClickZoomHandler","TwoFingersTouchZoomHandler","TwoFingersTouchRotateHandler","getWorkerCount","setWorkerCount","getMaxParallelImageRequests","setMaxParallelImageRequests","getWorkerUrl","setWorkerUrl","addSourceType","importScriptInWorkers","removeProtocol"],"mappings":";;;;;;;;;;;;;AAQO,IAAAA,KAAA,cAAqBC,EAAW,OAAO;AAAA,EAC5C,MAAMC,GAA6B;AACjC,WAAO,MAAM,MAAMA,CAAc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